mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-31 12:11:15 +00:00
Clean up code
This commit is contained in:
parent
a5af9ded7e
commit
113584f72e
@ -5,9 +5,10 @@
|
|||||||
#include "legogamestate.h"
|
#include "legogamestate.h"
|
||||||
#include "legoworld.h"
|
#include "legoworld.h"
|
||||||
#include "mxdsaction.h"
|
#include "mxdsaction.h"
|
||||||
#include "policestate.h"
|
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
|
class PoliceState;
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d8a80
|
// VTABLE: LEGO1 0x100d8a80
|
||||||
// SIZE 0x110
|
// SIZE 0x110
|
||||||
// Radio at 0xf8
|
// Radio at 0xf8
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "legostate.h"
|
#include "legostate.h"
|
||||||
|
#include "police.h"
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d8af0
|
// VTABLE: LEGO1 0x100d8af0
|
||||||
// SIZE 0x10
|
// SIZE 0x10
|
||||||
@ -35,7 +36,7 @@ class PoliceState : public LegoState {
|
|||||||
void FUN_1005ea40();
|
void FUN_1005ea40();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
undefined4 m_action; // 0x08
|
Police::PoliceScript m_policeScript; // 0x08
|
||||||
undefined4 m_unk0x0c; // 0x0c
|
undefined4 m_unk0x0c; // 0x0c
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "legoinputmanager.h"
|
#include "legoinputmanager.h"
|
||||||
#include "legoomni.h"
|
#include "legoomni.h"
|
||||||
#include "mxnotificationmanager.h"
|
#include "mxnotificationmanager.h"
|
||||||
|
#include "policestate.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(Police, 0x110)
|
DECOMP_SIZE_ASSERT(Police, 0x110)
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
|
|||||||
MxLong result = 0;
|
MxLong result = 0;
|
||||||
|
|
||||||
if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) {
|
if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) {
|
||||||
DeleteObjects(&m_atom, PoliceScript::c_nickAnim, PoliceScript::c_lauraAnim);
|
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
|
||||||
m_policeState->SetUnknown0x0c(0);
|
m_policeState->SetUnknown0x0c(0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ DECOMP_SIZE_ASSERT(PoliceState, 0x10)
|
|||||||
PoliceState::PoliceState()
|
PoliceState::PoliceState()
|
||||||
{
|
{
|
||||||
m_unk0x0c = 0;
|
m_unk0x0c = 0;
|
||||||
m_action = (rand() % 2 == 0) ? Police::PoliceScript::c_lauraAnim : Police::PoliceScript::c_nickAnim;
|
m_policeScript = (rand() % 2 == 0) ? Police::PoliceScript::c_lauraAnim : Police::PoliceScript::c_nickAnim;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1005e990
|
// FUNCTION: LEGO1 0x1005e990
|
||||||
@ -25,11 +25,11 @@ MxResult PoliceState::VTable0x1c(LegoFile* p_legoFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_legoFile->IsReadMode()) {
|
if (p_legoFile->IsReadMode()) {
|
||||||
p_legoFile->Read(&m_action, sizeof(m_action));
|
p_legoFile->Read(&m_policeScript, sizeof(m_policeScript));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
undefined4 unk0x08 = m_action;
|
undefined4 unk0x08 = m_policeScript;
|
||||||
p_legoFile->Write(&unk0x08, sizeof(m_action));
|
p_legoFile->Write(&unk0x08, sizeof(m_policeScript));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@ -38,27 +38,28 @@ MxResult PoliceState::VTable0x1c(LegoFile* p_legoFile)
|
|||||||
// FUNCTION: LEGO1 0x1005ea40
|
// FUNCTION: LEGO1 0x1005ea40
|
||||||
void PoliceState::FUN_1005ea40()
|
void PoliceState::FUN_1005ea40()
|
||||||
{
|
{
|
||||||
MxS32 actionId;
|
Police::PoliceScript policeScript;
|
||||||
|
|
||||||
if (m_unk0x0c == 1)
|
if (m_unk0x0c == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (CurrentVehicle()->VTable0x60()) {
|
switch (CurrentVehicle()->VTable0x60()) {
|
||||||
case 4:
|
case 4:
|
||||||
actionId = Police::PoliceScript::c_lauraAnim;
|
policeScript = Police::PoliceScript::c_lauraAnim;
|
||||||
|
m_policeScript = policeScript;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
actionId = Police::PoliceScript::c_nickAnim;
|
policeScript = Police::PoliceScript::c_nickAnim;
|
||||||
|
m_policeScript = policeScript;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
actionId = m_action;
|
policeScript = m_policeScript;
|
||||||
m_action = m_action == Police::PoliceScript::c_lauraAnim ? Police::PoliceScript::c_nickAnim
|
m_policeScript = m_policeScript == Police::PoliceScript::c_lauraAnim ? Police::PoliceScript::c_nickAnim
|
||||||
: Police::PoliceScript::c_lauraAnim;
|
: Police::PoliceScript::c_lauraAnim;
|
||||||
goto playAction;
|
|
||||||
}
|
}
|
||||||
m_action = actionId;
|
|
||||||
playAction:
|
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(actionId);
|
action.SetObjectId(policeScript);
|
||||||
action.SetAtomId(*g_policeScript);
|
action.SetAtomId(*g_policeScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
m_unk0x0c = 1;
|
m_unk0x0c = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user