Skip to content

Commit

Permalink
Add IsRoom to tile class (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Jan 23, 2019
1 parent b566dc0 commit 54d9132
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 202 deletions.
7 changes: 4 additions & 3 deletions src/cdogs/automap.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void DrawMap(
struct vec2i drawPos = svec2i(
mapPos.x + x*scale + j,
mapPos.y + y*scale + i);
color_t color = colorRoom;
color_t color = colorTransparent;
switch (tile->Class->Type)
{
case TILE_CLASS_WALL:
Expand All @@ -234,13 +234,14 @@ static void DrawMap(
color = DoorColor(x, y);
break;
case TILE_CLASS_FLOOR:
color = colorFloor;
color = tile->Class->IsRoom ?
colorRoom : colorFloor;
break;
default:
CASSERT(false, "Unknown tile class type");
break;
}
if (!ColorEquals(color, colorBlack))
if (!ColorEquals(color, colorTransparent))
{
if (flags & AUTOMAP_FLAGS_MASK)
{
Expand Down
19 changes: 10 additions & 9 deletions src/cdogs/door.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ void MapAddDoorGroup(MapBuilder *mb, const struct vec2i v, const int keyFlags)
CASSERT(TileCanWalk(tileB),
"map gen error: entrance should be clear");
// Change the tile below to shadow, cast by this door
const bool isFloor = !MapBuilderGetIsRoom(mb, vB);
tileB->Class = TileClassesGetMaskedTile(
&gTileFloor,
isFloor ? mb->mission->FloorStyle : mb->mission->RoomStyle,
tileB->Class->IsRoom ?
mb->mission->RoomStyle : mb->mission->FloorStyle,
"shadow",
isFloor ? mb->mission->FloorMask : mb->mission->RoomMask,
tileB->Class->IsRoom ?
mb->mission->RoomMask : mb->mission->FloorMask,
mb->mission->AltMask
);
}
Expand Down Expand Up @@ -228,13 +229,13 @@ static TWatch *CreateCloseDoorWatch(
a->a.Event = GameEventNew(GAME_EVENT_TILE_SET);
const struct vec2i vI2 = svec2i(vI.x + dAside.x, vI.y + dAside.y);
a->a.Event.u.TileSet.Pos = Vec2i2Net(vI2);
const bool isFloor = !MapBuilderGetIsRoom(mb, vI2);
const TileClass *t = MapBuilderGetTile(mb, vI2);
TileClassGetName(
a->a.Event.u.TileSet.ClassName,
"tile",
isFloor ? mb->mission->FloorStyle : mb->mission->RoomStyle,
t->IsRoom ? mb->mission->RoomStyle : mb->mission->FloorStyle,
"shadow",
isFloor ? mb->mission->FloorMask : mb->mission->RoomMask,
t->IsRoom ? mb->mission->RoomMask : mb->mission->FloorMask,
mb->mission->AltMask
);
}
Expand Down Expand Up @@ -290,14 +291,14 @@ static Trigger *CreateOpenDoorTrigger(
// Remove shadows below doors
a->Type = ACTION_EVENT;
a->a.Event = GameEventNew(GAME_EVENT_TILE_SET);
const bool isFloor = !MapBuilderGetIsRoom(mb, vIAside);
const TileClass *t = MapBuilderGetTile(mb, vIAside);
a->a.Event.u.TileSet.Pos = Vec2i2Net(vIAside);
TileClassGetName(
a->a.Event.u.TileSet.ClassName,
"tile",
isFloor ? mb->mission->FloorStyle : mb->mission->RoomStyle,
t->IsRoom ? mb->mission->RoomStyle : mb->mission->FloorStyle,
"normal",
isFloor ? mb->mission->FloorMask : mb->mission->RoomMask,
t->IsRoom ? mb->mission->RoomMask : mb->mission->FloorMask,
mb->mission->AltMask
);
}
Expand Down
Loading

0 comments on commit 54d9132

Please sign in to comment.