Implement/match LegoPathActor::ParseAction (#946)

* Implement/match LegoPathActor::ParseAction

* Fix naming

* Space
This commit is contained in:
Christian Semmler 2024-05-24 13:07:45 -04:00 committed by GitHub
parent 6774784b37
commit db90807d53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 137 additions and 75 deletions

View file

@ -20,6 +20,10 @@ const char* g_strAUTO_CREATE = "AUTO_CREATE";
// STRING: LEGO1 0x10102000
const char* g_strBOTTOM_TO_TOP = "BOTTOM_TO_TOP";
// GLOBAL: LEGO1 0x10102060
// STRING: LEGO1 0x10101ff4
const char* g_strCOLLIDEBOX = "COLLIDEBOX";
// GLOBAL: LEGO1 0x10102064
// STRING: LEGO1 0x10101fec
const char* g_strSTYLE = "STYLE";
@ -68,6 +72,14 @@ const char* g_strMUST_SUCCEED = "MUST_SUCCEED";
// STRING: LEGO1 0x10101f58
const char* g_strOBJECT = "OBJECT";
// GLOBAL: LEGO1 0x101020a0
// STRING: LEGO1 0x10101f50
const char* g_strPATH = "PATH";
// GLOBAL: LEGO1 0x101020a4
// STRING: LEGO1 0x10101f40
const char* g_strPERMIT_NAVIGATE = "PERMIT_NAVIGATE";
// GLOBAL: LEGO1 0x101020a8
// STRING: LEGO1 0x10101f38
const char* g_strPTATCAM = "PTATCAM";

View file

@ -34,5 +34,8 @@ extern const char* g_strVARIABLE;
extern const char* g_strBMP_ISMAP;
extern const char* g_strAUTO_CREATE;
extern const char* g_strDB_CREATE;
extern const char* g_strPERMIT_NAVIGATE;
extern const char* g_strPATH;
extern const char* g_strCOLLIDEBOX;
#endif // DEFINE_H

View file

@ -59,7 +59,7 @@ class Isle : public LegoWorld {
MxBool VTable0x64() override; // vtable+64
void Enable(MxBool p_enable) override; // vtable+68
virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c
virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+6c
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleClick(LegoControlManagerEvent& p_param);

View file

@ -137,7 +137,7 @@ class IslePathActor : public LegoPathActor {
protected:
LegoWorld* m_world; // 0x154
IslePathActor* m_unk0x158; // 0x158
LegoPathActor* m_unk0x158; // 0x158
MxFloat m_unk0x15c; // 0x15c
};

View file

@ -6,7 +6,6 @@
#include "mxomni.h"
class Isle;
class IslePathActor;
class LegoAnimationManager;
class LegoBuildingManager;
class LegoCharacterManager;
@ -14,6 +13,7 @@ class LegoEntity;
class LegoGameState;
class LegoInputManager;
class LegoNavController;
class LegoPathActor;
class LegoPathBoundary;
class LegoPlantManager;
class LegoROI;
@ -127,7 +127,7 @@ class LegoOmni : public MxOmni {
ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; }
LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; }
IslePathActor* GetCurrentActor() { return m_currentActor; }
LegoPathActor* GetCurrentActor() { return m_currentActor; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; }
LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; }
@ -139,7 +139,7 @@ class LegoOmni : public MxOmni {
LegoWorldList* GetWorldList() { return m_worldList; }
inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
inline void SetCurrentActor(IslePathActor* p_currentActor) { m_currentActor = p_currentActor; }
inline void SetCurrentActor(LegoPathActor* p_currentActor) { m_currentActor = p_currentActor; }
inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; }
inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction)
@ -162,7 +162,7 @@ class LegoOmni : public MxOmni {
LegoWorld* m_currentWorld; // 0x7c
MxBool m_exit; // 0x80
LegoNavController* m_navController; // 0x84
IslePathActor* m_currentActor; // 0x88
LegoPathActor* m_currentActor; // 0x88
LegoCharacterManager* m_characterManager; // 0x8c
LegoPlantManager* m_plantManager; // 0x90
LegoAnimationManager* m_animationManager; // 0x94

View file

@ -155,7 +155,7 @@ class LegoPathActor : public LegoActor {
MxU32 m_state; // 0xdc
LegoUnknown100db7f4* m_destEdge; // 0xe0
MxFloat m_unk0xe4; // 0xe4
undefined m_unk0xe8; // 0xe8
MxBool m_collideBox; // 0xe8
undefined m_unk0xe9; // 0xe9
MxBool m_userNavFlag; // 0xea
MxMatrix m_unk0xec; // 0xec

View file

@ -8,7 +8,6 @@
#include "mxpresenterlist.h"
#include "roi/legoroi.h"
class IslePathActor;
class LegoCameraController;
class LegoPathBoundary;
class LegoHideAnimPresenter;

View file

@ -7,7 +7,6 @@
#include "lego/legoomni/include/actions/actionsfwd.h"
#include "mxtypes.h"
class IslePathActor;
class LegoAnimationManager;
class LegoBuildingManager;
class LegoCharacterManager;
@ -16,6 +15,7 @@ class LegoGameState;
class LegoInputManager;
class LegoNavController;
class LegoOmni;
class LegoPathActor;
class LegoPlantManager;
class LegoROI;
class LegoSoundManager;
@ -40,7 +40,7 @@ LegoControlManager* ControlManager();
LegoGameState* GameState();
LegoAnimationManager* AnimationManager();
LegoNavController* NavController();
IslePathActor* CurrentActor();
LegoPathActor* CurrentActor();
LegoWorld* CurrentWorld();
LegoCharacterManager* CharacterManager();
ViewManager* GetViewManager();
@ -51,7 +51,7 @@ ViewLODListManager* GetViewLODListManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags);
LegoROI* FindROI(const char* p_name);
void SetROIVisible(const char* p_name, MxBool p_visible);
void SetCurrentActor(IslePathActor* p_currentActor);
void SetCurrentActor(LegoPathActor* p_currentActor);
MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction);
void DeleteAction();
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);

View file

@ -78,11 +78,12 @@ void Helicopter::VTable0xe4()
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
GameState()->SetCurrentArea(LegoGameState::e_copter);
if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) {
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk55,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
LegoGameState::e_unk55,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
}
}
@ -116,7 +117,7 @@ MxU32 Helicopter::VTable0xcc()
if (CurrentActor()) {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
}

View file

@ -27,7 +27,7 @@ IslePathActor::IslePathActor()
m_world = NULL;
m_unk0x13c = 6.0;
m_unk0x15c = 1.0;
m_unk0x158 = 0;
m_unk0x158 = NULL;
}
// FUNCTION: LEGO1 0x1001a280

View file

@ -38,7 +38,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
}
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw);

View file

@ -87,7 +87,7 @@ MxU32 SkateBoard::VTable0xcc()
if (GameState()->GetActorId() != CurrentActor()->GetActorId()) {
if (!CurrentActor()->IsA("SkateBoard")) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
}

View file

@ -994,7 +994,7 @@ MxResult LegoAnimationManager::FUN_100605e0(
FUN_100648f0(tranInfo, m_unk0x404);
}
else if (p_unk0x0a) {
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (actor != NULL) {
actor->SetState(4);
@ -1432,7 +1432,7 @@ MxResult LegoAnimationManager::Tickle()
return SUCCESS;
}
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
LegoROI* roi;
if (actor == NULL || (roi = actor->GetROI()) == NULL) {
@ -1655,7 +1655,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info)
LegoEntityListCursor cursor(entityList);
LegoEntity* entity;
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
while (cursor.Next(entity)) {
if (entity != actor && entity->IsA("LegoPathActor")) {
@ -1858,7 +1858,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
if (world != NULL) {
PurgeExtra(FALSE);
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) {
MxU32 i;
for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) {
@ -2163,7 +2163,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
{
MxU32 local2c = 12;
float destScale = ((rand() * 0.5) / 32767.0) + 0.25;
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (actor == NULL) {
return FALSE;

View file

@ -425,7 +425,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time)
MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
{
LegoROI* viewROI = VideoManager()->GetViewROI();
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) {
if (m_unk0x64 != NULL) {

View file

@ -172,7 +172,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
m_actorId = p_actorId;
}
IslePathActor* oldActor = CurrentActor();
LegoPathActor* oldActor = CurrentActor();
SetCurrentActor(NULL);
IslePathActor* newActor = new IslePathActor();
@ -199,7 +199,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
// FUNCTION: LEGO1 0x10039910
void LegoGameState::RemoveActor()
{
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
SetCurrentActor(NULL);
delete actor;
m_actorId = 0;
@ -209,7 +209,7 @@ void LegoGameState::RemoveActor()
void LegoGameState::ResetROI()
{
if (m_actorId) {
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (actor) {
LegoROI* roi = actor->GetROI();
@ -906,11 +906,12 @@ void LegoGameState::SwitchArea(Area p_area)
AnimationManager()->Resume();
}
CurrentActor()->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
break;
}
case e_hospital:
@ -922,11 +923,12 @@ void LegoGameState::SwitchArea(Area p_area)
SetCameraControllerFromIsle();
CurrentActor()->ResetWorldTransform(TRUE);
AnimationManager()->Resume();
CurrentActor()->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
p_area,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
break;
case e_police:
VideoManager()->SetUnk0x554(TRUE);

View file

@ -67,7 +67,7 @@ LegoNavController* NavController()
}
// FUNCTION: LEGO1 0x10015790
IslePathActor* CurrentActor()
LegoPathActor* CurrentActor()
{
return LegoOmni::GetInstance()->GetCurrentActor();
}
@ -137,7 +137,7 @@ void SetROIVisible(const char* p_name, MxBool p_visible)
}
// FUNCTION: LEGO1 0x10015880
void SetCurrentActor(IslePathActor* p_currentActor)
void SetCurrentActor(LegoPathActor* p_currentActor)
{
LegoOmni::GetInstance()->SetCurrentActor(p_currentActor);
}

View file

@ -1,7 +1,6 @@
#include "legoworld.h"
#include "anim/legoanim.h"
#include "islepathactor.h"
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
#include "legobuildingmanager.h"
@ -701,7 +700,7 @@ void LegoWorld::Enable(MxBool p_enable)
else if (!p_enable && m_set0xd0.empty()) {
MxPresenter* presenter;
LegoPathController* controller;
IslePathActor* actor = CurrentActor();
LegoPathActor* actor = CurrentActor();
if (actor) {
RemovePathActor(actor);

View file

@ -24,7 +24,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param)
state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -24,7 +24,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param)
act1State->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -26,7 +26,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param)
switch (GameState()->GetCurrentAct()) {
case LegoGameState::Act::e_act1: {
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -22,7 +22,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param)
state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -1,5 +1,6 @@
#include "legopathactor.h"
#include "define.h"
#include "geom/legounkown100db7f4.h"
#include "legocachesoundmanager.h"
#include "legocameracontroller.h"
@ -11,6 +12,7 @@
#include "misc.h"
#include "mxmisc.h"
#include "mxtimer.h"
#include "mxutilities.h"
#include "mxvariabletable.h"
#include <vec.h>
@ -44,7 +46,7 @@ LegoPathActor::LegoPathActor()
m_state = 0;
m_grec = NULL;
m_controller = NULL;
m_unk0xe8 = 0;
m_collideBox = FALSE;
m_unk0x148 = 0;
m_unk0x14c = 0;
m_unk0x140 = 0.0099999999f;
@ -454,7 +456,7 @@ MxU32 LegoPathActor::VTable0x6c(
LegoROI* roi = actor->GetROI();
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_unk0xe8 != 0 && actor->m_unk0xe8 != 0)) {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->m_collideBox)) {
VTable0x94(actor, TRUE);
actor->VTable0x94(this, FALSE);
return 2;
@ -540,10 +542,50 @@ inline MxU32 LegoPathActor::FUN_1002edd0(
return result;
}
// STUB: LEGO1 0x1002f020
// FUNCTION: LEGO1 0x1002f020
// FUNCTION: BETA10 0x100af54a
void LegoPathActor::ParseAction(char* p_extra)
{
LegoActor::ParseAction(p_extra);
char value[256];
value[0] = '\0';
if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) {
SetUserNavFlag(TRUE);
NavController()->ResetLinearVel(m_worldSpeed);
SetCurrentActor(this);
}
char* token;
if (KeyValueStringParse(value, g_strPATH, p_extra)) {
char name[12];
token = strtok(value, g_parseExtraTokens);
strcpy(name, token);
token = strtok(NULL, g_parseExtraTokens);
MxS32 src = atoi(token);
token = strtok(NULL, g_parseExtraTokens);
float srcScale = atof(token);
token = strtok(NULL, g_parseExtraTokens);
MxS32 dest = atoi(token);
token = strtok(NULL, g_parseExtraTokens);
float destScale = atof(token);
LegoWorld* world = CurrentWorld();
if (world != NULL) {
world->PlaceActor(this, name, src, srcScale, dest, destScale);
}
}
if (KeyValueStringParse(value, g_strCOLLIDEBOX, p_extra)) {
token = strtok(value, g_parseExtraTokens);
m_collideBox = atoi(token);
}
}
// FUNCTION: LEGO1 0x1002f1b0

View file

@ -24,7 +24,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param)
state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -22,7 +22,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param)
state->SetUnknown18(0);
if (CurrentActor()->GetActorId() != GameState()->GetActorId()) {
CurrentActor()->VTable0xe4();
((IslePathActor*) CurrentActor())->VTable0xe4();
}
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);

View file

@ -503,7 +503,7 @@ void Isle::Enable(MxBool p_enable)
}
if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) {
IslePathActor* actor = CurrentActor();
IslePathActor* actor = (IslePathActor*) CurrentActor();
actor->SpawnPlayer(
LegoGameState::e_unk45,
FALSE,
@ -657,11 +657,12 @@ void Isle::Enable(MxBool p_enable)
}
break;
case 5: {
CurrentActor()->SpawnPlayer(
LegoGameState::e_jetrace2,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
LegoGameState::e_jetrace2,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
if (raceState->GetUnknown0x28() == 2) {
@ -689,11 +690,12 @@ void Isle::Enable(MxBool p_enable)
}
case 6: {
GameState()->m_currentArea = LegoGameState::e_carraceExterior;
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk21,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
LegoGameState::e_unk21,
FALSE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState");
if (raceState->GetUnknown0x28() == 2) {
@ -738,11 +740,12 @@ void Isle::Enable(MxBool p_enable)
break;
case 11:
m_act1state->m_unk0x018 = 0;
CurrentActor()->SpawnPlayer(
LegoGameState::e_unk54,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
LegoGameState::e_unk54,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
GameState()->m_currentArea = LegoGameState::e_unk66;
FUN_1003ef00(TRUE);
m_jukebox->StartAction();
@ -789,7 +792,7 @@ void Isle::FUN_10032620()
case LegoGameState::e_unk66: {
MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World());
LegoPathBoundary* boundary = CurrentActor()->GetBoundary();
CurrentActor()->VTable0xec(mat, boundary, TRUE);
((IslePathActor*) CurrentActor())->VTable0xec(mat, boundary, TRUE);
break;
}
case LegoGameState::e_unk4:
@ -802,11 +805,12 @@ void Isle::FUN_10032620()
case LegoGameState::e_hospitalExterior:
case LegoGameState::e_unk31:
case LegoGameState::e_policeExterior:
CurrentActor()->SpawnPlayer(
GameState()->m_currentArea,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
((IslePathActor*) CurrentActor())
->SpawnPlayer(
GameState()->m_currentArea,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
GameState()->m_currentArea = LegoGameState::e_unk66;
break;
}
@ -1065,7 +1069,7 @@ void Isle::Add(MxCore* p_object)
}
// FUNCTION: LEGO1 0x10033050
void Isle::VTable0x6c(IslePathActor* p_actor)
void Isle::VTable0x6c(LegoPathActor* p_actor)
{
LegoWorld::Remove(p_actor);