# HG changeset patch
# User Trillster
# Date 1711827629 14400
#      Sat Mar 30 15:40:29 2024 -0400
# Node ID 5d72fa552084554cb2fc5dd830e5ce53baa7872a
# Parent  2f59d4a1f4d10d32e639890b6963fe96620512d8
A_SpawnItemEx now always syncs AAPTR_TARGET for +MISSILE actors (addresses 4200).

diff -r 2f59d4a1f4d1 -r 5d72fa552084 docs/zandronum-history.txt
--- a/docs/zandronum-history.txt	Mon Mar 04 09:34:51 2024 -0600
+++ b/docs/zandronum-history.txt	Sat Mar 30 15:40:29 2024 -0400
@@ -133,6 +133,7 @@
 -	- Fixed: STRFTIME would crash Zandronum if a negative was passed into the first argument (addresses 4144). [Ru5tK1ng]
 -	- Fixed: the server would freeze after running for long enough (e.g. 24 days on Windows) due to an integer overflow in SERVER_Tick. [Kaminsky]
 -	- Fixed: the SendToCommunicator special didn't stop the previous sound when online. [DrinkyBird]
+-	- Fixed: A_SpawnItemEx now always syncs AAPTR_TARGET for +MISSILE actors (addresses 4200). [Trillster]
 !	- The result value of GAMEEVENT_MEDALS event scripts can now be used to determine whether or not the player receives the medal. [Kaminsky]
 !	- GAMEMODE flags are now validated after all GAMEMODE lumps have been parsed instead of after each one. The internal game mode name (e.g. "TeamLMS") is now printed with the error message instead of the actual name. [Kaminsky]
 !	- Added an extra check to ensure that game modes have a (short) name. [Kaminsky]
diff -r 2f59d4a1f4d1 -r 5d72fa552084 src/thingdef/thingdef_codeptr.cpp
--- a/src/thingdef/thingdef_codeptr.cpp	Mon Mar 04 09:34:51 2024 -0600
+++ b/src/thingdef/thingdef_codeptr.cpp	Sat Mar 30 15:40:29 2024 -0400
@@ -2655,8 +2655,9 @@
 			if ( mo->Translation )
 				SERVERCOMMANDS_SetThingTranslation( mo );
 
+			// [TRSR] It is useful to always sync the AAPTR_TARGET field for missiles.
 			// [BB] To properly handle actor-actor bouncing, the client must know the target.
-			if ( mo->BounceFlags != BOUNCE_None )
+			if ( mo->flags & MF_MISSILE || mo->BounceFlags != BOUNCE_None )
 				SERVERCOMMANDS_SetThingTarget ( mo );
 
 			// [BB] Set scale if necessary.
