Merge cursor_issues into default
authorunc0rr
Mon, 02 May 2011 18:39:11 +0400
changeset 5198 6533e5450a21
parent 5197 9fa96377a69c (diff)
parent 5191 c7000a6b397b (current diff)
child 5199 5eae5da831e1
Merge cursor_issues into default
--- a/.hgtags	Mon May 02 18:37:57 2011 +0400
+++ b/.hgtags	Mon May 02 18:39:11 2011 +0400
@@ -1,16 +1,6 @@
 04a613bab65c75977b63ab7f54c58cceac707dd0 hedgewars-0.8.1-r1
-19ba506ed86b6306f7cd01b2613069391f4e34e6 0.9.13
-52c7981594f6bc3a7ed1b297b80cb38082015401 0.9.4
-69f1dc50a1faddf1a52080600a3f4771bedd45c1 0.9.2
-7d8d62a5566ed84688c596b8f55e83cfd171683e 0.9.12
-89d0fa6734af24e439755b102080cf6268c50aa6 0.9.11
-8c3e71880f492c61086c2ca2541b52f82a5957b0 0.9.9.2
 97b2d242e2a1ade7fc17fd0d4a856c612ad975ca hedgewars-0.8.0
-990f341a2332a7bef0822b313854544228375e36 0.9.10
-9b2abea1071f83da8fbda70b0bf6cec0ca481b07 0.9.3
 bb56f0682655b18f229be97085a409e3c76f578e hedgewars-0.8.1
-fee68e3a303998fdfcc69f74775dc84a36f587fb 0.9.9
-fee68e3a303998fdfcc69f74775dc84a36f587fb 0.9.9.1
 81db3c85784b4f35c7ff1ef9a5d64f5bdd383f08 Hedgewars-iOS-1.0
 3620607258cdc1213dce20cb6ad7872f6b8085e0 Hedgewars-iOS-1.0.1
 adffb668f06e265b45d1e4aedc283e6f4e5ba7e8 Hedgewars-iOS-1.1
@@ -20,3 +10,15 @@
 5ea3d182415e4327e7584b1aa68197931d232ac3 Hedgewars-iOS-1.2.2
 ae71dff40ecc405a55647b0f52f628674c1ebb51 0.9.14.1-release
 ae0c6c35414ddc120c8ae94035f287f03a752e78 Hedgewars-iOS-1.2.3
+19ba506ed86b6306f7cd01b2613069391f4e34e6 0.9.13-release
+7d8d62a5566ed84688c596b8f55e83cfd171683e 0.9.12-release
+89d0fa6734af24e439755b102080cf6268c50aa6 0.9.11-release
+990f341a2332a7bef0822b313854544228375e36 0.9.10-release
+8c3e71880f492c61086c2ca2541b52f82a5957b0 0.9.9.2-release
+040cfeac98127d35f22ac8433b06b09e50d5b28f 0.9.8-release
+44cc464de8f320e8018ed9e9cbb7281fd42d0a00 0.9.7-release
+a32f1eed51a6df2513d471cb849eb110545c50b3 0.9.6-release
+6bc4389344c7d7f41bcbc46f986c1dcf88846189 0.9.5-release
+52c7981594f6bc3a7ed1b297b80cb38082015401 0.9.4-release
+9b2abea1071f83da8fbda70b0bf6cec0ca481b07 0.9.3-release
+69f1dc50a1faddf1a52080600a3f4771bedd45c1 0.9.2-release
--- a/hedgewars/GSHandlers.inc	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Mon May 02 18:39:11 2011 +0400
@@ -4870,16 +4870,16 @@
        not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
        TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
        sprHHTelepMask, 0, false, false) then
-    begin
+        begin
         HHGear^.Message := HHGear^.Message and not gmAttack;
         HHGear^.State := HHGear^.State and not gstAttacking;
         HHGear^.State := HHGear^.State or gstHHChooseTarget;
         DeleteGear(Gear);
         isCursorVisible := true;
         PlaySound(sndDenied)
-    end
+        end
     else
-    begin
+        begin
         DeleteCI(HHGear);
         SetAllHHToActive;
         PlaySound(sndPlaced);
@@ -4894,7 +4894,49 @@
         hog^.Gear:= nil;
         Gear^.Hedgehog := hog;
         Gear^.doStep := @doStepStructure;
-    end;
+        end;
     TargetPoint.X := NoPointX;
 end;
 
+procedure doStepTardis(Gear: PGear);
+(*var 
+    i, x, y: LongInt;
+    dX, dY: hwFloat;
+    Fire: PGear;
+    vg: PVisualGear;*)
+begin
+    if (Gear^.State and gstTmpFlag) = 0 then dec(Gear^.Timer);
+    if (Gear^.Timer = 0) and (CurAmmoGear = Gear) then
+        begin
+        if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then 
+            begin
+            DeleteGear(Gear);
+            exit
+            end;
+        if Gear = CurAmmoGear then CurAmmoGear := nil;
+        Gear^.Hedgehog:= CurrentHedgehog;
+        RemoveGearFromList(CurrentHedgehog^.Gear);
+        CurrentHedgehog^.Gear^.Z := cHHZ;
+        CurrentHedgehog^.Gear^.Active := false;
+        CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstHHDriven;
+        CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear;
+        CurrentHedgehog^.Gear:= nil;
+        Gear^.State:= Gear^.State or gstTmpFlag;
+        Gear^.Timer:= GameTicks + GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime;
+        end
+    else if (((Gear^.State and gstTmpFlag) <> 0) and (Gear^.Timer = GameTicks)) or SuddenDeath then
+        begin
+        if Gear^.Hedgehog <> nil then
+            begin
+            Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden;
+            Gear^.Hedgehog^.GearHidden:= nil;
+            FindPlace(Gear^.Hedgehog^.Gear, false, 0, LAND_WIDTH,true);
+            InsertGearToList(Gear^.Hedgehog^.Gear);
+            Gear^.Hedgehog^.Gear^.State:= (Gear^.Hedgehog^.Gear^.State or gstTmpFlag or gstAttacked) and not gstHHDriven;
+            Gear^.Hedgehog^.Gear^.Timer:= $FF;
+            Gear^.Hedgehog^.Gear^.doStep:= @doStepHedgehogReturn;
+            SetAllHHToActive;
+            end;
+            DeleteGear(Gear)
+        end
+end;
--- a/hedgewars/HHHandlers.inc	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/HHHandlers.inc	Mon May 02 18:39:11 2011 +0400
@@ -317,6 +317,7 @@
                    amDrillStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
                    //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
                      amStructure: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtStructure, 0, _0, _0, 0);
+                        amTardis: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
                   end;
 
         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
@@ -996,3 +997,13 @@
     doStepHedgehogDriven(Gear)
     end;
 end;
+
+procedure doStepHedgehogReturn(Gear: PGear);
+begin
+if (Gear^.Timer > 0) and ((GameTicks mod 20) = 0) then dec(Gear^.Timer)
+else if (Gear^.Timer = 0) then
+    begin
+    Gear^.doStep:= @doStepHedgehog;
+    Gear^.State:= Gear^.State and not gstTmpFlag;
+    end
+end;
--- a/hedgewars/PascalExports.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/PascalExports.pas	Mon May 02 18:39:11 2011 +0400
@@ -28,8 +28,7 @@
  *           http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl
  *)
 interface
-uses uTypes, uConsts, uVariables, GLunit, uKeys, uSound, uAmmos, uUtils,
-     uCommands, uMobile;
+uses uTypes, uConsts, uVariables, GLunit, uKeys, uSound, uAmmos, uUtils, uCommands;
 
 {$INCLUDE "config.inc"}
 procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export;
@@ -201,7 +200,6 @@
 // equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup
 procedure HW_terminate(closeFrontend: boolean); cdecl; export;
 begin
-    {$IFDEF IPHONEOS}setGameRunning(false);{$ENDIF}
     alsoShutdownFrontend:= closeFrontend;
     ParseCommand('forcequit', true);
 end;
--- a/hedgewars/uFloat.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/uFloat.pas	Mon May 02 18:39:11 2011 +0400
@@ -192,7 +192,7 @@
 function hwFloat2Float (const i: hwFloat) : extended;
 begin
 hwFloat2Float:= i.QWordValue / $100000000;
