Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 22 levels | Jazz2Online | Multiple | N/A | |||||
Anniversary Bash 20 Levels | Jazz2Online | Multiple | N/A | |||||
Mt. Cinder | PurpleJazz | Capture the flag | 9 | |||||
Press Garden | SmokeNC | Battle | 9.2 | |||||
Weapon Mega | Violet CLM | Mutator | 8.7 |
#pragma require "weaponMega.asc"
#pragma require "weaponMega.j2a"
jjOBJ@ GetWeaponObjectConstant(WEAPON::Weapon weaponID, bool powerup) {
switch (weaponID) {
case WEAPON::BLASTER:
return jjObjectPresets[!powerup ? OBJECT::BLASTERBULLET : OBJECT::BLASTERBULLETPU];
case WEAPON::BOUNCER:
return jjObjectPresets[!powerup ? OBJECT::BOUNCERBULLET : OBJECT::BOUNCERBULLETPU];
case WEAPON::ICE:
return jjObjectPresets[!powerup ? OBJECT::ICEBULLET : OBJECT::ICEBULLETPU];
case WEAPON::SEEKER:
return jjObjectPresets[!powerup ? OBJECT::SEEKERBULLET : OBJECT::SEEKERBULLETPU];
case WEAPON::RF:
return jjObjectPresets[!powerup ? OBJECT::RFBULLET : OBJECT::RFBULLETPU];
case WEAPON::TOASTER:
return jjObjectPresets[!powerup ? OBJECT::TOASTERBULLET : OBJECT::TOASTERBULLETPU];
case WEAPON::TNT:
return jjObjectPresets[OBJECT::TNT];
case WEAPON::GUN8:
return jjObjectPresets[!powerup ? OBJECT::FIREBALLBULLET : OBJECT::FIREBALLBULLETPU];
case WEAPON::GUN9:
return jjObjectPresets[!powerup ? OBJECT::ELECTROBULLET : OBJECT::ELECTROBULLETPU];
}
return jjObjectPresets[0];
}
BEHAVIOR::Behavior GetWeaponBehaviorConstant(WEAPON::Weapon weaponID, bool powerup) {
switch (weaponID) {
case WEAPON::BLASTER:
return BEHAVIOR::BULLET;
case WEAPON::BOUNCER:
return !powerup ? BEHAVIOR::BOUNCERBULLET : BEHAVIOR::BOUNCERBULLETPU;
case WEAPON::ICE:
return !powerup ? BEHAVIOR::BULLET : BEHAVIOR::ICEBULLETPU;
case WEAPON::SEEKER:
return BEHAVIOR::SEEKERBULLET;
case WEAPON::RF:
return BEHAVIOR::RFBULLET;
case WEAPON::TOASTER:
return BEHAVIOR::TOASTERBULLET;
case WEAPON::TNT:
return BEHAVIOR::TNT;
case WEAPON::GUN8:
return BEHAVIOR::BULLET;
case WEAPON::GUN9:
return BEHAVIOR::ELECTROBULLET;
}
return BEHAVIOR::Behavior(0);
}
ANIM::Set findCustomAnimID(WEAPON::Weapon weaponID) {
uint customAnimID = 0;
while (jjAnimSets[ANIM::CUSTOM[customAnimID]].firstAnim != 0)
++customAnimID;
jjAnimSets[ANIM::CUSTOM[customAnimID]].load(weaponID - 1, "weaponMega.j2a");
return ANIM::CUSTOM[customAnimID];
}
jjOBJ@ Preset1, Preset2;
ANIM::Set AnimSet;
bool SafeToReplaceWeapon(WEAPON::Weapon weaponID) {
if (!(
GetWeaponObjectConstant(weaponID, false).behavior == GetWeaponBehaviorConstant(weaponID, false) &&
GetWeaponObjectConstant(weaponID, true ).behavior == GetWeaponBehaviorConstant(weaponID, true )
))
return false;
@Preset1 = GetWeaponObjectConstant(weaponID, false);
@Preset2 = GetWeaponObjectConstant(weaponID, true);
AnimSet = findCustomAnimID(weaponID);
return true;
}
abstract class WeaponMega : jjBEHAVIORINTERFACE {
jjOBJ@ obj;
void onBehave(jjOBJ@){}
int getBulletAngle() const {
return int(atan2(
(obj.xSpeed >= 0) ? obj.ySpeed : -obj.ySpeed,
abs(obj.xSpeed)
) * -512.0 * 0.318309886142228);
}
int getBulletDirection() const {
if (obj.xSpeed >= 0)
return 1;
return -1;
}
void drawAngledBullet() const {
jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, getBulletAngle(), getBulletDirection());
}
void onDraw(jjOBJ@) {
if (obj.isActive)
drawAngledBullet();
}
bool maskedPixelAtBullet() const {
return jjMaskedPixel(int(obj.xPos), int(obj.yPos));
}
bool isPowerup() const {
return (obj.var[6] & 8) == 8;
}
void blast(uint animID) {
obj.killAnim = animID;
obj.state = STATE::EXPLODE;
obj.behavior = BEHAVIOR::RFBULLET;
obj.behave(BEHAVIOR::DEFAULT, false);
}
bool playerIsEnemy(const jjPLAYER@ other) const {
if (obj.creatorType != CREATOR::PLAYER)
return false;
const jjPLAYER@ parent = jjPlayers[obj.creatorID];
return parent.isEnemy(other);
}
int getNearestEnemy(uint maxDistance, bool canBeFlickering = false) const {
int nearestPlayerID = -1;
if (!canBeFlickering && jjGameState != GAME::STARTED && jjGameState != GAME::OVERTIME)
return -1;
uint minDistance = maxDistance;
for (uint i = 0; i < 32; ++i) {
const jjPLAYER@ potentialEnemy = jjPlayers[i];
if (!potentialEnemy.isInGame)
continue;
if (!canBeFlickering && potentialEnemy.blink != 0)
continue;
const float dx = potentialEnemy.xPos - obj.xPos, dy = potentialEnemy.yPos - obj.yPos;
const uint distance = uint(sqrt(dx * dx + dy * dy));
if (distance < minDistance && playerIsEnemy(potentialEnemy)) {
minDistance = distance;
nearestPlayerID = i;
}
}
return nearestPlayerID;
}
}
const float LevelRight = float(jjLayerWidth[4] * 32);
const float LevelBottom = float(jjLayerHeight[4] * 32);
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.