mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Fixed: Bots did not process KEYCONF weapons. As far as I know, this is only relevant for the
owned-weapons display on the status bar. SVN r3466 (trunk)
This commit is contained in:
parent
287a814a18
commit
096725503c
5 changed files with 41 additions and 11 deletions
|
@ -2423,17 +2423,27 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEM_SETSLOT:
|
case DEM_SETSLOT:
|
||||||
|
case DEM_SETSLOTPNUM:
|
||||||
{
|
{
|
||||||
|
int pnum;
|
||||||
|
if (type == DEM_SETSLOTPNUM)
|
||||||
|
{
|
||||||
|
pnum = ReadByte(stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pnum = player;
|
||||||
|
}
|
||||||
unsigned int slot = ReadByte(stream);
|
unsigned int slot = ReadByte(stream);
|
||||||
int count = ReadByte(stream);
|
int count = ReadByte(stream);
|
||||||
if (slot < NUM_WEAPON_SLOTS)
|
if (slot < NUM_WEAPON_SLOTS)
|
||||||
{
|
{
|
||||||
players[player].weapons.Slots[slot].Clear();
|
players[pnum].weapons.Slots[slot].Clear();
|
||||||
}
|
}
|
||||||
for(i = 0; i < count; ++i)
|
for(i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
const PClass *wpn = Net_ReadWeapon(stream);
|
const PClass *wpn = Net_ReadWeapon(stream);
|
||||||
players[player].weapons.AddSlot(slot, wpn, player == consoleplayer);
|
players[pnum].weapons.AddSlot(slot, wpn, pnum == consoleplayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2595,9 +2605,10 @@ void Net_SkipCommand (int type, BYTE **stream)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEM_SETSLOT:
|
case DEM_SETSLOT:
|
||||||
|
case DEM_SETSLOTPNUM:
|
||||||
{
|
{
|
||||||
skip = 2;
|
skip = 2 + (type == DEM_SETSLOTPNUM);
|
||||||
for(int numweapons = (*stream)[1]; numweapons > 0; numweapons--)
|
for(int numweapons = (*stream)[skip-1]; numweapons > 0; numweapons--)
|
||||||
{
|
{
|
||||||
skip += 1 + ((*stream)[skip] >> 7);
|
skip += 1 + ((*stream)[skip] >> 7);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,7 @@ enum EDemoCommand
|
||||||
DEM_ADVANCEINTER, // 64 Advance intermission screen state
|
DEM_ADVANCEINTER, // 64 Advance intermission screen state
|
||||||
DEM_RUNNAMEDSCRIPT, // 65 String: Script name, Byte: Arg count + Always flag; each arg is a 4-byte int
|
DEM_RUNNAMEDSCRIPT, // 65 String: Script name, Byte: Arg count + Always flag; each arg is a 4-byte int
|
||||||
DEM_REVERTCAMERA, // 66
|
DEM_REVERTCAMERA, // 66
|
||||||
|
DEM_SETSLOTPNUM, // 67 Byte: player number, the rest is the same as DEM_SETSLOT
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct FWeaponSlots
|
||||||
void SetFromPlayer(const PClass *type);
|
void SetFromPlayer(const PClass *type);
|
||||||
void StandardSetup(const PClass *type);
|
void StandardSetup(const PClass *type);
|
||||||
void LocalSetup(const PClass *type);
|
void LocalSetup(const PClass *type);
|
||||||
void SendDifferences(const FWeaponSlots &other);
|
void SendDifferences(int playernum, const FWeaponSlots &other);
|
||||||
int RestoreSlots (FConfigFile *config, const char *section);
|
int RestoreSlots (FConfigFile *config, const char *section);
|
||||||
void PrintSettings();
|
void PrintSettings();
|
||||||
|
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ void FWeaponSlots::LocalSetup(const PClass *type)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FWeaponSlots::SendDifferences(const FWeaponSlots &other)
|
void FWeaponSlots::SendDifferences(int playernum, const FWeaponSlots &other)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -1285,7 +1285,15 @@ void FWeaponSlots::SendDifferences(const FWeaponSlots &other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The slots differ. Send mine.
|
// The slots differ. Send mine.
|
||||||
Net_WriteByte(DEM_SETSLOT);
|
if (playernum == consoleplayer)
|
||||||
|
{
|
||||||
|
Net_WriteByte(DEM_SETSLOT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Net_WriteByte(DEM_SETSLOTPNUM);
|
||||||
|
Net_WriteByte(playernum);
|
||||||
|
}
|
||||||
Net_WriteByte(i);
|
Net_WriteByte(i);
|
||||||
Net_WriteByte(Slots[i].Size());
|
Net_WriteByte(Slots[i].Size());
|
||||||
for (j = 0; j < Slots[i].Size(); ++j)
|
for (j = 0; j < Slots[i].Size(); ++j)
|
||||||
|
|
|
@ -566,11 +566,21 @@ void APlayerPawn::SetupWeaponSlots()
|
||||||
if (player != NULL && player->mo == this)
|
if (player != NULL && player->mo == this)
|
||||||
{
|
{
|
||||||
player->weapons.StandardSetup(GetClass());
|
player->weapons.StandardSetup(GetClass());
|
||||||
if (player - players == consoleplayer)
|
// If we're the local player, then there's a bit more work to do.
|
||||||
{ // 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))
|
||||||
|
{
|
||||||
FWeaponSlots local_slots(player->weapons);
|
FWeaponSlots local_slots(player->weapons);
|
||||||
local_slots.LocalSetup(GetClass());
|
if (player->isbot)
|
||||||
local_slots.SendDifferences(player->weapons);
|
{ // Bots only need weapons from KEYCONF, not INI modifications.
|
||||||
|
P_PlaybackKeyConfWeapons(&local_slots);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
local_slots.LocalSetup(GetClass());
|
||||||
|
}
|
||||||
|
local_slots.SendDifferences(int(player - players), player->weapons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue