From 34645238d4693852cbdded8c35b61efed44ff72f Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 3 Mar 2019 20:08:11 -0500 Subject: [PATCH 1/8] Fix MF_NOCLIPTHING --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 95ad0258..58007052 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -456,7 +456,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE))) + if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING)) return true; // Don't collide with your buddies while NiGHTS-flying. From e9771cd7d01e43f61608161e87571bd3773d6599 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Mon, 8 Jul 2019 08:39:31 -0500 Subject: [PATCH 2/8] Make FixedRem less laggy by just using the modulo operator. --- src/m_fixed.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 4609913b..654af6be 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -206,14 +206,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b) */ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y) { - const boolean n = x < 0; - x = abs(x); - while (x >= y) - x -= y; - if (n) - return -x; - else - return x; + return x % y; } /** \brief The FixedSqrt function From 2dd5f1abe3212eb9d6f2b9ee8e6127900fc68f6e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Aug 2019 18:18:29 +0100 Subject: [PATCH 3/8] Fixes for lib_cvRegisterVar (the Lua version of CV_RegisterVar): * Make sure the consvar's properties are all initialised to zeros as defaults * Error if the consvar is not given a name * Error if the consvar has CV_CALL but no call function * Error if the consvar has CV_NOINIT but not CV_CALL --- src/lua_consolelib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index dced4e43..7766ba1c 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -303,6 +303,8 @@ static int lib_cvRegisterVar(lua_State *L) #define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e); #define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1))) + memset(cvar, 0x00, sizeof(consvar_t)); // zero everything by default + lua_pushnil(L); while (lua_next(L, 1)) { // stack: cvar table, cvar userdata, key/index, value @@ -390,6 +392,13 @@ static int lib_cvRegisterVar(lua_State *L) #undef FIELDERROR #undef TYPEERROR + if (!cvar->name) + return luaL_error(L, M_GetText("Variable has no name!\n")); + if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL)) + return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name); + if ((cvar->flags & CV_CALL) && !cvar->func) + return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name); + // stack: cvar table, cvar userdata lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars"); I_Assert(lua_istable(L, 3)); From 7731bf6b09d5027bd984c2641911e361a6d24103 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 21 Aug 2019 21:25:45 -0400 Subject: [PATCH 4/8] Use correct integer format --- src/lua_playerlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index dd743932..1b219c70 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -628,7 +628,7 @@ static int power_get(lua_State *L) UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); if (p >= NUMPOWERS) - return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p); + return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p); lua_pushinteger(L, powers[p]); return 1; } @@ -640,7 +640,7 @@ static int power_set(lua_State *L) powertype_t p = luaL_checkinteger(L, 2); UINT16 i = (UINT16)luaL_checkinteger(L, 3); if (p >= NUMPOWERS) - return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p); + return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p); if (hud_running) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); powers[p] = i; From 9f7613ef6d280d30b571f35fbf53293004172450 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 24 Aug 2019 18:22:18 -0400 Subject: [PATCH 5/8] Typecast p to INT16 Since the enum type is implementation-defined, and could be either signed or unsigned. --- src/lua_playerlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 1b219c70..d5b949f4 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -628,19 +628,19 @@ static int power_get(lua_State *L) UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); if (p >= NUMPOWERS) - return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p); + return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p); lua_pushinteger(L, powers[p]); return 1; } // powers, p, value -> powers[p] = value -static int power_set(lua_State *L) -{ +static int power_set(lua_State *L){ + UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); UINT16 i = (UINT16)luaL_checkinteger(L, 3); if (p >= NUMPOWERS) - return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p); + return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p); if (hud_running) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); powers[p] = i; From 08808e220077b8899e361423cb665903d3c360ad Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 24 Aug 2019 18:27:07 -0400 Subject: [PATCH 6/8] I don't even know how this happened --- src/lua_playerlib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index d5b949f4..b3bda252 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -634,7 +634,8 @@ static int power_get(lua_State *L) } // powers, p, value -> powers[p] = value -static int power_set(lua_State *L){ +static int power_set(lua_State *L) +{ UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); From 13d627ee7fbe64697845cfea613a384c5ca81b40 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 24 Aug 2019 18:29:56 -0400 Subject: [PATCH 7/8] Remove extra whitespace --- src/lua_playerlib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index b3bda252..68e3e789 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -636,7 +636,6 @@ static int power_get(lua_State *L) // powers, p, value -> powers[p] = value static int power_set(lua_State *L) { - UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); UINT16 i = (UINT16)luaL_checkinteger(L, 3); From 92779487a4130a244dbb90d12061a031ba5253d0 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 20 Sep 2019 12:32:18 -0400 Subject: [PATCH 8/8] avoid the source code from getting the wrong EOL --- .gitattributes | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitattributes b/.gitattributes index d4562091..7751149a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,12 @@ +#Source code +/src/*.c text=auto +/src/*.h text=auto +/src/*.s text=auto +/src/*.m text=auto +/src/*.xpm text=auto +/src/Makefile text=auto +/src/Make*.cfg text=auto +/src/CMakeLists.txt text=auto # Windows EOL *.cs -crlf -whitespace *.mk -crlf -whitespace