1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +00:00

Decompile z_camera data, and some camera WIP (#173)

* 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
This commit is contained in:
krimtonz 2020-06-01 16:54:47 -05:00 committed by GitHub
parent 08aaba0d2c
commit 77137f5a04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 3967 additions and 2282 deletions

5
src/code/code_800BB0A0.c Normal file
View file

@ -0,0 +1,5 @@
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800BB0A0/func_800BB0A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800BB0A0/func_800BB2B4.s")

File diff suppressed because it is too large Load diff

View file

@ -1372,7 +1372,7 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, 7);
func_800C0874(globalCtx, csCtx->unk_14, 0x21);
sp28 = csCtx->cameraFocus->cameraRoll * 1.40625f;
func_8005AA90(sp2C, 64, &sp28);
Camera_SetParam(sp2C, 64, &sp28);
sp3C.x = csCtx->cameraFocus->pos.x;
sp3C.y = csCtx->cameraFocus->pos.y;
sp3C.z = csCtx->cameraFocus->pos.z;

View file

@ -1235,7 +1235,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((HREG(80) != 10) || (HREG(83) != 0)) {
if (globalCtx->skyboxCtx.unk_140 != 0) {
if (ACTIVE_CAM->unk_142 != 0x19) {
if (ACTIVE_CAM->setting != 0x19) {
Vec3f sp74;
func_8005AFB4(&sp74, ACTIVE_CAM);
SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0,
@ -1605,13 +1605,13 @@ s32 func_800C04D8(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3)
camera = globalCtx->cameraPtrs[camIdx];
ret = func_8005AA90(camera, 1, arg2);
ret = Camera_SetParam(camera, 1, arg2);
ret *= 2;
ret |= func_8005AA90(camera, 2, arg3);
ret |= Camera_SetParam(camera, 2, arg3);
if (1) {} // Necessary to match
camera->unk_DC = Math3D_Vec3f_DistXYZ(arg2, arg3);
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
player = camera->player;
if (player != NULL) {
@ -1639,13 +1639,13 @@ s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3,
if (1) {} // Probably necessary to match
ret = func_8005AA90(camera, 1, arg2);
ret = Camera_SetParam(camera, 1, arg2);
ret *= 2;
ret |= func_8005AA90(camera, 2, arg3);
ret |= Camera_SetParam(camera, 2, arg3);
ret *= 2;
ret |= func_8005AA90(camera, 4, arg4);
ret |= Camera_SetParam(camera, 4, arg4);
camera->unk_DC = func_800CB678(arg2, arg3);
camera->dist = func_800CB678(arg2, arg3);
player = camera->player;
if (player != NULL) {
@ -1667,7 +1667,7 @@ s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3,
#ifdef NON_MATCHING
// missing an extra move instruction
s32 func_800C0704(GlobalContext* globalCtx, s16 camId, f32 arg2) {
return (func_8005AA90(globalCtx->cameraPtrs[camId], 32, &arg2) & 1);
return (Camera_SetParam(globalCtx->cameraPtrs[camId], 32, &arg2) & 1);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0704.s")
@ -1678,7 +1678,7 @@ s32 func_800C0744(GlobalContext* globalCtx, s16 camId, s16 arg2) {
Camera* camera;
camera = globalCtx->cameraPtrs[camIdx];
camera->unk_15A = arg2;
camera->roll = arg2;
return 1;
}

View file

@ -248,7 +248,7 @@ void func_8008EEAC(GlobalContext* globalCtx, UNK_PTR arg1) {
player->unk_664 = arg1;
player->unk_684 = arg1;
player->stateFlags1 |= 0x10000;
func_8005AA90(Gameplay_GetCamera(globalCtx, 0), 8, arg1);
Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, arg1);
func_8005A444(Gameplay_GetCamera(globalCtx, 0), 2);
}
#else

View file

@ -345,7 +345,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
camera = ACTIVE_CAM;
polygon1 = &room->mesh->polygon1;
sp9C = (camera->unk_142 ^ 25) == 0;
sp9C = (camera->setting ^ 25) == 0;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
sp98 = (flags & 1) && sp9C && polygon1->single.source && !(SREG(25) & 1);
sp94 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2);
@ -390,13 +390,6 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 691);
}
typedef struct {
char unk_00[0x0E];
s16 unk_0E;
} struct_80041C10_ret;
extern struct_80041C10_ret* func_80041C10(CollisionContext*, s32, s32);
BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
Camera* camera;
s32 camId;
@ -450,7 +443,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 752);
camera = ACTIVE_CAM;
sp98 = (camera->unk_142 ^ 25) == 0;
sp98 = (camera->setting ^ 25) == 0;
polygon1 = &room->mesh->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
bgImage = func_80096A74(polygon1, globalCtx);