226 timeTexture:= nil; |
214 timeTexture:= nil; |
227 FreeTexture(missionTex); |
215 FreeTexture(missionTex); |
228 missionTex:= nil; |
216 missionTex:= nil; |
229 end; |
217 end; |
230 |
218 |
231 procedure ShowAmmoMenu; |
219 function GetAmmoMenuTexture(Ammo: PHHAmmo): PTexture; |
232 const MENUSPEED = 15; |
|
233 const BORDERSIZE = 2; |
220 const BORDERSIZE = 2; |
234 var x, y, i, t, g: LongInt; |
221 var x, y, i, t, SlotsNumY, SlotsNumX, AMFrame: LongInt; |
235 Slot, Pos, STurns: LongInt; |
222 STurns: LongInt; |
236 Ammo: PHHAmmo; |
223 amSurface: PSDL_Surface; |
237 begin |
224 AMRect: TSDL_Rect; |
238 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) |
225 begin |
239 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
|
240 bShowAmmoMenu:= false; |
|
241 |
|
242 if bShowAmmoMenu then |
|
243 // show ammo menu |
|
244 begin |
|
245 FollowGear:= nil; |
|
246 if AMShift = AMShiftTarget then |
|
247 {$IFDEF MOBILE} |
|
248 prevPoint.Y:= 0; |
|
249 {$ELSE} |
|
250 prevPoint.X:= 0; |
|
251 {$ENDIF} |
|
252 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
253 AMShift:= 0 |
|
254 else |
|
255 if AMShift > MENUSPEED then |
|
256 dec(AMShift, MENUSPEED) |
|
257 else |
|
258 AMShift:= 0; |
|
259 end |
|
260 else |
|
261 // hide ammo menu |
|
262 begin |
|
263 if AMShift = 0 then |
|
264 begin |
|
265 CursorPoint.X:= cScreenWidth shr 1; |
|
266 CursorPoint.Y:= cScreenHeight shr 1; |
|
267 prevPoint:= CursorPoint; |
|
268 end; |
|
269 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
270 AMShift:= AMShiftTarget+2 |
|
271 else |
|
272 if AMShift < (AMShiftTarget - MENUSPEED) then |
|
273 inc(AMShift, MENUSPEED) |
|
274 else |
|
275 AMShift:= AMShiftTarget; |
|
276 end; |
|
277 |
|
278 // give the assigned ammo to hedgehog |
|
279 Ammo:= nil; |
|
280 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) |
|
281 and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
|
282 Ammo:= CurrentHedgehog^.Ammo |
|
283 else if (LocalAmmo <> -1) then |
|
284 Ammo:= GetAmmoByNum(LocalAmmo); |
|
285 Pos:= -1; |
|
286 if Ammo = nil then |
|
287 begin |
|
288 bShowAmmoMenu:= false; |
|
289 exit |
|
290 end; |
|
291 SlotsNum:= 0; |
226 SlotsNum:= 0; |
292 |
|
293 {$IFDEF MOBILE} |
|
294 Slot:= cMaxSlotIndex; |
|
295 |
|
296 for i:= 0 to cMaxSlotIndex do |
227 for i:= 0 to cMaxSlotIndex do |
297 if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then |
228 if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then |
298 inc(SlotsNum); |
229 inc(SlotsNum); |
299 |
230 {$IFDEF MOBILE} |
300 x:= AMxOffset - ((SlotsNum * AMSlotSize) shr 1); |
231 SlotsNumX:= SlotsNum; |
301 y:= cScreenHeight - AMShiftTarget + AMShift; |
232 SlotsNumY:= cMaxSlotAmmoIndex + 2; |
302 dec(x, BORDERSIZE); |
233 {$ELSE} |
303 DrawSprite(sprAMCorners, x, y - BORDERSIZE, 0);//top left corner |
234 SlotsNumX:= cMaxSlotAmmoIndex + 1; |
304 for i:= 0 to cMaxSlotAmmoIndex +1 do |
235 SlotsNumY:= SlotsNum + 1; |
305 DrawSprite(sprAMBorderVertical, x, y + i * AMSlotSize, 0); |
236 {$ENDIF} |
306 DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+2) * AMSlotSize) , 2);//bottom left corner |
237 |
307 inc(x, BORDERSIZE); |
238 ammoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1); |
308 |
239 ammoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1); |
309 for i:= 0 to SlotsNum -2 do |
240 amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, ammoRect.w, ammoRect.h, 32, RMask, GMask, BMask, AMask); |
310 DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
241 |
311 DrawSprite(sprAMSlot, x + (SlotsNum-1) * AMSlotSize, y, 1); |
242 AMRect.x:= BORDERSIZE; |
312 |
243 AMRect.y:= BORDERSIZE; |
313 inc(y, AMSlotSize); |
244 AMRect.w:= ammoRect.w - (BORDERSIZE*2); |
|
245 AMRect.h:= ammoRect.h - (BORDERSIZE*2); |
|
246 |
|
247 SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0)); |
|
248 |
|
249 |
|
250 x:= 0; |
|
251 y:= 0; |
314 for i:= 0 to cMaxSlotIndex do |
252 for i:= 0 to cMaxSlotIndex do |
315 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
253 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
316 begin |
254 begin |
317 if (CursorPoint.X >= x) and (CursorPoint.X <= x + AMSlotSize) then |
255 {$IFDEF MOBILE} |
318 Slot:= i; |
256 y:= 0; |
319 DrawSprite(sprAMBorderHorizontal, x, y - BORDERSIZE - AMSlotSize, 0); |
257 {$ELSE} |
320 g:= 0; |
258 x:= 0; |
321 |
259 {$ENDIF} |
322 for t:=0 to cMaxSlotAmmoIndex do |
260 for t:=0 to cMaxSlotAmmoIndex do |
323 begin |
261 begin |
324 DrawSprite(sprAMSlot, x, y + t * AMSlotSize, 1); |
262 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
325 if (Ammo^[i, t].Count > 0) then |
|
326 begin |
263 begin |
327 if (Ammo^[i, t].AmmoType <> amNothing) then |
264 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
265 AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1; |
|
266 if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining |
328 begin |
267 begin |
329 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
268 DrawSprite2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, |
330 |
269 y + AMSlotPadding + 1, AMFrame); |
331 if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining |
270 if STurns < 100 then |
332 begin |
271 DrawSprite2Surf(sprTurnsLeft, amSurface, |
333 DrawSprite(sprAMAmmosBW, x, y + (g * AMSlotSize) + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
272 x + AMSlotSize-16, |
334 if STurns < 100 then |
273 y + AMSlotSize + 1 - 16, STurns); |
335 DrawSprite(sprTurnsLeft, x + AMSlotSize-16, y + (g + 1) * AMSlotSize-16, STurns); |
274 end |
336 end |
275 else //draw colored version |
337 else //draw colored version |
276 begin |
338 DrawSprite(sprAMAmmos, x, y + (g * AMSlotSize) + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
277 DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, |
339 if (Slot = i) and (CursorPoint.Y <= (cScreenHeight - y) - (g * AMSlotSize)) and |
278 y + AMSlotPadding + 1, AMFrame); |
340 (CursorPoint.Y >= (cScreenHeight - y) - ((g+1) * AMSlotSize)) then |
|
341 begin |
|
342 if (STurns < 0) then |
|
343 DrawSprite(sprAMSlot, x, y + (g * AMSlotSize), 0); |
|
344 Pos:= t; |
|
345 end; |
|
346 inc(g); |
|
347 end; |
279 end; |
348 end; |
280 {$IFDEF MOBILE} |
349 end; |
281 inc(y, AMSlotSize + 1); //the plus one is for the border |
350 DrawSprite(sprAMBorderHorizontal, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 1); |
|
351 inc(x, AMSlotSize); |
|
352 end; |
|
353 |
|
354 DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 3); //bottom right corner |
|
355 DrawSprite(sprAMCorners, x - BORDERSIZE, y + (AMSlotSize * cMaxSlotAmmoIndex), 1);//top right corner |
|
356 |
|
357 dec(y, AMSlotSize); |
|
358 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
359 DrawSprite(sprAMBorderVertical, x,y + i * AMSlotSize, 1); |
|
360 inc(y, AMSlotSize); |
|
361 {$ELSE} |
282 {$ELSE} |
362 Slot:= 0; |
283 inc(x, AMSlotSize + 1); |
363 x:= (cScreenWidth shr 1) - AMShiftTarget + AMShift; |
284 {$ENDIF} |
364 y:= cScreenHeight - AMyOffset; |
285 end; |
365 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
286 end; |
366 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
287 {$IFDEF MOBILE} |
367 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
288 inc(x, AMSlotSize + 1); |
368 DrawSprite(sprAMCorners, x + AMShiftTarget - AMxOffset, y, 3); |
289 {$ELSE} |
369 dec(y, AMSlotSize); |
290 inc(y, AMSlotSize + 1); |
370 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
291 {$ENDIF} |
371 for i:= 0 to cMaxSlotAmmoIndex do |
292 end; |
372 DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
293 |
373 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); |
294 for i:= 1 to SlotsNumX -1 do |
374 DrawSprite(sprAMBorderVertical, x + AMShiftTarget - AMxOffset, y, 1); |
295 DrawLine2Surf(amSurface, i * (AMSlotSize+1), BORDERSIZE, i * (AMSlotSize+1), AMRect.h + BORDERSIZE - AMSlotSize - 2,160,160,160); |
375 |
296 for i:= 1 to SlotsNumY -1 do |
376 for i:= cMaxSlotIndex downto 0 do |
297 DrawLine2Surf(amSurface, BORDERSIZE, i * (AMSlotSize+1), AMRect.w + BORDERSIZE, i * (AMSlotSize+1),160,160,160); |
|
298 |
|
299 //draw outer border |
|
300 DrawSprite2Surf(sprAMCorners, amSurface, 0 , 0 , 0); |
|
301 DrawSprite2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.y , 1); |
|
302 DrawSprite2Surf(sprAMCorners, amSurface, AMRect.x , AMRect.h + BORDERSIZE, 2); |
|
303 DrawSprite2Surf(sprAMCorners, amSurface, AMRect.w + BORDERSIZE, AMRect.h + BORDERSIZE, 3); |
|
304 |
|
305 for i:=0 to BORDERSIZE-1 do |
|
306 begin |
|
307 DrawLine2Surf(amSurface, BORDERSIZE, i, AMRect.w + BORDERSIZE, i,160,160,160);//top |
|
308 DrawLine2Surf(amSurface, BORDERSIZE, AMRect.h+BORDERSIZE+i, AMRect.w + BORDERSIZE, AMRect.h+BORDERSIZE+i,160,160,160);//bottom |
|
309 DrawLine2Surf(amSurface, i, BORDERSIZE, i, AMRect.h + BORDERSIZE,160,160,160);//left |
|
310 DrawLine2Surf(amSurface, AMRect.w+BORDERSIZE+i, BORDERSIZE, AMRect.w + BORDERSIZE+i, AMRect.h + BORDERSIZE, 160,160,160);//right |
|
311 end; |
|
312 |
|
313 |
|
314 GetAmmoMenuTexture:= Surface2Tex(amSurface, false); |
|
315 if amSurface <> nil then SDL_FreeSurface(amSurface); |
|
316 end; |
|
317 |
|
318 procedure ShowAmmoMenu; |
|
319 const BORDERSIZE = 2; |
|
320 MENUSPEED = 15; |
|
321 var Slot, Pos: LongInt; |
|
322 Ammo: PHHAmmo; |
|
323 i,g,t,CursorXtmp, CursorYtmp,STurns: LongInt; |
|
324 begin |
|
325 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) |
|
326 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
|
327 bShowAmmoMenu:= false; |
|
328 |
|
329 |
|
330 // give the assigned ammo to hedgehog |
|
331 Ammo:= nil; |
|
332 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) |
|
333 and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
|
334 Ammo:= CurrentHedgehog^.Ammo |
|
335 else if (LocalAmmo <> -1) then |
|
336 Ammo:= GetAmmoByNum(LocalAmmo); |
|
337 Pos:= -1; |
|
338 if Ammo = nil then |
|
339 begin |
|
340 bShowAmmoMenu:= false; |
|
341 exit |
|
342 end; |
|
343 |
|
344 //Init the menu |
|
345 if(AmmoMenuInvalidated) then |
|
346 begin |
|
347 AmmoMenuInvalidated:= false; |
|
348 FreeTexture(AmmoMenuTex); |
|
349 AmmoMenuTex:= GetAmmoMenuTexture(Ammo); |
|
350 |
|
351 {$IFDEF MOBILE} |
|
352 if isPhone() then |
|
353 begin |
|
354 AmmoRect.x:= -(AmmoRect.w shr 1); |
|
355 AmmoRect.y:= (cScreenHeight shr 1) - (AmmoRect.h shr 1); |
|
356 end |
|
357 else |
|
358 begin |
|
359 AmmoRect.x:= -(AmmoRect.w shr 1); |
|
360 AmmoRect.y:= cScreenHeight - (AmmoRect.h + AMSlotSize); |
|
361 end; |
|
362 {$ELSE} |
|
363 AmmoRect.x:= (cScreenWidth shr 1) - AmmoRect.w - AMSlotSize; |
|
364 AmmoRect.y:= cScreenHeight - (AmmoRect.h + AMSlotSize); |
|
365 {$ENDIF} |
|
366 AMShiftTargetX:= (cScreenWidth shr 1) - AmmoRect.x; |
|
367 AMShiftTargetY:= cScreenHeight - AmmoRect.y; |
|
368 AMShiftX:= AMShiftTargetX; |
|
369 AMShiftY:= AMShiftTargetY; |
|
370 |
|
371 if (AMShiftTargetX div MENUSPEED) < (AMShiftTargetY div MENUSPEED) then |
|
372 begin |
|
373 MenuSpeedX:= MENUSPEED; |
|
374 MenuSpeedY:= AMShiftTargetY div (AMShiftTargetX div MENUSPEED); |
|
375 end |
|
376 else |
|
377 begin |
|
378 MenuSpeedX:= AMShiftTargetX div (AMShiftTargetY div MENUSPEED); |
|
379 MenuSpeedY:= MENUSPEED; |
|
380 end; |
|
381 end; |
|
382 |
|
383 if bShowAmmoMenu then // show ammo menu |
|
384 begin |
|
385 FollowGear:= nil; |
|
386 if (AMShiftX = 0) and (AMShiftY = 0) then |
|
387 {$IFDEF MOBILE} |
|
388 prevPoint.Y:= 0; |
|
389 {$ELSE} |
|
390 prevPoint.X:= 0; |
|
391 {$ENDIF} |
|
392 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
393 begin |
|
394 AMShiftX:= 0; |
|
395 AMShiftY:= 0; |
|
396 end |
|
397 else |
|
398 if (AMShiftX <> 0) or (AMShiftY <> 0) then |
|
399 begin |
|
400 dec(AMShiftX, MenuSpeedX); |
|
401 if AMShiftX < 0 then AMShiftX:= 0; |
|
402 dec(AMShiftY, MenuSpeedY); |
|
403 if AMShiftY < 0 then AMShiftY:= 0; |
|
404 end |
|
405 end |
|
406 else // hide ammo menu |
|
407 begin |
|
408 if (AMShiftX = AMShiftTargetX) and (AMShiftY = AMShiftTargetY) then |
|
409 begin |
|
410 prevPoint:= CursorPoint; |
|
411 end; |
|
412 if (cReducedQuality and rqSlowMenu) <> 0 then |
|
413 begin |
|
414 AMShiftX:= AMShiftTargetX; |
|
415 AMShiftY:= AMShiftTargetY; |
|
416 end |
|
417 else |
|
418 if (AMShiftX <> AMShiftTargetX) or (AMShiftY <> AMShiftTargetY) then |
|
419 begin |
|
420 inc(AMShiftX, MenuSpeedX); |
|
421 if AMShiftX > AMShiftTargetX then AMShiftX:= AMShiftTargetX; |
|
422 inc(AMShiftY, MenuSpeedY); |
|
423 if AMShiftY> AMShiftTargetY then AMShiftY:= AMShiftTargetY; |
|
424 end |
|
425 end; |
|
426 |
|
427 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); |
|
428 |
|
429 Pos:= -1; |
|
430 Slot:= -1; |
|
431 {$IFDEF MOBILE} |
|
432 for i:= 0 to cMaxSlotIndex do |
377 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
433 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
378 begin |
434 begin |
379 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then |
435 g:= 0; |
380 Slot:= i; |
436 for t:=0 to cMaxSlotAmmoIndex do |
381 dec(y, AMSlotSize); |
437 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
382 inc(SlotsNum); |
|
383 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
384 DrawSprite(sprAMSlot, x, y, 1); |
|
385 DrawSprite(sprAMSlotKeys, x, y + 1, i); |
|
386 t:= 0; |
|
387 g:= 1; |
|
388 while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
|
389 begin |
|
390 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
391 if (Ammo^[i, t].AmmoType <> amNothing) then |
|
392 begin |
438 begin |
393 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
439 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and |
394 |
440 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and |
395 if STurns >= 0 then |
441 (CursorPoint.X >= AmmoRect.x + ( i * (AMSlotSize+1))) and |
|
442 (CursorPoint.X <= AmmoRect.x + ((i+1) * (AMSlotSize+1))) then |
396 begin |
443 begin |
397 DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
444 Slot:= i; |
398 if STurns < 100 then |
445 Pos:= t; |
399 DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
446 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
400 end else |
447 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
401 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
448 DrawSprite(sprAMSlot, |
402 if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and |
449 AmmoRect.x + BORDERSIZE + (Slot * (AMSlotSize+1)) + AMSlotPadding -1, |
403 (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
450 AmmoRect.y + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
|
451 end; |
|
452 inc(g); |
|
453 end; |
|
454 end; |
|
455 {$ELSE} |
|
456 for i:= 0 to cMaxSlotIndex do |
|
457 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
|
458 begin |
|
459 g:= 0; |
|
460 for t:=0 to cMaxSlotAmmoIndex do |
|
461 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
|
462 begin |
|
463 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( i * (AMSlotSize+1))) and |
|
464 (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((i+1) * (AMSlotSize+1))) and |
|
465 (CursorPoint.X >= AmmoRect.x + ( g * (AMSlotSize+1))) and |
|
466 (CursorPoint.X <= AmmoRect.x + ((g+1) * (AMSlotSize+1))) then |
404 begin |
467 begin |
405 if (STurns < 0) then |
468 Slot:= i; |
406 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
|
407 Pos:= t; |
469 Pos:= t; |
|
470 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
471 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
|
472 DrawSprite(sprAMSlot, |
|
473 AmmoRect.x + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding -1, |
|
474 AmmoRect.y + BORDERSIZE + (Slot * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
408 end; |
475 end; |
409 inc(g) |
476 inc(g); |
410 end; |
477 end; |
411 inc(t) |
|
412 end; |
|
413 for g:= g to cMaxSlotAmmoIndex + 1 do |
|
414 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
415 DrawSprite(sprAMBorderVertical, x + AMShiftTarget - AMxOffset, y, 1); |
|
416 end; |
478 end; |
417 |
|
418 dec(y, BORDERSIZE); |
|
419 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
|
420 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
421 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
|
422 DrawSprite(sprAMCorners, x + AMShiftTarget - AMxOffset, y, 1); |
|
423 {$ENDIF} |
479 {$ENDIF} |
424 |
480 if (Pos >= 0) and (Pos <= cMaxSlotAmmoIndex) and (Slot >= 0) and (Slot <= cMaxSlotIndex)then |
425 if (Pos >= 0) then |
481 begin |
426 begin |
482 if (AMShiftX = 0) and (AMShiftY = 0) then |
427 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
483 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
428 begin |
484 begin |
429 if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then |
485 if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then |
430 begin |
486 begin |
431 amSel:= Ammo^[Slot, Pos].AmmoType; |
487 amSel:= Ammo^[Slot, Pos].AmmoType; |
432 RenderWeaponTooltip(amSel) |
488 RenderWeaponTooltip(amSel) |
433 end; |
489 end; |
434 |
490 |
435 {$IFDEF MOBILE} |
491 DrawTexture(AmmoRect.x + (AMSlotSize shr 1), |
436 DrawTexture(AMxOffset - ((SlotsNum * AMSlotSize) shr 1) + (AMSlotSize shr 1), |
492 AmmoRect.y + AmmoRect.h - BORDERSIZE - (AMSlotSize shr 1) - (Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h shr 1), |
437 cScreenHeight - AMShiftTarget + AMShift + (Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h shr 1), |
|
438 Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
493 Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
439 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
494 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
440 DrawTexture(AMxOffset + ((SlotsNum * AMSlotSize) shr 1) - Round(Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h * 1.5), |
495 DrawTexture(AmmoRect.x + AmmoRect.w - 20 - (CountTexz[Ammo^[Slot, Pos].Count]^.w), |
441 cScreenHeight - AMShiftTarget + AMShift + (Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h shr 1), |
496 AmmoRect.y + AmmoRect.h - BORDERSIZE - (AMslotSize shr 1) - (CountTexz[Ammo^[Slot, Pos].Count]^.w shr 1), |
442 CountTexz[Ammo^[Slot, Pos].Count]); |
497 CountTexz[Ammo^[Slot, Pos].Count]); |
443 {$ELSE} |
|
444 DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + AMShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
|
445 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
|
446 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
|
447 {$ENDIF} |
|
448 |
498 |
449 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
499 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
450 begin |
500 begin |
451 bShowAmmoMenu:= false; |
501 bShowAmmoMenu:= false; |
452 SetWeapon(Ammo^[Slot, Pos].AmmoType); |
502 SetWeapon(Ammo^[Slot, Pos].AmmoType); |