[Freeciv-Dev] (PR#8128) don't do darkness via dithering
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8128 >
Oops.
This patch moved darkness drawing down to the end, so darkness sprites
are drawn over everything. This means darkness is drawn over some
sprites wrongly. See ftp://ftp.freeciv.org/freeciv/incoming/whale.png.
This patch moves the drawing of darkness sprites up. Darkness is now
drawn on top of base terrain, rivers, and road/rail, but underneath
other specials.
To do things correctly from a 3d perspective, darkness should probably
be drawn in 2 steps like fortresses. The darkness behind (on the tiles
above the current tile) should be drawn early, so it shows up behind
units, specials, etc. The darkness in front (on the tiles below the
current tile) is drawn later, so it shows up in front of units,
specials, etc. This may be a bit too much since iso-view isn't really
3d (the tilesets just make it look like it is).
jason
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.150
diff -u -r1.150 tilespec.c
--- client/tilespec.c 18 Mar 2004 20:00:24 -0000 1.150
+++ client/tilespec.c 18 Mar 2004 20:34:13 -0000
@@ -2080,6 +2080,19 @@
sprs += fill_road_rail_sprite_array(sprs,
tspecial, tspecial_near, pcity);
+ /* Add darkness sprites. */
+ for (dir = 0; dir < 4; dir++) {
+ int x1, y1;
+ const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ int offsets[4][2] = {{W / 2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}};
+
+ if (MAPSTEP(x1, y1, x, y, DIR4_TO_DIR8[dir])
+ && tile_get_known(x1, y1) == TILE_UNKNOWN) {
+ ADD_SPRITE(sprites.tx.darkness[dir],
+ offsets[dir][0], offsets[dir][1]);
+ }
+ }
+
if (draw_specials) {
if (contains_special(tspecial, S_SPECIAL_1)) {
ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
@@ -2127,19 +2140,6 @@
else
other = ttype_near[dir];
dither[dir] = get_dither(ttype, other);
- }
- }
-
- /* Add darkness sprites. */
- for (dir = 0; dir < 4; dir++) {
- int x1, y1;
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
- int offsets[4][2] = {{W / 2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}};
-
- if (MAPSTEP(x1, y1, x, y, DIR4_TO_DIR8[dir])
- && tile_get_known(x1, y1) == TILE_UNKNOWN) {
- ADD_SPRITE(sprites.tx.darkness[dir],
- offsets[dir][0], offsets[dir][1]);
}
}
|
|