Implement CScriptCameraBlurKeyframe and CScriptCameraFilterKeyframe

This commit is contained in:
Jack Andersen 2017-06-01 11:13:19 -10:00
parent 94461ff41d
commit 4c41132168
8 changed files with 108 additions and 45 deletions

View File

@ -13,12 +13,12 @@ struct CameraBlurKeyframe : IScriptObject
{
DECL_YAML
String<-1> name;
Value<bool> unknown1;
Value<atUint32> unknown2;
Value<float> unknown3;
Value<atUint32> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<bool> active;
Value<atUint32> type;
Value<float> amount;
Value<atUint32> unk;
Value<float> timeIn;
Value<float> timeOut;
};
}
}

View File

@ -13,14 +13,14 @@ struct CameraFilterKeyframe : IScriptObject
{
DECL_YAML
String<-1> name;
Value<bool> unknown1;
Value<atUint32> unkown2;
Value<atUint32> unkown3;
Value<atUint32> unkown4;
Value<atUint32> unkown5;
Value<atVec4f> unknown6; //CColor
Value<float> unknown7;
Value<float> unknown8;
Value<bool> active;
Value<atUint32> type;
Value<atUint32> shape;
Value<atUint32> filterIdx;
Value<atUint32> unk;
DNAColor color;
Value<float> timeIn;
Value<float> timeOut;
UniqueID32 texture;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const

View File

@ -417,6 +417,7 @@ public:
void ClearActiveRandom() { x900_activeRandom = nullptr; }
CRumbleManager& GetRumbleManager() {return *x88c_rumbleManager;}
CCameraFilterPassPoly& GetCameraFilterPass(int idx) {return xb84_camFilterPasses[idx];}
CCameraBlurPass& GetCameraBlurPass(int idx) {return xd14_camBlurPasses[idx];}
CEnvFxManager* GetEnvFxManager() { return x880_envFxManager; }
CWorld* WorldNC() {return x850_world.get();}

View File

@ -1,14 +1,36 @@
#include "CScriptCameraBlurKeyframe.hpp"
#include "TCastTo.hpp"
#include "CStateManager.hpp"
namespace urde
{
CScriptCameraBlurKeyframe::CScriptCameraBlurKeyframe(TUniqueId uid, const std::string& name, const CEntityInfo& info,
u32, float, u32, float, float, bool active)
: CEntity(uid, info, active, name)
CScriptCameraBlurKeyframe::CScriptCameraBlurKeyframe(TUniqueId uid, const std::string& name,
const CEntityInfo& info, EBlurType type,
float amount, u32 unk, float timeIn,
float timeOut, bool active)
: CEntity(uid, info, active, name), x34_type(type), x38_amount(amount), x3c_(unk),
x40_timeIn(timeIn), x44_timeOut(timeOut)
{
}
void CScriptCameraBlurKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
switch (msg)
{
case EScriptObjectMessage::Increment:
if (GetActive())
stateMgr.GetCameraBlurPass(3).SetBlur(x34_type, x38_amount, x40_timeIn);
break;
case EScriptObjectMessage::Decrement:
if (GetActive())
stateMgr.GetCameraBlurPass(3).DisableBlur(x44_timeOut);
break;
default: break;
}
}
void CScriptCameraBlurKeyframe::Accept(IVisitor& visitor)
{
visitor.Visit(this);

View File

@ -2,14 +2,24 @@
#define __URDE_CSCRIPTCAMERABLURKEYFRAME__
#include "CEntity.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CScriptCameraBlurKeyframe : public CEntity
{
EBlurType x34_type;
float x38_amount;
u32 x3c_;
float x40_timeIn;
float x44_timeOut;
public:
CScriptCameraBlurKeyframe(TUniqueId, const std::string&, const CEntityInfo&, u32, float, u32, float, float, bool);
CScriptCameraBlurKeyframe(TUniqueId uid, const std::string& name,
const CEntityInfo& info, EBlurType type,
float amount, u32 unk, float timeIn,
float timeOut, bool active);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
void Accept(IVisitor& visitor);
};
}

View File

@ -1,15 +1,40 @@
#include "CScriptCameraFilterKeyframe.hpp"
#include "TCastTo.hpp"
#include "CStateManager.hpp"
namespace urde
{
CScriptCameraFilterKeyframe::CScriptCameraFilterKeyframe(TUniqueId uid, const std::string& name,
const CEntityInfo& info, u32, u32, u32, u32,
const zeus::CColor&, float, float, u32, bool active)
: CEntity(uid, info, active, name)
const CEntityInfo& info, EFilterType type, EFilterShape shape,
u32 filterIdx, u32 unk, const zeus::CColor& color,
float timeIn, float timeOut, ResId txtr, bool active)
: CEntity(uid, info, active, name), x34_type(type), x38_shape(shape), x3c_filterIdx(filterIdx), x40_(unk),
x44_color(color), x48_timeIn(timeIn), x4c_timeOut(timeOut), x50_txtr(txtr)
{
}
void CScriptCameraFilterKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
switch (msg)
{
case EScriptObjectMessage::Increment:
if (GetActive())
stateMgr.GetCameraFilterPass(x3c_filterIdx).SetFilter(x34_type, x38_shape, x48_timeIn, x44_color, x50_txtr);
break;
case EScriptObjectMessage::Decrement:
if (GetActive())
stateMgr.GetCameraFilterPass(x3c_filterIdx).DisableFilter(x4c_timeOut);
break;
case EScriptObjectMessage::Deactivate:
if (GetActive())
stateMgr.GetCameraFilterPass(x3c_filterIdx).DisableFilter(0.f);
break;
default: break;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
void CScriptCameraFilterKeyframe::Accept(IVisitor& visitor)
{
visitor.Visit(this);

View File

@ -3,24 +3,28 @@
#include "CEntity.hpp"
#include "zeus/CColor.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CScriptCameraFilterKeyframe : public CEntity
{
u32 x34_;
u32 x38_;
u32 x3c_;
EFilterType x34_type;
EFilterShape x38_shape;
u32 x3c_filterIdx;
u32 x40_;
zeus::CColor x44_;
float x48_;
float x4c_;
u32 x50_;
zeus::CColor x44_color;
float x48_timeIn;
float x4c_timeOut;
ResId x50_txtr;
public:
CScriptCameraFilterKeyframe(TUniqueId, const std::string&, const CEntityInfo&, u32, u32, u32, u32,
const zeus::CColor&, float, float, u32, bool);
CScriptCameraFilterKeyframe(TUniqueId uid, const std::string& name,
const CEntityInfo& info, EFilterType type, EFilterShape shape,
u32 filterIdx, u32 unk, const zeus::CColor& color,
float timeIn, float timeOut, ResId txtr, bool active);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
void Accept(IVisitor& visitor);
};
}

View File

@ -1032,18 +1032,18 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream
return nullptr;
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
u32 w3 = in.readUint32Big();
u32 w4 = in.readUint32Big();
EFilterType type = EFilterType(in.readUint32Big());
EFilterShape shape = EFilterShape(in.readUint32Big());
u32 filterIdx = in.readUint32Big();
u32 unk = in.readUint32Big();
zeus::CColor color;
color.readRGBABig(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
u32 w5 = in.readUint32Big();
float timeIn = in.readFloatBig();
float timeOut = in.readFloatBig();
ResId txtr = in.readUint32Big();
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, w1, w2, w3, w4, color, f1, f2, w5,
active);
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, type, shape, filterIdx, unk,
color, timeIn, timeOut, txtr, active);
}
CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount,
@ -1054,13 +1054,14 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream&
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
u32 w1 = in.readUint32Big();
float f1 = in.readFloatBig();
u32 w2 = in.readUint32Big();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
EBlurType type = EBlurType(in.readUint32Big());
float amount = in.readFloatBig();
u32 unk = in.readUint32Big();
float timeIn = in.readFloatBig();
float timeOut = in.readFloatBig();
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, w1, f1, w2, f2, f3, active);
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, type, amount,
unk, timeIn, timeOut, active);
}
u32 ClassifyVector(const zeus::CVector3f& dir)