Skip to content

Commit

Permalink
fix(VirtualObject): fix loading of rigid-body info
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Jan 21, 2024
1 parent 8cba2cf commit 42efd41
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/vobs/VirtualObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ namespace zenkit {
// present but this is only relevant in save-games.
has_event_manager_object = static_cast<bool>((bit1 & 0b000000000100000u) >> 5u) && r.is_save_game();

if (version == GameVersion::GOTHIC_1) {
this->physics_enabled = static_cast<bool>((bit1 & 0b000000010000000u) >> 7u);
} else {
this->physics_enabled = static_cast<bool>((bit1 & 0b000000001000000u) >> 6u);
}
this->physics_enabled = static_cast<bool>((bit1 & 0b000000001000000u) >> 6u);

if (version == GameVersion::GOTHIC_2) {
this->anim_mode = static_cast<AnimationType>(bit1 & 0b000000110000000u >> 7u);
Expand Down Expand Up @@ -190,7 +186,7 @@ namespace zenkit {
this->sleep_mode = r.read_byte(); // sleepMode
this->next_on_timer = r.read_float(); // nextOnTimer

if (this->physics_enabled && version == GameVersion::GOTHIC_2) {
if (this->physics_enabled) {
this->rigid_body.emplace().load(r, version);
}
}
Expand Down Expand Up @@ -277,7 +273,7 @@ namespace zenkit {
w.write_float("nextOnTimer", this->next_on_timer);

// Gothic 1 does not store rigid-body information.
if (this->physics_enabled && this->rigid_body && version == GameVersion::GOTHIC_2) {
if (this->physics_enabled && this->rigid_body) {
this->rigid_body->save(w, version);
}
}
Expand Down

0 comments on commit 42efd41

Please sign in to comment.