Implement Score

This commit is contained in:
Nathan 2023-10-21 20:06:24 -04:00
parent ae908a74cc
commit 80713fbf42
31 changed files with 731 additions and 32 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ Debug/
Release/
*.ncb
/.vs
/.vscode
ISLE.EXE
LEGO1.DLL
build/

View File

@ -28,6 +28,7 @@ add_library(lego1 SHARED
LEGO1/gasstation.cpp
LEGO1/gasstationentity.cpp
LEGO1/gasstationstate.cpp
LEGO1/gifmanager.cpp
LEGO1/helicopter.cpp
LEGO1/helicopterstate.cpp
LEGO1/historybook.cpp

View File

@ -22,7 +22,25 @@ class AmbulanceMissionState : public LegoState
{
return !strcmp(name, AmbulanceMissionState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id)
{
switch (id)
{
case 1: return m_color1;
case 2: return m_color2;
case 3: return m_color3;
case 4: return m_color4;
case 5: return m_color5;
default: return 0;
}
}
protected:
undefined m_unk8[0x12];
MxU16 m_color1;
MxU16 m_color2;
MxU16 m_color3;
MxU16 m_color4;
MxU16 m_color5;
};

18
LEGO1/gifmanager.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "gifmanager.h"
// OFFSET: LEGO1 0x10001cc0
GifMapEntry *GifMap::FindNode(const char *&string)
{
GifMapEntry *ret = m_unk4;
GifMapEntry *current = ret->parent;
while (current != DAT_100f0100) {
if (strcmp(current->key, string) <= 0) {
ret = current;
current = current->right;
}
else current = current->left;
}
return ret;
}
GifMapEntry *DAT_100f0100;

65
LEGO1/gifmanager.h Normal file
View File

@ -0,0 +1,65 @@
#ifndef GIFMANAGER_H
#define GIFMANAGER_H
#include "decomp.h"
#include "mxtypes.h"
#include "ddraw.h"
#include "d3drmobj.h"
struct GifData {
public:
const char *m_name;
LPDIRECTDRAWSURFACE m_surface;
LPDIRECTDRAWPALETTE m_palette;
LPDIRECT3DRMTEXTURE2 m_texture;
MxU8 *data;
};
struct GifMapEntry {
public:
GifMapEntry *right;
GifMapEntry *parent;
GifMapEntry *left;
const char *key;
GifData *value;
};
extern GifMapEntry *DAT_100f0100;
class GifMap
{
public:
GifMapEntry *GifMap::FindNode(const char *&string);
inline GifData *Get(const char *string) {
GifData *ret = NULL;
GifMapEntry *entry = FindNode(string);
if (((m_unk4 == entry || strcmp(string, entry->key) > 0) ? m_unk4 : entry) != entry) {
ret = entry->value;
}
return ret;
}
undefined4 m_unk0;
GifMapEntry *m_unk4;
};
//VTABLE 100d86d4
class GifManagerBase {
public:
//OFFSET: LEGO1 0x1005a310 STUB
virtual ~GifManagerBase() {} // vtable+00
inline GifData *Get(const char *name) { return m_unk8.Get(name); }
protected:
undefined4 m_unk0;
undefined4 m_unk4;
GifMap m_unk8;
};
//VTABLE 100d86fc
class GifManager : public GifManagerBase {
//OFFSET: LEGO1 0x1005a580 STUB
virtual ~GifManager() {} // vtable+00
protected:
undefined m_unk[0x1c];
};
#endif // GIFMANAGER_H

View File

@ -19,3 +19,12 @@ MxResult LegoControlManager::Tickle()
return 0;
}
// OFFSET: LEGO1 0x10028e10 STUB
void LegoControlManager::Register(MxCore *p_listener)
{
}
// OFFSET: LEGO1 0x10028ea0 STUB
void LegoControlManager::Unregister(MxCore *p_listener)
{
}

View File

@ -24,7 +24,8 @@ class LegoControlManager : public MxCore
{
return !strcmp(name, LegoControlManager::ClassName()) || MxCore::IsA(name);
}
void Register(MxCore *p_listener);
void Unregister(MxCore *p_listener);
};
#endif // LEGOCONTROLMANAGER_H

View File

