| Name | Author | Game Mode | Rating | |||||
|---|---|---|---|---|---|---|---|---|
| Mires | 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.8w.asc" ///@MLLE-Generated
#pragma require "xlmmires-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmmires-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "xlmmires.j2l" ///@MLLE-Generated
#include "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "xlmmires_swamp.ogg"
#pragma require "xlmmires_rain.ogg"
int sample, sample2;
int sampleBoomerang = 0;
void onLevelLoad() {
jjUseLayer8Speeds = true;
jjObjectPresets[OBJECT::TOASTERBULLETPU].behavior = SuperToaster();
jjObjectPresets[OBJECT::TOASTERBULLETPU].lightType = LIGHT::FLICKER;
jjObjectPresets[OBJECT::TOASTERBULLETPU].light = 12;
jjANIMATION@ animBubble = jjAnimations[jjAnimSets[ANIM::COMMON] + 1];
for (uint i = 0; i < animBubble.frameCount; ++i) {
jjANIMFRAME@ frame = jjAnimFrames[animBubble + 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] += 115;
sprite.save(frame);
}
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] = 74;
else if (y > 16 && y <= 24) rain[x,y] = 73;
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;
}
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 48, 16, 88});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 27.45f, false);
jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
jjDelayGeneratedCrateOrigins = true;
WeaponVMega::Boomerang::BoomerangEdit().Apply(WEAPON::ICE, MLLE::WeaponHook);
}
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 onPlayer(jjPLAYER@ play) {
if (jjEventGet(int(play.xPos/32), int(play.yPos/32)) == AREA::PATH) {
int direction = jjParameterGet(int(play.xPos/32), int(play.yPos/32), 6, 3);
play.buttstomp = 100;
if (direction > 1) {
if (play.xSpeed > 1) play.xSpeed = -2;
} else if (direction == 0) {
if (play.xSpeed < 1) play.xSpeed = 2;
}
}
for (int i = 0; i < 1024; i++) {
jjPARTICLE@ particle = jjParticles[i];
if (particle.type == PARTICLE::LEAF) {
particle.xSpeed = -0.75;
particle.ySpeed = 0.25;
}
if (particle.type == PARTICLE::RAIN) {
particle.xSpeed = 0;
particle.ySpeed = play.ySpeed < 0? 10 : int(10 + play.ySpeed);
}
}
}
void onLevelBegin() {
MLLE::SpawnOffgrids();
jjSampleLoad(SOUND::WIND_WIND2A, "xlmmires_rain.ogg");
jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "xlmmires_swamp.ogg");
array<uint> BoomerangIDs = {13, 15, 17};
for (uint i = 0; i < BoomerangIDs.length(); i++) {
jjANIMATION@ anim2 = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + BoomerangIDs[i]];
for (uint j = 0; j < anim2.frameCount; j++) {
jjANIMFRAME@ frame = jjAnimFrames[anim2 + j];
jjPIXELMAP sprite(frame);
for (uint x = (BoomerangIDs[i] == 17? 3 : 0); x < (BoomerangIDs[i] == 17? 16 : sprite.width); ++x) {
for (uint y = (BoomerangIDs[i] == 17? 4 : 0); y < (BoomerangIDs[i] == 17? 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 onMain() {
jjWeapons[WEAPON::ICE].gradualAim = true;
jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
jjSnowingType = jjGameTicks % 18 == 0? SNOWING::LEAF : SNOWING::RAIN;
jjIsSnowing = !jjLowDetail;
if (!jjLowDetail) {
jjSnowingIntensity = jjRandom()%1;
jjIsSnowingOutdoorsOnly = true;
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;
}
}
}
sample = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::WIND_WIND2A, sample, 0, 0);
sample2 = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::SCIENCE_PLOPKAOS, sample2, 0, 0);
} else {
jjIsSnowing = false;
}
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ obj = jjObjects[i];
if (obj.eventID == OBJECT::TOASTERPOWERUP){
obj.xPos = obj.xOrg + 16;
obj.direction = -1;
}
if (obj.eventID == OBJECT::BOUNCERPOWERUP){
obj.xPos = obj.xOrg + 16;
obj.direction = 0;
}
if (obj.eventID == OBJECT::RFPOWERUP){
obj.xPos = obj.xOrg + 16;
obj.direction = 0;
}
}
}
void onLevelReload() {
MLLE::SpawnOffgridsLocal();
MLLE::ReapplyPalette();
}
class SuperToaster : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::TOASTERBULLET);
if (obj.counter == 1) obj.xSpeed = 5 * obj.direction;
if (obj.xSpeed != 0) obj.ySpeed += 0.085;
jjPARTICLE@ cinders = jjAddParticle(PARTICLE::FIRE);
if (cinders !is null && obj.counter > 10) {
cinders.xPos = int(obj.xPos - 8) + jjRandom()%17;
cinders.yPos = int(obj.yPos - 8) + jjRandom()%17;
cinders.fire.color = 32;
cinders.fire.colorStop = 40;
cinders.fire.colorDelta = 2;
}
}
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
return MLLE::WeaponHook.drawAmmo(player, canvas);
}
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.