Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • zandronum/zandronum-stable
1 result
Show changes
Commits on Source (5)
......@@ -270,6 +270,7 @@
! - The end level delay no longer ticks while the game's paused. [AKMDM]
! - Players now earn medals while cl_medals is disabled, but the medals themselves still remain unseen. [AKMDM]
! - Removed the hardcoded spawning behaviour that was used specifically for Team LMS, in favour of using sv_spawnfarthest. [AKMDM]
! - Adding -NOTDMATCH to WhiteFlag inheriting actors now allows them to spawn in non-1FCTF gamemodes. [Trillster]
3.1
......
......@@ -55,7 +55,9 @@
// Returns a random number in the range [0,mod)
int operator() (int mod)
{
return GenRand32() % mod;
return (0 == mod)
? 0
: (GenRand32() % mod);
}
// Returns rand# - rand#
......
......@@ -8907,6 +8907,7 @@
int *pc = this->pc;
ACSFormat fmt = activeBehavior->GetFormat();
FBehavior* const savedActiveBehavior = activeBehavior;
unsigned int runaway = 0; // used to prevent infinite loops
int pcd;
FString work;
......@@ -8943,6 +8944,7 @@
{
default:
Printf ("Unknown P-Code %d in %s\n", pcd, ScriptPresentation(script).GetChars());
activeBehavior = savedActiveBehavior;
// fall through
case PCD_TERMINATE:
DPrintf ("%s finished\n", ScriptPresentation(script).GetChars());
......@@ -12685,5 +12687,10 @@
}
}
// There are several or more p-codes that can trigger a division or modulus of zero.
// Reset the active behavior back to the original if this happens.
if (state == SCRIPT_DivideBy0 || state == SCRIPT_ModulusBy0)
activeBehavior = savedActiveBehavior;
if (runaway != 0 && InModuleScriptNumber >= 0)
{
......@@ -12688,6 +12695,15 @@
if (runaway != 0 && InModuleScriptNumber >= 0)
{
activeBehavior->GetScriptPtr(InModuleScriptNumber)->ProfileData.AddRun(runaway);
auto scriptptr = activeBehavior->GetScriptPtr(InModuleScriptNumber);
if (scriptptr != nullptr)
{
scriptptr->ProfileData.AddRun(runaway);
}
else
{
// It is pointless to continue execution. The script is broken and needs to be aborted.
I_Error("Bad script definition encountered. Script %d is reported running but not present.\nThe most likely cause for this message is using 'delay' inside a function which is not supported.\nPlease check the ACS compiler used for compiling the script!", InModuleScriptNumber);
}
}
if (state == SCRIPT_DivideBy0)
......
......@@ -3726,7 +3726,8 @@
// to delete the white flags, which are used for one flag CTF.
if (( teamgame ) && ( oneflagctf == false ))
{
if ( pActor->IsKindOf( PClass::FindClass( "WhiteFlag" )))
// [TRSR] Unless a mod explicitly wants their WhiteFlag replacement to spawn in other modes.
if (( pActor->IsKindOf( PClass::FindClass( "WhiteFlag" ))) && ( pActor->flags & MF_NOTDMATCH ))
{
P_RemoveThingLocal( pActor );
continue;
......