Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 22 levels | Jazz2Online | Multiple | N/A |
const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {WeaponVMega::Boomerang::Weapon(), null, WeaponVMega::IceCloud::Weapon(), null, null, se::EnergyBlastMLLEWrapper(), null, null, WeaponVMega::Meteor::Weapon()}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ETs Planet1 v3.j2t" ///@MLLE-Generated
#pragma require "ab22ctf10.j2l" ///@MLLE-Generated
#include "WeaponVMega9.asc" ///@MLLE-Generated
#pragma require "WeaponVMega9.asc" ///@MLLE-Generated
#include "SEenergyblast-mlle.asc" ///@MLLE-Generated
#pragma require "SEenergyblast-mlle.asc" ///@MLLE-Generated
#include "WeaponVMega3.asc" ///@MLLE-Generated
#pragma require "WeaponVMega3.asc" ///@MLLE-Generated
#include "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "Nail.j2a"
#pragma require "f_ar3.wav"
funcdef jjPALCOLOR ColorFunction(jjPALCOLOR);
class vector2i {
int x, y;
}
array<vector2i> oneWays;
bool gameIsActive() {
return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}
void darkenLayer(jjLAYER@ layer, array<uint8>& freePaletteIndices, ColorFunction@ func) {
array<int> tileIDs, uniqueTileIDs;
for (int i = 0; i < layer.height; i++) {
for (int j = 0; j < layer.width; j++) {
int tileID = layer.tileGet(j, i) & TILE::RAWRANGE;
if (tileID != 0)
tileIDs.insertLast(tileID);
}
}
int prev = 0;
tileIDs.sortAsc();
for (uint i = 0; i < tileIDs.length(); i++) {
if (tileIDs[i] != prev)
uniqueTileIDs.insertLast(prev = tileIDs[i]);
}
uint firstNewTile = jjTileCount;
jjTilesFromTileset(jjTilesetFileName, 1, uniqueTileIDs.length());
array<uint8> mapping(256);
for (uint i = 0; i < uniqueTileIDs.length(); i++) {
jjPIXELMAP tile(uniqueTileIDs[i]);
for (int j = 0; j < 32; j++) {
for (int k = 0; k < 32; k++) {
uint8 pixel = tile[k, j];
if (pixel != 0) {
if (mapping[pixel] == 0) {
jjPALCOLOR color = func(jjPalette.color[pixel]);
uint8 bestMatch = jjPalette.findNearestColor(color);
if (!freePaletteIndices.isEmpty()) {
jjPALCOLOR other = jjPalette.color[bestMatch];
int red = other.red - color.red;
int green = other.green - color.green;
int blue = other.blue - color.blue;
int distance = red * red + green * green + blue * blue;
if (distance > 16) {
bestMatch = freePaletteIndices[freePaletteIndices.length() - 1];
jjPalette.color[bestMatch] = color;
freePaletteIndices.removeLast();
}
}
mapping[pixel] = bestMatch;
}
tile[k, j] = mapping[pixel];
}
}
}
tile.save(firstNewTile + i, true);
}
layer.generateSettableTileArea();
for (int i = 0; i < layer.height; i++) {
for (int j = 0; j < layer.widthReal; j++) {
int tileID = layer.tileGet(j, i);
int tileFlags = tileID & (TILE::HFLIPPED | TILE::VFLIPPED);
tileID &= TILE::RAWRANGE;
if (tileID != 0)
layer.tileSet(j, i, firstNewTile + uniqueTileIDs.find(tileID) | tileFlags);
}
}
}
void onLevelLoad() {
jjTexturedBGTexture = TEXTURE::WISETYNESS;
jjUseLayer8Speeds = true;
if (jjLayers[1].hasTileMap)
darkenLayer(jjLayers[1], array<uint8>(), function(color) {
color.setHSL(color.getHue(), color.getSat(), color.getLight() * 3 / 5);
return color;
});
jjLayerOrderSet(array<jjLAYER@> = {jjLayers[2], jjLayers[3], jjLayers[4], jjLayers[1], jjLayers[5], jjLayers[6], jjLayers[7], jjLayers[8]});
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@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 71];
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] = 0;
sprite.save(frame);
}
jjAnimSets[ANIM::CUSTOM[26]].load(0, "TornadoGun.j2a");
jjAnimations[jjAnimSets[ANIM::AMMO] + 62] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 3];
jjAnimations[jjAnimSets[ANIM::AMMO] + 61] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 2];
jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = TornadoGun();
jjObjectPresets[OBJECT::FIREBALLBULLET].special = jjObjectPresets[OBJECT::FIREBALLBULLET].determineCurAnim(ANIM::CUSTOM[26], 0);
jjObjectPresets[OBJECT::FIREBALLBULLET].xSpeed = 4;
jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 110;
jjObjectPresets[OBJECT::FIREBALLBULLET].var[6] = 0;
jjObjectPresets[OBJECT::FIREBALLBULLET].freeze = 0;
jjObjectPresets[OBJECT::FIREBALLBULLET].eventID = OBJECT::FIREBALLBULLET;
jjObjectPresets[OBJECT::FIREBALLBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
jjObjectPresets[OBJECT::FIREBALLBULLET].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
jjObjectPresets[OBJECT::FIREBALLBULLET].lightType = LIGHT::POINT;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = TornadoGunPU();
jjObjectPresets[OBJECT::FIREBALLBULLETPU].special = jjObjectPresets[OBJECT::FIREBALLBULLETPU].determineCurAnim(ANIM::CUSTOM[26], 1);
jjObjectPresets[OBJECT::FIREBALLBULLETPU].xSpeed = 6;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd = 120;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].freeze = 0;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].eventID = OBJECT::FIREBALLBULLET;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
jjObjectPresets[OBJECT::GUN8POWERUP].determineCurAnim(ANIM::CUSTOM[26], 4);
jjObjectPresets[OBJECT::GUN8POWERUP].determineCurFrame();
jjWeapons[WEAPON::GUN8].defaultSample = false;
jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
jjWeapons[WEAPON::GUN8].style = WEAPON::NORMAL;
jjWeapons[WEAPON::GUN8].multiplier = 1;
jjWeapons[WEAPON::GUN8].gradualAim = false;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {160, 40});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 40.f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 20.f, 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.causesRicochet = obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
obj.deactivates = obj.isFreezable = true;
obj.eventID = OBJECT::REDSPRING;
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;
}
}
}
class Nailgun : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
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);
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, 32, 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 = 130;
else obj.counterEnd = 105;
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 = 130;
else obj.counterEnd = 105;
obj.var[2] = 1;
}
}
} else {
obj.clearPlatform();
obj.var[2] = 0;
obj.counterEnd = obj.eventID == OBJECT::RFBULLETPU? 55:60;
}
}
}
class TornadoGun : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::BULLET);
jjPLAYER@ creator = jjPlayers[obj.creatorID];
if (obj.state == STATE::FLY) {
if (obj.counter == 1 && creator.isLocal) {
jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 25000);
jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 25000);
}
switch (obj.direction) {
case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
}
float pdx = jjLocalPlayers[0].xPos - obj.xPos, pdy = jjLocalPlayers[0].yPos - obj.yPos;
if ((pdx * pdx + pdy * pdy < 64 * 64) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
jjLocalPlayers[0].ySpeed -= 2.5;
jjLocalPlayers[0].xSpeed += 2.5 * obj.direction;
}
}
if (obj.state == STATE::EXPLODE) {
if (obj.var[0] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
obj.var[0] = 1;
}
}
}
}
class TornadoGunPU : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::BULLET);
jjPLAYER@ creator = jjPlayers[obj.creatorID];
if (obj.state == STATE::FLY) {
if (obj.counter == 1 && creator.isLocal) {
jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 30000);
jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 30000);
}
switch (obj.direction) {
case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
}
float pdx = jjLocalPlayers[0].xPos - obj.xPos, pdy = jjLocalPlayers[0].yPos - obj.yPos;
if ((pdx * pdx + pdy * pdy < 96 * 96) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
jjLocalPlayers[0].ySpeed -= 5;
jjLocalPlayers[0].xSpeed += 5 * obj.direction;
}
}
if (obj.state == STATE::EXPLODE) {
if (obj.var[0] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
obj.var[0] = 1;
}
}
}
}
void onPlayer(jjPLAYER@ player) {
if (jjEventGet(int(player.xPos) >> 5, int(player.yPos) >> 5) == AREA::SUCKERTUBE)
player.alreadyDoubleJumped = false;
handleFastCustomSpringSpeeds(player);
for (uint i = 0; i < oneWays.length(); i++) {
jjEventSet(oneWays[i].x, oneWays[i].y, AREA::ONEWAY);
}
oneWays.resize(0);
int px = int(player.xPos), py = int(player.yPos);
bool masked;
for (int i = -11 + int(player.ySpeed); i <= 14; i++) {
if (masked = jjMaskedHLine(px - 14, 28, py + i))
break;
}
if (!masked) {
for (int i = 8; i <= 16; i += 8) {
for (int j = 12; j <= 20; j += 8) {
int x = (px + player.direction * j) >>> 5, y = (py + i) >>> 5;
if (x >= 0 && y >= 0 && x < jjLayerWidth[4] && y < jjLayerHeight[4] && jjEventGet(x, y) == AREA::ONEWAY) {
vector2i point;
jjEventSet(point.x = x, point.y = y, 0);
oneWays.insertLast(point);
}
}
}
}
}
void onPlayerInput(jjPLAYER@ player) {
MLLE::WeaponHook.processPlayerInput(player);
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
return MLLE::WeaponHook.drawAmmo(player, canvas);
}
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.