summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f666629)
raw | patch | inline | side by side (parent: f666629)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 1 Oct 2018 11:54:44 +0000 (14:54 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 1 Oct 2018 11:55:14 +0000 (14:55 +0300) |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 9563b8083f9fd7d1f7955a35fb0a36a96200cf35..f235035fbda6d740146eb383d07d4e66e740948f 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
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 0099b171830fbec8dfed9979c4d4d4e5eed092fb..0565c75b2761056ab75ca321ac9c3d6c556cd480 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
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) 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;
+ 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()`!
end
else
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
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
end;
procedure TPlayer.Reset(Force: Boolean);
+var
+ i: Integer;
begin
if Force then
FAlive := False;
//FCurrFrameIdx := 0;
//FNetForceWeap := FCurrWeap;
FNetForceWeapFIdx := 0;
+ resetWeaponQueue();
if FNoRespawn then
begin
FSpectator := False;
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();
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);
a, b, c: Byte;
Anim: TAnimation;
ID: DWORD;
+ i: Integer;
begin
FIncCam := 0;
FBFGFireCounter := -1;
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;
FWeapon[WEAPON_KASTET] := True;
FCurrWeap := WEAPON_PISTOL;
//FNetForceWeap := FCurrWeap;
+ FNetForceWeapFIdx := 0;
resetWeaponQueue();
FModel.SetWeapon(FCurrWeap);
begin
FCurrWeap := WEAPON_KASTET;
//FNetForceWeap := FCurrWeap;
+ FNetForceWeapFIdx := 0;
resetWeaponQueue();
FModel.SetWeapon(WEAPON_KASTET);
end;
FAIFlags := nil;
FSelectedWeapon := FCurrWeap;
+ FNetForceWeapFIdx := 0;
resetWeaponQueue();
FTargetUID := 0;
end;