108 g: ansistring; |
108 g: ansistring; |
109 begin |
109 begin |
110 missionTimer:= 0; |
110 missionTimer:= 0; |
111 |
111 |
112 if (GameFlags and gfRandomOrder) <> 0 then // shuffle them up a bit |
112 if (GameFlags and gfRandomOrder) <> 0 then // shuffle them up a bit |
113 begin |
113 begin |
114 for i:= 0 to ClansCount * 4 do |
114 for i:= 0 to ClansCount * 4 do |
115 begin |
115 begin |
116 t:= GetRandom(ClansCount); |
116 t:= GetRandom(ClansCount); |
117 if t <> 0 then |
117 if t <> 0 then |
118 begin |
118 begin |
119 cp:= ClansArray[0]; |
119 cp:= ClansArray[0]; |
120 ClansArray[0]:= ClansArray[t]; |
120 ClansArray[0]:= ClansArray[t]; |
121 ClansArray[t]:= cp; |
121 ClansArray[t]:= cp; |
122 ClansArray[t]^.ClanIndex:= t; |
122 ClansArray[t]^.ClanIndex:= t; |
123 ClansArray[0]^.ClanIndex:= 0; |
123 ClansArray[0]^.ClanIndex:= 0; |
124 if (LocalClan = t) then LocalClan:= 0 |
124 if (LocalClan = t) then |
125 else if (LocalClan = 0) then LocalClan:= t |
125 LocalClan:= 0 |
126 end; |
126 else if (LocalClan = 0) then |
127 end; |
127 LocalClan:= t |
128 CurrentTeam:= ClansArray[0]^.Teams[0]; |
128 end; |
129 end; |
129 end; |
|
130 CurrentTeam:= ClansArray[0]^.Teams[0]; |
|
131 end; |
130 |
132 |
131 // if special game flags/settings are changed, add them to the game mode notice window and then show it |
133 // if special game flags/settings are changed, add them to the game mode notice window and then show it |
132 g:= ''; // no text/things to note yet |
134 g:= ''; // no text/things to note yet |
133 |
135 |
134 // add custom goals from lua script if there are any |
136 // add custom goals from lua script if there are any |
135 if LuaGoals <> '' then g:= LuaGoals + '|'; |
137 if LuaGoals <> '' then |
|
138 g:= LuaGoals + '|'; |
136 |
139 |
137 // check different game flags (goals/game modes first for now) |
140 // check different game flags (goals/game modes first for now) |
138 g:= AddGoal(g, gfKing, gidKing); // king? |
141 g:= AddGoal(g, gfKing, gidKing); // king? |
139 g:= AddGoal(g, gfTagTeam, gidTagTeam); // tag team mode? |
142 g:= AddGoal(g, gfTagTeam, gidTagTeam); // tag team mode? |
140 |
143 |
231 const BORDERSIZE = 2; |
235 const BORDERSIZE = 2; |
232 var x, y, i, t, g: LongInt; |
236 var x, y, i, t, g: LongInt; |
233 Slot, Pos, STurns: LongInt; |
237 Slot, Pos, STurns: LongInt; |
234 Ammo: PHHAmmo; |
238 Ammo: PHHAmmo; |
235 begin |
239 begin |
236 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or |
240 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) |
237 ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
241 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
238 bShowAmmoMenu:= false; |
242 bShowAmmoMenu:= false; |
239 |
243 |
240 if bShowAmmoMenu then |
244 if bShowAmmoMenu then |
241 // show ammo menu |
245 // show ammo menu |
242 begin |
246 begin |
243 FollowGear:= nil; |
247 FollowGear:= nil; |
244 if AMxShift = AMWidth then prevPoint.X:= 0; |
248 if AMxShift = AMWidth then |
245 if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= 0 |
249 prevPoint.X:= 0; |
|
250 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
251 AMxShift:= 0 |
246 else |
252 else |
247 if AMxShift > MENUSPEED then dec(AMxShift, MENUSPEED) |
253 if AMxShift > MENUSPEED then |
248 else AMxShift:= 0; |
254 dec(AMxShift, MENUSPEED) |
|
255 else |
|
256 AMxShift:= 0; |
249 end |
257 end |
250 else |
258 else |
251 // hide ammo menu |
259 // hide ammo menu |
252 begin |
260 begin |
253 if AMxShift = 0 then |
261 if AMxShift = 0 then |
254 begin |
262 begin |
255 CursorPoint.X:= cScreenWidth shr 1; |
263 CursorPoint.X:= cScreenWidth shr 1; |
256 CursorPoint.Y:= cScreenHeight shr 1; |
264 CursorPoint.Y:= cScreenHeight shr 1; |
257 prevPoint:= CursorPoint; |
265 prevPoint:= CursorPoint; |
258 end; |
266 end; |
259 if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= AMWidth+2 |
267 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
268 AMxShift:= AMWidth+2 |
260 else |
269 else |
261 if AMxShift < (AMWidth - MENUSPEED) then inc(AMxShift, MENUSPEED) |
270 if AMxShift < (AMWidth - MENUSPEED) then |
262 else AMxShift:= AMWidth; |
271 inc(AMxShift, MENUSPEED) |
|
272 else |
|
273 AMxShift:= AMWidth; |
263 end; |
274 end; |
264 |
275 |
265 // give the assigned ammo to hedgehog |
276 // give the assigned ammo to hedgehog |
266 Ammo:= nil; |
277 Ammo:= nil; |
267 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and |
278 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) |
268 (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
279 and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
269 Ammo:= CurrentHedgehog^.Ammo |
280 Ammo:= CurrentHedgehog^.Ammo |
270 else if (LocalAmmo <> -1) then |
281 else if (LocalAmmo <> -1) then |
271 Ammo:= GetAmmoByNum(LocalAmmo); |
282 Ammo:= GetAmmoByNum(LocalAmmo); |
272 Pos:= -1; |
283 Pos:= -1; |
273 if Ammo = nil then |
284 if Ammo = nil then |
305 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
317 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
306 |
318 |
307 if STurns >= 0 then |
319 if STurns >= 0 then |
308 begin |
320 begin |
309 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
321 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
310 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
322 if STurns < 100 then |
|
323 DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
311 end |
324 end |
312 else |
325 else |
313 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
326 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
314 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
327 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
315 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
328 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
316 begin |
329 begin |
317 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
330 if (STurns < 0) then |
|
331 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
318 Pos:= t; |
332 Pos:= t; |
319 end; |
333 end; |
320 inc(g) |
334 inc(g) |
321 end; |
335 end; |
322 inc(t) |
336 inc(t) |
346 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
360 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
347 |
361 |
348 for i:= cMaxSlotIndex downto 0 do |
362 for i:= cMaxSlotIndex downto 0 do |
349 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
363 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
350 begin |
364 begin |
351 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i; |
365 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then |
|
366 Slot:= i; |
352 dec(y, AMSlotSize); |
367 dec(y, AMSlotSize); |
353 inc(SlotsNum); |
368 inc(SlotsNum); |
354 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
369 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
355 DrawSprite(sprAMSlot, x, y, 1); |
370 DrawSprite(sprAMSlot, x, y, 1); |
356 DrawSprite(sprAMSlotKeys, x, y + 1, i); |
371 DrawSprite(sprAMSlotKeys, x, y + 1, i); |
364 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
379 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
365 |
380 |
366 if STurns >= 0 then |
381 if STurns >= 0 then |
367 begin |
382 begin |
368 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
383 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
369 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
384 if STurns < 100 then |
|
385 DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
370 end else |
386 end else |
371 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
387 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
372 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
388 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
373 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
389 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
374 begin |
390 begin |
375 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
391 if (STurns < 0) then |
|
392 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
376 Pos:= t; |
393 Pos:= t; |
377 end; |
394 end; |
378 inc(g) |
395 inc(g) |
379 end; |
396 end; |
380 inc(t) |
397 inc(t) |
430 {$ELSE} |
447 {$ELSE} |
431 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
448 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
432 {$ENDIF} |
449 {$ENDIF} |
433 |
450 |
434 bSelected:= false; |
451 bSelected:= false; |
435 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
452 if AMxShift = 0 then |
|
453 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
436 end; |
454 end; |
437 |
455 |
438 procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
456 procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
439 var VertexBuffer: array [0..3] of TVertex2f; |
457 var VertexBuffer: array [0..3] of TVertex2f; |
440 r: TSDL_Rect; |
458 r: TSDL_Rect; |
441 lw, lh: GLfloat; |
459 lw, lh: GLfloat; |
442 begin |
460 begin |
443 if SuddenDeathDmg then |
461 if SuddenDeathDmg then |
444 begin |
462 begin |
445 SDWaterColorArray[0].a := Alpha; |
463 SDWaterColorArray[0].a := Alpha; |
446 SDWaterColorArray[1].a := Alpha; |
464 SDWaterColorArray[1].a := Alpha; |
447 SDWaterColorArray[2].a := Alpha; |
465 SDWaterColorArray[2].a := Alpha; |
448 SDWaterColorArray[3].a := Alpha |
466 SDWaterColorArray[3].a := Alpha |
449 end |
467 end |
450 else |
468 else |
451 begin |
469 begin |
452 WaterColorArray[0].a := Alpha; |
470 WaterColorArray[0].a := Alpha; |
453 WaterColorArray[1].a := Alpha; |
471 WaterColorArray[1].a := Alpha; |
454 WaterColorArray[2].a := Alpha; |
472 WaterColorArray[2].a := Alpha; |
455 WaterColorArray[3].a := Alpha |
473 WaterColorArray[3].a := Alpha |
456 end; |
474 end; |
457 |
475 |
458 lw:= cScreenWidth / cScaleFactor; |
476 lw:= cScreenWidth / cScaleFactor; |
459 lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
477 lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
460 |
478 |
461 // Water |
479 // Water |
462 r.y:= OffsetY + WorldDy + cWaterLine; |
480 r.y:= OffsetY + WorldDy + cWaterLine; |
463 if WorldDy < trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine then |
481 if WorldDy < trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine then |
464 begin |
482 begin |
465 if r.y < 0 then |
483 if r.y < 0 then |
466 r.y:= 0; |
484 r.y:= 0; |
467 |
485 |
468 glDisable(GL_TEXTURE_2D); |
486 glDisable(GL_TEXTURE_2D); |
557 end; |
575 end; |
558 |
576 |
559 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt); |
577 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt); |
560 var i, w, h, lw, lh, rw, rh, sw: LongInt; |
578 var i, w, h, lw, lh, rw, rh, sw: LongInt; |
561 begin |
579 begin |
562 sw:= round(cScreenWidth / cScaleFactor); |
580 sw:= round(cScreenWidth / cScaleFactor); |
563 if (SpritesData[sprL].Texture = nil) and (SpritesData[spr].Texture <> nil) then |
581 if (SpritesData[sprL].Texture = nil) and (SpritesData[spr].Texture <> nil) then |
564 begin |
582 begin |
565 w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
583 w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
566 h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
584 h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
567 i:= Shift mod w; |
585 i:= Shift mod w; |
568 if i > 0 then dec(i, w); |
586 if i > 0 then |
569 dec(i, w * (sw div w + 1)); |
587 dec(i, w); |
570 repeat |
588 dec(i, w * (sw div w + 1)); |
571 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
589 repeat |
572 inc(i, w) |
590 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
573 until i > sw |
591 inc(i, w) |
574 end |
592 until i > sw |
575 else if SpritesData[spr].Texture <> nil then |
593 end |
576 begin |
594 else if SpritesData[spr].Texture <> nil then |
577 w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
595 begin |
578 h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
596 w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
579 lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale; |
597 h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
580 lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; |
598 lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale; |
581 if SpritesData[sprR].Texture <> nil then |
599 lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; |
|
600 if SpritesData[sprR].Texture <> nil then |
|
601 begin |
|
602 rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; |
|
603 rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale |
|
604 end; |
|
605 dec(Shift, w div 2); |
|
606 DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
|
607 |
|
608 i:= Shift - lw; |
|
609 while i >= -sw - lw do |
|
610 begin |
|
611 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
|
612 dec(i, lw); |
|
613 end; |
|
614 |
|
615 i:= Shift + w; |
|
616 if SpritesData[sprR].Texture <> nil then |
|
617 while i <= sw do |
582 begin |
618 begin |
583 rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; |
619 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); |
584 rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale |
620 inc(i, rw) |
585 end; |
621 end |
586 dec(Shift, w div 2); |
622 else |
587 DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
623 while i <= sw do |
588 |
|
589 i:= Shift - lw; |
|
590 while i >= -sw - lw do |
|
591 begin |
624 begin |
592 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
625 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
593 dec(i, lw); |
626 inc(i, lw) |
594 end; |
627 end |
595 |
628 end |
596 i:= Shift + w; |
|
597 if SpritesData[sprR].Texture <> nil then |
|
598 while i <= sw do |
|
599 begin |
|
600 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); |
|
601 inc(i, rw) |
|
602 end |
|
603 else |
|
604 while i <= sw do |
|
605 begin |
|
606 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
|
607 inc(i, lw) |
|
608 end |
|
609 end |
|
610 end; |
629 end; |
611 |
630 |
612 |
631 |
613 procedure DrawWorld(Lag: LongInt); |
632 procedure DrawWorld(Lag: LongInt); |
614 begin |
633 begin |
615 if not isPaused then |
634 if not isPaused then |
616 begin |
635 begin |
617 if ZoomValue < zoom then |
636 if ZoomValue < zoom then |
618 begin |
637 begin |
619 zoom:= zoom - 0.002 * Lag; |
638 zoom:= zoom - 0.002 * Lag; |
620 if ZoomValue > zoom then |
639 if ZoomValue > zoom then |
621 zoom:= ZoomValue |
640 zoom:= ZoomValue |
622 end |
641 end |
623 else |
642 else |
624 if ZoomValue > zoom then |
643 if ZoomValue > zoom then |
625 begin |
644 begin |
626 zoom:= zoom + 0.002 * Lag; |
645 zoom:= zoom + 0.002 * Lag; |
627 if ZoomValue < zoom then |
646 if ZoomValue < zoom then |
628 zoom:= ZoomValue |
647 zoom:= ZoomValue |
629 end |
648 end |
630 end |
649 end |
804 if ScreenBottom > SkyOffset then |
826 if ScreenBottom > SkyOffset then |
805 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
827 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
806 |
828 |
807 // background |
829 // background |
808 ChangeDepth(RM, cStereo_Sky); |
830 ChangeDepth(RM, cStereo_Sky); |
809 if SuddenDeathDmg then Tint(SDTint, SDTint, SDTint, $FF); |
831 if SuddenDeathDmg then |
|
832 Tint(SDTint, SDTint, SDTint, $FF); |
810 DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
833 DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
811 ChangeDepth(RM, -cStereo_Horizon); |
834 ChangeDepth(RM, -cStereo_Horizon); |
812 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
835 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
813 if SuddenDeathDmg then Tint($FF, $FF, $FF, $FF); |
836 if SuddenDeathDmg then |
|
837 Tint($FF, $FF, $FF, $FF); |
814 end; |
838 end; |
815 |
839 |
816 DrawVisualGears(0); |
840 DrawVisualGears(0); |
817 ChangeDepth(RM, -cStereo_MidDistance); |
841 ChangeDepth(RM, -cStereo_MidDistance); |
818 DrawVisualGears(4); |
842 DrawVisualGears(4); |
819 |
843 |
820 if (cReducedQuality and rq2DWater) = 0 then |
844 if (cReducedQuality and rq2DWater) = 0 then |
821 begin |
845 begin |
822 // Waves |
846 // Waves |
823 DrawWater(255, SkyOffset); |
847 DrawWater(255, SkyOffset); |
824 ChangeDepth(RM, -cStereo_Water_distant); |
848 ChangeDepth(RM, -cStereo_Water_distant); |
825 DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
849 DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
828 ChangeDepth(RM, -cStereo_Water_distant); |
852 ChangeDepth(RM, -cStereo_Water_distant); |
829 DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32); |
853 DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32); |
830 ChangeDepth(RM, -cStereo_Water_distant); |
854 ChangeDepth(RM, -cStereo_Water_distant); |
831 DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24); |
855 DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24); |
832 end |
856 end |
833 else |
857 else |
834 DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); |
858 DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); |
835 |
859 |
836 changeDepth(RM, cStereo_Land); |
860 changeDepth(RM, cStereo_Land); |
837 DrawVisualGears(5); |
861 DrawVisualGears(5); |
838 DrawLand(WorldDx, WorldDy); |
862 DrawLand(WorldDx, WorldDy); |
859 hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16, |
883 hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16, |
860 i) |
884 i) |
861 end |
885 end |
862 end; |
886 end; |
863 |
887 |
864 DrawVisualGears(1); |
888 DrawVisualGears(1); |
865 DrawGears; |
889 DrawGears; |
866 DrawVisualGears(6); |
890 DrawVisualGears(6); |
867 |
891 |
|
892 if SuddenDeathDmg then |
|
893 DrawWater(cSDWaterOpacity, 0) |
|
894 else |
|
895 DrawWater(cWaterOpacity, 0); |
|
896 |
|
897 // Waves |
|
898 ChangeDepth(RM, cStereo_Water_near); |
|
899 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); |
|
900 |
|
901 if (cReducedQuality and rq2DWater) = 0 then |
|
902 begin |
|
903 //DrawWater(cWaterOpacity, - offsetY div 40); |
|
904 ChangeDepth(RM, cStereo_Water_near); |
|
905 DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); |
868 if SuddenDeathDmg then |
906 if SuddenDeathDmg then |
869 DrawWater(cSDWaterOpacity, 0) |
907 DrawWater(cSDWaterOpacity, - offsetY div 20) |
870 else |
908 else |
871 DrawWater(cWaterOpacity, 0); |
909 DrawWater(cWaterOpacity, - offsetY div 20); |
872 |
|
873 // Waves |
|
874 ChangeDepth(RM, cStereo_Water_near); |
910 ChangeDepth(RM, cStereo_Water_near); |
875 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); |
911 DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); |
876 |
|
877 if (cReducedQuality and rq2DWater) = 0 then |
|
878 begin |
|
879 //DrawWater(cWaterOpacity, - offsetY div 40); |
|
880 ChangeDepth(RM, cStereo_Water_near); |
|
881 DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); |
|
882 if SuddenDeathDmg then |
|
883 DrawWater(cSDWaterOpacity, - offsetY div 20) |
|
884 else |
|
885 DrawWater(cWaterOpacity, - offsetY div 20); |
|
886 ChangeDepth(RM, cStereo_Water_near); |
|
887 DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); |
|
888 if SuddenDeathDmg then |
912 if SuddenDeathDmg then |
889 DrawWater(cSDWaterOpacity, - offsetY div 10) |
913 DrawWater(cSDWaterOpacity, - offsetY div 10) |
890 else |
914 else |
891 DrawWater(cWaterOpacity, - offsetY div 10); |
915 DrawWater(cWaterOpacity, - offsetY div 10); |
892 ChangeDepth(RM, cStereo_Water_near); |
916 ChangeDepth(RM, cStereo_Water_near); |
893 DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
917 DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
894 end |
918 end |
895 else |
919 else |
896 DrawWaves(-1, 50, - (cWaveHeight shr 1), 0); |
920 DrawWaves(-1, 50, - (cWaveHeight shr 1), 0); |
897 |
921 |
898 // everything after this ChangeDepth will be drawn outside the screen |
922 // everything after this ChangeDepth will be drawn outside the screen |
899 // note: negative parallax gears should last very little for a smooth stereo effect |
923 // note: negative parallax gears should last very little for a smooth stereo effect |
959 // Teams Healths |
986 // Teams Healths |
960 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays |
987 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays |
961 begin |
988 begin |
962 SetScale(1.5); |
989 SetScale(1.5); |
963 smallScreenOffset:= cScreenHeight div 6; |
990 smallScreenOffset:= cScreenHeight div 6; |
964 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80); |
991 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then |
|
992 Tint($FF,$FF,$FF,$80); |
965 end |
993 end |
966 else smallScreenOffset:= 0; |
994 else smallScreenOffset:= 0; |
967 for t:= 0 to Pred(TeamsCount) do |
995 for t:= 0 to Pred(TeamsCount) do |
968 with TeamsArray[t]^ do |
996 with TeamsArray[t]^ do |
969 begin |
997 begin |
970 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
998 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
971 |
999 |
972 if highlight then |
1000 if highlight then |
973 Tint(Clan^.Color shl 8 or $FF); |
1001 Tint(Clan^.Color shl 8 or $FF); |
974 |
|
975 // draw name |
|
976 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex); |
|
977 |
|
978 // draw flag |
|
979 DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex); |
|
980 |
|
981 // draw health bar |
|
982 r.x:= 0; |
|
983 r.y:= 0; |
|
984 r.w:= 2 + TeamHealthBarWidth; |
|
985 r.h:= HealthTex^.h; |
|
986 DrawFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex); |
|
987 |
|
988 // draw health bars right border |
|
989 inc(r.x, cTeamHealthWidth + 2); |
|
990 r.w:= 3; |
|
991 DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex); |
|
992 |
|
993 // draw ai kill counter for gfAISurvival |
|
994 if (GameFlags and gfAISurvival) <> 0 then begin |
|
995 DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, |
|
996 AIKillsTex); |
|
997 end; |
|
998 |
|
999 // if highlighted, draw flag and other contents again to keep their colors |
|
1000 // this approach should be faster than drawing all borders one by one tinted or not |
|
1001 if highlight then |
|
1002 begin |
|
1003 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80) |
|
1004 else Tint($FF, $FF, $FF, $FF); |
|
1005 |
1002 |
1006 // draw name |
1003 // draw name |
1007 r.x:= 2; |
1004 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex); |
1008 r.y:= 2; |
1005 |
1009 r.w:= NameTagTex^.w - 4; |
1006 // draw flag |
1010 r.h:= NameTagTex^.h - 4; |
1007 DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex); |
1011 DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex); |
1008 |
1012 // draw flag |
1009 // draw health bar |
1013 r.w:= 22; |
1010 r.x:= 0; |
1014 r.h:= 15; |
1011 r.y:= 0; |
1015 DrawFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex); |
1012 r.w:= 2 + TeamHealthBarWidth; |
1016 // draw health bar |
1013 r.h:= HealthTex^.h; |
1017 r.w:= TeamHealthBarWidth + 1; |
1014 DrawFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex); |
1018 r.h:= HealthTex^.h - 4; |
1015 |
1019 DrawFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex); |
1016 // draw health bars right border |
1020 end; |
1017 inc(r.x, cTeamHealthWidth + 2); |
1021 end; |
1018 r.w:= 3; |
|
1019 DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex); |
|
1020 |
|
1021 // draw ai kill counter for gfAISurvival |
|
1022 if (GameFlags and gfAISurvival) <> 0 then |
|
1023 begin |
|
1024 DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex); |
|
1025 end; |
|
1026 |
|
1027 // if highlighted, draw flag and other contents again to keep their colors |
|
1028 // this approach should be faster than drawing all borders one by one tinted or not |
|
1029 if highlight then |
|
1030 begin |
|
1031 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then |
|
1032 Tint($FF,$FF,$FF,$80) |
|
1033 else Tint($FF, $FF, $FF, $FF); |
|
1034 |
|
1035 // draw name |
|
1036 r.x:= 2; |
|
1037 r.y:= 2; |
|
1038 r.w:= NameTagTex^.w - 4; |
|
1039 r.h:= NameTagTex^.h - 4; |
|
1040 DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex); |
|
1041 // draw flag |
|
1042 r.w:= 22; |
|
1043 r.h:= 15; |
|
1044 DrawFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex); |
|
1045 // draw health bar |
|
1046 r.w:= TeamHealthBarWidth + 1; |
|
1047 r.h:= HealthTex^.h - 4; |
|
1048 DrawFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex); |
|
1049 end; |
|
1050 end; |
1022 if smallScreenOffset <> 0 then |
1051 if smallScreenOffset <> 0 then |
1023 begin |
1052 begin |
1024 SetScale(cDefaultZoomLevel); |
1053 SetScale(cDefaultZoomLevel); |
1025 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$FF); |
1054 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then |
|
1055 Tint($FF,$FF,$FF,$FF); |
1026 end; |
1056 end; |
1027 |
1057 |
1028 // Lag alert |
1058 // Lag alert |
1029 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
1059 if isInLag then |
|
1060 DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
1030 |
1061 |
1031 // Wind bar |
1062 // Wind bar |
1032 {$IFDEF MOBILE} |
1063 {$IFDEF MOBILE} |
1033 offsetX:= cScreenHeight - 13; |
1064 offsetX:= cScreenHeight - 13; |
1034 offsetY:= (cScreenWidth shr 1) + 74; |
1065 offsetY:= (cScreenWidth shr 1) + 74; |
1058 r.h:= 13; |
1089 r.h:= 13; |
1059 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1090 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1060 end; |
1091 end; |
1061 |
1092 |
1062 // AmmoMenu |
1093 // AmmoMenu |
1063 if (AMxShift < AMWidth) or bShowAmmoMenu then ShowAmmoMenu; |
1094 if (AMxShift < AMWidth) or bShowAmmoMenu then |
|
1095 ShowAmmoMenu; |
1064 |
1096 |
1065 // Cursor |
1097 // Cursor |
1066 if isCursorVisible and bShowAmmoMenu then |
1098 if isCursorVisible and bShowAmmoMenu then |
1067 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
1099 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
1068 |
1100 |
1069 // Chat |
1101 // Chat |
1070 DrawChat; |
1102 DrawChat; |
1071 |
1103 |
1072 // various captions |
1104 // various captions |
1073 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
1105 if fastUntilLag then |
1074 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
1106 DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
|
1107 if isPaused then |
|
1108 DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
1075 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
1109 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
1076 begin |
1110 begin |
1077 if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); |
1111 if (ReadyTimeLeft = 0) and (missionTimer > 0) then |
1078 if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
1112 dec(missionTimer, Lag); |
|
1113 if missionTimer < 0 then |
|
1114 missionTimer:= 0; // avoid subtracting below 0 |
1079 if missionTex <> nil then |
1115 if missionTex <> nil then |
1080 DrawCentered(0, Min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1116 DrawCentered(0, Min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1081 end; |
1117 end; |
1082 |
1118 |
1083 // fps |
1119 // fps |
1086 {$ELSE} |
1122 {$ELSE} |
1087 offsetX:= 10; |
1123 offsetX:= 10; |
1088 {$ENDIF} |
1124 {$ENDIF} |
1089 offsetY:= cOffsetY; |
1125 offsetY:= cOffsetY; |
1090 if (RM = rmDefault) or (RM = rmRightEye) then |
1126 if (RM = rmDefault) or (RM = rmRightEye) then |
1091 begin |
1127 begin |
1092 inc(Frames); |
1128 inc(Frames); |
1093 |
1129 |
1094 if cShowFPS or (GameType = gmtDemo) then |
1130 if cShowFPS or (GameType = gmtDemo) then |
1095 inc(CountTicks, Lag); |
1131 inc(CountTicks, Lag); |
1096 if (GameType = gmtDemo) and (CountTicks >= 1000) then |
1132 if (GameType = gmtDemo) and (CountTicks >= 1000) then |
1097 begin |
1133 begin |
1098 i:=GameTicks div 1000; |
1134 i:=GameTicks div 1000; |
1099 t:= i mod 60; |
1135 t:= i mod 60; |
1100 s:= inttostr(t); |
1136 s:= inttostr(t); |
1101 if t < 10 then s:= '0' + s; |
1137 if t < 10 then |
|
1138 s:= '0' + s; |
1102 i:= i div 60; |
1139 i:= i div 60; |
1103 t:= i mod 60; |
1140 t:= i mod 60; |
1104 s:= inttostr(t) + ':' + s; |
1141 s:= inttostr(t) + ':' + s; |
1105 if t < 10 then s:= '0' + s; |
1142 if t < 10 then |
|
1143 s:= '0' + s; |
1106 s:= inttostr(i div 60) + ':' + s; |
1144 s:= inttostr(i div 60) + ':' + s; |
1107 |
1145 |
1108 |
1146 |
1109 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1147 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1110 tmpSurface:= doSurfaceConversion(tmpSurface); |
1148 tmpSurface:= doSurfaceConversion(tmpSurface); |
1111 FreeTexture(timeTexture); |
1149 FreeTexture(timeTexture); |
1112 timeTexture:= Surface2Tex(tmpSurface, false); |
1150 timeTexture:= Surface2Tex(tmpSurface, false); |
1113 SDL_FreeSurface(tmpSurface) |
1151 SDL_FreeSurface(tmpSurface) |
1114 end; |
1152 end; |
1115 |
1153 |
1116 if timeTexture <> nil then |
1154 if timeTexture <> nil then |
1117 DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); |
1155 DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); |
1118 |
1156 |
1119 if cShowFPS then |
1157 if cShowFPS then |
1120 begin |
1158 begin |
1121 if CountTicks >= 1000 then |
1159 if CountTicks >= 1000 then |
1122 begin |
1160 begin |
1123 FPS:= Frames; |
1161 FPS:= Frames; |
1124 Frames:= 0; |
1162 Frames:= 0; |
1125 CountTicks:= 0; |
1163 CountTicks:= 0; |
1126 s:= inttostr(FPS) + ' fps'; |
1164 s:= inttostr(FPS) + ' fps'; |
1127 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1165 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1128 tmpSurface:= doSurfaceConversion(tmpSurface); |
1166 tmpSurface:= doSurfaceConversion(tmpSurface); |
1129 FreeTexture(fpsTexture); |
1167 FreeTexture(fpsTexture); |
1130 fpsTexture:= Surface2Tex(tmpSurface, false); |
1168 fpsTexture:= Surface2Tex(tmpSurface, false); |
1131 SDL_FreeSurface(tmpSurface) |
1169 SDL_FreeSurface(tmpSurface) |
1132 end; |
1170 end; |
1133 if fpsTexture <> nil then |
1171 if fpsTexture <> nil then |
1134 DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); |
1172 DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); |
1135 end; |
1173 end; |
1136 |
1174 |
1137 if CountTicks >= 1000 then CountTicks:= 0; |
1175 if CountTicks >= 1000 then |
|
1176 CountTicks:= 0; |
1138 |
1177 |
1139 // lag warning (?) |
1178 // lag warning (?) |
1140 inc(SoundTimerTicks, Lag); |
1179 inc(SoundTimerTicks, Lag); |
1141 end; |
1180 end; |
1142 |
1181 |
1187 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1226 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1188 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1227 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1189 |
1228 |
1190 glEnable(GL_TEXTURE_2D); |
1229 glEnable(GL_TEXTURE_2D); |
1191 Tint($FF, $FF, $FF, $FF); |
1230 Tint($FF, $FF, $FF, $FF); |
1192 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone |
1231 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then |
|
1232 ScreenFade:= sfNone |
1193 end |
1233 end |
1194 end; |
1234 end; |
1195 |
1235 |
1196 SetScale(zoom); |
1236 SetScale(zoom); |
1197 |
1237 |
1198 // Cursor |
1238 // Cursor |
1199 if isCursorVisible then |
1239 if isCursorVisible then |
1200 begin |
1240 begin |
1201 if not bShowAmmoMenu then |
1241 if not bShowAmmoMenu then |
1202 begin |
1242 begin |
1203 with CurrentHedgehog^ do |
1243 with CurrentHedgehog^ do |
1204 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1244 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1205 begin |
1245 begin |
1206 if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then |
1246 if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then |
1207 DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF); |
1247 DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF); |
1208 i:= GetAmmoEntry(CurrentHedgehog^)^.Pos; |
1248 i:= GetAmmoEntry(CurrentHedgehog^)^.Pos; |
1209 with Ammoz[CurAmmoType] do |
1249 with Ammoz[CurAmmoType] do |
1210 if PosCount > 1 then |
1250 if PosCount > 1 then |
1211 DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1251 DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1212 end; |
1252 end; |
1213 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1253 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1214 end |
1254 end |
1215 end; |
1255 end; |
1216 isFirstFrame:= false |
1256 isFirstFrame:= false |
1217 end; |
1257 end; |
1218 |
1258 |
1219 procedure MoveCamera; |
1259 procedure MoveCamera; |
1220 var EdgesDist, wdy, shs,z: LongInt; |
1260 var EdgesDist, wdy, shs,z: LongInt; |
1240 else |
1280 else |
1241 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8; |
1281 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8; |
1242 end; |
1282 end; |
1243 |
1283 |
1244 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1284 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1245 if WorldDy < wdy then WorldDy:= wdy; |
1285 if WorldDy < wdy then |
1246 |
1286 WorldDy:= wdy; |
1247 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
1287 |
|
1288 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then |
|
1289 exit; |
1248 |
1290 |
1249 if AMxShift < AMWidth then |
1291 if AMxShift < AMWidth then |
1250 begin |
1292 begin |
1251 {$IFDEF MOBILE} |
1293 {$IFDEF MOBILE} |
1252 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1294 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then |
1253 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1295 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1254 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1296 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then |
1255 if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
1297 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1298 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then |
|
1299 CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
|
1300 if CursorPoint.Y > cScreenHeight - AMyOffset then |
|
1301 CursorPoint.Y:= cScreenHeight - AMyOffset; |
1256 {$ELSE} |
1302 {$ELSE} |
1257 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1303 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then |
1258 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1304 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1259 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
1305 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then |
1260 if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
1306 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1307 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then |
|
1308 CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
|
1309 if CursorPoint.Y < AMyOffset + AMSlotSize then |
|
1310 CursorPoint.Y:= AMyOffset + AMSlotSize; |
1261 {$ENDIF} |
1311 {$ENDIF} |
1262 prevPoint:= CursorPoint; |
1312 prevPoint:= CursorPoint; |
1263 //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1313 //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1264 exit |
1314 exit |
1265 end; |
1315 end; |
1266 |
1316 |
1267 if isCursorVisible then |
1317 if isCursorVisible then |
1268 begin |
1318 begin |
1269 if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
1319 if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
1270 begin |
1320 begin |
1271 SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
1321 SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
1272 PrevSentPointTime:= GameTicks |
1322 PrevSentPointTime:= GameTicks |
1273 end; |
1323 end; |
1274 EdgesDist:= cCursorEdgesDist |
1324 EdgesDist:= cCursorEdgesDist |
1275 end |
1325 end |
1276 else |
1326 else |
1277 EdgesDist:= cGearScrEdgesDist; |
1327 EdgesDist:= cGearScrEdgesDist; |
1278 |
1328 |
1279 // this generates the border around the screen that moves the camera when cursor is near it |
1329 // this generates the border around the screen that moves the camera when cursor is near it |
1280 if isCursorVisible or (FollowGear <> nil) then |
1330 if isCursorVisible or (FollowGear <> nil) then |
1281 begin |
1331 begin |
1282 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
1332 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
1283 begin |
1333 begin |
1284 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1334 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1285 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
1335 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
1286 end |
1336 end |
1287 else |
1337 else |
1288 if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
1338 if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
1289 begin |
1339 begin |
1290 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
1340 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
1291 CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
1341 CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
1292 end; |
1342 end; |
1293 |
1343 |
1294 shs:= min(cScreenHeight div 2 - trunc(cScreenHeight / cScaleFactor) + EdgesDist, cScreenHeight - EdgesDist); |
1344 shs:= min(cScreenHeight div 2 - trunc(cScreenHeight / cScaleFactor) + EdgesDist, cScreenHeight - EdgesDist); |
1295 if CursorPoint.Y < shs then |
1345 if CursorPoint.Y < shs then |
1296 begin |
1346 begin |
1297 WorldDy:= WorldDy + CursorPoint.Y - shs; |
1347 WorldDy:= WorldDy + CursorPoint.Y - shs; |
1298 CursorPoint.Y:= shs; |
1348 CursorPoint.Y:= shs; |
1299 end |
1349 end |
1300 else |
1350 else |
1301 if (CursorPoint.Y > cScreenHeight - EdgesDist) then |
1351 if (CursorPoint.Y > cScreenHeight - EdgesDist) then |
1302 begin |
1352 begin |
1303 WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
1353 WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
1304 CursorPoint.Y:= cScreenHeight - EdgesDist |
1354 CursorPoint.Y:= cScreenHeight - EdgesDist |
1305 end; |
1355 end; |
1306 end |
1356 end |
1307 else |
1357 else |
1308 if cHasFocus then |
1358 if cHasFocus then |
1309 begin |
1359 begin |
1310 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
1360 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
1311 WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
1361 WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
1312 CursorPoint.X:= 0; |
1362 CursorPoint.X:= 0; |
1313 CursorPoint.Y:= cScreenHeight div 2; |
1363 CursorPoint.Y:= cScreenHeight div 2; |
1314 end; |
1364 end; |
1315 |
1365 |
1316 // this moves the camera according to CursorPoint X and Y |
1366 // this moves the camera according to CursorPoint X and Y |
1317 prevPoint:= CursorPoint; |
1367 prevPoint:= CursorPoint; |
1318 //if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1368 //if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1319 if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; |
1369 if WorldDy > LAND_HEIGHT + 1024 then |
1320 if WorldDy < wdy then WorldDy:= wdy; |
1370 WorldDy:= LAND_HEIGHT + 1024; |
1321 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; |
1371 if WorldDy < wdy then |
1322 if WorldDx > 1024 then WorldDx:= 1024; |
1372 WorldDy:= wdy; |
|
1373 if WorldDx < - LAND_WIDTH - 1024 then |
|
1374 WorldDx:= - LAND_WIDTH - 1024; |
|
1375 if WorldDx > 1024 then |
|
1376 WorldDx:= 1024; |
1323 end; |
1377 end; |
1324 |
1378 |
1325 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
1379 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
1326 var r: TSDL_Rect; |
1380 var r: TSDL_Rect; |
1327 begin |
1381 begin |
1328 r.w:= 32; |
1382 r.w:= 32; |
1329 r.h:= 32; |
1383 r.h:= 32; |
1330 |
1384 |
1331 if time = 0 then time:= 5000; |
1385 if time = 0 then |
|
1386 time:= 5000; |
1332 missionTimer:= time; |
1387 missionTimer:= time; |
1333 FreeTexture(missionTex); |
1388 FreeTexture(missionTex); |
1334 |
1389 |
1335 if icon > -1 then |
1390 if icon > -1 then |
1336 begin |
1391 begin |