mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-25 17:18:16 -05:00
Score class cleanup (#855)
* Cleanup/fixes * Improve Paint match * Improve Score::FillArea * Fix naming * Fix value
This commit is contained in:
parent
180a1e6360
commit
19d39394be
12 changed files with 145 additions and 165 deletions
|
@ -26,19 +26,19 @@ class AmbulanceMissionState : public LegoState {
|
||||||
|
|
||||||
inline void SetUnknown0x08(undefined4 p_unk0x08) { m_unk0x08 = p_unk0x08; }
|
inline void SetUnknown0x08(undefined4 p_unk0x08) { m_unk0x08 = p_unk0x08; }
|
||||||
|
|
||||||
inline MxU16 GetColor(MxU8 p_id)
|
inline MxU16 GetScore(MxU8 p_id)
|
||||||
{
|
{
|
||||||
switch (p_id) {
|
switch (p_id) {
|
||||||
case 1:
|
case 1:
|
||||||
return m_color1;
|
return m_score1;
|
||||||
case 2:
|
case 2:
|
||||||
return m_color2;
|
return m_score2;
|
||||||
case 3:
|
case 3:
|
||||||
return m_color3;
|
return m_score3;
|
||||||
case 4:
|
case 4:
|
||||||
return m_color4;
|
return m_score4;
|
||||||
case 5:
|
case 5:
|
||||||
return m_color5;
|
return m_score5;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,11 @@ class AmbulanceMissionState : public LegoState {
|
||||||
MxU16 m_unk0x14; // 0x14
|
MxU16 m_unk0x14; // 0x14
|
||||||
MxU16 m_unk0x16; // 0x16
|
MxU16 m_unk0x16; // 0x16
|
||||||
MxU16 m_unk0x18; // 0x18
|
MxU16 m_unk0x18; // 0x18
|
||||||
MxU16 m_color1; // 0x1a
|
MxU16 m_score1; // 0x1a
|
||||||
MxU16 m_color2; // 0x1c
|
MxU16 m_score2; // 0x1c
|
||||||
MxU16 m_color3; // 0x1e
|
MxU16 m_score3; // 0x1e
|
||||||
MxU16 m_color4; // 0x20
|
MxU16 m_score4; // 0x20
|
||||||
MxU16 m_color5; // 0x22
|
MxU16 m_score5; // 0x22
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMBULANCEMISSIONSTATE_H
|
#endif // AMBULANCEMISSIONSTATE_H
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
// SIZE 0x20
|
// SIZE 0x20
|
||||||
struct PizzaMissionStateEntry {
|
struct PizzaMissionStateEntry {
|
||||||
public:
|
public:
|
||||||
undefined2 m_unk0x00;
|
undefined2 m_unk0x00; // 0x00
|
||||||
MxU8 m_id;
|
MxU8 m_id; // 0x02
|
||||||
undefined m_unk0x03[0x15];
|
undefined m_unk0x03[0x15]; // 0x03
|
||||||
MxU16 m_color;
|
MxU16 m_score; // 0x18
|
||||||
undefined m_unk0x18[6];
|
undefined m_unk0x18[6]; // 0x1a
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d7408
|
// VTABLE: LEGO1 0x100d7408
|
||||||
|
@ -32,7 +32,7 @@ class PizzaMissionState : public LegoState {
|
||||||
|
|
||||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||||
|
|
||||||
inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; }
|
inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; }
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x10039350
|
// SYNTHETIC: LEGO1 0x10039350
|
||||||
// PizzaMissionState::`scalar deleting destructor'
|
// PizzaMissionState::`scalar deleting destructor'
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
struct RaceStateEntry {
|
struct RaceStateEntry {
|
||||||
public:
|
public:
|
||||||
inline MxS16 GetUnknown0x02() { return m_unk0x02; }
|
inline MxS16 GetUnknown0x02() { return m_unk0x02; }
|
||||||
|
inline MxU16 GetScore() { return m_score; }
|
||||||
|
|
||||||
// TODO: Possibly private
|
// TODO: Possibly private
|
||||||
MxU8 m_id; // 0x00
|
MxU8 m_id; // 0x00
|
||||||
MxS16 m_unk0x02; // 0x02
|
MxS16 m_unk0x02; // 0x02
|
||||||
MxU16 m_color; // 0x04
|
MxU16 m_score; // 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d5e30
|
// VTABLE: LEGO1 0x100d5e30
|
||||||
|
@ -37,7 +38,6 @@ class RaceState : public LegoState {
|
||||||
|
|
||||||
RaceStateEntry* GetState(MxU8 p_id);
|
RaceStateEntry* GetState(MxU8 p_id);
|
||||||
|
|
||||||
inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; }
|
|
||||||
inline undefined4 GetUnknown0x28() { return m_unk0x28; }
|
inline undefined4 GetUnknown0x28() { return m_unk0x28; }
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1000f6f0
|
// SYNTHETIC: LEGO1 0x1000f6f0
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class Score : public LegoWorld {
|
class Score : public LegoWorld {
|
||||||
public:
|
public:
|
||||||
Score();
|
Score();
|
||||||
~Score() override; // vtable+0x00
|
~Score() override;
|
||||||
MxLong Notify(MxParam& p_param) override; // vtable+0x04
|
MxLong Notify(MxParam& p_param) override; // vtable+0x04
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100010c0
|
// FUNCTION: LEGO1 0x100010c0
|
||||||
|
@ -32,24 +32,23 @@ class Score : public LegoWorld {
|
||||||
// SYNTHETIC: LEGO1 0x100011e0
|
// SYNTHETIC: LEGO1 0x100011e0
|
||||||
// Score::`scalar deleting destructor'
|
// Score::`scalar deleting destructor'
|
||||||
|
|
||||||
MxResult Create(MxDSAction& p_dsAction) override; // vtable+18
|
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
|
||||||
void ReadyWorld() override; // vtable+50
|
void ReadyWorld() override; // vtable+0x50
|
||||||
MxBool VTable0x5c() override; // vtable+5c
|
MxBool VTable0x5c() override; // vtable+0x5c
|
||||||
MxBool VTable0x64() override; // vtable+64
|
MxBool VTable0x64() override; // vtable+0x64
|
||||||
void Enable(MxBool p_enable) override; // vtable+68
|
void Enable(MxBool p_enable) override; // vtable+0x68
|
||||||
|
|
||||||
void Paint();
|
void Paint();
|
||||||
MxLong FUN_10001510(MxEndActionNotificationParam& p_param);
|
MxLong FUN_10001510(MxEndActionNotificationParam& p_param);
|
||||||
MxLong FUN_100016d0(LegoControlManagerEvent& p_param);
|
MxLong FUN_100016d0(LegoControlManagerEvent& p_param);
|
||||||
void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color);
|
void FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LegoGameState::Area m_destLocation;
|
|
||||||
ScoreState* m_state;
|
|
||||||
MxU8* m_surface;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void DeleteScript();
|
void DeleteScript();
|
||||||
|
|
||||||
|
LegoGameState::Area m_destLocation; // 0xf8
|
||||||
|
ScoreState* m_state; // 0xfc
|
||||||
|
MxU8* m_surface; // 0x100
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCORE_H
|
#endif // SCORE_H
|
||||||
|
|
|
@ -24,19 +24,19 @@ class TowTrackMissionState : public LegoState {
|
||||||
|
|
||||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||||
|
|
||||||
inline MxU16 GetColor(MxU8 p_id)
|
inline MxU16 GetScore(MxU8 p_id)
|
||||||
{
|
{
|
||||||
switch (p_id) {
|
switch (p_id) {
|
||||||
case 1:
|
case 1:
|
||||||
return m_color1;
|
return m_score1;
|
||||||
case 2:
|
case 2:
|
||||||
return m_color2;
|
return m_score2;
|
||||||
case 3:
|
case 3:
|
||||||
return m_color3;
|
return m_score3;
|
||||||
case 4:
|
case 4:
|
||||||
return m_color4;
|
return m_score4;
|
||||||
case 5:
|
case 5:
|
||||||
return m_color5;
|
return m_score5;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,11 @@ class TowTrackMissionState : public LegoState {
|
||||||
MxU16 m_unk0x16; // 0x16
|
MxU16 m_unk0x16; // 0x16
|
||||||
MxU16 m_unk0x18; // 0x18
|
MxU16 m_unk0x18; // 0x18
|
||||||
MxU16 m_unk0x1a; // 0x1a
|
MxU16 m_unk0x1a; // 0x1a
|
||||||
MxU16 m_unk0x1c; // 0x1c
|
MxU16 m_score1; // 0x1c
|
||||||
MxU16 m_color1; // 0x1e
|
MxU16 m_score2; // 0x1e
|
||||||
MxU16 m_color2; // 0x20
|
MxU16 m_score3; // 0x20
|
||||||
MxU16 m_color3; // 0x22
|
MxU16 m_score4; // 0x22
|
||||||
MxU16 m_color4; // 0x24
|
MxU16 m_score5; // 0x24
|
||||||
MxU16 m_color5; // 0x26
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOWTRACKMISSIONSTATE_H
|
#endif // TOWTRACKMISSIONSTATE_H
|
||||||
|
|
|
@ -605,6 +605,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||||
break;
|
break;
|
||||||
case VK_ESCAPE: {
|
case VK_ESCAPE: {
|
||||||
LegoWorld* currentWorld = CurrentWorld();
|
LegoWorld* currentWorld = CurrentWorld();
|
||||||
|
|
||||||
if (currentWorld) {
|
if (currentWorld) {
|
||||||
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
|
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||||
if (infocenterState && infocenterState->GetUnknown0x74() != 8 && currentWorld->VTable0x64()) {
|
if (infocenterState && infocenterState->GetUnknown0x74() != 8 && currentWorld->VTable0x64()) {
|
||||||
|
|
|
@ -12,11 +12,11 @@ AmbulanceMissionState::AmbulanceMissionState()
|
||||||
m_unk0x16 = 0;
|
m_unk0x16 = 0;
|
||||||
m_unk0x0c = 0;
|
m_unk0x0c = 0;
|
||||||
m_unk0x18 = 0;
|
m_unk0x18 = 0;
|
||||||
m_color1 = 0;
|
m_score1 = 0;
|
||||||
m_color2 = 0;
|
m_score2 = 0;
|
||||||
m_color3 = 0;
|
m_score3 = 0;
|
||||||
m_color4 = 0;
|
m_score4 = 0;
|
||||||
m_color5 = 0;
|
m_score5 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10037440
|
// STUB: LEGO1 0x10037440
|
||||||
|
|
|
@ -25,6 +25,7 @@ RaceStateEntry* RaceState::GetState(MxU8 p_id)
|
||||||
if (i >= 5) {
|
if (i >= 5) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_state[i].m_id == p_id) {
|
if (m_state[i].m_id == p_id) {
|
||||||
return m_state + i;
|
return m_state + i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,11 @@ TowTrackMissionState::TowTrackMissionState()
|
||||||
m_unk0x0c = 0;
|
m_unk0x0c = 0;
|
||||||
m_unk0x1a = 0;
|
m_unk0x1a = 0;
|
||||||
m_unk0x10 = 0;
|
m_unk0x10 = 0;
|
||||||
m_unk0x1c = 0;
|
m_score1 = 0;
|
||||||
m_color1 = 0;
|
m_score2 = 0;
|
||||||
m_color2 = 0;
|
m_score3 = 0;
|
||||||
m_color3 = 0;
|
m_score4 = 0;
|
||||||
m_color4 = 0;
|
m_score5 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1004dde0
|
// FUNCTION: LEGO1 0x1004dde0
|
||||||
|
@ -31,11 +31,11 @@ MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile)
|
||||||
p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16));
|
p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16));
|
||||||
p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18));
|
p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18));
|
||||||
p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a));
|
p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a));
|
||||||
p_legoFile->Read(&m_unk0x1c, sizeof(m_unk0x1c));
|
p_legoFile->Read(&m_score1, sizeof(m_score1));
|
||||||
p_legoFile->Read(&m_color1, sizeof(m_color1));
|
p_legoFile->Read(&m_score2, sizeof(m_score2));
|
||||||
p_legoFile->Read(&m_color2, sizeof(m_color2));
|
p_legoFile->Read(&m_score3, sizeof(m_score3));
|
||||||
p_legoFile->Read(&m_color3, sizeof(m_color3));
|
p_legoFile->Read(&m_score4, sizeof(m_score4));
|
||||||
p_legoFile->Read(&m_color4, sizeof(m_color4));
|
p_legoFile->Read(&m_score5, sizeof(m_score5));
|
||||||
}
|
}
|
||||||
else if (p_legoFile->IsWriteMode()) {
|
else if (p_legoFile->IsWriteMode()) {
|
||||||
MxU16 write = m_unk0x12;
|
MxU16 write = m_unk0x12;
|
||||||
|
@ -53,19 +53,19 @@ MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile)
|
||||||
write = m_unk0x1a;
|
write = m_unk0x1a;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
|
|
||||||
write = m_unk0x1c;
|
write = m_score1;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
|
|
||||||
write = m_color1;
|
write = m_score2;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
|
|
||||||
write = m_color2;
|
write = m_score3;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
|
|
||||||
write = m_color3;
|
write = m_score4;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
|
|
||||||
write = m_color4;
|
write = m_score5;
|
||||||
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
p_legoFile->Write(&write, sizeof(m_unk0x12));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include "score.h"
|
#include "score.h"
|
||||||
|
|
||||||
#include "ambulancemissionstate.h"
|
#include "ambulancemissionstate.h"
|
||||||
|
#include "carracestate.h"
|
||||||
#include "infoscor_actions.h"
|
#include "infoscor_actions.h"
|
||||||
|
#include "jetskiracestate.h"
|
||||||
#include "jukebox.h"
|
#include "jukebox.h"
|
||||||
#include "jukebox_actions.h"
|
#include "jukebox_actions.h"
|
||||||
#include "legocontrolmanager.h"
|
#include "legocontrolmanager.h"
|
||||||
|
@ -39,6 +41,7 @@ Score::~Score()
|
||||||
if (InputManager()->GetWorld() == this) {
|
if (InputManager()->GetWorld() == this) {
|
||||||
InputManager()->ClearWorld();
|
InputManager()->ClearWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
InputManager()->UnRegister(this);
|
InputManager()->UnRegister(this);
|
||||||
ControlManager()->Unregister(this);
|
ControlManager()->Unregister(this);
|
||||||
NotificationManager()->Unregister(this);
|
NotificationManager()->Unregister(this);
|
||||||
|
@ -54,9 +57,9 @@ MxResult Score::Create(MxDSAction& p_dsAction)
|
||||||
ControlManager()->Register(this);
|
ControlManager()->Register(this);
|
||||||
InputManager()->Register(this);
|
InputManager()->Register(this);
|
||||||
SetIsWorldActive(FALSE);
|
SetIsWorldActive(FALSE);
|
||||||
LegoGameState* gs = GameState();
|
LegoGameState* gameState = GameState();
|
||||||
ScoreState* state = (ScoreState*) gs->GetState("ScoreState");
|
ScoreState* state = (ScoreState*) gameState->GetState("ScoreState");
|
||||||
m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState");
|
m_state = state ? state : (ScoreState*) gameState->CreateState("ScoreState");
|
||||||
GameState()->SetCurrentArea(LegoGameState::e_infoscor);
|
GameState()->SetCurrentArea(LegoGameState::e_infoscor);
|
||||||
GameState()->StopArea(LegoGameState::e_previousArea);
|
GameState()->StopArea(LegoGameState::e_previousArea);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +72,7 @@ void Score::DeleteScript()
|
||||||
{
|
{
|
||||||
if (m_state->GetTutorialFlag()) {
|
if (m_state->GetTutorialFlag()) {
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(0x1f5);
|
action.SetObjectId(InfoscorScript::c_iicc31in_PlayWav);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
action.SetUnknown24(-2);
|
action.SetUnknown24(-2);
|
||||||
DeleteObject(action);
|
DeleteObject(action);
|
||||||
|
@ -82,18 +85,19 @@ MxLong Score::Notify(MxParam& p_param)
|
||||||
{
|
{
|
||||||
MxLong ret = 0;
|
MxLong ret = 0;
|
||||||
LegoWorld::Notify(p_param);
|
LegoWorld::Notify(p_param);
|
||||||
|
|
||||||
if (m_worldStarted) {
|
if (m_worldStarted) {
|
||||||
switch (((MxNotificationParam&) p_param).GetNotification()) {
|
switch (((MxNotificationParam&) p_param).GetNotification()) {
|
||||||
case c_notificationStartAction:
|
case c_notificationStartAction:
|
||||||
ret = 1;
|
|
||||||
Paint();
|
Paint();
|
||||||
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
case c_notificationEndAction:
|
case c_notificationEndAction:
|
||||||
ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
|
ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
|
||||||
break;
|
break;
|
||||||
case c_notificationKeyPress:
|
case c_notificationKeyPress:
|
||||||
if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20) {
|
if (((LegoEventNotificationParam&) p_param).GetKey() == VK_SPACE) {
|
||||||
DeleteScript(); // Shutting down
|
DeleteScript();
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -101,16 +105,15 @@ MxLong Score::Notify(MxParam& p_param)
|
||||||
ret = FUN_100016d0((LegoControlManagerEvent&) p_param);
|
ret = FUN_100016d0((LegoControlManagerEvent&) p_param);
|
||||||
break;
|
break;
|
||||||
case c_notificationTransitioned:
|
case c_notificationTransitioned:
|
||||||
DeleteObjects(g_infoscorScript, 7, 9);
|
DeleteObjects(g_infoscorScript, InfoscorScript::c_LegoBox1_Flc, InfoscorScript::c_LegoBox3_Flc);
|
||||||
if (m_destLocation) {
|
if (m_destLocation) {
|
||||||
GameState()->SwitchArea(m_destLocation);
|
GameState()->SwitchArea(m_destLocation);
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,15 +123,15 @@ MxLong Score::FUN_10001510(MxEndActionNotificationParam& p_param)
|
||||||
MxDSAction* action = p_param.GetAction();
|
MxDSAction* action = p_param.GetAction();
|
||||||
|
|
||||||
if (m_atom == action->GetAtomId()) {
|
if (m_atom == action->GetAtomId()) {
|
||||||
MxU32 id = action->GetObjectId();
|
|
||||||
switch (action->GetObjectId()) {
|
switch (action->GetObjectId()) {
|
||||||
case 10:
|
case InfoscorScript::c_GoTo_HistBook:
|
||||||
m_destLocation = LegoGameState::e_histbook;
|
m_destLocation = LegoGameState::e_histbook;
|
||||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 0x32, 0, 0);
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||||
break;
|
break;
|
||||||
case 0x1f5:
|
case InfoscorScript::c_iicc31in_PlayWav:
|
||||||
PlayMusic(JukeboxScript::c_InformationCenter_Music);
|
PlayMusic(JukeboxScript::c_InformationCenter_Music);
|
||||||
m_state->SetTutorialFlag(FALSE);
|
m_state->SetTutorialFlag(FALSE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +144,14 @@ void Score::ReadyWorld()
|
||||||
LegoWorld::ReadyWorld();
|
LegoWorld::ReadyWorld();
|
||||||
|
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(0x1f4);
|
action.SetObjectId(InfoscorScript::c_nin001pr_RunAnim);
|
||||||
action.SetAtomId(m_atom);
|
action.SetAtomId(m_atom);
|
||||||
action.SetUnknown84(this);
|
action.SetUnknown84(this);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
|
|
||||||
if (m_state->GetTutorialFlag()) {
|
if (m_state->GetTutorialFlag()) {
|
||||||
MxDSAction action2;
|
MxDSAction action;
|
||||||
action.SetObjectId(0x1f5);
|
action.SetObjectId(InfoscorScript::c_iicc31in_PlayWav);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
}
|
}
|
||||||
|
@ -162,51 +165,49 @@ void Score::ReadyWorld()
|
||||||
// FUNCTION: LEGO1 0x100016d0
|
// FUNCTION: LEGO1 0x100016d0
|
||||||
MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param)
|
MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param)
|
||||||
{
|
{
|
||||||
MxS16 l = p_param.GetUnknown0x28();
|
MxS16 unk0x28 = p_param.GetUnknown0x28();
|
||||||
|
|
||||||
if (l == 1 || p_param.GetClickedObjectId() == 4) {
|
if (unk0x28 == 1 || p_param.GetClickedObjectId() == InfoscorScript::c_LegoBox_Ctl) {
|
||||||
switch (p_param.GetClickedObjectId()) {
|
switch (p_param.GetClickedObjectId()) {
|
||||||
case InfoscorScript::c_LeftArrow_Ctl:
|
case InfoscorScript::c_LeftArrow_Ctl:
|
||||||
m_destLocation = LegoGameState::e_infomain;
|
m_destLocation = LegoGameState::e_infomain;
|
||||||
DeleteScript();
|
DeleteScript();
|
||||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 0x32, 0, 0);
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||||
break;
|
break;
|
||||||
case InfoscorScript::c_RightArrow_Ctl:
|
case InfoscorScript::c_RightArrow_Ctl:
|
||||||
m_destLocation = LegoGameState::e_infodoor;
|
m_destLocation = LegoGameState::e_infodoor;
|
||||||
DeleteScript();
|
DeleteScript();
|
||||||
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 0x32, 0, 0);
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
||||||
break;
|
break;
|
||||||
case InfoscorScript::c_Book_Ctl: {
|
case InfoscorScript::c_Book_Ctl: {
|
||||||
LegoInputManager* im = InputManager();
|
InputManager()->DisableInputProcessing();
|
||||||
im->SetUnknown88(TRUE);
|
|
||||||
im->SetUnknown336(FALSE);
|
|
||||||
DeleteScript();
|
DeleteScript();
|
||||||
|
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(10);
|
action.SetObjectId(InfoscorScript::c_GoTo_HistBook);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InfoscorScript::c_LegoBox_Ctl: {
|
case InfoscorScript::c_LegoBox_Ctl: {
|
||||||
switch (l) {
|
switch (unk0x28) {
|
||||||
case 1: {
|
case 1: {
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(7);
|
action.SetObjectId(InfoscorScript::c_LegoBox1_Flc);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(8);
|
action.SetObjectId(InfoscorScript::c_LegoBox2_Flc);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
MxDSAction action;
|
MxDSAction action;
|
||||||
action.SetObjectId(9);
|
action.SetObjectId(InfoscorScript::c_LegoBox3_Flc);
|
||||||
action.SetAtomId(*g_infoscorScript);
|
action.SetAtomId(*g_infoscorScript);
|
||||||
Start(&action);
|
Start(&action);
|
||||||
break;
|
break;
|
||||||
|
@ -235,97 +236,74 @@ void Score::Enable(MxBool p_enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100019d0
|
// FUNCTION: LEGO1 0x100019d0
|
||||||
|
// FUNCTION: BETA10 0x100f47d8
|
||||||
void Score::Paint()
|
void Score::Paint()
|
||||||
{
|
{
|
||||||
LegoTextureInfo* gd = TextureContainer()->Get("bigcube.gif");
|
LegoTextureInfo* cube = TextureContainer()->Get("bigcube.gif");
|
||||||
|
|
||||||
if (gd) {
|
if (cube != NULL) {
|
||||||
RaceState* l78 = (RaceState*) GameState()->GetState("JetskiRaceState");
|
JetskiRaceState* jetskiRaceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
|
||||||
RaceState* l70 = (RaceState*) GameState()->GetState("CarRaceState");
|
CarRaceState* carRaceState = (CarRaceState*) GameState()->GetState("CarRaceState");
|
||||||
TowTrackMissionState* lesi = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
|
TowTrackMissionState* towTrackMissionState =
|
||||||
PizzaMissionState* l74 = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
|
(TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
|
||||||
AmbulanceMissionState* lebp = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
|
PizzaMissionState* pizzaMissionState = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
|
||||||
|
AmbulanceMissionState* ambulanceMissionState =
|
||||||
|
(AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
|
||||||
|
|
||||||
DDSURFACEDESC desc;
|
DDSURFACEDESC desc;
|
||||||
memset(&desc, 0, sizeof(desc));
|
memset(&desc, 0, sizeof(desc));
|
||||||
desc.dwSize = sizeof(desc);
|
desc.dwSize = sizeof(desc);
|
||||||
if (gd->m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
|
|
||||||
|
if (cube->m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
|
||||||
if (desc.lPitch != desc.dwWidth) {
|
if (desc.lPitch != desc.dwWidth) {
|
||||||
gd->m_surface->Unlock(desc.lpSurface);
|
cube->m_surface->Unlock(desc.lpSurface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MxU8 id = 1; id <= 5; id++) {
|
m_surface = (MxU8*) desc.lpSurface;
|
||||||
m_surface = (MxU8*) desc.lpSurface;
|
|
||||||
MxU16 color = 0;
|
for (MxU8 actor = 1; actor <= 5; actor++) {
|
||||||
if (l70) {
|
MxU16 score;
|
||||||
color = l70->GetColor(id);
|
|
||||||
}
|
score = carRaceState ? carRaceState->GetState(actor)->GetScore() : 0;
|
||||||
MxU32 row = id - 1;
|
FillArea(0, actor - 1, score);
|
||||||
FillArea(0, row, color);
|
|
||||||
color = 0;
|
score = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetScore() : 0;
|
||||||
if (l78) {
|
FillArea(1, actor - 1, score);
|
||||||
color = l78->GetColor(id);
|
|
||||||
}
|
score = pizzaMissionState ? pizzaMissionState->GetScore(actor) : 0;
|
||||||
FillArea(1, row, color);
|
FillArea(2, actor - 1, score);
|
||||||
color = 0;
|
|
||||||
if (l74) {
|
score = towTrackMissionState ? towTrackMissionState->GetScore(actor) : 0;
|
||||||
color = l74->GetColor(id);
|
FillArea(3, actor - 1, score);
|
||||||
}
|
|
||||||
FillArea(2, row, color);
|
score = ambulanceMissionState ? ambulanceMissionState->GetScore(actor) : 0;
|
||||||
color = 0;
|
FillArea(4, actor - 1, score);
|
||||||
if (lesi) {
|
|
||||||
color = lesi->GetColor(id);
|
|
||||||
}
|
|
||||||
FillArea(3, row, color);
|
|
||||||
color = 0;
|
|
||||||
if (lebp) {
|
|
||||||
color = lebp->GetColor(id);
|
|
||||||
}
|
|
||||||
FillArea(4, row, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gd->m_surface->Unlock(desc.lpSurface);
|
cube->m_surface->Unlock(desc.lpSurface);
|
||||||
gd->m_texture->Changed(TRUE, FALSE);
|
cube->m_texture->Changed(TRUE, FALSE);
|
||||||
m_surface = NULL;
|
m_surface = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10001d20
|
// FUNCTION: LEGO1 0x10001d20
|
||||||
void Score::FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color)
|
// FUNCTION: BETA10 0x100f4a52
|
||||||
|
void Score::FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score)
|
||||||
{
|
{
|
||||||
MxU32 data[24];
|
MxS32 local3c[] = {0x2b00, 0x5700, 0x8000, 0xab00, 0xd600};
|
||||||
data[9] = 0x2b00;
|
MxS32 local14[] = {0x2a, 0x27, 0x29, 0x29, 0x2a};
|
||||||
data[10] = 0x5700;
|
MxS32 local50[] = {0x2f, 0x56, 0x81, 0xaa, 0xd4};
|
||||||
data[11] = 0x8000;
|
MxS32 local28[] = {0x25, 0x29, 0x27, 0x28, 0x28};
|
||||||
data[19] = 0x2a;
|
MxS32 local60[] = {0x11, 0x0f, 0x08, 0x05};
|
||||||
data[12] = 0xab00;
|
|
||||||
data[13] = 0xd600;
|
MxU8* ptr = m_surface + local3c[i_actor] + local50[i_activity];
|
||||||
data[20] = 0x27;
|
MxS32 val = local60[score];
|
||||||
data[21] = 0x29;
|
MxS32 size = local28[i_activity];
|
||||||
data[22] = 0x29;
|
|
||||||
data[23] = 0x2a;
|
for (MxS32 i = 0; i < local14[i_actor]; i++) {
|
||||||
data[4] = 0x2f;
|
memset(ptr, val, size);
|
||||||
data[5] = 0x56;
|
|
||||||
data[6] = 0x81;
|
|
||||||
data[15] = 0x29;
|
|
||||||
data[16] = 0x27;
|
|
||||||
data[7] = 0xaa;
|
|
||||||
data[8] = 0xd4;
|
|
||||||
data[14] = 0x25;
|
|
||||||
data[0] = 0x11;
|
|
||||||
data[17] = 0x28;
|
|
||||||
data[18] = 0x28;
|
|
||||||
data[1] = 0x0f;
|
|
||||||
MxU32 size = data[p_x + 14];
|
|
||||||
MxU8* ptr = data[p_x + 4] + data[p_y + 9] + m_surface;
|
|
||||||
MxS32 count = data[p_y + 19];
|
|
||||||
data[2] = 0x08;
|
|
||||||
data[3] = 0x05;
|
|
||||||
MxU32 value = data[p_color];
|
|
||||||
for (; count > 0; count--) {
|
|
||||||
memset(ptr++, value, size);
|
|
||||||
ptr += 0x100;
|
ptr += 0x100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,9 @@ class LegoContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1007bc00
|
||||||
inline T* Get(const char* p_name)
|
inline T* Get(const char* p_name)
|
||||||
{
|
{
|
||||||
// TODO: Score::Paint matches better with no `value` on the stack,
|
|
||||||
// while LegoModelPresenter::CreateROI only matches with `value`
|
|
||||||
T* value = NULL;
|
T* value = NULL;
|
||||||
|
|
||||||
#ifdef COMPAT_MODE
|
#ifdef COMPAT_MODE
|
||||||
|
|
|
@ -26,3 +26,6 @@ m_AnimTreePtr: "Allow original naming from beta"
|
||||||
m_BADuration: "Allow original naming from beta"
|
m_BADuration: "Allow original naming from beta"
|
||||||
m_assAnimP: "Allow original naming from beta"
|
m_assAnimP: "Allow original naming from beta"
|
||||||
m_disAnimP: "Allow original naming from beta"
|
m_disAnimP: "Allow original naming from beta"
|
||||||
|
i_activity: "Allow original naming from beta"
|
||||||
|
i_actor: "Allow original naming from beta"
|
||||||
|
score: "Allow original naming from beta"
|
||||||
|
|
Loading…
Reference in a new issue