379 const BORDERSIZE = 2; |
379 const BORDERSIZE = 2; |
380 var x, y, i, t, SlotsNumY, SlotsNumX, AMFrame: LongInt; |
380 var x, y, i, t, SlotsNumY, SlotsNumX, AMFrame: LongInt; |
381 STurns: LongInt; |
381 STurns: LongInt; |
382 amSurface: PSDL_Surface; |
382 amSurface: PSDL_Surface; |
383 AMRect: TSDL_Rect; |
383 AMRect: TSDL_Rect; |
|
384 tmpsurf: PSDL_Surface; |
384 begin |
385 begin |
385 SlotsNum:= 0; |
386 SlotsNum:= 0; |
386 for i:= 0 to cMaxSlotIndex do |
387 for i:= 0 to cMaxSlotIndex do |
387 if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then |
388 if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then |
388 inc(SlotsNum); |
389 inc(SlotsNum); |
389 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
390 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
390 SlotsNumX:= SlotsNum; |
391 SlotsNumX:= SlotsNum; |
391 SlotsNumY:= cMaxSlotAmmoIndex + 2; |
392 SlotsNumY:= cMaxSlotAmmoIndex + 2; |
|
393 {$IFDEF USE_AM_NUMCOLUMN} |
|
394 inc(SlotsNumY); |
|
395 {$ENDIF} |
392 {$ELSE} |
396 {$ELSE} |
393 SlotsNumX:= cMaxSlotAmmoIndex + 1; |
397 SlotsNumX:= cMaxSlotAmmoIndex + 1; |
394 SlotsNumY:= SlotsNum + 1; |
398 SlotsNumY:= SlotsNum + 1; |
395 {$ENDIF} |
399 {$IFDEF USE_AM_NUMCOLUMN} |
|
400 inc(SlotsNumX); |
|
401 {$ENDIF} |
|
402 {$ENDIF} |
|
403 |
396 |
404 |
397 AmmoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1); |
405 AmmoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1); |
398 AmmoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1); |
406 AmmoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1); |
399 amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, AmmoRect.w, AmmoRect.h, 32, RMask, GMask, BMask, AMask); |
407 amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, AmmoRect.w, AmmoRect.h, 32, RMask, GMask, BMask, AMask); |
400 |
408 |
413 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
421 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
414 y:= AMRect.y; |
422 y:= AMRect.y; |
415 {$ELSE} |
423 {$ELSE} |
416 x:= AMRect.x; |
424 x:= AMRect.x; |
417 {$ENDIF} |
425 {$ENDIF} |
|
426 {$IFDEF USE_AM_NUMCOLUMN} |
|
427 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F' + IntToStr(i)), cWhiteColorChannels); |
|
428 copyToXY(tmpsurf, amSurface, |
|
429 x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1), |
|
430 y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1)); |
|
431 |
|
432 SDL_FreeSurface(tmpsurf); |
|
433 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
|
434 y:= AMRect.y + AMSlotSize + 1; |
|
435 {$ELSE} |
|
436 x:= AMRect.x + AMSlotSize + 1; |
|
437 {$ENDIF} |
|
438 {$ENDIF} |
|
439 |
|
440 |
418 for t:=0 to cMaxSlotAmmoIndex do |
441 for t:=0 to cMaxSlotAmmoIndex do |
419 begin |
442 begin |
420 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
443 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
421 begin |
444 begin |
422 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
445 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
430 x + AMSlotSize-16, |
453 x + AMSlotSize-16, |
431 y + AMSlotSize + 1 - 16, STurns); |
454 y + AMSlotSize + 1 - 16, STurns); |
432 end |
455 end |
433 else //draw colored version |
456 else //draw colored version |
434 begin |
457 begin |
435 DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, |
458 DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, |
436 y + AMSlotPadding, AMFrame); |
459 y + AMSlotPadding, AMFrame); |
437 end; |
460 end; |
438 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
461 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
439 inc(y, AMSlotSize + 1); //the plus one is for the border |
462 inc(y, AMSlotSize + 1); //the plus one is for the border |
440 {$ELSE} |
463 {$ELSE} |
441 inc(x, AMSlotSize + 1); |
464 inc(x, AMSlotSize + 1); |
594 if ((AMState = AMHiding) or (AMState = AMShowingUp)) and ((AMAnimType and AMTypeMaskAlpha) <> 0 )then |
617 if ((AMState = AMHiding) or (AMState = AMShowingUp)) and ((AMAnimType and AMTypeMaskAlpha) <> 0 )then |
595 Tint($FF, $ff, $ff, $ff); |
618 Tint($FF, $ff, $ff, $ff); |
596 |
619 |
597 Pos:= -1; |
620 Pos:= -1; |
598 Slot:= -1; |
621 Slot:= -1; |
|
622 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
599 c:= -1; |
623 c:= -1; |
600 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
|
601 for i:= 0 to cMaxSlotIndex do |
624 for i:= 0 to cMaxSlotIndex do |
602 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
625 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
603 begin |
626 begin |
604 inc(c); |
627 inc(c); |
|
628 {$IFDEF USE_AM_NUMCOLUMN} |
|
629 g:= 1; |
|
630 {$ELSE} |
605 g:= 0; |
631 g:= 0; |
|
632 {$ENDIF} |
606 for t:=0 to cMaxSlotAmmoIndex do |
633 for t:=0 to cMaxSlotAmmoIndex do |
607 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
634 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
608 begin |
635 begin |
609 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and |
636 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and |
610 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and |
637 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and |
621 end; |
648 end; |
622 inc(g); |
649 inc(g); |
623 end; |
650 end; |
624 end; |
651 end; |
625 {$ELSE} |
652 {$ELSE} |
|
653 {$IFDEF USE_AM_NUMCOLUMN} |
|
654 c:= 0; |
|
655 {$ELSE} |
|
656 c:= -1; |
|
657 {$ENDIF} |
626 for i:= 0 to cMaxSlotIndex do |
658 for i:= 0 to cMaxSlotIndex do |
627 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
659 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
628 begin |
660 begin |
629 inc(c); |
661 inc(c); |
|
662 {$IFDEF USE_AM_NUMCOLUMN} |
|
663 g:= 1; |
|
664 {$ELSE} |
630 g:= 0; |
665 g:= 0; |
|
666 {$ENDIF} |
631 for t:=0 to cMaxSlotAmmoIndex do |
667 for t:=0 to cMaxSlotAmmoIndex do |
632 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
668 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
633 begin |
669 begin |
634 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c * (AMSlotSize+1))) and |
670 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c * (AMSlotSize+1))) and |
635 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and |
671 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and |
712 {$ELSE} |
748 {$ELSE} |
713 ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
749 ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
714 {$ENDIF} |
750 {$ENDIF} |
715 |
751 |
716 bSelected:= false; |
752 bSelected:= false; |
717 {$IFNDEF USE_LANDSCAPE_AMMOMENU} |
753 {$IFNDEF USE_TOUCH_INTERFACE} |
718 if (AMShiftX = 0) and (AMShiftY = 0) then |
754 if (AMShiftX = 0) and (AMShiftY = 0) then |
719 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
755 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
720 {$ENDIF} |
756 {$ENDIF} |
721 end; |
757 end; |
722 |
758 |