mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 23:14:37 +00:00
decompile z_camera (#398)
* cleanup * name camera action functions * decompile a few small functions, name a few Camera struct members * decompile camera data, decompile a few camera functions * Split ASM for code_800BB0A0 * removing code_800BB0A0.s * PR Requests, Camera WIP * remove #define NON_MATCHING from db_camera * rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c * camera wip * rename some struct memebers, some decomp wip * pr updates * camera wip * name some fields in Camera Struct, being making sense of Camera_Update * Camera WIP * wip * wip * add z64camera.h header, begin creating CameraSetting macros * wip * wip * wip * wip * migrate camera bss to c * match a couple functions in db_camera * match some small db_camera functions * wip * migrate db_camera rodata, match a few functions * remote db_camera.rodata.s * match some of db_camera * identify types of some unknown data pieces * some small wip * Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs * add naming for a few more Camera struct members * wip * match func_80043F94 * Match Camera_Jump1 * document some of Camera_Jump1 * wip * match Camera_Jump3 * Match Camera_Update, FeelsAmazing * wip * wip * match Camera_SetParam * minor cleanup * wip * wip * match Camera_KeepOn0 * some documentation, modify some matching functions to match style of others. * match Camera_Demo1 * match camera_demo9 * document Camera_Demo1 and Camera_Demo9 * wip * Match camera_battle4 * match camera_unique2 * Match Camera_Unique3 * match camera_special6 * match Camera_Special5 * wip * document camera_special6 * naming updates * match camera_Unique1 * match Camera_Unique0 * wip * Match Camera_CalcUpFromPitchYawRoll * match func_80045508 * document Camera_Battle4 * document several camera functions, move camera data to separate file * rename phi/theta to pitch/yaw * wip * uniq9 wip * Camera_Unqiue9 OK * document Camera_Unique9 * name unk_160 in camera struct * wip * wip * minor updates * fix conflicts * wip * wip * Olib updates * wip * wip * rename most Math3D functions, few matches, documentation * wip * document most of math3d * wip * wip * wip * pr updates * Match Camera_Fixed4 * match func_80058E8C * pr updates * add missing comment block finalizer * Merge math3dupdates * match Camera_ChangeSetting * Match Camera_ChangeMode * match func_80058148 * Match Camera_Special9 * decompile the rest of camera data * match Camera_Demo5 * name a few camera functions in z_play * match func_80046CB4, some work on other fucntions * wip * impove some non matchings * fix function rename * match func_800588B4 * match Camera_Subj4 * wip * Camera_Demo3 matching, Camera_Battle1 big progress * Camera_Normal2 OK * wip * match Camera_Parallel1 * normalize some things across functions * match Camera_Normal1 * Match Camera_Normal3 * some cleanup * more cleanup * more cleanup , match Camera_CalcDefaultPitch * data formatting * Match Camera_Jump2 * document Camera_Jump2 * Match Camera_KeepOn3 * document some of Camera_KeepOn3 * improve some non_matchings * match func_80045C74 and func_800460A8 * code cleanup, documentation * match Camera_KeepOn1 * Match Camera_Subj3 * Match Camera_Battle1 * remove non_matching from func_80044adc and func_80046e20 * name several members of Battle1 * more documentation on Battle1 * cleanup * renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector * reorganize update structs, remove final references to params, remove CameraParams union * implement camera enums into player * Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player * remove non-global camera variables from variables.h * clean up some variable declarations * finish pr comment updates * fix some warnings * data formatting * finish commenting on data * delete unused asm * remove asm Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
parent
dadee87f94
commit
321388673b
243 changed files with 13819 additions and 28653 deletions
|
@ -1,24 +1,96 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3B50.s")
|
||||
extern GlobalContext* D_80161100;
|
||||
extern s32 D_8012CED8;
|
||||
extern s32 D_8012CED4;
|
||||
extern s32 D_8012CED0;
|
||||
extern char D_801612D0[0x1A];
|
||||
extern char D_801612EA;
|
||||
extern DBCamera* D_80161108;
|
||||
extern s16 D_80161148;
|
||||
extern s16 D_8016114A;
|
||||
extern s16 D_8016111A;
|
||||
extern s16 D_8016110C;
|
||||
|
||||
typedef struct {
|
||||
char state;
|
||||
s16 mode;
|
||||
CutsceneCameraPoint* eyePoints;
|
||||
CutsceneCameraPoint* atPoints;
|
||||
s16 frameCnt;
|
||||
s16 csPointsCnt;
|
||||
} DBCSEditorSlot;
|
||||
|
||||
extern DBCSEditorSlot sDbgEditorSlots[];
|
||||
extern char sDbgEditorStates[];
|
||||
|
||||
// DbgCamera_Vec3fVecSphGeoAdd
|
||||
Vec3f* func_800B3B50(Vec3f* dest, Vec3f* a, VecSph* b) {
|
||||
Vec3f copy, vecB;
|
||||
OLib_VecSphGeoToVec3f(&vecB, b);
|
||||
|
||||
copy.x = a->x + vecB.x;
|
||||
copy.y = a->y + vecB.y;
|
||||
copy.z = a->z + vecB.z;
|
||||
|
||||
*dest = copy;
|
||||
return dest;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3BD4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3DF8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3EBC.s")
|
||||
void func_800B3EBC(Vec3s* src, Vec3f* dest) {
|
||||
dest->x = src->x;
|
||||
dest->y = src->y;
|
||||
dest->z = src->z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3EFC.s")
|
||||
void func_800B3EFC(Vec3f* src, Vec3s* dest) {
|
||||
dest->x = src->x;
|
||||
dest->y = src->y;
|
||||
dest->z = src->z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F38.s")
|
||||
void func_800B3F38(Vec3f* src, Vec3f* dest) {
|
||||
dest->x = src->x;
|
||||
dest->y = src->y;
|
||||
dest->z = src->z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F54.s")
|
||||
void func_800B3F54(Vec3s* src, Vec3f* dest) {
|
||||
dest->x = src->x;
|
||||
dest->y = src->y;
|
||||
dest->z = src->z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F94.s")
|
||||
void func_800B3F94(PosRot* arg0, Vec3f* arg1, Vec3s* arg2) {
|
||||
VecSph sp28;
|
||||
Vec3f sp1C;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3FF4.s")
|
||||
OLib_Vec3fDiffToVecSphGeo(&sp28, &arg0->pos, arg1);
|
||||
sp28.yaw -= arg0->rot.y;
|
||||
OLib_VecSphGeoToVec3f((Vec3f*)&sp1C, &sp28);
|
||||
func_800B3EFC(&sp1C, arg2);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B404C.s")
|
||||
void func_800B3FF4(PosRot* arg0, Vec3f* arg1, Vec3f* arg2) {
|
||||
VecSph sp28;
|
||||
Vec3f sp1C;
|
||||
|
||||
func_800B3F38(arg1, &sp1C);
|
||||
OLib_Vec3fToVecSphGeo(&sp28, &sp1C);
|
||||
sp28.yaw += arg0->rot.y;
|
||||
func_800B3B50(arg2, arg0, &sp28);
|
||||
}
|
||||
|
||||
void func_800B404C(s32 arg0, Vec3s* arg1, Vec3f* arg2) {
|
||||
Vec3f sp1C;
|
||||
|
||||
func_800B3EBC(arg1, &sp1C);
|
||||
func_800B3FF4(arg0, &sp1C, arg2);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4088.s")
|
||||
|
||||
|
@ -30,7 +102,25 @@
|
|||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B44E0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4920.s")
|
||||
/**
|
||||
* Prints individual csSlot point information
|
||||
*/
|
||||
void func_800B4920(char* varName, s16 pointCnt, CutsceneCameraPoint* csPoints) {
|
||||
s32 i;
|
||||
CutsceneCameraPoint* csPoint;
|
||||
|
||||
osSyncPrintf("@@@static SplinedatZ %s[] = {\n", varName);
|
||||
for (i = 0, csPoint = csPoints; i < pointCnt; i++, csPoint++) {
|
||||
osSyncPrintf("@@@ /* key frame %2d */ {\n", i);
|
||||
osSyncPrintf("@@@ /* code */ %d,\n", csPoint->continueFlag);
|
||||
osSyncPrintf("@@@ /* z */ %d,\n", csPoint->cameraRoll);
|
||||
osSyncPrintf("@@@ /* T */ %d,\n", csPoint->nextPointFrame);
|
||||
osSyncPrintf("@@@ /* zoom */ %f,\n", csPoint->viewAngle);
|
||||
osSyncPrintf("@@@ /* pos */ { %d, %d, %d }\n", csPoint->pos.x, csPoint->pos.y, csPoint->pos.z);
|
||||
osSyncPrintf("@@@ },\n");
|
||||
}
|
||||
osSyncPrintf("@@@};\n@@@\n");
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4A68.s")
|
||||
|
||||
|
@ -40,28 +130,154 @@
|
|||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4B20.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4D58.s")
|
||||
void DbgCamera_Init(DBCamera* dbCamera, Camera* camera) {
|
||||
dbCamera->unk_10C6.x = dbCamera->unk_10C6.y = dbCamera->unk_10C6.z = 0;
|
||||
dbCamera->unk_44 = 0;
|
||||
dbCamera->unk_00 = 0;
|
||||
dbCamera->unk_34 = 0;
|
||||
dbCamera->unk_3C = 0;
|
||||
dbCamera->unk_38 = -1;
|
||||
dbCamera->unk_40 = -1;
|
||||
dbCamera->unk_4C = 0;
|
||||
dbCamera->fov = 0.0f;
|
||||
dbCamera->unk_50 = 0.0f;
|
||||
D_80161100 = camera->globalCtx;
|
||||
dbCamera->unk_7C = 0;
|
||||
dbCamera->unk_7E = -1;
|
||||
dbCamera->unk_80 = 1;
|
||||
dbCamera->unk_82 = 0;
|
||||
dbCamera->unk_84 = 0;
|
||||
dbCamera->unk_86 = 0;
|
||||
dbCamera->unk_78 = 0;
|
||||
dbCamera->unk_7A = 0;
|
||||
dbCamera->unk_10C0.x = 0;
|
||||
dbCamera->unk_10C0.y = 0;
|
||||
dbCamera->unk_10C0.z = 0;
|
||||
dbCamera->unk_6C = dbCamera->unk_70 = dbCamera->unk_74 = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4DE4.s")
|
||||
void DbgCamera_Enable(DBCamera* dbCamera, Camera* camera) {
|
||||
dbCamera->at = camera->at;
|
||||
dbCamera->eye = camera->eye;
|
||||
dbCamera->up = camera->up;
|
||||
dbCamera->fov = camera->fov;
|
||||
dbCamera->unk_4C = 0;
|
||||
dbCamera->unk_80 = 1;
|
||||
dbCamera->unk_82 = 0;
|
||||
dbCamera->unk_84 = 0;
|
||||
dbCamera->unk_86 = 1;
|
||||
dbCamera->unk_88 = 1;
|
||||
dbCamera->unk_78 = 0;
|
||||
dbCamera->unk_7A = 0;
|
||||
dbCamera->unk_50 = 0.0f;
|
||||
func_800B4088(dbCamera, camera);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4E7C.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/DbgCamera_Update.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8730.s")
|
||||
s32 func_800B8730(void) {
|
||||
s32 temp_v1;
|
||||
void* phi_v0;
|
||||
s32 phi_v1;
|
||||
|
||||
for (phi_v1 = 0; phi_v1 < 0x1A; phi_v1++) {
|
||||
if (D_801612D0[phi_v1] != 'O') {
|
||||
return phi_v1 + 'A';
|
||||
}
|
||||
}
|
||||
return '?';
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B87D8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8978.s")
|
||||
/**
|
||||
* Clears a DBCSEditorSlot
|
||||
*/
|
||||
void func_800B8978(s32 editorSlot, s32 free) {
|
||||
|
||||
if (sDbgEditorSlots[editorSlot].state != '?') {
|
||||
sDbgEditorStates[sDbgEditorSlots[editorSlot].state] = 'X';
|
||||
}
|
||||
if (free) {
|
||||
DebugArena_FreeDebug(sDbgEditorSlots[editorSlot].atPoints, "../db_camera.c", 2784);
|
||||
DebugArena_FreeDebug(sDbgEditorSlots[editorSlot].eyePoints, "../db_camera.c", 2785);
|
||||
}
|
||||
sDbgEditorSlots[editorSlot].state = '?';
|
||||
sDbgEditorSlots[editorSlot].atPoints = NULL;
|
||||
sDbgEditorSlots[editorSlot].eyePoints = NULL;
|
||||
sDbgEditorSlots[editorSlot].mode = 0;
|
||||
sDbgEditorSlots[editorSlot].frameCnt = 0;
|
||||
sDbgEditorSlots[editorSlot].csPointsCnt = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8A0C.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8BA4.s")
|
||||
extern s32 D_801612EC;
|
||||
|
||||
s32 func_800B8BA4(void) {
|
||||
return D_801612EC;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8BB0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8DB0.s")
|
||||
|
||||
void func_800B8F30(char* arg0) {
|
||||
Mempak_DeleteFile(2, *arg0);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8F58.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B9060.s")
|
||||
/**
|
||||
* Prints cs editor slot inforation
|
||||
*/
|
||||
void func_800B9060(s32 arg0) {
|
||||
DBCSEditorSlot* csSlot;
|
||||
s32 i;
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
osSyncPrintf("@@@\n@@@\n@@@/* ****** spline point data ** start here ***** */\n@@@\n");
|
||||
for (i = 0, csSlot = sDbgEditorSlots; i < 0xF; i++, csSlot++) {
|
||||
if (csSlot->csPointsCnt != 0) {
|
||||
if (i != 0) {
|
||||
osSyncPrintf("@@@\n@@@/* ** %d ** */\n@@@\n", i);
|
||||
}
|
||||
func_800B4920("Lookat", csSlot->csPointsCnt, csSlot->atPoints);
|
||||
func_800B4920("Position", csSlot->csPointsCnt, csSlot->eyePoints);
|
||||
osSyncPrintf("@@@static short nPoints = %d;\n@@@\n", csSlot->csPointsCnt);
|
||||
osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", csSlot->frameCnt);
|
||||
osSyncPrintf("@@@static short Mode = %d;\n@@@\n", csSlot->mode);
|
||||
}
|
||||
}
|
||||
osSyncPrintf("@@@\n@@@\n@@@/* ****** spline point data ** finish! ***** */\n@@@\n");
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B91B0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B958C.s")
|
||||
/**
|
||||
* Initalizes the custscene editor
|
||||
*/
|
||||
void DbgCamera_FirstInit(Camera* camera, DBCamera* dbCamera) {
|
||||
s32 temp_s0;
|
||||
u32 temp_v0;
|
||||
u32 phi_v0;
|
||||
s32 i;
|
||||
char* p;
|
||||
|
||||
D_801612EA = '*';
|
||||
for (p = D_801612D0; p < &D_801612D0[0x1A]; p++) {
|
||||
*p = 'X';
|
||||
}
|
||||
|
||||
for (i = 0; i < 0xF; i++) {
|
||||
func_800B8978(i, 0);
|
||||
}
|
||||
|
||||
D_80161108 = dbCamera;
|
||||
D_8016110C = 0;
|
||||
D_80161148 = 0;
|
||||
D_8016114A = -1;
|
||||
D_8016111A = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B9638.s")
|
||||
|
|
|
@ -952,7 +952,7 @@ f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) {
|
|||
return actorB->posRot.pos.y - actorA->posRot.pos.y;
|
||||
}
|
||||
|
||||
f32 Player_GetCameraYOffset(Player* player) {
|
||||
f32 Player_GetHeight(Player* player) {
|
||||
f32 offset = (player->stateFlags1 & 0x800000) ? 32.0f : 0.0f;
|
||||
|
||||
if (LINK_IS_ADULT) {
|
||||
|
@ -1012,7 +1012,7 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) {
|
|||
|
||||
void func_8002DE74(GlobalContext* globalCtx, Player* player) {
|
||||
if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) {
|
||||
func_8005A77C(Gameplay_GetCamera(globalCtx, 0), 6);
|
||||
Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_HORSE0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1206,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f
|
|||
u32 sp60;
|
||||
CollisionPoly* sp5C;
|
||||
f32 sp58;
|
||||
UNK_TYPE sp54;
|
||||
WaterBox* sp54;
|
||||
f32 sp50;
|
||||
Vec3f ripplePos;
|
||||
|
||||
|
@ -2166,10 +2166,10 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
|||
Lights_Draw(lights, globalCtx->state.gfxCtx);
|
||||
|
||||
if (actor->flags & 0x1000) {
|
||||
func_800D1694(actor->posRot.pos.x + globalCtx->mainCamera.unk_80.x,
|
||||
func_800D1694(actor->posRot.pos.x + globalCtx->mainCamera.skyboxOffset.x,
|
||||
actor->posRot.pos.y +
|
||||
(f32)((actor->shape.unk_08 * actor->scale.y) + globalCtx->mainCamera.unk_80.y),
|
||||
actor->posRot.pos.z + globalCtx->mainCamera.unk_80.z, &actor->shape.rot);
|
||||
(f32)((actor->shape.unk_08 * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y),
|
||||
actor->posRot.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
||||
} else {
|
||||
func_800D1694(actor->posRot.pos.x, actor->posRot.pos.y + (actor->shape.unk_08 * actor->scale.y),
|
||||
actor->posRot.pos.z, &actor->shape.rot);
|
||||
|
@ -2846,7 +2846,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
|||
|
||||
if ((player != NULL) && (actor == player->unk_664)) {
|
||||
func_8008EDF0(player);
|
||||
func_8005A444(Gameplay_GetCamera(globalCtx, Gameplay_GetActiveCamId(globalCtx)), 0);
|
||||
Camera_ChangeMode(Gameplay_GetCamera(globalCtx, Gameplay_GetActiveCamId(globalCtx)), 0);
|
||||
}
|
||||
|
||||
if (actor == actorCtx->targetCtx.arrowPointedActor) {
|
||||
|
@ -3831,7 +3831,7 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) {
|
|||
Player* player = PLAYER;
|
||||
f32 var;
|
||||
|
||||
if ((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) {
|
||||
if ((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) {
|
||||
var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &globalCtx->view.eye) * 0.25f;
|
||||
} else {
|
||||
var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &player->actor.posRot.pos);
|
||||
|
@ -5474,7 +5474,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
|
|||
actor->posRot2.pos = actor->posRot.pos;
|
||||
actor->posRot2.pos.y += arg4;
|
||||
|
||||
if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE))) {
|
||||
if (!(((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE))) {
|
||||
var = actor->yawTowardsLink - actor->shape.rot.y;
|
||||
abs_var = ABS(var);
|
||||
if (abs_var >= 0x4300) {
|
||||
|
@ -5483,7 +5483,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
|
|||
}
|
||||
}
|
||||
|
||||
if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE)) {
|
||||
if (((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE)) {
|
||||
sp2C = globalCtx->view.eye;
|
||||
} else {
|
||||
sp2C = player->actor.posRot2.pos;
|
||||
|
@ -5503,7 +5503,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
|
|||
|
||||
actor->posRot2.pos = arg4;
|
||||
|
||||
if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE))) {
|
||||
if (!(((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE))) {
|
||||
var = actor->yawTowardsLink - actor->shape.rot.y;
|
||||
abs_var = ABS(var);
|
||||
if (abs_var >= 0x4300) {
|
||||
|
@ -5512,7 +5512,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
|
|||
}
|
||||
}
|
||||
|
||||
if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE)) {
|
||||
if (((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE)) {
|
||||
sp24 = globalCtx->view.eye;
|
||||
} else {
|
||||
sp24 = player->actor.posRot2.pos;
|
||||
|
|
|
@ -354,7 +354,7 @@ void func_80041978(s32 iParm1, s32 iParm2) {
|
|||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800419B0.s")
|
||||
|
||||
u32 func_80041A28(CollisionContext* a0, u32 a1, u32 a2) {
|
||||
s32 func_80041A28(CollisionContext* a0, CollisionPoly* a1, u32 a2) {
|
||||
u32 uVar1;
|
||||
|
||||
uVar1 = func_800419B0(a0, a1, a2, 0);
|
||||
|
@ -436,9 +436,9 @@ s32 func_80042108(CollisionContext* a0, CollisionPoly* a1, u32 a2) {
|
|||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042244.s")
|
||||
|
||||
u8 func_80042538(CollisionContext* colCtx, s32 iParm2) {
|
||||
u32 var1 = *(u32*)(iParm2 + 0xc);
|
||||
return var1;
|
||||
u32 func_80042538(CollisionContext* colCtx, WaterBox* arg1) {
|
||||
u32 unk0C = arg1->unk_0C;
|
||||
return unk0C & 0xFF;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042548.s")
|
||||
|
|
10174
src/code/z_camera.c
10174
src/code/z_camera.c
File diff suppressed because it is too large
Load diff
3573
src/code/z_camera_data.c
Normal file
3573
src/code/z_camera_data.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "z64camera.h"
|
||||
|
||||
u16 D_8011E1C0 = 0;
|
||||
u16 D_8011E1C4 = 0;
|
||||
|
@ -104,7 +105,7 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
}
|
||||
|
||||
if (CHECK_BTN_ALL(pad1->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) &&
|
||||
(gSaveContext.sceneSetupIndex >= 4) && (D_8011D394 == 0)) {
|
||||
(gSaveContext.sceneSetupIndex >= 4) && (gDbgCamEnabled == 0)) {
|
||||
D_8015FCC8 = 1;
|
||||
gSaveContext.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
|
@ -1288,12 +1289,12 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext*
|
|||
if (csCtx->unk_1A != 0) {
|
||||
csCtx->unk_18 = cmdBase->startFrame;
|
||||
if (D_8015FCC8 != 0) {
|
||||
func_800C0874(globalCtx, csCtx->unk_14, 0x25);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, 1);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, 7);
|
||||
func_8005AC60(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
|
||||
func_8005AC6C(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, csCtx->cameraPosition,
|
||||
PLAYER, relativeToLink);
|
||||
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_DEMO0);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
|
||||
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
|
||||
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus,
|
||||
csCtx->cameraPosition, PLAYER, relativeToLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1325,12 +1326,12 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt
|
|||
if (csCtx->unk_1B != 0) {
|
||||
D_8015FCC0 = cmdBase->startFrame;
|
||||
if (D_8015FCC8 != 0) {
|
||||
func_800C0874(globalCtx, csCtx->unk_14, 0x25);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, 1);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, 7);
|
||||
func_8005AC60(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
|
||||
func_8005AC6C(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, csCtx->cameraPosition,
|
||||
PLAYER, relativeToLink);
|
||||
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_DEMO0);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
|
||||
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
|
||||
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus,
|
||||
csCtx->cameraPosition, PLAYER, relativeToLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1367,9 +1368,9 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
|
|||
if (D_8015FCC8 != 0) {
|
||||
sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14);
|
||||
sp2C->player = NULL;
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, 1);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, 7);
|
||||
func_800C0874(globalCtx, csCtx->unk_14, 0x21);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
|
||||
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0);
|
||||
sp28 = csCtx->cameraFocus->cameraRoll * 1.40625f;
|
||||
Camera_SetParam(sp2C, 64, &sp28);
|
||||
sp3C.x = csCtx->cameraFocus->pos.x;
|
||||
|
@ -1378,8 +1379,8 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
|
|||
sp30.x = csCtx->cameraPosition->pos.x;
|
||||
sp30.y = csCtx->cameraPosition->pos.y;
|
||||
sp30.z = csCtx->cameraPosition->pos.z;
|
||||
func_800C04D8(globalCtx, csCtx->unk_14, &sp3C, &sp30);
|
||||
func_800C0704(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
|
||||
Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30);
|
||||
Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1410,17 +1411,17 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
|
|||
if (D_8015FCC8 != 0) {
|
||||
sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14);
|
||||
sp2C->player = NULL;
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, 1);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, 7);
|
||||
func_800C0874(globalCtx, csCtx->unk_14, 0x21);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT);
|
||||
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
|
||||
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0);
|
||||
sp3C.x = csCtx->cameraFocus->pos.x;
|
||||
sp3C.y = csCtx->cameraFocus->pos.y;
|
||||
sp3C.z = csCtx->cameraFocus->pos.z;
|
||||
sp30.x = csCtx->cameraPosition->pos.x;
|
||||
sp30.y = csCtx->cameraPosition->pos.y;
|
||||
sp30.z = csCtx->cameraPosition->pos.z;
|
||||
func_800C04D8(globalCtx, csCtx->unk_14, &sp3C, &sp30);
|
||||
func_800C0704(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
|
||||
Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30);
|
||||
Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1909,7 +1910,7 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
case 0x028E:
|
||||
case 0x0292:
|
||||
case 0x0476:
|
||||
func_800C078C(globalCtx, D_8015FCC6, csCtx->unk_14);
|
||||
Gameplay_CopyCamera(globalCtx, D_8015FCC6, csCtx->unk_14);
|
||||
}
|
||||
|
||||
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, 7);
|
||||
|
|
|
@ -246,7 +246,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
|
|||
sp54.y = player->actor.posRot.pos.y + 100.0f;
|
||||
sp54.z = player->actor.posRot.pos.z;
|
||||
|
||||
func_800C04D8(globalCtx, globalCtx->activeCamera, &player->actor.posRot.pos, &sp54);
|
||||
Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.posRot.pos, &sp54);
|
||||
} else {
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x,
|
||||
D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0,
|
||||
|
|
|
@ -75,19 +75,19 @@ Vec3f* OLib_Vec3fDistNormalize(Vec3f* dest, Vec3f* a, Vec3f* b) {
|
|||
*/
|
||||
Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph) {
|
||||
Vec3f v;
|
||||
f32 sinPhi;
|
||||
f32 cosPhi;
|
||||
f32 sinTheta;
|
||||
f32 cosTheta;
|
||||
f32 sinPitch;
|
||||
f32 cosPitch;
|
||||
f32 sinYaw;
|
||||
f32 cosYaw;
|
||||
|
||||
cosPhi = Math_Coss(sph->pitch);
|
||||
cosTheta = Math_Coss(sph->yaw);
|
||||
sinPhi = Math_Sins(sph->pitch);
|
||||
sinTheta = Math_Sins(sph->yaw);
|
||||
cosPitch = Math_Coss(sph->pitch);
|
||||
cosYaw = Math_Coss(sph->yaw);
|
||||
sinPitch = Math_Sins(sph->pitch);
|
||||
sinYaw = Math_Sins(sph->yaw);
|
||||
|
||||
v.x = sph->r * sinPhi * sinTheta;
|
||||
v.y = sph->r * cosPhi;
|
||||
v.z = sph->r * sinPhi * cosTheta;
|
||||
v.x = sph->r * sinPitch * sinYaw;
|
||||
v.y = sph->r * cosPitch;
|
||||
v.z = sph->r * sinPitch * cosYaw;
|
||||
|
||||
*dest = v;
|
||||
|
||||
|
|
|
@ -1,36 +1,30 @@
|
|||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x08 */ s16 unk_08;
|
||||
/* 0x0A */ s16 unk_0A;
|
||||
} struct_8007C820;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C680.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C704.s")
|
||||
|
||||
void func_8007C76C(f32* pfParm1, s16* puParm2) {
|
||||
puParm2[0] = pfParm1[0];
|
||||
puParm2[1] = pfParm1[1];
|
||||
puParm2[2] = pfParm1[2];
|
||||
void func_8007C76C(Vec3f* src, Vec3s* dst) {
|
||||
dst->x = src->x;
|
||||
dst->y = src->y;
|
||||
dst->z = src->z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C7A8.s")
|
||||
|
||||
void func_8007C7F8(u32 uParm1, u32 uParm2) {
|
||||
u8 auStack4[4];
|
||||
u8 auStack8[4];
|
||||
void func_8007C7F8(CollisionContext* colCtx, Vec3f* arg1) {
|
||||
CollisionPoly* poly;
|
||||
s32 bgId;
|
||||
|
||||
func_8003C940(uParm1, auStack4, auStack8, uParm2);
|
||||
func_8003C940(colCtx, &poly, &bgId, arg1);
|
||||
}
|
||||
|
||||
void func_8007C820(struct_8007C820* puParm1, s16 uParm2, s16 uParm3, u32 uParm4, u32 param_5) {
|
||||
puParm1->unk_00 = uParm4;
|
||||
puParm1->unk_04 = param_5;
|
||||
puParm1->unk_08 = uParm2;
|
||||
puParm1->unk_0A = uParm3;
|
||||
void func_8007C820(OnePointDemoCamera* onePointCamera, s16 actionParameters, s16 initTimer,
|
||||
CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints) {
|
||||
onePointCamera->atPoints = atPoints;
|
||||
onePointCamera->eyePoints = eyePoints;
|
||||
onePointCamera->actionParameters = actionParameters;
|
||||
onePointCamera->initTimer = initTimer;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C850.s")
|
||||
|
|
|
@ -14,7 +14,7 @@ s16 D_801614C8;
|
|||
u64 D_801614D0[0xA00];
|
||||
|
||||
void func_800BC450(GlobalContext* globalCtx) {
|
||||
func_8005A7A8(ACTIVE_CAM, globalCtx->unk_1242B - 1);
|
||||
Camera_ChangeDataIdx(ACTIVE_CAM, globalCtx->unk_1242B - 1);
|
||||
}
|
||||
|
||||
void func_800BC490(GlobalContext* globalCtx, s16 point) {
|
||||
|
@ -223,12 +223,12 @@ void Gameplay_Init(GameState* thisx) {
|
|||
globalCtx->cameraPtrs[i] = NULL;
|
||||
}
|
||||
|
||||
func_80057C6C(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->mainCamera, 7);
|
||||
Camera_Init(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->mainCamera, CAM_STAT_ACTIVE);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
func_80057C6C(&globalCtx->subCameras[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->subCameras[i], 0x100);
|
||||
Camera_Init(&globalCtx->subCameras[i + 1], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->subCameras[i + 1], 0x100);
|
||||
}
|
||||
|
||||
globalCtx->cameraPtrs[0] = &globalCtx->mainCamera;
|
||||
|
@ -385,13 +385,13 @@ void Gameplay_Init(GameState* thisx) {
|
|||
}
|
||||
|
||||
player = PLAYER;
|
||||
func_80058148(&globalCtx->mainCamera, player);
|
||||
func_8005A444(&globalCtx->mainCamera, 0);
|
||||
Camera_InitPlayerSettings(&globalCtx->mainCamera, player);
|
||||
Camera_ChangeMode(&globalCtx->mainCamera, CAM_MODE_NORMAL);
|
||||
|
||||
playerStartCamId = player->actor.params & 0xFF;
|
||||
if (playerStartCamId != 0xFF) {
|
||||
osSyncPrintf("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartCamId);
|
||||
func_8005A7A8(&globalCtx->mainCamera, playerStartCamId);
|
||||
Camera_ChangeDataIdx(&globalCtx->mainCamera, playerStartCamId);
|
||||
}
|
||||
|
||||
if (YREG(15) == 0x20) {
|
||||
|
@ -1011,7 +1011,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
LOG_NUM("1", 1, "../z_play.c", 3801);
|
||||
}
|
||||
|
||||
if ((sp80 == 0) || (D_8011D394 != 0)) {
|
||||
if ((sp80 == 0) || (gDbgCamEnabled != 0)) {
|
||||
s32 i; // 0x54
|
||||
s32 camIdx;
|
||||
Vec3s sp48;
|
||||
|
@ -1028,12 +1028,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
LOG_NUM("1", 1, "../z_play.c", 3809);
|
||||
}
|
||||
|
||||
func_800591EC(&sp48, globalCtx->cameraPtrs[i]);
|
||||
Camera_Update(&sp48, globalCtx->cameraPtrs[i]);
|
||||
camIdx = globalCtx->nextCamera;
|
||||
}
|
||||
}
|
||||
|
||||
func_800591EC(&sp48, globalCtx->cameraPtrs[camIdx]);
|
||||
Camera_Update(&sp48, globalCtx->cameraPtrs[camIdx]);
|
||||
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3814);
|
||||
|
@ -1231,7 +1231,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
if (globalCtx->skyboxCtx.unk_140 != 0) {
|
||||
if (ACTIVE_CAM->setting != 0x19) {
|
||||
Vec3f sp74;
|
||||
func_8005AFB4(&sp74, ACTIVE_CAM);
|
||||
Camera_GetSkyboxOffset(&sp74, ACTIVE_CAM);
|
||||
SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0,
|
||||
globalCtx->view.eye.x + sp74.x, globalCtx->view.eye.y + sp74.y,
|
||||
globalCtx->view.eye.z + sp74.z);
|
||||
|
@ -1313,7 +1313,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
if (globalCtx->view.unk_124 != 0) {
|
||||
Vec3s sp50;
|
||||
func_800591EC(&sp50, ACTIVE_CAM);
|
||||
Camera_Update(&sp50, ACTIVE_CAM);
|
||||
func_800AB944(&globalCtx->view);
|
||||
globalCtx->view.unk_124 = 0;
|
||||
if ((globalCtx->skyboxId != 0) && (globalCtx->skyboxId != 0x1D) && !globalCtx->envCtx.skyDisabled) {
|
||||
|
@ -1322,7 +1322,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
func_80059EC8(ACTIVE_CAM);
|
||||
Camera_Finish(ACTIVE_CAM);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_play.c", 4508);
|
||||
}
|
||||
|
@ -1533,8 +1533,8 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) {
|
|||
i);
|
||||
|
||||
globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - 1];
|
||||
func_80057C6C(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
globalCtx->cameraPtrs[i]->unk_164 = i;
|
||||
Camera_Init(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
globalCtx->cameraPtrs[i]->thisIdx = i;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -1589,94 +1589,94 @@ Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) {
|
|||
return globalCtx->cameraPtrs[camIdx];
|
||||
}
|
||||
|
||||
s32 func_800C04D8(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3) {
|
||||
s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, arg2);
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, arg3);
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
player = camera->player;
|
||||
if (player != NULL) {
|
||||
camera->unk_E4.x = arg2->x - player->actor.posRot.pos.x;
|
||||
camera->unk_E4.y = arg2->y - player->actor.posRot.pos.y;
|
||||
camera->unk_E4.z = arg2->z - player->actor.posRot.pos.z;
|
||||
camera->posOffset.x = at->x - player->actor.posRot.pos.x;
|
||||
camera->posOffset.y = at->y - player->actor.posRot.pos.y;
|
||||
camera->posOffset.z = at->z - player->actor.posRot.pos.z;
|
||||
} else {
|
||||
camera->unk_E4.x = camera->unk_E4.y = camera->unk_E4.z = 0.0f;
|
||||
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
||||
}
|
||||
|
||||
camera->unk_100 = 0.01f;
|
||||
camera->atLERPStepScale = 0.01f;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4) {
|
||||
s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, arg2);
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, arg3);
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 4, arg4);
|
||||
ret |= Camera_SetParam(camera, 4, up);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
player = camera->player;
|
||||
if (player != NULL) {
|
||||
camera->unk_E4.x = arg2->x - player->actor.posRot.pos.x;
|
||||
camera->unk_E4.y = arg2->y - player->actor.posRot.pos.y;
|
||||
camera->unk_E4.z = arg2->z - player->actor.posRot.pos.z;
|
||||
camera->posOffset.x = at->x - player->actor.posRot.pos.x;
|
||||
camera->posOffset.y = at->y - player->actor.posRot.pos.y;
|
||||
camera->posOffset.z = at->z - player->actor.posRot.pos.z;
|
||||
} else {
|
||||
camera->unk_E4.x = camera->unk_E4.y = camera->unk_E4.z = 0.0f;
|
||||
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
||||
}
|
||||
|
||||
camera->unk_100 = 0.01f;
|
||||
camera->atLERPStepScale = 0.01f;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C0704(GlobalContext* globalCtx, s16 camId, f32 arg2) {
|
||||
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 32, &arg2) & 1;
|
||||
s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) {
|
||||
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 0x20, &fov) & 1;
|
||||
if (1) {}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C0744(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) {
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera;
|
||||
|
||||
camera = globalCtx->cameraPtrs[camIdx];
|
||||
camera->roll = arg2;
|
||||
camera->roll = roll;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void func_800C078C(GlobalContext* globalCtx, s16 camId1, s16 camId2) {
|
||||
void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2) {
|
||||
s16 camIdx2 = (camId2 == -1) ? globalCtx->activeCamera : camId2;
|
||||
s16 camIdx1 = (camId1 == -1) ? globalCtx->activeCamera : camId1;
|
||||
|
||||
func_8005AE64(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]);
|
||||
Camera_Copy(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]);
|
||||
}
|
||||
|
||||
s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 arg3) {
|
||||
s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting) {
|
||||
Camera* camera;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
|
||||
camera = globalCtx->cameraPtrs[camIdx];
|
||||
func_80058148(camera, player);
|
||||
return func_8005A77C(camera, arg3);
|
||||
Camera_InitPlayerSettings(camera, player);
|
||||
return Camera_ChangeSetting(camera, setting);
|
||||
}
|
||||
|
||||
void func_800C0874(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
func_8005A77C(Gameplay_GetCamera(globalCtx, camId), arg2);
|
||||
s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting) {
|
||||
return Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, camId), setting);
|
||||
}
|
||||
|
||||
void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
|
@ -1695,14 +1695,14 @@ void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
|||
}
|
||||
|
||||
if (arg2 <= 0) {
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, 7);
|
||||
globalCtx->cameraPtrs[0]->unk_14E = globalCtx->cameraPtrs[0]->unk_162 = 0;
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_ACTIVE);
|
||||
globalCtx->cameraPtrs[0]->childCamIdx = globalCtx->cameraPtrs[0]->parentCamIdx = 0;
|
||||
} else {
|
||||
func_800800F8(globalCtx, 1020, arg2, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
s16 func_800C09A4(GlobalContext* globalCtx, s16 camId) {
|
||||
s16 Gameplay_CameraGetUID(GlobalContext* globalCtx, s16 camId) {
|
||||
Camera* camera = globalCtx->cameraPtrs[camId];
|
||||
|
||||
if (camera != NULL) {
|
||||
|
@ -1827,7 +1827,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) {
|
|||
}
|
||||
|
||||
s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* arg1) {
|
||||
UNK_TYPE sp3C;
|
||||
WaterBox* sp3C;
|
||||
CollisionPoly* sp38;
|
||||
Vec3f sp2C;
|
||||
s32 sp28;
|
||||
|
|
|
@ -406,7 +406,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
|
|||
this->unk_684 = actor;
|
||||
this->stateFlags1 |= 0x10000;
|
||||
Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor);
|
||||
func_8005A444(Gameplay_GetCamera(globalCtx, 0), 2);
|
||||
Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2);
|
||||
}
|
||||
|
||||
s32 func_8008EF30(GlobalContext* globalCtx) {
|
||||
|
|
|
@ -148,7 +148,7 @@ QuakeRequest* Quake_AddImpl(Camera* cam, u32 callbackIdx) {
|
|||
|
||||
func_80106860(req, 0, sizeof(QuakeRequest)); // memset
|
||||
req->cam = cam;
|
||||
req->camPtrIdx = cam->unk_164;
|
||||
req->camPtrIdx = cam->thisIdx;
|
||||
req->callbackIdx = callbackIdx;
|
||||
req->unk_1C = 1;
|
||||
req->randIdx = ((s16)(Math_Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
||||
|
@ -293,7 +293,7 @@ u32 Quake_RemoveFromIdx(s16 idx) {
|
|||
return false;
|
||||
}
|
||||
|
||||
s16 Quake_Calc(Camera* camera, UnkQuakeCalcStruct* camData) {
|
||||
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
|
||||
f32 max;
|
||||
f32 max2;
|
||||
QuakeRequest* req;
|
||||
|
@ -314,12 +314,12 @@ s16 Quake_Calc(Camera* camera, UnkQuakeCalcStruct* camData) {
|
|||
camData->rotZ = 0;
|
||||
camData->unk_1A = 0;
|
||||
camData->zoom = 0;
|
||||
camData->vec1.x = 0.0f;
|
||||
camData->vec1.y = 0.0f;
|
||||
camData->vec1.z = 0.0f;
|
||||
camData->vec2.x = 0.0f;
|
||||
camData->vec2.y = 0.0f;
|
||||
camData->vec2.z = 0.0f;
|
||||
camData->atOffset.x = 0.0f;
|
||||
camData->atOffset.y = 0.0f;
|
||||
camData->atOffset.z = 0.0f;
|
||||
camData->eyeOffset.x = 0.0f;
|
||||
camData->eyeOffset.y = 0.0f;
|
||||
camData->eyeOffset.z = 0.0f;
|
||||
camData->unk_20 = 0.0f;
|
||||
|
||||
if (sQuakeRequestCount == 0) {
|
||||
|
@ -335,29 +335,29 @@ s16 Quake_Calc(Camera* camera, UnkQuakeCalcStruct* camData) {
|
|||
req->camPtrIdx);
|
||||
Quake_Remove(req);
|
||||
} else {
|
||||
temp = &camera->unk_164;
|
||||
eq = req->cam->unk_164 != *temp;
|
||||
temp = &camera->thisIdx;
|
||||
eq = req->cam->thisIdx != *temp;
|
||||
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
|
||||
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
|
||||
Quake_Remove(req);
|
||||
} else if (eq == 0) {
|
||||
if (fabsf(camData->vec1.x) < fabsf(shake.vec1.x)) {
|
||||
camData->vec1.x = shake.vec1.x;
|
||||
if (fabsf(camData->atOffset.x) < fabsf(shake.vec1.x)) {
|
||||
camData->atOffset.x = shake.vec1.x;
|
||||
}
|
||||
if (fabsf(camData->vec1.y) < fabsf(shake.vec1.y)) {
|
||||
camData->vec1.y = shake.vec1.y;
|
||||
if (fabsf(camData->atOffset.y) < fabsf(shake.vec1.y)) {
|
||||
camData->atOffset.y = shake.vec1.y;
|
||||
}
|
||||
if (fabsf(camData->vec1.z) < fabsf(shake.vec1.z)) {
|
||||
camData->vec1.z = shake.vec1.z;
|
||||
if (fabsf(camData->atOffset.z) < fabsf(shake.vec1.z)) {
|
||||
camData->atOffset.z = shake.vec1.z;
|
||||
}
|
||||
if (fabsf(camData->vec2.x) < fabsf(shake.vec2.x)) {
|
||||
camData->vec2.x = shake.vec2.x;
|
||||
if (fabsf(camData->eyeOffset.x) < fabsf(shake.vec2.x)) {
|
||||
camData->eyeOffset.x = shake.vec2.x;
|
||||
}
|
||||
if (fabsf(camData->vec2.y) < fabsf(shake.vec2.y)) {
|
||||
camData->vec2.y = shake.vec2.y;
|
||||
if (fabsf(camData->eyeOffset.y) < fabsf(shake.vec2.y)) {
|
||||
camData->eyeOffset.y = shake.vec2.y;
|
||||
}
|
||||
if (fabsf(camData->vec2.z) < fabsf(shake.vec2.z)) {
|
||||
camData->vec2.z = shake.vec2.z;
|
||||
if (fabsf(camData->eyeOffset.z) < fabsf(shake.vec2.z)) {
|
||||
camData->eyeOffset.z = shake.vec2.z;
|
||||
}
|
||||
if (camData->rotZ < shake.rotZ) {
|
||||
camData->rotZ = shake.rotZ;
|
||||
|
|
|
@ -358,7 +358,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
|
|||
{
|
||||
Vec3f sp60;
|
||||
spA8 = POLY_OPA_DISP;
|
||||
func_8005AFB4(&sp60, camera);
|
||||
Camera_GetSkyboxOffset(&sp60, camera);
|
||||
func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut, polygon1->single.width,
|
||||
polygon1->single.height, polygon1->single.fmt, polygon1->single.siz,
|
||||
polygon1->single.mode0, polygon1->single.tlutCount,
|
||||
|
@ -390,8 +390,9 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
|
|||
s32 i;
|
||||
|
||||
camera = ACTIVE_CAM;
|
||||
camId = camera->unk_148;
|
||||
camId2 = func_80041C10(&globalCtx->colCtx, camId, 50)->unk_0E;
|
||||
camId = camera->camDataIdx;
|
||||
// jfifid
|
||||
camId2 = func_80041C10(&globalCtx->colCtx, camId, 50)[2].y;
|
||||
if (camId2 >= 0) {
|
||||
camId = camId2;
|
||||
}
|
||||
|
@ -453,7 +454,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
|
|||
{
|
||||
Vec3f sp5C;
|
||||
spA8 = POLY_OPA_DISP;
|
||||
func_8005AFB4(&sp5C, camera);
|
||||
Camera_GetSkyboxOffset(&sp5C, camera);
|
||||
func_8009638C(&spA8, bgImage->source, bgImage->tlut, bgImage->width, bgImage->height, bgImage->fmt,
|
||||
bgImage->siz, bgImage->mode0, bgImage->tlutCount,
|
||||
(sp5C.x + sp5C.z) * 1.2f + sp5C.y * 0.6f, sp5C.y * 2.4f + (sp5C.x + sp5C.z) * 0.3f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue