On Sunday 10 May 2009 12:39:12 Christian Ohm wrote:

> Looks nice, and simple enough for 2.2 imo (unless it somehow misbehaves
> with
>
> FBOs, but I doubt that).

It really can't -- unless something truly magical is going on :)

> Just three comments: 
> > +                             char *p = imageData + (3 * ((offY2 + y) * 
> > BACKDROP_HACK_WIDTH + (x
> > + offX2)));
>
> Pointer should be const                 ^

Nope :)

make[3]: Entering directory `/home/ma1flfs/source/warzone-2.2/src'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -DYY_NO_INPUT -D_GNU_SOURCE=1 
-D_REENTRANT -I/usr/include/SDL     -I/usr/include/libpng12        
-I../lib/sqlite3 -DNDEBUG -DDATADIR="\"/usr/local/share/warzone2100\"" 
-DLOCALEDIR="\"/usr/local/share/locale\"" -I..  -g -Wall -Wwrite-strings -O3 
-march=native -fomit-frame-pointer -MT 
multiint.o -MD -MP -MF .deps/multiint.Tpo -c -o multiint.o multiint.c
multiint.c: In function ‘loadMapPreview’:
multiint.c:308: error: assignment of read-only location ‘*p’
multiint.c:309: error: assignment of read-only location ‘*(p + 1u)’
multiint.c:310: error: assignment of read-only location ‘*(p + 2u)’
multiint.c:313: error: assignment of read-only location ‘*p’
multiint.c:314: error: assignment of read-only location ‘*(p + 1u)’
multiint.c:315: error: assignment of read-only location ‘*(p + 2u)’
multiint.c:318: error: assignment of read-only location ‘*p’
multiint.c:319: error: assignment of read-only location ‘*(p + 1u)’
multiint.c:320: error: assignment of read-only location ‘*(p + 2u)’

> Indentation should be with tabs  ^
> The brace should get its own line                             ^

Emacs was misbehaving. Attached the fixed version.

        Florian
Index: src/multiint.c
===================================================================
--- src/multiint.c	(revision 7364)
+++ src/multiint.c	(working copy)
@@ -301,9 +301,25 @@
 			{
 				for (y = (i * scale); y < (i * scale) + scale; y++)
 				{
-					imageData[3 * ((offY2 + y) * BACKDROP_HACK_WIDTH + (x + offX2))] = col;
-					imageData[3 * ((offY2 + y) * BACKDROP_HACK_WIDTH + (x + offX2)) + 1] = col;
-					imageData[3 * ((offY2 + y) * BACKDROP_HACK_WIDTH + (x + offX2)) + 2] = col;
+					char *p = imageData + (3 * ((offY2 + y) * BACKDROP_HACK_WIDTH + (x + offX2)));
+					switch (terrainType(WTile))
+					{
+					case TER_CLIFFFACE:
+						p[0] = col;
+						p[1] = col / 2;
+						p[2] = col / 2;
+						break;
+					case TER_WATER:
+						p[0] = col / 2;
+						p[1] = col / 2;
+						p[2] = 0x80 + (col / 2);
+						break;
+					default:
+						p[0] = col;
+						p[1] = col;
+						p[2] = col;
+						break;
+					}
 				}
 			}
 			WTile += 1;
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to