Skip to content

Commit

Permalink
use enum types instead of hardcoded values
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbruv committed Jun 23, 2024
1 parent dbf834a commit a1c552d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/SB/Game/zNPCGoalTiki.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "zRumble.h"

#include "xEvent.h"
#include "zNPCTypes.h"

extern float32 _836_0;
extern float32 _837_3;
Expand Down Expand Up @@ -61,7 +62,7 @@ int32 zNPCGoalTikiIdle::Enter(float32, void*)
{
zNPCTiki* tiki = (zNPCTiki*)GetOwner();

if (tiki->SelfType() == 'NTT3')
if (tiki->SelfType() == NPC_TYPE_TIKI_THUNDER)
{
tmr_wait = _836_0;
}
Expand Down
17 changes: 9 additions & 8 deletions src/SB/Game/zNPCTypeTiki.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "xString.h"
#include "xutil.h"
#include "xMath.h"
#include "zNPCGoals.h"

#define ANIM_COUNT 2

Expand Down Expand Up @@ -93,12 +94,12 @@ xAnimTable* ZNPC_AnimTable_Tiki()

void zNPCTiki::Damage(en_NPC_DAMAGE_TYPE damtype, xBase* who, const xVec3* vec_hit)
{
if (((xNPCBasic::SelfType() != 'NTT4') || (damtype == DMGTYP_CRUISEBUBBLE) ||
if (((xNPCBasic::SelfType() != NPC_TYPE_TIKI_STONE) || (damtype == DMGTYP_CRUISEBUBBLE) ||
(damtype - DMGTYP_THUNDER_TIKI_EXPLOSION <= (uint32)1) ||
(damtype - DMGTYP_INSTAKILL <= (uint32)1)) &&
this->flg_vuln != 0)
{
this->psy_instinct->GoalSet('NGT4', 0);
this->psy_instinct->GoalSet(NPC_GOAL_TIKIDYING, 0);
this->flg_vuln = 0;
}
}
Expand All @@ -114,7 +115,7 @@ void zNPCTiki::Reset()

xNPCBasic::RestoreColFlags();

if (myNPCType == 'NTT4')
if (myNPCType == NPC_TYPE_TIKI_STONE)
{
flg_vuln = 1;
}
Expand Down Expand Up @@ -142,15 +143,15 @@ void zNPCTiki::Reset()

switch (myNPCType)
{
case 'NTT2':
case NPC_TYPE_TIKI_QUIET:
break;
case 'NTT1':
case NPC_TYPE_TIKI_LOVEY:
t1 = _858_2;
t2 = _1084;
t3 = _1084;
xVec3Copy((xVec3*)&v1, (xVec3*)&model->Mat->pos);
break;
case 0x4e545433:
case NPC_TYPE_TIKI_THUNDER:
t1 = xurand();
t2 = _867;
t3 = _867;
Expand All @@ -159,7 +160,7 @@ void zNPCTiki::Reset()
break;
}

psy_instinct->GoalSet('NGT0', 1);
psy_instinct->GoalSet(NPC_GOAL_TIKIIDLE, 1);
model->RedMultiplier = _862;
model->BlueMultiplier = _862;
model->GreenMultiplier = _862;
Expand All @@ -179,7 +180,7 @@ void zNPCTiki::ParseINI()
NPCS_SndTablePrepare((NPCSndTrax*)&g_sndTrax_TikiShared);
switch (xNPCBasic::SelfType())
{
case 'NTT3':
case NPC_TYPE_TIKI_THUNDER:
cfg_npc->snd_trax = g_sndTrax_TikiThunder;
NPCS_SndTablePrepare((NPCSndTrax*)&g_sndTrax_TikiThunder);
break;
Expand Down

0 comments on commit a1c552d

Please sign in to comment.