mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
ACS: Invalidate mapscope before PU_LEVEL purge occours
Fixes the MapWarp memory corruption conclusively.
This commit is contained in:
parent
b95b076bed
commit
0c645810c6
3 changed files with 50 additions and 3 deletions
|
|
@ -70,6 +70,28 @@ void ACS_Shutdown(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void ACS_InvalidateMapScope(size_t mapID)
|
||||||
|
|
||||||
|
See header file for description.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
void ACS_InvalidateMapScope(void)
|
||||||
|
{
|
||||||
|
Environment *env = &ACSEnv;
|
||||||
|
|
||||||
|
ACSVM::GlobalScope *const global = env->getGlobalScope(0);
|
||||||
|
ACSVM::HubScope *hub = NULL;
|
||||||
|
ACSVM::MapScope *map = NULL;
|
||||||
|
|
||||||
|
// Conclude hub scope, even if we are not using it.
|
||||||
|
hub = global->getHubScope(0);
|
||||||
|
hub->reset();
|
||||||
|
|
||||||
|
// Conclude current map scope.
|
||||||
|
map = hub->getMapScope(0); // This is where you'd put in mapID if you add hub support.
|
||||||
|
map->reset();
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
void ACS_LoadLevelScripts(size_t mapID)
|
void ACS_LoadLevelScripts(size_t mapID)
|
||||||
|
|
||||||
|
|
@ -103,14 +125,20 @@ void ACS_LoadLevelScripts(size_t mapID)
|
||||||
// hubs are to be implemented, this logic would need
|
// hubs are to be implemented, this logic would need
|
||||||
// to be far more sophisticated.
|
// to be far more sophisticated.
|
||||||
|
|
||||||
// Reset hub scope, even if we are not using it.
|
// Extra note regarding the commented out ->reset()'s:
|
||||||
|
// This is too late! That needs to be done before
|
||||||
|
// PU_LEVEL is purged. Call ACS_InvalidateMapScope
|
||||||
|
// to take care of that. Those lines are left in
|
||||||
|
// only as a warning to future code spelunkers.
|
||||||
|
|
||||||
|
// Restart hub scope, even if we are not using it.
|
||||||
hub = global->getHubScope(0);
|
hub = global->getHubScope(0);
|
||||||
hub->reset();
|
//hub->reset();
|
||||||
hub->active = true;
|
hub->active = true;
|
||||||
|
|
||||||
// Start up new map scope.
|
// Start up new map scope.
|
||||||
map = hub->getMapScope(0); // This is where you'd put in mapID if you add hub support.
|
map = hub->getMapScope(0); // This is where you'd put in mapID if you add hub support.
|
||||||
map->reset();
|
//map->reset();
|
||||||
map->active = true;
|
map->active = true;
|
||||||
|
|
||||||
// Insert BEHAVIOR lump into the list.
|
// Insert BEHAVIOR lump into the list.
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,23 @@ void ACS_Init(void);
|
||||||
void ACS_Shutdown(void);
|
void ACS_Shutdown(void);
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void ACS_InvalidateMapScope(size_t mapID);
|
||||||
|
|
||||||
|
Resets the ACS hub and map scopes to remove
|
||||||
|
existing running scripts, without starting
|
||||||
|
any new scripts.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
None
|
||||||
|
|
||||||
|
Return:-
|
||||||
|
None
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
|
void ACS_InvalidateMapScope(void);
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
void ACS_LoadLevelScripts(size_t mapID);
|
void ACS_LoadLevelScripts(size_t mapID);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8340,6 +8340,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
|
|
||||||
K_UnsetDialogue();
|
K_UnsetDialogue();
|
||||||
|
|
||||||
|
ACS_InvalidateMapScope();
|
||||||
|
|
||||||
LUA_InvalidateLevel();
|
LUA_InvalidateLevel();
|
||||||
|
|
||||||
for (ss = sectors; sectors+numsectors != ss; ss++)
|
for (ss = sectors; sectors+numsectors != ss; ss++)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue