offset for multi-column ammo image
authornemo
Thu, 15 Oct 2009 19:38:18 +0000
changeset 2467 be6690c337fb
parent 2466 ab6dfb227d1d
child 2468 0b62498c201a
offset for multi-column ammo image
QTfrontend/selectWeapon.cpp
--- a/QTfrontend/selectWeapon.cpp	Thu Oct 15 19:31:53 2009 +0000
+++ b/QTfrontend/selectWeapon.cpp	Thu Oct 15 19:38:18 2009 +0000
@@ -29,11 +29,14 @@
 #include <QSettings>
 #include <QMessageBox>
 #include <QTabWidget>
+#include <math.h>
 
 QImage getAmmoImage(int num)
 {
 	static QImage ammo(":Ammos.png");
-	return ammo.copy(0, num*32, 32, 32);
+    int x = floor((num * 32) / ammo.height()) * 32;
+    if(x) x--;
+	return ammo.copy(x, num*32, 32, 32);
 }
 
 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :