Duke3D: savemapstate can overwrite the wrong map slot
If one executes the command savemapstate
immediately after the userdef struct members volume_number
and level_number
are updated, the command will store the state of the currently loaded map in the slot pointed to by level_number
and volume_number
, instead of the proper map slot.
Subsequently executing loadmapstate
on said slot will then result in the game loading a copy of the previous map in the new slot.
There are several ways in which this can happen. Examples:
Simply executing savemapstate after startlevel:
onevent EVENT_ENTERLEVEL
loadmapstate
endevent
onevent EVENT_ALTFIRE
startlevel 1 5
savemapstate // E2L6 is now overridden
endevent
Executing savemapstate inside EVENT_ENDLEVELSCREEN
onevent EVENT_ENTERLEVEL
loadmapstate
endevent
onevent EVENT_ENDLEVELSCREEN
savemapstate // will override the next map always
endevent
During testing of WGR2 we have also encountered this problem in a case where the mapstate was saved on the same tick where the player exited the map using sector lotag -1.