initial support for customizing weaponset
authorkoda
Sun, 04 Jul 2010 00:33:59 +0200
changeset 3621 a8ddf681ba7d
parent 3620 c28a86f379f6
child 3622 24c4726b1019
initial support for customizing weaponset
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/CommodityFunctions.m
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.h
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
project_files/HedgewarsMobile/Classes/UIImageExtra.h
project_files/HedgewarsMobile/Classes/UIImageExtra.m
project_files/HedgewarsMobile/Classes/WeaponCellView.h
project_files/HedgewarsMobile/Classes/WeaponCellView.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sun Jul 04 00:33:59 2010 +0200
@@ -37,6 +37,8 @@
 #define MSG_MEMCLEAN()          DLog(@"has cleaned up some memory");
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
 
+#define CURRENT_AMMOSIZE        46
+
 void createTeamNamed (NSString *nameWithoutExt);
 void createWeaponNamed (NSString *nameWithoutExt);
 void createSchemeNamed (NSString *nameWithoutExt);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Sun Jul 04 00:33:59 2010 +0200
@@ -54,8 +54,8 @@
     }
     
     NSDictionary *theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+                               [NSNumber numberWithInt:CURRENT_AMMOSIZE],@"version",
                                @"9391929422199121032235111001201000000211110111",@"ammostore_initialqt",
-// rope on itouch              @"0000099999000000000000000000000099900000099999",@"ammostore_initialqt",
                                @"0405040541600655546554464776576666666155510111",@"ammostore_probability",
                                @"0000000000000205500000040007004000000000200000",@"ammostore_delay",
                                @"1311110312111111123114111111111111111211111111",@"ammostore_crate", nil];
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Sun Jul 04 00:33:59 2010 +0200
@@ -98,20 +98,26 @@
     NSString *weaponPath = [[NSString alloc] initWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),ammostoreName];
     NSDictionary *ammoData = [[NSDictionary alloc] initWithContentsOfFile:weaponPath];
     [weaponPath release];
+    NSString *update = @"";
     
-    NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@", [ammoData objectForKey:@"ammostore_initialqt"]];
+    // if we're loading an older version of ammos fill the engine message with 0s
+    int diff = CURRENT_AMMOSIZE - [[ammoData objectForKey:@"version"] intValue];
+    if (diff != 0)
+        update = [NSString stringWithCharacters:(const unichar*)"0000000000000000000000000000000000" length:diff];
+    
+    NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@%@", [ammoData objectForKey:@"ammostore_initialqt"], update];
     [self sendToEngine: ammloadt];
     [ammloadt release];
     
-    NSString *ammprob = [[NSString alloc] initWithFormat:@"eammprob %@", [ammoData objectForKey:@"ammostore_probability"]];
+    NSString *ammprob = [[NSString alloc] initWithFormat:@"eammprob %@%@", [ammoData objectForKey:@"ammostore_probability"], update];
     [self sendToEngine: ammprob];
     [ammprob release];
     
-    NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammdelay %@", [ammoData objectForKey:@"ammostore_delay"]];
+    NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammdelay %@%@", [ammoData objectForKey:@"ammostore_delay"], update];
     [self sendToEngine: ammdelay];
     [ammdelay release];
     
-    NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@", [ammoData objectForKey:@"ammostore_crate"]];
+    NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@%@", [ammoData objectForKey:@"ammostore_crate"], update];
     [self sendToEngine: ammreinf];
     [ammreinf release];
     
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sun Jul 04 00:33:59 2010 +0200
@@ -94,7 +94,8 @@
     [alert release];
 
     [pool release];
-    [NSThread exit];
+
+    // TODO: instead of this useless runtime initialization, check that all ammos remain compatible with engine
 }
 
 #pragma mark -
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m	Sun Jul 04 00:33:59 2010 +0200
@@ -112,9 +112,9 @@
     
     NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title];
     NSMutableArray *scheme = [[NSMutableArray alloc] initWithContentsOfFile:schemeFile];
