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

@ -293,28 +293,7 @@ player_t::player_t()
respawn_time(0),
camera(0),
air_finished(0),
savedyaw(0),
savedpitch(0),
angle(0),
dest(0),
prev(0),
enemy(0),
missile(0),
mate(0),
last_mate(0),
t_active(0),
t_respawn(0),
t_strafe(0),
t_react(0),
t_fight(0),
t_roam(0),
t_rocket(0),
isbot(0),
first_shot(0),
sleft(0),
allround(0),
oldx(0),
oldy(0),
Bot(0),
BlendR(0),
BlendG(0),
BlendB(0),
@ -333,7 +312,6 @@ player_t::player_t()
memset (&cmd, 0, sizeof(cmd));
memset (frags, 0, sizeof(frags));
memset (psprites, 0, sizeof(psprites));
memset (&skill, 0, sizeof(skill));
}
player_t &player_t::operator=(const player_t &p)
@ -401,30 +379,8 @@ player_t &player_t::operator=(const player_t &p)
camera = p.camera;
air_finished = p.air_finished;
LastDamageType = p.LastDamageType;
savedyaw = p.savedyaw;
savedpitch = p.savedpitch;
angle = p.angle;
dest = p.dest;
prev = p.prev;
enemy = p.enemy;
missile = p.missile;
mate = p.mate;
last_mate = p.last_mate;
Bot = p.Bot;
settings_controller = p.settings_controller;
skill = p.skill;
t_active = p.t_active;
t_respawn = p.t_respawn;
t_strafe = p.t_strafe;
t_react = p.t_react;
t_fight = p.t_fight;
t_roam = p.t_roam;
t_rocket = p.t_rocket;
isbot = p.isbot;
first_shot = p.first_shot;
sleft = p.sleft;
allround = p.allround;
oldx = p.oldx;
oldy = p.oldy;
BlendR = p.BlendR;
BlendG = p.BlendG;
BlendB = p.BlendB;
@ -466,12 +422,7 @@ size_t player_t::FixPointers (const DObject *old, DObject *rep)
if (*&poisoner == old) poisoner = replacement, changed++;
if (*&attacker == old) attacker = replacement, changed++;
if (*&camera == old) camera = replacement, changed++;
if (*&dest == old) dest = replacement, changed++;
if (*&prev == old) prev = replacement, changed++;
if (*&enemy == old) enemy = replacement, changed++;
if (*&missile == old) missile = replacement, changed++;
if (*&mate == old) mate = replacement, changed++;
if (*&last_mate == old) last_mate = replacement, changed++;
if (*&Bot == old) Bot = static_cast<DBot *>(rep), changed++;
if (ReadyWeapon == old) ReadyWeapon = static_cast<AWeapon *>(rep), changed++;
if (PendingWeapon == old) PendingWeapon = static_cast<AWeapon *>(rep), changed++;
if (*&PremorphWeapon == old) PremorphWeapon = static_cast<AWeapon *>(rep), changed++;
@ -486,12 +437,7 @@ size_t player_t::PropagateMark()
GC::Mark(poisoner);
GC::Mark(attacker);
GC::Mark(camera);
GC::Mark(dest);
GC::Mark(prev);
GC::Mark(enemy);
GC::Mark(missile);
GC::Mark(mate);
GC::Mark(last_mate);
GC::Mark(Bot);
GC::Mark(ReadyWeapon);
GC::Mark(ConversationNPC);
GC::Mark(ConversationPC);
@ -740,10 +686,10 @@ void APlayerPawn::SetupWeaponSlots()
// If we're the local player, then there's a bit more work to do.
// This also applies if we're a bot and this is the net arbitrator.
if (player - players == consoleplayer ||
(player->isbot && consoleplayer == Net_Arbitrator))
(player->Bot != NULL && consoleplayer == Net_Arbitrator))
{
FWeaponSlots local_slots(player->weapons);
if (player->isbot)
if (player->Bot != NULL)
{ // Bots only need weapons from KEYCONF, not INI modifications.
P_PlaybackKeyConfWeapons(&local_slots);
}
@ -2175,7 +2121,7 @@ void P_DeathThink (player_t *player)
if ((player->cmd.ucmd.buttons & BT_USE ||
((multiplayer || alwaysapplydmflags) && (dmflags & DF_FORCE_RESPAWN))) && !(dmflags2 & DF2_NO_RESPAWN))
{
if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && !player->isbot))
if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL))
{
player->cls = NULL; // Force a new class if the player is using a random class
player->playerstate = (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER;
@ -3007,9 +2953,17 @@ void player_t::Serialize (FArchive &arc)
<< respawn_time
<< air_finished
<< turnticks
<< oldbuttons
<< isbot
<< BlendR
<< oldbuttons;
bool IsBot;
if (SaveVersion >= 4514)
{
arc << Bot;
}
else
{
arc << IsBot;
}
arc << BlendR
<< BlendG
<< BlendB
<< BlendA;
@ -3092,32 +3046,30 @@ void player_t::Serialize (FArchive &arc)
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
}
if (isbot)
if (SaveVersion < 4514 && IsBot)
{
arc << angle
<< dest
<< prev
<< enemy
<< missile
<< mate
<< last_mate
<< skill
<< t_active
<< t_respawn
<< t_strafe
<< t_react
<< t_fight
<< t_roam
<< t_rocket
<< first_shot
<< sleft
<< allround
<< oldx
<< oldy;
}
else
{
dest = prev = enemy = missile = mate = last_mate = NULL;
Bot = new DBot;
arc << Bot->angle
<< Bot->dest
<< Bot->prev
<< Bot->enemy
<< Bot->missile
<< Bot->mate
<< Bot->last_mate
<< Bot->skill
<< Bot->t_active
<< Bot->t_respawn
<< Bot->t_strafe
<< Bot->t_react
<< Bot->t_fight
<< Bot->t_roam
<< Bot->t_rocket
<< Bot->first_shot
<< Bot->sleft
<< Bot->allround
<< Bot->oldx
<< Bot->oldy;
}
if (arc.IsLoading ())
{