Downloads containing ab22btl10.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 22 levels Jazz2Online Multiple N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "ab22btl10-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab22btl10-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab22btl10.j2l" ///@MLLE-Generated

/*******************************
A 2020 Mystic Legends Release!
http://www.mysticlegends.org
/******************************/

#pragma require "FTURROCK.wav"
#pragma require "EXPSTD3.wav"
#pragma require "redeemer_flight.wav"

#pragma require "SEenergyblast.asc"
#include "SEenergyblast.asc"

jjANIMFRAME@ backgroundCastle;

jjTEXTAPPEARANCE AlienTalk = STRING::NORMAL;

bool controllingRedeemer, warning = false;
int xPos = 0, yPos = 0, cameraX = 0, cameraY = 0, redeemerAngle = 0, CTFArrowTimer = 0;
uint delay = 0;

se::DefaultWeaponHook weaponHook;
funcdef jjPALCOLOR ColorFunction(jjPALCOLOR);

class Vine {
	private uint x, y;
	Vine(){}
	Vine(uint xx, uint yy) { x = xx; y = yy; }
	void setEvent(AREA::Area area) { jjEventSet(x, y, area); }
}
array<Vine> Vines;
void SetVines(bool toVine) {
	for (uint i = 0; i < Vines.length; ++i)
		Vines[i].setEvent(toVine ? AREA::VINE : AREA::ONEWAY);
}

int redeemerColor(jjPLAYER@ creator) {
	//switch(creator.team) {
		//case TEAM::BLUE: return 0;
		//case TEAM::RED: return 1;
		//case TEAM::GREEN: return 2;
		//case TEAM::YELLOW: return 3;
	//}
	return 0;
}

bool gameIsActive() {
	return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}

bool CTFMode() {
	return (jjGameMode == GAME::CTF && jjGameCustom == GAME::NOCUSTOM) || jjGameCustom == GAME::DCTF;
}

bool otherMode() {
	return jjGameMode != GAME::CTF || jjGameCustom == GAME::TB || jjGameCustom == GAME::TLRS || jjGameCustom == GAME::DOM;
}

bool isDestructibleItem(jjOBJ@ target) {
	return target.eventID == OBJECT::TNT || target.eventID == OBJECT::BOUNCERPOWERUP || target.eventID == OBJECT::RFPOWERUP || target.eventID == OBJECT::TOASTERPOWERUP || target.eventID == OBJECT::GUN8POWERUP || target.eventID == OBJECT::LIGHTNINGSHIELD;
}

void onLevelLoad() {
	jjTexturedBGTexture = TEXTURE::DIAMONDUSBETA;
	jjTexturedBGFadePositionY = 0.55;
	
	jjUseLayer8Speeds = true;
	
	se::energyBlast.loadAnims(jjAnimSets[ANIM::CUSTOM[0]]);
   	se::energyBlast.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BLOW});
   	se::energyBlast.setAsWeapon(3, weaponHook);	
	
	//redeemer stuff
	jjObjectPresets[OBJECT::TNT].determineCurFrame();
	jjObjectPresets[OBJECT::TNT].behavior = Redeemer();
	jjObjectPresets[OBJECT::TNT].xSpeed = jjObjectPresets[OBJECT::BLASTERBULLET].xSpeed * 1.33;
	jjObjectPresets[OBJECT::TNT].counterEnd = 255;
	jjObjectPresets[OBJECT::TNT].killAnim = jjObjectPresets[OBJECT::SEEKERBULLET].killAnim;
	
	jjObjectPresets[OBJECT::TNTAMMO3].behavior = RedeemerPickup();
	jjObjectPresets[OBJECT::TNTAMMO3].determineCurFrame();
	jjObjectPresets[OBJECT::TNTAMMO3].scriptedCollisions = true;
	
	jjWeapons[WEAPON::TNT].maximum = 1;
	
	jjWeapons[WEAPON::ICE].maximum = 99;
	
	jjAnimSets[ANIM::SONCSHIP].load();
	jjAnimSets[ANIM::VINE].load();
	jjAnimations[jjAnimSets[ANIM::AMMO] + 59] = jjAnimations[jjAnimSets[ANIM::SONCSHIP] + 0];
	
	AlienTalk.align = STRING::CENTER;
	AlienTalk.monospace = true;
	AlienTalk.spacing = 8;
	AlienTalk.xAmp = 0;
	AlienTalk.yAmp = 1;
	
	for (int x = jjLayerWidth[4] - 1; x >= 0; --x) {
		for (int y = jjLayerHeight[4] - 1; y >= 0; --y) {
			if (jjEventGet(x, y) == AREA::VINE)
				Vines.insertLast(Vine(x,y));
		}
	}
	
	//generateColoredRedeemerSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {32, 24, 16, 40});
	generateRedeemerPickupSprite(jjAnimSets[ANIM::CUSTOM[1]], array<uint> = {0});
	
	jjSampleLoad(SOUND::P2_POEP, "FTURROCK.wav");
	jjSampleLoad(SOUND::P2_PTOEI, "EXPSTD3.wav");
	jjSampleLoad(SOUND::P2_SPLOUT, "redeemer_flight.wav");
}

int elapsed = 0;
int glowIndex = 0;
array<uint8> glowColors = {1, 4, 5, 6};

const string ALIENTALK_1 = "(ayy lmao)";
const string ALIENTALK_2 = "(seek the red flower)";
const string ALIENTALK_3 = "(haha tractor beam goes bzz)";
const string ALIENTALK_S = "(I want to go home...)";

void onDrawLayer3(jjPLAYER@ play, jjCANVAS@ layer) {
	if (play.yPos >= 0) {
		int skill = jjParameterGet(uint16(play.xPos/32), uint16(play.yPos/32), -4, 2);	
		if (skill == 2) { //Hard
		
			if (++elapsed % 14 == 0) {
				if (glowIndex >= 3) {
						glowIndex = 0;
				}
				else {
						++glowIndex;
				}
				//jjAlert("" + glowIndex);
			}
			
			layer.drawString(556,  224,  ALIENTALK_1, STRING::SMALL, AlienTalk, 0, SPRITE::NEONGLOW, glowColors[glowIndex]);
			layer.drawString(1936, 196,  ALIENTALK_2, STRING::SMALL, AlienTalk, 0, SPRITE::NEONGLOW, glowColors[glowIndex]);
			layer.drawString(3924, 260,  ALIENTALK_3, STRING::SMALL, AlienTalk, 0, SPRITE::NEONGLOW, glowColors[glowIndex]);
			layer.drawString(2354, 2208, ALIENTALK_S, STRING::SMALL, AlienTalk, 0, SPRITE::NEONGLOW, glowColors[glowIndex]);
		}
		else {
			elapsed = 0;
			glowIndex = 0;
		}
	}	
}

void onPlayer(jjPLAYER@ play) {	
		weaponHook.processPlayer(play);
			
		//fix for getting stuck inside magnets, thanks SE				
		const int x = int(play.xPos);
		const int y = int(play.yPos);
		const int left = x - 12;
		const int right = x + 12;
		const int top = y - (play.antiGrav ? 18 : 6);
		const int bottom = y + (play.antiGrav ? 6 : 18);
		const int middle = (top + bottom) >>> 1;
		const array<int> passThroughEvents = {AREA::HOOK, AREA::ONEWAY, AREA::VINE};
		int counter = 0;
		int direction = 0;
		int topmost = bottom;
		int bottommost = top;
		for (int i = top; i <= bottom; i++) {
		    for (int j = left; j < right; j++) {
		        if (jjMaskedPixel(j, i) && passThroughEvents.find(jjEventAtLastMaskedPixel) < 0) {
		            counter++;
		            direction += i < middle ? 1 : i > middle ? -1 : 0;
		            if (i < topmost)
		                topmost = i;
		            if (i > bottommost)
		                bottommost = i;
		        }
		    }
		}
		if (counter > 32) {
		    if (direction > 0)
		        play.yPos += bottommost - top;
		    else if (direction < 0)
		        play.yPos += topmost - bottom;
		}
		
		if (controllingRedeemer) play.currWeapon = WEAPON::BLASTER;
}

