This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Descent 1 robots-drop-robots logic
Commit 7a183c1 ("Use enum class for robot_id") made an incorrect change to the Descent 1 call to `robot_create`, causing the game to drop the wrong type of robot. Descent 2 was not affected. This commit both fixes the incorrect type, which is readily visible, and fixes the created robot's radius, which Descent 1 has always done wrong and Descent 2 has always done right. The second argument to `robot_create` is the ID of the robot to create (Hulk, Lifter, Spider, etc.). Prior to 7a183c1, the second argument was `id`, which came from the caller and was of type `int`. Both games had a related variable `robot_id` used for lookup in the `Robot_info` array. In Descent 1, `robot_id` was set from a cast of `ObjId[type]`. In Descent 2, `robot_id` was set from a cast of `id`. Based on the observation that `Robot_info[robot_id]` was used to read `.model_num`, I believed that `robot_id` was suitable for use as the ID of the robot to create. For Descent 2, this was true. For Descent 1, it was not true. Based on that belief, commit 7a183c1 changed the second parameter from `id` to `robot_id` (which was also renamed to `rid`). For Descent 1, this caused the wrong robot to drop. For Descent 2, this was a no-op change. Reported-by: JeodC <dxx-rebirth#742> Bisected-by: InfernalCore <dxx-rebirth#742 (comment)> Fixes: 7a183c1 ("Use enum class for robot_id")
- Loading branch information