@ -38,6 +38,8 @@ class LegoEntity : public MxEntity
virtual MxResult InitFromMxDSObject(MxDSObject& p_object); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char *); // vtable+0x20
// OFFSET: LEGO1 0x10001090
virtual void VTable0x30(undefined4 p_1) { m_unk50 = p_1; }
protected:
void Reset();

View File

@ -233,4 +233,16 @@ void LegoGameState::RegisterState(LegoState *p_state)
if (m_stateArray[targetIndex])
delete m_stateArray[targetIndex];
m_stateArray[targetIndex] = p_state;
}
// OFFSET: LEGO1 0x1003a720 STUB
void LegoGameState::FUN_1003a720(MxU32 p_1)
{
// TODO
}
// OFFSET: LEGO1 0x1003b060 STUB
void LegoGameState::HandleAction(MxU32 p_1)
{
}

View File

@ -33,6 +33,9 @@ class LegoGameState
LegoState *CreateState(char *p_stateName);
void GetFileSavePath(MxString *p_outPath, MxULong p_slotn);
inline void Set424(MxU32 p_1) { m_unk424 = p_1; }
void FUN_1003a720(MxU32 p_1);
void HandleAction(MxU32 p_1);
private:
void RegisterState(LegoState *p_state);
@ -49,7 +52,10 @@ class LegoGameState
LegoBackgroundColor *m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie *m_fullScreenMovie; // 0x20
MxU16 m_unk24; // 0x24
undefined m_unk28[1032];
undefined m_unk28[1020];
MxU32 m_unk424;
MxU32 m_unk428;
undefined4 m_unk42c;
};
#endif // LEGOGAMESTATE_H

View File

@ -10,8 +10,8 @@ DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
LegoInputManager::LegoInputManager()
{
m_unk0x5c = NULL;
m_unk0x64 = 0;
m_unk0x60 = 0;
m_world = NULL;
m_camera = NULL;
m_unk0x68 = NULL;
m_unk0x80 = 0;
m_timer = 0;
@ -184,6 +184,30 @@ void LegoInputManager::UnRegister(MxCore *)
// TODO
}
// OFFSET: LEGO1 0x1005c700
void LegoInputManager::SetCamera(LegoCameraController *p_camera)
{
m_camera = p_camera;
}
// OFFSET: LEGO1 0x1005c710
void LegoInputManager::ClearCamera()
{
m_camera = NULL;
}
// OFFSET: LEGO1 0x1005c720
void LegoInputManager::SetWorld(LegoWorld *p_world)
{
m_world = p_world;
}
// OFFSET: LEGO1 0x1005c730
void LegoInputManager::ClearWorld()
{
m_world = NULL;
}
// OFFSET: LEGO1 0x1005c740 STUB
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
{
@ -205,4 +229,4 @@ void LegoInputManager::KillTimer()
LegoOmni* omni = LegoOmni::GetInstance();
::KillTimer(omni->GetWindowHandle(), m_timer);
}
}
}

View File

@ -2,6 +2,7 @@
#define LEGOINPUTMANAGER_H
#include "decomp.h"
#include "legoworld.h"
#include "mxpresenter.h"
#include "mxlist.h"
@ -42,12 +43,19 @@ class LegoInputManager : public MxPresenter
void KillTimer();
inline LegoControlManager *GetControlManager() { return m_controlManager; }
inline LegoWorld *GetWorld() { return m_world; }
void SetCamera(LegoCameraController *p_camera);
void ClearCamera();
void SetWorld(LegoWorld *p_world);
void ClearWorld();
void inline SetM88(MxBool p_1) { m_unk0x88 = p_1; }
void inline SetM336(MxBool p_1) { m_unk0x336 = p_1; }
//private:
MxCriticalSection m_criticalSection;
MxList<undefined4> *m_unk0x5c; // list or hash table
undefined4 m_unk0x60;
undefined4 m_unk0x64;
LegoCameraController *m_camera;
LegoWorld *m_world;
MxList<undefined4> *m_unk0x68; // list or hash table
undefined4 m_unk0x6c;
undefined4 m_unk0x70;
@ -73,4 +81,6 @@ class LegoInputManager : public MxPresenter
MxBool m_unk0x336;
};
LegoControlManager* ControlManager();
#endif // LEGOINPUTMANAGER_H

View File

