diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 636001c14..ef69857c2 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -947,6 +947,7 @@ lpeg.P(false) + "shoot" + "shiftvarr" + "shiftvarl" + +"shadeto" + "setwall" + "setvarvar" + "setvar" + @@ -976,6 +977,7 @@ lpeg.P(false) + "sectgethitag" + "sectclearinterpolation" + "scriptsize" + +"screentext" + "savenn" + "savemapstate" + "savegamevar" + @@ -1001,6 +1003,7 @@ lpeg.P(false) + "qsubstr" + "qstrncat" + "qstrlen" + +"qstrdim" + "qstrcpy" + "qstrcat" + "qsprintf" + @@ -1078,6 +1081,7 @@ lpeg.P(false) + "ifserver" + "ifrnd" + "ifrespawn" + +"ifplayersl" + "ifpinventory" + "ifphealthl" + "ifpdistl" + @@ -1184,11 +1188,13 @@ lpeg.P(false) + "enhanced" + "endswitch" + "ends" + +"endoflevel" + "endofgame" + "endevent" + "enda" + "else" + "echo" + +"dynamicsoundremap" + "dynamicremap" + "dragpoint" + "divvarvar" + @@ -1254,5 +1260,6 @@ lpeg.P(false) + "actor" + "activatecheat" + "activatebysector" + +"activate" + "action" + lpeg.P(false) diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index 51c190d73..588fd70ac 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -792,15 +792,19 @@ function _digitalnumber(tilenum, x, y, num, shade, pal, orientation, cx1, cy1, cx2, cy2, zoom) end -function _gametext(tilenum, x, y, qnum, shade, pal, orientation, - cx1, cy1, cx2, cy2, zoom) +local function text_check_common(tilenum, orientation) if (tilenum >= ffiC.MAXTILES-255+0ULL) then - error("invalid base tile number "..tilenum, 2) + error("invalid base tile number "..tilenum, 3) end + return bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1 +end + +function _gametext(tilenum, x, y, qnum, shade, pal, orientation, + cx1, cy1, cx2, cy2, zoom) + orientation = text_check_common(tilenum, orientation) local cstr = bcheck.quote_idx(qnum) - orientation = bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1 ffiC.G_PrintGameText(0, tilenum, bit.arshift(x,1), y, cstr, shade, pal, orientation, cx1, cy1, cx2, cy2, zoom) end @@ -810,6 +814,26 @@ end -- x86 when clicking wildly through its menu. jit.off(_gametext) +function _screentext(tilenum, x, y, z, blockangle, charangle, q, shade, pal, orientation, + alpha, xspace, yline, xbetween, ybetween, f, x1, y1, x2, y2) + orientation = text_check_common(tilenum, orientation) + local cstr = bcheck.quote_idx(q) + + ffiC.G_ScreenText(tilenum, x, y, z, blockangle, charangle, cstr, shade, pal, orientation, + alpha, xspace, yline, xbetween, ybetween, f, x1, y1, x2, y2) +end + +function _qstrdim(tilenum, x, y, z, blockangle, q, orientation, + xspace, yline, xbetween, ybetween, f, x1, y1, x2, y2) + orientation = text_check_common(tilenum, orientation) + local cstr = bcheck.quote_idx(q) + + local dim = ffiC.G_ScreenTextSize(tilenum, x, y, z, blockangle, cstr, orientation, + xspace, yline, xbetween, ybetween, f, x1, y1, x2, y2); + return dim.x, dim.y +end + + local D = { -- TODO: dynamic tile remapping ACTIVATOR = 2, diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index ac71f25b7..0beea41d1 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -651,6 +651,21 @@ int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const int32_t s, int32_t p, int32_t o, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z); +typedef struct { + int32_t x, y; +} vec2_t; +vec2_t G_ScreenText(const int32_t font, + int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, + const char *str, const int32_t shade, int32_t pal, int32_t o, const int32_t alpha, + int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, + const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2); +vec2_t G_ScreenTextSize(const int32_t font, + int32_t x, int32_t y, const int32_t z, const int32_t blockangle, + const char *str, const int32_t o, + int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, + const int32_t f, + int32_t x1, int32_t y1, int32_t x2, int32_t y2); + void G_SaveMapState(void); void G_RestoreMapState(void); ]] diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index fdc3012e2..ad45e9a5b 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -1388,6 +1388,8 @@ local Couter = { --- 2. Defines and Meta-Settings dynamicremap = cmd() / Cmd.dynamicremap, + dynamicsoundremap = cmd() + / Cmd.NYI("`dynamicsoundremap'"), setcfgname = sp1 * tok.filename / Cmd.nyi("`setcfgname'"), setdefname = sp1 * tok.filename @@ -2299,6 +2301,14 @@ local Cinner = { / handle.getzrange, -- screen text and numbers display + qstrdim = cmd(W,W,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R) -- 2W 16R + / function(...) + return format("%s,%s=_con._qstrdim("..n_s_fmt(16)..")", ...) + end, + screentext = cmd(R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R) -- 20 R + / function(...) + return format("_con._screentext("..n_s_fmt(20)..")", ...) + end, gametext = cmd(R,R,R,R,R,R,R,R,R,R,R) -- 11 R / function(...) return format("_con._gametext("..n_s_fmt(11)..",65536)", ...)