This commit is contained in:
Christoph Oelckers 2014-10-21 14:20:01 +02:00
commit 20b740d5fc
24 changed files with 415 additions and 385 deletions

View file

@ -697,7 +697,7 @@ void PlayerIsGone (int netnode, int netconsole)
// Pick a new network arbitrator
for (int i = 0; i < MAXPLAYERS; i++)
{
if (i != netconsole && playeringame[i] && !players[i].isbot)
if (i != netconsole && playeringame[i] && players[i].Bot == NULL)
{
Net_Arbitrator = i;
players[i].settings_controller = true;
@ -902,7 +902,7 @@ void GetPackets (void)
for (i = 0; i < numplayers; ++i)
{
int node = !players[playerbytes[i]].isbot ?
int node = (players[playerbytes[i]].Bot == NULL) ?
nodeforplayer[playerbytes[i]] : netnode;
SkipTicCmd (&start, nettics[node] - realstart);
@ -918,7 +918,7 @@ void GetPackets (void)
// packet.
for (i = 0; i < numplayers; ++i)
{
if (!players[playerbytes[i]].isbot)
if (players[playerbytes[i]].Bot == NULL)
{
nettics[nodeforplayer[playerbytes[i]]] = realend;
}
@ -935,10 +935,10 @@ void AdjustBots (int gameticdiv)
// be in even when gametic lags behind maketic.
for (int i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && players[i].isbot && players[i].mo)
if (playeringame[i] && players[i].Bot != NULL && players[i].mo)
{
players[i].savedyaw = players[i].mo->angle;
players[i].savedpitch = players[i].mo->pitch;
players[i].Bot->savedyaw = players[i].mo->angle;
players[i].Bot->savedpitch = players[i].mo->pitch;
for (int j = gameticdiv; j < maketic/ticdup; j++)
{
players[i].mo->angle += (netcmds[i][j%BACKUPTICS].ucmd.yaw << 16) * ticdup;
@ -952,10 +952,10 @@ void UnadjustBots ()
{
for (int i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && players[i].isbot && players[i].mo)
if (playeringame[i] && players[i].Bot != NULL && players[i].mo)
{
players[i].mo->angle = players[i].savedyaw;
players[i].mo->pitch = players[i].savedpitch;
players[i].mo->angle = players[i].Bot->savedyaw;
players[i].mo->pitch = players[i].Bot->savedpitch;
}
}
}
@ -1127,7 +1127,7 @@ void NetUpdate (void)
{
if (playeringame[j])
{
if (players[j].isbot || NetMode == NET_PacketServer)
if (players[j].Bot != NULL || NetMode == NET_PacketServer)
{
count++;
}
@ -1269,7 +1269,7 @@ void NetUpdate (void)
{
if (playeringame[j] && j != playerfornode[i] && j != consoleplayer)
{
if (players[j].isbot || NetMode == NET_PacketServer)
if (players[j].Bot != NULL || NetMode == NET_PacketServer)
{
playerbytes[l++] = j;
netbuffer[k++] = j;
@ -1308,9 +1308,8 @@ void NetUpdate (void)
}
else if (i != 0)
{
if (players[playerbytes[l]].isbot)
if (players[playerbytes[l]].Bot != NULL)
{
WriteWord (0, &cmddata); // fake consistancy word
}
else
@ -2251,10 +2250,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
break;
case DEM_ADDBOT:
{
BYTE num = ReadByte (stream);
bglobal.DoAddBot (num, s = ReadString (stream));
}
bglobal.DoAddBot (stream);
break;
case DEM_KILLBOTS:
@ -2710,10 +2706,13 @@ void Net_SkipCommand (int type, BYTE **stream)
switch (type)
{
case DEM_SAY:
case DEM_ADDBOT:
skip = strlen ((char *)(*stream + 1)) + 2;
break;
case DEM_ADDBOT:
skip = strlen ((char *)(*stream + 1)) + 6;
break;
case DEM_GIVECHEAT:
case DEM_TAKECHEAT:
skip = strlen ((char *)(*stream)) + 3;
@ -2875,7 +2874,7 @@ static void Network_Controller (int playernum, bool add)
return;
}
if (players[playernum].isbot)
if (players[playernum].Bot != NULL)
{
Printf ("Bots cannot be added to the controller list.\n");
return;