Difference between revisions of "Arch-vile fire spawned at the wrong location"

From DoomWiki.org

[checked revision][checked revision]
(Remove stub status; article is reasonably complete.)
(Show the offending code line in bold and remove the reference to the line number because there are no line numbers)
Line 11: Line 11:
 
      
 
      
 
         if (!actor->target)
 
         if (!actor->target)
    return;
+
            return;
 
      
 
      
 
         A_FaceTarget (actor);
 
         A_FaceTarget (actor);
 
      
 
      
 
         fog = P_SpawnMobj (actor->target->x,
 
         fog = P_SpawnMobj (actor->target->x,
          actor->target->x,
+
              '''actor->target->x,'''
          actor->target->z, MT_FIRE);
+
              actor->target->z, MT_FIRE);
 
      
 
      
 
         actor->tracer = fog;
 
         actor->tracer = fog;
Line 25: Line 25:
 
     }
 
     }
  
On line 15, the actor's target's x coordinate is used again where the code should instead use the target's y coordinate. This causes the initial position of the fire to be shifted on the x-y plane relative to the target of the arch-vile's attack. Should the target become hidden from the arch-vile's line of sight before the fire's position is updated, the fire will remain in this incorrect position until it dissipates completely.
+
On the line in bold, the actor's target's x coordinate is used again where the code should instead use the target's y coordinate. This causes the initial position of the fire to be shifted on the x-y plane relative to the target of the arch-vile's attack. Should the target become hidden from the arch-vile's line of sight before the fire's position is updated, the fire will remain in this incorrect position until it dissipates completely.
  
 
== Links ==
 
== Links ==

Revision as of 21:21, 6 July 2019

A screenshot of this bug in Doom II MAP16: Suburbs.

Due to a bug in the Doom engine, the fire from the arch-vile's attack can be spawned at the wrong location. When the fog is initially spawned, the following code is used, which contains a blatant programming error:

   //
   // A_VileTarget
   // Spawn the hellfire
   //
   void A_VileTarget (mobj_t*	actor)
   {
       mobj_t*	fog;
   
       if (!actor->target)
           return;
   
       A_FaceTarget (actor);
   
       fog = P_SpawnMobj (actor->target->x,
   		          actor->target->x,
   		          actor->target->z, MT_FIRE);
   
       actor->tracer = fog;
       fog->target = actor;
       fog->tracer = actor->target;
       A_Fire (fog);
   }

On the line in bold, the actor's target's x coordinate is used again where the code should instead use the target's y coordinate. This causes the initial position of the fire to be shifted on the x-y plane relative to the target of the arch-vile's attack. Should the target become hidden from the arch-vile's line of sight before the fire's position is updated, the fire will remain in this incorrect position until it dissipates completely.

Links