summaryrefslogtreecommitdiff
path: root/src/hexen/p_enemy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hexen/p_enemy.c')
-rw-r--r--src/hexen/p_enemy.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index 9219f339..1ad87032 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1108,16 +1108,33 @@ void A_MinotaurFade2(mobj_t * actor)
void A_MinotaurLook(mobj_t * actor);
-void A_MinotaurRoam(mobj_t * actor)
+// Check the age of the minotaur and stomp it after MAULATORTICS of time
+// have passed. Returns false if killed.
+static boolean CheckMinotaurAge(mobj_t *mo)
{
- unsigned int *starttime = (unsigned int *) actor->args;
+ unsigned int starttime;
+
+ // The start time is stored in the mobj_t structure, but it is stored
+ // in little endian format. For Vanilla savegame compatibility we must
+ // swap it to the native endianness.
+ memcpy(&starttime, mo->args, sizeof(unsigned int));
+
+ if (leveltime - LONG(starttime) >= MAULATORTICS)
+ {
+ P_DamageMobj(mo, NULL, NULL, 10000);
+ return false;
+ }
+ return true;
+}
+
+void A_MinotaurRoam(mobj_t * actor)
+{
actor->flags &= ~MF_SHADOW; // In case pain caused him to
actor->flags &= ~MF_ALTSHADOW; // skip his fade in.
- if ((leveltime - *starttime) >= MAULATORTICS)
+ if (!CheckMinotaurAge(actor))
{
- P_DamageMobj(actor, NULL, NULL, 10000);
return;
}
@@ -1231,14 +1248,11 @@ void A_MinotaurLook(mobj_t * actor)
void A_MinotaurChase(mobj_t * actor)
{
- unsigned int *starttime = (unsigned int *) actor->args;
-
actor->flags &= ~MF_SHADOW; // In case pain caused him to
actor->flags &= ~MF_ALTSHADOW; // skip his fade in.
- if ((leveltime - *starttime) >= MAULATORTICS)
+ if (!CheckMinotaurAge(actor))
{
- P_DamageMobj(actor, NULL, NULL, 10000);
return;
}