Continued work on LegoGameState

This commit is contained in:
Nathan 2024-02-25 23:22:04 -05:00
parent c5318dca13
commit 1e4c939db9
18 changed files with 179 additions and 82 deletions

View File

@ -41,16 +41,18 @@ class LegoActor : public LegoEntity {
virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c
// FUNCTION: LEGO1 0x10002d00 // FUNCTION: LEGO1 0x10002d00
virtual MxU8 VTable0x60() { return m_unk0x74; } // vtable+0x60 virtual MxU8 GetActorId() { return m_actorId; } // vtable+0x60
// FUNCTION: LEGO1 0x10002d10 // FUNCTION: LEGO1 0x10002d10
virtual void VTable0x64(MxU8 p_unk0x74) { m_unk0x74 = p_unk0x74; } // vtable+0x64 virtual void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } // vtable+0x64
static const char* GetActorName(MxU8 p_id);
private: private:
MxFloat m_unk0x68; // 0x68 MxFloat m_unk0x68; // 0x68
LegoCacheSound* m_sound; // 0x6c LegoCacheSound* m_sound; // 0x6c
MxFloat m_unk0x70; // 0x70 MxFloat m_unk0x70; // 0x70
MxU8 m_unk0x74; // 0x74 MxU8 m_actorId; // 0x74
}; };
// SYNTHETIC: LEGO1 0x1002d300 // SYNTHETIC: LEGO1 0x1002d300

View File

@ -63,6 +63,7 @@ class LegoEntity : public MxEntity {
inline MxU8 GetFlags() { return m_flags; } inline MxU8 GetFlags() { return m_flags; }
inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; } inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
inline void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; }
protected: protected:
void Init(); void Init();

View File

@ -88,8 +88,10 @@ class LegoGameState {
}; };
// SIZE 0x0c // SIZE 0x0c
struct ScoreName { struct Username {
ScoreName* operator=(const ScoreName* p_other); Username();
MxResult ReadWrite(LegoStorage* p_stream);
Username* operator=(const Username* p_other);
MxS16 m_letters[7]; // 0x00 MxS16 m_letters[7]; // 0x00
}; };
@ -97,13 +99,14 @@ class LegoGameState {
// SIZE 0x2c // SIZE 0x2c
struct ScoreItem { struct ScoreItem {
undefined2 m_unk0x00; // 0x00 undefined2 m_unk0x00; // 0x00
MxU8 m_state[25]; // 0x02 MxU8 m_state[5][5]; // 0x02
ScoreName m_name; // 0x1c Username m_name; // 0x1c
undefined2 m_unk0x2a; // 0x2a undefined2 m_unk0x2a; // 0x2a
}; };
// SIZE 0x372 // SIZE 0x372
struct Scores { struct History {
History();
void WriteScoreHistory(); void WriteScoreHistory();
void FUN_1003ccf0(LegoFile&); void FUN_1003ccf0(LegoFile&);
@ -111,6 +114,7 @@ class LegoGameState {
MxS16 m_count; // 0x00 MxS16 m_count; // 0x00
ScoreItem m_scores[20]; // 0x02 ScoreItem m_scores[20]; // 0x02
undefined2 m_unk0x372; // 0x372
}; };
LegoGameState(); LegoGameState();
@ -129,25 +133,25 @@ class LegoGameState {
void StopArea(Area p_area); void StopArea(Area p_area);
void SwitchArea(Area p_area); void SwitchArea(Area p_area);
inline MxU8 GetUnknownC() { return m_unk0x0c; } inline MxU8 GetActorId() { return m_actorId; }
inline Act GetCurrentAct() { return m_currentAct; } inline Act GetCurrentAct() { return m_currentAct; }
inline Act GetLoadedAct() { return m_loadedAct; } inline Act GetLoadedAct() { return m_loadedAct; }
inline Area GetCurrentArea() { return m_currentArea; } inline Area GetCurrentArea() { return m_currentArea; }
inline Area GetPreviousArea() { return m_previousArea; } inline Area GetPreviousArea() { return m_previousArea; }
inline MxU32 GetUnknown0x41c() { return m_unk0x41c; } inline MxU32 GetUnknown0x41c() { return m_unk0x41c; }
inline Area GetUnknown0x42c() { return m_unk0x42c; } inline Area GetUnknown0x42c() { return m_unk0x42c; }
inline Scores* GetScores() { return &m_unk0xa6; } inline History* GetHistory() { return &m_history; }
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; } inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; }
inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; } inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; }
inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; } inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
inline void SetUnknown0x0c(MxU8 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }
inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; } inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; }
inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; } inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
void SetCurrentAct(Act p_currentAct); void SetCurrentAct(Act p_currentAct);
void FindLoadedAct(); void FindLoadedAct();
void FUN_10039780(MxU8); void SetVehicle(MxU8 p_actorId);
void FUN_10039940(); void FUN_10039940();
private: private:
@ -155,21 +159,23 @@ class LegoGameState {
MxResult WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName); MxResult WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName);
MxResult WriteEndOfVariables(LegoStorage* p_stream); MxResult WriteEndOfVariables(LegoStorage* p_stream);
MxS32 ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to); MxS32 ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to);
void SetColors();
void SetROIHandlerFunction(); void SetROIHandlerFunction();
char* m_savePath; // 0x00 char* m_savePath; // 0x00
MxS16 m_stateCount; // 0x04 MxS16 m_stateCount; // 0x04
LegoState** m_stateArray; // 0x08 LegoState** m_stateArray; // 0x08
MxU8 m_unk0x0c; // 0x0c MxU8 m_actorId; // 0x0c
Act m_currentAct; // 0x10 Act m_currentAct; // 0x10
Act m_loadedAct; // 0x14 Act m_loadedAct; // 0x14
LegoBackgroundColor* m_backgroundColor; // 0x18 LegoBackgroundColor* m_backgroundColor; // 0x18
LegoBackgroundColor* m_tempBackgroundColor; // 0x1c LegoBackgroundColor* m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie* m_fullScreenMovie; // 0x20 LegoFullScreenMovie* m_fullScreenMovie; // 0x20
MxU16 m_unk0x24; // 0x24 MxU16 m_unk0x24; // 0x24
undefined m_unk0x26[128]; // 0x26 undefined2 m_unk0x26; // 0x26
Scores m_unk0xa6; // 0xa6 Username m_players[9]; // 0x28
undefined4 m_unk0x418; // 0x418 History m_history; // 0xa6
undefined2 m_unk0x41a; // 0x41a
undefined4 m_unk0x41c; // 0x41c undefined4 m_unk0x41c; // 0x41c
MxBool m_isDirty; // 0x420 MxBool m_isDirty; // 0x420
Area m_currentArea; // 0x424 Area m_currentArea; // 0x424

View File

@ -228,6 +228,7 @@ class LegoOmni : public MxOmni {
LegoWorldList* GetWorldList() { return m_worldList; } LegoWorldList* GetWorldList() { return m_worldList; }
inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; }
inline void SetCurrentVehicle(IslePathActor* p_currentVehicle) { m_currentVehicle = p_currentVehicle; }
inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; }
@ -280,6 +281,7 @@ LegoTextureContainer* TextureContainer();
ViewLODListManager* GetViewLODListManager(); ViewLODListManager* GetViewLODListManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags); void FUN_10015820(MxBool p_disable, MxU16 p_flags);
void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c); void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c);
void SetCurrentVehicle(IslePathActor* p_currentVehicle);
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);
LegoROI* FindROI(const char* p_name); LegoROI* FindROI(const char* p_name);
MxDSAction& GetCurrentAction(); MxDSAction& GetCurrentAction();

View File

