-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add various hooks #676
Add various hooks #676
Changes from all commits
82444bc
0cdd915
edeb2d9
50467f4
3d2fc6d
d37fc9b
77825c3
9c05063
d17566c
523a288
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,26 +365,19 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) { | |
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor); | ||
ceilHeight = vec3f_mario_ceil(nextPos, floorHeight, &ceil); | ||
|
||
if (floor == NULL) { | ||
return HANG_HIT_CEIL_OR_OOB; | ||
} | ||
if (ceil == NULL) { | ||
return HANG_LEFT_CEIL; | ||
} | ||
if (ceilHeight - floorHeight <= 160.0f) { | ||
return HANG_HIT_CEIL_OR_OOB; | ||
} | ||
if (ceil->type != SURFACE_HANGABLE) { | ||
return HANG_LEFT_CEIL; | ||
} | ||
|
||
ceilOffset = ceilHeight - (nextPos[1] + 160.0f); | ||
if (ceilOffset < -30.0f) { | ||
return HANG_HIT_CEIL_OR_OOB; | ||
} | ||
if (ceilOffset > 30.0f) { | ||
return HANG_LEFT_CEIL; | ||
} | ||
s32 stepResult = HANG_NONE; | ||
if (floor == NULL) { stepResult = HANG_HIT_CEIL_OR_OOB; } | ||
else if (ceil == NULL) { stepResult = HANG_LEFT_CEIL; } | ||
else if (ceilHeight - floorHeight <= 160.0f) { stepResult = HANG_HIT_CEIL_OR_OOB; } | ||
else if (ceil->type != SURFACE_HANGABLE) { stepResult = HANG_LEFT_CEIL; } | ||
else { | ||
ceilOffset = ceilHeight - (nextPos[1] + 160.0f); | ||
if (ceilOffset < -30.0f) { stepResult = HANG_HIT_CEIL_OR_OOB; } | ||
if (ceilOffset > 30.0f) { stepResult = HANG_LEFT_CEIL; } | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why change this code? it was much more readable before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code was rewritten to be like this because all of the returns. although made the code easier to read, made it pretty incompatible with the hook. |
||
|
||
smlua_call_event_hooks_after_quarter_step(HOOK_AFTER_QUARTER_STEP, m, STEP_TYPE_HANG, stepResult, 0, &stepResult); | ||
if (stepResult != HANG_NONE) { return stepResult; } | ||
|
||
nextPos[1] = m->ceilHeight - 160.0f; | ||
vec3f_copy(m->pos, nextPos); | ||
|
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.
the previous way of killing mario is still needed, because they were specifically for airborne actions. it would set mario as dead, but the death action doesn't play until mario reaches the floor. setting mario's action while in the air will teleport mario to the ground even if he's not there yet.