37
uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams;
37
uses SDLh, uKeys, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO;
39
39
const MaxStrIndex = 27;
181
181
visibleCount:= cnt;
184
procedure SendHogSpeech(s: shortstring);
187
ParseCommand('/hogsay '+s, true)
184
190
procedure AcceptChatString(s: shortstring);
188
// "Make hedgehog say something"
189
if (s[1] = '"') and (s[Length(s)] = '"') then
191
if CurrentTeam^.ExtDriven then
192
ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
194
ParseCommand('/hogsay '#1 + copy(s, 2, Length(s)-2), true);
197
// 'Make hedgehog think something'
198
if (s[1] = '''') and (s[Length(s)] = '''') then
200
if CurrentTeam^.ExtDriven then
201
ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
203
ParseCommand('/hogsay '#2 + copy(s, 2, Length(s)-2), true);
206
// -Make hedgehog yell something-
207
if (s[1] = '-') and (s[Length(s)] = '-') then
209
if CurrentTeam^.ExtDriven then
210
ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
212
ParseCommand('/hogsay '#3 + copy(s, 2, Length(s)-2), true);
197
if (s[1] = '"') and (s[Length(s)] = '"') then x:= 1
198
else if (s[1] = '''') and (s[Length(s)] = '''') then x:= 2
199
else if (s[1] = '-') and (s[Length(s)] = '-') then x:= 3;
200
if not CurrentTeam^.ExtDriven and (x <> 0) then
201
for c:= 0 to Pred(TeamsCount) do
202
if (TeamsArray[c] = CurrentTeam) then t:= c;
207
ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
209
SendHogSpeech(char(x) + char(t) + copy(s, 2, Length(s)-2));
215
213
// These 3 are same as above, only are to make the hedgehog say it on next attack
216
214
if (s[1] = '/') and (copy(s, 1, 5) = '/hsa ') then
218
216
if CurrentTeam^.ExtDriven then
219
217
ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
221
ParseCommand('/hogsay '#4 + copy(s, 6, Length(s)-5), true);
219
SendHogSpeech(#4 + copy(s, 6, Length(s)-5));
224
222
if (s[1] = '/') and (copy(s, 1, 5) = '/hta ') then
226
224
if CurrentTeam^.ExtDriven then
227
225
ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
229
ParseCommand('/hogsay '#5 + copy(s, 6, Length(s)-5), true);
227
SendHogSpeech(#5 + copy(s, 6, Length(s)-5));
232
230
if (s[1] = '/') and (copy(s, 1, 5) = '/hya ') then
234
232
if CurrentTeam^.ExtDriven then
235
233
ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
237
ParseCommand('/hogsay '#6 + copy(s, 6, Length(s)-5), true);
235
SendHogSpeech(#6 + copy(s, 6, Length(s)-5));
309
procedure chChatMessage(var s: shortstring);
314
procedure chSay(var s: shortstring);
318
if copy(s, 1, 4) = '/me ' then
319
s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
321
s:= #1 + UserNick + ': ' + s;
326
procedure chTeamSay(var s: shortstring);
330
s:= #4 + '[Team] ' + UserNick + ': ' + s;
335
procedure chHistory(var s: shortstring);
337
s:= s; // avoid compiler hint
338
uChat.showAll:= not uChat.showAll
341
procedure chChat(var s: shortstring);
343
s:= s; // avoid compiler hint
345
if length(s) = 0 then
311
359
procedure initModule;
361
RegisterVariable('chatmsg', vtCommand, @chChatMessage, true);
362
RegisterVariable('say', vtCommand, @chSay, true);
363
RegisterVariable('team', vtCommand, @chTeamSay, true);
364
RegisterVariable('history', vtCommand, @chHistory, true );
365
RegisterVariable('chat', vtCommand, @chChat, true );
314
368
visibleCount:= 0;