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

@ -4625,7 +4625,7 @@ static int32_t C_ParseCommand(int32_t loop)
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
if (*g_scriptPtr)
g_tile[j].flags |= SPRITE_CACHE;
g_tile[j].flags |= SPRITE_CACHE;
break;
}

View file

@ -463,7 +463,7 @@ projectile_t;
typedef struct {
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;
} tiledata_t;

View file

@ -171,7 +171,7 @@ for the `state` invocation.
`-ferror-nonlocal-userdef` (default: on)::
If enabled, an attept to issue `getuserdef` or `setuserdef` when the current
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)::
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
errors, while the others merely warn either at translation or execution
time. Parenthesized commands are of questionable use.
time.
Directives
^^^^^^^^^^
*`includedefault`*, `definecheat`, `setcfgname`, `setgamename`, (`precache`)
*`includedefault`*, `definecheat`, `setcfgname`, `setgamename`
Run-time commands
^^^^^^^^^^^^^^^^^

View file

@ -1292,6 +1292,18 @@ function Cmd.xspriteflags(tilenum, flags)
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)
if (ffi) then
ffiC.CheatKeys[0] = sc1
@ -1749,7 +1761,7 @@ local Couter = {
/ Cmd.nyi("`setgamename'"),
precache = cmd(D,D,D)
, -- / Cmd.nyi("`precache'"),
/ Cmd.precache,
scriptsize = cmd(D)
/ "", -- no-op
cheatkeys = cmd(D,D)

View file

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