Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde

This commit is contained in:
Jack Andersen 2019-07-19 18:29:06 -10:00
commit b4fe474de3
73 changed files with 1178 additions and 377 deletions

View File

@ -24,7 +24,7 @@
- strip -S -o URDE.app/Contents/MacOS/urde URDE.app/Contents/MacOS/urde
- strip -S -o URDE.app/Contents/MacOS/hecl URDE.app/Contents/MacOS/hecl
- strip -S -o URDE.app/Contents/MacOS/visigen URDE.app/Contents/MacOS/visigen
- (if [ "${URDE_MACOS_CODESIGN}" != "" ]; then codesign -s $URDE_MACOS_CODESIGN_UID --deep URDE.app; else echo "Unable to sign app bundle :("; fi);
- (if [ "${URDE_MACOS_CODESIGN_UID}" != "" ]; then codesign -s $URDE_MACOS_CODESIGN_UID --deep URDE.app; else echo "Unable to sign app bundle :("; fi);
only:
- release
- dev

2
.gitmodules vendored
View File

@ -33,7 +33,7 @@
url = https://github.com/Tencent/rapidjson.git
[submodule "NESEmulator/fixNES"]
path = NESEmulator/fixNES
url = https://github.com/Antidote/fixNES.git
url = https://github.com/FIX94/fixNES.git
[submodule "Editor/locale"]
path = Editor/locale
url = ../urde-translations.git

View File

@ -1,5 +1,8 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />

View File

@ -1,3 +1,3 @@
message(STATUS "32-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin'")
file(DOWNLOAD "https://axiodl.com/AssetNameMap32.dat"
file(DOWNLOAD "https://axiodl.com/files/AssetNameMap32.dat"
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=e1df648c04d4caaf0821266464c672e0c337b6f0)

View File

@ -1,3 +1,3 @@
message(STATUS "64-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin'")
file(DOWNLOAD "https://axiodl.com/AssetNameMap64.dat"
file(DOWNLOAD "https://axiodl.com/files/AssetNameMap64.dat"
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin SHOW_PROGRESS EXPECTED_HASH SHA1=335abe49d4848ddc7bb2d623acc76918365bc705)

View File

@ -124,8 +124,9 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
r.enumerate<atUint32>("memrelays", memRelays);
}
std::vector<MemRelayLink> memRelayLinks;
/* Bare minimum we'll need exactly the same number of links as relays */
std::vector<MemRelayLink> memRelayLinks(memRelays.size());
memRelayLinks.reserve(memRelays.size());
hecl::DirectoryEnumerator dEnum(area.path.getAbsolutePath(), hecl::DirectoryEnumerator::Mode::DirsSorted);
bool areaInit = false;
@ -256,13 +257,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
/* We must have a new relay, let's track it */
memRelayLinks.push_back(linkOut);
memRelays.push_back(memRelay.id);
} else /* Lets insert this in it's appropriate location, target order doesn't matter */
{
atUint32 idx = iter - memRelays.begin();
if (idx >= memRelayLinks.size())
} else {
memRelayLinks.push_back(linkOut);
else
memRelayLinks.insert(memRelayLinks.begin() + idx, linkOut);
}
}
}
@ -311,7 +307,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
}
/* Append Memory Relays */
mlvl.memRelayLinks.insert(mlvl.memRelayLinks.end(), memRelayLinks.begin(), memRelayLinks.end());
if (!memRelayLinks.empty())
mlvl.memRelayLinks.insert(mlvl.memRelayLinks.end(), memRelayLinks.begin(), memRelayLinks.end());
/* Cull duplicate area paths and add typed hash to list */
auto& conn = btok.getBlenderConnection();

View File

@ -12,6 +12,6 @@ struct AIJumpPoint : IScriptObject {
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown1;
Value<float> apex;
};
} // namespace DataSpec::DNAMP1

View File

@ -9,11 +9,11 @@ struct AIKeyframe : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<atUint32> unknown5;
Value<float> unknown6;
Value<atUint32> animationId;
Value<bool> looping;
Value<float> lifetime;
Value<bool> active;
Value<atUint32> fadeOut;
Value<float> totalPlayback;
};
} // namespace DataSpec::DNAMP1

View File

@ -12,10 +12,10 @@ struct ActorContraption : IScriptObject {
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> unknown1;
Value<atVec3f> scanOffset;
Value<float> unknown2;
Value<float> unknown3;
Value<atVec3f> collisionExtent;
Value<atVec3f> collisionOrigin;
Value<float> mass;
Value<float> zMomentum;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
AnimationParameters animationParameters;

View File

@ -11,8 +11,8 @@ struct ActorRotate : IScriptObject {
String<-1> name;
Value<atVec3f> rotationOffset;
Value<float> timeScale;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> updateActors;
Value<bool> updateOnCreation;
Value<bool> active;
};
} // namespace DataSpec::DNAMP1

View File

@ -10,15 +10,15 @@ struct AreaAttributes : IScriptObject {
AT_DECL_DNAV
enum class EWeatherType : atUint32 { None, Snow, Rain };
Value<atUint32> unknown1;
Value<atUint32> load; /* 0 causes the loader to bail and return null */
Value<bool> skyboxEnabled;
Value<EWeatherType> weather;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> envFxDensity;
Value<float> thermalHeat;
Value<float> xrayFogDistance;
Value<float> worldLightingLevel;
UniqueID32 skybox;
Value<atUint32> unknown6;
Value<atUint32> phazonType;
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(skybox, pathsOut);

View File

@ -17,11 +17,11 @@ struct AtomicAlpha : IScriptObject {
UniqueID32 wpsc;
UniqueID32 model;
DamageInfo damageInfo;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Value<float> bombDropDelay;
Value<float> bombReappearDelay;
Value<float> bombReappearTime;
Value<bool> invisible;
Value<bool> applyBeamAttraction;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);

View File

@ -11,11 +11,11 @@ struct BallTrigger : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<atVec3f> unknown5;
Value<bool> unknown6;
Value<bool> active;
Value<float> force;
Value<float> minAngle;
Value<float> maxDistance;
Value<atVec3f> forceAngle;
Value<bool> stopPlayer;
};
} // namespace DataSpec::DNAMP1

View File

@ -13,15 +13,15 @@ struct Camera : IScriptObject {
Value<atVec3f> orientation;
Value<bool> active;
Value<float> shotDuration;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Value<bool> unknown6;
Value<bool> unknown7;
Value<bool> lookAtPlayer;
Value<bool> outOfPlayerEye;
Value<bool> intoPlayerEye;
Value<bool> drawPlayer;
Value<bool> disableInput;
Value<bool> unknown9;
Value<bool> unknown;
Value<bool> finishCineSkip;
Value<float> fov;
Value<bool> unknown11;
Value<bool> unknown12;
Value<bool> checkFailsafe;
Value<bool> disableOutOfInto;
};
} // namespace DataSpec::DNAMP1

View File

@ -12,9 +12,9 @@ struct CameraPitchVolume : IScriptObject {
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<bool> active;
Value<float> upPitch;
Value<float> downPitch;
Value<float> scale;
};
} // namespace DataSpec::DNAMP1

View File

@ -12,7 +12,7 @@ struct CameraWaypoint : IScriptObject {
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown2;
Value<float> hFov;
Value<atUint32> unknown3;
};
} // namespace DataSpec::DNAMP1

View File

@ -9,9 +9,9 @@ struct Counter : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> startValue; // needs verification
Value<atUint32> initial;
Value<atUint32> maxValue;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> autoReset;
Value<bool> active;
};
} // namespace DataSpec::DNAMP1

View File

@ -11,11 +11,11 @@ struct CoverPoint : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<atUint32> unknown2;
Value<bool> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<bool> active;
Value<atUint32> flags;
Value<bool> crouch;
Value<float> horizontalAngle;
Value<float> verticleAngle;
Value<float> coverTime;
};
} // namespace DataSpec::DNAMP1

View File

@ -9,7 +9,7 @@ struct DockAreaChange : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
Value<atUint32> dockReference;
Value<bool> active;
};
} // namespace DataSpec::DNAMP1

View File

@ -11,13 +11,13 @@ struct ElectroMagneticPulse : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<bool> active;
Value<float> initialRadius;
Value<float> finalRadius;
Value<float> duration;
Value<float> interferenceDur;
Value<float> unknown6;
Value<float> unknown7;
Value<float> interferenceMag;
Value<float> unknown8;
UniqueID32 particle;

View File

@ -9,8 +9,8 @@ struct EnvFxDensityController : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown1;
Value<float> unknown2;
Value<atUint32> unknown3;
Value<bool> active;
Value<float> density;
Value<atUint32> maxDensityDeltaSpeed;
};
} // namespace DataSpec::DNAMP1

View File

@ -15,9 +15,9 @@ struct FlickerBat : IScriptObject {
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> collider;
Value<bool> startsHidden;
Value<bool> enableLineOfSight;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);

View File

@ -11,9 +11,9 @@ struct FogVolume : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<float> unknown1;
Value<float> flickerSpeed;
Value<float> unknown2;
Value<atVec4f> unkonwn3;
Value<bool> unknown4;
Value<atVec4f> fogColor;
Value<bool> active;
};
} // namespace DataSpec::DNAMP1

View File

@ -14,16 +14,16 @@ struct Geemer : IScriptObject {
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> advanceWpRadius;
Value<float> unknown2;
Value<float> unknown3;
Value<float> alignAngVel;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<atUint32> unknown8;
Value<atUint32> unknown9;
Value<atUint32> unknown10;
Value<float> playerObstructionMinDist;
Value<float> haltDelay;
Value<float> forwardMoveWeight;
Value<atUint32> haltSfx;
Value<atUint32> getUpSfx;
Value<atUint32> crouchSfx;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);

View File

@ -14,14 +14,14 @@ struct IceZoomer : IScriptObject {
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> advanceWpRadius;
Value<float> unknown2;
Value<float> unknown3;
Value<float> alignAngleVel;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<atUint32> unknown7;
Value<atUint32> unknown8;
Value<float> playerObstructionMinDist;
Value<float> moveForwardWeight;
UniqueID32 modelRes;
UniqueID32 skinRes;
DamageVulnerability damageVulnerabilty;
Value<float> unknown9;
@ -37,6 +37,8 @@ struct IceZoomer : IScriptObject {
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
g_curSpec->flattenDependencies(modelRes, pathsOut);
g_curSpec->flattenDependencies(skinRes, pathsOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }

View File

@ -9,7 +9,7 @@ struct MemoryRelay : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown;
Value<bool> active;
Value<bool> skipSendActive;
};
} // namespace DataSpec::DNAMP1

View File

@ -15,11 +15,11 @@ struct MetareeAlpha : IScriptObject {
PatternedInfo patternedInfo;
ActorParameters actorParameters;
DamageInfo damageInfo;
Value<float> unknown1;
Value<atVec3f> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> dropHeight;
Value<atVec3f> offset;
Value<float> attackSpeed;
Value<float> delay;
Value<float> unknown5; // Appears to be unused
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);

View File

@ -11,8 +11,8 @@ struct PlayerHint : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<bool> active;
PlayerHintParameters playerHintParameters;
Value<atUint32> unknown2;
Value<atUint32> priority;
};
} // namespace DataSpec::DNAMP1

View File

@ -9,11 +9,11 @@ struct PlayerStateChange : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown;
Value<bool> active;
Value<atUint32> item;
Value<atUint32> unknown2;
Value<atUint32> unknown3;
Value<atUint32> unknown4;
Value<atUint32> unknown5;
Value<atUint32> itemCount;
Value<atUint32> itemCapacity;
Value<atUint32> control;
Value<atUint32> controlCommandOption;
};
} // namespace DataSpec::DNAMP1

View File

@ -11,9 +11,9 @@ struct PointOfInterest : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<bool> active;
ScannableParameters scannableParameters;
Value<float> unknown2;
Value<float> pointSize;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const { scannableParameters.nameIDs(pakRouter, name + "_scanp"); }

View File

@ -11,6 +11,6 @@ struct Repulsor : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<bool> active;
Value<float> unknown;
Value<float> radius;
};
} // namespace DataSpec::DNAMP1

View File

@ -10,7 +10,7 @@ struct Ripple : IScriptObject {
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<bool> unknown1;
Value<float> unknown2;
Value<bool> active;
Value<float> mag;
};
} // namespace DataSpec::DNAMP1

View File

@ -14,11 +14,11 @@ struct SpankWeed : IScriptObject {
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<bool> unused;
Value<float> maxDetectionRange;
Value<float> maxHearingrange;
Value<float> maxSightRange;
Value<float> hideTime;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);

View File

@ -31,7 +31,7 @@ struct SpawnPoint : IScriptObject {
Value<atUint32> combatVisor;
Value<atUint32> boostBall;
Value<atUint32> spiderBall;
Value<atUint32> powerSuit; // verification needed
Value<atUint32> powerSuit;
Value<atUint32> gravitySuit;
Value<atUint32> variaSuit;
Value<atUint32> phazonSuit;

View File

@ -11,7 +11,7 @@ struct SpiderBallWaypoint : IScriptObject {
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<bool> active;
Value<atUint32> unknown2;
};
} // namespace DataSpec::DNAMP1

View File

@ -9,8 +9,8 @@ struct Switch : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> active;
Value<bool> opened;
Value<bool> closeOnOpened;
};
} // namespace DataSpec::DNAMP1

View File

@ -6,26 +6,26 @@ template <class Op>
void WorldTeleporter::Enumerate(typename Op::StreamT& s) {
IScriptObject::Enumerate<Op>(s);
Do<Op>({"name"}, name, s);
Do<Op>({"unknown1"}, unknown1, s);
Do<Op>({"active"}, active, s);
Do<Op>({"mlvl"}, mlvl, s);
Do<Op>({"mrea"}, mrea, s);
Do<Op>({"animationParameters"}, animationParameters, s);
Do<Op>({"unknown2"}, unknown2, s);
Do<Op>({"model1"}, model1, s);
Do<Op>({"unknown3"}, unknown3, s);
Do<Op>({"model2"}, model2, s);
Do<Op>({"unknown4"}, unknown4, s);
Do<Op>({"unknown5"}, unknown5, s);
Do<Op>({"soundID"}, soundID, s);
Do<Op>({"unknown6"}, unknown6, s);
Do<Op>({"unknown7"}, unknown7, s);
Do<Op>({"unknown8"}, unknown8, s);
Do<Op>({"playerScale"}, playerScale, s);
Do<Op>({"platformModel"}, platformModel, s);
Do<Op>({"platformScale"}, platformScale, s);
Do<Op>({"blackgroundModel"}, backgroundModel, s);
Do<Op>({"backgroundScale"}, backgroundScale, s);
Do<Op>({"upElevator"}, upElevator, s);
Do<Op>({"elevatorSound"}, elevatorSound, s);
Do<Op>({"volume"}, volume, s);
Do<Op>({"panning"}, panning, s);
Do<Op>({"showText"}, showText, s);
Do<Op>({"font"}, font, s);
Do<Op>({"strg"}, strg, s);
Do<Op>({"unknown9"}, unknown9, s);
Do<Op>({"unknown10"}, unknown10, s);
Do<Op>({"unknown11"}, unknown11, s);
Do<Op>({"unknown12"}, unknown12, s);
Do<Op>({"fadeWhite"}, fadeWhite, s);
Do<Op>({"charFadeInTime"}, charFadeInTime, s);
Do<Op>({"charsPerSecond"}, charsPerSecond, s);
Do<Op>({"showDelay"}, showDelay, s);
if (propertyCount == 26) {
Do<Op>({"audioStream"}, audioStream, s);

View File

@ -10,26 +10,26 @@ struct WorldTeleporter : IScriptObject {
AT_DECL_EXPLICIT_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown1;
Value<bool> active;
UniqueID32 mlvl;
UniqueID32 mrea;
AnimationParameters animationParameters;
Value<atVec3f> unknown2;
UniqueID32 model1;
Value<atVec3f> unknown3;
UniqueID32 model2;
Value<atVec3f> unknown4;
Value<bool> unknown5;
Value<atUint32> soundID; // needs verifcation
Value<atUint32> unknown6;
Value<atUint32> unknown7;
Value<bool> unknown8;
Value<atVec3f> playerScale;
UniqueID32 platformModel;
Value<atVec3f> platformScale;
UniqueID32 backgroundModel;
Value<atVec3f> backgroundScale;
Value<bool> upElevator;
Value<atUint32> elevatorSound; // needs verifcation
Value<atUint32> volume;
Value<atUint32> panning;
Value<bool> showText;
UniqueID32 font;
UniqueID32 strg;
Value<bool> unknown9;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<bool> fadeWhite;
Value<float> charFadeInTime;
Value<float> charsPerSecond;
Value<float> showDelay;
/* Trilogy additions (property count 26) */
String<-1> audioStream;
@ -39,12 +39,12 @@ struct WorldTeleporter : IScriptObject {
Value<float> unknown16;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model1.isValid()) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model1);
if (platformModel.isValid()) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(platformModel);
ent->name = name + "_model1";
}
if (model2.isValid()) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model2);
if (backgroundModel.isValid()) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(backgroundModel);
ent->name = name + "_model2";
}
if (strg.isValid()) {
@ -54,8 +54,8 @@ struct WorldTeleporter : IScriptObject {
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model1, pathsOut);
g_curSpec->flattenDependencies(model2, pathsOut);
g_curSpec->flattenDependencies(platformModel, pathsOut);
g_curSpec->flattenDependencies(backgroundModel, pathsOut);
g_curSpec->flattenDependencies(strg, pathsOut);
}
};

View File

@ -51,7 +51,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = /home/antidote/Projects/urde/Editor/platforms/freedesktop/128x128/apps/urde.png
PROJECT_LOGO = ./Editor/platforms/freedesktop/128x128/apps/urde.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is

View File

