changeset 6580 | 6155187bf599 |
parent 6453 | 11c578d30bd3 |
child 6700 | e04da46ee43c |
6579:fc52f7c22c9b | 6580:6155187bf599 |
---|---|
34 uses SDLh, uKeys, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO; |
34 uses SDLh, uKeys, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO; |
35 |
35 |
36 const MaxStrIndex = 27; |
36 const MaxStrIndex = 27; |
37 |
37 |
38 type TChatLine = record |
38 type TChatLine = record |
39 Tex: PTexture; |
39 Tex: PTexture; |
40 Time: Longword; |
40 Time: Longword; |
41 Width: LongInt; |
41 Width: LongInt; |
42 s: shortstring; |
42 s: shortstring; |
43 end; |
43 end; |
44 |
44 |
45 var Strs: array[0 .. MaxStrIndex] of TChatLine; |
45 var Strs: array[0 .. MaxStrIndex] of TChatLine; |
46 MStrs: array[0 .. MaxStrIndex] of shortstring; |
46 MStrs: array[0 .. MaxStrIndex] of shortstring; |
47 missedCount: LongWord; |
47 missedCount: LongWord; |
48 lastStr: LongWord; |
48 lastStr: LongWord; |
102 |
102 |
103 // For uStore texture recreation |
103 // For uStore texture recreation |
104 procedure ReloadLines; |
104 procedure ReloadLines; |
105 var i, t: LongWord; |
105 var i, t: LongWord; |
106 begin |
106 begin |
107 if InputStr.s <> '' then SetLine(InputStr, InputStr.s, true); |
107 if InputStr.s <> '' then |
108 SetLine(InputStr, InputStr.s, true); |
|
108 for i:= 0 to MaxStrIndex do |
109 for i:= 0 to MaxStrIndex do |
109 if Strs[i].s <> '' then |
110 if Strs[i].s <> '' then |
110 begin |
111 begin |
111 t:= Strs[i].Time; |
112 t:= Strs[i].Time; |
112 SetLine(Strs[i], Strs[i].s, false); |
113 SetLine(Strs[i], Strs[i].s, false); |
150 |
151 |
151 r.x:= 6 - cScreenWidth div 2; |
152 r.x:= 6 - cScreenWidth div 2; |
152 r.y:= (visibleCount - t) * 16 + 10; |
153 r.y:= (visibleCount - t) * 16 + 10; |
153 r.h:= 16; |
154 r.h:= 16; |
154 |
155 |
155 if (GameState = gsChat) |
156 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
156 and (InputStr.Tex <> nil) then |
|
157 begin |
157 begin |
158 r.w:= InputStr.Width; |
158 r.w:= InputStr.Width; |
159 DrawFillRect(r); |
159 DrawFillRect(r); |
160 Tint($00, $00, $00, $80); |
160 Tint($00, $00, $00, $80); |
161 DrawTexture(9 - cScreenWidth div 2, visibleCount * 16 + 11, InputStr.Tex); |
161 DrawTexture(9 - cScreenWidth div 2, visibleCount * 16 + 11, InputStr.Tex); |
163 DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex); |
163 DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex); |
164 end; |
164 end; |
165 |
165 |
166 dec(r.y, 16); |
166 dec(r.y, 16); |
167 |
167 |
168 while (((t < 7) and (Strs[i].Time > RealTicks)) or |
168 while (((t < 7) and (Strs[i].Time > RealTicks)) or ((t < MaxStrIndex) and showAll)) |
169 ((t < MaxStrIndex) and showAll)) and |
169 and (Strs[i].Tex <> nil) do |
170 (Strs[i].Tex <> nil) do |
|
171 begin |
170 begin |
172 r.w:= Strs[i].Width; |
171 r.w:= Strs[i].Width; |
173 DrawFillRect(r); |
172 DrawFillRect(r); |
174 Tint($00, $00, $00, $80); |
173 Tint($00, $00, $00, $80); |
175 DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex); |
174 DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex); |
176 Tint($FF, $FF, $FF, $FF); |
175 Tint($FF, $FF, $FF, $FF); |
177 DrawTexture(8 - cScreenWidth div 2, (visibleCount - t) * 16 - 6, Strs[i].Tex); |
176 DrawTexture(8 - cScreenWidth div 2, (visibleCount - t) * 16 - 6, Strs[i].Tex); |
178 dec(r.y, 16); |
177 dec(r.y, 16); |
179 |
178 |
180 if i = 0 then i:= MaxStrIndex else dec(i); |
179 if i = 0 then |
180 i:= MaxStrIndex |
|
181 else |
|
182 dec(i); |
|
183 |
|
181 inc(cnt); |
184 inc(cnt); |
182 inc(t) |
185 inc(t) |
183 end; |
186 end; |
184 |
187 |
185 visibleCount:= cnt; |
188 visibleCount:= cnt; |
196 c, t: LongInt; |
199 c, t: LongInt; |
197 x: byte; |
200 x: byte; |
198 begin |
201 begin |
199 t:= LocalTeam; |
202 t:= LocalTeam; |
200 x:= 0; |
203 x:= 0; |
201 if (s[1] = '"') and (s[Length(s)] = '"') then x:= 1 |
204 if (s[1] = '"') and (s[Length(s)] = '"') |
202 else if (s[1] = '''') and (s[Length(s)] = '''') then x:= 2 |
205 then x:= 1 |
203 else if (s[1] = '-') and (s[Length(s)] = '-') then x:= 3; |
206 |
207 else if (s[1] = '''') and (s[Length(s)] = '''') then |
|
208 x:= 2 |
|
209 |
|
210 else if (s[1] = '-') and (s[Length(s)] = '-') then |
|
211 x:= 3; |
|
212 |
|
204 if not CurrentTeam^.ExtDriven and (x <> 0) then |
213 if not CurrentTeam^.ExtDriven and (x <> 0) then |
205 for c:= 0 to Pred(TeamsCount) do |
214 for c:= 0 to Pred(TeamsCount) do |
206 if (TeamsArray[c] = CurrentTeam) then t:= c; |
215 if (TeamsArray[c] = CurrentTeam) then |
216 t:= c; |
|
207 |
217 |
208 if x <> 0 then |
218 if x <> 0 then |
209 begin |
219 begin |
210 if t = -1 then |
220 if t = -1 then |
211 ParseCommand('/say ' + copy(s, 2, Length(s)-2), true) |
221 ParseCommand('/say ' + copy(s, 2, Length(s)-2), true) |
293 FreezeEnterKey; |
303 FreezeEnterKey; |
294 SDL_EnableKeyRepeat(0,0); |
304 SDL_EnableKeyRepeat(0,0); |
295 GameState:= gsGame; |
305 GameState:= gsGame; |
296 end; |
306 end; |
297 else |
307 else |
298 if (Key < $80) then btw:= 1 |
308 if (Key < $80) then |
299 else if (Key < $800) then btw:= 2 |
309 btw:= 1 |
300 else if (Key < $10000) then btw:= 3 |
310 else if (Key < $800) then |
301 else btw:= 4; |
311 btw:= 2 |
312 else if (Key < $10000) then |
|
313 btw:= 3 |
|
314 else |
|
315 btw:= 4; |
|
302 |
316 |
303 utf8:= ''; |
317 utf8:= ''; |
304 |
318 |
305 for i:= btw downto 2 do |
319 for i:= btw downto 2 do |
306 begin |
320 begin |
308 Key:= Key shr 6 |
322 Key:= Key shr 6 |
309 end; |
323 end; |
310 |
324 |
311 utf8:= char(Key or firstByteMark[btw]) + utf8; |
325 utf8:= char(Key or firstByteMark[btw]) + utf8; |
312 |
326 |
313 if byte(InputStr.s[0]) + btw > 240 then exit; |
327 if byte(InputStr.s[0]) + btw > 240 then |
328 exit; |
|
314 |
329 |
315 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |
330 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |
316 SetLine(InputStr, InputStr.s + utf8, true) |
331 SetLine(InputStr, InputStr.s + utf8, true) |
317 end |
332 end |
318 end; |
333 end; |
383 showAll:= false; |
398 showAll:= false; |
384 ChatReady:= false; |
399 ChatReady:= false; |
385 missedCount:= 0; |
400 missedCount:= 0; |
386 |
401 |
387 inputStr.Tex := nil; |
402 inputStr.Tex := nil; |
388 for i:= 0 to MaxStrIndex do Strs[i].Tex := nil; |
403 for i:= 0 to MaxStrIndex do |
404 Strs[i].Tex := nil; |
|
389 end; |
405 end; |
390 |
406 |
391 procedure freeModule; |
407 procedure freeModule; |
392 var i: ShortInt; |
408 var i: ShortInt; |
393 begin |
409 begin |
394 FreeTexture(InputStr.Tex); |
410 FreeTexture(InputStr.Tex); |
395 for i:= 0 to MaxStrIndex do FreeTexture(Strs[i].Tex); |
411 for i:= 0 to MaxStrIndex do |
412 FreeTexture(Strs[i].Tex); |
|
396 end; |
413 end; |
397 |
414 |
398 end. |
415 end. |