Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 25 Battle | Jazz2Online | Battle | N/A |
const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.6.asc" ///@MLLE-Generated
#pragma require "ab25btl23-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "A_CarrFIXday.j2t" ///@MLLE-Generated
#pragma require "OWMist.j2t" ///@MLLE-Generated
#pragma require "icjungn.j2t" ///@MLLE-Generated
#pragma require "ab25btl23.j2l" ///@MLLE-Generated
#pragma require "rain9.wav"
uint palshift = 0;
uint type = 3;
int showerInterval = 4200;
int showerDuration = 2101;
uint R = 125;
uint G = 220;
uint B = 250;
uint light = 100;
uint tint = 185;
int sample = 0;
void removeSpritePaletteReferences() {
array<int> mapping(256);
for (int i = 1; i < 96; i++) {
jjPALCOLOR color = jjPalette.color[i];
int best = 0x40000;
for (int j = 96; j < 256; j++) {
jjPALCOLOR match = jjPalette.color[j];
int red = int(match.red) - color.red;
int green = int(match.green) - color.green;
int blue = int(match.blue) - color.blue;
int dist = red * red + green * green + blue * blue;
if (dist < best) {
best = dist;
mapping[i] = j;
}
}
}
for (int i = 96; i < 256; i++) {
mapping[i] = i;
}
for (uint i = 1; i < jjTileCount; i++) {
jjPIXELMAP tile(i);
for (int j = 0; j < 32; j++) {
for (int k = 0; k < 32; k++) {
tile[k, j] = mapping[tile[k, j]];
}
}
tile.save(i, true);
}
}
jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
int length = colors.length();
bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
if (success) {
uint srcSet = jjAnimSets[ANIM::SPRING];
for (int i = 0; i < length; i++) {
uint color = colors[i];
uint destAnimOffset = anim + i * 3;
for (int j = 0; j < 3; j++) {
uint srcAnim = jjAnimations[srcSet + j];
uint destAnim = jjAnimations[destAnimOffset + j];
for (int k = 0; k < 5; k++) {
jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
int width = image.width;
int height = image.height;
for (int l = 0; l < height; l++) {
for (int m = 0; m < width; m++) {
int pixel = image[m, l];
if (pixel >= 32 && pixel < 40)
image[m, l] = color + (pixel & 7);
}
}
if (!image.save(jjAnimFrames[destAnim + k]))
return false;
}
}
}
}
return success;
}
void initializeCustomSpring(jjOBJ@ obj) {
int anim = obj.curAnim;
obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
if (obj.curAnim != anim) {
obj.curAnim = anim + 2;
obj.determineCurFrame();
}
obj.draw();
}
void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
if (horizontal) {
obj.xSpeed = power;
obj.ySpeed = 0.f;
} else {
obj.xSpeed = 0.f;
obj.ySpeed = -power;
if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
int x = int(obj.xPos) >> 5;
int y = int(obj.yPos) >> 5;
if (jjParameterGet(x, y, 0, 1) != 0) {
jjParameterSet(x, y, 0, 1, 0);
obj.yPos -= 4.f;
obj.ySpeed = power;
}
}
}
obj.behavior = initializeCustomSpring;
obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
obj.causesRicochet = obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
obj.deactivates = obj.isFreezable = true;
obj.bulletHandling = HANDLING::IGNOREBULLET;
obj.playerHandling = HANDLING::SPECIAL;
obj.lightType = LIGHT::NORMAL;
obj.determineCurFrame();
}
void handleFastCustomSpringSpeeds(jjPLAYER@ player) {
if (player.ySpeed < -32.f) {
fastCustomSpringSpeeds[player.localPlayerID] = int(ceil((player.ySpeed + 32.f) / -0.125f));
} else if (fastCustomSpringSpeeds[player.localPlayerID] != 0) {
if (player.ySpeed < -31.f) {
fastCustomSpringSpeeds[player.localPlayerID]--;
player.ySpeed = -32.f;
} else {
fastCustomSpringSpeeds[player.localPlayerID] = 0;
}
}
}
void onLevelLoad() {
jjUseLayer8Speeds = true;
removeSpritePaletteReferences();
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {64});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 34.f, false);
for (int i = 1; i < 255; i++) {
if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP) {
jjObjectPresets[i].behavior = CannotBeShotDown;
}
}
jjObjectPresets[OBJECT::APPLE].behavior =
jjObjectPresets[OBJECT::BANANA].behavior =
jjObjectPresets[OBJECT::CANDY].behavior =
jjObjectPresets[OBJECT::CHERRY].behavior =
jjObjectPresets[OBJECT::DONUT].behavior =
jjObjectPresets[OBJECT::FRIES].behavior = ColoredMoth;
jjAnimSets[ANIM::MOTH].load();
jjSampleLoad(SOUND::INTRO_BLOW, "rain9.wav");
jjANIMATION@ animBubble = jjAnimations[jjAnimSets[ANIM::COMMON] + 1];
for (uint i = 0; i < animBubble.frameCount; ++i) {
jjANIMFRAME@ frame = jjAnimFrames[animBubble + i];
jjPIXELMAP sprite(frame);
for (uint x = 0; x < sprite.width; ++x)
for (uint y = 0; y < sprite.height; ++y)
if (sprite[x,y] != 0) sprite[x,y] += 115;
sprite.save(frame);
}
jjPIXELMAP rain(32,32);
for (uint x = 0; x < rain.width; ++x) {
for (uint y = 0; y < rain.height; ++y) {
if (x == 16) {
if (y <= 16) rain[x,y] = 74;
else if (y > 16 && y <= 24) rain[x,y] = 73;
else rain[x,y] = 0;
} else {
rain[x,y] = 0;
}
}
}
jjANIMATION@ animRain = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
for (uint frameID = 0; frameID < animRain.frameCount; ++frameID) {
jjANIMFRAME@ frame = jjAnimFrames[animRain.firstFrame + frameID];
rain.save(frame);
frame.hotSpotX = -frame.width/2;
frame.hotSpotY = -frame.height;
}
}
void onLevelBegin() {
jjPAL standard;
standard.load("Diam2.j2t");
jjPalette.copyFrom(16, 40, 16, standard, 1);
jjPalette.copyFrom(59, 37, 59, standard, 1);
jjPalette.apply();
}
void CannotBeShotDown(jjOBJ@ obj) {
obj.behave(BEHAVIOR::PICKUP);
if (obj.state == STATE::FLOATFALL) obj.state = STATE::FLOAT;
}
void ColoredMoth(jjOBJ@ obj) {
switch (obj.eventID) {
case OBJECT::APPLE: palshift = 8; type = 3; break;
case OBJECT::BANANA: palshift = 240; type = 2; break;
case OBJECT::CANDY: palshift = 192; type = 2; break;
case OBJECT::CHERRY: palshift = 240; type = 3; break;
case OBJECT::DONUT: palshift = 248; type = 2; break;
case OBJECT::FRIES: palshift = 224; type = 3; break;
}
jjDrawSprite(obj.xPos, obj.yPos + 6, ANIM::MOTH, type, obj.curFrame, obj.direction, SPRITE::PALSHIFT, palshift);
obj.playerHandling = jjObjectPresets[OBJECT::MOTH].playerHandling;
obj.bulletHandling = jjObjectPresets[OBJECT::MOTH].bulletHandling;
obj.behave(BEHAVIOR::MOTH, false);
}
void onPlayer(jjPLAYER@ player) {
handleFastCustomSpringSpeeds(player);
player.lightType = LIGHT::NONE;
player.lighting = light;
for (int i = 0; i < 1024; i++) {
jjPARTICLE@ particle = jjParticles[i];
if (particle.type == PARTICLE::RAIN) {
particle.xSpeed = 0;
particle.ySpeed = player.ySpeed < 0? 10 : int(10 + player.ySpeed);
}
}
}
void onMain() {
if (showerInterval > 0) showerInterval--;
else if (showerInterval == 0) showerDuration--;
if (showerDuration == 0) {
showerInterval = 4200;
showerDuration = 2101;
}
if (!jjLowDetail) {
jjIsSnowing = showerDuration < 2101? true:false;
if (jjIsSnowing) sample = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::INTRO_BLOW, sample, 0, 0);
if (showerInterval < 280 || showerInterval > 3920 && jjGameTicks > 281) {
if (light > 90) light--;
if (R > 45) R--;
if (G > 140) G--;
if (B > 170) B--;
if (tint < 186) tint++;
}
else {
if (light < 100) light++;
if (R < 125) R++;
if (G < 220) G++;
if (B < 250) B++;
if (tint > 185) tint--;
}
}
else {
jjIsSnowing = false;
light = 100;
R = 125;
G = 220;
B = 250;
}
jjSetFadeColors(R,G,B);
array<jjLAYER@> layers = jjLayerOrderGet();
layers[14].spriteMode = SPRITE::TINTED;
layers[14].spriteParam = tint;
}
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.