properly do offsets into mult-column ammo image (forgot y)
authornemo
Fri, 16 Oct 2009 01:00:37 +0000
changeset 2471 1cfc9f897616
parent 2470 44b66fbf37da
child 2472 bfe75d5e8a15
properly do offsets into mult-column ammo image (forgot y)
QTfrontend/selectWeapon.cpp
--- a/QTfrontend/selectWeapon.cpp	Thu Oct 15 23:54:18 2009 +0000
+++ b/QTfrontend/selectWeapon.cpp	Fri Oct 16 01:00:37 2009 +0000
@@ -34,9 +34,10 @@
 QImage getAmmoImage(int num)
 {
 	static QImage ammo(":Ammos.png");
-    int x = floor((num * 32) / ammo.height()) * 32;
-    if(x) x--;
-	return ammo.copy(x, num*32, 32, 32);
+    int x = floor(num/(ammo.height()/32));
+    int y = (num-((ammo.height()/32)*x))*32;
+    x*=32;
+	return ammo.copy(x, y, 32, 32);
 }
 
 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :