WW2GI: Tanks are not facing the player
See also MR !56 (merged)
And the following thread: https://forums.duke4.net/topic/10007-nam-m16-auto-aim-isnt-correct/page__st__30__p__348089#entry348089
The problem here is that the tanks in WW2GI are supposed to aim at the player and shoot him. However as of r9459, they always look and shoot in the same direction, obviously making them a non-threat.
The CON code for the tank in WW2GI is broken in the sense that it uses 0 as the move
argument of the ai
definition:
ai AITANKSEEK VCTANK 0 seekplayer
ai AITANKAIM VCTANK 0 faceplayer
ai AITANKSHOOT VCTANKSHOOT 0 faceplayer
ai AITANKHURT VCTANK 0 faceplayer
It should instead be using a proper move
definition with zero velocity. However, we cannot alter the CON code of WW2GI retroactively, making it necessary to accomodate for this problem.
The tank aiming broke almost 13 years ago, between the builds of 2008-11-25 and 2008-12-14.
Between these revisions, the following check was added to the function X_Move()
, now called VM_Move()
, in gameexec.cpp
.
GAMEEXEC_STATIC void VM_Move(void)
{
...
if (AC_MOVE_ID(vm.pData) == 0 || movflags == 0)
{
if (deadflag || (vm.pActor->bpos.x != vm.pSprite->x) || (vm.pActor->bpos.y != vm.pSprite->y))
setsprite(vm.spriteNum, &vm.pSprite->pos);
return;
}
if (!deadflag)
{
if (movflags & face_player)
VM_FacePlayer(2);
...
If the move is set to 0, the VM_Move() function aborts early, and therefore the code associated with the faceplayer
flag does not execute.
This check did not exist prior to the build compiled on 2008-12-14.
MR !56 (merged) adds a special case check for this case, which fixes the behavior of the tank.