From d5beae97382027750992d6a18615cab49b9020f0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 8 Sep 2020 18:08:08 +0100 Subject: [PATCH] Begin work on adding access to polyobjects in Lua: * create new file lua_polyobjlib.c * made a stub LUA_PolyObjLib function * added META_POLYOBJ to lua_libs.h * updated makefile, CMake and MSVC project files for lua_polyobjlib.c --- src/CMakeLists.txt | 1 + src/blua/Makefile.cfg | 1 + src/lua_libs.h | 3 +++ src/lua_polyobjlib.c | 22 ++++++++++++++++++++++ src/lua_script.c | 1 + src/sdl/Srb2SDL-vc10.vcxproj | 1 + src/sdl/Srb2SDL-vc10.vcxproj.filters | 3 +++ 7 files changed, 32 insertions(+) create mode 100644 src/lua_polyobjlib.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e3da126b..0eb13c690 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -261,6 +261,7 @@ set(SRB2_LUA_SOURCES lua_mathlib.c lua_mobjlib.c lua_playerlib.c + lua_polyobjlib.c lua_script.c lua_skinlib.c lua_thinkerlib.c diff --git a/src/blua/Makefile.cfg b/src/blua/Makefile.cfg index 12ea064b4..eae95ba3a 100644 --- a/src/blua/Makefile.cfg +++ b/src/blua/Makefile.cfg @@ -47,5 +47,6 @@ OBJS:=$(OBJS) \ $(OBJDIR)/lua_skinlib.o \ $(OBJDIR)/lua_thinkerlib.o \ $(OBJDIR)/lua_maplib.o \ + $(OBJDIR)/lua_polyobjlib.o \ $(OBJDIR)/lua_blockmaplib.o \ $(OBJDIR)/lua_hudlib.o diff --git a/src/lua_libs.h b/src/lua_libs.h index f987c79fd..b25e18a47 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -50,6 +50,8 @@ extern lua_State *gL; #define META_VECTOR3 "VECTOR3_T" #define META_MAPHEADER "MAPHEADER_T*" +#define META_POLYOBJ "POLYOBJ_T*" + #define META_CVAR "CONSVAR_T*" #define META_SECTORLINES "SECTOR_T*LINES" @@ -88,5 +90,6 @@ int LUA_PlayerLib(lua_State *L); int LUA_SkinLib(lua_State *L); int LUA_ThinkerLib(lua_State *L); int LUA_MapLib(lua_State *L); +int LUA_PolyObjLib(lua_State *L); int LUA_BlockmapLib(lua_State *L); int LUA_HudLib(lua_State *L); diff --git a/src/lua_polyobjlib.c b/src/lua_polyobjlib.c new file mode 100644 index 000000000..682288258 --- /dev/null +++ b/src/lua_polyobjlib.c @@ -0,0 +1,22 @@ +// SONIC ROBO BLAST 2 +//----------------------------------------------------------------------------- +// Copyright (C) 2020 by Iestyn "Monster Iestyn" Jealous. +// Copyright (C) 2016-2020 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_polyobjlib.c +/// \brief polyobject library for Lua scripting + +#include "doomdef.h" +#include "p_local.h" +#include "p_polyobj.h" +#include "lua_script.h" +#include "lua_libs.h" + +int LUA_PolyObjLib(lua_State *L) +{ + return 0; +} diff --git a/src/lua_script.c b/src/lua_script.c index 0260f018a..9562c89d2 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -50,6 +50,7 @@ static lua_CFunction liblist[] = { LUA_SkinLib, // skin_t, skins[] LUA_ThinkerLib, // thinker_t LUA_MapLib, // line_t, side_t, sector_t, subsector_t + LUA_PolyObjLib, // polyobj_t LUA_BlockmapLib, // blockmap stuff LUA_HudLib, // HUD stuff NULL diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index c6cef56de..43aa003b9 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -400,6 +400,7 @@ + diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index 04a1b5fa5..592b9f80c 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -720,6 +720,9 @@ LUA + + LUA + LUA