@ -1,3 +1,3 @@
message(STATUS "Inkscape not found; downloading icons to '${CMAKE_CURRENT_BINARY_DIR}/icons.bin'")
file(DOWNLOAD "https://axiodl.com/icons.bin"
file(DOWNLOAD "https://axiodl.com/files/icons.bin"
${CMAKE_CURRENT_BINARY_DIR}/icons.bin SHOW_PROGRESS EXPECTED_HASH SHA1=412baa3b12163a89b306ebfef2a395762105a8d4)

@ -1 +1 @@
Subproject commit 281e9aa1e7b6b3bbe8d499b720484fb547ce6ebd
Subproject commit f97b61fd06e34c6fc310eb93505671895843ae9c

View File

@ -19,7 +19,7 @@ Everything else is much too experimental to make portable/stable release builds
* [CMake 3.13+](https://cmake.org)
* [Python 3+](https://python.org)
* LLVM development package *(headers and libs)*
* [Specialized Windows Package](https://axiodl.com/LLVM-9.0.0svn-win64.exe)
* [Specialized Windows Package](https://axiodl.com/files/LLVM-9.0.0svn-win64.exe)
* [macOS Package](http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz)
* **[Windows]** [Visual Studio 2017/2019 and Windows SDK](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx)
* **[macOS]** [Xcode Tools](https://developer.apple.com/xcode/download/)

View File

@ -188,25 +188,22 @@ bool CAnimData::IsAdditiveAnimation(s32 idx) const {
bool CAnimData::IsAdditiveAnimationAdded(s32 idx) const {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
auto search = std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
return search != x434_additiveAnims.cend();
}
const std::shared_ptr<CAnimTreeNode>& CAnimData::GetAdditiveAnimationTree(s32 idx) const {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
auto search = std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
return search->second.GetAnim();
}
bool CAnimData::IsAdditiveAnimationActive(s32 idx) const {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
auto search = std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
if (search == x434_additiveAnims.cend())
return false;
return search->second.IsActive();
@ -214,11 +211,9 @@ bool CAnimData::IsAdditiveAnimationActive(s32 idx) const {
void CAnimData::DelAdditiveAnimation(s32 idx) {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.begin(), x434_additiveAnims.end(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
if (search != x434_additiveAnims.cend() &&
search->second.GetPhase() != EAdditivePlaybackPhase::FadingOut &&
auto search = std::find_if(x434_additiveAnims.begin(), x434_additiveAnims.end(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
if (search != x434_additiveAnims.cend() && search->second.GetPhase() != EAdditivePlaybackPhase::FadingOut &&
search->second.GetPhase() != EAdditivePlaybackPhase::FadedOut) {
search->second.FadeOut();
}
@ -226,26 +221,25 @@ void CAnimData::DelAdditiveAnimation(s32 idx) {
void CAnimData::AddAdditiveAnimation(s32 idx, float weight, bool active, bool fadeOut) {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.begin(), x434_additiveAnims.end(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
auto search = std::find_if(x434_additiveAnims.begin(), x434_additiveAnims.end(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
if (search != x434_additiveAnims.cend()) {
search->second.SetActive(active);
search->second.SetWeight(weight);
search->second.SetNeedsFadeOut(!search->second.IsActive() && fadeOut);
} else {
std::shared_ptr<CAnimTreeNode> node =
GetAnimationManager()->GetAnimationTree(animIdx, CMetaAnimTreeBuildOrders::NoSpecialOrders());
GetAnimationManager()->GetAnimationTree(animIdx, CMetaAnimTreeBuildOrders::NoSpecialOrders());
const CAdditiveAnimationInfo& info = x0_charFactory->FindAdditiveInfo(animIdx);
x434_additiveAnims.emplace_back(std::make_pair(animIdx, CAdditiveAnimPlayback(node, weight, active, info, fadeOut)));
x434_additiveAnims.emplace_back(
std::make_pair(animIdx, CAdditiveAnimPlayback(node, weight, active, info, fadeOut)));
}
}
float CAnimData::GetAdditiveAnimationWeight(s32 idx) const {
s32 animIdx = xc_charInfo.GetAnimationIndex(idx);
auto search =
std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
auto search = std::find_if(x434_additiveAnims.cbegin(), x434_additiveAnims.cend(),
[animIdx](const auto& pair) { return pair.first == animIdx; });
if (search != x434_additiveAnims.cend())
return search->second.GetTargetWeight();
return 0.f;
@ -541,15 +535,13 @@ void CAnimData::RecalcPoseBuilder(const CCharAnimTime* time) {
void CAnimData::RenderAuxiliary(const zeus::CFrustum& frustum) const { x120_particleDB.AddToRendererClipped(frustum); }
void CAnimData::Render(CSkinnedModel& model, const CModelFlags& drawFlags,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes) {
SetupRender(model, drawFlags, morphEffect, morphMagnitudes);
DrawSkinnedModel(model, drawFlags);
}
void CAnimData::SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes) {
if (!x220_30_poseBuilt) {
x2fc_poseBuilder.BuildNoScale(x224_pose);
x220_30_poseBuilt = true;
@ -798,8 +790,7 @@ void CAnimData::SetInfraModel(const TLockedToken<CModel>& model, const TLockedTo
}
void CAnimData::PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes) {
model.Calculate(pose, drawFlags, morphEffect, morphMagnitudes);
}

View File

@ -2,9 +2,12 @@
#include "CAnimSourceReader.hpp"
namespace urde {
CInt32POINode::CInt32POINode()
: CPOINode("root", EPOIType::EmptyInt32, CCharAnimTime(), -1, false, 1.f, -1, 0), x38_val(0), x3c_locatorName("root") {}
: CInt32POINode(""sv, EPOIType::EmptyInt32, CCharAnimTime(), -1, false, 1.f, -1, 0, 0, "root"sv) {}
CInt32POINode::CInt32POINode(std::string_view name, EPOIType type, const CCharAnimTime& time, s32 index, bool unique, float weight, s32 charIndex,
s32 flags, s32 val, std::string_view locator)
: CPOINode(name, type, time, index, unique, weight, charIndex, flags), x38_val(val), x3c_locatorName(locator) {}
CInt32POINode::CInt32POINode(CInputStream& in)
: CPOINode(in), x38_val(in.readUint32Big()), x3c_locatorName(in.readString()) {}

View File

@ -11,6 +11,7 @@ class CInt32POINode : public CPOINode {
public:
CInt32POINode();
CInt32POINode(std::string_view, EPOIType, const CCharAnimTime&, s32, bool, float, s32, s32, s32, std::string_view);
CInt32POINode(CInputStream& in);
s32 GetValue() const { return x38_val; }
std::string_view GetLocatorName() const { return x3c_locatorName; }

View File

@ -64,7 +64,7 @@ enum class EHurledState {
Seven
};
enum class EFallState { Invalid = -1, Zero };
enum class EFallState { Invalid = -1, Zero, One };
enum class EReactionType { Invalid = -1, Zero, One, Two, Three };
@ -77,8 +77,18 @@ enum class EJumpState { Invalid = -1, IntoJump, AmbushJump, Loop, OutOfJump, Wal
enum class EStepDirection { Invalid = -1, Forward = 0, Backward = 1, Left = 2, Right = 3, Up = 4, Down = 5 };
enum class EStepType { Normal = 0, Dodge = 1, BreakDodge = 2, RollDodge = 3 };
enum class ESeverity { Invalid = -1, Zero = 0, One = 1, Two = 2, Three, Four, Seven = 7, Eight = 8 };
enum class ESeverity {
Invalid = -1,
Zero = 0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8
};
enum class EGetupType { Invalid = -1, Zero = 0, One = 1, Two = 2 };

View File

@ -197,7 +197,7 @@ public:
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt);
float GetGravityConstant() const { return 10.f * 24.525f; }
float GetGravityConstant() const { return 10.f * CPhysicsActor::GravityConstant(); }
void SetPathFindMode(EPathFindMode mode) { x8b4_pathFindMode = mode; }

View File

@ -982,6 +982,6 @@ void CBeetle::Shock(CStateManager& mgr, float duration, float damage) {
CPathFindSearch* CBeetle::GetSearchPath() { return &x5fc_pathFindSearch; }
float CBeetle::GetGravityConstant() const { return 4.f * 24.525f; }
float CBeetle::GetGravityConstant() const { return 4.f * CPhysicsActor::GravityConstant(); }
} // namespace urde::MP1

View File

@ -171,7 +171,7 @@ bool CFireFlea::CheckNearWater(const CStateManager& mgr, const zeus::CVector3f&
mgr.BuildNearList(nearList, GetTranslation(), dir, 2.f, CMaterialFilter::skPassEverything, nullptr);
for (TUniqueId id : nearList) {
if (TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(id))
if (TCastToConstPtr<CScriptWater>(mgr.GetObjectById(id)))
return true;
}

View File

@ -76,7 +76,21 @@ CFlaahgra::CFlaahgra(TUniqueId uid, std::string_view name, const CEntityInfo& in
, x820_(xf.origin)
, x8a0_(xf.frontVector())
, x8ac_(animRes) {
x8e4_24_loaded = false;
x8e4_25_loading = false;
x8e4_26_ = false;
x8e4_27_ = false;
x8e4_28_ = false;
x8e4_29_getup = false;
x8e4_30_ = false;
x8e4_31_ = false;
x8e5_24_ = false;
x8e5_25_ = false;
x8e5_26_ = false;
x8e5_27_ = false;
x8e5_28_ = false;
x8e5_29_ = true;
x8e5_30_ = false;
x6dc_.Token().Lock();
x704_.Token().Lock();
x7dc_.SetDamage(0.5f * x7dc_.GetDamage());
@ -115,7 +129,7 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
}
case EScriptObjectMessage::Activate: {
GatherAssets(mgr);
if (x8e5_25_)
if (x8e5_27_)
break;
SetupCollisionManagers(mgr);
@ -150,10 +164,10 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
if (x7a8_ == 4)
contactDamage = x7dc_;
if (sub801ae670())
if (!sub801ae670())
contactDamage.SetDamage(0.5f * contactDamage.GetDamage());
if (x788_ == 2)
if (x788_ >= 2)
contactDamage.SetDamage(1.33f * contactDamage.GetDamage());
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), contactDamage,
@ -266,6 +280,7 @@ void CFlaahgra::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E
return;
}
case EUserEventType::BeginAction: {
printf("BeginAction\n");
x8e4_26_ = true;
x7c4_ = GetEndActionTime();
break;
@ -504,21 +519,26 @@ void CFlaahgra::sub801ae980(CStateManager& mgr) {
HealthInfo(mgr)->SetHP(HealthInfo(mgr)->GetHP() - x56c_.x8_);
x7d4_ = x56c_.xc_;
x8e4_29_getup = true;
x7d8_ = 0.f;
x430_damageColor = skUnkColor;
++x788_;
}
void CFlaahgra::sub801ade80() {
x894_ = (x7ac_ ? -GetTransform().basis[0] : GetTransform().basis[0]);
x894_ = (x7ac_ == 0 ? -GetTransform().basis[0] : GetTransform().basis[0]);
const rstl::reserved_vector<zeus::CVector3f, 4>& vec = (x7ac_ ? x82c_ : x860_);
const rstl::reserved_vector<zeus::CVector3f, 4>& vec = (x7ac_ == 0 ? x860_ : x82c_);
float curDist = FLT_MIN;
for (const zeus::CVector3f& v : vec) {
if (v.magSquared() < 0.f)
continue;
if (GetTransform().basis[1].dot(v) > FLT_MIN)
float dist = GetTransform().basis[1].dot(v);
if (dist > curDist) {
curDist = dist;
x894_ = v;
}
}
}
@ -539,8 +559,7 @@ bool CFlaahgra::ShouldAttack(CStateManager& mgr, float) {
(x7cc_ > 0.f || player.GetVelocity().magSquared() < 25.f))
return false;
return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), diff) > zeus::degToRad(45.f);
return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), diff) < zeus::degToRad(45.f);
}
void CFlaahgra::UpdateHeadDamageVulnerability(CStateManager& mgr, bool b) {
@ -567,6 +586,7 @@ void CFlaahgra::FadeOut(CStateManager& mgr, EStateMsg msg, float) {
x7a4_sphereCollision->SetActive(mgr, true);
x79c_leftArmCollision->SetActive(mgr, true);
x7a0_rightArmCollision->SetActive(mgr, true);
x784_ = x780_;
x81c_ = GetModelData()->GetScale().z();
UpdateScale(1.f, x81c_, x56c_.x4_);
x8e4_26_ = false;
@ -601,7 +621,7 @@ void CFlaahgra::UpdateSmallScaleReGrowth(float dt) {
if (!x8e4_29_getup || x7d8_ > 6.f)
return;
x430_damageColor = zeus::CColor::lerp(skUnkColor, zeus::skBlack, (M_PIF * std::cos(x7d8_)));
x430_damageColor = zeus::CColor::lerp(skUnkColor, zeus::skBlack, std::round(std::fabs(M_PIF * std::cos(x7d8_))));
TakeDamage({}, 0.f);
x7d8_ += dt;
}
@ -718,7 +738,7 @@ void CFlaahgra::GetUp(CStateManager& mgr, EStateMsg msg, float) {
SetCollisionActorBounds(mgr, x79c_leftArmCollision, skUnkVec1);
SetCollisionActorBounds(mgr, x7a0_rightArmCollision, skUnkVec1);
} else {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType(x8e4_29_getup)));
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType(!x8e4_29_getup)));
}
} else if (x568_ == 2 &&
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup) {
@ -777,7 +797,8 @@ void CFlaahgra::SetCollisionActorBounds(CStateManager& mgr, const std::unique_pt
}
}
void CFlaahgra::UpdateScale(float t, float min, float max) {
ModelData()->SetScale(zeus::skOne3f * (t * (max - min) + min));
float scale = (t * (max - min) + min);
ModelData()->SetScale(zeus::skOne3f * scale);
}
float CFlaahgra::GetEndActionTime() {
@ -838,7 +859,7 @@ void CFlaahgra::RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec) {
}
void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
static const pas::ESeverity kSeverities[2] {pas::ESeverity::Zero, pas::ESeverity::One};
static const pas::ESeverity kSeverities[2]{pas::ESeverity::Zero, pas::ESeverity::One};
if (msg == EStateMsg::Activate) {
x568_ = 0;
x7d4_ = 0.f;
@ -877,11 +898,8 @@ void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
void CFlaahgra::Dead(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
bool r29 = true;
if (x450_bodyController->GetFallState() == pas::EFallState::Zero &&
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall)
r29 = false;
x568_ = r29;
x568_ = (x450_bodyController->GetFallState() != pas::EFallState::Zero ||
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall);
SendScriptMsgs(EScriptObjectState::CloseIn, mgr, EScriptObjectMessage::None);
} else if (msg == EStateMsg::Update) {
if (x568_ == 0) {
@ -915,9 +933,8 @@ static const pas::ESeverity kStates1[5]{pas::ESeverity::Invalid, pas::ESeverity:
pas::ESeverity::Two, pas::ESeverity::Invalid};
void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
static const pas::ESeverity kSeverity[5] {
pas::ESeverity::Three, pas::ESeverity::Four, pas::ESeverity::One, pas::ESeverity::Zero, pas::ESeverity::Invalid
};
static const pas::ESeverity kSeverity[5]{pas::ESeverity::Three, pas::ESeverity::Four, pas::ESeverity::One,
pas::ESeverity::Zero, pas::ESeverity::Invalid};
if (msg == EStateMsg::Activate) {
x568_ = 0;
@ -1016,6 +1033,7 @@ void CFlaahgra::Suck(CStateManager& mgr, EStateMsg msg, float) {
x568_ = 0;
x8e4_26_ = false;
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Two));
x784_ = x780_;
} else if (msg == EStateMsg::Update) {
if (x568_ == 0) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Getup)
@ -1026,7 +1044,7 @@ void CFlaahgra::Suck(CStateManager& mgr, EStateMsg msg, float) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup)
x568_ = 4;
else if (x8e4_26_) {
UpdateScale(x7c4_ > 0.f ? 1.f - (GetEndActionTime() / x7c4_) : 1.f, x56c_.x4_, x56c_.x0_);
UpdateScale(x7c4_ > 0.0f ? 1.f - (GetEndActionTime() / x7c4_) : 1.f, x56c_.x4_, x56c_.x0_);
}
}
@ -1037,8 +1055,44 @@ void CFlaahgra::Suck(CStateManager& mgr, EStateMsg msg, float) {
x7a0_rightArmCollision->SetActive(mgr, false);
}
}
void CFlaahgra::ProjectileAttack(CStateManager&, EStateMsg, float) {
void CFlaahgra::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
x568_ = 0;
SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None);
} else if (msg == EStateMsg::Update) {
if (x568_ == 0) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::ProjectileAttack) {
x568_ = 2;
} else {
x7b4_ = 3;
pas::ESeverity severity;
if (x8e4_31_) {
x7b4_ = 2;
severity = pas::ESeverity::Six;
} else if (mgr.GetPlayer().GetVelocity().magSquared() > 100.f) {
if (mgr.GetPlayer().GetTransform().basis[0].magSquared() < 0.f) {
x7b4_ = 1;
severity = pas::ESeverity::Four;
x72c_ = 0;
} else {
severity = pas::ESeverity::Three;
x7b4_ = x72c_ = 0;
}
} else {
severity = pas::ESeverity::Seven;
}
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCProjectileAttackCmd(severity, mgr.GetPlayer().GetTranslation(), false));
}
} else if (x568_ == 2) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
x568_ = 4;
} else {
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
}
}
}
}
void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
static pas::ESeverity severities[2]{pas::ESeverity::Eight, pas::ESeverity::Seven};
@ -1054,7 +1108,7 @@ void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
else
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(severities[x7b0_]));
} else if (x568_ == 1) {
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(x77c_)) {
if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(x77c_)) {
zeus::CVector3f direction = wp->GetTranslation() - GetTranslation();
if (zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), direction.toVec2f()) >
zeus::degToRad(15.f) &&
@ -1069,7 +1123,7 @@ void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
} else if (x568_ == 2) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
x568_ = 4;
else if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(x77c_)) {
else if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(x77c_)) {
x450_bodyController->GetCommandMgr().SetTargetVector(wp->GetTranslation() - GetTranslation());
}
}
@ -1083,9 +1137,28 @@ void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
x7b0_ ^= 1;
}
}
void CFlaahgra::SpecialAttack(CStateManager&, EStateMsg, float) {}
void CFlaahgra::SpecialAttack(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
x568_ = 0;
x8e5_24_ = false;
x7b4_ = 3;
SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None);
} else if (msg == EStateMsg::Update) {
if (x568_ == 0) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::ProjectileAttack) {
x568_ = 2;
x8e4_30_ = true;
} else {
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCProjectileAttackCmd(pas::ESeverity::Eight, mgr.GetPlayer().GetTranslation(), false));
}
} else if (x568_ == 2) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {}
}
}
}
bool CFlaahgra::CoverCheck(CStateManager& mgr, float) {
if (x7f8_ < 0 && x7bc_ > 0.f)
if (x7f8_ <= 0 && x7bc_ > 0.f)
return false;
for (TUniqueId id : x770_mirrorWaypoints) {
@ -1103,11 +1176,10 @@ TUniqueId CFlaahgra::GetMirrorNearestPlayer(CStateManager& mgr) {
TUniqueId nearId = kInvalidUniqueId;
for (TUniqueId id : x770_mirrorWaypoints) {
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(id)) {
if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(id)) {
if (!wp->GetActive())
continue;
if ((wp->GetTranslation() - playerPos).magSquared() > -1.f)
nearId = id;
}
@ -1116,22 +1188,37 @@ TUniqueId CFlaahgra::GetMirrorNearestPlayer(CStateManager& mgr) {
return nearId;
}
void CFlaahgra::Enraged(CStateManager&, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
x568_ = 0;
} else if (msg == EStateMsg::Update) {
if (x568_ == 0) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Taunt)
x568_ = 2;
else
x450_bodyController->GetCommandMgr().DeliverCmd(CBCTauntCmd(pas::ETauntType::Zero));
} else if (x568_ == 2 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Taunt)
x568_ = 4;
} else if (msg == EStateMsg::Deactivate) {
x7d0_ = 0.f;
}
}
CFlaahgraPlants::CFlaahgraPlants(const TToken<CGenDescription>& genDesc, const CActorParameters& actParms,
TUniqueId uid, TAreaId aId, TUniqueId owner, const zeus::CTransform& xf,
const CDamageInfo& dInfo, const zeus::CVector3f& extents)
: CActor(uid, true, "Flaahgra Plants"sv, CEntityInfo(aId, NullConnectionList), xf, CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Projectile), actParms, kInvalidUniqueId)
, xe8_elementGen(new CElementGen(genDesc))
, xf0_ownerId(owner)
, x130_obbox(xf, extents) {
xe8_elementGen->SetGlobalOrientation(xf.getRotation());
xe8_elementGen->SetGlobalTranslation(xf.origin);
: CActor(uid, true, "Flaahgra Plants"sv, CEntityInfo(aId, NullConnectionList), xf, CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Projectile), actParms, kInvalidUniqueId)
, xe8_elementGen(new CElementGen(genDesc))
, xf0_ownerId(owner)
, x130_obbox(xf, extents) {
xe8_elementGen->SetOrientation(xf.getRotation());
xe8_elementGen->SetTranslation(xf.origin);
xe8_elementGen->SetModelsUseLights(true);
x110_aabox = {x130_obbox.calculateAABox(xf)};
}
void CFlaahgraPlants::Accept(IVisitor& visitor) {
visitor.Visit(this);
}
void CFlaahgraPlants::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CFlaahgraPlants::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
CActor::AcceptScriptMsg(msg, uid, mgr);

View File

@ -200,7 +200,7 @@ public:
bool AnimOver(CStateManager&, float) { return x568_ == 4; }
bool AIStage(CStateManager&, float arg) { return x780_ == u32(arg); }
bool HitSomething(CStateManager&, float arg) { return x7d0_ > 0.f; }
bool OffLine(CStateManager&, float) { return (!x8e5_29_ && !x8e5_28_); }
bool OffLine(CStateManager&, float) { return (x8e5_29_ && x8e5_28_); }
bool ShouldTurn(CStateManager&, float);
bool ShouldAttack(CStateManager&, float);
bool BreakAttack(CStateManager&, float) { return x7d4_ >= x56c_.xc_ && !x8e4_29_getup; }
@ -223,6 +223,7 @@ public:
void ProjectileAttack(CStateManager&, EStateMsg, float);
void Cover(CStateManager&, EStateMsg, float);
void SpecialAttack(CStateManager&, EStateMsg, float);
void Enraged(CStateManager&, EStateMsg, float);
};
}

View File

@ -10,15 +10,16 @@ namespace urde::MP1 {
CFlickerBat::CFlickerBat(TUniqueId uid, std::string_view name, CPatterned::EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
EColliderType colType, bool b1, const CActorParameters& actParms, bool b2)
EColliderType colType, bool startsHidden, const CActorParameters& actParms,
bool enableLineOfSight)
: CPatterned(ECharacter::FlickerBat, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small)
, x574_state(EFlickerBatState(b1))
, x574_state(EFlickerBatState(startsHidden))
, x580_24_wasInXray(false)
, x580_25_heardShot(false)
, x580_26_inLOS(false)
, x580_27_enableLOSCheck(b2) {
SetupPlayerCollision(b1);
, x580_27_enableLOSCheck(enableLineOfSight) {
SetupPlayerCollision(startsHidden);
x3d8_xDamageThreshold = 0.f;
x402_27_noXrayModel = false;
}

View File

@ -17,11 +17,11 @@
namespace urde::MP1 {
const float CParasite::flt_805A8FB0 = 2.f * std::sqrt(2.5f / 24.525002f);
const float CParasite::skAttackVelocity = 15.f / 2.f * (std::sqrt(2.5f / 24.525002f));
const float CParasite::flt_805A8FB0 = 2.f * std::sqrt(2.5f / CPhysicsActor::GravityConstant());
const float CParasite::skAttackVelocity = 15.f / 2.f * (std::sqrt(2.5f / CPhysicsActor::GravityConstant()));
short CParasite::word_805A8FC0 = 0;
const float CParasite::flt_805A8FB8 = 2.f * std::sqrt(2.5f / 24.525002f);
const float CParasite::skRetreatVelocity = 3.f / 2.f * std::sqrt(2.5f / 24.525002f);
const float CParasite::flt_805A8FB8 = 2.f * std::sqrt(2.5f / CPhysicsActor::GravityConstant());
const float CParasite::skRetreatVelocity = 3.f / 2.f * std::sqrt(2.5f / CPhysicsActor::GravityConstant());
CParasite::CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, EBodyType bodyType,

View File

@ -142,7 +142,7 @@ void CPuddleToadGamma::ShootPlayer(CStateManager& mgr, float speed) {
for (TUniqueId id : nearList) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(id)) {
bomb->SetVelocityWR((mgr.GetActiveRandom()->Float() * 5.f + 20.f) * shootDir);
bomb->SetConstantAccelerationWR({0.f, 0.f, -24.525f});
bomb->SetConstantAccelerationWR({0.f, 0.f, -CPhysicsActor::GravityConstant()});
}
}
}

View File

@ -2,13 +2,37 @@
#include "CStateManager.hpp"
#include "World/CWorld.hpp"
#include "World/CGameArea.hpp"
#include "World/CPatternedInfo.hpp"
#include "World/CPlayer.hpp"
#include "Weapon/CBomb.hpp"
#include "TCastTo.hpp"
namespace urde::MP1 {
const CDamageVulnerability CTryclops::skVulnerabilities = CDamageVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::Two);
CTryclops::CTryclops(urde::TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
urde::CModelData&& mData, const urde::CPatternedInfo& pInfo,
const urde::CActorParameters& actParms, float, float, float, float)
const urde::CActorParameters& actParms, float f1, float f2, float f3, float f4)
: CPatterned(ECharacter::Tryclops, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Small) {}
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Small)
, x568_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f)
, x67c_(f1)
, x680_(std::cos(zeus::degToRad(0.5f * f2)))
, x684_(f3)
, x688_launchSpeed(f4)
, x698_24_(false)
, x698_25_(false)
, x698_26_(false)
, x698_27_dizzy(false) {
CreateShadow(false);
MakeThermalColdAndHot();
x460_knockBackController.SetAutoResetImpulse(false);
x328_30_lookAtDeathDir = false;
}
void CTryclops::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
CPatterned::AcceptScriptMsg(msg, uid, mgr);
@ -16,7 +40,568 @@ void CTryclops::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
if (msg == EScriptObjectMessage::Registered) {
x450_bodyController->Activate(mgr);
} else if (msg == EScriptObjectMessage::InitializedInArea) {
//x568_pathFindSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
x568_pathFindSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
}
}
void CTryclops::Think(float dt, CStateManager& mgr) {
CPatterned::Think(dt, mgr);
if (x400_25_alive && x68c_ > 0.f)
x68c_ -= dt;
if (mgr.GetPlayer().GetAttachedActor() != GetUniqueId() || x698_27_dizzy)
return;
x698_27_dizzy = (mgr.GetPlayer().GetAttachedActorStruggle() == 1.f && sub8025dbd0(mgr));
}
void CTryclops::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& poi, EUserEventType type, float dt) {
switch (type) {
case EUserEventType::Projectile:
if (x694_bombId == kInvalidUniqueId) {
LaunchPlayer(mgr, GetLctrTransform(poi.GetLocatorName()), (x698_27_dizzy ? 5.f : x688_launchSpeed));
} else {
DragBomb(mgr, GetLctrTransform(poi.GetLocatorName()));
}
return;
default:
break;
}
CPatterned::DoUserAnimEvent(mgr, poi, type, dt);
}
void CTryclops::Death(CStateManager& mgr, const zeus::CVector3f& vec, EScriptObjectState state) {
if (x400_25_alive) {
CPlayer& player = mgr.GetPlayer();
if (player.GetAttachedActor() == GetUniqueId()) {
player.SetLeaveMorphBallAllowed(true);
player.AddMaterial(EMaterialTypes::Solid, mgr);
player.DetachActorFromPlayer();
} else if (x694_bombId != kInvalidUniqueId) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
bomb->SetFuseDisabled(false);
bomb->SetIsBeingDragged(false);
}
x694_bombId = kInvalidUniqueId;
}
}
CPatterned::Death(mgr, vec, state);
}
void CTryclops::Patrol(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::Patrol(mgr, msg, arg);
if (msg == EStateMsg::Activate) {
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
} else if (msg == EStateMsg::Update) {
ApplySeparation(mgr);
}
}
void CTryclops::PathFind(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::PathFind(mgr, msg, arg);
zeus::CVector3f front = GetTransform().basis[1];
if (front.dot(x450_bodyController->GetCommandMgr().GetMoveVector()) < 0.f && front.canBeNormalized()) {
x450_bodyController->GetCommandMgr().ClearLocomotionCmds();
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(front.normalized(), {}, 1.f));
}
ApplySeparation(mgr);
}
void CTryclops::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
x698_25_ = true;
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Internal6);
} else if (msg == EStateMsg::Update) {
AttractBomb(mgr, arg);
}
}
void CTryclops::TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate)
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
CPatterned::TargetPatrol(mgr, msg, arg);
}
void CTryclops::TargetPlayer(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::TargetPlayer(mgr, msg, arg);
if (msg == EStateMsg::Update && x694_bombId != kInvalidUniqueId) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
bomb->SetFuseDisabled(false);
bomb->SetIsBeingDragged(false);
x694_bombId = kInvalidUniqueId;
}
}
}
void CTryclops::TargetCover(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Update) {
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
if (x694_bombId == kInvalidUniqueId)
return;
if (TCastToConstPtr<CBomb> bomb = mgr.GetObjectById(x694_bombId))
SetDestPos(bomb->GetTranslation());
else
x694_bombId = kInvalidUniqueId;
}
}
void CTryclops::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
mgr.GetPlayer().Stop();
mgr.GetPlayer().RemoveMaterial(EMaterialTypes::Solid, mgr);
mgr.GetPlayer().SetLeaveMorphBallAllowed(false);
x32c_animState = EAnimState::Ready;
x698_24_ = false;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1);
if (!x698_24_)
DragPlayer(mgr, GetLctrTransform("bombGrab_locator"sv).origin);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
if (mgr.GetPlayer().GetAttachedActor() == GetUniqueId())
mgr.GetPlayer().DetachActorFromPlayer();
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
}
}
void CTryclops::JumpBack(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(GetWaypointForState(mgr, EScriptObjectState::Retreat, EScriptObjectMessage::Follow))) {
SetDestPos(wp->GetTranslation());
}
if (x694_bombId != kInvalidUniqueId) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId))
bomb->SetFuseDisabled(false);
else
x694_bombId = kInvalidUniqueId;
}
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
} else if (msg == EStateMsg::Update) {
GrabBomb(mgr);
}
}
void CTryclops::Shuffle(CStateManager& mgr, EStateMsg msg, float arg) { PathFind(mgr, msg, arg); }
void CTryclops::TurnAround(CStateManager& mgr, EStateMsg msg, float) {
CPlayer& player = mgr.GetPlayer();
if (msg == EStateMsg::Activate) {
if (x694_bombId == kInvalidUniqueId) {
player.Stop();
player.RemoveMaterial(EMaterialTypes::Solid, mgr);
player.SetLeaveMorphBallAllowed(true);
}
TUniqueId uid = GetWaypointForState(mgr, EScriptObjectState::Modify, EScriptObjectMessage::Follow);
bool retreat = false;
if (uid == kInvalidUniqueId) {
uid = GetWaypointForState(mgr, EScriptObjectState::Retreat, EScriptObjectMessage::Follow);
retreat = true;
}
if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(uid)) {
zeus::CVector3f destVec =
(retreat ? wp->GetTransform().basis[1] : GetTranslation() - wp->GetTranslation()).normalized();
destVec.z() = 0.f;
SetDestPos(GetTranslation() + destVec);
if (std::fabs(zeus::CVector3f(GetTransform().basis[1].x(), GetTransform().basis[1].y(), 0.f).dot(destVec)) < 0.9998)
x32c_animState = EAnimState::Ready;
}
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Turn, &CPatterned::TryTurn, 0);
if (x694_bombId == kInvalidUniqueId)
DragPlayer(mgr, GetLctrTransform("ballGrab_locator"sv).origin);
else
GrabBomb(mgr);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
if (mgr.GetPlayer().GetAttachedActor() == GetUniqueId())
mgr.GetPlayer().DetachActorFromPlayer();
}
}
void CTryclops::Crouch(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
if (TCastToConstPtr<CActor> wp =
mgr.GetObjectById(GetWaypointForState(mgr, EScriptObjectState::Retreat, EScriptObjectMessage::Follow))) {
SetDestPos(wp->GetTranslation());
}
mgr.GetPlayer().Stop();
mgr.GetPlayer().RemoveMaterial(EMaterialTypes::Solid, mgr);
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
mgr.GetPlayer().AttachActorToPlayer(GetUniqueId(), true);
mgr.GetPlayer().SetLeaveMorphBallAllowed(false);
mgr.GetPlayer().GetMorphBall()->DisableHalfPipeStatus();
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
} else if (msg == EStateMsg::Update) {
DragPlayer(mgr, GetLctrTransform("ballGrab_locator"sv).origin);
} else if (msg == EStateMsg::Deactivate) {
if (mgr.GetPlayer().GetAttachedActor() == GetUniqueId())
mgr.GetPlayer().DetachActorFromPlayer();
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
}
}
void CTryclops::GetUp(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x698_24_ = false;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1);
if (!x698_24_) {
GrabBomb(mgr);
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
}
}
void CTryclops::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
mgr.GetPlayer().SetLeaveMorphBallAllowed(false);
mgr.GetPlayer().GetMorphBall()->DisableHalfPipeStatus();
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Internal6);
} else if (msg == EStateMsg::Update) {
SuckPlayer(mgr, arg);
} else if (msg == EStateMsg::Deactivate) {
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
}
}
void CTryclops::Cover(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
if (!x698_25_)
x68c_ = 1.5f;
if (mgr.GetPlayer().GetAttachedActor() == GetUniqueId()) {
mgr.GetPlayer().SetLeaveMorphBallAllowed(true);
mgr.GetPlayer().AddMaterial(EMaterialTypes::Solid, mgr);
mgr.GetPlayer().DetachActorFromPlayer();
}
}
}
void CTryclops::Approach(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::PathFind(mgr, msg, arg);
ApplySeparation(mgr);
if (msg == EStateMsg::Update)
GrabBomb(mgr);
}
void CTryclops::PathFindEx(CStateManager& mgr, EStateMsg msg, float arg) {
CPatterned::PathFind(mgr, msg, arg);
ApplySeparation(mgr);
CPlayer& player = mgr.GetPlayer();
if (msg == EStateMsg::Activate) {
player.Stop();
player.RemoveMaterial(EMaterialTypes::Solid, mgr);
player.GetMorphBall()->DisableHalfPipeStatus();
player.AttachActorToPlayer(GetUniqueId(), true);
} else if (msg == EStateMsg::Update) {
DragPlayer(mgr, GetLctrTransform("ballGrab_locator"sv).origin);
}
}
void CTryclops::Dizzy(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
mgr.GetPlayer().Stop();
mgr.GetPlayer().RemoveMaterial(EMaterialTypes::Solid, mgr);
mgr.GetPlayer().SetLeaveMorphBallAllowed(false);
x32c_animState = EAnimState::Ready;
x698_24_ = false;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 0);
if (!x698_24_)
DragPlayer(mgr, GetLctrTransform("ballGrab_locator"sv).origin);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
if (mgr.GetPlayer().GetAttachedActor() == GetUniqueId()) {
mgr.GetPlayer().DetachActorFromPlayer();
x698_27_dizzy = false;
}
}
}
bool CTryclops::InAttackPosition(CStateManager& mgr, float) {
if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
return false;
CPlayer& player = mgr.GetPlayer();
return sub80260180(player.GetTranslation(),
player.GetTranslation() + zeus::CVector3f(0.f, 0.f, player.GetMorphBall()->GetBallRadius()),
player.GetBoundingBox(), mgr);
}
bool CTryclops::InRange(CStateManager& mgr, float) {
if (x694_bombId != kInvalidUniqueId) {
if (TCastToConstPtr<CBomb> bomb = mgr.GetObjectById(x694_bombId)) {
return sub80260180(bomb->GetTranslation(), bomb->GetTranslation(), *bomb->GetTouchBounds(), mgr);
}
}
return false;
}
bool CTryclops::InMaxRange(CStateManager& mgr, float) {
if (x694_bombId != kInvalidUniqueId)
return true;
rstl::reserved_vector<TUniqueId, 1024> nearList;
float dectRange = x3bc_detectionRange * x3bc_detectionRange;
float dectRangeHeight = x3c0_detectionHeightRange * x3c0_detectionHeightRange;
mgr.BuildNearList(nearList, {GetTranslation() - x3bc_detectionRange, GetTranslation() + x3bc_detectionRange},
CMaterialFilter::MakeInclude({EMaterialTypes::Bomb}), this);
x694_bombId = kInvalidUniqueId;
for (TUniqueId uid : nearList) {
if (TCastToConstPtr<CBomb> bomb = mgr.GetObjectById(uid)) {
if (!bomb->IsBeingDragged()) {
float dist = (bomb->GetTranslation() - GetTranslation()).magSquared();
float height = (bomb->GetTranslation().z() - GetTranslation().z());
if (dist < dectRange && (height * height) < dectRangeHeight) {
if (x568_pathFindSearch.OnPath(bomb->GetTranslation()) == CPathFindSearch::EResult::Success) {
dectRange = dist;
x694_bombId = bomb->GetUniqueId();
}
}
}
}
}
if (x694_bombId != kInvalidUniqueId) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
bomb->SetFuseDisabled(true);
bomb->SetIsBeingDragged(true);
return true;
}
}
return false;
}
bool CTryclops::InDetectionRange(CStateManager& mgr, float arg) {
CPlayer& player = mgr.GetPlayer();
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed ||
player.GetAttachedActor() != kInvalidUniqueId || x68c_ > 0.f || !CPatterned::InDetectionRange(mgr, arg))
return false;
return x568_pathFindSearch.OnPath(player.GetBallPosition()) == CPathFindSearch::EResult::Success;
}
bool CTryclops::SpotPlayer(CStateManager& mgr, float) {
if (x694_bombId != kInvalidUniqueId) {
CPlayer& player = mgr.GetPlayer();
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) {
bool isPlayerCloser = (player.GetTranslation() - GetTranslation()).magSquared() <
(bomb->GetTranslation() - GetTranslation()).magSquared();
if (isPlayerCloser) {
bomb->SetFuseDisabled(false);
bomb->SetIsBeingDragged(false);
x694_bombId = kInvalidUniqueId;
}
return isPlayerCloser;
}
}
}
return true;
}
bool CTryclops::InPosition(CStateManager& mgr, float arg) {
if (x694_bombId != kInvalidUniqueId) {
if (TCastToConstPtr<CBomb> bomb = mgr.GetObjectById(x694_bombId)) {
return InRangeToLocator(bomb->GetTranslation(), arg);
}
}
return false;
}
bool CTryclops::HearShot(CStateManager& mgr, float) {
x698_26_ = false;
if (x694_bombId != kInvalidUniqueId) {
if (TCastToConstPtr<CBomb>(mgr.GetObjectById(x694_bombId))) {
x698_26_ = true;
return false;
} else
x694_bombId = kInvalidUniqueId;
}
return true;
}
bool CTryclops::CoverBlown(CStateManager&, float) {
return x568_pathFindSearch.OnPath(GetTranslation()) != CPathFindSearch::EResult::InvalidArea;
}
bool CTryclops::Inside(CStateManager& mgr, float arg) {
const zeus::CTransform xf = mgr.GetPlayer().GetTransform();
x64c_ = xf.getRotation();
return InRangeToLocator(xf.origin + zeus::CVector3f(0.f, 0.f, mgr.GetPlayer().GetMorphBall()->GetBallRadius()), arg);
}
bool CTryclops::ShouldRetreat(CStateManager& mgr, float) {
if (TCastToConstPtr<CActor> wp =
mgr.GetObjectById(GetWaypointForState(mgr, EScriptObjectState::Modify, EScriptObjectMessage::Next))) {
SetDestPos(wp->GetTranslation());
return true;
}
return false;
}
bool CTryclops::IsDizzy(CStateManager&, float) { return x698_27_dizzy; }
void CTryclops::LaunchPlayer(CStateManager& mgr, const zeus::CTransform& xf, float f1) {
CPlayer& player = mgr.GetPlayer();
player.SetLeaveMorphBallAllowed(true);
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
return;
x698_24_ = true;
x68c_ = 1.5f;
player.Stop();
zeus::CTransform tmpXf = (xf * x64c_);
tmpXf.origin += zeus::CVector3f(0.f, 0.f, -0.5f);
player.Teleport(xf, mgr, false);
player.ApplyImpulseWR(f1 * (player.GetMass() * xf.basis[1].normalized()), zeus::CAxisAngle());
player.SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr);
player.AddMaterial(EMaterialTypes::Solid, mgr);
mgr.ApplyDamage(GetUniqueId(), player.GetUniqueId(), GetUniqueId(), GetContactDamage(),
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
}
void CTryclops::DragBomb(CStateManager& mgr, const zeus::CTransform& xf) {
if (x694_bombId != kInvalidUniqueId) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
bomb->SetVelocityWR((5.f * mgr.GetActiveRandom()->Float() + 20.f) * xf.basis[1].normalized());
bomb->SetConstantAccelerationWR({0.f, 0.f, -CPhysicsActor::GravityConstant()});
}
}
x698_26_ = false;
x698_24_ = true;
x694_bombId = kInvalidUniqueId;
}
void CTryclops::ApplySeparation(CStateManager& mgr) {
for (CEntity* ent : mgr.GetListeningAiObjectList()) {
if (TCastToPtr<CAi> ai = ent) {
if (ai == this || ai->GetAreaIdAlways() != GetAreaId())
continue;
zeus::CVector3f sep = x45c_steeringBehaviors.Separation(*this, ai->GetTranslation(), 8.f);
if (sep.x() != 0.f && sep.y() != 0.f && sep.z() != 0.f)
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(sep, {}, 1.f));
}
}
}
void CTryclops::GrabBomb(CStateManager& mgr) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
zeus::CTransform grabLctr = GetLctrTransform("ballGrab_locator"sv);
grabLctr.origin += zeus::CVector3f(0.f, 0.f, -.3f);
bomb->SetTransform(grabLctr);
}
}
void CTryclops::DragPlayer(CStateManager& mgr, const zeus::CVector3f& locOrig) {
CPlayer& player = mgr.GetPlayer();
player.Stop();
player.RemoveMaterial(EMaterialTypes::Solid, mgr);
zeus::CTransform xf = GetLctrTransform("ballGrab_locator"sv) * x64c_;
xf.origin += {0.f, 0.f, -.5f};
player.SetTransform(xf);
}
bool CTryclops::InRangeToLocator(const zeus::CVector3f& vec, float arg) {
return (vec - GetLctrTransform("ballGrab_locator"sv).origin).magSquared() <= arg;
}
bool CTryclops::sub80260180(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, const zeus::CAABox& bounds,
CStateManager& mgr) {
if (bounds.intersects(GetBoundingBox()))
return true;
zeus::CTransform xf = GetLctrTransform("ballGrab_locator"sv);
zeus::CVector3f tmpVec2 = vec2 - (xf.origin - (1.f * GetTransform().basis[1]));
float f28 = tmpVec2.normalized().dot(GetTransform().basis[1]);
zeus::CVector3f tmpVec4 = (vec1 - (xf.origin - (4.f * GetTransform().basis[1]))).normalized();
float f30 = tmpVec4.dot(GetTransform().basis[1]);
float f29 = tmpVec2.magnitude();
if (f29 > 2.f) {
CRayCastResult res = mgr.RayStaticIntersection(
xf.origin, (1.f / f29) * tmpVec2, f29 - mgr.GetPlayer().GetMorphBall()->GetBallRadius(),
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Character, EMaterialTypes::Player,
EMaterialTypes::ProjectilePassthrough}));
if (res.IsValid())
return false;
}
return !(f29 >= x684_ || f28 <= 0.f || f30 <= x680_);
}
void CTryclops::SuckPlayer(CStateManager& mgr, float arg) {
if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
return;
CPlayer& player = mgr.GetPlayer();
zeus::CTransform xf = GetLctrTransform("ballGrab_locator"sv);
zeus::CVector3f diff = (player.GetTranslation() - xf.origin);
float diffMag = diff.magnitude();
if (diffMag < 3.f) {
player.Stop();
AttractPlayer(mgr, xf.origin, arg);
} else {
player.ApplyForceWR(((x67c_ * (x684_ / (diffMag * diffMag))) * (player.GetMass() * -diff)), {});
}
}
void CTryclops::AttractPlayer(CStateManager& mgr, const zeus::CVector3f& dest, float arg) {
CPlayer& player = mgr.GetPlayer();
const float ballRad = player.GetMorphBall()->GetBallRadius();
player.SetVelocityWR(1.f / (2.f * arg) *
(dest - (player.GetTranslation() + zeus::CVector3f(0.f, 0.f, ballRad))).normalized());
}
void CTryclops::AttractBomb(CStateManager& mgr, float arg) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(x694_bombId)) {
bomb->SetVelocityWR(
1.f / (2.f * arg) *
(GetLctrTransform("ballGrab_locator"sv).origin + zeus::CVector3f(0.f, 0.f, -.3f) - bomb->GetTranslation())
.normalized());
}
}
} // namespace urde::MP1

View File

@ -1,14 +1,91 @@
#pragma once
#include "World/CPatterned.hpp"
#include "World/CPathFindSearch.hpp"
namespace urde::MP1 {
class CTryclops : public CPatterned {
static const CDamageVulnerability skVulnerabilities;
CPathFindSearch x568_pathFindSearch;
zeus::CTransform x64c_;
float x67c_;
float x680_;
float x684_;
float x688_launchSpeed;
float x68c_ = 0.f;
u32 x690_ = 0;
TUniqueId x694_bombId = kInvalidUniqueId;
TUniqueId x696_ = kInvalidUniqueId;
bool x698_24_ : 1;
bool x698_25_ : 1;
bool x698_26_ : 1;
bool x698_27_dizzy : 1;
bool sub8025dbd0(CStateManager&) { return false; }
void LaunchPlayer(CStateManager& mgr, const zeus::CTransform& xf, float);
void DragBomb(CStateManager& mgr, const zeus::CTransform& xf);
void ApplySeparation(CStateManager&);
void GrabBomb(CStateManager& mgr);
void DragPlayer(CStateManager& mgr, const zeus::CVector3f& locOrig);
bool InRangeToLocator(const zeus::CVector3f& vec, float);
bool sub80260180(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CAABox&, CStateManager&);
void SuckPlayer(CStateManager& mgr, float);
void AttractPlayer(CStateManager& mgr, const zeus::CVector3f& dest, float);
void AttractBomb(CStateManager& mgr, float);
public:
DEFINE_PATTERNED(Tryclops)
CTryclops(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, float, float, float, float);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void Think(float, CStateManager&);
const CDamageVulnerability* GetDamageVulnerability() const {
if (x698_26_)
return CAi::GetDamageVulnerability();
return &skVulnerabilities;
}
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
const CDamageInfo&) const {
if (x698_26_)
return CAi::GetDamageVulnerability();
return &skVulnerabilities;
}
void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float);
void Death(CStateManager&, const zeus::CVector3f&, EScriptObjectState);
bool IsListening() const { return true; }
void Patrol(CStateManager&, EStateMsg, float);
void PathFind(CStateManager&, EStateMsg, float);
void SelectTarget(CStateManager&, EStateMsg, float);
void TargetPatrol(CStateManager&, EStateMsg, float);
void TargetPlayer(CStateManager&, EStateMsg, float);
void TargetCover(CStateManager&, EStateMsg, float);
void Attack(CStateManager&, EStateMsg, float);
void JumpBack(CStateManager&, EStateMsg, float);
void Shuffle(CStateManager&, EStateMsg, float);
void TurnAround(CStateManager&, EStateMsg, float);
void Crouch(CStateManager&, EStateMsg, float);
void GetUp(CStateManager&, EStateMsg, float);
void Suck(CStateManager&, EStateMsg, float);
void Cover(CStateManager&, EStateMsg, float);
void Approach(CStateManager&, EStateMsg, float);
void PathFindEx(CStateManager&, EStateMsg, float);
void Dizzy(CStateManager&, EStateMsg, float);
bool InAttackPosition(CStateManager&, float);
bool InRange(CStateManager&, float);
bool InMaxRange(CStateManager&, float);
bool InDetectionRange(CStateManager&, float);
bool SpotPlayer(CStateManager&, float);
bool InPosition(CStateManager&, float);
bool HearShot(CStateManager&, float);
bool CoverBlown(CStateManager&, float);
bool Inside(CStateManager&, float);
bool ShouldRetreat(CStateManager&, float);
bool IsDizzy(CStateManager&, float);
CPathFindSearch* GetSearchPath() { return &x568_pathFindSearch; }
};
} // namespace urde::MP1

View File

@ -24,9 +24,9 @@ CBomb::CBomb(const TCachedToken<CGenDescription>& particle1, const TCachedToken<
new CElementGen(particle1, CElementGen::EModelOrientationType::Normal, CElementGen::EOptionalSystemFlags::One))
, x184_particle2(
new CElementGen(particle2, CElementGen::EModelOrientationType::Normal, CElementGen::EOptionalSystemFlags::One))
, x18c_(particle2.GetObj())
, x18c_particle2Obj(particle2.GetObj())
, x190_24_isNotDetonated(true)
, x190_25_(false)
, x190_25_beingDragged(false)
, x190_26_disableFuse(false) {
x180_particle1->SetGlobalTranslation(xf.origin);
x184_particle2->SetGlobalTranslation(xf.origin);
@ -40,7 +40,7 @@ void CBomb::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManag
x188_lightId = mgr.AllocateUniqueId();
CGameLight* gameLight = new CGameLight(x188_lightId, GetAreaIdAlways(), false,
std::string("Bomb_PLight") + GetName().data(), GetTransform(), GetUniqueId(),
x184_particle2->GetLight(), reinterpret_cast<size_t>(x18c_), 1, 0.f);
x184_particle2->GetLight(), reinterpret_cast<size_t>(x18c_particle2Obj), 1, 0.f);
mgr.AddObject(gameLight);
mgr.AddWeaponId(xec_ownerId, xf0_weaponType);
CSfxManager::AddEmitter(SFXwpn_bomb_drop, GetTranslation(), {}, true, false, 0x7f, -1);

View File

@ -15,9 +15,9 @@ class CBomb : public CWeapon {
std::unique_ptr<CElementGen> x180_particle1;
std::unique_ptr<CElementGen> x184_particle2;
TUniqueId x188_lightId = kInvalidUniqueId;
const CGenDescription* x18c_;
const CGenDescription* x18c_particle2Obj;
bool x190_24_isNotDetonated : 1;
bool x190_25_ : 1;
bool x190_25_beingDragged : 1;
bool x190_26_disableFuse : 1;
public:
@ -35,6 +35,9 @@ public:
std::optional<zeus::CAABox> GetTouchBounds() const;
void SetVelocityWR(const zeus::CVector3f& vel) { x158_velocity = vel; }
void SetConstantAccelerationWR(const zeus::CVector3f& acc) { x164_acceleration = acc; }
void SetFuseDisabled(bool b) { x190_26_disableFuse = false; }
void SetIsBeingDragged(bool b) { x190_25_beingDragged = b; }
bool IsBeingDragged() const { return x190_25_beingDragged; }
};
} // namespace urde

View File

