static int libd_draw(lua_State *L) { INT32 x, y, flags; patch_t *patch; const UINT8 *colormap = NULL; HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH)); flags = luaL_optinteger(L, 4, 0); if (!lua_isnoneornil(L, 5)) colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP)); flags &= ~V_PARAMMASK; // Don't let crashes happen. V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, flags, patch, colormap); return 0; }
static int libd_drawScaled(lua_State *L) { fixed_t x, y, scale; INT32 flags; patch_t *patch; const UINT8 *colormap = NULL; HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); scale = luaL_checkinteger(L, 3); patch = *((patch_t **)luaL_checkudata(L, 4, META_PATCH)); flags = luaL_optinteger(L, 5, 0); if (!lua_isnoneornil(L, 6)) colormap = *((UINT8 **)luaL_checkudata(L, 6, META_COLORMAP)); flags &= ~V_PARAMMASK; // Don't let crashes happen. V_DrawFixedPatch(x, y, scale, flags, patch, colormap); return 0; }
static int libd_draw(lua_State *L) { INT32 x, y, flags; patch_t *patch; const UINT8 *colormap = NULL; if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH)); flags = luaL_optinteger(L, 4, 0); if (!lua_isnoneornil(L, 5)) colormap = luaL_checkudata(L, 5, META_COLORMAP); flags &= ~V_PARAMMASK; // Don't let crashes happen. V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, flags, patch, colormap); return 0; }