mirror of https://github.com/PrimeDecomp/prime.git
Match CWeapon::FluidFXThink
This commit is contained in:
parent
e31200f62d
commit
492b31276a
|
@ -9,6 +9,12 @@
|
||||||
#include "rstl/reserved_vector.hpp"
|
#include "rstl/reserved_vector.hpp"
|
||||||
|
|
||||||
class CFluidPlaneManager {
|
class CFluidPlaneManager {
|
||||||
|
public:
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
void CreateSplash(TUniqueId splasher, CStateManager& mgr, const CScriptWater& water,
|
||||||
|
const CVector3f& pos, float factor, bool sfx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CSplashRecord {
|
class CSplashRecord {
|
||||||
float x0_time;
|
float x0_time;
|
||||||
|
|
|
@ -154,6 +154,8 @@ public:
|
||||||
CEnvFxManager* EnvFxManager() { return x880_envFxManager; }
|
CEnvFxManager* EnvFxManager() { return x880_envFxManager; }
|
||||||
const CEnvFxManager* GetEnvFxManager() const { return x880_envFxManager; }
|
const CEnvFxManager* GetEnvFxManager() const { return x880_envFxManager; }
|
||||||
CRumbleManager* GetRumbleManager() { return x88c_rumbleManager; }
|
CRumbleManager* GetRumbleManager() { return x88c_rumbleManager; }
|
||||||
|
CFluidPlaneManager* FluidPlaneManager() { return x87c_fluidPlaneManager; }
|
||||||
|
const CFluidPlaneManager* GetFluidPlaneManager() const { return x87c_fluidPlaneManager; }
|
||||||
|
|
||||||
CRandom16* Random() const { return x900_random; }
|
CRandom16* Random() const { return x900_random; }
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,84 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#include "MetroidPrime/ScriptObjects/CScriptTrigger.hpp"
|
||||||
|
|
||||||
|
#include "Kyoto/Math/CFrustumPlanes.hpp"
|
||||||
|
#include "Kyoto/TToken.hpp"
|
||||||
|
|
||||||
|
#include "rstl/list.hpp"
|
||||||
|
#include "rstl/optional_object.hpp"
|
||||||
|
#include "rstl/pair.hpp"
|
||||||
#include "rstl/single_ptr.hpp"
|
#include "rstl/single_ptr.hpp"
|
||||||
|
|
||||||
class CFluidPlaneCPU;
|
class CFluidPlaneCPU;
|
||||||
|
class CGenDescription;
|
||||||
|
|
||||||
class CScriptWater {
|
class CScriptWater : public CScriptTrigger {
|
||||||
public:
|
public:
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
bool CanRippleAtPoint(const CVector3f&) const;
|
||||||
|
|
||||||
CFluidPlaneCPU& FluidPlane() { return *x1b4_fluidPlane; }
|
CFluidPlaneCPU& FluidPlane() { return *x1b4_fluidPlane; }
|
||||||
|
float GetSurfaceZ() const { return GetTriggerBoundsWR().GetMaxPoint().GetZ(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uchar x0_pad[0x1b4];
|
CFrustumPlanes x150_frustum;
|
||||||
rstl::single_ptr< CFluidPlaneCPU > x1b4_fluidPlane;
|
rstl::single_ptr< CFluidPlaneCPU > x1b4_fluidPlane;
|
||||||
|
CVector3f x1b8_positionMorphed;
|
||||||
|
CVector3f x1c4_extentMorphed;
|
||||||
|
float x1d0_morphInTime;
|
||||||
|
CVector3f x1d4_positionOrig;
|
||||||
|
CVector3f x1e0_extentOrig;
|
||||||
|
float x1ec_damageOrig;
|
||||||
|
float x1f0_damageMorphed;
|
||||||
|
float x1f4_morphOutTime;
|
||||||
|
float x1f8_morphFactor;
|
||||||
|
rstl::list< rstl::pair< TUniqueId, bool > > x1fc_waterInhabitants;
|
||||||
|
float x214_fogBias;
|
||||||
|
float x218_fogMagnitude;
|
||||||
|
float x21c_origFogBias;
|
||||||
|
float x220_origFogMagnitude;
|
||||||
|
float x224_fogSpeed;
|
||||||
|
CColor x228_fogColor;
|
||||||
|
CAssetId x22c_splashParticle1Id;
|
||||||
|
CAssetId x230_splashParticle2Id;
|
||||||
|
CAssetId x234_splashParticle3Id;
|
||||||
|
CAssetId x238_visorRunoffParticleId;
|
||||||
|
rstl::optional_object< TLockedToken< CGenDescription > > x23c_visorRunoffEffect;
|
||||||
|
CAssetId x24c_unmorphVisorRunoffParticleId;
|
||||||
|
rstl::optional_object< TLockedToken< CGenDescription > > x250_unmorphVisorRunoffEffect;
|
||||||
|
ushort x260_visorRunoffSfx;
|
||||||
|
ushort x262_unmorphVisorRunoffSfx;
|
||||||
|
rstl::reserved_vector< rstl::optional_object< TLockedToken< CGenDescription > >, 3 >
|
||||||
|
x264_splashEffects;
|
||||||
|
rstl::reserved_vector< ushort, 3 > x298_splashSounds;
|
||||||
|
CColor x2a4_splashColor;
|
||||||
|
CColor x2a8_insideFogColor;
|
||||||
|
float x2ac_alphaInTime;
|
||||||
|
float x2b0_alphaOutTime;
|
||||||
|
float x2b4_alphaInRecip;
|
||||||
|
float x2b8_alphaOutRecip;
|
||||||
|
float x2bc_alpha;
|
||||||
|
float x2c0_tileSize;
|
||||||
|
int x2c4_gridDimX;
|
||||||
|
int x2c8_gridDimY;
|
||||||
|
int x2cc_gridCellCount;
|
||||||
|
int x2d0_patchDimX;
|
||||||
|
int x2d4_patchDimY;
|
||||||
|
rstl::single_ptr< bool[] > x2d8_tileIntersects;
|
||||||
|
rstl::single_ptr< bool[] > x2dc_vertIntersects;
|
||||||
|
// 0: all clear, 1: all intersect, 2: partial intersect
|
||||||
|
rstl::single_ptr< uchar[] > x2e0_patchIntersects;
|
||||||
|
int x2e4_computedGridCellCount;
|
||||||
|
bool x2e8_24_b4 : 1;
|
||||||
|
bool x2e8_25_morphIn : 1;
|
||||||
|
bool x2e8_26_morphing : 1;
|
||||||
|
bool x2e8_27_allowRender : 1;
|
||||||
|
bool x2e8_28_recomputeClipping : 1;
|
||||||
|
bool x2e8_29_alphaIn : 1;
|
||||||
|
bool x2e8_30_alphaOut : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CSCRIPTWATER
|
#endif // _CSCRIPTWATER
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CWeaponMode {
|
||||||
bool x4_26_instantKill : 1;
|
bool x4_26_instantKill : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CWeaponMode(EWeaponType type = kWT_None, bool charged = false, bool comboed = false,
|
CWeaponMode(EWeaponType type = kWT_None, bool charged = false, bool comboed = false,
|
||||||
bool instaKill = false)
|
bool instaKill = false)
|
||||||
: x0_weaponType(type)
|
: x0_weaponType(type)
|
||||||
, x4_24_charged(charged)
|
, x4_24_charged(charged)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "MetroidPrime/Weapons/CWeapon.hpp"
|
#include "MetroidPrime/Weapons/CWeapon.hpp"
|
||||||
|
|
||||||
#include "MetroidPrime/CActorParameters.hpp"
|
#include "MetroidPrime/CActorParameters.hpp"
|
||||||
|
#include "MetroidPrime/CFluidPlaneCPU.hpp"
|
||||||
|
#include "MetroidPrime/CFluidPlaneManager.hpp"
|
||||||
#include "MetroidPrime/ScriptObjects/CScriptWater.hpp"
|
#include "MetroidPrime/ScriptObjects/CScriptWater.hpp"
|
||||||
|
|
||||||
#include <rstl/math.hpp>
|
#include <rstl/math.hpp>
|
||||||
|
@ -33,10 +35,13 @@ void CWeapon::SetDamageFalloffSpeed(float speed) {
|
||||||
void CWeapon::Think(float dt, CStateManager& mgr) {
|
void CWeapon::Think(float dt, CStateManager& mgr) {
|
||||||
x148_curTime += dt;
|
x148_curTime += dt;
|
||||||
if ((xe8_projectileAttribs & kPA_DamageFalloff) == kPA_DamageFalloff) {
|
if ((xe8_projectileAttribs & kPA_DamageFalloff) == kPA_DamageFalloff) {
|
||||||
float damMul = CMath::Max(0.f, 1.f - x148_curTime * x14c_damageFalloffSpeed);
|
float max = 1.f - x148_curTime * x14c_damageFalloffSpeed;
|
||||||
x12c_curDamageInfo = CDamageInfo(
|
float scale = CMath::Max(0.f, max);
|
||||||
x110_origDamageInfo.GetWeaponMode(), damMul * x110_origDamageInfo.GetDamage(),
|
float damage = scale * x110_origDamageInfo.GetDamage();
|
||||||
damMul * x110_origDamageInfo.GetRadius(), damMul * x110_origDamageInfo.GetKnockBackPower());
|
float radius = scale * x110_origDamageInfo.GetRadius();
|
||||||
|
float knockback = scale * x110_origDamageInfo.GetKnockBackPower();
|
||||||
|
x12c_curDamageInfo =
|
||||||
|
CDamageInfo(x110_origDamageInfo.GetWeaponMode(), damage, radius, knockback);
|
||||||
} else {
|
} else {
|
||||||
x12c_curDamageInfo = x110_origDamageInfo;
|
x12c_curDamageInfo = x110_origDamageInfo;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +62,7 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager
|
||||||
mag = 0.1f;
|
mag = 0.1f;
|
||||||
break;
|
break;
|
||||||
case kWT_Plasma:
|
case kWT_Plasma:
|
||||||
|
mag = 0.f;
|
||||||
break;
|
break;
|
||||||
case kWT_Missile:
|
case kWT_Missile:
|
||||||
mag = 0.5f;
|
mag = 0.5f;
|
||||||
|
@ -80,26 +86,23 @@ void CWeapon::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager
|
||||||
if (mag > 1.f) {
|
if (mag > 1.f) {
|
||||||
mag = 1.f;
|
mag = 1.f;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (doRipple) {
|
if (doRipple) {
|
||||||
CVector3f pos = GetTranslation();
|
CVector3f pos(GetTranslation().GetX(), GetTranslation().GetY(), water.GetSurfaceZ());
|
||||||
pos.SetZ(water.GetSurfaceZ()); // <- GetTriggerBoundsWR().GetMax().GetZ()
|
if ((xe8_projectileAttribs & kPA_ComboShot) != 0) {
|
||||||
if (True(xe8_projectileAttribs & EProjectileAttrib::ComboShot)) {
|
|
||||||
if (!water.CanRippleAtPoint(pos)) {
|
if (!water.CanRippleAtPoint(pos)) {
|
||||||
doRipple = false;
|
doRipple = false;
|
||||||
}
|
}
|
||||||
} else if (state == EFluidState::InFluid) {
|
} else if (state == kFS_InFluid) {
|
||||||
doRipple = false;
|
doRipple = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doRipple) {
|
if (doRipple) {
|
||||||
water.FluidPlane().AddRipple(mag, x8_uid, pos, water, mgr);
|
bool sfx = state == kFS_EnteredFluid || state == kFS_LeftFluid;
|
||||||
mgr.FluidPlaneManager()->CreateSplash(x8_uid, mgr, water, pos, mag,
|
water.FluidPlane().AddRipple(mag, GetUniqueId(), pos, water, mgr);
|
||||||
state == EFluidState::EnteredFluid ||
|
mgr.FluidPlaneManager()->CreateSplash(GetUniqueId(), mgr, water, pos, mag, sfx);
|
||||||
state == EFluidState::LeftFluid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeapon::Render(const CStateManager& mgr) const {}
|
void CWeapon::Render(const CStateManager& mgr) const {}
|
||||||
|
|
Loading…
Reference in New Issue