Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 21 Levels | Jazz2Online | Multiple | N/A |
#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "IC - Jungrock1.j2t"
#pragma require "Carrot1N.j2t"
#pragma require "SwampsN.j2t"
#pragma require "ab21btl15.j2l"
#pragma require "ab21btl15.j2as"
#pragma require "SEenergyblast.asc"
#pragma require "SEfirework.asc"
#include "SEenergyblast.asc"
#include "SEfirework.asc"
#pragma require "Nail.j2a"
#pragma require "f_ar3.wav"
#pragma require "LaserBlaster.j2a"
#pragma require "f_laser1.wav"
#pragma require "f_laser2.wav"
#pragma require "f_laser3.wav"
#pragma require "f_laser4.wav"
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() {
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);
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[10]].load(0, "LaserBlaster.j2a");
jjAnimations[jjAnimSets[ANIM::AMMO] + 29] = jjAnimations[jjAnimSets[ANIM::CUSTOM[10]] + 2];
jjAnimations[jjAnimSets[ANIM::AMMO] + 28] = jjAnimations[jjAnimSets[ANIM::CUSTOM[10]] + 3];
jjAnimations[jjAnimSets[ANIM::PICKUPS] + 62] = jjAnimations[jjAnimSets[ANIM::CUSTOM[10]] + 4];
jjObjectPresets[OBJECT::ICEBULLET].behavior = LaserGun;
jjObjectPresets[OBJECT::ICEBULLET].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::CUSTOM[10], 0);
jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 1.5;
jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 125;
jjObjectPresets[OBJECT::ICEBULLET].freeze = 0;
jjObjectPresets[OBJECT::ICEBULLET].eventID = OBJECT::FIREBALLBULLET;
jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
jjObjectPresets[OBJECT::ICEBULLETPU].behavior = LaserGunPU;
jjObjectPresets[OBJECT::ICEBULLETPU].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::CUSTOM[10], 1);
jjObjectPresets[OBJECT::ICEBULLETPU].xSpeed = 2;
jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = 95;
jjObjectPresets[OBJECT::ICEBULLETPU].var[6] = 8;
jjObjectPresets[OBJECT::ICEBULLETPU].freeze = 0;
jjObjectPresets[OBJECT::ICEBULLETPU].eventID = OBJECT::FIREBALLBULLETPU;
jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
jjObjectPresets[OBJECT::ICEPOWERUP].determineCurAnim(ANIM::CUSTOM[10], 4, true);
jjObjectPresets[OBJECT::ICEPOWERUP].determineCurFrame();
jjWeapons[WEAPON::ICE].spread = SPREAD::NORMAL;
jjSampleLoad(SOUND::AMMO_ICEGUN, "f_laser1.wav");
jjSampleLoad(SOUND::AMMO_ICEGUN2, "f_laser2.wav");
jjSampleLoad(SOUND::AMMO_ICEGUNPU, "f_laser2.wav");
jjSampleLoad(SOUND::AMMO_ICEPU1, "f_laser3.wav");
jjSampleLoad(SOUND::AMMO_ICEPU2, "f_laser3.wav");
jjSampleLoad(SOUND::AMMO_ICEPU3, "f_laser4.wav");
jjSampleLoad(SOUND::AMMO_ICEPU4, "f_laser4.wav");
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::P2_CRUNCH, "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 LaserGun(jjOBJ@ obj) {
jjPLAYER@ creator = jjPlayers[obj.creatorID];
if (obj.state == STATE::START) {
obj.state = STATE::FLY;
obj.direction = creator.direction;
}
if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
obj.xSpeed = -obj.xSpeed;
obj.var[7] = -obj.var[7];
obj.xAcc = -obj.xAcc;
obj.ySpeed -= 1.5;
obj.counter -= 5;
if (obj.state == STATE::FLY) randomSample(obj);
}
else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
obj.ySpeed = -obj.ySpeed;
obj.yAcc = -obj.yAcc;
obj.xSpeed -= obj.direction == 1? -1.5:1.5;
obj.counter -= 5;
if (obj.state == STATE::FLY) randomSample(obj);
}
obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
if (obj.state == STATE::FLY) jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[10], 1, 0, obj.var[0], 0.9, 0.9, SPRITE::NORMAL);
obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
}
void LaserGunPU(jjOBJ@ obj) {
jjPLAYER@ creator = jjPlayers[obj.creatorID];
if (obj.state == STATE::START) {
obj.state = STATE::FLY;
obj.direction = creator.direction;
}
if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
obj.xSpeed = -obj.xSpeed;
obj.var[7] = -obj.var[7];
obj.xAcc = -obj.xAcc;
obj.ySpeed -= 3;
obj.counter -= 5;
if (obj.state == STATE::FLY) randomSample(obj);
}
else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
obj.ySpeed = -obj.ySpeed;
obj.yAcc = -obj.yAcc;
obj.xSpeed -= obj.direction == 1? -3:3;
obj.counter -= 5;
if (obj.state == STATE::FLY) randomSample(obj);
}
obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
if (obj.state == STATE::FLY) jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[10], 0, 0, obj.var[0], 1, 1, SPRITE::NORMAL);
obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
}
void randomSample(jjOBJ@ obj) {
switch (jjRandom() % 4) {
case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BUL1, 0, 0); break;
case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL1, 0, 0); break;
case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL2, 0, 0); break;
case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL3, 0, 0); break;
}
}
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::P2_CRUNCH, 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);
float dx = jjLocalPlayers[0].xPos - obj.xPos, dy = jjLocalPlayers[0].yPos - obj.yPos;
if ((dx * dx + dy * dy < 64 * 24) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
jjLocalPlayers[0].xPos = obj.xPos - (24 * obj.direction);
jjLocalPlayers[0].ySpeed = obj.ySpeed;
}
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.