summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9783b17)
raw | patch | inline | side by side (parent: 9783b17)
author | Stas'M <x86corez@gmail.com> | |
Mon, 28 Jan 2019 23:01:37 +0000 (02:01 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Mon, 28 Jan 2019 23:01:37 +0000 (02:01 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.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_game.pas b/src/game/g_game.pas
index 6ba4297d6f5b4c4b8e61f4559fd7deb0e9444cba..12c9824f0ba05c9617745d5b57a47f9bfd49f12b 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
goodsnd: array[0..3] of TPlayableSound;
killsnd: array[0..3] of TPlayableSound;
hahasnd: array[0..2] of TPlayableSound;
+ sound_get_flag: array[0..1] of TPlayableSound;
+ sound_lost_flag: array[0..1] of TPlayableSound;
+ sound_ret_flag: array[0..1] of TPlayableSound;
+ sound_cap_flag: array[0..1] of TPlayableSound;
gBodyKillEvent: Integer = -1;
gDefInterTime: ShortInt = -1;
gInterEndTime: LongWord = 0;
g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA1', GameWAD+':SOUNDS\MUHAHA1');
g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA2', GameWAD+':SOUNDS\MUHAHA2');
g_Sound_CreateWADEx('SOUND_ANNOUNCER_MUHAHA3', GameWAD+':SOUNDS\MUHAHA3');
+ g_Sound_CreateWADEx('SOUND_CTF_GET1', GameWAD+':SOUNDS\GETFLAG1');
+ g_Sound_CreateWADEx('SOUND_CTF_GET2', GameWAD+':SOUNDS\GETFLAG2');
+ g_Sound_CreateWADEx('SOUND_CTF_LOST1', GameWAD+':SOUNDS\LOSTFLG1');
+ g_Sound_CreateWADEx('SOUND_CTF_LOST2', GameWAD+':SOUNDS\LOSTFLG2');
+ g_Sound_CreateWADEx('SOUND_CTF_RETURN1', GameWAD+':SOUNDS\RETFLAG1');
+ g_Sound_CreateWADEx('SOUND_CTF_RETURN2', GameWAD+':SOUNDS\RETFLAG2');
+ g_Sound_CreateWADEx('SOUND_CTF_CAPTURE1', GameWAD+':SOUNDS\CAPFLAG1');
+ g_Sound_CreateWADEx('SOUND_CTF_CAPTURE2', GameWAD+':SOUNDS\CAPFLAG2');
goodsnd[0] := TPlayableSound.Create();
goodsnd[1] := TPlayableSound.Create();
hahasnd[1].SetByName('SOUND_ANNOUNCER_MUHAHA2');
hahasnd[2].SetByName('SOUND_ANNOUNCER_MUHAHA3');
+ sound_get_flag[0] := TPlayableSound.Create();
+ sound_get_flag[1] := TPlayableSound.Create();
+ sound_lost_flag[0] := TPlayableSound.Create();
+ sound_lost_flag[1] := TPlayableSound.Create();
+ sound_ret_flag[0] := TPlayableSound.Create();
+ sound_ret_flag[1] := TPlayableSound.Create();
+ sound_cap_flag[0] := TPlayableSound.Create();
+ sound_cap_flag[1] := TPlayableSound.Create();
+
+ sound_get_flag[0].SetByName('SOUND_CTF_GET1');
+ sound_get_flag[1].SetByName('SOUND_CTF_GET2');
+ sound_lost_flag[0].SetByName('SOUND_CTF_LOST1');
+ sound_lost_flag[1].SetByName('SOUND_CTF_LOST2');
+ sound_ret_flag[0].SetByName('SOUND_CTF_RETURN1');
+ sound_ret_flag[1].SetByName('SOUND_CTF_RETURN2');
+ sound_cap_flag[0].SetByName('SOUND_CTF_CAPTURE1');
+ sound_cap_flag[1].SetByName('SOUND_CTF_CAPTURE2');
+
g_Game_LoadChatSounds(GameWAD+':CHATSND\SNDCFG');
g_Game_SetLoadingText(_lc[I_LOAD_ITEMS_DATA], 0, False);
g_Sound_Delete('SOUND_ANNOUNCER_MUHAHA2');
g_Sound_Delete('SOUND_ANNOUNCER_MUHAHA3');
+ sound_get_flag[0].Free();
+ sound_get_flag[1].Free();
+ sound_lost_flag[0].Free();
+ sound_lost_flag[1].Free();
+ sound_ret_flag[0].Free();
+ sound_ret_flag[1].Free();
+ sound_cap_flag[0].Free();
+ sound_cap_flag[1].Free();
+
+ g_Sound_Delete('SOUND_CTF_GET1');
+ g_Sound_Delete('SOUND_CTF_GET2');
+ g_Sound_Delete('SOUND_CTF_LOST1');
+ g_Sound_Delete('SOUND_CTF_LOST2');
+ g_Sound_Delete('SOUND_CTF_RETURN1');
+ g_Sound_Delete('SOUND_CTF_RETURN2');
+ g_Sound_Delete('SOUND_CTF_CAPTURE1');
+ g_Sound_Delete('SOUND_CTF_CAPTURE2');
+
g_Game_FreeChatSounds();
DataLoaded := False;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index be752f804f2116d93fb88ea8be5a251586225726..81eb17e904044c36be49914f5172380a7b8cbdd6 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
a, d, j: Integer;
m: Word;
s: String;
+ b: Byte;
procedure UpdatePanelArray(var panels: TPanelArray);
var
s := _lc[I_PLAYER_FLAG_BLUE];
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_RETURN], [AnsiUpperCase(s)]), 144);
+ if (((gPlayer1 <> nil) and (((gPlayer1.Team = TEAM_RED) and (a = FLAG_RED)) or ((gPlayer1.Team = TEAM_BLUE) and (a = FLAG_BLUE))))
+ or ((gPlayer2 <> nil) and (((gPlayer2.Team = TEAM_RED) and (a = FLAG_RED)) or ((gPlayer2.Team = TEAM_BLUE) and (a = FLAG_BLUE))))) then
+ b := 0
+ else
+ b := 1;
+
+ if not sound_ret_flag[b].IsPlaying() then
+ sound_ret_flag[b].Play();
+
if g_Game_IsNet then
MH_SEND_FlagEvent(FLAG_STATE_RETURNED, a, 0);
Continue;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index a7ff31a9639fe68fdf2efdae7e308b54a1683a5d..f5b30efa23c914c9ad02f9eee8c796e5df28fa6f 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
PID: Word;
Pl: TPlayer;
EvType: Byte;
- Fl: Byte;
+ Fl, a: Byte;
Quiet: Boolean;
s, ts: string;
begin
s := _lc[I_PLAYER_FLAG_BLUE];
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_RETURN], [AnsiUpperCase(s)]), 144);
+
+ if ((Pl = gPlayer1) or (Pl = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = Pl.Team))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = Pl.Team))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_ret_flag[a].IsPlaying() then
+ sound_ret_flag[a].Play();
end;
FLAG_STATE_CAPTURED:
g_Console_Add(Format(_lc[I_PLAYER_FLAG_GET], [Pl.Name, s]), True);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_GET], [AnsiUpperCase(s)]), 144);
+
+ if ((Pl = gPlayer1) or (Pl = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = Pl.Team))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = Pl.Team))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_get_flag[a].IsPlaying() then
+ sound_get_flag[a].Play();
end;
FLAG_STATE_DROPPED:
g_Console_Add(Format(_lc[I_PLAYER_FLAG_DROP], [Pl.Name, s]), True);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_DROP], [AnsiUpperCase(s)]), 144);
+
+ if ((Pl = gPlayer1) or (Pl = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = Pl.Team))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = Pl.Team))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_lost_flag[a].IsPlaying() then
+ sound_lost_flag[a].Play();
end;
FLAG_STATE_SCORED:
Insert('.', ts, Length(ts) + 1 - 3);
g_Console_Add(Format(_lc[I_PLAYER_FLAG_CAPTURE], [Pl.Name, s, ts]), True);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_CAPTURE], [AnsiUpperCase(s)]), 144);
+
+ if ((Pl = gPlayer1) or (Pl = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = Pl.Team))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = Pl.Team))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_cap_flag[a].IsPlaying() then
+ sound_cap_flag[a].Play();
end;
FLAG_STATE_RETURNED:
s := _lc[I_PLAYER_FLAG_BLUE];
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_RETURN], [AnsiUpperCase(s)]), 144);
+
+ if ((Pl = gPlayer1) or (Pl = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = Pl.Team))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = Pl.Team))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_ret_flag[a].IsPlaying() then
+ sound_ret_flag[a].Play();
end;
end;
end;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 965d5d23adb33dc2184168564d45b25a46ffa2f0..854d8119b44c4f0b4fe27b264e7dd273dece20bc 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure BFGHit();
function GetFlag(Flag: Byte): Boolean;
procedure SetFlag(Flag: Byte);
- function DropFlag(): Boolean;
+ function DropFlag(Silent: Boolean = True): Boolean;
procedure AllRulez(Health: Boolean);
procedure RestoreHealthArmor();
procedure FragCombo();
end;
// Âûáðîñ ôëàãà:
- DropFlag();
+ DropFlag(KillType = K_FALLKILL);
end;
g_Player_CreateCorpse(Self);
function TPlayer.GetFlag(Flag: Byte): Boolean;
var
s, ts: String;
- evtype: Byte;
+ evtype, a: Byte;
begin
Result := False;
g_Map_ResetFlag(FFlag);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_CAPTURE], [AnsiUpperCase(s)]), 144);
+ if ((Self = gPlayer1) or (Self = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = FTeam))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = FTeam))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_cap_flag[a].IsPlaying() then
+ sound_cap_flag[a].Play();
+
gTeamStat[FTeam].Goals := gTeamStat[FTeam].Goals + 1;
Result := True;
g_Map_ResetFlag(Flag);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_RETURN], [AnsiUpperCase(s)]), 144);
+ if ((Self = gPlayer1) or (Self = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = FTeam))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = FTeam))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_ret_flag[a].IsPlaying() then
+ sound_ret_flag[a].Play();
+
Result := True;
if g_Game_IsNet then
begin
gFlags[Flag].State := FLAG_STATE_CAPTURED;
+ if ((Self = gPlayer1) or (Self = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = FTeam))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = FTeam))) then
+ a := 0
+ else
+ a := 1;
+
+ if not sound_get_flag[a].IsPlaying() then
+ sound_get_flag[a].Play();
+
Result := True;
if g_Game_IsNet then
begin
FModel.SetFlag(FFlag);
end;
-function TPlayer.DropFlag(): Boolean;
+function TPlayer.DropFlag(Silent: Boolean = True): Boolean;
var
s: String;
+ a: Byte;
begin
Result := False;
if (not g_Game_IsServer) or (FFlag = FLAG_NONE) then
g_Console_Add(Format(_lc[I_PLAYER_FLAG_DROP], [FName, s]), True);
g_Game_Message(Format(_lc[I_MESSAGE_FLAG_DROP], [AnsiUpperCase(s)]), 144);
+ if ((Self = gPlayer1) or (Self = gPlayer2)
+ or ((gPlayer1 <> nil) and (gPlayer1.Team = FTeam))
+ or ((gPlayer2 <> nil) and (gPlayer2.Team = FTeam))) then
+ a := 0
+ else
+ a := 1;
+
+ if (not Silent) and (not sound_lost_flag[a].IsPlaying()) then
+ sound_lost_flag[a].Play();
+
if g_Game_IsNet then
MH_SEND_FlagEvent(FLAG_STATE_DROPPED, Flag, FUID, False);
end;