Start on bots, doesn't work

This commit is contained in:
Sally Cochenour 2020-03-27 23:51:49 -04:00
parent 14fdc8a90a
commit 751fd9ad1b
19 changed files with 151 additions and 387 deletions

View file

@ -550,7 +550,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/i_tcp.o \
$(OBJDIR)/lzf.o \
$(OBJDIR)/vid_copy.o \
$(OBJDIR)/b_bot.o \
$(OBJDIR)/k_bot.o \
$(i_cdmus_o) \
$(i_net_o) \
$(i_system_o) \

View file

@ -1326,8 +1326,6 @@ static boolean CL_SendJoin(void)
if (splitscreen)
localplayers += splitscreen;
else if (botingame)
localplayers++;
netbuffer->u.clientcfg.localplayers = localplayers;
netbuffer->u.clientcfg.version = VERSION;
@ -2623,8 +2621,7 @@ static void Command_connect(void)
splitscreen = cv_splitplayers.value-1;
SplitScreen_OnChange();
}
botingame = false;
botskin = 0;
CL_ConnectToServer(viams);
}
#endif
@ -3292,6 +3289,7 @@ consvar_t cv_downloadspeed = {"downloadspeed", "16", CV_SAVE, downloadspeed_cons
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
static void Got_AddBot(UINT8 **p, INT32 playernum);
// called one time at init
void D_ClientServerInit(void)
@ -3321,6 +3319,7 @@ void D_ClientServerInit(void)
RegisterNetXCmd(XD_KICK, Got_KickCmd);
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer);
RegisterNetXCmd(XD_ADDBOT, Got_AddBot);
#ifndef NONET
#ifdef DUMPCONSISTENCY
CV_RegisterVar(&cv_dumpconsistency);
@ -3536,8 +3535,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
displayplayers[splitscreenplayer] = newplayernum;
g_localplayers[splitscreenplayer] = newplayernum;
DEBFILE(va("spawning sister # %d\n", splitscreenplayer));
if (splitscreenplayer == 1 && botingame)
players[newplayernum].bot = 1;
}
else
{
@ -3556,6 +3553,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
}
players[newplayernum].splitscreenindex = splitscreenplayer;
players[newplayernum].bot = false;
playerconsole[newplayernum] = console;
splitscreen_original_party_size[console] =
@ -3609,6 +3607,54 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
CL_RemovePlayer(pnum, reason);
}
// Xcmd XD_ADDBOT
// Compacted version of XD_ADDPLAYER for simplicity
static void Got_AddBot(UINT8 **p, INT32 playernum)
{
INT16 newplayernum;
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
// protect against hacked/buggy client
CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
return;
}
newplayernum = (UINT8)READUINT8(*p);
CONS_Debug(DBG_NETPLAY, "addbot: %d\n", newplayernum);
// Clear player before joining, lest some things get set incorrectly
CL_ClearPlayer(newplayernum);
playeringame[newplayernum] = true;
G_AddPlayer(newplayernum);
if (newplayernum+1 > doomcom->numslots)
doomcom->numslots = (INT16)(newplayernum+1);
players[newplayernum].splitscreenindex = 0;
players[newplayernum].bot = true;
playerconsole[newplayernum] = 0;
if (netgame)
{
HU_AddChatText(va("\x82*Bot %d has been added to the game", newplayernum+1), false);
}
#ifdef HAVE_BLUA
LUAh_PlayerJoin(newplayernum);
#endif
}
static boolean SV_AddWaitingPlayers(void)
{
INT32 node, n, newplayer = false;
@ -5057,7 +5103,7 @@ static void CL_SendClientCmd(void)
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]);
if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
if (splitscreen) // Send a special packet with 2 cmd for splitscreen
{
netbuffer->packettype = (mis ? PT_CLIENT2MIS : PT_CLIENT2CMD);
packetsize = sizeof (client2cmd_pak);
@ -5253,7 +5299,7 @@ static void Local_Maketic(INT32 realtics)
if (!dedicated) rendergametic = gametic;
// translate inputs (keyboard/mouse/joystick) into game controls
G_BuildTiccmd(&localcmds, realtics, 1);
if (splitscreen || botingame)
if (splitscreen)
{
G_BuildTiccmd(&localcmds2, realtics, 2);
if (splitscreen > 1)

View file

@ -766,8 +766,7 @@ void D_StartTitle(void)
splitscreen = 0;
SplitScreen_OnChange();
botingame = false;
botskin = 0;
cv_debug = 0;
emeralds = 0;

View file

@ -49,6 +49,7 @@
#include "k_kart.h" // SRB2kart
#include "k_battle.h"
#include "k_pwrlv.h"
#include "k_bot.h"
#include "y_inter.h"
#ifdef NETGAME_DEVMODE
@ -525,6 +526,11 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"PICKVOTE",
"REMOVEPLAYER",
"POWERLEVEL",
"PARTYINVITE",
"ACCEPTPARTYINVITE",
"LEAVEPARTY",
"CANCELPARTYINVITE",
"ADDBOT",
#ifdef HAVE_BLUA
"LUACMD",
"LUAVAR"
@ -1493,7 +1499,7 @@ static void SendNameAndColor2(void)
XBOXSTATIC char buf[MAXPLAYERNAME+2];
char *p;
if (splitscreen < 1 && !botingame)
if (splitscreen < 1)
return; // can happen if skin2/color2/name2 changed
if (g_localplayers[1] != consoleplayer)
@ -1531,15 +1537,7 @@ static void SendNameAndColor2(void)
return;
// If you're not in a netgame, merely update the skin, color, and name.
if (botingame)
{
players[secondplaya].skincolor = botcolor;
if (players[secondplaya].mo)
players[secondplaya].mo->color = players[secondplaya].skincolor;
SetPlayerSkinByNum(secondplaya, botskin-1);
return;
}
else if (!netgame)
if (!netgame)
{
INT32 foundskin;
@ -1769,15 +1767,7 @@ static void SendNameAndColor4(void)
return;
// If you're not in a netgame, merely update the skin, color, and name.
if (botingame)
{
players[fourthplaya].skincolor = botcolor;
if (players[fourthplaya].mo)
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
SetPlayerSkinByNum(fourthplaya, botskin-1);
return;
}
else if (!netgame)
if (!netgame)
{
INT32 foundskin;
@ -2187,7 +2177,7 @@ static void Got_LeaveParty(UINT8 **cp,INT32 playernum)
void D_SendPlayerConfig(void)
{
SendNameAndColor();
if (splitscreen || botingame)
if (splitscreen)
SendNameAndColor2();
if (splitscreen > 1)
SendNameAndColor3();
@ -2745,28 +2735,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
return;
}
// Kick bot from special stages
if (botskin)
{
if (G_IsSpecialStage(mapnum))
{
if (botingame)
{
//CL_RemoveSplitscreenPlayer();
botingame = false;
playeringame[1] = false;
}
}
else if (!botingame)
{
//CL_AddSplitscreenPlayer();
botingame = true;
displayplayers[1] = 1;
playeringame[1] = true;
players[1].bot = 1;
SendNameAndColor2();
}
}
K_AddBots(13);
chmappending++;
if (netgame)
@ -5738,8 +5707,7 @@ void Command_ExitGame_f(void)
splitscreen = 0;
SplitScreen_OnChange();
botingame = false;
botskin = 0;
cv_debug = 0;
emeralds = 0;

View file

@ -186,9 +186,10 @@ typedef enum
XD_ACCEPTPARTYINVITE, // 28
XD_LEAVEPARTY, // 29
XD_CANCELPARTYINVITE, // 30
XD_ADDBOT, // 31
#ifdef HAVE_BLUA
XD_LUACMD, // 31
XD_LUAVAR, // 32
XD_LUACMD, // 32
XD_LUAVAR, // 33
#endif
MAXNETXCMD
} netxcmd_t;

View file

@ -44,7 +44,7 @@
#include "v_video.h"
#include "dehacked.h" // get_number (for ghost thok)
#include "lua_hook.h"
#include "b_bot.h"
#include "k_bot.h"
#include "m_cond.h" // condition sets
#include "md5.h" // demo checksums
#include "k_kart.h" // SRB2kart
@ -55,10 +55,6 @@ gameaction_t gameaction;
gamestate_t gamestate = GS_NULL;
UINT8 ultimatemode = false;
boolean botingame;
UINT8 botskin;
UINT8 botcolor;
JoyType_t Joystick;
JoyType_t Joystick2;
JoyType_t Joystick3;
@ -1265,9 +1261,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
else
player = &players[g_localplayers[ssplayer-1]];
if (ssplayer == 2)
thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]);
else
thiscam = &camera[ssplayer-1];
lang = localangle[ssplayer-1];
laim = localaiming[ssplayer-1];
@ -1624,8 +1617,6 @@ static void UserAnalog_OnChange(void)
static void UserAnalog2_OnChange(void)
{
if (botingame)
return;
/*if (cv_useranalog2.value)
CV_SetValue(&cv_analog2, 1);
else
@ -1634,8 +1625,6 @@ static void UserAnalog2_OnChange(void)
static void UserAnalog3_OnChange(void)
{
if (botingame)
return;
/*if (cv_useranalog3.value)
CV_SetValue(&cv_analog3, 1);
else
@ -1644,8 +1633,6 @@ static void UserAnalog3_OnChange(void)
static void UserAnalog4_OnChange(void)
{
if (botingame)
return;
/*if (cv_useranalog4.value)
CV_SetValue(&cv_analog4, 1);
else
@ -1671,7 +1658,7 @@ static void Analog_OnChange(void)
static void Analog2_OnChange(void)
{
if (!(splitscreen || botingame) || !cv_cam2_dist.string)
if (!splitscreen || !cv_cam2_dist.string)
return;
// cameras are not initialized at this point
@ -1763,7 +1750,7 @@ void G_DoLoadLevel(boolean resetplayer)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i)
if (i > 0 && r_splitscreen < i)
g_localplayers[i] = consoleplayer;
}
@ -2570,7 +2557,7 @@ void G_PlayerReborn(INT32 player)
tic_t jointime;
UINT8 splitscreenindex;
boolean spectator;
INT16 bot;
boolean bot;
SINT8 pity;
// SRB2kart
@ -2701,8 +2688,7 @@ void G_PlayerReborn(INT32 player)
p->totalring = totalring;
p->mare = mare;
if (bot)
p->bot = 1; // reset to AI-controlled
p->bot = bot;
p->pity = pity;
// SRB2kart
@ -3151,96 +3137,9 @@ void G_DoReborn(INT32 playernum)
player_t *player = &players[playernum];
boolean starpost = false;
/*if (modeattacking) // Not needed for SRB2Kart.
{
M_EndModeAttackRun();
return;
}*/
// Make sure objectplace is OFF when you first start the level!
OP_ResetObjectplace();
if (player->bot && playernum != consoleplayer)
{ // Bots respawn next to their master.
mobj_t *oldmo = NULL;
// first dissasociate the corpse
if (player->mo)
{
oldmo = player->mo;
// Don't leave your carcass stuck 10-billion feet in the ground!
P_RemoveMobj(player->mo);
}
B_RespawnBot(playernum);
if (oldmo)
G_ChangePlayerReferences(oldmo, players[playernum].mo);
}
/*else if (countdowntimeup || (!multiplayer && !modeattacking))
{
// reload the level from scratch
if (countdowntimeup)
{
player->starpostangle = 0;
player->starposttime = 0;
player->starpostx = 0;
player->starposty = 0;
player->starpostz = 0;
player->starpostnum = 0;
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
INT32 i;
player->playerstate = PST_REBORN;
P_LoadThingsOnly();
// Do a wipe
wipegamestate = -1;
if (player->starpostnum) // SRB2kart
starpost = true;
for (i = 0; i <= splitscreen; i++)
{
if (camera[i].chase)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
// clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown));
for (i = 0;i < JOYAXISSET; i++)
{
joyxmove[i] = joyymove[i] = 0;
joy2xmove[i] = joy2ymove[i] = 0;
joy3xmove[i] = joy3ymove[i] = 0;
joy4xmove[i] = joy4ymove[i] = 0;
}
mousex = mousey = 0;
mouse2x = mouse2y = 0;
// clear hud messages remains (usually from game startup)
CON_ClearHUD();
// Starpost support
G_SpawnPlayer(playernum, starpost);
if (botingame)
{ // Bots respawn next to their master.
players[displayplayers[1]].playerstate = PST_REBORN;
G_SpawnPlayer(displayplayers[1], false);
}
}
else
{
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
G_DoLoadLevel(true);
}
}*/
else
{
// respawn at the start
mobj_t *oldmo = NULL;
@ -4602,9 +4501,6 @@ void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar
if (savedata.lives > 0)
{
color = savedata.skincolor;
botskin = savedata.botskin;
botcolor = savedata.botcolor;
botingame = (botskin != 0);
}
else if (splitscreen != ssplayers)
{

View file

@ -55,7 +55,4 @@ extern gamestate_t gamestate;
extern UINT8 ultimatemode; // was sk_insane
extern gameaction_t gameaction;
extern boolean botingame;
extern UINT8 botskin, botcolor;
#endif //__G_STATE__

View file

@ -7,7 +7,7 @@
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file b_bot.c
/// \file k_bot.c
/// \brief Basic bot handling
#include "doomdef.h"
@ -15,8 +15,10 @@
#include "g_game.h"
#include "r_main.h"
#include "p_local.h"
#include "b_bot.h"
#include "k_bot.h"
#include "lua_hook.h"
#include "byteptr.h"
#include "d_net.h" // nodetoplayer
// If you want multiple bots, variables like this will
// have to be stuffed in something accessible through player_t.
@ -24,6 +26,50 @@ static boolean lastForward = false;
static boolean lastBlocked = false;
static boolean blocked = false;
void K_AddBots(UINT8 numbots)
{
UINT8 newplayernum = 0;
UINT8 buf[4];
UINT8 *buf_p = buf;
if (dedicated)
newplayernum = 1;
while (numbots > 0)
{
numbots--;
// search for a free playernum
// we can't use playeringame since it is not updated here
for (; newplayernum < MAXPLAYERS; newplayernum++)
{
UINT8 n;
for (n = 0; n < MAXNETNODES; n++)
if (nodetoplayer[n] == newplayernum
|| nodetoplayer2[n] == newplayernum
|| nodetoplayer3[n] == newplayernum
|| nodetoplayer4[n] == newplayernum)
break;
if (n == MAXNETNODES)
break;
}
// should never happen since we check the playernum
// before accepting the join
I_Assert(newplayernum < MAXPLAYERS);
WRITEUINT8(buf_p, newplayernum);
SendNetXCmd(XD_ADDPLAYER, buf, buf_p - buf);
DEBFILE(va("Server added bot %d\n", newplayernum));
// use the next free slot (we can't put playeringame[newplayernum] = true here)
newplayernum++;
}
}
static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{
boolean forward=false, backward=false, left=false, right=false, jump=false, spin=false;
@ -242,7 +288,6 @@ void B_RespawnBot(INT32 playernum)
if (!sonic || sonic->health <= 0)
return;
player->bot = 1;
P_SpawnPlayer(playernum);
tails = player->mo;

View file

@ -10,6 +10,7 @@
/// \file b_bot.h
/// \brief Basic bot handling
void K_AddBots(UINT8 numbots);
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd);
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin);
boolean B_CheckRespawn(player_t *player);

View file

@ -16,7 +16,7 @@
#include "p_mobj.h"
#include "g_game.h"
#include "r_things.h"
#include "b_bot.h"
#include "k_bot.h"
#include "z_zone.h"
#include "lua_script.h"

View file

@ -294,7 +294,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"spectator"))
lua_pushboolean(L, plr->spectator);
else if (fastcmp(field,"bot"))
lua_pushinteger(L, plr->bot);
lua_pushboolean(L, plr->bot);
else if (fastcmp(field,"jointime"))
lua_pushinteger(L, plr->jointime);
else if (fastcmp(field,"splitscreenindex"))

View file

@ -166,8 +166,6 @@ void P_DoNightsScore(player_t *player)
return; // Don't do any fancy shit for failures.
dummymo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z+player->mo->height/2, MT_NIGHTSCORE);
if (player->bot)
player = &players[consoleplayer];
if (G_IsSpecialStage(gamemap)) // Global link count? Maybe not a good idea...
{
@ -793,8 +791,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// ***************************** //
// Special Stage Token
case MT_EMMY:
if (player->bot)
return;
tokenlist += special->health;
if (ALL7EMERALDS(emeralds)) // Got all 7
@ -811,9 +807,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Emerald Hunt
case MT_EMERHUNT:
if (player->bot)
return;
if (hunt1 == special)
hunt1 = NULL;
else if (hunt2 == special)
@ -842,9 +835,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_EMERALD5:
case MT_EMERALD6:
case MT_EMERALD7:
if (player->bot)
return;
if (special->threshold)
player->powers[pw_emeralds] |= special->info->speed;
else
@ -872,12 +862,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Secret emblem thingy
case MT_EMBLEM:
{
if (demo.playback || player->bot)
if (demo.playback)
return;
emblemlocations[special->health-1].collected = true;
M_UpdateUnlockablesAndExtraEmblems(false);
G_SaveGameData(false);
break;
}
@ -885,8 +874,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// CTF Flags
case MT_REDFLAG:
case MT_BLUEFLAG:
if (player->bot)
return;
if (player->powers[pw_flashing] || player->tossdelay)
return;
if (!special->spawnpoint)
@ -957,8 +944,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// NiGHTS gameplay items and powerups //
// ********************************** //
/*case MT_NIGHTSDRONE:
if (player->bot)
return;
if (player->exiting)
return;
if (player->bonustime)
@ -1112,9 +1097,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
return;
case MT_EGGCAPSULE:
if (player->bot)
return;
// make sure everything is as it should be, THEN take rings from players in special stages
if (player->pflags & PF_NIGHTSMODE && !toucher->target)
return;
@ -1216,7 +1198,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
return;
/*case MT_NIGHTSSUPERLOOP:
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
if (!(player->pflags & PF_NIGHTSMODE))
return;
if (!G_IsSpecialStage(gamemap))
player->powers[pw_nights_superloop] = (UINT16)special->info->speed;
@ -1238,7 +1220,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
break;
case MT_NIGHTSDRILLREFILL:
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
if (!(player->pflags & PF_NIGHTSMODE))
return;
if (!G_IsSpecialStage(gamemap))
player->drillmeter = special->info->speed;
@ -1260,7 +1242,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
break;
case MT_NIGHTSHELPER:
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
if (!(player->pflags & PF_NIGHTSMODE))
return;
if (!G_IsSpecialStage(gamemap))
{
@ -1292,7 +1274,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
break;
case MT_NIGHTSEXTRATIME:
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
if (!(player->pflags & PF_NIGHTSMODE))
return;
if (!G_IsSpecialStage(gamemap))
{
@ -1322,7 +1304,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
break;
case MT_NIGHTSLINKFREEZE:
if (player->bot || !(player->pflags & PF_NIGHTSMODE))
if (!(player->pflags & PF_NIGHTSMODE))
return;
if (!G_IsSpecialStage(gamemap))
{
@ -1393,8 +1375,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
players[i].drillmeter += TICRATE/2;
}
else if (player->bot)
players[consoleplayer].drillmeter += TICRATE/2;
else
player->drillmeter += TICRATE/2;
@ -1428,9 +1408,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
thinker_t *th;
mobj_t *mo2;
if (player->bot)
return;
junk.tag = 649;
EV_DoElevator(&junk, bridgeFall, false);
@ -1450,8 +1427,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
break;
case MT_FIREFLOWER:
if (player->bot)
return;
player->powers[pw_shield] |= SH_FIREFLOWER;
toucher->color = SKINCOLOR_WHITE;
G_GhostAddColor(player - players, GHC_FIREFLOWER);
@ -1461,9 +1436,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Misc touchables //
// *************** //
case MT_STARPOST:
if (player->bot)
return;
//
// SRB2kart: make sure the player will have enough checkpoints to touch
if (circuitmap && special->health - player->starpostnum > 1)
{
@ -1666,7 +1638,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->powers[pw_invulnerability] || player->powers[pw_flashing]
|| (player->powers[pw_super] && !(ALL7EMERALDS(player->powers[pw_emeralds]))))
return;
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
if (player->powers[pw_shield]) //If One-Hit Shield
{
P_RemoveShield(player);
S_StartSound(toucher, sfx_shldls); // Ba-Dum! Shield loss.
@ -1751,8 +1723,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return;
default: // SOC or script pickup
if (player->bot)
return;
P_SetTarget(&special->target, toucher);
break;
}
@ -2315,8 +2285,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
target->flags |= MF_NOBLOCKMAP|MF_NOCLIPHEIGHT;
P_SetThingPosition(target);
if (!target->player->bot && !G_IsSpecialStage(gamemap)
&& G_GametypeUsesLives())
if (!target->player->bot && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
{
target->player->lives -= 1; // Lose a life Tails 03-11-2000
@ -2329,6 +2298,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
}
}
}
target->player->playerstate = PST_DEAD;
if (target->player == &players[consoleplayer])
@ -3073,7 +3043,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false;
// Make sure that boxes cannot be popped by enemies, red rings, etc.
if (target->flags & MF_MONITOR && ((!source || !source->player || source->player->bot) || (inflictor && !inflictor->player)))
if (target->flags & MF_MONITOR && ((!source || !source->player) || (inflictor && !inflictor->player)))
return false;
}

View file

@ -491,89 +491,6 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
}
}
#if 0
static void P_DoTailsCarry(player_t *sonic, player_t *tails)
{
INT32 p;
fixed_t zdist; // z distance between the two players' bottoms
if ((tails->pflags & PF_CARRIED) && tails->mo->tracer == sonic->mo)
return;
if ((sonic->pflags & PF_CARRIED) && sonic->mo->tracer == tails->mo)
return;
//if (!tails->powers[pw_tailsfly] && !(tails->charability == CA_FLY && (tails->mo->state >= &states[S_PLAY_SPC1] && tails->mo->state <= &states[S_PLAY_SPC4])))
// return; // SRB2kart - no changey statey
if (tails->bot == 1)
return;
if (sonic->pflags & PF_NIGHTSMODE)
return;
if (sonic->mo->tracer && sonic->mo->tracer->type == MT_TUBEWAYPOINT
&& !(sonic->pflags & PF_ROPEHANG))
return; // don't steal players from zoomtubes!
if ((sonic->mo->eflags & MFE_VERTICALFLIP) != (tails->mo->eflags & MFE_VERTICALFLIP))
return; // Both should be in same gravity
if (tails->mo->eflags & MFE_VERTICALFLIP)
{
if (tails->mo->ceilingz - (tails->mo->z + tails->mo->height) < sonic->mo->height-FixedMul(2*FRACUNIT, sonic->mo->scale))
return;
}
else if (tails->mo->z - tails->mo->floorz < sonic->mo->height-FixedMul(2*FRACUNIT, sonic->mo->scale))
return; // No room to pick up this guy!
// Search in case another player is already being carried by this fox.
for (p = 0; p < MAXPLAYERS; p++)
if (playeringame[p] && players[p].mo
&& players[p].pflags & PF_CARRIED && players[p].mo->tracer == tails->mo)
return;
if (tails->mo->eflags & MFE_VERTICALFLIP)
zdist = (sonic->mo->z + sonic->mo->height) - (tails->mo->z + tails->mo->height);
else
zdist = tails->mo->z - sonic->mo->z;
if (zdist <= sonic->mo->height + FixedMul(FRACUNIT, sonic->mo->scale)
&& zdist > sonic->mo->height*2/3
&& P_MobjFlip(tails->mo)*sonic->mo->momz <= 0)
{
// Why block opposing teams from tailsflying each other?
// Sneaking into the hands of a flying tails player in Race might be a viable strategy, who knows.
/*
if (gametype == GT_RACE || gametype == GT_COMPETITION
|| (netgame && (tails->spectator || sonic->spectator))
|| (G_TagGametype() && (!(tails->pflags & PF_TAGIT) != !(sonic->pflags & PF_TAGIT)))
|| (gametype == GT_MATCH)
|| (G_GametypeHasTeams() && tails->ctfteam != sonic->ctfteam))
sonic->pflags &= ~PF_CARRIED; */
if (tails->spectator || sonic->spectator || G_RaceGametype()) // SRB2kart
sonic->pflags &= ~PF_CARRIED;
else
{
if (sonic-players == consoleplayer && botingame)
//CV_SetValue(&cv_analog2, false);
P_ResetPlayer(sonic);
P_SetTarget(&sonic->mo->tracer, tails->mo);
sonic->pflags |= PF_CARRIED;
S_StartSound(sonic->mo, sfx_s3k4a);
P_UnsetThingPosition(sonic->mo);
sonic->mo->x = tails->mo->x;
sonic->mo->y = tails->mo->y;
P_SetThingPosition(sonic->mo);
}
}
else {
if (sonic-players == consoleplayer && botingame)
//CV_SetValue(&cv_analog2, true);
sonic->pflags &= ~PF_CARRIED;
}
}
#endif
//
// PIT_CheckThing
//
@ -1338,8 +1255,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
}
else if (thing->player) {
if (thing->player-players == consoleplayer && botingame)
//CV_SetValue(&cv_analog2, true);
thing->player->pflags &= ~PF_CARRIED;
}*/

