2023-04-27 22:19:39 -04:00
|
|
|
#ifndef LEGOGAMESTATE_H
|
|
|
|
#define LEGOGAMESTATE_H
|
|
|
|
|
2023-09-29 16:38:08 -04:00
|
|
|
#include "decomp.h"
|
2024-01-24 12:12:57 -05:00
|
|
|
#include "lego/sources/misc/legostorage.h"
|
2023-09-29 16:38:08 -04:00
|
|
|
#include "legobackgroundcolor.h"
|
|
|
|
#include "legofullscreenmovie.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "mxtypes.h"
|
2024-01-24 12:12:57 -05:00
|
|
|
#include "mxvariabletable.h"
|
2023-07-02 04:05:49 -04:00
|
|
|
|
2023-10-12 12:18:24 -04:00
|
|
|
class LegoState;
|
|
|
|
class MxVariable;
|
|
|
|
class MxString;
|
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
struct ColorStringStruct {
|
|
|
|
const char* m_targetName;
|
|
|
|
const char* m_colorName;
|
2023-10-12 12:18:24 -04:00
|
|
|
};
|
|
|
|
|
2023-12-14 11:50:29 -05:00
|
|
|
// SIZE 0x430
|
2023-10-24 19:38:27 -04:00
|
|
|
class LegoGameState {
|
2023-04-27 22:19:39 -04:00
|
|
|
public:
|
2024-02-10 11:37:22 -05:00
|
|
|
enum Act {
|
|
|
|
e_actNotFound = -1,
|
2024-02-10 13:17:07 -05:00
|
|
|
e_act1,
|
|
|
|
e_act2,
|
|
|
|
e_act3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Area {
|
|
|
|
e_noArea = 0,
|
|
|
|
e_previousArea = 0,
|
|
|
|
e_isle,
|
|
|
|
e_infomain,
|
|
|
|
e_infodoor,
|
|
|
|
e_unk4,
|
|
|
|
e_elevbott,
|
|
|
|
e_unk6,
|
|
|
|
e_unk7,
|
|
|
|
e_unk8,
|
|
|
|
e_unk9,
|
|
|
|
e_unk10,
|
|
|
|
e_unk11,
|
|
|
|
e_regbook,
|
|
|
|
e_infoscor,
|
|
|
|
e_jetrace,
|
|
|
|
e_unk15,
|
|
|
|
e_unk16,
|
|
|
|
e_unk17,
|
|
|
|
e_carrace,
|
|
|
|
e_unk19,
|
|
|
|
e_unk20,
|
|
|
|
e_unk21,
|
|
|
|
e_unk22,
|
|
|
|
|
|
|
|
e_unk25 = 25,
|
|
|
|
e_garage,
|
|
|
|
e_unk27,
|
|
|
|
|
|
|
|
e_unk29 = 29,
|
|
|
|
e_hospital,
|
|
|
|
e_unk31,
|
|
|
|
e_unk32,
|
|
|
|
|
|
|
|
e_police = 34,
|
|
|
|
e_unk35,
|
|
|
|
e_copter,
|
|
|
|
e_dunecar,
|
|
|
|
e_jetski,
|
|
|
|
e_racecar,
|
|
|
|
|
|
|
|
e_act2main = 46,
|
|
|
|
e_act3script,
|
|
|
|
|
|
|
|
e_jukeboxw = 53,
|
|
|
|
|
|
|
|
e_histbook = 56,
|
|
|
|
e_unk57,
|
|
|
|
e_unk58,
|
|
|
|
e_unk59,
|
|
|
|
e_unk60,
|
|
|
|
e_unk61,
|
|
|
|
|
|
|
|
e_unk64 = 64,
|
|
|
|
|
|
|
|
e_unk66 = 66
|
2024-02-10 11:37:22 -05:00
|
|
|
};
|
|
|
|
|
2024-02-19 09:24:30 -05:00
|
|
|
// SIZE 0x0c
|
|
|
|
struct ScoreName {
|
|
|
|
ScoreName* operator=(const ScoreName* p_other);
|
|
|
|
|
|
|
|
MxS16 m_letters[7]; // 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x2c
|
|
|
|
struct ScoreItem {
|
|
|
|
undefined2 m_unk0x00; // 0x00
|
|
|
|
MxU8 m_state[25]; // 0x02
|
|
|
|
ScoreName m_name; // 0x1c
|
|
|
|
undefined2 m_unk0x2a; // 0x2a
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x372
|
|
|
|
struct Scores {
|
|
|
|
void WriteScoreHistory();
|
|
|
|
void FUN_1003ccf0(LegoFile&);
|
|
|
|
|
|
|
|
inline ScoreItem* GetScore(MxS16 p_index) { return p_index >= m_count ? NULL : &m_scores[p_index]; }
|
|
|
|
|
|
|
|
MxS16 m_count; // 0x00
|
|
|
|
ScoreItem m_scores[20]; // 0x02
|
|
|
|
};
|
|
|
|
|
2024-01-24 21:16:29 -05:00
|
|
|
LegoGameState();
|
|
|
|
~LegoGameState();
|
2024-02-10 11:37:22 -05:00
|
|
|
|
2024-01-24 21:16:29 -05:00
|
|
|
MxResult Load(MxULong);
|
|
|
|
MxResult Save(MxULong);
|
|
|
|
void SerializePlayersInfo(MxS16);
|
|
|
|
void SerializeScoreHistory(MxS16 p_flags);
|
|
|
|
void SetSavePath(char*);
|
2023-07-03 13:25:37 -04:00
|
|
|
|
2024-01-06 12:56:15 -05:00
|
|
|
LegoState* GetState(const char* p_stateName);
|
|
|
|
LegoState* CreateState(const char* p_stateName);
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
void GetFileSavePath(MxString* p_outPath, MxULong p_slotn);
|
2024-02-10 13:17:07 -05:00
|
|
|
void StopArea(Area p_area);
|
|
|
|
void SwitchArea(Area p_area);
|
2023-10-23 07:16:21 -04:00
|
|
|
|
2024-01-29 16:17:17 -05:00
|
|
|
inline MxU8 GetUnknownC() { return m_unk0x0c; }
|
2024-02-10 11:37:22 -05:00
|
|
|
inline Act GetCurrentAct() { return m_currentAct; }
|
|
|
|
inline Act GetLoadedAct() { return m_loadedAct; }
|
2024-02-10 13:17:07 -05:00
|
|
|
inline Area GetCurrentArea() { return m_currentArea; }
|
|
|
|
inline Area GetPreviousArea() { return m_previousArea; }
|
2024-02-14 11:48:39 -05:00
|
|
|
inline MxU32 GetUnknown0x41c() { return m_unk0x41c; }
|
2024-02-10 13:17:07 -05:00
|
|
|
inline Area GetUnknown0x42c() { return m_unk0x42c; }
|
2024-02-19 09:24:30 -05:00
|
|
|
inline Scores* GetScores() { return &m_unk0xa6; }
|
2024-01-31 07:34:36 -05:00
|
|
|
|
2023-12-15 18:11:34 -05:00
|
|
|
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; }
|
2024-02-10 13:17:07 -05:00
|
|
|
inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; }
|
|
|
|
inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
|
2024-02-02 16:32:50 -05:00
|
|
|
inline void SetUnknown0x0c(MxU8 p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
|
2024-02-14 11:48:39 -05:00
|
|
|
inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; }
|
2024-02-10 13:17:07 -05:00
|
|
|
inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-02-10 11:37:22 -05:00
|
|
|
void SetCurrentAct(Act p_currentAct);
|
|
|
|
void FindLoadedAct();
|
2024-01-17 11:53:53 -05:00
|
|
|
void FUN_10039780(MxU8);
|
2024-02-02 12:18:46 -05:00
|
|
|
void FUN_10039940();
|
2023-12-15 17:01:09 -05:00
|
|
|
|
2023-10-12 12:18:24 -04:00
|
|
|
private:
|
2023-10-24 19:38:27 -04:00
|
|
|
void RegisterState(LegoState* p_state);
|
2024-01-24 12:12:57 -05:00
|
|
|
MxResult WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName);
|
|
|
|
MxResult WriteEndOfVariables(LegoStorage* p_stream);
|
|
|
|
MxS32 ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to);
|
2023-11-01 11:12:03 -04:00
|
|
|
void SetROIHandlerFunction();
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-01-29 16:17:17 -05:00
|
|
|
char* m_savePath; // 0x00
|
|
|
|
MxS16 m_stateCount; // 0x04
|
|
|
|
LegoState** m_stateArray; // 0x08
|
|
|
|
MxU8 m_unk0x0c; // 0x0c
|
2024-02-10 11:37:22 -05:00
|
|
|
Act m_currentAct; // 0x10
|
|
|
|
Act m_loadedAct; // 0x14
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoBackgroundColor* m_backgroundColor; // 0x18
|
|
|
|
LegoBackgroundColor* m_tempBackgroundColor; // 0x1c
|
|
|
|
LegoFullScreenMovie* m_fullScreenMovie; // 0x20
|
2023-12-13 05:48:14 -05:00
|
|
|
MxU16 m_unk0x24; // 0x24
|
2024-02-19 09:24:30 -05:00
|
|
|
undefined m_unk0x26[128]; // 0x26
|
|
|
|
Scores m_unk0xa6; // 0xa6
|
|
|
|
undefined4 m_unk0x418; // 0x418
|
2024-02-14 11:48:39 -05:00
|
|
|
undefined4 m_unk0x41c; // 0x41c
|
2023-12-15 18:11:34 -05:00
|
|
|
MxBool m_isDirty; // 0x420
|
2024-02-10 13:17:07 -05:00
|
|
|
Area m_currentArea; // 0x424
|
|
|
|
Area m_previousArea; // 0x428
|
|
|
|
Area m_unk0x42c; // 0x42c
|
2023-04-27 22:19:39 -04:00
|
|
|
};
|
|
|
|
|
2023-12-13 05:48:14 -05:00
|
|
|
MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen);
|
2023-11-01 11:12:03 -04:00
|
|
|
|
2023-04-27 22:19:39 -04:00
|
|
|
#endif // LEGOGAMESTATE_H
|