| May 10, 2026, 04:37 PM | |
|
jjPAL(...).load(): possibly false positive detection of no GIF global color table?
Save this as a mutator and test on a local server. Pay attention to chatlogger for angelscript warnings.
Code:
// Reference: https://en.wikipedia.org/wiki/GIF#Example_GIF_file
// Reference: https://giflib.sourceforge.net/whatsinagif/bits_and_bytes.html
bool hasGlobalColorTable(string filename) {
jjSTREAM dat(filename);
if (dat.getSize() < 13) {
return false;
}
string magic;
dat.get(magic, 6);
if (magic != "GIF89a") {
return false;
}
dat.discard(2); // discard logical screen width
dat.discard(2); // discard logical screen height
uint8 gctFlags;
dat.pop(gctFlags);
if (gctFlags & 0x80 != 0) { // "the highest true bit means that the GCT is present"
return true;
}
return false;
}
void onLevelBegin() {
jjConsole("Test GIFs by typing a filename in chat");
}
bool onLocalChat(string &in stringReceived, CHAT::Type) {
bool res1 = jjPAL().load(stringReceived);
bool res2 = hasGlobalColorTable(stringReceived);
if (res1 != res2) {
jjAlert("jjPAL().load(...) != hasGlobalColorTable(...)");
jjAlert(" " + res1 + " != " + res2);
}
return true;
}
|
| May 10, 2026, 09:21 PM | |
|
Let's quote the relevant documentation here:
API: "an 8-bit globally-paletted GIF" Chatlog: "does not define a global 256 color palette" So JJ2+ is detecting that your GIF files have color tables, just not color tables that it's excited to work with. Specifically:
|
| May 11, 2026, 01:34 AM | ||
|
Quote:
If it's too niche of a use case to be worth padding other colors with jjPALCOLOR(0,0,0,0) I can just continue analyzing gifs using jjSTREAM to do what I desire. |
||
| May 11, 2026, 07:54 AM | |
|
I would rather say that the last case makes the most sense: the expected use case of loading a palette from a GIF is to display all the frames in that GIF (after loading them using jjANIMATION::load). In the last case, you can't do that, because different frames have different palettes. So maybe there needs to be an overload (or whatever) of jjANIMATION::load that imports the GIF frames as 32-bit (well, 24-bit really) sprites instead.
For the other cases, padding would probably be possible, though I'm leaving in that "probably" because I haven't taken a close enough look at our GIF library yet to know how it handles those cases. |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -8. The time now is 11:27 PM.
Jazz2Online © 1999-INFINITY (Site Credits). Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats. Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Original site design by Ovi Demetrian. DrJones is the puppet master. Eat your lima beans, Johnny.