+    [schemeFile release];
     self.schemeArray = scheme;
     [scheme release];
-    [schemeFile release];
     
     [self.tableView reloadData];
 }
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.h	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.h	Sun Jul 04 00:33:59 2010 +0200
@@ -10,7 +10,18 @@
 
 
 @interface SingleWeaponViewController : UITableViewController {
-
+    UIImage *ammoStoreImage;
+    NSArray *ammoNames;
+    NSInteger ammoSize;
+    
+    char *quantity;
+    char *probability;
+    char *delay;
+    char *crateness;
 }
 
+@property (nonatomic,retain) UIImage *ammoStoreImage;
+@property (nonatomic,retain) NSArray *ammoNames;
+
+
 @end
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Sun Jul 04 00:33:59 2010 +0200
@@ -7,143 +7,180 @@
 //
 
 #import "SingleWeaponViewController.h"
-
+#import "WeaponCellView.h"
+#import "CommodityFunctions.h"
+#import "UIImageExtra.h"
 
 @implementation SingleWeaponViewController
-
-
-#pragma mark -
-#pragma mark Initialization
+@synthesize ammoStoreImage, ammoNames;
 
-/*
-- (id)initWithStyle:(UITableViewStyle)style {
-    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
-    if ((self = [super initWithStyle:style])) {
-    }
-    return self;
+-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+    return rotationManager(interfaceOrientation);
 }
-*/
-
 
 #pragma mark -
 #pragma mark View lifecycle
-
-/*
-- (void)viewDidLoad {
+-(void) viewDidLoad {
     [super viewDidLoad];
+    
+    NSArray *array = [[NSArray alloc] initWithObjects:
+                      NSLocalizedString(@"Grenade",@""),
+                      NSLocalizedString(@"Cluster Bomb",@""),
+                      NSLocalizedString(@"Bazooka",@""),
+                      NSLocalizedString(@"Homing Bee",@""),
+                      NSLocalizedString(@"Shotgun",@""),
+                      NSLocalizedString(@"Pick Hammer",@""),
+                      NSLocalizedString(@"Skip",@""),
+                      NSLocalizedString(@"Rope",@""),
+                      NSLocalizedString(@"Mine",@""),
+                      NSLocalizedString(@"Deagle",@""),
+                      NSLocalizedString(@"Dynamite",@""),
+                      NSLocalizedString(@"Fire Punch",@""),
+                      NSLocalizedString(@"Slash",@""),
+                      NSLocalizedString(@"Baseball bat",@""),
+                      NSLocalizedString(@"Parachute",@""),
+                      NSLocalizedString(@"Air Attack",@""),
+                      NSLocalizedString(@"Mines Attack",@""),
+                      NSLocalizedString(@"Blow Torch",@""),
+                      NSLocalizedString(@"Construction",@""),
+                      NSLocalizedString(@"Teleport",@""),
+                      NSLocalizedString(@"Switch Hedgehog",@""),
+                      NSLocalizedString(@"Mortar",@""),
+                      NSLocalizedString(@"Kamikaze",@""),
+                      NSLocalizedString(@"Cake",@""),
+                      NSLocalizedString(@"Seduction",@""),
+                      NSLocalizedString(@"Watermelon Bomb",@""),
+                      NSLocalizedString(@"Hellish Hand Grenade",@""),
+                      NSLocalizedString(@"Napalm Attack",@""),
+                      NSLocalizedString(@"Drill Rocket",@""),
+                      NSLocalizedString(@"Ballgun",@""),
+                      NSLocalizedString(@"RC Plane",@""),
+                      NSLocalizedString(@"Low Gravity",@""),
+                      NSLocalizedString(@"Extra Damage",@""),
+                      NSLocalizedString(@"Invulnerable",@""),
+                      NSLocalizedString(@"Extra Time",@""),
+                      NSLocalizedString(@"Laser Sight",@""),
+                      NSLocalizedString(@"Vampirism",@""),
+                      NSLocalizedString(@"Sniper Rifle",@""),
+                      NSLocalizedString(@"Flying Saucer",@""),
+                      NSLocalizedString(@"Molotov Cocktail",@""),
+                      NSLocalizedString(@"Birdy",@""),
+                      NSLocalizedString(@"Portable Portal Device",@""),
+                      NSLocalizedString(@"Piano Attack",@""),
+                      NSLocalizedString(@"Old Limburger",@""),
+                      NSLocalizedString(@"Sine Gun",@""),
+                      NSLocalizedString(@"Flamethrower",@""),
+                      nil];
+    self.ammoNames = array;
+    [array release];
 
-    // Uncomment the following line to preserve selection between presentations.
-    self.clearsSelectionOnViewWillAppear = NO;
- 
-    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
-    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
-}
-*/
-
-/*
-- (void)viewWillAppear:(BOOL)animated {
-    [super viewWillAppear:animated];
+    ammoSize = [self.ammoNames count];
+    quantity = (char *)malloc(sizeof(char)*ammoSize);
+    probability = (char *)malloc(sizeof(char)*ammoSize);
+    delay = (char *)malloc(sizeof(char)*ammoSize);
+    crateness = (char *)malloc(sizeof(char)*ammoSize);
+    
+    NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
+    UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
+    self.ammoStoreImage = img;
+    [img release];
+    
+    self.tableView.rowHeight = 75;
 }
-*/
-/*
-- (void)viewDidAppear:(BOOL)animated {
-    [super viewDidAppear:animated];
-}
-*/
-/*
-- (void)viewWillDisappear:(BOOL)animated {
-    [super viewWillDisappear:animated];
+
+-(void) viewWillAppear:(BOOL) animated {
+    [super viewWillAppear:animated];
+    
+    NSString *ammoFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",WEAPONS_DIRECTORY(),self.title];
+    NSDictionary *weapon = [[NSDictionary alloc] initWithContentsOfFile:ammoFile];
+    [ammoFile release];
+    
+    const char *tmp1 = [[weapon objectForKey:@"ammostore_initialqt"] UTF8String];
+    const char *tmp2 = [[weapon objectForKey:@"ammostore_probability"] UTF8String];
+    const char *tmp3 = [[weapon objectForKey:@"ammostore_delay"] UTF8String];
+    const char *tmp4 = [[weapon objectForKey:@"ammostore_crate"] UTF8String];
+    [weapon release];
+    
+    // if the new weaponset is diffrent from the older we need to update it replacing
+    // the missing ammos with 0 quantity
+    int oldlen = strlen(tmp1);
+    for (int i = 0; i < oldlen; i++) {
+        quantity[i] = tmp1[i];
+        probability[i] = tmp2[i];
+        delay[i] = tmp3[i];
+        crateness[i] = tmp4[i];
+    }
+    for (int i = oldlen; i < ammoSize; i++) {
+        quantity[i] = '0';
+        probability[i] = '0';
+        delay[i] = '0';
+        crateness[i] = '0';
+    }
+    
+    [self.tableView reloadData];
 }
-*/
-/*
-- (void)viewDidDisappear:(BOOL)animated {
-    [super viewDidDisappear:animated];
+
+-(void) viewWillDisappear:(BOOL) animated {
+    [super viewWillDisappear:animated];
+    
+    NSString *quantityStr = [NSString stringWithUTF8String:quantity];
+    NSString *probabilityStr = [NSString stringWithUTF8String:probability];
+    NSString *delayStr = [NSString stringWithUTF8String:delay];
+    NSString *cratenessStr = [NSString stringWithUTF8String:crateness];
+
+    NSDictionary *weapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+                            [NSNumber numberWithInt:CURRENT_AMMOSIZE],@"version",
+                            quantityStr,@"ammostore_initialqt",
+                            probabilityStr,@"ammostore_probability",
+                            delayStr,@"ammostore_delay",
+                            cratenessStr,@"ammostore_crate", nil];
+
+    NSString *ammoFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",WEAPONS_DIRECTORY(),self.title];
+    [weapon writeToFile:ammoFile atomically:YES];
+    [ammoFile release];
+    [weapon release];
 }
-*/
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
-    // Return YES for supported orientations
-    return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
-
 
 #pragma mark -
 #pragma mark Table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    // Return the number of sections.
-    return 0;
+-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
 }
 
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    // Return the number of rows in the section.
-    return 0;
+-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return ammoSize;
 }
 
 
 // Customize the appearance of table view cells.
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     static NSString *CellIdentifier = @"Cell";
+    NSInteger row = [indexPath row];
     
-    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+    WeaponCellView *cell = (WeaponCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
-        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+        cell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
     }
     
-    // Configure the cell...
-    
+    int x = ((row*32)/1024)*32;
+    int y = (row*32)%1024;
+
+    UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, 32, 32)] makeRoundCornersOfSize:CGSizeMake(7, 7)];
+    cell.weaponIcon.image = img;
+    cell.weaponName.text = [ammoNames objectAtIndex:row];
+
+    cell.initialQt.titleLabel.text = [NSString stringWithFormat:@"%c",quantity[row]];
+    cell.probability.titleLabel.text = [NSString stringWithFormat:@"%c",probability[row]];
+    cell.delay.titleLabel.text = [NSString stringWithFormat:@"%c",delay[row]];
+    cell.initialQt.titleLabel.text = [NSString stringWithFormat:@"%c",crateness[row]];
     return cell;
 }
 
 
-/*
-// Override to support conditional editing of the table view.
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
-    // Return NO if you do not want the specified item to be editable.
-    return YES;
-}
-*/
-
-
-/*
-// Override to support editing the table view.
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
-    
-    if (editingStyle == UITableViewCellEditingStyleDelete) {
-        // Delete the row from the data source
-        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
-    }   
-    else if (editingStyle == UITableViewCellEditingStyleInsert) {
-        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
-    }   
-}
-*/
-
-
-/*
-// Override to support rearranging the table view.
-- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
-}
-*/
-
-
-/*
-// Override to support conditional rearranging of the table view.
-- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
-    // Return NO if you do not want the item to be re-orderable.
-    return YES;
-}
-*/
-
-
 #pragma mark -
 #pragma mark Table view delegate
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     // Navigation logic may go here. Create and push another view controller.
     /*
      <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
@@ -157,21 +194,23 @@
 
 #pragma mark -
 #pragma mark Memory management
-
-- (void)didReceiveMemoryWarning {
+-(void) didReceiveMemoryWarning {
     // Releases the view if it doesn't have a superview.
     [super didReceiveMemoryWarning];
-    
     // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
-- (void)viewDidUnload {
-    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
-    // For example: self.myOutlet = nil;
+-(void) viewDidUnload {
+    free(quantity);
+    free(probability);
+    free(delay);
+    free(crateness);
+    [super viewDidUnload];
+    MSG_DIDUNLOAD();
 }
 
 
-- (void)dealloc {
+-(void) dealloc {
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.h	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.h	Sun Jul 04 00:33:59 2010 +0200
@@ -15,6 +15,7 @@
 -(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint;
 -(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize;
 -(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect;
+-(UIImage *)cutAt:(CGRect) rect;
 -(UIImage *)convertToGrayScale;
 -(UIImage *)maskImageWith:(UIImage *)maskImage;
 -(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh;
--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m	Sun Jul 04 00:33:59 2010 +0200
@@ -61,16 +61,16 @@
     
     if (nil != image) {
         // get its CGImage representation with a give size
-        CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], rect);
+        CGImageRef cgImage = CGImageCreateWithImageInRect([image CGImage], rect);
     
         // clean memory
         [image release];
     
         // create a UIImage from the CGImage (memory must be allocated already)
-        UIImage *sprite = [self initWithCGImage:cgImgage];
+        UIImage *sprite = [self initWithCGImage:cgImage];
     
         // clean memory
-        CGImageRelease(cgImgage);
+        CGImageRelease(cgImage);
 
         // return resulting image
         return sprite;
@@ -80,6 +80,15 @@
     }
 }
 
+-(UIImage *)cutAt:(CGRect) rect {
+    CGImageRef cgImage = CGImageCreateWithImageInRect([self CGImage], rect);
+    
+    UIImage *res = [UIImage imageWithCGImage:cgImage];
+    CGImageRelease(cgImage);
+    
+    return res;
+}
+
 -(UIImage *)convertToGrayScale {
     // Create image rectangle with current image width/height
     CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.h	Sun Jul 04 00:33:59 2010 +0200
@@ -0,0 +1,30 @@
+//
+//  WeaponCellView.h
+//  Hedgewars
+//
+//  Created by Vittorio on 03/07/10.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@interface WeaponCellView : UITableViewCell {
+    UILabel *weaponName;
+    UIImageView *weaponIcon;
+    
+    UIButton *initialQt;
+    UIButton *probability;
+    UIButton *delay;
+    UIButton *crateQt;
+}
+
+@property (nonatomic,retain) UILabel *weaponName;
+@property (nonatomic,retain) UIImageView *weaponIcon;
+    
+@property (nonatomic,retain) UIButton *initialQt;
+@property (nonatomic,retain) UIButton *probability;
+@property (nonatomic,retain) UIButton *delay;
+@property (nonatomic,retain) UIButton *crateQt;
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.m	Sun Jul 04 00:33:59 2010 +0200
@@ -0,0 +1,95 @@
+//
+//  WeaponCellView.m
+//  Hedgewars
+//
+//  Created by Vittorio on 03/07/10.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import "WeaponCellView.h"
+#import "CommodityFunctions.h"
+
+@implementation WeaponCellView
+@synthesize weaponName, weaponIcon, initialQt, probability, delay, crateQt;
+
+-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+    if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
+        // Initialization code
+        weaponName = [[UILabel alloc] init];
+        weaponName.backgroundColor = [UIColor clearColor];
+        weaponName.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
+        weaponIcon = [[UIImageView alloc] init];
+    
+        NSString *imgStr;
+        initialQt = [[UIButton alloc] init];
+        imgStr = [NSString stringWithFormat:@"%@/iconAmmo.png",BTN_DIRECTORY()];
+        [initialQt setBackgroundImage:[UIImage imageWithContentsOfFile:imgStr] forState:UIControlStateNormal];
+        
+        probability = [[UIButton alloc] init];
+        imgStr = [NSString stringWithFormat:@"%@/iconDamage.png",BTN_DIRECTORY()];
+        [probability setBackgroundImage:[UIImage imageWithContentsOfFile:imgStr] forState:UIControlStateNormal];
+        
+        delay = [[UIButton alloc] init];
+        imgStr = [NSString stringWithFormat:@"%@/iconTime.png",BTN_DIRECTORY()];
+        [delay setBackgroundImage:[UIImage imageWithContentsOfFile:imgStr] forState:UIControlStateNormal];
+        
+        crateQt = [[UIButton alloc] init];
+        imgStr = [NSString stringWithFormat:@"%@/iconBox.png",BTN_DIRECTORY()];
+        [crateQt setBackgroundImage:[UIImage imageWithContentsOfFile:imgStr] forState:UIControlStateNormal];
+        
+        [self.contentView addSubview:weaponName];
+        [self.contentView addSubview:weaponIcon];
+        [self.contentView addSubview:initialQt];
+        [self.contentView addSubview:probability];
+        [self.contentView addSubview:delay];
+        [self.contentView addSubview:crateQt];
+    }
+    return self;
+}
+
+-(void) layoutSubviews {
+    [super layoutSubviews];
+
+    CGRect contentRect = self.contentView.bounds;
+    CGFloat boundsX = contentRect.origin.x;
+    CGRect frame;
+    
+    frame = CGRectMake(boundsX+10, 5, 32, 32);
+    weaponIcon.frame = frame;
+
+    frame = CGRectMake(boundsX+50, 9, 200, 25);
+    weaponName.frame = frame;
+    
+    // second line
+    frame = CGRectMake(boundsX+20, 40, 32, 32);
+    initialQt.frame = frame;
+    
+    frame = CGRectMake(boundsX+60, 40, 32, 32);
+    probability.frame = frame;
+    
+    frame = CGRectMake(boundsX+100, 40, 32, 32);
+    delay.frame = frame;
+    
+    frame = CGRectMake(boundsX+140, 40, 32, 32);
+    crateQt.frame = frame;
+}
+
+/*
+-(void) setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+    // Configure the view for the selected state
+}
+*/
+
+-(void) dealloc {
+    [weaponName release];
+    [weaponIcon release];
+    [initialQt release];
+    [probability release];
+    [delay release];
+    [crateQt release];
+    [super dealloc];
+}
+
+
+@end
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sun Jul 04 00:33:59 2010 +0200
@@ -152,6 +152,7 @@
 		61F9040F11DF59D10068B24D /* netplayButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F9040D11DF59D10068B24D /* netplayButton.png */; };
 		61F9041411DF5E9B0068B24D /* toolbarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F9041311DF5E9B0068B24D /* toolbarBackground.png */; };
 		61F9043A11DF64E20068B24D /* bluebox.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F9043911DF64E20068B24D /* bluebox.png */; };
