# HG changeset patch # User koda # Date 1336684916 -7200 # Node ID 0a4c88935902bac6bd2115dad66ac93be3e137c7 # Parent 606acf1f80be2bc386c91439823bbb16143c70e5 the ios port runs again, although with a few things to sort out diff -r 606acf1f80be -r 0a4c88935902 hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Thu May 10 22:15:31 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -(* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2004-2012 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - *) - -{$INCLUDE "options.inc"} - -unit PascalExports; -(* - * If the engine is compiled as library this unit will export functions - * as C declarations for convenient library usage in your application and - * language of choice. - * - * See also: C declarations on wikipedia - * http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl - *) -interface -uses uTypes, uConsts, uVariables, GLunit, uInputHandler, uSound, uAmmos, uUtils, uCommands; - -{$INCLUDE "config.inc"} -procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; - -function HW_getNumberOfWeapons:LongInt; cdecl; export; - -function HW_getMaxNumberOfTeams:LongInt; cdecl; export; - -function HW_getMaxNumberOfHogs:LongInt; cdecl; export; - -procedure HW_terminate(closeFrontend: Boolean); cdecl; export; - -implementation -{$IFDEF HWLIBRARY} -var cZoomVal: GLfloat; - -// retrieve protocol information -procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; -begin - netProto^:= cNetProtoVersion; - versionStr^:= cVersionString; -end; - -procedure HW_zoomSet(value: GLfloat); cdecl; export; -begin - cZoomVal:= value; - ZoomValue:= value; -end; - -procedure HW_zoomReset; cdecl; export; -begin - ZoomValue:= cZoomVal; - // center the camera at current hog - if CurrentHedgehog <> nil then - followGear:= CurrentHedgehog^.Gear; -end; - -function HW_zoomFactor: GLfloat; cdecl; export; -begin - HW_zoomFactor:= ZoomValue / cDefaultZoomLevel; -end; - -function HW_zoomLevel: LongInt; cdecl; export; -begin - HW_zoomLevel:= trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta); -end; - -procedure HW_screenshot; cdecl; export; -begin - flagMakeCapture:= true; -end; - -function HW_isPaused: boolean; cdecl; export; -begin - HW_isPaused:= isPaused; -end; - -// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup -procedure HW_terminate(closeFrontend: boolean); cdecl; export; -begin - closeFrontend:= closeFrontend; // avoid hint - ParseCommand('forcequit', true); -end; - -function HW_getSDLWindow: pointer; cdecl; export; -begin - HW_getSDLWindow:={$IFDEF SDL13}SDLwindow{$ELSE}nil{$ENDIF}; -end; - -// cursor handling -procedure HW_setCursor(x,y: LongInt); cdecl; export; -begin - CursorPoint.X:= x; - CursorPoint.Y:= y; -end; - -procedure HW_getCursor(x,y: PLongInt); cdecl; export; -begin - x^:= CursorPoint.X; - y^:= CursorPoint.Y; -end; - -// ammo menu related functions -function HW_isAmmoMenuOpen: boolean; cdecl; export; -begin - HW_isAmmoMenuOpen:= bShowAmmoMenu; -end; - -function HW_isAmmoMenuNotAllowed: boolean; cdecl; export; -begin; - HW_isAmmoMenuNotAllowed:= ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or - ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) ); -end; - -function HW_isWeaponRequiringClick: boolean; cdecl; export; -begin - HW_isWeaponRequiringClick:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponRequiringClick:= (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0; -end; - -function HW_isWeaponTimerable: boolean; cdecl; export; -begin - HW_isWeaponTimerable:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponTimerable:= (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Timerable) <> 0; -end; - -function HW_isWeaponSwitch: boolean cdecl; export; -begin - HW_isWeaponSwitch:= false; - if (CurAmmoGear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponSwitch:= (CurAmmoGear^.AmmoType = amSwitch); -end; - -function HW_isWeaponRope: boolean cdecl; export; -begin - HW_isWeaponRope:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponRope:= (CurrentHedgehog^.CurAmmoType = amRope); -end; - -procedure HW_setGrenadeTime(time: LongInt); cdecl; export; -begin - ParseCommand('/timer ' + inttostr(time), true); -end; - -function HW_getGrenadeTime: LongInt; cdecl; export; -var CurWeapon: PAmmo; -begin - HW_getGrenadeTime:= 3; - if HW_isWeaponTimerable then - begin - CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); - HW_getGrenadeTime:= CurWeapon^.Timer div 1000; - end; -end; - -procedure HW_setPianoSound(snd: LongInt); cdecl; export; -begin - // this most likely won't work in network game - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) - and (CurrentHedgehog^.CurAmmoType = amPiano) then - case snd of - 0: PlaySound(sndPiano0); - 1: PlaySound(sndPiano1); - 2: PlaySound(sndPiano2); - 3: PlaySound(sndPiano3); - 4: PlaySound(sndPiano4); - 5: PlaySound(sndPiano5); - 6: PlaySound(sndPiano6); - 7: PlaySound(sndPiano7); - else PlaySound(sndPiano8); - end; -end; - -function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponNameByIndex:= (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponCaptionByIndex:= (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponDescriptionByIndex:= (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getNumberOfWeapons: LongInt; cdecl; export; -begin - HW_getNumberOfWeapons:= ord(high(TAmmoType)); -end; - -procedure HW_setWeapon(whichone: LongInt); cdecl; export; -begin - if (CurrentTeam = nil) then exit; - if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then - SetWeapon(TAmmoType(whichone+1)); -end; - -function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export; -begin - HW_isWeaponAnEffect:= Ammoz[TAmmoType(whichone+1)].Ammo.Propz and ammoprop_Effect <> 0; -end; - -function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export; -var a : PHHAmmo; - slot, index, res: LongInt; -begin - HW_getAmmoCounts:= -1; - // nil check - if (CurrentHedgehog = nil) or (CurrentHedgehog^.Ammo = nil) or (CurrentTeam = nil) then - exit; - // hog controlled by opponent (net or ai) - if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then - exit; - - a:= CurrentHedgehog^.Ammo; - for slot:= 0 to cMaxSlotIndex do - for index:= 0 to cMaxSlotAmmoIndex do - if a^[slot,index].Count <> 0 then // yes, ammomenu is hell - counts[ord(a^[slot,index].AmmoType)-1]:= a^[slot,index].Count; - HW_getAmmoCounts:= 0; -end; - -procedure HW_getAmmoDelays (skipTurns: PByte); cdecl; export; -var a : TAmmoType; -begin - for a:= Low(TAmmoType) to High(TAmmoType) do - skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns); -end; - -function HW_getTurnsForCurrentTeam: LongInt; cdecl; export; -begin - HW_getTurnsForCurrentTeam:= 0; - if (CurrentTeam <> nil) and (CurrentTeam^.Clan <> nil) then - HW_getTurnsForCurrentTeam:= CurrentTeam^.Clan^.TurnNumber; -end; - -function HW_getMaxNumberOfHogs: LongInt; cdecl; export; -begin - HW_getMaxNumberOfHogs:= cMaxHHIndex + 1; -end; - -function HW_getMaxNumberOfTeams: LongInt; cdecl; export; -begin - HW_getMaxNumberOfTeams:= cMaxTeams; -end; - -procedure HW_memoryWarningCallback; cdecl; export; -begin - ReleaseSound(false); -end; - -{$ENDIF} - -end. - diff -r 606acf1f80be -r 0a4c88935902 hedgewars/hwLibrary.pas --- a/hedgewars/hwLibrary.pas Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/hwLibrary.pas Thu May 10 23:21:56 2012 +0200 @@ -16,17 +16,72 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA *) -Library hwLibrary; {$INCLUDE "options.inc"} -// Add all your Pascal units to the 'uses' clause below to add them to the program. -// Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using -// 'cdecl; export;' (see the fpclogo.pas unit for an example), and then add C-declarations for -// these procedures/functions to the PascalImports.h file (also in the 'Pascal Sources' group) -// to make these functions available in the C/C++/Objective-C source files -// (add '#include PascalImports.h' near the top of these files if it is not there yet) -uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF}; -exports Game, HW_versionInfo; +(* + * When engine is compiled as library this unit will export functions + * as C declarations for convenient library usage in your application + * and language of choice. + * + * See also: C declarations on Wikipedia + * http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl + *) + +Library hwLibrary; + +uses hwengine, uTypes, uConsts, uVariables, uSound, uCommands, uUtils, + uLocale{$IFDEF ANDROID}, jni{$ENDIF}; + +{$INCLUDE "config.inc"} + +// retrieve protocol information +procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; +begin + netProto^:= cNetProtoVersion; + versionStr^:= cVersionString; +end; + +// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup +procedure HW_terminate(closeFrontend: boolean); cdecl; export; +begin + closeFrontend:= closeFrontend; // avoid hint + ParseCommand('forcequit', true); +end; + +function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponNameByIndex:= (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); +end; + +(*function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponCaptionByIndex:= (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); +end; + +function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponDescriptionByIndex:= (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); +end;*) + +function HW_getNumberOfWeapons: LongInt; cdecl; export; +begin + HW_getNumberOfWeapons:= ord(high(TAmmoType)); +end; + +function HW_getMaxNumberOfHogs: LongInt; cdecl; export; +begin + HW_getMaxNumberOfHogs:= cMaxHHIndex + 1; +end; + +function HW_getMaxNumberOfTeams: LongInt; cdecl; export; +begin + HW_getMaxNumberOfTeams:= cMaxTeams; +end; + +procedure HW_memoryWarningCallback; cdecl; export; +begin + ReleaseSound(false); +end; {$IFDEF ANDROID} function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl; @@ -52,9 +107,19 @@ HW_getMaxNumberOfHogs name Java_Prefix + 'HWgetMaxNumberOfHogs', HW_getMaxNumberOfTeams name Java_Prefix + 'HWgetMaxNumberOfTeams', HW_terminate name Java_Prefix + 'HWterminate'; +{$ELSE} +exports + Game, + GenLandPreview, + LoadLocaleWrapper, + HW_versionInfo, + HW_terminate, + HW_getNumberOfWeapons, + HW_getMaxNumberOfHogs, + HW_getMaxNumberOfTeams, + HW_getWeaponNameByIndex, + HW_memoryWarningCallback; {$ENDIF} begin - end. - diff -r 606acf1f80be -r 0a4c88935902 hedgewars/options.inc --- a/hedgewars/options.inc Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/options.inc Thu May 10 23:21:56 2012 +0200 @@ -48,6 +48,7 @@ {$DEFINE GLunit:=gles11} {$DEFINE MOBILE} {$DEFINE USE_LANDSCAPE_AMMOMENU} + {$DEFINE USE_TOUCH_INTERFACE} {$ENDIF} {$IFDEF WIN32} diff -r 606acf1f80be -r 0a4c88935902 hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/uInputHandler.pas Thu May 10 23:21:56 2012 +0200 @@ -239,12 +239,8 @@ for i:= 6 to cKeyMaxIndex do begin -{$IFDEF SDL13} - s:= shortstring(SDL_GetScancodeName(i)); -{$ELSE} s:= shortstring(sdl_getkeyname(i)); -{$ENDIF} - WriteToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); + //WriteToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); if s = 'unknown key' then KeyNames[i]:= '' else begin diff -r 606acf1f80be -r 0a4c88935902 hedgewars/uLocale.pas --- a/hedgewars/uLocale.pas Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/uLocale.pas Thu May 10 23:21:56 2012 +0200 @@ -29,6 +29,10 @@ function Format(fmt: ansistring; var arg: ansistring): ansistring; function GetEventString(e: TEventId): ansistring; +{$IFDEF HWLIBRARY} +procedure LoadLocaleWrapper(str: pchar); cdecl; export; +{$ENDIF} + implementation uses uRandom, uUtils, uVariables, uDebug, uConsole; @@ -129,9 +133,11 @@ Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) end; +{$IFDEF HWLIBRARY} procedure LoadLocaleWrapper(str: pchar); cdecl; export; begin LoadLocale(Strpas(str)); end; +{$ENDIF} end. diff -r 606acf1f80be -r 0a4c88935902 hedgewars/uMobile.pas --- a/hedgewars/uMobile.pas Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/uMobile.pas Thu May 10 23:21:56 2012 +0200 @@ -18,28 +18,34 @@ {$INCLUDE "options.inc"} +(* + * This unit contains a lot of useful functions when hw is running on mobile + * Unlike HwLibrary when you declare functions that you will call from your code, + * here you need to provide functions that Pascall code will call. + *) + unit uMobile; interface +function isPhone: Boolean; inline; +procedure performRumble; inline; + +procedure GameLoading; inline; +procedure GameLoaded; inline; +procedure SaveLoadingEnded; inline; + +implementation +uses uVariables, uConsole; + +// add here any external call that you need {$IFDEF IPHONEOS} (* iOS calls written in ObjcExports.m *) -procedure clearView; cdecl; external; procedure startLoadingIndicator; cdecl; external; procedure stopLoadingIndicator; cdecl; external; procedure saveFinishedSynching; cdecl; external; function isApplePhone: Boolean; cdecl; external; procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external; {$ENDIF} -function isPhone: Boolean; inline; -procedure performRumble; inline; - -procedure GameLoading; inline; -procedure GameLoaded; inline; -procedure NewTurnBeginning; inline; -procedure SaveLoadingEnded; inline; - -implementation -uses uVariables, uConsole; // this function is just to determine whether we are running on a limited screen device function isPhone: Boolean; inline; @@ -56,16 +62,16 @@ end; // this function should make the device vibrate in some way -procedure performRumble; inline; -const kSystemSoundID_Vibrate = $00000FFF; +procedure PerformRumble; inline; +{$IFDEF IPHONEOS}const kSystemSoundID_Vibrate = $00000FFF;{$ENDIF} begin // do not vibrate while synchronising a demo/save if not fastUntilLag then - begin + begin {$IFDEF IPHONEOS} AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); {$ENDIF} - end; + end; end; procedure GameLoading; inline; @@ -82,13 +88,6 @@ {$ENDIF} end; -procedure NewTurnBeginning; inline; -begin -{$IFDEF IPHONEOS} - clearView(); -{$ENDIF} -end; - procedure SaveLoadingEnded; inline; begin {$IFDEF IPHONEOS} diff -r 606acf1f80be -r 0a4c88935902 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu May 10 22:15:31 2012 +0200 +++ b/hedgewars/uTeams.pas Thu May 10 23:21:56 2012 +0200 @@ -20,7 +20,8 @@ unit uTeams; interface -uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF}; +uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, + uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF}; procedure initModule; procedure freeModule; @@ -36,7 +37,7 @@ procedure TeamGoneEffect(var Team: TTeam); implementation -uses uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript, +uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript, uGearsUtils, uGearsList{$IFDEF SDL13}, uTouch{$ENDIF}; var MaxTeamHealth: LongInt; @@ -300,7 +301,6 @@ ReadyTimeLeft:= 0 end; -uMobile.NewTurnBeginning(); {$IFDEF SDL13} uTouch.NewTurnBeginning(); {$ENDIF} diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu May 10 23:21:56 2012 +0200 @@ -23,7 +23,7 @@ @class SchemeWeaponConfigViewController; @class TeamConfigViewController; @class MapConfigViewController; -@class HelpPageLobbyViewController; +//@class HelpPageLobbyViewController; @interface GameConfigViewController : UIViewController { UIView *imgContainer; @@ -33,7 +33,7 @@ SchemeWeaponConfigViewController *schemeWeaponConfigViewController; TeamConfigViewController *teamConfigViewController; MapConfigViewController *mapConfigViewController; - HelpPageLobbyViewController *helpPage; + //HelpPageLobbyViewController *helpPage; } @property (retain) UIView *imgContainer; @@ -42,7 +42,7 @@ @property (nonatomic,retain) IBOutlet SchemeWeaponConfigViewController *schemeWeaponConfigViewController; @property (nonatomic,retain) IBOutlet TeamConfigViewController *teamConfigViewController; @property (nonatomic,retain) IBOutlet MapConfigViewController *mapConfigViewController; -@property (nonatomic,retain) HelpPageLobbyViewController *helpPage; +//@property (nonatomic,retain) HelpPageLobbyViewController *helpPage; -(IBAction) buttonPressed:(id) sender; -(IBAction) segmentPressed:(id) sender; diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu May 10 23:21:56 2012 +0200 @@ -21,12 +21,11 @@ #import "MapConfigViewController.h" #import "TeamConfigViewController.h" #import "SchemeWeaponConfigViewController.h" -#import "HelpPageLobbyViewController.h" #import "GameInterfaceBridge.h" @implementation GameConfigViewController -@synthesize imgContainer, helpPage, titleImage, sliderBackground, +@synthesize imgContainer, titleImage, sliderBackground, //helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -67,6 +66,7 @@ break; case 2: [[AudioManagerController mainManager] playClickSound]; + /* if (self.helpPage == nil) self.helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil]; self.helpPage.view.alpha = 0; @@ -74,6 +74,7 @@ [UIView beginAnimations:@"helplobby" context:NULL]; self.helpPage.view.alpha = 1; [UIView commitAnimations]; + */ break; default: DLog(@"Nope"); @@ -103,6 +104,7 @@ [self.view bringSubviewToFront:schemeWeaponConfigViewController.view]; break; case 3: + /* if (helpPage == nil) { helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPhone" bundle:nil]; [self.view addSubview:helpPage.view]; @@ -110,6 +112,7 @@ // this message is compulsory otherwise the table won't be loaded at all [helpPage viewWillAppear:NO]; [self.view bringSubviewToFront:helpPage.view]; + */ break; default: DLog(@"Nope"); @@ -394,8 +397,8 @@ self.teamConfigViewController = nil; if (self.schemeWeaponConfigViewController.view.superview == nil) self.schemeWeaponConfigViewController = nil; - if (self.helpPage.view.superview == nil) - self.helpPage = nil; + //if (self.helpPage.view.superview == nil) + // self.helpPage = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } @@ -407,7 +410,7 @@ self.schemeWeaponConfigViewController = nil; self.teamConfigViewController = nil; self.mapConfigViewController = nil; - self.helpPage = nil; + //self.helpPage = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; } @@ -419,7 +422,7 @@ releaseAndNil(schemeWeaponConfigViewController); releaseAndNil(teamConfigViewController); releaseAndNil(mapConfigViewController); - releaseAndNil(helpPage); + //releaseAndNil(helpPage); [super dealloc]; } diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/HWUtils.h --- a/project_files/HedgewarsMobile/Classes/HWUtils.h Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.h Thu May 10 23:21:56 2012 +0200 @@ -41,7 +41,7 @@ +(NSInteger) randomPort; +(void) freePort:(NSInteger) port; +(BOOL) isNetworkReachable; -+(UIView *)mainSDLViewInstance; +//+(UIView *)mainSDLViewInstance; @end diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/HWUtils.m --- a/project_files/HedgewarsMobile/Classes/HWUtils.m Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Thu May 10 23:21:56 2012 +0200 @@ -157,6 +157,7 @@ return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO; } +/* +(UIView *)mainSDLViewInstance { SDL_Window *window = HW_getSDLWindow(); if (window == NULL) { @@ -167,5 +168,6 @@ SDL_uikitview *view = data != NULL ? data->view : nil; return view; } +*/ @end diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/ObjcExports.m --- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Thu May 10 23:21:56 2012 +0200 @@ -18,10 +18,6 @@ #import "ObjcExports.h" -#import "OverlayViewController.h" - -// the reference to the newMenu instance -static OverlayViewController *overlay_instance; #pragma mark - #pragma mark functions called by pascal code @@ -31,17 +27,17 @@ void startLoadingIndicator(void) { // this is the first ojbc function called by engine, so we have to initialize some variables here - overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; - // in order to get rotation events we have to insert the view inside the first view of the second window - [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view]; if ([HWUtils gameType] == gtSave) { [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; + /* overlay_instance.view.backgroundColor = [UIColor blackColor]; overlay_instance.view.alpha = 0.75; overlay_instance.view.userInteractionEnabled = NO; + */ } + /* CGPoint center = overlay_instance.view.center; CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3); @@ -55,13 +51,14 @@ [overlay_instance.loadingIndicator startAnimating]; [overlay_instance.view addSubview:overlay_instance.loadingIndicator]; [overlay_instance.loadingIndicator release]; + */ } void stopLoadingIndicator(void) { - HW_zoomSet(1.7); + //HW_zoomSet(1.7); if ([HWUtils gameType] != gtSave) { - [overlay_instance.loadingIndicator stopAnimating]; - [overlay_instance.loadingIndicator removeFromSuperview]; + //[overlay_instance.loadingIndicator stopAnimating]; + //[overlay_instance.loadingIndicator removeFromSuperview]; [HWUtils setGameStatus:gsInGame]; } // mark the savefile as valid, eg it's been loaded correctly @@ -70,6 +67,7 @@ } void saveFinishedSynching(void) { + /* [UIView beginAnimations:@"fading from save synch" context:NULL]; [UIView setAnimationDuration:1]; overlay_instance.view.backgroundColor = [UIColor clearColor]; @@ -79,14 +77,12 @@ [overlay_instance.loadingIndicator stopAnimating]; [overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; + */ [[UIApplication sharedApplication] setIdleTimerDisabled:NO]; [HWUtils setGameStatus:gsInGame]; } -void clearView(void) { - [overlay_instance clearOverlay]; -} // dummy function to prevent linkage fail int SDL_main(int argc, char **argv) { diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Classes/PascalImports.h --- a/project_files/HedgewarsMobile/Classes/PascalImports.h Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Thu May 10 23:21:56 2012 +0200 @@ -25,7 +25,7 @@ #endif /* add C declarations below for all exported Pascal functions/procedure - * that you want to use + * that you want to use in your non-Pascal code */ void Game(const char *args[]); @@ -33,68 +33,13 @@ void LoadLocaleWrapper(const char *filename); void HW_versionInfo(int *protoNum, char **versionStr); - - void HW_click(void); - void HW_ammoMenu(void); - - void HW_zoomSet(float value); - void HW_zoomIn(void); - void HW_zoomOut(void); - void HW_zoomReset(void); - float HW_zoomFactor(void); - int HW_zoomLevel(void); - - void HW_walkingKeysUp(void); - void HW_otherKeysUp(void); - void HW_allKeysUp(void); - - void HW_walkLeft(void); - 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); - - void HW_chat(void); - void HW_chatEnd(void); - void HW_tab(void); - void HW_screenshot(void); - - void HW_pause(void); - void HW_pauseToggle(void); - BOOL HW_isPaused(void); - void *HW_getSDLWindow(void); void HW_terminate(BOOL andCloseFrontend); - void HW_setCursor(int x, int y); - void HW_getCursor(int *x, int *y); - - BOOL HW_isAmmoMenuOpen(void); - BOOL HW_isAmmoMenuNotAllowed(void); - BOOL HW_isWeaponRequiringClick(void); - BOOL HW_isWeaponTimerable(void); - BOOL HW_isWeaponSwitch(void); - BOOL HW_isWeaponRope(void); - - void HW_setGrenadeTime(int time); - int HW_getGrenadeTime(void); - - void HW_setPianoSound(int snd); - void HW_setWeapon(int whichone); - BOOL HW_isWeaponAnEffect(int whichone); char *HW_getWeaponNameByIndex(int whichone); - char *HW_getWeaponCaptionByIndex(int whichone); - char *HW_getWeaponDescriptionByIndex(int whichone); - - void HW_getAmmoDelays(unsigned char *pointer); - int HW_getAmmoCounts(int *pointer); - + //char *HW_getWeaponCaptionByIndex(int whichone); + //char *HW_getWeaponDescriptionByIndex(int whichone); int HW_getNumberOfWeapons(void); - int HW_getTurnsForCurrentTeam(void); int HW_getMaxNumberOfHogs(void); int HW_getMaxNumberOfTeams(void); diff -r 606acf1f80be -r 0a4c88935902 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu May 10 22:15:31 2012 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu May 10 23:21:56 2012 +0200 @@ -71,6 +71,7 @@ 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD96112073B4D00F2FF04 /* startGameButton.png */; }; 615AD9E9120764CA00F2FF04 /* backButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9E8120764CA00F2FF04 /* backButton.png */; }; 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; }; + 615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */ = {isa = PBXBuildFile; fileRef = 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */; }; 615E755A14E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */; }; 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; }; 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; }; @@ -139,7 +140,6 @@ 6174F7C912CD62E300205D6F /* smallerTitle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */; }; 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E7114AA34C00BA94A9 /* hwengine.pas */; }; 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E9114AA34C00BA94A9 /* hwLibrary.pas */; }; - 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987EC114AA34C00BA94A9 /* PascalExports.pas */; }; 6179881C114AA34C00BA94A9 /* SDLh.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987ED114AA34C00BA94A9 /* SDLh.pas */; }; 6179881F114AA34C00BA94A9 /* uAI.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987F1114AA34C00BA94A9 /* uAI.pas */; }; 61798820114AA34C00BA94A9 /* uAIActions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987F2114AA34C00BA94A9 /* uAIActions.pas */; }; @@ -204,7 +204,6 @@ 61A670C212747DBD00B06CE7 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */; }; 61A976B3136F668500DD9878 /* uCursor.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61A976B2136F668500DD9878 /* uCursor.pas */; }; 61AC067412B2E32D000B52A2 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AC067312B2E32D000B52A2 /* Appirater.m */; }; - 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987FE114AA34C00BA94A9 /* uKeys.pas */; }; 61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B7A33712CC21080086B604 /* StatsPageViewController.m */; }; 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; @@ -389,6 +388,7 @@ 615AD96112073B4D00F2FF04 /* startGameButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = startGameButton.png; path = Resources/Frontend/startGameButton.png; sourceTree = ""; }; 615AD9E8120764CA00F2FF04 /* backButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backButton.png; path = Resources/Frontend/backButton.png; sourceTree = ""; }; 615AD9EA1207654E00F2FF04 /* helpButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpButton.png; path = Resources/Frontend/helpButton.png; sourceTree = ""; }; + 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uInputHandler.pas; path = ../../hedgewars/uInputHandler.pas; sourceTree = SOURCE_ROOT; }; 615E755814E41E8C00FBA131 /* MXAudioPlayerFadeOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MXAudioPlayerFadeOperation.h; path = Classes/MXAudioPlayerFadeOperation.h; sourceTree = ""; }; 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MXAudioPlayerFadeOperation.m; path = Classes/MXAudioPlayerFadeOperation.m; sourceTree = ""; }; 615E76B514E4406400FBA131 /* LICENCE.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = LICENCE.rtf; path = Classes/MGSplitViewController/LICENCE.rtf; sourceTree = ""; }; @@ -503,7 +503,6 @@ 617987E7114AA34C00BA94A9 /* hwengine.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = hwengine.pas; path = ../../hedgewars/hwengine.pas; sourceTree = SOURCE_ROOT; }; 617987E9114AA34C00BA94A9 /* hwLibrary.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = hwLibrary.pas; path = ../../hedgewars/hwLibrary.pas; sourceTree = SOURCE_ROOT; }; 617987EB114AA34C00BA94A9 /* options.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = options.inc; path = ../../hedgewars/options.inc; sourceTree = SOURCE_ROOT; }; - 617987EC114AA34C00BA94A9 /* PascalExports.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = PascalExports.pas; path = ../../hedgewars/PascalExports.pas; sourceTree = SOURCE_ROOT; }; 617987ED114AA34C00BA94A9 /* SDLh.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = SDLh.pas; path = ../../hedgewars/SDLh.pas; sourceTree = SOURCE_ROOT; }; 617987F1114AA34C00BA94A9 /* uAI.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uAI.pas; path = ../../hedgewars/uAI.pas; sourceTree = SOURCE_ROOT; }; 617987F2114AA34C00BA94A9 /* uAIActions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uAIActions.pas; path = ../../hedgewars/uAIActions.pas; sourceTree = SOURCE_ROOT; }; @@ -518,7 +517,6 @@ 617987FB114AA34C00BA94A9 /* uGame.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uGame.pas; path = ../../hedgewars/uGame.pas; sourceTree = SOURCE_ROOT; }; 617987FC114AA34C00BA94A9 /* uGears.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uGears.pas; path = ../../hedgewars/uGears.pas; sourceTree = SOURCE_ROOT; }; 617987FD114AA34C00BA94A9 /* uIO.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uIO.pas; path = ../../hedgewars/uIO.pas; sourceTree = SOURCE_ROOT; }; - 617987FE114AA34C00BA94A9 /* uKeys.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uKeys.pas; path = ../../hedgewars/uKeys.pas; sourceTree = SOURCE_ROOT; }; 617987FF114AA34C00BA94A9 /* uLand.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLand.pas; path = ../../hedgewars/uLand.pas; sourceTree = SOURCE_ROOT; }; 61798800114AA34C00BA94A9 /* uLandGraphics.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandGraphics.pas; path = ../../hedgewars/uLandGraphics.pas; sourceTree = SOURCE_ROOT; }; 61798801114AA34C00BA94A9 /* uLandObjects.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandObjects.pas; path = ../../hedgewars/uLandObjects.pas; sourceTree = SOURCE_ROOT; }; @@ -1126,6 +1124,7 @@ 9283015C0F10E48900CC5A3C /* Pascal Sources */ = { isa = PBXGroup; children = ( + 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */, 61798892114AA56300BA94A9 /* inc */, 61D08D7114AEA7FE0007C078 /* uGearsHedgehog.pas */, 61D08D7214AEA7FE0007C078 /* uGearsList.pas */, @@ -1152,7 +1151,6 @@ 61E1F4F711D004240016A5AA /* adler32.pas */, 617987E7114AA34C00BA94A9 /* hwengine.pas */, 617987E9114AA34C00BA94A9 /* hwLibrary.pas */, - 617987EC114AA34C00BA94A9 /* PascalExports.pas */, 617987ED114AA34C00BA94A9 /* SDLh.pas */, 617987F1114AA34C00BA94A9 /* uAI.pas */, 617987F2114AA34C00BA94A9 /* uAIActions.pas */, @@ -1167,7 +1165,6 @@ 617987FB114AA34C00BA94A9 /* uGame.pas */, 617987FC114AA34C00BA94A9 /* uGears.pas */, 617987FD114AA34C00BA94A9 /* uIO.pas */, - 617987FE114AA34C00BA94A9 /* uKeys.pas */, 617987FF114AA34C00BA94A9 /* uLand.pas */, 61798800114AA34C00BA94A9 /* uLandGraphics.pas */, 61798801114AA34C00BA94A9 /* uLandObjects.pas */, @@ -1518,7 +1515,6 @@ files = ( 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */, 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */, - 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */, 6179881C114AA34C00BA94A9 /* SDLh.pas in Sources */, 6179881F114AA34C00BA94A9 /* uAI.pas in Sources */, 61798820114AA34C00BA94A9 /* uAIActions.pas in Sources */, @@ -1576,7 +1572,6 @@ 6163EE7E11CC2600001C0453 /* SingleWeaponViewController.m in Sources */, 61E1F4F811D004240016A5AA /* adler32.pas in Sources */, 61F904D711DF7DA30068B24D /* WeaponCellView.m in Sources */, - 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */, 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */, 61F2E7CE1205EDE0005734F7 /* AboutViewController.m in Sources */, 6199E839124647DE00DADF8C /* SupportViewController.m in Sources */, @@ -1620,6 +1615,7 @@ 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */, 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */, 615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */, + 615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };