2016-04-17 22:38:05 +00:00
|
|
|
#include "ScriptLoader.hpp"
|
2016-04-18 05:33:23 +00:00
|
|
|
#include "CActorParameters.hpp"
|
|
|
|
#include "CAnimationParameters.hpp"
|
2016-04-19 21:25:26 +00:00
|
|
|
#include "CDamageInfo.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CFluidUVMotion.hpp"
|
|
|
|
#include "CGrappleParameters.hpp"
|
|
|
|
#include "CPatternedInfo.hpp"
|
|
|
|
#include "CRepulsor.hpp"
|
2016-04-19 00:17:49 +00:00
|
|
|
#include "CScriptActor.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptActorKeyframe.hpp"
|
|
|
|
#include "CScriptActorRotate.hpp"
|
|
|
|
#include "CScriptAiJumpPoint.hpp"
|
|
|
|
#include "CScriptAreaAttributes.hpp"
|
|
|
|
#include "CScriptBeam.hpp"
|
|
|
|
#include "CScriptCameraBlurKeyframe.hpp"
|
|
|
|
#include "CScriptCameraFilterKeyframe.hpp"
|
|
|
|
#include "CScriptCameraHint.hpp"
|
|
|
|
#include "CScriptCameraHintTrigger.hpp"
|
|
|
|
#include "CScriptCameraPitchVolume.hpp"
|
|
|
|
#include "CScriptCameraShaker.hpp"
|
|
|
|
#include "CScriptCameraWaypoint.hpp"
|
|
|
|
#include "CScriptColorModulate.hpp"
|
|
|
|
#include "CScriptControllerAction.hpp"
|
2016-04-19 21:25:26 +00:00
|
|
|
#include "CScriptCounter.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptCoverPoint.hpp"
|
|
|
|
#include "CScriptDamageableTrigger.hpp"
|
|
|
|
#include "CScriptDebris.hpp"
|
|
|
|
#include "CScriptDistanceFog.hpp"
|
2016-04-20 21:07:18 +00:00
|
|
|
#include "CScriptDock.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptDockAreaChange.hpp"
|
|
|
|
#include "CScriptDoor.hpp"
|
2016-04-20 21:44:18 +00:00
|
|
|
#include "CScriptEffect.hpp"
|
|
|
|
#include "CScriptGenerator.hpp"
|
2016-04-20 21:07:18 +00:00
|
|
|
#include "CScriptGrapplePoint.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptHUDMemo.hpp"
|
|
|
|
#include "CScriptMazeNode.hpp"
|
|
|
|
#include "CScriptMemoryRelay.hpp"
|
|
|
|
#include "CScriptMidi.hpp"
|
|
|
|
#include "CScriptPickup.hpp"
|
2016-12-10 02:35:20 +00:00
|
|
|
#include "CScriptPickupGenerator.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptPlatform.hpp"
|
2017-02-21 03:29:28 +00:00
|
|
|
#include "CScriptPlayerActor.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptPlayerHint.hpp"
|
|
|
|
#include "CScriptPlayerStateChange.hpp"
|
|
|
|
#include "CScriptPointOfInterest.hpp"
|
2016-05-18 03:57:43 +00:00
|
|
|
#include "CScriptRandomRelay.hpp"
|
|
|
|
#include "CScriptRelay.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptRoomAcoustics.hpp"
|
|
|
|
#include "CScriptShadowProjector.hpp"
|
|
|
|
#include "CScriptSound.hpp"
|
|
|
|
#include "CScriptSpawnPoint.hpp"
|
2016-04-27 19:59:38 +00:00
|
|
|
#include "CScriptSpecialFunction.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptSteam.hpp"
|
|
|
|
#include "CScriptStreamedMusic.hpp"
|
2016-12-19 18:27:58 +00:00
|
|
|
#include "CScriptSwitch.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptTimer.hpp"
|
2017-03-20 05:09:53 +00:00
|
|
|
#include "CScriptVisorFlare.hpp"
|
2017-11-12 05:14:57 +00:00
|
|
|
#include "CScriptVisorGoo.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CScriptWater.hpp"
|
|
|
|
#include "CScriptWaypoint.hpp"
|
2017-08-08 22:12:14 +00:00
|
|
|
#include "CScriptWorldTeleporter.hpp"
|
2017-09-18 03:02:48 +00:00
|
|
|
#include "CScriptSpiderBallAttractionSurface.hpp"
|
2017-10-06 07:29:56 +00:00
|
|
|
#include "CScriptSpindleCamera.hpp"
|
2016-04-19 21:25:26 +00:00
|
|
|
#include "CSimplePool.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CWallCrawlerSwarm.hpp"
|
|
|
|
#include "CWorld.hpp"
|
|
|
|
#include "Camera/CCinematicCamera.hpp"
|
2016-04-20 21:44:18 +00:00
|
|
|
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
2016-04-19 21:25:26 +00:00
|
|
|
#include "Editor/ProjectResourceFactoryMP1.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "MP1/World/CActorContraption.hpp"
|
|
|
|
#include "MP1/World/CBeetle.hpp"
|
|
|
|
#include "MP1/World/CMetroidPrimeRelay.hpp"
|
|
|
|
#include "MP1/World/CNewIntroBoss.hpp"
|
|
|
|
#include "MP1/World/CSpacePirate.hpp"
|
|
|
|
#include "MP1/World/CWarWasp.hpp"
|
2017-11-20 17:33:21 +00:00
|
|
|
#include "MP1/World/CParasite.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "Particle/CWeaponDescription.hpp"
|
2017-11-20 17:33:21 +00:00
|
|
|
#include "Camera/CPathCamera.hpp"
|
2016-04-17 22:38:05 +00:00
|
|
|
namespace urde
|
|
|
|
{
|
2016-04-18 01:58:13 +00:00
|
|
|
static logvisor::Module Log("urde::ScriptLoader");
|
2016-04-17 22:38:05 +00:00
|
|
|
|
2016-04-19 21:25:26 +00:00
|
|
|
static SObjectTag MorphballDoorANCS = {};
|
2016-04-27 19:59:38 +00:00
|
|
|
static const SObjectTag& GetMorphballDoorACS()
|
2016-04-19 21:25:26 +00:00
|
|
|
{
|
|
|
|
if (!MorphballDoorANCS)
|
2017-02-12 03:17:18 +00:00
|
|
|
{
|
|
|
|
MorphballDoorANCS.type = FOURCC('ANCS');
|
|
|
|
MorphballDoorANCS.id = g_ResFactory->TranslateOriginalToNew(0x1F9DA858);
|
|
|
|
}
|
2016-04-19 21:25:26 +00:00
|
|
|
return MorphballDoorANCS;
|
|
|
|
}
|
|
|
|
|
2016-04-18 01:58:13 +00:00
|
|
|
static bool EnsurePropertyCount(int count, int expected, const char* structName)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-18 01:58:13 +00:00
|
|
|
if (count < expected)
|
|
|
|
{
|
2016-09-02 15:26:29 +00:00
|
|
|
Log.report(logvisor::Warning, "Insufficient number of props (%d/%d) for %s entity", count, expected,
|
|
|
|
structName);
|
2016-04-18 01:58:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-04-18 05:33:23 +00:00
|
|
|
struct SActorHead
|
|
|
|
{
|
|
|
|
std::string x0_name;
|
|
|
|
zeus::CTransform x10_transform;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SScaledActorHead : SActorHead
|
|
|
|
{
|
|
|
|
zeus::CVector3f x40_scale;
|
|
|
|
SScaledActorHead(SActorHead&& head) : SActorHead(std::move(head)) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
static zeus::CTransform LoadEditorTransform(CInputStream& in)
|
|
|
|
{
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
zeus::CVector3f orientation;
|
|
|
|
orientation.readBig(in);
|
|
|
|
return ScriptLoader::ConvertEditorEulerToTransform4f(orientation, position);
|
|
|
|
}
|
|
|
|
|
|
|
|
static zeus::CTransform LoadEditorTransformPivotOnly(CInputStream& in)
|
|
|
|
{
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
zeus::CVector3f orientation;
|
|
|
|
orientation.readBig(in);
|
|
|
|
orientation.x = 0.f;
|
|
|
|
orientation.y = 0.f;
|
|
|
|
return ScriptLoader::ConvertEditorEulerToTransform4f(orientation, position);
|
|
|
|
}
|
|
|
|
|
|
|
|
static SActorHead LoadActorHead(CInputStream& in, CStateManager& stateMgr)
|
|
|
|
{
|
|
|
|
SActorHead ret;
|
2017-01-15 03:59:37 +00:00
|
|
|
ret.x0_name = stateMgr.HashInstanceName(in);
|
2016-04-18 05:33:23 +00:00
|
|
|
ret.x10_transform = LoadEditorTransform(in);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static SScaledActorHead LoadScaledActorHead(CInputStream& in, CStateManager& stateMgr)
|
|
|
|
{
|
|
|
|
SScaledActorHead ret = LoadActorHead(in, stateMgr);
|
|
|
|
ret.x40_scale.readBig(in);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
static zeus::CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id, const zeus::CVector3f& extent,
|
|
|
|
const zeus::CVector3f& offset)
|
2016-04-19 00:17:49 +00:00
|
|
|
{
|
|
|
|
zeus::CAABox box(-extent * 0.5f + offset, extent * 0.5f + offset);
|
2017-01-04 04:08:30 +00:00
|
|
|
const zeus::CTransform& rot = stateMgr.WorldNC()->GetGameAreas()[id]->GetTransform().getRotation();
|
2016-04-19 00:17:49 +00:00
|
|
|
return box.getTransformedAABox(rot);
|
|
|
|
}
|
|
|
|
|
2016-04-18 05:33:23 +00:00
|
|
|
u32 ScriptLoader::LoadParameterFlags(CInputStream& in)
|
|
|
|
{
|
|
|
|
u32 count = in.readUint32Big();
|
|
|
|
u32 ret = 0;
|
2016-09-02 15:26:29 +00:00
|
|
|
for (u32 i = 0; i < count; ++i)
|
2016-04-18 05:33:23 +00:00
|
|
|
if (in.readBool())
|
|
|
|
ret |= 1 << i;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
CGrappleParameters ScriptLoader::LoadGrappleParameters(CInputStream& in)
|
|
|
|
{
|
|
|
|
float a = in.readFloatBig();
|
|
|
|
float b = in.readFloatBig();
|
|
|
|
float c = in.readFloatBig();
|
|
|
|
float d = in.readFloatBig();
|
|
|
|
float e = in.readFloatBig();
|
|
|
|
float f = in.readFloatBig();
|
|
|
|
float g = in.readFloatBig();
|
|
|
|
float h = in.readFloatBig();
|
|
|
|
float i = in.readFloatBig();
|
|
|
|
float j = in.readFloatBig();
|
|
|
|
float k = in.readFloatBig();
|
|
|
|
bool l = in.readBool();
|
|
|
|
return CGrappleParameters(a, b, c, d, e, f, g, h, i, j, k, l);
|
|
|
|
}
|
|
|
|
|
|
|
|
CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in)
|
|
|
|
{
|
|
|
|
u32 propCount = in.readUint32Big();
|
|
|
|
if (propCount >= 5 && propCount <= 0xe)
|
|
|
|
{
|
|
|
|
CLightParameters lParms = ScriptLoader::LoadLightParameters(in);
|
|
|
|
|
|
|
|
CScannableParameters sParams;
|
|
|
|
if (propCount > 5)
|
|
|
|
sParams = LoadScannableParameters(in);
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId xrayModel = in.readUint32Big();
|
|
|
|
CAssetId xraySkin = in.readUint32Big();
|
|
|
|
CAssetId infraModel = in.readUint32Big();
|
|
|
|
CAssetId infraSkin = in.readUint32Big();
|
2016-04-18 05:33:23 +00:00
|
|
|
|
|
|
|
bool b1 = true;
|
|
|
|
if (propCount > 7)
|
|
|
|
b1 = in.readBool();
|
|
|
|
|
|
|
|
float f1 = 1.f;
|
|
|
|
if (propCount > 8)
|
|
|
|
f1 = in.readFloatBig();
|
|
|
|
|
|
|
|
float f2 = 1.f;
|
|
|
|
if (propCount > 9)
|
|
|
|
f2 = in.readFloatBig();
|
|
|
|
|
|
|
|
CVisorParameters vParms;
|
|
|
|
if (propCount > 6)
|
|
|
|
vParms = LoadVisorParameters(in);
|
|
|
|
|
2017-05-10 10:03:29 +00:00
|
|
|
bool thermalHeat = false;
|
2016-04-18 05:33:23 +00:00
|
|
|
if (propCount > 10)
|
2017-05-10 10:03:29 +00:00
|
|
|
thermalHeat = in.readBool();
|
2016-04-18 05:33:23 +00:00
|
|
|
|
|
|
|
bool b3 = false;
|
|
|
|
if (propCount > 11)
|
|
|
|
b3 = in.readBool();
|
|
|
|
|
|
|
|
bool b4 = false;
|
|
|
|
if (propCount > 12)
|
|
|
|
b4 = in.readBool();
|
|
|
|
|
|
|
|
float f3 = 1.f;
|
|
|
|
if (propCount > 13)
|
|
|
|
f3 = in.readFloatBig();
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
std::pair<CAssetId, CAssetId> xray = {};
|
2016-04-18 05:33:23 +00:00
|
|
|
if (g_ResFactory->GetResourceTypeById(xrayModel))
|
|
|
|
xray = {xrayModel, xraySkin};
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
std::pair<CAssetId, CAssetId> infra = {};
|
2016-04-18 05:33:23 +00:00
|
|
|
if (g_ResFactory->GetResourceTypeById(infraModel))
|
|
|
|
infra = {infraModel, infraSkin};
|
|
|
|
|
2017-05-10 10:03:29 +00:00
|
|
|
return CActorParameters(lParms, sParams, xray, infra, vParms, b1, thermalHeat, b3, b4);
|
2016-04-18 05:33:23 +00:00
|
|
|
}
|
|
|
|
return CActorParameters::None();
|
|
|
|
}
|
|
|
|
|
|
|
|
CVisorParameters ScriptLoader::LoadVisorParameters(CInputStream& in)
|
|
|
|
{
|
|
|
|
u32 propCount = in.readUint32Big();
|
|
|
|
if (propCount >= 1 && propCount <= 3)
|
|
|
|
{
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = false;
|
|
|
|
u8 mask = 0xf;
|
|
|
|
if (propCount > 1)
|
|
|
|
b2 = in.readBool();
|
|
|
|
if (propCount > 2)
|
|
|
|
mask = in.readUint32Big();
|
|
|
|
return CVisorParameters(mask, b1, b2);
|
|
|
|
}
|
|
|
|
return CVisorParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
CScannableParameters ScriptLoader::LoadScannableParameters(CInputStream& in)
|
|
|
|
{
|
|
|
|
u32 propCount = in.readUint32Big();
|
|
|
|
if (propCount == 1)
|
|
|
|
return CScannableParameters(in.readUint32Big());
|
|
|
|
return CScannableParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in)
|
|
|
|
{
|
|
|
|
u32 propCount = in.readUint32Big();
|
|
|
|
if (propCount == 14)
|
|
|
|
{
|
|
|
|
bool a = in.readBool();
|
|
|
|
float b = in.readFloatBig();
|
2016-08-31 00:33:59 +00:00
|
|
|
CLightParameters::EShadowTesselation shadowTess = CLightParameters::EShadowTesselation(in.readUint32Big());
|
2016-04-18 05:33:23 +00:00
|
|
|
float d = in.readFloatBig();
|
|
|
|
float e = in.readFloatBig();
|
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
zeus::CColor noLightsAmbient;
|
|
|
|
noLightsAmbient.readRGBABig(in);
|
2016-04-18 05:33:23 +00:00
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
bool makeLights = in.readBool();
|
2016-09-02 15:26:29 +00:00
|
|
|
CLightParameters::EWorldLightingOptions lightOpts = CLightParameters::EWorldLightingOptions(in.readUint32Big());
|
2016-08-31 00:33:59 +00:00
|
|
|
CLightParameters::ELightRecalculationOptions recalcOpts =
|
2016-09-02 15:26:29 +00:00
|
|
|
CLightParameters::ELightRecalculationOptions(in.readUint32Big());
|
2016-04-18 05:33:23 +00:00
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
zeus::CVector3f actorPosBias;
|
|
|
|
actorPosBias.readBig(in);
|
2016-04-18 05:33:23 +00:00
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
s32 maxDynamicLights = -1;
|
|
|
|
s32 maxAreaLights = -1;
|
2016-04-19 21:25:26 +00:00
|
|
|
if (propCount >= 12)
|
2016-04-18 05:33:23 +00:00
|
|
|
{
|
2017-04-10 06:57:00 +00:00
|
|
|
maxDynamicLights = in.readUint32Big();
|
|
|
|
maxAreaLights = in.readUint32Big();
|
2016-04-18 05:33:23 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
bool ambientChannelOverflow = false;
|
2016-04-19 21:25:26 +00:00
|
|
|
if (propCount >= 13)
|
2017-04-10 06:57:00 +00:00
|
|
|
ambientChannelOverflow = in.readBool();
|
2016-04-18 05:33:23 +00:00
|
|
|
|
2017-04-10 06:57:00 +00:00
|
|
|
s32 layerIdx = 0;
|
2016-04-19 21:25:26 +00:00
|
|
|
if (propCount >= 14)
|
2017-04-10 06:57:00 +00:00
|
|
|
layerIdx = in.readUint32Big();
|
2016-04-18 05:33:23 +00:00
|
|
|
|
2017-05-21 06:01:24 +00:00
|
|
|
return CLightParameters(a, b, shadowTess, d, e, noLightsAmbient, makeLights, lightOpts, recalcOpts,
|
|
|
|
actorPosBias, maxDynamicLights, maxAreaLights, ambientChannelOverflow, layerIdx);
|
2016-04-18 05:33:23 +00:00
|
|
|
}
|
|
|
|
return CLightParameters::None();
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimationParameters ScriptLoader::LoadAnimationParameters(CInputStream& in)
|
|
|
|
{
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId ancs = in.readUint32Big();
|
2016-04-18 05:33:23 +00:00
|
|
|
s32 charIdx = in.readUint32Big();
|
|
|
|
u32 defaultAnim = in.readUint32Big();
|
|
|
|
return CAnimationParameters(ancs, charIdx, defaultAnim);
|
|
|
|
}
|
|
|
|
|
2016-04-20 05:44:08 +00:00
|
|
|
CFluidUVMotion ScriptLoader::LoadFluidUVMotion(CInputStream& in)
|
|
|
|
{
|
2017-08-13 07:56:35 +00:00
|
|
|
auto motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
2016-04-20 05:44:08 +00:00
|
|
|
float a = in.readFloatBig();
|
|
|
|
float b = in.readFloatBig();
|
2016-04-20 21:50:11 +00:00
|
|
|
b = zeus::degToRad(b) - M_PIF;
|
2016-04-20 05:44:08 +00:00
|
|
|
float c = in.readFloatBig();
|
|
|
|
float d = in.readFloatBig();
|
2017-08-13 07:56:35 +00:00
|
|
|
CFluidUVMotion::SFluidLayerMotion pattern1Layer(motion, a, b, c, d);
|
2016-04-20 05:44:08 +00:00
|
|
|
|
|
|
|
motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
|
|
|
a = in.readFloatBig();
|
|
|
|
b = in.readFloatBig();
|
2016-04-20 21:50:11 +00:00
|
|
|
b = zeus::degToRad(b) - M_PIF;
|
2016-04-20 05:44:08 +00:00
|
|
|
c = in.readFloatBig();
|
|
|
|
d = in.readFloatBig();
|
2017-08-13 07:56:35 +00:00
|
|
|
CFluidUVMotion::SFluidLayerMotion pattern2Layer(motion, a, b, c, d);
|
2016-04-20 05:44:08 +00:00
|
|
|
|
|
|
|
motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big());
|
|
|
|
a = in.readFloatBig();
|
|
|
|
b = in.readFloatBig();
|
2016-04-20 21:50:11 +00:00
|
|
|
b = zeus::degToRad(b) - M_PIF;
|
2016-04-20 05:44:08 +00:00
|
|
|
c = in.readFloatBig();
|
|
|
|
d = in.readFloatBig();
|
2017-08-13 07:56:35 +00:00
|
|
|
CFluidUVMotion::SFluidLayerMotion colorLayer(motion, a, b, c, d);
|
2016-04-20 05:44:08 +00:00
|
|
|
|
|
|
|
a = in.readFloatBig();
|
|
|
|
b = in.readFloatBig();
|
|
|
|
|
2016-04-20 21:50:11 +00:00
|
|
|
b = zeus::degToRad(b) - M_PIF;
|
2016-04-20 05:44:08 +00:00
|
|
|
|
2017-08-13 07:56:35 +00:00
|
|
|
return CFluidUVMotion(a, b, colorLayer, pattern1Layer, pattern2Layer);
|
2016-04-20 05:44:08 +00:00
|
|
|
}
|
|
|
|
|
2016-04-18 05:33:23 +00:00
|
|
|
zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVector3f& orientation,
|
|
|
|
const zeus::CVector3f& position)
|
|
|
|
{
|
|
|
|
return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) *
|
2016-09-02 15:26:29 +00:00
|
|
|
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
|
|
|
|
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) +
|
|
|
|
position;
|
2016-04-18 05:33:23 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-18 01:58:13 +00:00
|
|
|
{
|
|
|
|
if (!EnsurePropertyCount(propCount, 24, "Actor"))
|
|
|
|
return nullptr;
|
|
|
|
|
2016-04-18 05:33:23 +00:00
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
|
|
|
|
zeus::CVector3f collisionExtent;
|
|
|
|
collisionExtent.readBig(in);
|
|
|
|
|
|
|
|
zeus::CVector3f centroid;
|
|
|
|
centroid.readBig(in);
|
|
|
|
|
2017-07-09 09:11:59 +00:00
|
|
|
float mass = in.readFloatBig();
|
|
|
|
float zMomentum = in.readFloatBig();
|
2016-04-18 05:33:23 +00:00
|
|
|
|
|
|
|
CHealthInfo hInfo(in);
|
|
|
|
|
2017-07-09 09:11:59 +00:00
|
|
|
CDamageVulnerability dVuln(in);
|
2016-04-18 01:58:13 +00:00
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId staticId = in.readUint32Big();
|
2016-04-19 00:17:49 +00:00
|
|
|
CAnimationParameters aParms = LoadAnimationParameters(in);
|
|
|
|
|
|
|
|
CActorParameters actParms = LoadActorParameters(in);
|
|
|
|
|
2017-07-09 09:11:59 +00:00
|
|
|
bool looping = in.readBool();
|
2016-12-29 21:38:59 +00:00
|
|
|
bool snow = in.readBool();
|
2017-02-13 00:00:07 +00:00
|
|
|
bool solid = in.readBool();
|
|
|
|
bool cameraPassthrough = in.readBool();
|
2017-07-09 09:11:59 +00:00
|
|
|
bool active = in.readBool();
|
2016-04-19 00:17:49 +00:00
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
bool b6 = in.readBool();
|
2017-07-09 09:11:59 +00:00
|
|
|
bool castsShadow = in.readBool();
|
|
|
|
bool xposeRotate = in.readBool();
|
2016-04-19 00:17:49 +00:00
|
|
|
bool b9 = in.readBool();
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile());
|
2016-04-19 00:17:49 +00:00
|
|
|
if (!g_ResFactory->GetResourceTypeById(staticId) && !animType)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, centroid);
|
|
|
|
|
|
|
|
CMaterialList list;
|
2016-12-29 21:38:59 +00:00
|
|
|
if (snow) // Bool 2
|
|
|
|
list.Add(EMaterialTypes::Snow);
|
2016-04-19 00:17:49 +00:00
|
|
|
|
2017-02-13 00:00:07 +00:00
|
|
|
if (solid) // Bool 3
|
|
|
|
list.Add(EMaterialTypes::Solid);
|
2016-04-19 00:17:49 +00:00
|
|
|
|
2017-02-13 00:00:07 +00:00
|
|
|
if (cameraPassthrough) // Bool 4
|
|
|
|
list.Add(EMaterialTypes::CameraPassthrough);
|
2016-04-19 00:17:49 +00:00
|
|
|
|
|
|
|
CModelData data;
|
|
|
|
if (animType == SBIG('ANCS'))
|
2017-03-18 05:12:27 +00:00
|
|
|
data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), true);
|
2016-04-19 00:17:49 +00:00
|
|
|
else
|
2016-04-27 19:59:38 +00:00
|
|
|
data = CStaticRes(staticId, head.x40_scale);
|
2016-04-19 00:17:49 +00:00
|
|
|
|
2017-05-21 06:01:24 +00:00
|
|
|
if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero())
|
2016-04-19 00:17:49 +00:00
|
|
|
aabb = data.GetBounds(head.x10_transform.getRotation());
|
|
|
|
|
2017-07-09 09:11:59 +00:00
|
|
|
return new CScriptActor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data), aabb, mass,
|
2017-08-20 05:23:22 +00:00
|
|
|
zMomentum, list, hInfo, dVuln, actParms, looping, active, w2, f3, b6, castsShadow,
|
|
|
|
xposeRotate, b9);
|
2016-04-18 01:58:13 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-18 01:58:13 +00:00
|
|
|
{
|
2016-04-19 00:17:49 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 13, "Waypoint"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
|
|
|
|
2016-05-13 03:13:34 +00:00
|
|
|
bool active = in.readBool();
|
2016-04-19 00:17:49 +00:00
|
|
|
float f1 = in.readFloatBig();
|
2016-05-13 03:13:34 +00:00
|
|
|
float delay = in.readFloatBig();
|
2016-04-19 00:17:49 +00:00
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
u32 w4 = in.readUint32Big();
|
|
|
|
u32 w5 = in.readUint32Big();
|
|
|
|
u32 w6 = in.readUint32Big();
|
|
|
|
u32 w7 = in.readUint32Big();
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, f1, delay, w1,
|
|
|
|
w2, w3, w4, w5, w6, w7);
|
2016-04-18 01:58:13 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 13, "Door") || propCount > 14)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
CAnimationParameters aParms = LoadAnimationParameters(in);
|
|
|
|
CActorParameters actParms = LoadActorParameters(in);
|
|
|
|
|
|
|
|
zeus::CVector3f v1;
|
|
|
|
v1.readBig(in);
|
|
|
|
zeus::CVector3f collisionExtent;
|
|
|
|
collisionExtent.readBig(in);
|
|
|
|
zeus::CVector3f offset;
|
|
|
|
offset.readBig(in);
|
|
|
|
|
2016-12-10 02:35:20 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
bool open = in.readBool();
|
2016-04-19 21:25:26 +00:00
|
|
|
bool b3 = in.readBool();
|
2016-12-10 02:35:20 +00:00
|
|
|
float animationLength = in.readFloatBig();
|
2016-04-19 21:25:26 +00:00
|
|
|
|
|
|
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, offset);
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
if (!g_ResFactory->GetResourceTypeById(aParms.GetACSFile()))
|
2016-04-19 21:25:26 +00:00
|
|
|
return nullptr;
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CModelData mData =
|
|
|
|
CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation());
|
2016-04-19 21:25:26 +00:00
|
|
|
if (collisionExtent.isZero())
|
|
|
|
aabb = mData.GetBounds(head.x10_transform.getRotation());
|
|
|
|
|
|
|
|
bool isMorphballDoor = false;
|
|
|
|
if (propCount == 13)
|
|
|
|
{
|
2016-04-27 19:59:38 +00:00
|
|
|
if (aParms.GetACSFile() == GetMorphballDoorACS().id)
|
2016-04-19 21:25:26 +00:00
|
|
|
isMorphballDoor = true;
|
|
|
|
}
|
|
|
|
else if (propCount == 14)
|
|
|
|
isMorphballDoor = in.readBool();
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), actParms,
|
2016-12-10 02:35:20 +00:00
|
|
|
v1, aabb, active, open, b3, animationLength, isMorphballDoor);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 9, "Trigger"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2017-04-22 11:04:07 +00:00
|
|
|
zeus::CVector3f position = zeus::CVector3f::ReadBig(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2017-04-22 11:04:07 +00:00
|
|
|
zeus::CVector3f extent = zeus::CVector3f::ReadBig(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
|
2017-04-22 11:04:07 +00:00
|
|
|
zeus::CVector3f forceVec = zeus::CVector3f::ReadBig(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2016-11-20 21:53:15 +00:00
|
|
|
ETriggerFlags flags = ETriggerFlags(in.readUint32Big());
|
|
|
|
bool active = in.readBool();
|
2016-04-19 21:25:26 +00:00
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
|
|
|
|
zeus::CAABox box(-extent * 0.5f, extent * 0.5f);
|
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
const zeus::CTransform& areaXf = mgr.WorldNC()->GetGameAreas()[info.GetAreaId()]->GetTransform();
|
2016-04-29 10:08:46 +00:00
|
|
|
zeus::CVector3f orientedForce = areaXf.basis * forceVec;
|
2016-04-19 21:25:26 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptTrigger(mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, flags, active,
|
2016-12-19 18:27:58 +00:00
|
|
|
b2, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "Timer"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptTimer(mgr.AllocateUniqueId(), name, info, f1, f2, b1, b2, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "Counter"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-19 21:25:26 +00:00
|
|
|
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptCounter(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 21:44:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 24, "Effect"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId partId = in.readUint32Big();
|
|
|
|
CAssetId elscId = in.readUint32Big();
|
2016-04-20 21:44:18 +00:00
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
bool b4 = in.readBool();
|
|
|
|
|
2017-11-20 17:33:21 +00:00
|
|
|
if (!partId.IsValid() && !elscId.IsValid())
|
2016-04-20 21:44:18 +00:00
|
|
|
return nullptr;
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
if (!g_ResFactory->GetResourceTypeById(partId) && !g_ResFactory->GetResourceTypeById(elscId))
|
2016-04-20 21:44:18 +00:00
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
bool b5 = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
bool b6 = in.readBool();
|
|
|
|
float f5 = in.readFloatBig();
|
|
|
|
float f6 = in.readFloatBig();
|
|
|
|
float f7 = in.readFloatBig();
|
|
|
|
bool b7 = in.readBool();
|
|
|
|
bool b8 = in.readBool();
|
|
|
|
bool b9 = in.readBool();
|
|
|
|
bool b10 = in.readBool();
|
|
|
|
|
|
|
|
CLightParameters lParms = LoadLightParameters(in);
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptEffect(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, head.x40_scale, partId,
|
|
|
|
elscId, b1, b2, b3, b4, b5, f1, f2, f3, f4, b6, f5, f6, f7, b7, b8, b9, lParms, b10);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 21:44:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 19, "Platform"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
|
|
|
|
zeus::CVector3f extent;
|
|
|
|
extent.readBig(in);
|
|
|
|
|
|
|
|
zeus::CVector3f centroid;
|
|
|
|
centroid.readBig(in);
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId staticId = in.readUint32Big();
|
2016-04-20 21:44:18 +00:00
|
|
|
CAnimationParameters aParms = LoadAnimationParameters(in);
|
|
|
|
|
|
|
|
CActorParameters actParms = LoadActorParameters(in);
|
|
|
|
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
bool b1 = in.readBool();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId dclnId = in.readUint32Big();
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile());
|
2016-04-20 21:44:18 +00:00
|
|
|
if (!g_ResFactory->GetResourceTypeById(staticId) && !animType)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid);
|
|
|
|
|
|
|
|
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
|
2017-06-11 05:49:27 +00:00
|
|
|
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
|
2016-04-20 21:44:18 +00:00
|
|
|
if (dclnType)
|
|
|
|
{
|
2016-09-02 15:26:29 +00:00
|
|
|
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
|
|
|
|
dclnToken->GetObj();
|
2016-04-20 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CModelData data;
|
|
|
|
if (animType == SBIG('ANCS'))
|
2016-04-27 19:59:38 +00:00
|
|
|
data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation());
|
2016-04-20 21:44:18 +00:00
|
|
|
else
|
2016-04-27 19:59:38 +00:00
|
|
|
data = CStaticRes(staticId, head.x40_scale);
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
if (extent.isZero())
|
|
|
|
aabb = data.GetBounds(head.x10_transform.getRotation());
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
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);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 21:44:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 20, "Sound"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
|
|
|
s32 soundId = in.readInt32Big();
|
2017-01-24 17:23:10 +00:00
|
|
|
bool active = in.readBool();
|
2017-11-27 05:06:53 +00:00
|
|
|
float maxDist = in.readFloatBig();
|
|
|
|
float distComp = in.readFloatBig();
|
|
|
|
float startDelay = in.readFloatBig();
|
|
|
|
u32 minVol = in.readUint32Big();
|
|
|
|
u32 vol = in.readUint32Big();
|
|
|
|
u32 prio = in.readUint32Big();
|
|
|
|
u32 pan = in.readUint32Big();
|
2017-01-24 17:23:10 +00:00
|
|
|
bool loop = in.readBool();
|
2017-11-27 05:06:53 +00:00
|
|
|
bool nonEmitter = in.readBool();
|
|
|
|
bool autoStart = in.readBool();
|
|
|
|
bool occlusionTest = in.readBool();
|
|
|
|
bool acoustics = in.readBool();
|
|
|
|
bool worldSfx = in.readBool();
|
|
|
|
bool allowDuplicates = in.readBool();
|
|
|
|
u32 pitch = in.readUint32Big();
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
if (soundId < 0)
|
|
|
|
return nullptr;
|
|
|
|
|
2017-11-27 05:06:53 +00:00
|
|
|
return new CScriptSound(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, u16(soundId), active,
|
|
|
|
maxDist, distComp, startDelay, minVol, vol, 0, prio, pan, 0, loop,
|
|
|
|
nonEmitter, autoStart, occlusionTest, acoustics, worldSfx, allowDuplicates, pitch);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 21:44:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 8, "Generator"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2017-01-24 17:47:11 +00:00
|
|
|
u32 spawnCount = in.readUint32Big();
|
|
|
|
bool reuseFollowers = in.readBool();
|
|
|
|
bool inheritXf = in.readBool();
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2017-01-24 17:47:11 +00:00
|
|
|
zeus::CVector3f offset = zeus::CVector3f::ReadBig(in);
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2017-01-24 17:47:11 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
float minScale = in.readFloatBig();
|
|
|
|
float maxScale = in.readFloatBig();
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2017-01-24 17:47:11 +00:00
|
|
|
return new CScriptGenerator(mgr.AllocateUniqueId(), name, info, spawnCount, reuseFollowers, offset, inheritXf,
|
|
|
|
active, minScale, maxScale);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
|
|
|
{
|
2016-04-20 21:07:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "Dock"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-20 21:07:18 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
zeus::CVector3f scale;
|
|
|
|
scale.readBig(in);
|
|
|
|
u32 dock = in.readUint32Big();
|
|
|
|
TAreaId area = in.readUint32Big();
|
2017-11-12 05:14:57 +00:00
|
|
|
bool loadConnected = in.readBool();
|
|
|
|
return new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, 0, loadConnected);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-22 03:40:26 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 14, "Camera"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
float shotDuration = in.readFloatBig();
|
2016-04-22 03:40:26 +00:00
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
bool b4 = in.readBool();
|
|
|
|
bool b5 = in.readBool();
|
|
|
|
bool b6 = in.readBool();
|
2017-08-29 13:17:52 +00:00
|
|
|
bool disableInput = in.readBool();
|
2016-04-22 03:40:26 +00:00
|
|
|
bool b8 = in.readBool();
|
2017-08-29 13:17:52 +00:00
|
|
|
float fov = in.readFloatBig();
|
2016-04-22 03:40:26 +00:00
|
|
|
bool b9 = in.readBool();
|
|
|
|
|
|
|
|
bool b10 = false;
|
|
|
|
if (propCount > 14)
|
|
|
|
b10 = in.readBool();
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
u32 flags = u32(b2) | u32(b3) << 1 | u32(b4) << 2 | u32(b5) << 3 | u32(b6) << 4 | u32(disableInput) << 5 |
|
|
|
|
u32(b8) << 6 | u32(b9) << 8;
|
2016-04-22 03:40:26 +00:00
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, shotDuration,
|
|
|
|
fov / CCameraManager::Aspect(), CCameraManager::NearPlane(), CCameraManager::FarPlane(),
|
2016-12-19 18:27:58 +00:00
|
|
|
CCameraManager::Aspect(), flags);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-24 01:10:47 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "CameraWaypoint"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
bool active = in.readBool();
|
2016-04-24 01:10:47 +00:00
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, f1, w1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-25 05:03:38 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 13, "NewIntroBoss"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
|
|
|
|
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
|
|
|
|
if (!pcount.first)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CPatternedInfo pInfo(in, pcount.second);
|
|
|
|
|
|
|
|
CActorParameters actParms = LoadActorParameters(in);
|
|
|
|
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
u32 w4 = in.readUint32Big();
|
|
|
|
u32 w5 = in.readUint32Big();
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
const CAnimationParameters& aParms = pInfo.GetAnimationParameters();
|
|
|
|
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile());
|
|
|
|
if (animType != SBIG('ANCS'))
|
2016-04-25 05:03:38 +00:00
|
|
|
return nullptr;
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation());
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, res, pInfo, actParms,
|
|
|
|
f1, w1, dInfo, w2, w3, w4, w5);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-27 00:21:08 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 35, "SpawnPoint"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-27 00:21:08 +00:00
|
|
|
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
|
|
|
|
zeus::CVector3f rotation;
|
|
|
|
rotation.readBig(in);
|
|
|
|
|
|
|
|
std::vector<u32> itemCounts;
|
2016-09-02 15:26:29 +00:00
|
|
|
itemCounts.reserve(propCount - 6);
|
|
|
|
for (int i = 0; i < propCount - 6; ++i)
|
2016-04-27 00:21:08 +00:00
|
|
|
itemCounts.push_back(in.readUint32Big());
|
|
|
|
|
2017-01-07 01:58:05 +00:00
|
|
|
bool defaultSpawn = in.readBool();
|
|
|
|
bool active = in.readBool();
|
|
|
|
bool morphed = false;
|
2016-04-27 00:21:08 +00:00
|
|
|
if (propCount > 34)
|
2017-01-07 01:58:05 +00:00
|
|
|
morphed = in.readBool();
|
2016-04-27 00:21:08 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptSpawnPoint(mgr.AllocateUniqueId(), name, info,
|
2017-01-24 17:23:10 +00:00
|
|
|
ConvertEditorEulerToTransform4f(rotation, position), itemCounts, defaultSpawn, active,
|
|
|
|
morphed);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-11-20 17:33:21 +00:00
|
|
|
if (propCount > 25)
|
|
|
|
{
|
|
|
|
Log.report(logvisor::Warning, "Too many props (%d > 25) for CameraHint entity", propCount);
|
2016-04-28 04:44:41 +00:00
|
|
|
return nullptr;
|
2017-11-20 17:33:21 +00:00
|
|
|
}
|
2016-04-28 04:44:41 +00:00
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
|
|
|
|
|
|
|
bool active = in.readBool();
|
2017-10-16 05:26:50 +00:00
|
|
|
u32 prio = in.readUint32Big();
|
2017-10-05 05:40:44 +00:00
|
|
|
auto behaviour = CBallCamera::EBallCameraBehaviour(in.readUint32Big());
|
2017-10-16 05:26:50 +00:00
|
|
|
u32 overrideFlags = LoadParameterFlags(in);
|
|
|
|
overrideFlags |= in.readBool() << 22;
|
|
|
|
float minDist = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 23;
|
|
|
|
float maxDist = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 24;
|
|
|
|
float backwardsDist = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 25;
|
|
|
|
zeus::CVector3f lookAtOffset;
|
|
|
|
lookAtOffset.readBig(in);
|
|
|
|
overrideFlags |= in.readBool() << 26;
|
|
|
|
zeus::CVector3f chaseLookAtOffset;
|
|
|
|
chaseLookAtOffset.readBig(in);
|
|
|
|
zeus::CVector3f ballToCam;
|
|
|
|
ballToCam.readBig(in);
|
|
|
|
overrideFlags |= in.readBool() << 27;
|
|
|
|
float fov = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 28;
|
|
|
|
float attitudeRange = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 29;
|
|
|
|
float azimuthRange = in.readFloatBig();
|
|
|
|
overrideFlags |= in.readBool() << 30;
|
|
|
|
float anglePerSecond = in.readFloatBig();
|
|
|
|
float clampVelRange = in.readFloatBig();
|
2016-04-28 04:44:41 +00:00
|
|
|
float f9 = in.readFloatBig();
|
2017-10-16 05:26:50 +00:00
|
|
|
overrideFlags |= in.readBool() << 31;
|
|
|
|
float elevation = in.readFloatBig();
|
2016-04-28 04:44:41 +00:00
|
|
|
float f11 = in.readFloatBig();
|
2017-10-16 05:26:50 +00:00
|
|
|
float clampVelTime = in.readFloatBig();
|
|
|
|
float controlInterpDur = in.readFloatBig();
|
2016-04-28 04:44:41 +00:00
|
|
|
|
2017-10-16 05:26:50 +00:00
|
|
|
return new CScriptCameraHint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, prio,
|
|
|
|
behaviour, overrideFlags, minDist, maxDist, backwardsDist, lookAtOffset,
|
|
|
|
chaseLookAtOffset, ballToCam, fov, attitudeRange, azimuthRange, anglePerSecond,
|
|
|
|
clampVelRange, f9, elevation, f11, clampVelTime, controlInterpDur);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPickup(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-13 03:13:34 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 18, "Pickup"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
zeus::CVector3f extent = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f offset = zeus::CVector3f::ReadBig(in);
|
2017-09-12 15:27:48 +00:00
|
|
|
CPlayerState::EItemType w1 = CPlayerState::EItemType(in.readUint32Big());
|
2016-05-13 03:13:34 +00:00
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId staticModel = in.readUint32Big();
|
2016-05-13 03:13:34 +00:00
|
|
|
CAnimationParameters animParms = LoadAnimationParameters(in);
|
|
|
|
CActorParameters actorParms = LoadActorParameters(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
float f4 = in.readFloatBig();
|
2017-09-12 15:27:48 +00:00
|
|
|
CAssetId w4(in);
|
2016-05-13 03:13:34 +00:00
|
|
|
|
|
|
|
FourCC acsType = g_ResFactory->GetResourceTypeById(animParms.GetACSFile());
|
|
|
|
if (g_ResFactory->GetResourceTypeById(staticModel) == 0 && acsType == 0)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, offset);
|
|
|
|
|
|
|
|
CModelData data;
|
|
|
|
|
|
|
|
if (acsType == SBIG('ANCS'))
|
|
|
|
data = CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale,
|
2016-09-02 15:26:29 +00:00
|
|
|
animParms.GetInitialAnimation(), true);
|
2016-05-13 03:13:34 +00:00
|
|
|
else
|
|
|
|
data = CStaticRes(staticModel, head.x40_scale);
|
|
|
|
|
|
|
|
if (extent.isZero())
|
|
|
|
aabb = data.GetBounds(head.x10_transform.getRotation());
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptPickup(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data),
|
2017-09-12 15:27:48 +00:00
|
|
|
actorParms, aabb, w1, w3, w2, w4, f1, f2, f3, f4, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMemoryRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-18 03:57:43 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 3, "MemoryRelay") || propCount > 4)
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-18 03:57:43 +00:00
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = false;
|
|
|
|
if (propCount > 3)
|
|
|
|
b3 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptMemoryRelay(mgr.AllocateUniqueId(), name, info, b1, b2, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-18 03:57:43 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "RandomRelay"))
|
|
|
|
return nullptr;
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-18 03:57:43 +00:00
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptRandomRelay(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-18 03:57:43 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 2, "Relay") || propCount > 3)
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-18 03:57:43 +00:00
|
|
|
if (propCount >= 3)
|
|
|
|
in.readUint32Big();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptRelay(mgr.AllocateUniqueId(), name, info, b1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-18 03:57:43 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 16, "Beetle"))
|
|
|
|
return nullptr;
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-18 03:57:43 +00:00
|
|
|
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
|
|
|
zeus::CTransform xfrm = LoadEditorTransform(in);
|
|
|
|
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
|
|
|
|
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
|
|
|
|
if (!pcount.first)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CPatternedInfo pInfo(in, pcount.second);
|
|
|
|
CActorParameters aParams = LoadActorParameters(in);
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
CDamageVulnerability dVuln1(in);
|
|
|
|
CDamageVulnerability dVuln2(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId abdomen = in.readUint32Big();
|
2016-05-18 03:57:43 +00:00
|
|
|
MP1::CBeetle::EEntranceType entrance = MP1::CBeetle::EEntranceType(in.readUint32Big());
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
|
|
|
|
FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile());
|
|
|
|
if (animType != SBIG('ANCS'))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
rstl::optional_object<CStaticRes> abdomenRes;
|
|
|
|
if (flavor == CPatterned::EFlavorType::One)
|
|
|
|
abdomenRes.emplace(CStaticRes(abdomen, scale));
|
|
|
|
|
|
|
|
const CAnimationParameters& animParams = pInfo.GetAnimationParameters();
|
|
|
|
CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true);
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new MP1::CBeetle(mgr.AllocateUniqueId(), name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2,
|
2016-09-02 15:26:29 +00:00
|
|
|
v1, f2, f3, f1, dVuln1, aParams, abdomenRes);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-20 09:17:51 +00:00
|
|
|
if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo"))
|
|
|
|
return 0;
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-20 09:17:51 +00:00
|
|
|
CHUDMemoParms hParms(in);
|
|
|
|
CScriptHUDMemo::EDisplayType displayType = CScriptHUDMemo::EDisplayType::MessageBox;
|
|
|
|
if (propCount == 6)
|
|
|
|
displayType = CScriptHUDMemo::EDisplayType(in.readUint32Big());
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId message = in.readUint32Big();
|
2016-05-20 09:17:51 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-20 09:17:51 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 10, "CameraFilterKeyframe"))
|
|
|
|
return nullptr;
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-20 09:17:51 +00:00
|
|
|
bool active = in.readBool();
|
2017-11-26 03:04:25 +00:00
|
|
|
EFilterType ftype = EFilterType(in.readUint32Big());
|
2017-06-01 21:13:19 +00:00
|
|
|
EFilterShape shape = EFilterShape(in.readUint32Big());
|
|
|
|
u32 filterIdx = in.readUint32Big();
|
|
|
|
u32 unk = in.readUint32Big();
|
2016-05-20 09:17:51 +00:00
|
|
|
zeus::CColor color;
|
|
|
|
color.readRGBABig(in);
|
2017-06-01 21:13:19 +00:00
|
|
|
float timeIn = in.readFloatBig();
|
|
|
|
float timeOut = in.readFloatBig();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId txtr = in.readUint32Big();
|
2016-05-20 09:17:51 +00:00
|
|
|
|
2017-11-26 03:04:25 +00:00
|
|
|
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, ftype, shape, filterIdx, unk, color,
|
2017-08-29 13:17:52 +00:00
|
|
|
timeIn, timeOut, txtr, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-23 05:36:20 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "CameraBlurKeyframe"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-23 05:36:20 +00:00
|
|
|
bool active = in.readBool();
|
2017-06-01 21:13:19 +00:00
|
|
|
EBlurType type = EBlurType(in.readUint32Big());
|
|
|
|
float amount = in.readFloatBig();
|
|
|
|
u32 unk = in.readUint32Big();
|
|
|
|
float timeIn = in.readFloatBig();
|
|
|
|
float timeOut = in.readFloatBig();
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, type, amount, unk, timeIn, timeOut,
|
|
|
|
active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-05-03 08:27:28 +00:00
|
|
|
u32 ClassifyVector(const zeus::CVector3f& dir)
|
|
|
|
{
|
|
|
|
zeus::CVector3f absDir(std::fabs(dir.x), std::fabs(dir.y), std::fabs(dir.z));
|
|
|
|
u32 max = (absDir.x > absDir.y ? 0 : 1);
|
|
|
|
max = (absDir[max] > absDir.z ? max : 2);
|
|
|
|
|
|
|
|
bool positive = (absDir[max] == dir[max]);
|
|
|
|
if (max == 0)
|
|
|
|
return (positive ? 0x08 : 0x04);
|
|
|
|
else if (max == 1)
|
|
|
|
return (positive ? 0x01 : 0x02);
|
|
|
|
else if (max == 2)
|
|
|
|
return (positive ? 0x10 : 0x20);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 TransformDamagableTriggerFlags(CStateManager& mgr, TAreaId aId, u32 flags)
|
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
CGameArea* area = mgr.WorldNC()->GetGameAreas().at(u32(aId)).get();
|
2016-05-03 08:27:28 +00:00
|
|
|
zeus::CTransform rotation = area->GetTransform().getRotation();
|
|
|
|
|
|
|
|
u32 ret = 0;
|
|
|
|
if (flags & 0x01)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skForward);
|
2016-05-03 08:27:28 +00:00
|
|
|
if (flags & 0x02)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skBack);
|
2016-05-03 08:27:28 +00:00
|
|
|
if (flags & 0x04)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skLeft);
|
2016-05-03 08:27:28 +00:00
|
|
|
if (flags & 0x08)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skRight);
|
2016-05-03 08:27:28 +00:00
|
|
|
if (flags & 0x10)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skUp);
|
2016-05-03 08:27:28 +00:00
|
|
|
if (flags & 0x20)
|
2017-02-12 03:51:59 +00:00
|
|
|
ret |= ClassifyVector(rotation * zeus::CVector3f::skDown);
|
2016-05-03 08:27:28 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-03 08:27:28 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 12, "DamageableTrigger"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-05-03 08:27:28 +00:00
|
|
|
zeus::CVector3f position(zeus::CVector3f::ReadBig(in));
|
|
|
|
zeus::CVector3f volume(zeus::CVector3f::ReadBig(in));
|
|
|
|
|
|
|
|
CHealthInfo hInfo(in);
|
|
|
|
CDamageVulnerability dVuln(in);
|
|
|
|
u32 triggerFlags = in.readUint32Big();
|
|
|
|
triggerFlags = TransformDamagableTriggerFlags(mgr, info.GetAreaId(), triggerFlags);
|
2017-08-14 03:55:06 +00:00
|
|
|
CAssetId patternTex1 = in.readUint32Big();
|
|
|
|
CAssetId patternTex2 = in.readUint32Big();
|
|
|
|
CAssetId colorTex = in.readUint32Big();
|
2016-05-03 08:27:28 +00:00
|
|
|
CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.readBool());
|
|
|
|
bool active = in.readBool();
|
|
|
|
CVisorParameters vParms = LoadVisorParameters(in);
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), name, info, position, volume, hInfo, dVuln,
|
2017-08-14 03:55:06 +00:00
|
|
|
triggerFlags, patternTex1, patternTex2, colorTex, canOrbit, active, vParms);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-23 05:36:20 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 18, "Debris"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CColor color;
|
|
|
|
color.readRGBABig(in);
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
CScriptDebris::EScaleType scaleType = CScriptDebris::EScaleType(in.readUint32Big());
|
|
|
|
bool b1 = in.readBool();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId model = in.readUint32Big();
|
2016-05-23 05:36:20 +00:00
|
|
|
CActorParameters aParams = LoadActorParameters(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId w3 = in.readUint32Big();
|
2016-05-23 05:36:20 +00:00
|
|
|
zeus::CVector3f v2 = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
|
|
|
|
if (!g_ResFactory->GetResourceTypeById(model))
|
|
|
|
return nullptr;
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptDebris(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform,
|
|
|
|
CStaticRes(model, head.x40_scale), aParams, w3, v2, f1, v1, color, f2, f3, f4, scaleType,
|
|
|
|
b2, b1, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-03-18 05:12:27 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 9, "CameraShaker"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
CCameraShakeData shakeData = CCameraShakeData::LoadCameraShakeData(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
|
|
|
|
return new CScriptCameraShaker(mgr.AllocateUniqueId(), name, info, active, shakeData);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-11-20 21:53:15 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "ActorKeyframe"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-11-20 21:53:15 +00:00
|
|
|
s32 w1 = in.readInt32Big();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
|
|
|
|
if (w1 == -1)
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptActorKeyframe(mgr.AllocateUniqueId(), name, info, w1, b1, f1, false, w2, active, f2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 05:44:08 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 63, "Water"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-20 05:44:08 +00:00
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
zeus::CVector3f extent;
|
|
|
|
extent.readBig(in);
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
zeus::CVector3f orientedForce;
|
|
|
|
orientedForce.readBig(in);
|
2016-11-20 21:53:15 +00:00
|
|
|
ETriggerFlags triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 |
|
|
|
|
ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 |
|
|
|
|
ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs |
|
2017-01-15 03:59:37 +00:00
|
|
|
ETriggerFlags::DetectPowerBombs | ETriggerFlags::DetectProjectiles5 |
|
2016-11-20 21:53:15 +00:00
|
|
|
ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7;
|
2017-08-13 07:56:35 +00:00
|
|
|
bool thermalCold = in.readBool();
|
2016-04-20 05:57:30 +00:00
|
|
|
bool displaySurface = in.readBool();
|
2017-08-13 08:19:33 +00:00
|
|
|
CAssetId patternMap1 = in.readUint32Big();
|
|
|
|
CAssetId patternMap2 = in.readUint32Big();
|
|
|
|
CAssetId colorMap = in.readUint32Big();
|
|
|
|
CAssetId bumpMap = in.readUint32Big();
|
|
|
|
CAssetId _envMap = in.readUint32Big();
|
|
|
|
CAssetId _envBumpMap = in.readUint32Big();
|
2017-08-13 07:56:35 +00:00
|
|
|
zeus::CVector3f _bumpLightDir;
|
|
|
|
_bumpLightDir.readBig(in);
|
|
|
|
|
|
|
|
zeus::CVector3f bumpLightDir = _bumpLightDir;
|
|
|
|
if (!bumpLightDir.canBeNormalized())
|
|
|
|
bumpLightDir.assign(0.f, 0.f, -1.f);
|
|
|
|
|
|
|
|
float bumpScale = 1.f / in.readFloatBig();
|
|
|
|
float morphInTime = in.readFloatBig();
|
|
|
|
float morphOutTime = in.readFloatBig();
|
2016-04-20 05:44:08 +00:00
|
|
|
bool active = in.readBool();
|
2017-08-13 07:56:35 +00:00
|
|
|
auto fluidType = CFluidPlane::EFluidType(in.readUint32Big());
|
2016-04-20 05:44:08 +00:00
|
|
|
bool b4 = in.readBool();
|
2017-08-13 07:56:35 +00:00
|
|
|
float alpha = in.readFloatBig();
|
|
|
|
CFluidUVMotion uvMotion = LoadFluidUVMotion(in);
|
|
|
|
|
|
|
|
float turbSpeed = in.readFloatBig();
|
|
|
|
float turbDistance = in.readFloatBig();
|
|
|
|
float turbFreqMax = in.readFloatBig();
|
|
|
|
float turbFreqMin = in.readFloatBig();
|
|
|
|
float turbPhaseMax = zeus::degToRad(in.readFloatBig());
|
|
|
|
float turbPhaseMin = zeus::degToRad(in.readFloatBig());
|
|
|
|
float turbAmplitudeMax = in.readFloatBig();
|
|
|
|
float turbAmplitudeMin = in.readFloatBig();
|
|
|
|
zeus::CColor splashColor;
|
|
|
|
splashColor.readRGBABig(in);
|
|
|
|
zeus::CColor unkColor;
|
|
|
|
unkColor.readRGBABig(in);
|
2017-08-13 08:19:33 +00:00
|
|
|
CAssetId splashParticle1 = in.readUint32Big();
|
|
|
|
CAssetId splashParticle2 = in.readUint32Big();
|
|
|
|
CAssetId splashParticle3 = in.readUint32Big();
|
2017-08-16 05:34:02 +00:00
|
|
|
CAssetId visorRunoffParticle = in.readUint32Big();
|
|
|
|
CAssetId unmorphVisorRunoffParticle = in.readUint32Big();
|
2017-08-13 07:56:35 +00:00
|
|
|
u32 visorRunoffSfx = in.readUint32Big();
|
2017-08-16 05:34:02 +00:00
|
|
|
u32 unmorphVisorRunoffSfx = in.readUint32Big();
|
2017-08-13 07:56:35 +00:00
|
|
|
u32 splashSfx1 = in.readUint32Big();
|
|
|
|
u32 splashSfx2 = in.readUint32Big();
|
|
|
|
u32 splashSfx3 = in.readUint32Big();
|
|
|
|
float tileSize = in.readFloatBig();
|
|
|
|
u32 tileSubdivisions = in.readUint32Big();
|
|
|
|
float specularMin = in.readFloatBig();
|
|
|
|
float specularMax = in.readFloatBig();
|
|
|
|
float reflectionSize = in.readFloatBig();
|
|
|
|
float rippleIntensity = in.readFloatBig();
|
|
|
|
float reflectionBlend = in.readFloatBig();
|
|
|
|
float fogBias = in.readFloatBig();
|
|
|
|
float fogMagnitude = in.readFloatBig();
|
|
|
|
float fogSpeed = in.readFloatBig();
|
|
|
|
zeus::CColor fogColor;
|
|
|
|
fogColor.readRGBABig(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId lightmap = in.readUint32Big();
|
2017-08-13 07:56:35 +00:00
|
|
|
float unitsPerLightmapTexel = in.readFloatBig();
|
|
|
|
float alphaInTime = in.readFloatBig();
|
|
|
|
float alphaOutTime = in.readFloatBig();
|
2016-04-20 05:44:08 +00:00
|
|
|
u32 w21 = in.readUint32Big();
|
|
|
|
u32 w22 = in.readUint32Big();
|
|
|
|
bool b5 = in.readBool();
|
|
|
|
|
2017-08-10 07:05:27 +00:00
|
|
|
std::unique_ptr<u32[]> bitset;
|
2016-09-02 15:26:29 +00:00
|
|
|
u32 bitVal0 = 0;
|
|
|
|
u32 bitVal1 = 0;
|
2016-04-20 05:44:08 +00:00
|
|
|
|
|
|
|
if (b5)
|
|
|
|
{
|
|
|
|
bitVal0 = in.readUint16Big();
|
|
|
|
bitVal1 = in.readUint16Big();
|
|
|
|
u32 len = ((bitVal0 * bitVal1) + 31) / 31;
|
2017-08-10 07:05:27 +00:00
|
|
|
bitset.reset(new u32[len]);
|
|
|
|
in.readBytesToBuf(bitset.get(), len * 4);
|
2016-04-20 05:44:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CAABox box(-extent * 0.5f, extent * 0.5f);
|
|
|
|
|
2017-08-13 08:19:33 +00:00
|
|
|
CAssetId envBumpMap;
|
2017-11-15 04:12:13 +00:00
|
|
|
if (!bumpMap.IsValid())
|
2017-08-13 07:56:35 +00:00
|
|
|
envBumpMap = _envBumpMap;
|
2016-04-20 05:44:08 +00:00
|
|
|
|
2017-08-13 08:19:33 +00:00
|
|
|
CAssetId envMap;
|
2017-11-15 04:12:13 +00:00
|
|
|
if (!bumpMap.IsValid())
|
2017-08-13 07:56:35 +00:00
|
|
|
envMap = _envMap;
|
2016-04-20 05:44:08 +00:00
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new CScriptWater(mgr, mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, triggerFlags,
|
|
|
|
thermalCold, displaySurface, patternMap1, patternMap2, colorMap, bumpMap, envMap,
|
|
|
|
envBumpMap, {}, bumpLightDir, bumpScale, morphInTime, morphOutTime, active, fluidType, b4,
|
|
|
|
alpha, uvMotion, turbSpeed, turbDistance, turbFreqMax, turbFreqMin, turbPhaseMax,
|
|
|
|
turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin, splashColor, unkColor, splashParticle1,
|
|
|
|
splashParticle2, splashParticle3, visorRunoffParticle, unmorphVisorRunoffParticle,
|
|
|
|
visorRunoffSfx, unmorphVisorRunoffSfx, splashSfx1, splashSfx2, splashSfx3, tileSize,
|
|
|
|
tileSubdivisions, specularMin, specularMax, reflectionSize, rippleIntensity,
|
|
|
|
reflectionBlend, fogBias, fogMagnitude, fogSpeed, fogColor, lightmap, unitsPerLightmapTexel,
|
|
|
|
alphaInTime, alphaOutTime, w21, w22, b5, bitVal0, bitVal1, std::move(bitset));
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-25 05:46:28 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 13, "WarWasp"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-25 05:46:28 +00:00
|
|
|
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
|
|
|
zeus::CTransform xf = LoadEditorTransformPivotOnly(in);
|
|
|
|
zeus::CVector3f scale;
|
|
|
|
scale.readBig(in);
|
|
|
|
|
|
|
|
std::pair<bool, u32> verifyPair = CPatternedInfo::HasCorrectParameterCount(in);
|
|
|
|
if (!verifyPair.first)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CPatternedInfo pInfo(in, verifyPair.second);
|
|
|
|
CActorParameters actorParms = LoadActorParameters(in);
|
|
|
|
CPatterned::EColliderType collider = CPatterned::EColliderType(in.readBool());
|
|
|
|
CDamageInfo damageInfo1(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId weaponDesc = in.readUint32Big();
|
2016-04-25 05:46:28 +00:00
|
|
|
CDamageInfo damageInfo2(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId particle = in.readUint32Big();
|
2016-04-25 05:46:28 +00:00
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
const CAnimationParameters& aParms = pInfo.GetAnimationParameters();
|
|
|
|
FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile());
|
2016-04-25 05:46:28 +00:00
|
|
|
if (animType != SBIG('ANCS'))
|
|
|
|
return nullptr;
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), scale, true, aParms.GetInitialAnimation());
|
2016-04-25 05:46:28 +00:00
|
|
|
CModelData mData(res);
|
2017-01-15 03:59:37 +00:00
|
|
|
return new MP1::CWarWasp(mgr.AllocateUniqueId(), name, info, xf, std::move(mData), pInfo, flavor, collider,
|
2016-09-01 19:39:13 +00:00
|
|
|
damageInfo1, actorParms, weaponDesc, damageInfo2, particle, w1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-06-21 04:15:30 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 34, "SpacePirate"))
|
|
|
|
return nullptr;
|
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
std::pair<bool, u32> verifyPair = CPatternedInfo::HasCorrectParameterCount(in);
|
|
|
|
if (!verifyPair.first)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CPatternedInfo pInfo(in, verifyPair.second);
|
|
|
|
CActorParameters aParams = LoadActorParameters(in);
|
|
|
|
CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
|
|
|
|
|
|
|
if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS'))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
if (animParms.GetCharacter() == 0)
|
|
|
|
{
|
2016-09-01 19:39:13 +00:00
|
|
|
Log.report(logvisor::Warning,
|
|
|
|
"SpacePirate <%s> has AnimationInformation property with invalid character selected",
|
|
|
|
head.x0_name.c_str());
|
2016-06-21 04:15:30 +00:00
|
|
|
animParms.SetCharacter(2);
|
|
|
|
}
|
|
|
|
|
2016-09-01 19:39:13 +00:00
|
|
|
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), head.x40_scale,
|
|
|
|
animParms.GetInitialAnimation(), true));
|
2016-06-21 04:15:30 +00:00
|
|
|
|
2016-09-01 19:39:13 +00:00
|
|
|
return new MP1::CSpacePirate(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData),
|
|
|
|
aParams, pInfo, in, propCount);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadElitePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-25 05:46:28 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 9, "CoverPoint"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
2016-10-01 19:00:16 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
u32 flags = in.readUint32Big();
|
|
|
|
bool crouch = in.readBool();
|
|
|
|
float horizontalAngle = in.readFloatBig();
|
|
|
|
float verticalAngle = in.readFloatBig();
|
|
|
|
float coverTime = in.readFloatBig();
|
2016-04-25 05:46:28 +00:00
|
|
|
|
2016-10-01 19:00:16 +00:00
|
|
|
return new CScriptCoverPoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, flags, crouch,
|
|
|
|
horizontalAngle, verticalAngle, coverTime);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadBloodFlower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-11-20 17:33:21 +00:00
|
|
|
if (propCount > 15)
|
|
|
|
{
|
|
|
|
Log.report(logvisor::Warning, "Too many props (%d > 15) for PathCamera entity", propCount);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 flags = LoadParameterFlags(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
CPathCamera::EInitialSplinePosition initPos = CPathCamera::EInitialSplinePosition(in.readUint32Big());
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
float f5 = in.readFloatBig();
|
|
|
|
return new CPathCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, f1, f2, f3, f4, f5, flags, initPos);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-20 21:07:18 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "GrapplePoint"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-20 21:07:18 +00:00
|
|
|
zeus::CTransform grappleXf = LoadEditorTransform(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
CGrappleParameters parameters = LoadGrappleParameters(in);
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptGrapplePoint(mgr.AllocateUniqueId(), name, info, grappleXf, active, parameters);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDebugCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpiderBallAttractionSurface(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-09-18 03:02:48 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "SpiderBallAttractionSurface"))
|
|
|
|
return nullptr;
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
return new CScriptSpiderBallAttractionSurface(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
|
|
|
aHead.x40_scale, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPuddleToadGamma(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-08-08 20:55:58 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 8, "DistanceFog"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-08-08 20:55:58 +00:00
|
|
|
u32 mode = in.readUint32Big();
|
2016-08-09 03:58:19 +00:00
|
|
|
zeus::CColor color;
|
|
|
|
color.readRGBABig(in);
|
|
|
|
zeus::CVector2f range;
|
|
|
|
range.readBig(in);
|
|
|
|
float colorDelta = in.readFloatBig();
|
|
|
|
zeus::CVector2f rangeDelta;
|
|
|
|
rangeDelta.readBig(in);
|
|
|
|
bool expl = in.readBool();
|
2016-08-08 20:55:58 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
ERglFogMode realMode;
|
|
|
|
|
|
|
|
if (mode == 0)
|
|
|
|
realMode = ERglFogMode::None;
|
|
|
|
else if (mode == 1)
|
|
|
|
realMode = ERglFogMode::PerspLin;
|
|
|
|
else if (mode == 2)
|
|
|
|
realMode = ERglFogMode::PerspExp;
|
|
|
|
else if (mode == 3)
|
|
|
|
realMode = ERglFogMode::PerspExp2;
|
|
|
|
else if (mode == 4)
|
|
|
|
realMode = ERglFogMode::PerspRevExp;
|
|
|
|
else if (mode == 5)
|
|
|
|
realMode = ERglFogMode::PerspRevExp2;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, realMode, color, range, colorDelta, rangeDelta,
|
2016-08-09 03:58:19 +00:00
|
|
|
expl, active, 0.f, 0.f, 0.f, 0.f);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFireFlea(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-22 02:48:22 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 3, "DockAreaChange"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-12-22 02:48:22 +00:00
|
|
|
s32 w1 = in.readInt32Big();
|
|
|
|
bool active = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptDockAreaChange(mgr.AllocateUniqueId(), name, info, w1, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-27 19:59:38 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "ActorRotate"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-04-27 19:59:38 +00:00
|
|
|
zeus::CVector3f rotation = zeus::CVector3f::ReadBig(in);
|
|
|
|
float scale = in.readFloatBig();
|
2017-08-29 13:17:52 +00:00
|
|
|
bool updateActors = in.readBool();
|
2016-04-27 19:59:38 +00:00
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool active = in.readBool();
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new CScriptActorRotate(mgr.AllocateUniqueId(), name, info, rotation, scale, updateActors, b2, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-27 19:59:38 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 15, "SpecialFunction"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead head = LoadActorHead(in, mgr);
|
2016-09-02 15:26:29 +00:00
|
|
|
CScriptSpecialFunction::ESpecialFunction specialFunction =
|
|
|
|
CScriptSpecialFunction::ESpecialFunction(in.readUint32Big());
|
|
|
|
std::string str = in.readString();
|
2016-04-27 19:59:38 +00:00
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
u32 w4 = in.readUint32Big();
|
|
|
|
bool active1 = in.readBool();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
s16 w5 = in.readUint32Big() & 0xFFFF;
|
|
|
|
s16 w6 = in.readUint32Big() & 0xFFFF;
|
|
|
|
s16 w7 = in.readUint32Big() & 0xFFFF;
|
2016-09-02 15:26:29 +00:00
|
|
|
if (specialFunction == CScriptSpecialFunction::ESpecialFunction::FogVolume ||
|
|
|
|
specialFunction == CScriptSpecialFunction::ESpecialFunction::RadialDamage)
|
2016-04-27 19:59:38 +00:00
|
|
|
return nullptr;
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, specialFunction,
|
|
|
|
str, f1, f2, f3, f4, zeus::CVector3f::skZero, zeus::CColor::skBlack, active1,
|
|
|
|
CDamageInfo(), w2, w3, w4, w5, w6, w7);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-11-20 17:33:21 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "Parasite"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
|
|
|
zeus::CTransform xf = LoadEditorTransform(in);
|
|
|
|
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
|
|
|
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
|
|
|
|
if (!pcount.first)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CPatternedInfo pInfo(in, pcount.second);
|
|
|
|
CActorParameters aParms = LoadActorParameters(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
float f5 = in.readFloatBig();
|
|
|
|
float f6 = in.readFloatBig();
|
|
|
|
float f7 = in.readFloatBig();
|
|
|
|
float f8 = in.readFloatBig();
|
|
|
|
float f9 = in.readFloatBig();
|
|
|
|
float f10 = in.readFloatBig();
|
|
|
|
float f11 = in.readFloatBig();
|
|
|
|
float f12 = in.readFloatBig();
|
|
|
|
float f13 = in.readFloatBig();
|
|
|
|
float f14 = in.readFloatBig();
|
|
|
|
float f15 = in.readFloatBig();
|
|
|
|
float f16 = in.readFloatBig();
|
|
|
|
float f17 = in.readFloatBig();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
|
|
|
|
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
|
|
|
|
return nullptr;
|
|
|
|
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
|
|
|
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
|
|
|
|
return nullptr; //return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, )
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-08-18 01:30:15 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "PlayerHint"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 w2 = LoadParameterFlags(in);
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
|
|
|
|
return new CScriptPlayerHint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-10 02:35:20 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "PickupGenerator"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-12-10 02:35:20 +00:00
|
|
|
zeus::CVector3f pos = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptPickupGenerator(mgr.AllocateUniqueId(), name, info, pos, f1, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-10 02:35:20 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "PointOfInterest"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
CScannableParameters sParms = LoadScannableParameters(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
|
2016-12-19 18:27:58 +00:00
|
|
|
return new CScriptPointOfInterest(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, sParms,
|
|
|
|
f1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMetroidAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-02-28 07:31:14 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 39, "DebrisExtended"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
float f5 = in.readFloatBig();
|
|
|
|
float f6 = in.readFloatBig();
|
|
|
|
float f7 = in.readFloatBig();
|
|
|
|
float f8 = in.readFloatBig();
|
|
|
|
float f9 = in.readFloatBig();
|
|
|
|
|
|
|
|
zeus::CColor c1 = zeus::CColor::ReadRGBABig(in);
|
|
|
|
zeus::CColor c2 = zeus::CColor::ReadRGBABig(in);
|
|
|
|
|
|
|
|
float f10 = in.readFloatBig();
|
|
|
|
|
|
|
|
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
|
|
|
float f11 = in.readFloatBig();
|
|
|
|
float f12 = in.readFloatBig();
|
|
|
|
|
|
|
|
zeus::CVector3f v2 = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId model = in.readUint32Big();
|
2017-02-28 07:31:14 +00:00
|
|
|
|
|
|
|
CActorParameters aParam = LoadActorParameters(in);
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId particle1 = in.readUint32Big();
|
2017-02-28 07:31:14 +00:00
|
|
|
zeus::CVector3f particle1Scale = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool particle1B1 = in.readBool();
|
|
|
|
bool particle1B2 = in.readBool();
|
|
|
|
CScriptDebris::EOrientationType particle1W = CScriptDebris::EOrientationType(in.readUint32Big());
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId particle2 = in.readUint32Big();
|
2017-02-28 07:31:14 +00:00
|
|
|
zeus::CVector3f particle2Scale = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool particle2B1 = in.readBool();
|
|
|
|
bool particle2B2 = in.readBool();
|
|
|
|
CScriptDebris::EOrientationType particle2W = CScriptDebris::EOrientationType(in.readUint32Big());
|
|
|
|
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId particle3 = in.readUint32Big();
|
2017-02-28 07:31:14 +00:00
|
|
|
zeus::CVector3f particle3Scale = zeus::CVector3f::ReadBig(in);
|
|
|
|
CScriptDebris::EOrientationType particle3W = CScriptDebris::EOrientationType(in.readUint32Big());
|
|
|
|
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
bool b4 = in.readBool();
|
|
|
|
|
|
|
|
CModelData modelData;
|
|
|
|
if (g_ResFactory->GetResourceTypeById(model))
|
|
|
|
modelData = CModelData(CStaticRes(model, aHead.x40_scale));
|
|
|
|
|
2017-05-21 06:01:24 +00:00
|
|
|
return new CScriptDebris(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(modelData),
|
|
|
|
aParam, f1, f2, f3, f4, f5, f6, f7, f8, f9, c1, c2, f10, aHead.x40_scale, v1, f11, f12, v2,
|
|
|
|
particle1, particle1Scale, particle1B1, particle1B2, particle1W, particle2, particle2Scale,
|
|
|
|
particle2B1, particle2B2, particle2W, particle3, particle3Scale, particle3W, b1, b2, b3,
|
|
|
|
b4);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-02-28 07:31:14 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 11, "Steam"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
|
|
|
|
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f v2 = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
|
|
|
|
zeus::CVector3f v3 = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
|
|
|
ETriggerFlags w1 = ETriggerFlags(in.readUint32Big());
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
|
|
|
|
zeus::CAABox aabb(-v2 * 0.5f, v2 * 0.5f);
|
|
|
|
|
2017-05-21 06:01:24 +00:00
|
|
|
return new CScriptSteam(mgr.AllocateUniqueId(), name, info, v1, aabb, dInfo, v3, w1, b1, w2, f1, f2, f3, f4, b2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRipple(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadBallTrigger(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadTargetingPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-02-21 03:29:28 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 19, "PlayerActor"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
zeus::CVector3f extents = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f offset = zeus::CVector3f::ReadBig(in);
|
|
|
|
float mass = in.readFloatBig();
|
|
|
|
float zMomentum = in.readFloatBig();
|
|
|
|
CHealthInfo hInfo(in);
|
|
|
|
CDamageVulnerability dVuln(in);
|
|
|
|
in.readUint32Big();
|
|
|
|
CAnimationParameters animParms = LoadAnimationParameters(in);
|
|
|
|
CActorParameters actParms = LoadActorParameters(in);
|
|
|
|
bool loop = in.readBool();
|
|
|
|
bool snow = in.readBool();
|
|
|
|
bool solid = in.readBool();
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 flags = LoadParameterFlags(in);
|
|
|
|
bool w1 = in.readUint32Big() - 1;
|
|
|
|
|
|
|
|
FourCC fcc = g_ResFactory->GetResourceTypeById(animParms.GetACSFile());
|
|
|
|
if (!fcc || fcc != SBIG('ANCS'))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
zeus::CAABox aabox = GetCollisionBox(mgr, info.GetAreaId(), extents, offset);
|
|
|
|
CMaterialList list;
|
|
|
|
if (snow)
|
|
|
|
list.Add(EMaterialTypes::Snow);
|
|
|
|
|
|
|
|
if (solid)
|
|
|
|
list.Add(EMaterialTypes::Solid);
|
|
|
|
|
|
|
|
if ((extents.x < 0.f || extents.y < 0.f || extents.z < 0.f) || extents.isZero())
|
2017-12-18 02:54:50 +00:00
|
|
|
aabox = zeus::CAABox(-.5f, 0.5f);
|
2017-02-21 03:29:28 +00:00
|
|
|
|
|
|
|
return new CScriptPlayerActor(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
|
|
|
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale,
|
2017-05-21 06:01:24 +00:00
|
|
|
animParms.GetInitialAnimation(), loop),
|
|
|
|
CModelData::CModelDataNull(), aabox, true, list, mass, zMomentum, hInfo, dVuln,
|
|
|
|
actParms, loop, active, flags, w1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-04-23 18:04:49 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 9, "AreaAttributes"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
bool load = in.readUint32Big() != 0;
|
|
|
|
if (!load)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
bool showSkybox = in.readBool();
|
|
|
|
EEnvFxType fxType = EEnvFxType(in.readUint32Big());
|
|
|
|
float envFxDensity = in.readFloatBig();
|
|
|
|
float thermalHeat = in.readFloatBig();
|
|
|
|
float xrayFogDistance = in.readFloatBig();
|
|
|
|
float worldLightingLevel = in.readFloatBig();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId skybox = in.readUint32Big();
|
2016-04-23 18:04:49 +00:00
|
|
|
EPhazonType phazonType = EPhazonType(in.readUint32Big());
|
|
|
|
|
|
|
|
return new CScriptAreaAttributes(mgr.AllocateUniqueId(), info, showSkybox, fxType, envFxDensity, thermalHeat,
|
|
|
|
xrayFogDistance, worldLightingLevel, skybox, phazonType);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-03-20 05:09:53 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 14, "VisorFlare"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
zeus::CVector3f pos = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
CVisorFlare::EBlendMode w1 = CVisorFlare::EBlendMode(in.readUint32Big());
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
std::vector<CVisorFlare::CFlareDef> flares;
|
|
|
|
flares.reserve(5);
|
2017-05-21 06:01:24 +00:00
|
|
|
for (int i = 0; i < 5; ++i)
|
2017-03-20 05:09:53 +00:00
|
|
|
if (auto flare = CVisorFlare::LoadFlareDef(in))
|
|
|
|
flares.push_back(*flare);
|
|
|
|
|
|
|
|
return new CScriptVisorFlare(mgr.AllocateUniqueId(), name, info, b1, pos, w1, b2, f1, f2, f3, 2, w2, flares);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-08-08 22:12:14 +00:00
|
|
|
if (propCount < 4 || propCount > 21)
|
|
|
|
{
|
|
|
|
Log.report(logvisor::Warning, "Incorrect number of props for WorldTeleporter");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool active = in.readBool();
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId worldId = in.readUint32Big();
|
|
|
|
CAssetId areaId = in.readUint32Big();
|
2017-08-08 22:12:14 +00:00
|
|
|
|
|
|
|
if (propCount == 4)
|
|
|
|
return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId);
|
|
|
|
|
|
|
|
CAnimationParameters animParms = LoadAnimationParameters(in);
|
|
|
|
zeus::CVector3f playerScale = zeus::CVector3f::ReadBig(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId platformModel = in.readUint32Big();
|
2017-08-08 22:12:14 +00:00
|
|
|
zeus::CVector3f platformScale = zeus::CVector3f::ReadBig(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId backgroundModel = in.readUint32Big();
|
2017-08-08 22:12:14 +00:00
|
|
|
zeus::CVector3f backgroundScale = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool upElevator = in.readBool();
|
|
|
|
|
|
|
|
s16 elevatorSound = (propCount < 12 ? s16(-1) : s16(in.readUint32Big()));
|
|
|
|
u8 volume = (propCount < 13 ? u8(127) : u8(in.readUint32Big()));
|
|
|
|
u8 panning = (propCount < 14 ? u8(64) : u8(in.readUint32Big()));
|
|
|
|
bool showText = (propCount < 15 ? false : in.readBool());
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId fontId = (propCount < 16 ? CAssetId() : in.readUint32Big());
|
|
|
|
CAssetId stringId = (propCount < 17 ? CAssetId() : in.readUint32Big());
|
2017-08-08 22:12:14 +00:00
|
|
|
bool fadeWhite = (propCount < 18 ? false : in.readBool());
|
|
|
|
float charFadeInTime = (propCount < 19 ? 0.1f : in.readFloatBig());
|
|
|
|
float charsPerSecond = (propCount < 20 ? 16.f : in.readFloatBig());
|
|
|
|
float showDelay = (propCount < 21 ? 0.f : in.readFloatBig());
|
|
|
|
|
|
|
|
if (showText)
|
|
|
|
return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId, elevatorSound,
|
|
|
|
volume, panning, fontId, stringId, fadeWhite, charFadeInTime, charsPerSecond,
|
|
|
|
showDelay);
|
|
|
|
|
|
|
|
return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId,
|
2017-08-29 13:17:52 +00:00
|
|
|
animParms.GetACSFile(), animParms.GetCharacter(), animParms.GetInitialAnimation(),
|
|
|
|
playerScale, platformModel, platformScale, backgroundModel, backgroundScale,
|
|
|
|
upElevator, elevatorSound, volume, panning);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-11-12 05:14:57 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 11, "VisorGoo"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
zeus::CTransform xf = zeus::CTransform::Translate(position);
|
|
|
|
CAssetId particle(in);
|
|
|
|
CAssetId electric(in);
|
|
|
|
float minDist = in.readFloatBig();
|
|
|
|
float maxDist = in.readFloatBig();
|
|
|
|
float nearProb = in.readFloatBig();
|
|
|
|
float farProb = in.readFloatBig();
|
|
|
|
zeus::CColor color;
|
|
|
|
color.readRGBABig(in);
|
|
|
|
u32 sfx = in.readUint32Big();
|
|
|
|
bool forceShow = in.readBool();
|
|
|
|
|
|
|
|
if (particle.IsValid() || electric.IsValid())
|
|
|
|
return new CScriptVisorGoo(mgr.AllocateUniqueId(), name, info, xf, particle, electric,
|
|
|
|
minDist, maxDist, nearProb, farProb, color, sfx, forceShow, false);
|
|
|
|
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadControllerAction(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-03-18 05:12:27 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "ControllerAction") || propCount > 6)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
ControlMapper::ECommands w1 = ControlMapper::ECommands(in.readUint32Big());
|
|
|
|
bool b1 = false;
|
|
|
|
u32 w2 = 0;
|
|
|
|
if (propCount == 6)
|
|
|
|
{
|
|
|
|
b1 = in.readBool();
|
|
|
|
w2 = in.readUint32Big();
|
|
|
|
}
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
|
|
|
|
return new CScriptControllerAction(mgr.AllocateUniqueId(), name, info, active, w1, b1, w2, b2);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-19 18:27:58 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "Switch"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-12-19 18:27:58 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptSwitch(mgr.AllocateUniqueId(), name, info, active, b2, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-07-30 11:00:30 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "PlayerStateChange"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
s32 itemType = in.readUint32Big();
|
|
|
|
s32 itemCount = in.readInt32Big();
|
|
|
|
s32 itemCapacity = in.readInt32Big();
|
|
|
|
CScriptPlayerStateChange::EControl ctrl = CScriptPlayerStateChange::EControl(in.readUint32Big());
|
|
|
|
CScriptPlayerStateChange::EControlCommandOption ctrlCmdOpt =
|
|
|
|
CScriptPlayerStateChange::EControlCommandOption(in.readUint32Big());
|
|
|
|
return new CScriptPlayerStateChange(mgr.AllocateUniqueId(), name, info, active, itemType, itemCount, itemCapacity,
|
|
|
|
ctrl, ctrlCmdOpt);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-01-24 17:23:10 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 39, "WallCrawlerSwarm"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
CActorParameters aParams = LoadActorParameters(in);
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
u32 w4 = in.readUint32Big();
|
|
|
|
u32 w5 = in.readUint32Big();
|
|
|
|
u32 w6 = in.readUint32Big();
|
|
|
|
u32 w7 = in.readUint32Big();
|
|
|
|
u32 w8 = in.readUint32Big();
|
|
|
|
u32 w9 = in.readUint32Big();
|
|
|
|
u32 w10 = in.readUint32Big();
|
|
|
|
CDamageInfo dInfo1(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
CDamageInfo dInfo2(in);
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
float f5 = in.readFloatBig();
|
|
|
|
u32 w11 = in.readUint32Big();
|
|
|
|
u32 w12 = in.readUint32Big();
|
|
|
|
float f6 = in.readFloatBig();
|
|
|
|
float f7 = in.readFloatBig();
|
|
|
|
float f8 = in.readFloatBig();
|
|
|
|
float f9 = in.readFloatBig();
|
|
|
|
float f10 = in.readFloatBig();
|
|
|
|
float f11 = in.readFloatBig();
|
|
|
|
float f12 = in.readFloatBig();
|
|
|
|
float f13 = in.readFloatBig();
|
|
|
|
u32 w13 = in.readUint32Big();
|
|
|
|
float f14 = in.readFloatBig();
|
|
|
|
float f15 = in.readFloatBig();
|
|
|
|
float f16 = in.readFloatBig();
|
|
|
|
CHealthInfo hInfo(in);
|
|
|
|
CDamageVulnerability dVulns(in);
|
|
|
|
u32 w14 = in.readUint32Big();
|
|
|
|
u32 w15 = in.readUint32Big();
|
|
|
|
|
2017-01-24 17:47:11 +00:00
|
|
|
return new CWallCrawlerSwarm(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale,
|
2017-12-18 02:54:50 +00:00
|
|
|
aHead.x10_transform, w1, CAnimRes(w2, w3, zeus::CVector3f(1.5f), w4, true), w5, w6,
|
|
|
|
w7, w8, w9, w10, dInfo1, dInfo2, f1, f2, f3, f4, w11, w12, f5, f6, f7, f8, f9, f10,
|
|
|
|
f11, f12, f13, w13, f14, f15, f16, hInfo, dVulns, w14, w15, aParams);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-10-01 19:00:16 +00:00
|
|
|
CEntity* ScriptLoader::LoadAiJumpPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-10-01 19:00:16 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "AiJumpPoint"))
|
2016-12-19 18:27:58 +00:00
|
|
|
return nullptr;
|
2016-10-01 19:00:16 +00:00
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
2016-12-19 18:27:58 +00:00
|
|
|
float f1 = in.readFloat();
|
2016-10-01 19:00:16 +00:00
|
|
|
|
|
|
|
return new CScriptAiJumpPoint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, f1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFlaahgraTentacle(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRoomAcoustics(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-01-23 07:22:17 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 32, "RoomAcoustics"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool a = in.readBool();
|
|
|
|
u32 b = in.readUint32Big();
|
|
|
|
bool c = in.readBool();
|
|
|
|
bool d = in.readBool();
|
|
|
|
float e = in.readFloatBig();
|
|
|
|
float f = in.readFloatBig();
|
|
|
|
float g = in.readFloatBig();
|
|
|
|
float h = in.readFloatBig();
|
|
|
|
float i = in.readFloatBig();
|
|
|
|
float j = in.readFloatBig();
|
|
|
|
bool k = in.readBool();
|
|
|
|
float l = in.readFloatBig();
|
|
|
|
float m = in.readFloatBig();
|
|
|
|
float n = in.readFloatBig();
|
|
|
|
bool o = in.readBool();
|
|
|
|
bool p = in.readBool();
|
|
|
|
float q = in.readFloatBig();
|
|
|
|
float r = in.readFloatBig();
|
|
|
|
float s = in.readFloatBig();
|
|
|
|
float t = in.readFloatBig();
|
|
|
|
float u = in.readFloatBig();
|
|
|
|
bool v = in.readBool();
|
|
|
|
u32 w = in.readUint32Big();
|
|
|
|
u32 x = in.readUint32Big();
|
|
|
|
u32 y = in.readUint32Big();
|
|
|
|
u32 z = in.readUint32Big();
|
|
|
|
u32 _a = in.readUint32Big();
|
|
|
|
u32 _b = in.readUint32Big();
|
|
|
|
u32 _c = in.readUint32Big();
|
|
|
|
u32 _d = in.readUint32Big();
|
|
|
|
u32 _e = in.readUint32Big();
|
|
|
|
|
2017-01-24 17:23:10 +00:00
|
|
|
return new CScriptRoomAcoustics(mgr.AllocateUniqueId(), name, info, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p,
|
|
|
|
q, r, s, t, u, v, w, x, y, z, _a, _b, _c, _d, _e);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-08-18 18:34:06 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 12, "ColorModulate"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-08-18 18:34:06 +00:00
|
|
|
zeus::CColor c1;
|
|
|
|
c1.readRGBABig(in);
|
|
|
|
zeus::CColor c2;
|
|
|
|
c2.readRGBABig(in);
|
|
|
|
CScriptColorModulate::EBlendMode bm = CScriptColorModulate::EBlendMode(in.readUint32Big());
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
bool b4 = in.readBool();
|
|
|
|
bool b5 = in.readBool();
|
|
|
|
bool active = in.readBool();
|
2017-01-24 17:23:10 +00:00
|
|
|
return new CScriptColorModulate(mgr.AllocateUniqueId(), name, info, c1, c2, bm, f1, f2, b1, b2, b3, b4, b5, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-02-27 05:25:14 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "Midi"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 csng = in.readUint32Big();
|
|
|
|
float fadeIn = in.readFloatBig();
|
|
|
|
float fadeOut = in.readFloatBig();
|
|
|
|
u32 vol = in.readUint32Big();
|
|
|
|
return new CScriptMidi(mgr.AllocateUniqueId(), info, name, active, csng, fadeIn, fadeOut, vol);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-01-15 03:07:01 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 9, "StreamedAudio"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
const std::string name = mgr.HashInstanceName(in);
|
2017-01-16 08:40:33 +00:00
|
|
|
bool active = in.readBool();
|
2017-01-15 03:07:01 +00:00
|
|
|
std::string fileName = in.readString();
|
2017-01-16 08:40:33 +00:00
|
|
|
bool noStopOnDeactivate = in.readBool();
|
|
|
|
float fadeIn = in.readFloatBig();
|
|
|
|
float fadeOut = in.readFloatBig();
|
|
|
|
u32 volume = in.readUint32Big();
|
|
|
|
u32 oneShot = in.readUint32Big();
|
|
|
|
bool music = in.readBool();
|
|
|
|
|
2017-01-24 17:23:10 +00:00
|
|
|
return new CScriptStreamedMusic(mgr.AllocateUniqueId(), info, name, active, fileName, noStopOnDeactivate, fadeIn,
|
|
|
|
fadeOut, volume, !oneShot, music);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-22 02:48:22 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "Repulsor"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-12-22 02:48:22 +00:00
|
|
|
zeus::CVector3f center = in.readVec3fBig();
|
|
|
|
bool active = in.readBool();
|
|
|
|
float radius = in.readFloatBig();
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CRepulsor(mgr.AllocateUniqueId(), active, name, info, center, radius);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-08-29 13:17:52 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "FogVolume"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
zeus::CVector3f center = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f volume = zeus::CVector3f::ReadBig(in);
|
|
|
|
float flickerSpeed = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
zeus::CColor fogColor = zeus::CColor::ReadRGBABig(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
|
|
|
|
volume.x = std::fabs(volume.x);
|
|
|
|
volume.y = std::fabs(volume.y);
|
|
|
|
volume.z = std::fabs(volume.z);
|
|
|
|
|
|
|
|
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(center, {}),
|
|
|
|
CScriptSpecialFunction::ESpecialFunction::FogVolume, "", flickerSpeed, f2, 0.f,
|
|
|
|
0.f, volume, fogColor, active, CDamageInfo(), CAssetId(), CAssetId(), CAssetId(),
|
|
|
|
-1, -1, -1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-19 18:27:58 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 5, "RadialDamage"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2016-12-19 18:27:58 +00:00
|
|
|
zeus::CVector3f center = zeus::CVector3f::ReadBig(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
float radius = in.readFloatBig();
|
|
|
|
zeus::CTransform xf = ConvertEditorEulerToTransform4f(zeus::CVector3f::skZero, center);
|
|
|
|
|
|
|
|
return new CScriptSpecialFunction(
|
2017-01-24 17:23:10 +00:00
|
|
|
mgr.AllocateUniqueId(), name, info, xf, CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius, 0.f,
|
|
|
|
0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active, dInfo, -1, -1, -1, -1, -1, -1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-19 18:27:58 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 8, "CameraPitchVolume"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
zeus::CRelAngle f1 = zeus::CRelAngle::FromDegrees(in.readFloatBig());
|
|
|
|
zeus::CRelAngle f2 = zeus::CRelAngle::FromDegrees(in.readFloatBig());
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
|
|
|
|
return new CScriptCameraPitchVolume(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale,
|
|
|
|
aHead.x10_transform, f1, f2, f3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-08-29 13:17:52 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "EnvFxDensityController"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
float density = in.readFloatBig();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
|
|
|
|
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, zeus::CTransform::Identity(),
|
|
|
|
CScriptSpecialFunction::ESpecialFunction::EnvFxDensityController, "", density,
|
|
|
|
w1, 0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active,
|
|
|
|
CDamageInfo(), CAssetId(), CAssetId(), CAssetId(), -1, -1, -1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::Load(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-05-21 06:01:24 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 15, "ActorContraption"))
|
|
|
|
return nullptr;
|
2017-02-03 23:32:15 +00:00
|
|
|
|
2017-05-21 06:01:24 +00:00
|
|
|
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
|
|
|
zeus::CVector3f collisionExtent = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f collisionOrigin = zeus::CVector3f::ReadBig(in);
|
|
|
|
float mass = in.readFloatBig();
|
|
|
|
float zMomentum = in.readFloatBig();
|
|
|
|
CHealthInfo hInfo(in);
|
|
|
|
CDamageVulnerability dVuln(in);
|
|
|
|
CAnimationParameters animParams(in);
|
|
|
|
CActorParameters actParams = LoadActorParameters(in);
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId flameFxId = in.readUint32Big();
|
2017-05-21 06:01:24 +00:00
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
|
|
|
|
if (!g_ResFactory->GetResourceTypeById(animParams.GetACSFile()))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, collisionOrigin);
|
|
|
|
CMaterialList list;
|
|
|
|
list.Add(EMaterialTypes::Immovable);
|
|
|
|
list.Add(EMaterialTypes::Solid);
|
|
|
|
|
|
|
|
CModelData data(CAnimRes(animParams.GetACSFile(), animParams.GetCharacter(), head.x40_scale,
|
|
|
|
animParams.GetInitialAnimation(), true));
|
|
|
|
|
|
|
|
if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero())
|
|
|
|
aabb = data.GetBounds(head.x10_transform.getRotation());
|
|
|
|
|
|
|
|
return new MP1::CActorContraption(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data),
|
|
|
|
aabb, list, mass, zMomentum, hInfo, dVuln, actParams, flameFxId, dInfo, active);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 07:29:56 +00:00
|
|
|
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-10-06 07:29:56 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 24, "SpindleCamera"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 flags = LoadParameterFlags(in);
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg1(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg1.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg2(in);
|
|
|
|
SSpindleProperty seg3(in);
|
|
|
|
SSpindleProperty seg4(in);
|
|
|
|
SSpindleProperty seg5(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg5.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg6(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg6.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg7(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg7.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg8(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg8.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg9(in);
|
|
|
|
SSpindleProperty seg10(in);
|
|
|
|
SSpindleProperty seg11(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg11.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg12(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg12.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg13(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg13.FixupAngles();
|
2017-11-12 05:14:57 +00:00
|
|
|
SSpindleProperty seg14(in);
|
|
|
|
SSpindleProperty seg15(in);
|
2017-10-06 07:29:56 +00:00
|
|
|
seg15.FixupAngles();
|
|
|
|
|
|
|
|
return new CScriptSpindleCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
|
|
|
active, flags, f1, f2, f3, f4, seg1, seg2, seg3, seg4, seg5, seg6,
|
|
|
|
seg7, seg8, seg9, seg10, seg11, seg12, seg13, seg14, seg15);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-13 02:56:43 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "CameraHintTrigger"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
zeus::CVector3f scale = 0.5f * zeus::CVector3f::ReadBig(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
bool b3 = in.readBool();
|
|
|
|
|
|
|
|
zeus::CTransform xfRot = aHead.x10_transform.getRotation();
|
|
|
|
if (xfRot == zeus::CTransform::Identity())
|
2016-12-19 18:27:58 +00:00
|
|
|
return new CScriptTrigger(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform.origin,
|
|
|
|
zeus::CAABox(-scale, scale), CDamageInfo(), zeus::CVector3f::skZero,
|
|
|
|
ETriggerFlags::DetectPlayer, active, b2, b3);
|
2016-12-13 02:56:43 +00:00
|
|
|
|
2016-12-19 18:27:58 +00:00
|
|
|
return new CScriptCameraHintTrigger(mgr.AllocateUniqueId(), active, aHead.x0_name, info, scale, aHead.x10_transform,
|
|
|
|
b2, b3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRumbleEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-11-12 05:14:57 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 6, "RumbleEffect"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
|
|
|
zeus::CVector3f position;
|
|
|
|
position.readBig(in);
|
|
|
|
bool active = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 pFlags = LoadParameterFlags(in);
|
|
|
|
|
|
|
|
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info,
|
|
|
|
ConvertEditorEulerToTransform4f(zeus::CVector3f::skZero, position),
|
|
|
|
CScriptSpecialFunction::ESpecialFunction::RumbleEffect, "",
|
|
|
|
f1, w1, pFlags, 0.f, zeus::CVector3f::skZero,
|
|
|
|
zeus::CColor::skBlack, active, {}, {}, {}, {}, -1, -1, -1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPuffer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadTryclops(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadRidley(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-08-31 00:33:59 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "ThermalHeatFader"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return LoadWorldLightFader(mgr, in, propCount, info);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-12-22 19:57:21 +00:00
|
|
|
CEntity* ScriptLoader::LoadBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-12-22 19:57:21 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 7, "Beam"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 weaponDescId = in.readUint32Big();
|
|
|
|
if (!g_ResFactory->GetResourceTypeById(weaponDescId))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
CBeamInfo beamInfo(in);
|
|
|
|
CDamageInfo dInfo(in);
|
|
|
|
TToken<CWeaponDescription> weaponDesc = g_SimplePool->GetObj({SBIG('WPSC'), weaponDescId});
|
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
return new CScriptBeam(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, weaponDesc,
|
|
|
|
beamInfo, dInfo);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-08-31 00:33:59 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 4, "WorldLightFader"))
|
|
|
|
return nullptr;
|
|
|
|
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-08-20 05:23:22 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 22, "MetroidPrimeStage1"))
|
|
|
|
return nullptr;
|
|
|
|
u32 version = in.readUint32Big();
|
|
|
|
if (version != 3)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
CHealthInfo hInfo1(in);
|
|
|
|
CHealthInfo hInfo2(in);
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
rstl::reserved_vector<MP1::SPrimeExoRoomParameters, 4> roomParms;
|
2017-08-29 13:17:52 +00:00
|
|
|
for (int i = 0; i < 4; ++i)
|
2017-08-20 05:23:22 +00:00
|
|
|
roomParms.emplace_back(in);
|
|
|
|
u32 w4 = in.readUint32Big();
|
|
|
|
u32 w5 = in.readUint32Big();
|
|
|
|
MP1::SPrimeExoParameters primeParms(in);
|
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
return new MP1::CMetroidPrimeRelay(mgr.AllocateUniqueId(), aHead.x0_name, info, active, aHead.x10_transform,
|
|
|
|
aHead.x40_scale, std::move(primeParms), f1, f2, f3, w1, b1, w2, hInfo1, hInfo2,
|
|
|
|
w3, w4, w5, std::move(roomParms));
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-05-22 11:24:24 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 10, "MazeNode"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
SActorHead aHead = LoadActorHead(in, mgr);
|
|
|
|
bool active = in.readBool();
|
|
|
|
u32 w1 = in.readUint32Big();
|
|
|
|
u32 w2 = in.readUint32Big();
|
|
|
|
u32 w3 = in.readUint32Big();
|
|
|
|
zeus::CVector3f vec1 = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f vec2 = zeus::CVector3f::ReadBig(in);
|
|
|
|
zeus::CVector3f vec3 = zeus::CVector3f::ReadBig(in);
|
|
|
|
|
|
|
|
return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2, w3,
|
|
|
|
vec1, vec2, vec3);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadPhazonHealingNodule(CStateManager& mgr, CInputStream& in, int propCount,
|
|
|
|
const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadNewCameraShaker(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-03-18 05:12:27 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 8, "NewCameraShaker"))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2017-10-10 03:50:48 +00:00
|
|
|
zeus::CVector3f sfxPos = zeus::CVector3f::ReadBig(in);
|
2017-03-18 05:12:27 +00:00
|
|
|
bool active = in.readBool();
|
|
|
|
u32 flags = LoadParameterFlags(in);
|
2017-10-10 03:50:48 +00:00
|
|
|
float duration = in.readFloatBig();
|
|
|
|
float sfxDist = in.readFloatBig();
|
|
|
|
CCameraShakerComponent shakerX = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
|
|
|
|
CCameraShakerComponent shakerY = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
|
|
|
|
CCameraShakerComponent shakerZ = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
|
2017-03-18 05:12:27 +00:00
|
|
|
|
2017-10-10 03:50:48 +00:00
|
|
|
CCameraShakeData shakeData(duration, sfxDist, flags, sfxPos, shakerX, shakerY, shakerZ);
|
2017-03-18 05:12:27 +00:00
|
|
|
|
|
|
|
return new CScriptCameraShaker(mgr.AllocateUniqueId(), name, info, active, shakeData);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
if (!EnsurePropertyCount(propCount, 10, "ShadowProjector"))
|
|
|
|
return nullptr;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string name = mgr.HashInstanceName(in);
|
2017-01-04 04:08:30 +00:00
|
|
|
zeus::CVector3f position(zeus::CVector3f::ReadBig(in));
|
|
|
|
bool b1 = in.readBool();
|
|
|
|
float f1 = in.readFloatBig();
|
|
|
|
zeus::CVector3f vec2(zeus::CVector3f::ReadBig(in));
|
|
|
|
float f2 = in.readFloatBig();
|
|
|
|
float f3 = in.readFloatBig();
|
|
|
|
float f4 = in.readFloatBig();
|
|
|
|
bool b2 = in.readBool();
|
|
|
|
u32 w1 = in.readUint32Big();
|
2017-01-15 03:59:37 +00:00
|
|
|
return new CScriptShadowProjector(mgr.AllocateUniqueId(), name, info, zeus::CTransform::Translate(position), b1,
|
2017-01-04 04:08:30 +00:00
|
|
|
vec2, b2, f1, f2, f3, f4, w1);
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-02 15:26:29 +00:00
|
|
|
CEntity* ScriptLoader::LoadEnergyBall(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
2016-04-17 22:38:05 +00:00
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return nullptr;
|
2016-04-17 22:38:05 +00:00
|
|
|
}
|
|
|
|
}
|