summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 11b921b)
raw | patch | inline | side by side (parent: 11b921b)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 1 Mar 2020 21:16:14 +0000 (00:16 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 1 Mar 2020 21:16:14 +0000 (00:16 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history | |
src/game/g_triggers.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f4486028795f4f80134a47d33b5de80b517f9f53..affc870bddbdb010228895f4b25277a4af62d0e9 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
else if gPlayers[i].Team = TEAM_BLUE then Inc(nb)
end;
- if (n < 2) or ((gGameSettings.GameMode = GM_TDM) and ((nr = 0) or (nb = 0))) then
+ if (n < 1) or ((gGameSettings.GameMode = GM_TDM) and ((nr = 0) or (nb = 0))) then
begin
// wait a second until the fuckers finally decide to join
gLMSRespawn := LMS_RESPAWN_WARMUP;
if g_Game_IsServer then
begin
gGameSettings.WarmupTime := gsWarmupTime;
+ // extend warmup if it's already going
+ if gLMSRespawn = LMS_RESPAWN_WARMUP then
+ begin
+ gLMSRespawnTime := gTime + gsWarmupTime * 1000;
+ if g_Game_IsNet then MH_SEND_GameEvent(NET_EV_LMS_WARMUP, gLMSRespawnTime - gTime);
+ end;
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 30a71f18306d98e7b0b79486399b0323284ee28d..fe38642843d48311e9169bb13b93973c9fcfa0b5 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
MaxAmmo: Array [A_BULLETS..A_HIGH] of Word;
Weapon: Array [WP_FIRST..WP_LAST] of Boolean;
Rulez: Set of R_ITEM_BACKPACK..R_BERSERK;
- WaitRecall: Boolean;
+ Used: Boolean;
end;
TKeyState = record
FFirePainTime: Integer;
FFireAttacker: Word;
- FSavedState: TPlayerSavedState;
+ FSavedStateNum: Integer;
FModel: TPlayerModel;
FPunchAnim: TAnimation;
CurrentShell: Integer = 0;
BotNames: Array of String;
BotList: Array of TBotProfile;
+ SavedStates: Array of TPlayerSavedState;
function Lerp(X, Y, Factor: Integer): Integer;
end;
config.Free();
+ SetLength(SavedStates, 0);
end;
procedure g_Player_Free();
gPlayer1 := nil;
gPlayer2 := nil;
+ SetLength(SavedStates, 0);
end;
procedure g_Player_UpdateAll();
FClientID := -1;
FPing := 0;
FLoss := 0;
- FSavedState.WaitRecall := False;
+ FSavedStateNum := -1;
FShellTimer := -1;
FFireTime := 0;
FFirePainTime := 0;
procedure TPlayer.RememberState();
var
i: Integer;
-begin
- FSavedState.Health := FHealth;
- FSavedState.Armor := FArmor;
- FSavedState.Air := FAir;
- FSavedState.JetFuel := FJetFuel;
- FSavedState.CurrWeap := FCurrWeap;
- FSavedState.NextWeap := FNextWeap;
- FSavedState.NextWeapDelay := FNextWeapDelay;
+ SavedState: TPlayerSavedState;
+begin
+ SavedState.Health := FHealth;
+ SavedState.Armor := FArmor;
+ SavedState.Air := FAir;
+ SavedState.JetFuel := FJetFuel;
+ SavedState.CurrWeap := FCurrWeap;
+ SavedState.NextWeap := FNextWeap;
+ SavedState.NextWeapDelay := FNextWeapDelay;
+ for i := Low(FWeapon) to High(FWeapon) do
+ SavedState.Weapon[i] := FWeapon[i];
+ for i := Low(FAmmo) to High(FAmmo) do
+ SavedState.Ammo[i] := FAmmo[i];
+ for i := Low(FMaxAmmo) to High(FMaxAmmo) do
+ SavedState.MaxAmmo[i] := FMaxAmmo[i];
+ SavedState.Rulez := FRulez - [R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE];
+
+ if FSavedStateNum < 0 then
+ begin
+ for i := Low(SavedStates) to High(SavedStates) do
+ if not SavedStates[i].Used then
+ begin
+ FSavedStateNum := i;
+ break;
+ end;
+ if FSavedStateNum < 0 then
+ begin
+ SetLength(SavedStates, Length(SavedStates) + 1);
+ FSavedStateNum := High(SavedStates);
+ end;
+ end;
- for i := 0 to 3 do
- FSavedState.Ammo[i] := FAmmo[i];
- for i := 0 to 3 do
- FSavedState.MaxAmmo[i] := FMaxAmmo[i];
- FSavedState.Rulez := FRulez;
- FSavedState.WaitRecall := True;
+ SavedState.Used := True;
+ SavedStates[i] := SavedState;
end;
procedure TPlayer.RecallState();
var
i: Integer;
+ SavedState: TPlayerSavedState;
begin
- if not FSavedState.WaitRecall then Exit;
-
- FHealth := FSavedState.Health;
- FArmor := FSavedState.Armor;
- FAir := FSavedState.Air;
- FJetFuel := FSavedState.JetFuel;
- FCurrWeap := FSavedState.CurrWeap;
- FNextWeap := FSavedState.NextWeap;
- FNextWeapDelay := FSavedState.NextWeapDelay;
-
- for i := 0 to 3 do
- FAmmo[i] := FSavedState.Ammo[i];
- for i := 0 to 3 do
- FMaxAmmo[i] := FSavedState.MaxAmmo[i];
+ if(FSavedStateNum < 0) or (FSavedStateNum > High(SavedStates)) then
+ Exit;
- FRulez := FSavedState.Rulez;
- FSavedState.WaitRecall := False;
+ SavedState := SavedStates[FSavedStateNum];
+ SavedStates[FSavedStateNum].Used := False;
+ FSavedStateNum := -1;
+
+ FHealth := SavedState.Health;
+ FArmor := SavedState.Armor;
+ FAir := SavedState.Air;
+ FJetFuel := SavedState.JetFuel;
+ FCurrWeap := SavedState.CurrWeap;
+ FNextWeap := SavedState.NextWeap;
+ FNextWeapDelay := SavedState.NextWeapDelay;
+ for i := Low(FWeapon) to High(FWeapon) do
+ FWeapon[i] := SavedState.Weapon[i];
+ for i := Low(FAmmo) to High(FAmmo) do
+ FAmmo[i] := SavedState.Ammo[i];
+ for i := Low(FMaxAmmo) to High(FMaxAmmo) do
+ FMaxAmmo[i] := SavedState.MaxAmmo[i];
+ FRulez := SavedState.Rulez;
if gGameSettings.GameType = GT_SERVER then
MH_SEND_PlayerStats(FUID);
index 55057b622a11f6b54475ee9d4265d580a7312097..779a9a151238f73afceb3c1d8e91df2cb3494ed2 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
begin
Enabled := False;
Result := True;
- if gLMSRespawn = LMS_RESPAWN_NONE then
+ p := g_Player_Get(ActivateUID);
+ p.GetSecret();
+ Inc(gCoopSecretsFound);
+ if g_Game_IsNet then
begin
- p := g_Player_Get(ActivateUID);
- p.GetSecret();
- Inc(gCoopSecretsFound);
- if g_Game_IsNet then
- begin
- MH_SEND_GameStats();
- if p.FClientID >= 0 then
- MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '');
- end;
+ MH_SEND_GameStats();
+ MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '');
end;
end;
begin
if (tgMonsList = nil) then tgMonsList := TSimpleMonsterList.Create();
- if gTriggers = nil then
- Exit;
+ if gTriggers = nil then Exit;
+ if gLMSRespawn > LMS_RESPAWN_NONE then Exit; // don't update triggers at all
+
SetLength(Affected, 0);
for a := 0 to High(gTriggers) do