View file

@ -30,7 +30,7 @@
#include "info.h"
#include "i_video.h"
#include "lua_hook.h"
#include "b_bot.h"
#include "k_bot.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
@ -1667,10 +1667,6 @@ void P_XYMovement(mobj_t *mo)
// blocked move
moved = false;
if (player) {
if (player->bot)
B_MoveBlocked(player);
}
//{ SRB2kart - Jawz
if (mo->type == MT_JAWZ || mo->type == MT_JAWZ_DUD)
{

View file

@ -78,12 +78,6 @@ static inline void P_ArchivePlayer(void)
WRITEUINT32(save_p, player->score);
WRITEINT32(save_p, pllives);
WRITEINT32(save_p, player->continues);
if (botskin)
{
WRITEUINT8(save_p, botskin);
WRITEUINT8(save_p, botcolor);
}
}
//
@ -97,16 +91,6 @@ static inline void P_UnArchivePlayer(void)
savedata.score = READINT32(save_p);
savedata.lives = READINT32(save_p);
savedata.continues = READINT32(save_p);
if (savedata.botcolor)
{
savedata.botskin = READUINT8(save_p);
if (savedata.botskin-1 >= numskins)
savedata.botskin = 0;
savedata.botcolor = READUINT8(save_p);
}
else
savedata.botskin = 0;
}
//
@ -3203,7 +3187,7 @@ static inline void P_ArchiveMisc(void)
lastmapsaved = gamemap;
WRITEUINT16(save_p, (botskin ? (emeralds|(1<<10)) : emeralds)+357);
WRITEUINT16(save_p, emeralds+357);
WRITESTRINGN(save_p, timeattackfolder, sizeof(timeattackfolder));
}

