From e6d1c9bd6a85cb1aae7ac16f081e16c806538d21 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 4 Dec 2011 21:21:01 +0000 Subject: [PATCH] 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 --- polymer/eduke32/samples/a.m32 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/samples/a.m32 b/polymer/eduke32/samples/a.m32 index 11acbc193..7889cfff1 100644 --- a/polymer/eduke32/samples/a.m32 +++ b/polymer/eduke32/samples/a.m32 @@ -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