spidey-decomp/scorpion.cpp

170 lines
3.0 KiB
C++
Raw Normal View History

2024-03-09 19:12:02 +00:00
#include "scorpion.h"
#include "validate.h"
2024-06-11 17:31:32 +00:00
#include "ai.h"
#include "ps2lowsfx.h"
2024-03-09 19:12:02 +00:00
2024-05-24 16:26:43 +00:00
// @Ok
void __inline CScorpion::NextRoom(void)
{
this->field_218 &= 0xFFFFFFE7;
}
2024-03-09 19:12:02 +00:00
// @Ok
__inline void* CScorpion::GetCurrentTarget(void)
{
if (!this->field_BF8)
{
return NULL;
}
2024-06-11 17:31:32 +00:00
return Mem_RecoverPointer(&this->hCurrentTarget);
}
// @Ok
void Scorpion_GetCurrentTarget(unsigned int* pScorp, unsigned int* pTarget)
{
*pTarget = reinterpret_cast<unsigned int>((*reinterpret_cast<CScorpion**>(pScorp))->GetCurrentTarget());
}
2024-06-02 15:52:08 +00:00
static CSuper* BaddyList;
// @NotOk
// globals
2024-06-11 17:31:32 +00:00
__inline CSuper* CScorpion::FindJonah(void)
2024-06-02 15:52:08 +00:00
{
if (this->field_BEC)
return field_BEC;
for (CSuper* cur = BaddyList; cur; cur = reinterpret_cast<CSuper*>(cur->field_20))
{
if (cur->field_38 == 316)
{
this->field_BEC = cur;
return this->field_BEC;
}
}
return NULL;
}
2024-06-11 17:31:32 +00:00
// @Ok
i32 __inline CScorpion::SetJonahHandle(SHandle* pHandle)
{
print_if_false(&pHandle != 0, "what in the name of Dog?");
CSuper *pJonah = this->FindJonah();
if (!pJonah)
return 0;
*pHandle = Mem_MakeHandle(pJonah);
return 1;
}
// @Ok
void CScorpion::DoIntroSequence(void)
{
switch (this->dumbAssPad)
{
case 0:
if (this->SetJonahHandle(&this->hCurrentTarget))
{
new CAIProc_LookAt(
this,
reinterpret_cast<CBody*>(this->hCurrentTarget.field_0),
0,
2,
50,
170);
this->dumbAssPad++;
}
else
{
this->field_31C.bothFlags = 2;
this->dumbAssPad = 0;
}
break;
case 1:
if (this->field_288 & 2)
{
this->field_1F8 = 600;
this->field_288 &= 0xFFFFFFFD;
this->dumbAssPad = 2;
}
break;
case 2:
this->field_1F8 -= this->field_80;
if (this->field_1F8 <= 0)
{
this->field_31C.bothFlags = 2;
this->dumbAssPad = 0;
}
break;
default:
print_if_false(0, "Unknown substate!");
break;
}
}
// @TODO
void CScorpion::DetermineTarget(void)
{}
// @Ok
void CScorpion::Gloat(void)
{
switch ( this->dumbAssPad )
{
case 0:
if ( (this->field_218 & 0x1000) == 0 )
SFX_PlayPos(0x80A7, &this->mPos, 0);
++this->dumbAssPad;
case 1:
this->Neutralize();
this->field_1F8 = 0;
this->RunAnim(0xE, 0, -1);
++this->dumbAssPad;
break;
case 2:
if ( this->field_142 )
this->CycleAnim(this->field_298.Bytes[0], 1);
this->RunTimer(&this->field_1F8);
if ( !this->field_1F8 )
{
this->RunAnim(this->field_12A, this->field_128, -1);
++this->dumbAssPad;
}
break;
case 3:
if ( this->field_142 )
{
if ( this->field_C18 )
{
this->RunAnim(this->field_298.Bytes[0], 0, -1);
}
else
{
this->DetermineTarget();
this->field_31C.bothFlags = 2;
this->dumbAssPad = 0;
}
}
break;
default:
print_if_false(0, "Unknown substate!");
break;
}
}
2024-03-09 19:12:02 +00:00
void validate_CScorpion(void){
VALIDATE_SIZE(CScorpion, 0xC28);
2024-06-02 15:52:08 +00:00
VALIDATE(CScorpion, field_BEC, 0xBEC);
2024-06-11 17:31:32 +00:00
VALIDATE(CScorpion, hCurrentTarget, 0xBF0);
VALIDATE(CScorpion, field_BF8, 0xBF8);
2024-06-11 17:31:32 +00:00
VALIDATE(CScorpion, field_C18, 0xC18);
2024-05-24 16:26:43 +00:00
}