match update_cameras (#321)

* near-match func_800279B4

* fix lakilester split

* match func_8023A1B0_70DEC0

* match func_800271FC

* further work on func_800279B4

* match update_cameras

* add CAM_FLAGs

* remove CAM macro
This commit is contained in:
alex 2021-07-17 18:04:14 +01:00 committed by GitHub
parent a876384c97
commit 0538a9220b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 479 additions and 652 deletions

View File

@ -95,10 +95,10 @@ extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
*/
extern void guMtxIdent(Mtx *m);
extern void guMtxIdentF(float mf[4][4]);
/*extern void guOrtho(Mtx *m, float l, float r, float b, float t,
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
float n, float f, float scale);*/
float n, float f, float scale);
extern void guFrustum(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t,

View File

@ -3,4 +3,13 @@
extern f32 D_8009A5EC;
enum {
CAM_FLAG_ENABLED = 0x2,
CAM_FLAG_LEAD_PLAYER = 0x4,
CAM_FLAG_SHAKING = 0x8,
CAM_FLAG_ORTHO = 0x10,
CAM_FLAG_80 = 0x80,
CAM_FLAG_1000 = 0x1000,
};
#endif

View File

@ -523,7 +523,7 @@ typedef struct CameraInitData {
} CameraInitData; // size = 0x12;
typedef struct Camera {
/* 0x000 */ s16 flags;
/* 0x000 */ u16 flags;
/* 0x002 */ s16 moveFlags;
/* 0x004 */ s16 mode;
/* 0x006 */ s16 unk_06;

View File

@ -20,8 +20,6 @@
#define PANIC() ASSERT(0)
#define STATIC_ASSERT(condition) enum { static_assert_fail = 1/(!!(condition)) } // Causes division by zero ("not integer constant") if false
#define CAM(id) (&gCameras[id])
#define BADGE_MENU_PAGE(index) (&gBadgeMenuPages[index])
#define ITEM_MENU_PAGE(index) (&gItemMenuPages[index])

View File

@ -5,7 +5,78 @@
void initialize_next_camera(CameraInitData* data);
INCLUDE_ASM(s32, "8800", update_cameras);
void update_cameras(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(gCameras); i++) {
Camera* cam = &gCameras[i];
if (cam->flags != 0 && !(cam->flags & CAM_FLAG_ENABLED)) {
s32 sx;
s32 sy;
s32 sz;
gCurrentCamID = i;
switch (cam->mode) {
case 3:
update_camera_zone_interp(cam);
break;
case 0:
update_camera_mode_0(cam);
break;
case 1:
update_camera_mode_1(cam);
break;
case 2:
update_camera_mode_2(cam);
break;
case 4:
update_camera_mode_4(cam);
break;
case 5:
update_camera_mode_5(cam);
break;
case 6:
default:
update_camera_mode_6(cam);
break;
}
guLookAtReflectF(cam->viewMtxPlayer, &gDisplayContext->lookAt[0], cam->lookAt_eye.x, cam->lookAt_eye.y, cam->lookAt_eye.z, cam->lookAt_obj.x, cam->lookAt_obj.y, cam->lookAt_obj.z, 0, 1.0f, 0);
if (!(cam->flags & CAM_FLAG_ORTHO)) {
if (cam->flags & CAM_FLAG_LEAD_PLAYER) {
create_camera_leadplayer_matrix(cam);
}
guPerspectiveF(cam->perspectiveMatrix, &cam->perspNorm, cam->vfov, (f32) cam->viewportW / (f32) cam->viewportH, (f32) cam->nearClip, (f32) cam->farClip, 1.0f);
if (cam->flags & CAM_FLAG_SHAKING) {
guMtxCatF(cam->viewMtxShaking, cam->perspectiveMatrix, cam->perspectiveMatrix);
}
if (cam->flags & CAM_FLAG_LEAD_PLAYER) {
guMtxCatF(cam->viewMtxLeading, cam->perspectiveMatrix, cam->perspectiveMatrix);
}
guMtxCatF(cam->viewMtxPlayer, cam->perspectiveMatrix, cam->perspectiveMatrix);
} else {
f32 w = cam->viewportW;
f32 h = cam->viewportH;
guOrthoF(cam->perspectiveMatrix, -w * 0.5, w * 0.5, -h * 0.5, h * 0.5, -1000.0f, 1000.0f, 1.0f);
}
get_screen_coords(0, cam->targetPos.x, cam->targetPos.y, cam->targetPos.z, &sx, &sy, &sz);
cam->targetScreenCoords[0] = sx;
cam->targetScreenCoords[1] = sy;
cam->targetScreenCoords[2] = sz;
}
}
gCurrentCamID = 0;
}
INCLUDE_ASM(void, "8800", render_frame);
@ -124,19 +195,19 @@ INCLUDE_ASM(void, "8800", initialize_next_camera, CameraInitData* data);
INCLUDE_ASM(void, "8800", set_cam_viewport, s16 id, s16 x, s16 y, s16 width, s16 height);
void get_cam_viewport(s32 camID, u16* x, u16* y, u16* width, u16* height) {
*width = CAM(camID)->viewportW;
*height = CAM(camID)->viewportH;
*x = CAM(camID)->viewportStartX;
*y = CAM(camID)->viewportStartY;
*width = gCameras[camID].viewportW;
*height = gCameras[camID].viewportH;
*x = gCameras[camID].viewportStartX;
*y = gCameras[camID].viewportStartY;
}
INCLUDE_ASM(void, "8800", get_screen_coords, Cam camID, f32 x, f32 y, f32 z, s32* screenX, s32* screenY, s32* screenZ);
s32 func_8002E754(s32 camID, s32 x, s32 y) {
s32 startX = CAM(camID)->viewportStartX;
s32 startY = CAM(camID)->viewportStartY;
s32 endX = startX + CAM(camID)->viewportW;
s32 endY = startY + CAM(camID)->viewportH;
s32 startX = gCameras[camID].viewportStartX;
s32 startY = gCameras[camID].viewportStartY;
s32 endX = startX + gCameras[camID].viewportW;
s32 endY = startY + gCameras[camID].viewportH;
if (x < startX) {
return TRUE;
@ -152,10 +223,10 @@ s32 func_8002E754(s32 camID, s32 x, s32 y) {
}
void func_8002E7CC(s32 camID, s32* x, s32* y, s32* width, s32* height) {
*x = CAM(camID)->viewportStartX;
*y = CAM(camID)->viewportStartY;
*width = CAM(camID)->viewportStartX + CAM(camID)->viewportW;
*height = CAM(camID)->viewportStartY + CAM(camID)->viewportH;
*x = gCameras[camID].viewportStartX;
*y = gCameras[camID].viewportStartY;
*width = gCameras[camID].viewportStartX + gCameras[camID].viewportW;
*height = gCameras[camID].viewportStartY + gCameras[camID].viewportH;
}
INCLUDE_ASM(s32, "8800", func_8002E82C);

View File

@ -1,4 +1,5 @@
#include "dizzy_dial.h"
#include "camera.h"
static s32* D_802A1CD0;
static HudElement* D_802A1CD4;
@ -75,7 +76,7 @@ ApiStatus N(func_802A1270_727B80)(ScriptInstance* script, s32 isInitialCall) {
D_802A1CD0 = create_generic_entity_frontUI(NULL, func_802A123C_727B4C);
script->functionTemp[0] = 1;
case 1:
camera->flags |= 8;
camera->flags |= CAM_FLAG_SHAKING;
a = script->functionTemp[1];
guRotateF(camera->viewMtxShaking, a, 0.0f, 0.0f, 1.0f);
script->functionTemp[1] = 2.0 * ((1.0 - sin_rad(((script->functionTemp[2] + 90) * 6.28318f) / 360.0f)) * 360.0);
@ -84,7 +85,7 @@ ApiStatus N(func_802A1270_727B80)(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_BLOCK;
}
camera->unk_1C = 0;
camera->flags &= ~8;
camera->flags &= ~CAM_FLAG_SHAKING;
free_generic_entity(D_802A1CD0);
return ApiStatus_DONE2;
}

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "camera.h"
Script ShakeCam1 = SCRIPT({
group 0;
@ -16,9 +17,9 @@ ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) {
s32 enabled = get_variable(script, *args++);
if (!enabled) {
CAM(id)->flags |= 0x2;
gCameras[id].flags |= CAM_FLAG_ENABLED;
} else {
CAM(id)->flags &= ~0x2;
gCameras[id].flags &= ~CAM_FLAG_ENABLED;
}
return ApiStatus_DONE2;
}
@ -29,9 +30,9 @@ ApiStatus SetCamFlag80(ScriptInstance* script, s32 isInitialCall) {
s32 enabled = get_variable(script, *args++);
if (!enabled) {
CAM(id)->flags |= 0x80;
gCameras[id].flags |= CAM_FLAG_80;
} else {
CAM(id)->flags &= ~0x80;
gCameras[id].flags &= ~CAM_FLAG_80;
}
return ApiStatus_DONE2;
}
@ -76,25 +77,25 @@ ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar4 = *args++;
f32 temp1, temp2, temp3;
CAM(id)->mode = 2;
CAM(id)->unk_06 = 0;
CAM(id)->unk_1C = -round(CAM(id)->currentPitch);
CAM(id)->unk_1E = -CAM(id)->currentBlendedYawNegated;
gCameras[id].mode = 2;
gCameras[id].unk_06 = 0;
gCameras[id].unk_1C = -round(gCameras[id].currentPitch);
gCameras[id].unk_1E = -gCameras[id].currentBlendedYawNegated;
temp1 = CAM(id)->lookAt_obj.x - CAM(id)->lookAt_eye.x;
temp2 = CAM(id)->lookAt_obj.y - CAM(id)->lookAt_eye.y;
temp3 = CAM(id)->lookAt_obj.z - CAM(id)->lookAt_eye.z;
temp1 = gCameras[id].lookAt_obj.x - gCameras[id].lookAt_eye.x;
temp2 = gCameras[id].lookAt_obj.y - gCameras[id].lookAt_eye.y;
temp3 = gCameras[id].lookAt_obj.z - gCameras[id].lookAt_eye.z;
CAM(id)->unk_20 = round(sqrtf(SQ(temp1) + SQ(temp2) + SQ(temp3)));
CAM(id)->unk_22 = 0;
CAM(id)->unk_54 = CAM(id)->lookAt_obj.x;
CAM(id)->unk_58 = CAM(id)->lookAt_obj.y;
CAM(id)->unk_5C = CAM(id)->lookAt_obj.z;
gCameras[id].unk_20 = round(sqrtf(SQ(temp1) + SQ(temp2) + SQ(temp3)));
gCameras[id].unk_22 = 0;
gCameras[id].unk_54 = gCameras[id].lookAt_obj.x;
gCameras[id].unk_58 = gCameras[id].lookAt_obj.y;
gCameras[id].unk_5C = gCameras[id].lookAt_obj.z;
set_variable(script, outVar1, CAM(id)->unk_1C);
set_variable(script, outVar2, CAM(id)->unk_1E);
set_variable(script, outVar3, CAM(id)->unk_20);
set_variable(script, outVar4, CAM(id)->unk_22);
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;
}
@ -220,9 +221,9 @@ ApiStatus SetCamLeadPlayer(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = &cameras[id];
if (enabled) {
camera->flags |= 0x4;
camera->flags |= CAM_FLAG_LEAD_PLAYER;
} else {
camera->flags &= ~0x4;
camera->flags &= ~CAM_FLAG_LEAD_PLAYER;
}
return ApiStatus_DONE2;
}

View File

@ -350,9 +350,17 @@ void gfx_init_state(void) {
gSPDisplayList(gMasterGfxPos++, OS_K0_TO_PHYSICAL(D_80074210));
}
void func_800271FC(s16*, u32*, s32, s32, void*);
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
INCLUDE_ASM(void, "main_loop", func_800271FC, s16*, u32*, s32, s32, void*);
s32 func_800271FC(const u16* framebuf1, const u16* framebuf2, s32 x, s32 y, u8* out) {
s32 pixel = (x * SCREEN_WIDTH) + y;
out[3] = (framebuf2[pixel] >> 2) & 0xF;
out[0] = framebuf1[pixel] >> 11; // red
out[1] = (framebuf1[pixel] >> 6) & 0x1F; // green
out[2] = (framebuf1[pixel] >> 1) & 0x1F; // blue
}
INCLUDE_ASM(s32, "main_loop", func_8002725C);
@ -360,13 +368,11 @@ INCLUDE_ASM(s32, "main_loop", func_80027600);
INCLUDE_ASM(s32, "main_loop", func_80027774);
// alex: mystery t0=0x140 temp and a few missing loads, but mostly there
// alex: mystery t0=SCREEN_WIDTH temp and weirdness with the `pixel` calculation
#ifdef NON_MATCHING
// arg0 and arg1 probably framebuffer voidptrs
void func_800279B4(u16* arg0, u16* arg1, u16* arg2) {
s32 temp_s4;
s32 j;
s32 i;
void func_800279B4(const u16* framebuf1, u16* framebuf2, u16* arg2) {
s32 x;
s32 y;
s32 subroutine_argE;
s32 subroutine_arg7;
s32 subroutine_arg8;
@ -376,21 +382,24 @@ void func_800279B4(u16* arg0, u16* arg1, u16* arg2) {
s32 subroutine_argC;
s32 subroutine_argF;
for (i = 1; i < 0xEF; i++) {
for (j = 2; j < 0x13E; j++) {
temp_s4 = (subroutine_argF + j) * 2;
for (y = 1; y < SCREEN_HEIGHT - 1; y++) {
for (x = 2; x < SCREEN_WIDTH - 2; x++) {
s32 pixel = (subroutine_argF + x) * 2;
// Wii U VC changes this condition to FALSE to fix pause menu lag
if (((*(temp_s4 + arg1) >> 2) & 0xF) < 8) {
func_800271FC(arg0, arg1, i - 1, j - 1, &subroutine_argE);
func_800271FC(arg0, arg1, i - 1, j + 1, &subroutine_arg7);
func_800271FC(arg0, arg1, i, j - 2, &subroutine_arg8);
func_800271FC(arg0, arg1, i, j + 2, &subroutine_arg9);
func_800271FC(arg0, arg1, i + 1, j - 1, &subroutine_argA);
func_800271FC(arg0, arg1, i + 1, j + 1, &subroutine_argB);
func_800271FC(arg0, arg1, i, j, &subroutine_argC);
func_8002725C(&subroutine_argE, (subroutine_argC << 24) | (subroutine_argC << 16) | (subroutine_argC << 8) | subroutine_argC, arg2 + temp_s4);
if (((framebuf2[pixel] >> 2) & 0xF) < 8) {
func_800271FC(framebuf1, framebuf2, y - 1, x - 1, &subroutine_argE);
func_800271FC(framebuf1, framebuf2, y - 1, x + 1, &subroutine_arg7);
func_800271FC(framebuf1, framebuf2, y, x - 2, &subroutine_arg8);
func_800271FC(framebuf1, framebuf2, y, x + 2, &subroutine_arg9);
func_800271FC(framebuf1, framebuf2, y + 1, x - 1, &subroutine_argA);
func_800271FC(framebuf1, framebuf2, y + 1, x + 1, &subroutine_argB);
func_800271FC(framebuf1, framebuf2, y, x, &subroutine_argC);
func_8002725C(&subroutine_argE, (subroutine_argC << 24) | (subroutine_argC << 16) | (subroutine_argC << 8) | subroutine_argC, &framebuf2[pixel]);
} else {
*(temp_s4 + arg2) = *(temp_s4 + arg0) | 1;
// Edge
framebuf2[pixel] = framebuf1[pixel] | 1;
}
}
}

View File

@ -1,10 +1,7 @@
#include "common.h"
#include "ld_addrs.h"
#include "nu/nusys.h"
// todo remove here and from undefined_syms
extern Addr _163400_BSS_START;
extern Addr _163400_BSS_END;
#include "camera.h"
s32 D_80077980[] = { &D_8038F800, &D_803B5000, &D_803DA800, };
@ -43,11 +40,11 @@ void state_init_file_select(void) {
gCameras[0].unk_06 = 1;
gCameras[0].nearClip = 16;
gCameras[0].farClip = 4096;
gCameras[0].flags |= 2;
gCameras[0].flags |= CAM_FLAG_ENABLED;
gCurrentCameraID = 0;
gCameras[1].flags |= 2;
gCameras[2].flags |= 2;
gCameras[3].flags |= 2;
gCameras[1].flags |= CAM_FLAG_ENABLED;
gCameras[2].flags |= CAM_FLAG_ENABLED;
gCameras[3].flags |= CAM_FLAG_ENABLED;
gCameras[0].vfov = 25.0f;
set_cam_viewport(0, 12, 28, 296, 184);
gCameras[0].unk_1E = 40;

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "ld_addrs.h"
#include "camera.h"
void appendGfx_intro_logos();
@ -41,10 +42,10 @@ void state_init_logos(void) {
gCameras[0].farClip = 0x1000;
gCurrentCameraID = 0;
gCameras[0].vfov = 25.0f;
gCameras[0].flags |= 0x2;
gCameras[1].flags |= 0x2;
gCameras[2].flags |= 0x2;
gCameras[3].flags |= 0x2;
gCameras[0].flags |= CAM_FLAG_ENABLED;
gCameras[1].flags |= CAM_FLAG_ENABLED;
gCameras[2].flags |= CAM_FLAG_ENABLED;
gCameras[3].flags |= CAM_FLAG_ENABLED;
set_cam_viewport(0, 12, 28, 296, 184);
gCameras[0].unk_1E = 0x28;
gCameras[0].bgColor[0] = 0;

View File

@ -203,7 +203,7 @@ NpcGroupList N(npcGroupList_80241A9C) = {
s32 N(func_80240000_BDD1B0)(ScriptInstance* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
f32 phi_f20;
s32 ret = FALSE;

View File

@ -650,7 +650,7 @@ ApiStatus N(func_8024219C_BE594C)(ScriptInstance* script, s32 isInitialCall) {
s32 N(func_80242388_BE5B38)(ScriptInstance* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
f32 phi_f20;
s32 ret = FALSE;

View File

@ -423,7 +423,7 @@ NpcGroupList N(npcGroupList_802425C8) = {
s32 N(func_80240208_C2EDA8)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -748,7 +748,7 @@ NpcGroupList N(npcGroupList_80244988) = {
s32 N(func_80240458_C31938)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -358,7 +358,7 @@ ApiStatus N(func_80240030_C3AA40)(ScriptInstance* script, s32 isInitialCall) {
s32 N(func_80240268_C3AC78)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -267,7 +267,7 @@ static const s32 N(pad_1E74)[] = {
s32 N(func_80240208_C3DDF8)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -1071,7 +1071,7 @@ ApiStatus N(func_80240B94_C40944)(ScriptInstance* script, s32 isInitialCall) {
s32 N(func_80241098_C40E48)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -606,7 +606,7 @@ NpcGroupList N(npcGroupList_8024533C) = {
s32 N(func_80240208_C46DE8)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -454,7 +454,7 @@ Script N(makeEntities) = SCRIPT({
s32 N(func_80240208_C4F718)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -624,7 +624,7 @@ NpcGroupList N(npcGroupList_8024318C) = {
s32 N(func_80240208_C52748)(ScriptInstance* script) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -36,7 +36,7 @@ s32 N(func_80241AD4_B4C544)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -36,7 +36,7 @@ s32 N(func_80241A24_B54254)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -21,7 +21,7 @@ s32 N(func_8024041C_B59C8C)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -20,7 +20,7 @@ s32 N(func_80241870_B5FB20)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -18,7 +18,7 @@ s32 N(func_80240D5C_B6680C)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -18,7 +18,7 @@ s32 N(func_802408DC_B7398C)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -26,7 +26,7 @@ s32 N(func_80240E00_C61B10)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -223,7 +223,7 @@ s32 N(func_80242744_C73BC4)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80241228_C77F08)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80240518_C85FC8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80240708_B93B48)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80240278_BA09A8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80240778_BA4EF8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -115,7 +115,7 @@ s32 N(func_802417A0_BAF0E0)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -125,7 +125,7 @@ s32 N(func_80241FB8_D8F208)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -18,7 +18,7 @@ s32 N(func_80241158_D94098)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -19,7 +19,7 @@ s32 N(func_80240258_D11318)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -17,7 +17,7 @@ s32 N(func_80240208_D189E8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -27,7 +27,7 @@ s32 N(func_80240858_D2C588)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_80240F48_D30BC8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -14,7 +14,7 @@ s32 N(func_802405D8_D37DD8)(ScriptInstance *script) {
PlayerStatus** playerStatus = &gPlayerStatusPtr;
Enemy* enemy = script->owner1.enemy;
Npc *npc = get_npc_unsafe(enemy->npcID);
Camera* camera = CAM(gCurrentCamID);
Camera* camera = &gCameras[gCurrentCamID];
Enemy* enemy2 = get_enemy(enemy->npcID + 1);
f32 phi_f20;
s32 ret = TRUE;

View File

@ -99,7 +99,7 @@ void func_8024029C_B1B80C(void) {
}
void func_80240360_B1B8D0(PlayerStatus* playerStatus) {
f32 yaw = -CAM(gCurrentCamID)->currentYaw;
f32 yaw = -gCameras[gCurrentCamID].currentYaw;
Matrix4f main;
Matrix4f translation;
Matrix4f rotation;

View File

@ -36,7 +36,7 @@ void func_8024003C_B1CA8C(void) {
}
void func_80240100_B1CB50(PlayerStatus* playerStatus) {
f32 yaw = -CAM(gCurrentCamID)->currentYaw;
f32 yaw = -gCameras[gCurrentCamID].currentYaw;
Matrix4f main;
Matrix4f translation;
Matrix4f rotation;

View File

@ -5,7 +5,7 @@ ApiStatus N(CamSetFOV)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 camIdx = get_variable(script, *args++);
CAM(camIdx)->vfov = get_variable(script, *args++);
gCameras[camIdx].vfov = get_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -5,6 +5,6 @@ ApiStatus N(GetCamVfov)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 cameraID = get_variable(script, *args++);
set_variable(script, *args++, SI_FIXED(CAM(cameraID)->vfov));
set_variable(script, *args++, SI_FIXED(gCameras[cameraID].vfov));
return ApiStatus_DONE2;
}

View File

@ -5,6 +5,6 @@ ApiStatus N(SetCamVfov)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 cameraID = get_variable(script, *args++);
CAM(cameraID)->vfov = get_float_variable(script, *args++);
gCameras[cameraID].vfov = get_float_variable(script, *args++);
return ApiStatus_DONE2;
}

View File

@ -2,7 +2,7 @@
#include "map.h"
ApiStatus N(SetCamera0MoveFlag1)(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = CAM(0);
Camera* camera = &gCameras[0];
camera->moveFlags |= 1;
return ApiStatus_DONE2;

View File

@ -1,9 +1,10 @@
#include "common.h"
#include "map.h"
#include "camera.h"
ApiStatus N(UnsetCamera0Flag1000)(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = CAM(0);
Camera* camera = &gCameras[0];
camera->flags &= ~0x1000;
camera->flags &= ~CAM_FLAG_1000;
return ApiStatus_DONE2;
}

View File

@ -2,7 +2,7 @@
#include "map.h"
ApiStatus N(UnsetCamera0MoveFlag1)(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = CAM(0);
Camera* camera = &gCameras[0];
camera->moveFlags &= ~1;
return ApiStatus_DONE2;

View File

@ -118,7 +118,7 @@ void N(reflection_setup_wall)(void) {
}
void N(reflection_render_wall)(PlayerStatus* playerStatus) {
f32 yaw = -CAM(gCurrentCamID)->currentYaw;
f32 yaw = -gCameras[gCurrentCamID].currentYaw;
Matrix4f main;
Matrix4f translation;
Matrix4f rotation;
@ -196,7 +196,7 @@ void N(reflection_setup_floor)(void) {
}
void N(reflection_render_floor)(PlayerStatus* playerStatus) {
f32 yaw = -CAM(gCurrentCamID)->currentYaw;
f32 yaw = -gCameras[gCurrentCamID].currentYaw;
Matrix4f main;
Matrix4f translation;
Matrix4f rotation;
@ -242,7 +242,7 @@ void N(reflection_render_floor_fancy)(PlayerStatus* playerStatus) {
s32 flags;
for (i = 0; i < 2; i++) {
yaw = -CAM(gCurrentCamID)->currentYaw;
yaw = -gCameras[gCurrentCamID].currentYaw;
if (i == 0) {
if ((playerStatus->spriteFacingAngle > 90.0f) && (playerStatus->spriteFacingAngle <= 180.0f)) {

View File

@ -70,7 +70,7 @@ ApiStatus func_80282594(ScriptInstance* script, s32 isInitialCall) {
f32 temp_f0;
temp_f0 = get_float_variable(script, *script->ptrReadPos);
camera = CAM(0);
camera = &gCameras[0];
if (temp_f0 >= 0.0f) {
D_80286540 = camera->moveSpeed;

View File

@ -1,6 +1,7 @@
#include "common.h"
#include "ld_addrs.h"
#include "map.h"
#include "camera.h"
#define ASSET_TABLE_ROM_START 0x1E40000
#define ASSET_TABLE_HEADER_SIZE 0x20
@ -168,10 +169,10 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) {
}
gCurrentCameraID = 0;
gCameras[0].flags |= 0x2;
gCameras[1].flags |= 0x2;
gCameras[2].flags |= 0x2;
gCameras[3].flags |= 0x2;
gCameras[0].flags |= CAM_FLAG_ENABLED;
gCameras[1].flags |= CAM_FLAG_ENABLED;
gCameras[2].flags |= CAM_FLAG_ENABLED;
gCameras[3].flags |= CAM_FLAG_ENABLED;
if (gGameStatusPtr->creditsViewportMode == -1) {
set_cam_viewport(0, 12, 20, 296, 200);

View File

@ -1,234 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.section .rodata
glabel jtbl_800981E0
.word L8002D4A8_88A8, L8002D4B8_88B8, L8002D4C8_88C8, L8002D498_8898, L8002D4D8_88D8, L8002D4E8_88E8, L8002D4F8_88F8, 0
.section .text
glabel update_cameras
/* 8800 8002D400 27BDFF90 */ addiu $sp, $sp, -0x70
/* 8804 8002D404 F7B60068 */ sdc1 $f22, 0x68($sp)
/* 8808 8002D408 3C013F80 */ lui $at, 0x3f80
/* 880C 8002D40C 4481B000 */ mtc1 $at, $f22
/* 8810 8002D410 F7B40060 */ sdc1 $f20, 0x60($sp)
/* 8814 8002D414 3C013FE0 */ lui $at, 0x3fe0
/* 8818 8002D418 4481A800 */ mtc1 $at, $f21
/* 881C 8002D41C 4480A000 */ mtc1 $zero, $f20
/* 8820 8002D420 AFB3004C */ sw $s3, 0x4c($sp)
/* 8824 8002D424 0000982D */ daddu $s3, $zero, $zero
/* 8828 8002D428 AFB60058 */ sw $s6, 0x58($sp)
/* 882C 8002D42C 27B60030 */ addiu $s6, $sp, 0x30
/* 8830 8002D430 AFB50054 */ sw $s5, 0x54($sp)
/* 8834 8002D434 27B50034 */ addiu $s5, $sp, 0x34
/* 8838 8002D438 AFB40050 */ sw $s4, 0x50($sp)
/* 883C 8002D43C 27B40038 */ addiu $s4, $sp, 0x38
/* 8840 8002D440 AFB00040 */ sw $s0, 0x40($sp)
/* 8844 8002D444 3C10800B */ lui $s0, %hi(gCameras)
/* 8848 8002D448 26101D80 */ addiu $s0, $s0, %lo(gCameras)
/* 884C 8002D44C AFBF005C */ sw $ra, 0x5c($sp)
/* 8850 8002D450 AFB20048 */ sw $s2, 0x48($sp)
/* 8854 8002D454 AFB10044 */ sw $s1, 0x44($sp)
.L8002D458:
/* 8858 8002D458 96020000 */ lhu $v0, ($s0)
/* 885C 8002D45C 104000A5 */ beqz $v0, .L8002D6F4
/* 8860 8002D460 30420002 */ andi $v0, $v0, 2
/* 8864 8002D464 544000A4 */ bnel $v0, $zero, .L8002D6F8
/* 8868 8002D468 26730001 */ addiu $s3, $s3, 1
/* 886C 8002D46C 86030004 */ lh $v1, 4($s0)
/* 8870 8002D470 3C01800A */ lui $at, %hi(gCurrentCamID)
/* 8874 8002D474 A433A634 */ sh $s3, %lo(gCurrentCamID)($at)
/* 8878 8002D478 2C620007 */ sltiu $v0, $v1, 7
/* 887C 8002D47C 1040001E */ beqz $v0, L8002D4F8_88F8
/* 8880 8002D480 00031080 */ sll $v0, $v1, 2
/* 8884 8002D484 3C01800A */ lui $at, %hi(jtbl_800981E0)
/* 8888 8002D488 00220821 */ addu $at, $at, $v0
/* 888C 8002D48C 8C2281E0 */ lw $v0, %lo(jtbl_800981E0)($at)
/* 8890 8002D490 00400008 */ jr $v0
/* 8894 8002D494 00000000 */ nop
glabel L8002D498_8898
/* 8898 8002D498 0C00C525 */ jal update_camera_zone_interp
/* 889C 8002D49C 0200202D */ daddu $a0, $s0, $zero
/* 88A0 8002D4A0 0800B540 */ j .L8002D500
/* 88A4 8002D4A4 00000000 */ nop
glabel L8002D4A8_88A8
/* 88A8 8002D4A8 0C00BE14 */ jal update_camera_mode_0
/* 88AC 8002D4AC 0200202D */ daddu $a0, $s0, $zero
/* 88B0 8002D4B0 0800B540 */ j .L8002D500
/* 88B4 8002D4B4 00000000 */ nop
glabel L8002D4B8_88B8
/* 88B8 8002D4B8 0C00BCA4 */ jal update_camera_mode_1
/* 88BC 8002D4BC 0200202D */ daddu $a0, $s0, $zero
/* 88C0 8002D4C0 0800B540 */ j .L8002D500
/* 88C4 8002D4C4 00000000 */ nop
glabel L8002D4C8_88C8
/* 88C8 8002D4C8 0C00BB3E */ jal update_camera_mode_2
/* 88CC 8002D4CC 0200202D */ daddu $a0, $s0, $zero
/* 88D0 8002D4D0 0800B540 */ j .L8002D500
/* 88D4 8002D4D4 00000000 */ nop
glabel L8002D4D8_88D8
/* 88D8 8002D4D8 0C00BA44 */ jal update_camera_mode_4
/* 88DC 8002D4DC 0200202D */ daddu $a0, $s0, $zero
/* 88E0 8002D4E0 0800B540 */ j .L8002D500
/* 88E4 8002D4E4 00000000 */ nop
glabel L8002D4E8_88E8
/* 88E8 8002D4E8 0C00C000 */ jal update_camera_mode_5
/* 88EC 8002D4EC 0200202D */ daddu $a0, $s0, $zero
/* 88F0 8002D4F0 0800B540 */ j .L8002D500
/* 88F4 8002D4F4 00000000 */ nop
glabel L8002D4F8_88F8
/* 88F8 8002D4F8 0C00BE64 */ jal update_camera_mode_6
/* 88FC 8002D4FC 0200202D */ daddu $a0, $s0, $zero
.L8002D500:
/* 8900 8002D500 C6000044 */ lwc1 $f0, 0x44($s0)
/* 8904 8002D504 3C05800A */ lui $a1, %hi(gDisplayContext)
/* 8908 8002D508 8CA5A674 */ lw $a1, %lo(gDisplayContext)($a1)
/* 890C 8002D50C E7A00010 */ swc1 $f0, 0x10($sp)
/* 8910 8002D510 C6000048 */ lwc1 $f0, 0x48($s0)
/* 8914 8002D514 E7A00014 */ swc1 $f0, 0x14($sp)
/* 8918 8002D518 C600004C */ lwc1 $f0, 0x4c($s0)
/* 891C 8002D51C E7A00018 */ swc1 $f0, 0x18($sp)
/* 8920 8002D520 C6000050 */ lwc1 $f0, 0x50($s0)
/* 8924 8002D524 26120114 */ addiu $s2, $s0, 0x114
/* 8928 8002D528 AFA00020 */ sw $zero, 0x20($sp)
/* 892C 8002D52C E7B60024 */ swc1 $f22, 0x24($sp)
/* 8930 8002D530 AFA00028 */ sw $zero, 0x28($sp)
/* 8934 8002D534 E7A0001C */ swc1 $f0, 0x1c($sp)
/* 8938 8002D538 8E06003C */ lw $a2, 0x3c($s0)
/* 893C 8002D53C 8E070040 */ lw $a3, 0x40($s0)
/* 8940 8002D540 0C018CC8 */ jal guLookAtReflectF
/* 8944 8002D544 0240202D */ daddu $a0, $s2, $zero
/* 8948 8002D548 96030000 */ lhu $v1, ($s0)
/* 894C 8002D54C 30620010 */ andi $v0, $v1, 0x10
/* 8950 8002D550 14400034 */ bnez $v0, .L8002D624
/* 8954 8002D554 260400D4 */ addiu $a0, $s0, 0xd4
/* 8958 8002D558 30620004 */ andi $v0, $v1, 4
/* 895C 8002D55C 10400004 */ beqz $v0, .L8002D570
/* 8960 8002D560 261100D4 */ addiu $s1, $s0, 0xd4
/* 8964 8002D564 0C00CCE5 */ jal create_camera_leadplayer_matrix
/* 8968 8002D568 0200202D */ daddu $a0, $s0, $zero
/* 896C 8002D56C 261100D4 */ addiu $s1, $s0, 0xd4
.L8002D570:
/* 8970 8002D570 0220202D */ daddu $a0, $s1, $zero
/* 8974 8002D574 8607000A */ lh $a3, 0xa($s0)
/* 8978 8002D578 86020012 */ lh $v0, 0x12($s0)
/* 897C 8002D57C 8603000C */ lh $v1, 0xc($s0)
/* 8980 8002D580 44820000 */ mtc1 $v0, $f0
/* 8984 8002D584 00000000 */ nop
/* 8988 8002D588 46800020 */ cvt.s.w $f0, $f0
/* 898C 8002D58C E7A00010 */ swc1 $f0, 0x10($sp)
/* 8990 8002D590 86020014 */ lh $v0, 0x14($s0)
/* 8994 8002D594 44871000 */ mtc1 $a3, $f2
/* 8998 8002D598 00000000 */ nop
/* 899C 8002D59C 468010A0 */ cvt.s.w $f2, $f2
/* 89A0 8002D5A0 E7B60018 */ swc1 $f22, 0x18($sp)
/* 89A4 8002D5A4 44820000 */ mtc1 $v0, $f0
/* 89A8 8002D5A8 00000000 */ nop
/* 89AC 8002D5AC 46800020 */ cvt.s.w $f0, $f0
/* 89B0 8002D5B0 E7A00014 */ swc1 $f0, 0x14($sp)
/* 89B4 8002D5B4 44830000 */ mtc1 $v1, $f0
/* 89B8 8002D5B8 00000000 */ nop
/* 89BC 8002D5BC 46800020 */ cvt.s.w $f0, $f0
/* 89C0 8002D5C0 46001083 */ div.s $f2, $f2, $f0
/* 89C4 8002D5C4 8E060018 */ lw $a2, 0x18($s0)
/* 89C8 8002D5C8 44071000 */ mfc1 $a3, $f2
/* 89CC 8002D5CC 0C018EE4 */ jal guPerspectiveF
/* 89D0 8002D5D0 26050038 */ addiu $a1, $s0, 0x38
/* 89D4 8002D5D4 96020000 */ lhu $v0, ($s0)
/* 89D8 8002D5D8 30420008 */ andi $v0, $v0, 8
/* 89DC 8002D5DC 10400004 */ beqz $v0, .L8002D5F0
/* 89E0 8002D5E0 26040194 */ addiu $a0, $s0, 0x194
/* 89E4 8002D5E4 0220282D */ daddu $a1, $s1, $zero
/* 89E8 8002D5E8 0C019D80 */ jal guMtxCatF
/* 89EC 8002D5EC 0220302D */ daddu $a2, $s1, $zero
.L8002D5F0:
/* 89F0 8002D5F0 96020000 */ lhu $v0, ($s0)
/* 89F4 8002D5F4 30420004 */ andi $v0, $v0, 4
/* 89F8 8002D5F8 10400004 */ beqz $v0, .L8002D60C
/* 89FC 8002D5FC 26040154 */ addiu $a0, $s0, 0x154
/* 8A00 8002D600 0220282D */ daddu $a1, $s1, $zero
/* 8A04 8002D604 0C019D80 */ jal guMtxCatF
/* 8A08 8002D608 0220302D */ daddu $a2, $s1, $zero
.L8002D60C:
/* 8A0C 8002D60C 0240202D */ daddu $a0, $s2, $zero
/* 8A10 8002D610 0220282D */ daddu $a1, $s1, $zero
/* 8A14 8002D614 0C019D80 */ jal guMtxCatF
/* 8A18 8002D618 00A0302D */ daddu $a2, $a1, $zero
/* 8A1C 8002D61C 0800B5B0 */ j .L8002D6C0
/* 8A20 8002D620 AFB60010 */ sw $s6, 0x10($sp)
.L8002D624:
/* 8A24 8002D624 8602000A */ lh $v0, 0xa($s0)
/* 8A28 8002D628 44822000 */ mtc1 $v0, $f4
/* 8A2C 8002D62C 00000000 */ nop
/* 8A30 8002D630 46802120 */ cvt.s.w $f4, $f4
/* 8A34 8002D634 46002187 */ neg.s $f6, $f4
/* 8A38 8002D638 460031A1 */ cvt.d.s $f6, $f6
/* 8A3C 8002D63C 46343182 */ mul.d $f6, $f6, $f20
/* 8A40 8002D640 00000000 */ nop
/* 8A44 8002D644 46002121 */ cvt.d.s $f4, $f4
/* 8A48 8002D648 46342102 */ mul.d $f4, $f4, $f20
/* 8A4C 8002D64C 00000000 */ nop
/* 8A50 8002D650 8602000C */ lh $v0, 0xc($s0)
/* 8A54 8002D654 44820000 */ mtc1 $v0, $f0
/* 8A58 8002D658 00000000 */ nop
/* 8A5C 8002D65C 46800020 */ cvt.s.w $f0, $f0
/* 8A60 8002D660 46000087 */ neg.s $f2, $f0
/* 8A64 8002D664 460010A1 */ cvt.d.s $f2, $f2
/* 8A68 8002D668 46341082 */ mul.d $f2, $f2, $f20
/* 8A6C 8002D66C 00000000 */ nop
/* 8A70 8002D670 3C01C47A */ lui $at, 0xc47a
/* 8A74 8002D674 44814000 */ mtc1 $at, $f8
/* 8A78 8002D678 3C01447A */ lui $at, 0x447a
/* 8A7C 8002D67C 44815000 */ mtc1 $at, $f10
/* 8A80 8002D680 E7B6001C */ swc1 $f22, 0x1c($sp)
/* 8A84 8002D684 E7A80014 */ swc1 $f8, 0x14($sp)
/* 8A88 8002D688 46000021 */ cvt.d.s $f0, $f0
/* 8A8C 8002D68C 46340002 */ mul.d $f0, $f0, $f20
/* 8A90 8002D690 00000000 */ nop
/* 8A94 8002D694 E7AA0018 */ swc1 $f10, 0x18($sp)
/* 8A98 8002D698 462031A0 */ cvt.s.d $f6, $f6
/* 8A9C 8002D69C 46202120 */ cvt.s.d $f4, $f4
/* 8AA0 8002D6A0 44053000 */ mfc1 $a1, $f6
/* 8AA4 8002D6A4 44062000 */ mfc1 $a2, $f4
/* 8AA8 8002D6A8 462010A0 */ cvt.s.d $f2, $f2
/* 8AAC 8002D6AC 44071000 */ mfc1 $a3, $f2
/* 8AB0 8002D6B0 46200020 */ cvt.s.d $f0, $f0
/* 8AB4 8002D6B4 0C018E44 */ jal guOrthoF
/* 8AB8 8002D6B8 E7A00010 */ swc1 $f0, 0x10($sp)
/* 8ABC 8002D6BC AFB60010 */ sw $s6, 0x10($sp)
.L8002D6C0:
/* 8AC0 8002D6C0 AFB50014 */ sw $s5, 0x14($sp)
/* 8AC4 8002D6C4 AFB40018 */ sw $s4, 0x18($sp)
/* 8AC8 8002D6C8 8E050060 */ lw $a1, 0x60($s0)
/* 8ACC 8002D6CC 8E060064 */ lw $a2, 0x64($s0)
/* 8AD0 8002D6D0 8E070068 */ lw $a3, 0x68($s0)
/* 8AD4 8002D6D4 0C00B94E */ jal get_screen_coords
/* 8AD8 8002D6D8 0000202D */ daddu $a0, $zero, $zero
/* 8ADC 8002D6DC 96C20002 */ lhu $v0, 2($s6)
/* 8AE0 8002D6E0 A6020032 */ sh $v0, 0x32($s0)
/* 8AE4 8002D6E4 96A20002 */ lhu $v0, 2($s5)
/* 8AE8 8002D6E8 A6020034 */ sh $v0, 0x34($s0)
/* 8AEC 8002D6EC 96820002 */ lhu $v0, 2($s4)
/* 8AF0 8002D6F0 A6020036 */ sh $v0, 0x36($s0)
.L8002D6F4:
/* 8AF4 8002D6F4 26730001 */ addiu $s3, $s3, 1
.L8002D6F8:
/* 8AF8 8002D6F8 2A620004 */ slti $v0, $s3, 4
/* 8AFC 8002D6FC 1440FF56 */ bnez $v0, .L8002D458
/* 8B00 8002D700 26100558 */ addiu $s0, $s0, 0x558
/* 8B04 8002D704 8FBF005C */ lw $ra, 0x5c($sp)
/* 8B08 8002D708 8FB60058 */ lw $s6, 0x58($sp)
/* 8B0C 8002D70C 8FB50054 */ lw $s5, 0x54($sp)
/* 8B10 8002D710 8FB40050 */ lw $s4, 0x50($sp)
/* 8B14 8002D714 8FB3004C */ lw $s3, 0x4c($sp)
/* 8B18 8002D718 8FB20048 */ lw $s2, 0x48($sp)
/* 8B1C 8002D71C 8FB10044 */ lw $s1, 0x44($sp)
/* 8B20 8002D720 8FB00040 */ lw $s0, 0x40($sp)
/* 8B24 8002D724 D7B60068 */ ldc1 $f22, 0x68($sp)
/* 8B28 8002D728 D7B40060 */ ldc1 $f20, 0x60($sp)
/* 8B2C 8002D72C 3C01800A */ lui $at, %hi(gCurrentCamID)
/* 8B30 8002D730 A420A634 */ sh $zero, %lo(gCurrentCamID)($at)
/* 8B34 8002D734 03E00008 */ jr $ra
/* 8B38 8002D738 27BD0070 */ addiu $sp, $sp, 0x70

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_800271FC
/* 25FC 800271FC 00061880 */ sll $v1, $a2, 2
/* 2600 80027200 00661821 */ addu $v1, $v1, $a2
/* 2604 80027204 00031980 */ sll $v1, $v1, 6
/* 2608 80027208 00671821 */ addu $v1, $v1, $a3
/* 260C 8002720C 00031840 */ sll $v1, $v1, 1
/* 2610 80027210 00652821 */ addu $a1, $v1, $a1
/* 2614 80027214 00641821 */ addu $v1, $v1, $a0
/* 2618 80027218 94A20000 */ lhu $v0, ($a1)
/* 261C 8002721C 8FA50010 */ lw $a1, 0x10($sp)
/* 2620 80027220 00021082 */ srl $v0, $v0, 2
/* 2624 80027224 3042000F */ andi $v0, $v0, 0xf
/* 2628 80027228 A0A20003 */ sb $v0, 3($a1)
/* 262C 8002722C 94620000 */ lhu $v0, ($v1)
/* 2630 80027230 000212C2 */ srl $v0, $v0, 0xb
/* 2634 80027234 A0A20000 */ sb $v0, ($a1)
/* 2638 80027238 94620000 */ lhu $v0, ($v1)
/* 263C 8002723C 00021182 */ srl $v0, $v0, 6
/* 2640 80027240 3042001F */ andi $v0, $v0, 0x1f
/* 2644 80027244 A0A20001 */ sb $v0, 1($a1)
/* 2648 80027248 94620000 */ lhu $v0, ($v1)
/* 264C 8002724C 00021042 */ srl $v0, $v0, 1
/* 2650 80027250 3042001F */ andi $v0, $v0, 0x1f
/* 2654 80027254 03E00008 */ jr $ra
/* 2658 80027258 A0A20002 */ sb $v0, 2($a1)