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);
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',
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';
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);