mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
fd3066e304
|
@ -37,23 +37,22 @@ struct Water : IScriptObject
|
|||
struct FluidUVMotion : BigYAML
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> unknown1;
|
||||
struct FluidLayerMotion : BigYAML
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> unknown1;
|
||||
Value<float> unknown2;
|
||||
Value<float> unknown3;
|
||||
Value<float> unknown4;
|
||||
Value<float> unknown5;
|
||||
};
|
||||
|
||||
/* BIG FAT WARNING: Do NOT re-order these, even if they seem incorrect */
|
||||
FluidLayerMotion layer2;
|
||||
FluidLayerMotion layer3;
|
||||
FluidLayerMotion layer1;
|
||||
Value<float> unknown1;
|
||||
Value<float> unknown2;
|
||||
Value<float> unknown3;
|
||||
Value<float> unknown4;
|
||||
Value<float> unknown5;
|
||||
Value<atUint32> unknown6;
|
||||
Value<float> unknown7;
|
||||
Value<float> unknown8;
|
||||
Value<float> unknown9;
|
||||
Value<float> unknown10;
|
||||
Value<atUint32> unknown11;
|
||||
Value<float> unknown12;
|
||||
Value<float> unknown13;
|
||||
Value<float> unknown14;
|
||||
Value<float> unknown15;
|
||||
Value<float> unknown16;
|
||||
Value<float> unknown17;
|
||||
} fluidUVMotion;
|
||||
|
||||
Value<float> unknown13;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __URDE_CFLUIDPLANE_HPP__
|
||||
#define __URDE_CFLUIDPLANE_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CFluidPlane
|
||||
{
|
||||
public:
|
||||
enum class EFluidType
|
||||
{};
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CFLUIDPLANE_HPP__
|
|
@ -0,0 +1,16 @@
|
|||
#include "CFluidUVMotion.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CFluidUVMotion::CFluidUVMotion(float a, float b, const urde::CFluidUVMotion::SFluidLayerMotion& c, const urde::CFluidUVMotion::SFluidLayerMotion& d, const urde::CFluidUVMotion::SFluidLayerMotion& e)
|
||||
{
|
||||
x4c_ = 1.f / a;
|
||||
x50_ = b;
|
||||
x0_fluidLayers.resize(3);
|
||||
x0_fluidLayers[0] = c;
|
||||
x0_fluidLayers[1] = d;
|
||||
x0_fluidLayers[2] = e;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef __URDE_CFLUIDUVMOTION_HPP__
|
||||
#define __URDE_CFLUIDUVMOTION_HPP__
|
||||
|
||||
#include "rstl.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CFluidUVMotion
|
||||
{
|
||||
public:
|
||||
enum class EFluidUVMotion
|
||||
{
|
||||
Zero
|
||||
};
|
||||
|
||||
struct SFluidLayerMotion
|
||||
{
|
||||
EFluidUVMotion x0_motion = EFluidUVMotion::Zero;
|
||||
float x4_a = 0.f;
|
||||
float x8_b = 0.f;
|
||||
float xc_c = 0.f;
|
||||
float x10_d = 0.f;
|
||||
float x14_e = 0.f;
|
||||
|
||||
SFluidLayerMotion() = default;
|
||||
SFluidLayerMotion(EFluidUVMotion motion, float a, float b, float c, float d)
|
||||
: x0_motion(motion), x4_a(1.f / a), x8_b(b), xc_c(c), x10_d(d), x14_e(1.f / d)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
rstl::reserved_vector<SFluidLayerMotion, 3> x0_fluidLayers;
|
||||
float x4c_;
|
||||
float x50_;
|
||||
public:
|
||||
CFluidUVMotion(float a, float b, const SFluidLayerMotion& c, const SFluidLayerMotion& d, const SFluidLayerMotion& e);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CFLUIDUVMOTION_HPP__
|
|
@ -28,4 +28,6 @@ add_library(RuntimeCommonWorld
|
|||
CVisorParameters.hpp
|
||||
CAnimationParameters.hpp
|
||||
CDamageInfo.hpp
|
||||
CDamageVulnerability.hpp)
|
||||
CDamageVulnerability.hpp
|
||||
CFluidUVMotion.hpp CFluidUVMotion.cpp
|
||||
CFluidPlane.hpp)
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace urde
|
|||
CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, const zeus::CAABox&,
|
||||
const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
|
||||
u32, bool active, bool, bool)
|
||||
u32 triggerFlags, bool active, bool, bool)
|
||||
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
|
||||
CMaterialList(34), CActorParameters::None(), kInvalidUniqueId)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ public:
|
|||
CScriptTrigger(TUniqueId, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, const zeus::CAABox&,
|
||||
const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
|
||||
u32, bool, bool, bool);
|
||||
u32 triggerFlags, bool, bool, bool);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include "CScriptWater.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, const std::string& name,
|
||||
const CEntityInfo& info, const zeus::CVector3f& pos, const zeus::CAABox& box,
|
||||
const urde::CDamageInfo& dInfo, zeus::CVector3f& orientedForce, u32 triggerFlags,
|
||||
bool b1, bool b2, ResId, ResId, ResId, ResId, ResId, ResId, ResId,
|
||||
const zeus::CVector3f&, float, float, float, bool active, CFluidPlane::EFluidType,
|
||||
bool, float, const CFluidUVMotion&,
|
||||
float, float, float, float, float, float, float, float,
|
||||
const zeus::CColor&, const zeus::CColor&, ResId, ResId, ResId, ResId,
|
||||
ResId, s32, s32, s32, s32, s32, float, u32, float, float, float, float, float, float, float, float,
|
||||
const zeus::CColor&, urde::ResId, float, float, float, u32, u32, bool, s32, s32, const u32*)
|
||||
: CScriptTrigger(uid, name, info, pos, box, dInfo, orientedForce, triggerFlags, active, false, false)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,26 @@
|
|||
#ifndef __URDE_CSCRIPTWATER_HPP__
|
||||
#define __URDE_CSCRIPTWATER_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
#include "CScriptTrigger.hpp"
|
||||
#include "CFluidPlane.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CScriptWater : public CActor
|
||||
class CDamageInfo;
|
||||
class CFluidUVMotion;
|
||||
|
||||
class CScriptWater : public CScriptTrigger
|
||||
{
|
||||
public:
|
||||
CScriptWater(CStateManager &,TUniqueId, const std::string& name, const CEntityInfo&, const zeus::CVector3f&,
|
||||
const zeus::CAABox&, CDamageInfo const &, zeus::CVector3f&, u32, bool, bool,
|
||||
ResId, ResId, ResId, ResId, ResId, ResId, ResId,
|
||||
const zeus::CVector3f&, float, float, float, bool, CFluidPlane::EFluidType, bool, float, const CFluidUVMotion&,
|
||||
float, float, float, float, float, float, float, float, const zeus::CColor&, const zeus::CColor&,
|
||||
ResId, ResId, ResId, ResId, ResId, s32, s32, s32, s32, s32,
|
||||
float, u32, float, float, float, float, float, float, float, float,
|
||||
const zeus::CColor&, ResId, float, float, float, u32, u32, bool, s32, s32, const u32*);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "CScannableParameters.hpp"
|
||||
#include "CLightParameters.hpp"
|
||||
#include "CAnimationParameters.hpp"
|
||||
#include "CFluidUVMotion.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CWorld.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
|
@ -17,6 +18,7 @@
|
|||
#include "CScriptTrigger.hpp"
|
||||
#include "CScriptTimer.hpp"
|
||||
#include "CScriptCounter.hpp"
|
||||
#include "CScriptWater.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "Editor/ProjectResourceFactoryMP1.hpp"
|
||||
#include "logvisor/logvisor.hpp"
|
||||
|
@ -38,7 +40,7 @@ static bool EnsurePropertyCount(int count, int expected, const char* structName)
|
|||
{
|
||||
if (count < expected)
|
||||
{
|
||||
Log.report(logvisor::Fatal, "Insufficient number of props (%d/%d) for %s entity",
|
||||
Log.report(logvisor::Warning, "Insufficient number of props (%d/%d) for %s entity",
|
||||
count, expected, structName);
|
||||
return false;
|
||||
}
|
||||
|
@ -263,6 +265,40 @@ CAnimationParameters ScriptLoader::LoadAnimationParameters(CInputStream& in)
|
|||
return CAnimationParameters(ancs, charIdx, defaultAnim);
|
||||
}
|
||||
|
||||
CFluidUVMotion ScriptLoader::LoadFluidUVMotion(CInputStream& in)
|
||||
{
|
||||
CFluidUVMotion::EFluidUVMotion motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
||||
float a = in.readFloatBig();
|
||||
float b = in.readFloatBig();
|
||||
b = ((M_PIF * b) / 180.f) - M_PIF;
|
||||
float c = in.readFloatBig();
|
||||
float d = in.readFloatBig();
|
||||
CFluidUVMotion::SFluidLayerMotion motionLayer2(motion, a, b, c, d);
|
||||
|
||||
motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
||||
a = in.readFloatBig();
|
||||
b = in.readFloatBig();
|
||||
b = ((M_PIF * b) / 180.f) - M_PIF;
|
||||
c = in.readFloatBig();
|
||||
d = in.readFloatBig();
|
||||
CFluidUVMotion::SFluidLayerMotion motionLayer3(motion, a, b, c, d);
|
||||
|
||||
motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
||||
a = in.readFloatBig();
|
||||
b = in.readFloatBig();
|
||||
b = ((M_PIF * b) / 180.f) - M_PIF;
|
||||
c = in.readFloatBig();
|
||||
d = in.readFloatBig();
|
||||
CFluidUVMotion::SFluidLayerMotion motionLayer1(motion, a, b, c, d);
|
||||
|
||||
a = in.readFloatBig();
|
||||
b = in.readFloatBig();
|
||||
|
||||
b = ((M_PIF * b) / 180.f) - M_PIF;
|
||||
|
||||
return CFluidUVMotion(a, b, motionLayer1, motionLayer2, motionLayer3);
|
||||
}
|
||||
|
||||
zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVector3f& orientation,
|
||||
const zeus::CVector3f& position)
|
||||
{
|
||||
|
@ -608,6 +644,113 @@ CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in,
|
|||
CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 63, "Water"))
|
||||
return nullptr;
|
||||
|
||||
std::string name = *mgr.HashInstanceName(in);
|
||||
zeus::CVector3f position;
|
||||
position.readBig(in);
|
||||
zeus::CVector3f extent;
|
||||
extent.readBig(in);
|
||||
CDamageInfo dInfo(in);
|
||||
zeus::CVector3f orientedForce;
|
||||
orientedForce.readBig(in);
|
||||
u32 triggerFlags = in.readUint32Big() | 2044;
|
||||
bool b1 = in.readBool();
|
||||
bool displaySurface = in.readBool();
|
||||
ResId textureId1 = in.readUint32Big();
|
||||
ResId textureId2 = in.readUint32Big();
|
||||
ResId textureId3 = in.readUint32Big();
|
||||
ResId textureId4 = in.readUint32Big();
|
||||
ResId textureId5 = in.readUint32Big();
|
||||
ResId textureId6 = in.readUint32Big();
|
||||
zeus::CVector3f v2;
|
||||
v2.readBig(in);
|
||||
|
||||
zeus::CVector3f otherV2 = v2;
|
||||
if (otherV2.canBeNormalized())
|
||||
otherV2.assign(0.f, 0.f, -1.f);
|
||||
|
||||
float f1 = 1.f / in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
bool active = in.readBool();
|
||||
CFluidPlane::EFluidType fluidType = CFluidPlane::EFluidType(in.readUint32Big());
|
||||
bool b4 = in.readBool();
|
||||
float f4 = in.readFloatBig();
|
||||
CFluidUVMotion fluidMotion = LoadFluidUVMotion(in);
|
||||
|
||||
float f5 = in.readFloatBig();
|
||||
float f6 = in.readFloatBig();
|
||||
float f7 = in.readFloatBig();
|
||||
float f8 = in.readFloatBig();
|
||||
float f9 = zeus::degToRad(in.readFloatBig());
|
||||
float f10 = zeus::degToRad(in.readFloatBig());
|
||||
float f11 = in.readFloatBig();
|
||||
float f12 = in.readFloatBig();
|
||||
zeus::CColor c1;
|
||||
c1.readRGBABig(in);
|
||||
zeus::CColor c2;
|
||||
c2.readRGBABig(in);
|
||||
ResId enterParticle = in.readUint32Big();
|
||||
ResId partId2 = in.readUint32Big();
|
||||
ResId partId3 = in.readUint32Big();
|
||||
ResId partId4 = in.readUint32Big();
|
||||
ResId partId5 = in.readUint32Big();
|
||||
u32 soundId1 = in.readUint32Big();
|
||||
u32 soundId2 = in.readUint32Big();
|
||||
u32 soundId3 = in.readUint32Big();
|
||||
u32 soundId4 = in.readUint32Big();
|
||||
u32 soundId5 = in.readUint32Big();
|
||||
float f13 = in.readFloatBig();
|
||||
u32 w19 = in.readUint32Big();
|
||||
float f14 = in.readFloatBig();
|
||||
float f15 = in.readFloatBig();
|
||||
float f16 = in.readFloatBig();
|
||||
float f17 = in.readFloatBig();
|
||||
float f18 = in.readFloatBig();
|
||||
float f19 = in.readFloatBig();
|
||||
float heatWaveHeight = in.readFloatBig();
|
||||
float heatWaveSpeed = in.readFloatBig();
|
||||
zeus::CColor heatWaveColor;
|
||||
heatWaveColor.readRGBABig(in);
|
||||
ResId lightmap = in.readUint32Big();
|
||||
float f22 = in.readFloatBig();
|
||||
float f23 = in.readFloatBig();
|
||||
float f24 = in.readFloatBig();
|
||||
u32 w21 = in.readUint32Big();
|
||||
u32 w22 = in.readUint32Big();
|
||||
bool b5 = in.readBool();
|
||||
|
||||
u32* bitset = nullptr;
|
||||
u32 bitVal0 = 0;
|
||||
u32 bitVal1 = 0;
|
||||
|
||||
if (b5)
|
||||
{
|
||||
bitVal0 = in.readUint16Big();
|
||||
bitVal1 = in.readUint16Big();
|
||||
u32 len = ((bitVal0 * bitVal1) + 31) / 31;
|
||||
bitset = new u32[len];
|
||||
in.readBytesToBuf(&bitset, len * 4);
|
||||
}
|
||||
|
||||
zeus::CAABox box(-extent * 0.5f, extent * 0.5f);
|
||||
|
||||
ResId realTextureId6 = -1;
|
||||
if (textureId4 == -1)
|
||||
realTextureId6 = textureId6;
|
||||
|
||||
ResId realTextureId5 = -1;
|
||||
if (textureId4 == -1)
|
||||
realTextureId5 = textureId5;
|
||||
|
||||
return new CScriptWater(mgr, mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, triggerFlags, b1, displaySurface,
|
||||
textureId1, textureId2, textureId3, textureId4, realTextureId5, realTextureId6, -1, otherV2, f1, f2,
|
||||
f3, active, fluidType, b4, f4, fluidMotion, f5, f6, f7, f8, f9, f10, f11, f12, c1, c2, enterParticle,
|
||||
partId2, partId3, partId4, partId5, soundId1, soundId2, soundId3, soundId4, soundId5,
|
||||
f13, w19, f14, f15, f16, f17, f18, f19, heatWaveHeight, heatWaveSpeed, heatWaveColor, lightmap, f22, f23, f24,
|
||||
w21, w22, b5, bitVal0, bitVal0, bitset);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadWarwasp(CStateManager& mgr, CInputStream& in,
|
||||
|
|
|
@ -15,6 +15,7 @@ class CVisorParameters;
|
|||
class CScannableParameters;
|
||||
class CLightParameters;
|
||||
class CAnimationParameters;
|
||||
class CFluidUVMotion;
|
||||
|
||||
using FScriptLoader = std::function<CEntity*(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)>;
|
||||
|
@ -29,6 +30,7 @@ public:
|
|||
static CScannableParameters LoadScannableParameters(CInputStream& in);
|
||||
static CLightParameters LoadLightParameters(CInputStream& in);
|
||||
static CAnimationParameters LoadAnimationParameters(CInputStream& in);
|
||||
static CFluidUVMotion LoadFluidUVMotion(CInputStream& in);
|
||||
static zeus::CTransform ConvertEditorEulerToTransform4f(const zeus::CVector3f& orientation,
|
||||
const zeus::CVector3f& position);
|
||||
|
||||
|
|
Loading…
Reference in New Issue