- Store sky color in theme cfg file
authorunc0rr
Fri, 01 Feb 2008 16:39:37 +0000
changeset 780 f45b0e513dfd
parent 779 cb18225a150a
child 781 4101f0f1c0b9
- Store sky color in theme cfg file - Repair water
hedgewars/SDLh.pas
hedgewars/uLandObjects.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Themes/Volcano/theme.cfg
share/hedgewars/Data/Themes/avematan/theme.cfg
share/hedgewars/Data/Themes/bubbles/theme.cfg
share/hedgewars/Data/Themes/cheese/theme.cfg
share/hedgewars/Data/Themes/norsk/theme.cfg
share/hedgewars/Data/Themes/steel/Clouds.32.png
share/hedgewars/Data/Themes/steel/theme.cfg
share/hedgewars/Data/Themes/tibet/Sky.png
share/hedgewars/Data/Themes/tibet/theme.cfg
share/hedgewars/Data/Themes/wood/theme.cfg
share/hedgewars/Data/Themes/xtheme/theme.cfg
--- a/hedgewars/SDLh.pas	Thu Jan 31 20:01:07 2008 +0000
+++ b/hedgewars/SDLh.pas	Fri Feb 01 16:39:37 2008 +0000
@@ -122,8 +122,6 @@
                            b: Byte;
                            unused: Byte;
                           );
-(* workaround over freepascal bug.
-   See http://www.freepascal.org/mantis/view.php?id=7613 for details *)
                        1: (value: Longword);
                   end;
 
--- a/hedgewars/uLandObjects.pas	Thu Jan 31 20:01:07 2008 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Feb 01 16:39:37 2008 +0000
@@ -359,7 +359,8 @@
 Assign(f, s);
 {$I-}
 Reset(f);
-Readln(f, s); // skip color
+Readln(f, s); // skip sky color
+Readln(f, s); // skip border color
 Readln(f, ThemeObjects.Count);
 for i:= 0 to Pred(ThemeObjects.Count) do
     begin
--- a/hedgewars/uMisc.pas	Thu Jan 31 20:01:07 2008 +0000
+++ b/hedgewars/uMisc.pas	Fri Feb 01 16:39:37 2008 +0000
@@ -55,7 +55,6 @@
     GameTicks     : LongWord = 0;
 
     cSkyColor     : Longword = 0;
-    cWaterColor   : Longword = $FF005ACE;
     cWhiteColor   : Longword = $FFFFFFFF;
     cConsoleSplitterColor : Longword = $FFFF0000;
     cColorNearBlack       : Longword = $FF000010;
--- a/hedgewars/uStore.pas	Thu Jan 31 20:01:07 2008 +0000
+++ b/hedgewars/uStore.pas	Fri Feb 01 16:39:37 2008 +0000
@@ -227,44 +227,25 @@
           end
     end;
 
-    procedure GetSkyColor;
-//    var p: PByteArray;
-    begin
-(*    if SDL_MustLock(SpritesData[sprSky].Surface) then
-       SDLTry(SDL_LockSurface(SpritesData[sprSky].Surface) >= 0, true);
-    p:= SpritesData[sprSky].Surface^.pixels;
-    case SpritesData[sprSky].Surface^.format^.BytesPerPixel of
-         1: cSkyColor:= PByte(p)^;
-         2: cSkyColor:= PWord(p)^;
-         3: cSkyColor:= (p^[0]) or (p^[1] shl 8) or (p^[2] shl 16);
-         4: cSkyColor:= PLongword(p)^;
-         end;*)
-    cSkyColor:= $3030A0;
-    glClearColor((cSkyColor shr 16) / 255, ((cSkyColor shr 8) and $FF) / 255, (cSkyColor and $FF) / 255, 0);
-
-//    if SDL_MustLock(SpritesData[sprSky].Surface) then
-//       SDL_UnlockSurface(SpritesData[sprSky].Surface)
-    end;
-
     procedure GetExplosionBorderColor;
     var f: textfile;
-        c: LongInt;
+        s1, s2: shortstring;
+        c1, c2: TSDL_Color;
     begin
     s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename;
     WriteToConsole(msgLoading + s + ' ');
     Assign(f, s);
     {$I-}
     Reset(f);
-    Readln(f, s);
+    Readln(f, c1.r, c1.g, c1. b);
+    Readln(f, c2.r, c2.g, c2. b);
     Close(f);
     {$I+}
     TryDo(IOResult = 0, msgFailed, true);
     WriteLnToConsole(msgOK);
-    val(s, cExplosionBorderColor, c);
-    TryDo(c = 0, 'Theme data corrupted', true);
-    cExplosionBorderColor:= (cExplosionBorderColor shr 16) or
-                            (cExplosionBorderColor and $FF) or
-                            (cExplosionBorderColor shl 16) or
+
+    glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); // sky color
+    cExplosionBorderColor:= c2.value or
                             $FF000000
     end;
 
@@ -305,8 +286,6 @@
          if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
          end;
 
-GetSkyColor;
-
 AddProgress;
 
 tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, true, true, true);
--- a/hedgewars/uWorld.pas	Thu Jan 31 20:01:07 2008 +0000
+++ b/hedgewars/uWorld.pas	Fri Feb 01 16:39:37 2008 +0000
@@ -195,10 +195,19 @@
 if r.y < cScreenHeight then
    begin
    if r.y < 0 then r.y:= 0;
-   r.h:= cScreenHeight - r.y;
-   r.x:= 0;
-   r.w:= cScreenWidth;
-//   SDL_FillRect(Surface, @r, cWaterColor)
+
+   glDisable(GL_TEXTURE_2D);
+   glBegin(GL_QUADS);
+    glColor3ub(0, $5A, $CE); // water color
+    glVertex2i(0, r.y);
+    glVertex2i(cScreenWidth, r.y);
+    glColor3ub(0, $40, $B3); // deep water color
+    glVertex2i(cScreenWidth, cScreenHeight);
+    glVertex2i(0, cScreenHeight);
+   glEnd();
+
+   glColor4f(1, 1, 1, 1); // disable coloring
+   glEnable(GL_TEXTURE_2D)
    end;
 
 DrawGears(Surface);
--- a/share/hedgewars/Data/Themes/Volcano/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/Volcano/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-5129753
+231 125 239
+78 70 25
 2
 tree
 0 253 23 1 1 0 0 138 190
--- a/share/hedgewars/Data/Themes/avematan/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/avematan/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-8388608
+24 8 165
+128 0 0
 5
 a
 65 220 45 1 1 0 0 186 180
--- a/share/hedgewars/Data/Themes/bubbles/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/bubbles/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-2829989
+24 0 165
+43 46 165
 1
 round
 90 242 10 1 3 0 0 97 97 63 61 95 115 100 190 67 26
--- a/share/hedgewars/Data/Themes/cheese/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/cheese/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,3 +1,4 @@
-11644721
+222 223 132
+177 175 49
 0
 0
--- a/share/hedgewars/Data/Themes/norsk/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/norsk/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-32896
+24 0 165
+0 128 128
 1
 tree
 67 218 42 2 1 0 0 180 182
Binary file share/hedgewars/Data/Themes/steel/Clouds.32.png has changed
--- a/share/hedgewars/Data/Themes/steel/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/steel/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-2105376
+192 192 192
+32 32 32
 2
 01
 4 175 114 2 1 0 0 122 132
Binary file share/hedgewars/Data/Themes/tibet/Sky.png has changed
--- a/share/hedgewars/Data/Themes/tibet/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/tibet/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-4989440
+188 70 133
+76 34 0
 5
 chha
 26 118 94 9 2 5 9 127 94 135 2 29 29
--- a/share/hedgewars/Data/Themes/wood/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/wood/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-5129753
+231 125 239
+78 70 25
 2
 tree
 41 224 22 1 1 0 0 105 203
--- a/share/hedgewars/Data/Themes/xtheme/theme.cfg	Thu Jan 31 20:01:07 2008 +0000
+++ b/share/hedgewars/Data/Themes/xtheme/theme.cfg	Fri Feb 01 16:39:37 2008 +0000
@@ -1,4 +1,5 @@
-8388608
+231 125 239
+128 0 0
 4
 plant1
 35 127 29 1 2 12 7 63 108 75 26 49 52