diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-16 16:43:00 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-20 20:25:52 +0200 |
commit | 02f712a439ef3f59569c4e942024b496eeb24370 (patch) | |
tree | 38c9650021890f128e5afea5acc55bf6dec60052 | |
parent | fb287a0caf3c129150c19a4b6db6188a5ff2053d (diff) |
scenery: externalize door z-offset
-rw-r--r-- | blender/door/door-close.tpl.json | 11 | ||||
-rw-r--r-- | scenery/door-close.json | 12 | ||||
-rw-r--r-- | src/scenery.cpp | 9 | ||||
-rw-r--r-- | src/scenery.hpp | 3 |
4 files changed, 17 insertions, 18 deletions
diff --git a/blender/door/door-close.tpl.json b/blender/door/door-close.tpl.json index d6907922..637770be 100644 --- a/blender/door/door-close.tpl.json +++ b/blender/door/door-close.tpl.json @@ -7,25 +7,28 @@ "ground": "951 x 556",
"name": "n",
"offset": [ 0, -32, 0 ],
- "depth-offset": "128 x 128"
+ "depth-offset": "-64 x 0"
},
{
"frames": [],
"ground": "951 x 556",
"name": "e",
- "offset": [ 32, 0, 0 ]
+ "offset": [ 32, 0, 0 ],
+ "depth-offset": "0 x -64"
},
{
"frames": [],
"ground": "951 x 556",
"name": "s",
- "offset": [ 0, 32, 0 ]
+ "offset": [ 0, 32, 0 ],
+ "depth-offset": "64 x 0"
},
{
"frames": [],
"ground": "951 x 556",
"name": "w",
- "offset": [ -32, 0, 0 ]
+ "offset": [ -32, 0, 0 ],
+ "depth-offset": "0 x 64"
}
],
"nframes": 55,
diff --git a/scenery/door-close.json b/scenery/door-close.json index 475b688c..25681e48 100644 --- a/scenery/door-close.json +++ b/scenery/door-close.json @@ -285,7 +285,8 @@ 0,
-32,
0
- ]
+ ],
+ "depth-offset": "-64 x 0"
},
{
"frames": [
@@ -571,7 +572,8 @@ 32,
0,
0
- ]
+ ],
+ "depth-offset": "0 x -64"
},
{
"frames": [
@@ -857,7 +859,8 @@ 0,
32,
0
- ]
+ ],
+ "depth-offset": "64 x 0"
},
{
"frames": [
@@ -1143,7 +1146,8 @@ -32,
0,
0
- ]
+ ],
+ "depth-offset": "0 x 64"
}
],
"nframes": 55,
diff --git a/src/scenery.cpp b/src/scenery.cpp index 29198b0f..f3a11f6d 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -93,15 +93,6 @@ float scenery::depth_offset() const constexpr auto inv_tile_size = 1.f/TILE_SIZE2; Vector2 offset; offset += Vector2(atlas->group(r).depth_offset) * inv_tile_size; - if (sc_type == scenery_type::door) - { - const bool is_open = frame != atlas->info().nframes-1; - constexpr auto off_opened = Vector2(-1, 0); - constexpr auto off_closed = Vector2(-1, 0); - const auto vec = is_open ? off_opened : off_closed; - const auto pt = rotate_point(vec, rotation::N, r); - offset += pt; - } float ret = 0; ret += offset[1]*TILE_MAX_DIM + offset[0]; ret += tile_shader::scenery_depth_offset; diff --git a/src/scenery.hpp b/src/scenery.hpp index 1c3b03ad..70b7733c 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -14,7 +14,8 @@ struct anim_atlas; struct world; enum class scenery_type : unsigned char { - none, generic, door, + none, generic, + door, // todo remove it }; constexpr inline size_t scenery_type_BITS = 3; |