Opened 9 years ago

Closed 8 years ago

Last modified 9 years ago

#1157 closed bug (fixed (in master))

SDL interface: 8x8 tiles show no floor because floor is treated as the transparency colour.

Reported by: angband@… Owned by: takkaria
Milestone: 3.3.0 Keywords: sdl graphics
Cc:

Description

In the 8x8 tileset, the first tile is the "floor" when lit. This tile has had it's first pixel chosen as the "transparency" colour for the 8x8 tiles - which is fine for monsters/traps/loot, but it means that the floor is also being treated as transparent.

The end effect is that there is no indication of whether an area is lit, where the torch-light extends to, etc. The user is walking in perpetual darkness.

Setting the floor tile definition to a different tile and making it a slightly different shade of grey results in the floor being drawn as expected again, but terrain tiles that should be being drawn "on the floor" like stairs are still drawn over the darkness/background colour instead (so look perpetually unlit).

This could be fixed in few ways:

  1. Draw the "transparent" colour itself on any lit square by default in the SDL interface code.
  2. Modify the 8x8 tile file so that there is a new "floor" tile and all feature tiles that should have been drawn on the floor are updated to use the new floor tile's colour instead of the transparency colour (though that may then affect "unlit" feature tiles)
  3. Since the file is a png, actually create the transparency where required in the file itself rather than using SDL to "pick" a transparency colour

I'm happy to help modify the 8x8 tiles themselves if needed.

Change History (12)

comment:1 Changed 9 years ago by magnate

  • Keywords sdl graphics added
  • Milestone changed from Triage to 3.1.3

comment:2 Changed 9 years ago by mcfall.iain@…

There is a really easy way to fix this (if I'm reading it correctly):

sdl_main.c: line 383:

{"8x8", "8x8.png", 8, 8, "old", 0, 0, TRUE},

The 0, 0 numbers are the x and y position of a transparent pixel on '8x8.png' -
just find a pixel which is the correct colour...

comment:3 Changed 9 years ago by angband@…

I wish it were that simple.

The biggest issue is that the 8x8 tile were never really designed with transparency in mind as far as I can see. For the current png file, the lit floor colour IS the correct background "transparency" colour for monsters, etc. But it's ALSO the lit floor colour. If it's made transparent all the time, there's no floor or torchlight.

I've been playing around with adding transparency to the png file, and making things that should be floor-transparent use transparency for the background rather than the lit floor colour as the background - and shifting the pixel definition to point to a transparent pixel.

What I'm finding is:

  • Stairs can either be perma-lit (if using the lit floor background), or perma-dark (if using transparent background).
  • Same for traps - either perma-lit, or perma-dark. Can't be both.

In the 8x8 tiles, there is only a single tile drawn for stairs/traps/etc. I've noticed that in the 16x16 and 32x32 tiles they actually draw 3 different variations of terrain tiles - one representing "dark", one "lit" and one "in field-of-view". How is the usage of the 2 other tiles defined? I can only find 1 actual definition per terrain tile in the pref files...so how are the dark and field-of-view versions being found/used?

comment:4 Changed 9 years ago by angband@…

Ok, it's taken me a while to get the time to trace what the other graphics tilesets are doing to work out what's needed to fix the 8x8 ones.

The other 2 tilesets are drawing multiple versions of the terrain tiles, and only indexing the standard lit version. The bright-light and dark versions are then being found by shifting the indexes in cave.c in the functions special_lighting_floor(..) and special_wall_display(..).

I'll start adding the additional terrain tiles needed to the 8x8 tileset this weekend.

comment:5 Changed 9 years ago by angband@…

Ok - I can't seem to attach the patch tar file directly here, so I've uploaded it to http://www.dawnmist.net/angband/8x8_graf_patch.tar.gz.

It contains:

  • replacement 8x8 tiles in both .bmp and .png, with dark/normal/bright versions of all tiles that looked like terrain tiles (including ones not used by vanilla angband). Note that the original terrain tiles are unchanged.
  • patch for lib/pref/graf-xxx.pref to move the terrain tile definitions to the new dark/lit/bright terrain sets.
  • patch for cave.c to handle lighting on the 8x8 tiles.
  • patch for main-sdl.c to shift the transparency definition to a point where the png file is transparent.

As a bonus, field of view lighting/torch light/special colours are now handled in the 8x8 tiles (they weren't before).

comment:6 Changed 9 years ago by angband@…

Forgot to update a comment in the patch when I got dark-stairs/doors/traps working, so have just re-uploaded the tar file. Same location.

comment:7 Changed 9 years ago by magnate

  • Milestone changed from 3.2.0 to 3.3.0

Punting to 3.3: non-urgent bug or change.

comment:8 Changed 9 years ago by magnate

  • Status changed from new to confirmed

comment:9 Changed 9 years ago by takkaria

  • Owner set to takkaria
  • Status changed from confirmed to assigned

Dawnmist, really sorry for not seeing this earlier. I'll get it as soon after 3.2 as possible, thanks for your time in putting this together!

comment:10 Changed 9 years ago by takkaria

  • Status changed from assigned to pending

In takkaria/angband/graphics-refactor as of e4abb60. Thanks a lot, these are pretty. :)

comment:11 Changed 9 years ago by takkaria

in staging as of [73775de9117f]

comment:12 Changed 8 years ago by magnate

  • Resolution set to fixed
  • Status changed from pending to closed

In master with [r296ffa6]

Note: See TracTickets for help on using tickets.