a.m32: New function save_restore_hlsectors, also accessible from the Quote-F

menu.  If some sectors are highlighted, save their indices.  The highlighting
of those particular sectors can then be restored at a later time (but careful
across structural modifications that tweak sector indices) by running the same
function.  Shares a 'gamearray' with function 'collect_teleporting_sectors',
so the latter will reset this one when run.

git-svn-id: https://svn.eduke32.com/eduke32@2155 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-04 21:21:01 +00:00
parent 3aac0c1bd4
commit e6d1c9bd6a

View file

@ -486,7 +486,8 @@ onevent EVENT_ENTER3DMODE
endevent
////// sector collecting stuff
gamearray collectedsectors MAXSECTORS
gamevar ohlsecs 0 0
gamearray collectedsectors MAXSECTORS // shared with 'old-highlighted sectors'
defstate try_nextsector
var nexts
@ -503,6 +504,26 @@ defstate try_nextsector
}
ends
// save or restore highlighted sectors
defstate save_restore_hlsectors
"Save/restore hl. sectors"
ifge highlightsectorcnt 0
{
// save
for i range highlightsectorcnt
set collectedsectors[i] highlightsector[i]
set ohlsecs highlightsectorcnt
quote "Highlighted sectors saved"
}
else ifl highlightcnt 0
{
for i range ohlsecs
sethighlightsector collectedsectors[i] 1
quote "Highlighted sectors restored"
}
ends
defstate collect_teleporting_sectors // (sec)
"Collect telep. sectors"
var numsects
@ -514,6 +535,8 @@ defstate collect_teleporting_sectors // (sec)
ifl sec 0, return
}
set ohlsecs 0 // reset old hl'd sectors
collectsectors collectedsectors sec numsects try_nextsector
for i range numsects
sethighlightsector collectedsectors[i] 1