fix the multitouch shooting and moving
authorkoda
Wed, 07 Jul 2010 02:52:11 +0200
changeset 3626 19f78afa0188
parent 3625 9f1d79e01a60
child 3627 f1da1d8fb56c
fix the multitouch shooting and moving fix a crash (unknown) when reloading leave the lobby open after returing from game
hedgewars/PascalExports.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Classes/PascalImports.h
project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
project_files/HedgewarsMobile/Resources/OverlayViewController.xib
--- a/hedgewars/PascalExports.pas	Tue Jul 06 03:33:01 2010 +0200
+++ b/hedgewars/PascalExports.pas	Wed Jul 07 02:52:11 2010 +0200
@@ -55,6 +55,21 @@
     rightClick:= true;
 end;
 
+procedure HW_walkingKeysUp; cdecl; export;
+begin
+    leftKey:= false;
+    rightKey:= false;
+    upKey:= false;
+    downKey:= false;
+end;
+
+procedure HW_otherKeysUp; cdecl; export;
+begin
+    spaceKey:= false;
+    enterKey:= false;
+    backspaceKey:= false;
+end;
+
 procedure HW_allKeysUp; cdecl; export;
 begin
     // set all keys to released
--- a/hedgewars/uMisc.pas	Tue Jul 06 03:33:01 2010 +0200
+++ b/hedgewars/uMisc.pas	Wed Jul 07 02:52:11 2010 +0200
@@ -804,7 +804,7 @@
 
 procedure freeModule;
 begin
-    //uRandom.DumpBuffer;
+    recordFileName:= '';
     while TextureList <> nil do FreeTexture(TextureList);
 
 {$IFDEF DEBUGFILE}
--- a/hedgewars/uStore.pas	Tue Jul 06 03:33:01 2010 +0200
+++ b/hedgewars/uStore.pas	Wed Jul 07 02:52:11 2010 +0200
@@ -36,9 +36,7 @@
     ProgrTex: PTexture;
     MissionIcons: PSDL_Surface;
     ropeIconTex: PTexture;
-{$IFDEF IPHONEOS}
     rotationQt: GLfloat;
-{$ENDIF}
     wScreen: LongInt;
     hScreen: LongInt;
     
@@ -1232,9 +1230,7 @@
     glMatrixMode(GL_MODELVIEW);
     // prepare default translation/scaling
     glLoadIdentity();
-{$IFDEF IPHONEOS}
     glRotatef(rotationQt, 0, 0, 1);
-{$ENDIF}
     glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0);
     glTranslatef(0, -cScreenHeight / 2, 0);
 
@@ -1260,9 +1256,7 @@
     begin
         glPushMatrix;       // save default scaling
         glLoadIdentity;
-{$IFDEF IPHONEOS}
         glRotatef(rotationQt, 0, 0, 1);
-{$ENDIF}
         glScalef(f / wScreen, -f / hScreen, 1.0);
         glTranslatef(0, -cScreenHeight / 2, 0);
     end;
@@ -1585,6 +1579,7 @@
 {$IFDEF IPHONEOS}
     rotationQt:= -90;
 {$ELSE}
+    rotationQt:= 0;
     cGPUVendor:= gvUnknown;
 {$ENDIF}
     // really initalized in storeLoad
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Wed Jul 07 02:52:11 2010 +0200
@@ -48,9 +48,10 @@
             break;
         case 1:
             theButton.enabled = NO;
-            [self performSelector:@selector(startGame:)
-                       withObject:theButton
-                       afterDelay:0.25];
+            [self startGame:theButton];
+//            [self performSelector:@selector(startGame:)
+//                       withObject:theButton
+//                       afterDelay:0.25];
             break;
         default:
             break;
@@ -154,9 +155,9 @@
                                                                       nil];
 
     // finally launch game and remove this controller
-    [[self parentViewController] dismissModalViewControllerAnimated:YES];
     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary];
     [gameDictionary release];
+    //[[self parentViewController] dismissModalViewControllerAnimated:YES];
 }
 
 -(void) viewDidLoad {
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Jul 07 02:52:11 2010 +0200
@@ -277,7 +277,7 @@
         
         switch (buffer[0]) {
             case 'C':
-                DLog(@"sending game config");
+                DLog(@"sending game config...\n%@",self.gameConfig);
                 
                 // local game
                 [self sendToEngine:@"TL"];
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Wed Jul 07 02:52:11 2010 +0200
@@ -26,16 +26,6 @@
     return rotationManager(interfaceOrientation);
 }
 
-
--(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
-    // Release any cached data, images, etc that aren't in use.
-    if (popupMenu.view.superview == nil) 
-        popupMenu = nil;
-    MSG_MEMCLEAN();
-}
-
 -(void) didRotate:(NSNotification *)notification {  
     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
     CGRect rect = [[UIScreen mainScreen] bounds];
@@ -148,6 +138,7 @@
     [self didRotate:[NSNotification notificationWithName:UIDeviceOrientationDidChangeNotification object:nil]];
 }
 
+/* these are causing problems at reloading so let's remove 'em
 -(void) viewDidUnload {
     [popoverController dismissPopoverAnimated:NO];
     [dimTimer invalidate];
@@ -159,6 +150,16 @@
     MSG_DIDUNLOAD();
 }
 
+-(void) didReceiveMemoryWarning {
+    // Releases the view if it doesn't have a superview.
+    [super didReceiveMemoryWarning];
+    // Release any cached data, images, etc that aren't in use.
+    if (popupMenu.view.superview == nil) 
+        popupMenu = nil;
+    MSG_MEMCLEAN();
+}
+*/
+
 -(void) dealloc {
     [writeChatTextField release];
     [popupMenu release];
@@ -170,12 +171,6 @@
 
 #pragma mark -
 #pragma mark Overlay actions and members
-// dim the overlay when there's no more input for a certain amount of time
--(IBAction) buttonReleased:(id) sender {
-    HW_allKeysUp();
-    [dimTimer setFireDate:HIDING_TIME_DEFAULT];
-}
-
 // nice transition for dimming, should be called only by the timer himself
 -(void) dimOverlay {
     if (canDim) {
@@ -192,6 +187,30 @@
     [dimTimer setFireDate:HIDING_TIME_NEVER];
 }
 
+// dim the overlay when there's no more input for a certain amount of time
+-(IBAction) buttonReleased:(id) sender {
+    UIButton *theButton = (UIButton *)sender;
+    
+    switch (theButton.tag) {
+        case 0:
+        case 1:
+        case 2:
+        case 3:
+            HW_walkingKeysUp();
+            break;
+        case 4:
+        case 5:
+        case 6:
+            HW_otherKeysUp();
+            break;
+        default:
+            NSLog(@"Nope");
+            break;
+    }
+
+    [dimTimer setFireDate:HIDING_TIME_DEFAULT];
+}
+
 // issue certain action based on the tag of the button 
 -(IBAction) buttonPressed:(id) sender {
     [self activateOverlay];
@@ -232,7 +251,7 @@
             HW_ammoMenu();
             break;
         default:
-            NSLog(@"Nope");
+            DLog(@"Nope");
             break;
     }
 }
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Wed Jul 07 02:52:11 2010 +0200
@@ -30,6 +30,8 @@
     void HW_zoomReset(void);
     void HW_ammoMenu(void);
     
+    void HW_walkingKeysUp(void);
+    void HW_otherKeysUp(void);
     void HW_allKeysUp(void);
     
     void HW_walkLeft(void);
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Jul 07 02:52:11 2010 +0200
@@ -100,8 +100,6 @@
     // bring the uiwindow below in front
     UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
     [aWin makeKeyAndVisible];
-    aWin =  [[[UIApplication sharedApplication] windows] lastObject];
-    [aWin removeFromSuperview];
     
     DLog(@"%@",[[UIApplication sharedApplication] windows]);
     
--- a/project_files/HedgewarsMobile/Resources/OverlayViewController.xib	Tue Jul 06 03:33:01 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/OverlayViewController.xib	Wed Jul 07 02:52:11 2010 +0200
@@ -581,6 +581,15 @@
 					</object>
 					<int key="connectionID">68</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchEventConnection" key="connection">
+						<string key="label">buttonReleased:</string>
+						<reference key="source" ref="50885250"/>
+						<reference key="destination" ref="372490531"/>
+						<int key="IBEventType">9</int>
+					</object>
+					<int key="connectionID">69</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -732,7 +741,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">68</int>
+			<int key="maxID">69</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">