# HG changeset patch # User unc0rr # Date 1237732342 0 # Node ID 644f93d8f148eace7f37bfabb59612444bf84913 # Parent b1ec8db513f2c77b2a2e46dffd837e484d29416a Apply koda's OpenGL ES compatibility patch diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/SDLh.pas Sun Mar 22 14:32:22 2009 +0000 @@ -51,8 +51,7 @@ {$linkframework AudioUnit} {$linkframework Quicktime} {$linkframework IOKit} -{for SDL1.3 {$linkframework ForceFeedback}} -{for SDL1.3 {$linkframework CoreAudio}} +{add ForceFeedback and CoreAudio frameworks when you use SDL-1.3} {$ENDIF} (* SDL *) diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/hwengine.dpr --- a/hedgewars/hwengine.dpr Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/hwengine.dpr Sun Mar 22 14:32:22 2009 +0000 @@ -23,7 +23,11 @@ program hwengine; uses SDLh, +{$IFDEF IPHONE} + gles11, +{$ELSE} GL, +{$ENDIF} uConsts in 'uConsts.pas', uGame in 'uGame.pas', uMisc in 'uMisc.pas', diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uConsts.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,16 @@ unit uConsts; interface -uses SDLh, GL, uLocale; + +uses + SDLh, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uLocale; + {$INCLUDE options.inc} {$INCLUDE proto.inc} type diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uGears.pas Sun Mar 22 14:32:22 2009 +0000 @@ -74,7 +74,12 @@ implementation uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, - uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL, + uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} uStats, uVisualGears; const MAXROPEPOINTS = 384; @@ -653,6 +658,7 @@ hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite` lx, ly, dx, dy, ax, ay, aAngle, dAngle: real; // laser, change defaultPos, HatVisible: boolean; + VertexBuffer: array [0..1] of TVertex2f; begin if (Gear^.State and gstHHDeath) <> 0 then begin @@ -1080,11 +1086,16 @@ begin glDisable(GL_TEXTURE_2D); glEnable(GL_LINE_SMOOTH); - glBegin(GL_LINES); + glColor4ub($FF, $00, $00, $C0); - glVertex2i(hx + WorldDx, hy + WorldDy); - glVertex2i(tx + WorldDx, ty + WorldDy); - glEnd(); + VertexBuffer[0].X:= hx + WorldDx; + VertexBuffer[0].Y:= hy + WorldDy; + VertexBuffer[1].X:= tx + WorldDx; + VertexBuffer[1].Y:= ty + WorldDy; + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); + glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); glColor4f(1, 1, 1, 1); glEnable(GL_TEXTURE_2D); glDisable(GL_LINE_SMOOTH); diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uLand.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,13 @@ unit uLand; interface -uses SDLh, uLandTemplates, uFloat, GL, uConsts; +uses SDLh, uLandTemplates, uFloat, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uConsts; {$include options.inc} type TLandArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of LongWord; TPreview = packed array[0..127, 0..31] of byte; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uLandObjects.pas Sun Mar 22 14:32:22 2009 +0000 @@ -27,7 +27,13 @@ procedure AddOnLandObjects(Surface: PSDL_Surface); implementation -uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, GL, uSound, uWorld; +uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uSound, uWorld; const MaxRects = 512; MAXOBJECTRECTS = 16; MAXTHEMEOBJECTS = 32; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uLandTexture.pas Sun Mar 22 14:32:22 2009 +0000 @@ -25,7 +25,13 @@ procedure FreeLand; implementation -uses uMisc, uLand, uStore, GL, uConsts; +uses uMisc, uLand, uStore, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uConsts; const TEXSIZE = 256; LANDTEXARW = LAND_WIDTH div TEXSIZE; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uMisc.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,13 @@ unit uMisc; interface -uses uConsts, SDLh, uFloat, GL; +uses uConsts, SDLh, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uFloat; {$INCLUDE options.inc} var isCursorVisible : boolean = false; @@ -444,7 +450,7 @@ byte(DecodeBase64[0]):= t - 1 end; -const GL_BGR = $80E0; // some opengl headers don't have that const (?) +const GL_BGR = $80E0; // some opengl headers don't have that const (?)' procedure MakeScreenshot(s: shortstring); const head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); var p: Pointer; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uStore.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,13 @@ unit uStore; interface -uses uConsts, uTeams, SDLh, uFloat, GL; +uses uConsts, uTeams, SDLh, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} +uFloat; {$INCLUDE options.inc} procedure StoreInit; @@ -50,7 +56,7 @@ ConfirmTexture: PTexture; implementation -uses uMisc, uConsole, uLand, uLocale, GLU; +uses uMisc, uConsole, uLand, uLocale; var HHTexture: PTexture; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uTeams.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,13 @@ unit uTeams; interface -uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, GL, uSound; +uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uSound; {$INCLUDE options.inc} type PHHAmmo = ^THHAmmo; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uVisualGears.pas Sun Mar 22 14:32:22 2009 +0000 @@ -18,7 +18,13 @@ unit uVisualGears; interface -uses SDLh, uConsts, uFloat, GL; +uses SDLh, uConsts, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} + uFloat; {$INCLUDE options.inc} const AllInactive: boolean = false; diff -r b1ec8db513f2 -r 644f93d8f148 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sat Mar 21 10:49:58 2009 +0000 +++ b/hedgewars/uWorld.pas Sun Mar 22 14:32:22 2009 +0000 @@ -39,7 +39,12 @@ WaterColor, DeepWaterColor: TSDL_Color; implementation -uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, GL, +uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, +{$IFDEF IPHONE} + gles11, +{$ELSE} + GL, +{$ENDIF} uAmmos, uVisualGears, uChat, uLandTexture, uLand; const FPS: Longword = 0;