-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Jade Dragon disappearance in Bartoli's Hideout #2538
Conversation
I've checked throughout OG TR1 and 2 and the only other place items are triggered is in Natla's Mines - the pistols, and one of the fuses. The current implementation doesn't seem to fix the Bartoli's issue though. I tried inverting the condition, and it does fix it, but it then also causes all other pickup items in a flip room to disappear. I think this is needed (same in TR1): diff --git a/src/tr2/game/objects/general/pickup.c b/src/tr2/game/objects/general/pickup.c
index 3d4720aa3..1e0bdb8ae 100644
--- a/src/tr2/game/objects/general/pickup.c
+++ b/src/tr2/game/objects/general/pickup.c
@@ -231,8 +231,10 @@ static void M_Setup(OBJECT *const obj)
static void M_HandleFlip(ITEM *const item, const ROOM_FLIP_STATUS flip_status)
{
- if (flip_status == RFS_UNFLIPPED) {
- item->flags |= IF_INVISIBLE;
+ if (flip_status == RFS_FLIPPED) {
+ if (Item_IsTriggerActive(item)) {
+ item->flags |= IF_INVISIBLE;
+ }
} else {
item->flags &= ~IF_INVISIBLE;
} Test level here with a pushblock, regular items and a secret set up like Bartoli's. |
e0f3c30
to
36e68c3
Compare
@lahm86 @aredfan updated. Thanks a lot to Lahm for helping me create a good solution. Testing:
|
36e68c3
to
8646346
Compare
@@ -25,8 +25,3 @@ int32_t Room_GetCeiling(const SECTOR *sector, int32_t x, int32_t y, int32_t z); | |||
|
|||
void Room_TestTriggers(const ITEM *item); | |||
void Room_TestSectorTrigger(const ITEM *item, const SECTOR *sector); | |||
|
|||
// TODO: eliminate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tidying this up, I forgot to come back to this 😄
This might be a separate issue because it's also present in the latest dev snapshot - the jade dragon persists with these steps.
Edit: The fuse and pistols in Natla's Mines LGTM. |
8646346
to
b3fb30d
Compare
@aredfan thank you :) Fixed, but it'll require retesting all scenarios from scratch. The logic is rather delicate unfortunately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aredfan thank you :) Fixed, but it'll require retesting all scenarios from scratch. The logic is rather delicate unfortunately.
Anytime 👍
I tested all the scenarios again including Lahm's test level, and your fix checks out in all cases. LGTM.
Checklist
Description
Resolves #2536.
The original game has a unique logic for the Jade Dragon, and only the jade variant alone, where the dragon removes itself immediately upon activation. So in terms of game mechanics, when Lara uses the detonator, it triggers the Dragon pickup, and that makes it disappear.
To me, it's a very bizarre approach, so rather than restoring it, I went with making pickups use the
IF_INVISIBLE
flags whenever their host room gets flipped, and not allowing Lara to see or interact with them if this flag is set. This method feels more conventional to me.That said, I find it hard to believe that this is the only pickup in both games that is placed in a flippable room, requiring such intricate trigger-based solution from the OG code, and that this scenario is not already handled in some other way. Also, I'm unsure if my usage of the flag is good, and would appreciate @lahm86's opinion on this. We hardly ever seem to use
IF_INVISIBLE
anywhere beyond initial item setup.Similar to the newest changes done in regard to the savegame↔specific object code decoupling, I've seen that the room flip logic also references certain objects, and I introduced a new method to
OBJECT
calledhandle_flip_func
to address this.Testing