@ -65,13 +65,18 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002de0 // FUNCTION: LEGO1 0x10002de0
virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8 virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8
inline MxU32 GetUnknown88() { return m_unk0x88; }
inline void SetUnknown88(MxU32 p_unk0x88) { m_unk0x88 = p_unk0x88; }
inline void SetUnknownDC(MxU32 p_unk0xdc) { m_unk0xdc = p_unk0xdc; } inline void SetUnknownDC(MxU32 p_unk0xdc) { m_unk0xdc = p_unk0xdc; }
// SYNTHETIC: LEGO1 0x1002d800 // SYNTHETIC: LEGO1 0x1002d800
// LegoPathActor::`scalar deleting destructor' // LegoPathActor::`scalar deleting destructor'
protected: protected:
undefined m_unk0x78[0x64]; // 0x78 undefined m_unk0x78[0x10]; // 0x78
MxU32 m_unk0x88; // 0x88
undefined m_unk0x8c[0x50]; // 0x8c
MxU32 m_unk0xdc; // 0xdc MxU32 m_unk0xdc; // 0xdc
undefined m_unk0xe0[0xa]; // 0xe0 undefined m_unk0xe0[0xa]; // 0xe0
MxU8 m_unk0xea; // 0xea MxU8 m_unk0xea; // 0xea

View File

