Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 22 levels | Jazz2Online | Multiple | N/A |
const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "ab22ctf18-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab22ctf18-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "IC - Diamondus1.j2t" ///@MLLE-Generated
#pragma require "Castle2.j2t" ///@MLLE-Generated
#pragma require "ab22ctf18.j2l" ///@MLLE-Generated
bool updateClients = false;
const int treeTimer = 3150;
void onLevelLoad() {
jjUseLayer8Speeds = true;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 64, 88});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 22.25f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 17.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
jjDelayGeneratedCrateOrigins = true;
jjObjectPresets[OBJECT::GUN9POWERUP].direction = -1;
for (int i = 1; i < 255; i++) {
if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP && i != 73) {
jjObjectPresets[i].behavior = CannotBeShotDown(jjObjectPresets[i].behavior);
}
}
jjObjectPresets[OBJECT::SMALLTREE].behavior = SyncWithClients();
}
void onLevelBegin() {
if (!jjIsServer) jjSendPacket(jjSTREAM());
}
class CannotBeShotDown : jjBEHAVIORINTERFACE {
CannotBeShotDown(const jjBEHAVIOR &in behavior) {
originalBehavior = behavior;
}
void onBehave(jjOBJ@ obj) {
obj.behave(originalBehavior);
if (obj.state == STATE::FLOATFALL)
obj.state = STATE::FLOAT;
}
bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
if (bullet is null) {
obj.behavior = originalBehavior;
if (player.objectHit(obj, force, obj.playerHandling))
return true;
obj.behavior = this;
}
return false;
}
private jjBEHAVIOR originalBehavior;
}
class SyncWithClients : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::POLE);
if (obj.state > STATE::SLEEP) {
obj.counter++;
if (obj.counter == treeTimer) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SPLUT);
jjObjects[jjAddObject(OBJECT::SMALLTREE, obj.xOrg, obj.yOrg)];
obj.clearPlatform();
obj.delete();
}
}
}
void onSetActive(jjOBJ@, bool) {}
}
void onReceive(jjSTREAM &in packet, int clientID) {
int state, rotationalAcceleration, angle, rotationalSpeed, hit, count;
if (!jjIsServer) {
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ obj = jjObjects[i];
if (obj.eventID == OBJECT::SMALLTREE) {
packet.pop(state);
packet.pop(rotationalAcceleration);
packet.pop(angle);
packet.pop(rotationalSpeed);
packet.pop(hit);
packet.pop(count);
obj.state = state;
obj.var[1] = rotationalAcceleration;
obj.var[2] = angle;
obj.var[3] = rotationalSpeed;
obj.noHit = hit;
obj.counter = count;
}
}
} else {
updateClients = true;
}
}
void onMain() {
jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
array<jjLAYER@> layers = jjLayerOrderGet();
jjSTREAM packet;
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ obj = jjObjects[i];
if ((obj.eventID == OBJECT::GUN9POWERUP) && (obj.behavior == BEHAVIOR::MONITOR)) {
obj.xPos = obj.xOrg + 16;
}
if (obj.eventID == OBJECT::SMALLTREE && jjIsServer) {
packet.push(int(obj.state));
packet.push(int(obj.var[1]));
packet.push(int(obj.var[2]));
packet.push(int(obj.var[3]));
packet.push(int(obj.noHit));
packet.push(int(obj.counter));
}
}
if (updateClients) {
jjSendPacket(packet);
updateClients = false;
}
}
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.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@ play) {
if (play.ySpeed < -32.f) {
fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
} else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
if (play.ySpeed < -31.f) {
fastCustomSpringSpeeds[play.localPlayerID]--;
play.ySpeed = -32.f;
} else {
fastCustomSpringSpeeds[play.localPlayerID] = 0;
}
}
}
void onPlayer(jjPLAYER@ player) {
handleFastCustomSpringSpeeds(player);
}
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.