@ -265,7 +265,7 @@ void LegoOmni::Init()
m_unk68 = 0;
m_inputMgr = NULL;
m_unk6c = 0;
m_unk74 = 0;
m_gifManager = NULL;
m_unk78 = 0;
m_currentWorld = NULL;
m_unk80 = FALSE;
@ -356,3 +356,8 @@ LegoWorld *GetCurrentWorld()
{
return LegoOmni::GetInstance()->GetCurrentWorld();
}
// OFFSET: LEGO1 0x10015800
GifManager *GetGifManager() {
return LegoOmni::GetInstance()->GetGifManager();
}

View File

@ -5,6 +5,7 @@
#include "mxomni.h"
#include "mxdsaction.h"
class GifManager;
class Isle;
class LegoAnimationManager;
class LegoBuildingManager;
@ -76,12 +77,13 @@ class LegoOmni : public MxOmni
LegoNavController *GetNavController() { return m_navController; }
MxTransitionManager *GetTransitionManager() { return m_transitionManager; }
LegoWorld *GetCurrentWorld() { return m_currentWorld; }
GifManager *GetGifManager() { return m_gifManager; }
private:
undefined4 m_unk68;
undefined4 m_unk6c;
LegoInputManager *m_inputMgr; // 0x70
undefined4 m_unk74;
GifManager *m_gifManager;
undefined4 m_unk78;
LegoWorld *m_currentWorld;
MxBool m_unk80;
@ -118,5 +120,5 @@ Isle* GetIsle();
LegoPlantManager* PlantManager();
MxBool KeyValueStringParse(char *, const char *, const char *);
LegoWorld *GetCurrentWorld();
GifManager *GetGifManager();
#endif // LEGOOMNI_H

View File

@ -1,4 +1,9 @@
#include "legoworld.h"
#include "legoomni.h"
#include "legoinputmanager.h"
#include "mxticklemanager.h"
MxBool g_isWorldActive;
// OFFSET: LEGO1 0x1001ca40 STUB
LegoWorld::LegoWorld()
@ -11,3 +16,46 @@ LegoWorld::~LegoWorld()
{
// TODO
}
// OFFSET: LEGO1 0x10022340
void LegoWorld::Stop() {
TickleManager()->UnregisterClient(this);
}
// OFFSET: LEGO1 0x1001d670
MxBool LegoWorld::VTable0x5c() {
return FALSE;
}
// OFFSET: LEGO1 0x100010a0
void LegoWorld::VTable0x60() {
}
// OFFSET: LEGO1 0x10021a70 STUB
void LegoWorld::VTable0x68(MxBool p_add) {
}
// OFFSET: LEGO1 0x1001e0b0 STUB
MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_object)
{
return SUCCESS;
}
// OFFSET: LEGO1 0x10015820 STUB
void FUN_10015820(MxU32 p_1, MxU32 p_2)
{
}
// OFFSET: LEGO1 0x10015910 STUB
void FUN_10015910(MxU32 p_1)
{
}
// OFFSET: LEGO1 0x100159c0
void SetIsWorldActive(MxBool p_active)
{
if (!p_active) LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
g_isWorldActive = p_active;
}

View File

@ -2,6 +2,7 @@
#define LEGOWORLD_H
#include "legoentity.h"
#include "legocameracontroller.h"
// VTABLE 0x100d6280
// SIZE 0xf8
@ -23,6 +24,22 @@ class LegoWorld : public LegoEntity
{
return !strcmp(name, LegoWorld::ClassName()) || LegoEntity::IsA(name);
}
virtual void Stop(); //vtable+50
virtual MxBool VTable0x5c(); // vtable+5c
virtual void VTable0x60(); // vtable+60
virtual void VTable0x68(MxBool p_add); // vtable+68
MxResult SetAsCurrentWorld(MxDSObject& p_object);
protected:
undefined unk68[0x30];
LegoCameraController *camera;
undefined unk9c[0x5a];
undefined unkf6;
undefined unkf7;
};
void FUN_10015820(MxU32 p_1, MxU32 p_2);
void FUN_10015910(MxU32 p_1);
void SetIsWorldActive(MxBool p_active);
#endif // LEGOWORLD_H

View File

