Forum

qbismSuper8 alpha 061410 released

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Postby mankrip » Sun Sep 05, 2010 10:59 pm

A kinda old thread that I didn't see before.

This is really cool, I'll take a look on it.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Postby mrmmaclean » Mon Sep 06, 2010 5:09 am

Well, I take back my apology then! 8)

This is pretty much a copy and paste from the qbism forum (which sadly doesn't get too much action) but I have a (possibly very newby) question: How do I use a skybox in this port???

In the Flash version, I put the 6 pcx files in gfx/env of pak0.pak and all I get from "loadsky <filename>" is "Couldn't load". I tried using "r_skyname <filename>" (only the main name, not the suffixes), and then "loadsky <filename>" (without quotes and angle brackets, of course) but the sky just goes black...

In the windows version, it simply crashes.

I was digging around in the source and comparing it to proquake for reference (I made a mini project of porting the ver 4.51 to Flash to learn some of the guts of the engine) and noticed that "svc_skybox" is commented out in qbismSuper8. Simply uncommenting that and tweaking some odds and ends didn't seem to help... what am I missing here?
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby mankrip » Mon Sep 06, 2010 9:49 am

Use this PAK file, and type loadsky des_ in the console.

I got this skybox from Ajay's Bulldog Stadium mod, resized to 512x512, converted with dithering to Quake's 8-bit pallete and saved it as PCX files.

The underline character in their filenames isn't a requirement, I just used it in the names of these files to make them easier to read.

Anyway, adding console parameter autocompletion for skyboxes should help.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Postby mrmmaclean » Mon Sep 06, 2010 9:23 pm

Still the same result, sadly. "Couldn't load" in the Flash trace and simply crashing the Windows version.

I did the same with some of the Kothic skyboxes, applying the quake palette and converting to pcx (shortening filenames when necessary just in case).
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby mrmmaclean » Tue Sep 14, 2010 2:44 am

Solved! I simply replaced:
Code: Select all
sprintf (pathname, (const char *)sizeof(pathname), "gfx/env/%s%s.pcx\0", skyname, suf[r_skysideimage[i]]);


in r_sky.c with this:
Code: Select all
snprintf (pathname, sizeof(pathname), "gfx/env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);


Seems to work fine and hopefully won't break anything! Thanks to referencing ProQuake 4.51 once again.
edit: seems that was the method used in Makaqu source as well. I wonder why qbism changed it?
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby Sajt » Tue Sep 14, 2010 6:30 pm

mrmmaclean wrote:
Code: Select all
sprintf (pathname, (const char *)sizeof(pathname), "gfx/env/%s%s.pcx\0", skyname, suf[r_skysideimage[i]]);


:shock:
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby mrmmaclean » Tue Sep 14, 2010 7:52 pm

My thoughts exactly. Basically, the (const char *) is needed to stop Adobe Alchemy from throwing a warning but makes the function just not work... doesn't sound like a good trade off to me.
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby qbism » Wed Sep 15, 2010 12:50 am

I think const char * was a partial misguided attempt to fix the issue. sprintf should not have the size argument at all. snprintf should, but it's C++, undefined when I compile Windows version. What it REALLY should be is Q_snprintfz
Code: Select all
Q_snprintfz (pathname, sizeof(pathname), "gfx/env/%s%s.pcx\0", skyname, suf[r_skysideimage[i]]);


Yeah, and I should check qbism site occaisionally :)
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Postby mrmmaclean » Wed Sep 15, 2010 1:13 am

qbism wrote:What it REALLY should be is Q_snprintfz
Code: Select all
Q_snprintfz (pathname, sizeof(pathname), "gfx/env/%s%s.pcx\0", skyname, suf[r_skysideimage[i]]);


Yeah, and I should check qbism site occaisionally :)


Nice, thanks! I'm pretty new to C/C++ in general and web reference tends to lump them together a lot. Alchemy can compile either as well, so since I'm working primarily with flash I don't notice, FML.

And on checking the site: Real life tends to make things like that kinda tough, so no worries! Thank you for the efforts so far with Super 8, I'm having a blast messing around with it, and thanks to mk for the work on Makaqu and the test skybox. :o
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby Sajt » Wed Sep 15, 2010 9:03 pm

mrmmaclean wrote:My thoughts exactly. Basically, the (const char *) is needed to stop Adobe Alchemy from throwing a warning but makes the function just not work... doesn't sound like a good trade off to me.


The warning was given for a reason, you know... What you did was tell the compiler to just shut up and accept the wrong arguments, which end up as, effectively, undefined garbage (an integer passed as a string address, for example)! You have to tread lightly around the C language sometimes... (and the error/warning messages are not always helpful to those who aren't already familiar with how to "interpret" them)
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby mrmmaclean » Wed Sep 15, 2010 11:43 pm

Sajt wrote:The warning was given for a reason, you know... What you did was tell the compiler to just shut up and accept the wrong arguments, which end up as, effectively, undefined garbage (an integer passed as a string address, for example)!


I'm not sure if this is directed towards me since the (const char *) was in the qbismSuper8 source code and not my own.

That's why it was so hard to find the problem. The compiler was happy so I had to chase keyword finds through the source to get what was up.

That's when I found qbism's self proclaimed "misguided" solution. REMOVING that type declaration popped out a compiler warning, so that's when I used the sndprintf method instead. As a fix rather than just sending safe garbage. Though I wasn't aware that sndprintf was C++ rather than C. qbism came back to provide the C equivalent of my solution!

edit: spelling
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby Baker » Thu Sep 16, 2010 2:33 am

snprintf isn't C++, it's C. It just isn't part of the ISO C-99 spec that some versions of Microsoft Visual Studio use [or maybe it isn't and Microsoft varies from the spec]; it has long been totally supported by gcc --- and as "FlashQuake" uses a gcc variant ... well ... [As Spike has noted, the MSVC 6.0 version of "_snprintf" does not null terminate strings ...]

Note: Q_snprintfz null terminates strings (adds the null character terminator, character 0 to the end), so doing a "\0" is entirely redundant. The "z" in "Q_snprintfz means that it null terminates it).
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby mrmmaclean » Thu Sep 16, 2010 2:39 am

Ahhh, gotcha. Thanks Baker. I still have yet soooo much to learn!
User avatar
mrmmaclean
 
Posts: 33
Joined: Sun Aug 22, 2010 2:49 am

Postby Baker » Thu Sep 16, 2010 2:41 am

mrmmaclean wrote:Ahhh, gotcha. Thanks Baker. I still have yet soooo much to learn!


Who doesn't? I still have a lot to learn.

The main characteristic of gaining experience is figuring out the massive set of things you do not know. Believe me, I know what I don't know.

There is something to be said of knowing what you don't know; the word is "competence".
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby qbism » Thu Sep 16, 2010 4:49 pm

Baker wrote:The "z" in "Q_snprintfz means that it null terminates it).
I did not know that.

If I read it correctly MicroSoft's _snprintf does not guarantee null termintation as gcc's snprintf does. http://msdn.microsoft.com/en-us/library/2ts7cx93.aspx
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

PreviousNext

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest