mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-29 03:01:15 +00:00
PoliceState: Create script enum + implement FUN_1005ea40
This commit is contained in:
parent
1b696e4bd8
commit
a5af9ded7e
@ -13,6 +13,11 @@
|
||||
// Radio at 0xf8
|
||||
class Police : public LegoWorld {
|
||||
public:
|
||||
enum PoliceScript {
|
||||
c_nickAnim = 500,
|
||||
c_lauraAnim = 501,
|
||||
};
|
||||
|
||||
Police();
|
||||
~Police() override; // vtable+0x00
|
||||
|
||||
|
||||
@ -32,8 +32,10 @@ class PoliceState : public LegoState {
|
||||
inline undefined4 GetUnknown0x0c() { return m_unk0x0c; }
|
||||
inline void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
|
||||
|
||||
void FUN_1005ea40();
|
||||
|
||||
private:
|
||||
undefined4 m_unk0x08; // 0x08
|
||||
undefined4 m_action; // 0x08
|
||||
undefined4 m_unk0x0c; // 0x0c
|
||||
};
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) {
|
||||
DeleteObjects(&m_atom, 500, 501);
|
||||
DeleteObjects(&m_atom, PoliceScript::c_nickAnim, PoliceScript::c_lauraAnim);
|
||||
m_policeState->SetUnknown0x0c(0);
|
||||
return 1;
|
||||
}
|
||||
@ -150,7 +150,7 @@ void Police::Enable(MxBool p_enable)
|
||||
// FUNCTION: LEGO1 0x1005e790
|
||||
MxBool Police::VTable0x64()
|
||||
{
|
||||
DeleteObjects(&m_atom, 500, 510);
|
||||
DeleteObjects(&m_atom, c_nickAnim, 510);
|
||||
m_transitionDestination = LegoGameState::e_infomain;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
#include "policestate.h"
|
||||
|
||||
#include "islepathactor.h"
|
||||
#include "legoomni.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxomni.h"
|
||||
#include "police.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(PoliceState, 0x10)
|
||||
@ -8,7 +14,7 @@ DECOMP_SIZE_ASSERT(PoliceState, 0x10)
|
||||
PoliceState::PoliceState()
|
||||
{
|
||||
m_unk0x0c = 0;
|
||||
m_unk0x08 = (rand() % 2 == 0) ? 501 : 500;
|
||||
m_action = (rand() % 2 == 0) ? Police::PoliceScript::c_lauraAnim : Police::PoliceScript::c_nickAnim;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
@ -19,12 +25,41 @@ MxResult PoliceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
}
|
||||
|
||||
if (p_legoFile->IsReadMode()) {
|
||||
p_legoFile->Read(&m_unk0x08, sizeof(m_unk0x08));
|
||||
p_legoFile->Read(&m_action, sizeof(m_action));
|
||||
}
|
||||
else {
|
||||
undefined4 unk0x08 = m_unk0x08;
|
||||
p_legoFile->Write(&unk0x08, sizeof(m_unk0x08));
|
||||
undefined4 unk0x08 = m_action;
|
||||
p_legoFile->Write(&unk0x08, sizeof(m_action));
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005ea40
|
||||
void PoliceState::FUN_1005ea40()
|
||||
{
|
||||
MxS32 actionId;
|
||||
|
||||
if (m_unk0x0c == 1)
|
||||
return;
|
||||
switch (CurrentVehicle()->VTable0x60()) {
|
||||
case 4:
|
||||
actionId = Police::PoliceScript::c_lauraAnim;
|
||||
break;
|
||||
case 5:
|
||||
actionId = Police::PoliceScript::c_nickAnim;
|
||||
break;
|
||||
default:
|
||||
actionId = m_action;
|
||||
m_action = m_action == Police::PoliceScript::c_lauraAnim ? Police::PoliceScript::c_nickAnim
|
||||
: Police::PoliceScript::c_lauraAnim;
|
||||
goto playAction;
|
||||
}
|
||||
m_action = actionId;
|
||||
playAction:
|
||||
MxDSAction action;
|
||||
action.SetObjectId(actionId);
|
||||
action.SetAtomId(*g_policeScript);
|
||||
Start(&action);
|
||||
m_unk0x0c = 1;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user