--- a/hedgewars/hwengine.dpr Wed Jul 08 12:53:36 2009 +0000
+++ b/hedgewars/hwengine.dpr Wed Jul 08 15:03:57 2009 +0000
@@ -72,7 +72,9 @@
////////////////////////////////
procedure DoTimer(Lag: LongInt);
+{$IFNDEF IPHONEOS}
var s: string;
+{$ENDIF}
begin
inc(RealTicks, Lag);
@@ -141,7 +143,7 @@
SendKB;
CloseIPC;
TTF_Quit;
-{$IFNDEF IPHONEOS}
+{$IFNDEF IPHONEOS or DEBUGFILE}
//i know it is not clean but it is better than a crash
SDL_Quit;
{$ENDIF}
@@ -169,8 +171,11 @@
repeat
while SDL_PollEvent(@event) <> 0 do
case event.type_ of
- {thinker here for adding touch events}
+ {$IFDEF IPHONEOS}
+ SDL_MOUSEMOTION: WriteLnToConsole('mouse number ' + inttostr(SDL_SelectMouse(event.motion.which)) + ' over ' + inttostr(SDL_GetNumMice()));
+ {$ELSE}
SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
+ {$ENDIF}
SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
cHasFocus:= event.active.gain = 1;
//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
--- a/hedgewars/uConsts.pas Wed Jul 08 12:53:36 2009 +0000
+++ b/hedgewars/uConsts.pas Wed Jul 08 15:03:57 2009 +0000
@@ -171,16 +171,30 @@
MAXNAMELEN = 192;
- LAND_WIDTH = 4096;
+ {* REFERENCE
+ 4096 -> $FFFFF000
+ 2048 -> $FFFFF800
+ 1024 -> $FFFFFC00
+ 512 -> $FFFFFE00 *}
+
+{$IFDEF IPHONEOS or LOWRES}
+ LAND_WIDTH = 2048;
+ LAND_HEIGHT = 1024;
+ LAND_WIDTH_MASK = $FFFFF800;
+ LAND_HEIGHT_MASK = $FFFFFC00;
+{$ELSE}
+ LAND_WIDTH = 4096;
LAND_HEIGHT = 2048;
LAND_WIDTH_MASK = $FFFFF000;
LAND_HEIGHT_MASK = $FFFFF800;
+{$ENDIF}
- COLOR_LAND = $FFFFFFFF; // white
- COLOR_INDESTRUCTIBLE = $FF0000FF; // red
+ COLOR_LAND = $FFFF; // white
+ COLOR_INDESTRUCTIBLE = $88FF; // red
- // some opengl headers do not have these macros
- GL_BGR = $80E0;
+
+ //some opengl headers do not have these macros
+ GL_BGR = $80E0;
GL_BGRA = $80E1;
cifRandomize = $00000001;
--- a/hedgewars/uLand.pas Wed Jul 08 12:53:36 2009 +0000
+++ b/hedgewars/uLand.pas Wed Jul 08 15:03:57 2009 +0000
@@ -27,10 +27,11 @@
uConsts;
{$include options.inc}
type TLandArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of LongWord;
+TCollisionArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of Word;
TPreview = packed array[0..127, 0..31] of byte;
TDirtyTag = packed array[0 .. LAND_HEIGHT div 32 - 1, 0 .. LAND_WIDTH div 32 - 1] of byte;
-var Land: TLandArray;
+var Land: TCollisionArray;
LandPixels: TLandArray;
LandDirty: TDirtyTag;
hasBorder: boolean; // I'm putting this here for now. I'd like it to be toggleable by user (so user can set a border on a non-cave map) - will turn off air attacks
@@ -655,8 +656,11 @@
begin
if (($FF000000 and p^[x]) = 0) then // Tiy was having trouble generating transparent black
Land[cpY + y, cpX + x]:= 0
- else
- Land[cpY + y, cpX + x]:= p^[x];
+ else if p^[x] = $FF0000FF then
+ Land[cpY + y, cpX + x]:= COLOR_INDESTRUCTIBLE
+ else if p^[x] = $FFFFFFFF then
+ Land[cpY + y, cpX + x]:= COLOR_LAND;
+
end;
p:= @(p^[tmpsurf^.pitch div 4]);
end;