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 "ab22btl03.j2l" ///@MLLE-Generated
#pragma require "SEenergyblast.asc"
#pragma require "SEfirework.asc"
#pragma require "SEroller.asc"
#include "SEenergyblast.asc"
#include "SEfirework.asc"
#include "SEroller.asc"
#pragma require "Nail.j2a"
#pragma require "f_ar3.wav"
#pragma require "BubbleGun.j2a"
bool gameIsActive() {
return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}
jjANIMSET@ customSpringSprite;
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();
}
se::DefaultWeaponHook weaponHook;
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
return weaponHook.drawAmmo(player, canvas);
}
void onMain() {
weaponHook.processMain();
}
void onPlayer(jjPLAYER@ player) {
weaponHook.processPlayer(player);
}
void onPlayerInput(jjPLAYER@ player) {
if (player.yPos > jjWaterLevel && player.currWeapon == 4)
player.keyFire = false;
weaponHook.processPlayerInput(player);
}
void onReceive(jjSTREAM &in packet, int clientID) {
weaponHook.processPacket(packet, clientID);
}
void onLevelLoad() {
jjWaterLighting = WATERLIGHT::GLOBAL;
jjSetWaterLevel(61*32, true);
se::firework.loadAnims(jjAnimSets[ANIM::CUSTOM[0]]);
se::firework.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BOEM1, SOUND::INTRO_BOEM2});
se::firework.setAsWeapon(6, weaponHook);
se::energyBlast.loadAnims(jjAnimSets[ANIM::CUSTOM[1]]);
se::energyBlast.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BLOW});
se::energyBlast.setAsWeapon(4, weaponHook);
se::roller.loadAnims(jjAnimSets[ANIM::CUSTOM[2]]);
se::roller.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_END});
se::roller.setAsWeapon(2, weaponHook);
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[3]], array<uint> = {40});
turnIntoCustomSpring(jjObjectPresets[OBJECT::GREENSPRING], 0, 19.f, false);
jjObjectPresets[OBJECT::SEEKERAMMO3].behavior = StaticPickup(jjObjectPresets[OBJECT::SEEKERAMMO3].behavior);
jjObjectPresets[OBJECT::CARROT].behavior = StaticPickup(jjObjectPresets[OBJECT::CARROT].behavior);
jjAnimSets[ANIM::CUSTOM[40]].load(0, "BubbleGun.j2a");
jjAnimSets[ANIM::CUSTOM[41]].load(1, "BubbleGun.j2a");
jjAnimSets[ANIM::CUSTOM[42]].load(2, "BubbleGun.j2a");
jjAnimations[jjAnimSets[ANIM::AMMO] + 29] = jjAnimations[jjAnimSets[ANIM::AMMO] + 8];
jjAnimations[jjAnimSets[ANIM::AMMO] + 28] = jjAnimations[jjAnimSets[ANIM::CUSTOM[40]] + 0];
jjObjectPresets[OBJECT::ICEBULLET].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::AMMO, 8);
jjObjectPresets[OBJECT::ICEBULLET].behavior = BubbleGun;
jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 1.5;
jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 105;
jjObjectPresets[OBJECT::ICEBULLET].var[6] = 0;
jjObjectPresets[OBJECT::ICEBULLET].freeze = 0;
jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::BLASTERBULLET].lightType;
jjObjectPresets[OBJECT::ICEBULLETPU].special = jjObjectPresets[OBJECT::ICEBULLETPU].determineCurAnim(ANIM::CUSTOM[40], 0);
jjObjectPresets[OBJECT::ICEBULLETPU].behavior = BubbleGunPU;
jjObjectPresets[OBJECT::ICEBULLETPU].xSpeed = 2;
jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = 105;
jjObjectPresets[OBJECT::ICEBULLETPU].var[6] = 8;
jjObjectPresets[OBJECT::ICEBULLETPU].freeze = 0;
jjObjectPresets[OBJECT::ICEBULLETPU].lightType = jjObjectPresets[OBJECT::BLASTERBULLET].lightType;
jjObjectPresets[OBJECT::ICEPOWERUP].determineCurAnim(ANIM::CUSTOM[41], 0, true);
jjObjectPresets[OBJECT::ICEPOWERUP].determineCurFrame();
jjWeapons[WEAPON::ICE].spread = SPREAD::NORMAL;
jjWeapons[WEAPON::ICE].defaultSample = false;
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 82];
for (uint i = 0; i < anim.frameCount; ++i) {
jjANIMFRAME@ frame = jjAnimFrames[anim + 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] != 15)
sprite[x, y] += 33;
}
}
sprite.save(frame);
}
jjAnimSets[ANIM::CUSTOM[25]].load(0, "Nail.j2a");
jjAnimations[jjAnimSets[ANIM::AMMO] + 49] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 4];
jjAnimations[jjAnimSets[ANIM::AMMO] + 48] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 5];
jjSampleLoad(SOUND::WIND_WIND2A, "f_ar3.wav");
jjObjectPresets[OBJECT::RFBULLET].behavior = jjObjectPresets[OBJECT::RFBULLETPU].behavior = Nailgun();
jjObjectPresets[OBJECT::RFBULLET].var[6] = 16;
jjObjectPresets[OBJECT::RFBULLET].counterEnd = 60;
jjObjectPresets[OBJECT::RFBULLET].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
jjObjectPresets[OBJECT::RFBULLET].special = jjObjectPresets[OBJECT::RFBULLET].determineCurAnim(ANIM::CUSTOM[25], 0);
jjObjectPresets[OBJECT::RFBULLETPU].var[6] = 8 + 16;
jjObjectPresets[OBJECT::RFBULLETPU].counterEnd = 55;
jjObjectPresets[OBJECT::RFBULLETPU].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
jjObjectPresets[OBJECT::RFBULLETPU].special = jjObjectPresets[OBJECT::RFBULLETPU].determineCurAnim(ANIM::CUSTOM[25], 1);
jjObjectPresets[OBJECT::RFBULLET].lightType = jjObjectPresets[OBJECT::RFBULLETPU].lightType = LIGHT::POINT;
jjObjectPresets[OBJECT::RFAMMO3].lightType = LIGHT::POINT;
jjObjectPresets[OBJECT::RFAMMO15].determineCurAnim(ANIM::CUSTOM[25], 2);
jjObjectPresets[OBJECT::RFAMMO15].determineCurFrame();
jjObjectPresets[OBJECT::RFPOWERUP].determineCurAnim(ANIM::CUSTOM[25], 3);
jjObjectPresets[OBJECT::RFPOWERUP].determineCurFrame();
jjWeapons[WEAPON::RF].spread = SPREAD::NORMAL;
jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
jjWeapons[WEAPON::RF].defaultSample = false;
jjANIMATION@ anim2 = jjAnimations[jjAnimSets[ANIM::AMMO] + 71];
for (uint i = 0; i < anim2.frameCount; ++i) {
jjANIMFRAME@ frame2 = jjAnimFrames[anim2 + i];
jjPIXELMAP sprite2(frame2);
for (uint x = 0; x < sprite2.width; ++x)
for (uint y = 0; y < sprite2.height; ++y)
if (sprite2[x,y] != 0) sprite2[x,y] = 0;
sprite2.save(frame2);
}
for (int i = 0; i < 2; i++) {
auto@ frame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::GRASSPLAT] + i]];
jjPIXELMAP image(frame);
for (uint j = 0; j < image.height; j++) {
for (uint k = 0; k < image.width; k++) {
uint8 color = image[k, j];
if (color >= 16 && color < 24)
image[k, j] = color | 128;
}
}
image.save(frame);
}
}
void onLevelBegin() {
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::CUSTOM[10]] + 4];
for (uint i = 0; i < anim.frameCount; ++i) {
jjANIMFRAME@ frame = jjAnimFrames[anim + i];
jjPIXELMAP sprite(frame);
for (uint x = 0; x < sprite.width; ++x)
for (uint y = 0; y < sprite.height; ++y)
if (sprite[x,y] < 8 && x <= 16 && y >= 2) sprite[x,y] = 71;
sprite.save(frame);
}
}
void BubbleGun(jjOBJ@ bubble) {
if (bubble.state == STATE::START) {
bubble.state = STATE::FLY;
jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
}
if (jjMaskedPixel(int(bubble.xPos) + int(bubble.xSpeed), int(bubble.yPos)) || jjMaskedPixel(int(bubble.xPos) - int(bubble.xSpeed), int(bubble.yPos)) || jjMaskedPixel(int(bubble.xPos), int(bubble.yPos) + int(bubble.ySpeed)) || jjMaskedPixel(int(bubble.xPos), int(bubble.yPos) - int(bubble.ySpeed))) {
jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
}
bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
}
void BubbleGunPU(jjOBJ@ bubble) {
if (bubble.state == STATE::START) {
bubble.state = STATE::FLY;
jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
}
if (jjMaskedPixel(int(bubble.xPos) + int(bubble.xSpeed), int(bubble.yPos)) || jjMaskedPixel(int(bubble.xPos) - int(bubble.xSpeed), int(bubble.yPos)) || jjMaskedPixel(int(bubble.xPos), int(bubble.yPos) + int(bubble.ySpeed)) || jjMaskedPixel(int(bubble.xPos), int(bubble.yPos) - int(bubble.ySpeed))) {
jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
}
bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
if (bubble.state == STATE::FLY && bubble.counter > 0) {
switch (bubble.direction) {
case 1: bubble.xSpeed = bubble.xSpeed - 0.08; bubble.ySpeed = bubble.ySpeed - 0.08; break;
case -1: bubble.xSpeed = bubble.xSpeed + 0.08; bubble.ySpeed = bubble.ySpeed - 0.08; break;
}
}
bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
}
class Nailgun : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) override {
obj.behave(obj.state == STATE::EXPLODE? BEHAVIOR::BULLET : BEHAVIOR::RFBULLET, obj.state == STATE::EXPLODE? true:false);
jjPLAYER@ creator = jjPlayers[obj.creatorID];
obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
obj.xAcc = (obj.eventID == OBJECT::RFBULLETPU? 0.4:0.35) * obj.direction;
if (obj.ySpeed < 0 && obj.direction == 0 && obj.xSpeed == 0) obj.yAcc = -0.5;
if (obj.state != STATE::EXPLODE) {
if (obj.counter == 1 && creator.isLocal) {
jjSample(creator.xPos, creator.yPos, SOUND::WIND_WIND2A, 48, obj.eventID == OBJECT::RFBULLETPU? 19000:17500);
obj.var[2] = 0;
obj.playerHandling = HANDLING::PLAYERBULLET;
}
jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[25], obj.eventID == OBJECT::RFBULLETPU? 1:0, 0, obj.var[0], 1, 1, SPRITE::NORMAL);
if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
obj.xSpeed = 0;
obj.var[7] = 0;
obj.playerHandling = HANDLING::PARTICLE;
obj.bePlatform(obj.xPos, obj.yPos, 48, 8);
if (obj.var[2] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
obj.counter = 1;
if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
obj.var[2] = 1;
}
}
else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
obj.ySpeed = 0;
obj.playerHandling = HANDLING::PARTICLE;
if (obj.var[2] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
obj.counter = 1;
if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
obj.var[2] = 1;
}
}
} else {
obj.clearPlatform();
obj.var[2] = 0;
obj.counterEnd = obj.eventID == OBJECT::RFBULLETPU? 55:60;
}
}
}
class StaticPickup : jjBEHAVIORINTERFACE {
StaticPickup(const jjBEHAVIOR &in behavior) {
originalBehavior = behavior;
}
void onBehave(jjOBJ@ obj) override {
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;
}
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.