Skip to content

Commit

Permalink
Implement/match RegistrationBook::HandlePathStruct (isledecomp#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtacles authored Aug 12, 2024
1 parent 9ab3954 commit 30e9e43
Show file tree
Hide file tree
Showing 18 changed files with 182 additions and 108 deletions.
8 changes: 4 additions & 4 deletions LEGO1/lego/legoomni/include/isle.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ class Act1State : public LegoState {
LegoNamedTexture* m_unk0x154; // 0x154
LegoNamedTexture* m_unk0x158; // 0x158
LegoNamedTexture* m_unk0x15c; // 0x15c
MxCore* m_unk0x160; // 0x160
Helicopter* m_helicopter; // 0x160
NamedPlane m_unk0x164; // 0x164
LegoNamedTexture* m_unk0x1b0; // 0x1b0
LegoNamedTexture* m_unk0x1b4; // 0x1b4
MxCore* m_unk0x1b8; // 0x1b8
Jetski* m_jetski; // 0x1b8
NamedPlane m_unk0x1bc; // 0x1bc
LegoNamedTexture* m_unk0x208; // 0x208
MxCore* m_unk0x20c; // 0x20c
DuneBuggy* m_dunebuggy; // 0x20c
NamedPlane m_unk0x210; // 0x210
LegoNamedTexture* m_unk0x25c; // 0x25c
LegoNamedTexture* m_unk0x260; // 0x260
LegoNamedTexture* m_unk0x264; // 0x264
MxCore* m_unk0x268; // 0x268
RaceCar* m_racecar; // 0x268
};

// FUNCTION: LEGO1 0x10033a70
Expand Down
3 changes: 2 additions & 1 deletion LEGO1/lego/legoomni/include/registrationbook.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class MxControlPresenter;
class MxEndActionNotificationParam;
class MxStillPresenter;
class LegoControlManagerNotificationParam;
class LegoPathStructNotificationParam;

// VTABLE: LEGO1 0x100d9928
// SIZE 0x2d0
Expand Down Expand Up @@ -65,7 +66,7 @@ class RegistrationBook : public LegoWorld {
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(MxU8 p_key);
MxLong HandleControl(LegoControlManagerNotificationParam& p_param);
MxLong HandleNotification19(MxParam& p_param);
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void FUN_100775c0(MxS16 p_playerIndex);
void WriteInfocenterLetters(MxS16);
void FUN_100778c0();
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/actors/pizza.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MxResult Pizza::Create(MxDSAction& p_dsAction)

if (result == SUCCESS) {
CreateState();
m_skateboard = (SkateBoard*) m_world->Find(m_atom, IsleScript::c_SkateBoard_Actor);
m_skateboard = (SkateBoard*) m_world->Find(m_atomId, IsleScript::c_SkateBoard_Actor);
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/actors/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void Radio::Stop()
if (m_state->IsActive()) {
LegoWorld* world = CurrentWorld();

MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), IsleScript::c_Radio_Ctl);
MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtomId(), IsleScript::c_Radio_Ctl);

if (presenter) {
presenter->VTable0x6c(0);
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/entity/legoentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void LegoEntity::SetWorldTransform(const Vector3& p_location, const Vector3& p_d
// FUNCTION: LEGO1 0x100107e0
MxResult LegoEntity::Create(MxDSAction& p_dsAction)
{
m_mxEntityId = p_dsAction.GetObjectId();
m_atom = p_dsAction.GetAtomId();
m_entityId = p_dsAction.GetObjectId();
m_atomId = p_dsAction.GetAtomId();
SetWorld();
return SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
if (world) {
MxDSAction action;
action.SetObjectId(1);
action.SetAtomId(world->GetAtom());
action.SetAtomId(world->GetAtomId());
LegoOmni::GetInstance()->Start(&action);
}
}
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/entity/legoworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
LegoEntity* entity;

while (entityCursor.Next(entity)) {
if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) {
if (entity->GetAtomId() == p_atom && entity->GetEntityId() == p_entityId) {
return entity;
}
}
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/main/legomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId)
b.Next();

if ((p_objectId == -1 || world->GetEntityId() == p_objectId) &&
(!p_atom.GetInternal() || world->GetAtom() == p_atom)) {
(!p_atom.GetInternal() || world->GetAtomId() == p_atom)) {
a.Detach();
delete world;
}
Expand All @@ -365,7 +365,7 @@ LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)

while (cursor.Next(world)) {
if ((p_entityid == -1 || world->GetEntityId() == p_entityid) &&
(!p_atom.GetInternal() || world->GetAtom() == p_atom)) {
(!p_atom.GetInternal() || world->GetAtomId() == p_atom)) {
return world;
}
}
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void ElevatorBottom::Enable(MxBool p_enable)
// FUNCTION: LEGO1 0x10018310
MxBool ElevatorBottom::Escape()
{
DeleteObjects(&m_atom, ElevbottScript::c_iica31in_PlayWav, 999);
DeleteObjects(&m_atomId, ElevbottScript::c_iica31in_PlayWav, 999);
m_destLocation = LegoGameState::e_infomain;
return TRUE;
}
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/worlds/gasstation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
if (result == 0) {
MxDSAction* action = p_param.GetAction();

if (action->GetAtomId() == m_atom && action->GetObjectId()) {
if (action->GetAtomId() == m_atomId && action->GetObjectId()) {
m_state->FUN_10006460((GarageScript::Script) action->GetObjectId());
m_unk0x106 = 0;

Expand Down
30 changes: 19 additions & 11 deletions LEGO1/lego/legoomni/src/worlds/hospital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ MxLong Hospital::HandleKeyPress(MxS8 p_key)
MxLong result = 0;

if (p_key == VK_SPACE && g_unk0x100f7918 == 0) {
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
result = 1;
}

Expand All @@ -241,7 +241,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
MxDSAction* action = p_param.GetAction();
Act1State* act1State;

if (action->GetAtomId() != m_atom) {
if (action->GetAtomId() != m_atomId) {
return result;
}

Expand Down Expand Up @@ -375,7 +375,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
m_unk0x128 = 1;
m_destLocation = LegoGameState::e_unk31;

DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}
break;
Expand All @@ -384,7 +384,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
m_unk0x128 = 1;
m_destLocation = LegoGameState::e_infomain;

DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}
break;
Expand Down Expand Up @@ -425,7 +425,11 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
act1State->SetUnknown18(9);

m_destLocation = LegoGameState::e_unk31;
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(
&m_atomId,
HospitalScript::c_hho002cl_RunAnim,
HospitalScript::c_hho006cl_RunAnim
);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}
}
Expand All @@ -434,7 +438,11 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
m_hospitalState->m_unk0x08.m_unk0x00 = 11;

BackgroundAudioManager()->RaiseVolume();
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(
&m_atomId,
HospitalScript::c_hho002cl_RunAnim,
HospitalScript::c_hho006cl_RunAnim
);
}
else {
switch (m_currentActorId) {
Expand Down Expand Up @@ -558,7 +566,7 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.GetClickedObjectId()) {
case HospitalScript::c_Info_Ctl:
BackgroundAudioManager()->RaiseVolume();
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);

if (m_unk0x100 == 1) {
m_hospitalState->m_unk0x08.m_unk0x00 = 14;
Expand All @@ -572,14 +580,14 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
m_hospitalState->m_unk0x08.m_unk0x00 = 13;
m_destLocation = LegoGameState::e_infomain;

DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}

break;

case HospitalScript::c_Door_Ctl:
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);

