Mapster32: add "extend all highlighted sectors" func to 'F menu via a.m32.

git-svn-id: https://svn.eduke32.com/eduke32@2866 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-06 20:00:35 +00:00
parent 936ef3424b
commit 8f61b72ca2
4 changed files with 92 additions and 27 deletions

View file

@ -131,6 +131,7 @@ enum GamearrayFlags_t {
MAXARRAYLABEL = MAXVARLABEL,
GAMEARRAY_READONLY = 0x00001000,
GAMEARRAY_WARN = 0x00002000,
GAMEARRAY_NORMAL = 0,
GAMEARRAY_OFCHAR = 0x00000001,

View file

@ -452,7 +452,85 @@ defstate rotselspr
}
ends
gamevar do_batch_extension 0 0
gamevar batch_ohl_i -1 0
gamevar batch_tmp 0 0
////// sector collecting stuff
gamearray collectedsectors MAXSECTORS // shared with 'old-highlighted sectors'
gamevar ohlsecs 0 0
// 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 extendhlsectors
"Extend all hl. sectors"
ifvarle highlightsectorcnt 0 return
state save_restore_hlsectors // will save them
for i range highlightsectorcnt
sethighlightsector highlightsector[i] 0
set do_batch_extension 1
set batch_ohl_i 0
ends
onevent EVENT_PREKEYS2D
ifvare do_batch_extension 1
set do_batch_extension 2
else ifvare do_batch_extension 2
{
ifge batch_ohl_i ohlsecs
{
// done!
set do_batch_extension 0
set batch_ohl_i -1
set keystatus[0x1d] 0
set keystatus[0x12] 0
}
else
{
ifvare batch_tmp 0
{
// highlight that sector
sethighlightsector collectedsectors[batch_ohl_i] 1
set batch_tmp 1
}
else // ... skip a mainloop iteration so that a frame can be displayed
{
set batch_tmp 0
add batch_ohl_i 1
// fake a Ctrl-E
set keystatus[0x1d] 1
set keystatus[0x12] 1
}
}
break
}
// state testkeyavail
set j 0
@ -488,9 +566,6 @@ onevent EVENT_ENTER3DMODE
state setas
endevent
////// sector collecting stuff
gamevar ohlsecs 0 0
gamearray collectedsectors MAXSECTORS // shared with 'old-highlighted sectors'
defstate try_nextsector_teleporting
var nexts
@ -514,26 +589,6 @@ defstate try_nextsector_ceilingsky
set RETURN 0
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

View file

@ -1149,10 +1149,19 @@ static void C_GetNextVarType(int32_t type)
}
else if (id<MAXGAMEARRAYS) // simple (non-local) gamearrays
{
if (!m32_script_expertmode && (aGameArrays[id].dwFlags & GAMEARRAY_READONLY) && (type&GV_WRITABLE))
if (!m32_script_expertmode && (type&GV_WRITABLE))
{
C_ReportError(ERROR_ARRAYREADONLY);
g_numCompilerErrors++;
int32_t flags = aGameArrays[id].dwFlags;
if (flags & GAMEARRAY_READONLY)
{
C_ReportError(ERROR_ARRAYREADONLY);
g_numCompilerErrors++;
}
else if (flags & GAMEARRAY_WARN)
{
C_CUSTOMWARNING("writing to expert-mode array. Be sure to know what you're doing!");
}
}
}
else // local array

View file

@ -681,7 +681,7 @@ static void Gv_AddSystemVars(void)
Gv_NewArray("show2dwall", (void *)show2dwall, (MAXWALLS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("show2dsprite", (void *)show2dsprite, (MAXSPRITES+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("keystatus", (void *)keystatus, 256, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("keystatus", (void *)keystatus, 256, GAMEARRAY_WARN|GAMEARRAY_OFCHAR);
Gv_NewArray("alphakeys", (void *)alphakeys, sizeof(alphakeys), GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("numberkeys", (void *)numberkeys, sizeof(numberkeys), GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);