Merge remote-tracking branch 'isle/master'

This commit is contained in:
Christian Semmler 2025-06-15 09:00:56 -07:00
commit e6a005fd33
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
5 changed files with 134 additions and 114 deletions

View File

@ -16,6 +16,19 @@ class MxStillPresenter;
// SIZE 0x24 // SIZE 0x24
class GasStationState : public LegoState { class GasStationState : public LegoState {
public: public:
enum {
e_unknown0 = 0,
e_newState = 1,
e_beforeExitingForQuest = 2,
e_unknown3 = 3,
e_unknown4 = 4,
e_introduction = 5,
e_explainQuest = 6,
e_waitAcceptingQuest = 7,
e_afterAcceptingQuest = 8,
e_cancelQuest = 9,
};
GasStationState(); GasStationState();
// FUNCTION: LEGO1 0x100061d0 // FUNCTION: LEGO1 0x100061d0
@ -44,7 +57,7 @@ public:
// TODO: Most likely getters/setters are not used according to BETA. // TODO: Most likely getters/setters are not used according to BETA.
GarageScript::Script m_actions[3]; // 0x08 GarageScript::Script m_actions[3]; // 0x08
undefined4 m_unk0x14; // 0x14 MxS32 m_state; // 0x14
MxS16 m_pepperAction; // 0x18 MxS16 m_pepperAction; // 0x18
MxS16 m_mamaAction; // 0x1a MxS16 m_mamaAction; // 0x1a
MxS16 m_papaAction; // 0x1c MxS16 m_papaAction; // 0x1c
@ -90,6 +103,13 @@ public:
// GasStation::`scalar deleting destructor' // GasStation::`scalar deleting destructor'
private: private:
enum {
e_finished = 0,
e_start = 1,
e_started = 2,
e_canceled = 3,
};
inline void PlayAction(GarageScript::Script p_objectId); inline void PlayAction(GarageScript::Script p_objectId);
inline void StopAction(GarageScript::Script p_objectId); inline void StopAction(GarageScript::Script p_objectId);
@ -101,13 +121,13 @@ private:
undefined2 m_unk0xfa; // 0xfa undefined2 m_unk0xfa; // 0xfa
LegoGameState::Area m_destLocation; // 0xfc LegoGameState::Area m_destLocation; // 0xfc
GasStationState* m_state; // 0x100 GasStationState* m_state; // 0x100
undefined2 m_unk0x104; // 0x104 MxS16 m_waitingState; // 0x104
undefined2 m_unk0x106; // 0x106 MxS16 m_setWithCurrentAction; // 0x106
MxStillPresenter* m_trackLedBitmap; // 0x108 MxStillPresenter* m_trackLedBitmap; // 0x108
MxLong m_unk0x10c; // 0x10c MxLong m_lastIdleAnimation; // 0x10c
MxLong m_trackLedTimer; // 0x110 MxLong m_trackLedTimer; // 0x110
MxBool m_unk0x114; // 0x114 MxBool m_waiting; // 0x114
MxBool m_unk0x115; // 0x115 MxBool m_flashingLeds; // 0x115
Radio m_radio; // 0x118 Radio m_radio; // 0x118
}; };

View File

@ -28,7 +28,7 @@ DECOMP_SIZE_ASSERT(GasStation, 0x128)
DECOMP_SIZE_ASSERT(GasStationState, 0x24) DECOMP_SIZE_ASSERT(GasStationState, 0x24)
// GLOBAL: LEGO1 0x100f0160 // GLOBAL: LEGO1 0x100f0160
undefined4 g_unk0x100f0160 = 3; MxS32 g_animationSkipCounterGasStation = 3;
// GLOBAL: LEGO1 0x100f0164 // GLOBAL: LEGO1 0x100f0164
MxBool g_trackLedEnabled = FALSE; MxBool g_trackLedEnabled = FALSE;
@ -40,11 +40,11 @@ GasStation::GasStation()
m_state = NULL; m_state = NULL;
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
m_trackLedBitmap = NULL; m_trackLedBitmap = NULL;
m_unk0x104 = 0; m_waitingState = e_finished;
m_unk0x114 = FALSE; m_waiting = FALSE;
m_unk0x106 = 0; m_setWithCurrentAction = 0;
m_unk0x10c = 0; m_lastIdleAnimation = 0;
m_unk0x115 = FALSE; m_flashingLeds = FALSE;
m_trackLedTimer = 0; m_trackLedTimer = 0;
NotificationManager()->Register(this); NotificationManager()->Register(this);
@ -61,7 +61,7 @@ GasStation::~GasStation()
ControlManager()->Unregister(this); ControlManager()->Unregister(this);
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
NotificationManager()->Unregister(this); NotificationManager()->Unregister(this);
g_unk0x100f0160 = 3; g_animationSkipCounterGasStation = 3;
} }
// FUNCTION: LEGO1 0x10004990 // FUNCTION: LEGO1 0x10004990
@ -79,13 +79,13 @@ MxResult GasStation::Create(MxDSAction& p_dsAction)
m_state = (GasStationState*) GameState()->GetState("GasStationState"); m_state = (GasStationState*) GameState()->GetState("GasStationState");
if (!m_state) { if (!m_state) {
m_state = (GasStationState*) GameState()->CreateState("GasStationState"); m_state = (GasStationState*) GameState()->CreateState("GasStationState");
m_state->m_unk0x14 = 1; m_state->m_state = GasStationState::e_newState;
} }
else if (m_state->m_unk0x14 == 4) { else if (m_state->m_state == GasStationState::e_unknown4) {
m_state->m_unk0x14 = 4; m_state->m_state = GasStationState::e_unknown4;
} }
else { else {
m_state->m_unk0x14 = 3; m_state->m_state = GasStationState::e_unknown3;
} }
GameState()->m_currentArea = LegoGameState::e_garage; GameState()->m_currentArea = LegoGameState::e_garage;
@ -141,25 +141,25 @@ void GasStation::ReadyWorld()
case LegoActor::c_pepper: case LegoActor::c_pepper:
switch (m_state->m_pepperAction) { switch (m_state->m_pepperAction) {
case 0: case 0:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs002nu_RunAnim); PlayAction(GarageScript::c_wgs002nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 1: case 1:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs003nu_RunAnim); PlayAction(GarageScript::c_wgs003nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 2: case 2:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs004nu_RunAnim); PlayAction(GarageScript::c_wgs004nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
default: default:
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
PlayAction(GarageScript::c_wgs008nu_RunAnim); PlayAction(GarageScript::c_wgs008nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
} }
@ -170,20 +170,20 @@ void GasStation::ReadyWorld()
case LegoActor::c_mama: case LegoActor::c_mama:
switch (m_state->m_mamaAction) { switch (m_state->m_mamaAction) {
case 0: case 0:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs006nu_RunAnim); PlayAction(GarageScript::c_wgs006nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 1: case 1:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs007nu_RunAnim); PlayAction(GarageScript::c_wgs007nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
default: default:
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
PlayAction(GarageScript::c_wgs008nu_RunAnim); PlayAction(GarageScript::c_wgs008nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
} }
@ -194,20 +194,20 @@ void GasStation::ReadyWorld()
case LegoActor::c_nick: case LegoActor::c_nick:
switch (m_state->m_nickAction) { switch (m_state->m_nickAction) {
case 0: case 0:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs009nu_RunAnim); PlayAction(GarageScript::c_wgs009nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 1: case 1:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs010nu_RunAnim); PlayAction(GarageScript::c_wgs010nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
default: default:
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
PlayAction(GarageScript::c_wgs008nu_RunAnim); PlayAction(GarageScript::c_wgs008nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
} }
@ -218,20 +218,20 @@ void GasStation::ReadyWorld()
case LegoActor::c_papa: case LegoActor::c_papa:
switch (m_state->m_papaAction) { switch (m_state->m_papaAction) {
case 0: case 0:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs012nu_RunAnim); PlayAction(GarageScript::c_wgs012nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 1: case 1:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs014nu_RunAnim); PlayAction(GarageScript::c_wgs014nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
default: default:
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
PlayAction(GarageScript::c_wgs017nu_RunAnim); PlayAction(GarageScript::c_wgs017nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
} }
@ -242,20 +242,20 @@ void GasStation::ReadyWorld()
case LegoActor::c_laura: case LegoActor::c_laura:
switch (m_state->m_lauraAction) { switch (m_state->m_lauraAction) {
case 0: case 0:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs020nu_RunAnim); PlayAction(GarageScript::c_wgs020nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
case 1: case 1:
m_state->m_unk0x14 = 5; m_state->m_state = GasStationState::e_introduction;
PlayAction(GarageScript::c_wgs021nu_RunAnim); PlayAction(GarageScript::c_wgs021nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
break; break;
default: default:
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
PlayAction(GarageScript::c_wgs022nu_RunAnim); PlayAction(GarageScript::c_wgs022nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
} }
@ -303,33 +303,33 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
if (action->GetAtomId() == m_atomId && action->GetObjectId()) { if (action->GetAtomId() == m_atomId && action->GetObjectId()) {
m_state->StopAction((GarageScript::Script) action->GetObjectId()); m_state->StopAction((GarageScript::Script) action->GetObjectId());
m_unk0x106 = 0; m_setWithCurrentAction = 0;
switch (m_state->m_unk0x14) { switch (m_state->m_state) {
case 5: case GasStationState::e_introduction:
g_unk0x100f0160 = 0; g_animationSkipCounterGasStation = 0;
m_state->m_unk0x14 = 6; m_state->m_state = GasStationState::e_explainQuest;
m_unk0x115 = TRUE; m_flashingLeds = TRUE;
PlayAction(GarageScript::c_wgs023nu_RunAnim); PlayAction(GarageScript::c_wgs023nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
m_unk0x104 = 1; m_waitingState = e_start;
break; break;
case 6: case GasStationState::e_explainQuest:
g_unk0x100f0160 = 0; g_animationSkipCounterGasStation = 0;
m_unk0x115 = TRUE; m_flashingLeds = TRUE;
if (m_unk0x104 == 3) { if (m_waitingState == e_canceled) {
m_state->m_unk0x14 = 8; m_state->m_state = GasStationState::e_afterAcceptingQuest;
PlayAction(GarageScript::c_wgs029nu_RunAnim); PlayAction(GarageScript::c_wgs029nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
} }
else { else {
m_state->m_unk0x14 = 7; m_state->m_state = GasStationState::e_waitAcceptingQuest;
m_unk0x114 = TRUE; m_waiting = TRUE;
} }
break; break;
case 8: case GasStationState::e_afterAcceptingQuest:
m_state->m_unk0x14 = 2; m_state->m_state = GasStationState::e_beforeExitingForQuest;
((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7;
m_destLocation = LegoGameState::e_unk28; m_destLocation = LegoGameState::e_unk28;
m_radio.Stop(); m_radio.Stop();
@ -348,7 +348,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: LEGO1 0x10005920 // FUNCTION: LEGO1 0x10005920
MxLong GasStation::HandleKeyPress(SDL_Keycode p_key) MxLong GasStation::HandleKeyPress(SDL_Keycode p_key)
{ {
if (p_key == SDLK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) { if (p_key == SDLK_SPACE && g_animationSkipCounterGasStation == 0 && m_setWithCurrentAction != 0) {
m_state->StopActions(); m_state->StopActions();
return 1; return 1;
} }
@ -360,18 +360,18 @@ MxLong GasStation::HandleKeyPress(SDL_Keycode p_key)
// FUNCTION: BETA10 0x10029319 // FUNCTION: BETA10 0x10029319
MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param) MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
{ {
if (m_unk0x104 == 1 || m_unk0x104 == 2) { if (m_waitingState == e_start || m_waitingState == e_started) {
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
if (roi != NULL) { if (roi != NULL) {
if (!SDL_strncasecmp(roi->GetName(), "capdb", 5) || !SDL_strncasecmp(roi->GetName(), "*capdb", 6)) { if (!SDL_strncasecmp(roi->GetName(), "capdb", 5) || !SDL_strncasecmp(roi->GetName(), "*capdb", 6)) {
m_unk0x104 = 3; m_waitingState = e_canceled;
m_unk0x114 = FALSE; m_waiting = FALSE;
if (m_state->m_unk0x14 == 7) { if (m_state->m_state == GasStationState::e_waitAcceptingQuest) {
m_state->m_unk0x14 = 8; m_state->m_state = GasStationState::e_afterAcceptingQuest;
PlayAction(GarageScript::c_wgs029nu_RunAnim); PlayAction(GarageScript::c_wgs029nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
} }
else { else {
StopAction(GarageScript::c_wgs023nu_RunAnim); StopAction(GarageScript::c_wgs023nu_RunAnim);
@ -395,7 +395,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) { switch (p_param.m_clickedObjectId) {
case GarageScript::c_LeftArrow_Ctl: case GarageScript::c_LeftArrow_Ctl:
case GarageScript::c_RightArrow_Ctl: case GarageScript::c_RightArrow_Ctl:
m_state->m_unk0x14 = 0; m_state->m_state = GasStationState::e_unknown0;
m_destLocation = LegoGameState::Area::e_garadoor; m_destLocation = LegoGameState::Area::e_garadoor;
m_state->StopActions(); m_state->StopActions();
@ -404,7 +404,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param)
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break; break;
case GarageScript::c_Info_Ctl: case GarageScript::c_Info_Ctl:
m_state->m_unk0x14 = 0; m_state->m_state = GasStationState::e_unknown0;
m_destLocation = LegoGameState::Area::e_infomain; m_destLocation = LegoGameState::Area::e_infomain;
m_state->StopActions(); m_state->StopActions();
@ -413,7 +413,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param)
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break; break;
case GarageScript::c_Buggy_Ctl: case GarageScript::c_Buggy_Ctl:
m_state->m_unk0x14 = 0; m_state->m_state = GasStationState::e_unknown0;
m_destLocation = LegoGameState::Area::e_dunecarbuild; m_destLocation = LegoGameState::Area::e_dunecarbuild;
m_state->StopActions(); m_state->StopActions();
@ -453,29 +453,29 @@ MxResult GasStation::Tickle()
return SUCCESS; return SUCCESS;
} }
if (g_unk0x100f0160 != 0) { if (g_animationSkipCounterGasStation != 0) {
g_unk0x100f0160--; g_animationSkipCounterGasStation--;
} }
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
if (m_unk0x114) { if (m_waiting) {
if (time - m_unk0x10c > 15000) { if (time - m_lastIdleAnimation > 15000) {
m_unk0x10c = time; m_lastIdleAnimation = time;
if (m_unk0x104 == 1) { if (m_waitingState == e_start) {
m_unk0x104 = 2; m_waitingState = e_started;
} }
else if (m_unk0x104 != 0) { else if (m_waitingState != e_finished) {
m_unk0x104 = 0; m_waitingState = e_finished;
MxDSAction action; MxDSAction action;
m_state->m_unk0x14 = 9; m_state->m_state = GasStationState::e_cancelQuest;
PlayAction(GarageScript::c_wgs031nu_RunAnim); PlayAction(GarageScript::c_wgs031nu_RunAnim);
m_unk0x106 = 1; m_setWithCurrentAction = 1;
} }
} }
} }
if (m_unk0x115) { if (m_flashingLeds) {
if (time - m_trackLedTimer > 300) { if (time - m_trackLedTimer > 300) {
m_trackLedTimer = time; m_trackLedTimer = time;
g_trackLedEnabled = !g_trackLedEnabled; g_trackLedEnabled = !g_trackLedEnabled;
@ -491,7 +491,7 @@ MxBool GasStation::Escape()
{ {
m_radio.Stop(); m_radio.Stop();
m_state->StopActions(); m_state->StopActions();
m_state->m_unk0x14 = 0; m_state->m_state = GasStationState::e_unknown0;
m_destLocation = LegoGameState::Area::e_infomain; m_destLocation = LegoGameState::Area::e_infomain;
return TRUE; return TRUE;
} }

View File

@ -26,7 +26,7 @@ DECOMP_SIZE_ASSERT(Hospital, 0x12c)
DECOMP_SIZE_ASSERT(HospitalState, 0x18) DECOMP_SIZE_ASSERT(HospitalState, 0x18)
// GLOBAL: LEGO1 0x100f7918 // GLOBAL: LEGO1 0x100f7918
undefined4 g_animationSkipCounter = 3; undefined4 g_animationSkipCounterHospital = 3;
// GLOBAL: LEGO1 0x100f791c // GLOBAL: LEGO1 0x100f791c
MxBool g_copLedEnabled = FALSE; MxBool g_copLedEnabled = FALSE;
@ -66,7 +66,7 @@ Hospital::~Hospital()
m_hospitalState->m_state = HospitalState::e_unknown3; m_hospitalState->m_state = HospitalState::e_unknown3;
NotificationManager()->Unregister(this); NotificationManager()->Unregister(this);
g_animationSkipCounter = 3; g_animationSkipCounterHospital = 3;
} }
// FUNCTION: LEGO1 0x100748c0 // FUNCTION: LEGO1 0x100748c0
@ -224,7 +224,7 @@ MxLong Hospital::HandleKeyPress(SDL_Keycode p_key)
{ {
MxLong result = 0; MxLong result = 0;
if (p_key == SDLK_SPACE && g_animationSkipCounter == 0) { if (p_key == SDLK_SPACE && g_animationSkipCounterHospital == 0) {
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
result = 1; result = 1;
} }
@ -253,7 +253,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
m_currentAction = HospitalScript::c_hho006cl_RunAnim; m_currentAction = HospitalScript::c_hho006cl_RunAnim;
m_setWithCurrentAction = 1; m_setWithCurrentAction = 1;
m_flashingLeds = 1; m_flashingLeds = 1;
g_animationSkipCounter = 0; g_animationSkipCounterHospital = 0;
break; break;
case HospitalState::e_explainQuestShort: case HospitalState::e_explainQuestShort:
m_time = Timer()->GetTime(); m_time = Timer()->GetTime();
@ -639,8 +639,8 @@ MxResult Hospital::Tickle()
return SUCCESS; return SUCCESS;
} }
if (g_animationSkipCounter != 0) { if (g_animationSkipCounterHospital != 0) {
g_animationSkipCounter -= 1; g_animationSkipCounterHospital -= 1;
} }
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();

View File

@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(LegoLOD::Mesh, 0x08)
LPDIRECT3DRMMATERIAL g_unk0x101013d4 = NULL; LPDIRECT3DRMMATERIAL g_unk0x101013d4 = NULL;
// GLOBAL: LEGO1 0x101013dc // GLOBAL: LEGO1 0x101013dc
const char* g_unk0x101013dc = "inh"; const char* g_InhPrefix = "inh";
inline IDirect3DRM2* GetD3DRM(Tgl::Renderer* pRenderer); inline IDirect3DRM2* GetD3DRM(Tgl::Renderer* pRenderer);
inline BOOL GetMeshData(IDirect3DRMMesh*& mesh, D3DRMGROUPINDEX& index, Tgl::Mesh* pMesh); inline BOOL GetMeshData(IDirect3DRMMesh*& mesh, D3DRMGROUPINDEX& index, Tgl::Mesh* pMesh);
@ -68,7 +68,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
LegoU32(*textureIndices)[3] = NULL; LegoU32(*textureIndices)[3] = NULL;
LegoTextureInfo* textureInfo = NULL; LegoTextureInfo* textureInfo = NULL;
LegoU32 i, meshUnd1, meshUnd2, tempNumVertsAndNormals; LegoU32 i, indexBackwards, indexForwards, tempNumVertsAndNormals;
unsigned char paletteEntries[256]; unsigned char paletteEntries[256];
if (p_storage->Read(&m_unk0x08, sizeof(undefined4)) != SUCCESS) { if (p_storage->Read(&m_unk0x08, sizeof(undefined4)) != SUCCESS) {
@ -95,8 +95,8 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
m_melems = new Mesh[m_numMeshes]; m_melems = new Mesh[m_numMeshes];
memset(m_melems, 0, sizeof(*m_melems) * m_numMeshes); memset(m_melems, 0, sizeof(*m_melems) * m_numMeshes);
meshUnd1 = m_numMeshes - 1; indexBackwards = m_numMeshes - 1;
meshUnd2 = 0; indexForwards = 0;
if (p_storage->Read(&tempNumVertsAndNormals, sizeof(LegoU32)) != SUCCESS) { if (p_storage->Read(&tempNumVertsAndNormals, sizeof(LegoU32)) != SUCCESS) {
goto done; goto done;
@ -186,13 +186,13 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
textureName = mesh->GetTextureName(); textureName = mesh->GetTextureName();
materialName = mesh->GetMaterialName(); materialName = mesh->GetMaterialName();
if (FUN_100aae20(textureName) || FUN_100aae20(materialName)) { if (HasInhPrefix(textureName) || HasInhPrefix(materialName)) {
meshIndex = meshUnd1; meshIndex = indexBackwards;
meshUnd1--; indexBackwards--;
} }
else { else {
meshIndex = meshUnd2; meshIndex = indexForwards;
meshUnd2++; indexForwards++;
} }
m_melems[meshIndex].m_tglMesh = m_meshBuilder->CreateMesh( m_melems[meshIndex].m_tglMesh = m_meshBuilder->CreateMesh(
@ -267,7 +267,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
} }
} }
m_meshOffset = meshUnd2; m_meshOffset = indexForwards;
if (textureVertices != NULL) { if (textureVertices != NULL) {
delete[] textureVertices; delete[] textureVertices;
@ -379,10 +379,10 @@ LegoResult LegoLOD::GetTextureInfo(LegoTextureInfo*& p_textureInfo)
} }
// FUNCTION: LEGO1 0x100aae20 // FUNCTION: LEGO1 0x100aae20
LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name) LegoBool LegoLOD::HasInhPrefix(const LegoChar* p_name)
{ {
if (p_name != NULL) { if (p_name != NULL) {
if (!SDL_strncasecmp(p_name, g_unk0x101013dc, strlen(g_unk0x101013dc))) { if (!SDL_strncasecmp(p_name, g_InhPrefix, strlen(g_InhPrefix))) {
return TRUE; return TRUE;
} }
} }

View File

@ -35,7 +35,7 @@ public:
void ClearMeshOffset(); void ClearMeshOffset();
LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo); LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo);
static LegoBool FUN_100aae20(const LegoChar* p_name); static LegoBool HasInhPrefix(const LegoChar* p_name);
// SYNTHETIC: LEGO1 0x100aa430 // SYNTHETIC: LEGO1 0x100aa430
// LegoLOD::`scalar deleting destructor' // LegoLOD::`scalar deleting destructor'