@ -38,6 +38,8 @@ class MxActionNotificationParam : public MxNotificationParam
virtual MxNotificationParam *Clone() override; // vtable+0x4
inline MxDSAction *GetAction() { return m_action; }
protected:
MxDSAction *m_action; // 0xc
MxBool m_realloc; // 0x10

View File

@ -0,0 +1,18 @@
#ifndef MXAPPNOTIFICATIONPARAM_H
#define MXAPPNOTIFICATIONPARAM_H
// VTABLE 0x100d6aa0
class MxAppNotificationParam : public MxNotificationParam
{
public:
inline MxAppNotificationParam() : MxNotificationParam((MxParamType)0, NULL) {}
virtual ~MxAppNotificationParam() override {} // vtable+0x0 (scalar deleting destructor)
inline MxU8 getM18() { return m_unk18; }
protected:
undefined m_unkc[0xc];
MxU8 m_unk18;
};
#endif // MXAPPNOTIFICATIONPARAM_H

View File

@ -62,6 +62,7 @@ class MxDSAction : public MxDSObject
inline MxS32 GetLoopCount() { return m_loopCount; }
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
inline const MxVector3Data &GetLocation() const { return m_location; }
inline void SetM84(MxCore *p_1) { m_unk84 = p_1; }
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
@ -82,7 +83,7 @@ class MxDSAction : public MxDSObject
MxVector3Data m_up;
char *m_extraData;
MxU16 m_extraLength;
undefined4 m_unk84;
MxCore *m_unk84;
undefined4 m_unk88;
MxOmni *m_omni; // 0x8c

View File

@ -9,9 +9,25 @@ class MxCore;
enum MxParamType
{
MXSTREAMER_UNKNOWN = 2,
PARAM_NONE = 0,
PAINT = 1, //100dc210:100d8350
MXSTREAMER_UNKNOWN = 2, //100d8358:100d8350
TYPE4 = 4, //100dc208:100d8350
MXPRESENTER_NOTIFICATION = 5,
MXSTREAMER_DELETE_NOTIFY = 6,
MXSTREAMER_DELETE_NOTIFY = 6, //100dc760
APP_MESSAGE = 7, //100d6aa0
MOUSE_RELEASE = 8, //100d6aa0
MOUSE_PRESS = 9, //100d6aa0
MOUSE_MOVE = 10, //100d6aa0
TYPE11 = 11, //100d6aa0
PARAM_TIMER = 15, //100d6aa0
TYPE17 = 17,
TYPE18 = 18, //100d7e80
TYPE19 = 19, //100d6230
TYPE20 = 20,
TYPE21 = 21,
TYPE22 = 22,
TYPE23 = 23,
MXTRANSITIONMANAGER_TRANSITIONENDED = 24
};

View File

@ -402,3 +402,20 @@ MxEventManager* EventManager()
{
return MxOmni::GetInstance()->GetEventManager();
}
// OFFSET: LEGO1 0x100acf70
void DeleteObject(MxDSAction &ds)
{
MxOmni::GetInstance()->DeleteObject(ds);
}
// Offset: LEGO1 0x100159e0
void DeleteObjects(MxAtomId *p_id, MxU32 p_first, MxU32 p_last)
{
MxDSAction action;
action.SetAtomId(*p_id);
while(p_first <= p_last) {
action.SetUnknown24(p_first++);
DeleteObject(action);
}
}

View File

@ -5,6 +5,7 @@
#include "mxstring.h"
#include "mxcriticalsection.h"
class MxAtomId;
class MxAtomIdCounterSet;
class MxDSAction;
class MxEventManager;
@ -98,5 +99,6 @@ __declspec(dllexport) MxNotificationManager * NotificationManager();
MxVideoManager *MVideoManager();
MxAtomIdCounterSet *AtomIdCounterSet();
MxObjectFactory *ObjectFactory();
void DeleteObject(MxDSAction &ds);
void DeleteObjects(MxAtomId *p_id, MxU32 p_first, MxU32 p_last);
#endif // MXOMNI_H

View File

@ -0,0 +1,17 @@
#ifndef MXTYPE17NOTIFICATIONPARAM_H
#define MXTYPE17NOTIFICATIONPARAM_H
// ??? This type is handled, but seemingly never created and no VTABLE fits
class MxType17NotificationParam : public MxNotificationParam
{
public:
inline MxU32 GetM20() { return m_unk20; }
inline MxU16 GetM28() { return m_unk28; }
protected:
undefined m_unkc[0x14];
MxU32 m_unk20;
undefined4 m_unk24;
MxU16 m_unk28;
};
#endif // MXTYPE17NOTIFICATIONPARAM_H

