Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Mini Boss Rush | Violet CLM | Single player | 8.1 |
class Tileset {
string filenameT;
string filenameL;
uint16 firstTile, lastTile;
OBJECT::Object boss;
array<uint> layerIDs;
array<int> layerHeights;
array<jjLAYER@> layers;
jjPAL gradient;
bool active;
Tileset(const string &in fn, const string &in fn2, uint16 f, uint16 l, OBJECT::Object b, const array<uint> &in ids, const array<int> &in h, uint8 g1 = 176, uint8 g2 = 207, bool gl = true) {
filenameT = fn + ".j2t";
filenameL = fn2 + ".j2l";
firstTile = f;
lastTile = l;
layerIDs = ids;
boss = b;
layerHeights = h;
layerHeights.resize(layerIDs.length);
if (g2 == g1 + 15)
g2 = 2;
else
g2 = 1;
jjPAL src;
src.load(filenameT);
for (uint i = 0; i < 32; ++i) {
const uint8 srcID = g1 + i / g2;
gradient.color[i] = src.color[srcID != 207 ? srcID : 206];
}
}
Tileset(){}
}
array<Tileset> Tilesets = {
Tileset("Castle1n", "Castle1n", 425, 472, OBJECT::QUEEN, array<uint>={5,6}, array<int>={14}, 128,143,true),
Tileset("Carrot1n", "Carrot1n", 300, 599, OBJECT::TUFBOSS, array<uint>={5,6,7}, array<int>={9,7,8}),
Tileset("Labrat1n", "Labrat2", 310, 599, OBJECT::ROBOT, array<uint>={6,7}, array<int>={10,10}),
//Tileset("Colon2", "Colon2", 661, 957, array<uint>={6,7}, array<int>={19,17}),
//Tileset("Psych2", "Psych2", 283, 779, array<uint>={5,6,7}, array<int>={9,9,8}),
Tileset("Beach2", "Beach2", 366, 539, OBJECT::UTERUS, array<uint>={6,7}, array<int>={17,13}, 192,223,true),
//Tileset("Diam2", "Diam3", 480, 715, array<uint>={5,6,7}, array<int>={10,9,9}),
Tileset("TubeNite", "Tube2", 182, 539, OBJECT::ROCKETTURTLE, array<uint>={5,6,7}, array<int>(), 176,191,true),
Tileset("Medivo2", "Medivo2", 120, 497, OBJECT::BOLLY, array<uint>={6,7}, array<int>={0,12}),
Tileset("Jungle2", "Jung2", 300,799, OBJECT::BILSY, array<uint>={5,6,7}, array<int>={7,8,7}),
Tileset("Inferno1", "Hell", 620,778, OBJECT::BUBBA, array<uint>={5,6,7}, array<int>={-66,9,7}, 192,223, true),
Tileset("Damn2", "Damn2", 307,648, OBJECT::DEVILDEVAN, array<uint>={6,7,5}, array<int>={11,10,69}, 160,175,true)
};
int NextBossID, BossCounter, BossesNeeded;
int Energy = jjDifficulty == 0 ? 33 : jjDifficulty == 1 ? 50 : 75;
void onLevelLoad() {
jjPIXELMAP().save(0,true);
for (uint i = 0; i < Tilesets.length; ++i) {
Tileset@ tileset = Tilesets[i];
if (tileset.filenameT == "")
break;
jjPAL rgbMapping;
rgbMapping.load(tileset.filenameT);
jjSpriteModeSetMapping(i, array<uint8>(), rgbMapping);
const auto oldTileCount = jjTileCount;
jjTilesFromTileset(
tileset.filenameT,
tileset.firstTile,
tileset.lastTile - tileset.firstTile + 1
);
if (i == 4) { //tubelectric
jjPIXELMAP black(1,1);
black[0,0] = 23;
black.resize(32,32).save(jjTileCount - 14);
}
array<jjLAYER@> tilesetLayers = jjLayersFromLevel(
tileset.filenameL,
tileset.layerIDs,
oldTileCount - tileset.firstTile
);
//jjAlert("" + jjTileCount);
for (uint j = 0; j < tilesetLayers.length; ++j) {
jjLAYER@ layer = tilesetLayers[j];
layer.spriteMode = tileset.layerHeights[j] >= 0 ? SPRITE::MAPPING : SPRITE::TRANSLUCENTMAPPING;
layer.spriteParam = i;
//if (!layer.tileHeight) {
layer.ySpeedModel = LAYERSPEEDMODEL::SPEEDMULTIPLIERS;
layer.ySpeed = layer.yAutoSpeed = 1;
layer.yOffset = (abs(tileset.layerHeights[j])) * 32;
//}
layer.xAutoSpeed = layer.xSpeed;
for (int x = layer.widthReal; --x >= 0;)
for (int y = layer.height; --y >= 0;) {
if ((layer.tileGet(x,y) & TILE::RAWRANGE) > jjTileCount) {
layer.tileSet(x,y, i == 4 ? jjTileCount - 14 : i == 1 ? (jjTileCount - 52 + (x % 25) + (y - 8) * 10) : 0);
}
}
tileset.layers.insertLast(layer);
}
jjOBJ@ boss = jjObjectPresets[tileset.boss];
boss.behavior = BossWrapper(boss.behavior, tileset.boss);
boss.playerHandling = HANDLING::PARTICLE;
boss.energy = Energy;
if (boss.eventID == OBJECT::DEVILDEVAN)
boss.var[0] = boss.energy;
}
jjWeapons[WEAPON::BLASTER].style = WEAPON::CAPPED;
jjParameterSet(10,0, 8,6, (jjDifficulty + 1) * 10 + 1); //carrot
jjObjectPresets[OBJECT::CARROT].state = STATE::FLOATFALL;
jjTexturedBGTexture = TEXTURE::NORMAL;
jjTexturedBGStyle = TEXTURE::TUNNEL;
jjTexturedBGUsed = true;
jjUseLayer8Speeds = true;
jjChat("/maxresolution 640x400");
for (int i = 0; i < 8; ++i)
jjAlert("");
jjMASKMAP side(false);
for (uint x = 0; x < 12; ++x)
for (uint y = 0; y < 32; ++y)
side[x,y] = true;
side.save(3, true);
jjTileType[3] = 3;
jjLayerHasTiles[4] = false;
for (int i = 0; i < 256; ++i)
jjObjectPresets[i].points = 0;
onLevelReload();
}
void onLevelReload() {
const int oldDelay = jjParameterGet(10,0,8,6);
if (oldDelay > 1)
jjParameterSet(10,0, 8,6, oldDelay - 1);
NextBossID = -1;
BossCounter = 0;
BossesNeeded = 2;
SetLayers(0,9999);
for (uint i = 0; i < Tilesets.length; ++i)
Tilesets[i].active = false;
}
bool onDrawScore(jjPLAYER@, jjCANVAS@) { return true; }
bool onDrawLives(jjPLAYER@, jjCANVAS@) { return true; }
bool onDrawAmmo(jjPLAYER@, jjCANVAS@) { return true; }
void onPlayer(jjPLAYER@ player) {
player.fastfire = 9;
player.lives = 3;
player.cameraFreeze(0,80,false,true);
}
void SetLayers(uint a, uint b) {
array<Tileset@> tilesets;
if (a < Tilesets.length && b < Tilesets.length) {
jjPalette.copyFrom(176, 32, 0, Tilesets[a].gradient, 1);
jjPalette.copyFrom(176, 32, 0, Tilesets[b].gradient, 0.5);
tilesets = {Tilesets[a], Tilesets[b]};
} else if (a < Tilesets.length) {
jjPalette.copyFrom(176, 32, 0, Tilesets[a].gradient, 1);
tilesets = {Tilesets[a]};
} else {
jjPalette.copyFrom(176, 32, 0, Tilesets[b].gradient, 1);
tilesets = {Tilesets[b]};
}
jjPalette.apply();
array<jjLAYER@> layers;
for (uint i = 0; i < tilesets.length; ++i) {
const auto tilesetLayers = @tilesets[i].layers;
for (uint j = 0; j < tilesetLayers.length; ++j)
layers.insertLast(tilesetLayers[j]);
}
layers.sort(function(a,b) { return a.xAutoSpeed > b.xAutoSpeed; });
layers.insertAt(0, jjLayers[4]);
layers.insertLast(jjLayers[8]);
jjLayerOrderSet(layers);
}
void IdentifyLayers() {
uint bossA = 9999, bossB = 9999;
for (uint i = 0; i < Tilesets.length; ++i)
if (Tilesets[i].active) {
if (bossA > 9000) {
bossA = i;
} else {
bossB = i;
break;
}
}
if (bossA <= 9000)
SetLayers(bossA, bossB);
}
void startBoss(jjOBJ@ obj) {
if (obj.eventID == OBJECT::ROCKETTURTLE) {
obj.state = STATE::FLY;
obj.xSpeed = 5;
} else if (obj.eventID == OBJECT::ROBOT) {
obj.state = STATE::FADEIN;
} else if (obj.eventID == OBJECT::BILSY) {
obj.state = STATE::IDLE;
obj.var[5] = int(obj.xOrg * 65536);
obj.var[6] = int(obj.yOrg * 65536);
obj.var[1] = 1;
} else if (obj.eventID == OBJECT::QUEEN) {
obj.state = STATE::IDLE;
obj.var[0] = 140;
} else {
if (obj.eventID == OBJECT::DEVILDEVAN)
obj.counter = 70;
obj.state = STATE::DELAYEDSTART;
}
}
class BossWrapper : jjBEHAVIORINTERFACE {
BEHAVIOR::Behavior behavior;
int targetBossID;
BossWrapper(const jjBEHAVIOR b, OBJECT::Object eventID) {
behavior = BEHAVIOR::Behavior(b);
for (uint i = 0; i < Tilesets.length; ++i)
if (Tilesets[i].boss == OBJECT::Object(eventID)) {
targetBossID = i;
break;
}
}
void onBehave(jjOBJ@ obj) {
if (obj.state == STATE::START) {
if (NextBossID >= targetBossID) {
if (obj.age == 127) {
obj.lightType = LIGHT::NONE;
startBoss(obj);
obj.playerHandling = HANDLING::SPECIAL;
Tilesets[targetBossID].active = true;
IdentifyLayers();
} else {
obj.lightType = LIGHT::RING2;
obj.light = (127 - obj.age) / 3;
if (obj.age++ == 0) {
startBoss(obj);
obj.behave(behavior, false);
obj.determineCurFrame();
obj.state = STATE::START;
if (obj.eventID == OBJECT::UTERUS || obj.eventID == OBJECT::BOLLY)
for (uint i = jjObjectCount; --i != 0;)
if (jjObjects[i].creatorID == uint(obj.objectID))
jjDeleteObject(i);
}
if (obj.eventID == OBJECT::UTERUS)
jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1024 - 256, 1,1, SPRITE::BLEND_NORMAL, obj.age * 2);
else {
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BLEND_NORMAL, obj.age * 2);
if (obj.eventID == OBJECT::BOLLY)
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame - 6, obj.direction, SPRITE::BLEND_NORMAL, obj.age * 2);
}
}
}
} else if (obj.state == STATE::DONE || obj.state == STATE::KILL || obj.yPos > 500) {
BossCounter = 0;
++BossesNeeded;
Tilesets[targetBossID].active = false;
obj.particlePixelExplosion(0);
obj.delete();
IdentifyLayers();
} else if (obj.state != STATE::DEACTIVATE) {
obj.behave(behavior);
if (obj.eventID == OBJECT::DEVILDEVAN && obj.var[0] >= 100)
obj.var[0] = Energy;
}
}
}
void onMain() {
if (++BossCounter == 100) {
if (uint(++NextBossID) > Tilesets.length)
jjNxt();
else if (--BossesNeeded >= 1)
BossCounter = 0;
}
}
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.