diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6b17e90..8fd81c57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,6 +104,12 @@ jobs: uses: maxim-lobanov/setup-xcode@v1.6.0 with: xcode-version: latest-stable + + - name: Install iOS components + if: ${{ matrix.ios }} + run: | + xcrun simctl list > /dev/null + xcodebuild -downloadPlatform iOS - name: Setup Emscripten uses: mymindstorm/setup-emsdk@master diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index ff248094..7b0fa23d 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -370,23 +370,6 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv) // Get reference to window *appstate = g_isle->GetWindowHandle(); - // Currently, SDL doesn't send SDL_EVENT_MOUSE_ADDED at startup (unlike for gamepads) - // This will probably be fixed in the future: https://github.com/libsdl-org/SDL/issues/12815 - { - int count; - SDL_MouseID* mice = SDL_GetMice(&count); - - if (mice) { - for (int i = 0; i < count; i++) { - if (InputManager()) { - InputManager()->AddMouse(mice[i]); - } - } - - SDL_free(mice); - } - } - #ifdef __EMSCRIPTEN__ SDL_AddEventWatch( [](void* userdata, SDL_Event* event) -> bool { @@ -1146,6 +1129,8 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:Exclusive Y Resolution", SDL_itoa(m_exclusiveYRes, buf, 10)); iniparser_set(dict, "isle:Exclusive Framerate", SDL_itoa(m_exclusiveFrameRate, buf, 10)); iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10)); + iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10)); + iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10)); #ifdef EXTENSIONS iniparser_set(dict, "extensions", NULL); diff --git a/ISLE/library_msvc.h b/ISLE/library_msvc.h index b65591d6..46438f76 100644 --- a/ISLE/library_msvc.h +++ b/ISLE/library_msvc.h @@ -324,9 +324,6 @@ // GLOBAL: ISLE 0x411850 // __cflush -// XGLOBAL ISLE 0x4125f8 -// ?_pnhHeap@@3P6AHI@ZA - // GLOBAL: ISLE 0x412888 // ___setlc_active diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index 324cf4b3..6b39de3f 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -14,18 +14,24 @@ class Act2Actor : public LegoAnimActor { MxFloat m_position[3]; // 0x00 MxFloat m_direction[3]; // 0x0c const char* m_boundary; // 0x18 - MxBool m_unk0x1c; // 0x1c + MxBool m_cleared; // 0x1c + }; + + enum VoiceOver { + e_head = 0, + e_behind = 1, + e_interrupt = 2, }; Act2Actor(); - void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 - void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 // FUNCTION: LEGO1 0x1001a180 MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override { - if (m_unk0x1f) { + if (m_animatingHit) { return 0; } @@ -35,16 +41,16 @@ class Act2Actor : public LegoAnimActor { void Animate(float p_time) override; // vtable+0x70 MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94 MxResult VTable0x9c() override; // vtable+0x9c - MxS32 VTable0xa0() override; // vtable+0xa0 + MxS32 NextTargetLocation() override; // vtable+0xa0 - void FUN_10018980(); - void FUN_10019250(MxFloat p_speed, MxFloat p_param2); - void FUN_10019520(); - void FUN_10019560(); - MxU32 FUN_10019700(MxFloat p_param); - void FUN_100199f0(MxS8 p_param); - void FUN_100192a0(undefined4 p_location); - LegoEntity* FUN_10019b90(MxBool* p_param); + void InitializeNextShot(); + void SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt); + void GoingToHide(); + void Hide(); + MxU32 UpdateShot(MxFloat p_time); + void PlayNextVoiceOver(MxS8 p_voiceOverType); + void FindPath(MxU32 p_location); + LegoEntity* GetNextEntity(MxBool* p_isBuilding); // SYNTHETIC: LEGO1 0x1001a0a0 // Act2Actor::`scalar deleting destructor' @@ -54,22 +60,31 @@ class Act2Actor : public LegoAnimActor { // `vbtable' private: - undefined m_unk0x1c; // 0x1c - MxS8 m_unk0x1d; // 0x1d - undefined m_unk0x1e; // 0x1e - MxBool m_unk0x1f; // 0x1f - MxFloat m_unk0x20; // 0x20 - MxFloat m_unk0x24; // 0x24 - MxS8 m_unk0x28; // 0x28 - MxFloat m_unk0x2c; // 0x2c - MxFloat m_unk0x30; // 0x30 - LegoAnimActorStruct* m_shootAnim; // 0x34 - LegoCacheSound* m_unk0x38; // 0x38 - undefined4 m_unk0x3c; // 0x3c - undefined m_unk0x40; // 0x40 - MxFloat m_unk0x44; // 0x44 - MxS8 m_unk0x48; // 0x48 - LegoEntity* m_unk0x4c; // 0x4c + enum { + e_readyToShoot = 0, + e_endShot = 1, + e_roaming = 2, + e_createdBrick = 3, + e_goingToHide = 4, + e_hiding = 5, + }; + + MxBool m_skipAnimation; // 0x1c + MxS8 m_targetLocation; // 0x1d + MxU8 m_state; // 0x1e + MxBool m_animatingHit; // 0x1f + MxFloat m_animationDuration; // 0x20 + MxFloat m_createBrickTime; // 0x24 + MxS8 m_baseWorldSpeed; // 0x28 + MxFloat m_shootAnimEnd; // 0x2c + MxFloat m_entityAnimationTime; // 0x30 + LegoAnimActorStruct* m_shootAnim; // 0x34 + LegoCacheSound* m_cachedShootSound; // 0x38 + undefined4 m_unk0x3c; // 0x3c + MxBool m_initializing; // 0x40 + MxFloat m_resetWorldSpeedAt; // 0x44 + MxS8 m_visitedLocations; // 0x48 + LegoEntity* m_nextEntity; // 0x4c }; // TEMPLATE: LEGO1 0x100194f0 diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 9172a6cc..ffba305b 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -106,7 +106,7 @@ class Act3 : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10072500 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x10072510 // FUNCTION: BETA10 0x10017550 diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index ad1fe29f..2db42ec5 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -18,7 +18,7 @@ class ElevatorBottom : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10017f10 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x10017f20 // FUNCTION: BETA10 0x10028130 diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 10a825ac..f87aeb6e 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -77,7 +77,7 @@ class GasStation : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10004770 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x10004780 // FUNCTION: BETA10 0x10029d40 diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index be198776..d6401be9 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -79,7 +79,7 @@ class Hospital : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x100746a0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x100746b0 // FUNCTION: BETA10 0x1002e1a0 diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 8c4f8aa9..ca1525c5 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -141,7 +141,7 @@ class Infocenter : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c + MxBool WaitForTransition() override; // vtable+0x5c MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index c9bb841b..4612cb1b 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -17,7 +17,7 @@ class InfocenterDoor : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100377a0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x100377b0 // FUNCTION: BETA10 0x10032790 diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 8d76e78d..eafec8fe 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -134,7 +134,7 @@ class Isle : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10030900 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x10030910 // FUNCTION: BETA10 0x10035d70 diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index e7a36668..1709e869 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -60,7 +60,7 @@ class JukeBox : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005d6e0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x1005d6f0 // FUNCTION: BETA10 0x100388d0 diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 23d05fae..d27f92d8 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -71,7 +71,7 @@ class LegoAct2 : public LegoWorld { void ReadyWorld() override; // vtable+0x50 // FUNCTION: LEGO1 0x1004fe10 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c void VTable0x60() override; // vtable+0x60 MxBool Escape() override; // vtable+0x64 @@ -80,10 +80,10 @@ class LegoAct2 : public LegoWorld { void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } - MxResult FUN_100516b0(); + MxResult CreateBrick(); void FUN_100517b0(); MxResult BadEnding(); - MxResult FUN_10052560( + MxResult StartAction( Act2mainScript::Script p_objectId, MxBool p_param2, MxBool p_param3, @@ -96,48 +96,65 @@ class LegoAct2 : public LegoWorld { // LegoAct2::`scalar deleting destructor' 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 HandleTransitionEnd(); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); void PlayMusic(JukeboxScript::Script p_objectId); void FUN_10051900(); - void FUN_10051960(); + void HideMaPaInfo(); void InitBricks(); void UninitBricks(); void SpawnBricks(); - void FUN_10051fa0(MxS32 p_param1); - void FUN_100521f0(MxS32 p_param1); - MxResult FUN_10052800(); + void CheckBricksterDestroying(MxS32 p_pathData); + void CheckBricksterIsLoose(MxS32 p_pathData); + MxResult InitializeShooting(); Act2Brick m_bricks[10]; // 0x00f8 MxU8 m_nextBrick; // 0x10c0 - undefined m_unk0x10c1; // 0x10c1 + MxU8 m_removedBricks; // 0x10c1 MxBool m_ready; // 0x10c2 - undefined4 m_unk0x10c4; // 0x10c4 + undefined4 m_state; // 0x10c4 JukeboxScript::Script m_music; // 0x10c8 LegoAct2State* m_gameState; // 0x10cc - MxS32 m_unk0x10d0; // 0x10d0 + MxS32 m_timeSinceLastStage; // 0x10d0 // variable name verified by BETA10 0x10014633 const char* m_siFile; // 0x10d4 - LegoROI* m_pepper; // 0x10d8 - MxMatrix m_unk0x10dc; // 0x10dc - LegoPathBoundary* m_unk0x1124; // 0x1124 - LegoROI* m_ambulance; // 0x1128 - undefined4 m_unk0x112c; // 0x112c - undefined4 m_unk0x1130; // 0x1130 - undefined4 m_unk0x1134; // 0x1134 - Act2Actor* m_unk0x1138; // 0x1138 - undefined m_unk0x113c; // 0x113c - Act2mainScript::Script m_unk0x1140; // 0x1140 - Act2mainScript::Script m_unk0x1144; // 0x1144 - undefined4 m_unk0x1148; // 0x1148 - undefined m_firstBrick; // 0x114c - undefined m_secondBrick; // 0x114d - undefined m_thirdBrick; // 0x114e - undefined m_fourthBrick; // 0x114e - LegoGameState::Area m_destLocation; // 0x1150 + LegoROI* m_pepper; // 0x10d8 + MxMatrix m_transformOnDisable; // 0x10dc + LegoPathBoundary* m_boundaryOnDisable; // 0x1124 + LegoROI* m_ambulance; // 0x1128 + undefined4 m_unk0x112c; // 0x112c + undefined4 m_unk0x1130; // 0x1130 + undefined4 m_unk0x1134; // 0x1134 + Act2Actor* m_unk0x1138; // 0x1138 + undefined m_unk0x113c; // 0x113c + Act2mainScript::Script m_currentAction; // 0x1140 + Act2mainScript::Script m_infomanDirecting; // 0x1144 + undefined4 m_unk0x1148; // 0x1148 + undefined m_firstBrick; // 0x114c + undefined m_secondBrick; // 0x114d + undefined m_thirdBrick; // 0x114e + undefined m_fourthBrick; // 0x114e + LegoGameState::Area m_destLocation; // 0x1150 }; #endif // LEGOACT2_H diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index a3e68f2e..174ec4e1 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -40,8 +40,8 @@ class LegoActor : public LegoEntity { return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name); } - void ParseAction(char* p_extra) override; // vtable+0x20 - void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 + void ParseAction(char* p_extra) override; // vtable+0x20 + void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24 // FUNCTION: LEGO1 0x10002cc0 // FUNCTION: BETA10 0x1000f3e0 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 4b764d0b..2d82a45b 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -232,7 +232,7 @@ class LegoAnimationManager : public MxCore { MxBool FUN_100623a0(AnimInfo& p_info); MxBool ModelExists(AnimInfo& p_info, const char* p_name); void FUN_10062580(AnimInfo& p_info); - MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); + MxBool FUN_10062650(Mx3DPointFloat& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); MxBool FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter); void FUN_10063950(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index e15f8598..b3421988 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -22,11 +22,11 @@ class MxActionNotificationParam; class LegoVehicleBuildState : public LegoState { public: enum AnimationState { - e_unknown0 = 0, + e_none = 0, e_entering = 1, - e_unknown2 = 2, + e_settingUpMovie = 2, e_cutscene = 3, - e_unknown4 = 4, + e_finishedBuild = 4, e_exiting = 6 }; @@ -59,9 +59,9 @@ class LegoVehicleBuildState : public LegoState { MxString m_className; // 0x38 AnimationState m_animationState; // 0x48 - MxU8 m_unk0x4c; // 0x4c - MxBool m_unk0x4d; // 0x4d - MxBool m_unk0x4e; // 0x4e + MxU8 m_introductionCounter; // 0x4c + MxBool m_finishedBuild; // 0x4d + MxBool m_playedExitScript; // 0x4e MxU8 m_placedPartCount; // 0x4f }; @@ -77,18 +77,28 @@ class LegoCarBuild : public LegoWorld { public: // SIZE 0x1c struct LookupTableActions { - undefined4 m_unk0x00; // 0x00 - undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - undefined4 m_unk0x18; // 0x18 + MxU32 m_introduction0; // 0x00 + MxU32 m_leaveUnfinished; // 0x04 + MxU32 m_completed; // 0x08 + MxU32 m_introduction1; // 0x0c + MxU32 m_introduction2; // 0x10 + MxU32 m_introduction3; // 0x14 + MxU32 m_shortExplanation; // 0x18 }; - enum Unknown0xf8 { - c_unknownminusone = -1, - c_unknown8 = 8 + enum LookupTableActionType { + e_introduction0 = 0, + e_introduction1 = 1, + e_introduction2 = 2, + e_introduction3 = 3, + e_leaveUnfinished = 4, + e_completed = 5, + e_shortExplanation = 6, + }; + + enum ResetPlacedSelectedPart { + c_disabled = -1, + c_enabled = 8 }; LegoCarBuild(); @@ -96,7 +106,7 @@ class LegoCarBuild : public LegoWorld { // FUNCTION: LEGO1 0x10022930 // FUNCTION: BETA10 0x10070070 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x10022940 // FUNCTION: BETA10 0x10070090 @@ -115,15 +125,15 @@ class LegoCarBuild : public LegoWorld { return !strcmp(p_name, LegoCarBuild::ClassName()) || LegoWorld::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void ReadyWorld() override; // vtable+0x50 - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 - virtual void VTable0x6c(); // vtable+0x6c - virtual void VTable0x70(); // vtable+0x70 - virtual void VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x74 - virtual void VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x78 - virtual void VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x7c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool Escape() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 + virtual void InitializeDisplayingTransform(); // vtable+0x6c + virtual void CalculateStartAndTargetScreenPositions(); // vtable+0x70 + virtual void CalculateDragPositionAbove(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x74 + virtual void CalculateDragPositionBetween(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x78 + virtual void CalculateDragPositionOnGround(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x7c virtual void VTable0x80( MxFloat p_param1[2], MxFloat p_param2[2], @@ -134,33 +144,33 @@ class LegoCarBuild : public LegoWorld { MxS16 GetPlacedPartCount(); void SetPlacedPartCount(MxU8 p_placedPartCount); void InitPresenters(); - void FUN_10022f00(); - void FUN_10022f30(); - void FUN_10023130(MxLong p_x, MxLong p_y); + void DisplaySelectedPart(); + void ResetSelectedPart(); + void CalculateSelectedPartMatrix(MxLong p_x, MxLong p_y); void AddSelectedPartToBuild(); - undefined4 FUN_10024250(LegoEventNotificationParam* p_param); - void FUN_100243a0(); - undefined4 FUN_10024480(MxActionNotificationParam* p_param); - undefined4 SelectPartFromMousePosition(MxLong p_x, MxLong p_y); - undefined4 FUN_100246e0(MxLong p_x, MxLong p_y); - MxS32 FUN_10024850(MxLong p_x, MxLong p_y); - undefined4 FUN_10024890(MxParam* p_param); - undefined4 FUN_10024c20(MxNotificationParam* p_param); - void FUN_10024ef0(); - void FUN_10024f30(); - void FUN_10024f50(); - void FUN_10024f70(MxBool p_enabled); - void SetPresentersEnabled(MxBool p_enabled); - void TogglePresentersEnabled(); - void FUN_100250e0(MxBool p_param); - void FUN_10025350(MxS32 p_objectId); - void FUN_10025450(); - void FUN_10025720(undefined4 p_param1); - void FUN_10025d10(MxS32 p_param); - MxS32 FUN_10025d70(); - void FUN_10025db0(const char* p_param1, undefined4 p_param2); - void FUN_10025e40(); - MxS32 FUN_10025ee0(undefined4 p_param1); + MxLong HandleKeyPress(LegoEventNotificationParam* p_param); + void InitExiting(); + MxLong HandleEndAction(MxActionNotificationParam* p_param); + MxLong SelectPartFromMousePosition(MxLong p_x, MxLong p_y); + MxLong HandleButtonUp(MxLong p_x, MxLong p_y); + MxLong HandleMouseMove(MxLong p_x, MxLong p_y); + MxLong HandleControl(MxParam* p_param); + MxLong HandleType0Notification(MxNotificationParam* p_param); + void StartIntroduction(); + void MoveShelves(); + void RotateVehicle(); + void EnableColorControlsForSelectedPart(MxBool p_enabled); + void SetColorControlsEnabled(MxBool p_enabled); + void ToggleColorControlsEnabled(); + void EnableDecalForSelectedPart(MxBool p_enabled); + void SetPartColor(MxS32 p_objectId); + void CalculateStartAndTargetTransforms(); + void StartActorScriptByType(MxS32 p_actionType); + void StartActorScript(MxS32 p_streamId); + MxS32 GetNextIntroduction(); + void TickleControl(const char* p_controlName, MxULong p_time); + void HandleEndAnim(); + MxS32 GetBuildMovieId(MxS32 p_carId); // FUNCTION: BETA10 0x100735b0 void SetCarBuildAnimPresenter(LegoCarBuildAnimPresenter* p_animPresenter) { m_animPresenter = p_animPresenter; } @@ -169,43 +179,45 @@ class LegoCarBuild : public LegoWorld { // LegoCarBuild::`scalar deleting destructor' private: - // inline functions - MxU32 Beta0x10070520(); - void StopActionIn0x344(); + enum { + e_idle = 0, + e_returning = 3, + e_selecting = 4, + e_displaying = 5, + e_dragging = 6, + }; - Unknown0xf8 m_unk0xf8; // 0xf8 - MxS16 m_unk0xfc; // 0xfc - MxS32 m_unk0x100; // 0x100 - undefined4 m_unk0x104; // 0x104 + // inline functions + MxU32 GetLookupIndex(); + void StopPlayingActorScript(); + + ResetPlacedSelectedPart m_resetPlacedSelectedPart; // 0xf8 + MxS16 m_rotateBuild; // 0xfc + MxS32 m_clickState; // 0x100 + undefined4 m_unk0x104; // 0x104 // name verified by BETA10 0x1006ebba MxS8 m_numAnimsRun; // 0x108 - MxU8 m_unk0x109; // 0x109 - MxU16 m_unk0x10a; // 0x10a - Uint64 m_unk0x10c; // 0x10c - LegoROI* m_selectedPart; // 0x110 - BoundingSphere m_unk0x114; // 0x114 - MxMatrix m_unk0x12c; // 0x12c - undefined m_unk0x174; // 0x174 - MxMatrix m_unk0x178; // 0x178 - MxMatrix m_unk0x1c0; // 0x1c0 - MxMatrix m_unk0x208; // 0x208 - - // This is likely a location in pixel space - MxS32 m_unk0x250[2]; // 0x250 - - LegoCarBuildAnimPresenter* m_animPresenter; // 0x258 - MxQuaternionTransformer m_unk0x25c; // 0x25c - - // These two are likely locations in pixel space - MxS32 m_unk0x290[2]; // 0x290 - MxS32 m_unk0x298[2]; // 0x298 - - MxFloat m_unk0x2a0; // 0x2a0 - Mx4DPointFloat m_unk0x2a4; // 0x2a4 - Mx4DPointFloat m_unk0x2bc; // 0x2bc - MxBool m_selectedPartIsPlaced; // 0x2d4 + MxU8 m_missclickCounter; // 0x109 + MxU16 m_lastActorScript; // 0x10a + Uint64 m_lastActorScriptStartTime; // 0x10c + LegoROI* m_selectedPart; // 0x110 + BoundingSphere m_targetBoundingSphere; // 0x114 + MxMatrix m_originalSelectedPartTransform; // 0x12c + MxBool m_alreadyFinished; // 0x174 + MxMatrix m_selectedPartStartTransform; // 0x178 + MxMatrix m_displayTransform; // 0x1c0 + MxMatrix m_selectedPartTargetTransform; // 0x208 + MxS32 m_selectedPartStartMousePosition[2]; // 0x250 + LegoCarBuildAnimPresenter* m_animPresenter; // 0x258 + MxQuaternionTransformer m_draggingQuarternionTransformer; // 0x25c + MxS32 m_selectedPartStartScreenPosition[2]; // 0x290 + MxS32 m_selectedPartTargetScreenPosition[2]; // 0x298 + MxFloat m_normalizedDistance; // 0x2a0 + Mx4DPointFloat m_selectedPartStartPosition; // 0x2a4 + Mx4DPointFloat m_selectedPartTargetPosition; // 0x2bc + MxBool m_displayedPartIsPlaced; // 0x2d4 // variable names verified by BETA10 0x1006b27a MxStillPresenter* m_ColorBook_Bitmap; // 0x2dc @@ -234,21 +246,21 @@ class LegoCarBuild : public LegoWorld { LegoVehicleBuildState* m_buildState; // 0x32c // variable name verified by BETA10 0x1006d742 - undefined4 m_carId; // 0x330 + MxS32 m_carId; // 0x330 // variable name verified by BETA10 0x1006cba7 LegoGameState::Area m_destLocation; // 0x334 - MxPresenter* m_unk0x338; // 0x338 - MxControlPresenter* m_unk0x33c; // 0x33c - undefined4 m_unk0x340; // 0x340 - undefined4 m_unk0x344; // 0x344 - MxU8 m_presentersEnabled; // 0x348 + MxPresenter* m_jukeboxPresenter; // 0x338 + MxControlPresenter* m_tickledControl; // 0x33c + undefined4 m_unk0x340; // 0x340 + MxS32 m_playingActorScript; // 0x344 + MxU8 m_presentersEnabled; // 0x348 - static MxS16 g_unk0x100f11cc; - static MxFloat g_unk0x100d65a4; + static MxS16 g_lastTickleState; + static MxFloat g_selectedPartRotationAngleStepYAxis; static MxFloat g_rotationAngleStepYAxis; - static LookupTableActions g_unk0x100d65b0[]; + static LookupTableActions g_actorScripts[]; }; #endif // LEGOCARBUILD_H diff --git a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h index 31423e32..f20738b6 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -21,10 +21,10 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { }; // SIZE 0x0c - struct UnknownListEntry { + struct CarBuildPart { // FUNCTION: LEGO1 0x100795c0 // FUNCTION: BETA10 0x10073850 - UnknownListEntry() + CarBuildPart() { m_name = NULL; m_wiredName = NULL; @@ -74,7 +74,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { 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 InitBuildPlatform(); void HideBuildPartByName(LegoChar* p_param); @@ -83,7 +83,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name); void AddPartToBuildByName(const LegoChar* p_name); void RotateAroundYAxis(MxFloat p_angle); - MxBool FUN_10079c30(const LegoChar* p_name); + MxBool IsNextPartToPlace(const LegoChar* p_name); MxBool PartIsPlaced(const LegoChar* p_name); void MoveShelfForward(); MxBool StringEqualsPlatform(const LegoChar* p_string); @@ -102,7 +102,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { MxBool StringEndsOnW(LegoChar* p_param); MxBool StringEndsOnYOrN(const LegoChar* p_string); - const BoundingSphere& FUN_10079e20(); + const BoundingSphere& GetTargetBoundingSphere(); // FUNCTION: BETA10 0x100703e0 const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; } @@ -121,7 +121,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { // LegoCarBuildAnimPresenter::`scalar deleting destructor' private: - void Beta10Inline0x100733d0(); + void UpdateFlashingPartVisibility(); MxU16 m_shelfState; // 0xbc @@ -136,16 +136,16 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { MxMatrix m_buildViewMatrix; // 0xe0 // variable name verified by BETA10 0x100719f0 - UnknownListEntry* m_parts; // 0x128 + CarBuildPart* m_parts; // 0x128 - MxFloat m_shelfFrameBuffer; // 0x12c - MxFloat m_shelfFrame; // 0x130 - MxFloat m_shelfFrameMax; // 0x134 - MxFloat m_shelfFrameInterval; // 0x138 - MxULong m_unk0x13c; // 0x13c - LegoEntity* m_carBuildEntity; // 0x140 - MxS32 m_unk0x144; // 0x144 - MxS32 m_unk0x148; // 0x148 + MxFloat m_shelfFrameBuffer; // 0x12c + MxFloat m_shelfFrame; // 0x130 + MxFloat m_shelfFrameMax; // 0x134 + MxFloat m_shelfFrameInterval; // 0x138 + MxULong m_flashingPartTimeState; // 0x13c + LegoEntity* m_carBuildEntity; // 0x140 + MxS32 m_unk0x144; // 0x144 + MxS32 m_unk0x148; // 0x148 // name verified by BETA10 0x10070d63 LegoChar* m_mainSourceId; // 0x14c diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index ed1dd202..c4f81daf 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -53,10 +53,10 @@ class LegoEntity : public MxEntity { return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c - virtual void ParseAction(char* p_extra); // vtable+0x20 - virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 + virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 + virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c + virtual void ParseAction(char* p_extra); // vtable+0x20 + virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform); // vtable+0x24 virtual void SetWorldTransform( const Vector3& p_location, const Vector3& p_direction, diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 04ac7294..f8a4bb0a 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -129,14 +129,13 @@ class LegoInputManager : public MxPresenter { void SetWorld(LegoWorld* p_world); void ClearWorld(); - void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; } void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; } void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } - // FUNCTION: BETA10 0x1002e290 + // FUNCTION: BETA10 0x1002e390 void DisableInputProcessing() { - m_unk0x88 = TRUE; + m_inputProcessingDisabled = TRUE; m_unk0x336 = FALSE; } @@ -192,7 +191,7 @@ class LegoInputManager : public MxPresenter { MxBool m_unk0x80; // 0x80 MxBool m_unk0x81; // 0x81 LegoControlManager* m_controlManager; // 0x84 - MxBool m_unk0x88; // 0x88 + MxBool m_inputProcessingDisabled; // 0x88 const bool* m_keyboardState; MxBool m_unk0x195; // 0x195 MxBool m_unk0x335; // 0x335 diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 8df0e9db..2f1d8862 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -99,7 +99,7 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d60 // FUNCTION: BETA10 0x1000f820 - virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 + virtual MxS32 NextTargetLocation() { return 0; } // vtable+0xa0 virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4 virtual void VTable0xa8(); // vtable+0xa8 diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index e1b93211..8c9c1fe2 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -153,7 +153,7 @@ class LegoRace : public LegoWorld { } // FUNCTION: LEGO1 0x1000dae0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c void Enable(MxBool p_enable) override; // vtable+0x68 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 11e5e667..9e96973d 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -47,18 +47,18 @@ class LegoWorld : public LegoEntity { LegoWorld(); ~LegoWorld() override; // vtable+0x00 - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - MxResult Tickle() override; // vtable+0x08 - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - virtual void ReadyWorld(); // vtable+0x50 - virtual LegoCameraController* VTable0x54(); // vtable+0x54 - virtual void Add(MxCore* p_object); // vtable+0x58 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + virtual void ReadyWorld(); // vtable+0x50 + virtual LegoCameraController* InitializeCameraController(); // vtable+0x54 + virtual void Add(MxCore* p_object); // vtable+0x58 // The BETA10 match could also be LegoWorld::Escape(), only the child classes might be able to tell // FUNCTION: LEGO1 0x1001d670 // FUNCTION: BETA10 0x10017530 - virtual MxBool VTable0x5c() { return FALSE; } // vtable+0x5c + virtual MxBool WaitForTransition() { return FALSE; } // vtable+0x5c // FUNCTION: LEGO1 0x100010a0 virtual void VTable0x60() {} // vtable+0x60 @@ -102,8 +102,8 @@ class LegoWorld : public LegoEntity { ); void RemoveActor(LegoPathActor* p_actor); MxBool ActorExists(LegoPathActor* p_actor); - void FUN_1001fda0(LegoAnimPresenter* p_presenter); - void FUN_1001fe90(LegoAnimPresenter* p_presenter); + void AddPresenterIfInRange(LegoAnimPresenter* p_presenter); + void RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter); LegoPathBoundary* FindPathBoundary(const char* p_name); void AddPath(LegoPathController* p_controller); MxResult GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL); @@ -115,7 +115,7 @@ class LegoWorld : public LegoEntity { LegoEntityList* GetEntityList() { return m_entityList; } LegoOmni::World GetWorldId() { return m_worldId; } - MxBool GetUnknown0xd0Empty() { return m_set0xd0.empty(); } + MxBool NoDisabledObjects() { return m_disabledObjects.empty(); } list& GetROIList() { return m_roiList; } LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnim; } @@ -131,9 +131,9 @@ class LegoWorld : public LegoEntity { LegoEntityList* m_entityList; // 0x9c LegoCacheSoundList* m_cacheSoundList; // 0xa0 MxBool m_destroyed; // 0xa4 - MxCoreSet m_set0xa8; // 0xa8 + MxCoreSet m_objects; // 0xa8 MxPresenterList m_controlPresenters; // 0xb8 - MxCoreSet m_set0xd0; // 0xd0 + MxCoreSet m_disabledObjects; // 0xd0 list m_roiList; // 0xe0 LegoOmni::World m_worldId; // 0xec diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 8d8d7840..12395cbc 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -65,7 +65,7 @@ class Police : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1005e1d0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x1005e1e0 // FUNCTION: BETA10 0x100f0c50 diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index c49d6bec..c8c0c703 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -55,12 +55,12 @@ class RegistrationBook : public LegoWorld { struct { MxS16 m_letters[7]; // 0x00 MxS16 m_cursorPos; // 0x0e - } m_unk0x280; // 0x280 + } m_newName; // 0x280 MxControlPresenter* m_checkmark[10]; // 0x290 - undefined2 m_unk0x2b8; // 0x2b8 + undefined2 m_vehiclesToPosition; // 0x2b8 InfocenterState* m_infocenterState; // 0x2bc undefined m_unk0x2c0; // 0x2c0 - undefined m_unk0x2c1; // 0x2c1 + undefined m_awaitLoad; // 0x2c1 undefined m_unk0x2c2[0x02]; // 0x2c2 LPDIRECTDRAWSURFACE m_checkboxHilite; // 0x2c4 LPDIRECTDRAWSURFACE m_checkboxSurface; // 0x2c8 @@ -72,9 +72,9 @@ class RegistrationBook : public LegoWorld { MxLong HandleKeyPress(SDL_Keycode p_key); MxLong HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); - void FUN_100775c0(MxS16 p_playerIndex); + void LoadSave(MxS16 p_checkMarkIndex); void WriteInfocenterLetters(MxS16); - void FUN_100778c0(); + void LoadVehicles(); MxBool CreateSurface(); }; diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 36252f6f..f2e453a5 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -60,7 +60,7 @@ class Score : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100010b0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c // FUNCTION: LEGO1 0x100010c0 // FUNCTION: BETA10 0x100f4f20 diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index 4062fef1..9c38f7a8 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -36,112 +36,114 @@ Act2Actor::Location g_brickstrLocations[] = { {{26.470566, 0.069, -44.670845}, {0.004602, 0.0, -0.99998897}, "int26", FALSE}, {{-6.323625, 0.069, -47.96045}, {-0.982068, 0.0, 0.188529}, "edg02_53", FALSE}, {{-36.689, -0.978409, 31.449}, {0.083792, -0.94303, -0.66398698}, "edg00_157", FALSE}, +#ifndef BETA10 {{-44.6, 0.1, 45.3}, {0.95, 0.0, -0.3}, "edg00_154", FALSE}, +#endif }; // GLOBAL: LEGO1 0x100f0f1c -MxFloat g_unk0x100f0f1c = 0.0f; +MxFloat g_lastAnimationTime = 0.0f; // GLOBAL: LEGO1 0x100f0f20 // GLOBAL: BETA10 0x101dbe40 -MxBool g_unk0x100f0f20 = FALSE; +MxBool g_nextEntityIsBuilding = FALSE; // GLOBAL: LEGO1 0x100f0f24 MxBool g_unk0x100f0f24 = FALSE; // GLOBAL: LEGO1 0x100f0f28 // GLOBAL: BETA10 0x101dbe44 -MxBool g_unk0x100f0f28 = FALSE; +MxBool g_playedShootSound = FALSE; // --- All of these are indices into g_plantInfo (0x10103180) --- // GLOBAL: LEGO1 0x100f0f30 // GLOBAL: BETA10 0x101dbe48 -MxS32 g_stage0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1}; +MxS32 g_location0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1}; // GLOBAL: LEGO1 0x100f0f50 // GLOBAL: BETA10 0x101dbe68 -MxS32 g_stage1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1}; +MxS32 g_location1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1}; // GLOBAL: LEGO1 0x100f0f90 // GLOBAL: BETA10 0x101dbea8 -MxS32 g_stage2Plants[] = {12, 19, 24, 48, 60, -1}; +MxS32 g_location2Plants[] = {12, 19, 24, 48, 60, -1}; // GLOBAL: LEGO1 0x100f0fa8 // GLOBAL: BETA10 0x101dbec0 -MxS32 g_stage3Plants[] = {8, 15, 46, -1}; +MxS32 g_location3Plants[] = {8, 15, 46, -1}; // GLOBAL: LEGO1 0x100f0fb8 // GLOBAL: BETA10 0x101dbed0 -MxS32 g_stage4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1}; +MxS32 g_location4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1}; // GLOBAL: LEGO1 0x100f0fe8 // GLOBAL: BETA10 0x101dbf00 -MxS32 g_stage5Plants[] = {3, 40, 53, 55, -1}; +MxS32 g_location5Plants[] = {3, 40, 53, 55, -1}; // GLOBAL: LEGO1 0x100f1000 // GLOBAL: BETA10 0x101dbf18 -MxS32 g_stage6Plants[] = {22, 33, 41, 45, 67, -1}; +MxS32 g_location6Plants[] = {22, 33, 41, 45, 67, -1}; // GLOBAL: LEGO1 0x100f1018 // GLOBAL: BETA10 0x101dbf30 -MxS32 g_stage7Plants[] = {13, 30, 31, 62, -1}; +MxS32 g_location7Plants[] = {13, 30, 31, 62, -1}; // GLOBAL: LEGO1 0x100f1030 // GLOBAL: BETA10 0x101dbf48 -MxS32 g_stage8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1}; +MxS32 g_location8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1}; // --- End of indices into g_plantInfo --- // GLOBAL: LEGO1 0x10102b1c // GLOBAL: BETA10 0x10209f60 -undefined4 g_nextHeadWavIndex = 0; +MxU32 g_nextHeadWavIndex = 0; // GLOBAL: LEGO1 0x10102b20 // GLOBAL: BETA10 0x10209f64 -undefined4 g_nextBehindWavIndex = 0; +MxU32 g_nextBehindWavIndex = 0; // GLOBAL: LEGO1 0x10102b24 // GLOBAL: BETA10 0x10209f68 -undefined4 g_nextInterruptWavIndex = 0; +MxU32 g_nextInterruptWavIndex = 0; // FUNCTION: LEGO1 0x100187e0 // FUNCTION: BETA10 0x1000c7fb Act2Actor::Act2Actor() { - m_unk0x1c = 0; - m_unk0x1d = 0; - m_unk0x1f = FALSE; - m_unk0x24 = 0; - m_unk0x20 = 0; - m_unk0x1e = 0; - m_unk0x28 = 4; - m_unk0x2c = 0; - m_unk0x30 = 0; + m_skipAnimation = FALSE; + m_targetLocation = 0; + m_animatingHit = FALSE; + m_createBrickTime = 0; + m_animationDuration = 0; + m_state = e_readyToShoot; + m_baseWorldSpeed = 4; + m_shootAnimEnd = 0; + m_entityAnimationTime = 0; m_shootAnim = NULL; - m_unk0x44 = 0; - m_unk0x40 = 1; - m_unk0x48 = 0; - m_unk0x4c = NULL; - m_unk0x38 = NULL; + m_resetWorldSpeedAt = 0; + m_initializing = TRUE; + m_visitedLocations = 0; + m_nextEntity = NULL; + m_cachedShootSound = NULL; m_unk0x3c = 0; // Odd: The code says < 10, but there are 11 entries in the array for (MxS32 i = 0; i < 10; i++) { - g_brickstrLocations[i].m_unk0x1c = FALSE; + g_brickstrLocations[i].m_cleared = FALSE; } } // FUNCTION: LEGO1 0x10018940 -void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) +void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) { - LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2); + LegoAnimActor::SetROI(p_roi, p_bool1, p_updateTransform); m_roi->SetVisibility(FALSE); } // FUNCTION: LEGO1 0x10018980 // FUNCTION: BETA10 0x1000c963 -void Act2Actor::FUN_10018980() +void Act2Actor::InitializeNextShot() { for (MxS32 i = 0; i < m_animMaps.size(); i++) { if (m_animMaps[i]->GetWorldSpeed() == -1.0f) { @@ -151,14 +153,14 @@ void Act2Actor::FUN_10018980() assert(m_shootAnim); - m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow"); + m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow"); #ifdef BETA10 // actually 0x2c and 0x30 - m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); - m_unk0x38->SetDistance(35, 60); - m_unk0x38->SetDistance(35, 60); + m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); + m_cachedShootSound->SetDistance(35, 60); + m_cachedShootSound->SetDistance(35, 60); #else - m_unk0x38->SetDistance(45, 55); + m_cachedShootSound->SetDistance(45, 55); m_roi->SetVisibility(TRUE); #endif } @@ -167,9 +169,9 @@ void Act2Actor::FUN_10018980() // FUNCTION: BETA10 0x1000ca64 MxResult Act2Actor::HitActor(LegoPathActor*, MxBool) { - if (m_unk0x1f == FALSE) { - m_unk0x1f = TRUE; - m_unk0x20 = 0; + if (m_animatingHit == FALSE) { + m_animatingHit = TRUE; + m_animationDuration = 0; } SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE); @@ -185,7 +187,7 @@ MxResult Act2Actor::VTable0x9c() return SUCCESS; } else { - if (m_unk0x1f) { + if (m_animatingHit) { MxMatrix matrix = m_roi->GetLocal2World(); matrix[3][1] -= 3.0f; m_roi->UpdateTransformationRelativeToParent(matrix); @@ -207,28 +209,28 @@ void Act2Actor::Animate(float p_time) int dummy1; // for BETA10, not sure what it is being used for #ifndef BETA10 - MxFloat local48float = 0.0f; - if (g_unk0x100f0f1c != 0.0f) { - local48float = p_time - g_unk0x100f0f1c; + MxFloat timeSinceLastAnimate = 0.0f; + if (g_lastAnimationTime != 0.0f) { + timeSinceLastAnimate = p_time - g_lastAnimationTime; } - g_unk0x100f0f1c = p_time; + g_lastAnimationTime = p_time; #endif LegoAnimActor::Animate(p_time); - if (m_unk0x44 != 0.0f && m_unk0x44 < p_time) { - SetWorldSpeed(m_unk0x28); + if (m_resetWorldSpeedAt != 0.0f && m_resetWorldSpeedAt < p_time) { + SetWorldSpeed(m_baseWorldSpeed); } - if (m_unk0x1f) { - if (m_unk0x20 > 600.0f) { - m_unk0x1f = FALSE; - m_unk0x20 = 0; + if (m_animatingHit) { + if (m_animationDuration > 600.0f) { + m_animatingHit = FALSE; + m_animationDuration = 0; } else { #ifndef BETA10 - m_unk0x20 += local48float; + m_animationDuration += timeSinceLastAnimate; #endif MxMatrix matrix = m_roi->GetLocal2World(); matrix[3][1] += 3.0f; @@ -245,41 +247,41 @@ void Act2Actor::Animate(float p_time) } if (!m_grec) { - if (m_unk0x1e == 2) { - m_unk0x1e = 0; - m_unk0x2c = m_shootAnim->GetDuration() + p_time; - m_unk0x30 = m_unk0x2c - 1300.0f; + if (m_state == e_roaming) { + m_state = e_readyToShoot; + m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; + m_entityAnimationTime = m_shootAnimEnd - 1300.0f; SetWorldSpeed(0); - m_unk0x1c = FALSE; + m_skipAnimation = FALSE; } - else if (m_unk0x1e == 1) { + else if (m_state == e_endShot) { FindROI("pwrbrik")->SetVisibility(FALSE); FindROI("debrick")->SetVisibility(FALSE); FindROI("ray")->SetVisibility(FALSE); - m_unk0x4c = NULL; - m_unk0x1e = 2; - VTable0xa0(); - FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f); + m_nextEntity = NULL; + m_state = e_roaming; + NextTargetLocation(); + SetWorldSpeed(m_baseWorldSpeed + 3, p_time + 3000.0f); } - else if (m_unk0x1e == 0) { - if (m_unk0x40) { - m_unk0x40 = 0; - m_unk0x2c = m_shootAnim->GetDuration() + p_time; - m_unk0x30 = m_unk0x2c - 1300.0f; + else if (m_state == e_readyToShoot) { + if (m_initializing) { + m_initializing = FALSE; + m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; + m_entityAnimationTime = m_shootAnimEnd - 1300.0f; } - if (FUN_10019700(p_time) == TRUE) { + if (UpdateShot(p_time) == TRUE) { return; } } - else if (m_unk0x1e == 5) { + else if (m_state == e_hiding) { FindROI("brickstr")->SetVisibility(FALSE); GetROI()->SetVisibility(FALSE); CurrentWorld()->RemoveActor(this); return; } #ifndef BETA10 - else if (m_unk0x1e == 4) { + else if (m_state == e_goingToHide) { if (m_worldSpeed == 0.0f) { return; } @@ -291,14 +293,14 @@ void Act2Actor::Animate(float p_time) #endif } - if (m_unk0x1e == 5 || m_unk0x1e == 4) { + if (m_state == e_hiding || m_state == e_goingToHide) { return; } - if (m_unk0x1e == 3) { - if (p_time - m_unk0x24 > 600.0f) { - m_unk0x1e = 2; - FUN_10019250(m_unk0x28 + 4, p_time + 15000.0f); + if (m_state == e_createdBrick) { + if (p_time - m_createBrickTime > 600.0f) { + m_state = e_roaming; + SetWorldSpeed(m_baseWorldSpeed + 4, p_time + 15000.0f); } } else { @@ -323,38 +325,38 @@ void Act2Actor::Animate(float p_time) const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition(); const MxFloat* worldPosition = m_roi->GetWorldPosition(); - MxFloat distance1 = DISTSQRD3(pepperWorldPosition, worldPosition); + MxFloat distanceToAmbulance = DISTSQRD3(pepperWorldPosition, worldPosition); - if (distance1 < 75.0f) { - if (!m_unk0x1c) { - m_unk0x1c = 1; + if (distanceToAmbulance < 75.0f) { + if (!m_skipAnimation) { + m_skipAnimation = TRUE; - if (!m_unk0x1e) { - FUN_100199f0(2); - m_unk0x1e = 1; + if (!m_state) { + PlayNextVoiceOver(VoiceOver::e_interrupt); + m_state = e_endShot; } else { LegoROI* childROI = m_roi->FindChildROI("windsd", m_roi); const MxFloat* childPosition = childROI->GetWorldPosition(); - MxFloat distance2 = DISTSQRD3(pepperWorldPosition, childPosition); + MxFloat distanceToWindshield = DISTSQRD3(pepperWorldPosition, childPosition); childROI = m_roi->FindChildROI("reardr", m_roi); childPosition = childROI->GetWorldPosition(); - MxFloat distance3 = DISTSQRD3(pepperWorldPosition, childPosition); + MxFloat distanceToRearDoor = DISTSQRD3(pepperWorldPosition, childPosition); - if (distance3 > distance2) { - FUN_100199f0(0); + if (distanceToRearDoor > distanceToWindshield) { + PlayNextVoiceOver(VoiceOver::e_head); } else #ifndef BETA10 - if (p_time - m_unk0x24 > 3000.0f) { + if (p_time - m_createBrickTime > 3000.0f) { #endif - SetWorldSpeed(m_unk0x28 - 1); - m_unk0x1e = 3; - m_unk0x24 = p_time; + SetWorldSpeed(m_baseWorldSpeed - 1); + m_state = e_createdBrick; + m_createBrickTime = p_time; - if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) { - FUN_100199f0(1); + if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) { + PlayNextVoiceOver(VoiceOver::e_behind); } #ifndef BETA10 } @@ -363,8 +365,8 @@ void Act2Actor::Animate(float p_time) } } else { - if (m_unk0x1c) { - m_unk0x1c = 0; + if (m_skipAnimation) { + m_skipAnimation = FALSE; } } } @@ -375,11 +377,11 @@ void Act2Actor::Animate(float p_time) // FUNCTION: LEGO1 0x10019250 // FUNCTION: BETA10 0x1000d45c -void Act2Actor::FUN_10019250(MxFloat p_speed, MxFloat p_param2) +void Act2Actor::SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt) { // The arguments have been changed from BETA10 to LEGO1 SetWorldSpeed(p_speed); - m_unk0x44 = p_param2; + m_resetWorldSpeedAt = p_resetWorldSpeedAt; } // FUNCTION: LEGO1 0x10019280 @@ -387,12 +389,12 @@ void Act2Actor::FUN_10019250(MxFloat p_speed, MxFloat p_param2) void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed) { LegoAnimActor::SetWorldSpeed(p_worldSpeed); - m_unk0x44 = 0; + m_resetWorldSpeedAt = 0; } // FUNCTION: LEGO1 0x100192a0 // FUNCTION: BETA10 0x1000d4d6 -void Act2Actor::FUN_100192a0(undefined4 p_location) +void Act2Actor::FindPath(MxU32 p_location) { Mx3DPointFloat newPosition(0.0, 0.0, 0.0); Mx3DPointFloat newDirection(0.0, 0.0, 0.0); @@ -429,37 +431,37 @@ void Act2Actor::FUN_100192a0(undefined4 p_location) } // FUNCTION: LEGO1 0x10019520 -void Act2Actor::FUN_10019520() +void Act2Actor::GoingToHide() { - m_unk0x1e = 4; - SetWorldSpeed(m_unk0x28 + 3); - FUN_100192a0(10); + m_state = e_goingToHide; + SetWorldSpeed(m_baseWorldSpeed + 3); + FindPath(10); } // FUNCTION: LEGO1 0x10019560 -void Act2Actor::FUN_10019560() +void Act2Actor::Hide() { - m_unk0x1e = 5; - SetWorldSpeed(m_unk0x28 + 5); - FUN_100192a0(9); + m_state = e_hiding; + SetWorldSpeed(m_baseWorldSpeed + 5); + FindPath(9); } // FUNCTION: LEGO1 0x100195a0 // FUNCTION: BETA10 0x1000d7d3 -MxS32 Act2Actor::VTable0xa0() +MxS32 Act2Actor::NextTargetLocation() { - undefined4 newLocation; + MxU32 newLocation; assert(!m_grec); CurrentWorld(); MxU16 randomVal = 1 + SDL_rand(2); - if (m_unk0x48 == 8 && m_unk0x1d != 8) { + if (m_visitedLocations == 8 && m_targetLocation != 8) { newLocation = 8; } else { - switch (m_unk0x1d) { + switch (m_targetLocation) { case 0: if (randomVal == 1) { newLocation = 3; @@ -534,10 +536,10 @@ MxS32 Act2Actor::VTable0xa0() } } - undefined4 firstChoice = newLocation; + MxU32 firstChoice = newLocation; - if (m_unk0x48 < 7 || g_brickstrLocations[m_unk0x1d].m_unk0x1c) { - while (g_brickstrLocations[newLocation].m_unk0x1c || m_unk0x1d == newLocation) { + if (m_visitedLocations < 7 || g_brickstrLocations[m_targetLocation].m_cleared) { + while (g_brickstrLocations[newLocation].m_cleared || m_targetLocation == newLocation) { if (newLocation == 7) { newLocation = 0; } @@ -549,8 +551,8 @@ MxS32 Act2Actor::VTable0xa0() } } - m_unk0x1d = newLocation; - FUN_100192a0(newLocation); + m_targetLocation = newLocation; + FindPath(newLocation); if (m_grec) { return SUCCESS; @@ -562,64 +564,64 @@ MxS32 Act2Actor::VTable0xa0() // FUNCTION: LEGO1 0x10019700 // FUNCTION: BETA10 0x1000dd27 -MxU32 Act2Actor::FUN_10019700(MxFloat p_param) +MxU32 Act2Actor::UpdateShot(MxFloat p_time) { - if (!m_unk0x4c) { - g_unk0x100f0f20 = FALSE; - m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20); + if (!m_nextEntity) { + g_nextEntityIsBuilding = FALSE; + m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding); g_unk0x100f0f24 = FALSE; - g_unk0x100f0f28 = FALSE; + g_playedShootSound = FALSE; } - if (!m_unk0x4c) { - MxTrace("nothing left to destroy at location %d\n", m_unk0x1d); - m_unk0x1e = 1; + if (!m_nextEntity) { + MxTrace("nothing left to destroy at location %d\n", m_targetLocation); + m_state = e_endShot; - if (m_unk0x1d == 8) { + if (m_targetLocation == 8) { ((LegoAct2*) CurrentWorld())->BadEnding(); } return TRUE; } - if (!g_unk0x100f0f28 && m_unk0x30 < p_param) { - g_unk0x100f0f28 = TRUE; + if (!g_playedShootSound && m_entityAnimationTime < p_time) { + g_playedShootSound = TRUE; assert(SoundManager()->GetCacheSoundManager()); - SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE); + SoundManager()->GetCacheSoundManager()->Play(m_cachedShootSound, "brickstr", FALSE); - if (g_unk0x100f0f20) { - BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE); + if (g_nextEntityIsBuilding) { + BuildingManager()->ScheduleAnimation(m_nextEntity, 800, TRUE, FALSE); } else { - PlantManager()->ScheduleAnimation(m_unk0x4c, 800); + PlantManager()->ScheduleAnimation(m_nextEntity, 800); } } - if (m_unk0x2c < p_param) { - g_unk0x100f0f20 = FALSE; - m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20); - m_unk0x2c = m_shootAnim->GetDuration() + p_param; - m_unk0x30 = m_unk0x2c - 1300.0f; + if (m_shootAnimEnd < p_time) { + g_nextEntityIsBuilding = FALSE; + m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding); + m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; + m_entityAnimationTime = m_shootAnimEnd - 1300.0f; g_unk0x100f0f24 = FALSE; - g_unk0x100f0f28 = FALSE; + g_playedShootSound = FALSE; return FALSE; } - m_lastTime = p_param; + m_lastTime = p_time; LegoROI* brickstrROI = FindROI("brickstr"); - MxMatrix matrix = m_roi->GetLocal2World(); - matrix[3][1] += 1.0f; - brickstrROI->SetLocal2World(matrix); + MxMatrix initialTransform = m_roi->GetLocal2World(); + initialTransform[3][1] += 1.0f; + brickstrROI->SetLocal2World(initialTransform); brickstrROI->WrappedUpdateWorldData(); - Vector3 col0(matrix[0]); - Vector3 col1(matrix[1]); - Vector3 col2(matrix[2]); - Vector3 col3(matrix[3]); + Vector3 col0(initialTransform[0]); + Vector3 col1(initialTransform[1]); + Vector3 col2(initialTransform[2]); + Vector3 col3(initialTransform[3]); col2 = col3; - col2 -= m_unk0x4c->GetROI()->GetWorldPosition(); + col2 -= m_nextEntity->GetROI()->GetWorldPosition(); col2.Unitize(); col0.EqualsCross(col1, col2); col0.Unitize(); @@ -628,10 +630,10 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param) assert(!m_cameraFlag); LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot(); - MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration()); + MxFloat time = p_time - (m_shootAnimEnd - m_shootAnim->GetDuration()); for (MxS32 i = 0; i < root->GetNumChildren(); i++) { - LegoROI::ApplyAnimationTransformation(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap()); + LegoROI::ApplyAnimationTransformation(root->GetChild(i), initialTransform, time, m_shootAnim->GetROIMap()); } return FALSE; @@ -639,68 +641,68 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param) // FUNCTION: LEGO1 0x100199f0 // FUNCTION: BETA10 0x1000e11a -void Act2Actor::FUN_100199f0(MxS8 p_param) +void Act2Actor::PlayNextVoiceOver(MxS8 p_voiceOverType) { - switch (p_param) { - case 0: + switch (p_voiceOverType) { + case VoiceOver::e_head: switch (g_nextHeadWavIndex) { case 0: ((LegoAct2*) CurrentWorld()) - ->FUN_10052560(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL); + ->StartAction(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL); g_nextHeadWavIndex++; break; default: ((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; break; } break; - case 1: + case VoiceOver::e_behind: switch (g_nextBehindWavIndex) { case 0: ((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++; break; case 1: ((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++; break; case 2: ((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++; break; default: ((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; break; } break; - case 2: + case VoiceOver::e_interrupt: switch (g_nextInterruptWavIndex) { case 0: ((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++; break; case 1: ((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++; break; case 2: ((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++; break; default: ((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; break; } @@ -709,27 +711,27 @@ void Act2Actor::FUN_100199f0(MxS8 p_param) // FUNCTION: LEGO1 0x10019b90 // FUNCTION: BETA10 0x1000e374 -LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) +LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding) { MxS32 i; LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i); LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i); LegoEntity* result = 0; - switch (m_unk0x1d) { + switch (m_targetLocation) { case 0: if (buildingInfo[12].m_counter) { result = buildingInfo[12].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else if (buildingInfo[14].m_counter) { result = buildingInfo[14].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage0Plants[i] != -1; i++) { - if (plantInfo[g_stage0Plants[i]].m_counter) { - result = plantInfo[g_stage0Plants[i]].m_entity; + for (i = 0; g_location0Plants[i] != -1; i++) { + if (plantInfo[g_location0Plants[i]].m_counter) { + result = plantInfo[g_location0Plants[i]].m_entity; break; } } @@ -738,12 +740,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 1: if (buildingInfo[13].m_counter) { result = buildingInfo[13].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage1Plants[i] != -1; i++) { - if (plantInfo[g_stage1Plants[i]].m_counter) { - result = plantInfo[g_stage1Plants[i]].m_entity; + for (i = 0; g_location1Plants[i] != -1; i++) { + if (plantInfo[g_location1Plants[i]].m_counter) { + result = plantInfo[g_location1Plants[i]].m_entity; break; } } @@ -752,16 +754,16 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 2: if (buildingInfo[9].m_counter) { result = buildingInfo[9].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else if (buildingInfo[11].m_counter) { result = buildingInfo[11].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage2Plants[i] != -1; i++) { - if (plantInfo[g_stage2Plants[i]].m_counter) { - result = plantInfo[g_stage2Plants[i]].m_entity; + for (i = 0; g_location2Plants[i] != -1; i++) { + if (plantInfo[g_location2Plants[i]].m_counter) { + result = plantInfo[g_location2Plants[i]].m_entity; break; } } @@ -770,20 +772,20 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 3: if (buildingInfo[7].m_counter) { result = buildingInfo[7].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else if (buildingInfo[8].m_counter) { result = buildingInfo[8].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else if (buildingInfo[3].m_counter) { result = buildingInfo[3].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage3Plants[i] != -1; i++) { - if (plantInfo[g_stage3Plants[i]].m_counter) { - result = plantInfo[g_stage3Plants[i]].m_entity; + for (i = 0; g_location3Plants[i] != -1; i++) { + if (plantInfo[g_location3Plants[i]].m_counter) { + result = plantInfo[g_location3Plants[i]].m_entity; break; } } @@ -792,16 +794,16 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 4: if (buildingInfo[5].m_counter) { result = buildingInfo[5].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else if (buildingInfo[10].m_counter) { result = buildingInfo[10].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage4Plants[i] != -1; i++) { - if (plantInfo[g_stage4Plants[i]].m_counter) { - result = plantInfo[g_stage4Plants[i]].m_entity; + for (i = 0; g_location4Plants[i] != -1; i++) { + if (plantInfo[g_location4Plants[i]].m_counter) { + result = plantInfo[g_location4Plants[i]].m_entity; break; } } @@ -810,12 +812,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 5: if (buildingInfo[4].m_counter) { result = buildingInfo[4].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage5Plants[i] != -1; i++) { - if (plantInfo[g_stage5Plants[i]].m_counter) { - result = plantInfo[g_stage5Plants[i]].m_entity; + for (i = 0; g_location5Plants[i] != -1; i++) { + if (plantInfo[g_location5Plants[i]].m_counter) { + result = plantInfo[g_location5Plants[i]].m_entity; break; } } @@ -824,12 +826,12 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 6: if (buildingInfo[2].m_counter) { result = buildingInfo[2].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage6Plants[i] != -1; i++) { - if (plantInfo[g_stage6Plants[i]].m_counter) { - result = plantInfo[g_stage6Plants[i]].m_entity; + for (i = 0; g_location6Plants[i] != -1; i++) { + if (plantInfo[g_location6Plants[i]].m_counter) { + result = plantInfo[g_location6Plants[i]].m_entity; break; } } @@ -838,21 +840,21 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) case 7: if (buildingInfo[6].m_counter) { result = buildingInfo[6].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } else { - for (i = 0; g_stage7Plants[i] != -1; i++) { - if (plantInfo[g_stage7Plants[i]].m_counter) { - result = plantInfo[g_stage7Plants[i]].m_entity; + for (i = 0; g_location7Plants[i] != -1; i++) { + if (plantInfo[g_location7Plants[i]].m_counter) { + result = plantInfo[g_location7Plants[i]].m_entity; break; } } } break; case 8: - for (i = 0; g_stage8Plants[i] != -1; i++) { - if (plantInfo[g_stage8Plants[i]].m_counter) { - result = plantInfo[g_stage8Plants[i]].m_entity; + for (i = 0; g_location8Plants[i] != -1; i++) { + if (plantInfo[g_location8Plants[i]].m_counter) { + result = plantInfo[g_location8Plants[i]].m_entity; break; } } @@ -863,14 +865,14 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) if (buildingInfo[15].m_counter) { result = buildingInfo[15].m_entity; - *p_param = TRUE; + *p_isBuilding = TRUE; } break; } - if (!result && !g_brickstrLocations[m_unk0x1d].m_unk0x1c) { - g_brickstrLocations[m_unk0x1d].m_unk0x1c = TRUE; - m_unk0x48++; + if (!result && !g_brickstrLocations[m_targetLocation].m_cleared) { + g_brickstrLocations[m_targetLocation].m_cleared = TRUE; + m_visitedLocations++; } return result; diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index efba4068..1c58cecf 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -583,11 +583,11 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 break; } - if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) { + if (state != NULL && state->m_finishedBuild && !state->m_playedExitScript) { if (AnimationManager() ->FUN_10060dc0(anim, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, TRUE, TRUE) == SUCCESS) { - state->m_unk0x4e = TRUE; + state->m_playedExitScript = TRUE; camAnim = FALSE; } } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index ab456f39..e4f58b02 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -51,7 +51,7 @@ DECOMP_SIZE_ASSERT(LegoCarBuild::LookupTableActions, 0x1c); // GLOBAL: LEGO1 0x100d65b0 // GLOBAL: BETA10 0x101bb7c0 -LegoCarBuild::LookupTableActions LegoCarBuild::g_unk0x100d65b0[] = { +LegoCarBuild::LookupTableActions LegoCarBuild::g_actorScripts[] = { {DunecarScript::c_igs001d3_RunAnim, DunecarScript::c_igs002d3_RunAnim, DunecarScript::c_igs003d3_RunAnim, @@ -83,22 +83,22 @@ LegoCarBuild::LookupTableActions LegoCarBuild::g_unk0x100d65b0[] = { }; // GLOBAL: LEGO1 0x100d65a4 -MxFloat LegoCarBuild::g_unk0x100d65a4 = -0.1f; +MxFloat LegoCarBuild::g_selectedPartRotationAngleStepYAxis = -0.1f; // GLOBAL: LEGO1 0x100d65a8 MxFloat LegoCarBuild::g_rotationAngleStepYAxis = 0.07; // GLOBAL: LEGO1 0x100f11cc -MxS16 LegoCarBuild::g_unk0x100f11cc = -1; +MxS16 LegoCarBuild::g_lastTickleState = -1; // FUNCTION: LEGO1 0x100226d0 // FUNCTION: BETA10 0x1006ac10 LegoCarBuild::LegoCarBuild() { - m_unk0x100 = 0; + m_clickState = e_idle; m_selectedPart = 0; - m_unk0xf8 = c_unknownminusone; - m_selectedPartIsPlaced = FALSE; + m_resetPlacedSelectedPart = c_disabled; + m_displayedPartIsPlaced = FALSE; m_animPresenter = NULL; m_ColorBook_Bitmap = NULL; m_Yellow_Ctl = NULL; @@ -121,15 +121,15 @@ LegoCarBuild::LegoCarBuild() m_Decals_Ctl5 = NULL; m_Decals_Ctl6 = NULL; m_Decals_Ctl7 = NULL; - m_unk0x33c = NULL; + m_tickledControl = NULL; m_buildState = NULL; m_unk0x104 = 0; - m_unk0x109 = 0; + m_missclickCounter = 0; m_numAnimsRun = 0; - m_unk0x338 = 0; + m_jukeboxPresenter = 0; m_destLocation = LegoGameState::e_undefined; - m_unk0x344 = DS_NOT_A_STREAM; - m_unk0x174 = 0; + m_playingActorScript = DS_NOT_A_STREAM; + m_alreadyFinished = 0; NotificationManager()->Register(this); } @@ -137,7 +137,7 @@ LegoCarBuild::LegoCarBuild() // FUNCTION: BETA10 0x1006aea3 LegoCarBuild::~LegoCarBuild() { - m_unk0x100 = 0; + m_clickState = e_idle; m_selectedPart = NULL; if (m_animPresenter) { @@ -205,12 +205,12 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction) } m_buildState = buildState; - m_unk0x174 = m_buildState->m_unk0x4d; + m_alreadyFinished = m_buildState->m_finishedBuild; GameState()->StopArea(LegoGameState::e_previousArea); m_buildState->m_animationState = LegoVehicleBuildState::e_entering; - m_unk0x100 = 0; + m_clickState = e_idle; BackgroundAudioManager()->Stop(); EnableAnimations(FALSE); @@ -289,22 +289,22 @@ void LegoCarBuild::InitPresenters() } // FUNCTION: LEGO1 0x10022f00 -void LegoCarBuild::FUN_10022f00() +void LegoCarBuild::DisplaySelectedPart() { if (m_selectedPart) { - VTable0x6c(); + InitializeDisplayingTransform(); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected); - m_unk0x100 = 5; + m_clickState = e_displaying; } } // FUNCTION: LEGO1 0x10022f30 // FUNCTION: BETA10 0x1006b835 -void LegoCarBuild::FUN_10022f30() +void LegoCarBuild::ResetSelectedPart() { if (m_selectedPart) { - FUN_10024f70(FALSE); - FUN_100250e0(FALSE); + EnableColorControlsForSelectedPart(FALSE); + EnableDecalForSelectedPart(FALSE); if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { m_PlaceBrick_Sound->Enable(FALSE); @@ -314,154 +314,157 @@ void LegoCarBuild::FUN_10022f30() m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped); m_animPresenter->PutFrame(); m_selectedPart = NULL; - m_unk0x100 = 0; + m_clickState = e_idle; } } // FUNCTION: LEGO1 0x10022fc0 // FUNCTION: BETA10 0x1006b90b -void LegoCarBuild::VTable0x6c() +void LegoCarBuild::InitializeDisplayingTransform() { - m_unk0x178 = m_unk0x1c0; - m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0x178); - m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition()); + m_selectedPartStartTransform = m_displayTransform; + m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(m_selectedPartStartTransform); + m_selectedPartStartPosition = Vector4(m_selectedPart->GetWorldPosition()); - VTable0x70(); + CalculateStartAndTargetScreenPositions(); } // FUNCTION: LEGO1 0x10023020 // FUNCTION: BETA10 0x1006b991 -void LegoCarBuild::VTable0x70() +void LegoCarBuild::CalculateStartAndTargetScreenPositions() { MxFloat worldPos[3]; MxFloat screenPos[4]; - worldPos[0] = m_unk0x2a4[0]; - worldPos[1] = m_unk0x2a4[1]; - worldPos[2] = m_unk0x2a4[2]; + worldPos[0] = m_selectedPartStartPosition[0]; + worldPos[1] = m_selectedPartStartPosition[1]; + worldPos[2] = m_selectedPartStartPosition[2]; TransformWorldToScreen(worldPos, screenPos); - m_unk0x290[0] = screenPos[0] / screenPos[3]; - m_unk0x290[1] = screenPos[1] / screenPos[3]; + m_selectedPartStartScreenPosition[0] = screenPos[0] / screenPos[3]; + m_selectedPartStartScreenPosition[1] = screenPos[1] / screenPos[3]; - worldPos[0] = m_unk0x2bc[0]; - worldPos[1] = m_unk0x2bc[1]; - worldPos[2] = m_unk0x2bc[2]; + worldPos[0] = m_selectedPartTargetPosition[0]; + worldPos[1] = m_selectedPartTargetPosition[1]; + worldPos[2] = m_selectedPartTargetPosition[2]; TransformWorldToScreen(worldPos, screenPos); - m_unk0x298[0] = screenPos[0] / screenPos[3]; - m_unk0x298[1] = screenPos[1] / screenPos[3]; + m_selectedPartTargetScreenPosition[0] = screenPos[0] / screenPos[3]; + m_selectedPartTargetScreenPosition[1] = screenPos[1] / screenPos[3]; - m_unk0x2a0 = sqrt((MxDouble) DISTSQRD2(m_unk0x290, m_unk0x298)); + m_normalizedDistance = + sqrt((MxDouble) DISTSQRD2(m_selectedPartStartScreenPosition, m_selectedPartTargetScreenPosition)); - m_unk0x25c.SetStartEnd(m_unk0x178, m_unk0x208); + m_draggingQuarternionTransformer.SetStartEnd(m_selectedPartStartTransform, m_selectedPartTargetTransform); } // FUNCTION: LEGO1 0x10023130 // FUNCTION: BETA10 0x1006bb22 -void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y) +void LegoCarBuild::CalculateSelectedPartMatrix(MxLong p_x, MxLong p_y) { if (m_selectedPart) { - MxFloat pfVar3[2]; + MxFloat screenCoordinatesForRay[2]; MxFloat local30[3]; MxFloat local84[3]; - p_x += (m_unk0x290[0] - m_unk0x250[0]); - p_y += (m_unk0x290[1] - m_unk0x250[1]); + p_x += (m_selectedPartStartScreenPosition[0] - m_selectedPartStartMousePosition[0]); + p_y += (m_selectedPartStartScreenPosition[1] - m_selectedPartStartMousePosition[1]); - pfVar3[0] = p_x; - pfVar3[1] = p_y; + screenCoordinatesForRay[0] = p_x; + screenCoordinatesForRay[1] = p_y; - if (CalculateRayOriginDirection(pfVar3, local30, local84)) { - MxFloat local18[3]; - MxFloat local8c[2]; + if (CalculateRayOriginDirection(screenCoordinatesForRay, local30, local84)) { + MxFloat positionOffset[3]; + MxFloat screenPosition[2]; - local8c[0] = p_x; - local8c[1] = p_y; + screenPosition[0] = p_x; + screenPosition[1] = p_y; - local18[0] = 0; - local18[1] = 0; - local18[2] = 0; + positionOffset[0] = 0; + positionOffset[1] = 0; + positionOffset[2] = 0; - MxMatrix local78; + MxMatrix transform; - if (p_y < m_unk0x290[1]) { - VTable0x74(local8c, local18); + if (p_y < m_selectedPartStartScreenPosition[1]) { + CalculateDragPositionAbove(screenPosition, positionOffset); } - else if (p_y > m_unk0x298[1]) { - VTable0x7c(local8c, local18); + else if (p_y > m_selectedPartTargetScreenPosition[1]) { + CalculateDragPositionOnGround(screenPosition, positionOffset); } - else if (p_y >= m_unk0x290[1]) { - VTable0x78(local8c, local18); + else if (p_y >= m_selectedPartStartScreenPosition[1]) { + CalculateDragPositionBetween(screenPosition, positionOffset); } - MxS32 local20[2]; + MxS32 currentDistance[2]; - local20[0] = p_x - m_unk0x290[0]; - local20[1] = p_y - m_unk0x290[1]; + currentDistance[0] = p_x - m_selectedPartStartScreenPosition[0]; + currentDistance[1] = p_y - m_selectedPartStartScreenPosition[1]; - MxFloat local1c = sqrt((double) (NORMSQRD2(local20))) / m_unk0x2a0; + MxFloat distanceRatio = sqrt((double) (NORMSQRD2(currentDistance))) / m_normalizedDistance; - m_unk0x25c.InterpolateToMatrix(local78, local1c); + m_draggingQuarternionTransformer.InterpolateToMatrix(transform, distanceRatio); - local78[3][0] = m_unk0x178[3][0] + local18[0]; - local78[3][1] = m_unk0x178[3][1] + local18[1]; - local78[3][2] = m_unk0x178[3][2] + local18[2]; - local78[3][3] = 1.0; + transform[3][0] = m_selectedPartStartTransform[3][0] + positionOffset[0]; + transform[3][1] = m_selectedPartStartTransform[3][1] + positionOffset[1]; + transform[3][2] = m_selectedPartStartTransform[3][2] + positionOffset[2]; + transform[3][3] = 1.0; - m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(local78); + m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(transform); } } } // FUNCTION: LEGO1 0x10023500 // FUNCTION: BETA10 0x1006bdf6 -void LegoCarBuild::VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]) +void LegoCarBuild::CalculateDragPositionAbove(MxFloat p_coordinates[2], MxFloat p_position[3]) { - MxFloat fVar1; - MxFloat local20[3]; - MxFloat local14[3]; + MxFloat planeFactor; + MxFloat origin[3]; + MxFloat direction[3]; - CalculateRayOriginDirection(p_param1, local14, local20); + CalculateRayOriginDirection(p_coordinates, direction, origin); - fVar1 = (m_unk0x2a4[2] - local20[2]) / local14[2]; - p_param2[0] = (fVar1 * local14[0] + local20[0]) - m_unk0x2a4[0]; - p_param2[1] = (fVar1 * local14[1] + local20[1]) - m_unk0x2a4[1]; - p_param2[2] = 0.0; + planeFactor = (m_selectedPartStartPosition[2] - origin[2]) / direction[2]; + p_position[0] = (planeFactor * direction[0] + origin[0]) - m_selectedPartStartPosition[0]; + p_position[1] = (planeFactor * direction[1] + origin[1]) - m_selectedPartStartPosition[1]; + p_position[2] = 0.0; } // FUNCTION: LEGO1 0x10023570 // FUNCTION: BETA10 0x1006be91 -void LegoCarBuild::VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]) +void LegoCarBuild::CalculateDragPositionBetween(MxFloat p_coordinates[2], MxFloat p_position[3]) { - MxFloat fVar1; - MxFloat local18[3]; - MxFloat localc[3]; + MxFloat planeFactor; + MxFloat direction[3]; + MxFloat origin[3]; - CalculateRayOriginDirection(p_param1, local18, localc); + CalculateRayOriginDirection(p_coordinates, direction, origin); - p_param2[2] = m_unk0x2a4[2] + - (m_unk0x2bc[2] - m_unk0x2a4[2]) * ((p_param1[1] - m_unk0x290[1]) / (m_unk0x298[1] - m_unk0x290[1])); - fVar1 = (p_param2[2] - localc[2]) / local18[2]; - p_param2[0] = fVar1 * local18[0] - m_unk0x2a4[0] + localc[0]; - p_param2[1] = fVar1 * local18[1] - m_unk0x2a4[1] + localc[1]; - p_param2[2] = p_param2[2] - m_unk0x2a4[2]; + p_position[2] = m_selectedPartStartPosition[2] + + (m_selectedPartTargetPosition[2] - m_selectedPartStartPosition[2]) * + ((p_coordinates[1] - m_selectedPartStartScreenPosition[1]) / + (m_selectedPartTargetScreenPosition[1] - m_selectedPartStartScreenPosition[1])); + planeFactor = (p_position[2] - origin[2]) / direction[2]; + p_position[0] = planeFactor * direction[0] - m_selectedPartStartPosition[0] + origin[0]; + p_position[1] = planeFactor * direction[1] - m_selectedPartStartPosition[1] + origin[1]; + p_position[2] = p_position[2] - m_selectedPartStartPosition[2]; } // FUNCTION: LEGO1 0x10023620 // FUNCTION: BETA10 0x1006bfb5 -void LegoCarBuild::VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]) +void LegoCarBuild::CalculateDragPositionOnGround(MxFloat p_coordinates[2], MxFloat p_position[3]) { - MxFloat local18[3]; - MxFloat localc[3]; - CalculateRayOriginDirection(p_param1, local18, localc); + MxFloat direction[3]; + MxFloat origin[3]; + CalculateRayOriginDirection(p_coordinates, direction, origin); - MxFloat fVar1 = (m_unk0x2bc[1] - localc[1]) / local18[1]; - p_param2[0] = fVar1 * local18[0] - m_unk0x2a4[0] + localc[0]; - p_param2[1] = m_unk0x2bc[1] - m_unk0x2a4[1]; - p_param2[2] = fVar1 * local18[2] - m_unk0x2a4[2] + localc[2]; + MxFloat planeFactor = (m_selectedPartTargetPosition[1] - origin[1]) / direction[1]; + p_position[0] = planeFactor * direction[0] - m_selectedPartStartPosition[0] + origin[0]; + p_position[1] = m_selectedPartTargetPosition[1] - m_selectedPartStartPosition[1]; + p_position[2] = planeFactor * direction[2] - m_selectedPartStartPosition[2] + origin[2]; } // FUNCTION: LEGO1 0x100236a0 @@ -479,46 +482,46 @@ void LegoCarBuild::VTable0x80(MxFloat p_param1[2], MxFloat p_param2[2], MxFloat // FUNCTION: BETA10 0x1006c076 void LegoCarBuild::AddSelectedPartToBuild() { - MxS32 pLVar2; + MxS32 jukeboxScript; - FUN_10024f70(FALSE); - FUN_100250e0(FALSE); + EnableColorControlsForSelectedPart(FALSE); + EnableDecalForSelectedPart(FALSE); m_animPresenter->AddPartToBuildByName(m_selectedPart->GetName()); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped); m_selectedPart = NULL; - m_unk0x100 = 0; + m_clickState = e_idle; if (m_animPresenter->AllPartsPlaced() && !Lego()->IsVersion10()) { // Note the code duplication with LEGO1 0x10025ee0 switch (m_carId) { - case 1: - pLVar2 = 0x2f; + case Helicopter_Actor: + jukeboxScript = JukeboxScript::c_HelicopterBuild_Movie; break; - case 2: - pLVar2 = 0x31; + case DuneBugy_Actor: + jukeboxScript = JukeboxScript::c_DuneCarBuild_Movie; break; - case 3: - pLVar2 = 0x33; + case Jetski_Actor: + jukeboxScript = JukeboxScript::c_JetskiBuild_Movie; break; - case 4: - pLVar2 = 0x35; + case RaceCar_Actor: + jukeboxScript = JukeboxScript::c_RaceCarBuild_Movie; } BackgroundAudioManager()->Init(); - InvokeAction(Extra::e_stop, *g_jukeboxScript, pLVar2, NULL); + InvokeAction(Extra::e_stop, *g_jukeboxScript, jukeboxScript, NULL); if (m_numAnimsRun > 0) { DeleteObjects(&m_atomId, 500, 510); } if (GameState()->GetCurrentAct() == LegoGameState::e_act2) { - FUN_100243a0(); + InitExiting(); } else { - m_buildState->m_unk0x4d = TRUE; + m_buildState->m_finishedBuild = TRUE; InvokeAction(Extra::e_start, m_atomId, m_carId, NULL); NotificationManager()->Send(this, MxNotificationParam()); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown4; + m_buildState->m_animationState = LegoVehicleBuildState::e_finishedBuild; m_buildState->m_placedPartCount = 0; } } @@ -526,7 +529,7 @@ void LegoCarBuild::AddSelectedPartToBuild() #define LEGOCARBUILD_TICKLE_CASE(subtract, start, end, str) \ if (start < dTime && dTime < end) { \ - FUN_10025db0(str, dTime - subtract); \ + TickleControl(str, dTime - subtract); \ break; \ } @@ -539,28 +542,28 @@ MxResult LegoCarBuild::Tickle() return SUCCESS; } - if (m_unk0xf8 == c_unknown8) { - if (m_unk0xfc == 1) { - FUN_10024f50(); + if (m_resetPlacedSelectedPart == c_enabled) { + if (m_rotateBuild == 1) { + RotateVehicle(); } if (m_selectedPart) { if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { - FUN_10022f30(); + ResetSelectedPart(); } } } - if (m_unk0x100 == 5 && m_selectedPart) { - RotateY(m_selectedPart, g_unk0x100d65a4); + if (m_clickState == e_displaying && m_selectedPart) { + RotateY(m_selectedPart, g_selectedPartRotationAngleStepYAxis); } - if (m_unk0x10a) { - Uint64 time = SDL_GetTicks(); - Uint64 dTime = (time - m_unk0x10c) / 100; + if (m_lastActorScript) { + MxULong time = SDL_GetTicks(); + MxULong dTime = (time - m_lastActorScriptStartTime) / 100; if (m_carId == RaceCar_Actor) { - switch (m_unk0x10a) { + switch (m_lastActorScript) { case RacecarScript::c_irt001d1_RunAnim: LEGOCARBUILD_TICKLE_CASE(160, 160, 180, "Exit_Ctl") LEGOCARBUILD_TICKLE_CASE(260, 260, 280, "ShelfUp_Ctl") @@ -583,7 +586,7 @@ MxResult LegoCarBuild::Tickle() } } else if (m_carId == Jetski_Actor) { - switch (m_unk0x10a) { + switch (m_lastActorScript) { case JetskiScript::c_ijs001d4_RunAnim: LEGOCARBUILD_TICKLE_CASE(291, 291, 311, "Exit_Ctl") LEGOCARBUILD_TICKLE_CASE(311, 311, 331, "ShelfUp_Ctl") @@ -606,7 +609,7 @@ MxResult LegoCarBuild::Tickle() } } else if (m_carId == DuneBugy_Actor) { - switch (m_unk0x10a) { + switch (m_lastActorScript) { case DunecarScript::c_igs001d3_RunAnim: LEGOCARBUILD_TICKLE_CASE(155, 155, 175, "Exit_Ctl") LEGOCARBUILD_TICKLE_CASE(215, 215, 235, "ShelfUp_Ctl") @@ -623,7 +626,7 @@ MxResult LegoCarBuild::Tickle() } } else if (m_carId == Helicopter_Actor) { - switch (m_unk0x10a) { + switch (m_lastActorScript) { case CopterScript::c_ips001d2_RunAnim: LEGOCARBUILD_TICKLE_CASE(185, 185, 205, "Exit_Ctl") LEGOCARBUILD_TICKLE_CASE(235, 235, 255, "ShelfUp_Ctl") @@ -659,37 +662,40 @@ MxLong LegoCarBuild::Notify(MxParam& p_param) if (m_worldStarted) { switch (param.GetNotification()) { case c_notificationType0: - FUN_10024c20((MxNotificationParam*) &p_param); + HandleType0Notification((MxNotificationParam*) &p_param); result = 1; break; case c_notificationEndAction: - result = FUN_10024480((MxActionNotificationParam*) &p_param); + result = HandleEndAction((MxActionNotificationParam*) &p_param); break; case c_notificationKeyPress: - result = FUN_10024250((LegoEventNotificationParam*) &p_param); + result = HandleKeyPress((LegoEventNotificationParam*) &p_param); break; case c_notificationButtonUp: - result = FUN_100246e0( + result = HandleButtonUp( ((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY() ); - if (result || m_unk0x10a || m_buildState->m_animationState == 4 || m_buildState->m_animationState == 6) { - m_unk0x109 = 0; + if (result || m_lastActorScript || + m_buildState->m_animationState == LegoVehicleBuildState::e_finishedBuild || + m_buildState->m_animationState == LegoVehicleBuildState::e_exiting) { + m_missclickCounter = 0; break; } - if (++m_unk0x109 > 2) { - FUN_10025720(6); - m_unk0x109 = 0; + if (++m_missclickCounter > 2) { + StartActorScriptByType(LookupTableActionType::e_shortExplanation); + m_missclickCounter = 0; } break; case c_notificationButtonDown: assert(m_buildState); - if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) && - (m_buildState->m_animationState != 2)) { - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; + if (((m_buildState->m_animationState != LegoVehicleBuildState::e_finishedBuild) && + (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting)) && + (m_buildState->m_animationState != LegoVehicleBuildState::e_settingUpMovie)) { + m_buildState->m_animationState = LegoVehicleBuildState::e_none; result = SelectPartFromMousePosition( ((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY() @@ -698,21 +704,21 @@ MxLong LegoCarBuild::Notify(MxParam& p_param) break; case c_notificationMouseMove: - result = FUN_10024850( + result = HandleMouseMove( ((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY() ); if (result == 1) { - m_unk0x109 = 0; + m_missclickCounter = 0; } break; case c_notificationControl: - result = FUN_10024890(&p_param); + result = HandleControl(&p_param); if (result == 1) { - m_unk0x109 = 0; + m_missclickCounter = 0; } break; @@ -721,8 +727,8 @@ MxLong LegoCarBuild::Notify(MxParam& p_param) m_numAnimsRun -= 1; } - FUN_10025e40(); - m_unk0x10a = 0; + HandleEndAnim(); + m_lastActorScript = 0; result = 1; break; case c_notificationTransitioned: @@ -736,13 +742,14 @@ MxLong LegoCarBuild::Notify(MxParam& p_param) // FUNCTION: LEGO1 0x10024250 // FUNCTION: BETA10 0x1006cc48 -undefined4 LegoCarBuild::FUN_10024250(LegoEventNotificationParam* p_param) +MxLong LegoCarBuild::HandleKeyPress(LegoEventNotificationParam* p_param) { - if (p_param->GetKey() == ' ' && m_buildState->m_animationState != 4 && m_buildState->m_animationState != 2) { + if (p_param->GetKey() == ' ' && m_buildState->m_animationState != LegoVehicleBuildState::e_finishedBuild && + m_buildState->m_animationState != LegoVehicleBuildState::e_settingUpMovie) { if (m_numAnimsRun > 0) { DeleteObjects(&m_atomId, 500, 0x1fe); BackgroundAudioManager()->RaiseVolume(); - m_unk0x109 = 0; + m_missclickCounter = 0; } return 1; @@ -758,17 +765,17 @@ void LegoCarBuild::ReadyWorld() InitPresenters(); if (BackgroundAudioManager()->GetEnabled()) { - InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, FUN_10025ee0(m_carId), NULL); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown2; + InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, GetBuildMovieId(m_carId), NULL); + m_buildState->m_animationState = LegoVehicleBuildState::e_settingUpMovie; NotificationManager()->Send(this, MxNotificationParam()); } else { - FUN_10024ef0(); + StartIntroduction(); } } // FUNCTION: LEGO1 0x100243a0 -void LegoCarBuild::FUN_100243a0() +void LegoCarBuild::InitExiting() { switch (m_carId) { case Helicopter_Actor: @@ -797,19 +804,19 @@ void LegoCarBuild::FUN_100243a0() } // FUNCTION: LEGO1 0x10024480 -undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param) +MxLong LegoCarBuild::HandleEndAction(MxActionNotificationParam* p_param) { - MxS32 result = 0; + MxLong result = 0; switch (m_buildState->m_animationState) { - case 3: + case LegoVehicleBuildState::e_cutscene: BackgroundAudioManager()->RaiseVolume(); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; + m_buildState->m_animationState = LegoVehicleBuildState::e_none; result = 1; break; - case 6: - if (p_param->GetAction()->GetObjectId() == m_unk0x344) { - FUN_100243a0(); + case LegoVehicleBuildState::e_exiting: + if (p_param->GetAction()->GetObjectId() == m_playingActorScript) { + InitExiting(); result = 1; break; } @@ -820,10 +827,10 @@ undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param) // FUNCTION: LEGO1 0x100244e0 // FUNCTION: BETA10 0x1006cfb6 -undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y) +MxLong LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y) { - m_unk0x250[0] = p_x; - m_unk0x250[1] = p_y; + m_selectedPartStartMousePosition[0] = p_x; + m_selectedPartStartMousePosition[1] = p_y; LegoROI* roi = PickROI(p_x, p_y); @@ -832,43 +839,45 @@ undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y) } if (m_selectedPart != roi) { - FUN_10022f30(); + ResetSelectedPart(); m_selectedPart = roi; - FUN_10024f70(TRUE); - FUN_100250e0(TRUE); + EnableColorControlsForSelectedPart(TRUE); + EnableDecalForSelectedPart(TRUE); } - if (m_unk0x100 == 5 && m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { - m_selectedPartIsPlaced = TRUE; + if (m_clickState == e_displaying && m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { + m_displayedPartIsPlaced = TRUE; } else { - m_selectedPartIsPlaced = FALSE; + m_displayedPartIsPlaced = FALSE; } - FUN_10025450(); - VTable0x70(); + CalculateStartAndTargetTransforms(); + CalculateStartAndTargetScreenPositions(); if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { - if (m_unk0x100 != 5) { - m_unk0x250[0] += m_unk0x290[0] - m_unk0x298[0]; - m_unk0x250[1] += m_unk0x290[1] - m_unk0x298[1]; + if (m_clickState != e_displaying) { + m_selectedPartStartMousePosition[0] += + m_selectedPartStartScreenPosition[0] - m_selectedPartTargetScreenPosition[0]; + m_selectedPartStartMousePosition[1] += + m_selectedPartStartScreenPosition[1] - m_selectedPartTargetScreenPosition[1]; } - if (m_unk0x100 == 0) { - m_unk0x114 = m_selectedPart->GetWorldBoundingSphere(); + if (m_clickState == e_idle) { + m_targetBoundingSphere = m_selectedPart->GetWorldBoundingSphere(); } } else { - if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { - m_unk0x114 = m_animPresenter->FUN_10079e20(); + if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) { + m_targetBoundingSphere = m_animPresenter->GetTargetBoundingSphere(); } } - switch (m_unk0x100) { - case 0: - m_unk0x100 = 4; + switch (m_clickState) { + case e_idle: + m_clickState = e_selecting; break; - case 5: - m_unk0x100 = 3; + case e_displaying: + m_clickState = e_returning; break; } @@ -881,44 +890,44 @@ undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y) // FUNCTION: LEGO1 0x100246e0 // FUNCTION: BETA10 0x1006d25a -undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y) +MxLong LegoCarBuild::HandleButtonUp(MxLong p_x, MxLong p_y) { - undefined4 result = 0; + MxLong result = 0; - switch (m_unk0x100) { - case 3: - FUN_10022f30(); + switch (m_clickState) { + case e_returning: + ResetSelectedPart(); result = 1; break; - case 4: - FUN_10022f00(); + case e_selecting: + DisplaySelectedPart(); result = 1; break; - case 6: + case e_dragging: if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName()) && - SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) { - FUN_10024f70(FALSE); - FUN_100250e0(FALSE); - m_unk0x100 = 0; + SpheresIntersect(m_targetBoundingSphere, m_selectedPart->GetWorldBoundingSphere())) { + EnableColorControlsForSelectedPart(FALSE); + EnableDecalForSelectedPart(FALSE); + m_clickState = e_idle; m_selectedPart = NULL; m_PlaceBrick_Sound->Enable(FALSE); m_PlaceBrick_Sound->Enable(TRUE); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped); } - else if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { - if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) { + else if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) { + if (SpheresIntersect(m_targetBoundingSphere, m_selectedPart->GetWorldBoundingSphere())) { m_PlaceBrick_Sound->Enable(FALSE); m_PlaceBrick_Sound->Enable(TRUE); AddSelectedPartToBuild(); } else { - VTable0x6c(); - m_unk0x100 = 5; + InitializeDisplayingTransform(); + m_clickState = e_displaying; } } else { - VTable0x6c(); - m_unk0x100 = 5; + InitializeDisplayingTransform(); + m_clickState = e_displaying; } result = 1; @@ -930,16 +939,16 @@ undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y) // FUNCTION: LEGO1 0x10024850 // FUNCTION: BETA10 0x1006d48e -MxS32 LegoCarBuild::FUN_10024850(MxLong p_x, MxLong p_y) +MxLong LegoCarBuild::HandleMouseMove(MxLong p_x, MxLong p_y) { - MxS32 result = 0; + MxLong result = 0; - switch (m_unk0x100) { - case 3: - case 4: - m_unk0x100 = 6; - case 6: - FUN_10023130(p_x, p_y); + switch (m_clickState) { + case e_returning: + case e_selecting: + m_clickState = e_dragging; + case e_dragging: + CalculateSelectedPartMatrix(p_x, p_y); result = 1; break; } @@ -950,9 +959,9 @@ MxS32 LegoCarBuild::FUN_10024850(MxLong p_x, MxLong p_y) #ifndef BETA10 // FUNCTION: LEGO1 0x10024890 -undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) +MxLong LegoCarBuild::HandleControl(MxParam* p_param) { - undefined4 result = 0; + MxLong result = 0; LegoControlManagerNotificationParam* param = (LegoControlManagerNotificationParam*) p_param; assert(m_buildState); @@ -960,8 +969,8 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) switch (param->m_clickedObjectId) { // The enum values are all identical between CopterScript, DunecarScript, JetskiScript, and RacecarScript case CopterScript::c_Info_Ctl: - if (m_buildState->m_animationState != LegoVehicleBuildState::e_unknown4 && - m_buildState->m_animationState != LegoVehicleBuildState::e_unknown2 && + if (m_buildState->m_animationState != LegoVehicleBuildState::e_finishedBuild && + m_buildState->m_animationState != LegoVehicleBuildState::e_settingUpMovie && m_buildState->m_animationState != LegoVehicleBuildState::e_exiting && GameState()->GetCurrentAct() != LegoGameState::e_act2) { if (m_numAnimsRun > 0) { @@ -977,7 +986,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) break; case CopterScript::c_Exit_Ctl: if (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting && - m_buildState->m_animationState != LegoVehicleBuildState::e_unknown4) { + m_buildState->m_animationState != LegoVehicleBuildState::e_finishedBuild) { if (m_numAnimsRun > 0) { DeleteObjects(&m_atomId, 500, 510); } @@ -985,18 +994,18 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected); if (GameState()->GetCurrentAct() == LegoGameState::e_act2) { - FUN_100243a0(); + InitExiting(); } - else if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) { - m_buildState->m_unk0x4d = TRUE; + else if (m_animPresenter->AllPartsPlaced() || m_buildState->m_finishedBuild) { + m_buildState->m_finishedBuild = TRUE; InvokeAction(Extra::e_start, m_atomId, m_carId, NULL); NotificationManager()->Send(this, MxNotificationParam()); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown4; + m_buildState->m_animationState = LegoVehicleBuildState::e_finishedBuild; } else { - FUN_10025720(4); + StartActorScriptByType(LookupTableActionType::e_leaveUnfinished); m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; } @@ -1004,15 +1013,15 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) } break; case CopterScript::c_ShelfUp_Ctl: - FUN_10024f30(); + MoveShelves(); m_Shelf_Sound->Enable(FALSE); m_Shelf_Sound->Enable(TRUE); result = 1; break; case CopterScript::c_Platform_Ctl: - FUN_10024f50(); - m_unk0xf8 = c_unknown8; - m_unk0xfc = param->m_enabledChild; + RotateVehicle(); + m_resetPlacedSelectedPart = c_enabled; + m_rotateBuild = param->m_enabledChild; result = 1; break; default: @@ -1029,15 +1038,15 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) m_Decal_Sound->Enable(TRUE); } else { - FUN_10025350(param->m_clickedObjectId); + SetPartColor(param->m_clickedObjectId); } result = 1; } } else { - m_unk0xf8 = c_unknownminusone; - m_unk0xfc = -1; + m_resetPlacedSelectedPart = c_disabled; + m_rotateBuild = -1; } // It is a bit unexpected that LEGO1 and BETA10 match so well with the `return 1` @@ -1048,9 +1057,9 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) #else // FUNCTION: BETA10 0x1006d512 -undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) +MxLong LegoCarBuild::HandleControl(MxParam* p_param) { - undefined4 result = 0; + MxLong result = 0; LegoControlManagerNotificationParam* param = (LegoControlManagerNotificationParam*) p_param; assert(m_buildState); @@ -1066,8 +1075,8 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) if (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting) { m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected); - if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) { - m_buildState->m_unk0x4d = TRUE; + if (m_animPresenter->AllPartsPlaced() || m_buildState->m_finishedBuild) { + m_buildState->m_finishedBuild = TRUE; // GameState()->GetCurrentAct() returns an MxS16 in BETA10 if (GameState()->GetCurrentAct() == 0) { @@ -1076,16 +1085,16 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) NotificationManager()->Send(this, MxNotificationParam()); assert(m_buildState); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown4; + m_buildState->m_animationState = LegoVehicleBuildState::e_finishedBuild; } else { - FUN_10025720(5); + StartActorScriptByType(LookupTableActionType::e_completed); m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; } } else { - FUN_10025720(4); + StartActorScriptByType(LookupTableActionType::e_leaveUnfinished); m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; } @@ -1108,15 +1117,15 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) } break; case CopterScript::c_ShelfUp_Ctl: - FUN_10024f30(); + MoveShelves(); m_Shelf_Sound->Enable(FALSE); m_Shelf_Sound->Enable(TRUE); result = 1; break; case CopterScript::c_Platform_Ctl: - FUN_10024f50(); - m_unk0xf8 = c_unknown8; - m_unk0xfc = param->m_enabledChild; + RotateVehicle(); + m_resetPlacedSelectedPart = c_enabled; + m_rotateBuild = param->m_enabledChild; result = 1; break; default: @@ -1133,14 +1142,14 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) m_Decal_Sound->Enable(TRUE); } else { - FUN_10025350(param->m_clickedObjectId); + SetPartColor(param->m_clickedObjectId); } result = 1; } } else { - m_unk0xf8 = c_unknownminusone; - m_unk0xfc = -1; + m_resetPlacedSelectedPart = c_disabled; + m_rotateBuild = -1; } return 1; @@ -1150,13 +1159,13 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) // FUNCTION: LEGO1 0x10024c20 // FUNCTION: BETA10 0x1006db21 -undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param) +MxLong LegoCarBuild::HandleType0Notification(MxNotificationParam* p_param) { LegoEntity* entity; assert(m_buildState); switch (m_buildState->m_animationState) { - case 4: + case LegoVehicleBuildState::AnimationState::e_finishedBuild: entity = (LegoEntity*) Find(m_atomId, m_carId); if (entity && entity->GetROI()) { @@ -1206,17 +1215,17 @@ undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param) m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; if (!m_animPresenter->AllPartsPlaced()) { - FUN_100243a0(); + InitExiting(); } else { - FUN_10025720(5); + StartActorScriptByType(LookupTableActionType::e_completed); } } else { NotificationManager()->Send(this, MxNotificationParam()); } break; - case 2: + case LegoVehicleBuildState::AnimationState::e_settingUpMovie: MxU32 jukeboxScript; switch (m_carId) { @@ -1233,11 +1242,11 @@ undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param) jukeboxScript = JukeboxScript::c_RaceCarBuild_Music; } - m_unk0x338 = SoundManager()->FindPresenter(*g_jukeboxScript, jukeboxScript); + m_jukeboxPresenter = SoundManager()->FindPresenter(*g_jukeboxScript, jukeboxScript); - if (m_unk0x338) { - BackgroundAudioManager()->SetPendingPresenter(m_unk0x338, 5, MxPresenter::e_repeating); - FUN_10024ef0(); + if (m_jukeboxPresenter) { + BackgroundAudioManager()->SetPendingPresenter(m_jukeboxPresenter, 5, MxPresenter::e_repeating); + StartIntroduction(); } else { // In BETA10, NotificationManager->Send() also takes __FILE__ and __LINE__ arguments @@ -1250,43 +1259,43 @@ undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param) } // FUNCTION: LEGO1 0x10024ef0 -void LegoCarBuild::FUN_10024ef0() +void LegoCarBuild::StartIntroduction() { ResetViewVelocity(); m_buildState->m_animationState = LegoVehicleBuildState::e_cutscene; - FUN_10025720(FUN_10025d70()); - m_buildState->m_unk0x4c += 1; + StartActorScriptByType(GetNextIntroduction()); + m_buildState->m_introductionCounter += 1; Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } // FUNCTION: LEGO1 0x10024f30 // FUNCTION: BETA10 0x1006dfa0 -void LegoCarBuild::FUN_10024f30() +void LegoCarBuild::MoveShelves() { - FUN_10022f30(); + ResetSelectedPart(); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_moving); } // FUNCTION: LEGO1 0x10024f50 // FUNCTION: BETA10 0x1006dfce -void LegoCarBuild::FUN_10024f50() +void LegoCarBuild::RotateVehicle() { - m_selectedPartIsPlaced = FALSE; + m_displayedPartIsPlaced = FALSE; m_animPresenter->RotateAroundYAxis(g_rotationAngleStepYAxis); } // FUNCTION: LEGO1 0x10024f70 // FUNCTION: BETA10 0x1006e002 -void LegoCarBuild::FUN_10024f70(MxBool p_enabled) +void LegoCarBuild::EnableColorControlsForSelectedPart(MxBool p_enabled) { if (m_animPresenter->StringEndsOnY(m_selectedPart->GetName())) { - SetPresentersEnabled(p_enabled); + SetColorControlsEnabled(p_enabled); } } // FUNCTION: LEGO1 0x10024fa0 // FUNCTION: BETA10 0x1006e04f -void LegoCarBuild::SetPresentersEnabled(MxBool p_enabled) +void LegoCarBuild::SetColorControlsEnabled(MxBool p_enabled) { m_presentersEnabled = p_enabled; m_ColorBook_Bitmap->Enable(p_enabled); @@ -1299,7 +1308,7 @@ void LegoCarBuild::SetPresentersEnabled(MxBool p_enabled) } // FUNCTION: LEGO1 0x10025010 -void LegoCarBuild::TogglePresentersEnabled() +void LegoCarBuild::ToggleColorControlsEnabled() { m_ColorBook_Bitmap->Enable(!m_ColorBook_Bitmap->IsEnabled()); m_Yellow_Ctl->Enable(!m_Yellow_Ctl->IsEnabled()); @@ -1312,7 +1321,7 @@ void LegoCarBuild::TogglePresentersEnabled() // FUNCTION: LEGO1 0x100250e0 // FUNCTION: BETA10 0x1006e124 -void LegoCarBuild::FUN_100250e0(MxBool p_enabled) +void LegoCarBuild::EnableDecalForSelectedPart(MxBool p_enabled) { if (m_animPresenter->StringDoesNotEndOnZero(m_selectedPart->GetName()) && m_Decals_Ctl) { if (SDL_strncasecmp(m_selectedPart->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) { @@ -1349,7 +1358,7 @@ void LegoCarBuild::FUN_100250e0(MxBool p_enabled) // FUNCTION: LEGO1 0x10025350 // FUNCTION: BETA10 0x1006e3c0 -void LegoCarBuild::FUN_10025350(MxS32 p_objectId) +void LegoCarBuild::SetPartColor(MxS32 p_objectId) { const LegoChar* color; LegoChar buffer[256]; @@ -1389,39 +1398,39 @@ void LegoCarBuild::FUN_10025350(MxS32 p_objectId) // FUNCTION: LEGO1 0x10025450 // FUNCTION: BETA10 0x1006e599 -void LegoCarBuild::FUN_10025450() +void LegoCarBuild::CalculateStartAndTargetTransforms() { - m_unk0x12c = m_selectedPart->GetLocal2World(); - m_unk0x1c0 = m_unk0x12c; + m_originalSelectedPartTransform = m_selectedPart->GetLocal2World(); + m_displayTransform = m_originalSelectedPartTransform; - Vector3 lastColumnOfUnk0x1c0(m_unk0x1c0[3]); - lastColumnOfUnk0x1c0 = Vector3(m_animPresenter->GetBuildViewMatrix()[3]); + Vector3 displayPosition(m_displayTransform[3]); + displayPosition = Vector3(m_animPresenter->GetBuildViewMatrix()[3]); // This looks odd, but it improves the LEGO1 match while breaking the BETA10 match. // I don't know whether this is due to compiler entropy. - // Feel free to replace unk0x178 -> m_unk0x178 and remove this variable if it improves the LEGO1 match - // in the future. - MxMatrix* unk0x178 = &m_unk0x178; - *unk0x178 = m_unk0x12c; + // Feel free to replace selectedPartStartTransform -> m_selectedPartStartTransform and remove this variable if it + // improves the LEGO1 match in the future. + MxMatrix* selectedPartStartTransform = &m_selectedPartStartTransform; + *selectedPartStartTransform = m_originalSelectedPartTransform; if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) { - m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition()); + m_selectedPartStartPosition = Vector4(m_selectedPart->GetWorldPosition()); - if (!m_selectedPartIsPlaced) { - m_unk0x2bc = m_unk0x2a4; + if (!m_displayedPartIsPlaced) { + m_selectedPartTargetPosition = m_selectedPartStartPosition; - m_unk0x208 = m_unk0x12c; - m_unk0x2a4[0] += m_unk0x1c0[3][0] - m_unk0x208[3][0]; - m_unk0x2a4[1] += m_unk0x1c0[3][1] - m_unk0x208[3][1]; - m_unk0x2a4[2] += m_unk0x1c0[3][2] - m_unk0x208[3][2]; + m_selectedPartTargetTransform = m_originalSelectedPartTransform; + m_selectedPartStartPosition[0] += m_displayTransform[3][0] - m_selectedPartTargetTransform[3][0]; + m_selectedPartStartPosition[1] += m_displayTransform[3][1] - m_selectedPartTargetTransform[3][1]; + m_selectedPartStartPosition[2] += m_displayTransform[3][2] - m_selectedPartTargetTransform[3][2]; } - *unk0x178 = m_unk0x1c0; + *selectedPartStartTransform = m_displayTransform; } else { const LegoChar* wiredName; - if (!m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { + if (!m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) { wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName()); } else { @@ -1429,12 +1438,12 @@ void LegoCarBuild::FUN_10025450() } LegoROI* parentROI = (LegoROI*) m_selectedPart->GetParentROI(); - m_unk0x208 = parentROI->FindChildROI(wiredName, parentROI)->GetLocal2World(); - m_unk0x2bc = Vector4(parentROI->FindChildROI(wiredName, parentROI)->GetWorldPosition()); - m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition()); + m_selectedPartTargetTransform = parentROI->FindChildROI(wiredName, parentROI)->GetLocal2World(); + m_selectedPartTargetPosition = Vector4(parentROI->FindChildROI(wiredName, parentROI)->GetWorldPosition()); + m_selectedPartStartPosition = Vector4(m_selectedPart->GetWorldPosition()); - m_unk0x2a4[2] += (m_unk0x1c0[3][2] - m_unk0x12c[3][2]); - m_unk0x178[3][2] = m_unk0x1c0[3][2]; + m_selectedPartStartPosition[2] += (m_displayTransform[3][2] - m_originalSelectedPartTransform[3][2]); + m_selectedPartStartTransform[3][2] = m_displayTransform[3][2]; } } @@ -1457,7 +1466,7 @@ void LegoCarBuild::Enable(MxBool p_enable) } // FUNCTION: BETA10 0x10070520 -inline MxU32 LegoCarBuild::Beta0x10070520() +inline MxU32 LegoCarBuild::GetLookupIndex() { switch (m_carId) { case Helicopter_Actor: @@ -1474,73 +1483,73 @@ inline MxU32 LegoCarBuild::Beta0x10070520() } } -inline void LegoCarBuild::StopActionIn0x344() +inline void LegoCarBuild::StopPlayingActorScript() { // There is no direct evidence for this inline function in LEGO1, // but some code doesn't make much sense otherwise. For example, - // sometimes `m_unk0x344` is set to another value right below this call, + // sometimes `m_playingActorScript` is set to another value right below this call, // which the original developer would likely have refactored. - if (m_unk0x344 != DS_NOT_A_STREAM) { - InvokeAction(Extra::ActionType::e_stop, m_atomId, m_unk0x344, NULL); - m_unk0x344 = DS_NOT_A_STREAM; + if (m_playingActorScript != DS_NOT_A_STREAM) { + InvokeAction(Extra::ActionType::e_stop, m_atomId, m_playingActorScript, NULL); + m_playingActorScript = DS_NOT_A_STREAM; } } // FUNCTION: LEGO1 0x10025720 // FUNCTION: BETA10 0x1006e9df -void LegoCarBuild::FUN_10025720(undefined4 p_param) +void LegoCarBuild::StartActorScriptByType(MxS32 p_actionType) { m_numAnimsRun++; - m_unk0x10a = 0; - MxS32 uVar6; + m_lastActorScript = 0; + MxS32 nextActorScript; #ifndef BETA10 if (GameState()->GetCurrentAct() == LegoGameState::e_act2) { // This is most likely related to the helicopter rebuild in Act 2 - switch (p_param) { - case 0: - case 1: - case 2: - case 3: + switch (p_actionType) { + case LookupTableActionType::e_introduction0: + case LookupTableActionType::e_introduction1: + case LookupTableActionType::e_introduction2: + case LookupTableActionType::e_introduction3: switch (SDL_rand(3)) { case 0: - m_unk0x10a = CopterScript::c_ips004d2_RunAnim; - StopActionIn0x344(); - m_unk0x344 = CopterScript::c_ips004d2_RunAnim; + m_lastActorScript = CopterScript::c_ips004d2_RunAnim; + StopPlayingActorScript(); + m_playingActorScript = CopterScript::c_ips004d2_RunAnim; BackgroundAudioManager()->LowerVolume(); InvokeAction(Extra::ActionType::e_start, m_atomId, CopterScript::c_ips004d2_RunAnim, NULL); break; case 1: - m_unk0x10a = CopterScript::c_ips006d2_RunAnim; - StopActionIn0x344(); - m_unk0x344 = CopterScript::c_ips006d2_RunAnim; + m_lastActorScript = CopterScript::c_ips006d2_RunAnim; + StopPlayingActorScript(); + m_playingActorScript = CopterScript::c_ips006d2_RunAnim; BackgroundAudioManager()->LowerVolume(); InvokeAction(Extra::ActionType::e_start, m_atomId, CopterScript::c_ips006d2_RunAnim, NULL); break; case 2: - m_unk0x10a = CopterScript::c_slp01xd2_RunAnim; - StopActionIn0x344(); - m_unk0x344 = CopterScript::c_slp01xd2_RunAnim; + m_lastActorScript = CopterScript::c_slp01xd2_RunAnim; + StopPlayingActorScript(); + m_playingActorScript = CopterScript::c_slp01xd2_RunAnim; BackgroundAudioManager()->LowerVolume(); InvokeAction(Extra::ActionType::e_start, m_atomId, CopterScript::c_slp01xd2_RunAnim, NULL); break; } break; - case 4: - FUN_10025d10(g_unk0x100d65b0[Beta0x10070520()].m_unk0x04); + case LookupTableActionType::e_leaveUnfinished: + StartActorScript(g_actorScripts[GetLookupIndex()].m_leaveUnfinished); break; - case 5: - FUN_10025d10(g_unk0x100d65b0[Beta0x10070520()].m_unk0x08); + case LookupTableActionType::e_completed: + StartActorScript(g_actorScripts[GetLookupIndex()].m_completed); break; - case 6: - m_unk0x10a = g_unk0x100d65b0[Beta0x10070520()].m_unk0x18; - uVar6 = m_unk0x10a; - StopActionIn0x344(); + case LookupTableActionType::e_shortExplanation: + m_lastActorScript = g_actorScripts[GetLookupIndex()].m_shortExplanation; + nextActorScript = m_lastActorScript; + StopPlayingActorScript(); - if (uVar6 != DS_NOT_A_STREAM) { - m_unk0x344 = uVar6; + if (nextActorScript != DS_NOT_A_STREAM) { + m_playingActorScript = nextActorScript; BackgroundAudioManager()->LowerVolume(); - InvokeAction(Extra::ActionType::e_start, m_atomId, uVar6, NULL); + InvokeAction(Extra::ActionType::e_start, m_atomId, nextActorScript, NULL); } break; @@ -1552,41 +1561,41 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param) else { #endif // This part doesn't match BETA10 perfectly, but it's the closest we get without hundreds of #ifdef's - switch (p_param) { - case 0: - m_unk0x10a = g_unk0x100d65b0[Beta0x10070520()].m_unk0x00; - FUN_10025d10(m_unk0x10a); + switch (p_actionType) { + case LookupTableActionType::e_introduction0: + m_lastActorScript = g_actorScripts[GetLookupIndex()].m_introduction0; + StartActorScript(m_lastActorScript); break; - case 1: - m_unk0x10a = g_unk0x100d65b0[Beta0x10070520()].m_unk0x0c; - FUN_10025d10(m_unk0x10a); + case LookupTableActionType::e_introduction1: + m_lastActorScript = g_actorScripts[GetLookupIndex()].m_introduction1; + StartActorScript(m_lastActorScript); - if (m_carId == 2) { - m_unk0x10a = 0; + if (m_carId == DuneBugy_Actor) { + m_lastActorScript = 0; } break; - case 2: - m_unk0x10a = g_unk0x100d65b0[Beta0x10070520()].m_unk0x10; - FUN_10025d10(m_unk0x10a); + case LookupTableActionType::e_introduction2: + m_lastActorScript = g_actorScripts[GetLookupIndex()].m_introduction2; + StartActorScript(m_lastActorScript); - if (m_carId != 3) { - m_unk0x10a = 0; + if (m_carId != Jetski_Actor) { + m_lastActorScript = 0; } break; - case 3: - FUN_10025d10(g_unk0x100d65b0[Beta0x10070520()].m_unk0x14); + case LookupTableActionType::e_introduction3: + StartActorScript(g_actorScripts[GetLookupIndex()].m_introduction3); break; - case 4: - FUN_10025d10(g_unk0x100d65b0[Beta0x10070520()].m_unk0x04); + case LookupTableActionType::e_leaveUnfinished: + StartActorScript(g_actorScripts[GetLookupIndex()].m_leaveUnfinished); break; - case 5: - FUN_10025d10(g_unk0x100d65b0[Beta0x10070520()].m_unk0x08); + case LookupTableActionType::e_completed: + StartActorScript(g_actorScripts[GetLookupIndex()].m_completed); break; - case 6: - m_unk0x10a = g_unk0x100d65b0[Beta0x10070520()].m_unk0x18; - FUN_10025d10(m_unk0x10a); + case LookupTableActionType::e_shortExplanation: + m_lastActorScript = g_actorScripts[GetLookupIndex()].m_shortExplanation; + StartActorScript(m_lastActorScript); break; default: assert(0); @@ -1600,74 +1609,74 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param) } #endif - if (m_unk0x10a != 0) { - m_unk0x10c = SDL_GetTicks(); + if (m_lastActorScript != 0) { + m_lastActorScriptStartTime = SDL_GetTicks(); } } // FUNCTION: LEGO1 0x10025d10 // FUNCTION: BETA10 0x10070490 -void LegoCarBuild::FUN_10025d10(MxS32 p_param) +void LegoCarBuild::StartActorScript(MxS32 p_streamId) { // this function has a different signature and partially different body in BETA10, but it is called in the same // places - if (m_unk0x344 != DS_NOT_A_STREAM) { - InvokeAction(Extra::ActionType::e_stop, m_atomId, m_unk0x344, NULL); - m_unk0x344 = DS_NOT_A_STREAM; + if (m_playingActorScript != DS_NOT_A_STREAM) { + InvokeAction(Extra::ActionType::e_stop, m_atomId, m_playingActorScript, NULL); + m_playingActorScript = DS_NOT_A_STREAM; } - if (p_param != DS_NOT_A_STREAM) { - m_unk0x344 = p_param; + if (p_streamId != DS_NOT_A_STREAM) { + m_playingActorScript = p_streamId; BackgroundAudioManager()->LowerVolume(); - InvokeAction(Extra::ActionType::e_start, m_atomId, p_param, NULL); + InvokeAction(Extra::ActionType::e_start, m_atomId, p_streamId, NULL); } } // FUNCTION: LEGO1 0x10025d70 -MxS32 LegoCarBuild::FUN_10025d70() +MxS32 LegoCarBuild::GetNextIntroduction() { - switch (m_buildState->m_unk0x4c % 3) { + switch (m_buildState->m_introductionCounter % 3) { case 1: - return 1; + return LookupTableActionType::e_introduction1; case 2: - return 2; + return LookupTableActionType::e_introduction2; case 3: - return 3; + return LookupTableActionType::e_introduction3; default: - return 0; + return LookupTableActionType::e_introduction0; } } // FUNCTION: LEGO1 0x10025db0 // FUNCTION: BETA10 0x1006ed18 -void LegoCarBuild::FUN_10025db0(const char* p_param1, undefined4 p_param2) +void LegoCarBuild::TickleControl(const char* p_controlName, MxULong p_time) { - m_unk0x33c = (MxControlPresenter*) Find("MxControlPresenter", p_param1); + m_tickledControl = (MxControlPresenter*) Find("MxControlPresenter", p_controlName); - MxS16 sVar3 = 1 - ((p_param2 / 5) & 1); + MxS16 expectedState = 1 - ((p_time / 5) & 1); - if (m_Yellow_Ctl == m_unk0x33c) { - if (sVar3 != g_unk0x100f11cc) { - TogglePresentersEnabled(); - g_unk0x100f11cc = sVar3; + if (m_Yellow_Ctl == m_tickledControl) { + if (expectedState != g_lastTickleState) { + ToggleColorControlsEnabled(); + g_lastTickleState = expectedState; } } else { - if (m_unk0x33c->GetEnabledChild() != sVar3) { - m_unk0x33c->UpdateEnabledChild(sVar3); + if (m_tickledControl->GetEnabledChild() != expectedState) { + m_tickledControl->UpdateEnabledChild(expectedState); } - g_unk0x100f11cc = -1; - SetPresentersEnabled(m_presentersEnabled); + g_lastTickleState = -1; + SetColorControlsEnabled(m_presentersEnabled); } } // FUNCTION: LEGO1 0x10025e40 -void LegoCarBuild::FUN_10025e40() +void LegoCarBuild::HandleEndAnim() { - SetPresentersEnabled(m_presentersEnabled); - if (m_unk0x33c && m_Yellow_Ctl != m_unk0x33c) { - m_unk0x33c->UpdateEnabledChild(0); + SetColorControlsEnabled(m_presentersEnabled); + if (m_tickledControl && m_Yellow_Ctl != m_tickledControl) { + m_tickledControl->UpdateEnabledChild(0); } } @@ -1675,28 +1684,27 @@ void LegoCarBuild::FUN_10025e40() MxBool LegoCarBuild::Escape() { BackgroundAudioManager()->Init(); - MxS32 targetEntityId = FUN_10025ee0(m_carId); + MxS32 targetEntityId = GetBuildMovieId(m_carId); InvokeAction(Extra::ActionType::e_stop, *g_jukeboxScript, targetEntityId, NULL); DeleteObjects(&m_atomId, 500, 999); - m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0; + m_buildState->m_animationState = LegoVehicleBuildState::e_none; m_destLocation = LegoGameState::e_infomain; return TRUE; } // FUNCTION: LEGO1 0x10025ee0 -MxS32 LegoCarBuild::FUN_10025ee0(undefined4 p_param1) +MxS32 LegoCarBuild::GetBuildMovieId(MxS32 p_carId) { - // TODO: Work out constants - switch (p_param1) { - case 1: - return 0x2f; - case 2: - return 0x31; - case 3: - return 0x33; - case 4: - return 0x35; + switch (p_carId) { + case Helicopter_Actor: + return JukeboxScript::c_HelicopterBuild_Movie; + case DuneBugy_Actor: + return JukeboxScript::c_DuneCarBuild_Movie; + case Jetski_Actor: + return JukeboxScript::c_JetskiBuild_Movie; + case RaceCar_Actor: + return JukeboxScript::c_RaceCarBuild_Movie; default: return -1; } @@ -1706,9 +1714,9 @@ MxS32 LegoCarBuild::FUN_10025ee0(undefined4 p_param1) LegoVehicleBuildState::LegoVehicleBuildState(const char* p_classType) { m_className = p_classType; - m_unk0x4c = 0; - m_unk0x4d = FALSE; - m_unk0x4e = FALSE; + m_introductionCounter = 0; + m_finishedBuild = FALSE; + m_playedExitScript = FALSE; m_placedPartCount = 0; } @@ -1719,17 +1727,17 @@ MxResult LegoVehicleBuildState::Serialize(LegoStorage* p_storage) LegoState::Serialize(p_storage); if (p_storage->IsReadMode()) { - p_storage->ReadU8(m_unk0x4c); - p_storage->ReadU8(m_unk0x4d); - p_storage->ReadU8(m_unk0x4e); + p_storage->ReadU8(m_introductionCounter); + p_storage->ReadU8(m_finishedBuild); + p_storage->ReadU8(m_playedExitScript); #ifndef BETA10 p_storage->ReadU8(m_placedPartCount); #endif } else { - p_storage->WriteU8(m_unk0x4c); - p_storage->WriteU8(m_unk0x4d); - p_storage->WriteU8(m_unk0x4e); + p_storage->WriteU8(m_introductionCounter); + p_storage->WriteU8(m_finishedBuild); + p_storage->WriteU8(m_playedExitScript); #ifndef BETA10 p_storage->WriteU8(m_placedPartCount); #endif diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index a3adac06..f5c92492 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -18,7 +18,7 @@ #include -DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::UnknownListEntry, 0x0c) +DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) // FUNCTION: LEGO1 0x10078400 @@ -34,7 +34,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter() m_shelfFrameBuffer = 0; m_shelfFrameMax = 0; m_shelfFrameInterval = 0; - m_unk0x13c = 0; + m_flashingPartTimeState = 0; m_carBuildEntity = NULL; m_unk0x144 = -1; m_unk0x148 = -1; @@ -62,28 +62,28 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter() } // FUNCTION: BETA10 0x100733d0 -inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0() +inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility() { MxLong time = Timer()->GetTime(); - MxLong bvar5; + MxLong showFlashingPart; - if (m_unk0x13c < time) { - bvar5 = FALSE; + if (m_flashingPartTimeState < time) { + showFlashingPart = FALSE; // I have no idea why this conditional is so convoluted - if (m_unk0x13c & c_bit1) { - bvar5 = TRUE; - m_unk0x13c = time + 400; + if (m_flashingPartTimeState & c_bit1) { + showFlashingPart = TRUE; + m_flashingPartTimeState = time + 400; } else { - m_unk0x13c = time + 200; + m_flashingPartTimeState = time + 200; } - if (bvar5) { - m_unk0x13c &= ~c_bit1; + if (showFlashingPart) { + m_flashingPartTimeState &= ~c_bit1; } else { - m_unk0x13c |= c_bit1; + m_flashingPartTimeState |= c_bit1; } if (m_placedPartCount < m_numberOfParts) { @@ -98,7 +98,7 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0() const LegoChar* name = roi->GetName(); if (name && SDL_strcasecmp(wiredName, name) == 0) { - if (bvar5) { + if (showFlashingPart) { roi->SetVisibility(TRUE); } else { @@ -129,7 +129,7 @@ void LegoCarBuildAnimPresenter::PutFrame() break; } - Beta10Inline0x100733d0(); + UpdateFlashingPartVisibility(); } // FUNCTION: LEGO1 0x100788c0 @@ -211,7 +211,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle() } if (i < m_placedPartCount) { - FUN_10079050(i); + MakePartPlaced(i); ShowBuildPartByName(m_parts[i].m_name); } @@ -318,7 +318,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage) // FUNCTION: LEGO1 0x10079050 // 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); HideBuildPartByName(m_parts[p_index].m_wiredName); @@ -384,7 +384,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform() } assert(m_numberOfParts); - m_parts = new UnknownListEntry[m_numberOfParts]; + m_parts = new CarBuildPart[m_numberOfParts]; assert(m_parts); // Go through and add the wired name of each part @@ -553,7 +553,7 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name) strcpy(m_parts[i].m_name, buffer); Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId); } - FUN_10079050(m_placedPartCount); + MakePartPlaced(m_placedPartCount); m_placedPartCount++; ((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount); @@ -646,7 +646,7 @@ MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string) // FUNCTION: LEGO1 0x10079c30 // FUNCTION: BETA10 0x100726a6 -MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name) +MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name) { if (PartIsPlaced(p_name)) { return FALSE; @@ -710,7 +710,7 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx // FUNCTION: LEGO1 0x10079e20 // FUNCTION: BETA10 0x10072959 -const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() +const BoundingSphere& LegoCarBuildAnimPresenter::GetTargetBoundingSphere() { LegoROI* roi = m_carBuildEntity->GetROI(); return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 90ea44c6..49a837e1 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1800,7 +1800,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) // FUNCTION: LEGO1 0x10062650 // FUNCTION: BETA10 0x100436e2 -MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi) +MxBool LegoAnimationManager::FUN_10062650(Mx3DPointFloat& p_position, float p_und, LegoROI* p_roi) { if (p_roi != NULL) { Mx3DPointFloat position(p_position); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index b306e06a..fb50b5ef 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -850,7 +850,7 @@ inline void LoadIsle() { LegoWorld* world = FindWorld(*g_isleScript, IsleScript::c__Isle); if (world != NULL) { - if (!world->GetUnknown0xd0Empty()) { + if (!world->NoDisabledObjects()) { NotificationManager()->Send(world, MxNotificationParam(c_notificationType20, NULL)); } } diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index fde06e8f..725e73d4 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -125,15 +125,9 @@ MxResult MxTransitionManager::StartTransition( m_animationSpeed = p_speed; - MxTickleManager* tickleManager = TickleManager(); - tickleManager->RegisterClient(this, p_speed); - - LegoInputManager* inputManager = InputManager(); - inputManager->SetUnknown88(TRUE); - inputManager->SetUnknown336(FALSE); - - LegoVideoManager* videoManager = VideoManager(); - videoManager->SetRender3D(FALSE); + TickleManager()->RegisterClient(this, p_speed); + InputManager()->DisableInputProcessing(); + VideoManager()->SetRender3D(FALSE); SetAppCursor(e_cursorBusy); return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 477bf529..6cfcc6da 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -129,7 +129,7 @@ const char* LegoActor::GetActorName(MxU8 p_id) // FUNCTION: LEGO1 0x1002d670 // FUNCTION: BETA10 0x1003d65f -void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) +void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) { if (p_roi) { const char* name = p_roi->GetName(); @@ -143,7 +143,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 diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 73981958..c6ae434f 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -127,12 +127,12 @@ void LegoEntity::SetWorld() // FUNCTION: LEGO1 0x100108a0 // FUNCTION: BETA10 0x1007e724 -void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) +void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) { m_roi = p_roi; if (m_roi != NULL) { - if (p_bool2) { + if (p_updateTransform) { MxMatrix mat; CalcLocalTransform( Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]), diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index fe4bbc63..f8e9b3cb 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -75,7 +75,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) return FAILURE; } - if (!VTable0x54()) { + if (!InitializeCameraController()) { return FAILURE; } @@ -135,10 +135,10 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } } - while (!m_set0xa8.empty()) { - MxCoreSet::iterator it = m_set0xa8.begin(); + while (!m_objects.empty()) { + MxCoreSet::iterator it = m_objects.begin(); MxCore* object = *it; - m_set0xa8.erase(it); + m_objects.erase(it); if (object->IsA("MxPresenter")) { MxPresenter* presenter = (MxPresenter*) object; @@ -166,7 +166,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } } - if (m_worldId != LegoOmni::e_undefined && m_set0xd0.empty()) { + if (m_worldId != LegoOmni::e_undefined && m_disabledObjects.empty()) { PlantManager()->Reset(m_worldId); BuildingManager()->Reset(); } @@ -234,7 +234,7 @@ MxLong LegoWorld::Notify(MxParam& p_param) // FUNCTION: LEGO1 0x1001f630 // FUNCTION: BETA10 0x100d9fc2 -LegoCameraController* LegoWorld::VTable0x54() +LegoCameraController* LegoWorld::InitializeCameraController() { MxBool success = FALSE; @@ -357,7 +357,7 @@ MxBool LegoWorld::ActorExists(LegoPathActor* p_actor) // FUNCTION: LEGO1 0x1001fda0 // FUNCTION: BETA10 0x100da621 -void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter) +void LegoWorld::AddPresenterIfInRange(LegoAnimPresenter* p_presenter) { LegoPathControllerListCursor cursor(&m_pathControllerList); LegoPathController* controller; @@ -369,7 +369,7 @@ void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter) // FUNCTION: LEGO1 0x1001fe90 // FUNCTION: BETA10 0x100da6b5 -void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter) +void LegoWorld::RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter) { LegoPathControllerListCursor cursor(&m_pathControllerList); LegoPathController* controller; @@ -486,25 +486,25 @@ void LegoWorld::Add(MxCore* p_object) } #endif else { - MxCoreSet::iterator it = m_set0xa8.find(p_object); - if (it == m_set0xa8.end()) { + MxCoreSet::iterator it = m_objects.find(p_object); + if (it == m_objects.end()) { #ifdef BETA10 if (p_object->IsA("MxPresenter")) { assert(static_cast(p_object)->GetAction()); } #endif - m_set0xa8.insert(p_object); + m_objects.insert(p_object); } else { assert(0); } } - if (m_set0xd0.size() != 0 && p_object->IsA("MxPresenter")) { + if (m_disabledObjects.size() != 0 && p_object->IsA("MxPresenter")) { if (((MxPresenter*) p_object)->IsEnabled()) { ((MxPresenter*) p_object)->Enable(FALSE); - m_set0xd0.insert(p_object); + m_disabledObjects.insert(p_object); } } } @@ -562,15 +562,15 @@ void LegoWorld::Remove(MxCore* p_object) } #endif else { - it = m_set0xa8.find(p_object); - if (it != m_set0xa8.end()) { - m_set0xa8.erase(it); + it = m_objects.find(p_object); + if (it != m_objects.end()) { + m_objects.erase(it); } } - it = m_set0xd0.find(p_object); - if (it != m_set0xd0.end()) { - m_set0xd0.erase(it); + it = m_disabledObjects.find(p_object); + if (it != m_disabledObjects.end()) { + m_disabledObjects.erase(it); } } @@ -622,7 +622,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) return NULL; } - for (MxCoreSet::iterator i = m_set0xa8.begin(); i != m_set0xa8.end(); i++) { + for (MxCoreSet::iterator i = m_objects.begin(); i != m_objects.end(); i++) { if ((*i)->IsA(p_class) && (*i)->IsA("MxPresenter")) { assert(((MxPresenter*) (*i))->GetAction()); @@ -675,7 +675,7 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) } } - for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { MxCore* core = *it; if (core->IsA("MxPresenter")) { @@ -697,7 +697,7 @@ void LegoWorld::Enable(MxBool p_enable) { MxCoreSet::iterator it; - if (p_enable && m_set0xd0.size() != 0) { + if (p_enable && m_disabledObjects.size() != 0) { if (CurrentWorld() == this) { return; } @@ -720,8 +720,8 @@ void LegoWorld::Enable(MxBool p_enable) } } - while (m_set0xd0.size() != 0) { - it = m_set0xd0.begin(); + while (m_disabledObjects.size() != 0) { + it = m_disabledObjects.begin(); if ((*it)->IsA("MxPresenter")) { ((MxPresenter*) *it)->Enable(TRUE); @@ -730,7 +730,7 @@ void LegoWorld::Enable(MxBool p_enable) ((LegoPathController*) *it)->Enable(TRUE); } - m_set0xd0.erase(it); + m_disabledObjects.erase(it); } SetCurrentWorld(this); @@ -754,7 +754,7 @@ void LegoWorld::Enable(MxBool p_enable) SetIsWorldActive(TRUE); #endif } - else if (!p_enable && m_set0xd0.size() == 0) { + else if (!p_enable && m_disabledObjects.size() == 0) { MxPresenter* presenter; LegoPathController* controller; LegoPathActor* actor = UserActor(); @@ -764,7 +764,7 @@ void LegoWorld::Enable(MxBool p_enable) } AnimationManager()->Reset(FALSE); - m_set0xd0.insert(this); + m_disabledObjects.insert(this); if (m_worldId != LegoOmni::e_undefined) { PlantManager()->Reset(m_worldId); @@ -777,15 +777,15 @@ void LegoWorld::Enable(MxBool p_enable) while (controlPresenterCursor.Next(presenter)) { if (presenter->IsEnabled()) { - m_set0xd0.insert(presenter); + m_disabledObjects.insert(presenter); presenter->Enable(FALSE); } } - for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { if ((*it)->IsA("LegoActionControlPresenter") || ((*it)->IsA("MxPresenter") && ((MxPresenter*) *it)->IsEnabled())) { - m_set0xd0.insert(*it); + m_disabledObjects.insert(*it); ((MxPresenter*) *it)->Enable(FALSE); } } @@ -811,7 +811,7 @@ void LegoWorld::Enable(MxBool p_enable) while (pathControllerCursor.Next(controller)) { controller->Enable(FALSE); - m_set0xd0.insert(controller); + m_disabledObjects.insert(controller); } GetViewManager()->RemoveAll(NULL); @@ -869,7 +869,7 @@ MxBool LegoWorld::PresentersPending() } } - for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { if ((*it)->IsA("MxPresenter")) { presenter = (MxPresenter*) *it; diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index abf6c32a..17bfedf2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -59,7 +59,7 @@ LegoWorldPresenter::~LegoWorldPresenter() PlantManager()->LoadWorldInfo(worldId); AnimationManager()->LoadWorldInfo(worldId); BuildingManager()->LoadWorldInfo(); - result = ((LegoWorld*) m_entity)->VTable0x5c(); + result = ((LegoWorld*) m_entity)->WaitForTransition(); } if (result == FALSE) { diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 39a97cc0..b56acab1 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -41,7 +41,7 @@ LegoInputManager::LegoInputManager() m_y = 0; m_controlManager = NULL; m_unk0x81 = FALSE; - m_unk0x88 = FALSE; + m_inputProcessingDisabled = FALSE; m_unk0x195 = 0; m_unk0x335 = FALSE; m_unk0x336 = FALSE; @@ -248,7 +248,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p { LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); - if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) || + if (((!m_inputProcessingDisabled) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) || ((m_unk0x336 && (p_key == SDLK_SPACE)))) { ProcessOneEvent(param); } @@ -499,9 +499,10 @@ void LegoInputManager::StopAutoDragTimer() } // FUNCTION: LEGO1 0x1005cff0 +// FUNCTION: BETA10 0x10096a10 void LegoInputManager::EnableInputProcessing() { - m_unk0x88 = FALSE; + m_inputProcessingDisabled = FALSE; g_clickedObjectId = -1; g_clickedAtom = NULL; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index 276b66ab..7d8dfc0f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -19,7 +19,6 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) extern MxU32 g_isleFlags; // GLOBAL: LEGO1 0x100f119c -// GLOBAL: BETA10 0x100f119c MxBool g_unk0x100f119c = FALSE; // FUNCTION: LEGO1 0x1001b700 diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index 33c740a1..805ee9d6 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -70,6 +70,7 @@ const LegoChar* g_strCRCEDGEY0 = "C_RCEDGEY0"; MxS32 g_unk0x100f0c7c = 2; // FUNCTION: LEGO1 0x10016a90 +// FUNCTION: BETA10 0x100c82e8 CarRace::CarRace() { m_skeleton = NULL; diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index 91374766..71e59f02 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -53,6 +53,7 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10015d40 +// FUNCTION: BETA10 0x100c7ab5 LegoRace::~LegoRace() { g_unk0x100f119c = FALSE; @@ -101,7 +102,7 @@ MxLong LegoRace::Notify(MxParam& p_param) // FUNCTION: BETA10 0x100c7c3f void LegoRace::Enable(MxBool p_enable) { - if (GetUnknown0xd0Empty() != p_enable && !p_enable) { + if (NoDisabledObjects() != p_enable && !p_enable) { Remove(UserActor()); MxU8 oldActorId = GameState()->GetActorId(); diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 42e7bb02..fe0fea08 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1139,7 +1139,7 @@ void LegoAnimPresenter::VTable0x8c() } if (m_currentWorld) { - m_currentWorld->FUN_1001fda0(this); + m_currentWorld->AddPresenterIfInRange(this); if (!m_compositePresenter || !m_compositePresenter->IsA("LegoAnimMMPresenter")) { m_currentWorld->Add(this); } @@ -1151,7 +1151,7 @@ void LegoAnimPresenter::VTable0x8c() void LegoAnimPresenter::VTable0x90() { if (m_currentWorld != NULL) { - m_currentWorld->FUN_1001fe90(this); + m_currentWorld->RemovePresenterFromBoundaries(this); if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) { return; diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index bad2762e..f897bc2e 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -893,7 +893,7 @@ void Act3::FUN_10073a60() // FUNCTION: LEGO1 0x10073a90 void Act3::Enable(MxBool p_enable) { - if ((MxBool) m_set0xd0.empty() == p_enable) { + if ((MxBool) m_disabledObjects.empty() == p_enable) { return; } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 45885c31..8884551b 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1301,7 +1301,7 @@ void Infocenter::StopCutscene() } // FUNCTION: LEGO1 0x10070d00 -MxBool Infocenter::VTable0x5c() +MxBool Infocenter::WaitForTransition() { return TRUE; } @@ -1453,10 +1453,10 @@ void Infocenter::StartCredits() { MxPresenter* presenter; - while (!m_set0xa8.empty()) { - MxCoreSet::iterator it = m_set0xa8.begin(); + while (!m_objects.empty()) { + MxCoreSet::iterator it = m_objects.begin(); MxCore* object = *it; - m_set0xa8.erase(it); + m_objects.erase(it); if (object->IsA("MxPresenter")) { presenter = (MxPresenter*) object; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 8e3c0535..a455c744 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -540,7 +540,7 @@ MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) // FUNCTION: BETA10 0x10034158 void Isle::Enable(MxBool p_enable) { - if ((MxBool) m_set0xd0.empty() == p_enable) { + if ((MxBool) m_disabledObjects.empty() == p_enable) { return; } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index fea291ba..85faa9e1 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -33,11 +33,11 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) // GLOBAL: LEGO1 0x100f4474 -Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0; +Act2mainScript::Script g_bricksterSpeech = (Act2mainScript::Script) 0; // GLOBAL: LEGO1 0x100f43f0 // GLOBAL: BETA10 0x101e14a8 -MxS32 g_unk0x100f43f0[] = { +MxS32 g_animationsBricksterIsLoose[] = { Act2mainScript::c_tns030bd_RunAnim, Act2mainScript::c_tns030pg_RunAnim, Act2mainScript::c_tns030rd_RunAnim, @@ -49,7 +49,7 @@ MxS32 g_unk0x100f43f0[] = { }; // 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 MxS32 g_unk0x100f4428[] = { @@ -74,17 +74,17 @@ const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd", // FUNCTION: BETA10 0x1003a5a0 LegoAct2::LegoAct2() { - m_unk0x10c4 = 0; + m_state = LegoAct2::e_initial; m_gameState = NULL; m_pepper = NULL; m_ambulance = NULL; m_ready = FALSE; m_unk0x1130 = 0; m_nextBrick = 0; - m_unk0x10c1 = 0; + m_removedBricks = 0; m_unk0x1138 = NULL; - m_unk0x1140 = (Act2mainScript::Script) 0; - m_unk0x1144 = (Act2mainScript::Script) 0; + m_currentAction = (Act2mainScript::Script) 0; + m_infomanDirecting = (Act2mainScript::Script) 0; m_destLocation = LegoGameState::e_undefined; m_music = JukeboxScript::c_MusicTheme1; m_siFile = ""; @@ -166,97 +166,97 @@ MxResult LegoAct2::Tickle() return SUCCESS; } - switch (m_unk0x10c4) { - case 0: - m_unk0x10c4 = 1; + switch (m_state) { + case LegoAct2::e_initial: + m_state = LegoAct2::e_startSpeech; break; - case 1: + case LegoAct2::e_startSpeech: ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); switch (SDL_rand(3)) { case 0: - g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim; + g_bricksterSpeech = Act2mainScript::c_tns002br_RunAnim; break; case 1: - g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim; + g_bricksterSpeech = Act2mainScript::c_tns003br_RunAnim; break; case 2: - g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim; + g_bricksterSpeech = Act2mainScript::c_tns004br_RunAnim; break; } - FUN_10052560(g_unk0x100f4474, TRUE, TRUE, NULL, NULL, NULL); - m_unk0x10d0 = 0; - m_unk0x10c4 = 2; + StartAction(g_bricksterSpeech, TRUE, TRUE, NULL, NULL, NULL); + m_timeSinceLastStage = 0; + m_state = LegoAct2::e_holdingSpeech; break; - case 2: - if (g_unk0x100f4474) { - if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) { + case LegoAct2::e_holdingSpeech: + if (g_bricksterSpeech) { + if (AnimationManager()->FUN_10064ee0(g_bricksterSpeech)) { 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; - case 3: + case LegoAct2::e_startDescription: Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); - m_unk0x10d0 = 0; - m_unk0x10c4 = 4; - FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); + m_timeSinceLastStage = 0; + m_state = LegoAct2::e_explaining; + StartAction(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->FUN_1005f6d0(TRUE); - AnimationManager()->FUN_100604f0(g_unk0x100f43f0, sizeOfArray(g_unk0x100f43f0)); - AnimationManager()->FUN_10060480(g_unk0x100f4410, sizeOfArray(g_unk0x100f4410)); + AnimationManager()->FUN_100604f0(g_animationsBricksterIsLoose, sizeOfArray(g_animationsBricksterIsLoose)); + AnimationManager()->FUN_10060480(g_charactersBricksterIsLoose, sizeOfArray(g_charactersBricksterIsLoose)); break; - case 4: - m_unk0x10d0 += 50; + case LegoAct2::e_explaining: + m_timeSinceLastStage += 50; break; - case 5: - m_unk0x10d0 += 50; + case LegoAct2::e_goingToResidentialArea: + m_timeSinceLastStage += 50; - if (m_unk0x10d0 == 20000) { + if (m_timeSinceLastStage == 20000) { const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition(); MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f}; distance = DISTSQRD3(pepperPosition, otherPoint); - if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) { - FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); - m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav; + if (m_infomanDirecting == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) { + StartAction(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); + m_infomanDirecting = Act2mainScript::c_Avo906In_PlayWav; } } - else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) { - FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); - m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav; + else if (m_timeSinceLastStage >= 90000 && m_timeSinceLastStage % 90000 == 0 && m_infomanDirecting == (Act2mainScript::Script) 0) { + StartAction(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); + m_infomanDirecting = Act2mainScript::c_Avo908In_PlayWav; } break; - case 6: - m_unk0x10d0 += 50; + case LegoAct2::e_atResidentialArea: + m_timeSinceLastStage += 50; break; - case 9: - m_unk0x10d0 += 50; + case LegoAct2::e_droppingBrick: + m_timeSinceLastStage += 50; - if (m_unk0x10d0 >= 200) { + if (m_timeSinceLastStage >= 200) { if (m_nextBrick < 5) { - m_unk0x10c4 = 7; + m_state = LegoAct2::e_chase; } else { - m_unk0x10c4 = 10; - m_unk0x10d0 = 0; - m_unk0x1138->FUN_10019520(); + m_state = LegoAct2::e_goingToHide; + m_timeSinceLastStage = 0; + m_unk0x1138->GoingToHide(); } } break; - case 10: - m_unk0x10d0 += 50; + case LegoAct2::e_goingToHide: + m_timeSinceLastStage += 50; break; - case 11: + case LegoAct2::e_hidden: break; - case 12: + case LegoAct2::e_distributeRemainingBricks: break; } @@ -297,9 +297,9 @@ MxLong LegoAct2::Notify(MxParam& p_param) case c_notificationAct2Brick: SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE); - m_unk0x10c1++; - if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) { - m_unk0x10c4 = 14; + m_removedBricks++; + if (m_removedBricks == 10 && m_state == LegoAct2::e_brickHunt) { + m_state = LegoAct2::e_allPiecesCollected; LegoEntity* entity = (LegoEntity*) param.GetSender(); @@ -326,10 +326,10 @@ MxLong LegoAct2::Notify(MxParam& p_param) Mx3DPointFloat locald4(local2world[2]); 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_unk0x10d0 = 0; + m_state = LegoAct2::e_allPiecesCollected; + m_timeSinceLastStage = 0; ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); } break; @@ -348,27 +348,27 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) if (m_gameState->m_enabled && p_param.GetAction() != NULL) { MxU32 objectId = p_param.GetAction()->GetObjectId(); - if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) { - m_unk0x1144 = (Act2mainScript::Script) 0; + if (m_state == LegoAct2::e_goingToResidentialArea && m_infomanDirecting == objectId) { + m_infomanDirecting = (Act2mainScript::Script) 0; return 0; } - if (m_unk0x1140 != objectId) { + if (m_currentAction != objectId) { return 0; } - m_unk0x1140 = (Act2mainScript::Script) 0; + m_currentAction = (Act2mainScript::Script) 0; - switch (m_unk0x10c4) { - case 2: - m_unk0x10c4 = 3; + switch (m_state) { + case LegoAct2::e_holdingSpeech: + m_state = LegoAct2::e_startDescription; break; - case 4: - FUN_10051960(); - m_unk0x10c4 = 5; - m_unk0x10d0 = 0; + case LegoAct2::e_explaining: + HideMaPaInfo(); + m_state = LegoAct2::e_goingToResidentialArea; + m_timeSinceLastStage = 0; break; - case 6: { + case LegoAct2::e_atResidentialArea: { LegoROI* roi; roi = FindROI("nick"); @@ -400,24 +400,24 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) roi->SetVisibility(FALSE); VariableTable()->SetVariable("ACTOR_01", "brickstr"); - FUN_10052800(); - m_unk0x10c4 = 7; + InitializeShooting(); + m_state = LegoAct2::e_chase; PlayMusic(JukeboxScript::c_BrickstrChase); break; } - case 11: + case LegoAct2::e_hidden: m_bricks[m_nextBrick - 1].Mute(TRUE); - m_unk0x10c4 = 12; - m_unk0x10d0 = 0; + m_state = LegoAct2::e_distributeRemainingBricks; + 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); AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428)); AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458)); break; - case 12: { + case LegoAct2::e_distributeRemainingBricks: { LegoROI* roi; roi = FindROI("nick"); @@ -441,13 +441,13 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) } m_bricks[m_nextBrick - 1].Mute(FALSE); - m_unk0x10c4 = 13; + m_state = LegoAct2::e_brickHunt; SpawnBricks(); PlayMusic(JukeboxScript::c_BrickHunt); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial); break; } - case 14: + case LegoAct2::e_allPiecesCollected: for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) { m_bricks[i].Remove(); } @@ -522,7 +522,7 @@ void LegoAct2::ReadyWorld() // FUNCTION: BETA10 0x1003bb2d void LegoAct2::Enable(MxBool p_enable) { - if ((MxBool) m_set0xd0.empty() == p_enable) { + if ((MxBool) m_disabledObjects.empty() == p_enable) { return; } @@ -534,7 +534,7 @@ void LegoAct2::Enable(MxBool p_enable) GameState()->SetActor(LegoActor::c_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) { 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); - if (m_unk0x10c4 != 6 && m_unk0x10c4 != 12) { + if (m_state != LegoAct2::e_atResidentialArea && m_state != LegoAct2::e_distributeRemainingBricks) { 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(); } - else if (m_unk0x10c4 == 13) { + else if (m_state == LegoAct2::e_brickHunt) { InitBricks(); } TickleManager()->RegisterClient(this, 20); SetAppCursor(e_cursorArrow); - if (m_unk0x10c4 == 2 || m_unk0x10c4 == 4 || m_unk0x10c4 == 6 || m_unk0x10c4 == 11 || m_unk0x10c4 == 12 || - m_unk0x10c4 == 14) { + if (m_state == LegoAct2::e_holdingSpeech || m_state == LegoAct2::e_explaining || + m_state == LegoAct2::e_atResidentialArea || m_state == LegoAct2::e_hidden || + m_state == LegoAct2::e_distributeRemainingBricks || m_state == LegoAct2::e_allPiecesCollected) { MxDSAction action; MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE); - m_unk0x1140 = (Act2mainScript::Script) 0; + m_currentAction = (Act2mainScript::Script) 0; action.SetObjectId(0); HandleEndAction(param); } @@ -569,21 +570,21 @@ void LegoAct2::Enable(MxBool p_enable) GameState()->m_isDirty = TRUE; } else { - m_unk0x10dc = m_pepper->GetLocal2World(); - m_unk0x1124 = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary(); + m_transformOnDisable = m_pepper->GetLocal2World(); + m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary(); FUN_10051900(); BackgroundAudioManager()->Stop(); UninitBricks(); 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; action.SetAtomId(m_atomId); action.SetUnknown24(-2); - action.SetObjectId(m_unk0x1144); + action.SetObjectId(m_infomanDirecting); DeleteObject(action); - m_unk0x1144 = (Act2mainScript::Script) 0; + m_infomanDirecting = (Act2mainScript::Script) 0; } TickleManager()->UnregisterClient(this); @@ -594,46 +595,46 @@ void LegoAct2::Enable(MxBool p_enable) // FUNCTION: BETA10 0x1003bb72 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(); actor->SetActorState(LegoPathActor::c_disabled); actor->SetWorldSpeed(0.0f); FUN_10051900(); - if (m_unk0x10d0 < 90000) { - FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); + if (m_timeSinceLastStage < 90000) { + StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); } 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_unk0x10c4 = 6; - m_unk0x10d0 = 0; + m_state = LegoAct2::e_atResidentialArea; + m_timeSinceLastStage = 0; } - else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) { - if (m_unk0x1144 == (Act2mainScript::Script) 0) { - FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); - m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav; + else if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x2a) { + if (m_infomanDirecting == (Act2mainScript::Script) 0) { + StartAction(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); + m_infomanDirecting = Act2mainScript::c_Avo907In_PlayWav; } } - else if (m_unk0x10c4 == 5) { - FUN_100521f0(p_param.GetData()); + else if (m_state == LegoAct2::e_goingToResidentialArea) { + CheckBricksterIsLoose(p_param.GetData()); } - else if (m_unk0x10c4 == 7) { - FUN_10051fa0(p_param.GetData()); + else if (m_state == LegoAct2::e_chase) { + 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); - if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { - m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav; + if (StartAction(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { + m_currentAction = Act2mainScript::c_VOhide_PlayWav; } - m_unk0x1138->FUN_10019560(); + m_unk0x1138->Hide(); - m_unk0x10c4 = 11; - m_unk0x10d0 = 0; + m_state = LegoAct2::e_hidden; + m_timeSinceLastStage = 0; if (m_nextBrick < 6) { m_bricks[m_nextBrick].Create(m_nextBrick); @@ -655,7 +656,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) // FUNCTION: LEGO1 0x100516b0 // FUNCTION: BETA10 0x1003bcbc -MxResult LegoAct2::FUN_100516b0() +MxResult LegoAct2::CreateBrick() { if (m_nextBrick > 4) { return FAILURE; @@ -673,8 +674,8 @@ MxResult LegoAct2::FUN_100516b0() brick.Place(local2world, local2world2, boundary); m_nextBrick++; - m_unk0x10c4 = 9; - m_unk0x10d0 = 0; + m_state = LegoAct2::e_droppingBrick; + m_timeSinceLastStage = 0; return SUCCESS; } @@ -721,7 +722,7 @@ void LegoAct2::FUN_10051900() // FUNCTION: LEGO1 0x10051960 // FUNCTION: BETA10 0x1003bf2c -void LegoAct2::FUN_10051960() +void LegoAct2::HideMaPaInfo() { LegoROI* roi; @@ -938,94 +939,94 @@ MxResult LegoAct2::BadEnding() TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); MxTrace("Bad End of Act2\n"); - m_unk0x10c4 = 14; + m_state = LegoAct2::e_allPiecesCollected; EmitGameEvent(e_badEnding); return SUCCESS; } // FUNCTION: LEGO1 0x10051fa0 // FUNCTION: BETA10 0x10013fd3 -void LegoAct2::FUN_10051fa0(MxS32 p_param1) +void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData) { MxU8 randN = SDL_rand(3); randN++; - switch (p_param1) { + switch (p_pathData) { case 2: 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 { - FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 8: 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 { - FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 9: 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 { - FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 14: 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 { - FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 23: 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 { - FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 24: case 25: - FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL); break; case 26: 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 { - FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 34: 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 { - FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 36: 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 { - FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; case 38: case 42: 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 { - FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); + StartAction(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); } break; } @@ -1033,44 +1034,44 @@ void LegoAct2::FUN_10051fa0(MxS32 p_param1) // FUNCTION: LEGO1 0x100521f0 // FUNCTION: BETA10 0x100142f1 -void LegoAct2::FUN_100521f0(MxS32 p_param1) +void LegoAct2::CheckBricksterIsLoose(MxS32 p_pathData) { Act2mainScript::Script objectId = (Act2mainScript::Script) 0; - Mx3DPointFloat vec; + Mx3DPointFloat actorPosition; - switch (p_param1) { + switch (p_pathData) { case 0x02: { - vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f); + actorPosition = Mx3DPointFloat(-9.1f, 0.0f, -16.5f); VariableTable()->SetVariable("ACTOR_01", "bd"); objectId = Act2mainScript::c_tns030bd_RunAnim; break; } case 0x2a: { - vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f); + actorPosition = Mx3DPointFloat(-9.67f, 0.0f, -44.3f); VariableTable()->SetVariable("ACTOR_01", "rd"); objectId = Act2mainScript::c_tns030rd_RunAnim; break; } case 0x133: { - vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f); + actorPosition = Mx3DPointFloat(25.75f, 0.0f, -13.0f); VariableTable()->SetVariable("ACTOR_01", "pg"); objectId = Act2mainScript::c_tns030pg_RunAnim; break; } case 0x134: { - vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f); + actorPosition = Mx3DPointFloat(43.63f, 0.0f, -46.33f); VariableTable()->SetVariable("ACTOR_01", "sy"); objectId = Act2mainScript::c_tns030sy_RunAnim; break; } case 0x135: { - vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f); + actorPosition = Mx3DPointFloat(50.0f, 0.0f, -34.6f); VariableTable()->SetVariable("ACTOR_01", "rd"); objectId = Act2mainScript::c_tns030rd_RunAnim; break; } case 0x138: { - vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f); + actorPosition = Mx3DPointFloat(-41.15f, 4.0f, 31.0f); VariableTable()->SetVariable("ACTOR_01", "sy"); objectId = Act2mainScript::c_tns030sy_RunAnim; break; @@ -1078,30 +1079,30 @@ void LegoAct2::FUN_100521f0(MxS32 p_param1) } if (objectId != (Act2mainScript::Script) 0) { - Mx3DPointFloat local30(vec); + Mx3DPointFloat lookingAtPepper(actorPosition); Mx3DPointFloat position(m_pepper->GetWorldPosition()); - local30 -= position; - Mx3DPointFloat local44 = local30; - local30.Unitize(); - FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL); + lookingAtPepper -= position; + Mx3DPointFloat local44 = lookingAtPepper; + lookingAtPepper.Unitize(); + StartAction(objectId, TRUE, TRUE, &actorPosition, &lookingAtPepper, NULL); } } // FUNCTION: LEGO1 0x10052560 // FUNCTION: BETA10 0x100145c6 -MxResult LegoAct2::FUN_10052560( +MxResult LegoAct2::StartAction( Act2mainScript::Script p_objectId, - MxBool p_param2, - MxBool p_param3, + MxBool p_isAnimation, + MxBool p_ignoreCurrentAction, Mx3DPointFloat* p_location, Mx3DPointFloat* p_direction, Mx3DPointFloat* p_param6 ) { - if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) { + if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) { assert(strlen(m_siFile)); - if (!p_param2) { + if (!p_isAnimation) { MxDSAction action; action.SetObjectId(p_objectId); @@ -1189,7 +1190,7 @@ MxResult LegoAct2::FUN_10052560( } if (result == SUCCESS) { - m_unk0x1140 = p_objectId; + m_currentAction = p_objectId; } } } @@ -1199,7 +1200,7 @@ MxResult LegoAct2::FUN_10052560( // FUNCTION: LEGO1 0x10052800 // FUNCTION: BETA10 0x10014aa8 -MxResult LegoAct2::FUN_10052800() +MxResult LegoAct2::InitializeShooting() { LegoPathActor* actor = m_unk0x1138; LegoLocomotionAnimPresenter* ap; @@ -1223,6 +1224,6 @@ MxResult LegoAct2::FUN_10052800() ap->FUN_1006d680(m_unk0x1138, -1.0f); actor->SetWorldSpeed(0.0f); - m_unk0x1138->FUN_10018980(); + m_unk0x1138->InitializeNextShot(); return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 28407834..a3e068f0 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -49,17 +49,17 @@ RegistrationBook::RegistrationBook() : m_registerDialogueTimer(0x80000000), m_un memset(m_alphabet, 0, sizeof(m_alphabet)); memset(m_intAlphabet, 0, sizeof(m_intAlphabet)); memset(m_name, 0, sizeof(m_name)); - m_unk0x280.m_cursorPos = 0; + m_newName.m_cursorPos = 0; memset(m_checkmark, 0, sizeof(m_checkmark)); - memset(&m_unk0x280, -1, sizeof(m_unk0x280) - 2); + memset(&m_newName, -1, sizeof(m_newName) - 2); - m_unk0x2b8 = 0; + m_vehiclesToPosition = 0; m_infocenterState = NULL; NotificationManager()->Register(this); - m_unk0x2c1 = FALSE; + m_awaitLoad = FALSE; m_checkboxHilite = NULL; m_checkboxSurface = NULL; m_checkboxNormal = NULL; @@ -155,9 +155,9 @@ MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param) switch ((MxS32) p_param.GetAction()->GetObjectId()) { case RegbookScript::c_Textures: - m_unk0x2c1 = FALSE; + m_awaitLoad = FALSE; - if (m_unk0x2b8 == 0) { + if (m_vehiclesToPosition == 0) { TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } break; @@ -198,40 +198,40 @@ MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key) BackgroundAudioManager()->RaiseVolume(); } } - else if (key != SDLK_BACKSPACE && m_unk0x280.m_cursorPos < 7) { - m_name[0][m_unk0x280.m_cursorPos] = (*intoAlphabet)->Clone(); + else if (key != SDLK_BACKSPACE && m_newName.m_cursorPos < 7) { + m_name[0][m_newName.m_cursorPos] = (*intoAlphabet)->Clone(); - if (m_name[0][m_unk0x280.m_cursorPos] != NULL) { + if (m_name[0][m_newName.m_cursorPos] != NULL) { (*intoAlphabet)->GetAction()->SetUnknown24((*intoAlphabet)->GetAction()->GetUnknown24() + 1); - m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE); - m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating); - m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121); + m_name[0][m_newName.m_cursorPos]->Enable(TRUE); + m_name[0][m_newName.m_cursorPos]->SetTickleState(MxPresenter::e_repeating); + m_name[0][m_newName.m_cursorPos]->SetPosition(m_newName.m_cursorPos * 23 + 343, 121); - if (m_unk0x280.m_cursorPos == 0) { + if (m_newName.m_cursorPos == 0) { m_checkmark[0]->Enable(TRUE); } - m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = + m_newName.m_letters[m_newName.m_cursorPos] = key >= SDLK_A && key <= SDLK_Z ? key - SDLK_A : (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet) - m_intAlphabetOffset; - m_unk0x280.m_cursorPos++; + m_newName.m_cursorPos++; } } else { - if (key == SDLK_BACKSPACE && m_unk0x280.m_cursorPos > 0) { - m_unk0x280.m_cursorPos--; + if (key == SDLK_BACKSPACE && m_newName.m_cursorPos > 0) { + m_newName.m_cursorPos--; - m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE); + m_name[0][m_newName.m_cursorPos]->Enable(FALSE); - delete m_name[0][m_unk0x280.m_cursorPos]; - m_name[0][m_unk0x280.m_cursorPos] = NULL; + delete m_name[0][m_newName.m_cursorPos]; + m_name[0][m_newName.m_cursorPos] = NULL; - if (m_unk0x280.m_cursorPos == 0) { + if (m_newName.m_cursorPos == 0) { m_checkmark[0]->Enable(FALSE); } - m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = -1; + m_newName.m_letters[m_newName.m_cursorPos] = -1; } } @@ -298,7 +298,7 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa } } - FUN_100775c0(i); + LoadSave(i); } } @@ -307,56 +307,57 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa // FUNCTION: LEGO1 0x100775c0 // STUB: BETA10 0x100f32b2 -void RegistrationBook::FUN_100775c0(MxS16 p_playerIndex) +void RegistrationBook::LoadSave(MxS16 p_checkMarkIndex) { if (m_infocenterState->HasRegistered()) { GameState()->Save(0); } + // The first checkmark searches for the name and is -1 if not found, while all other checkmarks start at 1 // TODO: structure incorrect - MxS16 player = p_playerIndex == 0 ? GameState()->FindPlayer(*(LegoGameState::Username*) &m_unk0x280.m_letters) - : p_playerIndex - 1; + MxS16 player = p_checkMarkIndex == 0 ? GameState()->FindPlayer(*(LegoGameState::Username*) &m_newName.m_letters) + : p_checkMarkIndex - 1; switch (player) { - case 0: + case 0: // Current save if (!m_infocenterState->HasRegistered()) { GameState()->SwitchPlayer(0); WriteInfocenterLetters(1); - FUN_100778c0(); + LoadVehicles(); } break; - case -1: + case -1: // New save GameState()->Init(); PlayAction(RegbookScript::c_Textures); - m_unk0x2c1 = TRUE; + m_awaitLoad = TRUE; // TOOD: structure incorrect - GameState()->AddPlayer(*(LegoGameState::Username*) &m_unk0x280.m_letters); + GameState()->AddPlayer(*(LegoGameState::Username*) &m_newName.m_letters); GameState()->Save(0); WriteInfocenterLetters(0); - GameState()->SerializePlayersInfo(2); - FUN_100778c0(); + GameState()->SerializePlayersInfo(LegoFile::c_write); + LoadVehicles(); break; default: GameState()->Init(); PlayAction(RegbookScript::c_Textures); - m_unk0x2c1 = TRUE; + m_awaitLoad = TRUE; GameState()->SwitchPlayer(player); WriteInfocenterLetters(player + 1); - GameState()->SerializePlayersInfo(2); - FUN_100778c0(); + GameState()->SerializePlayersInfo(LegoFile::c_write); + LoadVehicles(); break; } m_infocenterState->m_state = InfocenterState::e_selectedSave; - if (m_unk0x2b8 == 0 && !m_unk0x2c1) { + if (m_vehiclesToPosition == 0 && !m_awaitLoad) { DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } @@ -373,7 +374,7 @@ void RegistrationBook::WriteInfocenterLetters(MxS16 p_user) } // FUNCTION: LEGO1 0x100778c0 -void RegistrationBook::FUN_100778c0() +void RegistrationBook::LoadVehicles() { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); @@ -385,7 +386,7 @@ void RegistrationBook::FUN_100778c0() LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, CopterScript::c_Helicopter_Actor) ); - m_unk0x2b8++; + m_vehiclesToPosition++; } if (act1state->m_jetskiPlane.IsPresent()) { @@ -395,7 +396,7 @@ void RegistrationBook::FUN_100778c0() LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, JetskiScript::c_Jetski_Actor) ); - m_unk0x2b8++; + m_vehiclesToPosition++; } if (act1state->m_dunebuggyPlane.IsPresent()) { @@ -405,7 +406,7 @@ void RegistrationBook::FUN_100778c0() LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, DunecarScript::c_DuneBugy_Actor) ); - m_unk0x2b8++; + m_vehiclesToPosition++; } if (act1state->m_racecarPlane.IsPresent()) { @@ -415,10 +416,10 @@ void RegistrationBook::FUN_100778c0() LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, RacecarScript::c_RaceCar_Actor) ); - m_unk0x2b8++; + m_vehiclesToPosition++; } - if (m_unk0x2b8 != 0) { + if (m_vehiclesToPosition != 0) { DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); InputManager()->DisableInputProcessing(); SetAppCursor(e_cursorBusy); @@ -656,10 +657,10 @@ MxLong RegistrationBook::HandlePathStruct(LegoPathStructNotificationParam& p_par else { RemoveActor(actor); Remove(actor); - m_unk0x2b8--; + m_vehiclesToPosition--; } - if (m_unk0x2b8 == 0 && !m_unk0x2c1) { + if (m_vehiclesToPosition == 0 && !m_awaitLoad) { DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index dfd217d4..04e9a674 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -9,12 +9,6 @@ // LIBRARY: LEGO1 0x10086260 // ??3@YAXPAX@Z -// LIBRARY: LEGO1 0x1008a090 -// _malloc - -// LIBRARY: LEGO1 0x1008a100 -// _calloc - // LIBRARY: LEGO1 0x1008a1c0 // _free @@ -937,8 +931,31 @@ // GLOBAL: LEGO1 0x100db6e0 // GUID_SysKeyboard -// Cannot be handled right now due to anonymous pointer in struct +// GLOBAL: LEGO1 0x100dd1c0 +// IID_IDirect3DRM2 + +// LIBRARY: LEGO1 0x1008c960 +// ?_query_new_handler@@YAP6AHI@ZXZ + +// LIBRARY: LEGO1 0x1008c970 +// ?_query_new_mode@@YAHXZ + +// GLOBAL: LEGO1 0x100fd8ec +// __newmode + +// Cannot be handled right now due to anonymous pointer in struct. +// We can annotate it on the original side, but we have no symbol on the recomp side. +// We would need a way of annotating "the pointer at c_dfDIKeyboard+0x14 has orig address 0x10097f80". // // GLOBAL: LEGO1 0x10098f80 // c_dfDIKeyboard + +/// Globals from libraries without symbols + +// STRING: LEGO1 0x100dabb0 +static const char* ___crtLCMapStringA_str = "\0"; + +// STRING: LEGO1 0x100dabb4 +static const wchar_t *___crtLCMapStringA_wstr = L"\0"; + #endif diff --git a/LEGO1/library_smartheap.h b/LEGO1/library_smartheap.h new file mode 100644 index 00000000..adb04276 --- /dev/null +++ b/LEGO1/library_smartheap.h @@ -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 diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index f9f8fa49..81f33bd1 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -22,11 +22,11 @@ class Mx3DPointFloat : public Vector3 { } // FUNCTION: LEGO1 0x100343a0 - // FUNCTION: BETA10 0x10011600 + // FUNCTION: BETA10 0x100151e0 Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } // FUNCTION: LEGO1 0x10048ed0 - // FUNCTION: BETA10 0x100151e0 + // FUNCTION: BETA10 0x10011600 Mx3DPointFloat(const Vector3& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } // FUNCTION: LEGO1 0x10003c10 diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 7fc5c605..7ae5d439 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -14,10 +14,10 @@ class MxMatrix : public Matrix4 { // FUNCTION: LEGO1 0x10032770 // FUNCTION: BETA10 0x1001ff30 - MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); } // FUNCTION: BETA10 0x1000fc20 - MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); } // FUNCTION: BETA10 0x10010860 float* operator[](int idx) { return m_data[idx]; } @@ -25,10 +25,10 @@ class MxMatrix : public Matrix4 { const float* operator[](int idx) const { return m_data[idx]; } // FUNCTION: LEGO1 0x10002850 - void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 + void operator=(const Matrix4& p_matrix) override { CopyFrom(p_matrix); } // vtable+0x28 // FUNCTION: LEGO1 0x10002860 - virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48 + virtual void operator=(const MxMatrix& p_matrix) { CopyFrom(p_matrix); } // vtable+0x48 private: float m_elements[4][4]; // 0x08 diff --git a/LEGO1/omni/include/mxvideomanager.h b/LEGO1/omni/include/mxvideomanager.h index 08632f74..3e3266aa 100644 --- a/LEGO1/omni/include/mxvideomanager.h +++ b/LEGO1/omni/include/mxvideomanager.h @@ -47,7 +47,7 @@ class MxVideoManager : public MxPresentationManager { MxVideoParam& GetVideoParam() { return this->m_videoParam; } LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } - // FUNCTION: BETA10 0x1002e290 + // FUNCTION: BETA10 0x100969e0 MxDisplaySurface* GetDisplaySurface() { return this->m_displaySurface; } MxRegion* GetRegion() { return this->m_region; } diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index 39091e8f..ed1a1fea 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -13,7 +13,7 @@ DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c); -// GLOBAL LEGO1 0x10101420 +// GLOBAL: LEGO1 0x10101420 MxS32 g_volumeAttenuation[100] = {-6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058, -2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index 1b8d1fdb..cd87da48 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -24,8 +24,8 @@ class Matrix4 { virtual ~Matrix4() {} - inline virtual void Equals(float (*p_data)[4]); // vtable+0x04 - inline virtual void Equals(const Matrix4& p_matrix); // vtable+0x00 + inline virtual void CopyFrom(float (*p_data)[4]); // vtable+0x04 + inline virtual void CopyFrom(const Matrix4& p_matrix); // vtable+0x00 inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08 inline virtual float (*GetData())[4]; // vtable+0x14 diff --git a/LEGO1/realtime/matrix4d.inl.h b/LEGO1/realtime/matrix4d.inl.h index c1643f76..a5df1bc9 100644 --- a/LEGO1/realtime/matrix4d.inl.h +++ b/LEGO1/realtime/matrix4d.inl.h @@ -8,14 +8,14 @@ // FUNCTION: LEGO1 0x10002320 // FUNCTION: BETA10 0x1000fcb0 -void Matrix4::Equals(float (*p_data)[4]) +void Matrix4::CopyFrom(float (*p_data)[4]) { memcpy(m_data, p_data, sizeof(float) * 4 * 4); } // FUNCTION: LEGO1 0x10002340 // FUNCTION: BETA10 0x1000fcf0 -void Matrix4::Equals(const Matrix4& p_matrix) +void Matrix4::CopyFrom(const Matrix4& p_matrix) { memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4); } @@ -84,7 +84,7 @@ void Matrix4::SetIdentity() // FUNCTION: BETA10 0x1000ff20 void Matrix4::operator=(const Matrix4& p_matrix) { - Equals(p_matrix); + CopyFrom(p_matrix); } // FUNCTION: LEGO1 0x10002430 diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index dd5b9993..25829f7e 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -56,7 +56,7 @@ class BoundingSphere { // BoundingSphere::operator= // SYNTHETIC: BETA10 0x1001fc50 - // BoundingSphere::BoundingSphere + // ??0BoundingSphere@@QAE@XZ private: Mx3DPointFloat center; // 0x00 diff --git a/LEGO1/tgl/d3drm/renderer.cpp b/LEGO1/tgl/d3drm/renderer.cpp index cd6524f1..5b592d4f 100644 --- a/LEGO1/tgl/d3drm/renderer.cpp +++ b/LEGO1/tgl/d3drm/renderer.cpp @@ -88,8 +88,7 @@ inline Result RendererCreateDevice( if (Succeeded(result)) { if (rCreateData.m_pBackBuffer) { - // LEGO1 0x10101040 - // GLOBAL: BETA10 0x102055f4 + // annotated below static int g_setBufferCount = 1; if (g_setBufferCount) { Result result2 = ResultVal(rpDevice->SetBufferCount(2)); @@ -101,6 +100,10 @@ inline Result RendererCreateDevice( return result; } +// GLOBAL: LEGO1 0x10101040 +// GLOBAL: BETA10 0x102055f4 +// ?g_setBufferCount@?3??RendererCreateDevice@@YA?AW4Result@Tgl@@PAUIDirect3DRM2@@ABUDeviceDirectDrawCreateData@3@AAPAUIDirect3DRMDevice2@@@Z@4HA + // FUNCTION: BETA10 0x1016cf40 inline Result RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice) { diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index a6f4aaba..aaf37eec 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -270,6 +270,7 @@ inline void ViewManager::ManageVisibilityAndDetailRecursively(ViewROI* p_from, i p_from->SetLodLevel(ViewROI::c_lodLevelUnset); for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) { + // LINE: BETA10 0x10172bbd ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_lodLevel); } }