--- a/hedgewars/CCHandlers.inc Sat Jul 10 18:43:28 2010 +0200
+++ b/hedgewars/CCHandlers.inc Sun Jul 11 03:23:26 2010 +0200
@@ -499,17 +499,21 @@
procedure chSetWeapon(var s: shortstring);
begin
-if (s[0] <> #1) or CheckNoTeamOrHH then exit;
+ if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-if TAmmoType(s[1]) > High(TAmmoType) then exit;
+ if TAmmoType(s[1]) > High(TAmmoType) then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
+ if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
-with CurrentHedgehog^.Gear^ do
+ with CurrentHedgehog^.Gear^ do
begin
- Message:= Message or gm_Weapon;
- MsgParam:= byte(s[1])
- end
+ Message:= Message or gm_Weapon;
+ MsgParam:= byte(s[1]);
+ end;
+
+{$IFDEF IPHONEOS}
+ savedAmmoType:= TAmmoType(s[1]);
+{$ENDIF}
end;
procedure chTaunt(var s: shortstring);
--- a/hedgewars/PascalExports.pas Sat Jul 10 18:43:28 2010 +0200
+++ b/hedgewars/PascalExports.pas Sun Jul 11 03:23:26 2010 +0200
@@ -13,7 +13,7 @@
unit PascalExports;
interface
-uses uKeys, GLunit, uWorld, uMisc, uConsole, hwengine;
+uses uKeys, GLunit, uWorld, uMisc, uGears, uConsole, uTeams, uConsts, hwengine;
{$INCLUDE "config.inc"}
@@ -184,14 +184,30 @@
CursorPoint.Y:= yy;
end
else
+ begin
xx:= CursorPoint.X;
yy:= CursorPoint.Y;
+ end;
end;
-function HW_isAmmoOpen:boolean; cdecl; export;
+function HW_isAmmoOpen: boolean; cdecl; export;
begin
exit(bShowAmmoMenu);
end;
+
+function HW_isWeaponRequiringClick: boolean; cdecl; export;
+begin
+ exit( (savedAmmoType = amTeleport) or
+ (savedAmmoType = amBee) or
+ (savedAmmoType = amAirAttack) or
+ (savedAmmoType = amMineStrike) or
+ (savedAmmoType = amGirder) or
+ (savedAmmoType = amNapalm) or
+ (savedAmmoType = amPiano)
+ )
+end;
+
+//amSwitch
{$ENDIF}
end.
--- a/hedgewars/uConsts.pas Sat Jul 10 18:43:28 2010 +0200
+++ b/hedgewars/uConsts.pas Sun Jul 11 03:23:26 2010 +0200
@@ -298,6 +298,7 @@
{$IFDEF IPHONEOS}
cMaxCaptions = 3;
cDefaultZoomLevel = 1.5;
+ savedAmmoType : TAmmoType = amNothing;
{$ELSE}
cMaxCaptions = 4;
cDefaultZoomLevel = 2.0;
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Jul 10 18:43:28 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sun Jul 11 03:23:26 2010 +0200
@@ -396,18 +396,19 @@
// and remove the label (if any)
[[self.view viewWithTag:5599] removeFromSuperview];
} else {
- // TODO: only do this if the weapon does require a further click
- // if no click, then ask for tapping again
- CGPoint currentPosition = [[touches anyObject] locationInView:self.view];
- UILabel *tapAgain = [[UILabel alloc] initWithFrame:CGRectMake(currentPosition.x-100, currentPosition.y + 10, 200, 25)];
- tapAgain.text = NSLocalizedString(@"Tap again to confirm",@"from the overlay");
- tapAgain.backgroundColor = [UIColor clearColor];
- tapAgain.tag = 5599;
- tapAgain.textColor = [UIColor blueColor];
- tapAgain.textAlignment = UITextAlignmentCenter;
- tapAgain.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
- [self.view addSubview:tapAgain];
- [tapAgain release];
+ // if weapon requires a further click, ask for tapping again
+ if (HW_isWeaponRequiringClick()) {
+ CGPoint currentPosition = [[touches anyObject] locationInView:self.view];
+ UILabel *tapAgain = [[UILabel alloc] initWithFrame:CGRectMake(currentPosition.x-100, currentPosition.y + 10, 200, 25)];
+ tapAgain.text = NSLocalizedString(@"Tap again to confirm",@"from the overlay");
+ tapAgain.backgroundColor = [UIColor clearColor];
+ tapAgain.tag = 5599;
+ tapAgain.textColor = [UIColor blueColor];
+ tapAgain.textAlignment = UITextAlignmentCenter;
+ tapAgain.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
+ [self.view addSubview:tapAgain];
+ [tapAgain release];
+ }
}
pointWhereToClick = CGPointZero;
@@ -432,9 +433,10 @@
isSingleClick = NO;
currentPosition = [touch locationInView:self.view];
if (HW_isAmmoOpen()) {
- DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y));
+ // saves the point on which to select the ammo
+ pointWhereToClick = currentPosition;
+ // moves the cursor over
HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
- pointWhereToClick = currentPosition;
} else {
DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y));
HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h Sat Jul 10 18:43:28 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Sun Jul 11 03:23:26 2010 +0200
@@ -56,7 +56,9 @@
void HW_setLandscape(BOOL);
void HW_setCursor(int x, int y);
void HW_saveCursor(BOOL reset);
+
BOOL HW_isAmmoOpen(void);
+ BOOL HW_isWeaponRequiringClick(void);
#ifdef __cplusplus
}
#endif