View file

@ -2824,7 +2824,7 @@ boolean P_SetupLevel(boolean skipprecip)
P_Initsecnode();
if (netgame || multiplayer)
cv_debug = botskin = 0;
cv_debug = 0;
if (metalplayback)
G_StopMetalDemo();
@ -3264,7 +3264,7 @@ boolean P_SetupLevel(boolean skipprecip)
/*if (cv_useranalog.value)
CV_SetValue(&cv_analog, true);
if ((splitscreen && cv_useranalog2.value) || botingame)
if (splitscreen && cv_useranalog2.value)
CV_SetValue(&cv_analog2, true);
if (splitscreen > 1 && cv_useranalog3.value)
@ -3335,9 +3335,6 @@ boolean P_SetupLevel(boolean skipprecip)
players[consoleplayer].continues = savedata.continues;
players[consoleplayer].lives = savedata.lives;
players[consoleplayer].score = savedata.score;
botskin = savedata.botskin;
botcolor = savedata.botcolor;
botingame = (savedata.botskin != 0);
emeralds = savedata.emeralds;
savedata.lives = 0;
}

View file

@ -2278,13 +2278,9 @@ static mobj_t *P_GetObjectTypeInSectorNum(mobjtype_t type, size_t s)
static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
INT32 secnum = -1;
mobj_t *bot = NULL;
I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid!
if (mo && mo->player && botingame)
bot = players[displayplayers[1]].mo;
// note: only commands with linedef types >= 400 && < 500 can be used
switch (line->special)
{
@ -2423,9 +2419,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
UINT8 i;
if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3
P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z);
for (i = 0; i <= r_splitscreen; i++)
{
if (mo->player == &players[displayplayers[i]] && camera[i].chase)
@ -2448,8 +2441,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (!dest)
return;
if (bot)
P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKPLAYERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4);
if (line->flags & ML_BLOCKPLAYERS)
P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4);
else
@ -2882,18 +2873,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->player->cmomx = mo->player->cmomy = 0;
P_ResetPlayer(mo->player);
P_SetPlayerMobjState(mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
// Reset bot too.
if (bot) {
if (line->flags & ML_NOCLIMB)
P_TeleportMove(bot, mo->x, mo->y, mo->z);
bot->momx = bot->momy = bot->momz = 1;
bot->pmomz = 0;
bot->player->rmomx = bot->player->rmomy = 1;
bot->player->cmomx = bot->player->cmomy = 0;
P_ResetPlayer(bot->player);
P_SetPlayerMobjState(bot, S_KART_STND1); // SRB2kart - was S_PLAY_STND
}
}
break;
@ -2925,13 +2904,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->flags2 &= ~MF2_TWOD;
else
mo->flags2 |= MF2_TWOD;
// Copy effect to bot if necessary
// (Teleport them to you so they don't break it.)
if (bot && (bot->flags2 & MF2_TWOD) != (mo->flags2 & MF2_TWOD)) {
bot->flags2 = (bot->flags2 & ~MF2_TWOD) | (mo->flags2 & MF2_TWOD);
P_TeleportMove(bot, mo->x, mo->y, mo->z);
}
}
break;
@ -2940,8 +2912,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->flags2 &= ~MF2_OBJECTFLIP;
else
mo->flags2 |= MF2_OBJECTFLIP;
if (bot)
bot->flags2 = (bot->flags2 & ~MF2_OBJECTFLIP) | (mo->flags2 & MF2_OBJECTFLIP);
break;
case 434: // Custom Power
@ -2961,10 +2931,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
P_SetTarget(&dummy->target, mo);
A_CustomPower(dummy);
if (bot) {
P_SetTarget(&dummy->target, bot);
A_CustomPower(dummy);
}
P_RemoveMobj(dummy);
}
break;
@ -3033,8 +2999,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->flags & ML_NOCLIMB)
fractime |= 1<<15; //more crazy &ing, as if music stuff wasn't enough
mo->player->powers[pw_nocontrol] = fractime;
if (bot)
bot->player->powers[pw_nocontrol] = fractime;
}
break;
@ -3044,8 +3008,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->destscale = FixedDiv(P_AproxDistance(line->dx, line->dy), 100<<FRACBITS);
if (mo->destscale < FRACUNIT/100)
mo->destscale = FRACUNIT/100;
if (mo->player && bot)
bot->destscale = mo->destscale;
}
break;
@ -3876,7 +3838,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
}
break;
case 11: // Special Stage Damage - Kind of like a mini-P_DamageMobj()
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting || player->bot)
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting)
break;
if (!(player->powers[pw_shield] || player->mo->health > 1)) // Don't do anything if no shield or rings anyway
@ -3920,7 +3882,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
case 3: // Linedef executor requires all players present
/// \todo check continues for proper splitscreen support?
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
if (playeringame[i] && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
{
if (roversector)
{
@ -3978,7 +3940,6 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
case 5: // Linedef executor
case 6: // Linedef executor (7 Emeralds)
case 7: // Linedef executor (NiGHTS Mare)
if (!player->bot)
P_LinedefExecute(sector->tag, player->mo, sector);
break;
case 8: // Tells pushable things to check FOFs
@ -3989,7 +3950,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
mobj_t *mo2;
line_t junk;
if (player->bot || sector->ceilingdata || sector->floordata)
if (sector->ceilingdata || sector->floordata)
return;
// Find the center of the Eggtrap and release all the pretty animals!
@ -4177,8 +4138,6 @@ DoneSection2:
}
case 2: // Special stage GOAL sector / Exit Sector / CTF Flag Return
if (player->bot)
break;
if (!useNightsSS && G_IsSpecialStage(gamemap) && sstimer > 6)
sstimer = 6; // Just let P_Ticker take care of the rest.

View file

@ -39,7 +39,7 @@
#include "st_stuff.h"
#include "lua_script.h"
#include "lua_hook.h"
#include "b_bot.h"
#include "k_bot.h"
// Objectplace
#include "m_cheat.h"
// SRB2kart
@ -705,10 +705,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
{
INT32 oldmare;
// Bots can't be super, silly!1 :P
if (player->bot)
return;
if (!(player->pflags & PF_NIGHTSMODE))
{
P_SetTarget(&player->mo->tracer, P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NIGHTSCHAR));
@ -934,8 +930,6 @@ void P_ResetPlayer(player_t *player)
player->powers[pw_tailsfly] = 0;
player->onconveyor = 0;
player->skidtime = 0;
/*if (player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);*/
}
//
@ -1029,9 +1023,6 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
if (!(G_BattleGametype()))
return;
if (player->bot)
player = &players[consoleplayer];
if (player->exiting) // srb2kart
return;
@ -2264,7 +2255,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
}
// Underwater audio cues
if (P_IsLocalPlayer(player) && !player->bot)
if (P_IsLocalPlayer(player))
{
if (player->powers[pw_underwater] == 11*TICRATE + 1
&& player == &players[consoleplayer])
@ -8038,6 +8029,7 @@ void P_PlayerThink(player_t *player)
if (B_CheckRespawn(player))
player->playerstate = PST_REBORN;
}
if (player->playerstate == PST_REBORN)
return;
}

View file

@ -202,7 +202,7 @@ void SplitScreen_OnChange(void)
// recompute screen size
R_ExecuteSetViewSize();
if (!demo.playback && !botingame)
if (!demo.playback)
{
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
{
@ -259,8 +259,6 @@ static void ChaseCam_OnChange(void)
static void ChaseCam2_OnChange(void)
{
if (botingame)
return;
/*if (!cv_chasecam2.value || !cv_useranalog2.value)
CV_SetValue(&cv_analog2, 0);
else