| Name | Author | Game Mode | Rating | |||||
|---|---|---|---|---|---|---|---|---|
| NpcBunnies | Cranky | Mutator | N/A | |||||
#include "CharactersModAnim.asc"
namespace npcBunniesAnimations
{
array<uint> emptyCharSet;
array<int> animTypes;
void FurSetup_AdditionalCharacters(int type)
{
if(type != 0) emptyCharSet[type] = emptyCharSet[type-1] + 1;
while (jjAnimSets[ANIM::CUSTOM[emptyCharSet[type]]].firstAnim != 0)
{
++emptyCharSet[type];
}
if(type == npcBunniesCore::NpcAnim::DEVAN)
{
jjAnimSets[ANIM::DEVILDEVAN].load(); //load Devan
animTypes[type] = ANIM::DEVILDEVAN;
}
else if(type == npcBunniesCore::NpcAnim::EVA)
{
jjAnimSets[ANIM::EVA].load();
jjAnimSets[ANIM::FLAG].load();
animTypes[type] = ANIM::EVA;
}
else
{
jjANIMSET@ emptyCustomAnim = jjAnimSets[ANIM::CUSTOM[emptyCharSet[type]]];
emptyCustomAnim.load(type, "charactersMod.j2a");
animTypes[type] = ANIM::CUSTOM[emptyCharSet[type]];
RegisterCharactersModAnimSet(animTypes[type], type);
}
}
//to use as index for customMenu[] characters: the big characters in MenuAnimsMod.j2a
array<int> charFind = { 0, CHAR::JAZZ, CHAR::SPAZ, CHAR::LORI, CHAR::BIRD, CHAR::FROG, CHAR::BIRD2 };
//the ANIM::FACES order in JazzSD.exe (index 39 in 1.23 and 40 in 1.24). For 1.23, this is initialized without LORI in onLevelLoad()
array<int> charFaces = { CHAR::BIRD, CHAR::BIRD2, CHAR::FROG, CHAR::JAZZ, CHAR::LORI, CHAR::SPAZ };
array<int> npcFaces = {0, npcBunniesCore::NpcAnim::LORI, npcBunniesCore::NpcAnim::LORI, npcBunniesCore::NpcAnim::MARIO, npcBunniesCore::NpcAnim::FROG, npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::BIRD,
npcBunniesCore::NpcAnim::SONIC, npcBunniesCore::NpcAnim::SONIC, npcBunniesCore::NpcAnim::TAILS, npcBunniesCore::NpcAnim::TAILS, npcBunniesCore::NpcAnim::JJ1, npcBunniesCore::NpcAnim::JJ1, npcBunniesCore::NpcAnim::DEVAN, npcBunniesCore::NpcAnim::DEVAN,
npcBunniesCore::NpcAnim::YOSHI, npcBunniesCore::NpcAnim::YOSHI
};
array<int> npcFacesDefault = {npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::FROG, npcBunniesCore::NpcAnim::JAZZ, npcBunniesCore::NpcAnim::LORI, npcBunniesCore::NpcAnim::SPAZ };
array<int> customMenu(5,0); //index 0 will have nothing. Starts at 1 with Jazz
void loadMenuAnims()
{
if(!jjIsTSF)
{
charFaces = { CHAR::BIRD, CHAR::BIRD2, CHAR::FROG, CHAR::JAZZ, CHAR::SPAZ };
npcFacesDefault = {npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::BIRD, npcBunniesCore::NpcAnim::FROG, npcBunniesCore::NpcAnim::JAZZ, npcBunniesCore::NpcAnim::SPAZ };
}
for(uint i=0; i<3; i++)
{
if(i!=0) customMenu[i+1] = customMenu[i] + 1;
while (jjAnimSets[ANIM::CUSTOM[customMenu[i+1]]].firstAnim != 0) //find an unused slot in ANIM::CUSTOM
++customMenu[i+1];
jjANIMSET@ animMenu = jjAnimSets[ANIM::CUSTOM[customMenu[i+1]]];
animMenu.load(i, "MenuAnimsMod.j2a");
}
}
void LoadNpcUiIconAnimSets()
{
jjAnimSets[ANIM::BAT].load();
jjAnimSets[ANIM::BUMBEE].load();
jjAnimSets[ANIM::BEEBOY].load();
jjAnimSets[ANIM::BEES].load();
jjAnimSets[ANIM::BUTTERFLY].load();
jjAnimSets[ANIM::DEMON].load();
jjAnimSets[ANIM::DOG].load();
jjAnimSets[ANIM::DRAGON].load();
jjAnimSets[ANIM::DRAGFLY].load();
jjAnimSets[ANIM::FATCHK].load();
jjAnimSets[ANIM::FENCER].load();
jjAnimSets[ANIM::FISH].load();
jjAnimSets[ANIM::HATTER].load();
jjAnimSets[ANIM::HELMUT].load();
jjAnimSets[ANIM::LABRAT].load();
jjAnimSets[ANIM::LIZARD].load();
jjAnimSets[ANIM::XLIZARD].load();
jjAnimSets[ANIM::MONKEY].load();
jjAnimSets[ANIM::TURTLE].load();
jjAnimSets[ANIM::XTURTLE].load();
jjAnimSets[ANIM::TUBETURT].load();
jjAnimSets[ANIM::TUFTUR].load();
jjAnimSets[ANIM::RAPIER].load();
jjAnimSets[ANIM::RAVEN].load();
jjAnimSets[ANIM::SKELETON].load();
jjAnimSets[ANIM::SPARK].load();
jjAnimSets[ANIM::SUCKER].load();
jjAnimSets[ANIM::CAT].load();
jjAnimSets[ANIM::CAT2].load();
jjAnimSets[ANIM::MOTH].load();
jjAnimSets[ANIM::WITCH].load();
jjAnimSets[ANIM::BILSBOSS].load();
jjAnimSets[ANIM::XBILSY].load();
jjAnimSets[ANIM::BOSS].load();
jjAnimSets[ANIM::BUBBA].load();
jjAnimSets[ANIM::DEVAN].load();
jjAnimSets[ANIM::DEVILDEVAN].load();
jjAnimSets[ANIM::EVA].load();
jjAnimSets[ANIM::QUEEN].load();
jjAnimSets[ANIM::ROBOT].load();
jjAnimSets[ANIM::ROCKTURT].load();
jjAnimSets[ANIM::TUFBOSS].load();
jjAnimSets[ANIM::TWEEDLE].load();
jjAnimSets[ANIM::UTERUS].load();
}
class DrawParams
{
float xPos;
float yPos;
int animSet;
int anim;
int frame = 0;
float sizeX = 1;
float sizeY = 1;
SPRITE::Mode spriteMode;
int param;
int grav;
int animation;
void add(float xPos, float yPos, int animSet, int anim, int frame, float sizeX, float sizeY, SPRITE::Mode spriteMode, int param, int grav, int animation = -1)
{
this.xPos = xPos;
this.yPos = yPos;
this.animSet = animSet;
this.anim = anim;
this.frame = frame;
this.sizeX = sizeX;
this.sizeY = sizeY;
this.spriteMode = spriteMode;
this.param = param;
this.grav = grav;
this.animation = animation;
}
}
bool charactersModAvailable = false;
array<array<int>> charactersModAnimMerged;
array<array<int>> charactersModAnimStart;
array<array<int>> charactersModAnimCount;
array<int> charactersModSetByAnimSet(4096, -1);
void InitializeCharactersModTables()
{
charactersModAnimMerged.resize(16);
charactersModAnimStart.resize(16);
charactersModAnimCount.resize(16);
for(uint i = 0; i < charactersModAnimStart.length; i++)
{
charactersModAnimMerged[i].resize(128);
charactersModAnimStart[i].resize(128);
charactersModAnimCount[i].resize(128);
for(uint j = 0; j < 128; j++)
{
charactersModAnimMerged[i][j] = -1;
charactersModAnimStart[i][j] = -1;
charactersModAnimCount[i][j] = 0;
}
}
}
bool LoadCharactersModAnimIndexes()
{
InitializeCharactersModTables();
// CharactersModAnim.asc replaces the text table. Keep these local arrays
// because the rest of this file already uses them for drawing.
for(int sourceSet = 0; sourceSet < int(charactersModAnimStart.length); sourceSet++)
{
int animCount = CharactersModAnim::AnimCount(sourceSet);
if(animCount > int(charactersModAnimStart[sourceSet].length))
animCount = int(charactersModAnimStart[sourceSet].length);
for(int anim = 0; anim < animCount; anim++)
{
charactersModAnimMerged[sourceSet][anim] = CharactersModAnim::MergedAnim(sourceSet, anim);
charactersModAnimStart[sourceSet][anim] = CharactersModAnim::StartFrame(sourceSet, anim);
charactersModAnimCount[sourceSet][anim] = CharactersModAnim::FrameCount(sourceSet, anim);
}
}
return true;
}
void LoadCharactersModAnimationIndexes()
{
charactersModAvailable = LoadCharactersModAnimIndexes();
}
void RegisterCharactersModAnimSet(int animSet, int sourceSet)
{
if(animSet < 0 || sourceSet < 0) return;
if(animSet >= int(charactersModSetByAnimSet.length))
{
uint oldLength = charactersModSetByAnimSet.length;
charactersModSetByAnimSet.resize(animSet + 1);
for(uint i = oldLength; i < charactersModSetByAnimSet.length; i++) charactersModSetByAnimSet[i] = -1;
}
charactersModSetByAnimSet[animSet] = sourceSet;
}
int CharactersModSourceSetForAnimSet(int animSet)
{
if(animSet >= 0 && animSet < int(charactersModSetByAnimSet.length)) return charactersModSetByAnimSet[animSet];
return -1;
}
int CharactersModSourceSetForDraw(DrawParams &in draw)
{
if(draw.animation == -2) return -1;
if(draw.animation >= 0) return draw.animation;
return CharactersModSourceSetForAnimSet(draw.animSet);
}
int CharactersModCurFrame(int animSet, int anim, int frame)
{
return jjAnimations[jjAnimSets[animSet].firstAnim + anim].firstFrame + frame;
}
bool ApplyCharactersModFrame(DrawParams &inout draw)
{
if(!charactersModAvailable) return true;
int sourceSet = CharactersModSourceSetForDraw(draw);
if(sourceSet < 0) return true;
if(sourceSet >= int(charactersModAnimStart.length)) return false;
if(draw.anim < 0 || draw.anim >= int(charactersModAnimStart[sourceSet].length)) return false;
int frameCount = charactersModAnimCount[sourceSet][draw.anim];
if(frameCount <= 0) return false;
int mergedAnim = charactersModAnimMerged[sourceSet][draw.anim];
if(mergedAnim < 0) return false;
int remappedFrame = draw.frame % frameCount;
if(remappedFrame < 0) remappedFrame += frameCount;
draw.frame = charactersModAnimStart[sourceSet][draw.anim] + remappedFrame;
draw.anim = mergedAnim;
draw.animation = -2;
return true;
}
bool ApplyMergedCharacterLayer(DrawParams &inout draw, int division, int layer)
{
int sourceSet = charactersModAvailable ? CharactersModSourceSetForDraw(draw) : -1;
if(sourceSet < 0)
{
draw.frame = GetMergedAnimationFrame(draw.animSet, draw.anim, draw.frame, division, layer);
return true;
}
if(sourceSet >= int(charactersModAnimStart.length)) return false;
if(draw.anim < 0 || draw.anim >= int(charactersModAnimStart[sourceSet].length)) return false;
int frameCount = charactersModAnimCount[sourceSet][draw.anim];
if(frameCount <= 0) return false;
int mergedAnim = charactersModAnimMerged[sourceSet][draw.anim];
if(mergedAnim < 0) return false;
if(division <= 1) division = 1;
if(layer < 0) layer = 0;
if(layer >= division) layer = division - 1;
int layerFrameCount = frameCount / division;
if(layerFrameCount <= 0) return false;
int frameInLayer = draw.frame % layerFrameCount;
if(frameInLayer < 0) frameInLayer += layerFrameCount;
draw.frame = charactersModAnimStart[sourceSet][draw.anim] + layer * layerFrameCount + frameInLayer;
draw.anim = mergedAnim;
draw.animation = -2;
return true;
}
int GetMergedAnimationFrame(int animSet, int anim, int frame, int division, int layer)
{
if(division <= 1) return frame;
if(layer < 0) layer = 0;
if(layer >= division) layer = division - 1;
int animationIndex = jjAnimSets[animSet].firstAnim + anim;
int frameCount = jjAnimations[animationIndex].frameCount;
int layerFrameCount = frameCount / division;
if(layerFrameCount <= 0) return frame;
int frameInLayer = frame % layerFrameCount;
if(frameInLayer < 0) frameInLayer += layerFrameCount;
return layer * layerFrameCount + frameInLayer;
}
void DrawMergedCharacterLayer(DrawParams draw, int division, int layer)
{
bool useCurFrame = charactersModAvailable && CharactersModSourceSetForDraw(draw) >= 0;
if(!ApplyMergedCharacterLayer(draw, division, layer)) return;
if(useCurFrame)
jjDrawResizedSpriteFromCurFrame(draw.xPos, draw.yPos, CharactersModCurFrame(draw.animSet, draw.anim, draw.frame), draw.sizeX, draw.sizeY, draw.spriteMode, draw.param, 4, 4, -1);
else
DrawCharacter(draw);
}
void DrawMergedCharacterLayerOnCanvas(jjCANVAS@ canvas, DrawParams draw, int division, int layer)
{
if(!ApplyMergedCharacterLayer(draw, division, layer)) return;
DrawCharacterOnCanvas(canvas, draw);
}
void DrawCharacter(DrawParams draw)
{
bool useCurFrame = charactersModAvailable && CharactersModSourceSetForDraw(draw) >= 0;
if(!ApplyCharactersModFrame(draw)) return;
if(useCurFrame)
jjDrawResizedSpriteFromCurFrame(draw.xPos, draw.yPos, CharactersModCurFrame(draw.animSet, draw.anim, draw.frame), draw.sizeX, draw.sizeY, draw.spriteMode, draw.param, 4, 4, -1);
else
jjDrawResizedSprite(draw.xPos, draw.yPos, draw.animSet, draw.anim, draw.frame, draw.sizeX, draw.sizeY, draw.spriteMode, draw.param, 4, 4, -1);
}
void DrawCharacterOnCanvas(jjCANVAS@ canvas, DrawParams draw)
{
bool useCurFrame = charactersModAvailable && CharactersModSourceSetForDraw(draw) >= 0;
if(!ApplyCharactersModFrame(draw)) return;
if(useCurFrame)
canvas.drawResizedSpriteFromCurFrame(int(draw.xPos), int(draw.yPos), CharactersModCurFrame(draw.animSet, draw.anim, draw.frame), draw.sizeX, draw.sizeY, draw.spriteMode, draw.param);
else
canvas.drawResizedSprite(int(draw.xPos), int(draw.yPos), draw.animSet, draw.anim, draw.frame, draw.sizeX, draw.sizeY, draw.spriteMode, draw.param);
}
int getTypeFromTypeName(string typeName)
{
bool explicitBossType = int(typeName.findFirst("Boss:")) >= 0 || int(typeName.findFirst("npcBunniesAnimations::NpcBoss::")) >= 0;
int namespaceSep = int(typeName.findFirst("::"));
if(namespaceSep >= 0 && namespaceSep + 2 < int(typeName.length))
{
typeName = typeName.substr(namespaceSep + 2, typeName.length - namespaceSep - 2);
}
else
{
int colon = int(typeName.findFirst(":"));
if(colon >= 0 && colon + 1 < int(typeName.length)) typeName = typeName.substr(colon + 1, typeName.length - colon - 1);
}
while(typeName.length > 0 && typeName[0] == 32) typeName = typeName.substr(1, typeName.length - 1);
if(explicitBossType)
{
if(jjRegexMatch(typeName, "XmasBilsy", true)) return npcBunniesAnimations::NpcBoss::XmasBilsy;
if(jjRegexMatch(typeName, "Bilsy", true)) return npcBunniesAnimations::NpcBoss::Bilsy;
if(jjRegexMatch(typeName, "Bolly", true)) return npcBunniesAnimations::NpcBoss::Bolly;
if(jjRegexMatch(typeName, "Bubba", true)) return npcBunniesAnimations::NpcBoss::Bubba;
if(jjRegexMatch(typeName, "DevilDevan", true)) return npcBunniesAnimations::NpcBoss::DevilDevan;
if(jjRegexMatch(typeName, "Queen", true)) return npcBunniesAnimations::NpcBoss::Queen;
if(jjRegexMatch(typeName, "Robot", true)) return npcBunniesAnimations::NpcBoss::Robot;
if(jjRegexMatch(typeName, "RocketTurtle", true)) return npcBunniesAnimations::NpcBoss::RocketTurtle;
if(jjRegexMatch(typeName, "TufBoss", true)) return npcBunniesAnimations::NpcBoss::TufBoss;
if(jjRegexMatch(typeName, "Tweedle", true)) return npcBunniesAnimations::NpcBoss::Tweedle;
if(jjRegexMatch(typeName, "Uterus", true)) return npcBunniesAnimations::NpcBoss::Uterus;
}
if(parseInt(typeName) == npcBunniesCore::NpcAnim::JAZZ || jjRegexMatch(typeName, "Jazz", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::JAZZ]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::SPAZ || jjRegexMatch(typeName, "Spaz", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::SPAZ]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::LORI || jjRegexMatch(typeName, "Lori", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::LORI]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::FROG || jjRegexMatch(typeName, "Frog", true)) return npcBunniesCore::NpcAnim::FROG;
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::BIRD || jjRegexMatch(typeName, "Bird", true)) return npcBunniesCore::NpcAnim::BIRD;
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::DEVAN || jjRegexMatch(typeName, "Devan", true)) return ANIM::DEVILDEVAN;
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::MARIO || jjRegexMatch(typeName, "Mario", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::MARIO]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::SONIC || jjRegexMatch(typeName, "Sonic", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::SONIC]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::TAILS || jjRegexMatch(typeName, "Tails", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::TAILS]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::JJ1 || jjRegexMatch(typeName, "JJ1", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::JJ1]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::YOSHI || jjRegexMatch(typeName, "Yoshi", true)) return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::YOSHI]];
else if(parseInt(typeName) == npcBunniesCore::NpcAnim::EVA || jjRegexMatch(typeName, "Eva", true)) return ANIM::EVA;
else if(jjRegexMatch(typeName, "Static", true)) return npcBunniesAnimations::NpcStatic::Static;
else if(jjRegexMatch(typeName, "Bat", true)) return npcBunniesAnimations::NpcMonster::Bat;
else if(jjRegexMatch(typeName, "BeeBoy", true)) return npcBunniesAnimations::NpcMonster::BeeBoy;
else if(jjRegexMatch(typeName, "Bees", true)) return npcBunniesAnimations::NpcMonster::Bees;
else if(jjRegexMatch(typeName, "Bumbee", true) || jjRegexMatch(typeName, "Bee", true)) return npcBunniesAnimations::NpcMonster::Bee;
else if(jjRegexMatch(typeName, "Butterfly", true)) return npcBunniesAnimations::NpcMonster::Butterfly;
else if(jjRegexMatch(typeName, "Crab", true)) return npcBunniesAnimations::NpcMonster::Crab;
else if(jjRegexMatch(typeName, "Demon", true)) return npcBunniesAnimations::NpcMonster::Demon;
else if(jjRegexMatch(typeName, "DoggyDogg", true) || jjRegexMatch(typeName, "Dog", true)) return npcBunniesAnimations::NpcMonster::DoggyDogg;
else if(jjRegexMatch(typeName, "Dragfly", true) || jjRegexMatch(typeName, "Dragonfly", true)) return npcBunniesAnimations::NpcMonster::Dragonfly;
else if(jjRegexMatch(typeName, "Dragon", true)) return npcBunniesAnimations::NpcMonster::Dragon;
else if(jjRegexMatch(typeName, "Fatchk", true) || jjRegexMatch(typeName, "FatChick", true)) return npcBunniesAnimations::NpcMonster::FatChick;
else if(jjRegexMatch(typeName, "Fencer", true)) return npcBunniesAnimations::NpcMonster::Fencer;
else if(jjRegexMatch(typeName, "Fish", true)) return npcBunniesAnimations::NpcMonster::Fish;
else if(jjRegexMatch(typeName, "Hatter", true)) return npcBunniesAnimations::NpcMonster::Hatter;
else if(jjRegexMatch(typeName, "Helmut", true)) return npcBunniesAnimations::NpcMonster::Helmut;
else if(jjRegexMatch(typeName, "LabRat", true)) return npcBunniesAnimations::NpcMonster::LabRat;
else if(jjRegexMatch(typeName, "XmasFloatLizard", true) || jjRegexMatch(typeName, "XmasFloatLz", true) || jjRegexMatch(typeName, "XmasFloat", true) || jjRegexMatch(typeName, "XmasFlyingLizard", true)) return npcBunniesAnimations::NpcMonster::XmasFloatLizard;
else if(jjRegexMatch(typeName, "FloatLizard", true) || jjRegexMatch(typeName, "FloatLz", true)) return npcBunniesAnimations::NpcMonster::FloatLizard;
else if(jjRegexMatch(typeName, "XLizard", true) || jjRegexMatch(typeName, "XmasLizard", true) || jjRegexMatch(typeName, "XmasLz", true)) return npcBunniesAnimations::NpcMonster::XmasLizard;
else if(jjRegexMatch(typeName, "Lizard", true)) return npcBunniesAnimations::NpcMonster::Lizard;
else if(jjRegexMatch(typeName, "StandMonkey", true)) return npcBunniesAnimations::NpcMonster::StandMonkey;
else if(jjRegexMatch(typeName, "Monkey", true)) return npcBunniesAnimations::NpcMonster::Monkey;
else if(jjRegexMatch(typeName, "XmasNormalTurtle", true) || jjRegexMatch(typeName, "XmasTurt", true)) return npcBunniesAnimations::NpcMonster::XmasNormalTurtle;
else if(jjRegexMatch(typeName, "TubeTurt", true) || jjRegexMatch(typeName, "TubeTurtle", true)) return npcBunniesAnimations::NpcMonster::TubeTurtle;
else if(jjRegexMatch(typeName, "TufTurt", true) || jjRegexMatch(typeName, "TufTurtle", true)) return npcBunniesAnimations::NpcMonster::TufTurtle;
else if(jjRegexMatch(typeName, "NormalTurtle", true) || jjRegexMatch(typeName, "Turtle", true)) return npcBunniesAnimations::NpcMonster::NormalTurtle;
else if(jjRegexMatch(typeName, "Rapier", true)) return npcBunniesAnimations::NpcMonster::Rapier;
else if(jjRegexMatch(typeName, "Raven", true)) return npcBunniesAnimations::NpcMonster::Raven;
else if(jjRegexMatch(typeName, "Skeleton", true)) return npcBunniesAnimations::NpcMonster::Skeleton;
else if(jjRegexMatch(typeName, "Spark", true)) return npcBunniesAnimations::NpcMonster::Spark;
else if(jjRegexMatch(typeName, "FloatSucker", true) || jjRegexMatch(typeName, "FloatSuck", true)) return npcBunniesAnimations::NpcMonster::FloatSucker;
else if(jjRegexMatch(typeName, "Sucker", true)) return npcBunniesAnimations::NpcMonster::Sucker;
else if(jjRegexMatch(typeName, "Cat2", true) || jjRegexMatch(typeName, "PacmanGhost", true) || jjRegexMatch(typeName, "PacGhost", true)) return npcBunniesAnimations::NpcMonster::PacmanGhost;
else if(jjRegexMatch(typeName, "Cat", true)) return npcBunniesAnimations::NpcMonster::Cat;
else if(jjRegexMatch(typeName, "Moth", true)) return npcBunniesAnimations::NpcMonster::Moth;
else if(jjRegexMatch(typeName, "Witch", true)) return npcBunniesAnimations::NpcMonster::Witch;
else if(jjRegexMatch(typeName, "XBilsy", true) || jjRegexMatch(typeName, "XmasBilsy", true)) return npcBunniesAnimations::NpcBoss::XmasBilsy;
else if(jjRegexMatch(typeName, "BilsBoss", true) || jjRegexMatch(typeName, "Bilsy", true)) return npcBunniesAnimations::NpcBoss::Bilsy;
else if(jjRegexMatch(typeName, "Bolly", true)) return npcBunniesAnimations::NpcBoss::Bolly;
else if(jjRegexMatch(typeName, "Bubba", true)) return npcBunniesAnimations::NpcBoss::Bubba;
else if(jjRegexMatch(typeName, "DevilDevan", true)) return npcBunniesAnimations::NpcBoss::DevilDevan;
else if(jjRegexMatch(typeName, "Queen", true)) return npcBunniesAnimations::NpcBoss::Queen;
else if(jjRegexMatch(typeName, "Robot", true)) return npcBunniesAnimations::NpcBoss::Robot;
else if(jjRegexMatch(typeName, "RockTurt", true) || jjRegexMatch(typeName, "RocketTurtle", true)) return npcBunniesAnimations::NpcBoss::RocketTurtle;
else if(jjRegexMatch(typeName, "TufBoss", true)) return npcBunniesAnimations::NpcBoss::TufBoss;
else if(jjRegexMatch(typeName, "Tweedle", true)) return npcBunniesAnimations::NpcBoss::Tweedle;
else if(jjRegexMatch(typeName, "Uterus", true)) return npcBunniesAnimations::NpcBoss::Uterus;
else if(jjRegexMatch(typeName, "WaterShield", true) || jjRegexMatch(typeName, "BubbleShield", true) || jjRegexMatch(typeName, "BubbleSh", true)) return npcBunniesAnimations::NpcObject::WaterShield;
else if(jjRegexMatch(typeName, "FireShield", true) || jjRegexMatch(typeName, "FireSh", true)) return npcBunniesAnimations::NpcObject::FireShield;
else if(jjRegexMatch(typeName, "LightningShield", true) || jjRegexMatch(typeName, "ElectricShield", true) || jjRegexMatch(typeName, "ElectroShield", true) || jjRegexMatch(typeName, "ElectroSh", true)) return npcBunniesAnimations::NpcObject::LightningShield;
else if(jjRegexMatch(typeName, "MorphMonitor", true) || jjRegexMatch(typeName, "Morph", true)) return npcBunniesAnimations::NpcObject::MorphMonitor;
else if(jjRegexMatch(typeName, "BirdMonitor", true) || jjRegexMatch(typeName, "BirdMorph", true)) return npcBunniesAnimations::NpcObject::BirdMonitor;
else if(jjRegexMatch(typeName, "BlasterPowerup", true) || jjRegexMatch(typeName, "Blaster", true)) return npcBunniesAnimations::NpcObject::BlasterPowerup;
else if(jjRegexMatch(typeName, "BouncerPowerup", true) || jjRegexMatch(typeName, "Bouncer", true)) return npcBunniesAnimations::NpcObject::BouncerPowerup;
else if(jjRegexMatch(typeName, "IcePowerup", true) || jjRegexMatch(typeName, "Freezer", true) || jjRegexMatch(typeName, "Ice", true)) return npcBunniesAnimations::NpcObject::IcePowerup;
else if(jjRegexMatch(typeName, "SeekerPowerup", true) || jjRegexMatch(typeName, "Seeker", true)) return npcBunniesAnimations::NpcObject::SeekerPowerup;
else if(jjRegexMatch(typeName, "RFPowerup", true) || jjRegexMatch(typeName, "RF", true)) return npcBunniesAnimations::NpcObject::RFPowerup;
else if(jjRegexMatch(typeName, "ToasterPowerup", true) || jjRegexMatch(typeName, "Toaster", true)) return npcBunniesAnimations::NpcObject::ToasterPowerup;
else if(jjRegexMatch(typeName, "Gun8Powerup", true) || jjRegexMatch(typeName, "Pepper", true) || jjRegexMatch(typeName, "Gun8", true)) return npcBunniesAnimations::NpcObject::Gun8Powerup;
else if(jjRegexMatch(typeName, "Gun9Powerup", true) || jjRegexMatch(typeName, "Electro", true) || jjRegexMatch(typeName, "Gun9", true)) return npcBunniesAnimations::NpcObject::Gun9Powerup;
return ANIM::CUSTOM[emptyCharSet[npcBunniesCore::NpcAnim::JAZZ]]; //default to Jazz
}
/// JUST FOR TESTING /// These will be removed when you will load NPCs from the _npc file
/// Setup_NPC(); insertFurs(); are just for testing
void Setup_NPC()
{
npcBunniesCore::furClass defaultFur;
defaultFur.c1 = 16;
defaultFur.c2 = 24;
defaultFur.c3 = 32;
defaultFur.c4 = 40;
array<string> npc_names = {"Jazz", "Spaz", "Lori", "Frog", "Bird", "Devan", "Mario", "Sonic", "Tails", "JJ1", "Yoshi", "Eva"};
array<int> x_array = {64, 66, 68, 78, 83, 88, 93, 98, 103, 108, 113, 117};
for(int i=0; i<12; i++)
{
npcBunniesCore::npcBunny npc;
//type
npc.id = i;
npc.name = npc_names[i];
npc.type = getTypeFromTypeName(npc_names[i]); //was NpcList[i];
//location
npc.xTile = x_array[i];
npc.yTile = 253;
//direction
npc.direction = -1;
//fur
npc.fur.c1 = 40;
npc.fur.c2 = 32;
npc.fur.c3 = 80;
npc.fur.c4 = 64;
//moveable
npc.moveable = true;
npc.move = false; //it is moveable but it is not moving
npc.playerFollowing = -1;
npc = npcBunniesCore::InitNpcQuestState(npc);
//the object itself
int objId = jjAddObject(OBJECT::CHERRY, npc.xTile*32, npc.yTile*32);
jjOBJ@ obj = jjObjects[objId];
obj.behavior = npcBunniesMovement::Npc();
obj.direction = npc.direction;
obj.scriptedCollisions = true;
obj.playerHandling = HANDLING::SPECIAL;
obj.var[0] = npc.id + 1;
npc.objectID = obj.objectID;
//point to stand on
npc.fallToX = obj.xPos;
npc.fallToY = obj.yPos;
//adding the NPC in npcObjectIds dictionary and npcBunnies array
npcBunniesCore::npcObjectIds.set(obj.objectID+'', npc.id);
npcBunniesCore::npcBunnies.insertLast(npc);
//--- Add dialogue to Jazz NPC ---
npcBunniesCore::npcBunnies[i].dialogueSets =
{
@npcBunniesDialogue::DialogueSet
(
dialogue:
{
@npcBunniesDialogue::DialogueLine
(
personId: 0,
isNpc: 1,
text: "Test Line 1"
),
@npcBunniesDialogue::DialogueLine
(
personId: 1,
isNpc: 0,
text: "Test Line 2"
)
},
choices:
{
@npcBunniesDialogue::Choice
(
choiceText: "Choice A"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice B"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice C"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice D",
goToSet: 1
)
},
choicesAnswerMethod: 1
),
@npcBunniesDialogue::DialogueSet
(
dialogue:
{
@npcBunniesDialogue::DialogueLine
(
personId: 0,
isNpc: 1,
text: "Test Line 3"
),
@npcBunniesDialogue::DialogueLine
(
personId: 0,
isNpc: 0,
text: "Test Line 4"
)
},
choices:
{
@npcBunniesDialogue::Choice
(
choiceText: "Choice A"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice B"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice C"
),
@npcBunniesDialogue::Choice
(
choiceText: "Choice D",
goToSet: 0
)
},
choicesAnswerMethod: 2
)
};
}
//It works! These alerts prove it:
//jjAlert("Dialogue 1: "+npcBunnies[0].dialogueSets[0].dialogue[0].text);
//jjAlert("Dialogue 2: "+npcBunnies[0].dialogueSets[0].dialogue[1].text);
//jjAlert("Dialogue 3: "+npcBunnies[0].dialogueSets[1].dialogue[0].text);
//jjAlert("Dialogue 4: "+npcBunnies[0].dialogueSets[1].dialogue[1].text);
}
npcBunniesDialogue::DialogueSet@ CreateDialogueSet(array<npcBunniesDialogue::DialogueLine@> dialogue, array<npcBunniesDialogue::Choice@> choices, int choicesAnswerMethod)
{
return npcBunniesDialogue::DialogueSet(dialogue, choices, choicesAnswerMethod);
}
//----------------------------------------------------------------------------------------------------
//these arrays go with charIndex: Jazz, Spaz, Lori, Frog, Bird, Devan, Mario, Sonic, Tails, JJ1, Yoshi
array<int> adjustFaceX = {0, 0,0,0, 5, 0, 5, 15, 5, 10, 10, 10};
array<int> adjustFaceY = {0, 0,0,0, 15, 0, 45, 30, 15, 40, 45, 40};
array<float> adjustSizeX = {0, 1,1,1, 1, 1, 1, 1, 1,1.3,1.3,1.5};
array<float> adjustSizeY = {0, 1,1,1, 1, 1, 1, 1, 1,1.3,1.3,1.3};
array<int> facePalshift = {0, 1,1,1, 9, 0, 1, 2, 3, 4, 1, 1};
int AnimatedNpcUiFrame(const NpcUiAnimation &in icon)
{
if(icon.frameCount <= 1) return icon.firstFrame;
int speed = icon.ticksPerFrame <= 0 ? 6 : icon.ticksPerFrame;
return icon.firstFrame + ((jjGameTicks / speed) % icon.frameCount);
}
void DrawNpcUiIcon(jjCANVAS@ canvas, int x, int y, const NpcUiAnimation &in icon, float size = 0.75)
{
if(icon.hidden) return;
canvas.drawResizedSprite(x + icon.offsetX, y + icon.offsetY - 8, icon.animSet, icon.anim, AnimatedNpcUiFrame(icon), size, size, icon.spriteMode, icon.param);
}
void DrawNpcItemAmountText(jjCANVAS@ canvas, int x, int y, const string &in amountText, int amountTextWidth, const NpcUiAnimation &in icon)
{
if(icon.hidden) return;
canvas.drawString(x, y, amountText, STRING::SMALL, STRING::NORMAL);
DrawNpcUiIcon(canvas, x + amountTextWidth + 8, y + 8, icon);
}
void DrawNpcItemAmount(jjCANVAS@ canvas, int x, int y, int amount, const NpcUiAnimation &in icon)
{
if(icon.hidden) return;
string amountText = amount + " x ";
DrawNpcItemAmountText(canvas, x, y, amountText, jjGetStringWidth(amountText, STRING::SMALL, STRING::NORMAL), icon);
}
int GetNpcItemAmountWidth(int amount)
{
return jjGetStringWidth(amount + " x ", STRING::SMALL, STRING::NORMAL) + 30;
}
int cachedHudCoinAmount = -999999;
int cachedHudGemAmount = -999999;
string cachedHudCoinText = "";
string cachedHudGemText = "";
int cachedHudCoinTextWidth = 0;
int cachedHudGemTextWidth = 0;
void UpdateNpcHudCoinCache(int amount)
{
if(cachedHudCoinAmount == amount) return;
cachedHudCoinAmount = amount;
cachedHudCoinText = amount + " x ";
cachedHudCoinTextWidth = jjGetStringWidth(cachedHudCoinText, STRING::SMALL, STRING::NORMAL);
}
void UpdateNpcHudGemCache(int amount)
{
if(cachedHudGemAmount == amount) return;
cachedHudGemAmount = amount;
cachedHudGemText = amount + " x ";
cachedHudGemTextWidth = jjGetStringWidth(cachedHudGemText, STRING::SMALL, STRING::NORMAL);
}
void DrawNpcCountsHud(jjPLAYER@ play, jjCANVAS@ canvas)
{
if(!npcBunniesCore::HUD_COUNTS_ON || play is null) return;
int x = npcBunniesCore::HUD_COUNTS_X;
int y = npcBunniesCore::HUD_COUNTS_Y;
int gemAmount = play.gems[GEM::RED] + 5 * play.gems[GEM::GREEN] + 10 * play.gems[GEM::BLUE] + 1 * play.gems[GEM::PURPLE];
UpdateNpcHudCoinCache(play.coins);
UpdateNpcHudGemCache(gemAmount);
NpcUiAnimation gemIcon;
GetGemUiIcon(GEM::RED, gemIcon);
NpcUiAnimation coinIcon;
GetNpcUiIcon(NpcUiIcon::Coin, coinIcon);
DrawNpcItemAmountText(canvas, x + 150 + 92, y, cachedHudGemText, cachedHudGemTextWidth, gemIcon);
DrawNpcItemAmountText(canvas, x + 150, y, cachedHudCoinText, cachedHudCoinTextWidth, coinIcon);
}
int GetMonsterQuestIconId(int eventID)
{
if(eventID == OBJECT::BAT) return NpcUiIcon::MonsterBat;
if(eventID == OBJECT::BEE) return NpcUiIcon::MonsterBee;
if(eventID == OBJECT::BEEBOY) return NpcUiIcon::MonsterBeeBoy;
if(eventID == OBJECT::BEES) return NpcUiIcon::MonsterBees;
if(eventID == OBJECT::BUTTERFLY) return NpcUiIcon::MonsterButterfly;
if(eventID == OBJECT::CRAB) return NpcUiIcon::MonsterCrab;
if(eventID == OBJECT::DEMON) return NpcUiIcon::MonsterDemon;
if(eventID == OBJECT::DOGGYDOGG) return NpcUiIcon::MonsterDoggyDogg;
if(eventID == OBJECT::DRAGON) return NpcUiIcon::MonsterDragon;
if(eventID == OBJECT::DRAGONFLY) return NpcUiIcon::MonsterDragonfly;
if(eventID == OBJECT::FATCHICK) return NpcUiIcon::MonsterFatChick;
if(eventID == OBJECT::FENCER) return NpcUiIcon::MonsterFencer;
if(eventID == OBJECT::FISH) return NpcUiIcon::MonsterFish;
if(eventID == OBJECT::HATTER) return NpcUiIcon::MonsterHatter;
if(eventID == OBJECT::HELMUT) return NpcUiIcon::MonsterHelmut;
if(eventID == OBJECT::LABRAT) return NpcUiIcon::MonsterLabRat;
if(eventID == OBJECT::LIZARD) return NpcUiIcon::MonsterLizard;
if(eventID == OBJECT::FLOATLIZARD) return NpcUiIcon::MonsterFloatLizard;
if(eventID == OBJECT::XMASLIZARD) return NpcUiIcon::MonsterXmasLizard;
if(eventID == OBJECT::MONKEY) return NpcUiIcon::MonsterMonkey;
if(eventID == OBJECT::STANDMONKEY) return NpcUiIcon::MonsterStandMonkey;
if(eventID == OBJECT::NORMTURTLE) return NpcUiIcon::MonsterNormalTurtle;
if(eventID == OBJECT::XMASNORMTURTLE) return NpcUiIcon::MonsterXmasNormalTurtle;
if(eventID == OBJECT::TUBETURTLE) return NpcUiIcon::MonsterTubeTurtle;
if(eventID == OBJECT::TUFTURT) return NpcUiIcon::MonsterTufTurtle;
if(eventID == OBJECT::RAPIER) return NpcUiIcon::MonsterRapier;
if(eventID == OBJECT::RAVEN) return NpcUiIcon::MonsterRaven;
if(eventID == OBJECT::SKELETON) return NpcUiIcon::MonsterSkeleton;
if(eventID == OBJECT::SPARK) return NpcUiIcon::MonsterSpark;
if(eventID == OBJECT::SUCKER) return NpcUiIcon::MonsterSucker;
if(eventID == OBJECT::FLOATSUCKER) return NpcUiIcon::MonsterFloatSucker;
if(eventID == OBJECT::CAT) return NpcUiIcon::MonsterCat;
if(eventID == OBJECT::PACMANGHOST) return NpcUiIcon::MonsterPacmanGhost;
if(eventID == OBJECT::MOTH) return NpcUiIcon::MonsterMoth;
if(eventID == OBJECT::WITCH) return NpcUiIcon::MonsterWitch;
return NpcUiIcon::MonsterDefault;
}
int GetBossQuestIconId(int eventID)
{
if(eventID == OBJECT::ROBOT) return NpcUiIcon::BossRobot;
if(eventID == OBJECT::BILSY) return NpcUiIcon::BossBilsy;
if(eventID == OBJECT::XMASBILSY) return NpcUiIcon::BossXmasBilsy;
if(eventID == OBJECT::BOLLY) return NpcUiIcon::BossBolly;
if(eventID == OBJECT::BUBBA) return NpcUiIcon::BossBubba;
if(eventID == OBJECT::DEVANROBOT) return NpcUiIcon::BossDevan;
if(eventID == OBJECT::DEVILDEVAN) return NpcUiIcon::BossDevilDevan;
if(eventID == OBJECT::QUEEN) return NpcUiIcon::BossQueen;
if(eventID == OBJECT::ROCKETTURTLE) return NpcUiIcon::BossRocketTurtle;
if(eventID == OBJECT::TUFBOSS) return NpcUiIcon::BossTufBoss;
if(eventID == OBJECT::TWEEDLEBOSS) return NpcUiIcon::BossTweedle;
if(eventID == OBJECT::UTERUS) return NpcUiIcon::BossUterus;
return NpcUiIcon::BossDefault;
}
int GetQuestIconId(npcBunniesQuests::NpcQuest@ quest)
{
if(quest.questType == npcBunniesQuests::QuestType::Coins) return NpcUiIcon::Coin;
if(quest.questType == npcBunniesQuests::QuestType::Gems) return NpcUiIcon::Gem;
if(quest.questType == npcBunniesQuests::QuestType::DefeatBoss) return GetBossQuestIconId(quest.objectType);
if(quest.questType == npcBunniesQuests::QuestType::DefeatMonster) return GetMonsterQuestIconId(quest.objectType);
return NpcUiIcon::Unknown;
}
void CopyNpcUiAnimation(const NpcUiAnimation &in source, NpcUiAnimation &inout result)
{
SetNpcUiAnimation(result, source.animSet, source.anim, source.firstFrame, source.frameCount, source.ticksPerFrame, source.spriteMode, source.param, source.offsetX, source.offsetY, source.hidden);
}
void GetQuestUiAnimation(npcBunniesQuests::NpcQuest@ quest, NpcUiAnimation &inout result)
{
if(quest is null) { SetNpcUiAnimation(result, 0, 0, 0, 1, 6); result.hidden = true; return; }
if(quest.iconHidden) { CopyNpcUiAnimation(quest.icon, result); result.hidden = true; return; }
if(quest.iconSpecified) { CopyNpcUiAnimation(quest.icon, result); return; }
if(quest.questType == npcBunniesQuests::QuestType::Gems) { GetGemUiIcon(quest.gemType, result); return; }
if(quest.questType == npcBunniesQuests::QuestType::DefeatMonster || quest.questType == npcBunniesQuests::QuestType::DefeatBoss)
{
int simpleType = GetQuestObjectNpcSimpleType(quest.objectType);
if(simpleType != 0)
{
LoadNpcQuestIconAnimSet(simpleType);
GetNpcSimpleAnimation(simpleType, result);
result.firstFrame = 0;
result.ticksPerFrame = 8;
return;
}
GetNpcUiIcon(GetQuestIconId(quest), result);
return;
}
GetNpcUiIcon(GetQuestIconId(quest), result);
}
void LoadNpcQuestIconAnimSet(int type)
{
int animSet = GetNpcSimpleAnimSet(type);
if(animSet >= 0 && jjAnimSets[animSet].firstAnim == 0) jjAnimSets[animSet].load();
}
int GetQuestObjectNpcSimpleType(int eventID)
{
if(eventID == OBJECT::BAT) return npcBunniesAnimations::NpcMonster::Bat;
if(eventID == OBJECT::BEE) return npcBunniesAnimations::NpcMonster::Bee;
if(eventID == OBJECT::BEEBOY) return npcBunniesAnimations::NpcMonster::BeeBoy;
if(eventID == OBJECT::BEES) return npcBunniesAnimations::NpcMonster::Bees;
if(eventID == OBJECT::BUTTERFLY) return npcBunniesAnimations::NpcMonster::Butterfly;
if(eventID == OBJECT::CRAB) return npcBunniesAnimations::NpcMonster::Crab;
if(eventID == OBJECT::DEMON) return npcBunniesAnimations::NpcMonster::Demon;
if(eventID == OBJECT::DOGGYDOGG) return npcBunniesAnimations::NpcMonster::DoggyDogg;
if(eventID == OBJECT::DRAGON) return npcBunniesAnimations::NpcMonster::Dragon;
if(eventID == OBJECT::DRAGONFLY) return npcBunniesAnimations::NpcMonster::Dragonfly;
if(eventID == OBJECT::FATCHICK) return npcBunniesAnimations::NpcMonster::FatChick;
if(eventID == OBJECT::FENCER) return npcBunniesAnimations::NpcMonster::Fencer;
if(eventID == OBJECT::FISH) return npcBunniesAnimations::NpcMonster::Fish;
if(eventID == OBJECT::HATTER) return npcBunniesAnimations::NpcMonster::Hatter;
if(eventID == OBJECT::HELMUT) return npcBunniesAnimations::NpcMonster::Helmut;
if(eventID == OBJECT::LABRAT) return npcBunniesAnimations::NpcMonster::LabRat;
if(eventID == OBJECT::LIZARD) return npcBunniesAnimations::NpcMonster::Lizard;
if(eventID == OBJECT::FLOATLIZARD) return npcBunniesAnimations::NpcMonster::FloatLizard;
if(eventID == OBJECT::XMASLIZARD) return npcBunniesAnimations::NpcMonster::XmasLizard;
if(eventID == OBJECT::XMASFLOATLIZARD) return npcBunniesAnimations::NpcMonster::XmasFloatLizard;
if(eventID == OBJECT::MONKEY) return npcBunniesAnimations::NpcMonster::Monkey;
if(eventID == OBJECT::STANDMONKEY) return npcBunniesAnimations::NpcMonster::StandMonkey;
if(eventID == OBJECT::NORMTURTLE) return npcBunniesAnimations::NpcMonster::NormalTurtle;
if(eventID == OBJECT::XMASNORMTURTLE) return npcBunniesAnimations::NpcMonster::XmasNormalTurtle;
if(eventID == OBJECT::TUBETURTLE) return npcBunniesAnimations::NpcMonster::TubeTurtle;
if(eventID == OBJECT::TUFTURT) return npcBunniesAnimations::NpcMonster::TufTurtle;
if(eventID == OBJECT::RAPIER) return npcBunniesAnimations::NpcMonster::Rapier;
if(eventID == OBJECT::RAVEN) return npcBunniesAnimations::NpcMonster::Raven;
if(eventID == OBJECT::SKELETON) return npcBunniesAnimations::NpcMonster::Skeleton;
if(eventID == OBJECT::SPARK) return npcBunniesAnimations::NpcMonster::Spark;
if(eventID == OBJECT::SUCKER) return npcBunniesAnimations::NpcMonster::Sucker;
if(eventID == OBJECT::FLOATSUCKER) return npcBunniesAnimations::NpcMonster::FloatSucker;
if(eventID == OBJECT::CAT) return npcBunniesAnimations::NpcMonster::Cat;
if(eventID == OBJECT::PACMANGHOST) return npcBunniesAnimations::NpcMonster::PacmanGhost;
if(eventID == OBJECT::MOTH) return npcBunniesAnimations::NpcMonster::Moth;
if(eventID == OBJECT::WITCH) return npcBunniesAnimations::NpcMonster::Witch;
if(eventID == OBJECT::BILSY) return npcBunniesAnimations::NpcBoss::Bilsy;
if(eventID == OBJECT::XMASBILSY) return npcBunniesAnimations::NpcBoss::XmasBilsy;
if(eventID == OBJECT::BOLLY) return npcBunniesAnimations::NpcBoss::Bolly;
if(eventID == OBJECT::BUBBA) return npcBunniesAnimations::NpcBoss::Bubba;
if(eventID == OBJECT::DEVILDEVAN) return npcBunniesAnimations::NpcBoss::DevilDevan;
if(eventID == OBJECT::QUEEN) return npcBunniesAnimations::NpcBoss::Queen;
if(eventID == OBJECT::ROBOT) return npcBunniesAnimations::NpcBoss::Robot;
if(eventID == OBJECT::ROCKETTURTLE) return npcBunniesAnimations::NpcBoss::RocketTurtle;
if(eventID == OBJECT::TUFBOSS) return npcBunniesAnimations::NpcBoss::TufBoss;
if(eventID == OBJECT::TWEEDLEBOSS) return npcBunniesAnimations::NpcBoss::Tweedle;
if(eventID == OBJECT::UTERUS) return npcBunniesAnimations::NpcBoss::Uterus;
return 0;
}
int GetRewardIconId(npcBunniesQuests::NpcReward@ reward)
{
if(reward is null) return NpcUiIcon::Unknown;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardCoins) return NpcUiIcon::Coin;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardGems) return NpcUiIcon::Gem;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardAmmo) return GetAmmoRewardIconId(reward.weaponType);
if(reward.rewardType == npcBunniesQuests::RewardType::RewardPowerup) return GetPowerupRewardIconId(reward.weaponType);
if(reward.rewardType == npcBunniesQuests::RewardType::RewardTeleport) return NpcUiIcon::Teleport;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardTrigger) return NpcUiIcon::Trigger;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardFastFire) return NpcUiIcon::FastFire;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardMoveable) return NpcUiIcon::Moveable;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardGuidePath) return NpcUiIcon::Teleport;
return NpcUiIcon::Unknown;
}
int GetAmmoRewardIconId(int weaponType)
{
if(weaponType == WEAPON::BOUNCER) return NpcUiIcon::AmmoBouncer3;
if(weaponType == WEAPON::ICE) return NpcUiIcon::AmmoIce3;
if(weaponType == WEAPON::SEEKER) return NpcUiIcon::AmmoSeeker3;
if(weaponType == WEAPON::RF) return NpcUiIcon::AmmoRF3;
if(weaponType == WEAPON::TOASTER) return NpcUiIcon::AmmoToaster3;
if(weaponType == WEAPON::TNT) return NpcUiIcon::AmmoTNT3;
if(weaponType == WEAPON::GUN8) return NpcUiIcon::AmmoGun8_3;
if(weaponType == WEAPON::GUN9) return NpcUiIcon::AmmoGun9_3;
return NpcUiIcon::AmmoDefault;
}
int GetPowerupRewardIconId(int weaponType)
{
if(weaponType == WEAPON::BLASTER) return NpcUiIcon::PowerupBlaster;
if(weaponType == WEAPON::BOUNCER) return NpcUiIcon::PowerupBouncer;
if(weaponType == WEAPON::ICE) return NpcUiIcon::PowerupIce;
if(weaponType == WEAPON::SEEKER) return NpcUiIcon::PowerupSeeker;
if(weaponType == WEAPON::RF) return NpcUiIcon::PowerupRF;
if(weaponType == WEAPON::TOASTER) return NpcUiIcon::PowerupToaster;
if(weaponType == WEAPON::GUN8) return NpcUiIcon::PowerupGun8;
if(weaponType == WEAPON::GUN9) return NpcUiIcon::PowerupGun9;
return NpcUiIcon::PowerupDefault;
}
void GetRewardUiAnimation(npcBunniesQuests::NpcReward@ reward, NpcUiAnimation &inout result)
{
if(reward is null) { SetNpcUiAnimation(result, 0, 0, 0, 1, 6); result.hidden = true; return; }
if(reward.iconHidden) { CopyNpcUiAnimation(reward.icon, result); result.hidden = true; return; }
if(reward.iconSpecified) { CopyNpcUiAnimation(reward.icon, result); return; }
if(reward.rewardType == npcBunniesQuests::RewardType::RewardGems) { GetGemUiIcon(reward.gemType, result); return; }
GetNpcUiIcon(GetRewardIconId(reward), result);
}
int GetRewardDisplayAmount(npcBunniesQuests::NpcReward@ reward)
{
if(reward.rewardType == npcBunniesQuests::RewardType::RewardPowerup || reward.rewardType == npcBunniesQuests::RewardType::RewardTeleport || reward.rewardType == npcBunniesQuests::RewardType::RewardTrigger || reward.rewardType == npcBunniesQuests::RewardType::RewardMoveable || reward.rewardType == npcBunniesQuests::RewardType::RewardGuidePath) return 1;
if(reward.rewardType == npcBunniesQuests::RewardType::RewardFastFire) return reward.amount > 0 ? reward.amount : 5;
return reward.amount > 0 ? reward.amount : 1;
}
void DrawNpcQuestRewardStrip(jjCANVAS@ canvas, npcBunniesDialogue::DialogueSet@ set)
{
if(set is null) return;
int totalWidth = 0;
for(uint i = 0; i < set.quests.length; i++)
if(set.quests[i] !is null && !set.quests[i].iconHidden) totalWidth += GetNpcItemAmountWidth(set.quests[i].amount) + 18;
for(uint i = 0; i < set.rewards.length; i++)
if(set.rewards[i] !is null && !set.rewards[i].iconHidden) totalWidth += GetNpcItemAmountWidth(GetRewardDisplayAmount(set.rewards[i])) + 18;
if(totalWidth <= 0) return;
int x = (jjResolutionWidth - totalWidth) / 2;
int y = 340;
for(uint i = 0; i < set.quests.length; i++)
{
npcBunniesQuests::NpcQuest@ quest = set.quests[i];
if(quest is null || quest.iconHidden) continue;
NpcUiAnimation icon;
GetQuestUiAnimation(quest, icon);
DrawNpcItemAmount(canvas, x, y, quest.amount, icon);
x += GetNpcItemAmountWidth(quest.amount) + 18;
}
for(uint i = 0; i < set.rewards.length; i++)
{
npcBunniesQuests::NpcReward@ reward = set.rewards[i];
if(reward is null || reward.iconHidden) continue;
int amount = GetRewardDisplayAmount(reward);
NpcUiAnimation icon;
GetRewardUiAnimation(reward, icon);
DrawNpcItemAmount(canvas, x, y, amount, icon);
x += GetNpcItemAmountWidth(amount) + 18;
}
}
enum NpcUiIcon
{
Coin = 0,
Gem = 1,
MonsterDefault = 2,
MonsterBat,
MonsterBee,
MonsterBeeBoy,
MonsterBees,
MonsterButterfly,
MonsterCrab,
MonsterDemon,
MonsterDoggyDogg,
MonsterDragon,
MonsterDragonfly,
MonsterFatChick,
MonsterFencer,
MonsterFish,
MonsterHatter,
MonsterHelmut,
MonsterLabRat,
MonsterLizard,
MonsterFloatLizard,
MonsterXmasLizard,
MonsterMonkey,
MonsterStandMonkey,
MonsterNormalTurtle,
MonsterXmasNormalTurtle,
MonsterTubeTurtle,
MonsterTufTurtle,
MonsterRapier,
MonsterRaven,
MonsterSkeleton,
MonsterSpark,
MonsterSucker,
MonsterFloatSucker,
MonsterCat,
MonsterPacmanGhost,
MonsterMoth,
MonsterWitch,
BossDefault,
BossBilsy,
BossXmasBilsy,
BossBolly,
BossBollyTop,
BossBubba,
BossDevan,
BossDevilDevan,
BossQueen,
BossRobot,
BossRocketTurtle,
BossTufBoss,
BossTweedle,
BossUterus,
AmmoDefault,
AmmoIce3,
AmmoBouncer3,
AmmoSeeker3,
AmmoRF3,
AmmoToaster3,
AmmoTNT3,
AmmoGun8_3,
AmmoGun9_3,
PowerupDefault,
PowerupBlaster,
PowerupBouncer,
PowerupIce,
PowerupSeeker,
PowerupRF,
PowerupToaster,
PowerupGun8,
PowerupGun9,
Teleport,
Trigger,
Moveable,
FastFire,
Unknown
}
class NpcUiAnimation
{
int animSet;
int anim;
int firstFrame;
int frameCount;
int ticksPerFrame;
SPRITE::Mode spriteMode;
int param;
int offsetX;
int offsetY;
bool hidden;
NpcUiAnimation(int animSet = 0, int anim = 0, int firstFrame = 0, int frameCount = 1, int ticksPerFrame = 6, SPRITE::Mode spriteMode = SPRITE::NORMAL, int param = 0, int offsetX = 0, int offsetY = 0, bool hidden = false)
{
this.animSet = animSet;
this.anim = anim;
this.firstFrame = firstFrame;
this.frameCount = frameCount;
this.ticksPerFrame = ticksPerFrame;
this.spriteMode = spriteMode;
this.param = param;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.hidden = hidden;
}
}
void SetNpcUiAnimation(NpcUiAnimation &inout result, int animSet, int anim, int firstFrame, int frameCount, int ticksPerFrame, SPRITE::Mode spriteMode = SPRITE::NORMAL, int param = 0, int offsetX = 0, int offsetY = 0, bool hidden = false)
{
result.animSet = animSet;
result.anim = anim;
result.firstFrame = firstFrame;
result.frameCount = frameCount;
result.ticksPerFrame = ticksPerFrame;
result.spriteMode = spriteMode;
result.param = param;
result.offsetX = offsetX;
result.offsetY = offsetY;
result.hidden = hidden;
}
int GetGemSpriteParam(GEM::Color gemType)
{
if(gemType == GEM::GREEN) return 1;
if(gemType == GEM::BLUE) return 2;
if(gemType == GEM::PURPLE) return 3;
return 0;
}
void GetGemUiIcon(GEM::Color gemType, NpcUiAnimation &inout result)
{
SetNpcUiAnimation(result, ANIM::PICKUPS, 22, jjGameTicks/20, 8, 6, SPRITE::GEM, GetGemSpriteParam(gemType), 0, 0);
}
void GetNpcUiIcon(int icon, NpcUiAnimation &inout result)
{
// Basic
if(icon == NpcUiIcon::Coin) { SetNpcUiAnimation(result, ANIM::PICKUPS, 84, jjGameTicks/20, 20, 6); return; }
if(icon == NpcUiIcon::Gem) { GetGemUiIcon(GEM::RED, result); return; }
// Monsters
if(icon == NpcUiIcon::MonsterBat) { SetNpcUiAnimation(result, ANIM::BAT, 0, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterBee) { SetNpcUiAnimation(result, ANIM::BUMBEE, 0, jjGameTicks/8, 2, 6); return; }
if(icon == NpcUiIcon::MonsterBeeBoy) { SetNpcUiAnimation(result, ANIM::BEEBOY, 0, jjGameTicks/8, 4, 6); return; }
if(icon == NpcUiIcon::MonsterBees) { SetNpcUiAnimation(result, ANIM::BEES, 0, jjGameTicks/8, 4, 6); return; }
if(icon == NpcUiIcon::MonsterButterfly) { SetNpcUiAnimation(result, ANIM::BUTTERFLY, 0, jjGameTicks/8, 12, 6); return; }
if(icon == NpcUiIcon::MonsterCrab) { SetNpcUiAnimation(result, ANIM::BUMBEE, 0, jjGameTicks/8, 2, 6); return; } // fallback
if(icon == NpcUiIcon::MonsterDemon) { SetNpcUiAnimation(result, ANIM::DEMON, 0, jjGameTicks/8, 15, 6); return; }
if(icon == NpcUiIcon::MonsterDoggyDogg) { SetNpcUiAnimation(result, ANIM::DOG, 0, jjGameTicks/8, 5, 6); return; }
if(icon == NpcUiIcon::MonsterDragon) { SetNpcUiAnimation(result, ANIM::DRAGON, 0, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterDragonfly) { SetNpcUiAnimation(result, ANIM::DRAGFLY, 0, jjGameTicks/8, 4, 6); return; }
if(icon == NpcUiIcon::MonsterFatChick) { SetNpcUiAnimation(result, ANIM::FATCHK, 0, jjGameTicks/8, 12, 6); return; }
if(icon == NpcUiIcon::MonsterFencer) { SetNpcUiAnimation(result, ANIM::FENCER, 0, jjGameTicks/8, 5, 6); return; }
if(icon == NpcUiIcon::MonsterFish) { SetNpcUiAnimation(result, ANIM::FISH, 0, jjGameTicks/8, 6, 6); return; }
if(icon == NpcUiIcon::MonsterHatter) { SetNpcUiAnimation(result, ANIM::HATTER, 2, jjGameTicks/8, 22, 6); return; }
if(icon == NpcUiIcon::MonsterHelmut) { SetNpcUiAnimation(result, ANIM::HELMUT, 0, jjGameTicks/8, 4, 6); return; }
if(icon == NpcUiIcon::MonsterLabRat) { SetNpcUiAnimation(result, ANIM::LABRAT, 0, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterLizard) { SetNpcUiAnimation(result, ANIM::LIZARD, 4, jjGameTicks/8, 12, 6); return; }
if(icon == NpcUiIcon::MonsterFloatLizard) { SetNpcUiAnimation(result, ANIM::LIZARD, 0, jjGameTicks/8, 13, 6); return; }
if(icon == NpcUiIcon::MonsterXmasLizard) { SetNpcUiAnimation(result, ANIM::XLIZARD, 4, jjGameTicks/8, 12, 6); return; }
if(icon == NpcUiIcon::MonsterMonkey) { SetNpcUiAnimation(result, ANIM::MONKEY, 2, jjGameTicks/8, 13, 6); return; }
if(icon == NpcUiIcon::MonsterStandMonkey) { SetNpcUiAnimation(result, ANIM::MONKEY, 5, jjGameTicks/8, 13, 6); return; }
if(icon == NpcUiIcon::MonsterNormalTurtle) { SetNpcUiAnimation(result, ANIM::TURTLE, 0, jjGameTicks/8, 11, 6); return; }
if(icon == NpcUiIcon::MonsterXmasNormalTurtle) { SetNpcUiAnimation(result, ANIM::XTURTLE, 0, jjGameTicks/8, 11, 6); return; }
if(icon == NpcUiIcon::MonsterTubeTurtle) { SetNpcUiAnimation(result, ANIM::TUBETURT, 0, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterTufTurtle) { SetNpcUiAnimation(result, ANIM::TUFTUR, 0, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::MonsterRapier) { SetNpcUiAnimation(result, ANIM::RAPIER, 0, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterRaven) { SetNpcUiAnimation(result, ANIM::RAVEN, 1, jjGameTicks/8, 6, 6); return; }
if(icon == NpcUiIcon::MonsterSkeleton) { SetNpcUiAnimation(result, ANIM::SKELETON, 2, jjGameTicks/8, 16, 6); return; }
if(icon == NpcUiIcon::MonsterSpark) { SetNpcUiAnimation(result, ANIM::SPARK, 0, jjGameTicks/8, 5, 6); return; }
if(icon == NpcUiIcon::MonsterSucker) { SetNpcUiAnimation(result, ANIM::SUCKER, 6, jjGameTicks/8, 12, 6); return; }
if(icon == NpcUiIcon::MonsterFloatSucker) { SetNpcUiAnimation(result, ANIM::SUCKER, 4, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::MonsterCat) { SetNpcUiAnimation(result, ANIM::CAT, 0, jjGameTicks/8, 5, 6); return; }
if(icon == NpcUiIcon::MonsterPacmanGhost) { SetNpcUiAnimation(result, ANIM::CAT2, 0, jjGameTicks/8, 5, 6); return; }
if(icon == NpcUiIcon::MonsterMoth) { SetNpcUiAnimation(result, ANIM::MOTH, 0, jjGameTicks/8, 8, 6); return; } // -
if(icon == NpcUiIcon::MonsterWitch) { SetNpcUiAnimation(result, ANIM::WITCH, 0, jjGameTicks/8, 11, 6); return; }
// Bosses
if(icon == NpcUiIcon::BossBilsy) { SetNpcUiAnimation(result, ANIM::BILSBOSS, 0, jjGameTicks/8, 18, 6); return; }
if(icon == NpcUiIcon::BossXmasBilsy) { SetNpcUiAnimation(result, ANIM::XBILSY, 0, jjGameTicks/8, 18, 6); return; }
if(icon == NpcUiIcon::BossBolly) { SetNpcUiAnimation(result, ANIM::BOSS, 1, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::BossBubba) { SetNpcUiAnimation(result, ANIM::BUBBA, 0, jjGameTicks/8, 16, 6); return; }
if(icon == NpcUiIcon::BossDevan) { SetNpcUiAnimation(result, ANIM::DEVAN, 8, jjGameTicks/8, 4, 6); return; }
if(icon == NpcUiIcon::BossDevilDevan) { SetNpcUiAnimation(result, ANIM::DEVILDEVAN, 0, jjGameTicks/8, 11, 6); return; }
if(icon == NpcUiIcon::BossQueen) { SetNpcUiAnimation(result, ANIM::QUEEN, 0, jjGameTicks/8, 16, 6); return; }
if(icon == NpcUiIcon::BossRobot) { SetNpcUiAnimation(result, ANIM::ROBOT, 15, jjGameTicks/8, 8, 6); return; }
if(icon == NpcUiIcon::BossRocketTurtle) { SetNpcUiAnimation(result, ANIM::ROCKTURT, 0, jjGameTicks/8, 6, 6); return; }
if(icon == NpcUiIcon::BossTufBoss) { SetNpcUiAnimation(result, ANIM::TUFBOSS, 0, jjGameTicks/8, 19, 6); return; }
if(icon == NpcUiIcon::BossTweedle) { SetNpcUiAnimation(result, ANIM::TWEEDLE, 0, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::BossUterus) { SetNpcUiAnimation(result, ANIM::UTERUS, 0, jjGameTicks/8, 8, 6); return; }
// Ammo pickups
if(icon == NpcUiIcon::AmmoDefault) { SetNpcUiAnimation(result, ANIM::AMMO, 18, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoBouncer3) { SetNpcUiAnimation(result, ANIM::AMMO, 25, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoIce3) { SetNpcUiAnimation(result, ANIM::AMMO, 29, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoSeeker3) { SetNpcUiAnimation(result, ANIM::AMMO, 34, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoRF3) { SetNpcUiAnimation(result, ANIM::AMMO, 49, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoToaster3) { SetNpcUiAnimation(result, ANIM::AMMO, 57, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoTNT3) { SetNpcUiAnimation(result, ANIM::AMMO, 59, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::AmmoGun8_3) { SetNpcUiAnimation(result, ANIM::AMMO, 62, jjGameTicks/8, 9, 6); return; }
if(icon == NpcUiIcon::AmmoGun9_3) { SetNpcUiAnimation(result, ANIM::AMMO, 68, jjGameTicks/8, 10, 6); return; }
// Powerups / monitors
if(icon == NpcUiIcon::PowerupBlaster) { SetNpcUiAnimation(result, ANIM::PICKUPS, 60, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupBouncer) { SetNpcUiAnimation(result, ANIM::PICKUPS, 61, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupIce) { SetNpcUiAnimation(result, ANIM::PICKUPS, 62, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupSeeker) { SetNpcUiAnimation(result, ANIM::PICKUPS, 63, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupRF) { SetNpcUiAnimation(result, ANIM::PICKUPS, 64, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupToaster) { SetNpcUiAnimation(result, ANIM::PICKUPS, 65, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupGun8) { SetNpcUiAnimation(result, ANIM::PICKUPS, 66, jjGameTicks/8, 10, 6); return; }
if(icon == NpcUiIcon::PowerupGun9) { SetNpcUiAnimation(result, ANIM::PICKUPS, 67, jjGameTicks/8, 10, 6); return; }
// Existing misc
if(icon == NpcUiIcon::FastFire)
{
SetNpcUiAnimation(result, ANIM::AMMO, 18, jjGameTicks/20, 10, 6);
return;
}
if(icon == NpcUiIcon::Trigger) { SetNpcUiAnimation(result, ANIM::PICKUPS, 52, jjGameTicks/20, 1, 6); return; }
if(icon == NpcUiIcon::Teleport) { SetNpcUiAnimation(result, ANIM::SPAZ, 77, jjGameTicks/20, 8, 6); return; }
// Defaults
//if(icon == NpcUiIcon::MonsterDefault) { SetNpcUiAnimation(result, ANIM::PICKUPS, 0, 0, 1, 6); return; }
//if(icon == NpcUiIcon::BossDefault) { SetNpcUiAnimation(result, ANIM::PICKUPS, 0, 0, 1, 6); return; }
//if(icon == NpcUiIcon::AmmoDefault) { SetNpcUiAnimation(result, ANIM::AMMO, 0, 0, 1, 6); return; }
//if(icon == NpcUiIcon::PowerupDefault) { SetNpcUiAnimation(result, ANIM::PICKUPS, 60, 0, 1, 6); return; }
SetNpcUiAnimation(result, 0, 0, 0, 1, 6);
}
/*
FILL IN THESE:
ParseDefeatEventID
DefeatBossEvent
DefeatMonsterEvent
NPC_UI_* animation constants below
-animSet
- anim
- firstFrame
- frameCount
- ticksPerFrame
return NpcUiAnimation(ANIM::PICKUPS, 0, 0, 6, 5);
*/
//----------------------------------------------------------------------------------------------------
// NPC FIGHTING REGION
namespace NpcMonster
{
const int Bat = -901001;
const int Bee = -901002;
const int BeeBoy = -901003;
const int Bees = -901004;
const int Butterfly = -901005;
const int Crab = -901006;
const int Demon = -901007;
const int DoggyDogg = -901008;
const int Dragon = -901009;
const int Dragonfly = -901010;
const int FatChick = -901011;
const int Fencer = -901012;
const int Fish = -901013;
const int Hatter = -901014;
const int Helmut = -901015;
const int LabRat = -901016;
const int Lizard = -901017;
const int FloatLizard = -901018;
const int XmasLizard = -901019;
const int Monkey = -901020;
const int StandMonkey = -901021;
const int NormalTurtle = -901022;
const int XmasNormalTurtle = -901023;
const int TubeTurtle = -901024;
const int TufTurtle = -901025;
const int Rapier = -901026;
const int Raven = -901027;
const int Skeleton = -901028;
const int Spark = -901029;
const int Sucker = -901030;
const int FloatSucker = -901031;
const int Cat = -901032;
const int PacmanGhost = -901033;
const int Moth = -901034;
const int Witch = -901035;
const int XmasFloatLizard = -901036;
}
namespace NpcBoss
{
const int Bilsy = -902001;
const int XmasBilsy = -902002;
const int Bolly = -902003;
const int Bubba = -902004;
const int DevilDevan = -902005;
const int Queen = -902006;
const int Robot = -902007;
const int RocketTurtle = -902008;
const int TufBoss = -902009;
const int Tweedle = -902010;
const int Uterus = -902011;
}
namespace NpcObject
{
const int MorphMonitor = -903001;
const int BirdMonitor = -903002;
const int BlasterPowerup = -903003;
const int BouncerPowerup = -903004;
const int IcePowerup = -903005;
const int SeekerPowerup = -903006;
const int RFPowerup = -903007;
const int ToasterPowerup = -903008;
const int Gun8Powerup = -903009;
const int Gun9Powerup = -903010;
const int WaterShield = -903011;
const int FireShield = -903012;
const int LightningShield = -903013;
}
namespace NpcStatic
{
const int Static = -900000;
}
bool IsNpcStaticType(int type) { return type == npcBunniesAnimations::NpcStatic::Static; }
bool IsNpcMonsterType(int type) { return type >= -901036 && type <= -901001; }
bool IsNpcBossType(int type) { return type >= -902011 && type <= -902001; }
bool IsNpcObjectType(int type) { return type >= -903013 && type <= -903001; }
bool IsNpcSimpleAnimType(int type) { return IsNpcMonsterType(type) || IsNpcBossType(type) || IsNpcObjectType(type); }
int GetNpcSimpleAnimSet(int type)
{
switch(type)
{
case npcBunniesAnimations::NpcMonster::Bat: return ANIM::BAT;
case npcBunniesAnimations::NpcMonster::Bee: return ANIM::BUMBEE;
case npcBunniesAnimations::NpcMonster::BeeBoy: return ANIM::BEEBOY;
case npcBunniesAnimations::NpcMonster::Bees: return ANIM::BEES;
case npcBunniesAnimations::NpcMonster::Butterfly: return ANIM::BUTTERFLY;
case npcBunniesAnimations::NpcMonster::Crab: return ANIM::BUMBEE;
case npcBunniesAnimations::NpcMonster::Demon: return ANIM::DEMON;
case npcBunniesAnimations::NpcMonster::DoggyDogg: return ANIM::DOG;
case npcBunniesAnimations::NpcMonster::Dragon: return ANIM::DRAGON;
case npcBunniesAnimations::NpcMonster::Dragonfly: return ANIM::DRAGFLY;
case npcBunniesAnimations::NpcMonster::FatChick: return ANIM::FATCHK;
case npcBunniesAnimations::NpcMonster::Fencer: return ANIM::FENCER;
case npcBunniesAnimations::NpcMonster::Fish: return ANIM::FISH;
case npcBunniesAnimations::NpcMonster::Hatter: return ANIM::HATTER;
case npcBunniesAnimations::NpcMonster::Helmut: return ANIM::HELMUT;
case npcBunniesAnimations::NpcMonster::LabRat: return ANIM::LABRAT;
case npcBunniesAnimations::NpcMonster::Lizard: return ANIM::LIZARD;
case npcBunniesAnimations::NpcMonster::FloatLizard: return ANIM::LIZARD;
case npcBunniesAnimations::NpcMonster::XmasLizard: return ANIM::XLIZARD;
case npcBunniesAnimations::NpcMonster::XmasFloatLizard: return ANIM::XLIZARD;
case npcBunniesAnimations::NpcMonster::Monkey: return ANIM::MONKEY;
case npcBunniesAnimations::NpcMonster::StandMonkey: return ANIM::MONKEY;
case npcBunniesAnimations::NpcMonster::NormalTurtle: return ANIM::TURTLE;
case npcBunniesAnimations::NpcMonster::XmasNormalTurtle: return ANIM::XTURTLE;
case npcBunniesAnimations::NpcMonster::TubeTurtle: return ANIM::TUBETURT;
case npcBunniesAnimations::NpcMonster::TufTurtle: return ANIM::TUFTUR;
case npcBunniesAnimations::NpcMonster::Rapier: return ANIM::RAPIER;
case npcBunniesAnimations::NpcMonster::Raven: return ANIM::RAVEN;
case npcBunniesAnimations::NpcMonster::Skeleton: return ANIM::SKELETON;
case npcBunniesAnimations::NpcMonster::Spark: return ANIM::SPARK;
case npcBunniesAnimations::NpcMonster::Sucker: return ANIM::SUCKER;
case npcBunniesAnimations::NpcMonster::FloatSucker: return ANIM::SUCKER;
case npcBunniesAnimations::NpcMonster::Cat: return ANIM::ZDOG;
case npcBunniesAnimations::NpcMonster::PacmanGhost: return ANIM::ZSPARK;
case npcBunniesAnimations::NpcMonster::Moth: return ANIM::MOTH;
case npcBunniesAnimations::NpcMonster::Witch: return ANIM::WITCH;
case npcBunniesAnimations::NpcBoss::Bilsy: return ANIM::BILSBOSS;
case npcBunniesAnimations::NpcBoss::XmasBilsy: return ANIM::XBILSY;
case npcBunniesAnimations::NpcBoss::Bolly: return ANIM::BOSS;
case npcBunniesAnimations::NpcBoss::Bubba: return ANIM::BUBBA;
case npcBunniesAnimations::NpcBoss::DevilDevan: return ANIM::DEVILDEVAN;
case npcBunniesAnimations::NpcBoss::Queen: return ANIM::QUEEN;
case npcBunniesAnimations::NpcBoss::Robot: return ANIM::ROBOT;
case npcBunniesAnimations::NpcBoss::RocketTurtle: return ANIM::ROCKTURT;
case npcBunniesAnimations::NpcBoss::TufBoss: return ANIM::TUFBOSS;
case npcBunniesAnimations::NpcBoss::Tweedle: return ANIM::TWEEDLE;
case npcBunniesAnimations::NpcBoss::Uterus: return ANIM::UTERUS;
case npcBunniesAnimations::NpcObject::WaterShield: case npcBunniesAnimations::NpcObject::FireShield: case npcBunniesAnimations::NpcObject::LightningShield:
case npcBunniesAnimations::NpcObject::MorphMonitor: case npcBunniesAnimations::NpcObject::BirdMonitor: case npcBunniesAnimations::NpcObject::BlasterPowerup: case npcBunniesAnimations::NpcObject::BouncerPowerup:
case npcBunniesAnimations::NpcObject::IcePowerup: case npcBunniesAnimations::NpcObject::SeekerPowerup: case npcBunniesAnimations::NpcObject::RFPowerup: case npcBunniesAnimations::NpcObject::ToasterPowerup:
case npcBunniesAnimations::NpcObject::Gun8Powerup: case npcBunniesAnimations::NpcObject::Gun9Powerup:
return ANIM::PICKUPS;
}
return -1;
}
bool NpcSimpleAnimCanFly(int type)
{
switch(type)
{
case npcBunniesAnimations::NpcMonster::Bat: case npcBunniesAnimations::NpcMonster::Bee: case npcBunniesAnimations::NpcMonster::BeeBoy: case npcBunniesAnimations::NpcMonster::Bees: case npcBunniesAnimations::NpcMonster::Butterfly:
case npcBunniesAnimations::NpcMonster::Dragonfly: case npcBunniesAnimations::NpcMonster::Dragon: case npcBunniesAnimations::NpcMonster::Fish: case npcBunniesAnimations::NpcMonster::XmasFloatLizard:
case npcBunniesAnimations::NpcMonster::Rapier: case npcBunniesAnimations::NpcMonster::Raven:
case npcBunniesAnimations::NpcMonster::Spark: case npcBunniesAnimations::NpcMonster::PacmanGhost: case npcBunniesAnimations::NpcMonster::Moth: case npcBunniesAnimations::NpcMonster::Witch: case npcBunniesAnimations::NpcBoss::Bilsy:
case npcBunniesAnimations::NpcBoss::XmasBilsy: case npcBunniesAnimations::NpcBoss::Bolly: case npcBunniesAnimations::NpcBoss::DevilDevan: case npcBunniesAnimations::NpcBoss::Queen: case npcBunniesAnimations::NpcBoss::Robot:
case npcBunniesAnimations::NpcBoss::Uterus:
return true;
}
return false;
}
void LoadNpcSimpleAnimSet(int type)
{
int animSet = GetNpcSimpleAnimSet(type);
if(animSet < 0 || jjAnimSets[animSet].firstAnim != 0) return;
if((npcBunniesCore::LOAD_ALL_MONSTER_ANIMATIONS && !npcBunniesCore::NPC_ALL_MONSTER_ANIMS_PENDING_RESTART) || npcBunniesCore::NPC_ADDITIONAL_MONSTER_ANIMATIONS.find(type) >= 0) jjAnimSets[animSet].load();
}
void LoadAdditionalNpcMonsterAnimSets()
{
for(uint i = 0; i < npcBunniesCore::NPC_ADDITIONAL_MONSTER_ANIMATIONS.length; i++) LoadNpcSimpleAnimSet(npcBunniesCore::NPC_ADDITIONAL_MONSTER_ANIMATIONS[i]);
}
bool IsNpcSimpleAnimationLoaded(int type)
{
int animSet = GetNpcSimpleAnimSet(type);
return animSet >= 0 && jjAnimSets[animSet].firstAnim != 0;
}
bool IsNpcSimpleAnimationAvailable(int type)
{
return (npcBunniesCore::LOAD_ALL_MONSTER_ANIMATIONS && !npcBunniesCore::NPC_ALL_MONSTER_ANIMS_PENDING_RESTART) || IsNpcSimpleAnimationLoaded(type) || npcBunniesCore::NPC_ADDITIONAL_MONSTER_ANIMATIONS.find(type) >= 0;
}
int NpcSimpleAnimationFrame(const NpcUiAnimation &in icon)
{
int frames = icon.frameCount <= 0 ? 1 : icon.frameCount;
int frame = icon.firstFrame % frames;
if(frame < 0) frame += frames;
return frame;
}
void GetNpcSimpleAnimation(int type, NpcUiAnimation &inout result)
{
if(type == npcBunniesAnimations::NpcMonster::Bat) { SetNpcUiAnimation(result, ANIM::BAT, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Bee) { SetNpcUiAnimation(result, ANIM::BUMBEE, 0, jjGameTicks/8, 2, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Crab) { SetNpcUiAnimation(result, ANIM::BUMBEE, 0, jjGameTicks/8, 2, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::BeeBoy) { SetNpcUiAnimation(result, ANIM::BEEBOY, 0, jjGameTicks/8, 4, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Bees) { SetNpcUiAnimation(result, ANIM::BEES, 0, jjGameTicks/8, 4, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Butterfly) { SetNpcUiAnimation(result, ANIM::BUTTERFLY, 0, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Demon) { SetNpcUiAnimation(result, ANIM::DEMON, 0, jjGameTicks/8, 15, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::DoggyDogg) { SetNpcUiAnimation(result, ANIM::DOG, 0, jjGameTicks/8, 5, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Dragon) { SetNpcUiAnimation(result, ANIM::DRAGON, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Dragonfly) { SetNpcUiAnimation(result, ANIM::DRAGFLY, 0, jjGameTicks/8, 4, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::FatChick) { SetNpcUiAnimation(result, ANIM::FATCHK, 0, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Fencer) { SetNpcUiAnimation(result, ANIM::FENCER, 0, jjGameTicks/8, 5, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Fish) { SetNpcUiAnimation(result, ANIM::FISH, 0, jjGameTicks/8, 6, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Hatter) { SetNpcUiAnimation(result, ANIM::HATTER, 0, jjGameTicks/8, 22, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Helmut) { SetNpcUiAnimation(result, ANIM::HELMUT, 0, jjGameTicks/8, 4, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::LabRat) { SetNpcUiAnimation(result, ANIM::LABRAT, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Lizard) { SetNpcUiAnimation(result, ANIM::LIZARD, 4, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::FloatLizard) { SetNpcUiAnimation(result, ANIM::LIZARD, 2, jjGameTicks/8, 4, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::XmasLizard) { SetNpcUiAnimation(result, ANIM::XLIZARD, 4, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::XmasFloatLizard) { SetNpcUiAnimation(result, ANIM::XLIZARD, 4, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Monkey) { SetNpcUiAnimation(result, ANIM::MONKEY, 2, jjGameTicks/8, 13, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::StandMonkey) { SetNpcUiAnimation(result, ANIM::MONKEY, 5, jjGameTicks/8, 13, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::NormalTurtle) { SetNpcUiAnimation(result, ANIM::TURTLE, 0, jjGameTicks/8, 11, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::XmasNormalTurtle) { SetNpcUiAnimation(result, ANIM::XTURTLE, 0, jjGameTicks/8, 11, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::TubeTurtle) { SetNpcUiAnimation(result, ANIM::TUBETURT, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::TufTurtle) { SetNpcUiAnimation(result, ANIM::TUFTUR, 0, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Rapier) { SetNpcUiAnimation(result, ANIM::RAPIER, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Raven) { SetNpcUiAnimation(result, ANIM::RAVEN, 1, jjGameTicks/8, 6, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Skeleton) { SetNpcUiAnimation(result, ANIM::SKELETON, 2, jjGameTicks/8, 16, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Spark) { SetNpcUiAnimation(result, ANIM::SPARK, 0, jjGameTicks/8, 5, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Sucker) { SetNpcUiAnimation(result, ANIM::SUCKER, 6, jjGameTicks/8, 12, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::FloatSucker) { SetNpcUiAnimation(result, ANIM::SUCKER, 4, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Cat) { SetNpcUiAnimation(result, ANIM::ZDOG, 1, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::PacmanGhost) { SetNpcUiAnimation(result, ANIM::ZSPARK, 0, jjGameTicks/8, 5, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Moth) { SetNpcUiAnimation(result, ANIM::MOTH, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcMonster::Witch) { SetNpcUiAnimation(result, ANIM::WITCH, 0, jjGameTicks/8, 11, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Bilsy) { SetNpcUiAnimation(result, ANIM::BILSBOSS, 0, jjGameTicks/8, 18, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::XmasBilsy) { SetNpcUiAnimation(result, ANIM::XBILSY, 0, jjGameTicks/8, 18, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Bolly) { SetNpcUiAnimation(result, ANIM::BOSS, 1, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Bubba) { SetNpcUiAnimation(result, ANIM::BUBBA, 0, jjGameTicks/8, 16, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::DevilDevan) { SetNpcUiAnimation(result, ANIM::DEVILDEVAN, 0, jjGameTicks/8, 11, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Queen) { SetNpcUiAnimation(result, ANIM::QUEEN, 0, jjGameTicks/8, 16, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Robot) { SetNpcUiAnimation(result, ANIM::ROBOT, 15, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::RocketTurtle) { SetNpcUiAnimation(result, ANIM::ROCKTURT, 0, jjGameTicks/8, 6, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::TufBoss) { SetNpcUiAnimation(result, ANIM::TUFBOSS, 0, jjGameTicks/8, 19, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Tweedle) { SetNpcUiAnimation(result, ANIM::TWEEDLE, 0, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcBoss::Uterus) { SetNpcUiAnimation(result, ANIM::UTERUS, 0, jjGameTicks/8, 8, 6); return; }
if(type == npcBunniesAnimations::NpcObject::WaterShield) { SetNpcUiAnimation(result, ANIM::PICKUPS, 10, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::FireShield) { SetNpcUiAnimation(result, ANIM::PICKUPS, 31, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::LightningShield) { SetNpcUiAnimation(result, ANIM::PICKUPS, 51, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::MorphMonitor) { SetNpcUiAnimation(result, ANIM::PICKUPS, 70, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::BirdMonitor) { SetNpcUiAnimation(result, ANIM::PICKUPS, 69, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::BlasterPowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 60, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::BouncerPowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 61, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::IcePowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 62, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::SeekerPowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 63, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::RFPowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 64, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::ToasterPowerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 65, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::Gun8Powerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 66, jjGameTicks/8, 10, 6); return; }
if(type == npcBunniesAnimations::NpcObject::Gun9Powerup) { SetNpcUiAnimation(result, ANIM::PICKUPS, 67, jjGameTicks/8, 10, 6); return; }
SetNpcUiAnimation(result, ANIM::PICKUPS, 0, 0, 1, 6, SPRITE::NORMAL, 0, 0, 0, true);
}
bool CanDrawNpcSimpleAnimation(const NpcUiAnimation &in icon)
{
if(icon.hidden) return false;
if(icon.animSet < 0 || icon.anim < 0) return false;
return jjAnimSets[icon.animSet].firstAnim > 0;
}
void DrawNpcSimpleAnimation(npcBunniesCore::npcBunny &in npc, jjOBJ@ obj, bool shooting = false, bool walking = false)
{
if(!npcBunniesCore::ENABLE_NPC_MONSTER_DRAWING && (IsNpcMonsterType(npc.type) || IsNpcBossType(npc.type))) return;
if(npcMonsterAdjustments::DrawNpcMonster(npc, obj, shooting, walking)) return;
NpcUiAnimation icon;
GetNpcSimpleAnimation(npc.type, icon);
if(!CanDrawNpcSimpleAnimation(icon)) return;
int frame = NpcSimpleAnimationFrame(icon);
float scale = npcBunniesCore::NpcSizeScale(npc.sizeMode);
float drawY = obj.yPos + npcBunniesCore::NpcSizeDrawYOffset(npc.sizeMode);
if(npc.type == npcBunniesAnimations::NpcBoss::Uterus) jjDrawRotatedSprite(obj.xPos, drawY, icon.animSet, icon.anim, frame, 768, obj.direction * scale, scale, icon.spriteMode, icon.param, 4, 4, -1);
else jjDrawResizedSprite(obj.xPos, drawY, icon.animSet, icon.anim, frame, obj.direction * scale, scale, icon.spriteMode, icon.param, 4, 4, -1);
if(npcBunniesCore::ENABLE_NPC_ACCESSORIES && npcBunniesAccessories::NpcAccessories::NpcHasDrawableAccessory(npc)) npcBunniesAccessories::NpcAccessories::Draw(npc, obj.xPos, drawY, icon.animSet, icon.anim, frame, obj.direction, 1, scale);
}
}
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.