diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index aae4b9488..1fc2cfa29 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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; } diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 1d2af56fe..915b32603 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -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; diff --git a/polymer/eduke32/source/lunatic/doc/lunacon.txt b/polymer/eduke32/source/lunatic/doc/lunacon.txt index 285569963..2e335a1a0 100644 --- a/polymer/eduke32/source/lunatic/doc/lunacon.txt +++ b/polymer/eduke32/source/lunatic/doc/lunacon.txt @@ -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 ^^^^^^^^^^^^^^^^^ diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index fb8e65c17..6fc9eb3a0 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -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) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 6e32ee966..2f471ed6d 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -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;