View File

@ -1 +1,10 @@
#include "pizzamissionstate.h"
// OFFSET: LEGO1 0x10039510
PizzaMissionStateEntry *PizzaMissionState::GetState(MxU8 id)
{
for (MxU16 i = 0; i < 5; i++) {
if (m_state[i].m_id == id) return m_state + i;
}
return NULL;
}

View File

@ -3,6 +3,16 @@
#include "legostate.h"
struct PizzaMissionStateEntry
{
public:
undefined2 m_unk0;
MxU8 m_id;
undefined m_unk3[0x15];
MxU16 m_color;
undefined m_unk18[6];
};
// VTABLE 0x100d7408
class PizzaMissionState : public LegoState
{
@ -19,7 +29,13 @@ class PizzaMissionState : public LegoState
{
return !strcmp(name, PizzaMissionState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; }
private:
PizzaMissionStateEntry *GetState(MxU8 id);
protected:
undefined4 m_unk8;
undefined4 m_unkc;
PizzaMissionStateEntry m_state[5];
};
#endif // PIZZAMISSIONSTATE_H

View File

@ -5,3 +5,12 @@ RaceState::RaceState()
{
// TODO
}
// OFFSET: LEGO1 0x10016280
RaceStateEntry *RaceState::GetState(MxU8 id)
{
for (MxU16 i = 0; i < 5; i++) {
if (m_state[i].m_id == id) return m_state + i;
}
return NULL;
}

View File

@ -3,8 +3,17 @@
#include "legostate.h"
struct RaceStateEntry
{
public:
MxU8 m_id;
undefined m_unk1[1];
MxU16 m_unk2;
MxU16 m_color;
};
// VTABLE 0x100d5e30
// SIZE probably 0x2c
// SIZE 0x2c
class RaceState : public LegoState
{
public:
@ -22,7 +31,13 @@ class RaceState : public LegoState
{
return !strcmp(name, RaceState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; }
private:
RaceStateEntry *GetState(MxU8 id);
protected:
RaceStateEntry m_state[5];
undefined2 m_unk26[2];
undefined4 m_unk28;
};
#endif // RACESTATE_H

View File

@ -1,21 +1,305 @@
#include "score.h"
#include "gifmanager.h"
#include "ambulancemissionstate.h"
#include "mxnotificationmanager.h"
#include "mxnotificationparam.h"
#include "mxtransitionmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "pizzamissionstate.h"
#include "racestate.h"
#include "towtrackmissionstate.h"
// OFFSET: LEGO1 0x10001000 STUB
// OFFSET: LEGO1 0x10001000
Score::Score()
{
// TODO
m_unkF8 = 0;
NotificationManager()->Register(this);
}
// OFFSET: LEGO1 0x10001200 STUB
// OFFSET: LEGO1 0x10001200
Score::~Score()
{
// TODO
if (InputManager()->GetWorld() == this) InputManager()->ClearWorld();
InputManager()->UnRegister(this);
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
}
// OFFSET: LEGO1 0x10001410 STUB
// OFFSET: LEGO1 0x10001410
MxLong Score::Notify(MxParam &p)
{
// TODO
return 0;
MxLong ret = 0;
LegoWorld::Notify(p);
if (unkf6) {
switch (((MxNotificationParam &)p).GetType())
{
case PAINT:
ret = 1;
Paint();
break;
case MXSTREAMER_UNKNOWN:
ret = FUN_10001510((MxEndActionNotificationParam &)p);
break;
case APP_MESSAGE:
if (((MxAppNotificationParam &)p).getM18() == 0x20) DeleteScript(); // Shutting down
ret = 1;
break;
case TYPE17:
ret = FUN_100016d0((MxType17NotificationParam &)p);
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
DeleteObjects(g_infoscorScript, 7, 9);
if (m_unkF8) GameState()->HandleAction(m_unkF8);
ret = 1;
break;
default:
break;
}
}
return ret;
}
// OFFSET: LEGO1 0x100010b0
MxBool Score::VTable0x5c() {
return TRUE;
}
// OFFSET: LEGO1 0x100012a0
MxResult Score::InitFromMxDSObject(MxDSObject& p_object) override
{
MxResult result = SetAsCurrentWorld(p_object);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
InputManager()->Register(this);
SetIsWorldActive(FALSE);
LegoGameState *gs = GameState();
ScoreState *state = (ScoreState *)gs->GetState("ScoreState");
m_state = state ? state : (ScoreState *)gs->CreateState("ScoreState");
GameState()->Set424(0xd);
GameState()->FUN_1003a720(0);
}
return result;
}
// OFFSET: LEGO1 0x10001340
void Score::DeleteScript()
{
if (m_state->GetTutorialFlag()) {
MxDSAction action;
action.SetObjectId(0x1f5);
action.SetAtomId(*g_infoscorScript);
action.SetUnknown24(-2);
DeleteObject(action);
m_state->SetTutorialFlag(FALSE);
}
}
// OFFSET: LEGO1 0x10001510
MxLong Score::FUN_10001510(MxEndActionNotificationParam &p)
{
MxDSAction *action = p.GetAction();
if (m_atom == action->GetAtomId()) {
MxU32 id = action->GetObjectId();
switch(action->GetObjectId()) {
case 10:
m_unkF8 = 0x38;
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 0x1f5:
FUN_10015910(0xb);
m_state->SetTutorialFlag(FALSE);
}
}
return 1;
}
// OFFSET: LEGO1 0x10001580
void Score::Stop()
{
LegoWorld::Stop();
MxDSAction action;
action.SetObjectId(0x1f4);
action.SetAtomId(m_atom);
action.SetM84(this);
Start(&action);
if (m_state->GetTutorialFlag()) {
MxDSAction action2;
action.SetObjectId(0x1f5);
action.SetAtomId(*g_infoscorScript);
Start(&action);
}
else FUN_10015910(0xb);
FUN_10015820(0, 7);
}
// OFFSET: LEGO1 0x100016d0
MxLong Score::FUN_100016d0(MxType17NotificationParam &p)
{
MxS16 l = p.GetM28();
if (l == 1 || p.GetM20() == 4) {
switch (p.GetM20())
{
case 1:
m_unkF8 = 2;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 2:
m_unkF8 = 3;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 3:
{
LegoInputManager *im = InputManager();
im->SetM88(TRUE);
im->SetM336(FALSE);
DeleteScript();
MxDSAction action;
action.SetObjectId(10);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;;
}
case 4:
{
switch(l) {
case 1:
{
MxDSAction action;
action.SetObjectId(7);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
case 2:
{
MxDSAction action;
action.SetObjectId(8);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
case 3:
{
MxDSAction action;
action.SetObjectId(9);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
}
break;
}
}
}
return 1;
}
// OFFSET: LEGO1 0x10001980
void Score::VTable0x68(MxBool p_add)
{
LegoWorld::VTable0x68(p_add);
if (p_add) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else if (InputManager()->GetWorld() == this) InputManager()->ClearWorld();
}
// OFFSET: LEGO1 0x100019d0
void Score::Paint()
{
GifManager *gm = GetGifManager();
GifData *gd = gm->Get("bigcube.gif");
if (gd) {
RaceState *l78 = (RaceState *)GameState()->GetState("JetskiRaceState");
RaceState *l70 = (RaceState *)GameState()->GetState("CarRaceState");
TowTrackMissionState *lesi = (TowTrackMissionState *)GameState()->GetState("TowTrackMissionState");
PizzaMissionState *l74 = (PizzaMissionState *)GameState()->GetState("PizzaMissionState");
AmbulanceMissionState *lebp = (AmbulanceMissionState *)GameState()->GetState("AmbulanceMissionState");
DDSURFACEDESC desc;
memset(&desc, 0, 0x6c);
desc.dwSize = 0x6c;
if (gd->m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
if (desc.lPitch != desc.dwWidth) {
gd->m_surface->Unlock(desc.lpSurface);
return;
}
for (MxU8 id = 1; id <= 5; id++) {
m_surface = (MxU8 *)desc.lpSurface;
MxU16 color = 0;
if (l70) color = l70->GetColor(id);
MxU32 row = id - 1;
FillArea(0, row, color);
color = 0;
if (l78) color = l78->GetColor(id);
FillArea(1, row, color);
color = 0;
if (l74) color = l74->GetColor(id);
FillArea(2, row, color);
color = 0;
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);
gd->m_texture->Changed(TRUE, FALSE);
m_surface = NULL;
}
}
}
// OFFSET: LEGO1 0x10001d20
void Score::FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color)
{
MxU32 data[24];
data[9] = 0x2b00;
data[10] = 0x5700;
data[11] = 0x8000;
data[19] = 0x2a;
data[12] = 0xab00;
data[13] = 0xd600;
data[20] = 0x27;
data[21] = 0x29;
data[22] = 0x29;
data[23] = 0x2a;
data[4] = 0x2f;
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] = 0xf;
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] = 0x8;
data[3] = 0x5;
MxU32 value = data[p_color];
for (; count > 0; count--) {
memset(ptr++, value, size);
ptr += 0x100;
}
}
// OFFSET: LEGO1 0x10001e40
MxBool Score::VTable0x64()
{
DeleteScript();
m_unkF8 = 2;
return TRUE;
}
MxAtomId *g_infoscorScript;

View File

@ -2,6 +2,12 @@
#define SCORE_H
#include "legoworld.h"
#include "scorestate.h"
#include "mxactionnotificationparam.h"
#include "mxappnotificationparam.h"
#include "mxtype17notificationparam.h"
extern MxAtomId *g_infoscorScript;
// VTABLE 0x100d4018
// SIZE 0x104
@ -10,9 +16,38 @@ class Score : public LegoWorld
public:
Score();
virtual ~Score() override; // vtable+0x0
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x100010c0
inline virtual const char *ClassName() const override // vtable+0x0c
{
// 0x100f0058
return "Score";
}
// OFFSET: LEGO1 0x100010d0
inline virtual MxBool IsA(const char *name) const override // vtable+0x10
{
return !strcmp(name, Score::ClassName()) || LegoWorld::IsA(name);
}
MxResult InitFromMxDSObject(MxDSObject& p_object); // vtable+0x18
virtual void Stop() override; // vtable+0x50
virtual MxBool VTable0x5c() override; // vtable+0x5c
virtual MxBool VTable0x64() override; // vtable+64
virtual void VTable0x68(MxBool p_add) override; // vtable+68
void Paint();
MxLong FUN_10001510(MxEndActionNotificationParam &p);
MxLong FUN_100016d0(MxType17NotificationParam &p);
void FillArea(MxU32 p_1, MxU32 p_2, MxS16 p_3);
protected:
undefined4 m_unkF8;
ScoreState *m_state;
MxU8 *m_surface;
private:
void DeleteScript();
};
#endif // SCORE_H

