Refactor LegoOmni::PathContainer into IslePathActor::SpawnLocation (#877)

* Refactor LegoOmni::PathContainer into IslePathActor::SpawnLocation

* Add beta annotation

* Type var
This commit is contained in:
Christian Semmler 2024-05-02 10:51:41 -04:00 committed by GitHub
parent 0bf39c7108
commit 72cbd1fc60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 444 additions and 114 deletions

View file

@ -1,18 +1,78 @@
#ifndef ISLEPATHACTOR_H
#define ISLEPATHACTOR_H
#include "legocontrolmanager.h"
#include "legoendanimnotificationparam.h"
#include "legogamestate.h"
#include "legopathactor.h"
#include "legoworld.h"
#include "mxtype19notificationparam.h"
#include "mxtypes.h"
class LegoControlManagerEvent;
class LegoEndAnimNotificationParam;
class LegoWorld;
class MxType19NotificationParam;
// VTABLE: LEGO1 0x100d4398
// SIZE 0x160
class IslePathActor : public LegoPathActor {
public:
// SIZE 0x38
struct SpawnLocation {
SpawnLocation() {}
// FUNCTION: LEGO1 0x1001b1b0
SpawnLocation(
LegoGameState::Area p_area,
MxAtomId* p_script,
MxS32 p_entityId,
const char* p_key,
undefined2 p_unk0x20,
float p_unk0x24,
undefined2 p_unk0x28,
float p_unk0x2c,
undefined4 p_unk0x30,
JukeboxScript::Script p_music
)
{
m_area = p_area;
m_script = p_script;
m_entityId = p_entityId;
strcpy(m_key, p_key);
m_unk0x20 = p_unk0x20;
m_unk0x24 = p_unk0x24;
m_unk0x28 = p_unk0x28;
m_unk0x2c = p_unk0x2c;
m_unk0x30 = p_unk0x30;
m_music = p_music;
}
// FUNCTION: LEGO1 0x1001b230
SpawnLocation& operator=(const SpawnLocation& p_container)
{
m_area = p_container.m_area;
m_script = p_container.m_script;
m_entityId = p_container.m_entityId;
strcpy(m_key, p_container.m_key);
m_unk0x20 = p_container.m_unk0x20;
m_unk0x24 = p_container.m_unk0x24;
m_unk0x28 = p_container.m_unk0x28;
m_unk0x2c = p_container.m_unk0x2c;
m_unk0x30 = p_container.m_unk0x30;
m_music = p_container.m_music;
return *this;
}
private:
LegoGameState::Area m_area; // 0x00
MxAtomId* m_script; // 0x04
MxS32 m_entityId; // 0x08
char m_key[20]; // 0x0c
undefined2 m_unk0x20; // 0x20
float m_unk0x24; // 0x24
undefined2 m_unk0x28; // 0x28
float m_unk0x2c; // 0x2c
undefined4 m_unk0x30; // 0x30
JukeboxScript::Script m_music; // 0x34
};
IslePathActor();
// FUNCTION: LEGO1 0x10002e10
@ -64,6 +124,8 @@ class IslePathActor : public LegoPathActor {
void FUN_1001b660();
static void RegisterSpawnLocations();
protected:
LegoWorld* m_world; // 0x154
IslePathActor* m_unk0x158; // 0x158

View file

@ -167,7 +167,7 @@ class LegoAnimationManager : public MxCore {
MxLong m_unk0x40c; // 0x40c
MxLong m_unk0x410; // 0x410
undefined4 m_unk0x414; // 0x414
undefined4 m_unk0x418; // 0x418
MxU32 m_numAllowedExtras; // 0x418
undefined4 m_unk0x41c; // 0x41c
AnimState* m_animState; // 0x420
LegoROIList* m_unk0x424; // 0x424

View file

@ -54,8 +54,9 @@ class LegoGameState {
e_unk20,
e_unk21,
e_pizzeriaExterior,
e_garageExterior = 25,
e_unk23,
e_unk24,
e_garageExterior,
e_garage,
e_garadoor,
e_unk28,
@ -73,14 +74,17 @@ class LegoGameState {
e_unk40,
e_unk41,
e_unk42,
e_unk45 = 45,
e_unk43,
e_unk44,
e_unk45,
e_act2main,
e_act3script,
e_unk48,
e_unk49,
e_jukeboxw = 53,
e_unk50,
e_unk51,
e_unk52,
e_jukeboxw,
e_unk54,
e_unk55,
e_histbook,

View file

@ -103,65 +103,6 @@ class LegoOmni : public MxOmni {
MxAtomId* m_atomId; // 0x18
};
// SIZE 0x38
struct PathContainer {
PathContainer() {}
// FUNCTION: LEGO1 0x1001b1b0
PathContainer(
undefined4 p_unk0x00,
MxAtomId* p_script,
undefined4 p_unk0x04,
const char* p_key,
undefined2 p_unk0x20,
float p_unk0x24,
undefined2 p_unk0x28,
float p_unk0x2c,
undefined4 p_unk0x30,
MxS32 p_unk0x34
)
{
m_unk0x00 = p_unk0x00;
m_script = p_script;
m_unk0x04 = p_unk0x04;
strcpy(m_key, p_key);
m_unk0x20 = p_unk0x20;
m_unk0x24 = p_unk0x24;
m_unk0x28 = p_unk0x28;
m_unk0x2c = p_unk0x2c;
m_unk0x30 = p_unk0x30;
m_unk0x34 = p_unk0x34;
}
// FUNCTION: LEGO1 0x1001b230
PathContainer& operator=(const PathContainer& p_container)
{
m_unk0x00 = p_container.m_unk0x00;
m_script = p_container.m_script;
m_unk0x04 = p_container.m_unk0x04;
strcpy(m_key, p_container.m_key);
m_unk0x20 = p_container.m_unk0x20;
m_unk0x24 = p_container.m_unk0x24;
m_unk0x28 = p_container.m_unk0x28;
m_unk0x2c = p_container.m_unk0x2c;
m_unk0x30 = p_container.m_unk0x30;
m_unk0x34 = p_container.m_unk0x34;
return *this;
}
private:
undefined4 m_unk0x00; // 0x00
MxAtomId* m_script; // 0x04
undefined4 m_unk0x04; // 0x08
char m_key[20]; // 0x0c
undefined2 m_unk0x20; // 0x20
float m_unk0x24; // 0x24
undefined2 m_unk0x28; // 0x28
float m_unk0x2c; // 0x2c
undefined4 m_unk0x30; // 0x30
MxS32 m_unk0x34; // 0x34
};
LegoOmni();
~LegoOmni() override; // vtable+00

View file

@ -1,5 +1,6 @@
#include "islepathactor.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"
#include "legonavcontroller.h"
#include "legopathboundary.h"
@ -8,6 +9,10 @@
#include "mxnotificationparam.h"
DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38)
// GLOBAL: LEGO1 0x10102b28
IslePathActor::SpawnLocation g_spawnLocations[29];
// FUNCTION: LEGO1 0x1001a200
IslePathActor::IslePathActor()
@ -90,7 +95,361 @@ void IslePathActor::VTable0xe4()
// TODO
}
// FUNCTION: LEGO1 0x1001a700
void IslePathActor::RegisterSpawnLocations()
{
g_spawnLocations[0] = SpawnLocation(
LegoGameState::e_pizzeriaExterior,
g_isleScript,
0,
"int35",
2,
0.6,
4,
0.4,
0x2a,
JukeboxScript::c_Quiet_Audio
);
g_spawnLocations[1] = SpawnLocation(
LegoGameState::e_unk23,
g_isleScript,
0,
"edg00_49",
1,
0.43,
2,
0.6,
0x27,
JukeboxScript::c_Quiet_Audio
);
g_spawnLocations[2] = SpawnLocation(
LegoGameState::e_unk24,
g_isleScript,
0,
"edg00_191",
2,
0.5,
0,
0.55,
0x26,
JukeboxScript::c_Quiet_Audio
);
g_spawnLocations[3] = SpawnLocation(
LegoGameState::e_unk4,
g_isleScript,
0,
"int46",
0,
0.5,
2,
0.5,
0x10,
JukeboxScript::c_InformationCenter_Music
);
g_spawnLocations[4] = SpawnLocation(
LegoGameState::e_jetraceExterior,
g_isleScript,
0,
"EDG00_46",
0,
0.95,
2,
0.19,
0x17,
JukeboxScript::c_Beach_Music
);
g_spawnLocations[5] = SpawnLocation(
LegoGameState::e_unk17,
g_isleScript,
0,
"EDG00_46",
3,
0.625,
2,
0.03,
0x18,
JukeboxScript::c_Beach_Music
);
g_spawnLocations[6] = SpawnLocation(
LegoGameState::e_jetrace2,
g_isleScript,
0,
"EDG10_63",
0,
0.26,
1,
0.01,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[7] = SpawnLocation(
LegoGameState::e_carraceExterior,
g_isleScript,
0,
"INT15",
5,
0.65,
1,
0.68,
0x33,
JukeboxScript::c_CentralNorthRoad_Music
);
g_spawnLocations[8] = SpawnLocation(
LegoGameState::e_unk20,
g_isleScript,
0,
"INT16",
4,
0.1,
2,
0,
0x34,
JukeboxScript::c_CentralNorthRoad_Music
);
g_spawnLocations[9] = SpawnLocation(
LegoGameState::e_unk21,
g_isleScript,
0,
"INT62",
2,
0.1,
3,
0.7,
0x36,
JukeboxScript::c_CentralNorthRoad_Music
);
g_spawnLocations[10] = SpawnLocation(
LegoGameState::e_garageExterior,
g_isleScript,
0,
"INT24",
0,
0.55,
2,
0.71,
0x08,
JukeboxScript::c_GarageArea_Music
);
g_spawnLocations[11] = SpawnLocation(
LegoGameState::e_unk28,
g_isleScript,
0,
"INT24",
2,
0.73,
4,
0.71,
0x0a,
JukeboxScript::c_GarageArea_Music
);
g_spawnLocations[12] = SpawnLocation(
LegoGameState::e_hospitalExterior,
g_isleScript,
0,
"INT19",
0,
0.85,
1,
0.28,
0,
JukeboxScript::c_Hospital_Music
);
g_spawnLocations[13] = SpawnLocation(
LegoGameState::e_unk31,
g_isleScript,
0,
"EDG02_28",
3,
0.37,
1,
0.52,
0x0c,
JukeboxScript::c_Hospital_Music
);
g_spawnLocations[14] = SpawnLocation(
LegoGameState::e_policeExterior,
g_isleScript,
0,
"INT33",
0,
0.88,
2,
0.74,
0x22,
JukeboxScript::c_PoliceStation_Music
);
g_spawnLocations[15] = SpawnLocation(
LegoGameState::e_unk33,
g_isleScript,
0,
"EDG02_64",
2,
0.24,
0,
0.84,
0x23,
JukeboxScript::c_PoliceStation_Music
);
g_spawnLocations[16] = SpawnLocation(
LegoGameState::e_unk40,
g_isleScript,
0,
"edg02_51",
2,
0.63,
3,
0.01,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[17] = SpawnLocation(
LegoGameState::e_unk41,
g_isleScript,
0,
"edg02_51",
2,
0.63,
0,
0.4,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[18] = SpawnLocation(
LegoGameState::e_unk43,
g_isleScript,
0,
"edg02_35",
2,
0.8,
0,
0.2,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[19] = SpawnLocation(
LegoGameState::e_unk44,
g_isleScript,
0,
"EDG03_01",
2,
0.25,
0,
0.75,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[20] = SpawnLocation(
LegoGameState::e_unk45,
g_isleScript,
0,
"edg10_70",
3,
0.25,
0,
0.7,
0x44,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[21] = SpawnLocation(
LegoGameState::e_unk42,
g_isleScript,
0,
"inv_05",
2,
0.75,
0,
0.19,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[22] = SpawnLocation(
LegoGameState::e_unk48,
g_act3Script,
0,
"edg02_51",
2,
0.63,
0,
0.4,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[23] = SpawnLocation(
LegoGameState::e_unk49,
g_act3Script,
0,
"inv_05",
2,
0.75,
0,
0.19,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[24] = SpawnLocation(
LegoGameState::e_unk50,
g_act2mainScript,
0,
"EDG02_51",
0,
0.64,
1,
0.37,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[25] = SpawnLocation(
LegoGameState::e_unk51,
g_isleScript,
0,
"edg02_32",
0,
0.5,
2,
0.5,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[26] = SpawnLocation(
LegoGameState::e_unk52,
g_isleScript,
0,
"edg02_19",
2,
0.5,
0,
0.5,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[27] = SpawnLocation(
LegoGameState::e_unk54,
g_isleScript,
0,
"int36",
0,
0.2,
4,
0.4,
0,
JukeboxScript::c_noneJukebox
);
g_spawnLocations[28] = SpawnLocation(
LegoGameState::e_unk55,
g_isleScript,
0,
"edg02_50",
2,
0.8,
1,
0.3,
0,
JukeboxScript::c_noneJukebox
);
}
// STUB: LEGO1 0x1001b2a0
// FUNCTION: BETA10 0x100369c6
void IslePathActor::VTable0xe8(LegoGameState::Area, MxBool, MxU8)
{
// TODO

View file

@ -3,6 +3,7 @@
#include "define.h"
#include "islepathactor.h"
#include "legocharactermanager.h"
#include "legoendanimnotificationparam.h"
#include "legogamestate.h"
#include "legoomni.h"
#include "legoroilist.h"
@ -306,7 +307,7 @@ void LegoAnimationManager::Init()
m_unk0x3fc = 0;
m_unk0x400 = FALSE;
m_unk0x414 = 0;
m_unk0x418 = 5;
m_numAllowedExtras = 5;
m_unk0x0e = 0;
m_unk0x10 = 0;
m_unk0x401 = FALSE;
@ -1121,11 +1122,11 @@ MxResult LegoAnimationManager::Tickle()
if (elapsedSeconds < 1.0 && elapsedSeconds > 0.01) {
g_unk0x100f7500 = (g_unk0x100f7500 * 2.0 + elapsedSeconds) / 3.0;
if (elapsedSeconds > 0.2 && m_unk0x418 > 2) {
m_unk0x418--;
if (elapsedSeconds > 0.2 && m_numAllowedExtras > 2) {
m_numAllowedExtras--;
}
else if (g_unk0x100f7500 < 0.16 && m_unk0x418 < m_unk0x41c) {
m_unk0x418++;
else if (g_unk0x100f7500 < 0.16 && m_numAllowedExtras < m_unk0x41c) {
m_numAllowedExtras++;
}
}

View file

@ -1,5 +1,6 @@
#include "legoomni.h"
#include "islepathactor.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legocharactermanager.h"
@ -28,7 +29,6 @@
#include "viewmanager/viewmanager.h"
DECOMP_SIZE_ASSERT(LegoOmni::ScriptContainer, 0x1c)
DECOMP_SIZE_ASSERT(LegoOmni::PathContainer, 0x38)
DECOMP_SIZE_ASSERT(LegoWorldList, 0x18)
DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10)
@ -120,43 +120,6 @@ MxAtomId* g_nocdSourceName = NULL;
// STRING: LEGO1 0x100f6710
const char* g_current = "current";
// GLOBAL: LEGO1 0x10102b28
LegoOmni::PathContainer g_extraPaths[29];
// FUNCTION: LEGO1 0x1001a700
void RegisterExtraPaths()
{
g_extraPaths[0] = LegoOmni::PathContainer(0x16, g_isleScript, 0, "int35", 2, 0.6, 4, 0.4, 0x2a, 0x12);
g_extraPaths[1] = LegoOmni::PathContainer(0x17, g_isleScript, 0, "edg00_49", 1, 0.43, 2, 0.6, 0x27, 0x12);
g_extraPaths[2] = LegoOmni::PathContainer(0x18, g_isleScript, 0, "edg00_191", 2, 0.5, 0, 0.55, 0x26, 0x12);
g_extraPaths[3] = LegoOmni::PathContainer(0x04, g_isleScript, 0, "int46", 0, 0.5, 2, 0.5, 0x10, 0x0b);
g_extraPaths[4] = LegoOmni::PathContainer(0x10, g_isleScript, 0, "EDG00_46", 0, 0.95, 2, 0.19, 0x17, 0x11);
g_extraPaths[5] = LegoOmni::PathContainer(0x11, g_isleScript, 0, "EDG00_46", 3, 0.625, 2, 0.03, 0x18, 0x11);
g_extraPaths[6] = LegoOmni::PathContainer(0x0f, g_isleScript, 0, "EDG10_63", 0, 0.26, 1, 0.01, 0, -1);
g_extraPaths[7] = LegoOmni::PathContainer(0x13, g_isleScript, 0, "INT15", 5, 0.65, 1, 0.68, 0x33, 0x0e);
g_extraPaths[8] = LegoOmni::PathContainer(0x14, g_isleScript, 0, "INT16", 4, 0.1, 2, 0, 0x34, 0x0e);
g_extraPaths[9] = LegoOmni::PathContainer(0x15, g_isleScript, 0, "INT62", 2, 0.1, 3, 0.7, 0x36, 0x0e);
g_extraPaths[10] = LegoOmni::PathContainer(0x19, g_isleScript, 0, "INT24", 0, 0.55, 2, 0.71, 0x08, 0x0f);
g_extraPaths[11] = LegoOmni::PathContainer(0x1c, g_isleScript, 0, "INT24", 2, 0.73, 4, 0.71, 0x0a, 0x0f);
g_extraPaths[12] = LegoOmni::PathContainer(0x1d, g_isleScript, 0, "INT19", 0, 0.85, 1, 0.28, 0, 0x0a);
g_extraPaths[13] = LegoOmni::PathContainer(0x1f, g_isleScript, 0, "EDG02_28", 3, 0.37, 1, 0.52, 0x0c, 0x0a);
g_extraPaths[14] = LegoOmni::PathContainer(0x20, g_isleScript, 0, "INT33", 0, 0.88, 2, 0.74, 0x22, 0x0c);
g_extraPaths[15] = LegoOmni::PathContainer(0x21, g_isleScript, 0, "EDG02_64", 2, 0.24, 0, 0.84, 0x23, 0x0c);
g_extraPaths[16] = LegoOmni::PathContainer(0x28, g_isleScript, 0, "edg02_51", 2, 0.63, 3, 0.01, 0, -1);
g_extraPaths[17] = LegoOmni::PathContainer(0x29, g_isleScript, 0, "edg02_51", 2, 0.63, 0, 0.4, 0, -1);
g_extraPaths[18] = LegoOmni::PathContainer(0x2b, g_isleScript, 0, "edg02_35", 2, 0.8, 0, 0.2, 0, -1);
g_extraPaths[19] = LegoOmni::PathContainer(0x2c, g_isleScript, 0, "EDG03_01", 2, 0.25, 0, 0.75, 0, -1);
g_extraPaths[20] = LegoOmni::PathContainer(0x2d, g_isleScript, 0, "edg10_70", 3, 0.25, 0, 0.7, 0x44, -1);
g_extraPaths[21] = LegoOmni::PathContainer(0x2a, g_isleScript, 0, "inv_05", 2, 0.75, 0, 0.19, 0, -1);
g_extraPaths[22] = LegoOmni::PathContainer(0x30, g_act3Script, 0, "edg02_51", 2, 0.63, 0, 0.4, 0, -1);
g_extraPaths[23] = LegoOmni::PathContainer(0x31, g_act3Script, 0, "inv_05", 2, 0.75, 0, 0.19, 0, -1);
g_extraPaths[24] = LegoOmni::PathContainer(0x32, g_act2mainScript, 0, "EDG02_51", 0, 0.64, 1, 0.37, 0, -1);
g_extraPaths[25] = LegoOmni::PathContainer(0x33, g_isleScript, 0, "edg02_32", 0, 0.5, 2, 0.5, 0, -1);
g_extraPaths[26] = LegoOmni::PathContainer(0x34, g_isleScript, 0, "edg02_19", 2, 0.5, 0, 0.5, 0, -1);
g_extraPaths[27] = LegoOmni::PathContainer(0x36, g_isleScript, 0, "int36", 0, 0.2, 4, 0.4, 0, -1);
g_extraPaths[28] = LegoOmni::PathContainer(0x37, g_isleScript, 0, "edg02_50", 2, 0.8, 1, 0.3, 0, -1);
}
// FUNCTION: LEGO1 0x1003dd70
LegoROI* PickROI(MxLong p_a, MxLong p_b)
{
@ -467,7 +430,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
m_variableTable->SetVariable(variable);
CreateScripts();
RegisterExtraPaths();
IslePathActor::RegisterSpawnLocations();
result = RegisterScripts();
if (result != SUCCESS) {