papermario/src/code_f4c60_len_4300.c

342 lines
9.7 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
2020-08-16 08:55:51 +02:00
ApiStatus SpeakToPlayer(ScriptInstance* script, s32 isInitialCall) {
return _show_message(script, isInitialCall, 0);
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus EndSpeech(ScriptInstance* script, s32 isInitialCall) {
return _show_message(script, isInitialCall, 1);
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus ContinueSpeech(ScriptInstance* script, s32 isInitialCall) {
return _show_message(script, isInitialCall, 2);
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus SpeakToNpc(ScriptInstance* script, s32 isInitialCall) {
return _show_message(script, isInitialCall, 3);
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", _show_message);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", ShowMessageAtScreenPos);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", ShowMessageAtWorldPos);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", CloseMessage);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SwitchMessage);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", ShowChoice);
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus CloseChoice(ScriptInstance* script, s32 isInitialCall) {
close_message(D_802DB268);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE1;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus CancelMessage(ScriptInstance* script, s32 isInitialCall) {
cancel_message(gCurrentPrintContext);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus CancelMessageAndBlock(ScriptInstance* script, s32 isInitialCall) {
cancel_message(gCurrentPrintContext);
2020-08-16 08:55:51 +02:00
return ApiStatus_BLOCK;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus SetMessageImages(ScriptInstance* script, s32 isInitialCall) {
set_message_images(*script->ptrReadPos);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus func_802D0C94(ScriptInstance* script, s32 initialCall) {
if (get_variable(script, *script->ptrReadPos) == 0) {
D_8009A650[0] |= 0x10;
} else {
D_8009A650[0] &= ~0x10;
}
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
2020-08-16 08:55:51 +02:00
ApiStatus SetMessageString(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Bytecode string = get_variable(script, *args++);
Bytecode index = get_variable(script, *args++);
set_message_string(string, index);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-19 03:45:26 +02:00
#ifdef NON_MATCHING
// TODO: Figure out why there's an extra NOP after this function
// It's probably because of a file split issue
2020-08-16 08:55:51 +02:00
ApiStatus SetMessageValue(ScriptInstance* script, s32 initialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode value = get_variable(script, *ptrReadPos++);
Bytecode index = get_variable(script, *ptrReadPos);
set_message_value(value, index);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
2020-08-19 03:45:26 +02:00
#else
2020-08-20 18:02:57 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetMessageValue);
2020-08-19 03:45:26 +02:00
#endif
2020-08-04 08:49:11 +02:00
ApiStatus HidePlayerShadow(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 hideShadow = get_variable(script, *args++);
if (hideShadow) {
disable_player_shadow();
} else {
enable_player_shadow();
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus DisablePlayerPhysics(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-09-24 05:16:13 +02:00
s32 disable = get_variable(script, *args++);
2020-08-04 08:49:11 +02:00
2020-09-24 05:16:13 +02:00
if (disable) {
disable_player_static_collisions();
} else {
2020-09-24 05:16:13 +02:00
enable_player_static_collisions();
}
return ApiStatus_DONE2;
}
ApiStatus DisablePlayerInput(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
s32 enable = get_variable(script, *args++);
if (enable) {
2020-09-24 05:16:13 +02:00
disable_player_input();
func_800EF628();
func_800E97B8();
func_800E984C();
if (playerStatus->actionState == ActionState_SPIN) {
playerStatus->animFlags |= 0x40000;
}
D_8009A650[0] |= 0x40;
} else {
2020-09-24 05:16:13 +02:00
enable_player_input();
func_800EF600();
func_800E01DC();
D_8009A650[0] &= ~0x40;
func_800E983C();
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerPos);
/*
ApiStatus SetPlayerPos(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
f32 x = get_variable(script, *args++);
f32 y = get_variable(script, *args++);
f32 z = get_variable(script, *args++);
Npc* playerNpc = gPlayerNpc;
playerNpc->pos.x = x;
playerNpc->pos.z = z;
playerNpc->pos.y = y;
playerStatus->position.x = x;
playerStatus->position.y = y;
playerStatus->position.z = z;
return ApiStatus_DONE2;
}
*/
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerCollisionSize);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerSpeed);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerJumpscale);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerActionState);
2020-08-04 08:49:11 +02:00
2020-09-24 05:16:13 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerAnimationSpeed);
INCLUDE_API_ASM("code_f4c60_len_4300", PlayerMoveTo);
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D1270);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D1380);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", player_jump);
2020-08-04 08:49:11 +02:00
void PlayerJump(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 0);
}
2020-08-04 08:49:11 +02:00
void PlayerJump1(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 1);
}
2020-08-04 08:49:11 +02:00
void PlayerJump2(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 2);
}
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", InterpPlayerYaw);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", PlayerFaceNpc);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", GetPlayerTargetYaw);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerFlagBits);
2020-08-04 08:49:11 +02:00
ApiStatus GetPlayerActionState(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar = *script->ptrReadPos;
set_variable(script, outVar, gPlayerActionState);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus GetPlayerPos(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Bytecode outVar3 = *args++;
2020-08-04 08:49:11 +02:00
set_variable(script, outVar1, playerStatus->position.x);
set_variable(script, outVar2, playerStatus->position.y);
set_variable(script, outVar3, playerStatus->position.z);
return ApiStatus_DONE2;
}
ApiStatus GetPlayerAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar = *script->ptrReadPos;
2020-08-24 03:42:04 +02:00
set_variable(script, outVar, gPlayerAnimation);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus FullyRestoreHPandFP(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
playerData->curHP = playerData->curMaxHP;
playerData->curFP = playerData->curMaxFP;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", FullyRestoreSP);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", EnablePartner);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", DisablePartner);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", UseEntryHeading);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2148);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", UseExitHeading);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D23F8);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D244C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2484);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D249C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D24F4);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2508);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2520);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D286C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2884);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", DisablePulseStone);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", GetCurrentPartner);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2B50);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2B6C);
2020-09-24 05:16:13 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", Disable8bitMario);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2C14);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2C40);
2020-09-24 05:16:13 +02:00
INCLUDE_API_ASM("code_f4c60_len_4300", PlaySoundAtPlayer);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2D30);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2ED4);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2F34);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D2FCC);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3028);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D31E0);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3398);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D33D4);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3474);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D354C);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3624);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3674);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D36E0);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D378C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3840);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D38EC);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3998);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D39FC);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3A60);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3C58);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3EB8);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3F74);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D3FC8);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4050);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4164);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D417C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D420C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D42AC);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4364);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D43AC);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D43D0);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D43F4);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4434);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4488);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f4c60_len_4300", func_802D4560);