View File

@ -23,7 +23,8 @@ class ScoreState : public LegoState
virtual MxBool VTable0x14() override; // vtable+0x14
virtual MxBool SetFlag() override; // vtable+0x18
inline GetTutorialFlag() { return m_playCubeTutorial; }
inline void SetTutorialFlag(MxBool p_1) { m_playCubeTutorial = p_1; }
private:
MxBool m_playCubeTutorial;
};

View File

@ -5,7 +5,7 @@
// VTABLE 0x100d7fd8
// SIZE 0x28
class TowTrackMissionState : LegoState
class TowTrackMissionState : public LegoState
{
public:
TowTrackMissionState();
@ -15,14 +15,32 @@ class TowTrackMissionState : LegoState
{
// 0x100f00bc
return "TowTrackMissionState";
};
}
// OFFSET: LEGO1 0x1004dfb0
inline virtual MxBool IsA(const char *name) const // vtable+0x10
{
return !strcmp(name, TowTrackMissionState::ClassName()) || LegoState::IsA(name);
};
}
inline MxU16 GetColor(MxU8 id)
{
switch (id)
{
case 1: return m_color1;
case 2: return m_color2;
case 3: return m_color3;
case 4: return m_color4;
case 5: return m_color5;
default: return 0;
}
}
protected:
undefined m_unk8[0x14];
MxU16 m_color1;
MxU16 m_color2;
MxU16 m_color3;
MxU16 m_color4;
MxU16 m_color5;
};
#endif // TOWTRACKMISSIONSTATE_H