Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
![]() |
Anniversary Bash 27 CTF | Jazz2Online | Capture the flag | 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.7w.asc" ///@MLLE-Generated
#pragma require "ab27ctf12-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab27ctf12-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "loonjungle6.j2t" ///@MLLE-Generated
#pragma require "Aztec2.j2t" ///@MLLE-Generated
#pragma require "Lomat.j2t" ///@MLLE-Generated
#pragma require "ab27ctf12.j2l" ///@MLLE-Generated
#include "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "WeaponVMega1.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture ///@MLLE-Generated
#pragma require "spelunky_ignite.wav"
int sampleBoomerang, sampleWind = 0;
void onLevelReload() {
MLLE::SpawnOffgridsLocal();
MLLE::ReapplyPalette();
}
jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
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 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 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 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 onLevelBegin() {
MLLE::SpawnOffgrids();
for (int i = 1; i < 255; i++) {
jjOBJ@ preset = jjObjectPresets[i];
if (preset.playerHandling == HANDLING::PICKUP) {
preset.behavior = CannotBeShotDown(preset.behavior);
}
}
array<uint> BoomerangIDs = {4, 6, 7};
for (uint i = 0; i < BoomerangIDs.length(); i++) {
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + BoomerangIDs[i]];
for (uint j = 0; j < anim.frameCount; j++) {
jjANIMFRAME@ frame = jjAnimFrames[anim + j];
jjPIXELMAP sprite(frame);
for (uint x = (BoomerangIDs[i] == 7? 3 : 0); x < (BoomerangIDs[i] == 7? 16 : sprite.width); ++x) {
for (uint y = (BoomerangIDs[i] == 7? 4 : 0); y < (BoomerangIDs[i] == 7? 20 : sprite.height); ++y) {
if (sprite[x,y] >= 64 && sprite[x,y] <= 71) sprite[x,y] -= 32;
if (sprite[x,y] >= 72 && sprite[x,y] <= 79) sprite[x,y] -= 56;
}
}
sprite.save(frame);
}
}
}
void onLevelLoad() {
jjUseLayer8Speeds = true;
jjObjectPresets[OBJECT::GUNCRATE].behavior = GreyCrate();
jjObjectPresets[OBJECT::FLICKERLIGHT].behavior = torch;
jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {88, 40});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 27.0f, false);
WeaponVMega::Boomerang::BoomerangEdit().Apply(WEAPON::ICE, MLLE::WeaponHook);
jjSampleLoad(SOUND::P2_POEP, "spelunky_ignite.wav");
jjLayers[1].spriteMode = SPRITE::BLEND_NORMAL;
jjLayers[1].spriteParam = 255;
}
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.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
obj.isBlastable = false;
obj.deactivates = true;
obj.isFreezable = true;
obj.bulletHandling = HANDLING::IGNOREBULLET;
obj.playerHandling = HANDLING::SPECIAL;
obj.lightType = LIGHT::NORMAL;
obj.determineCurFrame();
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
return MLLE::WeaponHook.drawAmmo(player, canvas);
}
class GreyCrate : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::CRATE, false);
}
void onDraw(jjOBJ@ obj) {
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 72);
}
}
void torch(jjOBJ@ obj) {
jjDrawSprite(obj.xPos+2, obj.yPos-16, ANIM::AMMO, 13, jjGameTicks / 8 % 6);
}
void onPlayer(jjPLAYER@ player) {
jjWeapons[WEAPON::GUN8].gradualAim = player.powerup[WEAPON::GUN8];
player.lightType = LIGHT::NONE;
if (player.yPos >= 0) {
int skill = jjParameterGet(uint16(player.xPos/32), uint16(player.yPos/32), -4, 2);
if (skill == 2) {
if (jjLayers[1].spriteParam > 96) {
if (jjLayers[1].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP);
jjLayers[1].spriteParam = jjLayers[1].spriteParam - 10;
}
}
else if (jjLayers[1].spriteParam != 255) {
jjLayers[1].spriteParam = jjLayers[1].spriteParam + 10;
}
}
}
namespace WeaponVMega {
namespace Boomerang {
class BoomerangEdit : Weapon {
void onBehave(jjOBJ@ obj) override {
if (obj.state == STATE::START) {
obj.xAcc = (obj.xSpeed + obj.var[7] / 65536.f) * 48;
obj.yAcc = obj.ySpeed * 48;
obj.state = STATE::FLY;
jjSample(obj.xPos, obj.yPos, SOUND::P2_FOEW4, 0, 0);
}
obj.counter += 4;
if (obj.counter > 1) {
sampleBoomerang = jjSampleLooped(obj.xPos, obj.yPos, SOUND::MONKEY_THROW, sampleBoomerang, 0, 0);
}
const auto lastX = obj.xPos, lastY = obj.yPos;
obj.xPos = obj.xOrg + jjSin(obj.counter) * obj.xAcc;
obj.yPos = obj.yOrg + jjSin(obj.counter) * obj.yAcc;
obj.xSpeed = obj.xPos - lastX; //for GetAngle
obj.ySpeed = obj.yPos - lastY; //
obj.lightType = LIGHT::POINT2;
obj.light = 24;
obj.frameID = ((jjGameTicks + obj.objectID) / 3) & 7;
if (obj.frameID >= 4)
obj.frameID = 7 - obj.frameID;
obj.curFrame = jjAnimations[obj.curAnim] + obj.frameID;
if (obj.counter >= 512 || MLLEWeapons::HelpfulBulletFunctions::MaskedPixel(obj) || obj.state == STATE::EXPLODE) {
obj.delete();
if (obj.creatorType == CREATOR::PLAYER) {
const jjPLAYER@ play = jjPlayers[obj.creator];
if (abs(obj.xPos - play.xPos) <= 20 && abs(obj.yPos - play.yPos) <= 20) {
return; //inside shooter; no explosion anim needed
}
}
jjObjects[jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos, obj.objectID, CREATOR::OBJECT)].curAnim = obj.killAnim;
return;
} else if (obj.counter == 256 && obj.creatorType == CREATOR::PLAYER) { //reverse
obj.xAcc = obj.xPos - (obj.xOrg = jjPlayers[obj.creator].xPos);
obj.yAcc = obj.yPos - (obj.yOrg = jjPlayers[obj.creator].yPos);
}
jjDrawRotatedSpriteFromCurFrame(
obj.xPos, obj.yPos,
obj.curFrame,
MLLEWeapons::HelpfulBulletFunctions::GetAngle(obj), MLLEWeapons::HelpfulBulletFunctions::GetDirection(obj), 1,
SPRITE::SINGLEHUE, !MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj) ? 33 : 17
);
}
}
}
}
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.