@ -241,14 +241,14 @@ bool CEnergyProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVector3
EVulnerability vulnType = dVuln.GetVulnerability(x12c_curDamageInfo.GetWeaponMode(), false);
if (vulnType == EVulnerability::Deflect) {
deflect = true;
EVulnerability deflectType = dVuln.GetDeflectionType(x12c_curDamageInfo.GetWeaponMode());
EDeflectType deflectType = dVuln.GetDeflectionType(x12c_curDamageInfo.GetWeaponMode());
switch (deflectType) {
case EVulnerability::Weak:
case EDeflectType::None:
deflect = false;
break;
case EVulnerability::Deflect:
case EVulnerability::Immune:
if (deflectType != EVulnerability::Deflect ||
case EDeflectType::Two:
case EDeflectType::Three:
if (deflectType != EDeflectType::Two ||
(xf0_weaponType != EWeaponType::Missile &&
(xe8_projectileAttribs & EProjectileAttrib::ComboShot) != EProjectileAttrib::ComboShot))
if (xf8_filter.GetExcludeList().HasMaterial(EMaterialTypes::Player))

View File

@ -8,7 +8,7 @@ const CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Weak);
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EDeflectType::None);
const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
@ -16,7 +16,7 @@ const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Weak);
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None);
/* LOL, thanks retro */
const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
@ -24,7 +24,7 @@ const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Weak);
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None);
const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
@ -32,7 +32,7 @@ const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::Weak);
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EDeflectType::None);
static inline bool is_not_immune(EVulnerability vuln) {
return vuln != EVulnerability::Immune && vuln != EVulnerability::DirectImmune;
@ -56,19 +56,19 @@ void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount) {
for (int i = 15; i < propCount; ++i)
in.readUint32Big();
x5c_deflected = EVulnerability(in.readUint32Big());
x5c_deflected = EDeflectType(in.readUint32Big());
EVulnerability* vulns2 = &x3c_chargedPower;
in.readUint32Big();
for (int i = 0; i < 4; ++i)
vulns2[i] = EVulnerability(in.readUint32Big());
x60_chargedDeflected = EVulnerability(in.readUint32Big());
x60_chargedDeflected = EDeflectType(in.readUint32Big());
EVulnerability* vulns3 = &x4c_superMissile;
in.readUint32Big();
for (int i = 0; i < 4; ++i)
vulns3[i] = EVulnerability(in.readUint32Big());
x64_comboDeflected = EVulnerability(in.readUint32Big());
x64_comboDeflected = EDeflectType(in.readUint32Big());
}
CDamageVulnerability::CDamageVulnerability(CInputStream& in) {
@ -79,9 +79,9 @@ CDamageVulnerability::CDamageVulnerability(CInputStream& in) {
vulns[i] = EVulnerability(in.readUint32Big());
if (propCount == 15)
x5c_deflected = EVulnerability::Weak;
x5c_deflected = EDeflectType::None;
else
x5c_deflected = EVulnerability(in.readUint32Big());
x5c_deflected = EDeflectType(in.readUint32Big());
x3c_chargedPower = x0_power;
x4c_superMissile = x0_power;
@ -95,13 +95,44 @@ CDamageVulnerability::CDamageVulnerability(CInputStream& in) {
ConstructNew(in, propCount);
}
CDamageVulnerability::CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave,
EVulnerability plasma, EVulnerability bomb, EVulnerability powerBomb,
EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2,
EDeflectType deflectType)
: x0_power(power)
, x4_ice(ice)
, x8_wave(wave)
, xc_plasma(plasma)
, x10_bomb(bomb)
, x14_powerbomb(powerBomb)
, x18_missile(missile)
, x1c_boostBall(boostBall)
, x20_phazon(phazon)
, x24_enemyWp1(enemyWp1)
, x28_enemyWp2Poison(enemyWp2)
, x2c_enemyWp3Lava(enemyWp3)
, x30_enemyWp4(enemyWp4)
, x34_unk1(v1)
, x38_unk2(v2)
, x3c_chargedPower(x0_power)
, x40_chargedIce(x4_ice)
, x44_chargedWave(x8_wave)
, x48_chargedPlasma(xc_plasma)
, x4c_superMissile(x0_power)
, x50_iceSpreader(x4_ice)
, x54_wavebuster(x8_wave)
, x58_flamethrower(xc_plasma)
, x5c_deflected(deflectType) {}
CDamageVulnerability::CDamageVulnerability(
EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma, EVulnerability bomb,
EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall, EVulnerability phazon,
EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp4,
EVulnerability v1, EVulnerability v2, EVulnerability chargedPower, EVulnerability chargedIce,
EVulnerability chargedWave, EVulnerability chargedPlasma, EVulnerability superMissile, EVulnerability iceSpreader,
EVulnerability waveBuster, EVulnerability flameThrower, EVulnerability deflected)
EVulnerability waveBuster, EVulnerability flameThrower, EDeflectType deflected)
: x0_power(power)
, x4_ice(ice)
, x8_wave(wave)
@ -127,7 +158,7 @@ CDamageVulnerability::CDamageVulnerability(
, x58_flamethrower(flameThrower)
, x5c_deflected(deflected) {}
EVulnerability CDamageVulnerability::GetDeflectionType(const CWeaponMode& mode) const {
EDeflectType CDamageVulnerability::GetDeflectionType(const CWeaponMode& mode) const {
if (mode.IsCharged())
return x60_chargedDeflected;
if (mode.IsComboed())
@ -205,9 +236,7 @@ bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect)
return true;
if (chargedVuln && mode.IsCharged())
return true;
if (comboedVuln && mode.IsComboed())
return true;
return false;
return comboedVuln && mode.IsComboed();
}
EVulnerability CDamageVulnerability::GetVulnerability(const CWeaponMode& mode, bool ignoreDirect) const {

View File

@ -6,6 +6,7 @@
namespace urde {
enum class EVulnerability { Weak, Normal, Deflect, Immune, PassThrough, DirectWeak, DirectNormal, DirectImmune };
enum class EDeflectType { None, One, Two, Three, Four };
class CDamageVulnerability {
EVulnerability x0_power;
@ -34,9 +35,12 @@ class CDamageVulnerability {
EVulnerability x54_wavebuster;
EVulnerability x58_flamethrower;
EVulnerability x5c_deflected;
EVulnerability x60_chargedDeflected;
EVulnerability x64_comboDeflected;
EDeflectType x5c_deflected;
/* The following two values are hard coded to bizarre values on purpose to more closely reflect the behavior seen
* in-game.
*/
EDeflectType x60_chargedDeflected = EDeflectType(6);
EDeflectType x64_comboDeflected = EDeflectType(0x3e666666);
void ConstructNew(CInputStream& in, int propCount);
@ -47,15 +51,19 @@ class CDamageVulnerability {
public:
CDamageVulnerability(CInputStream& in);
CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall,
EVulnerability phazon, EVulnerability enemyWp1, EVulnerability wnemyWp2, EVulnerability enemyWp3,
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2, EDeflectType deflectType);
CDamageVulnerability(EVulnerability power, EVulnerability ice, EVulnerability wave, EVulnerability plasma,
EVulnerability bomb, EVulnerability powerBomb, EVulnerability missile, EVulnerability boostBall,
EVulnerability phazon, EVulnerability enemyWp1, EVulnerability enemyWp2, EVulnerability enemyWp3,
EVulnerability enemyWp4, EVulnerability v1, EVulnerability v2, EVulnerability chargedPower,
EVulnerability chargedIce, EVulnerability chargedWave, EVulnerability chargedPlasma,
EVulnerability superMissile, EVulnerability iceSpreader, EVulnerability waveBuster,
EVulnerability flameThrower, EVulnerability deflected);
EVulnerability flameThrower, EDeflectType deflected);
EVulnerability GetDeflectionType(const CWeaponMode& mode) const;
EDeflectType GetDeflectionType(const CWeaponMode& mode) const;
bool WeaponHurts(const CWeaponMode&, bool ignoreDirect) const;
bool WeaponHits(const CWeaponMode& mode, bool checkDirect) const;

View File

@ -346,7 +346,7 @@ public:
virtual CDamageInfo GetContactDamage() const { return x404_contactDamage; }
virtual u8 GetModelAlphau8(const CStateManager&) const { return u8(x42c_color.a() * 255); }
virtual bool IsOnGround() const { return x328_27_onGround; }
virtual float GetGravityConstant() const { return 24.525002f; }
virtual float GetGravityConstant() const { return CPhysicsActor::GravityConstant(); }
virtual CProjectileInfo* GetProjectileInfo() { return nullptr; }
virtual void PhazeOut(CStateManager&);
virtual const std::optional<TLockedToken<CGenDescription>>& GetDeathExplosionParticle() const {

View File

@ -47,7 +47,7 @@ float CPhysicsActor::GetStepUpHeight() const { return x23c_stepUpHeight; }
float CPhysicsActor::GetStepDownHeight() const { return x240_stepDownHeight; }
float CPhysicsActor::GetWeight() const { return 24.525002f * xe8_mass; }
float CPhysicsActor::GetWeight() const { return CPhysicsActor::GravityConstant() * xe8_mass; }
void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f& offset) { x1e8_primitiveOffset = offset; }

View File

@ -202,5 +202,6 @@ public:
void ApplyTorqueWR(const zeus::CVector3f& torque);
void UseCollisionImpulses();
static constexpr float GravityConstant() { return 9.81f * 2.5f; } /* 9.81 m/s ^ 2 is normal acceleration under earth gravity, Tallon 4 is 2.5 times that */
};
} // namespace urde

View File

@ -174,8 +174,8 @@ EWeaponCollisionResponseTypes CScriptActor::GetCollisionResponseType(const zeus:
EProjectileAttrib w) const {
const CDamageVulnerability* dVuln = GetDamageVulnerability();
if (dVuln->GetVulnerability(wMode, false) == EVulnerability::Deflect) {
EVulnerability phazonVuln = dVuln->GetDeflectionType(wMode);
if (phazonVuln < EVulnerability::PassThrough && phazonVuln >= EVulnerability::Normal)
EDeflectType deflectType = dVuln->GetDeflectionType(wMode);
if (deflectType < EDeflectType::Four && deflectType >= EDeflectType::One)
return EWeaponCollisionResponseTypes::Unknown15;
}
return CActor::GetCollisionResponseType(v1, v2, wMode, w);

View File

@ -30,5 +30,6 @@ public:
void Think(float, CStateManager&);
void UpdateEntity(TUniqueId, CStateManager&);
bool IsPassive() const { return x44_25_isPassive; }
void SetIsPassive(bool b) { x44_25_isPassive = b; }
};
} // namespace urde

View File

@ -6,10 +6,10 @@
namespace urde {
CScriptAiJumpPoint::CScriptAiJumpPoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
zeus::CTransform& xf, bool active, float f1)
zeus::CTransform& xf, bool active, float apex)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::NoStepLogic),
CActorParameters::None(), kInvalidUniqueId)
, xe8_apex(f1)
, xe8_apex(apex)
, xec_touchBounds(xf.origin, xf.origin) {}
void CScriptAiJumpPoint::Accept(IVisitor& visitor) { visitor.Visit(this); }

View File

@ -12,13 +12,13 @@ const zeus::CVector3f CScriptCameraPitchVolume::skScaleFactor = zeus::CVector3f(
CScriptCameraPitchVolume::CScriptCameraPitchVolume(TUniqueId uid, bool active, std::string_view name,
const CEntityInfo& info, const zeus::CVector3f& scale,
const zeus::CTransform& xf, const zeus::CRelAngle& r1,
const zeus::CRelAngle& r2, float maxInterpDistance)
const zeus::CTransform& xf, const zeus::CRelAngle& upPitch,
const zeus::CRelAngle& downPitch, float maxInterpDistance)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Trigger),
CActorParameters::None(), kInvalidUniqueId)
, xe8_obbox(xf, scale * skScaleFactor)
, x124_upPitch(r1)
, x128_downPitch(r2)
, x124_upPitch(upPitch)
, x128_downPitch(downPitch)
, x12c_scale(scale * skScaleFactor)
, x138_maxInterpDistance(maxInterpDistance) {}

View File

@ -53,7 +53,7 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity
x2d4_particleGens[0]->SetGlobalScale(particleScale);
}
x150_momentum = zeus::CVector3f(0.f, 0.f, -24.525f * xe8_mass);
x150_momentum = zeus::CVector3f(0.f, 0.f, -CPhysicsActor::GravityConstant() * xe8_mass);
if (x90_actorLights)
x90_actorLights->SetAmbienceGenerated(true);

View File

@ -5,10 +5,10 @@
namespace urde {
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool b1,
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool defaultActive,
bool skipSendActive, bool ignoreMessages)
: CEntity(uid, info, true, name)
, x34_24_(b1)
, x34_24_defaultActive(defaultActive)
, x34_25_skipSendActive(skipSendActive)
, x34_26_ignoreMessages(ignoreMessages) {}

View File

