Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Freeport | Loon | Battle | N/A |
const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, WeaponVMega::Boomerang::Weapon(), null, null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "xlmfreeport-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "xlmfreeport-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmfreeport-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "xlmfreeport.j2l" ///@MLLE-Generated
#include "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "WeaponVMega1.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -battle ///@MLLE-Generated
#pragma require "rain9.wav"
#pragma require "lightning2.wav"
#include "limitedoxygen.asc"
int sample, time = 0;
int lightningDelay = 90;
float lightningOffset = 0;
bool lightning, playOnceL, playOnceR = false;
bool isSnowing = true;
bool createFish = true;
array<OBJECT::Object> fishObjects = {
OBJECT::APPLE, //0,
OBJECT::BANANA, //1
OBJECT::BURGER, //2
OBJECT::CAKE, //3
OBJECT::CANDY, //4
OBJECT::CHERRY, //5
OBJECT::CUPCAKE, //6
OBJECT::DONUT, //7
OBJECT::FRIES, //8
OBJECT::GRAPES, //9
OBJECT::HAM, //10
OBJECT::THING //11
};
array<uint> fishToSpawn = {
2,3,4,1,2,2,1,7,3,1,2,1
};
int waterHeight = 100*32;
void setWaterProperties() {
jjSetWaterLevel(waterHeight,true);
}
void onLevelReload() {
MLLE::ReapplyPalette();
MLLE::SpawnOffgridsLocal();
}
void onLevelLoad() {
jjUseLayer8Speeds = true;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 48, 16, 88});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 17.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 27.45f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.0f, false);
jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
jjObjectPresets[OBJECT::BOMBCRATE].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[OBJECT::BOMBCRATE].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[OBJECT::BOMBCRATE].behavior = DarkCrate;
jjObjectPresets[OBJECT::STEADYLIGHT].behavior = Light();
jjDelayGeneratedCrateOrigins = true;
jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
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] = 76;
else if (y > 16 && y <= 24) rain[x,y] = 75;
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;
}
for (uint i = 0; i < fishObjects.length(); i++) {
jjObjectPresets[fishObjects[i]].behavior = AmbientFish();
jjObjectPresets[fishObjects[i]].special = i;
}
jjAnimSets[ANIM::FISH].load();
jjObjectPresets[OBJECT::WEENIE].behavior = AmbientFish();
jjObjectPresets[OBJECT::LEMON].behavior = FishSpawner();
jjObjectPresets[OBJECT::LEMON].playerHandling = HANDLING::PARTICLE;
jjObjectPresets[OBJECT::LEMON].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[OBJECT::LEMON].isBlastable = false;
generateFishSprites(jjAnimSets[ANIM::CUSTOM[1]]);
colorFishSprites(0, array<uint> = {32, 80, 48});
colorFishSprites(1, array<uint> = {16, 40, 88});
colorFishSprites(2, array<uint> = {24, 72, 40});
colorFishSprites(3, array<uint> = {31, 56, 80});
colorFishSprites(4, array<uint> = {40, 32, 48});
colorFishSprites(5, array<uint> = {88, 32, 16});
colorFishSprites(6, array<uint> = {72, 24, 40});
colorFishSprites(7, array<uint> = {71, 64, 48});
colorFishSprites(8, array<uint> = {48, 32, 88});
colorFishSprites(10, array<uint> = {80, 16, 56});
colorFishSprites(11, array<uint> = {56, 56, 56});
}
void onMain() {
jjWeapons[WEAPON::TNT].comesFromGunCrates = true;
jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
if (jjGameTicks == 210)
jjConsole("|You can use the following command to enable/disable fish: ||!fish on / !fish off");
if (!jjLowDetail) {
sample = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::WIND_WIND2A, sample, 24, 0);
}
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ obj = jjObjects[i];
if (obj.eventID == OBJECT::TOASTERPOWERUP){
obj.xPos = obj.xOrg + 16;
}
if (obj.eventID == OBJECT::BOUNCERPOWERUP){
obj.xPos = obj.xOrg + 16;
}
}
array<jjLAYER@> layers = jjLayerOrderGet();
layers[21].yOffset = waterHeight - jjWaterLevel;
layers[25].xOffset += .15f;
layers[25].xOffset += .2f;
jjIsSnowing = !jjLowDetail;
for (int i = 0; i < 1024; i++) {
jjPARTICLE@ particle = jjParticles[i];
if (particle.type == PARTICLE::RAIN) {
particle.xSpeed = 0;
particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed);
if (jjTileGet(6, int(particle.xPos/32), int(particle.yPos/32)) != 0) {
particle.type = PARTICLE::INACTIVE;
}
}
}
}
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 onLevelBegin() {
MLLE::SpawnOffgrids();
jjSampleLoad(SOUND::WIND_WIND2A, "rain9.wav");
jjSampleLoad(SOUND::BILSBOSS_THUNDER, "lightning2.wav");
water::maxOxygen = 1500;
uint a, b, c, d;
jjLocalPlayers[0].furGet(a, b, c, d);
switch (jjLocalPlayers[0].charCurr) {
case CHAR::JAZZ:
colorFishSprites(11, array<uint> = {a, b, d});
break;
case CHAR::SPAZ:
colorFishSprites(11, array<uint> = {b, d, c});
break;
case CHAR::LORI:
colorFishSprites(11, array<uint> = {d, a, c});
break;
default:
colorFishSprites(11, array<uint> = {a, b, c});
break;
}
jjANIMATION@ animDopefish = jjAnimations[jjObjectPresets[OBJECT::WEENIE].curAnim];
animDopefish.frameCount = 1;
jjANIMFRAME@ frameDopefish = jjAnimFrames[animDopefish.firstFrame];
jjPIXELMAP dopefish(114*32, 95*32, 32, 32, 4);
dopefish.save(frameDopefish);
frameDopefish.hotSpotX = -frameDopefish.width / 2;
frameDopefish.hotSpotY = -frameDopefish.height / 2;
for (int i = 1; i < 255; i++) {
jjOBJ@ preset = jjObjectPresets[i];
if (preset.playerHandling == HANDLING::PICKUP) {
preset.behavior = CannotBeShotDown(preset.behavior);
}
}
}
void onPlayer(jjPLAYER@ play) {
array<jjLAYER@> layers = jjLayerOrderGet();
const int lightningLayer = layers.length - 3;
layers[lightningLayer].xOffset = lightningOffset;
if (jjGameTicks == 1) layers[lightningLayer].hasTiles = false;
if (!jjLowDetail) {
if (lightning && lightningDelay > 0) lightningDelay--;
if (jjGameTicks % 1000 >= 940 && jjGameTicks % 1000 <= 979) {
if (jjGameTicks % 5 == 0) {
layers[lightningLayer].hasTiles = true;
play.lighting = 145;
}
else {
layers[lightningLayer].hasTiles = false;
play.lighting = 125;
}
if (jjGameTicks % 18 == 0) lightningOffset = jjRandom()%800;
}
if (jjGameTicks % 1000 >= 980) {
lightning = true;
lightningDelay = 90;
}
if (lightningDelay < 90) {
play.lighting = 78;
}
if (lightning && lightningDelay == 0) {
for (int i = 0; i < 2; i++) {
jjSample(play.xPos, play.yPos, SOUND::BILSBOSS_THUNDER, 41 + jjRandom()%22, 0);
}
lightning = false;
lightningDelay = 90;
}
} else {
play.lighting = 78;
layers[lightningLayer].hasTiles = false;
}
jjEnforceLighting = jjLowDetail? LIGHT::OPTIONAL : LIGHT::COMPLETE;
play.lightType = LIGHT::NONE;
handleFastCustomSpringSpeeds(play);
water::limitedOxygen(play);
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
return MLLE::WeaponHook.drawAmmo(player, canvas);
}
void DarkCrate(jjOBJ@ obj) {
obj.behave(BEHAVIOR::CRATE, false);
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BRIGHTNESS, 40);
}
void generateFishSprites(jjANIMSET@ anim) {
uint srcSet = jjAnimSets[ANIM::FISH];
anim.allocate(array<uint>(fishObjects.length(), 6));
for (uint i = 0; i < fishObjects.length(); i++) {
uint srcAnim = jjAnimations[srcSet + 1];
uint destAnim = jjAnimations[anim + i];
for (int j = 0; j < 6; j++) {
jjPIXELMAP image(jjAnimFrames[destAnim + j] = jjAnimFrames[srcAnim + j]);
image.save(jjAnimFrames[destAnim + j]);
}
}
}
void colorFishSprites(uint src, const array<uint> &in colors) {
int length = colors.length();
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::CUSTOM[1]] + src];
for (int i = 0; i < 6; i++) {
jjPIXELMAP image(jjAnimFrames[anim + i]);
int width = image.width;
int height = image.height;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pixel = image[x, y];
if (pixel >= 32 && pixel < 40) {
image[x, y] = colors[0] + (pixel & 7);
}
if (pixel >= 80 && pixel < 88) {
image[x, y] = colors[1] + (pixel & 7);
}
if (pixel >= 48 && pixel < 56) {
image[x, y] = colors[2] + (pixel & 7);
}
}
image.save(jjAnimFrames[anim + i]);
}
}
}
class AmbientFish : jjBEHAVIORINTERFACE {
float size, xOffset, yOffset;
bool cosine;
void onBehave(jjOBJ@ obj) {
switch (obj.eventID) {
case OBJECT::APPLE:
obj.xSpeed = 1;
obj.ySpeed = 60;
size = 1;
xOffset = 48;
yOffset = 24;
cosine = true;
break;
case OBJECT::BANANA:
obj.xSpeed = 1.25;
obj.ySpeed = 80;
size = 0.85;
xOffset = 24;
yOffset = 16;
cosine = false;
break;
case OBJECT::BURGER:
obj.xSpeed = 1.5;
obj.ySpeed = 15;
size = 0.75;
xOffset = 48;
yOffset = 24;
cosine = true;
break;
case OBJECT::CAKE:
obj.xSpeed = 0.75;
obj.ySpeed = 25;
size = 0.9;
xOffset = 48;
yOffset = 24;
cosine = false;
break;
case OBJECT::CANDY:
obj.xSpeed = 1.2;
obj.ySpeed = 100;
size = 0.8;
xOffset = 48;
yOffset = 24;
cosine = true;
break;
case OBJECT::CHERRY:
obj.xSpeed = 1.25;
obj.ySpeed = 70;
size = 0.75;
xOffset = 48;
yOffset = 24;
cosine = false;
break;
case OBJECT::CUPCAKE:
obj.xSpeed = 0.45;
obj.ySpeed = 15;
size = 0.9;
xOffset = 88;
yOffset = 64;
cosine = true;
break;
case OBJECT::DONUT:
obj.xSpeed = 2.5;
obj.ySpeed = 140;
size = 0.5;
xOffset = 16;
yOffset = 8;
cosine = true;
break;
case OBJECT::FRIES:
obj.xSpeed = 0.9;
obj.ySpeed = 75;
size = 1;
xOffset = 48;
yOffset = 24;
cosine = true;
break;
case OBJECT::GRAPES:
obj.xSpeed = 1;
obj.ySpeed = 60;
size = 0.7;
xOffset = 48;
yOffset = 24;
cosine = false;
break;
case OBJECT::HAM:
obj.xSpeed = 0.9;
obj.ySpeed = 50;
size = 1.1;
xOffset = 56;
yOffset = 32;
cosine = true;
break;
case OBJECT::THING:
obj.xSpeed = 0.5;
obj.ySpeed = 10;
size = 1.1;
xOffset = 0;
yOffset = 0;
cosine = false;
obj.lightType = LIGHT::LASER;
obj.light = 15;
break;
case OBJECT::WEENIE:
obj.xSpeed = 0.5;
obj.ySpeed = 30;
size = 1;
xOffset = 0;
yOffset = 0;
cosine = false;
break;
}
if (jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::PATH) {
obj.direction *= -1;
}
if (obj.counter == 0) {
obj.xPos = obj.xPos + (jjRandom()%2 == 0? xOffset:-xOffset);
obj.yPos = obj.yPos + (jjRandom()%2 == 0? yOffset:-yOffset);
if (jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::PATH) {
obj.delete();
}
obj.direction = jjRandom()%2 == 0? 1:-1;
obj.age = jjRandom()%6;
obj.counter = 1;
}
obj.xPos = obj.xPos + (obj.age * 0.15 * obj.direction) + (obj.xSpeed * obj.direction);
obj.bulletHandling = HANDLING::IGNOREBULLET;
obj.playerHandling = HANDLING::PARTICLE;
obj.deactivates = obj.triggersTNT = obj.isTarget = obj.isBlastable = obj.isFreezable = false;
if (!inView(obj) || !createFish) {
obj.delete();
}
}
void onDraw(jjOBJ@ obj) {
if (!jjLowDetail && createFish && inView(obj)) {
jjDrawResizedSprite(
int(obj.xPos),
int(obj.yPos + (cosine? jjCos(jjGameTicks) * obj.ySpeed : jjSin(jjGameTicks) * obj.ySpeed)),
obj.eventID == OBJECT::WEENIE? ANIM::PICKUPS : ANIM::CUSTOM[1],
obj.eventID == OBJECT::WEENIE? 91 : obj.special,
jjGameTicks / 10 % 6,
size * obj.direction * (obj.eventID == OBJECT::WEENIE? -1:1),
size,
obj.eventID == OBJECT::THING || obj.eventID == OBJECT::WEENIE || jjColorDepth == 8? SPRITE::NORMAL : SPRITE::TINTED,
152,
10,
10
);
}
}
}
bool inView(const jjOBJ@ obj) {
for (int i = 0; i < jjLocalPlayerCount; i++) {
const jjPLAYER@ play = jjLocalPlayers[i];
if (obj.xPos > play.cameraX - 512 && obj.yPos > play.cameraY - 256 && obj.xPos < play.cameraX + jjSubscreenWidth + 512 && obj.yPos < play.cameraY + jjSubscreenHeight + 256)
return true;
}
return false;
}
class FishSpawner : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (obj.state == STATE::START && inView(obj) && createFish) {
if (jjRandom()%400 == 0) {
spawnFish(obj, (jjRandom()%4 == 0? OBJECT::WEENIE : OBJECT::THING), 1);
} else {
uint rand = jjRandom()%(fishObjects.length() - 1);
if (rand == 6) {
if (jjRandom()% 2 == 0) spawnFish(obj, fishObjects[rand], fishToSpawn[rand]);
} else {
spawnFish(obj, fishObjects[rand], fishToSpawn[rand]);
}
obj.state = STATE::DONE;
}
}
if (!inView(obj) || !createFish) {
obj.state = STATE::START;
}
}
void spawnFish(jjOBJ@ obj, OBJECT::Object fishEvent, uint num) {
for (uint i = 0; i < num; i++) {
uint randX = int(obj.xPos - 192) + ((jjRandom()%32)*12);
uint randY = int(obj.yPos - 64 + ((jjRandom()%32)*4));
if (jjEventGet((randX/32), (randY/32)) != AREA::PATH) {
jjOBJ@ fish = jjObjects[jjAddObject(fishEvent, randX, randY, obj.creatorID, CREATOR::OBJECT)];
}
}
}
}
class Light : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::STEADYLIGHT);
obj.lightType = (jjGameTicks % 1000 >= 940 && jjGameTicks % 1000 <= 979) || (lightning && lightningDelay >= 90)? LIGHT::NONE : LIGHT::NORMAL;
}
}
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;
}
bool onDrawHealth(jjPLAYER@ play, jjCANVAS@ canvas) {
water::drawOxygenTimer(play, canvas);
return false;
}
bool onLocalChat(string &in text, CHAT::Type type) {
if (type == CHAT::NORMAL && text == "!fish on") {
if (!createFish) createFish = true;
jjAlert("|||Fish have been |||||ENABLED");
return true;
}
else if (type == CHAT::NORMAL && text == "!fish off") {
if (createFish) createFish = false;
jjAlert("|||Fish have been ||||||DISABLED");
return true;
}
else return false;
}
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.