Flying: Difference between revisions

1,272 bytes added ,  4 August 2023
(this code is so indirect)
(→‎Behavior: expand)
Line 22: Line 22:
As with all airborne actions, a variety of "cancels" are checked prior to actually performing any airborne action. See [[Jump#Airborne cancels]].
As with all airborne actions, a variety of "cancels" are checked prior to actually performing any airborne action. See [[Jump#Airborne cancels]].


Then:
Then:<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario_actions_airborne.c#L1726</ref>
# If Z is pressed
# If Z is pressed
## If Mario's camera mode is CAMERA_MODE_BEHIND_MARIO, set_camera_mode to m->area->camera->defMode
## If Mario's camera mode is CAMERA_MODE_BEHIND_MARIO, set_camera_mode to m->area->camera->defMode
Line 37: Line 37:
### Set action state to 1
### Set action state to 1
# Call '''<code>update_flying</code>'''
# Call '''<code>update_flying</code>'''
# switch [[Movement_steps#Perform_Air_Step]]:
# switch [[Movement_steps#Perform_Air_Step]]: (Note: perform air step is significant because it '''adds vel[0,1,2] to pos[0,1,2]'''.)
#* air step none:
#* air step none:
#*# Update graphics (camera) angle to be behind Mario
#*# Update graphics (camera) angle to be behind Mario
Line 56: Line 56:
Notice that there is no code handling air steps for ledge grabbing or hanging on a ceiling, so such transitions are impossible.
Notice that there is no code handling air steps for ledge grabbing or hanging on a ceiling, so such transitions are impossible.
===update_flying===
===update_flying===
Casually, tilt the joystick left to move left, right to move right, up to move down, down to move up.
I am too lazy to describe the exact details of <code>update_flying</code>, so here is the code
I am too lazy to describe the exact details of <code>update_flying</code>, so here is the code
<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
Line 96: Line 98:
}
}
</syntaxhighlight>
</syntaxhighlight>
Key takeaways:
* Pitching to move up happens faster with lower forward velocity. Try to be just under 4 or 16 forward velocity.
{| class="wikitable"
|+forwardVel's affect in pitch
|'''<=4'''
|5
|6
|7
|8
|9
|10
|11
|12
|13
|14
|15
|'''16'''
|17
|18
|19
|...
|31
|32
|33
|-
| -400
| -270
| -260
| -250
| -240
| -230
| -220
| -210
| -200
| -190
| -180
| -170
| -160
| -90
| -84
| -76
|...
| -6
|0
|6
|}
* However, the pitch is capped to within +- 0x2AAA (in decimal: 10922)
* '''TODO:''' I heard moving down then up can be faster then just the direct line. Explain big picture movements, what happens in a practical example.
* In summary:
# Joystick inputs affect (pitch,yaw) velocity.
# Yaw velocity affects yaw, roll, and forward velocity.
# Pitch affects forward velocity.
# Forward velocity affects pitch.
# Pitch velocity affects pitch.
# x,y,z velocity is more or less directly exactly correspondent to forward velocity, pitch, and yaw.
<hr>
Here are some tables summarizing the <code>approach_s32</code>, <code>update_flying_pitch</code>, and <code>update_flying_yaw</code> functions.
Here are some tables summarizing the <code>approach_s32</code>, <code>update_flying_pitch</code>, and <code>update_flying_yaw</code> functions.
{| class="wikitable"
{| class="wikitable"
246

edits