Compare commits

11 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
Fabian Neundorf
ef2d438a7d Clear unknowns in LegoCarBuildAnimPresenter (#1683) 2025-09-07 15:07:39 -07:00
Fabian Neundorf
e3b77fb50b Clear unknowns in LegoAct2 (#1679) 2025-09-07 22:54:22 +02:00
24 changed files with 1369 additions and 983 deletions

View File

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

View File

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

View File

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

View File

@@ -80,10 +80,10 @@ public:
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
MxResult FUN_100516b0(); MxResult CreateBrick();
void FUN_100517b0(); void FUN_100517b0();
MxResult BadEnding(); MxResult BadEnding();
MxResult FUN_10052560( MxResult StartAction(
Act2mainScript::Script p_objectId, Act2mainScript::Script p_objectId,
MxBool p_param2, MxBool p_param2,
MxBool p_param3, MxBool p_param3,
@@ -96,42 +96,59 @@ public:
// LegoAct2::`scalar deleting destructor' // LegoAct2::`scalar deleting destructor'
private: private:
enum {
e_initial = 0,
e_startSpeech = 1,
e_holdingSpeech = 2,
e_startDescription = 3,
e_explaining = 4,
e_goingToResidentialArea = 5,
e_atResidentialArea = 6,
e_chase = 7,
e_droppingBrick = 9,
e_goingToHide = 10,
e_hidden = 11,
e_distributeRemainingBricks = 12,
e_brickHunt = 13,
e_allPiecesCollected = 14,
};
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleTransitionEnd(); MxLong HandleTransitionEnd();
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void PlayMusic(JukeboxScript::Script p_objectId); void PlayMusic(JukeboxScript::Script p_objectId);
void FUN_10051900(); void FUN_10051900();
void FUN_10051960(); void HideMaPaInfo();
void InitBricks(); void InitBricks();
void UninitBricks(); void UninitBricks();
void SpawnBricks(); void SpawnBricks();
void FUN_10051fa0(MxS32 p_param1); void CheckBricksterDestroying(MxS32 p_pathData);
void FUN_100521f0(MxS32 p_param1); void CheckBricksterIsLoose(MxS32 p_pathData);
MxResult FUN_10052800(); MxResult InitializeShooting();
Act2Brick m_bricks[10]; // 0x00f8 Act2Brick m_bricks[10]; // 0x00f8
MxU8 m_nextBrick; // 0x10c0 MxU8 m_nextBrick; // 0x10c0
undefined m_unk0x10c1; // 0x10c1 MxU8 m_removedBricks; // 0x10c1
MxBool m_ready; // 0x10c2 MxBool m_ready; // 0x10c2
undefined4 m_unk0x10c4; // 0x10c4 undefined4 m_state; // 0x10c4
JukeboxScript::Script m_music; // 0x10c8 JukeboxScript::Script m_music; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc LegoAct2State* m_gameState; // 0x10cc
MxS32 m_unk0x10d0; // 0x10d0 MxS32 m_timeSinceLastStage; // 0x10d0
// variable name verified by BETA10 0x10014633 // variable name verified by BETA10 0x10014633
const char* m_siFile; // 0x10d4 const char* m_siFile; // 0x10d4
LegoROI* m_pepper; // 0x10d8 LegoROI* m_pepper; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc MxMatrix m_transformOnDisable; // 0x10dc
LegoPathBoundary* m_unk0x1124; // 0x1124 LegoPathBoundary* m_boundaryOnDisable; // 0x1124
LegoROI* m_ambulance; // 0x1128 LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134 undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138 Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_unk0x1140; // 0x1140 Act2mainScript::Script m_currentAction; // 0x1140
Act2mainScript::Script m_unk0x1144; // 0x1144 Act2mainScript::Script m_infomanDirecting; // 0x1144
undefined4 m_unk0x1148; // 0x1148 undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d undefined m_secondBrick; // 0x114d

View File

@@ -41,7 +41,7 @@ public:
} }
void ParseAction(char* p_extra) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24
// FUNCTION: LEGO1 0x10002cc0 // FUNCTION: LEGO1 0x10002cc0
// FUNCTION: BETA10 0x1000f3e0 // FUNCTION: BETA10 0x1000f3e0

View File

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

View File

@@ -21,10 +21,10 @@ public:
}; };
// SIZE 0x0c // SIZE 0x0c
struct UnknownListEntry { struct CarBuildPart {
// FUNCTION: LEGO1 0x100795c0 // FUNCTION: LEGO1 0x100795c0
// FUNCTION: BETA10 0x10073850 // FUNCTION: BETA10 0x10073850
UnknownListEntry() CarBuildPart()
{ {
m_name = NULL; m_name = NULL;
m_wiredName = NULL; m_wiredName = NULL;
@@ -74,7 +74,7 @@ public:
virtual MxResult Serialize(LegoStorage* p_storage); virtual MxResult Serialize(LegoStorage* p_storage);
void FUN_10079050(MxS16 p_index); void MakePartPlaced(MxS16 p_index);
void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2); void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2);
void InitBuildPlatform(); void InitBuildPlatform();
void HideBuildPartByName(LegoChar* p_param); void HideBuildPartByName(LegoChar* p_param);
@@ -83,7 +83,7 @@ public:
LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name); LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
void AddPartToBuildByName(const LegoChar* p_name); void AddPartToBuildByName(const LegoChar* p_name);
void RotateAroundYAxis(MxFloat p_angle); void RotateAroundYAxis(MxFloat p_angle);
MxBool FUN_10079c30(const LegoChar* p_name); MxBool IsNextPartToPlace(const LegoChar* p_name);
MxBool PartIsPlaced(const LegoChar* p_name); MxBool PartIsPlaced(const LegoChar* p_name);
void MoveShelfForward(); void MoveShelfForward();
MxBool StringEqualsPlatform(const LegoChar* p_string); MxBool StringEqualsPlatform(const LegoChar* p_string);
@@ -102,7 +102,7 @@ public:
MxBool StringEndsOnW(LegoChar* p_param); MxBool StringEndsOnW(LegoChar* p_param);
MxBool StringEndsOnYOrN(const LegoChar* p_string); MxBool StringEndsOnYOrN(const LegoChar* p_string);
const BoundingSphere& FUN_10079e20(); const BoundingSphere& GetTargetBoundingSphere();
// FUNCTION: BETA10 0x100703e0 // FUNCTION: BETA10 0x100703e0
const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; } const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; }
@@ -121,7 +121,7 @@ public:
// LegoCarBuildAnimPresenter::`scalar deleting destructor' // LegoCarBuildAnimPresenter::`scalar deleting destructor'
private: private:
void Beta10Inline0x100733d0(); void UpdateFlashingPartVisibility();
MxU16 m_shelfState; // 0xbc MxU16 m_shelfState; // 0xbc
@@ -136,13 +136,13 @@ private:
MxMatrix m_buildViewMatrix; // 0xe0 MxMatrix m_buildViewMatrix; // 0xe0
// variable name verified by BETA10 0x100719f0 // variable name verified by BETA10 0x100719f0
UnknownListEntry* m_parts; // 0x128 CarBuildPart* m_parts; // 0x128
MxFloat m_shelfFrameBuffer; // 0x12c MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_shelfFrame; // 0x130 MxFloat m_shelfFrame; // 0x130
MxFloat m_shelfFrameMax; // 0x134 MxFloat m_shelfFrameMax; // 0x134
MxFloat m_shelfFrameInterval; // 0x138 MxFloat m_shelfFrameInterval; // 0x138
MxULong m_unk0x13c; // 0x13c MxULong m_flashingPartTimeState; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140 LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144 MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148 MxS32 m_unk0x148; // 0x148

View File

@@ -56,7 +56,7 @@ public:
virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char* p_extra); // vtable+0x20 virtual void ParseAction(char* p_extra); // vtable+0x20
virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform); // vtable+0x24
virtual void SetWorldTransform( virtual void SetWorldTransform(
const Vector3& p_location, const Vector3& p_location,
const Vector3& p_direction, const Vector3& p_direction,

View File

@@ -99,7 +99,7 @@ public:
// FUNCTION: LEGO1 0x10002d60 // FUNCTION: LEGO1 0x10002d60
// FUNCTION: BETA10 0x1000f820 // 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 VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8 virtual void VTable0xa8(); // vtable+0xa8

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@
#include "mxtimer.h" #include "mxtimer.h"
#include "realtime/realtime.h" #include "realtime/realtime.h"
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::UnknownListEntry, 0x0c) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c)
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: LEGO1 0x10078400 // FUNCTION: LEGO1 0x10078400
@@ -32,7 +32,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
m_shelfFrameBuffer = 0; m_shelfFrameBuffer = 0;
m_shelfFrameMax = 0; m_shelfFrameMax = 0;
m_shelfFrameInterval = 0; m_shelfFrameInterval = 0;
m_unk0x13c = 0; m_flashingPartTimeState = 0;
m_carBuildEntity = NULL; m_carBuildEntity = NULL;
m_unk0x144 = -1; m_unk0x144 = -1;
m_unk0x148 = -1; m_unk0x148 = -1;
@@ -60,28 +60,28 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
} }
// FUNCTION: BETA10 0x100733d0 // FUNCTION: BETA10 0x100733d0
inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0() inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility()
{ {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
MxLong bvar5; MxLong showFlashingPart;
if (m_unk0x13c < time) { if (m_flashingPartTimeState < time) {
bvar5 = FALSE; showFlashingPart = FALSE;
// I have no idea why this conditional is so convoluted // I have no idea why this conditional is so convoluted
if (m_unk0x13c & c_bit1) { if (m_flashingPartTimeState & c_bit1) {
bvar5 = TRUE; showFlashingPart = TRUE;
m_unk0x13c = time + 400; m_flashingPartTimeState = time + 400;
} }
else { else {
m_unk0x13c = time + 200; m_flashingPartTimeState = time + 200;
} }
if (bvar5) { if (showFlashingPart) {
m_unk0x13c &= ~c_bit1; m_flashingPartTimeState &= ~c_bit1;
} }
else { else {
m_unk0x13c |= c_bit1; m_flashingPartTimeState |= c_bit1;
} }
if (m_placedPartCount < m_numberOfParts) { if (m_placedPartCount < m_numberOfParts) {
@@ -96,7 +96,7 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
const LegoChar* name = roi->GetName(); const LegoChar* name = roi->GetName();
if (name && stricmp(wiredName, name) == 0) { if (name && stricmp(wiredName, name) == 0) {
if (bvar5) { if (showFlashingPart) {
roi->SetVisibility(TRUE); roi->SetVisibility(TRUE);
} }
else { else {
@@ -127,7 +127,7 @@ void LegoCarBuildAnimPresenter::PutFrame()
break; break;
} }
Beta10Inline0x100733d0(); UpdateFlashingPartVisibility();
} }
// FUNCTION: LEGO1 0x100788c0 // FUNCTION: LEGO1 0x100788c0
@@ -209,7 +209,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
} }
if (i < m_placedPartCount) { if (i < m_placedPartCount) {
FUN_10079050(i); MakePartPlaced(i);
ShowBuildPartByName(m_parts[i].m_name); ShowBuildPartByName(m_parts[i].m_name);
} }
@@ -316,7 +316,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10079050 // FUNCTION: LEGO1 0x10079050
// FUNCTION: BETA10 0x1007151e // FUNCTION: BETA10 0x1007151e
void LegoCarBuildAnimPresenter::FUN_10079050(MxS16 p_index) void LegoCarBuildAnimPresenter::MakePartPlaced(MxS16 p_index)
{ {
SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name); SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
HideBuildPartByName(m_parts[p_index].m_wiredName); HideBuildPartByName(m_parts[p_index].m_wiredName);
@@ -382,7 +382,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
} }
assert(m_numberOfParts); assert(m_numberOfParts);
m_parts = new UnknownListEntry[m_numberOfParts]; m_parts = new CarBuildPart[m_numberOfParts];
assert(m_parts); assert(m_parts);
// Go through and add the wired name of each part // Go through and add the wired name of each part
@@ -551,7 +551,7 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
strcpy(m_parts[i].m_name, buffer); strcpy(m_parts[i].m_name, buffer);
Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId); Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId);
} }
FUN_10079050(m_placedPartCount); MakePartPlaced(m_placedPartCount);
m_placedPartCount++; m_placedPartCount++;
((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount); ((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount);
@@ -644,7 +644,7 @@ MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string)
// FUNCTION: LEGO1 0x10079c30 // FUNCTION: LEGO1 0x10079c30
// FUNCTION: BETA10 0x100726a6 // FUNCTION: BETA10 0x100726a6
MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name) MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name)
{ {
if (PartIsPlaced(p_name)) { if (PartIsPlaced(p_name)) {
return FALSE; return FALSE;
@@ -708,7 +708,7 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx
// FUNCTION: LEGO1 0x10079e20 // FUNCTION: LEGO1 0x10079e20
// FUNCTION: BETA10 0x10072959 // FUNCTION: BETA10 0x10072959
const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() const BoundingSphere& LegoCarBuildAnimPresenter::GetTargetBoundingSphere()
{ {
LegoROI* roi = m_carBuildEntity->GetROI(); LegoROI* roi = m_carBuildEntity->GetROI();
return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere(); return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere();

View File

@@ -127,7 +127,7 @@ const char* LegoActor::GetActorName(MxU8 p_id)
// FUNCTION: LEGO1 0x1002d670 // FUNCTION: LEGO1 0x1002d670
// FUNCTION: BETA10 0x1003d65f // 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) { if (p_roi) {
const char* name = p_roi->GetName(); 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 // FUNCTION: LEGO1 0x1002d6e0

View File

@@ -124,12 +124,12 @@ void LegoEntity::SetWorld()
// FUNCTION: LEGO1 0x100108a0 // FUNCTION: LEGO1 0x100108a0
// FUNCTION: BETA10 0x1007e724 // 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; m_roi = p_roi;
if (m_roi != NULL) { if (m_roi != NULL) {
if (p_bool2) { if (p_updateTransform) {
MxMatrix mat; MxMatrix mat;
CalcLocalTransform( CalcLocalTransform(
Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]), Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]),

View File

@@ -33,11 +33,11 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154)
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
// GLOBAL: LEGO1 0x100f4474 // GLOBAL: LEGO1 0x100f4474
Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0; Act2mainScript::Script g_bricksterSpeech = (Act2mainScript::Script) 0;
// GLOBAL: LEGO1 0x100f43f0 // GLOBAL: LEGO1 0x100f43f0
// GLOBAL: BETA10 0x101e14a8 // GLOBAL: BETA10 0x101e14a8
MxS32 g_unk0x100f43f0[] = { MxS32 g_animationsBricksterIsLoose[] = {
Act2mainScript::c_tns030bd_RunAnim, Act2mainScript::c_tns030bd_RunAnim,
Act2mainScript::c_tns030pg_RunAnim, Act2mainScript::c_tns030pg_RunAnim,
Act2mainScript::c_tns030rd_RunAnim, Act2mainScript::c_tns030rd_RunAnim,
@@ -49,7 +49,7 @@ MxS32 g_unk0x100f43f0[] = {
}; };
// GLOBAL: LEGO1 0x100f4410 // GLOBAL: LEGO1 0x100f4410
const LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"}; const LegoChar* g_charactersBricksterIsLoose[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
// GLOBAL: LEGO1 0x100f4428 // GLOBAL: LEGO1 0x100f4428
MxS32 g_unk0x100f4428[] = { MxS32 g_unk0x100f4428[] = {
@@ -74,17 +74,17 @@ const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd",
// FUNCTION: BETA10 0x1003a5a0 // FUNCTION: BETA10 0x1003a5a0
LegoAct2::LegoAct2() LegoAct2::LegoAct2()
{ {
m_unk0x10c4 = 0; m_state = LegoAct2::e_initial;
m_gameState = NULL; m_gameState = NULL;
m_pepper = NULL; m_pepper = NULL;
m_ambulance = NULL; m_ambulance = NULL;
m_ready = FALSE; m_ready = FALSE;
m_unk0x1130 = 0; m_unk0x1130 = 0;
m_nextBrick = 0; m_nextBrick = 0;
m_unk0x10c1 = 0; m_removedBricks = 0;
m_unk0x1138 = NULL; m_unk0x1138 = NULL;
m_unk0x1140 = (Act2mainScript::Script) 0; m_currentAction = (Act2mainScript::Script) 0;
m_unk0x1144 = (Act2mainScript::Script) 0; m_infomanDirecting = (Act2mainScript::Script) 0;
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
m_music = JukeboxScript::c_MusicTheme1; m_music = JukeboxScript::c_MusicTheme1;
m_siFile = ""; m_siFile = "";
@@ -166,97 +166,97 @@ MxResult LegoAct2::Tickle()
return SUCCESS; return SUCCESS;
} }
switch (m_unk0x10c4) { switch (m_state) {
case 0: case LegoAct2::e_initial:
m_unk0x10c4 = 1; m_state = LegoAct2::e_startSpeech;
break; break;
case 1: case LegoAct2::e_startSpeech:
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
switch (rand() % 3) { switch (rand() % 3) {
case 0: case 0:
g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim; g_bricksterSpeech = Act2mainScript::c_tns002br_RunAnim;
break; break;
case 1: case 1:
g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim; g_bricksterSpeech = Act2mainScript::c_tns003br_RunAnim;
break; break;
case 2: case 2:
g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim; g_bricksterSpeech = Act2mainScript::c_tns004br_RunAnim;
break; break;
} }
FUN_10052560(g_unk0x100f4474, TRUE, TRUE, NULL, NULL, NULL); StartAction(g_bricksterSpeech, TRUE, TRUE, NULL, NULL, NULL);
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
m_unk0x10c4 = 2; m_state = LegoAct2::e_holdingSpeech;
break; break;
case 2: case LegoAct2::e_holdingSpeech:
if (g_unk0x100f4474) { if (g_bricksterSpeech) {
if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) { if (AnimationManager()->FUN_10064ee0(g_bricksterSpeech)) {
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
g_unk0x100f4474 = (Act2mainScript::Script) 0; g_bricksterSpeech = (Act2mainScript::Script) 0;
} }
} }
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
break; break;
case 3: case LegoAct2::e_startDescription:
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
m_unk0x10c4 = 4; m_state = LegoAct2::e_explaining;
FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); StartAction(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f43f0, sizeOfArray(g_unk0x100f43f0)); AnimationManager()->FUN_100604f0(g_animationsBricksterIsLoose, sizeOfArray(g_animationsBricksterIsLoose));
AnimationManager()->FUN_10060480(g_unk0x100f4410, sizeOfArray(g_unk0x100f4410)); AnimationManager()->FUN_10060480(g_charactersBricksterIsLoose, sizeOfArray(g_charactersBricksterIsLoose));
break; break;
case 4: case LegoAct2::e_explaining:
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
break; break;
case 5: case LegoAct2::e_goingToResidentialArea:
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
if (m_unk0x10d0 == 20000) { if (m_timeSinceLastStage == 20000) {
const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition(); const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition();
MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f}; MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f};
distance = DISTSQRD3(pepperPosition, otherPoint); distance = DISTSQRD3(pepperPosition, otherPoint);
if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) { if (m_infomanDirecting == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav; m_infomanDirecting = Act2mainScript::c_Avo906In_PlayWav;
} }
} }
else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) { else if (m_timeSinceLastStage >= 90000 && m_timeSinceLastStage % 90000 == 0 && m_infomanDirecting == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav; m_infomanDirecting = Act2mainScript::c_Avo908In_PlayWav;
} }
break; break;
case 6: case LegoAct2::e_atResidentialArea:
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
break; break;
case 9: case LegoAct2::e_droppingBrick:
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
if (m_unk0x10d0 >= 200) { if (m_timeSinceLastStage >= 200) {
if (m_nextBrick < 5) { if (m_nextBrick < 5) {
m_unk0x10c4 = 7; m_state = LegoAct2::e_chase;
} }
else { else {
m_unk0x10c4 = 10; m_state = LegoAct2::e_goingToHide;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
m_unk0x1138->FUN_10019520(); m_unk0x1138->GoingToHide();
} }
} }
break; break;
case 10: case LegoAct2::e_goingToHide:
m_unk0x10d0 += 50; m_timeSinceLastStage += 50;
break; break;
case 11: case LegoAct2::e_hidden:
break; break;
case 12: case LegoAct2::e_distributeRemainingBricks:
break; break;
} }
@@ -297,9 +297,9 @@ MxLong LegoAct2::Notify(MxParam& p_param)
case c_notificationAct2Brick: case c_notificationAct2Brick:
SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE);
m_unk0x10c1++; m_removedBricks++;
if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) { if (m_removedBricks == 10 && m_state == LegoAct2::e_brickHunt) {
m_unk0x10c4 = 14; m_state = LegoAct2::e_allPiecesCollected;
LegoEntity* entity = (LegoEntity*) param.GetSender(); LegoEntity* entity = (LegoEntity*) param.GetSender();
@@ -326,10 +326,10 @@ MxLong LegoAct2::Notify(MxParam& p_param)
Mx3DPointFloat locald4(local2world[2]); Mx3DPointFloat locald4(local2world[2]);
Mx3DPointFloat localc0(local2world[1]); Mx3DPointFloat localc0(local2world[1]);
FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL); StartAction(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL);
m_unk0x10c4 = 14; m_state = LegoAct2::e_allPiecesCollected;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
} }
break; break;
@@ -348,27 +348,27 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
if (m_gameState->m_enabled && p_param.GetAction() != NULL) { if (m_gameState->m_enabled && p_param.GetAction() != NULL) {
MxU32 objectId = p_param.GetAction()->GetObjectId(); MxU32 objectId = p_param.GetAction()->GetObjectId();
if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) { if (m_state == LegoAct2::e_goingToResidentialArea && m_infomanDirecting == objectId) {
m_unk0x1144 = (Act2mainScript::Script) 0; m_infomanDirecting = (Act2mainScript::Script) 0;
return 0; return 0;
} }
if (m_unk0x1140 != objectId) { if (m_currentAction != objectId) {
return 0; return 0;
} }
m_unk0x1140 = (Act2mainScript::Script) 0; m_currentAction = (Act2mainScript::Script) 0;
switch (m_unk0x10c4) { switch (m_state) {
case 2: case LegoAct2::e_holdingSpeech:
m_unk0x10c4 = 3; m_state = LegoAct2::e_startDescription;
break; break;
case 4: case LegoAct2::e_explaining:
FUN_10051960(); HideMaPaInfo();
m_unk0x10c4 = 5; m_state = LegoAct2::e_goingToResidentialArea;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
break; break;
case 6: { case LegoAct2::e_atResidentialArea: {
LegoROI* roi; LegoROI* roi;
roi = FindROI("nick"); roi = FindROI("nick");
@@ -400,24 +400,24 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
roi->SetVisibility(FALSE); roi->SetVisibility(FALSE);
VariableTable()->SetVariable("ACTOR_01", "brickstr"); VariableTable()->SetVariable("ACTOR_01", "brickstr");
FUN_10052800(); InitializeShooting();
m_unk0x10c4 = 7; m_state = LegoAct2::e_chase;
PlayMusic(JukeboxScript::c_BrickstrChase); PlayMusic(JukeboxScript::c_BrickstrChase);
break; break;
} }
case 11: case LegoAct2::e_hidden:
m_bricks[m_nextBrick - 1].Mute(TRUE); m_bricks[m_nextBrick - 1].Mute(TRUE);
m_unk0x10c4 = 12; m_state = LegoAct2::e_distributeRemainingBricks;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL); StartAction(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428)); AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428));
AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458)); AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458));
break; break;
case 12: { case LegoAct2::e_distributeRemainingBricks: {
LegoROI* roi; LegoROI* roi;
roi = FindROI("nick"); roi = FindROI("nick");
@@ -441,13 +441,13 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
m_bricks[m_nextBrick - 1].Mute(FALSE); m_bricks[m_nextBrick - 1].Mute(FALSE);
m_unk0x10c4 = 13; m_state = LegoAct2::e_brickHunt;
SpawnBricks(); SpawnBricks();
PlayMusic(JukeboxScript::c_BrickHunt); PlayMusic(JukeboxScript::c_BrickHunt);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial);
break; break;
} }
case 14: case LegoAct2::e_allPiecesCollected:
for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) { for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
m_bricks[i].Remove(); m_bricks[i].Remove();
} }
@@ -534,7 +534,7 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->SetActor(LegoActor::c_pepper); GameState()->SetActor(LegoActor::c_pepper);
m_pepper = FindROI("pepper"); m_pepper = FindROI("pepper");
((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_unk0x10dc, m_unk0x1124, TRUE); ((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_transformOnDisable, m_boundaryOnDisable, TRUE);
if (GameState()->m_previousArea == LegoGameState::e_infomain) { if (GameState()->m_previousArea == LegoGameState::e_infomain) {
GameState()->StopArea(LegoGameState::e_infomain); GameState()->StopArea(LegoGameState::e_infomain);
@@ -542,26 +542,27 @@ void LegoAct2::Enable(MxBool p_enable)
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
if (m_unk0x10c4 != 6 && m_unk0x10c4 != 12) { if (m_state != LegoAct2::e_atResidentialArea && m_state != LegoAct2::e_distributeRemainingBricks) {
PlayMusic(m_music); PlayMusic(m_music);
} }
if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) { if (m_state == LegoAct2::e_goingToHide && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
m_bricks[5].PlayWhistleSound(); m_bricks[5].PlayWhistleSound();
} }
else if (m_unk0x10c4 == 13) { else if (m_state == LegoAct2::e_brickHunt) {
InitBricks(); InitBricks();
} }
TickleManager()->RegisterClient(this, 20); TickleManager()->RegisterClient(this, 20);
SetAppCursor(e_cursorArrow); SetAppCursor(e_cursorArrow);
if (m_unk0x10c4 == 2 || m_unk0x10c4 == 4 || m_unk0x10c4 == 6 || m_unk0x10c4 == 11 || m_unk0x10c4 == 12 || if (m_state == LegoAct2::e_holdingSpeech || m_state == LegoAct2::e_explaining ||
m_unk0x10c4 == 14) { m_state == LegoAct2::e_atResidentialArea || m_state == LegoAct2::e_hidden ||
m_state == LegoAct2::e_distributeRemainingBricks || m_state == LegoAct2::e_allPiecesCollected) {
MxDSAction action; MxDSAction action;
MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE); MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE);
m_unk0x1140 = (Act2mainScript::Script) 0; m_currentAction = (Act2mainScript::Script) 0;
action.SetObjectId(0); action.SetObjectId(0);
HandleEndAction(param); HandleEndAction(param);
} }
@@ -569,21 +570,21 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->m_isDirty = TRUE; GameState()->m_isDirty = TRUE;
} }
else { else {
m_unk0x10dc = m_pepper->GetLocal2World(); m_transformOnDisable = m_pepper->GetLocal2World();
m_unk0x1124 = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary(); m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
FUN_10051900(); FUN_10051900();
BackgroundAudioManager()->Stop(); BackgroundAudioManager()->Stop();
UninitBricks(); UninitBricks();
DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav); DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav);
if (m_unk0x1144 != (Act2mainScript::Script) 0) { if (m_infomanDirecting != (Act2mainScript::Script) 0) {
MxDSAction action; MxDSAction action;
action.SetAtomId(m_atomId); action.SetAtomId(m_atomId);
action.SetUnknown24(-2); action.SetUnknown24(-2);
action.SetObjectId(m_unk0x1144); action.SetObjectId(m_infomanDirecting);
DeleteObject(action); DeleteObject(action);
m_unk0x1144 = (Act2mainScript::Script) 0; m_infomanDirecting = (Act2mainScript::Script) 0;
} }
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
@@ -594,46 +595,46 @@ void LegoAct2::Enable(MxBool p_enable)
// FUNCTION: BETA10 0x1003bb72 // FUNCTION: BETA10 0x1003bb72
MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{ {
if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) { if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x32) {
LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity(); LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity();
actor->SetActorState(LegoPathActor::c_disabled); actor->SetActorState(LegoPathActor::c_disabled);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
FUN_10051900(); FUN_10051900();
if (m_unk0x10d0 < 90000) { if (m_timeSinceLastStage < 90000) {
FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); StartAction(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
} }
m_unk0x112c = 50; m_unk0x112c = 50;
m_unk0x10c4 = 6; m_state = LegoAct2::e_atResidentialArea;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
} }
else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) { else if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x2a) {
if (m_unk0x1144 == (Act2mainScript::Script) 0) { if (m_infomanDirecting == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav; m_infomanDirecting = Act2mainScript::c_Avo907In_PlayWav;
} }
} }
else if (m_unk0x10c4 == 5) { else if (m_state == LegoAct2::e_goingToResidentialArea) {
FUN_100521f0(p_param.GetData()); CheckBricksterIsLoose(p_param.GetData());
} }
else if (m_unk0x10c4 == 7) { else if (m_state == LegoAct2::e_chase) {
FUN_10051fa0(p_param.GetData()); CheckBricksterDestroying(p_param.GetData());
} }
else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) { else if (m_state == LegoAct2::e_goingToHide && p_param.GetData() == 0x165) {
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { if (StartAction(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav; m_currentAction = Act2mainScript::c_VOhide_PlayWav;
} }
m_unk0x1138->FUN_10019560(); m_unk0x1138->Hide();
m_unk0x10c4 = 11; m_state = LegoAct2::e_hidden;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
if (m_nextBrick < 6) { if (m_nextBrick < 6) {
m_bricks[m_nextBrick].Create(m_nextBrick); m_bricks[m_nextBrick].Create(m_nextBrick);
@@ -655,7 +656,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
// FUNCTION: LEGO1 0x100516b0 // FUNCTION: LEGO1 0x100516b0
// FUNCTION: BETA10 0x1003bcbc // FUNCTION: BETA10 0x1003bcbc
MxResult LegoAct2::FUN_100516b0() MxResult LegoAct2::CreateBrick()
{ {
if (m_nextBrick > 4) { if (m_nextBrick > 4) {
return FAILURE; return FAILURE;
@@ -673,8 +674,8 @@ MxResult LegoAct2::FUN_100516b0()
brick.Place(local2world, local2world2, boundary); brick.Place(local2world, local2world2, boundary);
m_nextBrick++; m_nextBrick++;
m_unk0x10c4 = 9; m_state = LegoAct2::e_droppingBrick;
m_unk0x10d0 = 0; m_timeSinceLastStage = 0;
return SUCCESS; return SUCCESS;
} }
@@ -721,7 +722,7 @@ void LegoAct2::FUN_10051900()
// FUNCTION: LEGO1 0x10051960 // FUNCTION: LEGO1 0x10051960
// FUNCTION: BETA10 0x1003bf2c // FUNCTION: BETA10 0x1003bf2c
void LegoAct2::FUN_10051960() void LegoAct2::HideMaPaInfo()
{ {
LegoROI* roi; LegoROI* roi;
@@ -938,93 +939,93 @@ MxResult LegoAct2::BadEnding()
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
MxTrace("Bad End of Act2\n"); MxTrace("Bad End of Act2\n");
m_unk0x10c4 = 14; m_state = LegoAct2::e_allPiecesCollected;
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x10051fa0 // FUNCTION: LEGO1 0x10051fa0
// FUNCTION: BETA10 0x10013fd3 // FUNCTION: BETA10 0x10013fd3
void LegoAct2::FUN_10051fa0(MxS32 p_param1) void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData)
{ {
MxU8 randN = rand() / (RAND_MAX / 3); MxU8 randN = rand() / (RAND_MAX / 3);
randN++; randN++;
switch (p_param1) { switch (p_pathData) {
case 2: case 2:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 8: case 8:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 9: case 9:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 14: case 14:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 23: case 23:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 24: case 24:
case 25: case 25:
FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
break; break;
case 26: case 26:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 34: case 34:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 36: case 36:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 38: case 38:
case 42: case 42:
if (randN == 1) { if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); StartAction(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
} }
@@ -1032,44 +1033,44 @@ void LegoAct2::FUN_10051fa0(MxS32 p_param1)
// FUNCTION: LEGO1 0x100521f0 // FUNCTION: LEGO1 0x100521f0
// FUNCTION: BETA10 0x100142f1 // FUNCTION: BETA10 0x100142f1
void LegoAct2::FUN_100521f0(MxS32 p_param1) void LegoAct2::CheckBricksterIsLoose(MxS32 p_pathData)
{ {
Act2mainScript::Script objectId = (Act2mainScript::Script) 0; Act2mainScript::Script objectId = (Act2mainScript::Script) 0;
Mx3DPointFloat vec; Mx3DPointFloat actorPosition;
switch (p_param1) { switch (p_pathData) {
case 0x02: { case 0x02: {
vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f); actorPosition = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
VariableTable()->SetVariable("ACTOR_01", "bd"); VariableTable()->SetVariable("ACTOR_01", "bd");
objectId = Act2mainScript::c_tns030bd_RunAnim; objectId = Act2mainScript::c_tns030bd_RunAnim;
break; break;
} }
case 0x2a: { case 0x2a: {
vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f); actorPosition = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
VariableTable()->SetVariable("ACTOR_01", "rd"); VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim; objectId = Act2mainScript::c_tns030rd_RunAnim;
break; break;
} }
case 0x133: { case 0x133: {
vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f); actorPosition = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
VariableTable()->SetVariable("ACTOR_01", "pg"); VariableTable()->SetVariable("ACTOR_01", "pg");
objectId = Act2mainScript::c_tns030pg_RunAnim; objectId = Act2mainScript::c_tns030pg_RunAnim;
break; break;
} }
case 0x134: { case 0x134: {
vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f); actorPosition = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
VariableTable()->SetVariable("ACTOR_01", "sy"); VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim; objectId = Act2mainScript::c_tns030sy_RunAnim;
break; break;
} }
case 0x135: { case 0x135: {
vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f); actorPosition = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
VariableTable()->SetVariable("ACTOR_01", "rd"); VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim; objectId = Act2mainScript::c_tns030rd_RunAnim;
break; break;
} }
case 0x138: { case 0x138: {
vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f); actorPosition = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
VariableTable()->SetVariable("ACTOR_01", "sy"); VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim; objectId = Act2mainScript::c_tns030sy_RunAnim;
break; break;
@@ -1077,30 +1078,30 @@ void LegoAct2::FUN_100521f0(MxS32 p_param1)
} }
if (objectId != (Act2mainScript::Script) 0) { if (objectId != (Act2mainScript::Script) 0) {
Mx3DPointFloat local30(vec); Mx3DPointFloat lookingAtPepper(actorPosition);
Mx3DPointFloat position(m_pepper->GetWorldPosition()); Mx3DPointFloat position(m_pepper->GetWorldPosition());
local30 -= position; lookingAtPepper -= position;
Mx3DPointFloat local44 = local30; Mx3DPointFloat local44 = lookingAtPepper;
local30.Unitize(); lookingAtPepper.Unitize();
FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL); StartAction(objectId, TRUE, TRUE, &actorPosition, &lookingAtPepper, NULL);
} }
} }
// FUNCTION: LEGO1 0x10052560 // FUNCTION: LEGO1 0x10052560
// FUNCTION: BETA10 0x100145c6 // FUNCTION: BETA10 0x100145c6
MxResult LegoAct2::FUN_10052560( MxResult LegoAct2::StartAction(
Act2mainScript::Script p_objectId, Act2mainScript::Script p_objectId,
MxBool p_param2, MxBool p_isAnimation,
MxBool p_param3, MxBool p_ignoreCurrentAction,
Mx3DPointFloat* p_location, Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction, Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6 Mx3DPointFloat* p_param6
) )
{ {
if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) { if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) {
assert(strlen(m_siFile)); assert(strlen(m_siFile));
if (!p_param2) { if (!p_isAnimation) {
MxDSAction action; MxDSAction action;
action.SetObjectId(p_objectId); action.SetObjectId(p_objectId);
@@ -1188,7 +1189,7 @@ MxResult LegoAct2::FUN_10052560(
} }
if (result == SUCCESS) { if (result == SUCCESS) {
m_unk0x1140 = p_objectId; m_currentAction = p_objectId;
} }
} }
} }
@@ -1198,7 +1199,7 @@ MxResult LegoAct2::FUN_10052560(
// FUNCTION: LEGO1 0x10052800 // FUNCTION: LEGO1 0x10052800
// FUNCTION: BETA10 0x10014aa8 // FUNCTION: BETA10 0x10014aa8
MxResult LegoAct2::FUN_10052800() MxResult LegoAct2::InitializeShooting()
{ {
LegoPathActor* actor = m_unk0x1138; LegoPathActor* actor = m_unk0x1138;
LegoLocomotionAnimPresenter* ap; LegoLocomotionAnimPresenter* ap;
@@ -1222,6 +1223,6 @@ MxResult LegoAct2::FUN_10052800()
ap->FUN_1006d680(m_unk0x1138, -1.0f); ap->FUN_1006d680(m_unk0x1138, -1.0f);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
m_unk0x1138->FUN_10018980(); m_unk0x1138->InitializeNextShot();
return SUCCESS; return SUCCESS;
} }

View File

@@ -9,12 +9,6 @@
// LIBRARY: LEGO1 0x10086260 // LIBRARY: LEGO1 0x10086260
// ??3@YAXPAX@Z // ??3@YAXPAX@Z
// LIBRARY: LEGO1 0x1008a090
// _malloc
// LIBRARY: LEGO1 0x1008a100
// _calloc
// LIBRARY: LEGO1 0x1008a1c0 // LIBRARY: LEGO1 0x1008a1c0
// _free // _free
@@ -937,8 +931,31 @@
// GLOBAL: LEGO1 0x100db6e0 // GLOBAL: LEGO1 0x100db6e0
// GUID_SysKeyboard // 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 // // GLOBAL: LEGO1 0x10098f80
// c_dfDIKeyboard // 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 #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: LEGO1 0x10032770
// FUNCTION: BETA10 0x1001ff30 // 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 // 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 // FUNCTION: BETA10 0x10010860
float* operator[](int idx) { return m_data[idx]; } float* operator[](int idx) { return m_data[idx]; }
@@ -25,10 +25,10 @@ public:
const float* operator[](int idx) const { return m_data[idx]; } const float* operator[](int idx) const { return m_data[idx]; }
// FUNCTION: LEGO1 0x10002850 // 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 // 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: private:
float m_elements[4][4]; // 0x08 float m_elements[4][4]; // 0x08

View File

@@ -11,7 +11,7 @@
DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c); 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, 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, -2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058,
-2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473,

View File

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

View File

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

View File

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

View File

@@ -38,6 +38,10 @@ targets:
- 0x100fb080 - 0x100fb080
# memset etc. # memset etc.
- 0x100f9570 - 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: ALPHA:
filename: ALPHA.DLL filename: ALPHA.DLL
source-root: LEGO1 source-root: LEGO1