summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e32689c)
raw | patch | inline | side by side (parent: e32689c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 4 Jan 2019 19:58:37 +0000 (22:58 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 4 Jan 2019 19:58:37 +0000 (22:58 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index f91bc624495dbbf29073904eb7ede60a3be7d8b7..7b68cce099b4130ca24d2a779501b32caecef2be 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
begin
if (Length(Line) = 0) then
begin
- if (g_Game_IsNet and g_Game_IsServer) or (g_Game_IsClient) then exit;
g_Console_Add('');
for i := 0 to High(commands) do
begin
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index e884e9b91054550e815ce2ff5e89d9e9fae787a4..6d1f430e5509196b9212f1535b1baedf3658e8af 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
{$INCLUDE ../shared/a_modes.inc}
unit g_netmsg;
-{.$DEFINE K8_XXX_WEAPON_DEBUG}
-
interface
uses e_msg, g_net, g_triggers, Classes, SysUtils, md5;
kByte: Word;
Pl: TPlayer;
GT: LongWord;
- newweapon: Byte;
begin
Result := 0;
if not gGameOn then Exit;
kByte := M.ReadWord();
Dir := M.ReadByte();
//WeaponSelect := M.ReadWord();
- newweapon := M.ReadByte();
- if (newweapon <> CurrWeap) then
- begin
-{$IFDEF K8_XXX_WEAPON_DEBUG}
- writeln('HOST PLRPOS: got: currweap=', CurrWeap, '; curfrm=', gTime, '; netweap=', newweapon, '; oldweap=', CurrWeap);
-{$ENDIF}
- //NetForceWeap := newweapon;
- SetWeapon(newweapon);
- end;
+ SetWeapon(M.ReadByte());
//e_WriteLog(Format('R:ws=%d', [WeaponSelect]), MSG_WARNING);
if Direction <> TDirection(Dir) then
JustTeleported := False;
NetOut.Write(Frags);
NetOut.Write(Death);
- //NetOut.Write(CurrWeap);
- NetOut.Write(Byte(CurrWeap));
+ NetOut.Write(CurrWeap);
// other flags
ww := 0;
OldJet: Boolean;
NewTeam: Byte;
ww: Word;
- newweapon: Byte;
begin
PID := M.ReadWord();
Pl := g_Player_Get(PID);
Frags := M.ReadLongInt();
Death := M.ReadLongInt();
- newweapon := M.ReadByte();
-{$IFDEF K8_XXX_WEAPON_DEBUG}
- writeln('CLIENT PLRSTATS: got: currweap=', CurrWeap, '; curfrm=', gTime, '; netweap=', newweapon, '; lastnwfrm=', NetForceWeapFIdx);
-{$ENDIF}
- if (gTime >= NetForceWeapFIdx) then
- begin
- //NetForceWeap := newweapon;
- SetWeapon(newweapon);
- end;
- //SetWeapon(M.ReadByte());
+ SetWeapon(M.ReadByte());
// other flags
ww := M.ReadByte();
NetOut.Write(kByte);
NetOut.Write(Byte(gPlayer1.Direction));
NetOut.Write(Byte(gPlayer1.CurrWeap));
-{$IFDEF K8_XXX_WEAPON_DEBUG}
- if (kByte and NET_KEY_FIRE) <> 0 then writeln('FIRE: CurrWeap=', gPlayer1.CurrWeap);
-{$ENDIF}
- //e_WriteLog(Format('S:nwp=%d; nwfidx=%d', [Integer(gPlayer1.NetForceWeap), Integer(gPlayer1.NetForceWeapFIdx)]), TMsgType.Warning);
//NetOut.Write(WeaponSelect);
//e_WriteLog(Format('S:ws=%d', [WeaponSelect]), MSG_WARNING);
g_Net_Client_Send(True, NET_CHAN_PLAYERPOS);
- // force player weapon
- //{if (gPlayer1.NetForceWeapFIdx < gTime) then} gPlayer1.SetWeapon(gPlayer1.NetForceWeap);
-
//kBytePrev := kByte;
//kDirPrev := gPlayer1.Direction;
end;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 8a516bf35e0be35a7258ecac442aaca10ad3c48f..23f38ffd70a4916bbdde1d67bd417bf7d1d9ba3d 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FFlag: Byte;
FSecrets: Integer;
FCurrWeap: Byte;
- //FNetForceWeap: Byte; // spam server with this -- this is new weapon we want to use
- FNetForceWeapFIdx: LongWord; // frame index; ignore weapon change if it is lesser than this
- //FCurrFrameIdx: LongWord; // increased in each `Update()`
FNextWeap: WORD;
FNextWeapDelay: Byte; // frames (unused)
FBFGFireCounter: SmallInt;
property Death: Integer read FDeath write FDeath;
property Kills: Integer read FKills write FKills;
property CurrWeap: Byte read FCurrWeap write FCurrWeap;
- //property NetForceWeap: Byte read FNetForceWeap write FNetForceWeap;
- property NetForceWeapFIdx: LongWord read FNetForceWeapFIdx write FNetForceWeapFIdx;
- //property CurrFrameIdx: LongWord read FCurrFrameIdx write FCurrFrameIdx;
property MonsterKills: Integer read FMonsterKills write FMonsterKills;
property Secrets: Integer read FSecrets;
property GodMode: Boolean read FGodMode write FGodMode;
gPlayers[a].FSecrets := utils.readLongInt(st);
// Òåêóùåå îðóæèå
gPlayers[a].FCurrWeap := utils.readByte(st);
- //gPlayers[a].FNetForceWeap := gPlayers[a].FCurrWeap;
// Ñëåäóþùåå æåëàåìîå îðóæèå
gPlayers[a].FNextWeap := utils.readWord(st);
// ...è ïàóçà
if gPlayers[i] is TPlayer then
begin
gPlayers[i].Update();
- if g_Game_IsClient or not g_Game_IsNet then
- begin
- gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`!
- end;
+ gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`!
end
else
begin
FJustTeleported := False;
FNetTime := 0;
- //FNetForceWeap := FCurrWeap;
- FNetForceWeapFIdx := 0;
- //FCurrFrameIdx := 0;
-
resetWeaponQueue();
releaseAllWeaponSwitchKeys();
end;
if FWeapon[nw] then
begin
- //k8: emulate this on client immediately, or wait for server confirmation?
- {
- if g_Game_IsClient then
- begin
- FNetForceWeap := nw;
- //FNetForceWeapFIdx := FCurrFrameIdx+5; // force for ~5 frames
- FNetForceWeapFIdx := gTime+5; // force for ~5 frames
- writeln('NETWEAPONSWITCH: fw=', NetForceWeap, '; fwfidx=', NetForceWeapFIdx, '; cfrm=', gTime);
- end;
- }
- FNetForceWeapFIdx := gTime+5; // force for ~5 frames
FCurrWeap := nw;
- if nw = WEAPON_SAW then FSawSoundSelect.PlayAt(FObj.X, FObj.Y);
- FModel.SetWeapon(nw);
FTime[T_SWITCH] := gTime+156;
+ if FCurrWeap = WEAPON_SAW then FSawSoundSelect.PlayAt(FObj.X, FObj.Y);
+ FModel.SetWeapon(FCurrWeap);
if g_Game_IsNet then MH_SEND_PlayerStats(FUID);
- //if g_Game_IsNet and g_Game_IsClient then
end;
end;
FNextWeap := $4000;
end;
-// used by network layer
procedure TPlayer.SetWeapon(W: Byte);
begin
if FCurrWeap <> W then
- if (W = WEAPON_SAW) then
+ if W = WEAPON_SAW then
FSawSoundSelect.PlayAt(FObj.X, FObj.Y);
FCurrWeap := W;
FModel.SetWeapon(CurrWeap);
- //if g_Game_IsClient then resetWeaponQueue();
+ resetWeaponQueue();
end;
function TPlayer.PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean): Boolean;
if allowBerserkSwitching then
begin
FCurrWeap := WEAPON_KASTET;
- //FNetForceWeap := FCurrWeap;
resetWeaponQueue();
FModel.SetWeapon(WEAPON_KASTET);
end;
FMonsterKills := 0;
FDeath := 0;
FSecrets := 0;
- //FCurrFrameIdx := 0;
- //FNetForceWeap := FCurrWeap;
- //FNetForceWeapFIdx := 0;
if FNoRespawn then
begin
FSpectator := False;
FShellTimer := -1;
FPain := 0;
FLastHit := 0;
- //FNetForceWeap := FCurrWeap;
if not g_Game_IsServer then
Exit;
FWeapon[WEAPON_PISTOL] := True;
FWeapon[WEAPON_KASTET] := True;
FCurrWeap := WEAPON_PISTOL;
- //FNetForceWeap := FCurrWeap;
resetWeaponQueue();
FModel.SetWeapon(FCurrWeap);
if (gPlayer2 = nil) and (gLMSPID2 = FUID) then
gPlayer2 := self;
- //FNetForceWeap := FCurrWeap;
-
if g_Game_IsNet then
begin
MH_SEND_PlayerPos(True, FUID, NET_EVERYONE);
AnyServer: Boolean;
SetSpect: Boolean;
begin
- //Inc(FCurrFrameIdx);
-
NetServer := g_Game_IsNet and g_Game_IsServer;
AnyServer := g_Game_IsServer;
FAir := FSavedState.Air;
FJetFuel := FSavedState.JetFuel;
FCurrWeap := FSavedState.CurrWeap;
- //FNetForceWeap := FCurrWeap;
FNextWeap := FSavedState.NextWeap;
FNextWeapDelay := FSavedState.NextWeapDelay;
FSecrets := utils.readLongInt(st);
// Òåêóùåå îðóæèå
FCurrWeap := utils.readByte(st);
- //FNetForceWeap := FCurrWeap;
// Æåëàåìîå îðóæèå
FNextWeap := utils.readWord(st);
// ...è ïàóçà
if FBFGFireCounter < 1 then
begin
FCurrWeap := WEAPON_KASTET;
- //FNetForceWeap := FCurrWeap;
resetWeaponQueue();
FModel.SetWeapon(WEAPON_KASTET);
end;