void onMain() {
	weaponHook.processMain();
}

void onPlayerInput(jjPLAYER@ play) {
    weaponHook.processPlayerInput(play);
    
    //SetVines((play.currWeapon == WEAPON::ICE && play.keyFire));
}

//redeemer
class Redeemer : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		//var[0] - angle
		//var[1] - angular speed
		//var[2] - has the redeemer exploded
		//special - value of jjGameTicks at the time the last packet was sent/received	
		
		int angle;
		float speed = jjObjectPresets[OBJECT::TNT].xSpeed;
		
		if (obj.creatorType != CREATOR::PLAYER)
			obj.delete();
		jjPLAYER@ creator = jjPlayers[obj.creatorID];
		
		switch (obj.state) {
			case STATE::START:
				obj.curAnim = jjObjectPresets[obj.eventID].curAnim;
				jjSamplePriority(SOUND::P2_POEP);
				obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
				obj.ySpeed = speed * -jjSin(obj.var[0]);
				obj.xSpeed = speed * jjCos(obj.var[0]);
				obj.direction = obj.xSpeed < 0.f ? -1 : 1;
				obj.var[2] = 0;
				if (creator.isLocal) controllingRedeemer = true;
				obj.state = STATE::FLY;
			break;
				
			case STATE::FLY:
				redeemerCamera(creator, obj);
				jjDrawRotatedSprite(obj.xPos, obj.yPos, (creator.isLocal || jjGameMode != GAME::CTF)? ANIM::SONCSHIP : ANIM::SONCSHIP, (creator.isLocal || jjGameMode != GAME::CTF)? 0 : redeemerColor(creator), obj.curFrame, obj.var[0], 2, 2, SPRITE::NORMAL);
				if (creator.isLocal) {
					redeemerAngle = obj.var[0];
					if (!jjLowDetail && (obj.counter % 131 == 36 || obj.counter == 1) && controllingRedeemer) jjSamplePriority(SOUND::P2_SPLOUT);
					float dx = creator.xPos - obj.xPos, dy = creator.yPos - obj.yPos;
						if (dx * dx + dy * dy < 420 * 420) warning = true;
						else warning = false;
					if (creator.health == 0) {
						creator.cameraUnfreeze(true);
						controllingRedeemer = false;
					} else {
						if (controllingRedeemer) creator.xSpeed = 0;
						if (obj.counter >= 21) {
							if (controllingRedeemer) {
								if (creator.keyRight || (obj.direction < 0 ? creator.keyUp : creator.keyDown))
									obj.var[1] = -16;
								else if (creator.keyLeft || (obj.direction < 0 ? creator.keyDown : creator.keyUp))
									obj.var[1] = 16;
								else
									obj.var[1] = 0;
							}
							else obj.var[1] = 0;
						}
						if (obj.counter >= 127)
							obj.counter = 35;
						else if (obj.counter >= 35 && creator.keyFire && controllingRedeemer)
							obj.state = STATE::EXPLODE;
					}
					xPos = int(obj.xPos);
					yPos = int(obj.yPos);
				}
				if (obj.yPos >= jjLayerHeight[4]*32) obj.state = STATE::EXPLODE;
				obj.var[0] = obj.var[0] + obj.var[1];
				obj.ySpeed = speed * -jjSin(obj.var[0]);
				obj.xSpeed = speed * jjCos(obj.var[0]);
				if (obj.counter % 3 == 0 && !jjLowDetail) spawnFireTrail(obj);
			break;
			
			case STATE::EXPLODE:
				if (obj.var[2] == 0) {
					RedeemerExplosion temp;
					jjOBJ@ explosion = jjObjects[jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER, jjVOIDFUNCOBJ(temp.onBehave))];
					jjSamplePriority(SOUND::P2_PTOEI);
					obj.var[2] = 1;
					explosion.var[2] = 1;
				} else {
					jjDrawResizedSprite(obj.xPos, obj.yPos, ANIM::AMMO, 5, obj.curFrame + 5, 8, 8, SPRITE::NORMAL, 0, 2, 2);
				}
				creator.cameraUnfreeze(true);
				if (creator.isLocal) controllingRedeemer = false;
			break;
		}
		
		int previousState = obj.state;
		obj.behave(BEHAVIOR::BULLET, false);
		if (!creator.isLocal) {
			if (obj.special + 128 > jjGameTicks)
				obj.state = previousState;
		} else if (obj.special + 4 <= jjGameTicks) {
			jjSTREAM packet;
			packet.push(int8(obj.creatorID));
			packet.push(obj.state == STATE::EXPLODE);
			packet.push(obj.xPos);
			packet.push(obj.yPos);
			if (obj.state != STATE::EXPLODE) {
				packet.push(int16(obj.var[0]));
				packet.push(int16(obj.var[1]));
			}
			jjSendPacket(packet);
			obj.special = jjGameTicks;
		}
	}
}

void spawnFireTrail(jjOBJ@ obj) {
	jjOBJ@ trail = jjObjects[jjAddObject(OBJECT::EXPLOSION, int(obj.xPos - jjCos(obj.var[0])), int(obj.yPos - jjSin(obj.var[0])))];
	trail.determineCurAnim(ANIM::AMMO, 3);
	trail.lightType = LIGHT::POINT;
	trail.playerHandling = HANDLING::PARTICLE;
	trail.bulletHandling = HANDLING::IGNOREBULLET;
	trail.isBlastable = false;
}

void redeemerCamera(jjPLAYER@ creator, jjOBJ@ obj) {
	float dx = jjLayerWidth[4] - obj.xPos, dy = jjLayerHeight[4] - obj.yPos;
	
	if (jjLayerWidth[4] - dx <= 400) cameraX = 400;
	else cameraX = int(obj.xPos);
	
	if (jjLayerHeight[4] - dy <= 400) cameraY = 400;
	else cameraY = int(obj.yPos);
	
	if (controllingRedeemer) {
		creator.cameraFreeze(int(obj.xPos) >= 8528? 8528 : cameraX, int(obj.yPos) >= 4080? 4080 : cameraY, true, true);
	
		for (int i = 0; i < 32; i++) {
			jjPLAYER@ play = jjPlayers[i];
			float reticleScale = jjSin(jjGameTicks*5);
			float reticleColor = jjSin(jjGameTicks*10)*2;
			float pdx = play.xPos - obj.xPos, pdy = play.yPos - obj.yPos;
			if ((pdx * pdx + pdy * pdy < 320 * 320) && (jjGameMode != GAME::CTF || jjFriendlyFire || play.team != creator.team) && !play.isLocal)
				jjDrawResizedSprite(play.xPos, play.yPos, ANIM::SONCSHIP, 7, 0, reticleScale + 2, reticleScale + 2, SPRITE::SINGLECOLOR, int(reticleColor + 18), 1);
							
		}
	}
}

class RedeemerPickup : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
		obj.direction = obj.xPos > 4464? -1:1;
		if (obj.isActive) jjDrawResizedSprite(int(obj.xPos) - (6 * obj.direction), int(obj.yPos) + jjSin(jjGameTicks*10)*6, ANIM::CUSTOM[1], 0, obj.curFrame, 2 * obj.direction, 2, ((obj.xPos < 4464 && jjLocalPlayers[0].team == TEAM::BLUE) || (obj.xPos > 4464 && jjLocalPlayers[0].team == TEAM::RED))? SPRITE::NORMAL : SPRITE::NORMAL);
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
		if (play.ammo[WEAPON::TNT] < jjWeapons[WEAPON::TNT].maximum) {
			if ((obj.xPos < 4464 && play.team == TEAM::BLUE) || (obj.xPos > 4464 && play.team == TEAM::RED) || otherMode()) {
				if (play.isLocal) {
					play.ammo[WEAPON::TNT] = play.ammo[WEAPON::TNT] + 1;
					play.currWeapon = WEAPON::TNT;
					//jjSample(obj.xPos, obj.yPos, SOUND::COMMON_LOADSPAZ, 0, 0);
					jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUPW1, 0, 0);
					jjSample(obj.xPos, obj.yPos, SOUND::INTRO_IFEEL, 0, 0);
					if (play.charCurr == CHAR::JAZZ) {
						jjSample(play.xPos, play.yPos, SOUND::JAZZSOUNDS_JUMMY, 0, 0);
					}
					if (play.charCurr == CHAR::SPAZ) {
						jjSample(play.xPos, play.yPos, SOUND::SPAZSOUNDS_HAPPY, 0, 0);
					}
					if (play.charCurr == CHAR::LORI) {
						jjSample(play.xPos, play.yPos, SOUND::LORISOUNDS_WEHOO, 0, 0);
					}
				}
				obj.behavior = BEHAVIOR::EXPLOSION2;
				obj.scriptedCollisions = false;
				obj.frameID = 0;
			}
		}
		return true;
	}
}

class RedeemerExplosion : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		//var[0] - obj.counter
		//var[2] - has the redeemer exploded
		//var[4] - blast radius
		//var[5] - damage
		//var[8] - has the player been hit by the explosion
	
		obj.playerHandling = HANDLING::PARTICLE;
		obj.bulletHandling = HANDLING::IGNOREBULLET;
		
		obj.lightType = obj.var[2] == 1? LIGHT::RING2 : LIGHT::NONE;
		
		jjPLAYER@ creator = jjPlayers[obj.creatorID];
		jjPLAYER@ play = jjLocalPlayers[0];
		
		if (obj.var[2] == 1) {
			obj.var[0] = obj.var[0] + 1;
			obj.light += 2;
			obj.var[4] = obj.light * 5;
			
			if (obj.var[4] >= 460) obj.var[5] = 1;
			else if (obj.var[4] >= 360 && obj.var[4] < 460) obj.var[5] = 2;
			else if (obj.var[4] < 360) obj.var[5] = 7;
			
			for (int i = 1; i < jjObjectCount; i++) {
				jjOBJ@ target = jjObjects[i];
				float dx = target.xPos - obj.xPos, dy = target.yPos - obj.yPos;
				if (isDestructibleItem(target) && target.var[4] == 0) {
					if (dx * dx + dy * dy < obj.var[4] * obj.var[4]) {
						if (target.eventID != OBJECT::TNT) creator.objectHit(target, -1, HANDLING::SPECIAL);
						else target.state = STATE::EXPLODE;
						target.var[4] = 1;
					}
					else target.var[4] = 0;
				}
				else if (target.behavior == BEHAVIOR::PICKUP && target.state == STATE::FLOAT) {
					if (dx * dx + dy * dy < obj.var[4] * obj.var[4])
						target.state = STATE::FLOATFALL;
				}
			}
			
			float pdx = play.xPos - obj.xPos, pdy = play.yPos - obj.yPos;
			if (pdx * pdx + pdy * pdy < 1600 * 1600) {
				uint random = jjRandom();
				int magnitude = (2 << (random & 3)) - 1;
				int halfMagnitude = magnitude >> 1;
				
				if ((jjGameTicks & 1 == 0 && !jjTriggers[19]) || (jjGameTicks & 1 == 0 && jjTriggers[19] && jjMaskedHLine(int(play.xPos) - 12, 24, int(play.yPos) + 21)) && !controllingRedeemer)
					play.cameraFreeze(play.cameraX + (random & magnitude) - halfMagnitude, play.cameraY + (random >> 8 & magnitude) - halfMagnitude, false, true);
				else
					play.cameraUnfreeze();
			}
		}
		
		if (jjIsServer && gameIsActive()) {
			for (int i = 0; i < 32; i++) {
				jjPLAYER@ player = jjPlayers[i];
				if (
					player.isActive && player.isInGame && player.health > 0 &&
						(jjGameMode != GAME::CTF || jjFriendlyFire || player.team != creator.team || player is creator)
				) {
					float dx = player.xPos - obj.xPos, dy = player.yPos - obj.yPos;
					if (dx * dx + dy * dy < obj.var[4] * obj.var[4]) {
						if (obj.var[8] & 1 << i == 0) {
							player.hurt(obj.var[5], true, creator);
							obj.var[8] = obj.var[8] | 1 << i;
						}
					}
				}
			}
		}
		
		if (obj.var[0] == 1) {
			jjSample(obj.xPos, obj.yPos, SOUND::BILSBOSS_FIRE, 0, 0);
			for (int i = -8; i <= 8; i+=8) {
				for (int j = -8; j <= 8; j+=8) {
					if (i != 0 || j != 0) {
						Fireworks temp;
						int id = jjAddObject(OBJECT::ELECTROBULLET, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER, jjVOIDFUNCOBJ(temp.onBehave));
						if (id != 0) {
							jjOBJ@ flares = jjObjects[id];
							flares.xSpeed = j*2;
							flares.ySpeed = i*2;
						}
					}
				}
			}
		}
		else if (obj.var[0] == 70) {
			obj.var[0] = 0;
			obj.var[2] = 0;
			obj.var[4] = 0;
			if (!controllingRedeemer) play.cameraUnfreeze();
			obj.delete();
		}
	}
}

class Fireworks : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::ELECTROBULLET, false);
		obj.counterEnd = 210;
		if (obj.ySpeed < 10 && obj.xSpeed != 0) obj.ySpeed += 0.5;
		obj.playerHandling = HANDLING::PARTICLE;
		obj.bulletHandling = HANDLING::IGNOREBULLET;
		if (obj.state == STATE::FLY) obj.particlePixelExplosion(1);
	}
}

void onReceive(jjSTREAM &in packet, int clientID) {
	int8 playerID;
	bool explosion;
	float xPos, yPos;
	int16 angle, angleSpeed;
	jjSTREAM packetBackup;
	if (jjIsServer)
		packetBackup = packet;
	if (packet.pop(playerID) && playerID >= 0 && playerID < 32 &&
		packet.pop(explosion) && packet.pop(xPos) && packet.pop(yPos) &&
		(explosion || packet.pop(angle) && packet.pop(angleSpeed))
	) {
		const jjPLAYER@ player = jjPlayers[playerID];
		if (!jjIsServer || player.isActive && player.isInGame && player.clientID == clientID ) {
			jjOBJ@ redeemer;
			for (int i = 0; i < jjObjectCount; i++) {
				jjOBJ@ obj = jjObjects[i];
				if (obj.isActive && obj.eventID == OBJECT::TNT && obj.creatorType == CREATOR::PLAYER && obj.creatorID == uint(playerID)) {
					@redeemer = obj;
					break;
				}
			}
			if (redeemer is null && jjGameTicks < 140) {
				int id = jjAddObject(OBJECT::TNT, xPos, yPos, playerID, CREATOR::PLAYER);
				if (id > 0)
					@redeemer = jjObjects[id];
			}
			if (redeemer !is null) {
				if (jjIsServer)
					jjSendPacket(packetBackup, -clientID);
				if (explosion)
					redeemer.state = STATE::EXPLODE;
				redeemer.xPos = xPos;
				redeemer.yPos = yPos;
				redeemer.var[0] = angle;
				redeemer.var[1] = angleSpeed;
				redeemer.special = jjGameTicks;
			}
		}
	}
	
	weaponHook.processPacket(packet, clientID);
}

//void onPlayer(jjPLAYER@ play) {
	//if (play.shieldTime > 15*70) play.shieldTime = 15*70;
	
	//play.lightType = LIGHT::NONE;
	//jjEnforceLighting = LIGHT::COMPLETE;
	
	//if (controllingRedeemer) play.currWeapon = WEAPON::BLASTER;
	
	//if (play.fly == FLIGHT::AIRBOARD && play.timerState == TIMER::STOPPED) play.timerStart(20*70);
	//if (play.fly == FLIGHT::NONE) play.timerStop();
  	//if (play.timerState == TIMER::STARTED && play.timerTime <= 3*70 && play.timerTime > 0 && play.timerTime % 70 == 0) jjSamplePriority(SOUND::COMMON_NOCOIN);
//}

bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) {
	if (controllingRedeemer) {
		canvas.drawString(
			jjSubscreenWidth - 480,
			jjSubscreenHeight - 450,
			"Redeemer!",
			STRING::MEDIUM,
			STRING::NORMAL
		);
		//canvas.drawString(
			//jjSubscreenWidth - 496,
			//jjSubscreenHeight - 422,
			//"Redeemer pos " + int(xPos / 32) + "," + int(yPos / 32),
			//STRING::SMALL,
			//STRING::NORMAL
		//);
		canvas.drawString(
			jjSubscreenWidth - 624,
			jjSubscreenHeight - 406,
			"§0|Use the |||movement keys |||||to rotate the missile",
			STRING::SMALL,
			STRING::NORMAL
		);
		canvas.drawString(
			jjSubscreenWidth - 625,
			jjSubscreenHeight - 390,
			"§0|Press |||FIRE |||||to detonate the missile in mid-air",
			STRING::SMALL,
			STRING::NORMAL
		);
		canvas.drawRectangle(
			jjSubscreenWidth - 750,
			jjSubscreenHeight - 240,
			140,
			140,
			87,
			SPRITE::TRANSLUCENT
		);
		canvas.drawString(
			jjSubscreenWidth - 708,
			jjSubscreenHeight - 108,
			"Radar",
			STRING::SMALL,
			STRING::PALSHIFT,
			16
		);
		canvas.drawRotatedSprite(
			jjSubscreenWidth - 680, 
			jjSubscreenHeight - 170, 
			ANIM::CUSTOM[1],
			0,
			jjGameTicks >> 2,
			redeemerAngle, 
			1, 
			1, 
			SPRITE::SINGLEHUE, 
			80
		);
		
		for (int i = 0; i < 32; i++) {
			jjPLAYER@ player = jjPlayers[i];
			
			uint8 teamColor;
			switch (player.team) {
				case TEAM::BLUE: teamColor = 34; break;
				case TEAM::RED: teamColor = 24; break;
				case TEAM::GREEN: teamColor = 18; break;
				case TEAM::YELLOW: teamColor = 40; break;
				default: teamColor = 24; break;
			}
			
			int radarOffsetX = int(xPos - player.xPos) / 35;
			int radarOffsetY = int(yPos - player.yPos) / 35;
			
			if (radarOffsetX < 70 && radarOffsetX > -63 && radarOffsetY < 70 && radarOffsetY > -63 && player.xPos > 0 && player.yPos > 0 && !play.isSpectating && !play.isOut && !play.isConnecting) {
				if (player.flag != 0 && !player.isLocal) {
					canvas.drawResizedSprite(
						((jjSubscreenWidth - 678) - radarOffsetX),
						((jjSubscreenHeight - 168) - radarOffsetY),
						ANIM::FLAG,
						3,
						jjGameTicks >> 2,
						radarOffsetX > 0? 0.4:-0.4,
						0.4,
						SPRITE::SINGLECOLOR,
						player.team == TEAM::BLUE? 24 : 34
					);
					canvas.drawRectangle(
						((jjSubscreenWidth - 680) - radarOffsetX),
						((jjSubscreenHeight - 170) - radarOffsetY),
						6,
						6,
						teamColor,
						SPRITE::NORMAL
					);
				}
				else if (player.flag == 0) {
					canvas.drawRectangle(
						((jjSubscreenWidth - 680) - radarOffsetX),
						((jjSubscreenHeight - 170) - radarOffsetY),
						player.isLocal? 8:6,
						player.isLocal? 8:6,
						player.isLocal? 64 : jjGameMode == GAME::CTF? teamColor : 24,
						SPRITE::NORMAL
					);
				}
			}
			
			for (int j = 1; j < jjObjectCount; j++) {
				if (jjObjects[j].eventID == OBJECT::TNT) {
					
					uint8 redeemerColor;
					switch (jjPlayers[jjObjects[j].creatorID].team) {
						case TEAM::BLUE: redeemerColor = 34; break;
						case TEAM::RED: redeemerColor = 24; break;
						case TEAM::GREEN: redeemerColor = 18; break;
						case TEAM::YELLOW: redeemerColor = 40; break;
						default: redeemerColor = 88; break;
					}
					
					int radarMissileOffsetX = int(xPos - jjObjects[j].xPos) / 35;
					int radarMissileOffsetY = int(yPos - jjObjects[j].yPos) / 35;
					
					if (!jjPlayers[jjObjects[j].creatorID].isLocal && radarMissileOffsetX < 70 && radarMissileOffsetX > -63 && radarMissileOffsetY < 70 && radarMissileOffsetY > -63) {
						canvas.drawRotatedSprite(
							((jjSubscreenWidth - 680) - radarMissileOffsetX),
							((jjSubscreenHeight - 170) - radarMissileOffsetY),
							ANIM::CUSTOM[1],
							0,
							jjGameTicks >> 2,
							jjObjects[j].var[0],
							0.5,
							0.5,
							SPRITE::SINGLECOLOR,
							jjGameMode == GAME::CTF? redeemerColor : 90
						);
					}
				}
			}
		}
		
		if (warning) {
			canvas.drawString(
				jjSubscreenWidth - 550,
				jjSubscreenHeight - 374,
				"||WARNING: YOU ARE IN RANGE!",
				STRING::SMALL,
				STRING::NORMAL
			);
		}
		
		if (!jjLowDetail && jjGameTicks % 140 >= 7) {
			canvas.drawString(
				jjSubscreenWidth - 132,
				jjSubscreenHeight - 46,
				"REC",
				STRING::MEDIUM,
				STRING::NORMAL
			);
			canvas.drawSprite(
				jjSubscreenWidth - 146,
				jjSubscreenHeight - 45,
				ANIM::VINE,
				0,
				0,
				0,
				SPRITE::NORMAL
			);
		}
	}
	else if (!controllingRedeemer && play.currWeapon == WEAPON::TNT) {
		canvas.drawString(
			jjSubscreenWidth - 80,
			jjSubscreenHeight - 14,
			"x" + play.ammo[WEAPON::TNT],
			STRING::MEDIUM,
			STRING::NORMAL
		);
		canvas.drawResizedSprite(
			jjSubscreenWidth - 110,
			jjSubscreenHeight - 14,
			ANIM::CUSTOM[1],
			0,
			jjGameTicks >> 2,
			2,
			2,
			SPRITE::NORMAL
		);
	}
	
	return weaponHook.drawAmmo(play, canvas);
}

jjANIMSET@ redeemerPickupSprite;
bool generateRedeemerPickupSprite(jjANIMSET@ anim, const array<uint> &in colors) {
	int length = colors.length();
	bool success = (@redeemerPickupSprite = anim).allocate(array<uint>(length, 8)) !is null;
	if (success) {
		uint srcSet = jjAnimSets[ANIM::SONCSHIP];
		for (int i = 0; i < length; i++) {
			uint color = colors[i];
			uint destAnimOffset = anim + i;
			uint srcAnim = jjAnimations[srcSet + 0];
			uint destAnim = jjAnimations[destAnimOffset + 0];
			for (int k = 0; k < 8; 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 >= 40 && pixel < 48)
							image[m, l] = color;
					}
				}
			if (!image.save(jjAnimFrames[destAnim + k]))
				return false;
			}
		}
	}
	return success;
}