Finish matching lift.c and improve its documentation#15
Conversation
| worldX = lift->worldX; | ||
| worldY = lift->worldY; | ||
| handleY = (worldY - gCamera.y) + I(lift->unk8C); | ||
| worldX = screenX = lift->worldX; |
There was a problem hiding this comment.
The original match in 9a0fee6 had the "screen" and "world" variables merged together, which I have a hunch is probably what the original code did, but personally I find this reuse of the same variables for two different purposes distasteful (but YMMV of course).
So the dead store assignments to the "screen" variables is a way to have the two sets of variables while coercing gcc into the correct regalloc (but this might border on fakematching)?
There was a problem hiding this comment.
Well, as long as it matches, there's nothing wrong with it, in theory, as long as it still matches.
| s = &lift->s[LIFT_SPRITE_HANDLE]; | ||
| s->x = screenX; | ||
| s->y = handleY; | ||
| linkY = handleY; |
There was a problem hiding this comment.
Regalloc no longer matches if this assignment to linkY is put further down
| lift->playerHoldsHandle[0] = FALSE; | ||
| lift->playerHoldsHandle[1] = FALSE; |
There was a problem hiding this comment.
To can change
playerHoldsHandle[0] and playerHoldsHandle[1]
to
playerHoldsHandle[PLAYER_1] and playerHoldsHandle[PLAYER_2].
| SET_MAP_ENTITY_INITIALIZED(me); | ||
|
|
||
| sub_8033098(&lift->s[0], &lift->s[1], &lift->s[2]); | ||
| Task_LiftInitSprites(&lift->s[LIFT_SPRITE_PLATFORM], &lift->s[LIFT_SPRITE_CHAIN_LINK], &lift->s[LIFT_SPRITE_HANDLE]); |
There was a problem hiding this comment.
This is definitely not a Task, since it has parameters.
Tasks are any procedure you can assign a pointer of to gCurTask->main without casting.
| worldX = screenX = lift->worldX; | ||
| worldY = screenYPlatform = lift->worldY; |
There was a problem hiding this comment.
Since we don't have any other screenY, you can just leave it as screenY, which is also consistent with basically all other entities.
No description provided.