Finish CScriptPlatform

This commit is contained in:
Jack Andersen 2018-06-29 10:21:36 -10:00
parent 3a9e7b2f9b
commit d0af2cb4f7
75 changed files with 590 additions and 239 deletions

View File

@ -1,7 +1,7 @@
#ifndef __DNACOMMON_ITWEAK_HPP__
#define __DNACOMMON_ITWEAK_HPP__
#include "../DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
namespace hecl
{

View File

@ -2,7 +2,7 @@
#define _DNAMP1_AFSM_HPP_
#include <athena/FileWriter.hpp>
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_AGSC_HPP_
#define _DNAMP1_AGSC_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -2,8 +2,8 @@
#define _DNAMP1_ANCS_HPP_
#include <map>
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"

View File

@ -2,7 +2,7 @@
#define _DNAMP1_ANIM_HPP_
#include "DNAMP1.hpp"
#include "../DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP1_CINF_HPP_
#define _DNAMP1_CINF_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/RigInverter.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
namespace DataSpec::DNAMP1
{

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP1_CMDL_HPP_
#define _DNAMP1_CMDL_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/CMDL.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/CMDL.hpp"
#include "CMDLMaterials.hpp"
#include "DNAMP1.hpp"
#include "CINF.hpp"

View File

@ -1,9 +1,9 @@
#ifndef _DNAMP1_CMDL_MATERIALS_HPP_
#define _DNAMP1_CMDL_MATERIALS_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "../DNACommon/CMDL.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/GX.hpp"
#include "DataSpec/DNACommon/CMDL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_CSKR_HPP_
#define _DNAMP1_CSKR_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CINF.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_CSNG_HPP_
#define _DNAMP1_CSNG_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -2,9 +2,9 @@
#define __DNAMP1_DCLN_HPP__
#include <athena/Types.hpp>
#include "../DNACommon/DeafBabe.hpp"
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/OBBTreeBuilder.hpp"
#include "DataSpec/DNACommon/DeafBabe.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/OBBTreeBuilder.hpp"
#include "DNAMP1.hpp"
#include "DeafBabe.hpp"

View File

@ -5,16 +5,16 @@
#include "STRG.hpp"
#include "SCAN.hpp"
#include "MLVL.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/PART.hpp"
#include "../DNACommon/ELSC.hpp"
#include "../DNACommon/SWHC.hpp"
#include "../DNACommon/CRSC.hpp"
#include "../DNACommon/WPSC.hpp"
#include "../DNACommon/DPSC.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/DGRP.hpp"
#include "../DNACommon/ATBL.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "DataSpec/DNACommon/PART.hpp"
#include "DataSpec/DNACommon/ELSC.hpp"
#include "DataSpec/DNACommon/SWHC.hpp"
#include "DataSpec/DNACommon/CRSC.hpp"
#include "DataSpec/DNACommon/WPSC.hpp"
#include "DataSpec/DNACommon/DPSC.hpp"
#include "DataSpec/DNACommon/FONT.hpp"
#include "DataSpec/DNACommon/DGRP.hpp"
#include "DataSpec/DNACommon/ATBL.hpp"
#include "HINT.hpp"
#include "CMDL.hpp"
#include "AFSM.hpp"
@ -29,7 +29,7 @@
#include "DCLN.hpp"
#include "PATH.hpp"
#include "../DNACommon/Tweaks/TweakWriter.hpp"
#include "DataSpec/DNACommon/Tweaks/TweakWriter.hpp"
#include "Tweaks/CTweakPlayerRes.hpp"
#include "Tweaks/CTweakGunRes.hpp"
#include "Tweaks/CTweakPlayer.hpp"

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP1_HPP__
#define __DNAMP1_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "PAK.hpp"
#include "zeus/CMatrix4f.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_DEAFBABE_HPP_
#define _DNAMP1_DEAFBABE_HPP_
#include "../DNACommon/DeafBabe.hpp"
#include "DataSpec/DNACommon/DeafBabe.hpp"
namespace DataSpec::DNAMP1
{

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP1_EVNT_HPP__
#define __DNAMP1_EVNT_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,5 +1,5 @@
#include "FRME.hpp"
#include "../DNACommon/TXTR.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_FRME_HPP_
#define _DNAMP1_FRME_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
#include <athena/FileWriter.hpp>
#include "athena/DNAOp.hpp"

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP1_HINT_HPP_
#define _DNAMP1_HINT_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP1
{

View File

@ -3,8 +3,8 @@
#include <vector>
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPA.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MAPA.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -3,8 +3,8 @@
#include <vector>
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPU.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MAPU.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,8 +1,8 @@
#ifndef __DNAMP1_MLVL_HPP__
#define __DNAMP1_MLVL_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MLVL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -4,7 +4,7 @@
#include "SCLY.hpp"
#include "PATH.hpp"
#include "DeafBabe.hpp"
#include "../DNACommon/BabeDead.hpp"
#include "DataSpec/DNACommon/BabeDead.hpp"
#include "zeus/Math.hpp"
#include "zeus/CAABox.hpp"
#include "DataSpec/DNACommon/AROTBuilder.hpp"

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP1_MREA_HPP__
#define __DNAMP1_MREA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"

View File

@ -4,7 +4,7 @@
#include <unordered_map>
#include <nod/DiscBase.hpp>
#include "../DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP1
{

View File

@ -1,7 +1,7 @@
#include "PATH.hpp"
#include "hecl/Blender/Connection.hpp"
#include "zeus/CAABox.hpp"
#include "../DNACommon/AROTBuilder.hpp"
#include "DataSpec/DNACommon/AROTBuilder.hpp"
namespace DataSpec::DNAMP1
{

View File

@ -1,8 +1,8 @@
#ifndef __DNACOMMON_PATH_HPP__
#define __DNACOMMON_PATH_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP1_SAVW_HPP__
#define __DNAMP1_SAVW_HPP__
#include "../DNACommon/SAVWCommon.hpp"
#include "DataSpec/DNACommon/SAVWCommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -2,7 +2,7 @@
#define _DNAMP1_SCAN_HPP_
#include <athena/FileWriter.hpp>
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_SCLY_HPP_
#define _DNAMP1_SCLY_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "ScriptObjects/IScriptObject.hpp"
#include "DNAMP1.hpp"

View File

@ -2,8 +2,8 @@
#define __DNAMP1_STRG_HPP__
#include <unordered_map>
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/STRG.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/STRG.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1

View File

@ -15,21 +15,21 @@ struct Platform : IScriptObject
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> unknown1;
Value<atVec3f> scanOffset;
Value<atVec3f> extent;
Value<atVec3f> collisionCenter;
UniqueID32 model;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<float> unknown2;
Value<float> speed;
Value<bool> active;
UniqueID32 dcln;
HealthInfo healthInfo;
DamageVulnerability damageVulnerabilty;
Value<bool> unknown3;
Value<float> unknown4;
Value<bool> unknown5;
Value<atUint32> unknown6;
Value<atUint32> unknown7;
Value<bool> detectCollision;
Value<float> xrayAlpha;
Value<bool> rainSplashes;
Value<atUint32> maxRainSplashes;
Value<atUint32> rainGenRate;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP2_AGSC_HPP_
#define _DNAMP2_AGSC_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP2.hpp"
namespace DataSpec::DNAMP2

View File

@ -2,8 +2,8 @@
#define _DNAMP2_ANCS_HPP_
#include <map>
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"

View File

@ -2,8 +2,8 @@
#define _DNAMP2_ANIM_HPP_
#include "DNAMP2.hpp"
#include "../DNACommon/ANIM.hpp"
#include "../DNACommon/RigInverter.hpp"
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
namespace DataSpec::DNAMP2

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP2_CINF_HPP_
#define _DNAMP2_CINF_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/RigInverter.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
namespace DataSpec::DNAMP2
{

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP2_CMDL_HPP_
#define _DNAMP2_CMDL_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/CMDL.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/CMDL.hpp"
#include "CMDLMaterials.hpp"
#include "DNAMP2.hpp"
#include "CINF.hpp"

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP2_CMDL_MATERIALS_HPP_
#define _DNAMP2_CMDL_MATERIALS_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/GX.hpp"
#include "../DNAMP1/CMDLMaterials.hpp"
#include "DNAMP2.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP2_CSKR_HPP_
#define _DNAMP2_CSKR_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CINF.hpp"
#include "../DNAMP1/CSKR.hpp"

View File

@ -12,11 +12,11 @@
#include "AGSC.hpp"
#include "../DNAMP1/HINT.hpp"
#include "../DNAMP1/CSNG.hpp"
#include "../DNACommon/FSM2.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/DGRP.hpp"
#include "../DNACommon/ATBL.hpp"
#include "DataSpec/DNACommon/FSM2.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "DataSpec/DNACommon/FONT.hpp"
#include "DataSpec/DNACommon/DGRP.hpp"
#include "DataSpec/DNACommon/ATBL.hpp"
#include "Runtime/GCNTypes.hpp"
namespace DataSpec::DNAMP2

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP2_HPP__
#define __DNAMP2_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "../DNAMP1/PAK.hpp"
namespace DataSpec::DNAMP2

View File

@ -1,8 +1,8 @@
#ifndef __DNAMP2_MAPA_HPP__
#define __DNAMP2_MAPA_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPA.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MAPA.hpp"
#include "DNAMP2.hpp"
namespace DataSpec::DNAMP2

View File

@ -3,8 +3,8 @@
#include <vector>
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPU.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MAPU.hpp"
#include "DNAMP2.hpp"
namespace DataSpec::DNAMP2

View File

@ -1,8 +1,8 @@
#ifndef __DNAMP2_MLVL_HPP__
#define __DNAMP2_MLVL_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MLVL.hpp"
#include "DNAMP2.hpp"
namespace DataSpec::DNAMP2

View File

@ -2,7 +2,7 @@
#include <lzo/lzo1x.h>
#include "MREA.hpp"
#include "../DNAMP1/MREA.hpp"
#include "../DNACommon/EGMC.hpp"
#include "DataSpec/DNACommon/EGMC.hpp"
#include "DeafBabe.hpp"
#include "hecl/Blender/Connection.hpp"

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP2_MREA_HPP__
#define __DNAMP2_MREA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP2_PTLA_HPP__
#define __DNAMP2_PTLA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
namespace DataSpec::DNAMP2
{

View File

@ -2,8 +2,8 @@
#define __DNAMP2_STRG_HPP__
#include <unordered_map>
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/STRG.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/STRG.hpp"
namespace DataSpec::DNAMP2
{

View File

@ -2,8 +2,8 @@
#define _DNAMP3_ANIM_HPP_
#include "DNAMP3.hpp"
#include "../DNACommon/ANIM.hpp"
#include "../DNACommon/RigInverter.hpp"
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP3_CAUD_HPP_
#define _DNAMP3_CAUD_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP3
{

View File

@ -2,8 +2,8 @@
#define _DNAMP3_CHAR_HPP_
#include <map>
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_CINF_HPP_
#define _DNAMP3_CINF_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "../DNAMP2/CINF.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP3_CMDL_HPP_
#define _DNAMP3_CMDL_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/CMDL.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/CMDL.hpp"
#include "CMDLMaterials.hpp"
#include "DNAMP3.hpp"
#include "CINF.hpp"

View File

@ -1,8 +1,8 @@
#ifndef _DNAMP3_CMDL_MATERIALS_HPP_
#define _DNAMP3_CMDL_MATERIALS_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/GX.hpp"
#include "../DNAMP1/CMDLMaterials.hpp"
#include "DNAMP3.hpp"

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_CSKR_HPP_
#define _DNAMP3_CSKR_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CINF.hpp"
#include "../DNAMP2/CSKR.hpp"

View File

@ -11,10 +11,10 @@
#include "MAPA.hpp"
#include "SAVW.hpp"
#include "HINT.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/FSM2.hpp"
#include "../DNACommon/DGRP.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
#include "DataSpec/DNACommon/FONT.hpp"
#include "DataSpec/DNACommon/FSM2.hpp"
#include "DataSpec/DNACommon/DGRP.hpp"
#include "Runtime/GCNTypes.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP3_HPP__
#define __DNAMP3_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP3_HINT_HPP_
#define _DNAMP3_HINT_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,8 +1,8 @@
#ifndef __DNAMP3_MAPA_HPP__
#define __DNAMP3_MAPA_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPA.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MAPA.hpp"
#include "DNAMP3.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,8 +1,8 @@
#ifndef __DNAMP3_MLVL_HPP__
#define __DNAMP3_MLVL_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MLVL.hpp"
#include "DNAMP3.hpp"
namespace DataSpec::DNAMP3

View File

@ -1,7 +1,7 @@
#include <athena/FileWriter.hpp>
#include "MREA.hpp"
#include "../DNAMP2/DeafBabe.hpp"
#include "../DNACommon/BabeDead.hpp"
#include "DataSpec/DNACommon/BabeDead.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP3_MREA_HPP__
#define __DNAMP3_MREA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"
#include "../DNAMP2/MREA.hpp"

View File

@ -5,7 +5,7 @@
#include <lzo/lzo1x.h>
#include <nod/DiscBase.hpp>
#include "../DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP3
{

View File

@ -1,7 +1,7 @@
#ifndef __DNAMP3_SAVW_HPP__
#define __DNAMP3_SAVW_HPP__
#include "../DNACommon/SAVWCommon.hpp"
#include "DataSpec/DNACommon/SAVWCommon.hpp"
#include "DNAMP3.hpp"
namespace DataSpec::DNAMP3

View File

@ -2,8 +2,8 @@
#define __DNAMP3_STRG_HPP__
#include <unordered_map>
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/STRG.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/STRG.hpp"
namespace DataSpec::DNAMP3
{

View File

@ -38,15 +38,15 @@ COBBTree::BuildOrientedBoundingBoxTree(const zeus::CVector3f& a, const zeus::CVe
CCollisionSurface COBBTree::GetSurface(u16 idx) const
{
u32 surfIdx = idx * 3;
CCollisionEdge edge1 = x18_indexData.x40_edges[x18_indexData.x50_surfaceIndices[surfIdx]];
CCollisionEdge edge2 = x18_indexData.x40_edges[x18_indexData.x50_surfaceIndices[surfIdx + 1]];
u16 vert1 = edge2.GetVertIndex1();
u16 vert2 = edge2.GetVertIndex2();
u16 vert3 = edge1.GetVertIndex1();
int surfIdx = idx * 3;
CCollisionEdge e0 = x18_indexData.x40_edges[x18_indexData.x50_surfaceIndices[surfIdx]];
CCollisionEdge e1 = x18_indexData.x40_edges[x18_indexData.x50_surfaceIndices[surfIdx + 1]];
u16 vert1 = e0.GetVertIndex1();
u16 vert2 = e0.GetVertIndex2();
u16 vert3 = e1.GetVertIndex1();
if (vert3 == vert1 || vert3 == edge2.GetVertIndex2())
vert3 = edge1.GetVertIndex2();
if (vert3 == vert1 || vert3 == vert2)
vert3 = e1.GetVertIndex2();
u32 mat = x18_indexData.x0_materials[x18_indexData.x30_surfaceMaterials[idx]];

View File

@ -293,7 +293,7 @@ void CActorModelParticles::StartIce(CActor& actor, CStateManager& mgr)
}
void CActorModelParticles::AddRainSplashGenerator(CScriptPlayerActor& act, CStateManager& mgr, u32 maxSplashes,
void CActorModelParticles::AddRainSplashGenerator(CActor& act, CStateManager& mgr, u32 maxSplashes,
u32 genRate, float minZ)
{
auto it = FindOrCreateSystem(act);
@ -305,7 +305,7 @@ void CActorModelParticles::AddRainSplashGenerator(CScriptPlayerActor& act, CStat
maxSplashes, genRate, minZ, 0.1875f);
}
void CActorModelParticles::RemoveRainSplashGenerator(CScriptPlayerActor& act)
void CActorModelParticles::RemoveRainSplashGenerator(CActor& act)
{
auto it = FindOrCreateSystem(act);
it->xd4_rainSplashGenerator.reset();

View File

@ -96,9 +96,9 @@ public:
std::list<CItem>::const_iterator FindSystem(TUniqueId uid) const;
std::list<CItem>::iterator FindOrCreateSystem(CActor& act);
void StartIce(CActor& actor, CStateManager& mgr);
void AddRainSplashGenerator(CScriptPlayerActor& act, CStateManager& mgr, u32 maxSplashes,
void AddRainSplashGenerator(CActor& act, CStateManager& mgr, u32 maxSplashes,
u32 genRate, float minZ);
void RemoveRainSplashGenerator(CScriptPlayerActor& act);
void RemoveRainSplashGenerator(CActor& act);
void Render(const CActor& actor) const;
};
}

View File

@ -44,8 +44,4 @@ void CEnvFxManager::Cleanup()
xb70_ = 0;
}
void CEnvFxManager::sub801e4f10(CActor*, float, const CStateManager& , u32, u32)
{
}
}

View File

@ -86,7 +86,6 @@ public:
bool GetX24() const { return x24_; }
float GetRainMagnitude() const { return x30_rainMagnitude; }
void Cleanup();
void sub801e4f10(CActor*, float, const CStateManager&, u32, u32);
};
}

View File

@ -82,8 +82,8 @@ void CScriptActorRotate::Think(float dt, CStateManager& mgr)
void CScriptActorRotate::UpdatePlatformRiders(CScriptPlatform& plat, const zeus::CTransform& xf, CStateManager& mgr)
{
UpdatePlatformRiders(plat.GetX328(), plat, xf, mgr);
UpdatePlatformRiders(plat.GetX338(), plat, xf, mgr);
UpdatePlatformRiders(plat.GetStaticSlaves(), plat, xf, mgr);
UpdatePlatformRiders(plat.GetDynamicSlaves(), plat, xf, mgr);
}
void CScriptActorRotate::UpdatePlatformRiders(std::vector<SRiders>& riders, CScriptPlatform& plat,

View File

@ -1,11 +1,16 @@
#include "CScriptPlatform.hpp"
#include "Collision/CMaterialList.hpp"
#include "Collision/CCollidableOBBTreeGroup.hpp"
#include "Collision/CGameCollision.hpp"
#include "World/CScriptWaypoint.hpp"
#include "World/CScriptColorModulate.hpp"
#include "World/CWorld.hpp"
#include "World/CPlayer.hpp"
#include "World/CScriptTrigger.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "CStateManager.hpp"
#include "TCastTo.hpp"
namespace urde
{
@ -21,29 +26,29 @@ static CMaterialList MakePlatformMaterialList()
CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
const zeus::CAABox& aabb, float f1, bool b1, float f2, bool active,
const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha,
bool active, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
bool b2, u32 w1, u32 w2)
bool rainSplashes, u32 maxRainSplashes, u32 rainGenRate)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
actParms, 0.3f, 0.1f)
, x25c_currentMass(f1)
, x25c_currentSpeed(speed)
, x28c_initialHealth(hInfo)
, x294_health(hInfo)
, x29c_damageVuln(dVuln)
, x304_treeGroupContainer(dcln)
{
x348_ = f2;
x34c_ = w1;
x350_ = w2;
x348_xrayAlpha = xrayAlpha;
x34c_maxRainSplashes = maxRainSplashes;
x350_rainGenRate = rainGenRate;
x356_24_dead = false;;
x356_25_ = false;
x356_26_ = b1;
x356_27_ = false;
x356_28_ = b2;
x356_29_ = false;
x356_30_ = false;
x356_31_ = true;
x356_25_notAnimating = false;
x356_26_detectCollision = detectCollision;
x356_27_squishedRider = false;
x356_28_rainSplashes = rainSplashes;
x356_29_setXrayDrawFlags = false;
x356_30_disableXrayAlpha = false;
x356_31_xrayFog = true;
CActor::SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
CMaterialList(EMaterialTypes::Solid),
CMaterialList(EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision, EMaterialTypes::Platform)));
@ -54,6 +59,38 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptPlatform::DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
CActor* actor, const zeus::CVector3f& delta)
{
if (std::find(draggedSet.begin(), draggedSet.end(), actor->GetUniqueId().Value()) == draggedSet.end())
{
draggedSet.push_back(actor->GetUniqueId().Value());
zeus::CTransform newXf = actor->GetTransform();
newXf.origin += delta;
actor->SetTransform(newXf);
if (TCastToPtr<CScriptPlatform> plat = actor)
plat->DragSlaves(mgr, draggedSet, delta);
}
}
void CScriptPlatform::DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
const zeus::CVector3f& delta)
{
for (SRiders& rider : x328_slavesStatic)
if (TCastToPtr<CActor> act = mgr.ObjectById(rider.x0_uid))
DragSlave(mgr, draggedSet, act.GetPtr(), delta);
for (auto it = x338_slavesDynamic.begin() ; it != x338_slavesDynamic.end() ;)
{
if (TCastToPtr<CActor> act = mgr.ObjectById(it->x0_uid))
{
DragSlave(mgr, draggedSet, act.GetPtr(), delta);
++it;
}
else
it = x338_slavesDynamic.erase(it);
}
}
void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
switch(msg)
@ -66,7 +103,7 @@ void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
break;
case EScriptObjectMessage::Stop:
{
x25c_currentMass = 0.f;
x25c_currentSpeed = 0.f;
Stop();
break;
}
@ -77,21 +114,20 @@ void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Stop);
else if (TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(x25a_targetWaypoint))
{
x25c_currentMass = 0.f;
x25c_currentSpeed = 0.f;
Stop();
x270_ = wp->GetTranslation() - GetTranslation();
x270_dragDelta = wp->GetTranslation() - GetTranslation();
SetTranslation(wp->GetTranslation());
x258_currentWaypoint = x25a_targetWaypoint;
x25a_targetWaypoint = GetNext(x258_currentWaypoint, mgr);
mgr.SendScriptMsg(wp, GetUniqueId(), EScriptObjectMessage::Arrived);
#if 0
if (!x328_slaves1.empty() || !x338_slaves2.empty())
DragSlaves(bitVector, x270_);
/* TODO: Implement bitvector */
#endif
x270_ = zeus::CVector3f::skZero;
if (!x328_slavesStatic.empty() || !x338_slavesDynamic.empty())
{
rstl::reserved_vector<u16, 1024> draggedSet;
DragSlaves(mgr, draggedSet, x270_dragDelta);
}
x270_dragDelta = zeus::CVector3f::skZero;
}
break;
}
@ -100,8 +136,8 @@ void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
x25a_targetWaypoint = GetNext(x258_currentWaypoint, mgr);
if (x25a_targetWaypoint == kInvalidUniqueId)
mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Stop);
else
x25c_currentMass = 0.f;
else if (TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(x25a_targetWaypoint))
x25c_currentSpeed = wp->GetSpeed();
break;
}
case EScriptObjectMessage::Reset:
@ -131,27 +167,118 @@ void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
CPhysicsActor::AcceptScriptMsg(msg, uid, mgr);
}
void CScriptPlatform::DecayRiders(std::vector<SRiders>& riders, float dt, CStateManager& mgr)
{
for (auto it = riders.begin() ; it != riders.end() ;)
{
it->x4_decayTimer -= dt;
if (it->x4_decayTimer <= 0.f)
{
mgr.SendScriptMsgAlways(it->x0_uid, kInvalidUniqueId, EScriptObjectMessage::AddPlatformRider);
it = riders.erase(it);
continue;
}
++it;
}
}
void CScriptPlatform::MoveRiders(CStateManager& mgr, float dt, bool active, std::vector<SRiders>& riders,
std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf,
const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta,
const zeus::CQuaternion& rotDelta)
{
for (auto it = riders.begin() ; it != riders.end() ;)
{
if (active)
{
if (TCastToPtr<CPhysicsActor> act = mgr.ObjectById(it->x0_uid))
{
if (act->GetActive())
{
zeus::CVector3f delta = newXf.rotate(it->x8_transform.origin) -
oldXf.rotate(it->x8_transform.origin) + dragDelta;
zeus::CVector3f newPos = act->GetTranslation() + delta;
act->MoveCollisionPrimitive(delta);
bool collision = CGameCollision::DetectStaticCollisionBoolean(mgr, *act->GetCollisionPrimitive(),
act->GetPrimitiveTransform(),
act->GetMaterialFilter());
act->MoveCollisionPrimitive(zeus::CVector3f::skZero);
if (collision)
{
AddRider(collidedRiders, act->GetUniqueId(), act.GetPtr(), mgr);
it = riders.erase(it);
continue;
}
act->SetTranslation(newPos);
if (TCastToPtr<CPlayer> player = act.GetPtr())
{
if (player->GetOrbitState() != CPlayer::EPlayerOrbitState::NoOrbit)
{
++it;
continue;
}
}
zeus::CTransform xf = (rotDelta * zeus::CQuaternion(act->GetTransform().basis)).toTransform();
xf.origin = act->GetTranslation();
act->SetTransform(xf);
}
}
}
++it;
}
}
rstl::reserved_vector<TUniqueId, 1024> CScriptPlatform::BuildNearListFromRiders
(CStateManager& mgr, const std::vector<SRiders>& movedRiders)
{
rstl::reserved_vector<TUniqueId, 1024> ret;
for (const SRiders& rider : movedRiders)
if (TCastToPtr<CActor> act = mgr.ObjectById(rider.x0_uid))
ret.push_back(act->GetUniqueId());
return ret;
}
void CScriptPlatform::PreThink(float dt, CStateManager& mgr)
{
DecayRiders(x318_riders, dt, mgr);
x264_ -= dt;
x260_ -= dt;
if (x260_ <= 0.f)
x264_collisionRecoverDelay -= dt;
x260_moveDelay -= dt;
if (x260_moveDelay <= 0.f)
{
x270_ = zeus::CVector3f::skZero;
zeus::CTransform xf = x34_transform;
x270_dragDelta = zeus::CVector3f::skZero;
zeus::CTransform oldXf = x34_transform;
CMotionState mState = GetMotionState();
if (GetActive())
{
for (SRiders& rider : x318_riders)
{
if (TCastToPtr<CPhysicsActor> act = mgr.ObjectById(rider.x0_uid))
rider.x8_transform.origin = x34_transform.transposeRotate(act->GetTranslation() - GetTranslation());
x27c_rotDelta = Move(dt, mgr);
}
x270_dragDelta = x34_transform.origin - oldXf.origin;
std::vector<SRiders> collidedRiders;
MoveRiders(mgr, dt, GetActive(), x318_riders, collidedRiders, oldXf,
x34_transform, x270_dragDelta, x27c_rotDelta);
x356_27_squishedRider = false;
if (!collidedRiders.empty())
{
rstl::reserved_vector<TUniqueId, 1024> nearList = BuildNearListFromRiders(mgr, collidedRiders);
if (CGameCollision::DetectDynamicCollisionBoolean(*GetCollisionPrimitive(), GetPrimitiveTransform(),
nearList, mgr))
{
SetMotionState(mState);
Stop();
x260_moveDelay = 0.035f;
MoveRiders(mgr, dt, GetActive(), x318_riders, collidedRiders, x34_transform, oldXf,
-x270_dragDelta, x27c_rotDelta.inverse());
x270_dragDelta = zeus::CVector3f::skZero;
SendScriptMsgs(EScriptObjectState::Modify, mgr, EScriptObjectMessage::None);
x356_27_squishedRider = true;
}
}
}
x27c_ = Move(dt, mgr);
}
void CScriptPlatform::Think(float dt, CStateManager& mgr)
@ -161,22 +288,21 @@ void CScriptPlatform::Think(float dt, CStateManager& mgr)
if (HasModelData() && GetModelData()->HasAnimData())
{
if (!x356_25_)
if (!x356_25_notAnimating)
UpdateAnimation(dt, mgr, true);
if (x356_28_ && mgr.GetWorld()->GetNeededEnvFx() == EEnvFxType::Rain)
if (x356_28_rainSplashes && mgr.GetWorld()->GetNeededEnvFx() == EEnvFxType::Rain)
{
if (HasModelData() && (GetModelData()->HasAnimData() || GetModelData()->HasNormalModel())
&& mgr.GetEnvFxManager()->GetRainMagnitude() != 0.f)
mgr.GetEnvFxManager()->sub801e4f10(this, 0.f, mgr, x34c_, x350_);
if (HasModelData() && !GetModelData()->IsNull() && mgr.GetEnvFxManager()->GetRainMagnitude() != 0.f)
mgr.GetActorModelParticles()->AddRainSplashGenerator
(*this, mgr, x34c_maxRainSplashes, x350_rainGenRate, 0.f);
}
}
#if 0
if (!x328_slaves1.empty() || !x338_slaves2.empty())
DragSlaves(bitVector, x270_);
/* TODO: Implement bitvector */
#endif
if (!x328_slavesStatic.empty() || !x338_slavesDynamic.empty())
{
rstl::reserved_vector<u16, 1024> draggedSet;
DragSlaves(mgr, draggedSet, x270_dragDelta);
}
if (x356_24_dead)
return;
@ -188,6 +314,38 @@ void CScriptPlatform::Think(float dt, CStateManager& mgr)
}
}
void CScriptPlatform::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
{
CActor::PreRender(mgr, frustum);
if (!xe4_30_outOfFrustum && !zeus::close_enough(x348_xrayAlpha, 1.f))
{
CModelFlags flags(5, 0, 3, {1.f, x348_xrayAlpha});
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && !x356_30_disableXrayAlpha)
{
xb4_drawFlags = flags;
x356_29_setXrayDrawFlags = true;
}
else if (x356_29_setXrayDrawFlags)
{
x356_29_setXrayDrawFlags = false;
if (xb4_drawFlags == flags && !x356_30_disableXrayAlpha)
xb4_drawFlags = CModelFlags(0, 0, 3, zeus::CColor::skWhite);
}
}
if (!mgr.GetObjectById(x354_boundsTrigger))
x354_boundsTrigger = kInvalidUniqueId;
}
void CScriptPlatform::Render(const CStateManager& mgr) const
{
bool xray = mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay;
if (xray && !x356_31_xrayFog)
g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::CColor::skBlack);
CPhysicsActor::Render(mgr);
if (xray && !x356_31_xrayFog)
mgr.SetupFogForArea(x4_areaId);
}
std::experimental::optional<zeus::CAABox> CScriptPlatform::GetTouchBounds() const
{
if (x314_treeGroup)
@ -210,6 +368,26 @@ const CCollisionPrimitive* CScriptPlatform::GetCollisionPrimitive() const
return x314_treeGroup.get();
}
zeus::CVector3f CScriptPlatform::GetOrbitPosition(const CStateManager& mgr) const
{
return GetAimPosition(mgr, 0.f);
}
zeus::CVector3f CScriptPlatform::GetAimPosition(const CStateManager& mgr, float dt) const
{
if (auto tb = GetTouchBounds())
return {tb->center()};
return CPhysicsActor::GetAimPosition(mgr, dt);
}
zeus::CAABox CScriptPlatform::GetSortingBounds(const CStateManager& mgr) const
{
if (x354_boundsTrigger != kInvalidUniqueId)
if (TCastToConstPtr<CScriptTrigger> trig = mgr.GetObjectById(x354_boundsTrigger))
return trig->GetTriggerBoundsWR();
return CActor::GetSortingBounds(mgr);
}
bool CScriptPlatform::IsRider(TUniqueId id) const
{
for (const SRiders& rider : x318_riders)
@ -220,22 +398,74 @@ bool CScriptPlatform::IsRider(TUniqueId id) const
bool CScriptPlatform::IsSlave(TUniqueId id) const
{
auto search = std::find_if(x328_slaves1.begin(), x328_slaves1.end(),
auto search = std::find_if(x328_slavesStatic.begin(), x328_slavesStatic.end(),
[id](const SRiders& rider){ return rider.x0_uid == id; });
if (search != x328_slaves1.end())
if (search != x328_slavesStatic.end())
return true;
search = std::find_if(x338_slaves2.begin(), x338_slaves2.end(),
search = std::find_if(x338_slavesDynamic.begin(), x338_slavesDynamic.end(),
[id](const SRiders& rider){ return rider.x0_uid == id; });
return search != x338_slaves2.end();
return search != x338_slavesDynamic.end();
}
void CScriptPlatform::BuildSlaveList(CStateManager& mgr)
{
x328_slavesStatic.reserve(GetConnectionList().size());
for (const SConnection& conn : GetConnectionList())
{
if (conn.x0_state == EScriptObjectState::Play && conn.x4_msg == EScriptObjectMessage::Activate)
{
if (TCastToPtr<CActor> act = mgr.ObjectById(mgr.GetIdForScript(conn.x8_objId)))
{
act->AddMaterial(EMaterialTypes::PlatformSlave, mgr);
zeus::CTransform xf = act->GetTransform();
xf.origin = act->GetTranslation() - GetTranslation();
x328_slavesStatic.emplace_back(act->GetUniqueId(), 0.166667f, xf);
}
}
else if (conn.x0_state == EScriptObjectState::InheritBounds && conn.x4_msg == EScriptObjectMessage::Activate)
{
auto list = mgr.GetIdListForScript(conn.x8_objId);
for (auto it = list.first ; it != list.second ; ++it)
if (TCastToConstPtr<CScriptTrigger>(mgr.GetObjectById(it->second)))
x354_boundsTrigger = it->second;
}
}
}
void CScriptPlatform::AddRider(std::vector<SRiders>&, TUniqueId, const CPhysicsActor*, CStateManager& )
void CScriptPlatform::AddRider(std::vector<SRiders>& riders, TUniqueId riderId,
const CPhysicsActor* ridee, CStateManager& mgr)
{
auto search = std::find_if(riders.begin(), riders.end(),
[riderId](const SRiders& r) { return r.x0_uid == riderId; });
if (search == riders.end())
{
zeus::CTransform xf;
if (TCastToPtr<CPhysicsActor> act = mgr.ObjectById(riderId))
{
xf.origin = ridee->GetTransform().transposeRotate(act->GetTranslation() - ridee->GetTranslation());
mgr.SendScriptMsg(act.GetPtr(), ridee->GetUniqueId(), EScriptObjectMessage::AddPlatformRider);
}
riders.emplace_back(riderId, 0.166667f, xf);
}
else
{
search->x4_decayTimer = 0.166667f;
}
}
void CScriptPlatform::AddSlave(TUniqueId id, CStateManager& mgr)
{
auto search = std::find_if(x338_slavesDynamic.begin(), x338_slavesDynamic.end(),
[id](const SRiders& r) { return r.x0_uid == id; });
if (search == x338_slavesDynamic.end())
{
if (TCastToPtr<CActor> act = mgr.ObjectById(id))
{
act->AddMaterial(EMaterialTypes::PlatformSlave, mgr);
zeus::CTransform localXf = x34_transform.inverse() * act->GetTransform();
x338_slavesDynamic.emplace_back(id, 0.166667f, localXf);
}
}
}
TUniqueId CScriptPlatform::GetNext(TUniqueId uid, CStateManager& mgr)
@ -245,8 +475,8 @@ TUniqueId CScriptPlatform::GetNext(TUniqueId uid, CStateManager& mgr)
return GetWaypoint(mgr);
TUniqueId next = nextWp->NextWaypoint(mgr);
if (TCastToConstPtr<CScriptWaypoint>(mgr.GetObjectById(next)))
x25c_currentMass = xe8_mass;
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(next))
x25c_currentSpeed = wp->GetSpeed();
return next;
}
@ -264,32 +494,134 @@ TUniqueId CScriptPlatform::GetWaypoint(CStateManager& mgr)
void CScriptPlatform::SplashThink(const zeus::CAABox &, const CFluidPlane &, float, CStateManager &) const
{
// Empty
}
zeus::CQuaternion CScriptPlatform::Move(float, CStateManager& mgr)
zeus::CQuaternion CScriptPlatform::Move(float dt, CStateManager& mgr)
{
TUniqueId nextWaypoint = x25a_targetWaypoint;
if (x25a_targetWaypoint == kInvalidUniqueId)
nextWaypoint = GetNext(x258_currentWaypoint, mgr);
TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(nextWaypoint);
if (x258_currentWaypoint != kInvalidUniqueId)
if (x258_currentWaypoint != kInvalidUniqueId && wp && !wp->GetActive())
{
if (wp && !wp->GetActive())
nextWaypoint = GetNext(x258_currentWaypoint, mgr);
nextWaypoint = GetNext(x258_currentWaypoint, mgr);
if (nextWaypoint == kInvalidUniqueId)
{
if (TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(x258_currentWaypoint))
if (wp->GetActive())
nextWaypoint = wp->GetUniqueId();
}
nextWaypoint = x258_currentWaypoint;
}
if (nextWaypoint == kInvalidUniqueId)
return zeus::CQuaternion::skNoRotation;
/* TODO: Finish */
return {};
while (nextWaypoint != kInvalidUniqueId)
{
if (TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(nextWaypoint))
{
zeus::CVector3f platToWp = wp->GetTranslation() - GetTranslation();
if (zeus::close_enough(platToWp, zeus::CVector3f::skZero))
{
x258_currentWaypoint = nextWaypoint;
mgr.SendScriptMsg(wp.GetPtr(), GetUniqueId(), EScriptObjectMessage::Arrived);
if (zeus::close_enough(x25c_currentSpeed, 0.f, 0.02))
{
nextWaypoint = GetNext(x258_currentWaypoint, mgr);
x25c_currentSpeed = 0.f;
Stop();
}
else
{
nextWaypoint = GetNext(x258_currentWaypoint, mgr);
}
if (nextWaypoint != kInvalidUniqueId)
continue;
mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Stop);
}
if (zeus::close_enough(platToWp, zeus::CVector3f::skZero))
{
x270_dragDelta = wp->GetTranslation() - GetTranslation();
MoveToWR(GetTranslation(), dt);
}
else if ((platToWp.normalized() * x25c_currentSpeed * dt).magSquared() > platToWp.magSquared())
{
x270_dragDelta = wp->GetTranslation() - GetTranslation();
MoveToWR(wp->GetTranslation(), dt);
}
else
{
x270_dragDelta = platToWp.normalized() * x25c_currentSpeed * dt;
MoveToWR(GetTranslation() + x270_dragDelta, dt);
}
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildColliderList(nearList, *this, GetMotionVolume(dt));
rstl::reserved_vector<TUniqueId, 1024> nonRiders;
for (TUniqueId id : nearList)
if (!IsRider(id) && !IsSlave(id))
nonRiders.push_back(id);
if (x356_26_detectCollision)
{
CMotionState mState = PredictMotion(dt);
MoveCollisionPrimitive(mState.x0_translation);
bool collision = CGameCollision::DetectDynamicCollisionBoolean
(*GetCollisionPrimitive(), GetPrimitiveTransform(), nonRiders, mgr);
MoveCollisionPrimitive(zeus::CVector3f::skZero);
if (collision || x356_27_squishedRider)
{
if (x356_26_detectCollision)
{
if (x264_collisionRecoverDelay <= 0.f && !x356_27_squishedRider)
{
x264_collisionRecoverDelay = 0.035f;
break;
}
else
{
x356_27_squishedRider = false;
TUniqueId prevWaypoint = nextWaypoint;
nextWaypoint = GetNext(nextWaypoint, mgr);
if (x25a_targetWaypoint == nextWaypoint || x25a_targetWaypoint == prevWaypoint)
{
x260_moveDelay = 0.035f;
break;
}
}
}
else
{
break;
}
}
else
{
AddMotionState(mState);
break;
}
}
else
{
xf8_24_movable = true;
CGameCollision::Move(mgr, *this, dt, &nonRiders);
xf8_24_movable = false;
break;
}
}
else
{
nextWaypoint = kInvalidUniqueId;
break;
}
}
x25a_targetWaypoint = nextWaypoint;
return zeus::CQuaternion::skNoRotation;
}
}

View File

@ -16,8 +16,11 @@ class CFluidPlane;
struct SRiders
{
TUniqueId x0_uid;
u32 x4_;
float x4_decayTimer;
zeus::CTransform x8_transform;
SRiders(TUniqueId id, float decayTimer, const zeus::CTransform& xf)
: x0_uid(id), x4_decayTimer(decayTimer), x8_transform(xf) {}
};
class CScriptPlatform : public CPhysicsActor
@ -25,70 +28,89 @@ class CScriptPlatform : public CPhysicsActor
u32 x254_;
TUniqueId x258_currentWaypoint = kInvalidUniqueId;
TUniqueId x25a_targetWaypoint = kInvalidUniqueId;
float x25c_currentMass;
float x260_ = 0.f;
float x264_ = 0.f;
float x25c_currentSpeed;
float x260_moveDelay = 0.f;
float x264_collisionRecoverDelay = 0.f;
float x268_fadeInTime = 0.f;
float x26c_fadeOutTime = 0.f;
zeus::CVector3f x270_;
zeus::CQuaternion x27c_;
zeus::CVector3f x270_dragDelta;
zeus::CQuaternion x27c_rotDelta;
CHealthInfo x28c_initialHealth;
CHealthInfo x294_health;
CDamageVulnerability x29c_damageVuln;
std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> x304_treeGroupContainer;
std::unique_ptr<CCollidableOBBTreeGroup> x314_treeGroup;
std::vector<SRiders> x318_riders;
std::vector<SRiders> x328_slaves1;
std::vector<SRiders> x338_slaves2;
float x348_;
u32 x34c_;
u32 x350_;
TUniqueId x354_ = kInvalidUniqueId;
std::vector<SRiders> x328_slavesStatic;
std::vector<SRiders> x338_slavesDynamic;
float x348_xrayAlpha;
u32 x34c_maxRainSplashes;
u32 x350_rainGenRate;
TUniqueId x354_boundsTrigger = kInvalidUniqueId;
union
{
struct
{
bool x356_24_dead : 1;
bool x356_25_ : 1;
bool x356_26_ : 1;
bool x356_27_ : 1;
bool x356_28_ : 1;
bool x356_29_ : 1;
bool x356_30_ : 1;
bool x356_31_ : 1;
bool x356_25_notAnimating : 1;
bool x356_26_detectCollision : 1;
bool x356_27_squishedRider : 1;
bool x356_28_rainSplashes : 1;
bool x356_29_setXrayDrawFlags : 1;
bool x356_30_disableXrayAlpha : 1;
bool x356_31_xrayFog : 1;
};
u32 x356_dummy = 0;
};
void DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
CActor* actor, const zeus::CVector3f& delta);
void DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
const zeus::CVector3f& delta);
static void DecayRiders(std::vector<SRiders>& riders, float dt, CStateManager& mgr);
static void MoveRiders(CStateManager& mgr, float dt, bool active, std::vector<SRiders>& riders,
std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf,
const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta,
const zeus::CQuaternion& rotDelta);
static rstl::reserved_vector<TUniqueId, 1024> BuildNearListFromRiders
(CStateManager& mgr, const std::vector<SRiders>& movedRiders);
public:
CScriptPlatform(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool, u32, u32);
CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha,
bool active, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
bool rainSplashes, u32 maxRainSplashes, u32 rainGenRate);
void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void PreThink(float, CStateManager&);
void Think(float, CStateManager&);
void PreRender(CStateManager&, const zeus::CFrustum&);
void Render(const CStateManager&) const;
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
zeus::CTransform GetPrimitiveTransform() const;
const CCollisionPrimitive* GetCollisionPrimitive() const;
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const;
zeus::CVector3f GetAimPosition(const CStateManager& mgr, float dt) const;
zeus::CAABox GetSortingBounds(const CStateManager& mgr) const;
bool IsRider(TUniqueId id) const;
bool IsSlave(TUniqueId id) const;
std::vector<SRiders>& GetX328() { return x328_slaves1; }
const std::vector<SRiders>& GetX328() const { return x328_slaves1; }
std::vector<SRiders>& GetX338() { return x338_slaves2; }
const std::vector<SRiders>& GetX338() const { return x338_slaves2; }
void AddSlave(TUniqueId, CStateManager&) {}
std::vector<SRiders>& GetStaticSlaves() { return x328_slavesStatic; }
const std::vector<SRiders>& GetStaticSlaves() const { return x328_slavesStatic; }
std::vector<SRiders>& GetDynamicSlaves() { return x338_slavesDynamic; }
const std::vector<SRiders>& GetDynamicSlaves() const { return x338_slavesDynamic; }
bool HasComplexCollision() const { return x314_treeGroup.operator bool(); }
void BuildSlaveList(CStateManager&);
void AddRider(std::vector<SRiders>&, TUniqueId, const CPhysicsActor*, CStateManager&);
static void AddRider(std::vector<SRiders>& riders, TUniqueId riderId,
const CPhysicsActor* ridee, CStateManager& mgr);
void AddSlave(TUniqueId, CStateManager&);
TUniqueId GetNext(TUniqueId, CStateManager&);
TUniqueId GetWaypoint(CStateManager&);
const CDamageVulnerability* GetDamageVulnerability() const { return &x29c_damageVuln; }
CHealthInfo* HealthInfo(CStateManager&) { return &x294_health; }
void DecayRiders(std::vector<SRiders>&, float, CStateManager&) {}
virtual void SplashThink(const zeus::CAABox&, const CFluidPlane&, float, CStateManager&) const;
virtual zeus::CQuaternion Move(float, CStateManager&);

