mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
LunaCON: fix tilesizx[] and tilesizy[] system gamearrays.
git-svn-id: https://svn.eduke32.com/eduke32@4731 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1f9c37517a
commit
76d60511bc
4 changed files with 25 additions and 8 deletions
|
@ -951,8 +951,8 @@ end
|
|||
|
||||
local tile_static_members = defs_c.static_members_tab()
|
||||
do
|
||||
tile_static_members.sizx = defs_c.creategtab(ffiC.tilesizx, ffiC.MAXTILES, "tilesizx[]")
|
||||
tile_static_members.sizy = defs_c.creategtab(ffiC.tilesizy, ffiC.MAXTILES, "tilesizy[]")
|
||||
tile_static_members.sizx = defs_c.creategtab_membidx(ffiC.tilesiz, "x", ffiC.MAXTILES, "tilesizx[]")
|
||||
tile_static_members.sizy = defs_c.creategtab_membidx(ffiC.tilesiz, "y", ffiC.MAXTILES, "tilesizy[]")
|
||||
end
|
||||
|
||||
-- XXX: error message will say "g_player_ps"
|
||||
|
|
|
@ -444,7 +444,7 @@ int32_t guniqhudid;
|
|||
const int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
||||
const int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
||||
const int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
||||
const int16_t tilesizx[MAXTILES], tilesizy[MAXTILES];
|
||||
const vec2_t tilesiz[MAXTILES];
|
||||
|
||||
uint8_t show2dsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
|
@ -849,7 +849,7 @@ end
|
|||
|
||||
---- indirect C array access ----
|
||||
|
||||
-- create a safe indirection for an ffi.C array
|
||||
-- Create a safe indirection for an ffi.C array.
|
||||
function creategtab(ctab, maxidx, name)
|
||||
local tab = {}
|
||||
local tmpmt = {
|
||||
|
@ -867,6 +867,25 @@ function creategtab(ctab, maxidx, name)
|
|||
return setmtonce(tab, tmpmt)
|
||||
end
|
||||
|
||||
-- Create a a safe indirection for an ffi.C struct array, accessing a given
|
||||
-- member.
|
||||
function creategtab_membidx(ctab, membname, maxidx, name)
|
||||
local tab = {}
|
||||
local tmpmt = {
|
||||
__index = function(tab, key)
|
||||
if (key>=0 and key < maxidx) then
|
||||
return ctab[key][membname]
|
||||
end
|
||||
error('out-of-bounds '..name..' read access', 2)
|
||||
end,
|
||||
__newindex = function()
|
||||
error('cannot write directly to '..name, 2)
|
||||
end,
|
||||
}
|
||||
|
||||
return setmtonce(tab, tmpmt)
|
||||
end
|
||||
|
||||
-- Construct const struct from table
|
||||
function conststruct(tab)
|
||||
local strtab = { "struct {" }
|
||||
|
|
|
@ -46,8 +46,7 @@ prevspritesect;
|
|||
prevspritestat;
|
||||
nextspritesect;
|
||||
nextspritestat;
|
||||
tilesizx;
|
||||
tilesizy;
|
||||
tilesiz;
|
||||
|
||||
show2dsector;
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ prevspritesect;
|
|||
prevspritestat;
|
||||
nextspritesect;
|
||||
nextspritestat;
|
||||
tilesizx;
|
||||
tilesizy;
|
||||
tilesiz;
|
||||
|
||||
show2dsector;
|
||||
|
||||
|
|
Loading…
Reference in a new issue