Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 18 Levels | Jazz2Online | Multiple | N/A | |||||
Take off and away! V3 | TreyLina | Capture the flag | 8.3 |
const array<array<jjPALCOLOR>> paletteChanges = {
{
jjPALCOLOR(165, 18, 18),
jjPALCOLOR(190, 21, 21),
jjPALCOLOR(226, 25, 25),
jjPALCOLOR(136, 15, 15),
jjPALCOLOR(193, 50, 50),
jjPALCOLOR(111, 12, 12),
jjPALCOLOR(86, 9, 9)
},
{
jjPALCOLOR(23, 79, 255),
jjPALCOLOR(35, 110, 255),
jjPALCOLOR(89, 125, 255),
jjPALCOLOR(0, 72, 255),
jjPALCOLOR(65, 101, 255),
jjPALCOLOR(0, 49, 152),
jjPALCOLOR(0, 23, 47)
}
};
array<jjPAL> teamPalette(17);
uint paletteCurrent = 8, paletteTarget = 8;
array<array<int>> previousTiles(jjLocalPlayerCount, array<int>(2, -1));
void disableControl(jjPLAYER@ player) {
float xPos = player.xPos;
float yPos = player.yPos;
float xSpeed = player.xSpeed;
float ySpeed = player.ySpeed;
jjOBJ@ obj = jjObjects[0];
int state = obj.state;
int var = obj.var[0];
int counter = obj.counter;
obj.state = STATE::ACTION;
obj.var[0] = player.playerID;
obj.behave(BEHAVIOR::EVA, false);
obj.state = state;
obj.var[0] = var;
obj.counter = counter;
player.idle = 0;
player.xPos = xPos;
player.yPos = yPos;
player.xSpeed = xSpeed;
player.ySpeed = ySpeed;
player.keyDown = player.keyFire = player.keyJump = player.keyRun = false;
}
bool isTileSpecialTube(int tile, int &out speed, int &out delay, bool rejectSpeed = true) {
int x = tile & 0xFFFF;
int y = tile >> 16;
return jjEventGet(x, y) == AREA::STOPENEMY && (rejectSpeed || uint(speed = jjParameterGet(x, y, 0, 8)) >= 0 && uint(delay = jjParameterGet(x, y, 8, 8)) >= 0);
}
void coloredSpring(jjOBJ@ obj) {
obj.behave(BEHAVIOR::SPRING, false);
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 216);
}
bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@) {
if (jjLocalPlayerCount == 1 && jjRenderFrame & 3 == 0) {
if (play.xPos > 1920.f && play.yPos < 832.f || play.xPos > 2176.f && play.yPos < 1376.f)
paletteTarget = 0;
else if (play.xPos < 832.f && play.yPos < 832.f || play.xPos < 576.f && play.yPos < 1408.f)
paletteTarget = 16;
else
paletteTarget = 8;
if (paletteCurrent != paletteTarget) {
if (paletteCurrent < paletteTarget)
paletteCurrent++;
else
paletteCurrent--;
teamPalette[paletteCurrent].apply();
}
}
return false;
}
void onLevelLoad() {
jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL; // They made me write this line.
jjOBJ@ preset = jjObjectPresets[OBJECT::FROZENSPRING];
preset.behavior = coloredSpring;
preset.bulletHandling = HANDLING::IGNOREBULLET;
preset.freeze = 0;
preset.ySpeed = -18.f;
for (int i = 0; i < 2; i++) {
jjPAL@ palette = teamPalette[i * 16];
palette = jjPalette;
for (int j = 0; j < 7; j++) {
palette.color[138 + j] = paletteChanges[i][j];
}
}
for (int i = 1; i < 8; i++) {
jjPAL@ palette = teamPalette[i];
palette = teamPalette[0];
palette.copyFrom(138, 6, 138, jjPalette, i / 8.f);
}
teamPalette[8] = jjPalette;
for (int i = 9; i < 16; i++) {
jjPAL@ palette = teamPalette[i];
palette = teamPalette[16];
palette.copyFrom(138, 6, 138, jjPalette, (16 - i) / 8.f);
}
}
void onPlayer(jjPLAYER@ play) {
array<int>@ tileHistory = previousTiles[play.localPlayerID];
int currTile = play.currTile;
if (currTile != tileHistory[0]) {
tileHistory[1] = tileHistory[0];
tileHistory[0] = currTile;
}
if (play.ballTime > 17)
disableControl(play);
int speed, delay;
if (isTileSpecialTube(currTile, speed, delay, false)) {
int dummy, previousTile = tileHistory[1];
play.ballTime = 35;
play.keyDown = play.keyFire = play.keyJump = play.keyRun = false;
play.buttstomp = 121;
if ((dummy = currTile + 1) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
play.xSpeed = speed;
play.ySpeed = 0.f;
play.yPos = currTile >> 16 << 5 | 16;
} else if ((dummy = currTile - 1) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
play.xSpeed = -speed;
play.ySpeed = 0.f;
play.yPos = currTile >> 16 << 5 | 16;
} else if ((dummy = currTile + 0x10000) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
play.xSpeed = 0.f;
play.ySpeed = speed;
play.xPos = (currTile & 0xFFFF) << 5 | 16;
} else if ((dummy = currTile - 0x10000) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
play.xSpeed = 0.f;
play.ySpeed = -speed;
play.xPos = (currTile & 0xFFFF) << 5 | 16;
} else if (abs(play.xSpeed) > abs(play.ySpeed)) {
play.xSpeed = play.xSpeed < 0.f ? -delay : delay;
play.ySpeed = 0.f;
play.yPos = currTile >> 16 << 5 | 16;
} else {
play.xSpeed = 0.f;
play.ySpeed = play.ySpeed < 0.f ? -delay : delay;
play.xPos = (currTile & 0xFFFF) << 5 | 16;
}
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. 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.
Eat your lima beans, Johnny.