summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19cdfaa)
raw | patch | inline | side by side (parent: 19cdfaa)
author | Stas'M <x86corez@gmail.com> | |
Sat, 13 Jan 2018 14:57:33 +0000 (17:57 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sat, 13 Jan 2018 14:57:33 +0000 (17:57 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_language.pas | patch | blob | history | |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_options.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index b1f5f9fe1955f1f85dac4e02ba05345d9bd298f0..12e8798431cbbeb7810b3218322a800d75a09c8f 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
gVotesEnabled: Boolean = True;
gEvents: Array of TGameEvent;
gDelayedEvents: Array of TDelayedEvent;
+ gUseChatSounds: Boolean = True;
gChatSounds: Array of TChatSound;
// move button values:
end;
procedure g_Game_ChatSound(Text: String; Taunt: Boolean = True);
+const
+ punct: Array[0..13] of String =
+ ('.', ',', ':', ';', '!', '?', '(', ')', '''', '"', '/', '\', '*', '^');
var
i, j: Integer;
ok: Boolean;
fpText: String;
+ function IsPunctuation(S: String): Boolean;
+ var
+ i: Integer;
+ begin
+ Result := False;
+ if Length(S) <> 1 then
+ Exit;
+ for i := Low(punct) to High(punct) do
+ if S = punct[i] then
+ begin
+ Result := True;
+ break;
+ end;
+ end;
function FilterPunctuation(S: String): String;
+ var
+ i: Integer;
begin
- S := StringReplace(S, '.', ' ', [rfReplaceAll]);
- S := StringReplace(S, ',', ' ', [rfReplaceAll]);
- S := StringReplace(S, ':', ' ', [rfReplaceAll]);
- S := StringReplace(S, ';', ' ', [rfReplaceAll]);
- S := StringReplace(S, '!', ' ', [rfReplaceAll]);
- S := StringReplace(S, '?', ' ', [rfReplaceAll]);
+ for i := Low(punct) to High(punct) do
+ S := StringReplace(S, punct[i], ' ', [rfReplaceAll]);
Result := S;
end;
begin
- g_Sound_PlayEx('SOUND_GAME_RADIO');
+ ok := False;
- if Taunt and (gChatSounds <> nil) and (Pos(': ', Text) > 0) then
+ if gUseChatSounds and Taunt and (gChatSounds <> nil) and (Pos(': ', Text) > 0) then
begin
// remove player name
Delete(Text, 1, Pos(': ', Text) + 2 - 1);
ok := True;
for j := 0 to Length(gChatSounds[i].Tags) - 1 do
begin
- if gChatSounds[i].FullWord and
- (gChatSounds[i].Tags[j] <> '.') and (gChatSounds[i].Tags[j] <> ',') and
- (gChatSounds[i].Tags[j] <> ':') and (gChatSounds[i].Tags[j] <> ';') and
- (gChatSounds[i].Tags[j] <> '!') and (gChatSounds[i].Tags[j] <> '?') then
+ if gChatSounds[i].FullWord and (not IsPunctuation(gChatSounds[i].Tags[j])) then
ok := Pos(' ' + gChatSounds[i].Tags[j] + ' ', fpText) > 0
else
ok := Pos(gChatSounds[i].Tags[j], Text) > 0;
end;
end;
end;
+ if not ok then
+ g_Sound_PlayEx('SOUND_GAME_RADIO');
end;
procedure g_Game_Announce_GoodShot(SpawnerUID: Word);
index 2bebf82afb36d255dcbe4da29137d2a0f3bc03cd..424aa2af4ead6ff684d6b60c499ccc97f4e12fd6 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MENU_SOUND_INACTIVE_SOUNDS_OFF,
I_MENU_SOUND_ANNOUNCE,
I_MENU_SOUND_COMPAT,
+ I_MENU_SOUND_CHAT,
I_MENU_ANNOUNCE_NONE,
I_MENU_ANNOUNCE_ME,
I_MENU_ANNOUNCE_MEPLUS,
'Îáúÿâëåíèÿ:'),
('MENU SOUND COMPAT', 'Sound FX set:',
'Íàáîð çâóêîâ:'),
+ ('MENU SOUND CHAT', 'Enable chat speech:',
+ 'Îçâó÷èâàòü ÷àò:'),
('MENU ANNOUNCE NONE', 'None',
'Íåò'),
('MENU ANNOUNCE ME', 'Only own announcers',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 9d5193d29f7822c30f6a58c6dad73da8b8994dfa..0ba399a571c94dfeaa23e66e2f09f00ee990cccf 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
gMuteWhenInactive := TGUISwitch(menu.GetControl('swInactiveSounds')).ItemIndex = 1;
gAnnouncer := TGUISwitch(menu.GetControl('swAnnouncer')).ItemIndex;
gSoundEffectsDF := TGUISwitch(menu.GetControl('swSoundEffects')).ItemIndex = 1;
+ gUseChatSounds := TGUISwitch(menu.GetControl('swChatSpeech')).ItemIndex = 0;
menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
else
ItemIndex := 0;
+ with TGUISwitch(menu.GetControl('swChatSpeech')) do
+ if gUseChatSounds then
+ ItemIndex := 0
+ else
+ ItemIndex := 1;
+
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
with menu, gGameControls.P1Control do
begin
AddItem(_lc[I_MENU_COMPAT_DOOM2]);
AddItem(_lc[I_MENU_COMPAT_DF]);
end;
+ // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
+ with AddSwitch (_lc[I_MENU_SOUND_CHAT]) do
+ begin;
+ Name := 'swChatSpeech';
+ AddItem(_lc[I_MENU_YES]);
+ AddItem(_lc[I_MENU_NO]);
+ end;
with AddSwitch(_lc[I_MENU_SOUND_INACTIVE_SOUNDS]) do
begin
Name := 'swInactiveSounds';
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index a3d7017a7785816f65043f1fb1fef382d37c4d91..90effe0f8e8a3d343f131cc5a5e071817efedf83 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gMuteWhenInactive := False;
gAnnouncer := ANNOUNCE_MEPLUS;
gSoundEffectsDF := True;
+ gUseChatSounds := True;
g_GFX_SetMax(2000);
g_Gibs_SetMax(150);
g_Corpses_SetMax(20);
gMuteWhenInactive := config.ReadBool('Sound', 'MuteInactive', False);
gAnnouncer := Min(Max(config.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS), ANNOUNCE_NONE), ANNOUNCE_ALL);
gSoundEffectsDF := config.ReadBool('Sound', 'SoundEffectsDF', True);
+ gUseChatSounds := config.ReadBool('Sound', 'ChatSounds', True);
gsSDLSampleRate := Min(Max(config.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
gsSDLBufferSize := Min(Max(config.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
config.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive);
config.WriteInt('Sound', 'Announcer', gAnnouncer);
config.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF);
+ config.WriteBool('Sound', 'ChatSounds', gUseChatSounds);
config.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate);
config.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize);