Skip to content

Commit

Permalink
Fix doors on top of each other
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Sep 5, 2021
1 parent 9b6eb55 commit c5bf1b1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
types: [published, created, edited]

env:
VERSION: 1.0.1
VERSION: 1.0.2
CTEST_EXT_COLOR_OUTPUT: TRUE
CTEST_OUTPUT_ON_FAILURE: 1
CTEST_BUILD_FLAGS: -j4
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(cdogs-sdl C)

SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "0")
SET(VERSION_PATCH "1")
SET(VERSION_PATCH "2")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

# Optionally configure CI files since they are excluded in source archives
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.0.1.{build}
version: 1.0.2.{build}

branches:
except:
Expand All @@ -18,7 +18,7 @@ environment:
SDL2_IMAGE_VERSION: 2.0.5
SDL2_MIXER_VERSION: 2.0.4
SDLDIR: C:\projects\cdogs-sdl
VERSION: 1.0.1
VERSION: 1.0.2

install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
Expand Down
37 changes: 21 additions & 16 deletions src/cdogs/door.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,18 @@ static TWatch *CreateCloseDoorWatch(
for (int i = 0; i < doorGroupCount; i++)
{
const struct vec2i vI = svec2i_add(v, svec2i_scale(dv, (float)i));

a = WatchAddAction(w);
a->Type = ACTION_EVENT;
a->u.Event = GameEventNew(GAME_EVENT_TILE_SET);
const struct vec2i vI2 = svec2i(vI.x + dAside.x, vI.y + dAside.y);
a->u.Event.u.TileSet.Pos = Vec2i2Net(vI2);
const TileClass *t = MapBuilderGetTile(mb, vI2);
TileClassGetName(
a->u.Event.u.TileSet.ClassName, t, t->Style, "shadow", t->Mask,
t->MaskAlt);
if (t->Type == TILE_CLASS_FLOOR)
{
a = WatchAddAction(w);
a->Type = ACTION_EVENT;
a->u.Event = GameEventNew(GAME_EVENT_TILE_SET);
a->u.Event.u.TileSet.Pos = Vec2i2Net(vI2);
TileClassGetName(
a->u.Event.u.TileSet.ClassName, t, t->Style, "shadow", t->Mask,
t->MaskAlt);
}
}
}

Expand Down Expand Up @@ -400,15 +402,18 @@ static Trigger *CreateOpenDoorTrigger(
{
const struct vec2i vI = svec2i_add(v, svec2i_scale(dv, (float)i));
const struct vec2i vIAside = svec2i_add(vI, dAside);
a = TriggerAddAction(t);
// Remove shadows below doors
a->Type = ACTION_EVENT;
a->u.Event = GameEventNew(GAME_EVENT_TILE_SET);
const TileClass *tc = MapBuilderGetTile(mb, vIAside);
a->u.Event.u.TileSet.Pos = Vec2i2Net(vIAside);
TileClassGetName(
a->u.Event.u.TileSet.ClassName, tc, tc->Style, "normal",
tc->Mask, tc->MaskAlt);
if (tc->Type == TILE_CLASS_FLOOR)
{
a = TriggerAddAction(t);
// Remove shadows below doors
a->Type = ACTION_EVENT;
a->u.Event = GameEventNew(GAME_EVENT_TILE_SET);
a->u.Event.u.TileSet.Pos = Vec2i2Net(vIAside);
TileClassGetName(
a->u.Event.u.TileSet.ClassName, tc, tc->Style, "normal",
tc->Mask, tc->MaskAlt);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/cdogs/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ bool MapHasLockedRooms(const Map *map)

uint16_t MapGetAccessLevel(const Map *map, const struct vec2i pos)
{
if (!MapIsTileIn(map, pos))
{
return 0;
}
const uint16_t t =
*(uint16_t *)CArrayGet(&map->access, pos.y * map->Size.x + pos.x);
return AccessCodeToFlags(t);
Expand Down

0 comments on commit c5bf1b1

Please sign in to comment.