From dad361721fa3c1f572ba5d40ae5af0884258fb17 Mon Sep 17 00:00:00 2001 From: Shane Ellis Date: Wed, 30 Jun 2021 01:32:24 -0400 Subject: [PATCH 1/5] comment cleanup --- src/p_user.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index dadc23193..7ab7d8105 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -776,7 +776,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) { UINT8 oldmare, oldmarelap, oldmarebonuslap; - //! Bots can't be NiGHTSerized, silly!1 :P + // Bots can't be NiGHTSerized, silly!1 :P if (player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) return; @@ -1188,7 +1188,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) { if (!player) return; - //! if ((player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) && player->botleader) player = player->botleader; @@ -5965,23 +5964,6 @@ static void P_3dMovement(player_t *player) acceleration = 96 + (FixedDiv(player->speed, player->mo->scale)>>FRACBITS) * 40; topspeed = normalspd; } - //! Kill this! - /* else if (player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) - { // Bot steals player 1's stats - normalspd = FixedMul(players[consoleplayer].normalspeed, player->mo->scale); - thrustfactor = players[consoleplayer].thrustfactor; - acceleration = players[consoleplayer].accelstart + (FixedDiv(player->speed, player->mo->scale)>>FRACBITS) * players[consoleplayer].acceleration; - - if (player->powers[pw_tailsfly]) - topspeed = normalspd/2; - else if (player->mo->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) - { - topspeed = normalspd/2; - acceleration = 2*acceleration/3; - } - else - topspeed = normalspd; - } */ else { if (player->powers[pw_super] || player->powers[pw_sneakers]) @@ -11488,7 +11470,7 @@ void P_PlayerThink(player_t *player) I_Error("p_playerthink: players[%s].mo == NULL", sizeu1(playeri)); #endif - //! Reset terrain blocked status for this frame + // Reset terrain blocked status for this frame player->blocked = false; // todo: Figure out what is actually causing these problems in the first place... @@ -11641,7 +11623,7 @@ void P_PlayerThink(player_t *player) INT32 i; for (i = 0; i < MAXPLAYERS; i++) - { //! + { if (!playeringame[i] || players[i].spectator || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) continue; if (players[i].lives <= 0) @@ -11673,7 +11655,7 @@ void P_PlayerThink(player_t *player) INT32 i, total = 0, exiting = 0; for (i = 0; i < MAXPLAYERS; i++) - { //! + { if (!playeringame[i] || players[i].spectator || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) continue; if (players[i].quittime > 30 * TICRATE) @@ -12614,7 +12596,6 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = tails->momy; player->mo->momz = tails->momz; } - //! if (G_CoopGametype() && tails->player && tails->player->bot != BOT_2PAI) { player->mo->angle = tails->angle; From ee765d1043893bb798cdd84cf22d3383812812e6 Mon Sep 17 00:00:00 2001 From: Shane Ellis Date: Wed, 30 Jun 2021 01:34:21 -0400 Subject: [PATCH 2/5] comment cleanup --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 0643350b6..6e900d026 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3005,7 +3005,7 @@ void G_DoReborn(INT32 playernum) // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); - //! Tailsbot + // Tailsbot if (player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) { // Bots respawn next to their master. mobj_t *oldmo = NULL; From 94441d6eee252c3ebc7cd438c32d3d15dbb3c012 Mon Sep 17 00:00:00 2001 From: Shane Ellis Date: Wed, 30 Jun 2021 01:36:28 -0400 Subject: [PATCH 3/5] comment cleanup --- src/b_bot.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index c61e56f5f..cdd74fc07 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -25,8 +25,6 @@ void B_UpdateBotleader(player_t *player) fixed_t neardist = INT32_MAX; player_t *nearplayer = NULL; //Find new botleader - //if (!player->botleader) - //{ for (i = 0; i < MAXPLAYERS; i++) { if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo) @@ -46,7 +44,6 @@ void B_UpdateBotleader(player_t *player) } //Set botleader to best candidate (or null if none available) player->botleader = nearplayer; - //} } static inline void B_ResetAI(botmem_t *mem) @@ -102,7 +99,6 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) { boolean isrelevant = (sonic->player->powers[pw_carry] == CR_MACESPIN || sonic->player->powers[pw_carry] == CR_GENERIC); - //dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); //! This is totally redundant. if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant) cmd->buttons |= BT_JUMP; if (isrelevant) @@ -402,8 +398,6 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward { player_t *player = mo->player; // don't try to do stuff if your sonic is in a minecart or something - //if (players[consoleplayer].powers[pw_carry] && players[consoleplayer].powers[pw_carry] != CR_PLAYER) - //!!! if (&player->botleader && player->botleader->powers[pw_carry] && player->botleader->powers[pw_carry] != CR_PLAYER) return; // Turn the virtual keypresses into ticcmd_t. @@ -576,7 +570,6 @@ void B_RespawnBot(INT32 playernum) player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime]; player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots]; player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol]; - //!!! Nuke the speed equivalencies player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR); P_TeleportMove(tails, x, y, z); From afa8466b304207f15367c30352da5af7e1ede59f Mon Sep 17 00:00:00 2001 From: Shane Ellis Date: Wed, 30 Jun 2021 01:38:04 -0400 Subject: [PATCH 4/5] comment cleanup --- src/p_mobj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4924ec053..8af7ab0d0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1839,7 +1839,6 @@ void P_XYMovement(mobj_t *mo) // blocked move moved = false; - //!!! if (player) B_MoveBlocked(player); From 33ae95bf134571967f3f9875e5b3efeb2a352127 Mon Sep 17 00:00:00 2001 From: Shane Ellis Date: Mon, 12 Jul 2021 23:38:52 -0400 Subject: [PATCH 5/5] G_RemovePlayer error handling --- src/lua_baselib.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 9946a9fd3..34d1b1a94 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3482,15 +3482,16 @@ static int lib_gAddPlayer(lua_State *L) static int lib_gRemovePlayer(lua_State *L) { UINT8 pnum = -1; - //const char *kickreason = luaL_checkstring(L, 2); - if (!lua_isnoneornil(L, 1)) pnum = luaL_checkinteger(L, 1); - if (&players[pnum]) + else // No argument + return luaL_error(L, "argument #1 not given (expected number)"); + if (pnum >= MAXPLAYERS) // Out of range + return luaL_error(L, "playernum %d out of range (0 - %d)", pnum, MAXPLAYERS-1); + if (playeringame[pnum]) // Found player { - if (players[pnum].bot != BOT_NONE) + if (players[pnum].bot != BOT_NONE) // Can't remove clients. { -// CL_RemovePlayer(pnum, *kickreason); CL_RemovePlayer(pnum, pnum); if (netgame) { @@ -3503,9 +3504,11 @@ static int lib_gRemovePlayer(lua_State *L) lua_pushboolean(L, true); return 1; } + else + return luaL_error(L, "G_RemovePlayer can only be used on players with a bot value other than BOT_NONE."); } - lua_pushboolean(L, false); - return 1; + // Fell through. Invalid player + return LUA_ErrInvalid(L, "player_t"); }