aim now starts slow and then moves faster
authorkoda
Sat, 17 Jul 2010 16:35:14 +0200
changeset 3649 bc35f8fee587
parent 3648 2477029463ed
child 3650 ec90e573f47a
aim now starts slow and then moves faster
hedgewars/PascalExports.pas
hedgewars/uKeys.pas
project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Classes/PascalImports.h
--- a/hedgewars/PascalExports.pas	Sat Jul 17 06:56:39 2010 +0200
+++ b/hedgewars/PascalExports.pas	Sat Jul 17 16:35:14 2010 +0200
@@ -63,6 +63,7 @@
     rightKey:= false;
     upKey:= false;
     downKey:= false;
+    preciseKey:= false;
 end;
 
 procedure HW_otherKeysUp; cdecl; export;
@@ -88,6 +89,11 @@
     rightKey:= true;
 end;
 
+procedure HW_preciseSet(status:boolean); cdecl; export;
+begin
+    preciseKey:= status;
+end;
+
 procedure HW_aimUp; cdecl; export;
 begin
     upKey:= true;
--- a/hedgewars/uKeys.pas	Sat Jul 17 06:56:39 2010 +0200
+++ b/hedgewars/uKeys.pas	Sat Jul 17 16:35:14 2010 +0200
@@ -70,7 +70,8 @@
     downKey: boolean;
     rightKey: boolean;
     leftKey: boolean;
-
+    preciseKey: boolean;
+    
     backspaceKey: boolean;
     spaceKey: boolean;
     enterKey: boolean;
@@ -342,6 +343,7 @@
 DefaultBinds[24]:= '+down';
 DefaultBinds[25]:= '+left';
 DefaultBinds[26]:= '+right';
+DefaultBinds[27]:= '+precise';
 DefaultBinds[44]:= 'chat';
 DefaultBinds[55]:= 'pause';
 DefaultBinds[66]:= '+cur_u';
@@ -380,6 +382,7 @@
     tkbdn[24]:= ord(downKey);
     tkbdn[25]:= ord(leftKey);
     tkbdn[26]:= ord(rightKey);
+    tkbdn[27]:= ord(preciseKey);
 
     tkbdn[ 8]:= ord(backspaceKey);
     tkbdn[ 9]:= ord(tabKey);
@@ -520,6 +523,7 @@
     downKey:= false;
     rightKey:= false;
     leftKey:= false;
+    preciseKey:= false;
 
     // action key emulation
     backspaceKey:= false;
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Sat Jul 17 06:56:39 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Sat Jul 17 16:35:14 2010 +0200
@@ -158,9 +158,10 @@
 #pragma mark actionSheet methods
 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
+        CGRect screen = [[UIScreen mainScreen] bounds];
         [UIView beginAnimations:@"table width less" context:NULL];
         [UIView setAnimationDuration:0.2];
-        self.view.frame = CGRectMake(280, 0, 200, 170);
+        self.view.frame = CGRectMake(screen.size.height-200, 0, 200, 170);
         [UIView commitAnimations];
     }
     
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sat Jul 17 06:56:39 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sat Jul 17 16:35:14 2010 +0200
@@ -183,6 +183,9 @@
         case 1:
         case 2:
         case 3:
+            [NSObject cancelPreviousPerformRequestsWithTarget:self
+                                                     selector:@selector(unsetPreciseStatus)
+                                                       object:nil];
             HW_walkingKeysUp();
             break;
         case 4:
@@ -218,9 +221,13 @@
             HW_walkRight();
             break;
         case 2:
+            [self performSelector:@selector(unsetPreciseStatus) withObject:nil afterDelay:0.8];
+            HW_preciseSet(YES);
             HW_aimUp();
             break;
         case 3:
+            [self performSelector:@selector(unsetPreciseStatus) withObject:nil afterDelay:0.8];
+            HW_preciseSet(YES);
             HW_aimDown();
             break;
         case 4:
@@ -249,6 +256,10 @@
     }
 }
 
+-(void) unsetPreciseStatus {
+    HW_preciseSet(NO);
+}
+
 // present a further check before closing game
 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
     if ([actionSheet cancelButtonIndex] != buttonIndex)
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Sat Jul 17 06:56:39 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Sat Jul 17 16:35:14 2010 +0200
@@ -39,6 +39,8 @@
     void HW_walkRight(void);
     void HW_aimUp(void);
     void HW_aimDown(void);
+    void HW_preciseSet(BOOL status);
+    
     void HW_shoot(void);
     void HW_jump(void);
     void HW_backjump(void);
@@ -53,14 +55,15 @@
     void HW_cursorLeft(int);
     void HW_cursorRight(int);
     
-    void HW_terminate(BOOL);
+    void HW_terminate(BOOL andCloseFrontend);
     
-    void HW_setLandscape(BOOL);
+    void HW_setLandscape(BOOL rotate);
     void HW_setCursor(int x, int y);
     void HW_saveCursor(BOOL reset);
     
     BOOL HW_isAmmoOpen(void);
     BOOL HW_isWeaponRequiringClick(void);
+    
 #ifdef __cplusplus
 }
 #endif