From c5bf1b13addf21dc1bb47246c9f9c5b1a4b3b393 Mon Sep 17 00:00:00 2001 From: Cong Date: Sun, 5 Sep 2021 12:56:00 +1000 Subject: [PATCH] Fix doors on top of each other --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 2 +- appveyor.yml | 4 ++-- src/cdogs/door.c | 37 +++++++++++++++++++++---------------- src/cdogs/map.c | 4 ++++ 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 36edc882e..4067615a4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index fcc1447b9..bd9f117ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/appveyor.yml b/appveyor.yml index aa6702f90..58bcdaae7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.0.1.{build} +version: 1.0.2.{build} branches: except: @@ -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%" diff --git a/src/cdogs/door.c b/src/cdogs/door.c index 37d254ccc..fdb7827eb 100644 --- a/src/cdogs/door.c +++ b/src/cdogs/door.c @@ -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); + } } } @@ -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); + } } } diff --git a/src/cdogs/map.c b/src/cdogs/map.c index 84e7676ce..2a78c4e8a 100644 --- a/src/cdogs/map.c +++ b/src/cdogs/map.c @@ -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);