43 CountTicks: Longword = 0; |
43 CountTicks: Longword = 0; |
44 SoundTimerTicks: Longword = 0; |
44 SoundTimerTicks: Longword = 0; |
45 prevPoint: TPoint = (X: 0; Y: 0); |
45 prevPoint: TPoint = (X: 0; Y: 0); |
46 |
46 |
47 type TCaptionStr = record |
47 type TCaptionStr = record |
48 Surf: PSDL_Surface; |
48 Tex: PTexture; |
49 EndTime: LongWord; |
49 EndTime: LongWord; |
50 end; |
50 end; |
51 |
51 |
52 var cWaterSprCount: LongInt; |
52 var cWaterSprCount: LongInt; |
53 Captions: array[TCapGroup] of TCaptionStr; |
53 Captions: array[TCapGroup] of TCaptionStr; |
193 {$WARNINGS OFF} |
193 {$WARNINGS OFF} |
194 for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) ) and $FF), cWaterLine + WorldDy - 64, 0, Surface); |
194 for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) ) and $FF), cWaterLine + WorldDy - 64, 0, Surface); |
195 for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx - (RealTicks shr 6) + 192) and $FF), cWaterLine + WorldDy - 48, 0, Surface); |
195 for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx - (RealTicks shr 6) + 192) and $FF), cWaterLine + WorldDy - 48, 0, Surface); |
196 {$WARNINGS ON} |
196 {$WARNINGS ON} |
197 |
197 |
198 DrawLand(WorldDx, WorldDy, Surface); |
198 DrawLand(WorldDx, WorldDy); |
199 // Water |
199 // Water |
200 r.y:= WorldDy + cWaterLine + 32; |
200 r.y:= WorldDy + cWaterLine + 32; |
201 if r.y < cScreenHeight then |
201 if r.y < cScreenHeight then |
202 begin |
202 begin |
203 if r.y < 0 then r.y:= 0; |
203 if r.y < 0 then r.y:= 0; |
246 *) 2: with CurrentHedgehog^ do |
246 *) 2: with CurrentHedgehog^ do |
247 begin |
247 begin |
248 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
248 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
249 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
249 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
250 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
250 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
251 // DrawSprite(sprPower, hwRound(Gear^.X) + system.round(WorldDx + tdx * (24 + i * 2)) - 16, |
251 DrawSprite(sprPower, hwRound(Gear^.X) + system.round(WorldDx + tdx * (24 + i * 2)) - 16, |
252 // hwRound(Gear^.Y) + system.round(WorldDy + tdy * (24 + i * 2)) - 12, |
252 hwRound(Gear^.Y) + system.round(WorldDy + tdy * (24 + i * 2)) - 12, |
253 // i, Surface) |
253 i, Surface) |
254 end |
254 end |
255 end; |
255 end; |
256 |
256 |
257 // Target |
257 // Target |
258 //if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0, Surface); |
258 if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0, Surface); |
259 |
259 |
260 // Captions |
260 // Captions |
261 i:= 8; |
261 i:= 8; |
262 for grp:= Low(TCapGroup) to High(TCapGroup) do |
262 for grp:= Low(TCapGroup) to High(TCapGroup) do |
263 with Captions[grp] do |
263 with Captions[grp] do |
264 if Surf <> nil then |
264 if Tex <> nil then |
265 begin |
265 begin |
266 // DrawCentered(cScreenWidth div 2, i + cConsoleYAdd, Surf, Surface); |
266 DrawCentered(cScreenWidth div 2, i + cConsoleYAdd, Tex); |
267 inc(i, Surf^.h + 2); |
267 inc(i, Tex^.h + 2); |
268 if EndTime <= RealTicks then |
268 if EndTime <= RealTicks then |
269 begin |
269 begin |
270 SDL_FreeSurface(Surf); |
270 FreeTexture(Tex); |
271 Surf:= nil; |
271 Tex:= nil; |
272 EndTime:= 0 |
272 EndTime:= 0 |
273 end |
273 end |
274 end; |
274 end; |
275 |
275 |
276 // Teams Healths |
276 // Teams Healths |
277 for t:= 0 to Pred(TeamsCount) do |
277 for t:= 0 to Pred(TeamsCount) do |
278 with TeamsArray[t]^ do |
278 with TeamsArray[t]^ do |
279 begin |
279 begin |
280 r.x:= cScreenWidth div 2 - NameTag^.w - 3; |
280 DrawTexture(cScreenWidth div 2 - NameTagTex^.w - 3, DrawHealthY, NameTagTex); |
281 r.y:= DrawHealthY; |
|
282 r.w:= NameTag^.w; |
|
283 r.h:= NameTag^.h; |
|
284 // SDL_UpperBlit(NameTag, nil, Surface, @r); |
|
285 |
281 |
286 r.x:= 0; |
282 r.x:= 0; |
287 r.y:= 0; |
283 r.y:= 0; |
288 r.w:= 2 + TeamHealthBarWidth; |
284 r.w:= 2 + TeamHealthBarWidth; |
289 r.h:= HealthSurf^.h; |
285 r.h:= HealthSurf^.h; |
299 // DrawHealthY, |
295 // DrawHealthY, |
300 // @r, HealthSurf, Surface); |
296 // @r, HealthSurf, Surface); |
301 end; |
297 end; |
302 |
298 |
303 // Lag alert |
299 // Lag alert |
304 //if isInLag then DrawSprite(sprLag, 32, 32 + cConsoleYAdd, (RealTicks shr 7) mod 12, Surface); |
300 if isInLag then DrawSprite(sprLag, 32, 32 + cConsoleYAdd, (RealTicks shr 7) mod 12, Surface); |
305 |
301 |
306 // Wind bar |
302 // Wind bar |
307 //DrawSprite(sprWindBar, cScreenWidth - 180, cScreenHeight - 30, 0, Surface); |
303 DrawSprite(sprWindBar, cScreenWidth - 180, cScreenHeight - 30, 0, Surface); |
308 if WindBarWidth > 0 then |
304 if WindBarWidth > 0 then |
309 begin |
305 begin |
310 {$WARNINGS OFF} |
306 {$WARNINGS OFF} |
311 r.x:= 8 - (RealTicks shr 6) mod 8; |
307 r.x:= 8 - (RealTicks shr 6) mod 8; |
312 {$WARNINGS ON} |
308 {$WARNINGS ON} |
337 if (Gear^.State and gstHHChooseTarget) <> 0 then |
333 if (Gear^.State and gstHHChooseTarget) <> 0 then |
338 begin |
334 begin |
339 i:= Ammo^[CurSlot, CurAmmo].Pos; |
335 i:= Ammo^[CurSlot, CurAmmo].Pos; |
340 with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do |
336 with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do |
341 if PosCount > 1 then |
337 if PosCount > 1 then |
342 // DrawSprite(PosSprite, CursorPoint.X - SpritesData[PosSprite].Width div 2, |
338 DrawSprite(PosSprite, CursorPoint.X - SpritesData[PosSprite].Width div 2, |
343 // CursorPoint.Y - SpritesData[PosSprite].Height div 2, |
339 CursorPoint.Y - SpritesData[PosSprite].Height div 2, |
344 // i, Surface); |
340 i, Surface); |
345 end; |
341 end; |
346 // DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface) |
342 DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface) |
347 end; |
343 end; |
348 |
344 |
349 {$IFDEF COUNTTICKS} |
345 {$IFDEF COUNTTICKS} |
350 //DXOutText(10, 10, fnt16, inttostr(cntTicks), Surface); |
346 //DXOutText(10, 10, fnt16, inttostr(cntTicks), Surface); |
351 {$ENDIF} |
347 {$ENDIF} |
352 |
348 |
353 //if isPaused then DrawCentered(cScreenWidth div 2, cScreenHeight div 2, PauseSurface, Surface); |
349 if isPaused then DrawCentered(cScreenWidth div 2, cScreenHeight div 2, PauseTexture); |
354 |
350 |
355 inc(Frames); |
351 inc(Frames); |
356 if cShowFPS then |
352 if cShowFPS then |
357 begin |
353 begin |
358 inc(CountTicks, Lag); |
354 inc(CountTicks, Lag); |
392 end; |
388 end; |
393 |
389 |
394 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup); |
390 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup); |
395 begin |
391 begin |
396 if Group in [capgrpGameState, capgrpNetSay] then WriteLnToConsole(s); |
392 if Group in [capgrpGameState, capgrpNetSay] then WriteLnToConsole(s); |
397 if Captions[Group].Surf <> nil then SDL_FreeSurface(Captions[Group].Surf); |
393 if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex); |
398 |
394 |
399 Captions[Group].Surf:= RenderString(s, Color, fntBig); |
395 Captions[Group].Tex:= RenderStringTex(s, Color, fntBig); |
400 Captions[Group].EndTime:= RealTicks + 1500 |
396 Captions[Group].EndTime:= RealTicks + 1500 |
401 end; |
397 end; |
402 |
398 |
403 procedure MoveCamera; |
399 procedure MoveCamera; |
404 const PrevSentPointTime: LongWord = 0; |
400 const PrevSentPointTime: LongWord = 0; |