View File

@ -11,7 +11,7 @@ CScriptWaypoint::CScriptWaypoint(TUniqueId uid, std::string_view name, const CEn
u32 w1, u32 w2, u32 w3, u32 w4, u32 w5, u32 w6, u32 w7)
: CActor(uid, active, name, info, xf, CModelData(), CMaterialList(),
CActorParameters::None(), kInvalidUniqueId),
xe8_(f1), xec_(w7), xf0_(f2), xf4_(w1), xf5_(w2), xf6_(w3), xf7_(w4), xf8_(w5), xfa_jumpFlags(w6)
xe8_speed(f1), xec_(w7), xf0_(f2), xf4_(w1), xf5_(w2), xf6_(w3), xf7_(w4), xf8_(w5), xfa_jumpFlags(w6)
{
SetUseInSortedLists(false);
SetCallTouch(false);

View File

@ -8,7 +8,7 @@ namespace urde
class CScriptWaypoint : public CActor
{
float xe8_;
float xe8_speed;
u32 xec_;
float xf0_;
bool xf4_;
@ -27,6 +27,7 @@ public:
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
TUniqueId FollowWaypoint(CStateManager& mgr) const;
TUniqueId NextWaypoint(CStateManager& mgr) const;
float GetSpeed() const { return xe8_speed; }
};
}

View File

@ -633,19 +633,19 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr
CActorParameters actParms = LoadActorParameters(in);
float f1 = in.readFloatBig();
bool b1 = in.readBool();
float speed = in.readFloatBig();
bool active = in.readBool();
CAssetId dclnId = in.readUint32Big();
CHealthInfo hInfo(in);
CDamageVulnerability dInfo(in);
bool b2 = in.readBool();
float f2 = in.readFloatBig();
bool b3 = in.readBool();
u32 w2 = in.readUint32Big();
u32 w3 = in.readUint32Big();
bool detectCollision = in.readBool();
float xrayAlpha = in.readFloatBig();
bool rainSplashes = in.readBool();
u32 maxRainSplashes = in.readUint32Big();
u32 rainGenRate = in.readUint32Big();
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile());
if (!g_ResFactory->GetResourceTypeById(staticId) && !animType)
@ -671,7 +671,8 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr
aabb = data.GetBounds(head.x10_transform.getRotation());
return new CScriptPlatform(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data),
actParms, aabb, f1, b2, f2, b1, hInfo, dInfo, dclnToken, b3, w2, w3);
actParms, aabb, speed, detectCollision, xrayAlpha, active, hInfo, dInfo,
dclnToken, rainSplashes, maxRainSplashes, rainGenRate);
}
CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)