Skip to content

Commit 301f881

Browse files
committed
[#19] vob: rename camera_lock_mode -> sprite_alignment
As per suggestion in [OpenGothic#272](Try/OpenGothic#271 (comment)). (cherry picked from commit 30de6a4)
1 parent 7806270 commit 301f881

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

include/phoenix/vobs/vob.hh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ namespace phoenix {
8282
};
8383

8484
/// \brief Ways the camera may behave with a VOb.
85-
enum class camera_lock_mode : std::uint8_t {
86-
none = 0, ///< The camera is not affected by this VOb.
87-
yaw = 1, ///< The camera's yaw is locked to the VOb's yaw.
88-
full = 2, ///< The camera is fully locked to the VOb.
85+
enum class sprite_alignment : std::uint8_t {
86+
none = 0, ///< The sprite is not affected by the camera's position.
87+
yaw = 1, ///< The sprite rotates with the camera's yaw axis.
88+
full = 2, ///< The sprite rotates with camera fully.
8989
};
9090

91+
/// \brief Ways the camera may behave with a VOb. Same as sprite_alignment
92+
/// \deprecated Use sprite_alignment instead.
93+
using camera_lock_mode [[deprecated("use phoenix::sprite_alignment")]] = sprite_alignment;
94+
9195
/// \brief Types of wavy animation.
9296
enum class animation_mode : std::uint8_t {
9397
none = 0, ///< No wave animation.
@@ -125,7 +129,12 @@ namespace phoenix {
125129
glm::vec3 position {};
126130
glm::mat3x3 rotation {};
127131
bool show_visual {};
128-
camera_lock_mode camera_alignment {};
132+
133+
union {
134+
[[deprecated("use phoenix::vob::sprite_camera_facing_mode")]] sprite_alignment camera_alignment;
135+
sprite_alignment sprite_camera_facing_mode;
136+
};
137+
129138
bool cd_static {};
130139
bool cd_dynamic {};
131140
bool vob_static {};

source/vobs/vob.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace phoenix {
6060
}
6161

6262
obj.show_visual = static_cast<bool>((bit0 & 0b00000001) >> 0);
63-
obj.camera_alignment = static_cast<camera_lock_mode>((bit0 & 0b00000110) >> 1);
63+
obj.sprite_camera_facing_mode = static_cast<sprite_alignment>((bit0 & 0b00000110) >> 1);
6464
obj.cd_static = static_cast<bool>((bit0 & 0b00001000) >> 3);
6565
obj.cd_dynamic = static_cast<bool>((bit0 & 0b00010000) >> 4);
6666
obj.vob_static = static_cast<bool>((bit0 & 0b00100000) >> 5);
@@ -101,10 +101,10 @@ namespace phoenix {
101101
obj.rotation = in.read_mat3x3(); // trafoOSToWSRot
102102
obj.position = in.read_vec3(); // trafoOSToWSPos
103103

104-
obj.vob_name = in.read_string(); // vobName
105-
obj.visual_name = in.read_string(); // visual
106-
obj.show_visual = in.read_bool(); // showVisual
107-
obj.camera_alignment = static_cast<camera_lock_mode>(in.read_enum()); // visualCamAlign
104+
obj.vob_name = in.read_string(); // vobName
105+
obj.visual_name = in.read_string(); // visual
106+
obj.show_visual = in.read_bool(); // showVisual
107+
obj.sprite_camera_facing_mode = static_cast<sprite_alignment>(in.read_enum()); // visualCamAlign
108108

109109
if (version == game_version::gothic_1) {
110110
obj.cd_static = in.read_bool(); // cdStatic

tests/test_world.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST_SUITE("world") {
169169
CHECK(vob0->preset_name.empty());
170170
CHECK(vob0->position == glm::vec3 {0, 0, 0});
171171
CHECK(!vob0->show_visual);
172-
CHECK(vob0->camera_alignment == phoenix::camera_lock_mode::none);
172+
CHECK(vob0->sprite_camera_facing_mode == phoenix::sprite_alignment::none);
173173
CHECK(vob0->anim_mode == phoenix::animation_mode::none);
174174
CHECK(vob0->anim_strength == 0.0f);
175175
CHECK(vob0->far_clip_scale == 0);
@@ -209,7 +209,7 @@ TEST_SUITE("world") {
209209
CHECK(child1->preset_name.empty());
210210
CHECK(child1->position == glm::vec3 {-18544.4863, -136.171906, 4141.19727});
211211
CHECK(!child1->show_visual);
212-
CHECK(child1->camera_alignment == phoenix::camera_lock_mode::none);
212+
CHECK(child1->sprite_camera_facing_mode == phoenix::sprite_alignment::none);
213213
CHECK(child1->anim_mode == phoenix::animation_mode::none);
214214
CHECK(child1->anim_strength == 0.0f);
215215
CHECK(child1->far_clip_scale == 0);
@@ -246,7 +246,7 @@ TEST_SUITE("world") {
246246
CHECK(vob13->preset_name.empty());
247247
CHECK(vob13->position == glm::vec3 {0, 0, 0});
248248
CHECK(!vob13->show_visual);
249-
CHECK(vob13->camera_alignment == phoenix::camera_lock_mode::none);
249+
CHECK(vob13->sprite_camera_facing_mode == phoenix::sprite_alignment::none);
250250
CHECK(vob13->anim_mode == phoenix::animation_mode::none);
251251
CHECK(vob13->anim_strength == 0.0f);
252252
CHECK(vob13->far_clip_scale == 0);

0 commit comments

Comments
 (0)