50 InputStr: TChatLine; |
51 InputStr: TChatLine; |
51 InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char |
52 InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char |
52 ChatReady: boolean; |
53 ChatReady: boolean; |
53 showAll: boolean; |
54 showAll: boolean; |
54 |
55 |
55 const colors: array[#0..#6] of TSDL_Color = ( |
56 const |
56 (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything |
57 colors: array[#0..#6] of TSDL_Color = ( |
57 (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White] |
58 (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything |
58 (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple] |
59 (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White] |
59 (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime] |
60 (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple] |
60 (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow] |
61 (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime] |
61 (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red] |
62 (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow] |
62 (r:$00; g:$FF; b:$FF; unused:$FF) // input line [Light Blue] |
63 (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red] |
63 ); |
64 (r:$00; g:$FF; b:$FF; unused:$FF) // input line [Light Blue] |
|
65 ); |
|
66 ChatCommandz: array [TChatCmd] of record |
|
67 ChatCmd: string[31]; |
|
68 ProcedureCallChatCmd: string[31]; |
|
69 end = ( |
|
70 (ChatCmd: '/quit'; ProcedureCallChatCmd: 'halt'), |
|
71 (ChatCmd: '/pause'; ProcedureCallChatCmd: 'pause'), |
|
72 (ChatCmd: '/finish'; ProcedureCallChatCmd: 'finish'), |
|
73 (ChatCmd: '/fullscreen'; ProcedureCallChatCmd: 'fullscr') |
|
74 ); |
64 |
75 |
65 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean); |
76 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean); |
66 var strSurface, resSurface: PSDL_Surface; |
77 var strSurface, resSurface: PSDL_Surface; |
67 w, h: LongInt; |
78 w, h: LongInt; |
68 color: TSDL_Color; |
79 color: TSDL_Color; |
195 ParseCommand('/hogsay '+s, true) |
206 ParseCommand('/hogsay '+s, true) |
196 end; |
207 end; |
197 |
208 |
198 procedure AcceptChatString(s: shortstring); |
209 procedure AcceptChatString(s: shortstring); |
199 var i: TWave; |
210 var i: TWave; |
|
211 j: TChatCmd; |
200 c, t: LongInt; |
212 c, t: LongInt; |
201 x: byte; |
213 x: byte; |
202 begin |
214 begin |
203 t:= LocalTeam; |
215 t:= LocalTeam; |
204 x:= 0; |
216 x:= 0; |
205 if (s[1] = '"') and (s[Length(s)] = '"') |
217 if (s[1] = '"') and (s[Length(s)] = '"') |
206 then x:= 1 |
218 then x:= 1 |
207 |
219 |
208 else if (s[1] = '''') and (s[Length(s)] = '''') then |
220 else if (s[1] = '''') and (s[Length(s)] = '''') then |
209 x:= 2 |
221 x:= 2 |
210 |
222 |
211 else if (s[1] = '-') and (s[Length(s)] = '-') then |
223 else if (s[1] = '-') and (s[Length(s)] = '-') then |
212 x:= 3; |
224 x:= 3; |
213 |
225 |
214 if (not CurrentTeam^.ExtDriven) and (x <> 0) then |
226 if (not CurrentTeam^.ExtDriven) and (x <> 0) then |
215 for c:= 0 to Pred(TeamsCount) do |
227 for c:= 0 to Pred(TeamsCount) do |
216 if (TeamsArray[c] = CurrentTeam) then |
228 if (TeamsArray[c] = CurrentTeam) then |
217 t:= c; |
229 t:= c; |
218 |
230 |
263 |
275 |
264 for i:= Low(TWave) to High(TWave) do |
276 for i:= Low(TWave) to High(TWave) do |
265 if (s = Wavez[i].cmd) then |
277 if (s = Wavez[i].cmd) then |
266 begin |
278 begin |
267 ParseCommand('/taunt ' + char(i), true); |
279 ParseCommand('/taunt ' + char(i), true); |
|
280 exit |
|
281 end; |
|
282 |
|
283 for j:= Low(TChatCmd) to High(TChatCmd) do |
|
284 if (s = ChatCommandz[j].ChatCmd) then |
|
285 begin |
|
286 ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true); |
268 exit |
287 exit |
269 end; |
288 end; |
270 end |
289 end |
271 else |
290 else |
272 ParseCommand('/say ' + s, true); |
291 ParseCommand('/say ' + s, true); |