+		61F904D711DF7DA30068B24D /* WeaponCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F904D611DF7DA30068B24D /* WeaponCellView.m */; };
 		922F64900F10F53100DC6EC0 /* libfpc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 928301170F10CAFC00CC5A3C /* libfpc.a */; };
 /* End PBXBuildFile section */
 
@@ -399,6 +400,8 @@
 		61F9040D11DF59D10068B24D /* netplayButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = netplayButton.png; path = "../../../../Desktop/ForKoda/Main Menu/netplayButton.png"; sourceTree = SOURCE_ROOT; };
 		61F9041311DF5E9B0068B24D /* toolbarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = toolbarBackground.png; path = "Resources/Frontend-iPad/toolbarBackground.png"; sourceTree = "<group>"; };
 		61F9043911DF64E20068B24D /* bluebox.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = bluebox.png; path = "Resources/Frontend-iPad/bluebox.png"; sourceTree = "<group>"; };
+		61F904D511DF7DA30068B24D /* WeaponCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeaponCellView.h; sourceTree = "<group>"; };
+		61F904D611DF7DA30068B24D /* WeaponCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeaponCellView.m; sourceTree = "<group>"; };
 		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		928301170F10CAFC00CC5A3C /* libfpc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpc.a; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
@@ -618,6 +621,8 @@
 				6163EE7D11CC2600001C0453 /* SingleWeaponViewController.m */,
 				616591FE11CA9BA200D6E256 /* SingleSchemeViewController.h */,
 				616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */,
+				61F904D511DF7DA30068B24D /* WeaponCellView.h */,
+				61F904D611DF7DA30068B24D /* WeaponCellView.m */,
 			);
 			name = "Second Level";
 			sourceTree = "<group>";
@@ -1028,7 +1033,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/.svn*\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Pirate,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/";
+			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Pirate,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/";
 			showEnvVarsInLog = 0;
 		};
 		9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
@@ -1133,6 +1138,7 @@
 				6165929E11CA9E2F00D6E256 /* SDL_uikitappdelegate.m in Sources */,
 				6163EE7E11CC2600001C0453 /* SingleWeaponViewController.m in Sources */,
 				61E1F4F811D004240016A5AA /* adler32.pas in Sources */,
+				61F904D711DF7DA30068B24D /* WeaponCellView.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};