mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
LunaCON: error on userdefs accesses with non-local current player.
Add lunatic/test/getuserdef.con. git-svn-id: https://svn.eduke32.com/eduke32@4285 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6d4f56c643
commit
60612d07f0
6 changed files with 29 additions and 1 deletions
|
@ -807,7 +807,7 @@ for member, code in pairs(ProjectileLabels) do
|
|||
end
|
||||
end
|
||||
|
||||
local UD = function(memb) return "_gv._ud"..memb end
|
||||
local UD = function(memb) return "_gud(_pli)"..memb end
|
||||
local UDRO = function(memb) return { UD(memb) } end
|
||||
|
||||
-- NOTE: Only members that actually encountered in existing mods are added here.
|
||||
|
|
|
@ -516,6 +516,14 @@ function _getsap(aci, pli)
|
|||
return (aci>=0) and sprite[aci], (aci>=0) and actor[aci], (pli>=0) and player[pli]
|
||||
end
|
||||
|
||||
function _gud(pli)
|
||||
if (pli ~= ffiC.myconnectindex) then
|
||||
error(format("userdefs access with non-local current player %d (we: %d)",
|
||||
pli, ffiC.myconnectindex), 2)
|
||||
end
|
||||
return ffiC.ud
|
||||
end
|
||||
|
||||
--- player/actor/sprite searching functions ---
|
||||
|
||||
local xmath = require("xmath")
|
||||
|
|
|
@ -603,6 +603,7 @@ decl("map_t MapInfo[$*$];", con_lang.MAXVOLUMES+1, con_lang.MAXLEVELS)
|
|||
decl("char EpisodeNames[$][33];", con_lang.MAXVOLUMES)
|
||||
|
||||
decl[[
|
||||
const int32_t myconnectindex;
|
||||
int32_t g_RETURN;
|
||||
int32_t g_elCONSize;
|
||||
char *g_elCON;
|
||||
|
|
|
@ -117,6 +117,7 @@ g_sizes_of;
|
|||
g_elFirstTime;
|
||||
g_elCallDepth;
|
||||
block_deletesprite;
|
||||
myconnectindex;
|
||||
g_RETURN;
|
||||
g_elModules;
|
||||
g_modDir;
|
||||
|
|
|
@ -305,6 +305,7 @@ local function new_initial_codetab()
|
|||
"local _band, _bor, _bxor = _bit.band, _bit.bor, _bit.bxor",
|
||||
"local _lsh, _rsh, _arsh = _bit.lshift, _bit.rshift, _bit.arshift",
|
||||
"local _setsprite,_ssp = _con._setsprite,_con._ssp",
|
||||
"local _gud=_con._gud",
|
||||
|
||||
-- * CON "states" (subroutines) and
|
||||
-- * Switch function table, indexed by global switch sequence number:
|
||||
|
|
17
polymer/eduke32/source/lunatic/test/getuserdef.con
Normal file
17
polymer/eduke32/source/lunatic/test/getuserdef.con
Normal file
|
@ -0,0 +1,17 @@
|
|||
// XXX: should be allowed to override existing modes? (Probably yes.)
|
||||
// XXX: but currently, this ensues badness? (g_numGametypes becomes inconsistent?)
|
||||
definegametype 0 46051 Cooperative
|
||||
|
||||
gamevar temp 0 0
|
||||
|
||||
// Original version by Fox, from
|
||||
// http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__183890
|
||||
onevent EVENT_DISPLAYREST
|
||||
// getuserdef[THISACTOR].statusbarscale temp
|
||||
// NOTE: index (THISACTOR) is never used.
|
||||
// NOTE: incorrect if screenpeek != myconnectindex, e.g. by pressing [K]:
|
||||
getuserdef .statusbarscale temp
|
||||
redefinequote 0 %ld
|
||||
qsprintf 0 0 temp
|
||||
gametext STARTALPHANUM 10 10 0 0 0 0 0 0 xdim ydim
|
||||
endevent
|
Loading…
Reference in a new issue