if (m_unk0x100 == 1) {
m_hospitalState->m_unk0x08.m_unk0x00 = 15;
Expand All @@ -593,7 +601,7 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param)
m_hospitalState->m_unk0x08.m_unk0x00 = 13;
m_destLocation = LegoGameState::e_unk31;

DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
}

Expand Down Expand Up @@ -664,7 +672,7 @@ MxResult Hospital::Tickle()
// FUNCTION: LEGO1 0x10076330
MxBool Hospital::Escape()
{
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, 999);
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, 999);
m_hospitalState->m_unk0x08.m_unk0x00 = 0;

m_destLocation = LegoGameState::e_infomain;
Expand Down
52 changes: 26 additions & 26 deletions LEGO1/lego/legoomni/src/worlds/infocenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
return 1;
}

if (action->GetAtomId() == m_atom && (action->GetObjectId() == InfomainScript::c_Mama_All_Movie ||
action->GetObjectId() == InfomainScript::c_Papa_All_Movie ||
action->GetObjectId() == InfomainScript::c_Pepper_All_Movie ||
action->GetObjectId() == InfomainScript::c_Nick_All_Movie ||
action->GetObjectId() == InfomainScript::c_Laura_All_Movie)) {
if (action->GetAtomId() == m_atomId && (action->GetObjectId() == InfomainScript::c_Mama_All_Movie ||
action->GetObjectId() == InfomainScript::c_Papa_All_Movie ||
action->GetObjectId() == InfomainScript::c_Pepper_All_Movie ||
action->GetObjectId() == InfomainScript::c_Nick_All_Movie ||
action->GetObjectId() == InfomainScript::c_Laura_All_Movie)) {
if (m_unk0x1d4) {
m_unk0x1d4--;
}
Expand Down Expand Up @@ -324,7 +324,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)

MxLong result = m_radio.Notify(p_param);

if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript)) {
if (result || (action->GetAtomId() != m_atomId && action->GetAtomId() != *g_introScript)) {
return result;
}

Expand Down Expand Up @@ -614,21 +614,21 @@ void Infocenter::InitializeBitmaps()
{
m_radio.Initialize(TRUE);

((MxPresenter*) Find(m_atom, InfomainScript::c_LeftArrow_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_RightArrow_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Info_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Boat_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Race_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Pizza_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Gas_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Med_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Cop_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Mama_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Papa_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Pepper_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Nick_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Laura_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atom, InfomainScript::c_Radio_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_LeftArrow_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_RightArrow_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Info_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Boat_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Race_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Pizza_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Gas_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Med_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Cop_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Mama_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Papa_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Pepper_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Nick_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Laura_Ctl))->Enable(TRUE);
((MxPresenter*) Find(m_atomId, InfomainScript::c_Radio_Ctl))->Enable(TRUE);

m_mapAreas[0].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap");
m_mapAreas[0].m_area.SetLeft(391);
Expand Down Expand Up @@ -1120,7 +1120,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param)
}

if (characterBitmap != InfomainScript::c_noneInfomain) {
m_unk0x11c = (MxStillPresenter*) Find(m_atom, characterBitmap);
m_unk0x11c = (MxStillPresenter*) Find(m_atomId, characterBitmap);
}
}

Expand Down Expand Up @@ -1241,16 +1241,16 @@ MxResult Infocenter::Tickle()
m_unk0x1d6 += 100;

if (m_unk0x1d6 > 3400 && m_unk0x1d6 < 3650) {
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 1);
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1);
}
else if (m_unk0x1d6 > 3650 && m_unk0x1d6 < 3900) {
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 0);
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0);
}
else if (m_unk0x1d6 > 3900 && m_unk0x1d6 < 4150) {
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 1);
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1);
}
else if (m_unk0x1d6 > 4400) {
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 0);
ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0);
m_unk0x1d6 = 0;
}
}
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ MxLong InfocenterDoor::Notify(MxParam& p_param)
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) {
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atomId) {
BackgroundAudioManager()->RaiseVolume();
result = 1;
}
Expand Down Expand Up @@ -95,7 +95,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_para
MxLong result = 0;

if (p_param.GetUnknown0x28() == 1) {
DeleteObjects(&m_atom, InfodoorScript::c_iic037in_PlayWav, 510);
DeleteObjects(&m_atomId, InfodoorScript::c_iic037in_PlayWav, 510);

switch (p_param.GetClickedObjectId()) {
case InfodoorScript::c_LeftArrow_Ctl:
Expand Down Expand Up @@ -167,7 +167,7 @@ void InfocenterDoor::Enable(MxBool p_enable)
// FUNCTION: LEGO1 0x10037cd0
MxBool InfocenterDoor::Escape()
{
DeleteObjects(&m_atom, InfodoorScript::c_iic037in_PlayWav, 510);
DeleteObjects(&m_atomId, InfodoorScript::c_iic037in_PlayWav, 510);
m_destLocation = LegoGameState::e_infomain;
return TRUE;
}
Loading

0 comments on commit 30e9e43

Please sign in to comment.