From 074cb7ff98253d7311264654779036cd90ef9064 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Thu, 6 Oct 2022 11:52:14 +0300 Subject: [PATCH] Add CTweakGunRes and CTweakPlayerGun --- include/MetroidPrime/Tweaks/CTweakGunRes.hpp | 48 ++++++++ .../MetroidPrime/Tweaks/CTweakPlayerGun.hpp | 113 ++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 include/MetroidPrime/Tweaks/CTweakGunRes.hpp create mode 100644 include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp diff --git a/include/MetroidPrime/Tweaks/CTweakGunRes.hpp b/include/MetroidPrime/Tweaks/CTweakGunRes.hpp new file mode 100644 index 00000000..e17c2f9d --- /dev/null +++ b/include/MetroidPrime/Tweaks/CTweakGunRes.hpp @@ -0,0 +1,48 @@ +#ifndef _CTWEAKGUNRES_HPP +#define _CTWEAKGUNRES_HPP + +#include "MetroidPrime/Tweaks/ITweakObject.hpp" + +#include "MetroidPrime/Player/CPlayerState.hpp" + +#include "Kyoto/CObjectReference.hpp" + +class CTweakGunRes : public ITweakObject { +public: + typedef CAssetId ResId; + typedef CPlayerState::EBeamId EBeamId; + + ~CTweakGunRes() override; + + ResId x4_gunMotion; + ResId x8_grappleArm; + ResId xc_rightHand; + + ResId x10_powerBeam; + ResId x14_iceBeam; + ResId x18_waveBeam; + ResId x1c_plasmaBeam; + ResId x20_phazonBeam; + + ResId x24_holoTransition; + + ResId x28_bombSet; + ResId x2c_bombExplode; + ResId x30_powerBombExplode; + + /* Power, Ice, Wave, Plasma, Phazon / Beam, Ball */ + ResId x34_weapons[2][5]; + ResId x84_muzzle[5]; + ResId x94_charge[5]; + ResId xa4_auxMuzzle[5]; + + ResId xb4_grappleSegment; + ResId xb8_grappleClaw; + ResId xbc_grappleHit; + ResId xc0_grappleMuzzle; + ResId xc4_grappleSwoosh; +}; + +extern CTweakGunRes* gpTweakGunRes; + +#endif // _CTWEAKGUNRES_HPP diff --git a/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp b/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp new file mode 100644 index 00000000..f6fac3ea --- /dev/null +++ b/include/MetroidPrime/Tweaks/CTweakPlayerGun.hpp @@ -0,0 +1,113 @@ +#ifndef _CTWEAKPLAYERGUN_HPP_ +#define _CTWEAKPLAYERGUN_HPP_ + +#include "MetroidPrime/Tweaks/ITweakObject.hpp" + +#include "Kyoto/Math/CVector3f.hpp" + +#include "rstl/reserved_vector.hpp" + +struct SShotParam { + uint x0_weaponType; + bool x4_24_charged : 1; + bool x4_25_combo : 1; + bool x4_26_instaKill : 1; + float x8_damage; + float xc_radiusDamage; + float x10_radius; + float x14_knockback; + bool x18_24_noImmunity : 1; + + SShotParam() + : x0_weaponType(-1) + , x4_24_charged(false) + , x4_25_combo(false) + , x4_26_instaKill(false) + , x8_damage(0.f) + , xc_radiusDamage(0.f) + , x10_radius(0.f) + , x14_knockback(0.f) + , x18_24_noImmunity(false) + {} + explicit SShotParam(CInputStream& in); +}; + +struct SComboShotParam : SShotParam { + SComboShotParam() { x4_25_combo = true; } + explicit SComboShotParam(CInputStream& in) : SShotParam(in) { x4_25_combo = true; } +}; + +struct SChargedShotParam : SShotParam { + SChargedShotParam() { x4_24_charged = true; } + explicit SChargedShotParam(CInputStream& in) : SShotParam(in) { x4_24_charged = true; } +}; + +struct SWeaponInfo { + float x0_coolDown; + SShotParam x4_normal; + SChargedShotParam x20_charged; + + SWeaponInfo() + : x0_coolDown(0.1f) {} + explicit SWeaponInfo(CInputStream& in); +}; + + +class CTweakPlayerGun : public ITweakObject { +public: + ~CTweakPlayerGun() override; + + float GetUpLookAngle() const { return x4_upLookAngle; } + float GetDownLookAngle() const { return x8_downLookAngle; } + float GetVerticalSpread() const { return xc_verticalSpread; } + float GetHorizontalSpread() const { return x10_horizontalSpread; } + float GetHighVerticalSpread() const { return x14_highVerticalSpread; } + float GetHighHorizontalSpread() const { return x18_highHorizontalSpread; } + float GetLowVerticalSpread() const { return x1c_lowVerticalSpread; } + float GetLowHorizontalSpread() const { return x20_lowHorizontalSpread; } + float GetAimVerticalSpeed() const { return x24_aimVerticalSpeed; } + float GetAimHorizontalSpeed() const { return x28_aimHorizontalSpeed; } + float GetBombFuseTime() const { return x2c_bombFuseTime; } + float GetBombDropDelayTime() const { return x30_bombDropDelayTime; } + float GetHoloHoldTime() const { return x34_holoHoldTime; } + float GetGunTransformTime() const { return x38_gunTransformTime; } + float GetGunHolsterTime() const { return x3c_gunHolsterTime; } + float GetGunNotFiringTime() const { return x40_gunNotFiringTime; } + float GetFixedVerticalAim() const { return x44_fixedVerticalAim; } + float GetGunExtendDistance() const { return x48_gunExtendDistance; } + const CVector3f& GetGunPosition() const { return x4c_gunPosition; } + const CVector3f& GetGrapplingArmPosition() const { return x64_grapplingArmPosition; } + +private: + float x4_upLookAngle; + float x8_downLookAngle; + float xc_verticalSpread; + float x10_horizontalSpread; + float x14_highVerticalSpread; + float x18_highHorizontalSpread; + float x1c_lowVerticalSpread; + float x20_lowHorizontalSpread; + float x24_aimVerticalSpeed; + float x28_aimHorizontalSpeed; + float x2c_bombFuseTime; + float x30_bombDropDelayTime; + float x34_holoHoldTime; + float x38_gunTransformTime; + float x3c_gunHolsterTime; + float x40_gunNotFiringTime; + float x44_fixedVerticalAim; + float x48_gunExtendDistance; + CVector3f x4c_gunPosition; + CVector3f x58_; + CVector3f x64_grapplingArmPosition; + SShotParam x70_bomb; + SShotParam x8c_powerBomb; + SShotParam x1d4_missile; + SWeaponInfo xa8_beams[5]; + rstl::reserved_vector x1f0_combos; // Originally rstl::reserved_vector + rstl::reserved_vector x280_ricochetData; +}; + +extern CTweakPlayerGun* gpTweakPlayerGun; + +#endif // _CTWEAKPLAYERGUN_HPP_