mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-22 16:02:29 +00:00
Merge public master
This commit is contained in:
commit
6d6acbae28
3 changed files with 30 additions and 33 deletions
|
|
@ -99,44 +99,29 @@ static int lib_lenPlayer(lua_State *L)
|
||||||
|
|
||||||
static int lib_iterateDisplayplayers(lua_State *L)
|
static int lib_iterateDisplayplayers(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 i = -1;
|
INT32 i = lua_tonumber(L, lua_upvalueindex(1));
|
||||||
INT32 temp = -1;
|
|
||||||
INT32 iter = 0;
|
|
||||||
|
|
||||||
if (lua_gettop(L) < 2)
|
if (lua_gettop(L) < 2)
|
||||||
{
|
{
|
||||||
//return luaL_error(L, "Don't call displayplayers.iterate() directly, use it as 'for player in displayplayers.iterate do <block> end'.");
|
lua_pushcclosure(L, lib_iterateDisplayplayers, 1);
|
||||||
lua_pushcfunction(L, lib_iterateDisplayplayers);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_settop(L, 2);
|
|
||||||
lua_remove(L, 1); // state is unused.
|
if (i <= r_splitscreen)
|
||||||
if (!lua_isnil(L, 1))
|
|
||||||
{
|
{
|
||||||
temp = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players); // get the player # of the last iterated player.
|
if (!playeringame[displayplayers[i]])
|
||||||
|
return 0;
|
||||||
// @FIXME:
|
|
||||||
// I didn't quite find a better way for this; Here, we go back to which player in displayplayers we last iterated to resume the for loop below for this new function call
|
|
||||||
// I don't understand enough about how the Lua stacks work to get this to work in possibly a single line.
|
|
||||||
// So anyone feel free to correct this!
|
|
||||||
|
|
||||||
for (; iter < MAXSPLITSCREENPLAYERS; iter++)
|
|
||||||
{
|
|
||||||
if (displayplayers[iter] == temp)
|
|
||||||
{
|
|
||||||
i = iter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i++; i < MAXSPLITSCREENPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (i > r_splitscreen || !playeringame[displayplayers[i]])
|
|
||||||
return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers.
|
|
||||||
|
|
||||||
|
// Return player and splitscreen index.
|
||||||
LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER);
|
LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER);
|
||||||
lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'!
|
lua_pushnumber(L, i);
|
||||||
|
|
||||||
|
// Update splitscreen index value for next iteration.
|
||||||
|
lua_pushnumber(L, i + 1);
|
||||||
|
lua_pushvalue(L, -1);
|
||||||
|
lua_replace(L, lua_upvalueindex(1));
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -162,7 +147,7 @@ static int lib_getDisplayplayers(lua_State *L)
|
||||||
field = luaL_checkstring(L, 2);
|
field = luaL_checkstring(L, 2);
|
||||||
if (fastcmp(field,"iterate"))
|
if (fastcmp(field,"iterate"))
|
||||||
{
|
{
|
||||||
lua_pushcfunction(L, lib_iterateDisplayplayers);
|
lua_pushcclosure(L, lib_iterateDisplayplayers, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,10 @@ void M_EndModeAttackRun(void)
|
||||||
// Return to the menu.
|
// Return to the menu.
|
||||||
D_ClearState();
|
D_ClearState();
|
||||||
M_StartControlPanel();
|
M_StartControlPanel();
|
||||||
|
// This removes any lingering optionsmenu.profile pointers,
|
||||||
|
// so that when returning to char select, it will show the normal
|
||||||
|
// stat grid instead of the profile one (this is also most likely a bad way to fix this)
|
||||||
|
M_ResetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replay Playback Menu
|
// Replay Playback Menu
|
||||||
|
|
|
||||||
|
|
@ -2398,6 +2398,14 @@ boolean P_ZMovement(mobj_t *mo)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MT_MONITOR:
|
||||||
|
// Prevent battle monitors getting stuck in pits
|
||||||
|
if (P_CheckDeathPitCollide(mo))
|
||||||
|
{
|
||||||
|
P_RemoveMobj(mo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// SRB2kart stuff that should die in pits
|
// SRB2kart stuff that should die in pits
|
||||||
// Shouldn't stop moving along the Z if there's no speed though!
|
// Shouldn't stop moving along the Z if there's no speed though!
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue