diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 6d5717cbc99520a13079b81d6076320e822d6142..29348b28c45600e074df7fe18b3dced0bbaa2b61 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
SysUtils, Classes,
MAPDEF,
g_basic, g_player, e_graphics, g_res_downloader,
- g_sound, g_gui, utils, md5, xprofiler;
+ g_sound, g_gui, utils, md5, mempool, xprofiler;
type
TGameSettings = record
gVotesEnabled: Boolean = True;
gEvents: Array of TGameEvent;
gDelayedEvents: Array of TDelayedEvent;
+ gUseChatSounds: Boolean = True;
gChatSounds: Array of TChatSound;
// move button values:
reliableUpdate: Boolean;
begin
g_ResetDynlights();
+ framePool.reset();
+
// Ïîðà âûêëþ÷àòü èãðó:
if gExit = EXIT_QUIT then
Exit;
gChatSounds[i].Sound.SetByName('SOUND_CHAT_MACRO' + IntToStr(i));
SetLength(gChatSounds[i].Tags, tags);
for j := 0 to tags - 1 do
- gChatSounds[i].Tags[j] := AnsiLowerCase(cfg.ReadStr(IntToStr(i), 'Tag' + IntToStr(j), ''));
+ gChatSounds[i].Tags[j] := toLowerCase1251(cfg.ReadStr(IntToStr(i), 'Tag' + IntToStr(j), ''));
gChatSounds[i].FullWord := cfg.ReadBool(IntToStr(i), 'FullWord', False);
end;
end;
g_Frames_CreateWAD(nil, 'FRAMES_TELEPORT', GameWAD+':TEXTURES\TELEPORT', 64, 64, 10, False);
+ g_Frames_CreateWAD(nil, 'FRAMES_PUNCH', GameWAD+':TEXTURES\PUNCH', 64, 64, 4, False);
g_Sound_CreateWADEx('SOUND_GAME_TELEPORT', GameWAD+':SOUNDS\TELEPORT');
g_Sound_CreateWADEx('SOUND_GAME_NOTELEPORT', GameWAD+':SOUNDS\NOTELEPORT');
g_Sound_CreateWADEx('SOUND_GAME_DOOROPEN', GameWAD+':SOUNDS\DOOROPEN');
g_Texture_Delete('TEXTURE_PLAYER_TALKBUBBLE');
g_Texture_Delete('TEXTURE_PLAYER_INVULPENTA');
g_Frames_DeleteByName('FRAMES_TELEPORT');
+ g_Frames_DeleteByName('FRAMES_PUNCH');
g_Sound_Delete('SOUND_GAME_TELEPORT');
g_Sound_Delete('SOUND_GAME_NOTELEPORT');
g_Sound_Delete('SOUND_GAME_DOOROPEN');
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);
// for FullWord check
- Text := AnsiLowerCase(' ' + Text + ' ');
+ Text := toLowerCase1251(' ' + Text + ' ');
fpText := FilterPunctuation(Text);
for i := 0 to Length(gChatSounds) - 1 do
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);