From 4147a9fdecc409dd31800f4b343e2b7c507409fc Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 24 Sep 2024 22:05:42 -0600 Subject: [PATCH] CScriptCameraHint, CCameraManager progress & renaming from MPR --- config/GM8E01_00/symbols.txt | 80 ++-- config/GM8E01_01/symbols.txt | 80 ++-- include/Kyoto/Audio/CSfxManager.hpp | 17 +- include/MetroidPrime/Cameras/CBallCamera.hpp | 9 +- include/MetroidPrime/Cameras/CCameraHint.hpp | 39 -- .../MetroidPrime/Cameras/CCameraManager.hpp | 48 ++- .../Cameras/CCameraOverrideInfo.hpp | 64 +++ .../Cameras/CFirstPersonCamera.hpp | 2 +- include/MetroidPrime/Cameras/CGameCamera.hpp | 2 +- include/MetroidPrime/Player/CPlayer.hpp | 1 + .../ScriptObjects/CScriptCameraHint.hpp | 38 +- include/rstl/algorithm.hpp | 6 +- include/rstl/reserved_vector.hpp | 10 +- src/MetroidPrime/Cameras/CBallCamera.cpp | 6 +- src/MetroidPrime/Cameras/CCameraHint.cpp | 29 -- src/MetroidPrime/Cameras/CCameraManager.cpp | 404 +++++++++++++++--- src/MetroidPrime/Cameras/CPathCamera.cpp | 14 +- .../ScriptObjects/CScriptCameraHint.cpp | 187 ++++++++ .../ScriptObjects/CScriptSpecialFunction.cpp | 4 +- 19 files changed, 771 insertions(+), 269 deletions(-) delete mode 100644 include/MetroidPrime/Cameras/CCameraHint.hpp create mode 100644 include/MetroidPrime/Cameras/CCameraOverrideInfo.hpp delete mode 100644 src/MetroidPrime/Cameras/CCameraHint.cpp create mode 100644 src/MetroidPrime/ScriptObjects/CScriptCameraHint.cpp diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 8bec0e91..a998da18 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -132,10 +132,10 @@ DeleteCameraHint__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x8000957C AddActiveCameraHint__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x80009664; // type:function size:0xCC scope:global HasBallCameraInitialPositionHint__14CCameraManagerCFR13CStateManager = .text:0x80009730; // type:function size:0x7C scope:global UpdateCameraHints__14CCameraManagerFfR13CStateManager = .text:0x800097AC; // type:function size:0xAF0 scope:global -RestoreHintlessCamera__14CCameraManagerFR13CStateManager = .text:0x8000A29C; // type:function size:0x1EC scope:global -ApplyCameraHint__14CCameraManagerFRC17CScriptCameraHintR13CStateManager = .text:0x8000A488; // type:function size:0x218 scope:global -SkipBallCameraCinematic__14CCameraManagerFR13CStateManager = .text:0x8000A6A0; // type:function size:0xC8 scope:global -InterpolateToBallCamera__14CCameraManagerFRC12CTransform4f9TUniqueIdRC9CVector3ffffbR13CStateManager = .text:0x8000A768; // type:function size:0xE0 scope:global +NoCameraHintsLeft__14CCameraManagerFR13CStateManager = .text:0x8000A29C; // type:function size:0x1EC scope:global +UseCameraHint__14CCameraManagerFRC17CScriptCameraHintR13CStateManager = .text:0x8000A488; // type:function size:0x218 scope:global +CinematicCut__14CCameraManagerFR13CStateManager = .text:0x8000A6A0; // type:function size:0xC8 scope:global +SetupInterpolation__14CCameraManagerFRC12CTransform4f9TUniqueId9CVector3ffffbR13CStateManager = .text:0x8000A768; // type:function size:0xE0 scope:global SetPlayerCamera__14CCameraManagerFR13CStateManager9TUniqueId = .text:0x8000A848; // type:function size:0x84 scope:global ShouldBypassInterpolationCamera__14CCameraManagerCFv = .text:0x8000A8CC; // type:function size:0x8 scope:global IsInterpolationCameraActive__14CCameraManagerCFv = .text:0x8000A8D4; // type:function size:0x10 scope:global @@ -151,7 +151,7 @@ create_node__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FPQ34rs __dt__16CCameraShakeDataFv = .text:0x8000AD2C; // type:function size:0x7C scope:global __ct__16CCameraShakeDataFRC16CCameraShakeData = .text:0x8000ADA8; // type:function size:0x1A8 scope:global __dt__22CCameraShakerComponentFv = .text:0x8000AF50; // type:function size:0x48 scope:global -SkipCinematic__14CCameraManagerFR13CStateManager = .text:0x8000AF98; // type:function size:0xC0 scope:global +StopCinematics__14CCameraManagerFR13CStateManager = .text:0x8000AF98; // type:function size:0xC0 scope:global EnterCinematic__14CCameraManagerFR13CStateManager = .text:0x8000B058; // type:function size:0x16C scope:global RemoveCinemaCamera__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x8000B1C4; // type:function size:0x94 scope:global erase__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>FQ24rstl110pointer_iterator<9TUniqueId,Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x8000B258; // type:function size:0x4C scope:global @@ -160,34 +160,34 @@ AddCinemaCamera__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x8000B33C; ProcessInput__14CCameraManagerFRC11CFinalInputR13CStateManager = .text:0x8000B46C; // type:function size:0xB0 scope:global SetInsideFluid__14CCameraManagerFb9TUniqueId = .text:0x8000B51C; // type:function size:0x30 scope:global Update__14CCameraManagerFfR13CStateManager = .text:0x8000B54C; // type:function size:0x80 scope:global -SetFogDensity__14CCameraManagerFff = .text:0x8000B5CC; // type:function size:0x28 scope:global -CalculateFogDensity__14CCameraManagerFR13CStateManagerPC12CScriptWater = .text:0x8000B5F4; // type:function size:0x8C scope:global -UpdateFog__14CCameraManagerFfR13CStateManager = .text:0x8000B680; // type:function size:0x1F8 scope:global -UpdateRumble__14CCameraManagerFfR13CStateManager = .text:0x8000B878; // type:function size:0x1B0 scope:global -UpdateSfxListener__14CCameraManagerFR13CStateManager = .text:0x8000BA28; // type:function size:0x9C scope:global +SetWaterFogScale__14CCameraManagerFff = .text:0x8000B5CC; // type:function size:0x28 scope:global +GetWaterFarDistance__14CCameraManagerFR13CStateManagerPC12CScriptWater = .text:0x8000B5F4; // type:function size:0x8C scope:global +UpdateFilters__14CCameraManagerFfR13CStateManager = .text:0x8000B680; // type:function size:0x1F8 scope:global +UpdateScreenShake__14CCameraManagerFfR13CStateManager = .text:0x8000B878; // type:function size:0x1B0 scope:global +UpdateAudioListener__14CCameraManagerFR13CStateManager = .text:0x8000BA28; // type:function size:0x9C scope:global SetCurrentCameraId__14CCameraManagerF9TUniqueId = .text:0x8000BAC4; // type:function size:0xC scope:global -GetLastCineCamera__14CCameraManagerCFR13CStateManager = .text:0x8000BAD0; // type:function size:0x48 scope:global +GetCurrentCinematicCamera__14CCameraManagerCFR13CStateManager = .text:0x8000BAD0; // type:function size:0x48 scope:global GetCurrentCamera__14CCameraManagerCFRC13CStateManager = .text:0x8000BB18; // type:function size:0x48 scope:global CurrentCamera__14CCameraManagerFR13CStateManager = .text:0x8000BB60; // type:function size:0x48 scope:global -GetLastCineCameraId__14CCameraManagerCFv = .text:0x8000BBA8; // type:function size:0x30 scope:global +GetCurrentCinematicCameraId__14CCameraManagerCFv = .text:0x8000BBA8; // type:function size:0x30 scope:global GetCurrentCameraId__14CCameraManagerCFv = .text:0x8000BBD8; // type:function size:0x30 scope:global -RenderCameras__14CCameraManagerFRC13CStateManager = .text:0x8000BC08; // type:function size:0x88 scope:global +Render__14CCameraManagerFRC13CStateManager = .text:0x8000BC08; // type:function size:0x88 scope:global ResetCameras__14CCameraManagerFR13CStateManager = .text:0x8000BC90; // type:function size:0xD0 scope:global -ThinkCameras__14CCameraManagerFfR13CStateManager = .text:0x8000BD60; // type:function size:0xF8 scope:global -CreateStandardCameras__14CCameraManagerFR13CStateManager = .text:0x8000BE58; // type:function size:0x260 scope:global -DefaultAspect__14CCameraManagerFv = .text:0x8000C0B8; // type:function size:0x8 scope:global -DefaultFarPlane__14CCameraManagerFv = .text:0x8000C0C0; // type:function size:0x8 scope:global -DefaultNearPlane__14CCameraManagerFv = .text:0x8000C0C8; // type:function size:0x8 scope:global -DefaultFirstPersonFov__14CCameraManagerFv = .text:0x8000C0D0; // type:function size:0x8 scope:global -DefaultThirdPersonFov__14CCameraManagerFv = .text:0x8000C0D8; // type:function size:0x8 scope:global +UpdateCameras__14CCameraManagerFfR13CStateManager = .text:0x8000BD60; // type:function size:0xF8 scope:global +CreateCameras__14CCameraManagerFR13CStateManager = .text:0x8000BE58; // type:function size:0x260 scope:global +GetDefaultAspectRatio__14CCameraManagerFv = .text:0x8000C0B8; // type:function size:0x8 scope:global +GetDefaultFirstPersonFarClipDistance__14CCameraManagerFv = .text:0x8000C0C0; // type:function size:0x8 scope:global +GetDefaultFirstPersonNearClipDistance__14CCameraManagerFv = .text:0x8000C0C8; // type:function size:0x8 scope:global +GetDefaultFirstPersonVerticalFOV__14CCameraManagerFv = .text:0x8000C0D0; // type:function size:0x8 scope:global +GetDefaultThirdPersonVerticalFOV__14CCameraManagerFv = .text:0x8000C0D8; // type:function size:0x8 scope:global __ct__14CCameraManagerF9TUniqueId = .text:0x8000C0E0; // type:function size:0x1D4 scope:global Clamp__5CMathFRCfRCfRCf = .text:0x8000C2B4; // type:function size:0x2C scope:global -fn_8000C2E0 = .text:0x8000C2E0; // type:function size:0x128 +sort,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFPQ24rstl18pairPQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C2E0; // type:function size:0x128 reserve__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>Fi = .text:0x8000C408; // type:function size:0xEC scope:global erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FRCQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>8iterator = .text:0x8000C4F4; // type:function size:0xC0 scope:global fn_8000C5B4 = .text:0x8000C5B4; // type:function size:0xC0 -fn_8000C674 = .text:0x8000C674; // type:function size:0x84 -fn_8000C6F8 = .text:0x8000C6F8; // type:function size:0x90 +__insertion_sort,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFPQ24rstl18pairPQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C674; // type:function size:0x84 +__sort3,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFRQ24rstl18pairRQ24rstl18pairRQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C6F8; // type:function size:0x90 SetCommandFiltered__13ControlMapperFQ213ControlMapper9ECommandsb = .text:0x8000C788; // type:function size:0x14 scope:global ResetCommandFilters__13ControlMapperFv = .text:0x8000C79C; // type:function size:0x34 scope:global GetPressInput__13ControlMapperFQ213ControlMapper9ECommandsRC11CFinalInput = .text:0x8000C7D0; // type:function size:0xA4 scope:global @@ -266,7 +266,7 @@ __dt__Q24rstl21reserved_vectorFv = .text:0x8000E050; // type:function size GetGunFollowTransform__18CFirstPersonCameraCFv = .text:0x8000E0E4; // type:function size:0x8 scope:global Accept__18CFirstPersonCameraFR8IVisitor = .text:0x8000E0EC; // type:function size:0x38 scope:global Think__18CFirstPersonCameraFfR13CStateManager = .text:0x8000E124; // type:function size:0x1F4 scope:global -SkipCinematic__18CFirstPersonCameraFv = .text:0x8000E318; // type:function size:0x28 scope:global +CancelCinematicOffset__18CFirstPersonCameraFv = .text:0x8000E318; // type:function size:0x28 scope:global Reset__18CFirstPersonCameraFRC12CTransform4fR13CStateManager = .text:0x8000E340; // type:function size:0x88 scope:global Render__18CFirstPersonCameraCFRC13CStateManager = .text:0x8000E3C8; // type:function size:0x4 scope:global PreThink__18CFirstPersonCameraFfR13CStateManager = .text:0x8000E3CC; // type:function size:0x4 scope:global @@ -1418,7 +1418,7 @@ AddToRenderer__7CEffectCFRC14CFrustumPlanesRC13CStateManager = .text:0x8005AD48; Render__7CEffectCFRC13CStateManager = .text:0x8005AD4C; // type:function size:0x4 scope:global __ct__7CEffectF9TUniqueIdRC11CEntityInfobRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4f = .text:0x8005AD50; // type:function size:0xEC scope:global UpdatePerspective__11CGameCameraFf = .text:0x8005AE3C; // type:function size:0xDC scope:global -SetFovInterpolation__11CGameCameraFffff = .text:0x8005AF18; // type:function size:0x70 scope:global +InterpolateFOV__11CGameCameraFffff = .text:0x8005AF18; // type:function size:0x70 scope:global SkipFovInterpolation__11CGameCameraFv = .text:0x8005AF88; // type:function size:0x38 scope:global ValidateCameraTransform__11CGameCameraFRC12CTransform4fRC12CTransform4f = .text:0x8005AFC0; // type:function size:0x314 scope:global Accept__11CGameCameraFR8IVisitor = .text:0x8005B2D4; // type:function size:0x38 scope:global @@ -1925,7 +1925,7 @@ __ct__8CMapAreaFR12CInputStreamUi = .text:0x80080EFC; // type:function size:0x11 __sinit_CMapArea_cpp = .text:0x80081010; // type:function size:0x38 scope:local SplineIntersectTest__11CBallCameraCFR13CMaterialListR13CStateManager = .text:0x80081048; // type:function size:0x788 scope:global CheckFailsafeFromMorphBallState__11CBallCameraCFR13CStateManager = .text:0x800817D0; // type:function size:0x6B0 scope:global -ApplyCameraHint__11CBallCameraFR13CStateManager = .text:0x80081E80; // type:function size:0x8A0 scope:global +OverrideCameraInfo__11CBallCameraFR13CStateManager = .text:0x80081E80; // type:function size:0x8A0 scope:global Accept__11CBallCameraFR8IVisitor = .text:0x80082720; // type:function size:0x38 scope:global AcceptScriptMsg__11CBallCameraF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x80082758; // type:function size:0x3B4 scope:global ProcessInput__11CBallCameraFRC11CFinalInputR13CStateManager = .text:0x80082B0C; // type:function size:0x190 scope:global @@ -1959,7 +1959,7 @@ UpdateCameraPositions__11CBallCameraFfRC12CTransform4fRC12CTransform4f = .text:0 ConstrainYawAngle__11CBallCameraCFRC7CPlayerfffR13CStateManager = .text:0x80089374; // type:function size:0x358 scope:global ConstrainElevationAndDistance__11CBallCameraFRfRffR13CStateManager = .text:0x800896CC; // type:function size:0x230 scope:global UpdateObjectTooCloseId__11CBallCameraFR13CStateManager = .text:0x800898FC; // type:function size:0x284 scope:global -UpdateLookDirection__11CBallCameraFRC9CVector3fR13CStateManager = .text:0x80089B80; // type:function size:0x134 scope:global +FindDesiredTransform__11CBallCameraF9CVector3fR13CStateManager = .text:0x80089B80; // type:function size:0x134 scope:global FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb = .text:0x80089CB4; // type:function size:0xD48 scope:global DetectCollision__11CBallCameraFRC9CVector3fRC9CVector3ffRfR13CStateManager = .text:0x8008A9FC; // type:function size:0x71C scope:global AvoidGeometry__11CBallCameraFRC12CTransform4fRCQ24rstl32reserved_vector<9TUniqueId,1024>fR13CStateManager = .text:0x8008B118; // type:function size:0x134 scope:global @@ -1979,7 +1979,7 @@ __ct__15CCameraColliderFRC15CCameraCollider = .text:0x8008C6CC; // type:function __dt__15CCameraColliderFv = .text:0x8008C77C; // type:function size:0x48 scope:global ResetToTweaks__11CBallCameraFR13CStateManager = .text:0x8008C7C4; // type:function size:0x234 scope:global TeleportCamera__11CBallCameraFRC12CTransform4fR13CStateManager = .text:0x8008C9F8; // type:function size:0x98 scope:global -ResetPosition__11CBallCameraFR13CStateManager = .text:0x8008CA90; // type:function size:0x8C scope:global +TeleportLookAtStuff__11CBallCameraFR13CStateManager = .text:0x8008CA90; // type:function size:0x8C scope:global TeleportCamera__11CBallCameraFRC9CVector3fR13CStateManager = .text:0x8008CB1C; // type:function size:0x100 scope:global TeleportColliders__11CBallCameraFRQ24rstl52vector<15CCameraCollider,Q24rstl17rmemory_allocator>9CVector3f = .text:0x8008CC1C; // type:function size:0xD4 scope:global __dt__11CBallCameraFv = .text:0x8008CCF0; // type:function size:0x1BC scope:global @@ -5731,17 +5731,17 @@ __dt__11CScriptDockFv = .text:0x800C43CC; // type:function size:0x60 scope:globa __ct__11CScriptDockF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3fRC9CVector3fi7TAreaIdbib = .text:0x800C442C; // type:function size:0x260 scope:global Accept__17CScriptCameraHintFR8IVisitor = .text:0x800C468C; // type:function size:0x38 scope:global AcceptScriptMsg__17CScriptCameraHintF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800C46C4; // type:function size:0x2E0 scope:global -InitializeInArea__17CScriptCameraHintFR13CStateManager = .text:0x800C49A4; // type:function size:0x1F4 scope:global -fn_800C4B98 = .text:0x800C4B98; // type:function size:0x4C -fn_800C4BE4 = .text:0x800C4BE4; // type:function size:0xB4 -RemoveHelper__17CScriptCameraHintF9TUniqueId = .text:0x800C4C98; // type:function size:0xD0 scope:global -AddHelper__17CScriptCameraHintF9TUniqueId = .text:0x800C4D68; // type:function size:0x58 scope:global -ClearIdList__17CScriptCameraHintFv = .text:0x800C4DC0; // type:function size:0x58 scope:global -GetFirstHelper__17CScriptCameraHintCFv = .text:0x800C4E18; // type:function size:0x24 scope:global +CheckLegacyConnections__17CScriptCameraHintFR13CStateManager = .text:0x800C49A4; // type:function size:0x1F4 scope:global +erase__Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>FQ24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x800C4B98; // type:function size:0x4C +erase__Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>FQ24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x800C4BE4; // type:function size:0xB4 +RemoveSender__17CScriptCameraHintF9TUniqueIdR13CStateManager = .text:0x800C4C98; // type:function size:0xD0 scope:global +AddSender__17CScriptCameraHintF9TUniqueId = .text:0x800C4D68; // type:function size:0x58 scope:global +ClearSenders__17CScriptCameraHintFv = .text:0x800C4DC0; // type:function size:0x58 scope:global +GetSenderId__17CScriptCameraHintCFv = .text:0x800C4E18; // type:function size:0x24 scope:global __dt__17CScriptCameraHintFv = .text:0x800C4E3C; // type:function size:0xD4 scope:global -__ct__17CScriptCameraHintF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiQ211CBallCamera20EBallCameraBehaviourifffRC13CCameraSpringRC13CCameraSpringfRC9CVector3fRC9CVector3ff = .text:0x800C4F10; // type:function size:0x27C scope:global -__dt__11CCameraHintFv = .text:0x800C518C; // type:function size:0x48 scope:global -__ct__11CCameraHintFiQ211CBallCamera20EBallCameraBehaviourfffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C51D4; // type:function size:0xA8 scope:global +__ct__17CScriptCameraHintF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiQ211CBallCamera20EBallCameraBehaviourifffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C4F10; // type:function size:0x27C scope:global +__dt__19CCameraOverrideInfoFv = .text:0x800C518C; // type:function size:0x48 scope:global +__ct__19CCameraOverrideInfoFUiQ211CBallCamera20EBallCameraBehaviourfffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C51D4; // type:function size:0xA8 scope:global LoadEnergyBall__12ScriptLoaderFR13CStateManagerR12CInputStreamiRC11CEntityInfo = .text:0x800C527C; // type:function size:0x3A0 scope:global __ct__16CActorParametersFRC16CActorParameters = .text:0x800C561C; // type:function size:0xE0 scope:global LoadShadowProjector__12ScriptLoaderFR13CStateManagerR12CInputStreamiRC11CEntityInfo = .text:0x800C56FC; // type:function size:0x15C scope:global @@ -18206,8 +18206,8 @@ lbl_803DF4E8 = .data:0x803DF4E8; // type:object size:0x10 __vt__13CScriptPickup = .data:0x803DF4F8; // type:object size:0x84 scope:global lbl_803DF580 = .data:0x803DF580; // type:object size:0x84 jumptable_803DF604 = .data:0x803DF604; // type:object size:0x80 scope:local -lbl_803DF688 = .data:0x803DF688; // type:object size:0x6C -lbl_803DF6F4 = .data:0x803DF6F4; // type:object size:0xC +__vt__17CScriptCameraHint = .data:0x803DF688; // type:object size:0x6C +__vt__19CCameraOverrideInfo = .data:0x803DF6F4; // type:object size:0xC __vt__41TObjOwnerDerivedFromIObj<13CStateMachine> = .data:0x803DF700; // type:object size:0xC scope:weak __vt__11CPlasmaBeam = .data:0x803DF710; // type:object size:0x44 scope:global __vt__10CPowerBeam = .data:0x803DF758; // type:object size:0x44 scope:global diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 41f64549..e3fef8d1 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -132,10 +132,10 @@ DeleteCameraHint__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x800095F8 AddActiveCameraHint__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x800096E0; // type:function size:0xCC scope:global HasBallCameraInitialPositionHint__14CCameraManagerCFR13CStateManager = .text:0x800097AC; // type:function size:0x7C scope:global UpdateCameraHints__14CCameraManagerFfR13CStateManager = .text:0x80009828; // type:function size:0xAF0 scope:global -RestoreHintlessCamera__14CCameraManagerFR13CStateManager = .text:0x8000A318; // type:function size:0x1EC scope:global -ApplyCameraHint__14CCameraManagerFRC17CScriptCameraHintR13CStateManager = .text:0x8000A504; // type:function size:0x218 scope:global -SkipBallCameraCinematic__14CCameraManagerFR13CStateManager = .text:0x8000A71C; // type:function size:0xC8 scope:global -InterpolateToBallCamera__14CCameraManagerFRC12CTransform4f9TUniqueIdRC9CVector3ffffbR13CStateManager = .text:0x8000A7E4; // type:function size:0xE0 scope:global +NoCameraHintsLeft__14CCameraManagerFR13CStateManager = .text:0x8000A318; // type:function size:0x1EC scope:global +UseCameraHint__14CCameraManagerFRC17CScriptCameraHintR13CStateManager = .text:0x8000A504; // type:function size:0x218 scope:global +CinematicCut__14CCameraManagerFR13CStateManager = .text:0x8000A71C; // type:function size:0xC8 scope:global +SetupInterpolation__14CCameraManagerFRC12CTransform4f9TUniqueId9CVector3ffffbR13CStateManager = .text:0x8000A7E4; // type:function size:0xE0 scope:global SetPlayerCamera__14CCameraManagerFR13CStateManager9TUniqueId = .text:0x8000A8C4; // type:function size:0x84 scope:global ShouldBypassInterpolationCamera__14CCameraManagerCFv = .text:0x8000A948; // type:function size:0x8 scope:global IsInterpolationCameraActive__14CCameraManagerCFv = .text:0x8000A950; // type:function size:0x10 scope:global @@ -151,7 +151,7 @@ create_node__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FPQ34rs __dt__16CCameraShakeDataFv = .text:0x8000ADA8; // type:function size:0x7C scope:global __ct__16CCameraShakeDataFRC16CCameraShakeData = .text:0x8000AE24; // type:function size:0x1A8 scope:global __dt__22CCameraShakerComponentFv = .text:0x8000AFCC; // type:function size:0x48 scope:global -SkipCinematic__14CCameraManagerFR13CStateManager = .text:0x8000B014; // type:function size:0xC0 scope:global +StopCinematics__14CCameraManagerFR13CStateManager = .text:0x8000B014; // type:function size:0xC0 scope:global EnterCinematic__14CCameraManagerFR13CStateManager = .text:0x8000B0D4; // type:function size:0x16C scope:global RemoveCinemaCamera__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x8000B240; // type:function size:0x94 scope:global erase__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>FQ24rstl110pointer_iterator<9TUniqueId,Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x8000B2D4; // type:function size:0x4C scope:global @@ -160,34 +160,34 @@ AddCinemaCamera__14CCameraManagerF9TUniqueIdR13CStateManager = .text:0x8000B3B8; ProcessInput__14CCameraManagerFRC11CFinalInputR13CStateManager = .text:0x8000B4E8; // type:function size:0xB0 scope:global SetInsideFluid__14CCameraManagerFb9TUniqueId = .text:0x8000B598; // type:function size:0x30 scope:global Update__14CCameraManagerFfR13CStateManager = .text:0x8000B5C8; // type:function size:0x80 scope:global -SetFogDensity__14CCameraManagerFff = .text:0x8000B648; // type:function size:0x28 scope:global -CalculateFogDensity__14CCameraManagerFR13CStateManagerPC12CScriptWater = .text:0x8000B670; // type:function size:0x8C scope:global -UpdateFog__14CCameraManagerFfR13CStateManager = .text:0x8000B6FC; // type:function size:0x1F8 scope:global -UpdateRumble__14CCameraManagerFfR13CStateManager = .text:0x8000B8F4; // type:function size:0x1B0 scope:global -UpdateSfxListener__14CCameraManagerFR13CStateManager = .text:0x8000BAA4; // type:function size:0x9C scope:global +SetWaterFogScale__14CCameraManagerFff = .text:0x8000B648; // type:function size:0x28 scope:global +GetWaterFarDistance__14CCameraManagerFR13CStateManagerPC12CScriptWater = .text:0x8000B670; // type:function size:0x8C scope:global +UpdateFilters__14CCameraManagerFfR13CStateManager = .text:0x8000B6FC; // type:function size:0x1F8 scope:global +UpdateScreenShake__14CCameraManagerFfR13CStateManager = .text:0x8000B8F4; // type:function size:0x1B0 scope:global +UpdateAudioListener__14CCameraManagerFR13CStateManager = .text:0x8000BAA4; // type:function size:0x9C scope:global SetCurrentCameraId__14CCameraManagerF9TUniqueId = .text:0x8000BB40; // type:function size:0xC scope:global -GetLastCineCamera__14CCameraManagerCFR13CStateManager = .text:0x8000BB4C; // type:function size:0x48 scope:global +GetCurrentCinematicCamera__14CCameraManagerCFR13CStateManager = .text:0x8000BB4C; // type:function size:0x48 scope:global GetCurrentCamera__14CCameraManagerCFRC13CStateManager = .text:0x8000BB94; // type:function size:0x48 scope:global CurrentCamera__14CCameraManagerFR13CStateManager = .text:0x8000BBDC; // type:function size:0x48 scope:global -GetLastCineCameraId__14CCameraManagerCFv = .text:0x8000BC24; // type:function size:0x30 scope:global +GetCurrentCinematicCameraId__14CCameraManagerCFv = .text:0x8000BC24; // type:function size:0x30 scope:global GetCurrentCameraId__14CCameraManagerCFv = .text:0x8000BC54; // type:function size:0x30 scope:global -RenderCameras__14CCameraManagerFRC13CStateManager = .text:0x8000BC84; // type:function size:0x88 scope:global +Render__14CCameraManagerFRC13CStateManager = .text:0x8000BC84; // type:function size:0x88 scope:global ResetCameras__14CCameraManagerFR13CStateManager = .text:0x8000BD0C; // type:function size:0xD0 scope:global -ThinkCameras__14CCameraManagerFfR13CStateManager = .text:0x8000BDDC; // type:function size:0xF8 scope:global -CreateStandardCameras__14CCameraManagerFR13CStateManager = .text:0x8000BED4; // type:function size:0x260 scope:global -DefaultAspect__14CCameraManagerFv = .text:0x8000C134; // type:function size:0x8 scope:global -DefaultFarPlane__14CCameraManagerFv = .text:0x8000C13C; // type:function size:0x8 scope:global -DefaultNearPlane__14CCameraManagerFv = .text:0x8000C144; // type:function size:0x8 scope:global -DefaultFirstPersonFov__14CCameraManagerFv = .text:0x8000C14C; // type:function size:0x8 scope:global -DefaultThirdPersonFov__14CCameraManagerFv = .text:0x8000C154; // type:function size:0x8 scope:global +UpdateCameras__14CCameraManagerFfR13CStateManager = .text:0x8000BDDC; // type:function size:0xF8 scope:global +CreateCameras__14CCameraManagerFR13CStateManager = .text:0x8000BED4; // type:function size:0x260 scope:global +GetDefaultAspectRatio__14CCameraManagerFv = .text:0x8000C134; // type:function size:0x8 scope:global +GetDefaultFirstPersonFarClipDistance__14CCameraManagerFv = .text:0x8000C13C; // type:function size:0x8 scope:global +GetDefaultFirstPersonNearClipDistance__14CCameraManagerFv = .text:0x8000C144; // type:function size:0x8 scope:global +GetDefaultFirstPersonVerticalFOV__14CCameraManagerFv = .text:0x8000C14C; // type:function size:0x8 scope:global +GetDefaultThirdPersonVerticalFOV__14CCameraManagerFv = .text:0x8000C154; // type:function size:0x8 scope:global __ct__14CCameraManagerF9TUniqueId = .text:0x8000C15C; // type:function size:0x1D4 scope:global Clamp__5CMathFRCfRCfRCf = .text:0x8000C330; // type:function size:0x2C scope:global -fn_8000C2E0 = .text:0x8000C35C; // type:function size:0x128 scope:global +sort,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFPQ24rstl18pairPQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C35C; // type:function size:0x128 scope:global reserve__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>Fi = .text:0x8000C484; // type:function size:0xEC scope:global erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FRCQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>8iterator = .text:0x8000C570; // type:function size:0xC0 scope:global fn_8000C5B4 = .text:0x8000C630; // type:function size:0xC0 scope:global -fn_8000C674 = .text:0x8000C6F0; // type:function size:0x84 scope:global -fn_8000C6F8 = .text:0x8000C774; // type:function size:0x90 scope:global +__insertion_sort,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFPQ24rstl18pairPQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C6F0; // type:function size:0x84 scope:global +__sort3,Q24rstl63pair_sorter_finder,Q24rstl7less>>__4rstlFRQ24rstl18pairRQ24rstl18pairRQ24rstl18pairQ24rstl63pair_sorter_finder,Q24rstl7less> = .text:0x8000C774; // type:function size:0x90 scope:global SetCommandFiltered__13ControlMapperFQ213ControlMapper9ECommandsb = .text:0x8000C804; // type:function size:0x14 scope:global ResetCommandFilters__13ControlMapperFv = .text:0x8000C818; // type:function size:0x34 scope:global GetPressInput__13ControlMapperFQ213ControlMapper9ECommandsRC11CFinalInput = .text:0x8000C84C; // type:function size:0xA4 scope:global @@ -266,7 +266,7 @@ __dt__Q24rstl21reserved_vectorFv = .text:0x8000E0CC; // type:function size GetGunFollowTransform__18CFirstPersonCameraCFv = .text:0x8000E160; // type:function size:0x8 scope:global Accept__18CFirstPersonCameraFR8IVisitor = .text:0x8000E168; // type:function size:0x38 scope:global Think__18CFirstPersonCameraFfR13CStateManager = .text:0x8000E1A0; // type:function size:0x1F4 scope:global -SkipCinematic__18CFirstPersonCameraFv = .text:0x8000E394; // type:function size:0x28 scope:global +CancelCinematicOffset__18CFirstPersonCameraFv = .text:0x8000E394; // type:function size:0x28 scope:global Reset__18CFirstPersonCameraFRC12CTransform4fR13CStateManager = .text:0x8000E3BC; // type:function size:0x88 scope:global Render__18CFirstPersonCameraCFRC13CStateManager = .text:0x8000E444; // type:function size:0x4 scope:global PreThink__18CFirstPersonCameraFfR13CStateManager = .text:0x8000E448; // type:function size:0x4 scope:global @@ -1418,7 +1418,7 @@ AddToRenderer__7CEffectCFRC14CFrustumPlanesRC13CStateManager = .text:0x8005ADC4; Render__7CEffectCFRC13CStateManager = .text:0x8005ADC8; // type:function size:0x4 scope:global __ct__7CEffectF9TUniqueIdRC11CEntityInfobRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4f = .text:0x8005ADCC; // type:function size:0xEC scope:global UpdatePerspective__11CGameCameraFf = .text:0x8005AEB8; // type:function size:0xDC scope:global -SetFovInterpolation__11CGameCameraFffff = .text:0x8005AF94; // type:function size:0x70 scope:global +InterpolateFOV__11CGameCameraFffff = .text:0x8005AF94; // type:function size:0x70 scope:global SkipFovInterpolation__11CGameCameraFv = .text:0x8005B004; // type:function size:0x38 scope:global ValidateCameraTransform__11CGameCameraFRC12CTransform4fRC12CTransform4f = .text:0x8005B03C; // type:function size:0x314 scope:global Accept__11CGameCameraFR8IVisitor = .text:0x8005B350; // type:function size:0x38 scope:global @@ -1925,7 +1925,7 @@ __ct__8CMapAreaFR12CInputStreamUi = .text:0x80080F78; // type:function size:0x11 __sinit_CMapArea_cpp = .text:0x8008108C; // type:function size:0x38 scope:global SplineIntersectTest__11CBallCameraCFR13CMaterialListR13CStateManager = .text:0x800810C4; // type:function size:0x788 scope:global CheckFailsafeFromMorphBallState__11CBallCameraCFR13CStateManager = .text:0x8008184C; // type:function size:0x6B0 scope:global -ApplyCameraHint__11CBallCameraFR13CStateManager = .text:0x80081EFC; // type:function size:0x8A0 scope:global +OverrideCameraInfo__11CBallCameraFR13CStateManager = .text:0x80081EFC; // type:function size:0x8A0 scope:global Accept__11CBallCameraFR8IVisitor = .text:0x8008279C; // type:function size:0x38 scope:global AcceptScriptMsg__11CBallCameraF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800827D4; // type:function size:0x3B4 scope:global ProcessInput__11CBallCameraFRC11CFinalInputR13CStateManager = .text:0x80082B88; // type:function size:0x190 scope:global @@ -1959,7 +1959,7 @@ UpdateCameraPositions__11CBallCameraFfRC12CTransform4fRC12CTransform4f = .text:0 ConstrainYawAngle__11CBallCameraCFRC7CPlayerfffR13CStateManager = .text:0x800893F0; // type:function size:0x358 scope:global ConstrainElevationAndDistance__11CBallCameraFRfRffR13CStateManager = .text:0x80089748; // type:function size:0x230 scope:global UpdateObjectTooCloseId__11CBallCameraFR13CStateManager = .text:0x80089978; // type:function size:0x284 scope:global -UpdateLookDirection__11CBallCameraFRC9CVector3fR13CStateManager = .text:0x80089BFC; // type:function size:0x134 scope:global +FindDesiredTransform__11CBallCameraF9CVector3fR13CStateManager = .text:0x80089BFC; // type:function size:0x134 scope:global FindDesiredPosition__11CBallCameraFff9CVector3fR13CStateManagerb = .text:0x80089D30; // type:function size:0xD48 scope:global DetectCollision__11CBallCameraFRC9CVector3fRC9CVector3ffRfR13CStateManager = .text:0x8008AA78; // type:function size:0x71C scope:global AvoidGeometry__11CBallCameraFRC12CTransform4fRCQ24rstl32reserved_vector<9TUniqueId,1024>fR13CStateManager = .text:0x8008B194; // type:function size:0x134 scope:global @@ -1979,7 +1979,7 @@ __ct__15CCameraColliderFRC15CCameraCollider = .text:0x8008C748; // type:function __dt__15CCameraColliderFv = .text:0x8008C7F8; // type:function size:0x48 scope:global ResetToTweaks__11CBallCameraFR13CStateManager = .text:0x8008C840; // type:function size:0x234 scope:global TeleportCamera__11CBallCameraFRC12CTransform4fR13CStateManager = .text:0x8008CA74; // type:function size:0x98 scope:global -ResetPosition__11CBallCameraFR13CStateManager = .text:0x8008CB0C; // type:function size:0x8C scope:global +TeleportLookAtStuff__11CBallCameraFR13CStateManager = .text:0x8008CB0C; // type:function size:0x8C scope:global TeleportCamera__11CBallCameraFRC9CVector3fR13CStateManager = .text:0x8008CB98; // type:function size:0x100 scope:global TeleportColliders__11CBallCameraFRQ24rstl52vector<15CCameraCollider,Q24rstl17rmemory_allocator>9CVector3f = .text:0x8008CC98; // type:function size:0xD4 scope:global __dt__11CBallCameraFv = .text:0x8008CD6C; // type:function size:0x1BC scope:global @@ -5733,17 +5733,17 @@ __dt__11CScriptDockFv = .text:0x800C4448; // type:function size:0x60 scope:globa __ct__11CScriptDockF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC9CVector3fRC9CVector3fi7TAreaIdbib = .text:0x800C44A8; // type:function size:0x260 scope:global Accept__17CScriptCameraHintFR8IVisitor = .text:0x800C4708; // type:function size:0x38 scope:global AcceptScriptMsg__17CScriptCameraHintF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800C4740; // type:function size:0x2E0 scope:global -InitializeInArea__17CScriptCameraHintFR13CStateManager = .text:0x800C4A20; // type:function size:0x1F4 scope:global -fn_800C4B98 = .text:0x800C4C14; // type:function size:0x4C scope:global -fn_800C4BE4 = .text:0x800C4C60; // type:function size:0xB4 scope:global -RemoveHelper__17CScriptCameraHintF9TUniqueId = .text:0x800C4D14; // type:function size:0xD0 scope:global -AddHelper__17CScriptCameraHintF9TUniqueId = .text:0x800C4DE4; // type:function size:0x58 scope:global -ClearIdList__17CScriptCameraHintFv = .text:0x800C4E3C; // type:function size:0x58 scope:global -GetFirstHelper__17CScriptCameraHintCFv = .text:0x800C4E94; // type:function size:0x24 scope:global +CheckLegacyConnections__17CScriptCameraHintFR13CStateManager = .text:0x800C4A20; // type:function size:0x1F4 scope:global +erase__Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>FQ24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x800C4C14; // type:function size:0x4C scope:global +erase__Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>FQ24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>Q24rstl116pointer_iterator<11SConnection,Q24rstl48vector<11SConnection,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator> = .text:0x800C4C60; // type:function size:0xB4 scope:global +RemoveSender__17CScriptCameraHintF9TUniqueIdR13CStateManager = .text:0x800C4D14; // type:function size:0xD0 scope:global +AddSender__17CScriptCameraHintF9TUniqueId = .text:0x800C4DE4; // type:function size:0x58 scope:global +ClearSenders__17CScriptCameraHintFv = .text:0x800C4E3C; // type:function size:0x58 scope:global +GetSenderId__17CScriptCameraHintCFv = .text:0x800C4E94; // type:function size:0x24 scope:global __dt__17CScriptCameraHintFv = .text:0x800C4EB8; // type:function size:0xD4 scope:global -__ct__17CScriptCameraHintF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiQ211CBallCamera20EBallCameraBehaviourifffRC13CCameraSpringRC13CCameraSpringfRC9CVector3fRC9CVector3ff = .text:0x800C4F8C; // type:function size:0x27C scope:global -__dt__11CCameraHintFv = .text:0x800C5208; // type:function size:0x48 scope:global -__ct__11CCameraHintFiQ211CBallCamera20EBallCameraBehaviourfffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C5250; // type:function size:0xA8 scope:global +__ct__17CScriptCameraHintF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbiQ211CBallCamera20EBallCameraBehaviourifffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C4F8C; // type:function size:0x27C scope:global +__dt__19CCameraOverrideInfoFv = .text:0x800C5208; // type:function size:0x48 scope:global +__ct__19CCameraOverrideInfoFUiQ211CBallCamera20EBallCameraBehaviourfffRC9CVector3fRC9CVector3fRC9CVector3fffffffffff = .text:0x800C5250; // type:function size:0xA8 scope:global LoadEnergyBall__12ScriptLoaderFR13CStateManagerR12CInputStreamiRC11CEntityInfo = .text:0x800C52F8; // type:function size:0x3A0 scope:global __ct__16CActorParametersFRC16CActorParameters = .text:0x800C5698; // type:function size:0xE0 scope:global LoadShadowProjector__12ScriptLoaderFR13CStateManagerR12CInputStreamiRC11CEntityInfo = .text:0x800C5778; // type:function size:0x15C scope:global @@ -18259,8 +18259,8 @@ lbl_803DF4E8 = .data:0x803DF6C8; // type:object size:0x10 scope:global __vt__13CScriptPickup = .data:0x803DF6D8; // type:object size:0x84 scope:global lbl_803DF580 = .data:0x803DF760; // type:object size:0x84 scope:global lbl_803DF604 = .data:0x803DF7E4; // type:object size:0x80 scope:global -lbl_803DF688 = .data:0x803DF868; // type:object size:0x6C scope:global -lbl_803DF6F4 = .data:0x803DF8D4; // type:object size:0xC scope:global +__vt__17CScriptCameraHint = .data:0x803DF868; // type:object size:0x6C scope:global +__vt__19CCameraOverrideInfo = .data:0x803DF8D4; // type:object size:0xC scope:global __vt__41TObjOwnerDerivedFromIObj<13CStateMachine> = .data:0x803DF8E0; // type:object size:0x10 scope:global __vt__11CPlasmaBeam = .data:0x803DF8F0; // type:object size:0x48 scope:global __vt__10CPowerBeam = .data:0x803DF938; // type:object size:0x48 scope:global diff --git a/include/Kyoto/Audio/CSfxManager.hpp b/include/Kyoto/Audio/CSfxManager.hpp index dcd17af0..faf02d2c 100644 --- a/include/Kyoto/Audio/CSfxManager.hpp +++ b/include/Kyoto/Audio/CSfxManager.hpp @@ -44,7 +44,7 @@ public: public: CBaseSfxWrapper(const bool looped, const short prio, const CSfxHandle handle, const bool useAcoustics, const int area); - virtual ~CBaseSfxWrapper(){}; + virtual ~CBaseSfxWrapper() {}; virtual void SetActive(bool v); virtual void SetPlaying(bool v); virtual void SetRank(short v); @@ -188,12 +188,13 @@ public: static const ushort kInternalInvalidSfxId; // 0xFFFF static const int kAllAreas; // 0xFFFFFFFF static CSfxHandle AddEmitter(const SND_FXID id, const CVector3f& pos, const CVector3f& dir, - const bool useAcoustics, const bool looped, + const bool useAcoustics = false, const bool looped = false, const short prio = kMedPriority, const int areaId = kAllAreas); static CSfxHandle AddEmitter(const SND_FXID id, const CVector3f& pos, const CVector3f& dir, - const uchar vol, const bool useAcoustics, const bool looped, - const short prio = kMedPriority, const int areaId = kAllAreas); - static CSfxHandle AddEmitter(CAudioSys::C3DEmitterParmData& parmData, bool useAcoustics, + const uchar vol, const bool useAcoustics = false, + const bool looped = false, const short prio = kMedPriority, + const int areaId = kAllAreas); + static CSfxHandle AddEmitter(CAudioSys::C3DEmitterParmData& parmData, bool useAcoustics = false, const short prio = kMedPriority, const bool looped = false, const int areaId = kAllAreas); @@ -209,9 +210,9 @@ public: static void SetDuration(CSfxHandle handle, float duration); static ushort GetReverbAmount(); - static CSfxHandle SfxStart(ushort id, short vol, short pan, bool useAcoustics, - short prio = kMaxPriority, bool looped = false, - int areaId = kAllAreas); + static CSfxHandle SfxStart(const ushort id, const short vol, const short pan, + const bool useAcoustics = false, const short prio = kMaxPriority, + const bool looped = false, const int areaId = kAllAreas); static void SfxStop(CSfxHandle handle); static void SfxVolume(CSfxHandle handle, uchar volume); static void SfxSpan(CSfxHandle, uchar); diff --git a/include/MetroidPrime/Cameras/CBallCamera.hpp b/include/MetroidPrime/Cameras/CBallCamera.hpp index 16473482..775b06d8 100644 --- a/include/MetroidPrime/Cameras/CBallCamera.hpp +++ b/include/MetroidPrime/Cameras/CBallCamera.hpp @@ -117,7 +117,7 @@ public: void TeleportColliders(rstl::vector< CCameraCollider >& colliderList, CVector3f pos); void TeleportCamera(const CVector3f& pos, CStateManager& mgr); void TeleportCamera(const CTransform4f& xf, CStateManager& mgr); - void ResetPosition(CStateManager& mgr); + void TeleportLookAtStuff(CStateManager& mgr); void ResetToTweaks(CStateManager& mgr); CVector3f FindDesiredPosition(float distance, float elevation, CVector3f dir, CStateManager& mgr, bool fullTest); @@ -138,6 +138,7 @@ public: CStateManager& mgr); bool DetectCollision(const CVector3f& from, const CVector3f& to, float radius, float& d, CStateManager& mgr); + CTransform4f FindDesiredTransform(CVector3f dir, CStateManager& mgr); const CVector3f& GetLookAtPosition() const { return x1d8_lookPos; } float GetDistance() const { return x190_curMinDistance; } @@ -161,7 +162,11 @@ public: void SetWorldOffset(CVector3f vec); // TODO EBallCameraState GetState() const { return x400_state; } void SetState(EBallCameraState state); - void ApplyCameraHint(CStateManager& mgr); + void OverrideCameraInfo(CStateManager& mgr); + void UpdateLookAtPosition(float dt, CStateManager& mgr); + + void SetClampVelTimer(float v) { x470_clampVelTimer = v; } + void SetClampVelRange(float v) { x474_clampVelRange = v; } private: struct SFailsafeState { diff --git a/include/MetroidPrime/Cameras/CCameraHint.hpp b/include/MetroidPrime/Cameras/CCameraHint.hpp deleted file mode 100644 index d6887565..00000000 --- a/include/MetroidPrime/Cameras/CCameraHint.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _CCAMERAHINT -#define _CCAMERAHINT - -#include "Kyoto/Math/CVector3f.hpp" -#include "MetroidPrime/Cameras/CBallCamera.hpp" -#include "types.h" - -class CCameraHint { -public: - CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, - float maxDist, float backwardsDist, const CVector3f& lookAtOffset, - const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov, - float attitudeRange, float azimuthRange, float anglePerSecond, float clampVelRange, - float clampRotRange, float elevation, float interpolateTime, float clampVelTime, - float controlInterpDur); - virtual ~CCameraHint(); - -private: - uint mOverrideFlags; - CBallCamera::EBallCameraBehaviour mBehaviour; - float mMinDist; - float mMaxDist; - float mBackwardsDist; - CVector3f mLookAtOffset; - CVector3f mChaseLookAtOffset; - CVector3f mBallToCam; - float mFov; - float mAttitudeRange; - float mAzimuthRange; - float mAnglePerSecond; - float mClampVelRange; - float mClampRotRange; - float mElevation; - float mInterpolateTime; - float mClampVelTime; - float mControlInterpDur; -}; - -#endif // _CCAMERAHINT diff --git a/include/MetroidPrime/Cameras/CCameraManager.hpp b/include/MetroidPrime/Cameras/CCameraManager.hpp index 0ba51e45..8004d705 100644 --- a/include/MetroidPrime/Cameras/CCameraManager.hpp +++ b/include/MetroidPrime/Cameras/CCameraManager.hpp @@ -40,25 +40,25 @@ class CCameraManager { public: CCameraManager(TUniqueId curCamera = kInvalidUniqueId); - void CreateStandardCameras(CStateManager& mgr); - void ThinkCameras(float dt, CStateManager& mgr); + void CreateCameras(CStateManager& mgr); + void UpdateCameras(float dt, CStateManager& mgr); void ResetCameras(CStateManager& mgr); - void RenderCameras(const CStateManager& mgr); + void Render(const CStateManager& mgr); TUniqueId GetCurrentCameraId() const; void SetCurrentCameraId(TUniqueId camId); CGameCamera& CurrentCamera(CStateManager& mgr); const CGameCamera& GetCurrentCamera(const CStateManager& mgr) const; - const CGameCamera& GetLastCineCamera(CStateManager& mgr) const; - TUniqueId GetLastCineCameraId() const; + const CGameCamera& GetCurrentCinematicCamera(CStateManager& mgr) const; + TUniqueId GetCurrentCinematicCameraId() const; void Update(float dt, CStateManager& mgr); - void UpdateSfxListener(CStateManager& mgr); - void UpdateRumble(float dt, CStateManager& mgr); - void UpdateFog(float dt, CStateManager& mgr); + void UpdateAudioListener(CStateManager& mgr); + void UpdateScreenShake(float dt, CStateManager& mgr); + void UpdateFilters(float dt, CStateManager& mgr); void UpdateCameraHints(float dt, CStateManager& mgr); - float CalculateFogDensity(CStateManager& mgr, const CScriptWater* water); - void SetFogDensity(float fogDensityTarget, float fogDensitySpeed); + float GetWaterFarDistance(CStateManager& mgr, const CScriptWater* water); + void SetWaterFogScale(float fogDensityTarget, float fogDensitySpeed); CFirstPersonCamera* FirstPersonCamera() const /* map */ { return x7c_fpCamera; } const CFirstPersonCamera* GetFirstPersonCamera() const { return x7c_fpCamera; } @@ -68,7 +68,7 @@ public: void AddCinemaCamera(TUniqueId uid, CStateManager& mgr); void RemoveCinemaCamera(TUniqueId uid, CStateManager& mgr); void EnterCinematic(CStateManager& mgr); - void SkipCinematic(CStateManager& mgr); + void StopCinematics(CStateManager& mgr); int AddCameraShaker(const CCameraShakeData& data, bool sfx); void RemoveCameraShaker(int id); @@ -77,11 +77,15 @@ public: bool IsInFirstPersonCamera() const; bool IsInterpolationCameraActive() const; bool ShouldBypassInterpolationCamera() const; - void InterpolateToBallCamera(const CTransform4f& xf, TUniqueId camId, const CVector3f& lookPos, + void SetupInterpolation(const CTransform4f& xf, TUniqueId camId, CVector3f lookPos, float maxTime, float positionSpeed, float rotationSpeed, bool sinusoidal, CStateManager& mgr); - void SkipBallCameraCinematic(CStateManager& mgr); - void ApplyCameraHint(const CScriptCameraHint& hint, CStateManager& mgr); + void CinematicCut(CStateManager& mgr); + void UseCameraHint(const CScriptCameraHint& hint, CStateManager& mgr); + void NoCameraHintsLeft(CStateManager& mgr); + void AddCameraHint(TUniqueId uid, CStateManager& mgr); + void DeleteCameraHint(TUniqueId uid, CStateManager& mgr); + void ReallyRemoveCameraHint(TUniqueId uid, CStateManager& mgr); // SetSpecialCameras__14CCameraManagerFR18CFirstPersonCameraR11CBallCamera void SetCurrentFov(float fov) { x3bc_curFov = fov; } @@ -89,17 +93,23 @@ public: int GetFluidCounter() const { return x74_fluidCounter; } TUniqueId GetFluidId() const { return x78_fluidId; } // GetInsideFluid__14CCameraManagerCFv + bool IsInsideFluid() const { return xa0_26_inWater; } // WasInsideFluid__14CCameraManagerCFv // SetWasInsideFluid__14CCameraManagerFb void SetInsideFluid(bool isInside, TUniqueId fluidId); void ProcessInput(const CFinalInput& input, CStateManager& mgr); - static float DefaultThirdPersonFov(); - static float DefaultFirstPersonFov(); - static float DefaultNearPlane(); - static float DefaultFarPlane(); - static float DefaultAspect(); + void SetPathCamera(TUniqueId id, CStateManager& mgr); + TUniqueId GetPathCameraId() const; + void SetSpindleCamera(TUniqueId id, CStateManager& mgr); + TUniqueId GetSpindleCameraId() const; + + static float GetDefaultThirdPersonVerticalFOV(); + static float GetDefaultFirstPersonVerticalFOV(); + static float GetDefaultFirstPersonNearClipDistance(); + static float GetDefaultFirstPersonFarClipDistance(); + static float GetDefaultAspectRatio(); private: TUniqueId x0_curCameraId; diff --git a/include/MetroidPrime/Cameras/CCameraOverrideInfo.hpp b/include/MetroidPrime/Cameras/CCameraOverrideInfo.hpp new file mode 100644 index 00000000..77fcdfd1 --- /dev/null +++ b/include/MetroidPrime/Cameras/CCameraOverrideInfo.hpp @@ -0,0 +1,64 @@ +#ifndef _CCAMERAOVERRIDEINFO +#define _CCAMERAOVERRIDEINFO + +#include "Kyoto/Math/CVector3f.hpp" +#include "MetroidPrime/Cameras/CBallCamera.hpp" +#include "types.h" + +class CCameraOverrideInfo { + friend class CScriptCameraHint; + +public: + CCameraOverrideInfo(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, + float maxDist, float backwardsDist, const CVector3f& lookAtOffset, + const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov, + float attitudeRange, float azimuthRange, float anglePerSecond, float clampVelRange, + float clampRotRange, float elevation, float interpolateTime, float clampVelTime, + float controlInterpDur); + virtual ~CCameraOverrideInfo() {} + + uint GetOverrideFlags() const { return mOverrideFlags; } + CBallCamera::EBallCameraBehaviour GetBehaviourType() const { return mBehaviour; } + float GetMinDist() const { return mMinDist; } + float GetMaxDist() const { return mMaxDist; } + float GetBackwardsDist() const { return mBackwardsDist; } + const CVector3f& GetLookAtOffset() const { return mLookAtOffset; } + const CVector3f& GetChaseLookAtOffset() const { return mChaseLookAtOffset; } + const CVector3f& GetBallToCam() const { return mBallToCam; } + float GetFov() const { return mFov; } + float GetAttitudeRange() const { return mAttitudeRange; } + float GetAzimuthRange() const { return mAzimuthRange; } + float GetAnglePerSecond() const { return mAnglePerSecond; } + float GetClampVelRange() const { return mClampVelRange; } + float GetClampRotRange() const { return mClampRotRange; } + float GetElevation() const { return mElevation; } + float GetInterpolateTime() const { return mInterpolateTime; } + float GetClampVelTime() const { return mClampVelTime; } + float GetControlInterpDur() const { return mControlInterpDur; } + + bool Flagx20() const { return (mOverrideFlags & 0x20) != 0; } + bool Flagx400() const { return (mOverrideFlags & 0x400) != 0; } + bool Flagx800() const { return (mOverrideFlags & 0x800) != 0; } + +private: + uint mOverrideFlags; + CBallCamera::EBallCameraBehaviour mBehaviour; + float mMinDist; + float mMaxDist; + float mBackwardsDist; + CVector3f mLookAtOffset; + CVector3f mChaseLookAtOffset; + CVector3f mBallToCam; + float mFov; + float mAttitudeRange; + float mAzimuthRange; + float mAnglePerSecond; + float mClampVelRange; + float mClampRotRange; + float mElevation; + float mInterpolateTime; + float mClampVelTime; + float mControlInterpDur; +}; + +#endif // _CCAMERAOVERRIDEINFO diff --git a/include/MetroidPrime/Cameras/CFirstPersonCamera.hpp b/include/MetroidPrime/Cameras/CFirstPersonCamera.hpp index de277bf0..ae93c953 100644 --- a/include/MetroidPrime/Cameras/CFirstPersonCamera.hpp +++ b/include/MetroidPrime/Cameras/CFirstPersonCamera.hpp @@ -26,7 +26,7 @@ public: // UpdateTransform__18CFirstPersonCameraFR13CStateManagerf // GetGunFollowTransform__18CFirstPersonCameraCFv // SetLockCamera__18CFirstPersonCameraFb - void SkipCinematic(); + void CancelCinematicOffset(); private: float x188_orbitCameraSpeed; diff --git a/include/MetroidPrime/Cameras/CGameCamera.hpp b/include/MetroidPrime/Cameras/CGameCamera.hpp index 4eed3fb4..a15cd1ce 100644 --- a/include/MetroidPrime/Cameras/CGameCamera.hpp +++ b/include/MetroidPrime/Cameras/CGameCamera.hpp @@ -36,7 +36,7 @@ public: float GetFov() const { return x15c_currentFov; } void SetFov(float fov) { x15c_currentFov = fov; } float GetNearClipDistance() const { return x160_znear; } - void SetFovInterpolation(float start, float fov, float time, float delayTime); + void InterpolateFOV(float start, float fov, float time, float delayTime); void UpdatePerspective(float dt); int GetControllerNumber() const { return x16c_controllerIdx; } bool DisablesInput() const { return x170_25_disablesInput; } diff --git a/include/MetroidPrime/Player/CPlayer.hpp b/include/MetroidPrime/Player/CPlayer.hpp index 5a39c970..3215510a 100644 --- a/include/MetroidPrime/Player/CPlayer.hpp +++ b/include/MetroidPrime/Player/CPlayer.hpp @@ -215,6 +215,7 @@ public: void DoSfxEffects(CSfxHandle sfx); void UnFreeze(CStateManager& mgr); void UpdateCinematicState(CStateManager& mgr); + bool IsMorphBallTransitioning() const; CPlayerGun* PlayerGun() { return x490_gun.get(); } const CPlayerGun* GetPlayerGun() const { return x490_gun.get(); } diff --git a/include/MetroidPrime/ScriptObjects/CScriptCameraHint.hpp b/include/MetroidPrime/ScriptObjects/CScriptCameraHint.hpp index 648228b9..ec8a44dd 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptCameraHint.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptCameraHint.hpp @@ -3,7 +3,7 @@ #include "MetroidPrime/CActor.hpp" #include "MetroidPrime/Cameras/CBallCamera.hpp" -#include "MetroidPrime/Cameras/CCameraHint.hpp" +#include "MetroidPrime/Cameras/CCameraOverrideInfo.hpp" #include "MetroidPrime/TGameTypes.hpp" #include "Kyoto/Math/CTransform4f.hpp" @@ -17,26 +17,40 @@ public: CScriptCameraHint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, bool active, int priority, CBallCamera::EBallCameraBehaviour behavior, int overrideFlags, float minDist, - float maxDist, float backwardsDist, const CCameraSpring&, const CCameraSpring&, - float, const CVector3f&, const CVector3f&, float); + float maxDist, float backwardsDist, const CVector3f& lookAtOffset, + const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov, + float attitudeRange, float azimuthRange, float anglePerSecond, + float clampVelRange, float clampRotRange, float elevation, + float interpolateTime, float clampVelTime, float controlInterpDur); // CEntity ~CScriptCameraHint() override; void Accept(IVisitor& visitor) override; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override; - // GetOverrideFlags__17CScriptCameraHintCFv - // GetBehaviourType__17CScriptCameraHintCFv - int GetPriority() const { return xe8_priority; } + TUniqueId GetSenderId() const; + void ClearSenders(); + void AddSender(TUniqueId uid); + void RemoveSender(TUniqueId uid, CStateManager& mgr); + void CheckLegacyConnections(CStateManager& mgr); + + const CCameraOverrideInfo& GetInfo() const { return mOverrideInfo; } // Not real? + uint GetOverrideFlags() const { return mOverrideInfo.mOverrideFlags; } + CBallCamera::EBallCameraBehaviour GetBehaviourType() const { return mOverrideInfo.mBehaviour; } + int GetPriority() const { return mPriority; } + TUniqueId GetDelegatedCameraId() const { return mDelegatedCameraId; } // OverrideCameraInfo__17CScriptCameraHintFP11CBallCamera + uint GetSenderCount() const { return mSenders.size(); } + bool GetInactive() const { return mInactive; } + private: - int xe8_priority; - CCameraHint xec_hint; - rstl::reserved_vector< TUniqueId, 8 > x150_helpers; - TUniqueId x164_delegatedCamera; - bool x166_inactive; - CTransform4f x168_origXf; + int mPriority; + CCameraOverrideInfo mOverrideInfo; + rstl::reserved_vector< TUniqueId, 8 > mSenders; + TUniqueId mDelegatedCameraId; + bool mInactive; + CTransform4f mOrigXf; }; CHECK_SIZEOF(CScriptCameraHint, 0x198) diff --git a/include/rstl/algorithm.hpp b/include/rstl/algorithm.hpp index ce3780f7..91104199 100644 --- a/include/rstl/algorithm.hpp +++ b/include/rstl/algorithm.hpp @@ -181,8 +181,7 @@ find_by_key(const T& container, template < typename T > typename T::const_iterator inline find_by_key( const T& container, const typename select1st< typename T::value_type >::value_type& key) { - return binary_find(container.begin(), container.end(), key, - default_pair_sorter_finder()); + return binary_find(container.begin(), container.end(), key, default_pair_sorter_finder< T >()); } template < typename T > @@ -192,8 +191,7 @@ find_by_key_nc(T& container, const typename select1st< typename T::value_type >: template < typename T > typename T::iterator inline find_by_key_nc( T& container, const typename select1st< typename T::value_type >::value_type& key) { - return binary_find(container.begin(), container.end(), key, - default_pair_sorter_finder()); + return binary_find(container.begin(), container.end(), key, default_pair_sorter_finder< T >()); } } // namespace rstl diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 8bf62b9f..33195040 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -19,6 +19,7 @@ public: // typedef const_pointer_iterator< T, reserved_vector< T, N >, void > const_iterator; typedef T* iterator; typedef const T* const_iterator; + typedef T value_type; inline iterator begin() { return iterator(data()); } inline const_iterator begin() const { return const_iterator(data()); } @@ -71,16 +72,15 @@ public: inline const T& back() const { return data()[x0_count - 1]; } inline T& operator[](int idx) { return data()[idx]; } inline const T& operator[](int idx) const { return data()[idx]; } - void erase(iterator it) { - if (it < begin()) { - return; - } - if (it < end()) { + iterator erase(iterator it) { + if (it >= begin() && it < end()) { for (iterator j = it; j < end() - 1; ++j) { *j = *(j + 1); } --x0_count; + return it; } + return end(); } void resize(int count, const T& item) { diff --git a/src/MetroidPrime/Cameras/CBallCamera.cpp b/src/MetroidPrime/Cameras/CBallCamera.cpp index 5e1d5c31..c3c3bea2 100644 --- a/src/MetroidPrime/Cameras/CBallCamera.cpp +++ b/src/MetroidPrime/Cameras/CBallCamera.cpp @@ -169,7 +169,7 @@ void CBallCamera::TeleportCamera(const CVector3f& pos, CStateManager& mgr) { } } -void CBallCamera::ResetPosition(CStateManager& mgr) { +void CBallCamera::TeleportLookAtStuff(CStateManager& mgr) { CVector3f pos = mgr.GetPlayer()->GetBallPosition(); x1d8_lookPos = pos; x1d8_lookPos.SetZ(x1d8_lookPos.GetZ() + x1b4_lookAtOffset.GetZ()); @@ -205,7 +205,7 @@ void CBallCamera::ResetToTweaks(CStateManager& mgr) { SetElevation(gpTweakBall->GetBallCameraElevation()); x1ac_attitudeRange = M_PIF / 2.f; x1b0_azimuthRange = M_PIF / 2.f; - SetFovInterpolation(GetFov(), CCameraManager::DefaultThirdPersonFov(), 1.f, 0.f); + InterpolateFOV(GetFov(), CCameraManager::GetDefaultThirdPersonVerticalFOV(), 1.f, 0.f); x1a8_targetAnglePerSecond = gpTweakBall->GetBallCameraAnglePerSecond(); x18d_29_noElevationInterp = false; x18d_30_directElevation = false; @@ -245,7 +245,7 @@ void CBallCamera::Reset(const CTransform4f& xf, CStateManager& mgr) { FindDesiredPosition(GetDistance(), GetElevation(), xf.GetForward(), mgr, false); if (const CPlayer* player = TCastToConstPtr< CPlayer >(mgr.GetObjectById(GetWatchedObject()))) { - ResetPosition(mgr); + TeleportLookAtStuff(mgr); x310_idealLookVec = x1b4_lookAtOffset; x31c_predictedLookPos = GetLookAtPosition(); CVector3f dist = GetLookAtPosition() - desiredPos; diff --git a/src/MetroidPrime/Cameras/CCameraHint.cpp b/src/MetroidPrime/Cameras/CCameraHint.cpp deleted file mode 100644 index 1a1aaeec..00000000 --- a/src/MetroidPrime/Cameras/CCameraHint.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "MetroidPrime/Cameras/CCameraHint.hpp" -#include "Kyoto/Alloc/CMemory.hpp" - -CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, - float minDist, float maxDist, float backwardsDist, - const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset, - const CVector3f& ballToCam, float fov, float attitudeRange, - float azimuthRange, float anglePerSecond, float clampVelRange, - float clampRotRange, float elevation, float interpolateTime, - float clampVelTime, float controlInterpDur) -: mOverrideFlags(overrideFlags) -, mBehaviour(behaviour) -, mMinDist(minDist) -, mMaxDist(maxDist) -, mBackwardsDist(backwardsDist) -, mLookAtOffset(lookAtOffset) -, mChaseLookAtOffset(chaseLookAtOffset) -, mBallToCam(ballToCam) -, mFov(fov) -, mAttitudeRange(attitudeRange) -, mAnglePerSecond(anglePerSecond) -, mClampVelRange(clampVelRange) -, mClampRotRange(clampRotRange) -, mElevation(elevation) -, mInterpolateTime(interpolateTime) -, mClampVelTime(clampVelTime) -, mControlInterpDur(controlInterpDur) {} - -CCameraHint::~CCameraHint() {} diff --git a/src/MetroidPrime/Cameras/CCameraManager.cpp b/src/MetroidPrime/Cameras/CCameraManager.cpp index 5eb3e547..584a52ac 100644 --- a/src/MetroidPrime/Cameras/CCameraManager.cpp +++ b/src/MetroidPrime/Cameras/CCameraManager.cpp @@ -1,18 +1,18 @@ #include "MetroidPrime/Cameras/CCameraManager.hpp" +#include "MetroidPrime/CExplosion.hpp" +#include "MetroidPrime/CFluidPlaneCPU.hpp" +#include "MetroidPrime/CRumbleManager.hpp" #include "MetroidPrime/Cameras/CBallCamera.hpp" -#include "MetroidPrime/ScriptObjects/CScriptCameraHint.hpp" #include "MetroidPrime/Cameras/CCinematicCamera.hpp" #include "MetroidPrime/Cameras/CFirstPersonCamera.hpp" #include "MetroidPrime/Cameras/CGameCamera.hpp" #include "MetroidPrime/Cameras/CInterpolationCamera.hpp" -#include "MetroidPrime/CExplosion.hpp" -#include "MetroidPrime/CFluidPlaneCPU.hpp" -#include "MetroidPrime/CRumbleManager.hpp" #include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/Player/CPlayerGun.hpp" -#include "MetroidPrime/ScriptObjects/CScriptWater.hpp" #include "MetroidPrime/SFX/Misc.h" +#include "MetroidPrime/ScriptObjects/CScriptCameraHint.hpp" +#include "MetroidPrime/ScriptObjects/CScriptWater.hpp" #include "MetroidPrime/Tweaks/CTweakGame.hpp" #include "MetroidPrime/Tweaks/CTweakPlayer.hpp" #include "MetroidPrime/Weapons/CWeapon.hpp" @@ -64,31 +64,33 @@ CCameraManager::CCameraManager(TUniqueId curCamera) sFirstPersonFOV = gpTweakGame->GetFirstPersonFOV(); } -float CCameraManager::DefaultThirdPersonFov() { return sThirdPersonFOV; } +float CCameraManager::GetDefaultThirdPersonVerticalFOV() { return sThirdPersonFOV; } -float CCameraManager::DefaultFirstPersonFov() { return sFirstPersonFOV; } +float CCameraManager::GetDefaultFirstPersonVerticalFOV() { return sFirstPersonFOV; } -float CCameraManager::DefaultNearPlane() { return sNearPlane; } +float CCameraManager::GetDefaultFirstPersonNearClipDistance() { return sNearPlane; } -float CCameraManager::DefaultFarPlane() { return sFarPlane; } +float CCameraManager::GetDefaultFirstPersonFarClipDistance() { return sFarPlane; } -float CCameraManager::DefaultAspect() { return sAspectRatio; } +float CCameraManager::GetDefaultAspectRatio() { return sAspectRatio; } -void CCameraManager::CreateStandardCameras(CStateManager& mgr) { +void CCameraManager::CreateCameras(CStateManager& mgr) { TUniqueId plId = mgr.GetPlayer()->GetUniqueId(); CTransform4f xf = CTransform4f::Identity(); xf.SetTranslation(mgr.GetPlayer()->GetEyePosition()); TUniqueId fpId = mgr.AllocateUniqueId(); - x7c_fpCamera = rs_new CFirstPersonCamera(fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), - DefaultFirstPersonFov(), DefaultNearPlane(), - DefaultFarPlane(), DefaultAspect()); + x7c_fpCamera = rs_new CFirstPersonCamera( + fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), GetDefaultFirstPersonVerticalFOV(), + GetDefaultFirstPersonNearClipDistance(), GetDefaultFirstPersonFarClipDistance(), + GetDefaultAspectRatio()); mgr.AddObject(x7c_fpCamera); mgr.Player()->SetCameraState(CPlayer::kCS_FirstPerson, mgr); SetCurrentCameraId(fpId); TUniqueId ballId = mgr.AllocateUniqueId(); - x80_ballCamera = rs_new CBallCamera(ballId, plId, xf, DefaultThirdPersonFov(), DefaultNearPlane(), - DefaultFarPlane(), DefaultAspect()); + x80_ballCamera = rs_new CBallCamera( + ballId, plId, xf, GetDefaultThirdPersonVerticalFOV(), GetDefaultFirstPersonNearClipDistance(), + GetDefaultFirstPersonFarClipDistance(), GetDefaultAspectRatio()); mgr.AddObject(x80_ballCamera); TUniqueId interpId = mgr.AllocateUniqueId(); @@ -96,7 +98,7 @@ void CCameraManager::CreateStandardCameras(CStateManager& mgr) { mgr.AddObject(x88_interpCamera); } -void CCameraManager::ThinkCameras(float dt, CStateManager& mgr) { +void CCameraManager::UpdateCameras(float dt, CStateManager& mgr) { CObjectList& objList = mgr.ObjectListById(kOL_GameCamera); int idx = objList.GetFirstObjectIndex(); @@ -114,7 +116,7 @@ void CCameraManager::ThinkCameras(float dt, CStateManager& mgr) { } if (const CGameCamera* cam = - TCastToConstPtr< CGameCamera >(mgr.GetObjectById(GetLastCineCameraId()))) { + TCastToConstPtr< CGameCamera >(mgr.GetObjectById(GetCurrentCinematicCameraId()))) { x3bc_curFov = cam->GetFov(); } } @@ -136,7 +138,7 @@ void CCameraManager::ResetCameras(CStateManager& mgr) { } } -void CCameraManager::RenderCameras(const CStateManager& mgr) { +void CCameraManager::Render(const CStateManager& mgr) { const CObjectList& objList = mgr.GetObjectListById(kOL_GameCamera); int idx = objList.GetFirstObjectIndex(); @@ -154,7 +156,7 @@ TUniqueId CCameraManager::GetCurrentCameraId() const { return x4_cineCameras.back(); } -TUniqueId CCameraManager::GetLastCineCameraId() const { +TUniqueId CCameraManager::GetCurrentCinematicCameraId() const { if (x4_cineCameras.empty()) { return kInvalidUniqueId; } @@ -170,20 +172,20 @@ const CGameCamera& CCameraManager::GetCurrentCamera(const CStateManager& mgr) co return *static_cast< const CGameCamera* >(mgr.GetObjectById(GetCurrentCameraId())); } -const CGameCamera& CCameraManager::GetLastCineCamera(CStateManager& mgr) const { - return *static_cast< const CGameCamera* >(mgr.GetObjectById(GetLastCineCameraId())); +const CGameCamera& CCameraManager::GetCurrentCinematicCamera(CStateManager& mgr) const { + return *static_cast< const CGameCamera* >(mgr.GetObjectById(GetCurrentCinematicCameraId())); } void CCameraManager::SetCurrentCameraId(TUniqueId uid) { x0_curCameraId = uid; } -void CCameraManager::UpdateSfxListener(CStateManager& mgr) { +void CCameraManager::UpdateAudioListener(CStateManager& mgr) { CTransform4f xf = GetCurrentCameraTransform(mgr); CSfxManager::UpdateListener(xf.GetTranslation(), CVector3f::Zero(), xf.GetColumn(kDY), xf.GetColumn(kDZ), CAudioSys::kMaxVolume); } -void CCameraManager::UpdateRumble(float dt, CStateManager& mgr) { +void CCameraManager::UpdateScreenShake(float dt, CStateManager& mgr) { x30_shakeOffset = CVector3f::Zero(); rstl::list< CCameraShakeData >::iterator it = x14_shakers.begin(); @@ -213,7 +215,7 @@ void CCameraManager::UpdateRumble(float dt, CStateManager& mgr) { } } -void CCameraManager::UpdateFog(float dt, CStateManager& mgr) { +void CCameraManager::UpdateFilters(float dt, CStateManager& mgr) { if (x98_fogDensitySpeed != 0.f) { x94_fogDensityFactor += dt * x98_fogDensitySpeed; if ((x98_fogDensitySpeed > 0.f) ? x94_fogDensityFactor > x9c_fogDensityFactorTarget @@ -229,7 +231,7 @@ void CCameraManager::UpdateFog(float dt, CStateManager& mgr) { const CGameCamera& camera = GetCurrentCamera(mgr); if (water) { const float near = camera.GetNearClipDistance(); - const float far = CalculateFogDensity(mgr, water); + const float far = GetWaterFarDistance(mgr, water); const CColor& color = water->GetUnderwaterFogColor(); x3c_fog.SetFogExplicit(kRFM_PerspExp, color, CVector2f(near, far)); if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::kPV_Thermal) { @@ -240,7 +242,7 @@ void CCameraManager::UpdateFog(float dt, CStateManager& mgr) { } } xa0_26_inWater = true; - } else if (xa0_26_inWater) { + } else if (IsInsideFluid()) { mgr.CameraManager()->x3c_fog.DisableFog(); pass.DisableFilter(0.f); xa0_26_inWater = false; @@ -249,19 +251,19 @@ void CCameraManager::UpdateFog(float dt, CStateManager& mgr) { x3c_fog.Update(dt); } -float CCameraManager::CalculateFogDensity(CStateManager& mgr, const CScriptWater* water) { +float CCameraManager::GetWaterFarDistance(CStateManager& mgr, const CScriptWater* water) { float density = 1.f - water->GetFluidPlane().GetAlpha(); if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::kIT_GravitySuit)) { - density = density * gpTweakGame->GetGravityWaterFogDistanceRange() + - gpTweakGame->GetGravityWaterFogDistanceBase(); + density = gpTweakGame->x5c_gravityWaterFogDistanceRange * density + + gpTweakGame->x58_gravityWaterFogDistanceBase; } else { density = - density * gpTweakGame->GetWaterFogDistanceRange() + gpTweakGame->GetWaterFogDistanceBase(); + gpTweakGame->x54_waterFogDistanceRange * density + gpTweakGame->x50_waterFogDistanceBase; } return density * x94_fogDensityFactor; } -void CCameraManager::SetFogDensity(float fogDensityTarget, float fogDensitySpeed) { +void CCameraManager::SetWaterFogScale(float fogDensityTarget, float fogDensitySpeed) { x9c_fogDensityFactorTarget = fogDensityTarget; if (x9c_fogDensityFactorTarget < x94_fogDensityFactor) { x98_fogDensitySpeed = -fogDensitySpeed; @@ -272,10 +274,10 @@ void CCameraManager::SetFogDensity(float fogDensityTarget, float fogDensitySpeed void CCameraManager::Update(float dt, CStateManager& mgr) { UpdateCameraHints(dt, mgr); - ThinkCameras(dt, mgr); - UpdateSfxListener(mgr); - UpdateRumble(dt, mgr); - UpdateFog(dt, mgr); + UpdateCameras(dt, mgr); + UpdateAudioListener(mgr); + UpdateScreenShake(dt, mgr); + UpdateFilters(dt, mgr); } void CCameraManager::SetInsideFluid(bool isInside, TUniqueId fluidId) { @@ -318,7 +320,7 @@ void CCameraManager::AddCinemaCamera(TUniqueId uid, CStateManager& mgr) { delayTime = 0.f; time = duration; } - cam->SetFovInterpolation(cam->GetFov(), sFirstPersonFOV, time, delayTime); + cam->InterpolateFOV(cam->GetFov(), sFirstPersonFOV, time, delayTime); } } } @@ -356,7 +358,7 @@ void CCameraManager::EnterCinematic(CStateManager& mgr) { } } -void CCameraManager::SkipCinematic(CStateManager& mgr) { +void CCameraManager::StopCinematics(CStateManager& mgr) { CCinematicCamera* ent = static_cast< CCinematicCamera* >(mgr.ObjectById(GetCurrentCameraId())); while (ent) { ent->SetActive(false); @@ -364,10 +366,9 @@ void CCameraManager::SkipCinematic(CStateManager& mgr) { ent = TCastToPtr< CCinematicCamera >(&CurrentCamera(mgr)); } mgr.Player()->UpdateCinematicState(mgr); - x7c_fpCamera->SkipCinematic(); + x7c_fpCamera->CancelCinematicOffset(); } -// TODO: nonmatching int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) { CCameraShakeData shakeData = data; shakeData.SetId(++x2c_lastShakeId); @@ -388,11 +389,9 @@ int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) { CSfxHandle sfxHandle; if (data.GetFlags() & 0x1) { CVector3f pos = data.GetSfxPos(); - sfxHandle = - CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, pos, CVector3f::Zero(), vol, false, false); + sfxHandle = CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, pos, CVector3f::Zero(), vol); } else { - sfxHandle = - CSfxManager::SfxStart(SFXamb_x_rumble_lp_00, vol, 64, false, CSfxManager::kMedPriority); + sfxHandle = CSfxManager::SfxStart(SFXamb_x_rumble_lp_00, vol, 64); } CSfxManager::SetDuration(sfxHandle, duration); } @@ -439,10 +438,9 @@ void CCameraManager::SetPlayerCamera(CStateManager& mgr, TUniqueId uid) { } } -void CCameraManager::InterpolateToBallCamera(const CTransform4f& xf, TUniqueId camId, - const CVector3f& lookPos, float maxTime, - float positionSpeed, float rotationSpeed, - bool sinusoidal, CStateManager& mgr) { +void CCameraManager::SetupInterpolation(const CTransform4f& xf, TUniqueId camId, CVector3f lookPos, + float maxTime, float positionSpeed, float rotationSpeed, + bool sinusoidal, CStateManager& mgr) { if (IsInFirstPersonCamera()) { return; } @@ -453,26 +451,320 @@ void CCameraManager::InterpolateToBallCamera(const CTransform4f& xf, TUniqueId c } } -void CCameraManager::SkipBallCameraCinematic(CStateManager& mgr) { +void CCameraManager::CinematicCut(CStateManager& mgr) { if (IsInCinematicCamera()) { - x80_ballCamera->TeleportCamera(GetLastCineCamera(mgr).GetTransform(), mgr); - x80_ballCamera->SetFovInterpolation(GetLastCineCamera(mgr).GetFov(), x80_ballCamera->GetFov(), - 1.f, 0.f); - SkipCinematic(mgr); + x80_ballCamera->TeleportCamera(GetCurrentCinematicCamera(mgr).GetTransform(), mgr); + x80_ballCamera->InterpolateFOV(GetCurrentCinematicCamera(mgr).GetFov(), + x80_ballCamera->GetFov(), 1.f, 0.f); + StopCinematics(mgr); SetCurrentCameraId(x80_ballCamera->GetUniqueId()); } } -void CCameraManager::ApplyCameraHint(const CScriptCameraHint& hint, CStateManager& mgr) { +// TODO: nonmatching +void CCameraManager::UseCameraHint(const CScriptCameraHint& hint, CStateManager& mgr) { if (x80_ballCamera->GetState() == CBallCamera::kBCS_ToBall) { x80_ballCamera->SetState(CBallCamera::kBCS_Default); mgr.Player()->SetCameraState(CPlayer::kCS_Ball, mgr); } - CScriptCameraHint* oldHint = TCastToPtr(mgr.ObjectById(xa6_camHintId)); + CScriptCameraHint* oldHint = TCastToPtr< CScriptCameraHint >(mgr.ObjectById(xa6_camHintId)); xa6_camHintId = hint.GetUniqueId(); xa8_hintPriority = hint.GetPriority(); CTransform4f camXf = GetCurrentCameraTransform(mgr); - x80_ballCamera->ApplyCameraHint(mgr); + x80_ballCamera->OverrideCameraInfo(mgr); + + if (hint.GetOverrideFlags() & 0x20) { + x80_ballCamera->TeleportLookAtStuff(mgr); + } + + switch (hint.GetBehaviourType()) { + case CBallCamera::kBCB_PathCameraDesiredPos: + case CBallCamera::kBCB_PathCamera: + SetPathCamera(hint.GetDelegatedCameraId(), mgr); + break; + case CBallCamera::kBCB_SpindleCamera: + SetSpindleCamera(hint.GetDelegatedCameraId(), mgr); + break; + default: + SetPathCamera(kInvalidUniqueId, mgr); + SetSpindleCamera(kInvalidUniqueId, mgr); + break; + } + + if (hint.GetOverrideFlags() & 0x2000) { + CinematicCut(mgr); + } + + x80_ballCamera->UpdateLookAtPosition(0.f, mgr); + + if ((hint.GetOverrideFlags() & 0x20) == 0 && + (hint.GetBehaviourType() != CBallCamera::kBCB_Default || + (oldHint && (!oldHint || oldHint->GetBehaviourType() != CBallCamera::kBCB_Default)))) { + SetupInterpolation(camXf, x80_ballCamera->GetUniqueId(), x80_ballCamera->GetLookAtPosition(), + hint.GetInfo().GetInterpolateTime(), hint.GetInfo().GetClampVelRange(), + hint.GetInfo().GetClampRotRange(), hint.GetInfo().Flagx400(), mgr); + } +} + +void CCameraManager::NoCameraHintsLeft(CStateManager& mgr) { + CScriptCameraHint* hint = TCastToPtr< CScriptCameraHint >(mgr.ObjectById(xa6_camHintId)); + CTransform4f ballCamXf = x80_ballCamera->GetTransform(); + + xa6_camHintId = kInvalidUniqueId; + xa8_hintPriority = 1000; + + if (!hint) { + return; + } + + CVector3f camToPlayerFlat = mgr.GetPlayer()->GetTranslation() - ballCamXf.GetTranslation(); + camToPlayerFlat.SetZ(0.f); + if (camToPlayerFlat.CanBeNormalized()) { + camToPlayerFlat.Normalize(); + } else { + camToPlayerFlat = mgr.GetPlayer()->GetMovementDirection(); + } + + x80_ballCamera->ResetToTweaks(mgr); + x80_ballCamera->UpdateLookAtPosition(0.f, mgr); + if (!mgr.GetPlayer()->IsMorphBallTransitioning() && + hint->GetInfo().GetBehaviourType() != CBallCamera::kBCB_Default) { + if ((hint->GetInfo().GetOverrideFlags() & 0x1000) != 0) { + x80_ballCamera->SetClampVelRange(hint->GetInfo().GetClampVelRange()); + x80_ballCamera->SetClampVelTimer(hint->GetInfo().GetClampVelTime()); + } else { + x80_ballCamera->TeleportCamera(x80_ballCamera->FindDesiredTransform(camToPlayerFlat, mgr), + mgr); + SetupInterpolation(ballCamXf, x80_ballCamera->GetUniqueId(), + x80_ballCamera->GetLookAtPosition(), hint->GetInfo().GetClampVelTime(), + hint->GetInfo().GetClampVelRange(), hint->GetInfo().GetClampRotRange(), + hint->GetInfo().Flagx800(), mgr); + } + } +} + +// TODO: nonmatching +void CCameraManager::UpdateCameraHints(float dt, CStateManager& mgr) { + bool invalidHintRemoved = false; + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin(); + it != xac_cameraHints.end();) { + if (!TCastToConstPtr< CScriptCameraHint >(mgr.ObjectById(it->second))) { + it = xac_cameraHints.erase(it); + invalidHintRemoved = true; + } else { + ++it; + } + } + + bool inactiveHintRemoved = false; + if (!x2b0_inactiveCameraHints.empty()) { + for (rstl::reserved_vector< TUniqueId, 64 >::iterator id = x2b0_inactiveCameraHints.begin(); + id != x2b0_inactiveCameraHints.end(); ++id) { + TUniqueId uid = *id; + if (const CScriptCameraHint* hint = + TCastToConstPtr< CScriptCameraHint >(mgr.GetObjectById(uid))) { + if (hint->GetSenderCount() == 0 || hint->GetInactive()) { + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin(); + it != xac_cameraHints.end(); ++it) { + if (it->second == uid) { + xac_cameraHints.erase(it); + if (uid == xa6_camHintId) { + inactiveHintRemoved = true; + SetPathCamera(kInvalidUniqueId, mgr); + SetSpindleCamera(kInvalidUniqueId, mgr); + } + break; + } + } + } + } + } + x2b0_inactiveCameraHints.clear(); + } + + bool activeHintAdded = false; + if (!x334_activeCameraHints.empty()) { + for (rstl::reserved_vector< TUniqueId, 64 >::iterator id = x334_activeCameraHints.begin(); + id != x334_activeCameraHints.end(); ++id) { + TUniqueId uid = *id; + if (const CScriptCameraHint* hint = + TCastToConstPtr< CScriptCameraHint >(mgr.GetObjectById(uid))) { + bool activeHintPresent = false; + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin(); + it != xac_cameraHints.end(); ++it) { + if (it->second == uid) { + activeHintPresent = true; + break; + } + } + + if (!activeHintPresent) { + xac_cameraHints.push_back(rstl::pair< int, TUniqueId >(hint->GetPriority(), uid)); + activeHintAdded = true; + } + } + } + x334_activeCameraHints.clear(); + } + + if (inactiveHintRemoved || activeHintAdded || invalidHintRemoved) { + rstl::less< int > less; + rstl::pair_sorter_finder< rstl::pair< int, TUniqueId >, rstl::less< int > > sorter(less); + rstl::sort(xac_cameraHints.begin(), xac_cameraHints.end(), sorter); + CTransform4f ballCamXf = x80_ballCamera->GetTransform(); + if ((inactiveHintRemoved || invalidHintRemoved) && xac_cameraHints.empty()) { + NoCameraHintsLeft(mgr); + return; + } + CScriptCameraHint* bestHint = nullptr; + bool foundHint = false; + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin(); + it != xac_cameraHints.end(); ++it) { + bestHint = TCastToPtr< CScriptCameraHint >(mgr.ObjectById(it->second)); + if (bestHint) { + foundHint = true; + break; + } + } + if (!foundHint) { + NoCameraHintsLeft(mgr); + } + + bool changeHint = false; + if (bestHint && foundHint) { + if ((bestHint->GetInfo().GetOverrideFlags() & 0x80) != 0 && xac_cameraHints.size() > 1) { + CVector3f ballPos = mgr.GetPlayer()->GetBallPosition(); + if ((bestHint->GetInfo().GetOverrideFlags() & 0x100) != 0) { + CVector3f camToBall = ballPos - ballCamXf.GetTranslation(); + if (camToBall.CanBeNormalized()) { + camToBall.Normalize(); + } else { + camToBall = ballCamXf.GetColumn(kDY); + } + + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin() + 1; + it != xac_cameraHints.end(); ++it) { + if (CScriptCameraHint* hint = + TCastToPtr< CScriptCameraHint >(mgr.ObjectById(it->second))) { + if ((hint->GetInfo().GetOverrideFlags() & 0x80) != 0 && + hint->GetPriority() == bestHint->GetPriority() && + hint->GetCurrentAreaId() == bestHint->GetCurrentAreaId()) { + CVector3f hintToBall = ballPos - bestHint->GetTranslation(); + if (hintToBall.CanBeNormalized()) { + hintToBall.Normalize(); + } else { + hintToBall = bestHint->GetTransform().GetColumn(kDY); + } + + float camHintDot = CMath::Limit(CVector3f::Dot(camToBall, hintToBall), 1.f); + + CVector3f thisHintToBall = ballPos - hint->GetTranslation(); + if (thisHintToBall.CanBeNormalized()) { + thisHintToBall.Normalize(); + } else { + thisHintToBall = hint->GetTransform().GetColumn(kDY); + } + + float camThisHintDot = CMath::Limit(CVector3f::Dot(camToBall, thisHintToBall), 1.f); + + if (camThisHintDot > camHintDot) { + bestHint = hint; + } + } else { + break; + } + } else { + break; + } + } + } else if (const CActor* act = + TCastToConstPtr< CActor >(mgr.GetObjectById(bestHint->GetSenderId()))) { + CVector3f actorPos = act->GetTranslation(); + CVector3f ballPos = mgr.GetPlayer()->GetBallPosition(); + CVector3f ballToHelper = actorPos - ballPos; + if (ballToHelper.CanBeNormalized()) { + ballToHelper.Normalize(); + } else { + ballToHelper = bestHint->GetTransform().GetColumn(kDY); + } + + for (rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 >::iterator it = + xac_cameraHints.begin() + 1; + it != xac_cameraHints.end(); ++it) { + if (CScriptCameraHint* hint = + TCastToPtr< CScriptCameraHint >(mgr.ObjectById(it->second))) { + if ((hint->GetInfo().GetOverrideFlags() & 0x80) != 0 && + hint->GetPriority() == bestHint->GetPriority() && + hint->GetCurrentAreaId() == bestHint->GetCurrentAreaId()) { + CVector3f hintToHelper = actorPos - bestHint->GetTranslation(); + if (hintToHelper.CanBeNormalized()) { + hintToHelper.Normalize(); + } else { + hintToHelper = bestHint->GetTransform().GetColumn(kDY); + } + + float ballHintDot = CMath::Limit(CVector3f::Dot(hintToHelper, ballToHelper), 1.f); + + CVector3f thisBallToHelper = actorPos - ballPos; + if (thisBallToHelper.CanBeNormalized()) { + thisBallToHelper.Normalize(); + } else { + thisBallToHelper = hint->GetTransform().GetColumn(kDY); + } + + CVector3f thisHintToHelper = actorPos - hint->GetTranslation(); + if (thisHintToHelper.CanBeNormalized()) { + thisHintToHelper.Normalize(); + } else { + thisHintToHelper = hint->GetTransform().GetColumn(kDY); + } + + float thisBallHintDot = + CMath::Limit(CVector3f::Dot(thisHintToHelper, thisBallToHelper), 1.f); + + if (thisBallHintDot > ballHintDot) { + bestHint = hint; + } + } else { + break; + } + } else { + break; + } + } + } + + if (bestHint->GetUniqueId() != xa6_camHintId) { + changeHint = true; + } + } else if (xa6_camHintId != bestHint->GetUniqueId()) { + if (bestHint->GetInfo().GetBehaviourType() == CBallCamera::kBCB_HintInitializePosition) { + if ((bestHint->GetInfo().GetOverrideFlags() & 0x20) != 0) { + x80_ballCamera->TeleportCamera( + CTransform4f::LookAt(bestHint->GetTranslation(), + x80_ballCamera->GetLookAtPosition()), + mgr); + } + DeleteCameraHint(bestHint->GetUniqueId(), mgr); + if ((bestHint->GetInfo().GetOverrideFlags() & 0x2000) != 0) { + CinematicCut(mgr); + } + changeHint = false; + } else { + changeHint = true; + } + } + + if (changeHint) { + UseCameraHint(*bestHint, mgr); + } + } + } } diff --git a/src/MetroidPrime/Cameras/CPathCamera.cpp b/src/MetroidPrime/Cameras/CPathCamera.cpp index 2c1d9f8b..b9d28900 100644 --- a/src/MetroidPrime/Cameras/CPathCamera.cpp +++ b/src/MetroidPrime/Cameras/CPathCamera.cpp @@ -7,9 +7,10 @@ CPathCamera::CPathCamera(TUniqueId uid, const rstl::string& name, const CEntityI const CTransform4f& xf, bool active, float lengthExtent, float filterMag, float filterProportion, float minEaseDist, float maxEaseDist, u32 flags, EInitialSplinePosition initPos) -: CGameCamera(uid, active, name, info, xf, CCameraManager::DefaultThirdPersonFov(), - CCameraManager::DefaultNearPlane(), CCameraManager::DefaultFarPlane(), - CCameraManager::DefaultAspect(), kInvalidUniqueId, false, 0) +: CGameCamera(uid, active, name, info, xf, CCameraManager::GetDefaultThirdPersonVerticalFOV(), + CCameraManager::GetDefaultFirstPersonNearClipDistance(), + CCameraManager::GetDefaultFirstPersonFarClipDistance(), + CCameraManager::GetDefaultAspectRatio(), kInvalidUniqueId, false, 0) , x188_spline(flags & 1) , x1d4_pos(0.f) , x1d8_time(0.f) @@ -88,16 +89,13 @@ void CPathCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) { // Empty } -void CPathCamera::Accept(IVisitor& visitor) override { visitor.Visit(*this); } +void CPathCamera::Accept(IVisitor& visitor) { visitor.Visit(*this); } -void CPathCamera::Render(const CStateManager& mgr) const { - -} +void CPathCamera::Render(const CStateManager& mgr) const {} void CPathCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { CGameCamera::AcceptScriptMsg(msg, uid, mgr); - if (!GetActive() || msg != kSM_InitializedInArea) { return; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptCameraHint.cpp b/src/MetroidPrime/ScriptObjects/CScriptCameraHint.cpp new file mode 100644 index 00000000..027e1b80 --- /dev/null +++ b/src/MetroidPrime/ScriptObjects/CScriptCameraHint.cpp @@ -0,0 +1,187 @@ +#include "MetroidPrime/ScriptObjects/CScriptCameraHint.hpp" + +#include "MetroidPrime/CActorParameters.hpp" +#include "MetroidPrime/Cameras/CCameraManager.hpp" + +#include "Kyoto/Alloc/CMemory.hpp" + +#include "rstl/algorithm.hpp" + +CCameraOverrideInfo::CCameraOverrideInfo( + uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist, float maxDist, + float backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset, + const CVector3f& ballToCam, float fov, float attitudeRange, float azimuthRange, + float anglePerSecond, float clampVelRange, float clampRotRange, float elevation, + float interpolateTime, float clampVelTime, float controlInterpDur) +: mOverrideFlags(overrideFlags) +, mBehaviour(behaviour) +, mMinDist(minDist) +, mMaxDist(maxDist) +, mBackwardsDist(backwardsDist) +, mLookAtOffset(lookAtOffset) +, mChaseLookAtOffset(chaseLookAtOffset) +, mBallToCam(ballToCam) +, mFov(fov) +, mAttitudeRange(attitudeRange) +, mAzimuthRange(azimuthRange) +, mAnglePerSecond(anglePerSecond) +, mClampVelRange(clampVelRange) +, mClampRotRange(clampRotRange) +, mElevation(elevation) +, mInterpolateTime(interpolateTime) +, mClampVelTime(clampVelTime) +, mControlInterpDur(controlInterpDur) {} + +CScriptCameraHint::CScriptCameraHint( + TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, + bool active, int priority, CBallCamera::EBallCameraBehaviour behavior, int overrideFlags, + float minDist, float maxDist, float backwardsDist, const CVector3f& lookAtOffset, + const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov, float attitudeRange, + float azimuthRange, float anglePerSecond, float clampVelRange, float clampRotRange, + float elevation, float interpolateTime, float clampVelTime, float controlInterpDur) +: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(kMT_NoStepLogic), + CActorParameters::None(), kInvalidUniqueId) +, mPriority(priority) +, mOverrideInfo(overrideFlags, behavior, minDist, maxDist, backwardsDist, lookAtOffset, + chaseLookAtOffset, ballToCam, fov, attitudeRange, azimuthRange, anglePerSecond, + clampVelRange, clampRotRange, elevation, interpolateTime, clampVelTime, + controlInterpDur) +, mSenders() +, mDelegatedCameraId(kInvalidUniqueId) +, mInactive(false) +, mOrigXf(xf) {} + +CScriptCameraHint::~CScriptCameraHint() {} + +TUniqueId CScriptCameraHint::GetSenderId() const { + if (mSenders.size() > 0) { + return mSenders.front(); + } + return kInvalidUniqueId; +} + +void CScriptCameraHint::ClearSenders() { mSenders.clear(); } + +void CScriptCameraHint::AddSender(TUniqueId uid) { + rstl::reserved_vector< TUniqueId, 8 >::iterator it = + rstl::find(mSenders.begin(), mSenders.end(), uid); + if (it == mSenders.end()) { + mSenders.push_back(uid); + } +} + +void CScriptCameraHint::RemoveSender(TUniqueId uid, CStateManager& mgr) { + if (mSenders.empty()) { + return; + } + rstl::reserved_vector< TUniqueId, 8 >::iterator it = + rstl::find(mSenders.begin(), mSenders.end(), uid); + if (it == mSenders.end()) { + mSenders.erase(mSenders.begin()); + } else { + mSenders.erase(it); + } +} + +void CScriptCameraHint::CheckLegacyConnections(CStateManager& mgr) { + TUniqueId uid = GetUniqueId(); + CObjectList& objList = mgr.ObjectListById(kOL_All); + mDelegatedCameraId = kInvalidUniqueId; + for (int idx = objList.GetFirstObjectIndex(); idx != -1; idx = objList.GetNextObjectIndex(idx)) { + CEntity* entity = TCastToPtr< CEntity >(objList[idx]); + if (!entity) { + continue; + } + rstl::vector< SConnection >& connections = entity->ConnectionList(); + rstl::vector< SConnection >::iterator outer = connections.begin(); + for (; outer != connections.end(); ++outer) { + if (mgr.GetIdForScript(outer->x8_objId) != uid || + (outer->x4_msg != kSM_Increment && outer->x4_msg != kSM_Decrement)) { + continue; + } + rstl::vector< SConnection >::iterator inner = connections.begin(); + while (inner != connections.end()) { + if (inner->x4_msg == kSM_Increment || inner->x4_msg == kSM_Decrement) { + TUniqueId senderId = mgr.GetIdForScript(inner->x8_objId); + CPathCamera* pathCamera = TCastToPtr< CPathCamera >(mgr.ObjectById(senderId)); + CScriptSpindleCamera* spindleCamera = + TCastToPtr< CScriptSpindleCamera >(mgr.ObjectById(senderId)); + if (pathCamera || spindleCamera) { + connections.erase(inner); + if (mDelegatedCameraId != senderId) { + mDelegatedCameraId = senderId; + } + break; + } else { + inner = inner + 1; // ? + } + } else { + inner = inner + 1; // ? + } + } + break; + } + } +} + +void CScriptCameraHint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, + CStateManager& mgr) { + switch (msg) { + case kSM_Deleted: + case kSM_Deactivate: + CCameraManager* cameraManager = mgr.CameraManager(); + cameraManager->ReallyRemoveCameraHint(GetUniqueId(), mgr); + break; + case kSM_InitializedInArea: + CheckLegacyConnections(mgr); + break; + default: + break; + } + + if (GetActive()) { + CCameraManager* cameraManager = mgr.CameraManager(); + switch (msg) { + case kSM_Increment: + AddSender(uid); + cameraManager->AddCameraHint(GetUniqueId(), mgr); + mInactive = false; + break; + case kSM_Decrement: + RemoveSender(uid, mgr); + cameraManager->DeleteCameraHint(GetUniqueId(), mgr); + break; + default: + break; + } + } + + CCameraManager* cameraManager = mgr.CameraManager(); + switch (msg) { + case kSM_Follow: + if (!GetActive()) { + SetActive(true); + if (CActor* act = TCastToPtr< CActor >(mgr.ObjectById(uid))) { + CVector3f followerToThisFlat = mOrigXf.GetTranslation() - act->GetTranslation(); + followerToThisFlat.SetZ(0.f); + if (followerToThisFlat.CanBeNormalized()) { + followerToThisFlat.Normalize(); + } else { + followerToThisFlat = act->GetTransform().GetColumn(kDY); + } + CVector3f pos = act->GetTranslation(); + pos.SetZ(mOrigXf.GetTranslation().GetZ()); + SetTransform(CTransform4f::LookAt(pos, pos + followerToThisFlat)); + } + } + AddSender(uid); + cameraManager->AddCameraHint(GetUniqueId(), mgr); + break; + default: + break; + } + + CActor::AcceptScriptMsg(msg, uid, mgr); +} + +void CScriptCameraHint::Accept(IVisitor& visitor) { visitor.Visit(*this); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index 146e171a..36099216 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -580,9 +580,9 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId case kSF_FogFader: { float speed = x100_float2; if (msg == kSM_Increment) { - mgr.CameraManager()->SetFogDensity(xfc_float1, speed); + mgr.CameraManager()->SetWaterFogScale(xfc_float1, speed); } else if (msg == kSM_Decrement) { - mgr.CameraManager()->SetFogDensity(1.f, speed); + mgr.CameraManager()->SetWaterFogScale(1.f, speed); } break; }