Skip to content
Snippets Groups Projects
Select Git revision
  • a58461c29e610c4fcacb940c4e37c44c933a3080
  • next default protected
  • next-test
  • classic-netcode-fixes
  • fix-dedi-pthread
  • fix-enemy-target
  • master protected
  • better-distance-math
  • movie
  • softcode-info
  • acs
  • clipmidtex
  • custom-map-names
  • nogravity-trampolines
  • 2214-pre4
  • 2214-pre3
  • just-in-case
  • fix-opengl-parameter-crash
  • 2214-pre2
  • 2214-pre1
  • delfile2
  • SRB2_release_2.2.15
  • SRB2_release_2.2.13
  • SRB2_release_2.2.12
  • SRB2_release_2.2.11
  • SRB2_release_2.2.10
  • SRB2_release_2.2.9
  • SRB2_release_2.2.8
  • SRB2_release_2.2.7
  • SRB2_release_2.2.6
  • SRB2_release_2.2.5
  • SRB2_release_2.2.4
  • SRB2_release_2.2.3
  • SRB2_release_2.2.2
  • SRB2_release_2.2.1
  • SRB2_release_2.2.0
  • SRB2_release_2.1.25
  • SRB2_release_2.1.24
  • SRB2_release_2.1.23
  • SRB2_release_2.1.22
  • SRB2_release_2.1.21
41 results

d_main.h

Blame
  • lua_script.h 2.23 KiB
    // SONIC ROBO BLAST 2
    //-----------------------------------------------------------------------------
    // Copyright (C) 2012-2014 by John "JTE" Muniz.
    // Copyright (C) 2012-2014 by Sonic Team Junior.
    //
    // This program is free software distributed under the
    // terms of the GNU General Public License, version 2.
    // See the 'LICENSE' file for more details.
    //-----------------------------------------------------------------------------
    /// \file  lua_script.h
    /// \brief Lua scripting basics
    
    #ifdef HAVE_BLUA
    
    #include "m_fixed.h"
    #include "doomtype.h"
    #include "d_player.h"
    
    #include "blua/lua.h"
    #include "blua/lualib.h"
    #include "blua/lauxlib.h"
    
    #define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i))
    #define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i))
    
    // fixed_t casting
    // TODO add some distinction between fixed numbers and integer numbers
    // for at least the purpose of printing and maybe math.
    #define luaL_checkfixed(L, i) luaL_checkinteger(L, i)
    #define lua_pushfixed(L, f) lua_pushinteger(L, f)
    
    // angle_t casting
    // we reduce the angle to a fixed point between 0.0 and 1.0
    #define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16)
    #define lua_pushangle(L, a) lua_pushfixed(L, a>>16)
    
    #ifdef _DEBUG
    void LUA_ClearExtVars(void);
    #endif
    
    void LUA_LoadLump(UINT16 wad, UINT16 lump);
    #ifdef LUA_ALLOW_BYTECODE
    void LUA_DumpFile(const char *filename);
    #endif
    fixed_t LUA_EvalMath(const char *word);
    void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
    void LUA_InvalidateUserdata(void *data);
    void LUA_InvalidateLevel(void);
    void LUA_InvalidateMapthings(void);
    void LUA_InvalidatePlayer(player_t *player);
    void LUA_Archive(void);
    void LUA_UnArchive(void);
    void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
    void LUA_CVarChanged(const char *name); // lua_consolelib.c
    int Lua_optoption(lua_State *L, int narg,
    	const char *def, const char *const lst[]);
    
    // Console wrapper
    void COM_Lua_f(void);
    
    #define LUA_Call(L,a)\
    {\
    	if (lua_pcall(L, a, 0, 0)) {\
    		CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(L,-1));\
    		lua_pop(L, 1);\
    	}\
    }
    
    #define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
    
    #endif