add some phone rumbling to big explosions, airbomb and sinegun
authorkoda
Sun, 31 Oct 2010 18:04:02 +0100
changeset 4034 634a8c8682de
parent 4032 4aeab704d006
child 4047 6c07a302b7c0
add some phone rumbling to big explosions, airbomb and sinegun really have mine timer go up to 5 seconds
hedgewars/GSHandlers.inc
hedgewars/VGSHandlers.inc
hedgewars/uGears.pas
hedgewars/uMobile.pas
hedgewars/uVisualGears.pas
project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m
project_files/HedgewarsMobile/Classes/ObjcExports.m
project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
project_files/HedgewarsMobile/Resources/Frontend-iPad/bricks.png
--- a/hedgewars/GSHandlers.inc	Sun Oct 31 04:16:10 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Sun Oct 31 18:04:02 2010 +0100
@@ -2090,6 +2090,7 @@
     begin
         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
         DeleteGear(Gear);
+        performRumble();
         exit
     end;
     if (GameTicks and $3F) = 0 then
@@ -3872,7 +3873,8 @@
     Gear^.dX.isNegative := not Gear^.dX.isNegative;
     Gear^.dY.isNegative := not Gear^.dY.isNegative;
 
-    Gear^.doStep := @doStepSineGunShotWork; 
+    Gear^.doStep := @doStepSineGunShotWork;
+    performRumble();
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/VGSHandlers.inc	Sun Oct 31 04:16:10 2010 +0100
+++ b/hedgewars/VGSHandlers.inc	Sun Oct 31 18:04:02 2010 +0100
@@ -584,6 +584,7 @@
 for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2);
 Gear^.doStep:= @doStepBigExplosionWork;
 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
+performRumble();
 end;
 
 procedure doStepChunk(Gear: PVisualGear; Steps: Longword);
--- a/hedgewars/uGears.pas	Sun Oct 31 04:16:10 2010 +0100
+++ b/hedgewars/uGears.pas	Sun Oct 31 18:04:02 2010 +0100
@@ -102,7 +102,7 @@
 
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
-    uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit;
+     uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile;
 
 const MAXROPEPOINTS = 384;
 var RopePoints: record
@@ -121,7 +121,7 @@
 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward;
 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
 //procedure AmmoFlameWork(Ammo: PGear); forward;
-function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
+function  GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
 procedure SpawnBoxOfSmth; forward;
 procedure AfterAttack; forward;
@@ -365,7 +365,7 @@
                 gear^.Elasticity:= _0_55;
                 gear^.Friction:= _0_995;
                 if cMinesTime < 0 then
-                    gear^.Timer:= getrandom(4)*1000
+                    gear^.Timer:= getrandom(6)*1000
                 else
                     gear^.Timer:= cMinesTime*1;
                 end;
--- a/hedgewars/uMobile.pas	Sun Oct 31 04:16:10 2010 +0100
+++ b/hedgewars/uMobile.pas	Sun Oct 31 18:04:02 2010 +0100
@@ -22,7 +22,7 @@
 interface
 
 {$IFDEF IPHONEOS}
-(*  iOS calls written in C/Objc  *)
+(*  iOS calls written in ObjcExports.m  *)
 procedure clearView; cdecl; external;
 procedure startSpinning; cdecl; external;
 procedure stopSpinning; cdecl; external;
@@ -30,9 +30,10 @@
 procedure replayFinished; cdecl; external;
 procedure updateVisualsNewTurn; cdecl; external;
 function  isApplePhone: Boolean; cdecl; external;
+procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
 {$ENDIF}
 function  isPhone: Boolean; inline;
-procedure doRumble; inline;
+procedure performRumble; inline;
 procedure perfExt_AddProgress; inline;
 procedure perfExt_FinishProgress; inline;
 procedure perfExt_AmmoUpdate; // don't inline
@@ -51,9 +52,12 @@
     exit(false);
 end;
 
-procedure doRumble; inline;
+procedure performRumble; inline;
 begin
-    // fill me!
+{$IFDEF IPHONEOS}
+    // kSystemSoundID_Vibrate = $00000FFF
+    AudioServicesPlaySystemSound($00000FFF);
+{$ENDIF}
 end;
 
 procedure perfExt_AddProgress; inline;
--- a/hedgewars/uVisualGears.pas	Sun Oct 31 04:16:10 2010 +0100
+++ b/hedgewars/uVisualGears.pas	Sun Oct 31 18:04:02 2010 +0100
@@ -62,7 +62,7 @@
     vobVelocity, vobFallSpeed: LongInt;
 
 implementation
-uses uWorld, uMisc, uStore, uTeams, uSound;
+uses uWorld, uMisc, uStore, uTeams, uSound, uMobile;
 const cExplFrameTicks = 110;
 
 {$INCLUDE "VGSHandlers.inc"}
--- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Sun Oct 31 04:16:10 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Sun Oct 31 18:04:02 2010 +0100
@@ -367,7 +367,3 @@
 }
 
 @end
-
-void updateVisualsNewTurn (void) {
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"updateAmmoVisuals" object:nil];
-}
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sun Oct 31 04:16:10 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sun Oct 31 18:04:02 2010 +0100
@@ -33,9 +33,9 @@
 #pragma mark -
 #pragma mark functions called like oop
 void objcExportsInit() {
-        gameRunning = NO;
-        savedGame = NO;
-        grenadeTime = 2;
+    gameRunning = NO;
+    savedGame = NO;
+    grenadeTime = 2;
 }
 
 BOOL inline isGameRunning() {
@@ -56,7 +56,6 @@
 
 #pragma mark -
 #pragma mark functions called by pascal code
-// called by uStore from AddProgress
 void startSpinning() {
     gameRunning = NO;
     UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow];
@@ -77,7 +76,6 @@
     [indicator release];
 }
 
-// called by uStore from FinishProgress and by OverlayViewController by replayBegan
 void stopSpinning() {
     UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow];
     UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[theWindow viewWithTag:ACTIVITYINDICATOR_TAG];
@@ -87,7 +85,6 @@
         gameRunning = YES;
 }
 
-// called by CCHandlers from chNextTurn
 void clearView() {
     UIWindow *theWindow = (IS_DUALHEAD()) ? [SDLUIKitDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow];
     UIButton *theButton = (UIButton *)[theWindow viewWithTag:CONFIRMATION_TAG];
@@ -107,7 +104,6 @@
     grenadeTime = 2;
 }
 
-// called by hwengine
 void replayBegan() {
     UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow];
     UIView *blackView = [[UIView alloc] initWithFrame:theWindow.frame];
@@ -130,7 +126,6 @@
     stopSpinning();
 }
 
-// called by uGame
 void replayFinished() {
     UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow];
     UIView *blackView = (UIView *)[theWindow viewWithTag:REPLAYBLACKVIEW_TAG];
@@ -144,3 +139,7 @@
     gameRunning = YES;
     savedGame = NO;
 }
+
+void updateVisualsNewTurn(void) {
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"updateAmmoVisuals" object:nil];
+}
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Sun Oct 31 04:16:10 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Sun Oct 31 18:04:02 2010 +0100
@@ -28,7 +28,6 @@
 #import "jumphack.h"
 #import "SDL_video.h"
 #import "SDL_mixer.h"
-
 #import "PascalImports.h"
 #import "CommodityFunctions.h"
 #import "GameSetup.h"
Binary file project_files/HedgewarsMobile/Resources/Frontend-iPad/bricks.png has changed