Skip to content

Commit

Permalink
Improve order until legomain.cpp (#1350)
Browse files Browse the repository at this point in the history
* Fix `LegoBackgroundColor` order

* Order

* Improve order in Act3Actors

* Improve order

* Add BETA annotation

* Order more

* More order

* More order

* Order

* Match/order

* Remove blank line

* Modern compiler fix

* vtable annotation
  • Loading branch information
foxtacles authored Jan 18, 2025
1 parent e1ce96c commit fc03e7a
Show file tree
Hide file tree
Showing 24 changed files with 217 additions and 207 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ function(add_lego_libraries NAME)
LEGO1/lego/legoomni/src/common/legovariables.cpp
LEGO1/lego/legoomni/src/actors/pizza.cpp
LEGO1/lego/legoomni/src/common/legogamestate.cpp
LEGO1/lego/legoomni/src/actors/act3ammo.cpp
LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp
LEGO1/lego/legoomni/src/common/legoutils.cpp
LEGO1/lego/legoomni/src/actors/act3actors.cpp
Expand All @@ -350,7 +349,6 @@ function(add_lego_libraries NAME)
LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp
LEGO1/lego/legoomni/src/common/legophoneme.cpp
LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp
LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp
LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp
LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp
LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp
Expand All @@ -361,9 +359,11 @@ function(add_lego_libraries NAME)
LEGO1/lego/legoomni/src/worlds/legoact2.cpp
LEGO1/lego/legoomni/src/main/scripts.cpp
LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp
LEGO1/lego/legoomni/src/actors/act3ammo.cpp
LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp
LEGO1/lego/legoomni/src/paths/legopathboundary.cpp
LEGO1/lego/legoomni/src/main/legomain.cpp
LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp
LEGO1/lego/legoomni/src/input/legoinputmanager.cpp
LEGO1/lego/legoomni/src/race/legoracemap.cpp
LEGO1/lego/legoomni/src/worlds/jukebox.cpp
Expand Down
104 changes: 52 additions & 52 deletions LEGO1/lego/legoomni/include/act3actors.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,56 @@ struct LegoBuildingInfo;
struct LegoPlantInfo;
class LegoWorld;

// VTABLE: LEGO1 0x100d7920 LegoPathActor
// VTABLE: LEGO1 0x100d79f0 LegoAnimActor
// SIZE 0x1a8
class Act3Shark : public LegoAnimActor {
public:
Act3Shark();

void ParseAction(char*) override; // vtable+0x20
void Animate(float p_time) override; // vtable+0x70

// LegoAnimActor vtable
virtual MxResult EatPizza(Act3Ammo* p_ammo); // vtable+0x10

// FUNCTION: LEGO1 0x100430d0
const char* ClassName() const override // vtable+0x0c
{
// Does not exist in BETA10
// STRING: LEGO1 0x100f03a0
return "Act3Shark";
}

MxFloat GetUnknown0x2c() { return m_unk0x2c; }

void SetUnknown0x2c(MxFloat p_unk0x2c) { m_unk0x2c = p_unk0x2c; }

// SYNTHETIC: LEGO1 0x10043030
// Act3Shark::`scalar deleting destructor'

private:
list<Act3Ammo*> m_eatPizzas; // 0x1c
Act3Ammo* m_nextPizza; // 0x28
MxFloat m_unk0x2c; // 0x2c
LegoWorld* m_world; // 0x30
LegoAnimActorStruct* m_unk0x34; // 0x34
LegoROI* m_unk0x38; // 0x38
Mx3DPointFloat m_unk0x3c; // 0x3c
};

// VTABLE: LEGO1 0x100d7668 LegoPathActor
// VTABLE: LEGO1 0x100d7738 LegoAnimActor
// VTABLE: BETA10 0x101b8a98 LegoPathActor
// VTABLE: BETA10 0x101b8b88 LegoAnimActor
// SIZE 0x178
class Act3Actor : public LegoAnimActor {
public:
struct Act3CopDest {
// name verified by BETA10 0x10018776
const char* m_bName; // 0x00

// name verified by BETA10 0x100187cb
LegoPathBoundary* m_boundary; // 0x04

MxFloat m_unk0x08[3]; // 0x08
MxFloat m_unk0x14[3]; // 0x14
};

Act3Actor();

MxU32 VTable0x90(float p_time, Matrix4& p_transform) override; // vtable+0x90
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94

// FUNCTION: LEGO1 0x100431b0
// FUNCTION: BETA10 0x1001d320
const char* ClassName() const override // vtable+0x0c
Expand All @@ -38,9 +68,6 @@ class Act3Actor : public LegoAnimActor {
return "Act3Actor";
}

MxU32 VTable0x90(float p_time, Matrix4& p_transform) override; // vtable+0x90
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94

MxFloat GetUnknown0x1c() { return m_unk0x1c; }

void SetUnknown0x1c(MxFloat p_unk0x1c) { m_unk0x1c = p_unk0x1c; }
Expand All @@ -62,6 +89,17 @@ class Act3Actor : public LegoAnimActor {
// SIZE 0x188
class Act3Cop : public Act3Actor {
public:
struct Act3CopDest {
// name verified by BETA10 0x10018776
const char* m_bName; // 0x00

// name verified by BETA10 0x100187cb
LegoPathBoundary* m_boundary; // 0x04

MxFloat m_unk0x08[3]; // 0x08
MxFloat m_unk0x14[3]; // 0x14
};

Act3Cop();

void ParseAction(char* p_extra) override; // vtable+0x20
Expand Down Expand Up @@ -137,44 +175,6 @@ class Act3Brickster : public Act3Actor {
MxU8 m_unk0x58; // 0x58
};

// VTABLE: LEGO1 0x100d7920 LegoPathActor
// VTABLE: LEGO1 0x100d79f0 LegoAnimActor
// SIZE 0x1a8
class Act3Shark : public LegoAnimActor {
public:
Act3Shark();

// FUNCTION: LEGO1 0x100430d0
const char* ClassName() const override // vtable+0x0c
{
// Does not exist in BETA10
// STRING: LEGO1 0x100f03a0
return "Act3Shark";
}

void ParseAction(char*) override; // vtable+0x20
void Animate(float p_time) override; // vtable+0x70

// LegoAnimActor vtable
virtual MxResult EatPizza(Act3Ammo* p_ammo); // vtable+0x10

MxFloat GetUnknown0x2c() { return m_unk0x2c; }

void SetUnknown0x2c(MxFloat p_unk0x2c) { m_unk0x2c = p_unk0x2c; }

// SYNTHETIC: LEGO1 0x10043030
// Act3Shark::`scalar deleting destructor'

private:
list<Act3Ammo*> m_eatPizzas; // 0x1c
Act3Ammo* m_nextPizza; // 0x28
MxFloat m_unk0x2c; // 0x2c
LegoWorld* m_world; // 0x30
LegoAnimActorStruct* m_unk0x34; // 0x34
LegoROI* m_unk0x38; // 0x38
Mx3DPointFloat m_unk0x3c; // 0x3c
};

// FUNCTION: LEGO1 0x1003ff10
// Act3Actor::`vbase destructor'

Expand Down
11 changes: 7 additions & 4 deletions LEGO1/lego/legoomni/include/legoact2.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ class LegoAct2 : public LegoWorld {
MxResult Tickle() override; // vtable+0x08
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool VTable0x5c() override; // vtable+0x5c
void VTable0x60() override; // vtable+0x60
MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68

// FUNCTION: LEGO1 0x1004fe10
MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c

void VTable0x60() override; // vtable+0x60
MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68

void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
Expand Down
20 changes: 10 additions & 10 deletions LEGO1/lego/legoomni/include/legoanimactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ class LegoAnimActor : public virtual LegoPathActor {

~LegoAnimActor() override;

void ParseAction(char* p_extra) override; // vtable+0x20
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
void Animate(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74

virtual MxResult FUN_1001c1f0(float& p_und);
virtual MxResult FUN_1001c360(float, Matrix4& p_transform);
virtual MxResult FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs);
virtual void ClearMaps();

// FUNCTION: LEGO1 0x1000fba0
// FUNCTION: BETA10 0x10012400
const char* ClassName() const override // vtable+0x0c
Expand All @@ -57,16 +67,6 @@ class LegoAnimActor : public virtual LegoPathActor {
return !strcmp(p_name, LegoAnimActor::ClassName()) || LegoPathActor::IsA(p_name);
}

void ParseAction(char* p_extra) override; // vtable+0x20
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
void Animate(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74

virtual MxResult FUN_1001c1f0(float& p_und);
virtual MxResult FUN_1001c360(float, Matrix4& p_transform);
virtual MxResult FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs);
virtual void ClearMaps();

// SYNTHETIC: LEGO1 0x1000fb60
// LegoAnimActor::`scalar deleting destructor'

Expand Down
4 changes: 4 additions & 0 deletions LEGO1/lego/legoomni/include/legoanimmmpresenter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef LEGOANIMMMPRESENTER_H
#define LEGOANIMMMPRESENTER_H

// MxDSActionListCursor needs to be included before std::list
// clang-format off
#include "mxdsmultiaction.h"
// clang-format on
#include "mxcompositepresenter.h"

class LegoAnimPresenter;
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/include/legogamestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct ColorStringStruct {
// SIZE 0x30
class LegoBackgroundColor : public MxVariable {
public:
LegoBackgroundColor();
LegoBackgroundColor(const char* p_key, const char* p_value);

void SetValue(const char* p_colorString) override; // vtable+0x04
Expand Down
28 changes: 14 additions & 14 deletions LEGO1/lego/legoomni/include/legopathactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ class LegoPathActor : public LegoActor {
LegoPathActor();
~LegoPathActor() override;

// FUNCTION: LEGO1 0x1000c430
// FUNCTION: BETA10 0x10012790
const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f0114
return "LegoPathActor";
}

// FUNCTION: LEGO1 0x1000c440
MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name);
}

void ParseAction(char* p_extra) override; // vtable+0x20
virtual MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3); // vtable+0x68
virtual MxU32 VTable0x6c(
Expand Down Expand Up @@ -137,6 +123,20 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002de0
virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8

// FUNCTION: LEGO1 0x1000c430
// FUNCTION: BETA10 0x10012790
const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f0114
return "LegoPathActor";
}

// FUNCTION: LEGO1 0x1000c440
MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name);
}

// FUNCTION: BETA10 0x1001ca40
LegoPathBoundary* GetBoundary() { return m_boundary; }

Expand Down
3 changes: 1 addition & 2 deletions LEGO1/lego/legoomni/include/legopathcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
#include "geom/legounkown100db7f4.h"
#include "legopathactor.h"
#include "legopathboundary.h"
#include "mxcore.h"
#include "legopathstruct.h"
#include "mxstl/stlcompat.h"

class LegoAnimPresenter;
class LegoPathStruct;
class LegoWorld;
class MxAtomId;
class Vector3;
Expand Down
12 changes: 9 additions & 3 deletions LEGO1/lego/legoomni/include/mxcontrolpresenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ class MxControlPresenter : public MxCompositePresenter {
MxControlPresenter();
~MxControlPresenter() override;

// FUNCTION: LEGO1 0x10043fd0
void RepeatingTickle() override {} // vtable+0x24

// FUNCTION: LEGO1 0x10043fe0
MxBool VTable0x64(undefined4 p_undefined) override { return m_unk0x50; } // vtable+0x64

// FUNCTION: LEGO1 0x10043ff0
virtual void VTable0x68(MxBool p_unk0x50) { m_unk0x50 = p_unk0x50; } // vtable+0x68

// FUNCTION: LEGO1 0x10044000
// FUNCTION: BETA10 0x100ebf80
const char* ClassName() const override // vtable+0x0c
Expand All @@ -30,15 +39,12 @@ class MxControlPresenter : public MxCompositePresenter {
}

void ReadyTickle() override; // vtable+0x18
void RepeatingTickle() override; // vtable+0x24
void ParseExtra() override; // vtable+0x30
MxResult AddToManager() override; // vtable+0x34
MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c
void EndAction() override; // vtable+0x40
MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48
void Enable(MxBool p_enable) override; // vtable+0x54
MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64
virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68
virtual void VTable0x6c(MxS16 p_unk0x4e); // vtable+0x6c

MxBool FUN_10044480(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter);
Expand Down
36 changes: 34 additions & 2 deletions LEGO1/lego/legoomni/include/towtrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ class TowTrackMissionState : public LegoState {
public:
TowTrackMissionState();

// FUNCTION: LEGO1 0x1004dde0
// FUNCTION: BETA10 0x100f8720
MxResult Serialize(LegoStorage* p_storage) override
{
LegoState::Serialize(p_storage);

if (p_storage->IsReadMode()) {
p_storage->ReadS16(m_peScore);
p_storage->ReadS16(m_maScore);
p_storage->ReadS16(m_paScore);
p_storage->ReadS16(m_niScore);
p_storage->ReadS16(m_laScore);
p_storage->ReadS16(m_peHighScore);
p_storage->ReadS16(m_maHighScore);
p_storage->ReadS16(m_paHighScore);
p_storage->ReadS16(m_niHighScore);
p_storage->ReadS16(m_laHighScore);
}
else if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_peScore);
p_storage->WriteS16(m_maScore);
p_storage->WriteS16(m_paScore);
p_storage->WriteS16(m_niScore);
p_storage->WriteS16(m_laScore);
p_storage->WriteS16(m_peHighScore);
p_storage->WriteS16(m_maHighScore);
p_storage->WriteS16(m_paHighScore);
p_storage->WriteS16(m_niHighScore);
p_storage->WriteS16(m_laHighScore);
}

return SUCCESS;
} // vtable+0x1c

// FUNCTION: LEGO1 0x1004dfa0
// FUNCTION: BETA10 0x100f8920
const char* ClassName() const override // vtable+0x0c
Expand All @@ -28,8 +62,6 @@ class TowTrackMissionState : public LegoState {
return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name);
}

MxResult Serialize(LegoStorage* p_storage) override; // vtable+0x1c

// FUNCTION: BETA10 0x10088890
MxS16 GetHighScore(MxU8 p_actorId)
{
Expand Down
5 changes: 1 addition & 4 deletions LEGO1/lego/legoomni/src/actors/act3actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DECOMP_SIZE_ASSERT(Act3Shark, 0x1a8)
// name verified by BETA10 0x10018776
// GLOBAL: LEGO1 0x100f4120
// GLOBAL: BETA10 0x101dcdc8
Act3Actor::Act3CopDest g_copDest[5] = {
Act3Cop::Act3CopDest g_copDest[5] = {
{"INT38", NULL, {3.69, -1.31251, -59.231}, {-0.99601698, 0.0, -0.089166}},
{
"EDG02_08",
Expand Down Expand Up @@ -1012,9 +1012,6 @@ MxResult Act3Brickster::FUN_100417c0()
// FUNCTION: BETA10 0x1001b017
MxS32 Act3Brickster::FUN_10042300()
{
// TODO: Has poor inlining, can be fixed by changing the assignment operator in vector.h
// See extended comment in vector.h for operator=

Act3* a3 = (Act3*) m_world;

assert(a3 && a3->m_cop1 && a3->m_cop2);
Expand Down
Loading

0 comments on commit fc03e7a

Please sign in to comment.