From 2ce8c39f1c6e2ade354a14bd7fce6be00c8c7b0a Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Fri, 4 Jan 2019 22:58:37 +0300 Subject: [PATCH] Revert "properly reset weapon states, so player will be able to switch weapons after map restart (and other restarts)" This reverts commit 8a0bb6df836d0e815a261280d628cfd766fa02e7. --- src/game/g_netmsg.pas | 2 -- src/game/g_player.pas | 41 +++++------------------------------------ 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index f235035..9563b80 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -2839,11 +2839,9 @@ begin begin if isKeyPressed(KeyWeapon[I], KeyWeapon2[I]) then begin - //writeln('keyweapon #', i, ' is pressed; released=', Integer(gPlayer1.isWeaponSwitchKeyReleased(i)), '; frm=', gPlayer1.NetForceWeapFIdx, '; gTime=', gTime); gPlayer1.weaponSwitchKeysStateChange(i, true); if gPlayer1.isWeaponSwitchKeyReleased(i) then begin - //writeln('keyweapon #', i, ' is pressed; released=', Integer(gPlayer1.isWeaponSwitchKeyReleased(i)), '; frm=', gPlayer1.NetForceWeapFIdx, '; gTime=', gTime); gPlayer1.QueueWeaponSwitch(i); // all choices are passed there, and god will take the best //WeaponSelect := WeaponSelect or Word(1 shl I); end; diff --git a/src/game/g_player.pas b/src/game/g_player.pas index c9a6406..7436e7a 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -1372,10 +1372,12 @@ begin begin if gPlayers[i] is TPlayer then begin - //if (gPlayers[i].NetForceWeapFIdx > gTime) then writeln('*** PLAYER #', i, '; gTime=', gTime, '; nfwf=', gPlayers[i].NetForceWeapFIdx); gPlayers[i].Update(); - if (not gPlayers[i].alive) or (gPlayers[i].NetForceWeapFIdx >= gTime+15) then gPlayers[i].NetForceWeapFIdx := 0; // just in case - gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`! + if (not gPlayers[i].alive) then gPlayers[i].NetForceWeapFIdx := 0; // just in case + //if g_Game_IsClient or not g_Game_IsNet then + begin + gPlayers[i].RealizeCurrentWeapon(); // WARNING! DO NOT MOVE THIS INTO `Update()`! + end; end else begin @@ -3727,13 +3729,6 @@ begin WEAPON_FLAMETHROWER = 10; *) - { - if (FNextWeap <> 0) or (FNextWeapDelay <> 0) then - begin - e_WriteLog(Format('!!! FNextWeap=%04x; FNextWeapDelay=%d', [FNextWeap, FNextWeapDelay]), TMsgType.Warning); - end; - } - // cycling has priority if (FNextWeap and $C000) <> 0 then begin @@ -3856,14 +3851,11 @@ begin if not switchAllowed then begin - //writeln('WEAPON SWITCHING IS NOT ALLOWED! FBFGFireCounter=', FBFGFireCounter, '; gTime=', gTime, '; FTime[T_SWITCH]=', FTime[T_SWITCH]); //HACK for weapon cycling if (FNextWeap and $E000) <> 0 then FNextWeap := 0; exit; end; - if (FNetForceWeapFIdx >= gTime+15) then FNetForceWeapFIdx := 0; - nw := getNextWeaponIndex(); if nw = 255 then exit; // don't reset anything here if nw > High(FWeapon) then @@ -4373,8 +4365,6 @@ begin end; procedure TPlayer.Reset(Force: Boolean); -var - i: Integer; begin if Force then FAlive := False; @@ -4395,7 +4385,6 @@ begin //FCurrFrameIdx := 0; //FNetForceWeap := FCurrWeap; FNetForceWeapFIdx := 0; - resetWeaponQueue(); if FNoRespawn then begin FSpectator := False; @@ -4406,16 +4395,10 @@ begin end; FLives := gGameSettings.MaxLives; - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; - SetFlag(FLAG_NONE); end; procedure TPlayer.SoftReset(); -var - i: Integer; begin ReleaseKeys(); @@ -4428,11 +4411,6 @@ begin FLastFrag := 0; FComboEvnt := -1; FNetForceWeapFIdx := 0; - resetWeaponQueue(); - - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; SetFlag(FLAG_NONE); SetAction(A_STAND, True); @@ -4593,7 +4571,6 @@ var a, b, c: Byte; Anim: TAnimation; ID: DWORD; - i: Integer; begin FIncCam := 0; FBFGFireCounter := -1; @@ -4602,11 +4579,6 @@ begin FLastHit := 0; //FNetForceWeap := FCurrWeap; FNetForceWeapFIdx := 0; - resetWeaponQueue(); - - FBFGFireCounter := -1; - FTime[T_SWITCH] := 0; - for i := WP_FIRST to WP_LAST do FReloading[i] := 0; if not g_Game_IsServer then Exit; @@ -4671,7 +4643,6 @@ begin FWeapon[WEAPON_KASTET] := True; FCurrWeap := WEAPON_PISTOL; //FNetForceWeap := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FModel.SetWeapon(FCurrWeap); @@ -6285,7 +6256,6 @@ begin begin FCurrWeap := WEAPON_KASTET; //FNetForceWeap := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FModel.SetWeapon(WEAPON_KASTET); end; @@ -6714,7 +6684,6 @@ begin FAIFlags := nil; FSelectedWeapon := FCurrWeap; - FNetForceWeapFIdx := 0; resetWeaponQueue(); FTargetUID := 0; end; -- 2.29.2