Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday 10 May 2009 14:08:39 Per Inge Mathisen wrote: > Looks good on little egypt, but way too crisp red on other, more normal > maps. Actually, whats wrong with a really strong contrast? The map preview was never intended to look overly pretty, I figured it should be functional first and foremost. Anyways, could anyone please apply _something_; as the patch really helps with maps spit out with my random map generator :) Florian ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On 5/10/09, Florian Schanda wrote: > Hi all, > > attached is a patch for 2.2 which will show water in blue and cliffs red on > the skirmish / mp map preview. > > > Florian > Back when I was screwing around with this code, you almost need 3 different color pallets, one for each tileset, to make it look good on all maps, and even then, there is the oddball map that throws the color scheme out of whack. Perhaps we should have a 'cycle color pallet' control somewhere? ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sun, May 10, 2009 at 2:21 PM, Florian Schanda wrote: > On Sunday 10 May 2009 13:18:01 Per Inge Mathisen wrote: >> Trying some more, I came up with >> >> + case TER_CLIFFFACE: >> + p[0] = 255 - col; >> + p[1] = 255 - col; >> + p[2] = 255 - col; >> >> which looks like http://imagebin.ca/view/HfxvMy7.html > > I still think we should give it some primary colour to make cliffs stand out. > For example the above won't show cliffs on terrain which is 128 high. > > Red seemed the obvious choice -- not only does it have an association of "you > can't pass" its also the only other colour not really used on the preview -- > green being structures and blue being water / and the GUI. And yellow > wouldn't stand out enough v.s. the white I think. A compromise would be http://imagebin.ca/view/N2Zb9d.html which uses a combination of both. But the little egypt map shows a problem with my approach as Christian points out. Also, there is little point in giving water a different blue colour depending on the height. I would rather find a nice blue colour, put it in lib/ivis_opengl/piepalette.c and use it for water. > case TER_CLIFFFACE: > p[0] = 0x80 + (col / 2); > p[1] = 0x40 - (col / 4); > p[2] = 0x40 - (col / 4); > break; Looks good on little egypt, but way too crisp red on other, more normal maps. - Per ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday 10 May 2009 13:32:59 Christian Ohm wrote: > On Sunday, 10 May 2009 at 14:18, Per Inge Mathisen wrote: > > On Sun, May 10, 2009 at 1:56 PM, Florian Schanda > > > > > I also tried, but I think red will stand out the most. Its meant to be > > > only an overview anyway -- to quickly see whats going on on the map. > > > > Trying some more, I came up with > > + case TER_CLIFFFACE: > > + p[0] = 255 - col; > > + p[1] = 255 - col; > > + p[2] = 255 - col; > > which looks like http://imagebin.ca/view/HfxvMy7.html > > That works for most maps I've randomly looked at, but e.g. for Little Egypt > the contrast is very irritating imo > (http://xs839.xs.to/xs839/09190/wz2100_shot_0012565.png vs. > http://xs539.xs.to/xs539/09190/wz2100_shot_0301614.png). Try the following? This will give excellent contrast and is easy to see whats going on. case TER_CLIFFFACE: p[0] = 0x80 + (col / 2); p[1] = 0x40 - (col / 4); p[2] = 0x40 - (col / 4); break; Florian ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday, 10 May 2009 at 14:18, Per Inge Mathisen wrote: > On Sun, May 10, 2009 at 1:56 PM, Florian Schanda > > I also tried, but I think red will stand out the most. Its meant to be only > > an > > overview anyway -- to quickly see whats going on on the map. > Trying some more, I came up with > + case TER_CLIFFFACE: > + p[0] = 255 - col; > + p[1] = 255 - col; > + p[2] = 255 - col; > which looks like http://imagebin.ca/view/HfxvMy7.html That works for most maps I've randomly looked at, but e.g. for Little Egypt the contrast is very irritating imo (http://xs839.xs.to/xs839/09190/wz2100_shot_0012565.png vs. http://xs539.xs.to/xs539/09190/wz2100_shot_0301614.png). ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday 10 May 2009 13:18:01 Per Inge Mathisen wrote: > Trying some more, I came up with > > + case TER_CLIFFFACE: > + p[0] = 255 - col; > + p[1] = 255 - col; > + p[2] = 255 - col; > > which looks like http://imagebin.ca/view/HfxvMy7.html I still think we should give it some primary colour to make cliffs stand out. For example the above won't show cliffs on terrain which is 128 high. Red seemed the obvious choice -- not only does it have an association of "you can't pass" its also the only other colour not really used on the preview -- green being structures and blue being water / and the GUI. And yellow wouldn't stand out enough v.s. the white I think. Florian ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday 10 May 2009 13:11:55 Christian Ohm wrote: > > > Pointer should be const ^ > > > > Nope :) > > "char * const p", not "const char *p". Ah, fair. Brain not working yet. Florian Index: src/multiint.c === --- src/multiint.c (revision 7388) +++ 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 * const 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
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sun, May 10, 2009 at 1:56 PM, Florian Schanda wrote: >> Thanks. This is a good idea, and I love the blue water. Is it possible >> to use some other colour than red for cliffs? I tried a few colour >> combinations but got nothing that looked better. > > Thanks :) > > I also tried, but I think red will stand out the most. Its meant to be only an > overview anyway -- to quickly see whats going on on the map. Trying some more, I came up with + case TER_CLIFFFACE: + p[0] = 255 - col; + p[1] = 255 - col; + p[2] = 255 - col; which looks like http://imagebin.ca/view/HfxvMy7.html >> Also, I think the blue component of the water colour could overflow >> (pardon the pun!). > > It shouldn't -- > 0x80 = 128 > 0xff / 2 = 127 (int arithmetic will round down) > > 128 + 127 = 255 == 0xff > > Unless I missed something obvious? No, I wasn't thinking clearly. - Per ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday, 10 May 2009 at 12:46, Florian Schanda wrote: > On Sunday 10 May 2009 12:39:12 Christian Ohm wrote: > > Pointer should be const ^ > Nope :) "char * const p", not "const char *p". ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday 10 May 2009 12:51:43 Per Inge Mathisen wrote: > 2009/5/10 Florian Schanda : > > attached is a patch for 2.2 which will show water in blue and cliffs red > > on the skirmish / mp map preview. > > Thanks. This is a good idea, and I love the blue water. Is it possible > to use some other colour than red for cliffs? I tried a few colour > combinations but got nothing that looked better. Thanks :) I also tried, but I think red will stand out the most. Its meant to be only an overview anyway -- to quickly see whats going on on the map. > Also, I think the blue component of the water colour could overflow > (pardon the pun!). It shouldn't -- 0x80 = 128 0xff / 2 = 127 (int arithmetic will round down) 128 + 127 = 255 == 0xff Unless I missed something obvious? Florian ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
2009/5/10 Florian Schanda : > attached is a patch for 2.2 which will show water in blue and cliffs red on > the skirmish / mp map preview. Thanks. This is a good idea, and I love the blue water. Is it possible to use some other colour than red for cliffs? I tried a few colour combinations but got nothing that looked better. Also, I think the blue component of the water colour could overflow (pardon the pun!). - Per ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
Re: [Warzone-dev] Patch to show cliffs and water on map previews
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
Re: [Warzone-dev] Patch to show cliffs and water on map previews
On Sunday, 10 May 2009 at 10:59, Florian Schanda wrote: > attached is a patch for 2.2 which will show water in blue and cliffs red on > the skirmish / mp map preview. Looks nice, and simple enough for 2.2 imo (unless it somehow misbehaves with FBOs, but I doubt that). Just three comments: > + char *p = imageData + (3 * ((offY2 + y) * > BACKDROP_HACK_WIDTH + (x + offX2))); Pointer should be const ^ > + switch (terrainType(WTile)) { Indentation should be with tabs ^ The brace should get its own line ^ ___ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev
[Warzone-dev] Patch to show cliffs and water on map previews
Hi all, attached is a patch for 2.2 which will show water in blue and cliffs red on the skirmish / mp map preview. Florian Index: src/multiint.c === --- src/multiint.c (revision 7364) +++ src/multiint.c (working copy) @@ -301,9 +301,24 @@ { 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