-if i.isNegative then hwFloat2Float:=hwFloat2Float*-1;
+if i.isNegative then hwFloat2Float:= -hwFloat2Float;
 end;
 
 operator + (const z1, z2: hwFloat) z : hwFloat;
--- a/hedgewars/uGears.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/uGears.pas	Mon May 02 18:39:11 2011 +0400
@@ -72,6 +72,7 @@
 procedure AfterAttack; forward;
 procedure HedgehogStep(Gear: PGear); forward;
 procedure doStepHedgehogMoving(Gear: PGear); forward;
+procedure doStepHedgehogReturn(Gear: PGear); forward;
 procedure HedgehogChAngle(HHGear: PGear); forward;
 procedure ShotgunShot(Gear: PGear); forward;
 procedure PickUp(HH, Gear: PGear); forward;
@@ -147,8 +148,8 @@
             @doStepSnowball,
             @doStepSnowflake,
             @doStepPlaceStructure,
-            @doStepLandGun
-            );
+            @doStepLandGun,
+            @doStepTardis);
 
 procedure InsertGearToList(Gear: PGear);
 var tmp, ptmp: PGear;
@@ -1042,7 +1043,6 @@
     Gear^.LastDamage := AttackerHog;
 
     Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
-    uStats.HedgehogDamaged(Gear, AttackerHog);
     HHHurt(Gear^.Hedgehog, Source);
     AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
@@ -1084,6 +1084,8 @@
         Gear^.Hedgehog:= AttackerHog;
         end;
     inc(Gear^.Damage, Damage);
+    
+    uStats.HedgehogDamaged(Gear, AttackerHog);    
     ScriptCall('onGearDamage', Gear^.UID, Damage);
 end;
 
--- a/hedgewars/uGearsRender.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/uGearsRender.pas	Mon May 02 18:39:11 2011 +0400
@@ -227,6 +227,13 @@
         Tint($FF, $FF, $FF, $FF)
         end;
 
+    if  (CurAmmoGear <> nil) and 
+        (CurrentHedgehog^.Gear <> nil) and
+        (CurrentHedgehog^.Gear = Gear) and 
+        (CurAmmoGear^.Kind = gtTardis) then Tint($FF, $FF, $FF, CurAmmoGear^.Timer div 20)
+    // probably will need a new flag for this
+    else if (Gear^.State and gstTmpFlag <> 0) then Tint($FF, $FF, $FF, $FF-Gear^.Timer);
+
     if ((Gear^.State and gstWinner) <> 0) and
     ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
         begin
--- a/hedgewars/uTypes.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/uTypes.pas	Mon May 02 18:39:11 2011 +0400
@@ -97,7 +97,7 @@
             gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
             gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
             gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
-            gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun); // 61
+            gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis); // 62
 
     // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
--- a/hedgewars/uVariables.pas	Mon May 02 18:37:57 2011 +0400
+++ b/hedgewars/uVariables.pas	Mon May 02 18:39:11 2011 +0400
@@ -2041,8 +2041,6 @@
             NumberInCase: 1;
             Ammo: (Propz: ammoprop_ForwMsgs or
                           ammoprop_NoCrosshair or
-                          ammoprop_NeedTarget or
-                          ammoprop_AttackingPut or
                           ammoprop_Utility or
                           ammoprop_DontHold;
                 Count: 2;
--- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Mon May 02 18:37:57 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Mon May 02 18:39:11 2011 +0400
@@ -67,17 +67,17 @@
     [self viewWillAppear:YES];
     [container addSubview:self.view];
 
-    if (placingPoint.x == -1 && placingPoint.y == -1)
+    if (placingPoint.x == -1 || placingPoint.y == -1)
         placingPoint = container.center;
-    if (IS_DUALHEAD() == NO)
-        self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
-    else {
+    if (IS_DUALHEAD() == YES) {
         UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
         if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
             self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
         else
             self.view.center = CGPointMake(placingPoint.x, placingPoint.y);
-    }
+    } else
+        self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
+
     self.isVisible = YES;
     if (IS_IPAD() == NO)
         HW_pause();
@@ -116,7 +116,7 @@
     [self.view addSubview:self.captionLabel];
     [caption release];
 
-    UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 415, 53)];
+    UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, self.view.frame.size.height-50, 415, 53)];
     description.backgroundColor = [UIColor clearColor];
     description.textColor = [UIColor whiteColor];
     description.text = DEFAULT_DESCRIPTION;
@@ -281,7 +281,7 @@
     if (theButton.tag > 41)
         y = 5;
     else
-        y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18;
+        y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*40;
 
     self.nameLabel.frame = CGRectMake(x, y, 200, 20);
     self.captionLabel.frame = CGRectMake(x+200, y, 220, 20);
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon May 02 18:37:57 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon May 02 18:39:11 2011 +0400
@@ -57,11 +57,8 @@
 #pragma mark -
 // overlay with controls, become visible later, with a transparency effect since the sdlwindow is not yet created
 -(void) displayOverlayLater:(id) object {
-    NSDictionary *dict = (NSDictionary *)object;
-
-    [self.overlayController setUseClassicMenu:[[dict objectForKey:@"menu"] boolValue]];
-    [self.overlayController setInitialOrientation:[[dict objectForKey:@"orientation"] intValue]];
-    objcExportsInit(self.overlayController);
+    [self.overlayController setUseClassicMenu:[[self.systemSettings objectForKey:@"menu"] boolValue]];
+    [self.overlayController setInitialOrientation:self.parentController.interfaceOrientation];
 
     UIWindow *gameWindow = (IS_DUALHEAD() ? [HedgewarsAppDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow]);
     [gameWindow addSubview:self.overlayController.view];
@@ -129,6 +126,8 @@
     [localeString release];
     [ipcString release];
 
+    objcExportsInit(self.overlayController);
+
     // this is the pascal fuction that starts the game, wrapped around isInGame
     [HedgewarsAppDelegate sharedAppDelegate].isInGame = YES;
     Game(gameArgs);
@@ -154,12 +153,7 @@
         blackView.alpha = 1;
 
     // prepare options for overlay and add it to the future sdl uiwindow
-    NSDictionary *overlayOptions = [[NSDictionary alloc] initWithObjectsAndKeys:
-                                    [NSNumber numberWithInt:self.parentController.interfaceOrientation],@"orientation",
-                                    [self.systemSettings objectForKey:@"menu"],@"menu",
-                                    nil];
-    [self performSelector:@selector(displayOverlayLater:) withObject:overlayOptions afterDelay:3];
-    [overlayOptions release];
+    [self performSelector:@selector(displayOverlayLater:) withObject:nil afterDelay:3];
 
     // SYSTEMS ARE GO!!
     [self startGameEngine];
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Mon May 02 18:37:57 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Mon May 02 18:39:11 2011 +0400
@@ -101,6 +101,9 @@
 }
 
 void saveBeganSynching() {
+    savedGame = YES;
+    stopSpinningProgress();
+
     overlay_instance.view.backgroundColor = [UIColor blackColor];
     overlay_instance.view.alpha = 0.75;
     overlay_instance.view.userInteractionEnabled = NO;
@@ -114,9 +117,6 @@
     [overlay_instance.savesIndicator startAnimating];
     [overlay_instance.view addSubview:overlay_instance.savesIndicator];
     [overlay_instance.savesIndicator release];
-
-    savedGame = YES;
-    stopSpinningProgress();
 }
 
 void saveFinishedSynching() {
@@ -131,7 +131,6 @@
     [overlay_instance.savesIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
 
     gameRunning = YES;
-    savedGame = NO;
 }
 
 void updateVisualsNewTurn(void) {
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon May 02 18:37:57 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon May 02 18:39:11 2011 +0400
@@ -42,9 +42,6 @@
 #pragma mark rotation
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
-    // don't rotate until the game is running for performance and synchronization with the sdlview
-    if (isGameRunning() == NO)
-        return (interfaceOrientation == (UIInterfaceOrientation) self.initialOrientation);
     return rotationManager(interfaceOrientation);
 }
 
@@ -117,7 +114,6 @@
             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
             break;
         default:
-            DLog(@"Nope");
             break;
     }
     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
@@ -664,7 +660,6 @@
                 initialDistanceForPinching = currentDistanceOfPinching;
             break;
         default:
-            DLog(@"Nope");
             break;
     }
 }