qbismSuper8 alpha 061410 released
Moderator: InsideQC Admins
40 posts
• Page 2 of 3 • 1, 2, 3
Well, I take back my apology then!
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?
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?
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2: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.
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.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
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).
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).
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2:49 am
Solved! I simply replaced:
in r_sky.c with this:
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?
- 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?
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2:49 am
mrmmaclean wrote:
- Code: Select all
sprintf (pathname, (const char *)sizeof(pathname), "gfx/env/%s%s.pcx\0", skyname, suf[r_skysideimage[i]]);
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
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.
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2:49 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
Yeah, and I should check qbism site occaisionally
- 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
-
qbism - Posts: 1236
- Joined: Thu Nov 04, 2004 5:51 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.
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2:49 am
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
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
-

mrmmaclean - Posts: 33
- Joined: Sun Aug 22, 2010 2:49 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).
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?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 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?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
I did not know that.Baker wrote:The "z" in "Q_snprintfz means that it null terminates it).
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
-
qbism - Posts: 1236
- Joined: Thu Nov 04, 2004 5:51 am
40 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 1 guest