summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPrakxo <87568477+Prakxo@users.noreply.github.com>2024-04-04 17:38:30 +0200
committerGitHub <noreply@github.com>2024-04-04 08:38:30 -0700
commit322592d306b27910b44ac2330105ae12233c4d13 (patch)
tree1216a4bcc57736e59bbccb5eeec0e126d307318f /src
parent1ffded6b490c23db809aa46c5c186dd8d554b271 (diff)
m_view OK (#163)
* m_view OK * format?
Diffstat (limited to 'src')
-rw-r--r--src/code/m_actor.c6
-rw-r--r--src/code/m_view.c533
-rw-r--r--src/overlays/gamestates/ovl__00743CD0/_00743CD0.h2
-rw-r--r--src/overlays/gamestates/ovl_play/m_play.c18
-rw-r--r--src/overlays/gamestates/ovl_play/m_play.h2
-rw-r--r--src/overlays/gamestates/ovl_select/m_select.c2
-rw-r--r--src/overlays/gamestates/ovl_select/m_select.h2
-rw-r--r--src/overlays/submenu/submenu_ovl/m_submenu_ovl.c6
8 files changed, 552 insertions, 19 deletions
diff --git a/src/code/m_actor.c b/src/code/m_actor.c
index e8297ae..690a8c4 100644
--- a/src/code/m_actor.c
+++ b/src/code/m_actor.c
@@ -1117,7 +1117,7 @@ Hilite* Setpos_HiliteReflect_init(xyz_t* object, Game_Play* game_play) {
sp24.x = game_play->kankyo.unk_02;
sp24.y = game_play->kankyo.unk_03;
sp24.z = game_play->kankyo.unk_04;
- return HiliteReflect_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
+ return HiliteReflect_init(object, &game_play->view.eye, &sp24, game_play->state.gfxCtx);
}
Hilite* Setpos_HiliteReflect_xlu_init(xyz_t* object, Game_Play* game_play) {
@@ -1126,7 +1126,7 @@ Hilite* Setpos_HiliteReflect_xlu_init(xyz_t* object, Game_Play* game_play) {
sp24.x = game_play->kankyo.unk_02;
sp24.y = game_play->kankyo.unk_03;
sp24.z = game_play->kankyo.unk_04;
- return HiliteReflect_xlu_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
+ return HiliteReflect_xlu_init(object, &game_play->view.eye, &sp24, game_play->state.gfxCtx);
}
Hilite* Setpos_HiliteReflect_light_init(xyz_t* object, Game_Play* game_play) {
@@ -1135,5 +1135,5 @@ Hilite* Setpos_HiliteReflect_light_init(xyz_t* object, Game_Play* game_play) {
sp24.x = game_play->kankyo.unk_02;
sp24.y = game_play->kankyo.unk_03;
sp24.z = game_play->kankyo.unk_04;
- return HiliteReflect_xlu_init(object, &game_play->unk_1938.unk_028, &sp24, game_play->state.gfxCtx);
+ return HiliteReflect_xlu_init(object, &game_play->view.eye, &sp24, game_play->state.gfxCtx);
}
diff --git a/src/code/m_view.c b/src/code/m_view.c
new file mode 100644
index 0000000..38280f0
--- /dev/null
+++ b/src/code/m_view.c
@@ -0,0 +1,533 @@
+#include "m_view.h"
+#include "gfx.h"
+#include "macros.h"
+#include "main.h"
+#include "sys_matrix.h"
+
+s32 D_8010EF00_jp = 1;
+
+void set_viewport(Vp* vp, Viewport* viewport) {
+ s32 width = viewport->rightX - viewport->leftX;
+ s32 height = viewport->bottomY - viewport->topY;
+
+ vp->vp.vscale[0] = width * 2;
+ vp->vp.vscale[1] = height * 2;
+ vp->vp.vscale[2] = 511;
+ vp->vp.vscale[3] = 0;
+
+ vp->vp.vtrans[0] = (width + viewport->leftX * 2) * 2;
+ vp->vp.vtrans[1] = (height + viewport->topY * 2) * 2;
+ vp->vp.vtrans[2] = 511;
+ vp->vp.vtrans[3] = 0;
+}
+
+void initView(View* view, GraphicsContext* graph) {
+ if (D_8010EF00_jp) {}
+
+ view->gfxCtx = graph;
+
+ view->viewport.topY = 0;
+ view->viewport.bottomY = SCREEN_HEIGHT;
+ view->viewport.leftX = 0;
+ view->viewport.rightX = SCREEN_WIDTH;
+ view->unk_000 = 1234;
+
+ view->fovY = 20.0f;
+ view->scale = 1.0f;
+ view->near = 200.0f;
+ view->far = 1600.0f;
+
+ view->eye.x = 0.0f;
+ view->eye.y = 0.0f;
+ view->eye.z = -1.0f;
+ view->at.x = 0.0f;
+ view->at.x = 0.0f;
+ view->at.x = 0.0f;
+ view->up.x = 0.0f;
+ view->up.y = 1.0f;
+ view->up.z = 0.0f;
+
+ if (D_8010EF00_jp != 0) {
+ D_8010EF00_jp = 0;
+ }
+
+ view->flag = 7;
+ stretchViewInit(view);
+}
+
+void setLookAtView(View* view, xyz_t* eye, xyz_t* at, xyz_t* up) {
+ if (eye->x == at->x && eye->z == at->z) {
+ eye->x += 0.1f;
+ }
+
+ view->eye = *eye;
+ view->at = *at;
+ view->up = *up;
+
+ view->flag |= 1;
+}
+
+void getLookAtView(View* view, xyz_t* eye, xyz_t* at, xyz_t* up) {
+ view->eye = *eye;
+ view->at = *at;
+ view->up = *up;
+}
+
+void setScaleView(View* view, f32 scale) {
+ view->scale = scale;
+
+ view->flag |= 4;
+}
+
+void getScaleView(View* view, f32* scale) {
+ *scale = view->scale;
+}
+
+void setPerspectiveView(View* view, f32 fovY, f32 near, f32 far) {
+ view->fovY = fovY;
+ view->near = near;
+ view->far = far;
+
+ view->flag |= 4;
+}
+
+void getPerspectiveView(View* view, f32* fovY, f32* near, f32* far) {
+ *fovY = view->fovY;
+ *near = view->near;
+ *far = view->far;
+}
+
+void setScissorView(View* view, Viewport* viewport) {
+ view->viewport = *viewport;
+
+ view->flag |= 2;
+}
+
+void getScissorView(View* view, Viewport* viewport) {
+ *viewport = view->viewport;
+}
+
+void setScissorX(Gfx** gfxP, s32 leftX, s32 topY, s32 rightX, s32 bottomY) {
+ Gfx* gfx = *gfxP;
+
+ gDPSetScissor(gfx++, G_SC_NON_INTERLACE, leftX, topY, rightX, bottomY);
+ *gfxP = gfx;
+}
+
+void setScissorOvl(View* view, Gfx** gfxP) {
+ Gfx* gfx = *gfxP;
+ s32 left = view->viewport.leftX;
+ s32 top = view->viewport.topY;
+ s32 right = view->viewport.rightX;
+ s32 bottom = view->viewport.bottomY;
+
+ gDPPipeSync(gfx++);
+ setScissorX(&gfx, left, top, right, bottom);
+ *gfxP = gfx;
+}
+
+void setScissor(View* view) {
+ GraphicsContext* graph = view->gfxCtx;
+ Gfx* gfx;
+ s32 left = view->viewport.leftX;
+ s32 top = view->viewport.topY;
+ s32 right = view->viewport.rightX;
+ s32 bottom = view->viewport.bottomY;
+
+ OPEN_DISPS(graph);
+
+ gfx = POLY_OPA_DISP;
+ setScissorX(&gfx, left, top, right, bottom);
+ POLY_OPA_DISP = gfx;
+
+ gfx = POLY_XLU_DISP;
+ setScissorX(&gfx, left, top, right, bottom);
+ POLY_XLU_DISP = gfx;
+
+ gfx = SHADOW_DISP;
+ setScissorX(&gfx, left, top, right, bottom);
+ SHADOW_DISP = gfx;
+
+ gfx = LIGHT_DISP;
+ setScissorX(&gfx, left, top, right, bottom);
+ LIGHT_DISP = gfx;
+
+ CLOSE_DISPS(graph);
+}
+
+s32 stretchViewInit(View* view) {
+ view->stretch.targetRotate.x = 0.0f;
+ view->stretch.targetRotate.y = 0.0f;
+ view->stretch.targetRotate.z = 0.0f;
+
+ view->stretch.targetScale.x = 1.0f;
+ view->stretch.targetScale.y = 1.0f;
+ view->stretch.targetScale.z = 1.0f;
+
+ view->stretch.rotate = view->stretch.targetRotate;
+ view->stretch.scale = view->stretch.targetScale;
+ view->stretch.step = 0.0f;
+
+ return 0;
+}
+
+s32 do_stretch_view(View* view, Mtx* mtx) {
+ if (view->stretch.step == 0.0f) {
+ return FALSE;
+ } else if (view->stretch.step == 1.0f) {
+ view->stretch.rotate = view->stretch.targetRotate;
+ view->stretch.scale = view->stretch.targetScale;
+ view->stretch.step = 0.0f;
+ } else {
+ view->stretch.rotate.x += (view->stretch.targetRotate.x - view->stretch.rotate.x) * view->stretch.step;
+ view->stretch.rotate.y += (view->stretch.targetRotate.y - view->stretch.rotate.y) * view->stretch.step;
+ view->stretch.rotate.z += (view->stretch.targetRotate.z - view->stretch.rotate.z) * view->stretch.step;
+
+ view->stretch.scale.x += (view->stretch.targetScale.x - view->stretch.scale.x) * view->stretch.step;
+ view->stretch.scale.y += (view->stretch.targetScale.y - view->stretch.scale.y) * view->stretch.step;
+ view->stretch.scale.z += (view->stretch.targetScale.z - view->stretch.scale.z) * view->stretch.step;
+ }
+
+ {
+ MtxF mtxF;
+ s_xyz rot;
+
+ rot.x = view->stretch.rotate.x * 10430.378f;
+ rot.y = view->stretch.rotate.y * 10430.378f;
+ rot.z = view->stretch.rotate.z * 10430.378f;
+
+ Matrix_MtxtoMtxF(mtx, &mtxF);
+ Matrix_put(&mtxF);
+
+ Matrix_RotateX(rot.x, 1);
+ Matrix_RotateY(rot.y, 1);
+ Matrix_RotateZ(rot.z, 1);
+
+ Matrix_scale(view->stretch.scale.x, view->stretch.scale.y, view->stretch.scale.z, TRUE);
+
+ Matrix_RotateZ(-rot.z, 1);
+ Matrix_RotateY(-rot.y, 1);
+ Matrix_RotateX(-rot.x, 1);
+
+ _Matrix_to_Mtx(mtx);
+ }
+
+ return TRUE;
+}
+
+s32 showView(View* view, s32 flagMask) {
+ flagMask = ((view->flag & flagMask) | (flagMask >> 4));
+
+ if (flagMask & 8) {
+ return showOrthoView(view);
+ } else {
+ return showPerspectiveView(view);
+ }
+}
+
+s32 showPerspectiveView(View* view) {
+ GraphicsContext* graph = view->gfxCtx;
+ f32 aspect;
+ s32 width;
+ s32 height;
+ Vp* vp;
+ Mtx* mtx;
+
+ OPEN_DISPS(graph);
+
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ setScissor(view);
+
+ gSPViewport(POLY_OPA_DISP++, vp);
+ gSPViewport(POLY_XLU_DISP++, vp);
+ gSPViewport(SHADOW_DISP++, vp);
+ gSPViewport(LIGHT_DISP++, vp);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+
+ view->projectionMtxPtr = mtx;
+
+ width = view->viewport.rightX - view->viewport.leftX;
+ height = view->viewport.bottomY - view->viewport.topY;
+ aspect = (f32)width / (f32)height;
+ guPerspective(mtx, &view->normal, view->fovY, aspect, view->near, view->far, view->scale);
+
+ view->projectionMtx = *mtx;
+
+ do_stretch_view(view, mtx);
+
+ gSPPerspNormalize(POLY_OPA_DISP++, view->normal);
+ gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPPerspNormalize(POLY_XLU_DISP++, view->normal);
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPPerspNormalize(SHADOW_DISP++, view->normal);
+ gSPMatrix(SHADOW_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPPerspNormalize(LIGHT_DISP++, view->normal);
+ gSPMatrix(LIGHT_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+ view->viewingMtxPtr = mtx;
+
+ if ((view->eye.x == view->at.x) && (view->eye.y == view->at.y) && (view->eye.z == view->at.z)) {
+ view->eye.x += 1.0f;
+ view->eye.y += 1.0f;
+ view->eye.z += 1.0f;
+ }
+ guLookAt(mtx, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
+ view->up.z);
+
+ view->viewingMtx = *mtx;
+
+ gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+
+ gSPMatrix(SHADOW_DISP++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+
+ gSPMatrix(LIGHT_DISP++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+
+ CLOSE_DISPS(graph);
+
+ return TRUE;
+}
+
+s32 showOrthoView(View* view) {
+ GraphicsContext* graph = view->gfxCtx;
+ Vp* vp;
+ Mtx* mtx;
+
+ OPEN_DISPS(graph);
+
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ setScissor(view);
+
+ gSPViewport(POLY_OPA_DISP++, vp);
+ gSPViewport(POLY_XLU_DISP++, vp);
+ gSPViewport(SHADOW_DISP++, vp);
+ gSPViewport(LIGHT_DISP++, vp);
+ gSPViewport(OVERLAY_DISP++, vp);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+ view->projectionMtxPtr = mtx;
+
+ guOrtho(mtx, -(f32)ScreenWidth / 2.0f, (f32)ScreenWidth / 2.0f, -(f32)ScreenHeight / 2.0f, (f32)ScreenHeight / 2.0f,
+ view->near, view->far, view->scale);
+
+ view->projectionMtx = *mtx;
+
+ gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPMatrix(SHADOW_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ gSPMatrix(LIGHT_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ CLOSE_DISPS(graph);
+
+ return TRUE;
+}
+
+s32 showOverLayView(View* view) {
+ GraphicsContext* graph = view->gfxCtx;
+ Gfx* gfx;
+ Vp* vp;
+
+ Mtx* mtx;
+
+ OPEN_DISPS(graph);
+
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ gDPPipeSync(OVERLAY_DISP++);
+
+ gfx = OVERLAY_DISP;
+ setScissorX(&gfx, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, view->viewport.bottomY);
+ OVERLAY_DISP = gfx;
+
+ gSPViewport(OVERLAY_DISP++, vp);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+ view->projectionMtxPtr = mtx;
+
+ guOrtho(mtx, -(f32)ScreenWidth / 2.0f, (f32)ScreenWidth / 2.0f, -(f32)ScreenHeight / 2.0f, (f32)ScreenHeight / 2.0f,
+ view->near, view->far, view->scale);
+
+ view->projectionMtx = *mtx;
+
+ gSPMatrix(OVERLAY_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ CLOSE_DISPS(graph);
+
+ return TRUE;
+}
+
+s32 showPerspectiveOverLayView(View* view) {
+ UNUSED s32 pad;
+ Gfx* gfx;
+ UNUSED s32 pad2;
+ GraphicsContext* graph = view->gfxCtx;
+ f32 aspect;
+ s32 width;
+ s32 height;
+ Vp* vp;
+ Mtx* mtx;
+
+ OPEN_DISPS(graph);
+
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ gDPPipeSync(OVERLAY_DISP++);
+
+ gfx = OVERLAY_DISP;
+ setScissorX(&gfx, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, view->viewport.bottomY);
+ OVERLAY_DISP = gfx;
+
+ gSPViewport(OVERLAY_DISP++, vp);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+
+ view->projectionMtxPtr = mtx;
+
+ width = view->viewport.rightX - view->viewport.leftX;
+ height = view->viewport.bottomY - view->viewport.topY;
+ aspect = (f32)width / (f32)height;
+ guPerspective(mtx, &view->normal, view->fovY, aspect, view->near, view->far, view->scale);
+
+ view->projectionMtx = *mtx;
+ gSPPerspNormalize(OVERLAY_DISP++, view->normal);
+ gSPMatrix(OVERLAY_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+ view->viewingMtxPtr = mtx;
+
+ if ((view->eye.x == view->at.x) && (view->eye.y == view->at.y) && (view->eye.z == view->at.z)) {
+ view->eye.x += 1.0f;
+ view->eye.y += 1.0f;
+ view->eye.z += 1.0f;
+ }
+ guLookAt(mtx, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
+ view->up.z);
+
+ view->viewingMtx = *mtx;
+
+ gSPMatrix(OVERLAY_DISP++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+
+ CLOSE_DISPS(graph);
+
+ return TRUE;
+}
+
+s32 showOrthoView1(View* view, Gfx** gfxPtr) {
+ Gfx* gfx;
+ GraphicsContext* graph;
+ Mtx* mtx;
+ Vp* vp;
+
+ gfx = *gfxPtr;
+ graph = view->gfxCtx;
+
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ setScissorOvl(view, &gfx);
+
+ gSPViewport(gfx++, vp);
+
+ mtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+ view->projectionMtxPtr = mtx;
+
+ guOrtho(mtx, (f32)ScreenWidth * -0.5f, (f32)ScreenWidth * 0.5f, (f32)ScreenHeight * -0.5f, (f32)ScreenHeight * 0.5f,
+ view->near, view->far, view->scale);
+
+ view->projectionMtx = *mtx;
+
+ gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+
+ *gfxPtr = gfx;
+
+ return TRUE;
+}
+
+s32 showView1(View* view, s32 flagMask, Gfx** gfxPtr) {
+ Gfx* gfx;
+ s32 width;
+ Gfx* gfxSave;
+ s32 height;
+ GraphicsContext* graph;
+ Mtx* projection;
+ Mtx* viewMtx;
+ Vp* vp;
+
+ graph = view->gfxCtx;
+ gfx = *gfxPtr;
+ flagMask = (flagMask & view->flag) | (flagMask >> 4);
+
+ if (flagMask & 2) {
+ vp = GRAPH_ALLOC(graph, sizeof(Vp));
+ set_viewport(vp, &view->viewport);
+ view->vp = *vp;
+
+ gDPPipeSync(gfx++);
+ {
+ gfxSave = gfx;
+ setScissorX(&gfxSave, view->viewport.leftX, view->viewport.topY, view->viewport.rightX,
+ view->viewport.bottomY);
+ gfx = gfxSave;
+ }
+ gSPViewport(gfx++, vp);
+ }
+
+ if (flagMask & 8) {
+ projection = GRAPH_ALLOC(graph, sizeof(Mtx));
+
+ view->projectionMtxPtr = projection;
+ guOrtho(projection, -(f32)ScreenWidth / 2.0f, (f32)ScreenWidth / 2.0f, -(f32)ScreenHeight / 2.0f,
+ (f32)ScreenHeight / 2.0f, view->near, view->far, view->scale);
+
+ view->projectionMtx = *projection;
+ gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+ } else if (flagMask & 6) {
+ viewMtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+
+ view->projectionMtxPtr = viewMtx;
+
+ width = view->viewport.rightX - view->viewport.leftX;
+ height = view->viewport.bottomY - view->viewport.topY;
+ guPerspective(viewMtx, &view->normal, view->fovY, (f32)width / (f32)height, view->near, view->far, view->scale);
+
+ view->projectionMtx = *viewMtx;
+ gSPPerspNormalize(gfx++, view->normal);
+ gSPMatrix(gfx++, viewMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+ }
+
+ if (flagMask & 1) {
+ viewMtx = GRAPH_ALLOC(graph, sizeof(Mtx));
+
+ view->viewingMtxPtr = viewMtx;
+ guLookAt(viewMtx, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
+ view->up.y, view->up.z);
+
+ view->viewingMtx = *viewMtx;
+ gSPMatrix(gfx++, viewMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
+ }
+
+ view->flag = 0;
+ *gfxPtr = gfx;
+
+ return TRUE;
+}
diff --git a/src/overlays/gamestates/ovl__00743CD0/_00743CD0.h b/src/overlays/gamestates/ovl__00743CD0/_00743CD0.h
index 1da7f9e..7e48657 100644
--- a/src/overlays/gamestates/ovl__00743CD0/_00743CD0.h
+++ b/src/overlays/gamestates/ovl__00743CD0/_00743CD0.h
@@ -9,7 +9,7 @@
typedef struct Game__00743CD0 {
/* 0x0000 */ Game state;
- /* 0x00E0 */ Game_Play1938 unk_00E0;
+ /* 0x00E0 */ View view;
/* 0x0208 */ UNK_TYPE1 unk_0208[0x2FC-0x208];
/* 0x02FC */ ObjectExchangeBank unk_02FC;
} Game__00743CD0; // size = 0x1B20
diff --git a/src/overlays/gamestates/ovl_play/m_play.c b/src/overlays/gamestates/ovl_play/m_play.c
index 008300c..893fe69 100644
--- a/src/overlays/gamestates/ovl_play/m_play.c
+++ b/src/overlays/gamestates/ovl_play/m_play.c
@@ -389,7 +389,7 @@ void play_init(Game* game) {
mSM_submenu_ovlptr_init(game_play);
func_8007CFD8_jp(game_play);
mEv_init(&game_play->event);
- initView(&game_play->unk_1938, gfxCtx);
+ initView(&game_play->view, gfxCtx);
func_80064F48_jp(game_play);
CollisionCheck_ct(game_play, &game_play->unk_2138);
func_8006BB64_jp();
@@ -579,13 +579,13 @@ void setupFog(Game_Play* game_play, GraphicsContext* gfxCtx) {
}
void setupViewer(Game_Play* game_play) {
- showView(&game_play->unk_1938, 0xF);
+ showView(&game_play->view, 0xF);
}
void setupViewMatrix(Game_Play* game_play, GraphicsContext* __gfxCtx, GraphicsContext* gfxCtx2) {
// TODO: A way to fit OPEN_DISPS/CLOSE_DISPS on the stack
- Matrix_MtxtoMtxF(&game_play->unk_1938.unk_0A0, &game_play->billboardMtxF);
- Matrix_MtxtoMtxF(&game_play->unk_1938.unk_060, &game_play->viewProjectionMtxF);
+ Matrix_MtxtoMtxF(&game_play->view.viewingMtx, &game_play->billboardMtxF);
+ Matrix_MtxtoMtxF(&game_play->view.projectionMtx, &game_play->viewProjectionMtxF);
Skin_Matrix_MulMatrix(&game_play->viewProjectionMtxF, &game_play->billboardMtxF, &game_play->viewProjectionMtxF);
game_play->billboardMtxF.mf[0][3] = 0.0f;
@@ -613,16 +613,16 @@ s32 makeBumpTexture(Game_Play* game_play, GraphicsContext* __gfxCtx, GraphicsCon
gSPDisplayList(OVERLAY_DISP++, sp194);
if (game_play->unk_1EE3 == 3) {
- Game_Play1938 sp60;
+ View view;
- initView(&sp60, gfxCtx2);
+ initView(&view, gfxCtx2);
{
- sp60.unk_120 = 10;
+ view.flag = 10;
//! FAKE
label2:;
}
- SET_FULLSCREEN_VIEWPORT(&sp60);
- showView1(&sp60, 0xF, &sp194);
+ SET_FULLSCREEN_VIEWPORT(&view);
+ showView1(&view, 0xF, &sp194);
game_play->unk_1EE8.unk_21C.unk_0C(&game_play->unk_1EE8, &sp194);
}
diff --git a/src/overlays/gamestates/ovl_play/m_play.h b/src/overlays/gamestates/ovl_play/m_play.h
index 5f523b0..4549cff 100644
--- a/src/overlays/gamestates/ovl_play/m_play.h
+++ b/src/overlays/gamestates/ovl_play/m_play.h
@@ -68,7 +68,7 @@ typedef struct Game_Play {
/* 0x00E8 */ UNK_TYPE1 unk_00E8[0x24];
/* 0x010C */ void* unk_010C;
/* 0x0110 */ ObjectExchangeBank objectExchangeBank;
- /* 0x1938 */ Game_Play1938 unk_1938;
+ /* 0x1938 */ View view;
/* 0x1A60 */ Camera2 camera;
/* 0x1B98 */ Kankyo kankyo;
/* 0x1C60 */ Global_light glight;
diff --git a/src/overlays/gamestates/ovl_select/m_select.c b/src/overlays/gamestates/ovl_select/m_select.c
index 5a3628d..1c2195a 100644
--- a/src/overlays/gamestates/ovl_select/m_select.c
+++ b/src/overlays/gamestates/ovl_select/m_select.c
@@ -939,7 +939,7 @@ void select_init(Game* game) {
select->selectedScene = 0;
initView(&select->view, game->gfxCtx);
- select->view.unk_120 = 10;
+ select->view.flag = 10;
select->unk_234 = 0;
select->unk_238 = 0;
diff --git a/src/overlays/gamestates/ovl_select/m_select.h b/src/overlays/gamestates/ovl_select/m_select.h
index 8dbb323..9ef78df 100644
--- a/src/overlays/gamestates/ovl_select/m_select.h
+++ b/src/overlays/gamestates/ovl_select/m_select.h
@@ -26,7 +26,7 @@ struct gfxprint;
typedef struct Game_Select {
/* 0x000 */ Game state;
- /* 0x0E0 */ Game_Play1938 view;
+ /* 0x0E0 */ View view;
/* 0x208 */ s32 status;
/* 0x20C */ s32 cursorX;
/* 0x210 */ s32 cursorY;
diff --git a/src/overlays/submenu/submenu_ovl/m_submenu_ovl.c b/src/overlays/submenu/submenu_ovl/m_submenu_ovl.c
index be3129b..1b4be82 100644
--- a/src/overlays/submenu/submenu_ovl/m_submenu_ovl.c
+++ b/src/overlays/submenu/submenu_ovl/m_submenu_ovl.c
@@ -631,12 +631,12 @@ void mSM_setup_view(Submenu* submenu, GraphicsContext* gfxCtx, s32 arg1) {
OPEN_CUSTOM_POLY_OPA();
if (arg1 == 0) {
- Game_Play1938* view;
+ View* view;
if (submenu->unk_00 != 4) {
- view = &((Game_Play*)gamePT)->unk_1938;
+ view = &((Game_Play*)gamePT)->view;
} else {
- view = &((Game__00743CD0*)gamePT)->unk_00E0;
+ view = &((Game__00743CD0*)gamePT)->view;
}
gDPPipeSync(__polyOpa++);