(svn r756) Demystify and explain some piece of code regarding which house sprite to draw

This commit is contained in:
tron 2004-11-22 10:09:37 +00:00
parent 6d81770985
commit 40a04816a4
1 changed files with 10 additions and 6 deletions

View File

@ -52,12 +52,16 @@ static void DrawTile_Town(TileInfo *ti)
/* Retrieve pointer to the draw town tile struct */ /* Retrieve pointer to the draw town tile struct */
{ {
uint hash, t; /* this "randomizes" on the (up to) 4 variants of a building */
hash = ti->x >> 4; byte gfx = _map2[ti->tile];
hash ^= hash>>2; byte stage = _map3_lo[ti->tile] >> 6;
hash ^= (t=(ti->y >> 4)); uint variant;
hash -= t>>2; variant = ti->x >> 4;
dcts = &_town_draw_tile_data[((_map2[ti->tile]<<4)|(_map3_lo[ti->tile]>>6)|((hash&3)<<2))]; variant ^= ti->x >> 6;
variant ^= ti->y >> 4;
variant -= ti->y >> 6;
variant &= 3;
dcts = &_town_draw_tile_data[gfx << 4 | variant << 2 | stage];
} }
z = ti->z; z = ti->z;