@ -56,7 +56,7 @@ class LegoUnkSaveDataWriter {
LegoUnkSaveDataWriter(); LegoUnkSaveDataWriter();
MxResult WriteSaveData3(LegoStorage* p_stream); MxResult WriteSaveData3(LegoStorage* p_stream);
LegoROI* FUN_10083500(char*, MxBool); LegoROI* FUN_10083500(const char*, MxBool);
static void InitSaveData(); static void InitSaveData();
static void SetCustomizeAnimFile(const char* p_value); static void SetCustomizeAnimFile(const char* p_value);

View File

@ -103,7 +103,7 @@ MxU32 Helicopter::VTable0xcc()
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
if (CurrentVehicle()) { if (CurrentVehicle()) {
if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { if (CurrentVehicle()->GetActorId() != GameState()->GetActorId()) {
CurrentVehicle()->VTable0xe4(); CurrentVehicle()->VTable0xe4();
} }
} }

View File

@ -8,6 +8,7 @@
#include "legonavcontroller.h" #include "legonavcontroller.h"
#include "legoomni.h" #include "legoomni.h"
#include "legostate.h" #include "legostate.h"
#include "legounksavedatawriter.h"
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworld.h" #include "legoworld.h"
@ -19,9 +20,9 @@
#include <stdio.h> #include <stdio.h>
DECOMP_SIZE_ASSERT(LegoGameState::ScoreName, 0xe) DECOMP_SIZE_ASSERT(LegoGameState::Username, 0xe)
DECOMP_SIZE_ASSERT(LegoGameState::ScoreItem, 0x2c) DECOMP_SIZE_ASSERT(LegoGameState::ScoreItem, 0x2c)
DECOMP_SIZE_ASSERT(LegoGameState::Scores, 0x372) DECOMP_SIZE_ASSERT(LegoGameState::History, 0x374)
DECOMP_SIZE_ASSERT(LegoGameState, 0x430) DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
// GLOBAL: LEGO1 0x100f3e40 // GLOBAL: LEGO1 0x100f3e40
@ -45,21 +46,28 @@ const char* g_endOfVariables = "END_OF_VARIABLES";
// GLOBAL: LEGO1 0x100f3e58 // GLOBAL: LEGO1 0x100f3e58
ColorStringStruct g_colorSaveData[43] = { ColorStringStruct g_colorSaveData[43] = {
{"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, {"c_chbasey0", "lego black"}, {"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, // dunebuggy back fender, dunebuggy back axle
{"c_chbacky0", "lego black"}, {"c_chdishy0", "lego white"}, {"c_chhorny0", "lego black"}, {"c_chbasey0", "lego black"}, {"c_chbacky0", "lego black"}, // copter base, copter back
{"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, {"c_chmidly0", "lego black"}, {"c_chdishy0", "lego white"}, {"c_chhorny0", "lego black"}, // copter dish, copter horn
{"c_chmotry0", "lego blue"}, {"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"}, {"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, // copter left jet, copter right jet
{"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, {"c_chwindy1", "lego black"}, {"c_chmidly0", "lego black"}, {"c_chmotry0", "lego blue"}, // copter middle, copter motor
{"c_dbfbrdy0", "lego red"}, {"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"}, {"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"}, // copter side left, copter side right
{"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, {"c_dbltbry0", "lego white"}, {"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, // copter ???, copter tail
{"c_jsdashy0", "lego white"}, {"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"}, {"c_chwindy1", "lego black"}, {"c_dbfbrdy0", "lego red"}, // copter ???, dunebuggy ???
{"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, {"c_jsrsidy0", "lego black"}, {"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"}, // dunebuggy flag, dunebuggy front fender
{"c_jsskiby0", "lego red"}, {"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"}, {"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, // dunebuggy front axle, dunebuggy handlebar
{"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, {"c_rcfrnty6", "lego green"}, {"c_dbltbry0", "lego white"}, {"c_jsdashy0", "lego white"}, // dunebuggy ???, jetski dash
{"c_rcmotry0", "lego white"}, {"c_rcsidey0", "lego green"}, {"c_rcstery0", "lego white"}, {"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"}, // jetski exhaust, jetski front
{"c_rcstrpy0", "lego yellow"}, {"c_rctailya", "lego white"}, {"c_rcwhl1y0", "lego white"}, {"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, // jetski handlebar, jetski left side
{"c_rcwhl2y0", "lego white"}, {"c_jsbasey0", "lego white"}, {"c_chblady0", "lego black"}, {"c_jsrsidy0", "lego black"}, {"c_jsskiby0", "lego red"}, // jetski right side, jetski ???
{"c_chseaty0", "lego white"}, {"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"}, // jetski windshield, racecar back
{"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, // racecar edge, racecar frame
{"c_rcfrnty6", "lego green"}, {"c_rcmotry0", "lego white"}, // racecar front, racecar motor
{"c_rcsidey0", "lego green"}, {"c_rcstery0", "lego white"}, // racecar side, racecar steering wheel
{"c_rcstrpy0", "lego yellow"}, {"c_rctailya", "lego white"}, // racecar stripe, racecar tail
{"c_rcwhl1y0", "lego white"}, {"c_rcwhl2y0", "lego white"}, // racecar wheels 1, racecar wheels 2
{"c_jsbasey0", "lego white"}, {"c_chblady0", "lego black"}, // jetski base, copter blades
{"c_chseaty0", "lego white"}, // copter seat
}; };
// NOTE: This offset = the end of the variables table, the last entry // NOTE: This offset = the end of the variables table, the last entry
@ -69,17 +77,21 @@ extern const char* g_endOfVariables;
// FUNCTION: LEGO1 0x10039550 // FUNCTION: LEGO1 0x10039550
LegoGameState::LegoGameState() LegoGameState::LegoGameState()
{ {
// TODO SetColors();
SetROIHandlerFunction(); SetROIHandlerFunction();
this->m_stateCount = 0; m_stateCount = 0;
this->m_unk0x0c = 0; m_actorId = 0;
this->m_savePath = NULL; m_savePath = NULL;
this->m_currentArea = e_noArea; m_stateArray = NULL;
this->m_previousArea = e_noArea; m_unk0x41c = -1;
this->m_unk0x42c = e_noArea; m_unk0x26 = 0;
this->m_isDirty = FALSE; m_currentArea = e_noArea;
this->m_loadedAct = e_actNotFound; m_previousArea = e_noArea;
m_unk0x42c = e_noArea;
m_isDirty = FALSE;
m_loadedAct = e_actNotFound;
SetCurrentAct(e_act1);
m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68"); m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68");
VariableTable()->SetVariable(m_backgroundColor); VariableTable()->SetVariable(m_backgroundColor);
@ -113,10 +125,29 @@ LegoGameState::~LegoGameState()
delete[] m_savePath; delete[] m_savePath;
} }
// STUB: LEGO1 0x10039780 // FUNCTION: LEGO1 0x10039780
void LegoGameState::FUN_10039780(MxU8) void LegoGameState::SetVehicle(MxU8 p_actorId)
{ {
// TODO if (p_actorId) {
m_actorId = p_actorId;
}
IslePathActor* oldVehicle = CurrentVehicle();
SetCurrentVehicle(NULL);
IslePathActor* newVehicle = new IslePathActor();
LegoROI* roi = UnkSaveDataWriter()->FUN_10083500(LegoActor::GetActorName(m_actorId), FALSE);
MxDSAction action;
action.SetAtomId(*g_isleScript);
action.SetObjectId(100000);
newVehicle->Create(action);
newVehicle->SetActorId(p_actorId);
newVehicle->SetROI(roi, FALSE, FALSE);
if (oldVehicle) {
newVehicle->GetROI()->FUN_100a58f0(oldVehicle->GetROI()->GetLocal2World());
newVehicle->SetUnknown88(oldVehicle->GetUnknown88());
delete oldVehicle;
}
newVehicle->ClearFlag(0x2);
SetCurrentVehicle(newVehicle);
} }
// STUB: LEGO1 0x10039940 // STUB: LEGO1 0x10039940
@ -145,7 +176,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
fileStream.Write(&maybeVersion, 4); fileStream.Write(&maybeVersion, 4);
fileStream.Write(&m_unk0x24, 2); fileStream.Write(&m_unk0x24, 2);
fileStream.Write(&m_currentAct, 2); fileStream.Write(&m_currentAct, 2);
fileStream.Write(&m_unk0x0c, 1); fileStream.Write(&m_actorId, 1);
for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) { for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) {
if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) { if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) {
@ -649,6 +680,15 @@ void LegoGameState::SwitchArea(Area p_area)
} }
} }
// FUNCTION: LEGO1 0x1003ba90
void LegoGameState::SetColors()
{
MxVariableTable* variables = VariableTable();
for (int i = 0; i < _countof(g_colorSaveData); i++) {
variables->SetVariable(g_colorSaveData[i].m_targetName, g_colorSaveData[i].m_colorName);
}
}
// FUNCTION: LEGO1 0x1003bac0 // FUNCTION: LEGO1 0x1003bac0
void LegoGameState::SetROIHandlerFunction() void LegoGameState::SetROIHandlerFunction()
{ {
@ -725,21 +765,50 @@ void LegoGameState::RegisterState(LegoState* p_state)
m_stateArray[targetIndex] = p_state; m_stateArray[targetIndex] = p_state;
} }
// FUNCTION: LEGO1 0x1003c670
LegoGameState::Username::Username()
{
memset(m_letters, 0, sizeof(m_letters));
}
// FUNCTION: LEGO1 0x1003c690
MxResult LegoGameState::Username::ReadWrite(LegoStorage* p_stream)
{
if (p_stream->IsReadMode()) {
for (MxS16 i = 0; i < 7; i++) {
p_stream->Read(&m_letters[i], 2);
}
}
else if (p_stream->IsWriteMode()) {
for (MxS16 i = 0; i < 7; i++) {
p_stream->Write(&m_letters[i], 2);
}
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x1003c710 // FUNCTION: LEGO1 0x1003c710
LegoGameState::ScoreName* LegoGameState::ScoreName::operator=(const ScoreName* p_other) LegoGameState::Username* LegoGameState::Username::operator=(const Username* p_other)
{ {
memcpy(m_letters, p_other->m_letters, sizeof(m_letters)); memcpy(m_letters, p_other->m_letters, sizeof(m_letters));
return this; return this;
} }
// FUNCTION: LEGO1 0x1003c830
LegoGameState::History::History()
{
m_count = 0;
m_unk0x372 = 0;
}
// STUB: LEGO1 0x1003c870 // STUB: LEGO1 0x1003c870
void LegoGameState::Scores::WriteScoreHistory() void LegoGameState::History::WriteScoreHistory()
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x1003ccf0 // STUB: LEGO1 0x1003ccf0
void LegoGameState::Scores::FUN_1003ccf0(LegoFile&) void LegoGameState::History::FUN_1003ccf0(LegoFile&)
{ {
// TODO // TODO
} }
@ -753,11 +822,11 @@ void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
savePath += g_historyGSI; savePath += g_historyGSI;
if (p_flags == LegoFile::c_write) { if (p_flags == LegoFile::c_write) {
m_unk0xa6.WriteScoreHistory(); m_history.WriteScoreHistory();
} }
if (stream.Open(savePath.GetData(), p_flags) == SUCCESS) { if (stream.Open(savePath.GetData(), p_flags) == SUCCESS) {
m_unk0xa6.FUN_1003ccf0(stream); m_history.FUN_1003ccf0(stream);
} }
} }

View File

@ -90,7 +90,7 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream)
} }
// STUB: LEGO1 0x10083500 // STUB: LEGO1 0x10083500
LegoROI* LegoUnkSaveDataWriter::FUN_10083500(char* p_key, MxBool p_option) LegoROI* LegoUnkSaveDataWriter::FUN_10083500(const char* p_key, MxBool p_option)
{ {
// TODO // TODO
// involves an STL map with a _Nil node at 0x100fc508 // involves an STL map with a _Nil node at 0x100fc508

View File

@ -3,7 +3,7 @@
DECOMP_SIZE_ASSERT(LegoActor, 0x78) DECOMP_SIZE_ASSERT(LegoActor, 0x78)
// GLOBAL: LEGO1 0x100f32d0 // GLOBAL: LEGO1 0x100f32d0
const char* g_unk0x100f32d0[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"}; const char* g_actorNames[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"};
// FUNCTION: LEGO1 0x1002d110 // FUNCTION: LEGO1 0x1002d110
LegoActor::LegoActor() LegoActor::LegoActor()
@ -12,7 +12,7 @@ LegoActor::LegoActor()
m_sound = NULL; m_sound = NULL;
m_unk0x70 = 0.0f; m_unk0x70 = 0.0f;
m_unk0x10 = 0; m_unk0x10 = 0;
m_unk0x74 = 0; m_actorId = 0;
} }
// FUNCTION: LEGO1 0x1002d320 // FUNCTION: LEGO1 0x1002d320
@ -29,16 +29,22 @@ void LegoActor::ParseAction(char*)
// TODO // TODO
} }
// FUNCTION: LEGO1 0x1002d660
const char* LegoActor::GetActorName(MxU8 p_id)
{
return g_actorNames[p_id];
}
// FUNCTION: LEGO1 0x1002d670 // FUNCTION: LEGO1 0x1002d670
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{ {
if (p_roi) { if (p_roi) {
const char* name = p_roi->GetName(); const char* name = p_roi->GetName();
for (MxU32 i = 1; i <= _countof(g_unk0x100f32d0) - 1; i++) { for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) {
if (!strcmpi(name, g_unk0x100f32d0[i])) { if (!strcmpi(name, g_actorNames[i])) {
m_unk0x59 = 0; m_unk0x59 = 0;
m_unk0x74 = i; m_actorId = i;
break; break;
} }
} }

View File

@ -201,7 +201,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
if (!m_unk0x1d4) { if (!m_unk0x1d4) {
PlayMusic(JukeBox::e_informationCenter); PlayMusic(JukeBox::e_informationCenter);
GameState()->FUN_10039780(m_selectedCharacter); GameState()->SetVehicle(m_selectedCharacter);
switch (m_selectedCharacter) { switch (m_selectedCharacter) {
case e_pepper: case e_pepper:
@ -303,7 +303,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
case 5: case 5:
if (action->GetObjectId() == m_currentInfomainScript) { if (action->GetObjectId() == m_currentInfomainScript) {
if (GameState()->GetCurrentAct() != LegoGameState::e_act3 && m_selectedCharacter != e_noCharacter) { if (GameState()->GetCurrentAct() != LegoGameState::e_act3 && m_selectedCharacter != e_noCharacter) {
GameState()->FUN_10039780(m_selectedCharacter); GameState()->SetVehicle(m_selectedCharacter);
} }
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_infocenterState->SetUnknown0x74(14); m_infocenterState->SetUnknown0x74(14);
@ -734,7 +734,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
switch (m_mapAreas[m_unk0x1c8].m_unk0x04) { switch (m_mapAreas[m_unk0x1c8].m_unk0x04) {
case 3: case 3:
GameState()->FUN_10039780(m_selectedCharacter); GameState()->SetVehicle(m_selectedCharacter);
switch (m_selectedCharacter) { switch (m_selectedCharacter) {
case e_pepper: case e_pepper:
@ -810,23 +810,23 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
switch (m_selectedCharacter) { switch (m_selectedCharacter) {
case e_pepper: case e_pepper:
dialogueToPlay = c_pepperCharacterSelect; dialogueToPlay = c_pepperCharacterSelect;
GameState()->SetUnknown0x0c(m_selectedCharacter); GameState()->SetActorId(m_selectedCharacter);
break; break;
case e_mama: case e_mama:
dialogueToPlay = c_mamaCharacterSelect; dialogueToPlay = c_mamaCharacterSelect;
GameState()->SetUnknown0x0c(m_selectedCharacter); GameState()->SetActorId(m_selectedCharacter);
break; break;
case e_papa: case e_papa:
dialogueToPlay = c_papaCharacterSelect; dialogueToPlay = c_papaCharacterSelect;
GameState()->SetUnknown0x0c(m_selectedCharacter); GameState()->SetActorId(m_selectedCharacter);
break; break;
case e_nick: case e_nick:
dialogueToPlay = c_nickCharacterSelect; dialogueToPlay = c_nickCharacterSelect;
GameState()->SetUnknown0x0c(m_selectedCharacter); GameState()->SetActorId(m_selectedCharacter);
break; break;
case e_laura: case e_laura:
dialogueToPlay = c_lauraCharacterSelect; dialogueToPlay = c_lauraCharacterSelect;
GameState()->SetUnknown0x0c(m_selectedCharacter); GameState()->SetActorId(m_selectedCharacter);
break; break;
default: default:
dialogueToPlay = dialogueToPlay =
@ -948,7 +948,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
InputManager()->SetUnknown336(TRUE); InputManager()->SetUnknown336(TRUE);
break; break;
case LegoGameState::e_unk4: case LegoGameState::e_unk4:
if (state->GetUnknownC()) { if (state->GetActorId()) {
if (m_infocenterState->HasRegistered()) { if (m_infocenterState->HasRegistered()) {
m_infocenterState->SetUnknown0x74(5); m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = state->GetPreviousArea(); m_transitionDestination = state->GetPreviousArea();
@ -1228,7 +1228,7 @@ void Infocenter::UpdateFrameHot(MxBool p_display)
if (p_display) { if (p_display) {
MxS32 x, y; MxS32 x, y;
switch (GameState()->GetUnknownC()) { switch (GameState()->GetActorId()) {
case 1: case 1:
x = 302; x = 302;
y = 81; y = 81;
@ -1292,7 +1292,7 @@ void Infocenter::Reset()
InitializeBitmaps(); InitializeBitmaps();
m_selectedCharacter = e_pepper; m_selectedCharacter = e_pepper;
GameState()->FUN_10039780(e_pepper); GameState()->SetVehicle(e_pepper);
HelicopterState* state = (HelicopterState*) GameState()->GetState("HelicopterState"); HelicopterState* state = (HelicopterState*) GameState()->GetState("HelicopterState");

View File

@ -109,7 +109,7 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
result = 1; result = 1;
break; break;
case 4: case 4:
if (GameState()->GetUnknownC()) { if (GameState()->GetActorId()) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->HasRegistered()) { if (state->HasRegistered()) {
m_unk0xf8 = LegoGameState::e_unk4; m_unk0xf8 = LegoGameState::e_unk4;

View File

@ -80,7 +80,7 @@ inline void SetColor(MxStillPresenter* p_presenter, MxU8 p_color, MxU8* p_colors
void HistoryBook::ReadyWorld() void HistoryBook::ReadyWorld()
{ {
LegoWorld::ReadyWorld(); LegoWorld::ReadyWorld();
GameState()->GetScores()->WriteScoreHistory(); GameState()->GetHistory()->WriteScoreHistory();
char bitmap[] = "A_Bitmap"; char bitmap[] = "A_Bitmap";
for (MxS16 i = 0; i < 26; i++) { for (MxS16 i = 0; i < 26; i++) {
@ -93,8 +93,8 @@ void HistoryBook::ReadyWorld()
{0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B {0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B
MxS32 scoreY = 0x79; MxS32 scoreY = 0x79;
for (MxS16 scoreIndex = 0; scoreIndex < GameState()->GetScores()->m_count; scoreIndex++) { for (MxS16 scoreIndex = 0; scoreIndex < GameState()->GetHistory()->m_count; scoreIndex++) {
LegoGameState::ScoreItem* score = GameState()->GetScores()->GetScore(scoreIndex); LegoGameState::ScoreItem* score = GameState()->GetHistory()->GetScore(scoreIndex);
MxStillPresenter** scorebox = &m_scores[scoreIndex]; MxStillPresenter** scorebox = &m_scores[scoreIndex];
*scorebox = scoreboxMaster->Clone(); *scorebox = scoreboxMaster->Clone();
@ -110,14 +110,14 @@ void HistoryBook::ReadyWorld()
MxS32 scoreboxX = 1; MxS32 scoreboxX = 1;
MxS32 scoreboxRow = 5; MxS32 scoreboxRow = 5;
MxU8* scoreState = score->m_state; MxS32 scoreState = 0;
for (; scoreboxRow > 0; scoreboxRow--) { for (; scoreboxRow > 0; scoreboxRow--) {
for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) { for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) {
SetColor(*scorebox, scoreState[scoreBoxColumn], scoreColors, scoreboxX, scoreboxY); SetColor(*scorebox, score->m_state[scoreState][scoreBoxColumn], scoreColors, scoreboxX, scoreboxY);
} }
scoreState += 5; scoreState++;
scoreboxX += 5; scoreboxX += 5;
} }

View File

@ -29,7 +29,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
return 1; return 1;
} }
if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { if (CurrentVehicle()->GetActorId() != GameState()->GetActorId()) {
CurrentVehicle()->VTable0xe4(); CurrentVehicle()->VTable0xe4();
} }

View File

@ -248,6 +248,12 @@ void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c)
} }
} }
// FUNCTION: LEGO1 0x10015880
void SetCurrentVehicle(IslePathActor* p_currentVehicle)
{
LegoOmni::GetInstance()->SetCurrentVehicle(p_currentVehicle);
}
// FUNCTION: LEGO1 0x100158c0 // FUNCTION: LEGO1 0x100158c0
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
{ {

View File

@ -44,7 +44,7 @@ void PoliceState::FUN_1005ea40()
return; return;
} }
switch (CurrentVehicle()->VTable0x60()) { switch (CurrentVehicle()->GetActorId()) {
case 4: case 4:
policeScript = Police::PoliceScript::c_lauraAnim; policeScript = Police::PoliceScript::c_lauraAnim;
m_policeScript = policeScript; m_policeScript = policeScript;

View File

@ -50,7 +50,7 @@ void LegoROI::FUN_100a46b0(Matrix4& p_transform)
} }
// STUB: LEGO1 0x100a58f0 // STUB: LEGO1 0x100a58f0
void LegoROI::FUN_100a58f0(Matrix4& p_transform) void LegoROI::FUN_100a58f0(const Matrix4& p_transform)
{ {
} }

View File

@ -46,7 +46,7 @@ class LegoROI : public ViewROI {
void WrappedSetLocalTransform(Matrix4& p_transform); void WrappedSetLocalTransform(Matrix4& p_transform);
void FUN_100a46b0(Matrix4& p_transform); void FUN_100a46b0(Matrix4& p_transform);
void FUN_100a58f0(Matrix4& p_transform); void FUN_100a58f0(const Matrix4& p_transform);
inline const char* GetName() const { return m_name; } inline const char* GetName() const { return m_name; }
inline LegoEntity* GetUnknown0x104() { return m_unk0x104; } inline LegoEntity* GetUnknown0x104() { return m_unk0x104; }