• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).


Commit MetaInfo

Revisión59f1474300fa889904ba85ce4526a0734db3af08 (tree)
Tiempo2021-10-04 04:46:48
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed the activator's target and master pointers in GAMEEVENT_ACTOR_DAMAGED event scripts.

Cambiar Resumen

Diferencia incremental

diff -r f9fa0270195b -r 59f1474300fa src/gamemode.cpp
--- a/src/gamemode.cpp Sun Oct 03 12:38:58 2021 -0400
+++ b/src/gamemode.cpp Sun Oct 03 15:46:48 2021 -0400
@@ -1115,21 +1115,20 @@
11151115 if ((( target->STFlags & STFL_USEDAMAGEEVENTSCRIPT ) == false ) && ( gameinfo.bForceDamageEventScripts == false ))
11161116 return;
11171117
1118- // [AK] We somehow need to pass the source and inflictor actor pointers into the script
1119- // itself. A simple way to do this is temporarily changing the target's pointers to the
1120- // source and inflictor, which we'll then use to initialize AAPTR_DAMAGE_SOURCE and
1121- // AAPTR_DAMAGE_INFLICTOR for the script.
1122- // The source actor is the activator, which we'll use to initialize AAPTR_DAMAGE_TARGET.
1123- AActor *tempMaster = target->master;
1124- AActor *tempTarget = target->target;
1125- target->master = source;
1126- target->target = inflictor;
1118+ // [AK] We somehow need to pass all the actor pointers into the script itself. A simple way
1119+ // to do this is temporarily spawn a temporary actor and change its actor pointers to the target,
1120+ // source, and inflictor. We can then use these to initialize the AAPTR_DAMAGE_TARGET,
1121+ // AAPTR_DAMAGE_SOURCE, and AAPTR_DAMAGE_INFLICTOR pointers of the script.
1122+ AActor *temp = Spawn( "MapSpot", target->x, target->y, target->z, NO_REPLACE );
11271123
1128- GAMEMODE_HandleEvent( GAMEEVENT_ACTOR_DAMAGED, target, damage, GlobalACSStrings.AddString( mod ));
1124+ temp->target = target;
1125+ temp->master = source;
1126+ temp->tracer = inflictor;
11291127
1130- // [AK] Restore the source actor's old pointers.
1131- target->master = tempMaster;
1132- target->target = tempTarget;
1128+ GAMEMODE_HandleEvent( GAMEEVENT_ACTOR_DAMAGED, temp, damage, GlobalACSStrings.AddString( mod ));
1129+
1130+ // [AK] Destroy the temporary actor after executing all event scripts.
1131+ temp->Destroy( );
11331132 }
11341133
11351134 //*****************************************************************************
diff -r f9fa0270195b -r 59f1474300fa src/p_acs.cpp
--- a/src/p_acs.cpp Sun Oct 03 12:38:58 2021 -0400
+++ b/src/p_acs.cpp Sun Oct 03 15:46:48 2021 -0400
@@ -11656,14 +11656,16 @@
1165611656
1165711657 // [AK] Check if this is an event script triggered by GAMEEVENT_ACTOR_DAMAGED. This is
1165811658 // where we initialize the script's target, source, and inflictor pointers by using the
11659- // activator as the target, and the activator's own master and target, which are the
11660- // source and inflictor respectively.
11659+ // temporary activator's own pointers.
1166111660 if (( NETWORK_InClientMode( ) == false ) && ( who != NULL ) &&
1166211661 ( code->Type == SCRIPT_Event ) && ( args[0] == GAMEEVENT_ACTOR_DAMAGED ))
1166311662 {
11664- pDamageTarget = who;
11663+ pDamageTarget = who->target;
1166511664 pDamageSource = who->master;
11666- pDamageInflictor = who->target;
11665+ pDamageInflictor = who->tracer;
11666+
11667+ // [AK] Make the target actor the activator.
11668+ activator = pDamageTarget;
1166711669 }
1166811670 else
1166911671 {