288 begin |
294 begin |
289 bShowAmmoMenu:= false; |
295 bShowAmmoMenu:= false; |
290 exit |
296 exit |
291 end; |
297 end; |
292 SlotsNum:= 0; |
298 SlotsNum:= 0; |
293 x:= (cScreenWidth shr 1) - AMWidth + AMxShift; |
|
294 |
299 |
295 {$IFDEF MOBILE} |
300 {$IFDEF MOBILE} |
296 Slot:= cMaxSlotIndex; |
301 Slot:= cMaxSlotIndex; |
297 x:= x - cOffsetY; |
302 |
298 y:= AMyOffset; |
303 for i:= 0 to cMaxSlotIndex do |
299 dec(y, BORDERSIZE); |
304 if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then |
300 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
305 inc(SlotsNum); |
|
306 |
|
307 x:= AMxOffset - ((SlotsNum * AMSlotSize) shr 1); |
|
308 y:= cScreenHeight - AMShiftTarget + AMShift; |
|
309 dec(x, BORDERSIZE); |
|
310 DrawSprite(sprAMCorners, x, y - BORDERSIZE, 0);//top left corner |
301 for i:= 0 to cMaxSlotAmmoIndex do |
311 for i:= 0 to cMaxSlotAmmoIndex do |
302 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
312 DrawSprite(sprAMBorderVertical, x, y + i * AMSlotSize, 0); |
303 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
313 DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize) , 2); |
304 inc(y, BORDERSIZE); |
314 inc(x, BORDERSIZE); |
305 |
315 |
306 for i:= 0 to cMaxSlotIndex do |
316 for i:= 0 to cMaxSlotIndex do |
307 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
317 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
308 begin |
318 begin |
309 if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then |
319 if (CursorPoint.X >= x) and (CursorPoint.X <= x + AMSlotSize) then |
310 Slot:= i; |
320 Slot:= i; |
311 inc(SlotsNum); |
321 DrawSprite(sprAMBorderHorizontal, x, y - BORDERSIZE, 0); |
312 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
313 t:= 0; |
|
314 g:= 0; |
322 g:= 0; |
315 while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
323 for t:=0 to cMaxSlotAmmoIndex do |
316 begin |
324 begin |
317 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
325 DrawSprite(sprAMSlot, x, y + t * AMSlotSize, 1); |
318 if (Ammo^[i, t].AmmoType <> amNothing) then |
326 if (Ammo^[i, t].Count > 0) then |
319 begin |
327 begin |
320 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
328 if (Ammo^[i, t].AmmoType <> amNothing) then |
321 |
|
322 if STurns >= 0 then |
|
323 begin |
329 begin |
324 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
330 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
325 if STurns < 100 then |
331 |
326 DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
332 if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining |
327 end |
333 begin |
328 else |
334 DrawSprite(sprAMAmmosBW, x, y + (g * AMSlotSize) + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
329 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
335 if STurns < 100 then |
330 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
336 DrawSprite(sprTurnsLeft, x + AMSlotSize-16, y + (g + 1) * AMSlotSize-16, STurns); |
331 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
337 end |
332 begin |
338 else //draw colored version |
333 if (STurns < 0) then |
339 DrawSprite(sprAMAmmos, x, y + (g * AMSlotSize) + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
334 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
340 if (Slot = i) and (CursorPoint.Y <= (cScreenHeight - y) - (g * AMSlotSize)) and |
335 Pos:= t; |
341 (CursorPoint.Y >= (cScreenHeight - y) - ((g+1) * AMSlotSize)) then |
|
342 begin |
|
343 if (STurns < 0) then |
|
344 DrawSprite(sprAMSlot, x, y + (g * AMSlotSize), 0); |
|
345 Pos:= t; |
|
346 end; |
|
347 inc(g); |
336 end; |
348 end; |
337 inc(g) |
|
338 end; |
349 end; |
339 inc(t) |
|
340 end; |
350 end; |
341 for g:= g to cMaxSlotAmmoIndex do |
351 DrawSprite(sprAMBorderHorizontal, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 1); |
342 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
352 inc(x, AMSlotSize); |
343 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
344 inc(y, AMSlotSize); |
|
345 end; |
353 end; |
346 |
354 |
347 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
355 DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 3); //bottom right corner |
|
356 DrawSprite(sprAMCorners, x - BORDERSIZE, y + (AMSlotSize * cMaxSlotAmmoIndex), 1);//top right corner |
|
357 |
348 for i:= 0 to cMaxSlotAmmoIndex do |
358 for i:= 0 to cMaxSlotAmmoIndex do |
349 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
359 DrawSprite(sprAMBorderVertical, x,y + i * AMSlotSize, 1); |
350 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
|
351 {$ELSE} |
360 {$ELSE} |
352 Slot:= 0; |
361 Slot:= 0; |
|
362 x:= (cScreenWidth shr 1) - AMShiftTarget + AMShift; |
353 y:= cScreenHeight - AMyOffset; |
363 y:= cScreenHeight - AMyOffset; |
354 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
364 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
355 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
365 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
356 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
366 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
357 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
367 DrawSprite(sprAMCorners, x + AMShiftTarget - AMxOffset, y, 3); |
358 dec(y, AMSlotSize); |
368 dec(y, AMSlotSize); |
359 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
369 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
360 for i:= 0 to cMaxSlotAmmoIndex do |
370 for i:= 0 to cMaxSlotAmmoIndex do |
361 DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
371 DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
362 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); |
372 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); |
363 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
373 DrawSprite(sprAMBorderVertical, x + AMShiftTarget - AMxOffset, y, 1); |
364 |
374 |
365 for i:= cMaxSlotIndex downto 0 do |
375 for i:= cMaxSlotIndex downto 0 do |
366 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
376 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
367 begin |
377 begin |
368 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then |
378 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then |
399 end; |
409 end; |
400 inc(t) |
410 inc(t) |
401 end; |
411 end; |
402 for g:= g to cMaxSlotAmmoIndex + 1 do |
412 for g:= g to cMaxSlotAmmoIndex + 1 do |
403 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
413 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
404 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
414 DrawSprite(sprAMBorderVertical, x + AMShiftTarget - AMxOffset, y, 1); |
405 end; |
415 end; |
406 |
416 |
407 dec(y, BORDERSIZE); |
417 dec(y, BORDERSIZE); |
408 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
418 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
409 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
419 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
410 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
420 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
411 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
421 DrawSprite(sprAMCorners, x + AMShiftTarget - AMxOffset, y, 1); |
412 {$ENDIF} |
422 {$ENDIF} |
413 |
423 |
414 if (Pos >= 0) then |
424 if (Pos >= 0) then |
415 begin |
425 begin |
416 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
426 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
420 amSel:= Ammo^[Slot, Pos].AmmoType; |
430 amSel:= Ammo^[Slot, Pos].AmmoType; |
421 RenderWeaponTooltip(amSel) |
431 RenderWeaponTooltip(amSel) |
422 end; |
432 end; |
423 |
433 |
424 {$IFDEF MOBILE} |
434 {$IFDEF MOBILE} |
425 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
435 DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + AMShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
426 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
436 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
427 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + 163, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
437 DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + 163, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
428 {$ELSE} |
438 {$ELSE} |
429 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
439 DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + AMShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
430 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
440 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
431 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
441 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
432 {$ENDIF} |
442 {$ENDIF} |
433 |
443 |
434 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
444 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
1294 WorldDy:= wdy; |
1300 WorldDy:= wdy; |
1295 |
1301 |
1296 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then |
1302 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then |
1297 exit; |
1303 exit; |
1298 |
1304 |
1299 if AMxShift < AMWidth then |
1305 if AMShift < AMShiftTarget then |
1300 begin |
1306 begin |
1301 {$IFDEF MOBILE} |
1307 {$IFDEF MOBILE} |
1302 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then |
1308 if CursorPoint.X < AMxOffset - ((SlotsNum * AMSlotSize) shr 1) then//check left |
1303 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1309 CursorPoint.X:= AMxOffset - ((SlotsNum* AMSlotSize) shr 1); |
1304 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then |
1310 if CursorPoint.X > (AMxOffset + (SlotsNum * AMSlotSize) shr 1) then//check right |
1305 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1311 CursorPoint.X:= (AMxOffset + (SlotsNum * AMSlotSize) shr 1); |
1306 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then |
1312 if CursorPoint.Y > (AMShiftTarget + AMShift) then//check top |
1307 CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1313 CursorPoint.Y:= AMShiftTarget + AMShift; |
1308 if CursorPoint.Y > cScreenHeight - AMyOffset then |
1314 if CursorPoint.Y < (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+1) * AMSlotSize) then//check bottom |
1309 CursorPoint.Y:= cScreenHeight - AMyOffset; |
1315 CursorPoint.Y:= (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+1) * AMSlotSize); |
1310 {$ELSE} |
1316 {$ELSE} |
1311 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then |
1317 if CursorPoint.X < cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize then |
1312 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1318 CursorPoint.X:= cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize; |
1313 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then |
1319 if CursorPoint.X > cScreenWidth div 2 + AMShift - AMxOffset then |
1314 CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1320 CursorPoint.X:= cScreenWidth div 2 + AMShift - AMxOffset; |
1315 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then |
1321 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then |
1316 CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
1322 CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
1317 if CursorPoint.Y < AMyOffset + AMSlotSize then |
1323 if CursorPoint.Y < AMyOffset + AMSlotSize then |
1318 CursorPoint.Y:= AMyOffset + AMSlotSize; |
1324 CursorPoint.Y:= AMyOffset + AMSlotSize; |
1319 {$ENDIF} |
1325 {$ENDIF} |