LunaCON: implement 'precache'.

git-svn-id: https://svn.eduke32.com/eduke32@4291 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-02-02 10:50:40 +00:00
parent 6d8ea48257
commit 21a8788b6b
5 changed files with 21 additions and 14 deletions

View file

@ -463,7 +463,7 @@ projectile_t;
typedef struct { typedef struct {
uint32_t _flags; // XXX: do we want to have this accessible at game time? uint32_t _flags; // XXX: do we want to have this accessible at game time?
const int32_t _cacherange; int32_t _cacherange;
const projectile_t _defproj; const projectile_t _defproj;
} tiledata_t; } tiledata_t;

View file

@ -171,7 +171,7 @@ for the `state` invocation.
`-ferror-nonlocal-userdef` (default: on):: `-ferror-nonlocal-userdef` (default: on)::
If enabled, an attept to issue `getuserdef` or `setuserdef` when the current If enabled, an attept to issue `getuserdef` or `setuserdef` when the current
player doesn't equal the local player generates an error. Otherwise, the player doesn't equal the local player generates an error. Otherwise, the
userdef structure is accessible without restriction. userdef structure can be accessed irrespective of the current player.
`-fbad-getactorvar-use-pli` (default: off):: `-fbad-getactorvar-use-pli` (default: off)::
If enabled and `-Werror-bad-getactorvar` is off, a `getactorvar` of a If enabled and `-Werror-bad-getactorvar` is off, a `getactorvar` of a
@ -322,11 +322,11 @@ implemented.
The following commands are not yet implemented. Those highlighted in bold give The following commands are not yet implemented. Those highlighted in bold give
errors, while the others merely warn either at translation or execution errors, while the others merely warn either at translation or execution
time. Parenthesized commands are of questionable use. time.
Directives Directives
^^^^^^^^^^ ^^^^^^^^^^
*`includedefault`*, `definecheat`, `setcfgname`, `setgamename`, (`precache`) *`includedefault`*, `definecheat`, `setcfgname`, `setgamename`
Run-time commands Run-time commands
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^

View file

@ -1292,6 +1292,18 @@ function Cmd.xspriteflags(tilenum, flags)
end end
end end
function Cmd.precache(tilenum0, tilenum1, flagnum)
local ok = check.tile_idx(tilenum0) and check.tile_idx(tilenum1)
if (ffi and ok) then
ffiC.g_tile[tilenum0]._cacherange = tilenum1;
if (flagnum) then
ffiC.g_tile[tilenum0]._flags = bit.bor(
ffiC.g_tile[tilenum0]._flags, conl.SFLAG.SFLAG_CACHE)
end
end
end
function Cmd.cheatkeys(sc1, sc2) function Cmd.cheatkeys(sc1, sc2)
if (ffi) then if (ffi) then
ffiC.CheatKeys[0] = sc1 ffiC.CheatKeys[0] = sc1
@ -1749,7 +1761,7 @@ local Couter = {
/ Cmd.nyi("`setgamename'"), / Cmd.nyi("`setgamename'"),
precache = cmd(D,D,D) precache = cmd(D,D,D)
, -- / Cmd.nyi("`precache'"), / Cmd.precache,
scriptsize = cmd(D) scriptsize = cmd(D)
/ "", -- no-op / "", -- no-op
cheatkeys = cmd(D,D) cheatkeys = cmd(D,D)

View file

@ -82,7 +82,6 @@ static void G_CacheSpriteNum(int32_t i)
maxc = 1; maxc = 1;
if (g_tile[PN].cacherange >= PN)
for (j = PN; j <= g_tile[PN].cacherange; j++) for (j = PN; j <= g_tile[PN].cacherange; j++)
tloadtile(j,1); tloadtile(j,1);
@ -467,13 +466,9 @@ void G_CacheMapData(void)
tloadtile(LA+2, 0); tloadtile(LA+2, 0);
} }
j = headspritesect[i]; for (SPRITES_OF_SECT(i, j))
while (j >= 0)
{
if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0) if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0)
G_CacheSpriteNum(j); G_CacheSpriteNum(j);
j = nextspritesect[j];
}
} }
tc = totalclock; tc = totalclock;