Review roof_fill_off
This commit is contained in:
parent
ce351988b5
commit
9599d63f45
41
src/tile.cc
41
src/tile.cc
|
@ -52,7 +52,7 @@ static void tileSetBorder(int windowWidth, int windowHeight, int hexGridWidth, i
|
|||
static void tileRefreshMapper(Rect* rect, int elevation);
|
||||
static void tileRefreshGame(Rect* rect, int elevation);
|
||||
static void roof_fill_on(int x, int y, int elevation);
|
||||
static void sub_4B23DC(int x, int y, int elevation);
|
||||
static void roof_fill_off(int x, int y, int elevation);
|
||||
static void tileRenderRoof(int fid, int x, int y, Rect* rect, int light);
|
||||
static void _draw_grid(int tile, int elevation, Rect* rect);
|
||||
static void tileRenderFloor(int fid, int x, int y, Rect* rect);
|
||||
|
@ -1271,37 +1271,32 @@ void _tile_fill_roof(int a1, int a2, int elevation, int a4)
|
|||
if (a4) {
|
||||
roof_fill_on(a1, a2, elevation);
|
||||
} else {
|
||||
sub_4B23DC(a1, a2, elevation);
|
||||
roof_fill_off(a1, a2, elevation);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x4B23DC
|
||||
static void sub_4B23DC(int a1, int a2, int elevation)
|
||||
static void roof_fill_off(int x, int y, int elevation)
|
||||
{
|
||||
while ((a1 >= 0 && a1 < gSquareGridWidth) && (a2 >= 0 && a2 < gSquareGridHeight)) {
|
||||
int squareTile = gSquareGridWidth * a2 + a1;
|
||||
int value = gTileSquares[elevation]->field_0[squareTile];
|
||||
int upper = (value >> 16) & 0xFFFF;
|
||||
|
||||
int id = upper & 0xFFF;
|
||||
if (buildFid(OBJ_TYPE_TILE, id, 0, 0, 0) == buildFid(OBJ_TYPE_TILE, 1, 0, 0, 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
int flag = (upper & 0xF000) >> 12;
|
||||
if ((flag & 0x03) != 0) {
|
||||
break;
|
||||
}
|
||||
if (x >= 0 && x < gSquareGridWidth && y >= 0 && y < gSquareGridHeight) {
|
||||
int squareTileIndex = gSquareGridWidth * y + x;
|
||||
int squareTile = gTileSquares[elevation]->field_0[squareTileIndex];
|
||||
int roof = (squareTile >> 16) & 0xFFFF;
|
||||
|
||||
int id = roof & 0xFFF;
|
||||
if (buildFid(OBJ_TYPE_TILE, id, 0, 0, 0) != buildFid(OBJ_TYPE_TILE, 1, 0, 0, 0)) {
|
||||
int flag = (roof & 0xF000) >> 12;
|
||||
if ((flag & 0x03) == 0) {
|
||||
flag |= 0x01;
|
||||
|
||||
gTileSquares[elevation]->field_0[squareTile] = (value & 0xFFFF) | (((flag << 12) | id) << 16);
|
||||
gTileSquares[elevation]->field_0[squareTileIndex] = (squareTile & 0xFFFF) | (((flag << 12) | id) << 16);
|
||||
|
||||
sub_4B23DC(a1 - 1, a2, elevation);
|
||||
sub_4B23DC(a1 + 1, a2, elevation);
|
||||
sub_4B23DC(a1, a2 - 1, elevation);
|
||||
|
||||
a2++;
|
||||
roof_fill_off(x - 1, y, elevation);
|
||||
roof_fill_off(x + 1, y, elevation);
|
||||
roof_fill_off(x, y - 1, elevation);
|
||||
roof_fill_off(x, y + 1, elevation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue