town_cmd.c
changeset 2493 f6b4300cc2b0
parent 2484 0e45d70ae908
child 2498 3ed05caa4449
equal deleted inserted replaced
2492:b4785c8f3700 2493:f6b4300cc2b0
    76 #include "table/town_land.h"
    76 #include "table/town_land.h"
    77 
    77 
    78 
    78 
    79 static void TownDrawHouseLift(const TileInfo *ti)
    79 static void TownDrawHouseLift(const TileInfo *ti)
    80 {
    80 {
    81 	AddChildSpriteScreen(0x5A3, 0xE, 0x3C - (_m[ti->tile].m1 & 0x7F));
    81 	AddChildSpriteScreen(0x5A3, 0xE, 0x3C - GB(_m[ti->tile].m1, 0, 7));
    82 }
    82 }
    83 
    83 
    84 typedef void TownDrawTileProc(const TileInfo *ti);
    84 typedef void TownDrawTileProc(const TileInfo *ti);
    85 static TownDrawTileProc * const _town_draw_tile_procs[1] = {
    85 static TownDrawTileProc * const _town_draw_tile_procs[1] = {
    86 	TownDrawHouseLift
    86 	TownDrawHouseLift
   181 		} while (i < 0 || i == 1 || i*6==old);
   181 		} while (i < 0 || i == 1 || i*6==old);
   182 
   182 
   183 		SB(_m[tile].m5, 0, 6, i);
   183 		SB(_m[tile].m5, 0, 6, i);
   184 	}
   184 	}
   185 
   185 
   186 	a = _m[tile].m1 & 0x7F;
   186 	a = GB(_m[tile].m1, 0, 7);
   187 	b = (_m[tile].m5&0x3F) * 6;
   187 	b = GB(_m[tile].m5, 0, 6) * 6;
   188 	a += (a < b) ? 1 : -1;
   188 	a += (a < b) ? 1 : -1;
   189 	_m[tile].m1 = (_m[tile].m1 & 0x80) | a;
   189 	SB(_m[tile].m1, 0, 7, a);
   190 
   190 
   191 	if (a == b) {
   191 	if (a == b) {
   192 		_m[tile].m1 &= 0x7F;
   192 		_m[tile].m1 &= 0x7F;
   193 		_m[tile].m5 &= 0x40;
   193 		_m[tile].m5 &= 0x40;
   194 		DeleteAnimatedTile(tile);
   194 		DeleteAnimatedTile(tile);
   621 		rcmd = 1 << (block^2);
   621 		rcmd = 1 << (block^2);
   622 	} else {
   622 	} else {
   623 
   623 
   624 		// Reached a tunnel? Then continue at the other side of it.
   624 		// Reached a tunnel? Then continue at the other side of it.
   625 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5& ~3) == 4) {
   625 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5& ~3) == 4) {
   626 			FindLengthOfTunnelResult flotr = FindLengthOfTunnel(tile, _m[tile].m5&3);
   626 			FindLengthOfTunnelResult flotr = FindLengthOfTunnel(tile, GB(_m[tile].m5, 0, 2));
   627 			*tile_ptr = flotr.tile;
   627 			*tile_ptr = flotr.tile;
   628 			return;
   628 			return;
   629 		}
   629 		}
   630 
   630 
   631 		// For any other kind of tunnel/bridge, bail out.
   631 		// For any other kind of tunnel/bridge, bail out.