@ -6,7 +6,7 @@ namespace urde {
class CScriptMemoryRelay : public CEntity {
union {
struct {
bool x34_24_;
bool x34_24_defaultActive;
bool x34_25_skipSendActive;
bool x34_26_ignoreMessages;
};

View File

@ -16,6 +16,7 @@
#include "GameGlobalObjects.hpp"
#include "CStateManager.hpp"
#include "CSimplePool.hpp"
#include "World/CPhysicsActor.hpp"
#include "TCastTo.hpp"
namespace urde {
@ -490,7 +491,7 @@ void CWallCrawlerSwarm::UpdateBoid(const CAreaCollisionCache& ccache, CStateMana
f28 += f25;
}
if (!found) {
boid.x30_velocity += zeus::CVector3f(0.f, 0.f, -(x558_flavor == EFlavor::Scarab ? 3.f * 24.525f : 24.525f)) * dt;
boid.x30_velocity += zeus::CVector3f(0.f, 0.f, -(x558_flavor == EFlavor::Scarab ? 3.f * CPhysicsActor::GravityConstant() : CPhysicsActor::GravityConstant())) * dt;
if (boid.x7c_remainingLaunchNotOnSurfaceFrames)
boid.x7c_remainingLaunchNotOnSurfaceFrames -= 1;
}
@ -561,7 +562,7 @@ void CWallCrawlerSwarm::UpdateBoid(const CAreaCollisionCache& ccache, CStateMana
void CWallCrawlerSwarm::LaunchBoid(CBoid& boid, const zeus::CVector3f& dir) {
zeus::CVector3f pos = boid.GetTranslation();
static float skAttackTime = std::sqrt(2.5f / 24.525f) * 2.f;
static float skAttackTime = std::sqrt(2.5f / CPhysicsActor::GravityConstant()) * 2.f;
static float skAttackVelocity = 15.f / skAttackTime;
zeus::CVector3f deltaFlat = dir - pos;
float deltaZ = deltaFlat.z();
@ -578,14 +579,14 @@ void CWallCrawlerSwarm::LaunchBoid(CBoid& boid, const zeus::CVector3f& dir) {
bool r29 = deltaZ < 0.f;
float _12c, _130;
float f25 = 0.f;
if (CSteeringBehaviors::SolveQuadratic(-24.525f, vec.z(), -deltaZ, _12c, _130))
if (CSteeringBehaviors::SolveQuadratic(-CPhysicsActor::GravityConstant(), vec.z(), -deltaZ, _12c, _130))
f25 = r29 ? _130 : _12c;
if (!r29)
f25 += deltaMag / dot;
if (f25 < 10.f) {
vec.x() = deltaMag / f25 * deltaFlat.x() * 0.6f;
vec.y() = deltaMag / f25 * deltaFlat.y() * 0.6f;
vec.z() = deltaZ / f25 - 0.5f * -24.525f * f25;
vec.z() = deltaZ / f25 - 0.5f * -CPhysicsActor::GravityConstant() * f25;
}
}
}

View File

@ -560,12 +560,12 @@ CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int pro
std::string name = mgr.HashInstanceName(in);
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
bool b1 = in.readBool();
bool b2 = in.readBool();
u32 initial = in.readUint32Big();
u32 max = in.readUint32Big();
bool autoReset = in.readBool();
bool active = in.readBool();
return new CScriptCounter(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2);
return new CScriptCounter(mgr.AllocateUniqueId(), name, info, initial, max, autoReset, active);
}
CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1557,9 +1557,9 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
bool b1 = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
bool collider = in.readBool();
bool excludePlayer = in.readBool();
bool enableLineOfSight = in.readBool();
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
return nullptr;
@ -1567,7 +1567,7 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CFlickerBat(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo,
CPatterned::EColliderType(b1), b2, actParms, b3);
CPatterned::EColliderType(collider), excludePlayer, actParms, enableLineOfSight);
}
CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1631,7 +1631,7 @@ CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int
return nullptr;
CModelData mData(
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
return new MP1::CPuddleSpore(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo,
CPatterned::EColliderType(b1), w1, f1, f2, f3, f4, f5, actParms, w2, dInfo);
}
@ -1831,8 +1831,8 @@ CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in,
return nullptr;
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, specialFunction,
str, f1, f2, f3, f4, zeus::skZero3f, zeus::skBlack, active1,
CDamageInfo(), w2, w3, w4, w5, w6, w7);
str, f1, f2, f3, f4, zeus::skZero3f, zeus::skBlack, active1, CDamageInfo(), w2, w3,
w4, w5, w6, w7);
}
CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1846,10 +1846,10 @@ CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int p
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
in.readBool();
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
float maxDetectionRange = in.readFloatBig();
float maxHearingRange = in.readFloatBig();
float maxSightRange = in.readFloatBig();
float hideTime = in.readFloatBig();
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
if (!animParms.GetACSFile().IsValid())
@ -1858,7 +1858,7 @@ CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int p
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale,
animParms.GetInitialAnimation(), true));
return new MP1::CSpankWeed(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData),
actParms, pInfo, f1, f2, f3, f4);
actParms, pInfo, maxDetectionRange, maxHearingRange, maxSightRange, hideTime);
}
CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1915,10 +1915,11 @@ CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
u32 w2 = LoadParameterFlags(in);
u32 w1 = in.readUint32Big();
u32 overrideFlags = LoadParameterFlags(in);
u32 priority = in.readUint32Big();
return new CScriptPlayerHint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2);
return new CScriptPlayerHint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, priority,
overrideFlags);
}
CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1938,6 +1939,10 @@ CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in,
}
CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
if (CScriptActorKeyframe* kf = static_cast<CScriptActorKeyframe*>(LoadActorKeyframe(mgr, in, propCount, info))) {
kf->SetIsPassive(true);
return kf;
}
return nullptr;
}
@ -1949,10 +1954,10 @@ CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in,
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
CScannableParameters sParms = LoadScannableParameters(in);
float f1 = in.readFloatBig();
float pointSize = in.readFloatBig();
return new CScriptPointOfInterest(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, sParms,
f1);
pointSize);
}
CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -1979,7 +1984,7 @@ CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int pro
return nullptr;
CModelData mData(
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
return new MP1::CMetroid(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, actParms, metData,
kInvalidUniqueId);
}
@ -2030,7 +2035,7 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in,
CScriptDebris::EOrientationType particle2Or = CScriptDebris::EOrientationType(in.readUint32Big());
CAssetId particle3 = in.readUint32Big();
/*zeus::CVector3f particle3Scale =*/ zeus::CVector3f::ReadBig(in); /* Not actually used, go figure */
/*zeus::CVector3f particle3Scale =*/zeus::CVector3f::ReadBig(in); /* Not actually used, go figure */
CScriptDebris::EOrientationType particle3Or = CScriptDebris::EOrientationType(in.readUint32Big());
bool solid = in.readBool();
@ -2275,8 +2280,8 @@ CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int p
bool hotInThermal = in.readBool();
CModelData mData(CStaticRes(model, zeus::skOne3f));
CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::skOne3f,
animParms.GetInitialAnimation(), true);
CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::skOne3f, animParms.GetInitialAnimation(),
true);
return new CFishCloud(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale, aHead.x10_transform,
std::move(mData), animRes, numBoids, speed, separationRadius, cohesionMagnitude,
alignmentWeight, separationMagnitude, weaponRepelMagnitude, playerRepelMagnitude,
@ -2526,15 +2531,13 @@ CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in
u32 launchSfx = in.readUint32Big();
u32 scatterSfx = in.readUint32Big();
return new CWallCrawlerSwarm(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale,
aHead.x10_transform, flavor,
CAnimRes(actor, charIdx, zeus::CVector3f(1.5f), defaultAnim, true),
launchAnim, attractAnim, part1, part2, part3, part4, crabDamage, scarabExplodeDamage,
crabDamageCooldown, boidRadius, touchRadius, playerTouchRadius, numBoids,
maxCreatedBoids, animPlaybackSpeed, separationRadius, cohesionMagnitude, alignmentWeight,
separationMagnitude, moveToWaypointWeight, attractionMagnitude, attractionRadius,
boidGenRate, maxLaunches, scarabBoxMargin, scarabScatterXYVelocity, scarabTimeToExplode,
hInfo, dVulns, launchSfx, scatterSfx, aParams);
return new CWallCrawlerSwarm(
mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale, aHead.x10_transform, flavor,
CAnimRes(actor, charIdx, zeus::CVector3f(1.5f), defaultAnim, true), launchAnim, attractAnim, part1, part2, part3,
part4, crabDamage, scarabExplodeDamage, crabDamageCooldown, boidRadius, touchRadius, playerTouchRadius, numBoids,
maxCreatedBoids, animPlaybackSpeed, separationRadius, cohesionMagnitude, alignmentWeight, separationMagnitude,
moveToWaypointWeight, attractionMagnitude, attractionRadius, boidGenRate, maxLaunches, scarabBoxMargin,
scarabScatterXYVelocity, scarabTimeToExplode, hInfo, dVulns, launchSfx, scatterSfx, aParams);
}
CEntity* ScriptLoader::LoadAiJumpPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -2543,9 +2546,9 @@ CEntity* ScriptLoader::LoadAiJumpPoint(CStateManager& mgr, CInputStream& in, int
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
float f1 = in.readFloat();
float apex = in.readFloat();
return new CScriptAiJumpPoint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, f1);
return new CScriptAiJumpPoint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, apex);
}
CEntity* ScriptLoader::LoadFlaahgraTentacle(CStateManager& mgr, CInputStream& in, int propCount,
@ -2810,10 +2813,9 @@ CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, in
float radius = in.readFloatBig();
zeus::CTransform xf = ConvertEditorEulerToTransform4f(zeus::skZero3f, center);
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, xf,
CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius, 0.f, 0.f, 0.f,
zeus::skZero3f, zeus::skBlack, active, dInfo, -1, -1,
CPlayerState::EItemType::Invalid, -1, -1, -1);
return new CScriptSpecialFunction(
mgr.AllocateUniqueId(), name, info, xf, CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius, 0.f,
0.f, 0.f, zeus::skZero3f, zeus::skBlack, active, dInfo, -1, -1, CPlayerState::EItemType::Invalid, -1, -1, -1);
}
CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& in, int propCount,
@ -2823,12 +2825,12 @@ CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& i
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();
zeus::CRelAngle upPitch = zeus::CRelAngle::FromDegrees(in.readFloatBig());
zeus::CRelAngle downPitch = zeus::CRelAngle::FromDegrees(in.readFloatBig());
float scale = in.readFloatBig();
return new CScriptCameraPitchVolume(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale,
aHead.x10_transform, f1, f2, f3);
aHead.x10_transform, upPitch, downPitch, scale);
}
CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, int propCount,
@ -2839,12 +2841,12 @@ CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStre
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
float density = in.readFloatBig();
u32 w1 = in.readUint32Big();
u32 maxDensityDeltaSpeed = in.readUint32Big();
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, zeus::CTransform(),
CScriptSpecialFunction::ESpecialFunction::EnvFxDensityController, "", density, w1,
0.f, 0.f, zeus::skZero3f, zeus::skBlack, active, CDamageInfo(), -1,
-1, CPlayerState::EItemType::Invalid, -1, -1, -1);
CScriptSpecialFunction::ESpecialFunction::EnvFxDensityController, "", density,
maxDensityDeltaSpeed, 0.f, 0.f, zeus::skZero3f, zeus::skBlack, active,
CDamageInfo(), -1, -1, CPlayerState::EItemType::Invalid, -1, -1, -1);
}
CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -2993,25 +2995,26 @@ CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int prop
if (pInfo.GetAnimationParameters().GetACSFile() == CAssetId())
return nullptr;
float f1 = in.readFloatBig();
float advanceWpRadius = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float alignAngVel = in.readFloatBig();
float f4 = in.readFloatBig();
float f5 = in.readFloatBig();
float f6 = in.readFloatBig();
float f7 = in.readFloatBig();
u16 sId1 = in.readUint32Big() & 0xFFFF;
u16 sId2 = in.readUint32Big() & 0xFFFF;
u16 sId3 = in.readUint32Big() & 0xFFFF;
float playerObstructionMinDist = in.readFloatBig();
float haltDelay = in.readFloatBig();
float forwardMoveWeight = in.readFloatBig();
u16 haltSfx = in.readUint32Big() & 0xFFFF;
u16 getUpSfx = in.readUint32Big() & 0xFFFF;
u16 crouchSfx = in.readUint32Big() & 0xFFFF;
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CParasite(mgr.AllocateUniqueId(), actHead.x0_name, CPatterned::EFlavorType::Zero, info,
actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, f1, f2, f3, f4,
0.2f, 0.4f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, f7, 0.f, 0.f, f5, f6, false,
CWallWalker::EWalkerType::Geemer, CDamageVulnerability::NormalVulnerabilty(), CDamageInfo(),
sId1, sId2, sId3, -1, -1, 0.f, actParms);
actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, advanceWpRadius,
f2, alignAngVel, f4, 0.2f, 0.4f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, forwardMoveWeight, 0.f, 0.f,
playerObstructionMinDist, haltDelay, false, CWallWalker::EWalkerType::Geemer,
CDamageVulnerability::NormalVulnerabilty(), CDamageInfo(), haltSfx, getUpSfx, crouchSfx, -1,
-1, 0.f, actParms);
}
CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -3051,13 +3054,12 @@ CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, i
SSpindleProperty recoverClampedAzimuthFromHintDir(in);
recoverClampedAzimuthFromHintDir.FixupAngles();
return new CScriptSpindleCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, flags,
hintToCamDistMin, hintToCamDistMax, hintToCamVOffMin, hintToCamVOffMax,
targetHintToCamDeltaAngleVel, deltaAngleScaleWithCamDist, hintToCamDist,
distOffsetFromBallDist, hintBallToCamAzimuth, unused, maxHintBallToCamAzimuth,
camLookRelAzimuth, lookPosZOffset, camPosZOffset, clampedAzimuthFromHintDir,
dampingAzimuthSpeed, targetHintToCamDeltaAngleVelRange, deleteHintBallDist,
recoverClampedAzimuthFromHintDir);
return new CScriptSpindleCamera(
mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, flags, hintToCamDistMin,
hintToCamDistMax, hintToCamVOffMin, hintToCamVOffMax, targetHintToCamDeltaAngleVel, deltaAngleScaleWithCamDist,
hintToCamDist, distOffsetFromBallDist, hintBallToCamAzimuth, unused, maxHintBallToCamAzimuth, camLookRelAzimuth,
lookPosZOffset, camPosZOffset, clampedAzimuthFromHintDir, dampingAzimuthSpeed, targetHintToCamDeltaAngleVelRange,
deleteHintBallDist, recoverClampedAzimuthFromHintDir);
}
CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -3102,8 +3104,8 @@ CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& i
zeus::CTransform xfRot = aHead.x10_transform.getRotation();
if (xfRot == zeus::CTransform())
return new CScriptTrigger(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform.origin,
zeus::CAABox(-scale, scale), CDamageInfo(), zeus::skZero3f,
ETriggerFlags::DetectPlayer, active, deactivateOnEnter, deactivateOnExit);
zeus::CAABox(-scale, scale), CDamageInfo(), zeus::skZero3f, ETriggerFlags::DetectPlayer,
active, deactivateOnEnter, deactivateOnExit);
return new CScriptCameraHintTrigger(mgr.AllocateUniqueId(), active, aHead.x0_name, info, scale, aHead.x10_transform,
deactivateOnEnter, deactivateOnExit);
@ -3123,8 +3125,8 @@ CEntity* ScriptLoader::LoadRumbleEffect(CStateManager& mgr, CInputStream& in, in
return new CScriptSpecialFunction(
mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(zeus::skZero3f, position),
CScriptSpecialFunction::ESpecialFunction::RumbleEffect, "", f1, w1, pFlags, 0.f, zeus::skZero3f,
zeus::skBlack, active, {}, {}, {}, CPlayerState::EItemType::Invalid, -1, -1, -1);
CScriptSpecialFunction::ESpecialFunction::RumbleEffect, "", f1, w1, pFlags, 0.f, zeus::skZero3f, zeus::skBlack,
active, {}, {}, {}, CPlayerState::EItemType::Invalid, -1, -1, -1);
}
CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -3218,9 +3220,8 @@ CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int p
CDamageVulnerability dVuln(in);
float iceZoomerJointHP = in.readFloatBig();
CModelData mData(
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), actHead.x40_scale, animParms.GetInitialAnimation(),
true));
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), actHead.x40_scale,
animParms.GetInitialAnimation(), true));
return new MP1::CParasite(mgr.AllocateUniqueId(), actHead.x0_name, CPatterned::EFlavorType::Zero, info,
actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, advanceWpRadius,
f2, alignAngleVel, f4, 0.2f, 0.4f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, moveFowardWeight, 0.f, 0.f,
@ -3347,9 +3348,8 @@ CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in
bool active = in.readBool();
float fadedLevel = in.readFloatBig();
float initialLevel = in.readFloatBig();
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack,
zeus::CVector2f(), 0.f, zeus::CVector2f(), false, active, fadedLevel, initialLevel, 0.f,
0.f);
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack, zeus::CVector2f(),
0.f, zeus::CVector2f(), false, active, fadedLevel, initialLevel, 0.f, 0.f);
}
CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
@ -3411,8 +3411,8 @@ CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in,
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack,
zeus::skZero2f, 0.f, zeus::skZero2f, false, active, 0.f, 0.f, f1, f2);
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack, zeus::skZero2f,
0.f, zeus::skZero2f, false, active, 0.f, 0.f, f1, f2);
}
CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount,