From 24c42469fb9d659fd12d822a9ccb02a4021618d5 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 30 Sep 2024 00:02:23 -0600 Subject: [PATCH] More CPlayer progress --- config/GM8E01_00/symbols.txt | 82 +- config/GM8E01_01/symbols.txt | 62 +- include/Kyoto/Audio/CSfxManager.hpp | 2 +- include/Kyoto/Math/CMath.hpp | 13 +- include/MetroidPrime/ActorCommon.hpp | 21 - include/MetroidPrime/CActor.hpp | 2 +- include/MetroidPrime/CCollisionActor.hpp | 2 +- include/MetroidPrime/CFluidPlane.hpp | 9 +- include/MetroidPrime/CStateManager.hpp | 1 + .../MetroidPrime/Cameras/CCameraManager.hpp | 4 + .../MetroidPrime/Cameras/CCameraShakeData.hpp | 28 +- include/MetroidPrime/Enemies/CPatterned.hpp | 2 +- include/MetroidPrime/HUD/CSamusHud.hpp | 3 + include/MetroidPrime/Player/CGameState.hpp | 10 +- include/MetroidPrime/Player/CMorphBall.hpp | 93 ++- include/MetroidPrime/Player/CPlayer.hpp | 76 +- .../{CSystemOptions.hpp => CSystemState.hpp} | 19 +- .../CScriptDamageableTrigger.hpp | 2 +- .../ScriptObjects/CScriptWater.hpp | 2 +- include/MetroidPrime/Tweaks/CTweakPlayer.hpp | 547 +++++++------- .../MetroidPrime/Weapons/CBeamProjectile.hpp | 2 +- include/MetroidPrime/Weapons/CGunWeapon.hpp | 2 +- include/MetroidPrime/Weapons/CWeapon.hpp | 41 +- include/rstl/string.hpp | 22 +- src/Kyoto/Math/CQuaternion.cpp | 8 + src/MetroidPrime/CFluidPlane.cpp | 11 + src/MetroidPrime/CMemoryCardDriver.cpp | 26 +- src/MetroidPrime/Cameras/CBallCamera.cpp | 2 +- src/MetroidPrime/Cameras/CCameraManager.cpp | 8 +- src/MetroidPrime/Enemies/CBurstFire.cpp | 6 +- src/MetroidPrime/Player/CPlayer.cpp | 709 +++++++++++++++++- .../ScriptObjects/CScriptBallTrigger.cpp | 2 +- .../ScriptObjects/CScriptBeam.cpp | 2 +- .../ScriptObjects/CScriptEMPulse.cpp | 4 +- .../ScriptObjects/CScriptPickup.cpp | 12 +- .../ScriptObjects/CScriptSpecialFunction.cpp | 8 +- .../ScriptObjects/CScriptTrigger.cpp | 4 +- src/MetroidPrime/Tweaks/CTweakPlayer.cpp | 286 +++---- .../Weapons/CElectricBeamProjectile.cpp | 2 +- src/MetroidPrime/Weapons/CGunWeapon.cpp | 8 +- src/MetroidPrime/Weapons/CPowerBomb.cpp | 6 +- .../Weapons/CTargetableProjectile.cpp | 6 +- src/MetroidPrime/Weapons/CWaveBeam.cpp | 4 +- src/MetroidPrime/Weapons/CWeapon.cpp | 13 +- src/MetroidPrime/main.cpp | 20 +- src/WorldFormat/CMetroidAreaCollider.cpp | 18 +- tools/metaforce_renames.py | 69 +- 47 files changed, 1590 insertions(+), 691 deletions(-) rename include/MetroidPrime/Player/{CSystemOptions.hpp => CSystemState.hpp} (76%) create mode 100644 src/Kyoto/Math/CQuaternion.cpp create mode 100644 src/MetroidPrime/CFluidPlane.cpp diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index da4638c0..5c4b4511 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -25,7 +25,7 @@ RegisterResourceTweaks__5CMainFv = .text:0x8000367C; // type:function size:0x24 ResetGameState__5CMainFv = .text:0x800036A0; // type:function size:0x100 scope:global __as__12CGameOptionsFRC12CGameOptions = .text:0x800037A0; // type:function size:0x130 scope:global __as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator> = .text:0x800038D0; // type:function size:0xFC scope:global -__as__14CSystemOptionsFRC14CSystemOptions = .text:0x800039CC; // type:function size:0x1C0 scope:global +__as__12CSystemStateFRC12CSystemState = .text:0x800039CC; // type:function size:0x1C0 scope:global __as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator> = .text:0x80003B8C; // type:function size:0xFC scope:global __as__Q24rstl24single_ptr<10CGameState>FP10CGameState = .text:0x80003C88; // type:function size:0x48 scope:global __dt__10CGameStateFv = .text:0x80003CD0; // type:function size:0x190 scope:global @@ -33,8 +33,8 @@ __dt__Q24rstl48vector<11CWorldState,Q24rstl17rmemory_allocator>Fv = .text:0x8000 deallocate<11CWorldState>__Q24rstl17rmemory_allocatorFP11CWorldState = .text:0x80003EEC; // type:function size:0x98 scope:global __dt__12CGameOptionsFv = .text:0x80003F84; // type:function size:0xF0 scope:global __ct__12CGameOptionsFRC12CGameOptions = .text:0x80004074; // type:function size:0x164 scope:global -__dt__14CSystemOptionsFv = .text:0x800041D8; // type:function size:0x14C scope:global -__ct__14CSystemOptionsFRC14CSystemOptions = .text:0x80004324; // type:function size:0x180 scope:global +__dt__12CSystemStateFv = .text:0x800041D8; // type:function size:0x14C scope:global +__ct__12CSystemStateFRC12CSystemState = .text:0x80004324; // type:function size:0x180 scope:global StreamNewGameState__5CMainFR12CInputStreami = .text:0x800044A4; // type:function size:0xEC scope:global RefreshGameState__5CMainFv = .text:0x80004590; // type:function size:0x21C scope:global __dt__15CMemoryInStreamFv = .text:0x800047AC; // type:function size:0x60 scope:global @@ -359,15 +359,15 @@ UpdateMorphBallState__7CPlayerFfRC11CFinalInputR13CStateManager = .text:0x80014B ProcessInput__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x80014D5C; // type:function size:0x9B0 scope:global GetMaterial__19CCollisionPrimitiveCFv = .text:0x8001570C; // type:function size:0x8 scope:global StartLandingControlFreeze__7CPlayerFv = .text:0x80015714; // type:function size:0x14 scope:global -ProcessFrozenInput__7CPlayerFfR13CStateManager = .text:0x80015728; // type:function size:0xC0 scope:global +UpdateControlLostState__7CPlayerFfR13CStateManager = .text:0x80015728; // type:function size:0xC0 scope:global EndLandingControlFreeze__7CPlayerFv = .text:0x800157E8; // type:function size:0x14 scope:global UpdateFrozenState__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x800157FC; // type:function size:0x1F4 scope:global wstring_l__4rstlFPCw = .text:0x800159F0; // type:function size:0x3C scope:global -UnFreeze__7CPlayerFR13CStateManager = .text:0x80015A2C; // type:function size:0x2D0 scope:global +BreakFrozenState__7CPlayerFR13CStateManager = .text:0x80015A2C; // type:function size:0x2D0 scope:global GetFrozenState__7CPlayerCFv = .text:0x80015CFC; // type:function size:0x18 scope:global -Freeze__7CPlayerFR13CStateManagerUiUsUi = .text:0x80015D14; // type:function size:0x19C scope:global +SetFrozenState__7CPlayerFR13CStateManagerUiUsUi = .text:0x80015D14; // type:function size:0x19C scope:global Think__7CPlayerFfR13CStateManager = .text:0x80015EB0; // type:function size:0x59C scope:global -UpdateWaterSurfaceCameraBias__7CPlayerFR13CStateManager = .text:0x8001644C; // type:function size:0xF4 scope:global +AdjustEyeOffset__7CPlayerFR13CStateManager = .text:0x8001644C; // type:function size:0xF4 scope:global PreThink__7CPlayerFfR13CStateManager = .text:0x80016540; // type:function size:0x38 scope:global AcceptScriptMsg__7CPlayerF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x80016578; // type:function size:0x824 scope:global UpdateCameraTimers__7CPlayerFfRC11CFinalInput = .text:0x80016D9C; // type:function size:0x148 scope:global @@ -5686,7 +5686,7 @@ __ct__22CCompoundTargetReticleFRC13CStateManager = .text:0x800C132C; // type:fun __ct__Q222CCompoundTargetReticle14SOuterItemInfoFPCc = .text:0x800C1A68; // type:function size:0x7C scope:global calculate_premultiplied_overshoot_offset__Ff = .text:0x800C1AE4; // type:function size:0x3C scope:global offshoot_func__Ffff = .text:0x800C1B20; // type:function size:0x48 scope:global -IsDamageOrbit__F19EPlayerOrbitRequest = .text:0x800C1B68; // type:function size:0x2C scope:global +IsDamageOrbit__FQ27CPlayer16EOrbitBrokenType = .text:0x800C1B68; // type:function size:0x2C scope:global reserve__Q24rstl77vectorFi = .text:0x800C1B94; // type:function size:0x12C scope:global __sinit_CTargetReticles_cpp = .text:0x800C1CC0; // type:function size:0x68 scope:local GetNumActive__10CWeaponMgrCF9TUniqueId11EWeaponType = .text:0x800C1D28; // type:function size:0xC0 scope:global @@ -6201,7 +6201,7 @@ UpdateHalfPipeStatus__10CMorphBallFR13CStateManagerf = .text:0x800F19DC; // type RenderDamageEffects__10CMorphBallCFRC13CStateManagerRC12CTransform4f = .text:0x800F1B8C; // type:function size:0x1C0 scope:global RenderIceBreakEffect__10CMorphBallCFRC13CStateManager = .text:0x800F1D4C; // type:function size:0x38 scope:global UpdateIceBreakEffect__10CMorphBallFf = .text:0x800F1D84; // type:function size:0x1D0 scope:global -Stop__10CMorphBallFv = .text:0x800F1F54; // type:function size:0x58 scope:global +ResetMorphBallIceBreak__10CMorphBallFv = .text:0x800F1F54; // type:function size:0x58 scope:global IsMorphBallTransitionFlashValid__10CMorphBallCFv = .text:0x800F1FAC; // type:function size:0x14 scope:global RenderMorphBallTransitionFlash__10CMorphBallCFRC13CStateManager = .text:0x800F1FC0; // type:function size:0x90 scope:global UpdateMorphBallTransitionFlash__10CMorphBallFf = .text:0x800F2050; // type:function size:0x1D0 scope:global @@ -6359,7 +6359,7 @@ FluidFXThink__7CWeaponFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager = . Think__7CWeaponFfR13CStateManager = .text:0x801020D8; // type:function size:0x140 scope:global SetDamageFalloffSpeed__7CWeaponFf = .text:0x80102218; // type:function size:0x1C scope:global __dt__7CWeaponFv = .text:0x80102234; // type:function size:0x60 scope:global -__ct__7CWeaponF9TUniqueId7TAreaIdb9TUniqueId11EWeaponTypeRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4fRC15CMaterialFilterRC13CMaterialListRC11CDamageInfo17EProjectileAttribRC10CModelData = .text:0x80102294; // type:function size:0x1FC scope:global +__ct__7CWeaponF9TUniqueId7TAreaIdb9TUniqueId11EWeaponTypeRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4fRC15CMaterialFilterRC13CMaterialListRC11CDamageInfoiRC10CModelData = .text:0x80102294; // type:function size:0x1FC scope:global GetDeflectionType__20CDamageVulnerabilityCFRC11CWeaponMode = .text:0x80102490; // type:function size:0x2C scope:global GetVulnerability__20CDamageVulnerabilityCFRC11CWeaponModei = .text:0x801024BC; // type:function size:0xC8 scope:global WeaponHits__20CDamageVulnerabilityCFRC11CWeaponModei = .text:0x80102584; // type:function size:0x184 scope:global @@ -6935,7 +6935,7 @@ fn_8012E90C = .text:0x8012E90C; // type:function size:0x4 AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E910; // type:function size:0x54 scope:global AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC9CVector3fRC12CScriptWaterR13CStateManagerRC9CVector3f = .text:0x8012E964; // type:function size:0xC4 scope:global AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fR13CStateManager = .text:0x8012EA28; // type:function size:0xA0 scope:global -ProjectRippleVelocity__11CFluidPlaneCFff = .text:0x8012EAC8; // type:function size:0x50 scope:global +GetRippleScaleFromKineticEnergy__11CFluidPlaneFff = .text:0x8012EAC8; // type:function size:0x50 scope:global CalculateRippleIntensity__11CFluidPlaneCFf = .text:0x8012EB18; // type:function size:0xC4 scope:global __dt__11CFluidPlaneFv = .text:0x8012EBDC; // type:function size:0x158 scope:global __ct__11CFluidPlaneFUiUiUifQ211CFluidPlane10EFluidTypefRC14CFluidUVMotion = .text:0x8012ED34; // type:function size:0x364 scope:global @@ -7181,7 +7181,7 @@ ResolveCollisionWithActor__21CTargetableProjectileFRC14CRayCastResultR6CActorR13 GetAimPosition__21CTargetableProjectileCFRC13CStateManagerf = .text:0x8013BABC; // type:function size:0x184 scope:global Explode__21CTargetableProjectileFRC9CVector3fRC9CVector3f29EWeaponCollisionResponseTypesR13CStateManagerRC20CDamageVulnerability9TUniqueId = .text:0x8013BC40; // type:function size:0x27C scope:global Accept__21CTargetableProjectileFR8IVisitor = .text:0x8013BEBC; // type:function size:0x38 scope:global -__ct__21CTargetableProjectileFRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfoRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRC34TLockedToken<18CWeaponDescription>9TUniqueId17EProjectileAttribRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb = .text:0x8013BEF4; // type:function size:0x154 scope:global +__ct__21CTargetableProjectileFRC28TToken<18CWeaponDescription>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfoRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRC34TLockedToken<18CWeaponDescription>9TUniqueIdQ27CWeapon17EProjectileAttribRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>Usb = .text:0x8013BEF4; // type:function size:0x154 scope:global __dt__15CBSLoopReactionFv = .text:0x8013C048; // type:function size:0x5C scope:global GetBodyStateTransition__15CBSLoopReactionFfR15CBodyController = .text:0x8013C0A4; // type:function size:0x1B0 scope:global PlayExitAnimation__15CBSLoopReactionCFR15CBodyControllerR13CStateManager = .text:0x8013C254; // type:function size:0x210 scope:global @@ -7968,7 +7968,7 @@ MakeBillboardEffect__17CPlasmaProjectileFRCQ24rstl44optional_object<25TToken<15C UpdateBeamState__17CPlasmaProjectileFfR13CStateManager = .text:0x80178A68; // type:function size:0x184 scope:global Touch__17CPlasmaProjectileFR6CActorR13CStateManager = .text:0x80178BEC; // type:function size:0x4 scope:global Accept__17CPlasmaProjectileFR8IVisitor = .text:0x80178BF0; // type:function size:0x38 scope:global -__ct__17CPlasmaProjectileFRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string,Q24rstl17rmemory_allocator>11EWeaponTypeRC9CBeamInfoRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRCQ217CPlasmaProjectile21PlayerEffectResourcesb17EProjectileAttrib = .text:0x80178C28; // type:function size:0x758 scope:global +__ct__17CPlasmaProjectileFRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string,Q24rstl17rmemory_allocator>11EWeaponTypeRC9CBeamInfoRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdRCQ217CPlasmaProjectile21PlayerEffectResourcesbQ27CWeapon17EProjectileAttrib = .text:0x80178C28; // type:function size:0x758 scope:global __sinit_CPlasmaProjectile_cpp = .text:0x80179380; // type:function size:0xC scope:local UpdateGrappleArmTransform__7CPlayerFRC9CVector3fR13CStateManagerf = .text:0x8017938C; // type:function size:0x320 scope:global ApplyGrappleForces__7CPlayerFRC11CFinalInputR13CStateManagerf = .text:0x801796AC; // type:function size:0xCCC scope:global @@ -7976,9 +7976,9 @@ ValidateFPPosition__7CPlayerF9CVector3fR13CStateManager = .text:0x8017A378; // t UpdateGrappleState__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x8017A668; // type:function size:0x784 scope:global ApplyGrappleJump__7CPlayerFR13CStateManager = .text:0x8017ADEC; // type:function size:0x234 scope:global BeginGrapple__7CPlayerFR9CVector3fR13CStateManager = .text:0x8017B020; // type:function size:0xA4 scope:global -BreakGrapple__7CPlayerF19EPlayerOrbitRequestR13CStateManager = .text:0x8017B0C4; // type:function size:0xD8 scope:global -SetOrbitRequest__7CPlayerF19EPlayerOrbitRequestR13CStateManager = .text:0x8017B19C; // type:function size:0xB8 scope:global -SetOrbitRequestForTarget__7CPlayerF9TUniqueId19EPlayerOrbitRequestR13CStateManager = .text:0x8017B254; // type:function size:0x54 scope:global +BreakGrapple__7CPlayerFQ27CPlayer16EOrbitBrokenTypeR13CStateManager = .text:0x8017B0C4; // type:function size:0xD8 scope:global +BreakOrbit__7CPlayerFQ27CPlayer16EOrbitBrokenTypeR13CStateManager = .text:0x8017B19C; // type:function size:0xB8 scope:global +TryToBreakOrbit__7CPlayerF9TUniqueIdQ27CPlayer16EOrbitBrokenTypeR13CStateManager = .text:0x8017B254; // type:function size:0x54 scope:global CheckPostGrapple__7CPlayerCFv = .text:0x8017B2A8; // type:function size:0x38 scope:global PreventFallingCameraPitch__7CPlayerFv = .text:0x8017B2E0; // type:function size:0x1C scope:global OrbitCarcass__7CPlayerFR13CStateManager = .text:0x8017B2FC; // type:function size:0x3C scope:global @@ -8330,7 +8330,7 @@ Touch__15CBeamProjectileFR6CActorR13CStateManager = .text:0x80199350; // type:fu Accept__15CBeamProjectileFR8IVisitor = .text:0x80199354; // type:function size:0x38 scope:global CalculateRenderBounds__15CBeamProjectileFv = .text:0x8019938C; // type:function size:0x68 scope:global GetTouchBounds__15CBeamProjectileCFv = .text:0x801993F4; // type:function size:0x98 scope:global -__ct__15CBeamProjectileFRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string,Q24rstl17rmemory_allocator>11EWeaponTypeRC12CTransform4fiff14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId17EProjectileAttribb = .text:0x8019948C; // type:function size:0x408 scope:global +__ct__15CBeamProjectileFRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string,Q24rstl17rmemory_allocator>11EWeaponTypeRC12CTransform4fiff14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdQ27CWeapon17EProjectileAttribb = .text:0x8019948C; // type:function size:0x408 scope:global RenderCleanup__14CFluidPlaneCPUCFv = .text:0x80199894; // type:function size:0x1D4 scope:global Render__14CFluidPlaneCPUCFRC13CStateManagerRC6CAABoxRC12CTransform4fRC12CTransform4fbRC14CFrustumPlanesRCQ24rstl33optional_object<14CRippleManager>9TUniqueIdPCbiiRC9CVector3f = .text:0x80199A68; // type:function size:0x840 scope:global __ct__Q220CFluidPlaneCPURender10SPatchInfoFRC9CVector3fRC9CVector3fRC9CVector3fffb = .text:0x8019A2A8; // type:function size:0x188 scope:global @@ -9000,8 +9000,8 @@ StateForWorld__10CGameStateFUi = .text:0x801D39D8; // type:function size:0x104 s __ct__11CWorldStateFRC11CWorldState = .text:0x801D3ADC; // type:function size:0xD8 scope:global WriteBackupBuf__10CGameStateFv = .text:0x801D3BB4; // type:function size:0x68 scope:global resize__Q24rstl37vectorFiRCUc = .text:0x801D3C1C; // type:function size:0xEC scope:global -ExportPersistentOptions__10CGameStateFR14CSystemOptions = .text:0x801D3D08; // type:function size:0x1C4 scope:global -ImportPersistentOptions__10CGameStateFRC14CSystemOptions = .text:0x801D3ECC; // type:function size:0x150 scope:global +ExportPersistentOptions__10CGameStateFR12CSystemState = .text:0x801D3D08; // type:function size:0x1C4 scope:global +ImportPersistentOptions__10CGameStateFRC12CSystemState = .text:0x801D3ECC; // type:function size:0x150 scope:global WriteSystemOptions__10CGameStateFR13COutputStream = .text:0x801D401C; // type:function size:0x24 scope:global ReadSystemOptions__10CGameStateFR12CInputStream = .text:0x801D4040; // type:function size:0x48 scope:global PutTo__10CGameStateCFR13COutputStream = .text:0x801D4088; // type:function size:0x1CC scope:global @@ -9024,28 +9024,28 @@ GetWorldAssetId__11CWorldStateCFv = .text:0x801D4D90; // type:function size:0x8 PutTo__11CWorldStateFR16CMemoryStreamOut = .text:0x801D4D98; // type:function size:0xA0 scope:global __ct__11CWorldStateFR12CInputStreamPCvR18CWorldSaveGameInfo = .text:0x801D4E38; // type:function size:0x238 scope:global __ct__11CWorldStateFUi = .text:0x801D5070; // type:function size:0x138 scope:global -SetAutoMapperKeyState__14CSystemOptionsFi = .text:0x801D51A8; // type:function size:0x8 scope:global -SetAllItemsCollected__14CSystemOptionsFb = .text:0x801D51B0; // type:function size:0x10 scope:global -SetHasFusion__14CSystemOptionsFb = .text:0x801D51C0; // type:function size:0x10 scope:global +SetAutoMapperKeyState__12CSystemStateFi = .text:0x801D51A8; // type:function size:0x8 scope:global +SetAllItemsCollected__12CSystemStateFb = .text:0x801D51B0; // type:function size:0x10 scope:global +SetHasFusion__12CSystemStateFb = .text:0x801D51C0; // type:function size:0x10 scope:global fn_801D51D0 = .text:0x801D51D0; // type:function size:0x10 -SetHardModeBeat__14CSystemOptionsFb = .text:0x801D51E0; // type:function size:0x10 scope:global -SetHasHardMode__14CSystemOptionsFb = .text:0x801D51F0; // type:function size:0x10 scope:global -SetLogScanCount__14CSystemOptionsFi = .text:0x801D5200; // type:function size:0x8 scope:global -GetLogScanCount__14CSystemOptionsFv = .text:0x801D5208; // type:function size:0x8 scope:global +SetHardModeBeat__12CSystemStateFb = .text:0x801D51E0; // type:function size:0x10 scope:global +SetHasHardMode__12CSystemStateFb = .text:0x801D51F0; // type:function size:0x10 scope:global +SetLogScanCount__12CSystemStateFi = .text:0x801D5200; // type:function size:0x8 scope:global +GetLogScanCount__12CSystemStateFv = .text:0x801D5208; // type:function size:0x8 scope:global fn_801D5210 = .text:0x801D5210; // type:function size:0x10 -IncrementPowerBombAmmoCount__14CSystemOptionsFv = .text:0x801D5220; // type:function size:0x34 scope:global -GetShowPowerBombAmmoMessage__14CSystemOptionsCFv = .text:0x801D5254; // type:function size:0x1C scope:global -IncrementFrozenBallCount__14CSystemOptionsFv = .text:0x801D5270; // type:function size:0x34 scope:global -GetShowFrozenBallMessage__14CSystemOptionsCFv = .text:0x801D52A4; // type:function size:0x1C scope:global -IncrementFrozenFpsCount__14CSystemOptionsFv = .text:0x801D52C0; // type:function size:0x34 scope:global -GetShowFrozenFpsMessage__14CSystemOptionsCFv = .text:0x801D52F4; // type:function size:0x1C scope:global -SetCinematicState__14CSystemOptionsFUi9TEditorIdb = .text:0x801D5310; // type:function size:0x130 scope:global +IncrementPowerBombAmmoCount__12CSystemStateFv = .text:0x801D5220; // type:function size:0x34 scope:global +GetShowPowerBombAmmoMessage__12CSystemStateCFv = .text:0x801D5254; // type:function size:0x1C scope:global +IncrementFrozenBallCount__12CSystemStateFv = .text:0x801D5270; // type:function size:0x34 scope:global +GetShowFrozenBallMessage__12CSystemStateCFv = .text:0x801D52A4; // type:function size:0x1C scope:global +IncNumFreezeInstructionsPrintedFirstPerson__12CSystemStateFv = .text:0x801D52C0; // type:function size:0x34 scope:global +GetShowFrozenFpsMessage__12CSystemStateCFv = .text:0x801D52F4; // type:function size:0x1C scope:global +SetCinematicState__12CSystemStateFUi9TEditorIdb = .text:0x801D5310; // type:function size:0x130 scope:global fn_801D5440 = .text:0x801D5440; // type:function size:0x4C fn_801D548C = .text:0x801D548C; // type:function size:0x9C -GetCinematicState__14CSystemOptionsCFQ24rstl19pair = .text:0x801D5528; // type:function size:0x68 scope:global -PutTo__14CSystemOptionsFR13COutputStream = .text:0x801D5590; // type:function size:0x3D8 scope:global -__ct__14CSystemOptionsFR12CInputStream = .text:0x801D5968; // type:function size:0x5A0 scope:global -__ct__14CSystemOptionsFv = .text:0x801D5F08; // type:function size:0x1A8 scope:global +GetCinematicState__12CSystemStateCFQ24rstl19pair = .text:0x801D5528; // type:function size:0x68 scope:global +PutTo__12CSystemStateFR13COutputStream = .text:0x801D5590; // type:function size:0x3D8 scope:global +__ct__12CSystemStateFR12CInputStream = .text:0x801D5968; // type:function size:0x5A0 scope:global +__ct__12CSystemStateFv = .text:0x801D5F08; // type:function size:0x1A8 scope:global fn_801D60B0 = .text:0x801D60B0; // type:function size:0x20 Clamp__5CMathFRCdRCdRCd = .text:0x801D60D0; // type:function size:0x2C scope:global fn_801D60FC = .text:0x801D60FC; // type:function size:0x100 @@ -10681,7 +10681,7 @@ AddToRenderer__23CElectricBeamProjectileCFRC14CFrustumPlanesRC13CStateManager = UpdateFx__23CElectricBeamProjectileFRC12CTransform4ffR13CStateManager = .text:0x80251E84; // type:function size:0x47C scope:global Touch__23CElectricBeamProjectileFR6CActorR13CStateManager = .text:0x80252300; // type:function size:0x4 scope:global Accept__23CElectricBeamProjectileFR8IVisitor = .text:0x80252304; // type:function size:0x38 scope:global -__ct__23CElectricBeamProjectileFRC28TToken<18CWeaponDescription>11EWeaponTypeRC17SElectricBeamInfoRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId17EProjectileAttrib = .text:0x8025233C; // type:function size:0x25C scope:global +__ct__23CElectricBeamProjectileFRC28TToken<18CWeaponDescription>11EWeaponTypeRC17SElectricBeamInfoRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueIdQ27CWeapon17EProjectileAttrib = .text:0x8025233C; // type:function size:0x25C scope:global __dt__7CRidleyFv = .text:0x80252598; // type:function size:0x21C scope:global fn_802527B4 = .text:0x802527B4; // type:function size:0x10C GetGravityConstant__7CRidleyCFv = .text:0x802528C0; // type:function size:0x8 scope:global @@ -19424,7 +19424,7 @@ lbl_8057194C = .bss:0x8057194C; // type:object size:0x40 data:byte lbl_8057198C = .bss:0x8057198C; // type:object size:0x40 data:byte lbl_805719CC = .bss:0x805719CC; // type:object size:0x4 lbl_805719DC = .bss:0x805719DC; // type:object size:0xC data:float -skChargedShotCameraShakeData__16CCameraShakeData = .bss:0x805719E8; // type:object size:0xD4 scope:global +skHardRecoil__16CCameraShakeData = .bss:0x805719E8; // type:object size:0xD4 scope:global lbl_80571B90 = .bss:0x80571B90; // type:object size:0xD4 lbl_80571C64 = .bss:0x80571C64; // type:object size:0x68 lbl_80571E6C = .bss:0x80571E6C; // type:object size:0x68 @@ -21496,8 +21496,8 @@ lbl_805A8C68 = .sbss:0x805A8C68; // type:object size:0x4 data:4byte lbl_805A8C6C = .sbss:0x805A8C6C; // type:object size:0x1 data:byte lbl_805A8C70 = .sbss:0x805A8C70; // type:object size:0x4 data:4byte lbl_805A8C74 = .sbss:0x805A8C74; // type:object size:0x1 data:byte -lbl_805A8C78 = .sbss:0x805A8C78; // type:object size:0x1 data:byte -lbl_805A8C7C = .sbss:0x805A8C7C; // type:object size:0x4 data:4byte +gUseSurfaceHack = .sbss:0x805A8C78; // type:object size:0x1 data:byte +gSR_Hack = .sbss:0x805A8C7C; // type:object size:0x4 data:4byte lbl_805A8C80 = .sbss:0x805A8C80; // type:object size:0x1 data:byte lbl_805A8C81 = .sbss:0x805A8C81; // type:object size:0x1 data:byte lbl_805A8C84 = .sbss:0x805A8C84; // type:object size:0x4 data:float diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 03a4c3a5..88b45a67 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -25,7 +25,7 @@ RegisterResourceTweaks__5CMainFv = .text:0x8000367C; // type:function size:0x24 ResetGameState__5CMainFv = .text:0x800036A0; // type:function size:0x100 scope:global __as__12CGameOptionsFRC12CGameOptions = .text:0x800037A0; // type:function size:0x130 scope:global __as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator> = .text:0x800038D0; // type:function size:0xFC scope:global -__as__14CSystemOptionsFRC14CSystemOptions = .text:0x800039CC; // type:function size:0x1C0 scope:global +__as__12CSystemStateFRC12CSystemState = .text:0x800039CC; // type:function size:0x1C0 scope:global __as__Q24rstl63vector,Q24rstl17rmemory_allocator>FRCQ24rstl63vector,Q24rstl17rmemory_allocator> = .text:0x80003B8C; // type:function size:0xFC scope:global __as__Q24rstl24single_ptr<10CGameState>FP10CGameState = .text:0x80003C88; // type:function size:0x48 scope:global __dt__10CGameStateFv = .text:0x80003CD0; // type:function size:0x190 scope:global @@ -33,8 +33,8 @@ fn_80003E60 = .text:0x80003E60; // type:function size:0x8C scope:global fn_80003EEC = .text:0x80003EEC; // type:function size:0x98 scope:global __dt__12CGameOptionsFv = .text:0x80003F84; // type:function size:0xF0 scope:global __ct__12CGameOptionsFRC12CGameOptions = .text:0x80004074; // type:function size:0x164 scope:global -__dt__14CSystemOptionsFv = .text:0x800041D8; // type:function size:0x14C scope:global -__ct__14CSystemOptionsFRC14CSystemOptions = .text:0x80004324; // type:function size:0x180 scope:global +__dt__12CSystemStateFv = .text:0x800041D8; // type:function size:0x14C scope:global +__ct__12CSystemStateFRC12CSystemState = .text:0x80004324; // type:function size:0x180 scope:global StreamNewGameState__5CMainFR12CInputStreami = .text:0x800044A4; // type:function size:0xEC scope:global RefreshGameState__5CMainFv = .text:0x80004590; // type:function size:0x21C scope:global __dt__15CMemoryInStreamFv = .text:0x800047AC; // type:function size:0x60 scope:global @@ -359,15 +359,15 @@ UpdateMorphBallState__7CPlayerFfRC11CFinalInputR13CStateManager = .text:0x80014B ProcessInput__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x80014DD8; // type:function size:0x9B0 scope:global GetMaterial__19CCollisionPrimitiveCFv = .text:0x80015788; // type:function size:0x8 scope:global StartLandingControlFreeze__7CPlayerFv = .text:0x80015790; // type:function size:0x14 scope:global -ProcessFrozenInput__7CPlayerFfR13CStateManager = .text:0x800157A4; // type:function size:0xC0 scope:global +UpdateControlLostState__7CPlayerFfR13CStateManager = .text:0x800157A4; // type:function size:0xC0 scope:global EndLandingControlFreeze__7CPlayerFv = .text:0x80015864; // type:function size:0x14 scope:global UpdateFrozenState__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x80015878; // type:function size:0x1F4 scope:global wstring_l__4rstlFPCw = .text:0x80015A6C; // type:function size:0x3C scope:global -UnFreeze__7CPlayerFR13CStateManager = .text:0x80015AA8; // type:function size:0x2D0 scope:global +BreakFrozenState__7CPlayerFR13CStateManager = .text:0x80015AA8; // type:function size:0x2D0 scope:global GetFrozenState__7CPlayerCFv = .text:0x80015D78; // type:function size:0x18 scope:global -Freeze__7CPlayerFR13CStateManagerUiUsUi = .text:0x80015D90; // type:function size:0x19C scope:global +SetFrozenState__7CPlayerFR13CStateManagerUiUsUi = .text:0x80015D90; // type:function size:0x19C scope:global Think__7CPlayerFfR13CStateManager = .text:0x80015F2C; // type:function size:0x59C scope:global -UpdateWaterSurfaceCameraBias__7CPlayerFR13CStateManager = .text:0x800164C8; // type:function size:0xF4 scope:global +AdjustEyeOffset__7CPlayerFR13CStateManager = .text:0x800164C8; // type:function size:0xF4 scope:global PreThink__7CPlayerFfR13CStateManager = .text:0x800165BC; // type:function size:0x38 scope:global AcceptScriptMsg__7CPlayerF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x800165F4; // type:function size:0x824 scope:global UpdateCameraTimers__7CPlayerFfRC11CFinalInput = .text:0x80016E18; // type:function size:0x148 scope:global @@ -6203,7 +6203,7 @@ UpdateHalfPipeStatus__10CMorphBallFR13CStateManagerf = .text:0x800F1A58; // type RenderDamageEffects__10CMorphBallCFRC13CStateManagerRC12CTransform4f = .text:0x800F1C08; // type:function size:0x1C0 scope:global RenderIceBreakEffect__10CMorphBallCFRC13CStateManager = .text:0x800F1DC8; // type:function size:0x38 scope:global UpdateIceBreakEffect__10CMorphBallFf = .text:0x800F1E00; // type:function size:0x1D0 scope:global -Stop__10CMorphBallFv = .text:0x800F1FD0; // type:function size:0x58 scope:global +ResetMorphBallIceBreak__10CMorphBallFv = .text:0x800F1FD0; // type:function size:0x58 scope:global IsMorphBallTransitionFlashValid__10CMorphBallCFv = .text:0x800F2028; // type:function size:0x14 scope:global RenderMorphBallTransitionFlash__10CMorphBallCFRC13CStateManager = .text:0x800F203C; // type:function size:0x90 scope:global UpdateMorphBallTransitionFlash__10CMorphBallFf = .text:0x800F20CC; // type:function size:0x1D0 scope:global @@ -6361,7 +6361,7 @@ FluidFXThink__7CWeaponFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager = . Think__7CWeaponFfR13CStateManager = .text:0x80102154; // type:function size:0x140 scope:global SetDamageFalloffSpeed__7CWeaponFf = .text:0x80102294; // type:function size:0x1C scope:global __dt__7CWeaponFv = .text:0x801022B0; // type:function size:0x60 scope:global -__ct__7CWeaponF9TUniqueId7TAreaIdb9TUniqueId11EWeaponTypeRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4fRC15CMaterialFilterRC13CMaterialListRC11CDamageInfo17EProjectileAttribRC10CModelData = .text:0x80102310; // type:function size:0x1FC scope:global +__ct__7CWeaponF9TUniqueId7TAreaIdb9TUniqueId11EWeaponTypeRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC12CTransform4fRC15CMaterialFilterRC13CMaterialListRC11CDamageInfoiRC10CModelData = .text:0x80102310; // type:function size:0x1FC scope:global GetDeflectionType__20CDamageVulnerabilityCFRC11CWeaponMode = .text:0x8010250C; // type:function size:0x2C scope:global GetVulnerability__20CDamageVulnerabilityCFRC11CWeaponModei = .text:0x80102538; // type:function size:0xC8 scope:global WeaponHits__20CDamageVulnerabilityCFRC11CWeaponModei = .text:0x80102600; // type:function size:0x184 scope:global @@ -6937,7 +6937,7 @@ nullsub_209 = .text:0x8012E988; // type:function size:0x4 scope:global AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E98C; // type:function size:0x54 scope:global AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fRC9CVector3fRC12CScriptWaterR13CStateManagerRC9CVector3f = .text:0x8012E9E0; // type:function size:0xC4 scope:global AddRipple__11CFluidPlaneFf9TUniqueIdRC9CVector3fR13CStateManager = .text:0x8012EAA4; // type:function size:0xA0 scope:global -ProjectRippleVelocity__11CFluidPlaneCFff = .text:0x8012EB44; // type:function size:0x50 scope:global +GetRippleScaleFromKineticEnergy__11CFluidPlaneFff = .text:0x8012EB44; // type:function size:0x50 scope:global CalculateRippleIntensity__11CFluidPlaneCFf = .text:0x8012EB94; // type:function size:0xC4 scope:global __dt__11CFluidPlaneFv = .text:0x8012EC58; // type:function size:0x158 scope:global __ct__11CFluidPlaneFUiUiUifQ211CFluidPlane10EFluidTypefRC14CFluidUVMotion = .text:0x8012EDB0; // type:function size:0x364 scope:global @@ -9006,8 +9006,8 @@ StateForWorld__10CGameStateFUi = .text:0x801D3A54; // type:function size:0x104 s __ct__11CWorldStateFRC11CWorldState = .text:0x801D3B58; // type:function size:0xD8 scope:global WriteBackupBuf__10CGameStateFv = .text:0x801D3C30; // type:function size:0x68 scope:global resize__Q24rstl37vectorFiRCUc = .text:0x801D3C98; // type:function size:0xEC scope:global -ExportPersistentOptions__10CGameStateFR14CSystemOptions = .text:0x801D3D84; // type:function size:0x1C4 scope:global -ImportPersistentOptions__10CGameStateFRC14CSystemOptions = .text:0x801D3F48; // type:function size:0x150 scope:global +ExportPersistentOptions__10CGameStateFR12CSystemState = .text:0x801D3D84; // type:function size:0x1C4 scope:global +ImportPersistentOptions__10CGameStateFRC12CSystemState = .text:0x801D3F48; // type:function size:0x150 scope:global WriteSystemOptions__10CGameStateFR13COutputStream = .text:0x801D4098; // type:function size:0x24 scope:global ReadSystemOptions__10CGameStateFR12CInputStream = .text:0x801D40BC; // type:function size:0x48 scope:global PutTo__10CGameStateCFR13COutputStream = .text:0x801D4104; // type:function size:0x1CC scope:global @@ -9030,28 +9030,28 @@ GetWorldAssetId__11CWorldStateCFv = .text:0x801D4E0C; // type:function size:0x8 PutTo__11CWorldStateFR16CMemoryStreamOut = .text:0x801D4E14; // type:function size:0xA0 scope:global __ct__11CWorldStateFR12CInputStreamPCvR18CWorldSaveGameInfo = .text:0x801D4EB4; // type:function size:0x238 scope:global __ct__11CWorldStateFUi = .text:0x801D50EC; // type:function size:0x138 scope:global -SetAutoMapperKeyState__14CSystemOptionsFi = .text:0x801D5224; // type:function size:0x8 scope:global -SetAllItemsCollected__14CSystemOptionsFb = .text:0x801D522C; // type:function size:0x10 scope:global -SetHasFusion__14CSystemOptionsFb = .text:0x801D523C; // type:function size:0x10 scope:global +SetAutoMapperKeyState__12CSystemStateFi = .text:0x801D5224; // type:function size:0x8 scope:global +SetAllItemsCollected__12CSystemStateFb = .text:0x801D522C; // type:function size:0x10 scope:global +SetHasFusion__12CSystemStateFb = .text:0x801D523C; // type:function size:0x10 scope:global fn_801D51D0 = .text:0x801D524C; // type:function size:0x10 scope:global -SetHardModeBeat__14CSystemOptionsFb = .text:0x801D525C; // type:function size:0x10 scope:global -SetHasHardMode__14CSystemOptionsFb = .text:0x801D526C; // type:function size:0x10 scope:global -SetLogScanCount__14CSystemOptionsFi = .text:0x801D527C; // type:function size:0x8 scope:global -GetLogScanCount__14CSystemOptionsFv = .text:0x801D5284; // type:function size:0x8 scope:global +SetHardModeBeat__12CSystemStateFb = .text:0x801D525C; // type:function size:0x10 scope:global +SetHasHardMode__12CSystemStateFb = .text:0x801D526C; // type:function size:0x10 scope:global +SetLogScanCount__12CSystemStateFi = .text:0x801D527C; // type:function size:0x8 scope:global +GetLogScanCount__12CSystemStateFv = .text:0x801D5284; // type:function size:0x8 scope:global fn_801D5210 = .text:0x801D528C; // type:function size:0x10 scope:global -IncrementPowerBombAmmoCount__14CSystemOptionsFv = .text:0x801D529C; // type:function size:0x34 scope:global -GetShowPowerBombAmmoMessage__14CSystemOptionsCFv = .text:0x801D52D0; // type:function size:0x1C scope:global -IncrementFrozenBallCount__14CSystemOptionsFv = .text:0x801D52EC; // type:function size:0x34 scope:global -GetShowFrozenBallMessage__14CSystemOptionsCFv = .text:0x801D5320; // type:function size:0x1C scope:global -IncrementFrozenFpsCount__14CSystemOptionsFv = .text:0x801D533C; // type:function size:0x34 scope:global -GetShowFrozenFpsMessage__14CSystemOptionsCFv = .text:0x801D5370; // type:function size:0x1C scope:global -SetCinematicState__14CSystemOptionsFUi9TEditorIdb = .text:0x801D538C; // type:function size:0x130 scope:global +IncrementPowerBombAmmoCount__12CSystemStateFv = .text:0x801D529C; // type:function size:0x34 scope:global +GetShowPowerBombAmmoMessage__12CSystemStateCFv = .text:0x801D52D0; // type:function size:0x1C scope:global +IncrementFrozenBallCount__12CSystemStateFv = .text:0x801D52EC; // type:function size:0x34 scope:global +GetShowFrozenBallMessage__12CSystemStateCFv = .text:0x801D5320; // type:function size:0x1C scope:global +IncNumFreezeInstructionsPrintedFirstPerson__12CSystemStateFv = .text:0x801D533C; // type:function size:0x34 scope:global +GetShowFrozenFpsMessage__12CSystemStateCFv = .text:0x801D5370; // type:function size:0x1C scope:global +SetCinematicState__12CSystemStateFUi9TEditorIdb = .text:0x801D538C; // type:function size:0x130 scope:global fn_801D5440 = .text:0x801D54BC; // type:function size:0x4C scope:global fn_801D548C = .text:0x801D5508; // type:function size:0x9C scope:global -GetCinematicState__14CSystemOptionsCFQ24rstl19pair = .text:0x801D55A4; // type:function size:0x68 scope:global -PutTo__14CSystemOptionsFR13COutputStream = .text:0x801D560C; // type:function size:0x3D8 scope:global -__ct__14CSystemOptionsFR12CInputStream = .text:0x801D59E4; // type:function size:0x5A0 scope:global -__ct__14CSystemOptionsFv = .text:0x801D5F84; // type:function size:0x1A8 scope:global +GetCinematicState__12CSystemStateCFQ24rstl19pair = .text:0x801D55A4; // type:function size:0x68 scope:global +PutTo__12CSystemStateFR13COutputStream = .text:0x801D560C; // type:function size:0x3D8 scope:global +__ct__12CSystemStateFR12CInputStream = .text:0x801D59E4; // type:function size:0x5A0 scope:global +__ct__12CSystemStateFv = .text:0x801D5F84; // type:function size:0x1A8 scope:global fn_801D60B0 = .text:0x801D612C; // type:function size:0x20 scope:global Clamp__5CMathFRCdRCdRCd = .text:0x801D614C; // type:function size:0x2C scope:global fn_801D60FC = .text:0x801D6178; // type:function size:0x100 scope:global @@ -19446,7 +19446,7 @@ lbl_8057194C = .bss:0x80571B2C; // type:object size:0x40 scope:global data:byte lbl_8057198C = .bss:0x80571B6C; // type:object size:0x40 scope:global data:byte lbl_805719CC = .bss:0x80571BAC; // type:object size:0x10 scope:global lbl_805719DC = .bss:0x80571BBC; // type:object size:0xC scope:global data:float -skChargedShotCameraShakeData__16CCameraShakeData = .bss:0x80571BC8; // type:object size:0x27C scope:global +skHardRecoil__16CCameraShakeData = .bss:0x80571BC8; // type:object size:0x27C scope:global lbl_80571ABC = .bss:0x80571C9C; // type:object size:0xD4 scope:global lbl_80571B90 = .bss:0x80571D70; // type:object size:0xD4 scope:global lbl_80571C64 = .bss:0x80571E44; // type:object size:0x3A8 scope:global diff --git a/include/Kyoto/Audio/CSfxManager.hpp b/include/Kyoto/Audio/CSfxManager.hpp index ff4310ab..dbdea6fe 100644 --- a/include/Kyoto/Audio/CSfxManager.hpp +++ b/include/Kyoto/Audio/CSfxManager.hpp @@ -210,7 +210,7 @@ public: static void SetDuration(CSfxHandle handle, float duration); static ushort GetReverbAmount(); - static CSfxHandle SfxStart(const ushort id, const short vol = 127, const short pan = 64, + static CSfxHandle SfxStart(ushort id, const short vol = 127, const short pan = 64, const bool useAcoustics = false, const short prio = kMedPriority, const bool looped = false, const int areaId = kAllAreas); static void SfxStop(CSfxHandle handle); diff --git a/include/Kyoto/Math/CMath.hpp b/include/Kyoto/Math/CMath.hpp index 1c51f3b9..8a7e2810 100644 --- a/include/Kyoto/Math/CMath.hpp +++ b/include/Kyoto/Math/CMath.hpp @@ -19,7 +19,7 @@ public: template < typename T > static const T& Clamp(const T& min, const T& val, const T& max); static float SqrtF(float v); - static inline float Limit(float v, float h) { return fabs(v) > h ? h * Sign(v) : v; } + static inline float Limit(float v, float h) { if (fabs(v) > h) return h * Sign(v); return v; } static inline float Sign(float v) { return FastFSel(v, 1.f, -1.f); } #ifdef __MWERKS__ static inline float FastFSel(register float v, register float h, register float l) { @@ -72,7 +72,16 @@ public: static CVector3f BaryToWorld(const CVector3f& p0, const CVector3f& p1, const CVector3f& p2, const CVector3f& bary); // GetCatmullRomSplinePoint__5CMathFRC9CVector3fRC9CVector3fRC9CVector3fRC9CVector3ff global - // FastSqrtF__5CMathFf weak +#ifdef __MWERKS__ + static inline float FastSqrtF(register float x) { + if (x == 0.f) { + return 0.f; + } + return x * __frsqrte(x); + } +#else + static inline float FastSqrtF(float x) { return sqrtf(x); } +#endif static double SqrtD(double x); // IsEpsilon__5CMathFfff global // FastMin__5CMathFff weak diff --git a/include/MetroidPrime/ActorCommon.hpp b/include/MetroidPrime/ActorCommon.hpp index f7516dc5..3e29455f 100644 --- a/include/MetroidPrime/ActorCommon.hpp +++ b/include/MetroidPrime/ActorCommon.hpp @@ -97,27 +97,6 @@ enum EWeaponCollisionResponseTypes { kWCR_AtomicBetaReflect, kWCR_AtomicAlphaReflect, }; -enum EProjectileAttrib { - kPA_None = 0, - kPA_PartialCharge = (1 << 0), - kPA_PlasmaProjectile = (1 << 1), - kPA_Charged = (1 << 2), - kPA_Ice = (1 << 3), - kPA_Wave = (1 << 4), - kPA_Plasma = (1 << 5), - kPA_Phazon = (1 << 6), - kPA_ComboShot = (1 << 7), - kPA_Bombs = (1 << 8), - kPA_PowerBombs = (1 << 9), - kPA_BigProjectile = (1 << 10), - kPA_ArmCannon = (1 << 11), - kPA_BigStrike = (1 << 12), - kPA_DamageFalloff = (1 << 13), - kPA_StaticInterference = (1 << 14), - kPA_PlayerUnFreeze = (1 << 15), - kPA_ParticleOPTS = (1 << 16), - kPA_KeepInCinematic = (1 << 17), -}; enum EUserEventType { kUE_Projectile = 0, kUE_EggLay = 1, diff --git a/include/MetroidPrime/CActor.hpp b/include/MetroidPrime/CActor.hpp index 57d5a467..e8fe2d4c 100644 --- a/include/MetroidPrime/CActor.hpp +++ b/include/MetroidPrime/CActor.hpp @@ -82,7 +82,7 @@ public: virtual CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const; virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&, - int /*EProjectileAttrib?*/) const; + int) const; virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&); virtual void OnScanStateChange(EScanState, CStateManager&); virtual CAABox GetSortingBounds(const CStateManager&) const; diff --git a/include/MetroidPrime/CCollisionActor.hpp b/include/MetroidPrime/CCollisionActor.hpp index c212c14f..95ed010f 100644 --- a/include/MetroidPrime/CCollisionActor.hpp +++ b/include/MetroidPrime/CCollisionActor.hpp @@ -45,7 +45,7 @@ public: CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const override; EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&, - int /*EProjectileAttrib?*/) const override; + int) const override; void OnScanStateChange(EScanState, CStateManager&) override; // CPhysicsActor diff --git a/include/MetroidPrime/CFluidPlane.hpp b/include/MetroidPrime/CFluidPlane.hpp index 4fd4ce01..5ec12543 100644 --- a/include/MetroidPrime/CFluidPlane.hpp +++ b/include/MetroidPrime/CFluidPlane.hpp @@ -25,7 +25,12 @@ public: class CFluidPlane { public: enum EFluidType { - // TODO + kFT_NormalWater, + kFT_PoisonWater, + kFT_Lava, + kFT_PhazonFluid, + kFT_Four, + kFT_ThickLava }; CFluidPlane(uint, uint, uint, CFluidPlane::EFluidType, float, const CFluidUVMotion&); @@ -37,6 +42,8 @@ public: const CVector3f& upVec); // Update__11CFluidPlaneFv + float GetRippleScaleFromKineticEnergy(float baseI, float velDot); + float GetAlpha() const { return x40_alpha; } EFluidType GetFluidType() const { return x44_fluidType; } const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; } diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index 8b960ca3..f8341c1c 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -192,6 +192,7 @@ public: const CFluidPlaneManager* GetFluidPlaneManager() const { return x87c_fluidPlaneManager; } CWorldTransManager* WorldTransManager() { return x8c4_worldTransManager.GetPtr(); } const CWorldTransManager* GetWorldTransManager() const { return x8c4_worldTransManager.GetPtr(); } + EGameState GetGameState() const { return x904_gameState; } CRandom16* Random() const { return x900_random; } uint GetUpdateFrameIndex() const { return x8d8_updateFrameIdx; } diff --git a/include/MetroidPrime/Cameras/CCameraManager.hpp b/include/MetroidPrime/Cameras/CCameraManager.hpp index 42b7b4d8..2ed5b463 100644 --- a/include/MetroidPrime/Cameras/CCameraManager.hpp +++ b/include/MetroidPrime/Cameras/CCameraManager.hpp @@ -87,6 +87,7 @@ public: void DeleteCameraHint(TUniqueId uid, CStateManager& mgr); void ReallyRemoveCameraHint(TUniqueId uid, CStateManager& mgr); // SetSpecialCameras__14CCameraManagerFR18CFirstPersonCameraR11CBallCamera + void ResetCameraHint(CStateManager& mgr); void SetCurrentFov(float fov) { x3bc_curFov = fov; } @@ -105,6 +106,9 @@ public: void SetSpindleCamera(TUniqueId id, CStateManager& mgr); TUniqueId GetSpindleCameraId() const; + CBallCamera* BallCamera() const { return x80_ballCamera; } + const CBallCamera* GetBallCamera() const { return x80_ballCamera; } + static float GetDefaultThirdPersonVerticalFOV(); static float GetDefaultFirstPersonVerticalFOV(); static float GetDefaultFirstPersonNearClipDistance(); diff --git a/include/MetroidPrime/Cameras/CCameraShakeData.hpp b/include/MetroidPrime/Cameras/CCameraShakeData.hpp index eaf0a224..c1473de0 100644 --- a/include/MetroidPrime/Cameras/CCameraShakeData.hpp +++ b/include/MetroidPrime/Cameras/CCameraShakeData.hpp @@ -68,14 +68,36 @@ public: float GetSomething() const; float GetSomething2() const; - float GetDuration() const { return x0_duration; } + // From MP1R + float GetAttenuatedMagnitude() const; + float GetMaxAmplitude() const; + float GetMaxSeverity() const; + bool IsSingleDirection() const; + void ResetTime(); + void SetAttenuation(float, CVector3f); + void SetTranslation(const CVector3f&); + + static CCameraShakeData HardBothAxesShake(float duration, float); + static CCameraShakeData HardHorizShake(float duration, float); + static CCameraShakeData HardHorizShakeDistance(float duration, float, float, CVector3f); + static CCameraShakeData HardVertShake(float duration, float); + static CCameraShakeData HardVertShakeDistance(float duration, float, float, CVector3f); + static CCameraShakeData SoftBothAxesShake(float duration, float); + static CCameraShakeData SoftHorizShake(float duration, float); + static CCameraShakeData SoftHorizShakeDistance(float duration, float, float, CVector3f); + static CCameraShakeData SoftVertShake(float duration, float); + static CCameraShakeData SoftVertShakeDistance(float duration, float, float, CVector3f); + static CCameraShakeData VerticalOverrideShake(float duration); + + float GetDuration() const { return x0_duration; } // In MP1R, returns either x0 or xec? float GetCurTime() const { return x4_curTime; } CVector3f GetPoint() const; // { return xc4_sfxPos; } - bool Done() const { return x4_curTime >= x0_duration; } + bool Done() const { return x4_curTime >= x0_duration; } // Finished in MP1R uint GetFlags() const { return xc0_flags; } const CVector3f& GetSfxPos() const { return xc4_sfxPos; } - static CCameraShakeData skChargedShotCameraShakeData; + static CCameraShakeData skSoftRecoil; + static CCameraShakeData skHardRecoil; private: float x0_duration; diff --git a/include/MetroidPrime/Enemies/CPatterned.hpp b/include/MetroidPrime/Enemies/CPatterned.hpp index efa7afa0..bd48af8a 100644 --- a/include/MetroidPrime/Enemies/CPatterned.hpp +++ b/include/MetroidPrime/Enemies/CPatterned.hpp @@ -168,7 +168,7 @@ public: CVector3f GetAimPosition(const CStateManager&, float) const override; EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&, - int /*EProjectileAttrib?*/) const override; + int) const override; void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override; diff --git a/include/MetroidPrime/HUD/CSamusHud.hpp b/include/MetroidPrime/HUD/CSamusHud.hpp index 56ebb2f9..245cb46d 100644 --- a/include/MetroidPrime/HUD/CSamusHud.hpp +++ b/include/MetroidPrime/HUD/CSamusHud.hpp @@ -10,6 +10,9 @@ class CSamusHud { public: static void DisplayHudMemo(const rstl::wstring& text, const CHUDMemoParms& info); + static void ClearHudMemo() { + DisplayHudMemo(rstl::wstring_l(L""), CHUDMemoParms(0.f, true, true, true)); + } }; #endif // _CSAMUSHUD diff --git a/include/MetroidPrime/Player/CGameState.hpp b/include/MetroidPrime/Player/CGameState.hpp index c9a7ab7a..daffe8a2 100644 --- a/include/MetroidPrime/Player/CGameState.hpp +++ b/include/MetroidPrime/Player/CGameState.hpp @@ -6,7 +6,7 @@ #include "MetroidPrime/Player/CGameOptions.hpp" #include "MetroidPrime/Player/CHintOptions.hpp" #include "MetroidPrime/Player/CPlayerState.hpp" -#include "MetroidPrime/Player/CSystemOptions.hpp" +#include "MetroidPrime/Player/CSystemState.hpp" #include "MetroidPrime/Player/CWorldState.hpp" #include "MetroidPrime/Player/CWorldTransManager.hpp" #include "MetroidPrime/TGameTypes.hpp" @@ -32,10 +32,10 @@ public: CWorldState& CurrentWorldState(); - void ImportPersistentOptions(const CSystemOptions&); - void ExportPersistentOptions(CSystemOptions&); + void ImportPersistentOptions(const CSystemState&); + void ExportPersistentOptions(CSystemState&); - CSystemOptions& SystemOptions() { return xa8_systemOptions; } + CSystemState& SystemState() { return xa8_systemState; } CGameOptions& GameOptions() { return x17c_gameOptions; } CHintOptions& HintOptions() { return x1f8_hintOptions; } uint& SaveIdx() { return x20c_saveIdx; } @@ -68,7 +68,7 @@ private: rstl::rc_ptr< CPlayerState > x98_playerState; rstl::rc_ptr< CWorldTransManager > x9c_transManager; double xa0_playTime; - CSystemOptions xa8_systemOptions; + CSystemState xa8_systemState; CGameOptions x17c_gameOptions; CHintOptions x1f8_hintOptions; uint x20c_saveIdx; diff --git a/include/MetroidPrime/Player/CMorphBall.hpp b/include/MetroidPrime/Player/CMorphBall.hpp index cf46876d..a25e0b02 100644 --- a/include/MetroidPrime/Player/CMorphBall.hpp +++ b/include/MetroidPrime/Player/CMorphBall.hpp @@ -30,14 +30,103 @@ public: float GetBallRadius() const; - EBallBoostState GetBallBoostState() const; // { return x1e3c_boostState; } + EBallBoostState GetBallBoostState() const; void SetBallBoostState(EBallBoostState state); - EBombJumpState GetBombJumpState() const; // { return x1e40_bombJumpState; } + EBombJumpState GetBombJumpState() const; void SetBombJumpState(EBombJumpState state); void LoadMorphBallModel(CStateManager& mgr); void Update(float dt, CStateManager& mgr); void StopSounds(); void UpdateEffects(float dt, CStateManager& mgr); + void SetBallLightActive(CStateManager& mgr, const bool active); + // GetBallToWorld__10CMorphBallCFv global + // GetBallRadius__10CMorphBallCFv global + // TakeDamage__10CMorphBallFf global + // IsProjectile__10CMorphBallCFv weak + // LeaveMorphBallState__10CMorphBallFR13CStateManager global + // LeaveBoosting__10CMorphBallFv global + // CancelBoosting__10CMorphBallFv global + // InSpiderMode__10CMorphBallCFv weak + // SetAsProjectile__10CMorphBallFRC11CDamageInfoRC11CDamageInfo global + // CollidedWith__10CMorphBallFRC9TUniqueIdRC18CCollisionInfoListR13CStateManager global + // SwitchToMarble__10CMorphBallFv global + bool GetIsInHalfPipeMode() const; + // DampLinearAndAngularVelocities__10CMorphBallFff global + // IsClimbable__10CMorphBallCFRC14CCollisionInfo global + // FluidFXThink__10CMorphBallFQ26CActor11EFluidStateR12CScriptWaterR13CStateManager global + // GetCollidableSphere__10CMorphBallCFv weak + // DrawCollisionPrimitive__10CMorphBallCFv global + // GetPrimitiveTransform__10CMorphBallCFv global + // TouchModel__10CMorphBallCFRC13CStateManager global + // Render__10CMorphBallCFRC13CStateManagerPC12CActorLights global + // RenderDamageEffects__10CMorphBallCFRC13CStateManagerRC12CTransform4f global + // RenderSpiderBallElectricalEffects__10CMorphBallCFv global + // RenderEnergyDrainEffects__10CMorphBallCFRC13CStateManager global + // RenderMorphBallTransitionFlash__10CMorphBallCFRC13CStateManager global + // GetModel__10CMorphBallCFv weak + // GetBallContactSurfaceNormal__10CMorphBallCFv weak + // PreRender__10CMorphBallFR13CStateManagerRC14CFrustumPlanes global + // IsInFrustum__10CMorphBallCFRC14CFrustumPlanes global + // GetBallTouchRadius__10CMorphBallCFv global + // Touch__10CMorphBallFR6CActorR13CStateManager global + void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); + // DeleteLight__10CMorphBallFR13CStateManager global + // EnterMorphBallState__10CMorphBallFR13CStateManager + // GetSwooshToWorld__10CMorphBallCFv global + // IsMorphBallTransitionFlashValid__10CMorphBallCFv global + // AddSpiderBallElectricalEffect__10CMorphBallFv global + // UpdateSpiderBallElectricalEffects__10CMorphBallFv global + // UpdateMorphBallTransitionFlash__10CMorphBallFf global + // DisableHalfPipeStatus__10CMorphBallFv global + // SetIsInHalfPipeMode__10CMorphBallFb global + // SetIsInHalfPipeModeInAir__10CMorphBallFb global + // SetTouchedHalfPipeRecently__10CMorphBallFb global + // ResetMorphBallTransitionFlash__10CMorphBallFv global + // CreateSpiderBallParticles__10CMorphBallFRC9CVector3fRC9CVector3f global + ESpiderBallState GetSpiderBallState() const { return x187c_spiderBallState; } + // GetMorphBallModel__10CMorphBallFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>f global + // LoadAnimationTokens__10CMorphBallFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator> global + // IsBoosting__10CMorphBallCFv weak + // GetBoostChargeTimer__10CMorphBallCFv weak + // GetWallBumpCounter__10CMorphBallCFv weak + // GetBallContactMaterials__10CMorphBallCFv weak + void ComputeBallMovement(const CFinalInput&, CStateManager&, float); + // ComputeBoostBallMovement__10CMorphBallFRC11CFinalInputRC13CStateManagerf global + // IsMovementAllowed__10CMorphBallCFv global + // EnterBoosting__10CMorphBallFv global + // SwitchToTire__10CMorphBallFv global + // ComputeMarioMovement__10CMorphBallFRC11CFinalInputR13CStateManagerf global + // SetSpiderBallState__10CMorphBallFQ210CMorphBall16ESpiderBallState weak + // UpdateSpiderBall__10CMorphBallFRC11CFinalInputR13CStateManagerf global + // CheckForSwitchToSpiderBallSwinging__10CMorphBallCFR13CStateManager global + // FindClosestSpiderBallWaypoint__10CMorphBallCFR13CStateManagerRC9CVector3fR9CVector3fR9CVector3fR9CVector3fRfR9CVector3fRbR12CTransform4f global + // SetSpiderBallSwingingState__10CMorphBallFb global + // ResetSpiderBallSwingControllerMovementTimer__10CMorphBallFv global + // ApplySpiderBallSwingingForces__10CMorphBallFRC11CFinalInputR13CStateManagerf global + // GetSpiderBallControllerMovement__10CMorphBallCFRC11CFinalInputbb global + // UpdateSpiderBallSwingControllerMovementTimer__10CMorphBallFff global + // GetSpiderBallSwingControllerMovementScalar__10CMorphBallCFv global + // ApplySpiderBallRollForces__10CMorphBallFRC11CFinalInputR13CStateManagerf global + // CalculateSpiderBallAttractionSurfaceForces__10CMorphBallCFRC11CFinalInputR13CStateManagerRC12CTransform4f global + // ForwardInput__10CMorphBallCFRC11CFinalInput global + // BallTurnInput__10CMorphBallCFRC11CFinalInput global + // ComputeMaxSpeed__10CMorphBallCFv global + bool GetIsInHalfPipeModeInAir() const; + // GetTouchedHalfPipeRecently__10CMorphBallCFv global + // ComputeLiftForces__10CMorphBallFRC9CVector3fRC9CVector3fRC13CStateManager global + void UpdateBallDynamics(CStateManager&, float); + // BallCloseToCollision__10CMorphBallCFRC13CStateManagerf global + // UpdateHalfPipeStatus__10CMorphBallFR13CStateManagerf global + // CalculateSurfaceToWorld__10CMorphBallCFRC9CVector3fRC9CVector3fRC9CVector3f global + // UpdateMarbleDynamics__10CMorphBallFR13CStateManagerfRC9CVector3f global + // SpinToSpeed__10CMorphBallFfRC9CVector3ff global + // GetMinimumAlignmentSpeed__10CMorphBallCFv global + // CalculateBallContactInfo__10CMorphBallCFR9CVector3fR9CVector3f global + // CalculateSurfaceFriction__10CMorphBallCFv global + // ApplyFriction__10CMorphBallFf global + // ApplyGravity__10CMorphBallFR13CStateManager global + void Land(); + void ResetMorphBallIceBreak(); private: struct CSpiderBallElectricityManager { diff --git a/include/MetroidPrime/Player/CPlayer.hpp b/include/MetroidPrime/Player/CPlayer.hpp index 150f59e2..1c4367a5 100644 --- a/include/MetroidPrime/Player/CPlayer.hpp +++ b/include/MetroidPrime/Player/CPlayer.hpp @@ -28,22 +28,6 @@ enum EPlayerMovementState { }; }; -enum EPlayerOrbitRequest { - kOR_StopOrbit, - kOR_Respawn, - kOR_EnterMorphBall, - kOR_Default, - kOR_Four, - kOR_Five, - kOR_InvalidateTarget, - kOR_BadVerticalAngle, - kOR_ActivateOrbitSource, - kOR_ProjectileCollide, - kOR_Freeze, - kOR_DamageOnGrapple, - kOR_LostGrappleLineOfSight, -}; - class CPlayer : public CPhysicsActor, public TOneStatic< CPlayer > { struct CVisorSteam { float x0_curTargetAlpha; @@ -156,6 +140,21 @@ public: kGH_Drawn, kGH_Holstering, }; + enum EOrbitBrokenType { + kOB_StopOrbit, + kOB_Respawn, + kOB_EnterMorphBall, + kOB_Default, + kOB_Four, + kOB_Five, + kOB_InvalidateTarget, + kOB_BadVerticalAngle, + kOB_ActivateOrbitSource, + kOB_ProjectileCollide, + kOB_Freeze, + kOB_DamageOnGrapple, + kOB_LostGrappleLineOfSight, + }; CPlayer(TUniqueId uid, const CTransform4f& xf, const CAABox& aabb, CAssetId resId, const CVector3f& playerScale, float mass, float stepUp, float stepDown, float ballRadius, @@ -213,12 +212,16 @@ public: void DecrementPhazon(); // GetMovementDirection2D__7CPlayerCFv ?? void SetOrbitTargetId(TUniqueId id, CStateManager& mgr); - void SetOrbitRequestForTarget(TUniqueId id, EPlayerOrbitRequest req, CStateManager& mgr); + void TryToBreakOrbit(TUniqueId id, EOrbitBrokenType type, CStateManager& mgr); + void BreakOrbit(EOrbitBrokenType type, CStateManager& mgr); + void BreakGrapple(EOrbitBrokenType type, CStateManager& mgr); void AddOrbitDisableSource(CStateManager& mgr, TUniqueId addId); void RemoveOrbitDisableSource(TUniqueId uid); void SetAimTargetId(TUniqueId target); void DoSfxEffects(CSfxHandle sfx); - void UnFreeze(CStateManager& mgr); + bool GetFrozenState() const; + void SetFrozenState(CStateManager& stateMgr, CAssetId steamTxtr, ushort sfx, CAssetId iceTxtr); + void BreakFrozenState(CStateManager& mgr); void UpdateCinematicState(CStateManager& mgr); bool IsMorphBallTransitioning() const; void InitialiseAnimation(); @@ -260,6 +263,35 @@ public: float GetActualFirstPersonMaxVelocity(float dt) const; const CScriptWater* GetVisorRunoffEffect(const CStateManager& mgr) const; void SetMorphBallState(EPlayerMorphBallState state, CStateManager& mgr); + bool CanLeaveMorphBallState(CStateManager& mgr, CVector3f& pos) const; + void LeaveMorphBallState(CStateManager& mgr); + void EnterMorphBallState(CStateManager& mgr); + void ResetBallCamera(CStateManager& mgr); + void UpdateCameraState(CStateManager& mgr); + void UpdateFreeLookState(const CFinalInput& input, float dt, CStateManager& mgr); + void UpdateCameraTimers(float dt, const CFinalInput& input); + void UpdateSubmerged(const CStateManager& mgr); + bool CheckSubmerged(); + void SetMoveState(NPlayer::EPlayerMovementState state, CStateManager& mgr); + void StartLandingControlFreeze(); // name? + void EndLandingControlFreeze(); // name? + void AdjustEyeOffset(CStateManager& mgr); + void SetEyeOffset(float bias); + float GetEyeOffset() const { return x9c8_eyeZBias; } + void UpdateStepUpSmoothing(float dt); + void UpdateEnvironmentDamageCameraShake(float dt, CStateManager& mgr); + void UpdatePhazonDamage(float dt, CStateManager& mgr); + void UpdateFreeLook(float dt); + void UpdatePlayerHints(CStateManager& mgr); + void UpdateBombJumpStuff(); + void UpdateTransitionFilter(float dt, CStateManager& mgr); + void CalculatePlayerMovementDirection(float dt); + void UpdatePlayerControlDirection(float dt, CStateManager& mgr); + void UpdateFrozenState(const CFinalInput& input, CStateManager& mgr); + void UpdateControlLostState(float dt, CStateManager& mgr); + void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float dt); + void ProcessInput(const CFinalInput& input, CStateManager& mgr); + void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float dt); CPlayerGun* PlayerGun() { return x490_gun.get(); } const CPlayerGun* GetPlayerGun() const { return x490_gun.get(); } @@ -287,6 +319,8 @@ public: EGunHolsterState GetGunHolsterState() const { return x498_gunHolsterState; } NPlayer::EPlayerMovementState GetPlayerMovementState() const { return x258_movementState; } const CVector3f& GetAssistedTargetAim() const { return x480_assistedTargetAim; } + // CPlayer::GetFlipSpiderBallControlY() const weak + // CPlayer::GetFlipSpiderBallControlX() const weak bool IsInsideFluid() const { return x9c4_31_inWaterMovement; } @@ -320,13 +354,13 @@ private: float x28c_sjTimer; float x290_minJumpTimeout; float x294_jumpCameraTimer; - uint x298_jumpPresses; + int x298_jumpPresses; float x29c_fallCameraTimer; float x2a0_; bool x2a4_cancelCameraPitch; float x2a8_timeSinceJump; ESurfaceRestraints x2ac_surfaceRestraint; - uint x2b0_outOfWaterTicks; + int x2b0_outOfWaterTicks; rstl::reserved_vector< float, 6 > x2b4_accelerationTable; uint x2d0_curAcceleration; float x2d4_accelerationChangeTimer; @@ -338,7 +372,7 @@ private: float x300_fallingTime; EPlayerOrbitState x304_orbitState; EPlayerOrbitType x308_orbitType; - EPlayerOrbitRequest x30c_orbitRequest; + EOrbitBrokenType x30c_orbitBrokenType; TUniqueId x310_orbitTargetId; CVector3f x314_orbitPoint; CVector3f x320_orbitVector; diff --git a/include/MetroidPrime/Player/CSystemOptions.hpp b/include/MetroidPrime/Player/CSystemState.hpp similarity index 76% rename from include/MetroidPrime/Player/CSystemOptions.hpp rename to include/MetroidPrime/Player/CSystemState.hpp index 3df3c6d8..1f3ad12f 100644 --- a/include/MetroidPrime/Player/CSystemOptions.hpp +++ b/include/MetroidPrime/Player/CSystemState.hpp @@ -1,5 +1,5 @@ -#ifndef _CSYSTEMOPTIONS -#define _CSYSTEMOPTIONS +#ifndef _CSYSTEMSTATE +#define _CSYSTEMSTATE #include "types.h" @@ -9,11 +9,11 @@ #include "rstl/reserved_vector.hpp" #include "rstl/vector.hpp" -class CSystemOptions { +class CSystemState { public: - CSystemOptions(); - explicit CSystemOptions(CInputStream&); - ~CSystemOptions(); + CSystemState(); + explicit CSystemState(CInputStream&); + ~CSystemState(); void PutTo(COutputStream&) const; void SetHasFusion(bool v); @@ -28,6 +28,11 @@ public: bool GetAllItemsCollected() const { return xd0_29_allItemsCollected; } void SetAllItemsCollected(bool); + // MP1R + bool AreFreezeInstructionsStillEnabledFirstPerson() const; + bool AreFreezeInstructionsStillEnabledMorphBall() const; + void IncNumFreezeInstructionsPrintedFirstPerson(); + private: rstl::reserved_vector< uchar, 98 > x0_nesState; rstl::reserved_vector< bool, 64 > x68_; @@ -45,4 +50,4 @@ private: bool xd0_29_allItemsCollected : 1; }; -#endif // _CSYSTEMOPTIONS +#endif // _CSYSTEMSTATE diff --git a/include/MetroidPrime/ScriptObjects/CScriptDamageableTrigger.hpp b/include/MetroidPrime/ScriptObjects/CScriptDamageableTrigger.hpp index 0d4882a6..69bc5e5e 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptDamageableTrigger.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptDamageableTrigger.hpp @@ -28,7 +28,7 @@ public: void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&, - int /*EProjectileAttrib?*/) const override; + int) const override; void Render(const CStateManager& mgr) const override; void AddToRenderer(const CFrustumPlanes& frustum, const CStateManager& mgr) const override; void PreRender(CStateManager& mgr, const CFrustumPlanes& frustum) override; diff --git a/include/MetroidPrime/ScriptObjects/CScriptWater.hpp b/include/MetroidPrime/ScriptObjects/CScriptWater.hpp index 6a5466fa..c7c3c96e 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptWater.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptWater.hpp @@ -49,7 +49,7 @@ public: void Touch(CActor&, CStateManager&) override; EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&, - int /*EProjectileAttrib?*/) const override; + int) const override; CAABox GetSortingBounds(const CStateManager&) const override; bool CanRippleAtPoint(const CVector3f&) const; diff --git a/include/MetroidPrime/Tweaks/CTweakPlayer.hpp b/include/MetroidPrime/Tweaks/CTweakPlayer.hpp index a709e949..6ff38d1c 100644 --- a/include/MetroidPrime/Tweaks/CTweakPlayer.hpp +++ b/include/MetroidPrime/Tweaks/CTweakPlayer.hpp @@ -3,6 +3,7 @@ #include "types.h" +#include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/Tweaks/ITweakObject.hpp" #include "Kyoto/TOneStatic.hpp" @@ -16,310 +17,316 @@ class CTweakPlayer : public ITweakObject, public TOneStatic< CTweakPlayer > { public: CTweakPlayer(CInputStream&); - // TODO CPlayer::ESurfaceRestraints - float GetMaxTranslationalAcceleration(int s) const { return x4_maxTranslationalAcceleration[s]; } - float GetMaxRotationalAcceleration(int s) const { return x24_maxRotationalAcceleration[s]; } - float GetPlayerTranslationFriction(int s) const { return x44_translationFriction[s]; } - float GetPlayerRotationFriction(int s) const { return x64_rotationFriction[s]; } - float GetPlayerRotationMaxSpeed(int s) const { return x84_rotationMaxSpeed[s]; } - float GetPlayerTranslationMaxSpeed(int s) const { return xa4_translationMaxSpeed[s]; } - float GetNormalGravAccel() const { return xc4_normalGravAccel; } - float GetFluidGravAccel() const { return xc8_fluidGravAccel; } - float GetVerticalJumpAccel() const { return xcc_verticalJumpAccel; } - float GetHorizontalJumpAccel() const { return xd0_horizontalJumpAccel; } - float GetVerticalDoubleJumpAccel() const { return xd4_verticalDoubleJumpAccel; } - float GetHorizontalDoubleJumpAccel() const { return xd8_horizontalDoubleJumpAccel; } - float GetWaterJumpFactor() const { return xdc_waterJumpFactor; } - float GetWaterBallJumpFactor() const { return xe0_waterBallJumpFactor; } - float GetLavaJumpFactor() const { return xe4_lavaJumpFactor; } - float GetLavaBallJumpFactor() const { return xe8_lavaBallJumpFactor; } - float GetPhazonJumpFactor() const { return xec_phazonJumpFactor; } - float GetPhazonBallJumpFactor() const { return xf0_phazonBallJumpFactor; } - float GetAllowedJumpTime() const { return xf4_allowedJumpTime; } - float GetAllowedDoubleJumpTime() const { return xf8_allowedDoubleJumpTime; } - float GetMinDoubleJumpWindow() const { return xfc_minDoubleJumpWindow; } - float GetMaxDoubleJumpWindow() const { return x100_maxDoubleJumpWindow; } - float GetMinJumpTime() const { return x108_minJumpTime; } - float GetMinDoubleJumpTime() const { return x10c_minDoubleJumpTime; } - float GetAllowedLedgeTime() const { return x110_allowedLedgeTime; } - float GetDoubleJumpImpulse() const { return x114_doubleJumpImpulse; } - float GetBackwardsForceMultiplier() const { return x118_backwardsForceMultiplier; } - float GetBombJumpRadius() const { return x11c_bombJumpRadius; } - float GetBombJumpHeight() const { return x120_bombJumpHeight; } - float GetEyeOffset() const { return x124_eyeOffset; } - float GetTurnSpeedMultiplier() const { return x128_turnSpeedMultiplier; } - float GetFreeLookTurnSpeedMultiplier() const { return x12c_freeLookTurnSpeedMultiplier; } - float GetFreeLookSpeed() const { return x138_freeLookSpeed; } - float GetFreeLookSnapSpeed() const { return x13c_freeLookSnapSpeed; } - float GetFreeLookCenteredThresholdAngle() const { return x144_freeLookCenteredThresholdAngle; } - float GetFreeLookCenteredTime() const { return x148_freeLookCenteredTime; } - float GetOrbitModeTimer() const { return x180_orbitModeTimer; } - float GetOrbitUpperAngle() const { return x188_orbitUpperAngle; } - float GetOrbitLowerAngle() const { return x18c_orbitLowerAngle; } - float GetOrbitHorizAngle() const { return x190_orbitHorizAngle; } - float GetOrbitMaxTargetDistance() const { return x19c_orbitMaxTargetDistance; } - float GetOrbitMaxLockDistance() const { return x1a0_orbitMaxLockDistance; } - float GetOrbitDistanceThreshold() const { return x1a4_orbitDistanceThreshold; } - uint GetOrbitScreenBoxHalfExtentX(int zone) const { return x1a8_orbitScreenBoxHalfExtentX[zone]; } - uint GetOrbitScreenBoxHalfExtentY(int zone) const { return x1b0_orbitScreenBoxHalfExtentY[zone]; } - uint GetOrbitScreenBoxCenterX(int zone) const { return x1b8_orbitScreenBoxCenterX[zone]; } - uint GetOrbitScreenBoxCenterY(int zone) const { return x1c0_orbitScreenBoxCenterY[zone]; } - uint GetOrbitZoneIdealX(int zone) const { return x1c8_orbitZoneIdealX[zone]; } - uint GetOrbitZoneIdealY(int zone) const { return x1d0_orbitZoneIdealY[zone]; } - float GetOrbitNearX() const { return x1d8_orbitNearX; } - float GetOrbitNearZ() const { return x1dc_orbitNearZ; } - float GetOrbitFixedOffsetZDiff() const { return x1e8_orbitFixedOffsetZDiff; } - float GetOrbitZRange() const { return x1ec_orbitZRange; } - bool GetDashEnabled() const { return x200_24_dashEnabled; } - bool GetDashOnButtonRelease() const { return x200_25_dashOnButtonRelease; } - float GetDashButtonHoldCancelTime() const { return x204_dashButtonHoldCancelTime; } - float GetDashStrafeInputThreshold() const { return x208_dashStrafeInputThreshold; } - float GetSidewaysDoubleJumpImpulse() const { return x20c_sidewaysDoubleJumpImpulse; } - float GetSidewaysVerticalDoubleJumpAccel() const { return x210_sidewaysVerticalDoubleJumpAccel; } - float GetSidewaysHorizontalDoubleJumpAccel() const { - return x214_sidewaysHorizontalDoubleJumpAccel; + float GetMaxTranslationalAcceleration(CPlayer::ESurfaceRestraints s) const { + return mMaxTranslationalAcceleration[s]; } - float GetScanningRange() const { return x218_scanningRange; } - bool GetScanRetention() const { return x21c_24_scanRetention; } - bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; } - bool GetOrbitWhileScanning() const { return x21c_26_orbitWhileScanning; } - float GetScanMaxTargetDistance() const { return x220_scanMaxTargetDistance; } - float GetScanMaxLockDistance() const { return x224_scanMaxLockDistance; } - bool GetMoveDuringFreeLook() const { return x228_27_moveDuringFreeLook; } - bool GetHoldButtonsForFreeLook() const { return x228_28_holdButtonsForFreeLook; } - bool GetTwoButtonsForFreeLook() const { return x228_29_twoButtonsForFreeLook; } - bool GetAimWhenOrbitingPoint() const { return x229_25_aimWhenOrbitingPoint; } - bool GetStayInFreeLookWhileFiring() const { return x229_26_stayInFreeLookWhileFiring; } - bool GetOrbitFixedOffset() const { return x229_29_orbitFixedOffset; } - bool GetGunButtonTogglesHolster() const { return x229_30_gunButtonTogglesHolster; } - bool GetGunNotFiringHolstersGun() const { return x229_31_gunNotFiringHolstersGun; } - bool GetFallingDoubleJump() const { return x22a_24_fallingDoubleJump; } - bool GetImpulseDoubleJump() const { return x22a_25_impulseDoubleJump; } - bool GetFiringCancelsCameraPitch() const { return x22a_26_firingCancelsCameraPitch; } - bool GetAssistedAimingIgnoreHorizontal() const { return x22a_27_assistedAimingIgnoreHorizontal; } - bool GetAssistedAimingIgnoreVertical() const { return x22a_28_assistedAimingIgnoreVertical; } - float GetAimMaxDistance() const { return x234_aimMaxDistance; } - float GetAimThresholdDistance() const { return x24c_aimThresholdDistance; } - float GetAimBoxWidth() const { return x258_aimBoxWidth; } - float GetAimBoxHeight() const { return x25c_aimBoxHeight; } - float GetAimTargetTimer() const { return x260_aimTargetTimer; } - float GetAimAssistHorizontalAngle() const { return x264_aimAssistHorizontalAngle; } - float GetAimAssistVerticalAngle() const { return x268_aimAssistVerticalAngle; } - float GetPlayerHeight() const { return x26c_playerHeight; } - float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; } - float GetStepUpHeight() const { return x274_stepUpHeight; } - float GetStepDownHeight() const { return x278_stepDownHeight; } - float GetPlayerBallHalfExtent() const { return x27c_playerBallHalfExtent; } - float GetOrbitDistanceMax() const { return x2a0_orbitDistanceMax; } - float GetGrappleSwingLength() const { return x2a4_grappleSwingLength; } - float GetGrappleSwingPeriod() const { return x2a8_grappleSwingPeriod; } - float GetGrapplePullSpeedMin() const { return x2ac_grapplePullSpeedMin; } - float GetMaxGrappleLockedTurnAlignDistance() const { - return x2b4_maxGrappleLockedTurnAlignDistance; + float GetMaxRotationalAcceleration(CPlayer::ESurfaceRestraints s) const { + return mMaxRotationalAcceleration[s]; } - float GetGrapplePullSpeedProportion() const { return x2b8_grapplePullSpeedProportion; } - float GetGrapplePullSpeedMax() const { return x2bc_grapplePullSpeedMax; } - float GetGrappleLookCenterSpeed() const { return x2c0_grappleLookCenterSpeed; } - float GetMaxGrappleTurnSpeed() const { return x2c4_maxGrappleTurnSpeed; } - float GetGrappleJumpForce() const { return x2c8_grappleJumpForce; } - float GetGrappleReleaseTime() const { return x2cc_grappleReleaseTime; } - uint GetGrappleJumpMode() const { return x2d0_grappleJumpMode; } - bool GetOrbitReleaseBreaksGrapple() const { return x2d4_orbitReleaseBreaksGrapple; } - bool GetInvertGrappleTurn() const { return x2d5_invertGrappleTurn; } - float GetGrappleBeamSpeed() const { return x2d8_grappleBeamSpeed; } - float GetGrappleBeamXWaveAmplitude() const { return x2dc_grappleBeamXWaveAmplitude; } - float GetGrappleBeamZWaveAmplitude() const { return x2e0_grappleBeamZWaveAmplitude; } - float GetGrappleBeamAnglePhaseDelta() const { return x2e4_grappleBeamAnglePhaseDelta; } - float GetHorizontalFreeLookAngleVel() const { return x130_horizontalFreeLookAngleVel; } - float GetVerticalFreeLookAngleVel() const { return x134_verticalFreeLookAngleVel; } - float GetOrbitCameraSpeed() const { return x184_orbitCameraSpeed; } - float GetOrbitPreventionTime() const { return x1fc_orbitPreventionTime; } - bool GetFreeLookTurnsPlayer() const { return x228_24_freelookTurnsPlayer; } - float GetJumpCameraPitchDownStart() const { return x288_jumpCameraPitchDownStart; } - float GetJumpCameraPitchDownFull() const { return x28c_jumpCameraPitchDownFull; } - float GetJumpCameraPitchDownAngle() const { return x290_jumpCameraPitchDownAngle; } - float GetFallCameraPitchDownStart() const { return x294_fallCameraPitchDownStart; } - float GetFallCameraPitchDownFull() const { return x298_fallCameraPitchDownFull; } - float GetFallCameraPitchDownAngle() const { return x29c_fallCameraPitchDownAngle; } - float GetFirstPersonCameraSpeed() const { return x280_firstPersonCameraSpeed; } - float GetGrappleCameraSpeed() const { return x2b0_grappleCameraSpeed; } - float GetFreeLookDampenFactor() const { return x14c_freeLookDampenFactor; } - float GetLeftAnalogMax() const { return x150_leftDiv; } - float GetRightAnalogMax() const { return x154_rightDiv; } - float GetOrbitMinDistance(int type) const { return x158_orbitMinDistance[type]; } - float GetOrbitNormalDistance(int type) const { return x164_orbitNormalDistance[type]; } - float GetOrbitMaxDistance(int type) const { return x170_orbitMaxDistance[type]; } - float GetFrozenTimeout() const { return x2f8_frozenTimeout; } - uint GetIceBreakJumpCount() const { return x2fc_iceBreakJumpCount; } - float GetVariaDamageReduction() const { return x300_variaDamageReduction; } - float GetGravityDamageReduction() const { return x304_gravityDamageReduction; } - float GetPhazonDamageReduction() const { return x308_phazonDamageReduction; } + float GetPlayerTranslationFriction(CPlayer::ESurfaceRestraints s) const { + return mTranslationFriction[s]; + } + float GetPlayerRotationFriction(CPlayer::ESurfaceRestraints s) const { + return mRotationFriction[s]; + } + float GetPlayerRotationMaxSpeed(CPlayer::ESurfaceRestraints s) const { + return mRotationMaxSpeed[s]; + } + float GetPlayerTranslationMaxSpeed(CPlayer::ESurfaceRestraints s) const { + return mTranslationMaxSpeed[s]; + } + float GetNormalGravAccel() const { return mNormalGravAccel; } + float GetFluidGravAccel() const { return mFluidGravAccel; } + float GetVerticalJumpAccel() const { return mVerticalJumpAccel; } + float GetHorizontalJumpAccel() const { return mHorizontalJumpAccel; } + float GetVerticalDoubleJumpAccel() const { return mVerticalDoubleJumpAccel; } + float GetHorizontalDoubleJumpAccel() const { return mHorizontalDoubleJumpAccel; } + float GetWaterJumpFactor() const { return mWaterJumpFactor; } + float GetWaterBallJumpFactor() const { return mWaterBallJumpFactor; } + float GetLavaJumpFactor() const { return mLavaJumpFactor; } + float GetLavaBallJumpFactor() const { return mLavaBallJumpFactor; } + float GetPhazonJumpFactor() const { return mPhazonJumpFactor; } + float GetPhazonBallJumpFactor() const { return mPhazonBallJumpFactor; } + float GetAllowedJumpTime() const { return mAllowedJumpTime; } + float GetAllowedDoubleJumpTime() const { return mAllowedDoubleJumpTime; } + float GetMinDoubleJumpWindow() const { return mMinDoubleJumpWindow; } + float GetMaxDoubleJumpWindow() const { return mMaxDoubleJumpWindow; } + float GetMinJumpTime() const { return mMinJumpTime; } + float GetMinDoubleJumpTime() const { return mMinDoubleJumpTime; } + float GetAllowedLedgeTime() const { return mAllowedLedgeTime; } + float GetDoubleJumpImpulse() const { return mDoubleJumpImpulse; } + float GetBackwardsForceMultiplier() const { return mBackwardsForceMultiplier; } + float GetBombJumpRadius() const { return mBombJumpRadius; } + float GetBombJumpHeight() const { return mBombJumpHeight; } + float GetEyeOffset() const { return mEyeOffset; } + float GetTurnSpeedMultiplier() const { return mTurnSpeedMultiplier; } + float GetFreeLookTurnSpeedMultiplier() const { return mFreeLookTurnSpeedMultiplier; } + float GetFreeLookSpeed() const { return mFreeLookSpeed; } + float GetFreeLookSnapSpeed() const { return mFreeLookSnapSpeed; } + float GetFreeLookCenteredThresholdAngle() const { return mFreeLookCenteredThresholdAngle; } + float GetFreeLookCenteredTime() const { return mFreeLookCenteredTime; } + float GetOrbitModeTimer() const { return mOrbitModeTimer; } + float GetOrbitUpperAngle() const { return mOrbitUpperAngle; } + float GetOrbitLowerAngle() const { return mOrbitLowerAngle; } + float GetOrbitHorizAngle() const { return mOrbitHorizAngle; } + float GetOrbitMaxTargetDistance() const { return mOrbitMaxTargetDistance; } + float GetOrbitMaxLockDistance() const { return mOrbitMaxLockDistance; } + float GetOrbitDistanceThreshold() const { return mOrbitDistanceThreshold; } + uint GetOrbitScreenBoxHalfExtentX(int zone) const { return mOrbitScreenBoxHalfExtentX[zone]; } + uint GetOrbitScreenBoxHalfExtentY(int zone) const { return mOrbitScreenBoxHalfExtentY[zone]; } + uint GetOrbitScreenBoxCenterX(int zone) const { return mOrbitScreenBoxCenterX[zone]; } + uint GetOrbitScreenBoxCenterY(int zone) const { return mOrbitScreenBoxCenterY[zone]; } + uint GetOrbitZoneIdealX(int zone) const { return mOrbitZoneIdealX[zone]; } + uint GetOrbitZoneIdealY(int zone) const { return mOrbitZoneIdealY[zone]; } + float GetOrbitNearX() const { return mOrbitNearX; } + float GetOrbitNearZ() const { return mOrbitNearZ; } + float GetOrbitFixedOffsetZDiff() const { return mOrbitFixedOffsetZDiff; } + float GetOrbitZRange() const { return mOrbitZRange; } + bool GetDashEnabled() const { return mDashEnabled; } + bool GetDashOnButtonRelease() const { return mDashOnButtonRelease; } + float GetDashButtonHoldCancelTime() const { return mDashButtonHoldCancelTime; } + float GetDashStrafeInputThreshold() const { return mDashStrafeInputThreshold; } + float GetSidewaysDoubleJumpImpulse() const { return mSidewaysDoubleJumpImpulse; } + float GetSidewaysVerticalDoubleJumpAccel() const { return mSidewaysVerticalDoubleJumpAccel; } + float GetSidewaysHorizontalDoubleJumpAccel() const { return mSidewaysHorizontalDoubleJumpAccel; } + float GetScanningRange() const { return mScanningRange; } + bool GetScanRetention() const { return mScanRetention; } + bool GetScanFreezesGame() const { return mScanFreezesGame; } + bool GetOrbitWhileScanning() const { return mOrbitWhileScanning; } + float GetScanMaxTargetDistance() const { return mScanMaxTargetDistance; } + float GetScanMaxLockDistance() const { return mScanMaxLockDistance; } + bool GetMoveDuringFreeLook() const { return mMoveDuringFreeLook; } + bool GetHoldButtonsForFreeLook() const { return mHoldButtonsForFreeLook; } + bool GetTwoButtonsForFreeLook() const { return mTwoButtonsForFreeLook; } + bool GetAimWhenOrbitingPoint() const { return mAimWhenOrbitingPoint; } + bool GetStayInFreeLookWhileFiring() const { return mStayInFreeLookWhileFiring; } + bool GetOrbitFixedOffset() const { return mOrbitFixedOffset; } + bool GetGunButtonTogglesHolster() const { return mGunButtonTogglesHolster; } + bool GetGunNotFiringHolstersGun() const { return mGunNotFiringHolstersGun; } + bool GetFallingDoubleJump() const { return mFallingDoubleJump; } + bool GetImpulseDoubleJump() const { return mImpulseDoubleJump; } + bool GetFiringCancelsCameraPitch() const { return mFiringCancelsCameraPitch; } + bool GetAssistedAimingIgnoreHorizontal() const { return mAssistedAimingIgnoreHorizontal; } + bool GetAssistedAimingIgnoreVertical() const { return mAssistedAimingIgnoreVertical; } + float GetAimMaxDistance() const { return mAimMaxDistance; } + float GetAimThresholdDistance() const { return mAimThresholdDistance; } + float GetAimBoxWidth() const { return mAimBoxWidth; } + float GetAimBoxHeight() const { return mAimBoxHeight; } + float GetAimTargetTimer() const { return mAimTargetTimer; } + float GetAimAssistHorizontalAngle() const { return mAimAssistHorizontalAngle; } + float GetAimAssistVerticalAngle() const { return mAimAssistVerticalAngle; } + float GetPlayerHeight() const { return mPlayerHeight; } + float GetPlayerXYHalfExtent() const { return mPlayerXYHalfExtent; } + float GetStepUpHeight() const { return mStepUpHeight; } + float GetStepDownHeight() const { return mStepDownHeight; } + float GetPlayerBallHalfExtent() const { return mPlayerBallHalfExtent; } + float GetOrbitDistanceMax() const { return mOrbitDistanceMax; } + float GetGrappleSwingLength() const { return mGrappleSwingLength; } + float GetGrappleSwingPeriod() const { return mGrappleSwingPeriod; } + float GetGrapplePullSpeedMin() const { return mGrapplePullSpeedMin; } + float GetMaxGrappleLockedTurnAlignDistance() const { return mMaxGrappleLockedTurnAlignDistance; } + float GetGrapplePullSpeedProportion() const { return mGrapplePullSpeedProportion; } + float GetGrapplePullSpeedMax() const { return mGrapplePullSpeedMax; } + float GetGrappleLookCenterSpeed() const { return mGrappleLookCenterSpeed; } + float GetMaxGrappleTurnSpeed() const { return mMaxGrappleTurnSpeed; } + float GetGrappleJumpForce() const { return mGrappleJumpForce; } + float GetGrappleReleaseTime() const { return mGrappleReleaseTime; } + uint GetGrappleJumpMode() const { return mGrappleJumpMode; } + bool GetOrbitReleaseBreaksGrapple() const { return mOrbitReleaseBreaksGrapple; } + bool GetInvertGrappleTurn() const { return mInvertGrappleTurn; } + float GetGrappleBeamSpeed() const { return mGrappleBeamSpeed; } + float GetGrappleBeamXWaveAmplitude() const { return mGrappleBeamXWaveAmplitude; } + float GetGrappleBeamZWaveAmplitude() const { return mGrappleBeamZWaveAmplitude; } + float GetGrappleBeamAnglePhaseDelta() const { return mGrappleBeamAnglePhaseDelta; } + float GetHorizontalFreeLookAngleVel() const { return mHorizontalFreeLookAngleVel; } + float GetVerticalFreeLookAngleVel() const { return mVerticalFreeLookAngleVel; } + float GetOrbitCameraSpeed() const { return mOrbitCameraSpeed; } + float GetOrbitPreventionTime() const { return mOrbitPreventionTime; } + bool GetFreeLookTurnsPlayer() const { return mFreelookTurnsPlayer; } + float GetJumpCameraPitchDownStart() const { return mJumpCameraPitchDownStart; } + float GetJumpCameraPitchDownFull() const { return mJumpCameraPitchDownFull; } + float GetJumpCameraPitchDownAngle() const { return mJumpCameraPitchDownAngle; } + float GetFallCameraPitchDownStart() const { return mFallCameraPitchDownStart; } + float GetFallCameraPitchDownFull() const { return mFallCameraPitchDownFull; } + float GetFallCameraPitchDownAngle() const { return mFallCameraPitchDownAngle; } + float GetFirstPersonCameraSpeed() const { return mFirstPersonCameraSpeed; } + float GetGrappleCameraSpeed() const { return mGrappleCameraSpeed; } + float GetFreeLookDampenFactor() const { return mFreeLookDampenFactor; } + float GetLeftAnalogMax() const { return mLeftDiv; } + float GetRightAnalogMax() const { return mRightDiv; } + float GetOrbitMinDistance(int type) const { return mOrbitMinDistance[type]; } + float GetOrbitNormalDistance(int type) const { return mOrbitNormalDistance[type]; } + float GetOrbitMaxDistance(int type) const { return mOrbitMaxDistance[type]; } + float GetFrozenTimeout() const { return mFrozenTimeout; } + uint GetIceBreakJumpCount() const { return mIceBreakJumpCount; } + float GetVariaDamageReduction() const { return mVariaDamageReduction; } + float GetGravityDamageReduction() const { return mGravityDamageReduction; } + float GetPhazonDamageReduction() const { return mPhazonDamageReduction; } -// private: - float x4_maxTranslationalAcceleration[8]; - float x24_maxRotationalAcceleration[8]; - float x44_translationFriction[8]; - float x64_rotationFriction[8]; - float x84_rotationMaxSpeed[8]; - float xa4_translationMaxSpeed[8]; - float xc4_normalGravAccel; - float xc8_fluidGravAccel; - float xcc_verticalJumpAccel; - float xd0_horizontalJumpAccel; - float xd4_verticalDoubleJumpAccel; - float xd8_horizontalDoubleJumpAccel; - float xdc_waterJumpFactor; - float xe0_waterBallJumpFactor; - float xe4_lavaJumpFactor; - float xe8_lavaBallJumpFactor; - float xec_phazonJumpFactor; - float xf0_phazonBallJumpFactor; - float xf4_allowedJumpTime; - float xf8_allowedDoubleJumpTime; - float xfc_minDoubleJumpWindow; - float x100_maxDoubleJumpWindow; + float mMaxTranslationalAcceleration[8]; + float mMaxRotationalAcceleration[8]; + float mTranslationFriction[8]; + float mRotationFriction[8]; + float mRotationMaxSpeed[8]; + float mTranslationMaxSpeed[8]; + float mNormalGravAccel; + float mFluidGravAccel; + float mVerticalJumpAccel; + float mHorizontalJumpAccel; + float mVerticalDoubleJumpAccel; + float mHorizontalDoubleJumpAccel; + float mWaterJumpFactor; + float mWaterBallJumpFactor; + float mLavaJumpFactor; + float mLavaBallJumpFactor; + float mPhazonJumpFactor; + float mPhazonBallJumpFactor; + float mAllowedJumpTime; + float mAllowedDoubleJumpTime; + float mMinDoubleJumpWindow; + float mMaxDoubleJumpWindow; float x104_; - float x108_minJumpTime; - float x10c_minDoubleJumpTime; - float x110_allowedLedgeTime; - float x114_doubleJumpImpulse; - float x118_backwardsForceMultiplier; - float x11c_bombJumpRadius; - float x120_bombJumpHeight; - float x124_eyeOffset; - float x128_turnSpeedMultiplier; - float x12c_freeLookTurnSpeedMultiplier; - float x130_horizontalFreeLookAngleVel; - float x134_verticalFreeLookAngleVel; - float x138_freeLookSpeed; - float x13c_freeLookSnapSpeed; + float mMinJumpTime; + float mMinDoubleJumpTime; + float mAllowedLedgeTime; + float mDoubleJumpImpulse; + float mBackwardsForceMultiplier; + float mBombJumpRadius; + float mBombJumpHeight; + float mEyeOffset; + float mTurnSpeedMultiplier; + float mFreeLookTurnSpeedMultiplier; + float mHorizontalFreeLookAngleVel; + float mVerticalFreeLookAngleVel; + float mFreeLookSpeed; + float mFreeLookSnapSpeed; float x140_; - float x144_freeLookCenteredThresholdAngle; - float x148_freeLookCenteredTime; - float x14c_freeLookDampenFactor; - float x150_leftDiv; - float x154_rightDiv; - float x158_orbitMinDistance[3]; - float x164_orbitNormalDistance[3]; - float x170_orbitMaxDistance[3]; + float mFreeLookCenteredThresholdAngle; + float mFreeLookCenteredTime; + float mFreeLookDampenFactor; + float mLeftDiv; + float mRightDiv; + float mOrbitMinDistance[3]; + float mOrbitNormalDistance[3]; + float mOrbitMaxDistance[3]; float x17c_; - float x180_orbitModeTimer; - float x184_orbitCameraSpeed; - float x188_orbitUpperAngle; - float x18c_orbitLowerAngle; - float x190_orbitHorizAngle; + float mOrbitModeTimer; + float mOrbitCameraSpeed; + float mOrbitUpperAngle; + float mOrbitLowerAngle; + float mOrbitHorizAngle; float x194_; float x198_; - float x19c_orbitMaxTargetDistance; - float x1a0_orbitMaxLockDistance; - float x1a4_orbitDistanceThreshold; - uint x1a8_orbitScreenBoxHalfExtentX[2]; - uint x1b0_orbitScreenBoxHalfExtentY[2]; - uint x1b8_orbitScreenBoxCenterX[2]; - uint x1c0_orbitScreenBoxCenterY[2]; - uint x1c8_orbitZoneIdealX[2]; - uint x1d0_orbitZoneIdealY[2]; - float x1d8_orbitNearX; - float x1dc_orbitNearZ; + float mOrbitMaxTargetDistance; + float mOrbitMaxLockDistance; + float mOrbitDistanceThreshold; + uint mOrbitScreenBoxHalfExtentX[2]; + uint mOrbitScreenBoxHalfExtentY[2]; + uint mOrbitScreenBoxCenterX[2]; + uint mOrbitScreenBoxCenterY[2]; + uint mOrbitZoneIdealX[2]; + uint mOrbitZoneIdealY[2]; + float mOrbitNearX; + float mOrbitNearZ; float x1e0_; float x1e4_; - float x1e8_orbitFixedOffsetZDiff; - float x1ec_orbitZRange; + float mOrbitFixedOffsetZDiff; + float mOrbitZRange; float x1f0_; float x1f4_; float x1f8_; - float x1fc_orbitPreventionTime; - bool x200_24_dashEnabled : 1; - bool x200_25_dashOnButtonRelease : 1; - float x204_dashButtonHoldCancelTime; - float x208_dashStrafeInputThreshold; - float x20c_sidewaysDoubleJumpImpulse; - float x210_sidewaysVerticalDoubleJumpAccel; - float x214_sidewaysHorizontalDoubleJumpAccel; - float x218_scanningRange; - bool x21c_24_scanRetention : 1; - bool x21c_25_scanFreezesGame : 1; - bool x21c_26_orbitWhileScanning : 1; - float x220_scanMaxTargetDistance; - float x224_scanMaxLockDistance; - bool x228_24_freelookTurnsPlayer : 1; + float mOrbitPreventionTime; + bool mDashEnabled : 1; + bool mDashOnButtonRelease : 1; + float mDashButtonHoldCancelTime; + float mDashStrafeInputThreshold; + float mSidewaysDoubleJumpImpulse; + float mSidewaysVerticalDoubleJumpAccel; + float mSidewaysHorizontalDoubleJumpAccel; + float mScanningRange; + bool mScanRetention : 1; + bool mScanFreezesGame : 1; + bool mOrbitWhileScanning : 1; + float mScanMaxTargetDistance; + float mScanMaxLockDistance; + bool mFreelookTurnsPlayer : 1; bool x228_25_ : 1; bool x228_26_ : 1; - bool x228_27_moveDuringFreeLook : 1; - bool x228_28_holdButtonsForFreeLook : 1; - bool x228_29_twoButtonsForFreeLook : 1; + bool mMoveDuringFreeLook : 1; + bool mHoldButtonsForFreeLook : 1; + bool mTwoButtonsForFreeLook : 1; bool x228_30_ : 1; bool x228_31_ : 1; bool x229_24_ : 1; - bool x229_25_aimWhenOrbitingPoint : 1; - bool x229_26_stayInFreeLookWhileFiring : 1; + bool mAimWhenOrbitingPoint : 1; + bool mStayInFreeLookWhileFiring : 1; bool x229_27_ : 1; bool x229_28_ : 1; - bool x229_29_orbitFixedOffset : 1; - bool x229_30_gunButtonTogglesHolster : 1; - bool x229_31_gunNotFiringHolstersGun : 1; - bool x22a_24_fallingDoubleJump : 1; - bool x22a_25_impulseDoubleJump : 1; - bool x22a_26_firingCancelsCameraPitch : 1; - bool x22a_27_assistedAimingIgnoreHorizontal : 1; - bool x22a_28_assistedAimingIgnoreVertical : 1; + bool mOrbitFixedOffset : 1; + bool mGunButtonTogglesHolster : 1; + bool mGunNotFiringHolstersGun : 1; + bool mFallingDoubleJump : 1; + bool mImpulseDoubleJump : 1; + bool mFiringCancelsCameraPitch : 1; + bool mAssistedAimingIgnoreHorizontal : 1; + bool mAssistedAimingIgnoreVertical : 1; float x22c_; float x230_; - float x234_aimMaxDistance; + float mAimMaxDistance; float x238_; float x23c_; float x240_; float x244_; float x248_; - float x24c_aimThresholdDistance; + float mAimThresholdDistance; float x250_; float x254_; - float x258_aimBoxWidth; - float x25c_aimBoxHeight; - float x260_aimTargetTimer; - float x264_aimAssistHorizontalAngle; - float x268_aimAssistVerticalAngle; - float x26c_playerHeight; - float x270_playerXYHalfExtent; - float x274_stepUpHeight; - float x278_stepDownHeight; - float x27c_playerBallHalfExtent; - float x280_firstPersonCameraSpeed; + float mAimBoxWidth; + float mAimBoxHeight; + float mAimTargetTimer; + float mAimAssistHorizontalAngle; + float mAimAssistVerticalAngle; + float mPlayerHeight; + float mPlayerXYHalfExtent; + float mStepUpHeight; + float mStepDownHeight; + float mPlayerBallHalfExtent; + float mFirstPersonCameraSpeed; float x284_; - float x288_jumpCameraPitchDownStart; - float x28c_jumpCameraPitchDownFull; - float x290_jumpCameraPitchDownAngle; - float x294_fallCameraPitchDownStart; - float x298_fallCameraPitchDownFull; - float x29c_fallCameraPitchDownAngle; - float x2a0_orbitDistanceMax; - float x2a4_grappleSwingLength; - float x2a8_grappleSwingPeriod; - float x2ac_grapplePullSpeedMin; - float x2b0_grappleCameraSpeed; - float x2b4_maxGrappleLockedTurnAlignDistance; - float x2b8_grapplePullSpeedProportion; - float x2bc_grapplePullSpeedMax; - float x2c0_grappleLookCenterSpeed; - float x2c4_maxGrappleTurnSpeed; - float x2c8_grappleJumpForce; - float x2cc_grappleReleaseTime; - uint x2d0_grappleJumpMode; - bool x2d4_orbitReleaseBreaksGrapple; - bool x2d5_invertGrappleTurn; - float x2d8_grappleBeamSpeed; - float x2dc_grappleBeamXWaveAmplitude; - float x2e0_grappleBeamZWaveAmplitude; - float x2e4_grappleBeamAnglePhaseDelta; + float mJumpCameraPitchDownStart; + float mJumpCameraPitchDownFull; + float mJumpCameraPitchDownAngle; + float mFallCameraPitchDownStart; + float mFallCameraPitchDownFull; + float mFallCameraPitchDownAngle; + float mOrbitDistanceMax; + float mGrappleSwingLength; + float mGrappleSwingPeriod; + float mGrapplePullSpeedMin; + float mGrappleCameraSpeed; + float mMaxGrappleLockedTurnAlignDistance; + float mGrapplePullSpeedProportion; + float mGrapplePullSpeedMax; + float mGrappleLookCenterSpeed; + float mMaxGrappleTurnSpeed; + float mGrappleJumpForce; + float mGrappleReleaseTime; + uint mGrappleJumpMode; + bool mOrbitReleaseBreaksGrapple; + bool mInvertGrappleTurn; + float mGrappleBeamSpeed; + float mGrappleBeamXWaveAmplitude; + float mGrappleBeamZWaveAmplitude; + float mGrappleBeamAnglePhaseDelta; float x2e8_; float x2ec_; float x2f0_; bool x2f4_; - float x2f8_frozenTimeout; - uint x2fc_iceBreakJumpCount; - float x300_variaDamageReduction; - float x304_gravityDamageReduction; - float x308_phazonDamageReduction; + float mFrozenTimeout; + int mIceBreakJumpCount; + float mVariaDamageReduction; + float mGravityDamageReduction; + float mPhazonDamageReduction; }; extern CTweakPlayer* gpTweakPlayer; diff --git a/include/MetroidPrime/Weapons/CBeamProjectile.hpp b/include/MetroidPrime/Weapons/CBeamProjectile.hpp index 23374a6a..12fb21d0 100644 --- a/include/MetroidPrime/Weapons/CBeamProjectile.hpp +++ b/include/MetroidPrime/Weapons/CBeamProjectile.hpp @@ -14,7 +14,7 @@ public: kDT_Actor, kDT_World, }; - + CBeamProjectile(const TToken& wDesc, const rstl::string& name, EWeaponType wType, const CTransform4f& xf, int maxLength, float beamRadius, float travelSpeed, EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner, diff --git a/include/MetroidPrime/Weapons/CGunWeapon.hpp b/include/MetroidPrime/Weapons/CGunWeapon.hpp index cb21cdfc..cf6996eb 100644 --- a/include/MetroidPrime/Weapons/CGunWeapon.hpp +++ b/include/MetroidPrime/Weapons/CGunWeapon.hpp @@ -96,7 +96,7 @@ public: rstl::optional_object< CModelData >& SolidModelData() { return x10_solidModelData; } const CModelData& GetSolidModelData() const { return x10_solidModelData.data(); } - EWeaponType GetWeaponType() const { return x1c0_weaponType; } + EWeaponType GetType() const { return x1c0_weaponType; } TUniqueId GetPlayerId() const { return x1c4_playerId; } EMaterialTypes GetPlayerMaterial() const { return x1c8_playerMaterial; } diff --git a/include/MetroidPrime/Weapons/CWeapon.hpp b/include/MetroidPrime/Weapons/CWeapon.hpp index 4281de7d..c188d731 100644 --- a/include/MetroidPrime/Weapons/CWeapon.hpp +++ b/include/MetroidPrime/Weapons/CWeapon.hpp @@ -9,9 +9,31 @@ class CWeapon : public CActor { public: + enum EProjectileAttrib { + kPA_None = 0, + kPA_PartialCharge = (1 << 0), + kPA_PlasmaProjectile = (1 << 1), + kPA_Charged = (1 << 2), + kPA_Ice = (1 << 3), + kPA_Wave = (1 << 4), + kPA_Plasma = (1 << 5), + kPA_Phazon = (1 << 6), + kPA_ComboShot = (1 << 7), + kPA_Bombs = (1 << 8), + kPA_PowerBombs = (1 << 9), + kPA_BigProjectile = (1 << 10), + kPA_ArmCannon = (1 << 11), + kPA_BigStrike = (1 << 12), + kPA_DamageFalloff = (1 << 13), + kPA_StaticInterference = (1 << 14), + kPA_PlayerUnFreeze = (1 << 15), + kPA_ParticleOPTS = (1 << 16), + kPA_KeepInCinematic = (1 << 17), + }; + CWeapon(TUniqueId uid, TAreaId areaId, bool active, TUniqueId owner, EWeaponType type, const rstl::string& name, const CTransform4f& xf, const CMaterialFilter& filter, - const CMaterialList& mList, const CDamageInfo& dInfo, EProjectileAttrib attribs, + const CMaterialList& mList, const CDamageInfo& dInfo, int attribs, const CModelData& mData); // CEntity @@ -21,20 +43,27 @@ public: // CActor void Render(const CStateManager&) const override; EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, - const CWeaponMode&, - int /*EProjectileAttrib?*/) const override; + const CWeaponMode&, int) const override; void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) override; void SetDamageFalloffSpeed(float d); - EProjectileAttrib GetAttribField() const { return xe8_projectileAttribs; } + int GetAttribField() const { return xe8_projectileAttribs; } + bool HasAttrib(EProjectileAttrib attrib) const { + return (xe8_projectileAttribs & attrib) == attrib; // maybe wrong + } TUniqueId GetOwnerId() const { return xec_ownerId; } - EWeaponType GetWeaponType() const { return xf0_weaponType; } + EWeaponType GetType() const { return xf0_weaponType; } CMaterialFilter GetFilter() const { return xf8_filter; } CDamageInfo& OrigDamageInfo() { return x110_origDamageInfo; } + float GetInterferenceDuration() const { return x154_interferenceDuration; } + + void SetOwnerId(TUniqueId id) { xec_ownerId = id; } + void SetDamageInfo(const CDamageInfo& dInfo) { x12c_curDamageInfo = dInfo; } + void SetFilter(const CMaterialFilter& filter) { xf8_filter = filter; } protected: - EProjectileAttrib xe8_projectileAttribs; + int xe8_projectileAttribs; TUniqueId xec_ownerId; EWeaponType xf0_weaponType; CMaterialFilter xf8_filter; diff --git a/include/rstl/string.hpp b/include/rstl/string.hpp index c3eac0ee..ad6ac039 100644 --- a/include/rstl/string.hpp +++ b/include/rstl/string.hpp @@ -47,17 +47,16 @@ public: basic_string() : x0_ptr(&mNull), x4_cow(nullptr), x8_size(0) {} - basic_string(literal_t, const _CharTp* data); - // { - // x0_ptr = data; - // x4_cow = nullptr; + basic_string(literal_t, const _CharTp* data) { + x0_ptr = data; + x4_cow = nullptr; - // const _CharTp* it = data; - // while (*it) - // ++it; + const _CharTp* it = data; + while (*it) + ++it; - // x8_size = uint((it - data) / sizeof(_CharTp)); - // } + x8_size = static_cast< uint >(it - data); + } basic_string(const basic_string& str); // { @@ -139,10 +138,7 @@ bool basic_string< _CharTp, Traits, Alloc >::operator<(const basic_string& other typedef basic_string< wchar_t > wstring; typedef basic_string< char > string; -wstring wstring_l(const wchar_t* data); -// { -// return wstring(wstring::literal_t(), data); -// } +wstring wstring_l(const wchar_t* data) { return wstring(wstring::literal_t(), data); } string string_l(const char* data); // { diff --git a/src/Kyoto/Math/CQuaternion.cpp b/src/Kyoto/Math/CQuaternion.cpp new file mode 100644 index 00000000..00556543 --- /dev/null +++ b/src/Kyoto/Math/CQuaternion.cpp @@ -0,0 +1,8 @@ +#include "Kyoto/Math/CQuaternion.hpp" + +CQuaternion CQuaternion::operator*(const CQuaternion& rhs) const { + float w = this->w * rhs.w - CVector3f::Dot(imaginary, rhs.imaginary); + CVector3f imag = + rhs.w * imaginary + this->w * rhs.imaginary + CVector3f::Cross(imaginary, rhs.imaginary); + return CQuaternion(w, imag); +} diff --git a/src/MetroidPrime/CFluidPlane.cpp b/src/MetroidPrime/CFluidPlane.cpp new file mode 100644 index 00000000..7d53c147 --- /dev/null +++ b/src/MetroidPrime/CFluidPlane.cpp @@ -0,0 +1,11 @@ +#include "MetroidPrime/CFluidPlane.hpp" + +#include "Kyoto/Math/CMath.hpp" + +float CFluidPlane::GetRippleScaleFromKineticEnergy(float baseI, float velDot) { + float tmp = CMath::FastSqrtF(0.5f * baseI * velDot * velDot); + if (tmp >= 160.f) { + return 1.f; + } + return tmp * (1.f / 160.f); +} diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 0e7d6a84..373e6623 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -582,8 +582,8 @@ void CMemoryCardDriver::StartFileCreate() { } x194_fileIdx = 0; - x198_fileInfo = - rs_new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); + x198_fileInfo = rs_new CMemoryCardSys::CCardFileInfo( + x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); InitializeFileInfo(); ECardResult result = x198_fileInfo->CreateFile(); if (result != kCR_READY) @@ -616,8 +616,8 @@ void CMemoryCardDriver::StartFileCreateTransactional() { } x194_fileIdx = altFileIdx; - x198_fileInfo = - rs_new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); + x198_fileInfo = rs_new CMemoryCardSys::CCardFileInfo( + x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx])); InitializeFileInfo(); ECardResult result = x198_fileInfo->CreateFile(); if (result != kCR_READY) @@ -661,8 +661,8 @@ void CMemoryCardDriver::InitializeFileInfo() { char nameBuffer[36]; - sprintf(nameBuffer, "%02d.%02d.%02d %02d:%02d", time.mon + 1, time.mday, - time.year % 100, time.hour, time.min); + sprintf(nameBuffer, "%02d.%02d.%02d %02d:%02d", time.mon + 1, time.mday, time.year % 100, + time.hour, time.min); fileInfo.SetComment(rstl::string_l(nameConstant) + nameBuffer); fileInfo.LockBannerToken(x4_saveBanner, *gpSimplePool); @@ -722,7 +722,7 @@ void CMemoryCardDriver::ReadFinished() { void CMemoryCardDriver::EraseFileSlot(int saveIdx) { xe4_fileSlots[saveIdx] = nullptr; } void CMemoryCardDriver::BuildNewFileSlot(int saveIdx) { - bool fusionBackup = gpGameState->SystemOptions().GetHasFusion(); + bool fusionBackup = gpGameState->SystemState().GetHasFusion(); gpGameState->SetFileIdx(saveIdx); rstl::auto_ptr< SGameFileSlot >& slot = xe4_fileSlots[saveIdx]; @@ -738,7 +738,7 @@ void CMemoryCardDriver::BuildNewFileSlot(int saveIdx) { ImportPersistentOptions(); gpGameState->SetCardSerial(x28_cardSerial); - gpGameState->SystemOptions().SetHasFusion(fusionBackup); + gpGameState->SystemState().SetHasFusion(fusionBackup); } void CMemoryCardDriver::BuildExistingFileSlot(int saveIdx) { @@ -756,18 +756,18 @@ void CMemoryCardDriver::BuildExistingFileSlot(int saveIdx) { void CMemoryCardDriver::ImportPersistentOptions() { CMemoryInStream r(x30_systemData.data(), x30_systemData.capacity()); - CSystemOptions opts(r); - gpGameState->ImportPersistentOptions(opts); + CSystemState state(r); + gpGameState->ImportPersistentOptions(state); } void CMemoryCardDriver::ExportPersistentOptions() { u8* data = x30_systemData.data(); CMemoryInStream r(data, x30_systemData.capacity()); - CSystemOptions opts(r); - gpGameState->ExportPersistentOptions(opts); + CSystemState state(r); + gpGameState->ExportPersistentOptions(state); CMemoryStreamOut w(data, x30_systemData.capacity()); - w.Put(opts); + w.Put(state); } SSaveHeader::SSaveHeader(int i) : x0_version(i) {} diff --git a/src/MetroidPrime/Cameras/CBallCamera.cpp b/src/MetroidPrime/Cameras/CBallCamera.cpp index 078770f8..c4f25226 100644 --- a/src/MetroidPrime/Cameras/CBallCamera.cpp +++ b/src/MetroidPrime/Cameras/CBallCamera.cpp @@ -309,7 +309,7 @@ void CBallCamera::UpdateColliders(const CTransform4f& xf, if (idx < colliderList.size()) { const CPlayer& player = *mgr.GetPlayer(); x310_idealLookVec = CVector3f(0.f, gpTweakBall->GetBallCameraOffset().GetY(), - gpTweakPlayer->GetPlayerBallHalfExtent()); + gpTweakPlayer->mPlayerBallHalfExtent); x310_idealLookVec.SetY(x310_idealLookVec.GetY() * x308_speedFactor); x31c_predictedLookPos = player.GetMovementDirection() * x310_idealLookVec.GetY(); x31c_predictedLookPos.SetZ(x310_idealLookVec.GetZ()); diff --git a/src/MetroidPrime/Cameras/CCameraManager.cpp b/src/MetroidPrime/Cameras/CCameraManager.cpp index 584a52ac..c49fd1d7 100644 --- a/src/MetroidPrime/Cameras/CCameraManager.cpp +++ b/src/MetroidPrime/Cameras/CCameraManager.cpp @@ -81,7 +81,7 @@ void CCameraManager::CreateCameras(CStateManager& mgr) { TUniqueId fpId = mgr.AllocateUniqueId(); x7c_fpCamera = rs_new CFirstPersonCamera( - fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), GetDefaultFirstPersonVerticalFOV(), + fpId, xf, plId, gpTweakPlayer->mOrbitCameraSpeed, GetDefaultFirstPersonVerticalFOV(), GetDefaultFirstPersonNearClipDistance(), GetDefaultFirstPersonFarClipDistance(), GetDefaultAspectRatio()); mgr.AddObject(x7c_fpCamera); @@ -337,7 +337,7 @@ void CCameraManager::RemoveCinemaCamera(TUniqueId uid, CStateManager& mgr) { // TODO nonmatching: regswap void CCameraManager::EnterCinematic(CStateManager& mgr) { mgr.Player()->PlayerGun()->CancelFiring(mgr); - mgr.Player()->UnFreeze(mgr); + mgr.Player()->BreakFrozenState(mgr); CObjectList& objList = mgr.ObjectListById(kOL_All); int idx = objList.GetFirstObjectIndex(); @@ -345,8 +345,8 @@ void CCameraManager::EnterCinematic(CStateManager& mgr) { if (CExplosion* explosion = TCastToPtr< CExplosion >(objList[idx])) { mgr.DeleteObjectRequest(explosion->GetUniqueId()); } else if (CWeapon* weapon = TCastToPtr< CWeapon >(objList[idx])) { - if (weapon->GetActive() && - (weapon->GetAttribField() & kPA_KeepInCinematic) != kPA_KeepInCinematic) { + if (weapon->GetActive() && (weapon->GetAttribField() & CWeapon::kPA_KeepInCinematic) != + CWeapon::kPA_KeepInCinematic) { CPatterned* patterned = TCastToPtr< CPatterned >(mgr.ObjectById(weapon->GetOwnerId())); CPlayer* player = TCastToPtr< CPlayer >(mgr.ObjectById(weapon->GetOwnerId())); if (patterned || player) { diff --git a/src/MetroidPrime/Enemies/CBurstFire.cpp b/src/MetroidPrime/Enemies/CBurstFire.cpp index 3c818dd0..afa1e6e0 100644 --- a/src/MetroidPrime/Enemies/CBurstFire.cpp +++ b/src/MetroidPrime/Enemies/CBurstFire.cpp @@ -70,7 +70,7 @@ CVector3f CBurstFire::GetError(float xMag, float zMag) const { CVector3f result = CVector3f::Zero(); if (x14_24_shouldFire && x18_curBursts) { - + int r0 = x18_curBursts->x4_shotAngles[x4_angleIdx]; if (x14_25_avoidAccuracy && (r0 == 4 || r0 == 12)) { r0 = x18_curBursts->x4_shotAngles[x4_angleIdx > 0 ? x4_angleIdx - 1 : x4_angleIdx + 1]; @@ -96,7 +96,7 @@ CVector3f CBurstFire::GetDistanceCompensatedError(float dist, float maxErrDist) } float CBurstFire::GetMaxXError() const { - return gpTweakPlayer->GetPlayerXYHalfExtent() * 3.625f + 0.2f; + return gpTweakPlayer->mPlayerXYHalfExtent * 3.625f + 0.2f; } -float CBurstFire::GetMaxZError() const { return gpTweakPlayer->GetEyeOffset(); } +float CBurstFire::GetMaxZError() const { return gpTweakPlayer->mEyeOffset; } diff --git a/src/MetroidPrime/Player/CPlayer.cpp b/src/MetroidPrime/Player/CPlayer.cpp index 119a1d7a..ede8ea3b 100644 --- a/src/MetroidPrime/Player/CPlayer.cpp +++ b/src/MetroidPrime/Player/CPlayer.cpp @@ -2,14 +2,21 @@ #include "MetroidPrime/CActorParameters.hpp" #include "MetroidPrime/CControlMapper.hpp" +#include "MetroidPrime/CFluidPlaneCPU.hpp" +#include "MetroidPrime/CGameCollision.hpp" +#include "MetroidPrime/CRumbleManager.hpp" #include "MetroidPrime/CWorld.hpp" +#include "MetroidPrime/Cameras/CBallCamera.hpp" #include "MetroidPrime/Cameras/CCameraManager.hpp" #include "MetroidPrime/Cameras/CCinematicCamera.hpp" #include "MetroidPrime/Cameras/CFirstPersonCamera.hpp" +#include "MetroidPrime/HUD/CSamusHud.hpp" +#include "MetroidPrime/Player/CGameState.hpp" #include "MetroidPrime/Player/CGrappleArm.hpp" #include "MetroidPrime/Player/CMorphBall.hpp" #include "MetroidPrime/Player/CPlayerCameraBob.hpp" #include "MetroidPrime/Player/CPlayerGun.hpp" +#include "MetroidPrime/SFX/IceCrack.h" #include "MetroidPrime/SFX/LavaWorld.h" #include "MetroidPrime/SFX/MiscSamus.h" #include "MetroidPrime/ScriptObjects/CHUDBillboardEffect.hpp" @@ -17,16 +24,21 @@ #include "MetroidPrime/Tweaks/CTweakPlayer.hpp" #include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp" #include "MetroidPrime/Tweaks/CTweakPlayerRes.hpp" +#include "MetroidPrime/Weapons/CEnergyProjectile.hpp" #include "Kyoto/Audio/CSfxManager.hpp" #include "Kyoto/Audio/CStreamAudioManager.hpp" #include "Kyoto/CSimplePool.hpp" +#include "Kyoto/Input/CRumbleVoice.hpp" #include "Kyoto/Math/CRelAngle.hpp" #include "Kyoto/Math/CloseEnough.hpp" +#include "Kyoto/Text/CStringTable.hpp" #include "Collision/CCollisionInfo.hpp" #include "Collision/CRayCastResult.hpp" +#include "WorldFormat/CMetroidAreaCollider.hpp" + #include "rstl/math.hpp" static CVector3f testRayStart(0.f, 0.f, 0.f); @@ -152,6 +164,9 @@ static const ushort skRightStepSounds[24] = { static const char* const kGunLocator = "GUN_LCTR"; +static bool gUseSurfaceHack; +static CPlayer::ESurfaceRestraints gSR_Hack; + CAnimRes MakePlayerAnimres(CAssetId resId, const CVector3f& scale) { return CAnimRes(resId, CAnimRes::kDefaultCharIdx, scale, 0, true); } @@ -190,7 +205,7 @@ CPlayer::CPlayer(TUniqueId uid, const CTransform4f& xf, const CAABox& aabb, CAss , x300_fallingTime(0.f) , x304_orbitState(kOS_NoOrbit) , x308_orbitType(kOT_Close) -, x30c_orbitRequest(kOR_Default) +, x30c_orbitBrokenType(kOB_Default) , x310_orbitTargetId(kInvalidUniqueId) , x314_orbitPoint(0.f, 0.f, 0.f) , x320_orbitVector(0.f, 0.f, 0.f) @@ -455,13 +470,13 @@ void CPlayer::UpdateGunState(const CFinalInput& input, CStateManager& mgr) { switch (x498_gunHolsterState) { case kGH_Drawn: { bool needsHolster = false; - if (gpTweakPlayer->GetGunButtonTogglesHolster()) { + if (gpTweakPlayer->mGunButtonTogglesHolster) { if (ControlMapper::GetPressInput(ControlMapper::kC_ToggleHolster, input)) { needsHolster = true; } if (!ControlMapper::GetDigitalInput(ControlMapper::kC_FireOrBomb, input) && !ControlMapper::GetDigitalInput(ControlMapper::kC_MissileOrPowerBomb, input) && - gpTweakPlayer->x229_31_gunNotFiringHolstersGun) { + gpTweakPlayer->mGunNotFiringHolstersGun) { x49c_gunHolsterRemTime -= dt; if (x49c_gunHolsterRemTime <= 0.f) { needsHolster = true; @@ -471,7 +486,7 @@ void CPlayer::UpdateGunState(const CFinalInput& input, CStateManager& mgr) { if (!ControlMapper::GetDigitalInput(ControlMapper::kC_FireOrBomb, input) && !ControlMapper::GetDigitalInput(ControlMapper::kC_MissileOrPowerBomb, input) && x490_gun->IsFidgeting()) { - if (gpTweakPlayer->x229_31_gunNotFiringHolstersGun) { + if (gpTweakPlayer->mGunNotFiringHolstersGun) { x49c_gunHolsterRemTime -= dt; } } else { @@ -499,7 +514,7 @@ void CPlayer::UpdateGunState(const CFinalInput& input, CStateManager& mgr) { ControlMapper::GetDigitalInput(ControlMapper::kC_MissileOrPowerBomb, input) || x3b8_grappleState == kGS_None) { needsDraw = true; - } else if (gpTweakPlayer->x229_30_gunButtonTogglesHolster && + } else if (gpTweakPlayer->mGunButtonTogglesHolster && ControlMapper::GetPressInput(ControlMapper::kC_ToggleHolster, input)) { needsDraw = true; } @@ -582,14 +597,14 @@ void CPlayer::UpdateAssistedAiming(const CTransform4f& xf, CStateManager& mgr) { float vAngleDelta = az1 - az2; bool hasVAngleDelta = true; if (!x9c6_27_aimingAtProjectile && - fabsf(vAngleDelta) > gpTweakPlayer->x268_aimAssistVerticalAngle) { - if (gpTweakPlayer->x22a_28_assistedAimingIgnoreVertical) { + fabsf(vAngleDelta) > gpTweakPlayer->mAimAssistVerticalAngle) { + if (gpTweakPlayer->mAssistedAimingIgnoreVertical) { vAngleDelta = 0.f; hasVAngleDelta = false; } else if (vAngleDelta > 0.f) { - vAngleDelta = gpTweakPlayer->x268_aimAssistVerticalAngle; + vAngleDelta = gpTweakPlayer->mAimAssistVerticalAngle; } else { - vAngleDelta = -gpTweakPlayer->x268_aimAssistVerticalAngle; + vAngleDelta = -gpTweakPlayer->mAimAssistVerticalAngle; } } @@ -597,9 +612,9 @@ void CPlayer::UpdateAssistedAiming(const CTransform4f& xf, CStateManager& mgr) { float hAngleDelta = acosf(CMath::Limit(CVector3f::Dot(gunToTargetFlat, gunDirFlat), 1.f)); bool hasHAngleDelta = true; if (!x9c6_27_aimingAtProjectile && - fabsf(hAngleDelta) > gpTweakPlayer->x264_aimAssistHorizontalAngle) { - hAngleDelta = gpTweakPlayer->x264_aimAssistHorizontalAngle; - if (gpTweakPlayer->x22a_27_assistedAimingIgnoreHorizontal) { + fabsf(hAngleDelta) > gpTweakPlayer->mAimAssistHorizontalAngle) { + hAngleDelta = gpTweakPlayer->mAimAssistHorizontalAngle; + if (gpTweakPlayer->mAssistedAimingIgnoreHorizontal) { hAngleDelta = 0.f; hasHAngleDelta = false; } @@ -1106,31 +1121,645 @@ void CPlayer::SetMorphBallState(EPlayerMorphBallState state, CStateManager& mgr) } } -// void CPlayer::SetSpawnedMorphBallState(EPlayerMorphBallState state, CStateManager& mgr) { -// x2fc_spawnedMorphBallState = state; -// SetCameraState(kCS_Spawned, mgr); -// if (x2fc_spawnedMorphBallState != x2f8_morphBallState) { -// CPhysicsActor::Stop(); -// SetOrbitRequest(kOR_Respawn, mgr); -// switch (x2fc_spawnedMorphBallState) { -// case kMS_Unmorphed: { -// CVector3f pos; -// if (CanLeaveMorphBallState(mgr, pos)) { -// SetTranslation(GetTranslation() + pos); -// LeaveMorphBallState(mgr); -// ForceGunOrientation(GetTransform(), mgr); -// DrawGun(mgr); -// } -// break; -// } -// case kMS_Morphed: -// EnterMorphBallState(mgr); -// ResetBallCAmera(mgr); -// mgr.GetCameraManager()->ResetCameraHint(mgr); -// mgr.GetCameraManager()->GetBallCamera()->Reset(CreateTransformFromMovementDirection(), mgr); -// break; -// default: -// break; -// } -// } -// } +void CPlayer::SetSpawnedMorphBallState(EPlayerMorphBallState state, CStateManager& mgr) { + x2fc_spawnedMorphBallState = state; + SetCameraState(kCS_Spawned, mgr); + if (x2fc_spawnedMorphBallState != x2f8_morphBallState) { + CPhysicsActor::Stop(); + BreakOrbit(kOB_Respawn, mgr); + switch (x2fc_spawnedMorphBallState) { + case kMS_Unmorphed: { + CVector3f pos = CVector3f::Zero(); + if (CanLeaveMorphBallState(mgr, pos)) { + SetTranslation(GetTranslation() + pos); + LeaveMorphBallState(mgr); + ForceGunOrientation(GetTransform(), mgr); + DrawGun(mgr); + } + break; + } + case kMS_Morphed: + EnterMorphBallState(mgr); + ResetBallCamera(mgr); + mgr.CameraManager()->ResetCameraHint(mgr); + mgr.CameraManager()->BallCamera()->Reset(CreateTransformFromMovementDirection(), mgr); + break; + default: + break; + } + } +} + +void CPlayer::UpdateCinematicState(CStateManager& mgr) { + if (mgr.GetCameraManager()->IsInCinematicCamera()) { + if (x2f4_cameraState != kCS_Spawned) { + x2fc_spawnedMorphBallState = x2f8_morphBallState; + if (x2fc_spawnedMorphBallState == kMS_Unmorphing) { + x2fc_spawnedMorphBallState = kMS_Unmorphed; + } + if (x2fc_spawnedMorphBallState == kMS_Morphing) { + x2fc_spawnedMorphBallState = kMS_Morphed; + } + SetCameraState(kCS_Spawned, mgr); + } + } else { + if (x2f4_cameraState == kCS_Spawned) { + if (x2fc_spawnedMorphBallState == x2f8_morphBallState) { + switch (x2fc_spawnedMorphBallState) { + case kMS_Morphed: + SetCameraState(kCS_Ball, mgr); + break; + case kMS_Unmorphed: + SetCameraState(kCS_FirstPerson, mgr); + if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Scan) { + ForceGunOrientation(GetTransform(), mgr); + DrawGun(mgr); + } + break; + default: + break; + } + } else { + CPhysicsActor::Stop(); + BreakOrbit(kOB_Respawn, mgr); + switch (x2fc_spawnedMorphBallState) { + case kMS_Unmorphed: { + CVector3f vec = CVector3f::Zero(); + if (CanLeaveMorphBallState(mgr, vec)) { + SetTranslation(GetTranslation() + vec); + LeaveMorphBallState(mgr); + SetCameraState(kCS_FirstPerson, mgr); + ForceGunOrientation(GetTransform(), mgr); + DrawGun(mgr); + } + break; + } + case kMS_Morphed: + EnterMorphBallState(mgr); + ResetBallCamera(mgr); + mgr.CameraManager()->ResetCameraHint(mgr); + mgr.CameraManager()->BallCamera()->Reset(CreateTransformFromMovementDirection(), mgr); + break; + default: + break; + } + } + } + } +} + +void CPlayer::UpdateCameraState(CStateManager& mgr) { UpdateCinematicState(mgr); } + +void CPlayer::SetCameraState(EPlayerCameraState camState, CStateManager& mgr) { + if (x2f4_cameraState == camState) { + return; + } + + x2f4_cameraState = camState; + + CCameraManager* camMgr = mgr.CameraManager(); + switch (camState) { + case kCS_FirstPerson: + camMgr->SetCurrentCameraId(camMgr->GetFirstPersonCamera()->GetUniqueId()); + x768_morphball->SetBallLightActive(mgr, false); + break; + case kCS_Ball: + camMgr->SetCurrentCameraId(camMgr->GetBallCamera()->GetUniqueId()); + x768_morphball->SetBallLightActive(mgr, true); + break; + case kCS_Transitioning: + camMgr->SetCurrentCameraId(camMgr->GetBallCamera()->GetUniqueId()); + x768_morphball->SetBallLightActive(mgr, true); + break; + case kCS_Two: + break; + case kCS_Spawned: { + bool ballLight = false; + if (const CCinematicCamera* cineCam = + TCastToConstPtr< CCinematicCamera >(camMgr->GetCurrentCamera(mgr))) { + ballLight = x2f8_morphBallState == kMS_Morphed && cineCam->GetFlags() & 0x40; + } + x768_morphball->SetBallLightActive(mgr, ballLight); + break; + } + } +} + +void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateManager& mgr) { + if (x304_orbitState == kOS_ForcedOrbitObject || IsMorphBallTransitioning() || + x2f8_morphBallState != kMS_Unmorphed || + (x3b8_grappleState != kGS_None && x3b8_grappleState != kGS_Firing)) { + x3dc_inFreeLook = false; + x3dd_lookButtonHeld = false; + x3de_lookAnalogHeld = false; + x3e8_horizFreeLookAngleVel = 0.f; + x3f0_vertFreeLookAngleVel = 0.f; + x9c4_25_showCrosshairs = false; + return; + } + + if (gpTweakPlayer->mHoldButtonsForFreeLook) { + if ((gpTweakPlayer->mTwoButtonsForFreeLook && + (ControlMapper::GetDigitalInput(ControlMapper::kC_LookHold1, input) && + ControlMapper::GetDigitalInput(ControlMapper::kC_LookHold2, input))) || + (!gpTweakPlayer->mTwoButtonsForFreeLook && + (ControlMapper::GetDigitalInput(ControlMapper::kC_LookHold1, input) || + ControlMapper::GetDigitalInput(ControlMapper::kC_LookHold2, input)))) { + if (!x3dd_lookButtonHeld) { + CVector3f lookDir = + mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().GetColumn(kDY); + CVector3f lookDirFlat = lookDir; + lookDirFlat.SetZ(0.f); + x3e4_freeLookYawAngle = 0.f; + if (lookDirFlat.CanBeNormalized()) { + lookDirFlat.Normalize(); + x3ec_freeLookPitchAngle = acosf(CMath::Limit(CVector3f::Dot(lookDir, lookDirFlat), 1.f)); + if (lookDir.GetZ() < 0.f) { + x3ec_freeLookPitchAngle = -x3ec_freeLookPitchAngle; + } + } + } + x3dc_inFreeLook = true; + x3dd_lookButtonHeld = true; + + if (ControlMapper::GetAnalogInput(ControlMapper::kC_LookLeft, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookRight, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookDown, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookUp, input) >= 0.1f) { + x3de_lookAnalogHeld = true; + } else { + x3de_lookAnalogHeld = false; + } + } else { + x3dc_inFreeLook = false; + x3dd_lookButtonHeld = false; + x3de_lookAnalogHeld = false; + x3e8_horizFreeLookAngleVel = 0.f; + x3f0_vertFreeLookAngleVel = 0.f; + } + } else { + if (ControlMapper::GetAnalogInput(ControlMapper::kC_LookLeft, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookRight, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookDown, input) >= 0.1f || + ControlMapper::GetAnalogInput(ControlMapper::kC_LookUp, input) >= 0.1f) { + x3de_lookAnalogHeld = true; + } else { + x3de_lookAnalogHeld = false; + } + x3dd_lookButtonHeld = false; + if (fabsf(x3e4_freeLookYawAngle) < gpTweakPlayer->mFreeLookCenteredThresholdAngle && + fabsf(x3ec_freeLookPitchAngle) < gpTweakPlayer->mFreeLookCenteredThresholdAngle) { + if (x3e0_curFreeLookCenteredTime > gpTweakPlayer->mFreeLookCenteredTime) { + x3dc_inFreeLook = false; + x3e8_horizFreeLookAngleVel = 0.f; + x3f0_vertFreeLookAngleVel = 0.f; + } else { + x3e0_curFreeLookCenteredTime += dt; + } + } else { + x3dc_inFreeLook = true; + x3e0_curFreeLookCenteredTime = 0.f; + } + } + + UpdateCrosshairsState(input); +} + +void CPlayer::UpdateCameraTimers(float dt, const CFinalInput& input) { + if (x3dc_inFreeLook || x3dd_lookButtonHeld) { + x294_jumpCameraTimer = 0.f; + x29c_fallCameraTimer = 0.f; + return; + } + + if (gpTweakPlayer->mFiringCancelsCameraPitch) { + if (ControlMapper::GetDigitalInput(ControlMapper::kC_FireOrBomb, input) || + ControlMapper::GetDigitalInput(ControlMapper::kC_MissileOrPowerBomb, input)) { + if (x288_startingJumpTimeout > 0.f) { + x2a4_cancelCameraPitch = true; + return; + } + } + } + + if (ControlMapper::GetPressInput(ControlMapper::kC_JumpOrBoost, input)) { + ++x298_jumpPresses; + } + + if (ControlMapper::GetDigitalInput(ControlMapper::kC_JumpOrBoost, input) && + x294_jumpCameraTimer > 0.f && !x2a4_cancelCameraPitch && x298_jumpPresses <= 2) { + x294_jumpCameraTimer += dt; + } + + if (x29c_fallCameraTimer > 0.f && !x2a4_cancelCameraPitch) { + x29c_fallCameraTimer += dt; + } +} + +void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) { + switch (msg) { + case kSM_OnFloor: + if (x258_movementState != NPlayer::kMS_OnGround && x2f8_morphBallState != kMS_Morphed && + x300_fallingTime > 0.3f) { + if (x258_movementState != NPlayer::kMS_Falling) { + float hardThres = CMath::FastSqrtF(-gpTweakPlayer->mNormalGravAccel * 2.f * 30.f); + uchar landVol = + CCast::ToUint8(CMath::Clamp(95.f, -x794_lastVelocity.GetZ() * 1.6f + 95.f, 127.f)); + ushort landSfx; + if (-x794_lastVelocity.GetZ() < hardThres) { + landSfx = GetMaterialSoundUnderPlayer(mgr, skPlayerLandSfxSoft, + ARRAY_SIZE(skPlayerLandSfxSoft), 0xffff); + } else { + landSfx = GetMaterialSoundUnderPlayer(mgr, skPlayerLandSfxHard, + ARRAY_SIZE(skPlayerLandSfxHard), 0xffff); + StartSamusVoiceSfx(SFXsam_voxland_02, 127, 5); + x55c_damageAmt = 0.f; + x560_prevDamageAmt = 10.f; + x564_damageLocation = GetTranslation(); + x558_wasDamaged = true; + mgr.CameraManager()->AddCameraShaker(CCameraShakeData::HardBothAxesShake(0.3f, 1.25f), + false); + StartLandingControlFreeze(); + } + DoSfxEffects(CSfxManager::SfxStart(landSfx, landVol, 64, true)); + + float rumbleMag = -x794_lastVelocity.GetZ() * (1.f / 110.f); + if (rumbleMag > 0.f) { + mgr.GetRumbleManager()->Rumble(mgr, kRFX_PlayerLand, CMath::Limit(rumbleMag, 0.8f), + kRP_One); + } + + x2a0_ = 0.f; + } + } else if (x258_movementState != NPlayer::kMS_OnGround && x2f8_morphBallState == kMS_Morphed) { + if (GetVelocityWR().GetZ() < -40.f && !x768_morphball->GetIsInHalfPipeMode() && + x258_movementState == NPlayer::kMS_ApplyJump && x300_fallingTime > 0.75f) { + SetCoefficientOfRestitutionModifier(0.2f); + } + x768_morphball->Land(); + if (GetVelocityWR().GetZ() < -5.f) { + mgr.GetRumbleManager()->Rumble( + mgr, kRFX_PlayerLand, + CMath::Limit(-GetVelocityWR().GetZ() * (1.f / 110.f) * 0.5f, 0.8f), kRP_One); + x2a0_ = 0.f; + } + if (GetVelocityWR().GetZ() < -30.f) { + mgr.GetRumbleManager()->Rumble(mgr, kRFX_PlayerLand, + CMath::Limit(-GetVelocityWR().GetZ() * (1.f / 110.f), 0.8f), + kRP_One); + x2a0_ = 0.f; + } + } + x300_fallingTime = 0.f; + SetMoveState(NPlayer::kMS_OnGround, mgr); + break; + case kSM_Falling: + if (x2f8_morphBallState == kMS_Morphed) { + if (x768_morphball->GetSpiderBallState() == CMorphBall::kSBS_Active) { + break; + } + } + if (x2f8_morphBallState != kMS_Morphed) { + SetMoveState(NPlayer::kMS_Falling, mgr); + } else if (x258_movementState == NPlayer::kMS_OnGround) { + SetMoveState(NPlayer::kMS_FallingMorphed, mgr); + } + break; + case kSM_LandOnNotFloor: + if (x2f8_morphBallState == kMS_Morphed && + x768_morphball->GetSpiderBallState() == CMorphBall::kSBS_Active && + x258_movementState != NPlayer::kMS_ApplyJump) { + SetMoveState(NPlayer::kMS_ApplyJump, mgr); + } + break; + case kSM_OnIceSurface: + x2ac_surfaceRestraint = kSR_Ice; + break; + case kSM_OnMudSlowSurface: + x2ac_surfaceRestraint = kSR_Organic; + break; + case kSM_OnNormalSurface: + x2ac_surfaceRestraint = kSR_Normal; + break; + case kSM_InSnakeWeed: + x2ac_surfaceRestraint = kSR_Shrubbery; + break; + case kSM_AddSplashInhabitant: { + SetInFluid(true, sender); + UpdateSubmerged(mgr); + float length = 0.5f * GetEyeHeight(); + CMaterialFilter filter = CMaterialFilter::MakeInclude(CMaterialList(kMT_Solid)); + CVector3f dir(0.f, 0.f, -1.f); + const CRayCastResult result = mgr.RayStaticIntersection(GetTranslation(), dir, length, filter); + if (result.IsInvalid()) { + SetVelocityWR(GetVelocityWR() * 0.095f); + SetConstantForceWR(GetConstantForceWR() * 0.095f); + } + break; + } + case kSM_UpdateSplashInhabitant: + UpdateSubmerged(mgr); + if (CheckSubmerged() && !mgr.GetPlayerState()->HasPowerUp(CPlayerState::kIT_GravitySuit)) { + if (const CScriptWater* water = + TCastToConstPtr< CScriptWater >(mgr.ObjectById(InFluidId()))) { + switch (water->GetFluidPlane().GetFluidType()) { + case CFluidPlane::kFT_NormalWater: + x2b0_outOfWaterTicks = 0; + break; + case CFluidPlane::kFT_Lava: + case CFluidPlane::kFT_ThickLava: + x2ac_surfaceRestraint = kSR_Lava; + break; + case CFluidPlane::kFT_PoisonWater: + x2b0_outOfWaterTicks = 0; + break; + case CFluidPlane::kFT_PhazonFluid: + x2ac_surfaceRestraint = kSR_Phazon; + break; + default: + break; + } + } + } + x9c5_25_splashUpdated = true; + break; + case kSM_RemoveSplashInhabitant: + SetInFluid(false, kInvalidUniqueId); + UpdateSubmerged(mgr); + break; + case kSM_ProjectileCollide: + x378_orbitPreventionTimer = gpTweakPlayer->mOrbitPreventionTime; + BreakOrbit(kOB_ProjectileCollide, mgr); + break; + case kSM_AddPlatformRider: + x82e_ridingPlatform = sender; + break; + case kSM_Damage: + if (const CEnergyProjectile* energ = + TCastToConstPtr< CEnergyProjectile >(mgr.ObjectById(sender))) { + if ((energ->GetAttribField() & CWeapon::kPA_StaticInterference) == + CWeapon::kPA_StaticInterference) { + mgr.PlayerState()->StaticInterference().AddSource(GetUniqueId(), 0.3f, + energ->GetInterferenceDuration()); + } + } + break; + case kSM_Deleted: + mgr.PlayerState()->ResetVisor(); + x730_transitionModels.clear(); + break; + default: + break; + } + + x490_gun->AcceptScriptMsg(msg, sender, mgr); + x768_morphball->AcceptScriptMsg(msg, sender, mgr); + CActor::AcceptScriptMsg(msg, sender, mgr); +} + +void CPlayer::PreThink(float dt, CStateManager& mgr) { + x558_wasDamaged = false; + x55c_damageAmt = 0.f; + x560_prevDamageAmt = 0.f; + x564_damageLocation = CVector3f::Zero(); + xa04_preThinkDt = dt; +} + +void CPlayer::AdjustEyeOffset(CStateManager& mgr) { + const CScriptWater* water = TCastToConstPtr< CScriptWater >(mgr.GetObjectById(InFluidId())); + if (!water) { + return; + } + + CVector3f bounds = water->GetTriggerBoundsWR().GetMaxPoint(); + CVector3f eyePos = GetEyePosition(); + eyePos[kDZ] -= GetEyeOffset(); + float waterToDeltaDelta = eyePos.GetZ() - bounds.GetZ(); + + if (eyePos.GetZ() >= bounds.GetZ() && waterToDeltaDelta <= 0.25f) { + SetEyeOffset(GetEyeOffset() + bounds.GetZ() + 0.25f - eyePos.GetZ()); + } else if (eyePos.GetZ() < bounds.GetZ() && waterToDeltaDelta >= -0.2f) { + SetEyeOffset(GetEyeOffset() + bounds.GetZ() - 0.2f - eyePos.GetZ()); + } +} + +void CPlayer::Think(float dt, CStateManager& mgr) { + UpdateStepUpSmoothing(dt); + AdjustEyeOffset(mgr); + UpdateEnvironmentDamageCameraShake(dt, mgr); + UpdatePhazonDamage(dt, mgr); + UpdateFreeLook(dt); + UpdatePlayerHints(mgr); + + if (x2b0_outOfWaterTicks < 2) { + x2b0_outOfWaterTicks += 1; + } + + x9c5_24_ = x9c4_31_inWaterMovement; + x9c4_31_inWaterMovement = x9c5_25_splashUpdated; + x9c5_25_splashUpdated = false; + UpdateBombJumpStuff(); + + if (0.f < x288_startingJumpTimeout) { + x288_startingJumpTimeout -= dt; + if (0.f >= x288_startingJumpTimeout) { + SetMoveState(NPlayer::kMS_ApplyJump, mgr); + } + } + + if (x2a0_ > 0.f) { + x2a0_ += dt; + } + if (x774_samusVoiceTimeout > 0.f) { + x774_samusVoiceTimeout -= dt; + } + if (0.f < x28c_sjTimer) { + x28c_sjTimer -= dt; + } + + x300_fallingTime += dt; + if (x258_movementState == NPlayer::kMS_FallingMorphed && x300_fallingTime > 0.4f) { + SetMoveState(NPlayer::kMS_ApplyJump, mgr); + } + + if (x570_immuneTimer > 0.f) { + x570_immuneTimer -= dt; + } + + Update(dt, mgr); + UpdateTransitionFilter(dt, mgr); + CalculatePlayerMovementDirection(dt); + UpdatePlayerControlDirection(dt, mgr); + + if (gUseSurfaceHack) { + if (gSR_Hack == kSR_Water) { + x2b0_outOfWaterTicks = 0; + } else { + x2ac_surfaceRestraint = gSR_Hack; + } + } + + if (x2f8_morphBallState == kMS_Unmorphed && x9c5_27_camSubmerged && + mgr.GetCameraManager()->GetFluidCounter() == 0) { + if (const CScriptWater* water = GetVisorRunoffEffect(mgr)) { + if (water->GetVisorRunoffEffect()) { + mgr.AddObject(rs_new CHUDBillboardEffect( + rstl::optional_object< TToken< CGenDescription > >(*water->GetVisorRunoffEffect()), + rstl::optional_object_null(), mgr.AllocateUniqueId(), true, + rstl::string_l("WaterSheets"), CHUDBillboardEffect::GetNearClipDistance(mgr), + CHUDBillboardEffect::GetScaleForPOV(mgr), CColor(1.f, 1.f, 1.f, 1.f), + CVector3f(1.f, 1.f, 1.f), CVector3f(0.f, 0.f, 0.f))); + } + DoSfxEffects(CSfxManager::SfxStart(water->GetVisorRunoffSfx())); + } + } + x9c5_27_camSubmerged = mgr.GetCameraManager()->GetFluidCounter() != 0; + + if (x2f8_morphBallState != kMS_Morphed) { + if (fabsf(GetTransform().GetColumn(kDX).GetZ()) > FLT_EPSILON || + fabsf(GetTransform().GetColumn(kDY).GetZ()) > FLT_EPSILON) { + CVector3f backupTranslation = GetTranslation(); + CVector3f lookDirFlat = GetTransform().GetColumn(kDY); + lookDirFlat.SetZ(0.f); + if (lookDirFlat.CanBeNormalized()) { + SetTransform(CTransform4f::LookAt(CUnitVector3f(CVector3f::Zero()), + CUnitVector3f(lookDirFlat.AsNormalized()))); + } else { + SetTransform(CTransform4f::Identity()); + } + SetTranslation(backupTranslation); + } + } + + x794_lastVelocity = GetVelocityWR(); +} + +void CPlayer::SetFrozenState(CStateManager& stateMgr, CAssetId steamTxtr, ushort sfx, + CAssetId iceTxtr) { + if (!stateMgr.GetCameraManager()->IsInCinematicCamera() && !GetFrozenState()) { + bool showMsg; + CSystemState& systemState = gpGameState->SystemState(); + if (x2f8_morphBallState == kMS_Unmorphed) { + showMsg = systemState.AreFreezeInstructionsStillEnabledFirstPerson(); + } else { + showMsg = systemState.AreFreezeInstructionsStillEnabledMorphBall(); + } + + if (showMsg) { + int msgIdx = x2f8_morphBallState != kMS_Morphed ? 19 : 20; + CSamusHud::DisplayHudMemo(rstl::wstring_l(gpStringTable->GetString(msgIdx)), + CHUDMemoParms(5.f, true, false, false)); + } + + x750_frozenTimeout = x758_frozenTimeoutBias + gpTweakPlayer->mFrozenTimeout; + x754_iceBreakJumps = -x75c_additionalIceBreakJumps; + + CPhysicsActor::Stop(); + ClearForcesAndTorques(); + if (x3b8_grappleState != kGS_None) { + BreakGrapple(kOB_Freeze, stateMgr); + } else { + BreakOrbit(kOB_Freeze, stateMgr); + } + + AddMaterial(kMT_Immovable, stateMgr); + IsMorphBallTransitioning(); + xa08_steamTextureId = steamTxtr; + xa0c_iceTextureId = iceTxtr; + DoSfxEffects(CSfxManager::SfxStart(sfx)); + EndLandingControlFreeze(); + } +} + +bool CPlayer::GetFrozenState() const { return x750_frozenTimeout > 0.f; } + +void CPlayer::BreakFrozenState(CStateManager& stateMgr) { + if (!GetFrozenState()) { + return; + } + + x750_frozenTimeout = 0.f; + x754_iceBreakJumps = 0; + CPhysicsActor::Stop(); + ClearForcesAndTorques(); + RemoveMaterial(kMT_Immovable, stateMgr); + if (!stateMgr.GetCameraManager()->IsInCinematicCamera() && xa0c_iceTextureId != kInvalidAssetId) { + stateMgr.AddObject(rs_new CHUDBillboardEffect( + rstl::optional_object< TToken< CGenDescription > >( + gpSimplePool->GetObj(SObjectTag('PART', xa0c_iceTextureId))), + rstl::optional_object_null(), stateMgr.AllocateUniqueId(), true, + rstl::string_l("FrostExplosion"), CHUDBillboardEffect::GetNearClipDistance(stateMgr), + CHUDBillboardEffect::GetScaleForPOV(stateMgr), CColor(1.f, 1.f, 1.f, 1.f), + CVector3f(1.f, 1.f, 1.f), CVector3f(0.f, 0.f, 0.f))); + DoSfxEffects(CSfxManager::SfxStart(SFXcrk_break_final)); + } + + x768_morphball->ResetMorphBallIceBreak(); + SetVisorSteam(0.f, 6.f / 14.f, 1.f / 14.f, xa08_steamTextureId, false); +} + +void CPlayer::UpdateFrozenState(const CFinalInput& input, CStateManager& mgr) { + x750_frozenTimeout -= input.Time(); + if (x750_frozenTimeout > 0.f) { + SetVisorSteam(0.7f, 6.f / 14.f, 1.f / 14.f, xa08_steamTextureId, false); + } else { + BreakFrozenState(mgr); + return; + } + if (x258_movementState == NPlayer::kMS_OnGround || + x258_movementState == NPlayer::kMS_FallingMorphed) { + Stop(); + ClearForcesAndTorques(); + } + x7a0_visorSteam.Update(input.Time()); + + switch (x2f8_morphBallState) { + case kMS_Morphed: + x490_gun->ProcessInput(input, mgr); + break; + case kMS_Unmorphed: + case kMS_Morphing: + case kMS_Unmorphing: + if (ControlMapper::GetPressInput(ControlMapper::kC_JumpOrBoost, input)) { + if (x754_iceBreakJumps != 0) { + /* Subsequent Breaks */ + DoSfxEffects(CSfxManager::SfxStart(SFXcrk_break_subsequent)); + } else { + /* Initial Break */ + DoSfxEffects(CSfxManager::SfxStart(SFXcrk_break_initial)); + } + int max = gpTweakPlayer->mIceBreakJumpCount; + if (++x754_iceBreakJumps > max) { + gpGameState->SystemState().IncNumFreezeInstructionsPrintedFirstPerson(); + CSamusHud::ClearHudMemo(); + BreakFrozenState(mgr); + } + } + break; + } +} + +void CPlayer::EndLandingControlFreeze() { + x760_controlsFrozen = false; + x764_controlsFrozenTimeout = 0.f; +} + +void CPlayer::UpdateControlLostState(float dt, CStateManager& mgr) { + x764_controlsFrozenTimeout -= dt; + if (x764_controlsFrozenTimeout <= 0.f) { + EndLandingControlFreeze(); + } else { + const CFinalInput dummy; + if (x2f8_morphBallState == kMS_Morphed) { + x768_morphball->ComputeBallMovement(dummy, mgr, dt); + x768_morphball->UpdateBallDynamics(mgr, dt); + } else { + ComputeMovement(dummy, mgr, dt); + } + } +} + +void CPlayer::StartLandingControlFreeze() { + x760_controlsFrozen = true; + x764_controlsFrozenTimeout = 0.75f; +} diff --git a/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp index 8c5146ca..d5c95e5d 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptBallTrigger.cpp @@ -8,7 +8,7 @@ #include "rstl/math.hpp" static CAABox calculate_ball_aabox() { - const float extent = 0.33f * gpTweakPlayer->GetPlayerBallHalfExtent(); + const float extent = 0.33f * gpTweakPlayer->mPlayerBallHalfExtent; return CAABox(CVector3f(-extent, -extent, -extent), CVector3f(extent, extent, extent)); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp index 42adb27a..c3e2c03e 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptBeam.cpp @@ -24,7 +24,7 @@ void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, GetTransform(), kMT_Projectile, x138_damageInfo, x154_projectileId, GetCurrentAreaId(), GetUniqueId(), CPlasmaProjectile::PlayerEffectResources(), false, - kPA_KeepInCinematic // TODO: wrong attrib definition? + CWeapon::kPA_KeepInCinematic // TODO: wrong attrib definition? )); } break; diff --git a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp index 92179954..e7258595 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptEMPulse.cpp @@ -92,8 +92,8 @@ void CScriptEMPulse::Touch(CActor& act, CStateManager& mgr) { if (dur > pl->GetStaticTimer()) { pl->SetHudDisable(dur); - pl->SetOrbitRequestForTarget(mgr.GetPlayer()->GetOrbitTargetId(), kOR_ActivateOrbitSource, - mgr); + pl->TryToBreakOrbit(mgr.GetPlayer()->GetOrbitTargetId(), CPlayer::kOB_ActivateOrbitSource, + mgr); } mgr.PlayerState()->StaticInterference().AddSource(GetUniqueId(), mag, dur); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp index 3007e6aa..3ebdd970 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp @@ -171,21 +171,21 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) { int total = playerState->GetTotalPickupCount(); int colRate = playerState->CalculateItemCollectionRate(); if (colRate == total) { - CSystemOptions& opts = gpGameState->SystemOptions(); + CSystemState& state = gpGameState->SystemState(); CAssetId id = gpResourceFactory - ->GetResourceIdByName(opts.GetAllItemsCollected() ? "STRG_AllPickupsFound_2" + ->GetResourceIdByName(state.GetAllItemsCollected() ? "STRG_AllPickupsFound_2" : "STRG_AllPickupsFound_1") ->GetId(); mgr.QueueMessage(mgr.GetHUDMessageFrameCount() + 1, id, 0.f); - opts.SetAllItemsCollected(true); + state.SetAllItemsCollected(true); } } if (itemType == CPlayerState::kIT_PowerBombs) { - CSystemOptions& opts = gpGameState->SystemOptions(); - if (opts.GetShowPowerBombAmmoMessage()) { - opts.IncrementPowerBombAmmoCount(); + CSystemState& state = gpGameState->SystemState(); + if (state.GetShowPowerBombAmmoMessage()) { + state.IncrementPowerBombAmmoCount(); CSamusHud::DisplayHudMemo(rstl::wstring_l(gpStringTable->GetString(109)), CHUDMemoParms(5.f, true, false, false)); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index 36099216..8030a7eb 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -303,7 +303,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (msg == kSM_Action) { CPlayerState& pState = *mgr.PlayerState(); pState.SetPickup(CPlayerState::kIT_Missiles, - pState.GetItemCapacity(CPlayerState::kIT_Missiles)); + pState.GetItemCapacity(CPlayerState::kIT_Missiles)); } break; } @@ -311,7 +311,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (msg == kSM_Action) { CPlayerState& pState = *mgr.PlayerState(); pState.SetPickup(CPlayerState::kIT_PowerBombs, - pState.GetItemCapacity(CPlayerState::kIT_PowerBombs)); + pState.GetItemCapacity(CPlayerState::kIT_PowerBombs)); } break; } @@ -436,7 +436,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } } else if (msg == kSM_Decrement) { mgr.SetCinematicSkipObject(kInvalidUniqueId); - gpGameState->SystemOptions().SetCinematicState( + gpGameState->SystemState().SetCinematicState( rstl::pair< CAssetId, TEditorId >(mgr.GetWorld()->GetWorldAssetId(), GetEditorId()), true); } @@ -607,7 +607,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& mgr) const { CAssetId mlvlId = mgr.GetWorld()->GetWorldAssetId(); TEditorId cineId = GetEditorId(); - return gpGameState->SystemOptions().GetCinematicState( + return gpGameState->SystemState().GetCinematicState( rstl::pair< CAssetId, TEditorId >(mlvlId, cineId)); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp index aa611b37..27696d81 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp @@ -65,9 +65,9 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) { kTFL_DetectProjectiles4 | kTFL_DetectProjectiles5 | kTFL_DetectProjectiles6 | kTFL_DetectProjectiles7; } else if (const CWeapon* weap = TCastToConstPtr< CWeapon >(act)) { - if ((weap->GetAttribField() & kPA_Bombs) == kPA_Bombs) { + if ((weap->GetAttribField() & CWeapon::kPA_Bombs) == CWeapon::kPA_Bombs) { testFlags |= kTFL_DetectBombs; - } else if ((weap->GetAttribField() & kPA_PowerBombs) == kPA_PowerBombs) { + } else if ((weap->GetAttribField() & CWeapon::kPA_PowerBombs) == CWeapon::kPA_PowerBombs) { testFlags |= kTFL_DetectPowerBombs; } } diff --git a/src/MetroidPrime/Tweaks/CTweakPlayer.cpp b/src/MetroidPrime/Tweaks/CTweakPlayer.cpp index 9167bc73..21589bcc 100644 --- a/src/MetroidPrime/Tweaks/CTweakPlayer.cpp +++ b/src/MetroidPrime/Tweaks/CTweakPlayer.cpp @@ -4,199 +4,199 @@ #include "Kyoto/Streams/CInputStream.hpp" CTweakPlayer::CTweakPlayer(CInputStream& in) -: x2d8_grappleBeamSpeed(0.0) -, x2dc_grappleBeamXWaveAmplitude(0.0) -, x2e0_grappleBeamZWaveAmplitude(0.0) -, x2e4_grappleBeamAnglePhaseDelta(0.0) { +: mGrappleBeamSpeed(0.0) +, mGrappleBeamXWaveAmplitude(0.0) +, mGrappleBeamZWaveAmplitude(0.0) +, mGrappleBeamAnglePhaseDelta(0.0) { int i; - for (i = 0; i < ARRAY_SIZE(x4_maxTranslationalAcceleration); ++i) { - x4_maxTranslationalAcceleration[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mMaxTranslationalAcceleration); ++i) { + mMaxTranslationalAcceleration[i] = in.ReadFloat(); } - for (i = 0; i < ARRAY_SIZE(x24_maxRotationalAcceleration); ++i) { - x24_maxRotationalAcceleration[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mMaxRotationalAcceleration); ++i) { + mMaxRotationalAcceleration[i] = in.ReadFloat(); } - for (i = 0; i < ARRAY_SIZE(x44_translationFriction); ++i) { - x44_translationFriction[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mTranslationFriction); ++i) { + mTranslationFriction[i] = in.ReadFloat(); } - for (i = 0; i < ARRAY_SIZE(x64_rotationFriction); ++i) { - x64_rotationFriction[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mRotationFriction); ++i) { + mRotationFriction[i] = in.ReadFloat(); } - for (i = 0; i < ARRAY_SIZE(x84_rotationMaxSpeed); ++i) { - x84_rotationMaxSpeed[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mRotationMaxSpeed); ++i) { + mRotationMaxSpeed[i] = in.ReadFloat(); } - for (i = 0; i < ARRAY_SIZE(xa4_translationMaxSpeed); ++i) { - xa4_translationMaxSpeed[i] = in.ReadFloat(); + for (i = 0; i < ARRAY_SIZE(mTranslationMaxSpeed); ++i) { + mTranslationMaxSpeed[i] = in.ReadFloat(); } - xc4_normalGravAccel = in.ReadFloat(); - xc8_fluidGravAccel = in.ReadFloat(); - xcc_verticalJumpAccel = in.ReadFloat(); - xd0_horizontalJumpAccel = in.ReadFloat(); - xd4_verticalDoubleJumpAccel = in.ReadFloat(); - xd8_horizontalDoubleJumpAccel = in.ReadFloat(); - xdc_waterJumpFactor = in.ReadFloat(); - xe0_waterBallJumpFactor = in.ReadFloat(); - xe4_lavaJumpFactor = in.ReadFloat(); - xe8_lavaBallJumpFactor = in.ReadFloat(); - xec_phazonJumpFactor = in.ReadFloat(); - xf0_phazonBallJumpFactor = in.ReadFloat(); - xf4_allowedJumpTime = in.ReadFloat(); - xf8_allowedDoubleJumpTime = in.ReadFloat(); - xfc_minDoubleJumpWindow = in.ReadFloat(); - x100_maxDoubleJumpWindow = in.ReadFloat(); + mNormalGravAccel = in.ReadFloat(); + mFluidGravAccel = in.ReadFloat(); + mVerticalJumpAccel = in.ReadFloat(); + mHorizontalJumpAccel = in.ReadFloat(); + mVerticalDoubleJumpAccel = in.ReadFloat(); + mHorizontalDoubleJumpAccel = in.ReadFloat(); + mWaterJumpFactor = in.ReadFloat(); + mWaterBallJumpFactor = in.ReadFloat(); + mLavaJumpFactor = in.ReadFloat(); + mLavaBallJumpFactor = in.ReadFloat(); + mPhazonJumpFactor = in.ReadFloat(); + mPhazonBallJumpFactor = in.ReadFloat(); + mAllowedJumpTime = in.ReadFloat(); + mAllowedDoubleJumpTime = in.ReadFloat(); + mMinDoubleJumpWindow = in.ReadFloat(); + mMaxDoubleJumpWindow = in.ReadFloat(); x104_ = in.ReadFloat(); - x108_minJumpTime = in.ReadFloat(); - x10c_minDoubleJumpTime = in.ReadFloat(); - x110_allowedLedgeTime = in.ReadFloat(); - x114_doubleJumpImpulse = in.ReadFloat(); - x118_backwardsForceMultiplier = in.ReadFloat(); - x11c_bombJumpRadius = in.ReadFloat(); - x120_bombJumpHeight = in.ReadFloat(); - x124_eyeOffset = in.ReadFloat(); - x128_turnSpeedMultiplier = in.ReadFloat(); - x12c_freeLookTurnSpeedMultiplier = in.ReadFloat(); + mMinJumpTime = in.ReadFloat(); + mMinDoubleJumpTime = in.ReadFloat(); + mAllowedLedgeTime = in.ReadFloat(); + mDoubleJumpImpulse = in.ReadFloat(); + mBackwardsForceMultiplier = in.ReadFloat(); + mBombJumpRadius = in.ReadFloat(); + mBombJumpHeight = in.ReadFloat(); + mEyeOffset = in.ReadFloat(); + mTurnSpeedMultiplier = in.ReadFloat(); + mFreeLookTurnSpeedMultiplier = in.ReadFloat(); - x130_horizontalFreeLookAngleVel = in.ReadFloat() * (M_PIF / 180.f); - x134_verticalFreeLookAngleVel = in.ReadFloat() * (M_PIF / 180.f); - x138_freeLookSpeed = in.ReadFloat() * (M_PIF / 180.f); - x13c_freeLookSnapSpeed = in.ReadFloat() * (M_PIF / 180.f); + mHorizontalFreeLookAngleVel = in.ReadFloat() * (M_PIF / 180.f); + mVerticalFreeLookAngleVel = in.ReadFloat() * (M_PIF / 180.f); + mFreeLookSpeed = in.ReadFloat() * (M_PIF / 180.f); + mFreeLookSnapSpeed = in.ReadFloat() * (M_PIF / 180.f); x140_ = in.ReadFloat() * (M_PIF / 180.f); - x144_freeLookCenteredThresholdAngle = in.ReadFloat() * (M_PIF / 180.f); + mFreeLookCenteredThresholdAngle = in.ReadFloat() * (M_PIF / 180.f); - x148_freeLookCenteredTime = in.ReadFloat(); - x14c_freeLookDampenFactor = in.ReadFloat(); - x150_leftDiv = in.ReadFloat(); - x154_rightDiv = in.ReadFloat(); + mFreeLookCenteredTime = in.ReadFloat(); + mFreeLookDampenFactor = in.ReadFloat(); + mLeftDiv = in.ReadFloat(); + mRightDiv = in.ReadFloat(); - x228_24_freelookTurnsPlayer = in.ReadBool(); + mFreelookTurnsPlayer = in.ReadBool(); x228_25_ = in.ReadBool(); x228_26_ = in.ReadBool(); - x228_27_moveDuringFreeLook = in.ReadBool(); - x228_28_holdButtonsForFreeLook = in.ReadBool(); - x228_29_twoButtonsForFreeLook = in.ReadBool(); + mMoveDuringFreeLook = in.ReadBool(); + mHoldButtonsForFreeLook = in.ReadBool(); + mTwoButtonsForFreeLook = in.ReadBool(); x228_30_ = in.ReadBool(); x228_31_ = in.ReadBool(); x229_24_ = in.ReadBool(); - x229_25_aimWhenOrbitingPoint = in.ReadBool(); - x229_26_stayInFreeLookWhileFiring = in.ReadBool(); + mAimWhenOrbitingPoint = in.ReadBool(); + mStayInFreeLookWhileFiring = in.ReadBool(); x229_27_ = in.ReadBool(); x229_28_ = in.ReadBool(); - x229_29_orbitFixedOffset = in.ReadBool(); - x229_30_gunButtonTogglesHolster = in.ReadBool(); - x229_31_gunNotFiringHolstersGun = in.ReadBool(); - x22a_24_fallingDoubleJump = in.ReadBool(); - x22a_25_impulseDoubleJump = in.ReadBool(); - x22a_26_firingCancelsCameraPitch = in.ReadBool(); - x22a_27_assistedAimingIgnoreHorizontal = in.ReadBool(); - x22a_28_assistedAimingIgnoreVertical = in.ReadBool(); + mOrbitFixedOffset = in.ReadBool(); + mGunButtonTogglesHolster = in.ReadBool(); + mGunNotFiringHolstersGun = in.ReadBool(); + mFallingDoubleJump = in.ReadBool(); + mImpulseDoubleJump = in.ReadBool(); + mFiringCancelsCameraPitch = in.ReadBool(); + mAssistedAimingIgnoreHorizontal = in.ReadBool(); + mAssistedAimingIgnoreVertical = in.ReadBool(); x22c_ = in.ReadFloat(); x230_ = in.ReadFloat(); - x234_aimMaxDistance = in.ReadFloat(); + mAimMaxDistance = in.ReadFloat(); x238_ = in.ReadFloat() * (M_PIF / 180.f); x23c_ = in.ReadFloat() * (M_PIF / 180.f); x240_ = in.ReadFloat() * (M_PIF / 180.f); x244_ = in.ReadFloat() * (M_PIF / 180.f); x248_ = in.ReadFloat() * (M_PIF / 180.f); - x24c_aimThresholdDistance = in.ReadFloat(); + mAimThresholdDistance = in.ReadFloat(); x250_ = in.ReadFloat() * (M_PIF / 180.f); x254_ = in.ReadFloat(); - x258_aimBoxWidth = in.ReadFloat(); - x25c_aimBoxHeight = in.ReadFloat(); - x260_aimTargetTimer = in.ReadFloat(); - x264_aimAssistHorizontalAngle = in.ReadFloat() * (M_PIF / 180.f); - x268_aimAssistVerticalAngle = in.ReadFloat() * (M_PIF / 180.f); + mAimBoxWidth = in.ReadFloat(); + mAimBoxHeight = in.ReadFloat(); + mAimTargetTimer = in.ReadFloat(); + mAimAssistHorizontalAngle = in.ReadFloat() * (M_PIF / 180.f); + mAimAssistVerticalAngle = in.ReadFloat() * (M_PIF / 180.f); for (i = 0; i < 3; ++i) { - x158_orbitMinDistance[i] = in.ReadFloat(); - x164_orbitNormalDistance[i] = in.ReadFloat(); - x170_orbitMaxDistance[i] = in.ReadFloat(); + mOrbitMinDistance[i] = in.ReadFloat(); + mOrbitNormalDistance[i] = in.ReadFloat(); + mOrbitMaxDistance[i] = in.ReadFloat(); } x17c_ = in.ReadFloat() * (M_PIF / 180.f); - x180_orbitModeTimer = in.ReadFloat(); - x184_orbitCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); - x188_orbitUpperAngle = in.ReadFloat() * (M_PIF / 180.f); - x18c_orbitLowerAngle = in.ReadFloat() * (M_PIF / 180.f); - x190_orbitHorizAngle = in.ReadFloat() * (M_PIF / 180.f); + mOrbitModeTimer = in.ReadFloat(); + mOrbitCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); + mOrbitUpperAngle = in.ReadFloat() * (M_PIF / 180.f); + mOrbitLowerAngle = in.ReadFloat() * (M_PIF / 180.f); + mOrbitHorizAngle = in.ReadFloat() * (M_PIF / 180.f); x194_ = in.ReadFloat() * (M_PIF / 180.f); x198_ = in.ReadFloat() * (M_PIF / 180.f); - x19c_orbitMaxTargetDistance = in.ReadFloat(); - x1a0_orbitMaxLockDistance = in.ReadFloat(); - x1a4_orbitDistanceThreshold = in.ReadFloat(); + mOrbitMaxTargetDistance = in.ReadFloat(); + mOrbitMaxLockDistance = in.ReadFloat(); + mOrbitDistanceThreshold = in.ReadFloat(); for (i = 0; i < 2; ++i) { - x1a8_orbitScreenBoxHalfExtentX[i] = in.ReadLong(); - x1b0_orbitScreenBoxHalfExtentY[i] = in.ReadLong(); - x1b8_orbitScreenBoxCenterX[i] = in.ReadLong(); - x1c0_orbitScreenBoxCenterY[i] = in.ReadLong(); - x1c8_orbitZoneIdealX[i] = in.ReadLong(); - x1d0_orbitZoneIdealY[i] = in.ReadLong(); + mOrbitScreenBoxHalfExtentX[i] = in.ReadLong(); + mOrbitScreenBoxHalfExtentY[i] = in.ReadLong(); + mOrbitScreenBoxCenterX[i] = in.ReadLong(); + mOrbitScreenBoxCenterY[i] = in.ReadLong(); + mOrbitZoneIdealX[i] = in.ReadLong(); + mOrbitZoneIdealY[i] = in.ReadLong(); } - x1d8_orbitNearX = in.ReadFloat(); - x1dc_orbitNearZ = in.ReadFloat(); + mOrbitNearX = in.ReadFloat(); + mOrbitNearZ = in.ReadFloat(); x1e0_ = in.ReadFloat(); x1e4_ = in.ReadFloat(); - x1e8_orbitFixedOffsetZDiff = in.ReadFloat(); - x1ec_orbitZRange = in.ReadFloat(); + mOrbitFixedOffsetZDiff = in.ReadFloat(); + mOrbitZRange = in.ReadFloat(); x1f0_ = in.ReadFloat() * (M_PIF / 180.f); x1f4_ = in.ReadFloat() * (M_PIF / 180.f); x1f8_ = in.ReadFloat(); - x1fc_orbitPreventionTime = in.ReadFloat(); - x200_24_dashEnabled = in.ReadBool(); - x200_25_dashOnButtonRelease = in.ReadBool(); - x204_dashButtonHoldCancelTime = in.ReadFloat(); - x208_dashStrafeInputThreshold = in.ReadFloat(); - x20c_sidewaysDoubleJumpImpulse = in.ReadFloat(); - x210_sidewaysVerticalDoubleJumpAccel = in.ReadFloat(); - x214_sidewaysHorizontalDoubleJumpAccel = in.ReadFloat(); - x218_scanningRange = in.ReadFloat(); - x21c_24_scanRetention = in.ReadBool(); - x21c_25_scanFreezesGame = in.ReadBool(); - x21c_26_orbitWhileScanning = in.ReadBool(); - x220_scanMaxTargetDistance = in.ReadFloat(); - x224_scanMaxLockDistance = in.ReadFloat(); - x2a0_orbitDistanceMax = in.ReadFloat(); - x2a4_grappleSwingLength = in.ReadFloat(); - x2a8_grappleSwingPeriod = in.ReadFloat(); - x2ac_grapplePullSpeedMin = in.ReadFloat(); - x2b0_grappleCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); - x2b4_maxGrappleLockedTurnAlignDistance = in.ReadFloat(); - x2b8_grapplePullSpeedProportion = in.ReadFloat(); - x2bc_grapplePullSpeedMax = in.ReadFloat(); - x2c0_grappleLookCenterSpeed = in.ReadFloat() * (M_PIF / 180.f); - x2c4_maxGrappleTurnSpeed = in.ReadFloat(); - x2c8_grappleJumpForce = in.ReadFloat(); - x2cc_grappleReleaseTime = in.ReadFloat(); - x2d0_grappleJumpMode = in.ReadLong(); - x2d4_orbitReleaseBreaksGrapple = in.ReadBool(); - x2d5_invertGrappleTurn = in.ReadBool(); - x2d8_grappleBeamSpeed = in.ReadFloat(); - x2dc_grappleBeamXWaveAmplitude = in.ReadFloat(); - x2e0_grappleBeamZWaveAmplitude = in.ReadFloat(); - x2e4_grappleBeamAnglePhaseDelta = in.ReadFloat(); - x26c_playerHeight = in.ReadFloat(); - x270_playerXYHalfExtent = in.ReadFloat(); - x274_stepUpHeight = in.ReadFloat(); - x278_stepDownHeight = in.ReadFloat(); - x27c_playerBallHalfExtent = in.ReadFloat(); - x280_firstPersonCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); + mOrbitPreventionTime = in.ReadFloat(); + mDashEnabled = in.ReadBool(); + mDashOnButtonRelease = in.ReadBool(); + mDashButtonHoldCancelTime = in.ReadFloat(); + mDashStrafeInputThreshold = in.ReadFloat(); + mSidewaysDoubleJumpImpulse = in.ReadFloat(); + mSidewaysVerticalDoubleJumpAccel = in.ReadFloat(); + mSidewaysHorizontalDoubleJumpAccel = in.ReadFloat(); + mScanningRange = in.ReadFloat(); + mScanRetention = in.ReadBool(); + mScanFreezesGame = in.ReadBool(); + mOrbitWhileScanning = in.ReadBool(); + mScanMaxTargetDistance = in.ReadFloat(); + mScanMaxLockDistance = in.ReadFloat(); + mOrbitDistanceMax = in.ReadFloat(); + mGrappleSwingLength = in.ReadFloat(); + mGrappleSwingPeriod = in.ReadFloat(); + mGrapplePullSpeedMin = in.ReadFloat(); + mGrappleCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); + mMaxGrappleLockedTurnAlignDistance = in.ReadFloat(); + mGrapplePullSpeedProportion = in.ReadFloat(); + mGrapplePullSpeedMax = in.ReadFloat(); + mGrappleLookCenterSpeed = in.ReadFloat() * (M_PIF / 180.f); + mMaxGrappleTurnSpeed = in.ReadFloat(); + mGrappleJumpForce = in.ReadFloat(); + mGrappleReleaseTime = in.ReadFloat(); + mGrappleJumpMode = in.ReadLong(); + mOrbitReleaseBreaksGrapple = in.ReadBool(); + mInvertGrappleTurn = in.ReadBool(); + mGrappleBeamSpeed = in.ReadFloat(); + mGrappleBeamXWaveAmplitude = in.ReadFloat(); + mGrappleBeamZWaveAmplitude = in.ReadFloat(); + mGrappleBeamAnglePhaseDelta = in.ReadFloat(); + mPlayerHeight = in.ReadFloat(); + mPlayerXYHalfExtent = in.ReadFloat(); + mStepUpHeight = in.ReadFloat(); + mStepDownHeight = in.ReadFloat(); + mPlayerBallHalfExtent = in.ReadFloat(); + mFirstPersonCameraSpeed = in.ReadFloat() * (M_PIF / 180.f); x284_ = in.ReadFloat() * (M_PIF / 180.f); - x288_jumpCameraPitchDownStart = in.ReadFloat(); - x28c_jumpCameraPitchDownFull = in.ReadFloat(); - x290_jumpCameraPitchDownAngle = in.ReadFloat() * (M_PIF / 180.f); - x294_fallCameraPitchDownStart = in.ReadFloat(); - x298_fallCameraPitchDownFull = in.ReadFloat(); - x29c_fallCameraPitchDownAngle = in.ReadFloat() * (M_PIF / 180.f); + mJumpCameraPitchDownStart = in.ReadFloat(); + mJumpCameraPitchDownFull = in.ReadFloat(); + mJumpCameraPitchDownAngle = in.ReadFloat() * (M_PIF / 180.f); + mFallCameraPitchDownStart = in.ReadFloat(); + mFallCameraPitchDownFull = in.ReadFloat(); + mFallCameraPitchDownAngle = in.ReadFloat() * (M_PIF / 180.f); x2e8_ = in.ReadFloat(); x2ec_ = in.ReadFloat(); x2f0_ = in.ReadFloat(); x2f4_ = in.ReadBool(); - x2f8_frozenTimeout = in.ReadFloat(); - x2fc_iceBreakJumpCount = in.ReadLong(); - x300_variaDamageReduction = in.ReadFloat(); - x304_gravityDamageReduction = in.ReadFloat(); - x308_phazonDamageReduction = in.ReadFloat(); + mFrozenTimeout = in.ReadFloat(); + mIceBreakJumpCount = in.ReadLong(); + mVariaDamageReduction = in.ReadFloat(); + mGravityDamageReduction = in.ReadFloat(); + mPhazonDamageReduction = in.ReadFloat(); } diff --git a/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp b/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp index 79701af9..124d1ce5 100644 --- a/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp +++ b/src/MetroidPrime/Weapons/CElectricBeamProjectile.cpp @@ -110,7 +110,7 @@ void CElectricBeamProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueI CStateManager& mgr) { switch (msg) { case kSM_Registered: - mgr.AddWeaponId(GetOwnerId(), GetWeaponType()); + mgr.AddWeaponId(GetOwnerId(), GetType()); CauseDamage(true); break; case kSM_Deleted: diff --git a/src/MetroidPrime/Weapons/CGunWeapon.cpp b/src/MetroidPrime/Weapons/CGunWeapon.cpp index 94bb8b11..607ed895 100644 --- a/src/MetroidPrime/Weapons/CGunWeapon.cpp +++ b/src/MetroidPrime/Weapons/CGunWeapon.cpp @@ -400,11 +400,11 @@ void CGunWeapon::Fire(bool underwater, float dt, CPlayerState::EChargeStage char uint particleChargeAttribs = 0; if (partialCharge) - particleChargeAttribs = kPA_PartialCharge; + particleChargeAttribs = CWeapon::kPA_PartialCharge; - uint attribs = kPA_ArmCannon; + uint attribs = CWeapon::kPA_ArmCannon; if (chargeState != CPlayerState::kCS_Normal) - attribs = kPA_ArmCannon | kPA_Charged; + attribs = CWeapon::kPA_ArmCannon | CWeapon::kPA_Charged; CEnergyProjectile* proj = rs_new CEnergyProjectile( true, x144_weapons[chargeState], x1c0_weaponType, xf, x1c8_playerMaterial, dInfo, @@ -418,7 +418,7 @@ void CGunWeapon::Fire(bool underwater, float dt, CPlayerState::EChargeStage char if (chargeState != CPlayerState::kCS_Normal) { x218_25_enableCharge = true; - mgr.CameraManager()->AddCameraShaker(CCameraShakeData::skChargedShotCameraShakeData, false); + mgr.CameraManager()->AddCameraShaker(CCameraShakeData::skHardRecoil, false); } x10_solidModelData->AnimationData()->EnableLooping(false); diff --git a/src/MetroidPrime/Weapons/CPowerBomb.cpp b/src/MetroidPrime/Weapons/CPowerBomb.cpp index b3325330..acc0bca7 100644 --- a/src/MetroidPrime/Weapons/CPowerBomb.cpp +++ b/src/MetroidPrime/Weapons/CPowerBomb.cpp @@ -18,7 +18,7 @@ CPowerBomb::CPowerBomb(TToken< CGenDescription > particle, TUniqueId uid, TAreaI : CWeapon(uid, aid, true, playerId, kWT_PowerBomb, rstl::string_l("PowerBomb"), xf, CMaterialFilter::MakeIncludeExclude(CMaterialList(kMT_Trigger, kMT_Immovable, kMT_Solid), CMaterialList(kMT_Projectile, kMT_PowerBomb)), - CMaterialList(kMT_Projectile, kMT_PowerBomb), dInfo, kPA_PowerBombs, + CMaterialList(kMT_Projectile, kMT_PowerBomb), dInfo, CWeapon::kPA_PowerBombs, CModelData::CModelDataNull()) , x158_24_canStartFilter(true) @@ -98,7 +98,7 @@ void CPowerBomb::Accept(IVisitor& visitor) { visitor.Visit(*this); } void CPowerBomb::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { switch (msg) { case kSM_Registered: - mgr.AddWeaponId(GetOwnerId(), GetWeaponType()); + mgr.AddWeaponId(GetOwnerId(), GetType()); OrigDamageInfo().SetRadius(0.f); if (mgr.GetPlayerState()->IsAlive()) { CSfxManager::AddEmitter(SFXsfx0710, GetTranslation(), CVector3f::Zero(), true, false); @@ -113,7 +113,7 @@ void CPowerBomb::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CState if (x15c_curTime <= 7.0f) { mgr.CameraFilterPass(CStateManager::kCFS_Six).DisableFilter(0.f); } - mgr.RemoveWeaponId(GetOwnerId(), GetWeaponType()); + mgr.RemoveWeaponId(GetOwnerId(), GetType()); break; default: diff --git a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp index 8527de5b..9ecc43b5 100644 --- a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp +++ b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp @@ -12,7 +12,7 @@ CTargetableProjectile::CTargetableProjectile( const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, ushort visorSfx, bool sendCollideMsg) : CEnergyProjectile(true, desc, type, xf, materials, damage, uid, aid, owner, homingTarget, - attribs | kPA_BigProjectile | kPA_PartialCharge | kPA_PlasmaProjectile, false, + attribs | CWeapon::kPA_BigProjectile | CWeapon::kPA_PartialCharge | CWeapon::kPA_PlasmaProjectile, false, CVector3f(1.f, 1.f, 1.f), visorParticle, visorSfx, sendCollideMsg) , x3d8_weaponDesc(weapDesc) , x3e0_damage(damage2) { @@ -36,10 +36,10 @@ bool CTargetableProjectile::Explode(const CVector3f& pos, const CVector3f& norma CVector3f aimPosition = act->GetAimPosition(mgr, 0.f); CEnergyProjectile* projectile = rs_new CEnergyProjectile( - true, x3d8_weaponDesc, GetWeaponType(), + true, x3d8_weaponDesc, GetType(), CTransform4f::LookAt(x170_projectile.GetTranslation(), aimPosition, CVector3f::Up()), kMT_Player, x3e0_damage, uid, GetCurrentAreaId(), GetHitProjectileOwner(), GetOwnerId(), - kPA_None, false, CVector3f(1.f, 1.f, 1.f), rstl::optional_object_null(), + CWeapon::kPA_None, false, CVector3f(1.f, 1.f, 1.f), rstl::optional_object_null(), CSfxManager::kInternalInvalidSfxId, false); mgr.AddObject(projectile); projectile->AddMaterial(kMT_Orbit, mgr); diff --git a/src/MetroidPrime/Weapons/CWaveBeam.cpp b/src/MetroidPrime/Weapons/CWaveBeam.cpp index 21d8d89d..fa5dbe84 100644 --- a/src/MetroidPrime/Weapons/CWaveBeam.cpp +++ b/src/MetroidPrime/Weapons/CWaveBeam.cpp @@ -102,9 +102,9 @@ void CWaveBeam::Fire(bool underwater, float dt, CPlayerState::EChargeStage charg CTransform4f shotXf = xf * CTransform4f::RotateY(CRelAngle::FromDegrees((randAng + i) * skShotAnglePitch)); CEnergyProjectile* proj = rs_new CEnergyProjectile( - true, x144_weapons[chargeState], GetWeaponType(), shotXf, GetPlayerMaterial(), + true, x144_weapons[chargeState], GetType(), shotXf, GetPlayerMaterial(), GetDamageInfo(mgr, chargeState, chargeFactor1), mgr.AllocateUniqueId(), kInvalidAreaId, - GetPlayerId(), homingTarget, kPA_ArmCannon, underwater, CVector3f(1.f, 1.f, 1.f), + GetPlayerId(), homingTarget, CWeapon::kPA_ArmCannon, underwater, CVector3f(1.f, 1.f, 1.f), rstl::optional_object_null(), CSfxManager::kInternalInvalidSfxId, false); mgr.AddObject(proj); proj->Think(dt, mgr); diff --git a/src/MetroidPrime/Weapons/CWeapon.cpp b/src/MetroidPrime/Weapons/CWeapon.cpp index 153d65eb..ae5a3849 100644 --- a/src/MetroidPrime/Weapons/CWeapon.cpp +++ b/src/MetroidPrime/Weapons/CWeapon.cpp @@ -9,7 +9,7 @@ CWeapon::CWeapon(TUniqueId uid, TAreaId areaId, bool active, TUniqueId owner, EWeaponType type, const rstl::string& name, const CTransform4f& xf, const CMaterialFilter& filter, - const CMaterialList& mList, const CDamageInfo& dInfo, EProjectileAttrib attribs, + const CMaterialList& mList, const CDamageInfo& dInfo, int attribs, const CModelData& mData) : CActor(uid, active, name, CEntityInfo(areaId, CEntity::NullConnectionList), xf, mData, mList, CActorParameters::None().HotInThermal(true), kInvalidUniqueId) @@ -34,14 +34,15 @@ void CWeapon::SetDamageFalloffSpeed(float speed) { void CWeapon::Think(float dt, CStateManager& mgr) { x148_curTime += dt; - if ((xe8_projectileAttribs & kPA_DamageFalloff) == kPA_DamageFalloff) { + if ((xe8_projectileAttribs & CWeapon::kPA_DamageFalloff) == CWeapon::kPA_DamageFalloff) { float max = 1.f - x148_curTime * x14c_damageFalloffSpeed; float scale = CMath::Max(0.f, max); float damage = scale * x110_origDamageInfo.GetDamage(); float radius = scale * x110_origDamageInfo.GetRadius(); float knockback = scale * x110_origDamageInfo.GetKnockBackPower(); x12c_curDamageInfo = - CDamageInfo(x110_origDamageInfo.GetWeaponMode(), damage, (double)(scale * x110_origDamageInfo.GetDamage()), radius, knockback); + CDamageInfo(x110_origDamageInfo.GetWeaponMode(), damage, + (double)(scale * x110_origDamageInfo.GetDamage()), radius, knockback); } else { x12c_curDamageInfo = x110_origDamageInfo; } @@ -75,11 +76,11 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager break; } - if ((xe8_projectileAttribs & kPA_ComboShot) != 0 && state != kFS_InFluid) { + if ((xe8_projectileAttribs & CWeapon::kPA_ComboShot) != 0 && state != kFS_InFluid) { mag += 0.5f; } - if ((xe8_projectileAttribs & kPA_Charged) != 0) { + if ((xe8_projectileAttribs & CWeapon::kPA_Charged) != 0) { mag += 0.25f; } @@ -89,7 +90,7 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager if (doRipple) { CVector3f pos(GetTranslation().GetX(), GetTranslation().GetY(), water.GetSurfaceZ()); - if ((xe8_projectileAttribs & kPA_ComboShot) != 0) { + if ((xe8_projectileAttribs & CWeapon::kPA_ComboShot) != 0) { if (!water.CanRippleAtPoint(pos)) { doRipple = false; } diff --git a/src/MetroidPrime/main.cpp b/src/MetroidPrime/main.cpp index 9f3123f2..302ba287 100644 --- a/src/MetroidPrime/main.cpp +++ b/src/MetroidPrime/main.cpp @@ -49,7 +49,7 @@ #include "MetroidPrime/Player/CGameOptions.hpp" #include "MetroidPrime/Player/CGameState.hpp" #include "MetroidPrime/Player/CPlayerState.hpp" -#include "MetroidPrime/Player/CSystemOptions.hpp" +#include "MetroidPrime/Player/CSystemState.hpp" #include "MetroidPrime/ScriptObjects/CScriptMazeNode.hpp" #include "MetroidPrime/Tweaks/CTweakGame.hpp" #include "MetroidPrime/Tweaks/CTweakPlayer.hpp" @@ -306,19 +306,19 @@ CGameArchitectureSupport::~CGameArchitectureSupport() { // 800044A4 void CMain::StreamNewGameState(CInputStream& in, int saveIdx) { - bool hasFusion = gpGameState->SystemOptions().GetHasFusion(); + bool hasFusion = gpGameState->SystemState().GetHasFusion(); x128_gameGlobalObjects->GameState() = nullptr; gpGameState = nullptr; x128_gameGlobalObjects->GameState() = rs_new CGameState(in, saveIdx); gpGameState = x128_gameGlobalObjects->GameState().get(); - gpGameState->SystemOptions().SetHasFusion(hasFusion); - gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); + gpGameState->SystemState().SetHasFusion(hasFusion); + gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemState().GetHasFusion()); gpGameState->HintOptions().SetHintNextTime(); } // 80004590 void CMain::RefreshGameState() { - CSystemOptions systemOptions = gpGameState->SystemOptions(); + CSystemState systemState = gpGameState->SystemState(); uint saveIdx = gpGameState->SaveIdx(); u64 cardSerial = gpGameState->CardSerial(); rstl::vector< uchar > backupBuf = gpGameState->BackupBuf(); @@ -330,11 +330,11 @@ void CMain::RefreshGameState() { x128_gameGlobalObjects->GameState() = rs_new CGameState(stream, saveIdx); } gpGameState = x128_gameGlobalObjects->GameState().get(); - gpGameState->SystemOptions() = systemOptions; + gpGameState->SystemState() = systemState; gpGameState->GameOptions() = gameOptions; gpGameState->GameOptions().EnsureOptions(); gpGameState->CardSerial() = cardSerial; - gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); + gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemState().GetHasFusion()); } // 8000487C @@ -548,16 +548,16 @@ void CMain::EnsureWorldPakReady(CAssetId id) { // 800036A0 void CMain::ResetGameState() { - CSystemOptions persistentOptions = gpGameState->SystemOptions(); + CSystemState systemState = gpGameState->SystemState(); CGameOptions gameOptions = gpGameState->GameOptions(); x128_gameGlobalObjects->GameState() = nullptr; gpGameState = nullptr; x128_gameGlobalObjects->GameState() = rs_new CGameState(); gpGameState = x128_gameGlobalObjects->GameState().get(); - gpGameState->SystemOptions() = persistentOptions; + gpGameState->SystemState() = systemState; gpGameState->GameOptions() = gameOptions; gpGameState->GameOptions().EnsureOptions(); - gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); + gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemState().GetHasFusion()); } // 8000367C diff --git a/src/WorldFormat/CMetroidAreaCollider.cpp b/src/WorldFormat/CMetroidAreaCollider.cpp index 916508ca..efc5b4aa 100644 --- a/src/WorldFormat/CMetroidAreaCollider.cpp +++ b/src/WorldFormat/CMetroidAreaCollider.cpp @@ -101,10 +101,11 @@ bool CMetroidAreaCollider::AABoxCollisionCheck_Internal(const CAreaOctTree::Node } case CAreaOctTree::Node::kTT_Leaf: { CAreaOctTree::TriListReference list = node.GetTriangleArray(); + int size = list.GetSize(); const CAreaOctTree& owner = node.GetOwner(); const CMaterialFilter& filter = cache.x8_filter; const CPlane* planes = cache.x4_planes; - for (int j = 0; j < list.GetSize(); ++j) { + for (int j = 0; j < size; ++j) { ++gTrianglesProcessed; ushort triIdx = list.GetAt(j); if (sDupPrimitiveCheckCount == sDupTriangleList[triIdx]) { @@ -119,9 +120,9 @@ bool CMetroidAreaCollider::AABoxCollisionCheck_Internal(const CAreaOctTree::Node CAABox aabb = CAABox::MakeMaxInvertedBox(); if (ConvexPolyCollision(planes, &surf.GetVert(0), aabb)) { CPlane plane = surf.GetPlane(); - CCollisionInfo collision(aabb, cache.xc_material, material, plane.GetNormal(), - -plane.GetNormal()); - cache.x10_collisionList.Add(collision, false); + cache.x10_collisionList.Add(CCollisionInfo(aabb, cache.xc_material, material, + plane.GetNormal(), -plane.GetNormal()), + false); ret = true; } } @@ -147,12 +148,9 @@ bool CMetroidAreaCollider::AABoxCollisionCheck_Cached(const COctreeLeafCache& le const CUnitVector3f forward(0.f, 1.f, 0.f, CUnitVector3f::kN_No); const CUnitVector3f up(0.f, 0.f, 1.f, CUnitVector3f::kN_No); const CPlane planes[6] = { - CPlane(aabb.GetMinPoint(), right), - CPlane(aabb.GetMaxPoint(), -right), - CPlane(aabb.GetMinPoint(), forward), - CPlane(aabb.GetMaxPoint(), -forward), - CPlane(aabb.GetMinPoint(), up), - CPlane(aabb.GetMaxPoint(), -up), + CPlane(aabb.GetMinPoint(), right), CPlane(aabb.GetMaxPoint(), -right), + CPlane(aabb.GetMinPoint(), forward), CPlane(aabb.GetMaxPoint(), -forward), + CPlane(aabb.GetMinPoint(), up), CPlane(aabb.GetMaxPoint(), -up), }; ResetInternalCounters(); diff --git a/tools/metaforce_renames.py b/tools/metaforce_renames.py index 1113af4f..38255b0a 100644 --- a/tools/metaforce_renames.py +++ b/tools/metaforce_renames.py @@ -19,10 +19,17 @@ _LITERAL_REPLACEMENTS = [ ("zeus::lookAt", "CTransform4f::LookAt"), ("zeus::radToDeg", "CMath::Rad2Deg"), ("zeus::degToRad", "CMath::Deg2Rad"), + ("zeus::skUp", "CVector3f::Up()"), + ("zeus::skDown", "CVector3f::Down()"), + ("zeus::skRight", "CVector3f::Right()"), + ("zeus::skLeft", "CVector3f::Left()"), + ("zeus::skForward", "CVector3f::Forward()"), + ("zeus::skBack", "CVector3f::Back()"), ("zeus::", ""), ("u32 ", "uint "), ("s32 ", "int "), ("u16 ", "ushort "), + ("char16_t", "wchar_t"), ("std::min(", "rstl::min_val("), ("std::max(", "rstl::max_val("), @@ -32,10 +39,16 @@ _LITERAL_REPLACEMENTS = [ ("g_SimplePool", "gpSimplePool"), ("g_Renderer", "gpRender"), ("g_ResFactory", "gpResourceFactory"), + ("g_GameState", "gpGameState"), + ("g_MainStringTable", "gpStringTable"), # Vector (".magnitude()", ".Magnitude()"), (".normalized()", ".AsNormalized()"), + (".canBeNormalized()", ".CanBeNormalized()"), + (".normalize()", ".Normalize()"), + (".basis[1]", ".GetColumn(kDY)"), + # Transform (".frontVector()", ".GetForward()"), @@ -46,12 +59,24 @@ _LITERAL_REPLACEMENTS = [ ("EMaterialTypes::", "kMT_"), ("EScriptObjectState::", "kSS_"), ("EScriptObjectMessage::", "kSM_"), + ("EPlayerOrbitState::", "CPlayer::kOS_"), + ("ESurfaceRestraints::", "kSR_"), + ("EPlayerCameraState::", "kCS_"), + ("EPlayerMorphBallState::", "kMS_"), + ("EPlayerOrbitType::", "kOT_"), + ("EPlayerOrbitRequest::", "kOB_"), + ("EPlayerZoneInfo::", "kZI_"), + ("EPlayerZoneType::", "kZT_"), + ("EPlayerScanState::", "kSS_"), + ("EGrappleState::", "kGS_"), + ("EFootstepSfx::", "kFS_"), + ("EGunHolsterState::", "kGH_"), ("CPlayer::EPlayerOrbitState::", "CPlayer::kOS_"), ("CPlayer::ESurfaceRestraints::", "CPlayer::kSR_"), ("CPlayer::EPlayerCameraState::", "CPlayer::kCS_"), ("CPlayer::EPlayerMorphBallState::", "CPlayer::kMS_"), ("CPlayer::EPlayerOrbitType::", "CPlayer::kOT_"), - ("CPlayer::EPlayerOrbitRequest::", "CPlayer::kOR_"), + ("CPlayer::EPlayerOrbitRequest::", "CPlayer::kOB_"), ("CPlayer::EPlayerZoneInfo::", "CPlayer::kZI_"), ("CPlayer::EPlayerZoneType::", "CPlayer::kZT_"), ("CPlayer::EPlayerScanState::", "CPlayer::kSS_"), @@ -62,9 +87,51 @@ _LITERAL_REPLACEMENTS = [ ("CPlayerState::EPlayerSuit::", "CPlayerState::kPS_"), ("CPlayerState::EBeamId::", "CPlayerState::kBI_"), ("CPlayerState::EItemType::", "CPlayerState::kIT_"), + ("ControlMapper::ECommands::", "ControlMapper::kC_"), + ("EFluidType::", "CFluidPlane::kFT_"), + ("EPlayerMovementState::", "NPlayer::kMS_"), + ("CMorphBall::ESpiderBallState::", "CMorphBall::kSBS_"), + ("EProjectileAttrib::", "kPA_"), + ("ERumbleFxId::", "kRFX_"), + ("ERumblePriority::", "kRP_"), + + # CActor + ("x34_transform.origin", "GetTranslation()"), + ("x34_transform", "GetTransform()"), + ("xc4_fluidId", "InFluidId()"), + + # CPhysicsActor + ("x138_velocity", "GetVelocityWR()"), + + # CPlayer + ("SetOrbitRequest", "BreakOrbit"), + ("ActivateMorphBallCamera", "ResetBallCamera"), + ("ApplySubmergedPitchBend", "DoSfxEffects"), + + # CCameraManager + ("SetupBallCamera", "ResetCameraHint"), + + # Math + ("std::acos", "acosf"), + ("std::fabs", "fabsf"), + ("std::sqrt", "sqrtf"), + ("clamp(", "CMath::Clamp("), ] _RE_REPLACEMENTS = [ + # SObjectTag{FOURCC('...'), ...} -> SObjectTag('...', ...) (re.compile(r"SObjectTag{FOURCC\('(.*)'\),\s*(.*)}"), r"SObjectTag('\1', \2)"), + # const TCastToConstPtr<...> ... = ...) { -> const ...* = TCastToConstPtr<...>(...)) { + (re.compile(r"const TCastToConstPtr<([A-z0-9]+)> ([A-z0-9]+) = (.*)\) {"), r"const \1* \2 = TCastToConstPtr<\1>(\3)) {"), + # const TCastToConstPtr<...> ... = ...; -> const ...* = TCastToConstPtr<...>(...); + (re.compile(r"const TCastToConstPtr<([A-z0-9]+)> ([A-z0-9]+) = (.*);"), r"const \1* \2 = TCastToConstPtr<\1>(\3);"), + # g_tweakFoo->GetBar() -> gpTweakFoo->mBar + (re.compile(r"g_tweak([A-z0-9]+)->Get([A-z0-9]+)\(\)"), r"gpTweak\1->m\2"), + # vec.xyz() = ... -> vec.SetXYZ(...) + (re.compile(r"([A-z0-9]+)\.([xyz])\(\) = (.*);"), lambda m: f"{m.group(1)}.Set{m.group(2).upper()}({m.group(3)});"), + # vec.xyz() -> vec.GetXYZ() + (re.compile(r"\.([xyz])\(\)"), lambda m: f".Get{m.group(1).upper()}()"), + # lhs.dot(rhs) -> CVector3f::Dot(lhs, rhs) + (re.compile(r"([A-z0-9]+)\.dot\(([A-z0-9]+)\)([,;])"), r"CVector3f::Dot(\1, \2)\3"), ]