Compare commits

9 Commits

Author SHA1 Message Date
MS
828254cbfe Entropy CI: Use new virtualenv upon retry (#1695) 2025-10-14 19:52:09 -04:00
jonschz
fe5a238ae1 Add SmartHeap for LEGO1 (#1694)
---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
2025-10-12 07:36:36 +02:00
jonschz
e355b55907 Fix some library globals (#1692)
Co-authored-by: jonschz <jonschz@users.noreply.github.com>
2025-10-09 22:28:38 +02:00
Fabian Neundorf
9531678dfd Clear unknowns in LegoCarBuild (#1691) 2025-10-07 23:04:02 +02:00
Fabian Neundorf
d05d583368 Clear unknown parameter in LegoEntity::SetROI (#1688) 2025-09-21 11:11:04 -07:00
jonschz
c06ffe71b5 Add name substitution config (#1680)
Co-authored-by: jonschz <jonschz@users.noreply.github.com>
2025-09-13 06:51:45 +02:00
Fabian Neundorf
6c83ceb549 Clear unknowns in Act2Actor (#1687) 2025-09-12 21:22:48 +02:00
Fabian Neundorf
0832bedbf2 Improve naming for Equals in MxMatrix (#1685) 2025-09-08 18:21:12 -07:00
Fabian Neundorf
4460d2a33d Clear unknowns in LegoVehicleBuildState (#1684) 2025-09-08 09:19:49 -07:00
21 changed files with 1119 additions and 751 deletions

View File

@@ -38,7 +38,7 @@ jobs:
- name: Cache venv
uses: actions/cache@v4
with:
key: venv-entropy-${{ github.run_id }}
key: venv-entropy-${{ github.run_id }}-${{ github.run_attempt }}
path: .venv
- name: Install python packages
@@ -97,7 +97,7 @@ jobs:
- name: Restore cached virtualenv
uses: actions/cache@v4
with:
key: venv-entropy-${{ github.run_id }}
key: venv-entropy-${{ github.run_id }}-${{ github.run_attempt }}
path: .venv
- name: Prepare builds
@@ -166,7 +166,7 @@ jobs:
- name: Restore cached virtualenv
uses: actions/cache@v4
with:
key: venv-entropy-${{ github.run_id }}
key: venv-entropy-${{ github.run_id }}-${{ github.run_attempt }}
path: .venv
- name: Aggregate Accuracy

View File

@@ -324,9 +324,6 @@
// GLOBAL: ISLE 0x411850
// __cflush
// XGLOBAL ISLE 0x4125f8
// ?_pnhHeap@@3P6AHI@ZA
// GLOBAL: ISLE 0x412888
// ___setlc_active

View File

@@ -14,18 +14,24 @@ public:
MxFloat m_position[3]; // 0x00
MxFloat m_direction[3]; // 0x0c
const char* m_boundary; // 0x18
MxBool m_unk0x1c; // 0x1c
MxBool m_cleared; // 0x1c
};
enum VoiceOver {
e_head = 0,
e_behind = 1,
e_interrupt = 2,
};
Act2Actor();
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
// FUNCTION: LEGO1 0x1001a180
MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override
{
if (m_unk0x1f) {
if (m_animatingHit) {
return 0;
}
@@ -35,16 +41,16 @@ public:
void Animate(float p_time) override; // vtable+0x70
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxS32 VTable0xa0() override; // vtable+0xa0
MxS32 NextTargetLocation() override; // vtable+0xa0
void FUN_10018980();
void FUN_10019250(MxFloat p_speed, MxFloat p_param2);
void FUN_10019520();
void FUN_10019560();
MxU32 FUN_10019700(MxFloat p_param);
void FUN_100199f0(MxS8 p_param);
void FUN_100192a0(undefined4 p_location);
LegoEntity* FUN_10019b90(MxBool* p_param);
void InitializeNextShot();
void SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt);
void GoingToHide();
void Hide();
MxU32 UpdateShot(MxFloat p_time);
void PlayNextVoiceOver(MxS8 p_voiceOverType);
void FindPath(MxU32 p_location);
LegoEntity* GetNextEntity(MxBool* p_isBuilding);
// SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor'
@@ -54,22 +60,31 @@ public:
// `vbtable'
private:
undefined m_unk0x1c; // 0x1c
MxS8 m_unk0x1d; // 0x1d
undefined m_unk0x1e; // 0x1e
MxBool m_unk0x1f; // 0x1f
MxFloat m_unk0x20; // 0x20
MxFloat m_unk0x24; // 0x24
MxS8 m_unk0x28; // 0x28
MxFloat m_unk0x2c; // 0x2c
MxFloat m_unk0x30; // 0x30
LegoAnimActorStruct* m_shootAnim; // 0x34
LegoCacheSound* m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c
undefined m_unk0x40; // 0x40
MxFloat m_unk0x44; // 0x44
MxS8 m_unk0x48; // 0x48
LegoEntity* m_unk0x4c; // 0x4c
enum {
e_readyToShoot = 0,
e_endShot = 1,
e_roaming = 2,
e_createdBrick = 3,
e_goingToHide = 4,
e_hiding = 5,
};
MxBool m_skipAnimation; // 0x1c
MxS8 m_targetLocation; // 0x1d
MxU8 m_state; // 0x1e
MxBool m_animatingHit; // 0x1f
MxFloat m_animationDuration; // 0x20
MxFloat m_createBrickTime; // 0x24
MxS8 m_baseWorldSpeed; // 0x28
MxFloat m_shootAnimEnd; // 0x2c
MxFloat m_entityAnimationTime; // 0x30
LegoAnimActorStruct* m_shootAnim; // 0x34
LegoCacheSound* m_cachedShootSound; // 0x38
undefined4 m_unk0x3c; // 0x3c
MxBool m_initializing; // 0x40
MxFloat m_resetWorldSpeedAt; // 0x44
MxS8 m_visitedLocations; // 0x48
LegoEntity* m_nextEntity; // 0x4c
};
// TEMPLATE: LEGO1 0x100194f0

View File

@@ -40,8 +40,8 @@ public:
return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name);
}
void ParseAction(char* p_extra) override; // vtable+0x20
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
void ParseAction(char* p_extra) override; // vtable+0x20
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24
// FUNCTION: LEGO1 0x10002cc0
// FUNCTION: BETA10 0x1000f3e0

View File

@@ -20,11 +20,11 @@ class MxActionNotificationParam;
class LegoVehicleBuildState : public LegoState {
public:
enum AnimationState {
e_unknown0 = 0,
e_none = 0,
e_entering = 1,
e_unknown2 = 2,
e_settingUpMovie = 2,
e_cutscene = 3,
e_unknown4 = 4,
e_finishedBuild = 4,
e_exiting = 6
};
@@ -57,9 +57,9 @@ public:
MxString m_className; // 0x38
AnimationState m_animationState; // 0x48
MxU8 m_unk0x4c; // 0x4c
MxBool m_unk0x4d; // 0x4d
MxBool m_unk0x4e; // 0x4e
MxU8 m_introductionCounter; // 0x4c
MxBool m_finishedBuild; // 0x4d
MxBool m_playedExitScript; // 0x4e
MxU8 m_placedPartCount; // 0x4f
};
@@ -75,18 +75,28 @@ class LegoCarBuild : public LegoWorld {
public:
// SIZE 0x1c
struct LookupTableActions {
undefined4 m_unk0x00; // 0x00
undefined4 m_unk0x04; // 0x04
undefined4 m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c
undefined4 m_unk0x10; // 0x10
undefined4 m_unk0x14; // 0x14
undefined4 m_unk0x18; // 0x18
MxU32 m_introduction0; // 0x00
MxU32 m_leaveUnfinished; // 0x04
MxU32 m_completed; // 0x08
MxU32 m_introduction1; // 0x0c
MxU32 m_introduction2; // 0x10
MxU32 m_introduction3; // 0x14
MxU32 m_shortExplanation; // 0x18
};
enum Unknown0xf8 {
c_unknownminusone = -1,
c_unknown8 = 8
enum LookupTableActionType {
e_introduction0 = 0,
e_introduction1 = 1,
e_introduction2 = 2,
e_introduction3 = 3,
e_leaveUnfinished = 4,
e_completed = 5,
e_shortExplanation = 6,
};
enum ResetPlacedSelectedPart {
c_disabled = -1,
c_enabled = 8
};
LegoCarBuild();
@@ -113,15 +123,15 @@ public:
return !strcmp(p_name, LegoCarBuild::ClassName()) || LegoWorld::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68
virtual void VTable0x6c(); // vtable+0x6c
virtual void VTable0x70(); // vtable+0x70
virtual void VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x74
virtual void VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x78
virtual void VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x7c
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68
virtual void InitializeDisplayingTransform(); // vtable+0x6c
virtual void CalculateStartAndTargetScreenPositions(); // vtable+0x70
virtual void CalculateDragPositionAbove(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x74
virtual void CalculateDragPositionBetween(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x78
virtual void CalculateDragPositionOnGround(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x7c
virtual void VTable0x80(
MxFloat p_param1[2],
MxFloat p_param2[2],
@@ -132,33 +142,33 @@ public:
MxS16 GetPlacedPartCount();
void SetPlacedPartCount(MxU8 p_placedPartCount);
void InitPresenters();
void FUN_10022f00();
void FUN_10022f30();
void FUN_10023130(MxLong p_x, MxLong p_y);
void DisplaySelectedPart();
void ResetSelectedPart();
void CalculateSelectedPartMatrix(MxLong p_x, MxLong p_y);
void AddSelectedPartToBuild();
undefined4 FUN_10024250(LegoEventNotificationParam* p_param);
void FUN_100243a0();
undefined4 FUN_10024480(MxActionNotificationParam* p_param);
undefined4 SelectPartFromMousePosition(MxLong p_x, MxLong p_y);
undefined4 FUN_100246e0(MxLong p_x, MxLong p_y);
MxS32 FUN_10024850(MxLong p_x, MxLong p_y);
undefined4 FUN_10024890(MxParam* p_param);
undefined4 FUN_10024c20(MxNotificationParam* p_param);
void FUN_10024ef0();
void FUN_10024f30();
void FUN_10024f50();
void FUN_10024f70(MxBool p_enabled);
void SetPresentersEnabled(MxBool p_enabled);
void TogglePresentersEnabled();
void FUN_100250e0(MxBool p_param);
void FUN_10025350(MxS32 p_objectId);
void FUN_10025450();
void FUN_10025720(undefined4 p_param1);
void FUN_10025d10(MxS32 p_param);
MxS32 FUN_10025d70();
void FUN_10025db0(const char* p_param1, undefined4 p_param2);
void FUN_10025e40();
MxS32 FUN_10025ee0(undefined4 p_param1);
MxLong HandleKeyPress(LegoEventNotificationParam* p_param);
void InitExiting();
MxLong HandleEndAction(MxActionNotificationParam* p_param);
MxLong SelectPartFromMousePosition(MxLong p_x, MxLong p_y);
MxLong HandleButtonUp(MxLong p_x, MxLong p_y);
MxLong HandleMouseMove(MxLong p_x, MxLong p_y);
MxLong HandleControl(MxParam* p_param);
MxLong HandleType0Notification(MxNotificationParam* p_param);
void StartIntroduction();
void MoveShelves();
void RotateVehicle();
void EnableColorControlsForSelectedPart(MxBool p_enabled);
void SetColorControlsEnabled(MxBool p_enabled);
void ToggleColorControlsEnabled();
void EnableDecalForSelectedPart(MxBool p_enabled);
void SetPartColor(MxS32 p_objectId);
void CalculateStartAndTargetTransforms();
void StartActorScriptByType(MxS32 p_actionType);
void StartActorScript(MxS32 p_streamId);
MxS32 GetNextIntroduction();
void TickleControl(const char* p_controlName, MxULong p_time);
void HandleEndAnim();
MxS32 GetBuildMovieId(MxS32 p_carId);
// FUNCTION: BETA10 0x100735b0
void SetCarBuildAnimPresenter(LegoCarBuildAnimPresenter* p_animPresenter) { m_animPresenter = p_animPresenter; }
@@ -167,43 +177,45 @@ public:
// LegoCarBuild::`scalar deleting destructor'
private:
// inline functions
MxU32 Beta0x10070520();
void StopActionIn0x344();
enum {
e_idle = 0,
e_returning = 3,
e_selecting = 4,
e_displaying = 5,
e_dragging = 6,
};
Unknown0xf8 m_unk0xf8; // 0xf8
MxS16 m_unk0xfc; // 0xfc
MxS32 m_unk0x100; // 0x100
undefined4 m_unk0x104; // 0x104
// inline functions
MxU32 GetLookupIndex();
void StopPlayingActorScript();
ResetPlacedSelectedPart m_resetPlacedSelectedPart; // 0xf8
MxS16 m_rotateBuild; // 0xfc
MxS32 m_clickState; // 0x100
undefined4 m_unk0x104; // 0x104
// name verified by BETA10 0x1006ebba
MxS8 m_numAnimsRun; // 0x108
MxU8 m_unk0x109; // 0x109
MxU16 m_unk0x10a; // 0x10a
DWORD m_unk0x10c; // 0x10c
LegoROI* m_selectedPart; // 0x110
BoundingSphere m_unk0x114; // 0x114
MxMatrix m_unk0x12c; // 0x12c
undefined m_unk0x174; // 0x174
MxMatrix m_unk0x178; // 0x178
MxMatrix m_unk0x1c0; // 0x1c0
MxMatrix m_unk0x208; // 0x208
// This is likely a location in pixel space
MxS32 m_unk0x250[2]; // 0x250
LegoCarBuildAnimPresenter* m_animPresenter; // 0x258
MxQuaternionTransformer m_unk0x25c; // 0x25c
// These two are likely locations in pixel space
MxS32 m_unk0x290[2]; // 0x290
MxS32 m_unk0x298[2]; // 0x298
MxFloat m_unk0x2a0; // 0x2a0
Mx4DPointFloat m_unk0x2a4; // 0x2a4
Mx4DPointFloat m_unk0x2bc; // 0x2bc
MxBool m_selectedPartIsPlaced; // 0x2d4
MxU8 m_missclickCounter; // 0x109
MxU16 m_lastActorScript; // 0x10a
MxULong m_lastActorScriptStartTime; // 0x10c
LegoROI* m_selectedPart; // 0x110
BoundingSphere m_targetBoundingSphere; // 0x114
MxMatrix m_originalSelectedPartTransform; // 0x12c
MxBool m_alreadyFinished; // 0x174
MxMatrix m_selectedPartStartTransform; // 0x178
MxMatrix m_displayTransform; // 0x1c0
MxMatrix m_selectedPartTargetTransform; // 0x208
MxS32 m_selectedPartStartMousePosition[2]; // 0x250
LegoCarBuildAnimPresenter* m_animPresenter; // 0x258
MxQuaternionTransformer m_draggingQuarternionTransformer; // 0x25c
MxS32 m_selectedPartStartScreenPosition[2]; // 0x290
MxS32 m_selectedPartTargetScreenPosition[2]; // 0x298
MxFloat m_normalizedDistance; // 0x2a0
Mx4DPointFloat m_selectedPartStartPosition; // 0x2a4
Mx4DPointFloat m_selectedPartTargetPosition; // 0x2bc
MxBool m_displayedPartIsPlaced; // 0x2d4
// variable names verified by BETA10 0x1006b27a
MxStillPresenter* m_ColorBook_Bitmap; // 0x2dc
@@ -232,21 +244,21 @@ private:
LegoVehicleBuildState* m_buildState; // 0x32c
// variable name verified by BETA10 0x1006d742
undefined4 m_carId; // 0x330
MxS32 m_carId; // 0x330
// variable name verified by BETA10 0x1006cba7
LegoGameState::Area m_destLocation; // 0x334
MxPresenter* m_unk0x338; // 0x338
MxControlPresenter* m_unk0x33c; // 0x33c
undefined4 m_unk0x340; // 0x340
undefined4 m_unk0x344; // 0x344
MxU8 m_presentersEnabled; // 0x348
MxPresenter* m_jukeboxPresenter; // 0x338
MxControlPresenter* m_tickledControl; // 0x33c
undefined4 m_unk0x340; // 0x340
MxS32 m_playingActorScript; // 0x344
MxU8 m_presentersEnabled; // 0x348
static MxS16 g_unk0x100f11cc;
static MxFloat g_unk0x100d65a4;
static MxS16 g_lastTickleState;
static MxFloat g_selectedPartRotationAngleStepYAxis;
static MxFloat g_rotationAngleStepYAxis;
static LookupTableActions g_unk0x100d65b0[];
static LookupTableActions g_actorScripts[];
};
#endif // LEGOCARBUILD_H

View File

@@ -53,10 +53,10 @@ public:
return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name);
}
virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char* p_extra); // vtable+0x20
virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24
virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char* p_extra); // vtable+0x20
virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform); // vtable+0x24
virtual void SetWorldTransform(
const Vector3& p_location,
const Vector3& p_direction,

View File

@@ -99,7 +99,7 @@ public:
// FUNCTION: LEGO1 0x10002d60
// FUNCTION: BETA10 0x1000f820
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual MxS32 NextTargetLocation() { return 0; } // vtable+0xa0
virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8

View File

@@ -42,108 +42,108 @@ Act2Actor::Location g_brickstrLocations[] = {
};
// GLOBAL: LEGO1 0x100f0f1c
MxFloat g_unk0x100f0f1c = 0.0f;
MxFloat g_lastAnimationTime = 0.0f;
// GLOBAL: LEGO1 0x100f0f20
// GLOBAL: BETA10 0x101dbe40
MxBool g_unk0x100f0f20 = FALSE;
MxBool g_nextEntityIsBuilding = FALSE;
// GLOBAL: LEGO1 0x100f0f24
MxBool g_unk0x100f0f24 = FALSE;
// GLOBAL: LEGO1 0x100f0f28
// GLOBAL: BETA10 0x101dbe44
MxBool g_unk0x100f0f28 = FALSE;
MxBool g_playedShootSound = FALSE;
// --- All of these are indices into g_plantInfo (0x10103180) ---
// GLOBAL: LEGO1 0x100f0f30
// GLOBAL: BETA10 0x101dbe48
MxS32 g_stage0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1};
MxS32 g_location0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1};
// GLOBAL: LEGO1 0x100f0f50
// GLOBAL: BETA10 0x101dbe68
MxS32 g_stage1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
MxS32 g_location1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
// GLOBAL: LEGO1 0x100f0f90
// GLOBAL: BETA10 0x101dbea8
MxS32 g_stage2Plants[] = {12, 19, 24, 48, 60, -1};
MxS32 g_location2Plants[] = {12, 19, 24, 48, 60, -1};
// GLOBAL: LEGO1 0x100f0fa8
// GLOBAL: BETA10 0x101dbec0
MxS32 g_stage3Plants[] = {8, 15, 46, -1};
MxS32 g_location3Plants[] = {8, 15, 46, -1};
// GLOBAL: LEGO1 0x100f0fb8
// GLOBAL: BETA10 0x101dbed0
MxS32 g_stage4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
MxS32 g_location4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
// GLOBAL: LEGO1 0x100f0fe8
// GLOBAL: BETA10 0x101dbf00
MxS32 g_stage5Plants[] = {3, 40, 53, 55, -1};
MxS32 g_location5Plants[] = {3, 40, 53, 55, -1};
// GLOBAL: LEGO1 0x100f1000
// GLOBAL: BETA10 0x101dbf18
MxS32 g_stage6Plants[] = {22, 33, 41, 45, 67, -1};
MxS32 g_location6Plants[] = {22, 33, 41, 45, 67, -1};
// GLOBAL: LEGO1 0x100f1018
// GLOBAL: BETA10 0x101dbf30
MxS32 g_stage7Plants[] = {13, 30, 31, 62, -1};
MxS32 g_location7Plants[] = {13, 30, 31, 62, -1};
// GLOBAL: LEGO1 0x100f1030
// GLOBAL: BETA10 0x101dbf48
MxS32 g_stage8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
MxS32 g_location8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
// --- End of indices into g_plantInfo ---
// GLOBAL: LEGO1 0x10102b1c
// GLOBAL: BETA10 0x10209f60
undefined4 g_nextHeadWavIndex = 0;
MxU32 g_nextHeadWavIndex = 0;
// GLOBAL: LEGO1 0x10102b20
// GLOBAL: BETA10 0x10209f64
undefined4 g_nextBehindWavIndex = 0;
MxU32 g_nextBehindWavIndex = 0;
// GLOBAL: LEGO1 0x10102b24
// GLOBAL: BETA10 0x10209f68
undefined4 g_nextInterruptWavIndex = 0;
MxU32 g_nextInterruptWavIndex = 0;
// FUNCTION: LEGO1 0x100187e0
// FUNCTION: BETA10 0x1000c7fb
Act2Actor::Act2Actor()
{
m_unk0x1c = 0;
m_unk0x1d = 0;
m_unk0x1f = FALSE;
m_unk0x24 = 0;
m_unk0x20 = 0;
m_unk0x1e = 0;
m_unk0x28 = 4;
m_unk0x2c = 0;
m_unk0x30 = 0;
m_skipAnimation = FALSE;
m_targetLocation = 0;
m_animatingHit = FALSE;
m_createBrickTime = 0;
m_animationDuration = 0;
m_state = e_readyToShoot;
m_baseWorldSpeed = 4;
m_shootAnimEnd = 0;
m_entityAnimationTime = 0;
m_shootAnim = NULL;
m_unk0x44 = 0;
m_unk0x40 = 1;
m_unk0x48 = 0;
m_unk0x4c = NULL;
m_unk0x38 = NULL;
m_resetWorldSpeedAt = 0;
m_initializing = TRUE;
m_visitedLocations = 0;
m_nextEntity = NULL;
m_cachedShootSound = NULL;
m_unk0x3c = 0;
// Odd: The code says < 10, but there are 11 entries in the array
for (MxS32 i = 0; i < 10; i++) {
g_brickstrLocations[i].m_unk0x1c = FALSE;
g_brickstrLocations[i].m_cleared = FALSE;
}
}
// FUNCTION: LEGO1 0x10018940
void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform)
{
LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2);
LegoAnimActor::SetROI(p_roi, p_bool1, p_updateTransform);
m_roi->SetVisibility(FALSE);
}
// FUNCTION: LEGO1 0x10018980
// FUNCTION: BETA10 0x1000c963
void Act2Actor::FUN_10018980()
void Act2Actor::InitializeNextShot()
{
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
@@ -153,14 +153,14 @@ void Act2Actor::FUN_10018980()
assert(m_shootAnim);
m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow");
m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow");
#ifdef BETA10
// actually 0x2c and 0x30
m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
m_unk0x38->SetDistance(35, 60);
m_unk0x38->SetDistance(35, 60);
m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
m_cachedShootSound->SetDistance(35, 60);
m_cachedShootSound->SetDistance(35, 60);
#else
m_unk0x38->SetDistance(45, 55);
m_cachedShootSound->SetDistance(45, 55);
m_roi->SetVisibility(TRUE);
#endif
}
@@ -169,9 +169,9 @@ void Act2Actor::FUN_10018980()
// FUNCTION: BETA10 0x1000ca64
MxResult Act2Actor::HitActor(LegoPathActor*, MxBool)
{
if (m_unk0x1f == FALSE) {
m_unk0x1f = TRUE;
m_unk0x20 = 0;
if (m_animatingHit == FALSE) {
m_animatingHit = TRUE;
m_animationDuration = 0;
}
SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE);
@@ -187,7 +187,7 @@ MxResult Act2Actor::VTable0x9c()
return SUCCESS;
}
else {
if (m_unk0x1f) {
if (m_animatingHit) {
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] -= 3.0f;
m_roi->UpdateTransformationRelativeToParent(matrix);
@@ -209,28 +209,28 @@ void Act2Actor::Animate(float p_time)
int dummy1; // for BETA10, not sure what it is being used for
#ifndef BETA10
MxFloat local48float = 0.0f;
if (g_unk0x100f0f1c != 0.0f) {
local48float = p_time - g_unk0x100f0f1c;
MxFloat timeSinceLastAnimate = 0.0f;
if (g_lastAnimationTime != 0.0f) {
timeSinceLastAnimate = p_time - g_lastAnimationTime;
}
g_unk0x100f0f1c = p_time;
g_lastAnimationTime = p_time;
#endif
LegoAnimActor::Animate(p_time);
if (m_unk0x44 != 0.0f && m_unk0x44 < p_time) {
SetWorldSpeed(m_unk0x28);
if (m_resetWorldSpeedAt != 0.0f && m_resetWorldSpeedAt < p_time) {
SetWorldSpeed(m_baseWorldSpeed);
}
if (m_unk0x1f) {
if (m_unk0x20 > 600.0f) {
m_unk0x1f = FALSE;
m_unk0x20 = 0;
if (m_animatingHit) {
if (m_animationDuration > 600.0f) {
m_animatingHit = FALSE;
m_animationDuration = 0;
}
else {
#ifndef BETA10
m_unk0x20 += local48float;
m_animationDuration += timeSinceLastAnimate;
#endif
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 3.0f;
@@ -247,41 +247,41 @@ void Act2Actor::Animate(float p_time)
}
if (!m_grec) {
if (m_unk0x1e == 2) {
m_unk0x1e = 0;
m_unk0x2c = m_shootAnim->GetDuration() + p_time;
m_unk0x30 = m_unk0x2c - 1300.0f;
if (m_state == e_roaming) {
m_state = e_readyToShoot;
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f;
SetWorldSpeed(0);
m_unk0x1c = FALSE;
m_skipAnimation = FALSE;
}
else if (m_unk0x1e == 1) {
else if (m_state == e_endShot) {
FindROI("pwrbrik")->SetVisibility(FALSE);
FindROI("debrick")->SetVisibility(FALSE);
FindROI("ray")->SetVisibility(FALSE);
m_unk0x4c = NULL;
m_unk0x1e = 2;
VTable0xa0();
FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f);
m_nextEntity = NULL;
m_state = e_roaming;
NextTargetLocation();
SetWorldSpeed(m_baseWorldSpeed + 3, p_time + 3000.0f);
}
else if (m_unk0x1e == 0) {
if (m_unk0x40) {
m_unk0x40 = 0;
m_unk0x2c = m_shootAnim->GetDuration() + p_time;
m_unk0x30 = m_unk0x2c - 1300.0f;
else if (m_state == e_readyToShoot) {
if (m_initializing) {
m_initializing = FALSE;
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f;
}
if (FUN_10019700(p_time) == TRUE) {
if (UpdateShot(p_time) == TRUE) {
return;
}
}
else if (m_unk0x1e == 5) {
else if (m_state == e_hiding) {
FindROI("brickstr")->SetVisibility(FALSE);
GetROI()->SetVisibility(FALSE);
CurrentWorld()->RemoveActor(this);
return;
}
#ifndef BETA10
else if (m_unk0x1e == 4) {
else if (m_state == e_goingToHide) {
if (m_worldSpeed == 0.0f) {
return;
}
@@ -293,14 +293,14 @@ void Act2Actor::Animate(float p_time)
#endif
}
if (m_unk0x1e == 5 || m_unk0x1e == 4) {
if (m_state == e_hiding || m_state == e_goingToHide) {
return;
}
if (m_unk0x1e == 3) {
if (p_time - m_unk0x24 > 600.0f) {
m_unk0x1e = 2;
FUN_10019250(m_unk0x28 + 4, p_time + 15000.0f);
if (m_state == e_createdBrick) {
if (p_time - m_createBrickTime > 600.0f) {
m_state = e_roaming;
SetWorldSpeed(m_baseWorldSpeed + 4, p_time + 15000.0f);
}
}
else {
@@ -325,38 +325,38 @@ void Act2Actor::Animate(float p_time)
const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition();
const MxFloat* worldPosition = m_roi->GetWorldPosition();
MxFloat distance1 = DISTSQRD3(pepperWorldPosition, worldPosition);
MxFloat distanceToAmbulance = DISTSQRD3(pepperWorldPosition, worldPosition);
if (distance1 < 75.0f) {
if (!m_unk0x1c) {
m_unk0x1c = 1;
if (distanceToAmbulance < 75.0f) {
if (!m_skipAnimation) {
m_skipAnimation = TRUE;
if (!m_unk0x1e) {
FUN_100199f0(2);
m_unk0x1e = 1;
if (!m_state) {
PlayNextVoiceOver(VoiceOver::e_interrupt);
m_state = e_endShot;
}
else {
LegoROI* childROI = m_roi->FindChildROI("windsd", m_roi);
const MxFloat* childPosition = childROI->GetWorldPosition();
MxFloat distance2 = DISTSQRD3(pepperWorldPosition, childPosition);
MxFloat distanceToWindshield = DISTSQRD3(pepperWorldPosition, childPosition);
childROI = m_roi->FindChildROI("reardr", m_roi);
childPosition = childROI->GetWorldPosition();
MxFloat distance3 = DISTSQRD3(pepperWorldPosition, childPosition);
MxFloat distanceToRearDoor = DISTSQRD3(pepperWorldPosition, childPosition);
if (distance3 > distance2) {
FUN_100199f0(0);
if (distanceToRearDoor > distanceToWindshield) {
PlayNextVoiceOver(VoiceOver::e_head);
}
else
#ifndef BETA10
if (p_time - m_unk0x24 > 3000.0f) {
if (p_time - m_createBrickTime > 3000.0f) {
#endif
SetWorldSpeed(m_unk0x28 - 1);
m_unk0x1e = 3;
m_unk0x24 = p_time;
SetWorldSpeed(m_baseWorldSpeed - 1);
m_state = e_createdBrick;
m_createBrickTime = p_time;
if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) {
FUN_100199f0(1);
PlayNextVoiceOver(VoiceOver::e_behind);
}
#ifndef BETA10
}
@@ -365,8 +365,8 @@ void Act2Actor::Animate(float p_time)
}
}
else {
if (m_unk0x1c) {
m_unk0x1c = 0;
if (m_skipAnimation) {
m_skipAnimation = FALSE;
}
}
}
@@ -377,11 +377,11 @@ void Act2Actor::Animate(float p_time)
// FUNCTION: LEGO1 0x10019250
// FUNCTION: BETA10 0x1000d45c
void Act2Actor::FUN_10019250(MxFloat p_speed, MxFloat p_param2)
void Act2Actor::SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt)
{
// The arguments have been changed from BETA10 to LEGO1
SetWorldSpeed(p_speed);
m_unk0x44 = p_param2;
m_resetWorldSpeedAt = p_resetWorldSpeedAt;
}
// FUNCTION: LEGO1 0x10019280
@@ -389,12 +389,12 @@ void Act2Actor::FUN_10019250(MxFloat p_speed, MxFloat p_param2)
void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed)
{
LegoAnimActor::SetWorldSpeed(p_worldSpeed);
m_unk0x44 = 0;
m_resetWorldSpeedAt = 0;
}
// FUNCTION: LEGO1 0x100192a0
// FUNCTION: BETA10 0x1000d4d6
void Act2Actor::FUN_100192a0(undefined4 p_location)
void Act2Actor::FindPath(MxU32 p_location)
{
Mx3DPointFloat newPosition(0.0, 0.0, 0.0);
Mx3DPointFloat newDirection(0.0, 0.0, 0.0);
@@ -431,37 +431,37 @@ void Act2Actor::FUN_100192a0(undefined4 p_location)
}
// FUNCTION: LEGO1 0x10019520
void Act2Actor::FUN_10019520()
void Act2Actor::GoingToHide()
{
m_unk0x1e = 4;
SetWorldSpeed(m_unk0x28 + 3);
FUN_100192a0(10);
m_state = e_goingToHide;
SetWorldSpeed(m_baseWorldSpeed + 3);
FindPath(10);
}
// FUNCTION: LEGO1 0x10019560
void Act2Actor::FUN_10019560()
void Act2Actor::Hide()
{
m_unk0x1e = 5;
SetWorldSpeed(m_unk0x28 + 5);
FUN_100192a0(9);
m_state = e_hiding;
SetWorldSpeed(m_baseWorldSpeed + 5);
FindPath(9);
}
// FUNCTION: LEGO1 0x100195a0
// FUNCTION: BETA10 0x1000d7d3
MxS32 Act2Actor::VTable0xa0()
MxS32 Act2Actor::NextTargetLocation()
{
undefined4 newLocation;
MxU32 newLocation;
assert(!m_grec);
CurrentWorld();
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
if (m_unk0x48 == 8 && m_unk0x1d != 8) {
if (m_visitedLocations == 8 && m_targetLocation != 8) {
newLocation = 8;
}
else {
switch (m_unk0x1d) {
switch (m_targetLocation) {
case 0:
if (randomVal == 1) {
newLocation = 3;
@@ -536,10 +536,10 @@ MxS32 Act2Actor::VTable0xa0()
}
}
undefined4 firstChoice = newLocation;
MxU32 firstChoice = newLocation;
if (m_unk0x48 < 7 || g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
while (g_brickstrLocations[newLocation].m_unk0x1c || m_unk0x1d == newLocation) {
if (m_visitedLocations < 7 || g_brickstrLocations[m_targetLocation].m_cleared) {
while (g_brickstrLocations[newLocation].m_cleared || m_targetLocation == newLocation) {
if (newLocation == 7) {
newLocation = 0;
}
@@ -551,8 +551,8 @@ MxS32 Act2Actor::VTable0xa0()
}
}
m_unk0x1d = newLocation;
FUN_100192a0(newLocation);
m_targetLocation = newLocation;
FindPath(newLocation);
if (m_grec) {
return SUCCESS;
@@ -564,64 +564,64 @@ MxS32 Act2Actor::VTable0xa0()
// FUNCTION: LEGO1 0x10019700
// FUNCTION: BETA10 0x1000dd27
MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
MxU32 Act2Actor::UpdateShot(MxFloat p_time)
{
if (!m_unk0x4c) {
g_unk0x100f0f20 = FALSE;
m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
if (!m_nextEntity) {
g_nextEntityIsBuilding = FALSE;
m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding);
g_unk0x100f0f24 = FALSE;
g_unk0x100f0f28 = FALSE;
g_playedShootSound = FALSE;
}
if (!m_unk0x4c) {
MxTrace("nothing left to destroy at location %d\n", m_unk0x1d);
m_unk0x1e = 1;
if (!m_nextEntity) {
MxTrace("nothing left to destroy at location %d\n", m_targetLocation);
m_state = e_endShot;
if (m_unk0x1d == 8) {
if (m_targetLocation == 8) {
((LegoAct2*) CurrentWorld())->BadEnding();
}
return TRUE;
}
if (!g_unk0x100f0f28 && m_unk0x30 < p_param) {
g_unk0x100f0f28 = TRUE;
if (!g_playedShootSound && m_entityAnimationTime < p_time) {
g_playedShootSound = TRUE;
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE);
SoundManager()->GetCacheSoundManager()->Play(m_cachedShootSound, "brickstr", FALSE);
if (g_unk0x100f0f20) {
BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE);
if (g_nextEntityIsBuilding) {
BuildingManager()->ScheduleAnimation(m_nextEntity, 800, TRUE, FALSE);
}
else {
PlantManager()->ScheduleAnimation(m_unk0x4c, 800);
PlantManager()->ScheduleAnimation(m_nextEntity, 800);
}
}
if (m_unk0x2c < p_param) {
g_unk0x100f0f20 = FALSE;
m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
m_unk0x2c = m_shootAnim->GetDuration() + p_param;
m_unk0x30 = m_unk0x2c - 1300.0f;
if (m_shootAnimEnd < p_time) {
g_nextEntityIsBuilding = FALSE;
m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding);
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f;
g_unk0x100f0f24 = FALSE;
g_unk0x100f0f28 = FALSE;
g_playedShootSound = FALSE;
return FALSE;
}
m_lastTime = p_param;
m_lastTime = p_time;
LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 1.0f;
brickstrROI->SetLocal2World(matrix);
MxMatrix initialTransform = m_roi->GetLocal2World();
initialTransform[3][1] += 1.0f;
brickstrROI->SetLocal2World(initialTransform);
brickstrROI->WrappedUpdateWorldData();
Vector3 col0(matrix[0]);
Vector3 col1(matrix[1]);
Vector3 col2(matrix[2]);
Vector3 col3(matrix[3]);
Vector3 col0(initialTransform[0]);
Vector3 col1(initialTransform[1]);
Vector3 col2(initialTransform[2]);
Vector3 col3(initialTransform[3]);
col2 = col3;
col2 -= m_unk0x4c->GetROI()->GetWorldPosition();
col2 -= m_nextEntity->GetROI()->GetWorldPosition();
col2.Unitize();
col0.EqualsCross(col1, col2);
col0.Unitize();
@@ -630,10 +630,10 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
assert(!m_cameraFlag);
LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration());
MxFloat time = p_time - (m_shootAnimEnd - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::ApplyAnimationTransformation(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap());
LegoROI::ApplyAnimationTransformation(root->GetChild(i), initialTransform, time, m_shootAnim->GetROIMap());
}
return FALSE;
@@ -641,10 +641,10 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
// FUNCTION: LEGO1 0x100199f0
// FUNCTION: BETA10 0x1000e11a
void Act2Actor::FUN_100199f0(MxS8 p_param)
void Act2Actor::PlayNextVoiceOver(MxS8 p_voiceOverType)
{
switch (p_param) {
case 0:
switch (p_voiceOverType) {
case VoiceOver::e_head:
switch (g_nextHeadWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
@@ -659,7 +659,7 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
break;
}
break;
case 1:
case VoiceOver::e_behind:
switch (g_nextBehindWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
@@ -683,7 +683,7 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
break;
}
break;
case 2:
case VoiceOver::e_interrupt:
switch (g_nextInterruptWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
@@ -711,27 +711,27 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
// FUNCTION: LEGO1 0x10019b90
// FUNCTION: BETA10 0x1000e374
LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
{
MxS32 i;
LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i);
LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i);
LegoEntity* result = 0;
switch (m_unk0x1d) {
switch (m_targetLocation) {
case 0:
if (buildingInfo[12].m_counter) {
result = buildingInfo[12].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else if (buildingInfo[14].m_counter) {
result = buildingInfo[14].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage0Plants[i] != -1; i++) {
if (plantInfo[g_stage0Plants[i]].m_counter) {
result = plantInfo[g_stage0Plants[i]].m_entity;
for (i = 0; g_location0Plants[i] != -1; i++) {
if (plantInfo[g_location0Plants[i]].m_counter) {
result = plantInfo[g_location0Plants[i]].m_entity;
break;
}
}
@@ -740,12 +740,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 1:
if (buildingInfo[13].m_counter) {
result = buildingInfo[13].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage1Plants[i] != -1; i++) {
if (plantInfo[g_stage1Plants[i]].m_counter) {
result = plantInfo[g_stage1Plants[i]].m_entity;
for (i = 0; g_location1Plants[i] != -1; i++) {
if (plantInfo[g_location1Plants[i]].m_counter) {
result = plantInfo[g_location1Plants[i]].m_entity;
break;
}
}
@@ -754,16 +754,16 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 2:
if (buildingInfo[9].m_counter) {
result = buildingInfo[9].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else if (buildingInfo[11].m_counter) {
result = buildingInfo[11].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage2Plants[i] != -1; i++) {
if (plantInfo[g_stage2Plants[i]].m_counter) {
result = plantInfo[g_stage2Plants[i]].m_entity;
for (i = 0; g_location2Plants[i] != -1; i++) {
if (plantInfo[g_location2Plants[i]].m_counter) {
result = plantInfo[g_location2Plants[i]].m_entity;
break;
}
}
@@ -772,20 +772,20 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 3:
if (buildingInfo[7].m_counter) {
result = buildingInfo[7].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else if (buildingInfo[8].m_counter) {
result = buildingInfo[8].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else if (buildingInfo[3].m_counter) {
result = buildingInfo[3].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage3Plants[i] != -1; i++) {
if (plantInfo[g_stage3Plants[i]].m_counter) {
result = plantInfo[g_stage3Plants[i]].m_entity;
for (i = 0; g_location3Plants[i] != -1; i++) {
if (plantInfo[g_location3Plants[i]].m_counter) {
result = plantInfo[g_location3Plants[i]].m_entity;
break;
}
}
@@ -794,16 +794,16 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 4:
if (buildingInfo[5].m_counter) {
result = buildingInfo[5].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else if (buildingInfo[10].m_counter) {
result = buildingInfo[10].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage4Plants[i] != -1; i++) {
if (plantInfo[g_stage4Plants[i]].m_counter) {
result = plantInfo[g_stage4Plants[i]].m_entity;
for (i = 0; g_location4Plants[i] != -1; i++) {
if (plantInfo[g_location4Plants[i]].m_counter) {
result = plantInfo[g_location4Plants[i]].m_entity;
break;
}
}
@@ -812,12 +812,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 5:
if (buildingInfo[4].m_counter) {
result = buildingInfo[4].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage5Plants[i] != -1; i++) {
if (plantInfo[g_stage5Plants[i]].m_counter) {
result = plantInfo[g_stage5Plants[i]].m_entity;
for (i = 0; g_location5Plants[i] != -1; i++) {
if (plantInfo[g_location5Plants[i]].m_counter) {
result = plantInfo[g_location5Plants[i]].m_entity;
break;
}
}
@@ -826,12 +826,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 6:
if (buildingInfo[2].m_counter) {
result = buildingInfo[2].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage6Plants[i] != -1; i++) {
if (plantInfo[g_stage6Plants[i]].m_counter) {
result = plantInfo[g_stage6Plants[i]].m_entity;
for (i = 0; g_location6Plants[i] != -1; i++) {
if (plantInfo[g_location6Plants[i]].m_counter) {
result = plantInfo[g_location6Plants[i]].m_entity;
break;
}
}
@@ -840,21 +840,21 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
case 7:
if (buildingInfo[6].m_counter) {
result = buildingInfo[6].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
else {
for (i = 0; g_stage7Plants[i] != -1; i++) {
if (plantInfo[g_stage7Plants[i]].m_counter) {
result = plantInfo[g_stage7Plants[i]].m_entity;
for (i = 0; g_location7Plants[i] != -1; i++) {
if (plantInfo[g_location7Plants[i]].m_counter) {
result = plantInfo[g_location7Plants[i]].m_entity;
break;
}
}
}
break;
case 8:
for (i = 0; g_stage8Plants[i] != -1; i++) {
if (plantInfo[g_stage8Plants[i]].m_counter) {
result = plantInfo[g_stage8Plants[i]].m_entity;
for (i = 0; g_location8Plants[i] != -1; i++) {
if (plantInfo[g_location8Plants[i]].m_counter) {
result = plantInfo[g_location8Plants[i]].m_entity;
break;
}
}
@@ -865,14 +865,14 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
if (buildingInfo[15].m_counter) {
result = buildingInfo[15].m_entity;
*p_param = TRUE;
*p_isBuilding = TRUE;
}
break;
}
if (!result && !g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
g_brickstrLocations[m_unk0x1d].m_unk0x1c = TRUE;
m_unk0x48++;
if (!result && !g_brickstrLocations[m_targetLocation].m_cleared) {
g_brickstrLocations[m_targetLocation].m_cleared = TRUE;
m_visitedLocations++;
}
return result;

View File

@@ -583,11 +583,11 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8
break;
}
if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) {
if (state != NULL && state->m_finishedBuild && !state->m_playedExitScript) {
if (AnimationManager()
->FUN_10060dc0(anim, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, TRUE, TRUE) ==
SUCCESS) {
state->m_unk0x4e = TRUE;
state->m_playedExitScript = TRUE;
camAnim = FALSE;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -127,7 +127,7 @@ const char* LegoActor::GetActorName(MxU8 p_id)
// FUNCTION: LEGO1 0x1002d670
// FUNCTION: BETA10 0x1003d65f
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform)
{
if (p_roi) {
const char* name = p_roi->GetName();
@@ -141,7 +141,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
}
}
LegoEntity::SetROI(p_roi, p_bool1, p_bool2);
LegoEntity::SetROI(p_roi, p_bool1, p_updateTransform);
}
// FUNCTION: LEGO1 0x1002d6e0

View File

@@ -124,12 +124,12 @@ void LegoEntity::SetWorld()
// FUNCTION: LEGO1 0x100108a0
// FUNCTION: BETA10 0x1007e724
void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform)
{
m_roi = p_roi;
if (m_roi != NULL) {
if (p_bool2) {
if (p_updateTransform) {
MxMatrix mat;
CalcLocalTransform(
Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]),

View File

@@ -246,7 +246,7 @@ MxResult LegoAct2::Tickle()
else {
m_state = LegoAct2::e_goingToHide;
m_timeSinceLastStage = 0;
m_unk0x1138->FUN_10019520();
m_unk0x1138->GoingToHide();
}
}
@@ -631,7 +631,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
m_currentAction = Act2mainScript::c_VOhide_PlayWav;
}
m_unk0x1138->FUN_10019560();
m_unk0x1138->Hide();
m_state = LegoAct2::e_hidden;
m_timeSinceLastStage = 0;
@@ -1223,6 +1223,6 @@ MxResult LegoAct2::InitializeShooting()
ap->FUN_1006d680(m_unk0x1138, -1.0f);
actor->SetWorldSpeed(0.0f);
m_unk0x1138->FUN_10018980();
m_unk0x1138->InitializeNextShot();
return SUCCESS;
}

View File

@@ -9,12 +9,6 @@
// LIBRARY: LEGO1 0x10086260
// ??3@YAXPAX@Z
// LIBRARY: LEGO1 0x1008a090
// _malloc
// LIBRARY: LEGO1 0x1008a100
// _calloc
// LIBRARY: LEGO1 0x1008a1c0
// _free
@@ -937,8 +931,31 @@
// GLOBAL: LEGO1 0x100db6e0
// GUID_SysKeyboard
// Cannot be handled right now due to anonymous pointer in struct
// GLOBAL: LEGO1 0x100dd1c0
// IID_IDirect3DRM2
// LIBRARY: LEGO1 0x1008c960
// ?_query_new_handler@@YAP6AHI@ZXZ
// LIBRARY: LEGO1 0x1008c970
// ?_query_new_mode@@YAHXZ
// GLOBAL: LEGO1 0x100fd8ec
// __newmode
// Cannot be handled right now due to anonymous pointer in struct.
// We can annotate it on the original side, but we have no symbol on the recomp side.
// We would need a way of annotating "the pointer at c_dfDIKeyboard+0x14 has orig address 0x10097f80".
// // GLOBAL: LEGO1 0x10098f80
// c_dfDIKeyboard
/// Globals from libraries without symbols
// STRING: LEGO1 0x100dabb0
static const char* ___crtLCMapStringA_str = "\0";
// STRING: LEGO1 0x100dabb4
static const wchar_t *___crtLCMapStringA_wstr = L"\0";
#endif

312
LEGO1/library_smartheap.h Normal file
View File

@@ -0,0 +1,312 @@
#if 0
// LIBRARY: LEGO1 0x100861d0
// ?shi_New@@YAPAXKIPAU_SHI_Pool@@@Z
// LIBRARY: LEGO1 0x10086270
// _MemInitDefaultPool@0
// LIBRARY: LEGO1 0x100862e0
// _shi_call_new_handler_msc
// LIBRARY: LEGO1 0x10086310
// _MemPoolShrink@4
// LIBRARY: LEGO1 0x10086440
// _MemPoolPreAllocate@12
// LIBRARY: LEGO1 0x100865c0
// @_shi_initPageHeaders@4
// LIBRARY: LEGO1 0x10086830
// @shi_allocPageHeader@4
// LIBRARY: LEGO1 0x10086860
// @shi_freePageHeader@8
// LIBRARY: LEGO1 0x10086a10
// @_shi_deletePage@8
// LIBRARY: LEGO1 0x10086af0
// @_shi_allocExternal@12
// LIBRARY: LEGO1 0x10086d10
// @_shi_initPageVariable@8
// LIBRARY: LEGO1 0x10086dc0
// _MemAllocPtr@12
// LIBRARY: LEGO1 0x10087020
// @_shi_allocVar@12
// LIBRARY: LEGO1 0x100871b0
// @_shi_allocBlock@12
// LIBRARY: LEGO1 0x10087380
// _MemFreePtr@4
// LIBRARY: LEGO1 0x10087430
// @_shi_freeVar@4
// LIBRARY: LEGO1 0x10087520
// _MemReAllocPtr@12
// LIBRARY: LEGO1 0x10087670
// @_shi_resizeAny@16
// LIBRARY: LEGO1 0x10087910
// @_shi_resizeVar@8
// LIBRARY: LEGO1 0x10087ae0
// _MemSizePtr@4
// LIBRARY: LEGO1 0x10087b90
// @shi_findAllocAddress@4
// LIBRARY: LEGO1 0x10087bd0
// @_shi_sysAlloc@8
// LIBRARY: LEGO1 0x10087c60
// @_shi_sysFree@4
// LIBRARY: LEGO1 0x10087cc0
// @_shi_sysRealloc@12
// LIBRARY: LEGO1 0x10087d70
// @_shi_sysResize@12
// LIBRARY: LEGO1 0x10087e50
// @_shi_sysSize@4
// LIBRARY: LEGO1 0x10087e90
// @_shi_sysAllocNear@4
// LIBRARY: LEGO1 0x10087eb0
// @_shi_sysFreeNear@4
// LIBRARY: LEGO1 0x10087ed0
// @_shi_sysValidatePtr@12
// LIBRARY: LEGO1 0x10087fd0
// @_shi_sysValidateFunction@4
// LIBRARY: LEGO1 0x100885c0
// @_shi_sysAllocPool@12
// LIBRARY: LEGO1 0x100887e0
// @_shi_sysResizePool@16
// LIBRARY: LEGO1 0x10088950
// @_shi_sysFreePage@4
// LIBRARY: LEGO1 0x10088a70
// @_shi_sysSizePage@4
// LIBRARY: LEGO1 0x10088aa0
// @_shi_sysSizePool@8
// LIBRARY: LEGO1 0x10088ac0
// @_shi_registerShared@16
// LIBRARY: LEGO1 0x10088cc0
// @_shi_unregisterShared@8
// LIBRARY: LEGO1 0x10088de0
// @_shi_getNextPool@4
// LIBRARY: LEGO1 0x10088df0
// @shi_delNextPool@4
// LIBRARY: LEGO1 0x10088ff0
// @shi_createAndEnterMutexShr@12
// LIBRARY: LEGO1 0x100890e0
// @shi_termPoolMutexShr@4
// LIBRARY: LEGO1 0x10089100
// @shi_enterPoolMutexShr@4
// LIBRARY: LEGO1 0x10089120
// @shi_leavePoolMutexShr@4
// LIBRARY: LEGO1 0x10089140
// __shi_enterCriticalSection@0
// LIBRARY: LEGO1 0x10089160
// __shi_leaveCriticalSection@0
// LIBRARY: LEGO1 0x10089180
// __shi_createAndEnterMutex
// LIBRARY: LEGO1 0x100891b0
// _shi_enterPoolMutexSafely
// LIBRARY: LEGO1 0x10089290
// _shi_enterPoolInitMutexReader
// LIBRARY: LEGO1 0x10089320
// _shi_leavePoolInitMutexReader
// LIBRARY: LEGO1 0x10089350
// _shi_enterPoolInitMutexWriter
// LIBRARY: LEGO1 0x10089420
// _shi_leavePoolInitMutexWriter
// LIBRARY: LEGO1 0x10089440
// _shi_isNT
// LIBRARY: LEGO1 0x10089470
// _MemPoolInit@4
// LIBRARY: LEGO1 0x100897e0
// _MemPoolSetPageSize@8
// LIBRARY: LEGO1 0x100898f0
// _MemPoolSetBlockSizeFS@8
// LIBRARY: LEGO1 0x100899d0
// @_shi_poolFree@8
// LIBRARY: LEGO1 0x10089b80
// @_shi_invokeErrorHandler1@8
// LIBRARY: LEGO1 0x10089ea0
// _MemErrorUnwind@0
// LIBRARY: LEGO1 0x10089ef0
// _MemDefaultErrorHandler@4
// LIBRARY: LEGO1 0x10089f70
// @_shi_taskRemovePool@4
// LIBRARY: LEGO1 0x1008a010
// @_shi_getCurrentThreadContext@8
// LIBRARY: LEGO1 0x1008a070
// @_shi_deleteThreadContext@8
// LIBRARY: LEGO1 0x1008a090
// _malloc
// LIBRARY: LEGO1 0x1008a100
// _calloc
// LIBRARY: LEGO1 0x1008a160
// _realloc
// LIBRARY: LEGO1 0x1008a1d0
// __expand
// LIBRARY: LEGO1 0x1008a210
// __heapadd
// LIBRARY: LEGO1 0x1008a220
// __heapwalk
// LIBRARY: LEGO1 0x1008a2b0
// __heapused
// LIBRARY: LEGO1 0x1008a2e0
// __heapmin
// LIBRARY: LEGO1 0x1008a300
// __msize
// LIBRARY: LEGO1 0x1008a310
// __heapchk
// LIBRARY: LEGO1 0x1008a340
// __heapset
// LIBRARY: LEGO1 0x1008a350
// @_shi_sysReportError@16
// LIBRARY: LEGO1 0x1008a3d0
// _MemPoolSize@4
// LIBRARY: LEGO1 0x1008a460
// _MemPoolWalk@8
// LIBRARY: LEGO1 0x1008a500
// @_shi_walkPool@16
// LIBRARY: LEGO1 0x1008a800
// @shi_isBlockInUseSmall@8
// LIBRARY: LEGO1 0x1008aac0
// @_shi_isBlockInUseFS@12
// LIBRARY: LEGO1 0x1008ab40
// _MemPoolCheck@4
// LIBRARY: LEGO1 0x1008ade0
// _MemCheckPtr@8
// GLOBAL: LEGO1 0x100da970
// _szLibName
// GLOBAL: LEGO1 0x100fc528
// ?_new_handler@@3P6AXXZA
// GLOBAL: LEGO1 0x100fc530
// _MemDefaultPool
// GLOBAL: LEGO1 0x100fc54c
// __shi_compactPoolFn
// GLOBAL: LEGO1 0x100fc550
// __shi_compactPageFn
// GLOBAL: LEGO1 0x100fc554
// _MemDefaultPoolFlags
// GLOBAL: LEGO1 0x100fc55c
// __shi_mutexGlobalInit
// GLOBAL: LEGO1 0x100fc560
// __shi_mutexMovInit
// GLOBAL: LEGO1 0x100fc564
// __shi_mutexMovLockCount
// GLOBAL: LEGO1 0x100fc568
// _shi_initPoolReaders
// GLOBAL: LEGO1 0x100fc56c
// _shi_eventInitPool
// GLOBAL: LEGO1 0x100fc570
// _shi_mutexMovShr
// GLOBAL: LEGO1 0x100fc598
// _shi_deferFreePools
// GLOBAL: LEGO1 0x100fc5a8
// __shi_poolTerminating
// GLOBAL: LEGO1 0x100fc5ac
// _MemDefaultPoolBlockSizeFS
// GLOBAL: LEGO1 0x100fc5b0
// _MemDefaultPoolPageSize
// GLOBAL: LEGO1 0x100fc5b4
// _SmartHeap_malloc
// GLOBAL: LEGO1 0x100fc7e0
// __shi_TaskRecord
// GLOBAL: LEGO1 0x10109368
// ?_pnhHeap@@3P6AHI@ZA
// GLOBAL: LEGO1 0x101095a0
// __shi_mutexMov
// GLOBAL: LEGO1 0x101095c0
// _shi_mutexPoolSynch
// GLOBAL: LEGO1 0x101095e0
// __shi_mutexGlobal
#endif

View File

@@ -14,10 +14,10 @@ public:
// FUNCTION: LEGO1 0x10032770
// FUNCTION: BETA10 0x1001ff30
MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); }
// FUNCTION: BETA10 0x1000fc20
MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); }
// FUNCTION: BETA10 0x10010860
float* operator[](int idx) { return m_data[idx]; }
@@ -25,10 +25,10 @@ public:
const float* operator[](int idx) const { return m_data[idx]; }
// FUNCTION: LEGO1 0x10002850
void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28
void operator=(const Matrix4& p_matrix) override { CopyFrom(p_matrix); } // vtable+0x28
// FUNCTION: LEGO1 0x10002860
virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48
virtual void operator=(const MxMatrix& p_matrix) { CopyFrom(p_matrix); } // vtable+0x48
private:
float m_elements[4][4]; // 0x08

View File

@@ -11,7 +11,7 @@
DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c);
// GLOBAL LEGO1 0x10101420
// GLOBAL: LEGO1 0x10101420
MxS32 g_volumeAttenuation[100] = {-6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058,
-2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058,
-2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473,

View File

@@ -22,8 +22,8 @@ public:
// FUNCTION: BETA10 0x1000fc70
Matrix4(float (*p_data)[4]) { SetData(p_data); }
inline virtual void Equals(float (*p_data)[4]); // vtable+0x04
inline virtual void Equals(const Matrix4& p_matrix); // vtable+0x00
inline virtual void CopyFrom(float (*p_data)[4]); // vtable+0x04
inline virtual void CopyFrom(const Matrix4& p_matrix); // vtable+0x00
inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c
inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08
inline virtual float (*GetData())[4]; // vtable+0x14

View File

@@ -8,14 +8,14 @@
// FUNCTION: LEGO1 0x10002320
// FUNCTION: BETA10 0x1000fcb0
void Matrix4::Equals(float (*p_data)[4])
void Matrix4::CopyFrom(float (*p_data)[4])
{
memcpy(m_data, p_data, sizeof(float) * 4 * 4);
}
// FUNCTION: LEGO1 0x10002340
// FUNCTION: BETA10 0x1000fcf0
void Matrix4::Equals(const Matrix4& p_matrix)
void Matrix4::CopyFrom(const Matrix4& p_matrix)
{
memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4);
}
@@ -84,7 +84,7 @@ void Matrix4::SetIdentity()
// FUNCTION: BETA10 0x1000ff20
void Matrix4::operator=(const Matrix4& p_matrix)
{
Equals(p_matrix);
CopyFrom(p_matrix);
}
// FUNCTION: LEGO1 0x10002430

View File

@@ -88,8 +88,7 @@ inline Result RendererCreateDevice(
if (Succeeded(result)) {
if (rCreateData.m_pBackBuffer) {
// LEGO1 0x10101040
// GLOBAL: BETA10 0x102055f4
// annotated below
static int g_setBufferCount = 1;
if (g_setBufferCount) {
Result result2 = ResultVal(rpDevice->SetBufferCount(2));
@@ -101,6 +100,10 @@ inline Result RendererCreateDevice(
return result;
}
// GLOBAL: LEGO1 0x10101040
// GLOBAL: BETA10 0x102055f4
// ?g_setBufferCount@?3??RendererCreateDevice@@YA?AW4Result@Tgl@@PAUIDirect3DRM2@@ABUDeviceDirectDrawCreateData@3@AAPAUIDirect3DRMDevice2@@@Z@4HA
// FUNCTION: BETA10 0x1016cf40
inline Result RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice)
{

View File

@@ -38,6 +38,10 @@ targets:
- 0x100fb080
# memset etc.
- 0x100f9570
name-substitutions:
# Rename matched functions named like `FUN_12345678` to `LEGO1_12345678`
# so we can distinguish them from non-matched functions
- ["FUN_([0-9a-f]{8})", "LEGO1_\\1"]
ALPHA:
filename: ALPHA.DLL
source-root: LEGO1