mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-27 01:45:37 -05:00
some gamestate functions (#333)
* some gamestate functions * fix order * fix naming convention * Update legogamestate.cpp * fix * Add stub ScoreStruct --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
540a930494
commit
04d9524a90
4 changed files with 70 additions and 7 deletions
|
@ -13,6 +13,12 @@
|
||||||
// There may be other members that come after.
|
// There may be other members that come after.
|
||||||
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
|
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f3e24
|
||||||
|
const char* g_historyGSI = "History.gsi";
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f3e30
|
||||||
|
const char* g_playersGSI = "Players.gsi";
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f3e40
|
// GLOBAL: LEGO1 0x100f3e40
|
||||||
const char* g_fileExtensionGS = ".GS";
|
const char* g_fileExtensionGS = ".GS";
|
||||||
|
|
||||||
|
@ -255,14 +261,54 @@ void LegoGameState::RegisterState(LegoState* p_state)
|
||||||
m_stateArray[targetIndex] = p_state;
|
m_stateArray[targetIndex] = p_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1003cdd0
|
// STUB: LEGO1 0x1003c870
|
||||||
void LegoGameState::SerializeScoreHistory(MxS16)
|
void LegoGameState::ScoreStruct::WriteScoreHistory()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// STUB: LEGO1 0x1003ccf0
|
||||||
|
void LegoGameState::ScoreStruct::FUN_1003ccf0(LegoFileStream&)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1003cdd0
|
||||||
|
void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
|
||||||
|
{
|
||||||
|
LegoFileStream stream;
|
||||||
|
MxString savePath(m_savePath);
|
||||||
|
savePath += "\\";
|
||||||
|
savePath += g_historyGSI;
|
||||||
|
|
||||||
|
if (p_flags == LegoStream::WriteBit) {
|
||||||
|
m_unk0xa6.WriteScoreHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream.Open(savePath.GetData(), (LegoStream::OpenFlags) p_flags) == SUCCESS) {
|
||||||
|
m_unk0xa6.FUN_1003ccf0(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1003cea0
|
// FUNCTION: LEGO1 0x1003cea0
|
||||||
void LegoGameState::SetSomeEnumState(undefined4 p_state)
|
void LegoGameState::SetSomeEnumState(undefined4 p_state)
|
||||||
{
|
{
|
||||||
m_unk0x10 = p_state;
|
m_unk0x10 = p_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1003ceb0
|
||||||
|
void LegoGameState::FUN_1003ceb0()
|
||||||
|
{
|
||||||
|
if (FindEntityByAtomIdOrEntityId(*g_isleScript, 0)) {
|
||||||
|
m_currentAct = 0;
|
||||||
|
}
|
||||||
|
else if (FindEntityByAtomIdOrEntityId(*g_act2mainScript, 0)) {
|
||||||
|
m_currentAct = 1;
|
||||||
|
}
|
||||||
|
else if (FindEntityByAtomIdOrEntityId(*g_act3Script, 0)) {
|
||||||
|
m_currentAct = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_currentAct = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "legobackgroundcolor.h"
|
#include "legobackgroundcolor.h"
|
||||||
#include "legofullscreenmovie.h"
|
#include "legofullscreenmovie.h"
|
||||||
|
#include "legostream.h"
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
|
||||||
class LegoState;
|
class LegoState;
|
||||||
class LegoStream;
|
|
||||||
class MxVariable;
|
class MxVariable;
|
||||||
class MxString;
|
class MxString;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class LegoGameState {
|
||||||
__declspec(dllexport) MxResult Load(MxULong);
|
__declspec(dllexport) MxResult Load(MxULong);
|
||||||
__declspec(dllexport) MxResult Save(MxULong);
|
__declspec(dllexport) MxResult Save(MxULong);
|
||||||
__declspec(dllexport) void SerializePlayersInfo(MxS16);
|
__declspec(dllexport) void SerializePlayersInfo(MxS16);
|
||||||
__declspec(dllexport) void SerializeScoreHistory(MxS16);
|
__declspec(dllexport) void SerializeScoreHistory(MxS16 p_flags);
|
||||||
__declspec(dllexport) void SetSavePath(char*);
|
__declspec(dllexport) void SetSavePath(char*);
|
||||||
|
|
||||||
LegoState* GetState(COMPAT_CONST char* p_stateName);
|
LegoState* GetState(COMPAT_CONST char* p_stateName);
|
||||||
|
@ -39,24 +39,34 @@ class LegoGameState {
|
||||||
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; }
|
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; }
|
||||||
|
|
||||||
void SetSomeEnumState(undefined4 p_state);
|
void SetSomeEnumState(undefined4 p_state);
|
||||||
|
void FUN_1003ceb0();
|
||||||
|
|
||||||
|
struct ScoreStruct {
|
||||||
|
void WriteScoreHistory();
|
||||||
|
void FUN_1003ccf0(LegoFileStream&);
|
||||||
|
|
||||||
|
MxU16 m_unk0x00;
|
||||||
|
undefined m_unk0x02[0x2c][20];
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RegisterState(LegoState* p_state);
|
void RegisterState(LegoState* p_state);
|
||||||
MxResult WriteEndOfVariables(LegoStream* p_stream);
|
MxResult WriteEndOfVariables(LegoStream* p_stream);
|
||||||
void SetROIHandlerFunction();
|
void SetROIHandlerFunction();
|
||||||
|
|
||||||
private:
|
|
||||||
char* m_savePath; // 0x0
|
char* m_savePath; // 0x0
|
||||||
MxS16 m_stateCount; // 0x4
|
MxS16 m_stateCount; // 0x4
|
||||||
LegoState** m_stateArray; // 0x8
|
LegoState** m_stateArray; // 0x8
|
||||||
MxU8 m_unk0xc; // 0xc
|
MxU8 m_unk0xc; // 0xc
|
||||||
MxU32 m_unk0x10; // 0x10
|
MxU32 m_unk0x10; // 0x10
|
||||||
undefined4 m_unk0x14; // 0x14
|
undefined4 m_currentAct; // 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_unk0x28[1020]; // 0x28
|
undefined m_unk0x28[128]; // 0x28
|
||||||
|
ScoreStruct m_unk0xa6; // 0xa6
|
||||||
|
undefined m_unk0x41a[10]; // 0x41a - might be part of the structure at 0xa6
|
||||||
undefined4 m_unk0x424; // 0x424
|
undefined4 m_unk0x424; // 0x424
|
||||||
undefined4 m_unk0x428; // 0x428
|
undefined4 m_unk0x428; // 0x428
|
||||||
undefined4 m_unk0x42c; // 0x42c
|
undefined4 m_unk0x42c; // 0x42c
|
||||||
|
|
|
@ -194,6 +194,12 @@ GifManager* GetGifManager()
|
||||||
return LegoOmni::GetInstance()->GetGifManager();
|
return LegoOmni::GetInstance()->GetGifManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100158c0
|
||||||
|
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid)
|
||||||
|
{
|
||||||
|
return LegoOmni::GetInstance()->FindByEntityIdOrAtomId(p_atom, p_entityid);
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100158e0
|
// FUNCTION: LEGO1 0x100158e0
|
||||||
MxDSAction& GetCurrentAction()
|
MxDSAction& GetCurrentAction()
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,6 +158,7 @@ LegoPlantManager* PlantManager();
|
||||||
MxBool KeyValueStringParse(char*, const char*, const char*);
|
MxBool KeyValueStringParse(char*, const char*, const char*);
|
||||||
LegoWorld* GetCurrentWorld();
|
LegoWorld* GetCurrentWorld();
|
||||||
GifManager* GetGifManager();
|
GifManager* GetGifManager();
|
||||||
|
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
|
||||||
MxDSAction& GetCurrentAction();
|
MxDSAction& GetCurrentAction();
|
||||||
|
|
||||||
void RegisterScripts();
|
void RegisterScripts();
|
||||||
|
|
Loading…
Reference in a new issue