papermario/src/code_ef070_len_3400.c

174 lines
5.4 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode id = get_variable(script, *ptrReadPos++);
Bytecode enabled = get_variable(script, *ptrReadPos++);
if (!enabled) {
(&gCameras[id])->flags |= 0x2;
} else {
(&gCameras[id])->flags &= ~0x2;
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus SetCamFlag80(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode id = get_variable(script, *ptrReadPos++);
Bytecode enabled = get_variable(script, *ptrReadPos++);
2020-08-04 08:49:11 +02:00
if (!enabled) {
(&gCameras[id])->flags |= 0x80;
} else {
(&gCameras[id])->flags &= ~0x80;
}
return ApiStatus_DONE2;
}
ApiStatus SetCamPerspective(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode id = get_variable(script, *ptrReadPos++);
Bytecode mode = get_variable(script, *ptrReadPos++);
f32 vfov = get_float_variable(script, *ptrReadPos++);
Bytecode nearClip = get_variable(script, *ptrReadPos++);
Bytecode farClip = get_variable(script, *ptrReadPos++);
(&gCameras[id])->farClip = farClip;
(&gCameras[id])->mode = mode;
(&gCameras[id])->unk_06 = 1;
(&gCameras[id])->unk_08 = 1;
(&gCameras[id])->vfov = vfov;
(&gCameras[id])->nearClip = nearClip;
return ApiStatus_DONE2;
}
ApiStatus func_802CA90C(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode id = get_variable(script, *ptrReadPos++);
Bytecode mode = get_variable(script, *ptrReadPos++);
(&gCameras[id])->mode = mode;
(&gCameras[id])->unk_06 = 0;
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_ef070_len_3400", func_802CA988);
/*
ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode id = get_variable(script, *ptrReadPos++);
Bytecode outVar1 = *ptrReadPos++;
Bytecode outVar2 = *ptrReadPos++;
Bytecode outVar3 = *ptrReadPos++;
Bytecode outVar4 = *ptrReadPos++;
f32 temp1, temp2, temp3;
f32 tempSqrt;
(&gCameras[id])->mode = 2;
(&gCameras[id])->unk_06 = 0;
(&gCameras[id])->unk_1C = -1 * round((&gCameras[id])->currentPitch);
(&gCameras[id])->unk_1E = -1 * (&gCameras[id])->currentBlendedYawNegated;
temp1 = (&gCameras[id])->lookAt_obj[0] - (&gCameras[id])->lookAt_eye[0];
temp2 = (&gCameras[id])->lookAt_obj[1] - (&gCameras[id])->lookAt_eye[1];
temp3 = (&gCameras[id])->lookAt_obj[2] - (&gCameras[id])->lookAt_eye[2];
tempSqrt = sqrtf((temp1 * temp1) + (temp2 * temp2) + (temp3 * temp3));
if (tempSqrt != tempSqrt) {
(&gCameras[id])->unk_20 = round(tempSqrt);
}
(&gCameras[id])->unk_22 = 0;
(&gCameras[id])->unk_54 = (&gCameras[id])->lookAt_obj[0];
(&gCameras[id])->unk_58 = (&gCameras[id])->lookAt_obj[1];
(&gCameras[id])->unk_5C = (&gCameras[id])->lookAt_obj[2];
set_variable(script, outVar1, (&gCameras[id])->unk_1C);
set_variable(script, outVar2, (&gCameras[id])->unk_1E);
set_variable(script, outVar3, (&gCameras[id])->unk_20);
set_variable(script, outVar4, (&gCameras[id])->unk_22);
return ApiStatus_DONE2;
}
*/
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamViewport);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamBGColor);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamTarget);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", ShakeCam);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_ef070_len_3400", exec_ShakeCam1);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_ef070_len_3400", exec_ShakeCamX);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamLeadPlayer);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", PanToTarget);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", UseSettingsFrom);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", LoadSettings);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamType);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamPitch);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamDistance);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosA);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosB);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosC);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetPanTarget);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamSpeed);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamType);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamPitch);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamDistance);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosA);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosB);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosC);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosition);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", WaitForCam);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetCamProperties);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", AdjustCam);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", ResetCam);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_ef070_len_3400", draw_anim_models);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", LoadModelAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", PlayModelAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", ChangeModelAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetAnimModelPosition);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", GetAnimModelPosition);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", AddAnimModelPosition);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetAnimModelRotation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_ef070_len_3400", SetAnimModelScale);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_ef070_len_3400", func_802CD4B4);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_ef070_len_3400", func_802CD57C);