6#include "sprite/player.h"
103 Bytecode* args = script->ptrReadPos;
110 Bytecode* args = script->ptrReadPos;
123 Bytecode* args = script->ptrReadPos;
130 Bytecode* args = script->ptrReadPos;
137 Bytecode* args = script->ptrReadPos;
148 if (script->functionTemp[0] == 0) {
149 script->functionTemp[0] =
dist2D(playerStatus->
pos.
x, playerStatus->
pos.
z, targetX,
153 moveSpeed =
dist2D(playerStatus->
pos.
x, playerStatus->
pos.
z, targetX, targetZ) / script->functionTemp[0];
159 script->functionTemp[0]--;
160 return script->functionTemp[0] < 0;
164 Bytecode* args = script->ptrReadPos;
175 dist =
dist2D(playerStatus->
pos.
x, playerStatus->
pos.
z, targetX, targetZ);
176 script->functionTemp[0] = dist / var3;
177 moveSpeed = dist / script->functionTemp[0];
183 script->functionTemp[0]--;
188 Bytecode* args = script->ptrReadPos;
226 script->functionTemp[0] = 0;
229 if (script->functionTemp[0] == 0) {
264 anim = ANIM_Mario1_Jump;
266 anim = ANIM_MarioW1_JumpWatt;
269 anim = ANIM_MarioW3_8bit_Jump;
274 script->functionTemp[0] = 1;
285 anim = ANIM_Mario1_Fall;
287 anim = ANIM_MarioW1_FallWatt;
290 anim = ANIM_MarioW3_8bit_Jump;
305 playerStatus->
flags &= ~PS_FLAG_FLYING;
306 playerStatus->
animFlags &= ~PA_FLAG_NO_OOB_RESPAWN;
311 anim = ANIM_Mario1_Land;
313 anim = ANIM_MarioW1_LandWatt;
316 anim = ANIM_Mario1_TiredIdle;
322 if (mode == 0 || mode == 2) {
328 playerStatus->
pos.
y = yTemp;
351 Bytecode* args = script->ptrReadPos;
353 f32* initialYaw = &script->functionTempF[1];
354 f32* deltaYaw = &script->functionTempF[2];
355 s32* time = &script->functionTemp[3];
364 if (*deltaYaw < -180.0f) {
367 if (*deltaYaw > 180.0f) {
390 s32* args = script->ptrReadPos;
391 f32* playerTargetYaw = &script->functionTempF[1];
392 f32* angle = &script->functionTempF[2];
393 s32* ft3 = &script->functionTemp[3];
416 if (*angle < -180.0f) {
419 if (*angle > 180.0f) {
443 Bytecode* args = script->ptrReadPos;
449 playerStatus->
flags |= bits;
451 playerStatus->
flags &= ~bits;
458 Bytecode outVar = *script->ptrReadPos;
465 Bytecode* args = script->ptrReadPos;
477 Bytecode outVar = *script->ptrReadPos;
515 Bytecode* args = script->ptrReadPos;
529 gPlayerStatus.
pos.
x = (entryX + (var1 * sinTheta)) - (exitTangentFrac * cosTheta);
530 gPlayerStatus.
pos.
z = (entryZ - (var1 * cosTheta)) - (exitTangentFrac * sinTheta);
544 Bytecode* args = script->ptrReadPos;
547 f32* varTableVar5 = &script->varTableF[5];
552 f32 entryX = (*mapSettings->
entryList)[entryID].x;
553 f32 entryZ = (*mapSettings->
entryList)[entryID].z;
554 f32 temp = (var1 + 10.0f) / 2;
555 f32 temp_f2 =
dist2D(entryX, entryZ, playerStatus->
pos.
x, playerStatus->
pos.
z) - temp;
560 if (temp_f2 > 0.0f) {
561 if (temp_f2 > var1 + 10.0f) {
562 temp_f2 = var1 + 10.0f;
570 script->varTable[1] = (playerStatus->
pos.
x + (var1 * sinTheta)) - (exitTangentFrac * cosTheta);
571 script->varTable[3] = (playerStatus->
pos.
z - (var1 * cosTheta)) - (exitTangentFrac * sinTheta);
572 script->varTable[2] = (*mapSettings->
entryList)[entryID].y;
573 *varTableVar5 = var1 / 15;
609 Bytecode* args = script->ptrReadPos;
637 Bytecode* args = script->ptrReadPos;
705 s32 imgfxFlags = *script->ptrReadPos;
712 Bytecode* args = script->ptrReadPos;
714 f32* initialYaw = &script->functionTempF[1];
715 f32* deltaYaw = &script->functionTempF[2];
716 s32* duration = &script->functionTemp[3];
725 if (playerStatus->
pos.
x != targetX || playerStatus->
pos.
z != targetY) {
726 targetYaw =
atan2(playerStatus->
pos.
x, playerStatus->
pos.
z, targetX, targetY);
731 *deltaYaw = targetYaw - *initialYaw;
735 if (*deltaYaw < -180.0f) {
738 if (*deltaYaw > 180.0f) {
763 playerStatus->
animFlags &= ~PA_FLAG_USING_PULSE_STONE;
773 Bytecode* args = script->ptrReadPos;
801 Bytecode* args = script->ptrReadPos;
807 playerStatus->
animFlags &= ~PA_FLAG_8BIT_MARIO;
820 Bytecode* args = script->ptrReadPos;
827 Bytecode* args = script->ptrReadPos;
840 Bytecode* args = script->ptrReadPos;
@ PS_FLAG_CAMERA_DOESNT_FOLLOW
@ PA_FLAG_INTERRUPT_USE_PARTNER
forces actions with bow, parakarry, watt, and lakilester to end (sushie not tested)
@ PA_FLAG_FORCE_USE_PARTNER
triggers partner use when set
@ PA_FLAG_USING_PULSE_STONE
@ SOUND_QUICK_PLAYER_JUMP
@ RENDER_MODE_SURFACE_XLU_LAYER2
@ ACTION_STATE_STEP_DOWN_LAND
@ ACTION_STATE_SPIN_POUND
@ ACTION_STATE_TORNADO_POUND
s32 evt_get_variable(Evt *script, Bytecode var)
void enable_status_bar_input(void)
void partner_disable_input(void)
s32 disable_player_input(void)
f32 player_check_collision_below(f32, s32 *colliderID)
s32 disable_player_static_collisions(void)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
void close_status_bar(void)
s32 enable_player_input(void)
void move_player(s32 duration, f32 heading, f32 speed)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
void enable_player_shadow(void)
void player_handle_floor_collider_type(s32 colliderID)
void sin_cos_deg(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
void disable_status_bar_input(void)
void set_action_state(s32 actionState)
void exec_ShakeCam1(s32 arg0, s32 arg1, s32 arg2)
void suggest_player_anim_allow_backward(AnimID anim)
void player_surface_spawn_fx(void)
f32 evt_get_float_variable(Evt *script, Bytecode var)
s32 enable_player_static_collisions(void)
void disable_player_shadow(void)
b32 can_trigger_loading_zone(void)
void npc_surface_spawn_fx(Npc *npc, SurfaceInteractMode mode)
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Npc * get_npc_safe(s32 npcID)
void partner_enable_input(void)
ApiStatus player_jump(Evt *script, s32 isInitialCall, s32 mode)
Internal function for PlayerJump(), PlayerJump1(), and PlayerJump2().
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
ApiStatus GetPartnerInUse(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerImgFXFlags(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerPos(Evt *script, b32 isInitialCall)
Sets the player position.
ApiStatus func_802D2484(Evt *script, b32 isInitialCall)
ApiStatus ForceUsePartner(Evt *script, b32 isInitialCall)
ApiStatus IsPlayerOnValidFloor(Evt *script, b32 isInitialCall)
ApiStatus PlayerJump1(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerAnimation(Evt *script, b32 isInitialCall)
ApiStatus func_802D2148(Evt *script, b32 isInitialCall)
ApiStatus UseEntryHeading(Evt *script, b32 isInitialCall)
ApiStatus PlayerJump2(Evt *script, b32 isInitialCall)
ApiStatus UpdatePlayerImgFX(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerAnimationSpeed(Evt *script, b32 isInitialCall)
ApiStatus DisablePlayerInput(Evt *script, b32 isInitialCall)
Disables player and partner input, and disables the status menu.
ApiStatus HidePlayerShadow(Evt *script, b32 isInitialCall)
Hides the player's shadow if hide is TRUE, shows it if FALSE.
ApiStatus GetPlayerTargetYaw(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerJumpscale(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerCollisionSize(Evt *script, b32 isInitialCall)
Overrides the player collision size.
ApiStatus GetPlayerActionState(Evt *script, b32 isInitialCall)
ApiStatus Disable8bitMario(Evt *script, b32 isInitialCall)
Enables and disables the 8-bit Mario easter egg.
ApiStatus FacePlayerTowardPoint(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerAnimation(Evt *script, b32 isInitialCall)
ApiStatus PlaySoundAtPlayer(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerPushVelocity(Evt *script, b32 isInitialCall)
ApiStatus func_802D2C14(Evt *script, b32 isInitialCall)
ApiStatus PlayerFaceNpc(Evt *script, b32 isInitialCall)
ApiStatus UseExitHeading(Evt *script, b32 isInitialCall)
ApiStatus WaitForPlayerMoveToComplete(Evt *script, b32 isInitialCall)
ApiStatus WaitForPlayerTouchingFloor(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerSpeed(Evt *script, b32 isInitialCall)
Sets the move speed of the player for subequent PlayerMoveTo calls.
ApiStatus SetPlayerActionState(Evt *script, b32 isInitialCall)
ApiStatus FullyRestoreSP(Evt *script, b32 isInitialCall)
ApiStatus DisablePulseStone(Evt *script, b32 isInitialCall)
ApiStatus DisablePartner(Evt *script, b32 isInitialCall)
Disables switching to the given partner.
ApiStatus FullyRestoreHPandFP(Evt *script, b32 isInitialCall)
ApiStatus PlayerMoveTo(Evt *script, b32 isInitialCall)
ApiStatus WaitForPlayerInputEnabled(Evt *script, b32 isInitialCall)
ApiStatus EnablePartner(Evt *script, b32 isInitialCall)
Enables switching to the given partner.
ApiStatus DisablePlayerPhysics(Evt *script, b32 isInitialCall)
Disables player physics if disable is TRUE, enables it if FALSE.
ApiStatus InterpPlayerYaw(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerFlagBits(Evt *script, b32 isInitialCall)
ApiStatus InterruptUsePartner(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerPos(Evt *script, b32 isInitialCall)
ApiStatus func_802D1380(Evt *script, b32 isInitialCall)
ApiStatus PlayerJump(Evt *script, b32 isInitialCall)
ApiStatus func_802D1270(Evt *script, b32 isInitialCall)
MapSettings * get_current_map_settings(void)
Fields other than main, entryList, entryCount, background, and tattle are initialised when the map lo...
void set_player_imgfx_all(s32 animID, ImgFXType imgfxType, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
CollisionStatus gCollisionStatus
PartnerStatus gPartnerStatus
GameStatus * gGameStatusPtr
PlayerStatus gPlayerStatus