This is a fork of Zandronum Beta for Mac Os (Silicon and Intel)
Revision | 3b50783ec354c8ae306db8680e492b8df5eb8813 (tree) |
---|---|
Time | 2022-08-25 22:15:20 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Added an optional parameter to GAMEMODE_HandleEvent that decides whether the event script is executed immediately or not. By default, this is set to false.
@@ -1087,7 +1087,7 @@ | ||
1087 | 1087 | |
1088 | 1088 | // [AK] Trigger an event script indicating that a chat message was received. |
1089 | 1089 | // If the event returns 0, then don't print the message. |
1090 | - if ( GAMEMODE_HandleEvent( GAMEEVENT_CHAT, NULL, ulPlayer != MAXPLAYERS ? ulPlayer : -1, ulMode - CHATMODE_GLOBAL ) == 0 ) | |
1090 | + if ( GAMEMODE_HandleEvent( GAMEEVENT_CHAT, NULL, ulPlayer != MAXPLAYERS ? ulPlayer : -1, ulMode - CHATMODE_GLOBAL, true ) == 0 ) | |
1091 | 1091 | return; |
1092 | 1092 | |
1093 | 1093 | BOTCMD_SetLastChatString( ChatString ); |
@@ -1079,7 +1079,7 @@ | ||
1079 | 1079 | |
1080 | 1080 | //***************************************************************************** |
1081 | 1081 | // |
1082 | -LONG GAMEMODE_HandleEvent ( const GAMEEVENT_e Event, AActor *pActivator, const int DataOne, const int DataTwo, const int OverrideResult ) | |
1082 | +LONG GAMEMODE_HandleEvent ( const GAMEEVENT_e Event, AActor *pActivator, const int DataOne, const int DataTwo, const bool bRunNow, const int OverrideResult ) | |
1083 | 1083 | { |
1084 | 1084 | // [BB] Clients don't start scripts. |
1085 | 1085 | if ( NETWORK_InClientMode() ) |
@@ -1091,13 +1091,6 @@ | ||
1091 | 1091 | const LONG lOldResult = GAMEMODE_GetEventResult( ); |
1092 | 1092 | GAMEMODE_SetEventResult( OverrideResult ); |
1093 | 1093 | |
1094 | - // [AK] Allow events that are triggered by an actor spawning or | |
1095 | - // taking damage to be executed immediately, in case any of the | |
1096 | - // actor pointers that were responsible for calling the event | |
1097 | - // become NULL after one tic. | |
1098 | - // Also allow chat events to be executed immediately. | |
1099 | - const bool bRunNow = ( Event == GAMEEVENT_ACTOR_SPAWNED || Event == GAMEEVENT_ACTOR_DAMAGED || Event == GAMEEVENT_ACTOR_ARMORDAMAGED || Event == GAMEEVENT_CHAT ); | |
1100 | - | |
1101 | 1094 | // [BB] The activator of the event activates the event script. |
1102 | 1095 | // The first argument is the type, e.g. GAMEEVENT_PLAYERFRAGS, |
1103 | 1096 | // the second and third are specific to the event, e.g. the second is the number of the fragged player. |
@@ -1138,7 +1131,7 @@ | ||
1138 | 1131 | temp->master = source; |
1139 | 1132 | temp->tracer = inflictor; |
1140 | 1133 | |
1141 | - damage = GAMEMODE_HandleEvent( DamageEvent, temp, damage, GlobalACSStrings.AddString( mod ), damage ); | |
1134 | + damage = GAMEMODE_HandleEvent( DamageEvent, temp, damage, GlobalACSStrings.AddString( mod ), true, damage ); | |
1142 | 1135 | |
1143 | 1136 | // [AK] Destroy the temporary actor after executing all event scripts. |
1144 | 1137 | temp->Destroy( ); |
@@ -213,7 +213,7 @@ | ||
213 | 213 | bool GAMEMODE_IsHandledSpecial ( AActor *Activator, int Special ); |
214 | 214 | GAMESTATE_e GAMEMODE_GetState ( void ); |
215 | 215 | void GAMEMODE_SetState ( GAMESTATE_e GameState ); |
216 | -LONG GAMEMODE_HandleEvent ( const GAMEEVENT_e Event, AActor *pActivator = NULL, const int DataOne = 0, const int DataTwo = 0, const int OverrideResult = 1 ); | |
216 | +LONG GAMEMODE_HandleEvent ( const GAMEEVENT_e Event, AActor *pActivator = NULL, const int DataOne = 0, const int DataTwo = 0, const bool bRunNow = false, const int OverrideResult = 1 ); | |
217 | 217 | bool GAMEMODE_HandleDamageEvent ( AActor *target, AActor *inflictor, AActor *source, int &damage, FName mod, bool bBeforeArmor = false ); |
218 | 218 | LONG GAMEMODE_GetEventResult ( void ); |
219 | 219 | void GAMEMODE_SetEventResult ( LONG lResult ); |
@@ -5205,7 +5205,7 @@ | ||
5205 | 5205 | // [AK] If we want to force GAMEEVENT_ACTOR_SPAWNED on every actor, then at least ignore |
5206 | 5206 | // the less imporant actors unless they have the USESPAWNEVENTSCRIPT flag enabled. |
5207 | 5207 | if (( STFlags & STFL_USESPAWNEVENTSCRIPT ) || (( gameinfo.bForceSpawnEventScripts ) && ( bNotImportant == false ))) |
5208 | - GAMEMODE_HandleEvent( GAMEEVENT_ACTOR_SPAWNED, this, !!( STFlags & STFL_LEVELSPAWNED )); | |
5208 | + GAMEMODE_HandleEvent( GAMEEVENT_ACTOR_SPAWNED, this, !!( STFlags & STFL_LEVELSPAWNED ), 0, true ); | |
5209 | 5209 | } |
5210 | 5210 | } |
5211 | 5211 |
@@ -1219,7 +1219,7 @@ | ||
1219 | 1219 | |
1220 | 1220 | // [AK] Trigger an event script indicating that a chat message was received. |
1221 | 1221 | // If the event returns 0, then don't print the message or send it to the clients. |
1222 | - if ( GAMEMODE_HandleEvent( GAMEEVENT_CHAT, NULL, ulPlayer != MAXPLAYERS ? ulPlayer : -1, ulMode - CHATMODE_GLOBAL ) == 0 ) | |
1222 | + if ( GAMEMODE_HandleEvent( GAMEEVENT_CHAT, NULL, ulPlayer != MAXPLAYERS ? ulPlayer : -1, ulMode - CHATMODE_GLOBAL, true ) == 0 ) | |
1223 | 1223 | return; |
1224 | 1224 | |
1225 | 1225 | SERVERCOMMANDS_PlayerSay( ulPlayer, pszString, ulMode, bForbidChatToPlayers ); |