document viewport functions

This commit is contained in:
mariob92 2024-09-10 00:17:16 +02:00
parent b77274c9ea
commit 4f843f3ecb
67 changed files with 562 additions and 548 deletions

View File

@ -250,8 +250,8 @@ void particleEmitter_setParticleVelocityRange(ParticleEmitter *, f32, f32, f32,
void func_802EFF50(ParticleEmitter *, f32);
void particleEmitter_setRGB(ParticleEmitter *this, s32 arg1[3]);
void particleEmitter_setSpawnInterval(ParticleEmitter *, f32);
int func_8024DC04(f32, f32, f32);
void func_8024E3A8(f32 [3], f32);
int viewport_isPointOutsideFrustum_3f(f32, f32, f32);
void viewport_adjustPointDistance(f32 [3], f32);
OSContPad *func_8024F3F4(void);
OSMesgQueue *pfsManager_getFrameReplyQ(void);

View File

@ -149,7 +149,7 @@ void func_80387CC0(void){
if(getGameMode() == GAME_MODE_7_ATTRACT_DEMO)
return;
viewport_get_rotation_vec3f(sp1C);
viewport_getRotation_vec3f(sp1C);
tmp_v0 = globalTimer_getTimeMasked(0x7F);
if(tmp_v0 >= 0x40){
tmp_v0 = 0x7F - tmp_v0;
@ -158,7 +158,7 @@ void func_80387CC0(void){
if(360.0f <= sp1C[2]){
sp1C[2] -= 360.0f;
}
viewport_set_rotation_vec3f(sp1C);
viewport_setRotation_vec3f(sp1C);
}

View File

@ -18,7 +18,7 @@ extern int func_80340020(s32, f32[3], s32, f32, s32, BKVertexList *, f32[3], f32
extern void boneTransformList_getBoneScale(s32, s32, f32[3]);
extern void boneTransformList_setBoneScale(s32, s32, f32[3]);
extern void func_8033A9A8(s32, s32, f32[3]);
extern void viewport_get_position_vec3f(f32[3]);
extern void viewport_getPosition_vec3f(f32[3]);
extern void ml_vec3f_normalize(f32[3]);
extern void func_8033A45C(s32, s32);
extern void modelRender_setBoneTransformList(s32);
@ -146,7 +146,7 @@ void CC_func_80388760(Gfx **gfx, Mtx **mtx, Vtx **vtx){
if(D_80389FA0.unk21 == 0)
return;
viewport_get_position_vec3f(sp98);
viewport_getPosition_vec3f(sp98);
if(sp98[0] < -2600.0f || 11600.0f < sp98[0])
return;

View File

@ -162,7 +162,7 @@ void func_8038687C(Actor *this) {
if (local->unk0 != NULL) {
other = marker_getActor(local->unk0);
viewport_get_position_vec3f(sp78);
viewport_getPosition_vec3f(sp78);
sp6C[0] = this->position[0] - sp78[0];
sp6C[1] = this->position[1] - sp78[1];
sp6C[2] = this->position[2] - sp78[2];
@ -188,7 +188,7 @@ void func_8038687C(Actor *this) {
if(tmp < (f32) phi_v0)
continue;
if(func_8024DC04(sp4C[0], 0.0f, sp4C[2]))
if(viewport_isPointOutsideFrustum_3f(sp4C[0], 0.0f, sp4C[2]))
break;
}

View File

@ -153,7 +153,7 @@ void chnapper_update(Actor *this){
}//L80386DF4
if(this->state != 4){
viewport_get_position_vec3f(sp58);
viewport_getPosition_vec3f(sp58);
sp4C[0] = this->position_x - sp58[0];
sp4C[1] = this->position_y - sp58[1];
sp4C[2] = this->position_z - sp58[2];

View File

@ -128,7 +128,7 @@ void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) {
func_8028F66C(BS_INTR_D_SURF);
}
if (sp3C && ((sp40[0] != 0.0f) || (sp40[1] != 0.0f))) {
viewport_get_rotation_vec3f(sp70);
viewport_getRotation_vec3f(sp70);
sp64[0] = sp40[0];
sp64[1] = 0.0f;
sp64[2] = -sp40[1];
@ -147,7 +147,7 @@ void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) {
func_80351B28(arg1, sp54);
func_8035179C(arg1, sp54);
if (arg0->unk0 != NULL) {
viewport_get_position_vec3f(sp7C);
viewport_getPosition_vec3f(sp7C);
sp64[0] = sp54[0] - sp7C[0];
sp64[2] = sp54[2] - sp7C[2];
sp64[1] = 0.0f;

View File

@ -139,7 +139,7 @@ void func_80386A7C(Actor *this){
func_802D3D74(this);
this->depth_mode = 1;
viewport_get_position_vec3f(&sp2C);
viewport_getPosition_vec3f(&sp2C);
sp28 = func_80386A30(&this->position);
temp_v0 = func_80386A30(&sp2C);
this->unk38_0 = 0;

View File

@ -239,7 +239,7 @@ void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom) {
gScissorBoxBottom = bottom;
framebuffer_width = top - left;
framebuffer_height = bottom - right;
func_8024CC5C();
viewport_pushFramebufferExtendsToVpStack();
}

View File

@ -34,7 +34,7 @@ f32 ml_acosValTbl[90] = { //D_80276CBC
0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997
};
f32 viewport_get_yaw(void);
f32 viewport_getYaw(void);
// .h
void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]);
@ -1485,7 +1485,7 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
s32 func_8025975C(f32 a0)
{
f32 val = (s32)(viewport_get_yaw() - a0);
f32 val = (s32)(viewport_getYaw() - a0);
while (val < 0)
val += 360;

View File

@ -17,7 +17,7 @@ void func_802409C0(f32 arg0[3], f32 arg1){
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * sp24);
viewport_get_rotation_vec3f(&sp3C);
viewport_getRotation_vec3f(&sp3C);
ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]);
arg0[0] = arg0[0] + sp30[0];
@ -59,7 +59,7 @@ void func_80240AC8(f32 arg0[3], f32 arg1){
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * sp24);
viewport_get_rotation_vec3f(&sp3C);
viewport_getRotation_vec3f(&sp3C);
ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]);
arg0[0] = arg0[0] + sp30[0];

View File

@ -4,7 +4,7 @@
extern f32 ml_cos_deg(f32);
extern f32 ml_sin_deg(f32);
extern void veiwport_get_position_vec3w(s32[3]);
extern void viewport_getPosition_vec3w(s32[3]);
Gfx D_80275880[] = {
gsSPClearGeometryMode(G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0060CD00),
@ -26,7 +26,7 @@ void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3],
s32 sp78[3][4];
s32 i;
veiwport_get_position_vec3w(spB4);
viewport_getPosition_vec3w(spB4);
gSPDisplayList((*gfx)++, D_80275880);
if (arg6 != 0) {
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_BACK);
@ -95,7 +95,7 @@ void func_80241928(Gfx** gfx, Vtx** vtx, s32 arg2[3], s32 arg3, s32 arg4[3]) {
s32 var_fp;
s32 var_s0;
veiwport_get_position_vec3w(spB4);
viewport_getPosition_vec3w(spB4);
for(var_fp = 0; var_fp < 4; var_fp++){
gSPDisplayList((*gfx)++, D_80275880);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
@ -162,7 +162,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3
sp68[1] *= arg5;
sp68[2] *= arg5;
viewport_get_position_vec3f(sp5C);
viewport_getPosition_vec3f(sp5C);
gSPDisplayList((*gfx)++, D_80275880);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
gSPVertex((*gfx)++, *vtx, 8, 0);
@ -209,7 +209,7 @@ void func_80242BE8(Gfx **gfx, Vtx **arg1, f32 arg2[2][2][2][3], s32 arg3[3], s32
s32 i;
s32 j;
s32 k;
viewport_get_position_vec3f(sp84);
viewport_getPosition_vec3f(sp84);
gSPDisplayList((*gfx)++, D_80275880);
if (arg5){
gSPSetGeometryMode((*gfx)++, G_CULL_BACK);

View File

@ -4,91 +4,82 @@
extern void guPerspective(Mtx *, u16*, f32, f32, f32, f32, f32);
extern f32 ml_dotProduct_vec3f(f32[3], f32[3]);
#define VIEWPORT_FOVY_DEFAULT (40.0f)
/* .data */
f32 s_viewport_fovy = VIEWPORT_FOVY_DEFAULT; //fovy
f32 s_viewport_aspect = 1.35185182f; //aspect
f32 s_viewport_near = 30.0f; //near
f32 s_viewport_far = 4000.0f; //far
/* .data */
f32 D_80280EA0[3];
f32 viewportPosition[3];
f32 viewportRotation[3];
f32 D_80280ECC;
f32 D_80280ED0[4][4];
Vp s_viewport_stack[8];
int D_80280F90;
f32 D_80280F98[4][4];
Mtx D_80280FD8;
s32 s_viewport_stack_index; //viewport indx
void func_8024F450(void);
void func_8024F4AC(void);
void func_8024C964(Gfx **, Mtx **, f32, f32);
void func_8024CD7C(int);
void viewport_set_position_f3(f32, f32, f32);
void viewport_set_rotation_f3(f32, f32, f32);
void viewport_set_near_far(f32, f32);
void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void viewport_set_field_of_view(f32);
void func_80256E24(f32 [3], f32, f32, f32, f32, f32);
/* .code */
#define VIEWPORT_FOVY_DEFAULT (40.0f)
#define VIEWPORT_STACK_SIZE (8)
f32 sViewportFOVy = VIEWPORT_FOVY_DEFAULT;
f32 sViewportAspect = 1.35185182f;
f32 sViewportNear = 30.0f;
f32 sViewportFar = 4000.0f;
f32 sViewportLookVector[3];
f32 sViewportPosition[3];
f32 sViewportRotation[3];
f32 sViewportUnused1; // debug?
f32 sViewportFrustumPlanes[4][4];
Vp sViewportStack[VIEWPORT_STACK_SIZE];
int sViewportUnused2; // debug?
f32 sViewportMatrix[4][4];
Mtx sViewportDefaultMatrix;
s32 sViewportStackIndex;
void viewport_setRenderPerspectiveMatrix(Gfx **, Mtx **, f32, f32);
void viewport_debug4(int);
void viewport_setPosition_f3(f32, f32, f32);
void viewport_setRotation_f3(f32, f32, f32);
void viewport_setNearAndFar(f32, f32);
void viewport_pushVpScaleAndTranslation(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void viewport_setFOVy(f32);
void func_8024C510(f32 arg0){
f32 sp24[3];
func_80256E24(sp24, viewportRotation[0], viewportRotation[1], 0.0f, 0.0f, arg0);
viewportPosition[0] += sp24[0];
viewportPosition[1] += sp24[1];
viewportPosition[2] += sp24[2];
func_80256E24(sp24, sViewportRotation[0], sViewportRotation[1], 0.0f, 0.0f, arg0);
sViewportPosition[0] += sp24[0];
sViewportPosition[1] += sp24[1];
sViewportPosition[2] += sp24[2];
}
f32 viewport_getDistance(f32 arg0[3]){
ml_distance_vec3f(arg0, viewportPosition);
f32 viewport_getDistance(f32 arg0[3]) {
ml_distance_vec3f(arg0, sViewportPosition);
}
void func_8024C5A8(f32 arg0[3]){
ml_vec3f_copy(arg0, D_80280EA0);
void viewport_getLookVector(f32 arg0[3]) {
ml_vec3f_copy(arg0, sViewportLookVector);
}
void viewport_get_position_vec3f(f32 arg0[3]){
ml_vec3f_copy(arg0, viewportPosition);
void viewport_getPosition_vec3f(f32 arg0[3]) {
ml_vec3f_copy(arg0, sViewportPosition);
}
void veiwport_get_position_vec3w(s32 dst[3]){
dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0;
void viewport_getPosition_vec3w(s32 dst[3]) {
dst[0] = ((f32)(s32)(sViewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(sViewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(sViewportPosition[2]*500.0))/500.0;
}
void veiwport_get_position_vec3s(s16 dst[3]){
dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0;
void viewport_getPosition_vec3s(s16 dst[3]) {
dst[0] = ((f32)(s32)(sViewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(sViewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(sViewportPosition[2]*500.0))/500.0;
}
void viewport_get_rotation_vec3f(f32 arg0[3]){
ml_vec3f_copy(arg0, viewportRotation);
void viewport_getRotation_vec3f(f32 arg0[3]) {
ml_vec3f_copy(arg0, sViewportRotation);
}
f32 viewport_get_yaw(void){
return viewportRotation[1];
f32 viewport_getYaw(void) {
return sViewportRotation[1];
}
void viewport_get_rotation_f3(f32 *pitch, f32 *yaw, f32 *roll){
*pitch = viewportRotation[0];
*yaw = viewportRotation[1];
*roll = viewportRotation[2];
void viewport_getRotation_f3(f32 *pitch, f32 *yaw, f32 *roll) {
*pitch = sViewportRotation[0];
*yaw = sViewportRotation[1];
*roll = sViewportRotation[2];
}
void func_8024C7B8(Gfx **gfx, Mtx **mtx){
gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]);
void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx) {
gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]);
guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f);
gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
@ -97,321 +88,337 @@ void func_8024C7B8(Gfx **gfx, Mtx **mtx){
gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
void func_8024C904(Gfx **gfx, Mtx **mtx){
gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]);
func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far);
void viewport_setRenderViewportAndPerspectiveMatrix(Gfx **gfx, Mtx **mtx) {
gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]);
viewport_setRenderPerspectiveMatrix(gfx, mtx, sViewportNear, sViewportFar);
}
void func_8024C964(Gfx **gfx, Mtx **mtx, f32 near, f32 far){
void viewport_setRenderPerspectiveMatrix(Gfx **gfx, Mtx **mtx, f32 near, f32 far) {
u16 sp5e;
near = MAX(s_viewport_near, near);
far = MIN(s_viewport_far, far);
near = MAX(sViewportNear, near);
far = MIN(sViewportFar, far);
if(*(u32*)OS_PHYSICAL_TO_K1(0x1D8) + 0x53D4FFF0){
near = 750.0f;
near = 750.0f;
far = 1250.0f;
}
guPerspective(*mtx, &sp5e, s_viewport_fovy, s_viewport_aspect, near, far, 0.5f);
guPerspective(*mtx, &sp5e, sViewportFOVy, sViewportAspect, near, far, 0.5f);
gSPPerspNormalize((*gfx)++, sp5e);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guRotate(*mtx, -viewportRotation[2], 0.0f, 0.0f, -1.0f);
guRotate(*mtx, -sViewportRotation[2], 0.0f, 0.0f, -1.0f);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
guRotate(*mtx, -viewportRotation[0], 1.0f, 0.0f, 0.0f);
guRotate(*mtx, -sViewportRotation[0], 1.0f, 0.0f, 0.0f);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
guRotate(*mtx, -viewportRotation[1], 0.0f, 1.0f, 0.0f);
guRotate(*mtx, -sViewportRotation[1], 0.0f, 1.0f, 0.0f);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
guTranslate(*mtx, 0.0f, 0.0f, 0.0f);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
void func_8024CBD4(Gfx **gfx, Mtx **mtx){
func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far);
void viewport_setRenderPerspectiveMatrixDefaultNearAndFar(Gfx **gfx, Mtx **mtx) {
viewport_setRenderPerspectiveMatrix(gfx, mtx, sViewportNear, sViewportFar);
}
void viewport_debug(void){}
void viewport_debug(void) {}
void func_8024CC08(f32 arg0){
void viewport_debug2(f32 arg0) {
if(90.0f < arg0) arg0 = 90.0f;
if(arg0 < 5.0f) arg0 = 10.0f;
D_80280ECC = arg0;
sViewportUnused1 = arg0;
}
f32 func_8024CC50(void){
return D_80280ECC;
f32 viewport_debug3(void) {
return sViewportUnused1;
}
void func_8024CC5C(void){
func_8024CE74((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2));
void viewport_pushFramebufferExtendsToVpStack(void) {
viewport_pushVpScaleAndTranslation((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2));
}
void viewport_reset(void){
func_8024CD7C(1);
viewport_set_position_f3(0.0f, 0.0f, 0.0f);
viewport_set_rotation_f3(0.0f, 0.0f, 0.0f);
func_8024CC08(40.0f);
viewport_set_near_far(1.0f, 10000.0f);
func_8024CC5C();
viewport_set_field_of_view(VIEWPORT_FOVY_DEFAULT);
void viewport_reset(void) {
viewport_debug4(1);
viewport_setPosition_f3(0.0f, 0.0f, 0.0f);
viewport_setRotation_f3(0.0f, 0.0f, 0.0f);
viewport_debug2(40.0f);
viewport_setNearAndFar(1.0f, 10000.0f);
viewport_pushFramebufferExtendsToVpStack();
viewport_setFOVy(VIEWPORT_FOVY_DEFAULT);
mlMtxIdent();
mlMtxRotYaw(-60.0f);
mlMtxRotPitch(-90.0f);
mlMtxGet(&D_80280FD8);
mlMtxGet(&sViewportDefaultMatrix);
}
void func_8024CD7C(int arg0){
D_80280F90 = arg0;
void viewport_debug4(int arg0) {
sViewportUnused2 = arg0;
}
void viewport_set_position_vec3f(f32 src[3]){
ml_vec3f_copy(viewportPosition, src);
void viewport_setPosition_vec3f(f32 src[3]) {
ml_vec3f_copy(sViewportPosition, src);
}
void viewport_set_position_vec3w(s32 src[3]){
viewportPosition[0] = (f32)src[0];
viewportPosition[1] = (f32)src[1];
viewportPosition[2] = (f32)src[2];
void viewport_setPosition_vec3w(s32 src[3]) {
sViewportPosition[0] = (f32)src[0];
sViewportPosition[1] = (f32)src[1];
sViewportPosition[2] = (f32)src[2];
}
void viewport_set_position_f3(f32 x, f32 y, f32 z){
viewportPosition[0] = x;
viewportPosition[1] = y;
viewportPosition[2] = z;
void viewport_setPosition_f3(f32 x, f32 y, f32 z) {
sViewportPosition[0] = x;
sViewportPosition[1] = y;
sViewportPosition[2] = z;
}
void viewport_set_rotation_vec3f(f32 src[3]){
ml_vec3f_copy(viewportRotation, src);
void viewport_setRotation_vec3f(f32 src[3]) {
ml_vec3f_copy(sViewportRotation, src);
}
void viewport_set_rotation_f3(f32 pitch, f32 yaw, f32 roll){
viewportRotation[0] = pitch;
viewportRotation[1] = yaw;
viewportRotation[2] = roll;
void viewport_setRotation_f3(f32 pitch, f32 yaw, f32 roll) {
sViewportRotation[0] = pitch;
sViewportRotation[1] = yaw;
sViewportRotation[2] = roll;
}
void viewport_set_near_far(f32 near, f32 far){
s_viewport_near = near;
s_viewport_far = far;
void viewport_setNearAndFar(f32 near, f32 far) {
sViewportNear = near;
sViewportFar = far;
}
void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
s_viewport_stack_index = (s_viewport_stack_index + 1) % 8;
s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0;
osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8);
void viewport_pushVpScaleAndTranslation(s32 scale_x, s32 scale_y, s32 translation_x, s32 translation_y) {
sViewportStackIndex = (sViewportStackIndex + 1) % 8;
sViewportStack[sViewportStackIndex].vp.vscale[0] = scale_x << 2;
sViewportStack[sViewportStackIndex].vp.vscale[1] = scale_y << 2;
sViewportStack[sViewportStackIndex].vp.vscale[2] = 0x1ff;
sViewportStack[sViewportStackIndex].vp.vscale[3] = 0;
sViewportStack[sViewportStackIndex].vp.vtrans[0] = translation_x << 2;
sViewportStack[sViewportStackIndex].vp.vtrans[1] = translation_y << 2;
sViewportStack[sViewportStackIndex].vp.vtrans[2] = 0x1ff;
sViewportStack[sViewportStackIndex].vp.vtrans[3] = 0;
osWritebackDCache(&sViewportStack[sViewportStackIndex], VIEWPORT_STACK_SIZE * sizeof(Vp));
}
void func_8024CF10(f32 arg0, f32 arg1, f32 arg2, f32 arg3){
s_viewport_stack_index = (s_viewport_stack_index + 1) % 8;
s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0*4;
s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1*4;
s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2*4;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3*4;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0;
osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8);
void viewport_unused_pushVpScaleAndTranslation(f32 scale_x, f32 scale_y, f32 translation_x, f32 translation_y) {
sViewportStackIndex = (sViewportStackIndex + 1) % 8;
sViewportStack[sViewportStackIndex].vp.vscale[0] = scale_x * 4;
sViewportStack[sViewportStackIndex].vp.vscale[1] = scale_y * 4;
sViewportStack[sViewportStackIndex].vp.vscale[2] = 0x1ff;
sViewportStack[sViewportStackIndex].vp.vscale[3] = 0;
sViewportStack[sViewportStackIndex].vp.vtrans[0] = translation_x * 4;
sViewportStack[sViewportStackIndex].vp.vtrans[1] = translation_y * 4;
sViewportStack[sViewportStackIndex].vp.vtrans[2] = 0x1ff;
sViewportStack[sViewportStackIndex].vp.vtrans[3] = 0;
osWritebackDCache(&sViewportStack[sViewportStackIndex], VIEWPORT_STACK_SIZE * sizeof(Vp));
}
void viewport_update(void){
func_80256E24(D_80280ED0[0], viewportRotation[0], viewportRotation[1], -89.21774f, 0.0f, 45.168514251708984f);
func_80256E24(D_80280ED0[1], viewportRotation[0], viewportRotation[1], 89.21774f, 0.0f, 45.168514251708984f);
func_80256E24(D_80280ED0[2], viewportRotation[0], viewportRotation[1], 0.0f, 93.9692611694336f, 34.20201110839844f);
func_80256E24(D_80280ED0[3], viewportRotation[0], viewportRotation[1], 0.0f, -93.9692611694336f, 34.20201110839844f);
ml_vec3f_normalize(D_80280ED0[0]);
ml_vec3f_normalize(D_80280ED0[1]);
ml_vec3f_normalize(D_80280ED0[2]);
ml_vec3f_normalize(D_80280ED0[3]);
D_80280ED0[0][3] = -(viewportPosition[0]*D_80280ED0[0][0] + viewportPosition[1]*D_80280ED0[0][1] + viewportPosition[2]*D_80280ED0[0][2]);
D_80280ED0[1][3] = -(viewportPosition[0]*D_80280ED0[1][0] + viewportPosition[1]*D_80280ED0[1][1] + viewportPosition[2]*D_80280ED0[1][2]);
D_80280ED0[2][3] = -(viewportPosition[0]*D_80280ED0[2][0] + viewportPosition[1]*D_80280ED0[2][1] + viewportPosition[2]*D_80280ED0[2][2]);
D_80280ED0[3][3] = -(viewportPosition[0]*D_80280ED0[3][0] + viewportPosition[1]*D_80280ED0[3][1] + viewportPosition[2]*D_80280ED0[3][2]);
void viewport_update(void) {
func_80256E24(sViewportFrustumPlanes[0], sViewportRotation[0], sViewportRotation[1], -89.21774f, 0.0f, 45.168514251708984f);
func_80256E24(sViewportFrustumPlanes[1], sViewportRotation[0], sViewportRotation[1], 89.21774f, 0.0f, 45.168514251708984f);
func_80256E24(sViewportFrustumPlanes[2], sViewportRotation[0], sViewportRotation[1], 0.0f, 93.9692611694336f, 34.20201110839844f);
func_80256E24(sViewportFrustumPlanes[3], sViewportRotation[0], sViewportRotation[1], 0.0f, -93.9692611694336f, 34.20201110839844f);
ml_vec3f_normalize(sViewportFrustumPlanes[0]);
ml_vec3f_normalize(sViewportFrustumPlanes[1]);
ml_vec3f_normalize(sViewportFrustumPlanes[2]);
ml_vec3f_normalize(sViewportFrustumPlanes[3]);
sViewportFrustumPlanes[0][3] = -(sViewportPosition[0]*sViewportFrustumPlanes[0][0] + sViewportPosition[1]*sViewportFrustumPlanes[0][1] + sViewportPosition[2]*sViewportFrustumPlanes[0][2]);
sViewportFrustumPlanes[1][3] = -(sViewportPosition[0]*sViewportFrustumPlanes[1][0] + sViewportPosition[1]*sViewportFrustumPlanes[1][1] + sViewportPosition[2]*sViewportFrustumPlanes[1][2]);
sViewportFrustumPlanes[2][3] = -(sViewportPosition[0]*sViewportFrustumPlanes[2][0] + sViewportPosition[1]*sViewportFrustumPlanes[2][1] + sViewportPosition[2]*sViewportFrustumPlanes[2][2]);
sViewportFrustumPlanes[3][3] = -(sViewportPosition[0]*sViewportFrustumPlanes[3][0] + sViewportPosition[1]*sViewportFrustumPlanes[3][1] + sViewportPosition[2]*sViewportFrustumPlanes[3][2]);
mlMtxIdent();
mlMtxRotYaw(viewportRotation[1]);
mlMtxRotPitch(viewportRotation[0]);
mlMtxGet(&D_80280F98);
D_80280EA0[0] = 0.0f;
D_80280EA0[1] = 0.0f;
D_80280EA0[2] = -1.0f;
func_8025235C(D_80280EA0, D_80280EA0);
mlMtxRotYaw(sViewportRotation[1]);
mlMtxRotPitch(sViewportRotation[0]);
mlMtxGet(&sViewportMatrix);
sViewportLookVector[0] = 0.0f;
sViewportLookVector[1] = 0.0f;
sViewportLookVector[2] = -1.0f;
func_8025235C(sViewportLookVector, sViewportLookVector);
}
void func_8024D1EC(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3[4]){
void viewport_getFrustumPlanes(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3[4]) {
s32 i;
for(i = 0; i < 4; i++){
arg0[i] = D_80280ED0[0][i];
arg1[i] = D_80280ED0[1][i];
arg2[i] = D_80280ED0[2][i];
arg3[i] = D_80280ED0[3][i];
arg0[i] = sViewportFrustumPlanes[0][i];
arg1[i] = sViewportFrustumPlanes[1][i];
arg2[i] = sViewportFrustumPlanes[2][i];
arg3[i] = sViewportFrustumPlanes[3][i];
}
}
void func_8024D2B0(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3[4]){
void viewport_setFrustumPlanes(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3[4]) {
s32 i;
for(i = 0; i < 4; i++){
D_80280ED0[0][i] = arg0[i];
D_80280ED0[1][i] = arg1[i];
D_80280ED0[2][i] = arg2[i];
D_80280ED0[3][i] = arg3[i];
for(i = 0; i < 4; i++) {
sViewportFrustumPlanes[0][i] = arg0[i];
sViewportFrustumPlanes[1][i] = arg1[i];
sViewportFrustumPlanes[2][i] = arg2[i];
sViewportFrustumPlanes[3][i] = arg3[i];
}
}
bool func_8024D374(f32 arg0[3], f32 arg1[3]) {
bool viewport_isBoundingBoxInFrustum(f32 min[3], f32 max[3]) {
if ((D_80280ED0[0][0] * arg0[0] + D_80280ED0[0][1] * arg0[1] + D_80280ED0[0][2] * arg0[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg0[0] + D_80280ED0[0][1] * arg0[1] + D_80280ED0[0][2] * arg1[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg0[0] + D_80280ED0[0][1] * arg1[1] + D_80280ED0[0][2] * arg0[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg0[0] + D_80280ED0[0][1] * arg1[1] + D_80280ED0[0][2] * arg1[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg1[0] + D_80280ED0[0][1] * arg0[1] + D_80280ED0[0][2] * arg0[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg1[0] + D_80280ED0[0][1] * arg0[1] + D_80280ED0[0][2] * arg1[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg1[0] + D_80280ED0[0][1] * arg1[1] + D_80280ED0[0][2] * arg0[2] + D_80280ED0[0][3]) >= 0.0f)
if ((D_80280ED0[0][0] * arg1[0] + D_80280ED0[0][1] * arg1[1] + D_80280ED0[0][2] * arg1[2] + D_80280ED0[0][3]) >= 0.0f)
return 0;
if (((sViewportFrustumPlanes[0][0] * min[0] + sViewportFrustumPlanes[0][1] * min[1] + sViewportFrustumPlanes[0][2] * min[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * min[0] + sViewportFrustumPlanes[0][1] * min[1] + sViewportFrustumPlanes[0][2] * max[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * min[0] + sViewportFrustumPlanes[0][1] * max[1] + sViewportFrustumPlanes[0][2] * min[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * min[0] + sViewportFrustumPlanes[0][1] * max[1] + sViewportFrustumPlanes[0][2] * max[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * max[0] + sViewportFrustumPlanes[0][1] * min[1] + sViewportFrustumPlanes[0][2] * min[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * max[0] + sViewportFrustumPlanes[0][1] * min[1] + sViewportFrustumPlanes[0][2] * max[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * max[0] + sViewportFrustumPlanes[0][1] * max[1] + sViewportFrustumPlanes[0][2] * min[2] + sViewportFrustumPlanes[0][3]) >= 0.0f) &&
((sViewportFrustumPlanes[0][0] * max[0] + sViewportFrustumPlanes[0][1] * max[1] + sViewportFrustumPlanes[0][2] * max[2] + sViewportFrustumPlanes[0][3]) >= 0.0f))
return FALSE;
if ((D_80280ED0[1][0] * arg0[0] + D_80280ED0[1][1] * arg0[1] + D_80280ED0[1][2] * arg0[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg0[0] + D_80280ED0[1][1] * arg0[1] + D_80280ED0[1][2] * arg1[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg0[0] + D_80280ED0[1][1] * arg1[1] + D_80280ED0[1][2] * arg0[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg0[0] + D_80280ED0[1][1] * arg1[1] + D_80280ED0[1][2] * arg1[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg1[0] + D_80280ED0[1][1] * arg0[1] + D_80280ED0[1][2] * arg0[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg1[0] + D_80280ED0[1][1] * arg0[1] + D_80280ED0[1][2] * arg1[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg1[0] + D_80280ED0[1][1] * arg1[1] + D_80280ED0[1][2] * arg0[2] + D_80280ED0[1][3]) >= 0.0f)
if ((D_80280ED0[1][0] * arg1[0] + D_80280ED0[1][1] * arg1[1] + D_80280ED0[1][2] * arg1[2] + D_80280ED0[1][3]) >= 0.0f)
return 0;
if (((sViewportFrustumPlanes[1][0] * min[0] + sViewportFrustumPlanes[1][1] * min[1] + sViewportFrustumPlanes[1][2] * min[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * min[0] + sViewportFrustumPlanes[1][1] * min[1] + sViewportFrustumPlanes[1][2] * max[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * min[0] + sViewportFrustumPlanes[1][1] * max[1] + sViewportFrustumPlanes[1][2] * min[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * min[0] + sViewportFrustumPlanes[1][1] * max[1] + sViewportFrustumPlanes[1][2] * max[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * max[0] + sViewportFrustumPlanes[1][1] * min[1] + sViewportFrustumPlanes[1][2] * min[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * max[0] + sViewportFrustumPlanes[1][1] * min[1] + sViewportFrustumPlanes[1][2] * max[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * max[0] + sViewportFrustumPlanes[1][1] * max[1] + sViewportFrustumPlanes[1][2] * min[2] + sViewportFrustumPlanes[1][3]) >= 0.0f) &&
((sViewportFrustumPlanes[1][0] * max[0] + sViewportFrustumPlanes[1][1] * max[1] + sViewportFrustumPlanes[1][2] * max[2] + sViewportFrustumPlanes[1][3]) >= 0.0f))
return FALSE;
if ((D_80280ED0[2][0] * arg0[0] + D_80280ED0[2][1] * arg0[1] + D_80280ED0[2][2] * arg0[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg0[0] + D_80280ED0[2][1] * arg0[1] + D_80280ED0[2][2] * arg1[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg0[0] + D_80280ED0[2][1] * arg1[1] + D_80280ED0[2][2] * arg0[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg0[0] + D_80280ED0[2][1] * arg1[1] + D_80280ED0[2][2] * arg1[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg1[0] + D_80280ED0[2][1] * arg0[1] + D_80280ED0[2][2] * arg0[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg1[0] + D_80280ED0[2][1] * arg0[1] + D_80280ED0[2][2] * arg1[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg1[0] + D_80280ED0[2][1] * arg1[1] + D_80280ED0[2][2] * arg0[2] + D_80280ED0[2][3]) >= 0.0f)
if ((D_80280ED0[2][0] * arg1[0] + D_80280ED0[2][1] * arg1[1] + D_80280ED0[2][2] * arg1[2] + D_80280ED0[2][3]) >= 0.0f)
return 0;
if (((sViewportFrustumPlanes[2][0] * min[0] + sViewportFrustumPlanes[2][1] * min[1] + sViewportFrustumPlanes[2][2] * min[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * min[0] + sViewportFrustumPlanes[2][1] * min[1] + sViewportFrustumPlanes[2][2] * max[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * min[0] + sViewportFrustumPlanes[2][1] * max[1] + sViewportFrustumPlanes[2][2] * min[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * min[0] + sViewportFrustumPlanes[2][1] * max[1] + sViewportFrustumPlanes[2][2] * max[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * max[0] + sViewportFrustumPlanes[2][1] * min[1] + sViewportFrustumPlanes[2][2] * min[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * max[0] + sViewportFrustumPlanes[2][1] * min[1] + sViewportFrustumPlanes[2][2] * max[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * max[0] + sViewportFrustumPlanes[2][1] * max[1] + sViewportFrustumPlanes[2][2] * min[2] + sViewportFrustumPlanes[2][3]) >= 0.0f) &&
((sViewportFrustumPlanes[2][0] * max[0] + sViewportFrustumPlanes[2][1] * max[1] + sViewportFrustumPlanes[2][2] * max[2] + sViewportFrustumPlanes[2][3]) >= 0.0f))
return FALSE;
if ((D_80280ED0[3][0] * arg0[0] + D_80280ED0[3][1] * arg0[1] + D_80280ED0[3][2] * arg0[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg0[0] + D_80280ED0[3][1] * arg0[1] + D_80280ED0[3][2] * arg1[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg0[0] + D_80280ED0[3][1] * arg1[1] + D_80280ED0[3][2] * arg0[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg0[0] + D_80280ED0[3][1] * arg1[1] + D_80280ED0[3][2] * arg1[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg1[0] + D_80280ED0[3][1] * arg0[1] + D_80280ED0[3][2] * arg0[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg1[0] + D_80280ED0[3][1] * arg0[1] + D_80280ED0[3][2] * arg1[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg1[0] + D_80280ED0[3][1] * arg1[1] + D_80280ED0[3][2] * arg0[2] + D_80280ED0[3][3]) >= 0.0f)
if ((D_80280ED0[3][0] * arg1[0] + D_80280ED0[3][1] * arg1[1] + D_80280ED0[3][2] * arg1[2] + D_80280ED0[3][3]) >= 0.0f)
return 0;
return 1;
if (((sViewportFrustumPlanes[3][0] * min[0] + sViewportFrustumPlanes[3][1] * min[1] + sViewportFrustumPlanes[3][2] * min[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * min[0] + sViewportFrustumPlanes[3][1] * min[1] + sViewportFrustumPlanes[3][2] * max[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * min[0] + sViewportFrustumPlanes[3][1] * max[1] + sViewportFrustumPlanes[3][2] * min[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * min[0] + sViewportFrustumPlanes[3][1] * max[1] + sViewportFrustumPlanes[3][2] * max[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * max[0] + sViewportFrustumPlanes[3][1] * min[1] + sViewportFrustumPlanes[3][2] * min[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * max[0] + sViewportFrustumPlanes[3][1] * min[1] + sViewportFrustumPlanes[3][2] * max[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * max[0] + sViewportFrustumPlanes[3][1] * max[1] + sViewportFrustumPlanes[3][2] * min[2] + sViewportFrustumPlanes[3][3]) >= 0.0f) &&
((sViewportFrustumPlanes[3][0] * max[0] + sViewportFrustumPlanes[3][1] * max[1] + sViewportFrustumPlanes[3][2] * max[2] + sViewportFrustumPlanes[3][3]) >= 0.0f))
return FALSE;
return TRUE;
}
bool cube_isInFrustum(Cube *cube) {
f32 min[3];
f32 max[3];
bool func_8024D8F4(Cube *cube) {
f32 sp24[3];
f32 sp18[3];
min[0] = (f32) ((cube->x * 1000) - 150);
min[1] = (f32) ((cube->y * 1000) - 150);
min[2] = (f32) ((cube->z * 1000) - 150);
sp24[0] = (f32) ((cube->x * 1000) - 150);
sp24[1] = (f32) ((cube->y * 1000) - 150);
sp24[2] = (f32) ((cube->z * 1000) - 150);
sp18[0] = sp24[0] + 1300.0f;
sp18[1] = sp24[1] + 1300.0f;
sp18[2] = sp24[2] + 1300.0f;
return func_8024D374(sp24, sp18);
max[0] = min[0] + 1300.0f;
max[1] = min[1] + 1300.0f;
max[2] = min[2] + 1300.0f;
return viewport_isBoundingBoxInFrustum(min, max);
}
bool func_8024D9B0(Cube *cube) {
f32 sp34[3];
f32 sp28[3];
f32 sp1C[3];
bool cube_isInFrustum2(Cube *cube) {
f32 min[3];
f32 max[3];
f32 rel_pos[3];
if (cube->x == -0x10) {
if (cube->x == -16) {
return TRUE;
}
sp1C[0] = (f32) ((cube->x * 1000) + 500) - viewportPosition[0];
sp1C[1] = (f32) ((cube->y * 1000) + 500) - viewportPosition[1];
sp1C[2] = (f32) ((cube->z * 1000) + 500) - viewportPosition[2];
if (LENGTH_SQ_VEC3F(sp1C) > 1.6e7f) {
rel_pos[0] = (f32) ((cube->x * 1000) + 500) - sViewportPosition[0];
rel_pos[1] = (f32) ((cube->y * 1000) + 500) - sViewportPosition[1];
rel_pos[2] = (f32) ((cube->z * 1000) + 500) - sViewportPosition[2];
if (LENGTH_SQ_VEC3F(rel_pos) > 1.6e7f) {
return FALSE;
}
sp34[0] = (f32) ((cube->x * 1000) - 150);
sp34[1] = (f32) ((cube->y * 1000) - 150);
sp34[2] = (f32) ((cube->z * 1000) - 150);
sp28[0] = sp34[0] + 1300.0f;
sp28[1] = sp34[1] + 1300.0f;
sp28[2] = sp34[2] + 1300.0f;
return func_8024D374(sp34, sp28);
min[0] = (f32) ((cube->x * 1000) - 150);
min[1] = (f32) ((cube->y * 1000) - 150);
min[2] = (f32) ((cube->z * 1000) - 150);
max[0] = min[0] + 1300.0f;
max[1] = min[1] + 1300.0f;
max[2] = min[2] + 1300.0f;
return viewport_isBoundingBoxInFrustum(min, max);
}
bool func_8024DB50(f32 arg0[3], f32 arg1) {
f32 delta[3];
s32 i;
delta[0] = arg0[0] - viewportPosition[0];
delta[1] = arg0[1] - viewportPosition[1];
delta[2] = arg0[2] - viewportPosition[2];
delta[0] = arg0[0] - sViewportPosition[0];
delta[1] = arg0[1] - sViewportPosition[1];
delta[2] = arg0[2] - sViewportPosition[2];
for(i = 0; i < 4; i++){
if(arg1 <= ml_dotProduct_vec3f(delta, D_80280ED0[i])){
if(arg1 <= ml_dotProduct_vec3f(delta, sViewportFrustumPlanes[i])){
return FALSE;
}
}
return TRUE;
}
bool func_8024DC04(f32 arg0, f32 arg1, f32 arg2) {
if (
(((D_80280ED0[0][0] * arg0) + (D_80280ED0[0][1] * arg1) + (D_80280ED0[0][2] * arg2) + D_80280ED0[0][3]) <= 0.0f)
&& (((D_80280ED0[1][0] * arg0) + (D_80280ED0[1][1] * arg1) + (D_80280ED0[1][2] * arg2) + D_80280ED0[1][3]) <= 0.0f)
&& (((D_80280ED0[2][0] * arg0) + (D_80280ED0[2][1] * arg1) + (D_80280ED0[2][2] * arg2) + D_80280ED0[2][3]) <= 0.0f)
&& (((D_80280ED0[3][0] * arg0) + (D_80280ED0[3][1] * arg1) + (D_80280ED0[3][2] * arg2) + D_80280ED0[3][3]) <= 0.0f)
) {
bool viewport_isPointOutsideFrustum_3f(f32 x, f32 y, f32 z) {
if ((sViewportFrustumPlanes[0][0] * x + sViewportFrustumPlanes[0][1] * y + sViewportFrustumPlanes[0][2] * z + sViewportFrustumPlanes[0][3] <= 0.0f) &&
(sViewportFrustumPlanes[1][0] * x + sViewportFrustumPlanes[1][1] * y + sViewportFrustumPlanes[1][2] * z + sViewportFrustumPlanes[1][3] <= 0.0f) &&
(sViewportFrustumPlanes[2][0] * x + sViewportFrustumPlanes[2][1] * y + sViewportFrustumPlanes[2][2] * z + sViewportFrustumPlanes[2][3] <= 0.0f) &&
(sViewportFrustumPlanes[3][0] * x + sViewportFrustumPlanes[3][1] * y + sViewportFrustumPlanes[3][2] * z + sViewportFrustumPlanes[3][3] <= 0.0f))
return TRUE;
}
return FALSE;
}
bool func_8024DD0C(f32 arg0[3]){
return func_8024DC04(arg0[0], arg0[1], arg0[2]);
bool viewport_isPointOutsideFrustum_vec3f(f32 arg0[3]) {
return viewport_isPointOutsideFrustum_3f(arg0[0], arg0[1], arg0[2]);
}
bool func_8024DD34(f32 arg0, f32 arg1, f32 arg2) {
return ((D_80280ED0[2][0]*arg0 + D_80280ED0[2][1]*arg1 + D_80280ED0[2][2]*arg2 + D_80280ED0[2][3]) <= 0.0f);
// need to figure out, what plane 2 is (neg/pos x/y ?)
bool viewport_isPointPlane2_3f(f32 arg0, f32 arg1, f32 arg2) {
return ((sViewportFrustumPlanes[2][0]*arg0 + sViewportFrustumPlanes[2][1]*arg1 + sViewportFrustumPlanes[2][2]*arg2 + sViewportFrustumPlanes[2][3]) <= 0.0f);
}
Mtx *func_8024DD90(void){
return &D_80280F98;
Mtx *viewport_getMatrix(void) {
return (Mtx *) sViewportMatrix;
}
Mtx *func_8024DD9C(void){
return &D_80280FD8;
Mtx *viewport_getDefaultMatrix(void) {
return &sViewportDefaultMatrix;
}
f32 viewport_get_field_of_view(void){
return s_viewport_fovy;
f32 viewport_getFOVy(void) {
return sViewportFOVy;
}
void viewport_set_field_of_view(f32 fovy){
s_viewport_fovy = fovy;
void viewport_setFOVy(f32 fovy) {
sViewportFOVy = fovy;
}
f32 viewport_get_aspect_ratio(void){
return s_viewport_aspect;
f32 viewport_getAspectRatio(void) {
return sViewportAspect;
}
f32 viewport_get_near(void){
return s_viewport_near;
f32 viewport_getNear(void) {
return sViewportNear;
}
f32 func_8024DDD8(s32 arg0, f32 arg1){
return mlNormalizeAngle((viewportRotation[1] + arg1) + 90.0);
f32 func_8024DDD8(s32 arg0, f32 arg1) {
return mlNormalizeAngle((sViewportRotation[1] + arg1) + 90.0);
}
f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) {
@ -420,54 +427,56 @@ f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) {
static f32 D_80281020;
static f32 D_80281024;
if ((s_viewport_fovy != D_8028101C) || (s_viewport_near != D_80281020)) {
fovy_rad = (s_viewport_fovy * M_PI) / 360.0;
D_80281024 = (500.0 + s_viewport_near) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad));
D_8028101C = s_viewport_fovy;
D_80281020 = s_viewport_near;
if ((sViewportFOVy != D_8028101C) || (sViewportNear != D_80281020)) {
fovy_rad = (sViewportFOVy * M_PI) / 360.0;
D_80281024 = (500.0 + sViewportNear) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad));
D_8028101C = sViewportFOVy;
D_80281020 = sViewportNear;
}
arg0 = arg0 - (framebuffer_width / (f32)2);
arg1 = (framebuffer_height / (f32)2) - arg1;
arg3[0] = viewportRotation[0];
arg3[1] = viewportRotation[1];
arg3[2] = viewportRotation[2];
arg3[0] = sViewportRotation[0];
arg3[1] = sViewportRotation[1];
arg3[2] = sViewportRotation[2];
arg2[0] = arg0 * D_80281024;
arg2[1] = arg1 * D_80281024;
arg2[2] = (-500.0 - s_viewport_near);
arg2[2] = (-500.0 - sViewportNear);
ml_vec3f_pitch_rotate_copy(arg2, arg2, arg3[0]);
ml_vec3f_yaw_rotate_copy(arg2, arg2, arg3[1]);
arg2[0] += viewportPosition[0];
arg2[1] += viewportPosition[1];
arg2[2] += viewportPosition[2];
arg2[0] += sViewportPosition[0];
arg2[1] += sViewportPosition[1];
arg2[2] += sViewportPosition[2];
return D_80281024;
}
f32 D_80281028[3];
f32 D_80281038[3];
f32 D_80281048[3];
f32 D_80281058[3];
f32 D_80281068[3];
f32 D_80281078[3];
f32 D_80281088[3];
f32 D_80281098[4][4];
f32 sViewportBackupPosition[3];
f32 sViewportBackupRotation[3];
f32 sViewportBackupFrustumPlanes[4][4];
f32 sViewportBackupLookVector[3];
f32 sViewportBackupMatrix[4][4];
bool func_8024E030(f32 arg0[3], f32 *arg1)
{
f32 sp34[3];
f32 temp_f2_2;
f32 temp_f2;
f32 sp28;
sp28 = (s_viewport_fovy * M_PI) / 360.0;
sp34[0] = arg0[0] - viewportPosition[0];
sp34[1] = arg0[1] - viewportPosition[1];
sp34[2] = arg0[2] - viewportPosition[2];
ml_vec3f_yaw_rotate_copy(sp34, sp34, -viewportRotation[1]);
ml_vec3f_pitch_rotate_copy(sp34, sp34, -viewportRotation[0]);
if ((-s_viewport_near) <= sp34[2]) {
f32 fovy_radians;
fovy_radians = (sViewportFOVy * M_PI) / 360.0;
sp34[0] = arg0[0] - sViewportPosition[0];
sp34[1] = arg0[1] - sViewportPosition[1];
sp34[2] = arg0[2] - sViewportPosition[2];
ml_vec3f_yaw_rotate_copy(sp34, sp34, -sViewportRotation[1]);
ml_vec3f_pitch_rotate_copy(sp34, sp34, -sViewportRotation[0]);
if ((-sViewportNear) <= sp34[2]) {
return 0;
}
temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(sp28);
temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(fovy_radians);
temp_f2_2 = (((f32) framebuffer_width) / ((f32) framebuffer_height)) * temp_f2;
arg1[0] = (f32) (((sp34[0] / temp_f2_2) + 1) * (((f32) framebuffer_width) / 2));
arg1[1] = (f32) ((1 - (sp34[1] / temp_f2)) * (((f32) framebuffer_height) / 2));
@ -480,38 +489,43 @@ bool func_8024E030(f32 arg0[3], f32 *arg1)
return 1;
}
void func_8024E258(void){
void viewport_backupState(void) {
s32 i, j;
viewport_get_position_vec3f(D_80281028);
viewport_get_rotation_vec3f(D_80281038);
func_8024D1EC(D_80281048, D_80281058, D_80281068, D_80281078);
func_8024C5A8(D_80281088);
viewport_getPosition_vec3f(sViewportBackupPosition);
viewport_getRotation_vec3f(sViewportBackupRotation);
viewport_getFrustumPlanes(sViewportBackupFrustumPlanes[0], sViewportBackupFrustumPlanes[1], sViewportBackupFrustumPlanes[2], sViewportBackupFrustumPlanes[3]);
viewport_getLookVector(sViewportBackupLookVector);
for(i = 0; i < 4; i++){
for(j = 0; j < 4; j++){
D_80281098[i][j] = D_80280F98[i][j];
sViewportBackupMatrix[i][j] = sViewportMatrix[i][j];
}
}
}
void func_8024E2FC(void){
void viewport_restoreState(void) {
s32 i, j;
viewport_set_position_vec3f(D_80281028);
viewport_set_rotation_vec3f(D_80281038);
func_8024D2B0(D_80281048, D_80281058, D_80281068, D_80281078);
ml_vec3f_copy(D_80280EA0, D_80281088);
viewport_setPosition_vec3f(sViewportBackupPosition);
viewport_setRotation_vec3f(sViewportBackupRotation);
viewport_setFrustumPlanes(sViewportBackupFrustumPlanes[0], sViewportBackupFrustumPlanes[1], sViewportBackupFrustumPlanes[2], sViewportBackupFrustumPlanes[3]);
ml_vec3f_copy(sViewportLookVector, sViewportBackupLookVector);
for(i = 0; i < 4; i++){
for(j = 0; j < 4; j++){
D_80280F98[i][j] = D_80281098[i][j];
sViewportMatrix[i][j] = sViewportBackupMatrix[i][j];
}
}
}
//moves the point(arg0) some distance (arg1) further away from the camera
void func_8024E3A8(f32 arg0[3], f32 distance){
f32 sp1C[3];
ml_vec3f_diff_copy(sp1C, viewportPosition, arg0);
ml_vec3f_set_length_copy(sp1C, sp1C, distance);
arg0[0] += sp1C[0];
arg0[1] += sp1C[1];
arg0[2] += sp1C[2];
void viewport_adjustPointDistance(f32 pos[3], f32 distance) {
f32 out[3];
ml_vec3f_diff_copy(out, sViewportPosition, pos);
ml_vec3f_set_length_copy(out, out, distance);
pos[0] += out[0];
pos[1] += out[1];
pos[2] += out[2];
}

View File

@ -34,9 +34,9 @@ int func_802A3350(void){
}
void func_802A339C(f32 arg0[3], f32 arg1[3], f32 arg2){
func_8024C5A8(arg0);
viewport_getLookVector(arg0);
ml_vec3f_scale(arg0, arg2);
viewport_get_rotation_vec3f(arg1);
viewport_getRotation_vec3f(arg1);
}
void func_802A33D8(void){

View File

@ -282,7 +282,7 @@ static void __bsdronexform_setState(int next_state){
case 5:// 802B02F4
_player_getPosition(sp24);
sp24[1] += 30.0f;
func_8024E3A8(sp24, 80.0f);
viewport_adjustPointDistance(sp24, 80.0f);
func_802AFBB8(sp24);
func_8029E3C0(0, 0.1f);
break;

View File

@ -88,7 +88,7 @@ f32 func_802D7038(Actor *this) {
void func_802D7124(Actor *actor, f32 arg1) {
f32 vp[3];
viewport_get_position_vec3f(&vp);
viewport_getPosition_vec3f(&vp);
if ((actor->position[0] - vp[0]) * (actor->position[0] - vp[0]) + (actor->position[2] - vp[2]) * (actor->position[2] - vp[2]) < 12250000.0f) {
func_802D729C(actor, arg1);
}

View File

@ -50,7 +50,7 @@ typedef struct{
extern void item_set(enum item_e, s32);
extern void actor_postdrawMethod(ActorMarker *);
extern void viewport_set_near_far(f32, f32);
extern void viewport_setNearAndFar(f32, f32);
Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chBottlesBonus_update(Actor *this);
@ -122,8 +122,8 @@ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) {
f32 vp_position[3];
f32 vp_rotation[3];
func_8024E258();
viewport_set_near_far(50.0f, 2000.0f);
viewport_backupState();
viewport_setNearAndFar(50.0f, 2000.0f);
if (getGameMode() == GAME_MODE_A_SNS_PICTURE) {
vp_rotation[0] = 0.0f;
vp_rotation[1] = 0.0f;
@ -139,15 +139,15 @@ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) {
vp_rotation[1] = 270.0f;
vp_rotation[2] = 0.0f;
}
viewport_set_position_vec3f(vp_position);
viewport_set_rotation_vec3f(vp_rotation);
viewport_setPosition_vec3f(vp_position);
viewport_setRotation_vec3f(vp_rotation);
viewport_update();
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
void chBottlesBonus_func_802DD158(Gfx **gfx, Mtx** mtx){
func_8024E2FC();
func_8024C904(gfx, mtx);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {

View File

@ -88,11 +88,11 @@ void func_802CDAC4(Actor *this){
f32 sp1C[3];
camera_setType(1);
viewport_set_position_vec3f(this->position);
viewport_setPosition_vec3f(this->position);
sp1C[0] = this->pitch;
sp1C[1] = this->yaw;
sp1C[2] = 0.0f;
viewport_set_rotation_vec3f(sp1C);
viewport_setRotation_vec3f(sp1C);
}
void func_802CDB18(Actor *this){

View File

@ -37,18 +37,18 @@ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vt
actor = marker_getActor(marker);
modelRender_preDraw((GenFunction_1)actor_predrawMethod, (s32)actor);
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)marker);
func_8024E258();
viewport_backupState();
{sp58[0] = 0.0f; sp58[1] = 0.0f; sp58[2] = 1312.5f;};
{sp4C[0] = 0.0f; sp4C[1] = 0.0f; sp4C[2] = 0.0f;};
viewport_set_position_vec3f(sp58);
viewport_set_rotation_vec3f(sp4C);
viewport_setPosition_vec3f(sp58);
viewport_setRotation_vec3f(sp4C);
viewport_update();
func_8024C904(gdl, mptr);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
{sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;};
{sp34[0] = 0.0f; sp34[1] = 165.0f; sp34[2] = 0.0f;};
modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, marker_loadModelBin(marker));
func_8024E2FC();
func_8024C904(gdl, mptr);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
return actor;
}

View File

@ -47,18 +47,18 @@ Actor *chOverlayPressStart_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx
modelRender_preDraw((GenFunction_1)actor_predrawMethod, (s32)actor);
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)marker);
func_8024E258();
viewport_backupState();
{sp58[0] = 0.0f; sp58[1] = 0.0f; sp58[2] = 1312.5f;};
{sp4C[0] = 0.0f; sp4C[1] = 0.0f; sp4C[2] = 0.0f;};
viewport_set_position_vec3f(sp58);
viewport_set_rotation_vec3f(sp4C);
viewport_setPosition_vec3f(sp58);
viewport_setRotation_vec3f(sp4C);
viewport_update();
func_8024C904(gdl, mptr);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
{sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;};
{sp34[0] = 0.0f; sp34[1] = 400.0f; sp34[2] = 0.0f;};
modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, marker_loadModelBin(marker));
func_8024E2FC();
func_8024C904(gdl, mptr);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
return actor;
}

View File

@ -52,7 +52,7 @@ void __chTermite_updateWalkSFX(Actor *this) {
f32 sp24[3];
f32 sp20;
viewport_get_position_vec3f(&sp24);
viewport_getPosition_vec3f(&sp24);
sp20 = ml_map_f( (300.0f - sp24[0])*(300.0f - sp24[0]) + (this->position[1] - sp24[1])*(this->position[1] - sp24[1]) + (-858.0f - sp24[2])*(-858.0f - sp24[2])
, 7617600.0f, 8236900.0f
, 8000.0f, 1000.0f

View File

@ -203,7 +203,7 @@ f32 func_8029B41C(void){
f32 sp1C;
player_getPosition(sp2C);
viewport_get_position_vec3f(sp20);
viewport_getPosition_vec3f(sp20);
func_80257F18(sp2C, sp20, &sp1C);
return sp1C;
}
@ -363,7 +363,7 @@ void func_8029B984(f32 dst[3]){
f32 sp18[3];
_player_getPosition(plyr_pos);
viewport_get_position_vec3f(sp18);
viewport_getPosition_vec3f(sp18);
ml_vec3f_diff_copy(dst, sp18, plyr_pos);
}

View File

@ -33,8 +33,8 @@ void func_802BAC58(void) {
f32 vp_rotation[3];
f32 sp1C[3];
viewport_get_position_vec3f(vp_position);
viewport_get_rotation_vec3f(vp_rotation);
viewport_getPosition_vec3f(vp_position);
viewport_getRotation_vec3f(vp_rotation);
func_802BEA4C(vp_rotation, vp_position, 150.0f, sp1C);
if (D_8037D810 == NULL) {
D_8037D810 = func_8032FBE4(sp1C, func_802BABC0, 1, 0x15D);

View File

@ -120,9 +120,9 @@ void func_802BBA84(void) {
f32 max[3];
mapModel_getBounds(min, max);
viewport_get_position_vec3f(vp_position);
viewport_get_rotation_vec3f(vp_rotation);
func_8024C5A8(sp48);
viewport_getPosition_vec3f(vp_position);
viewport_getRotation_vec3f(vp_rotation);
viewport_getLookVector(sp48);
D_8037D8CC = (f32) func_8033EAF8(min, max, vp_position, sp48);
D_8037D8CC += 100.0f;
if (D_8037D8CC < 1000.0f) {
@ -295,11 +295,11 @@ void ncCamera_update(void){
break;
}
viewport_get_position_vec3f(sp2C);
viewport_get_rotation_vec3f(sp20);
viewport_getPosition_vec3f(sp2C);
viewport_getRotation_vec3f(sp20);
func_802BB4D8(sp2C, sp20);
viewport_set_position_vec3f(sp2C);
viewport_set_rotation_vec3f(sp20);
viewport_setPosition_vec3f(sp2C);
viewport_setRotation_vec3f(sp20);
viewport_update();
func_802BEFB0();
func_802BBA84();
@ -352,8 +352,8 @@ void func_802BC2CC(s32 arg0) {
if (ncCameraType == CAMERA_TYPE_2_DYNAMIC) {
func_802BE894(D_8037D918, D_8037D908);
}
viewport_set_position_vec3f(D_8037D908);
viewport_set_rotation_vec3f(D_8037D918);
viewport_setPosition_vec3f(D_8037D908);
viewport_setRotation_vec3f(D_8037D918);
viewport_update();
__spawnQueue_add_2((GenFunction_2)func_802BC2A0, reinterpret_cast(s32, sp24), reinterpret_cast(s32, sp20));
if (ncCameraType == CAMERA_TYPE_2_DYNAMIC) {

View File

@ -94,7 +94,7 @@ void func_802BEFB0(void) {
return;
}
D_8037DA80.unk10 += time_getDelta();
viewport_get_position_vec3f(sp30);
viewport_getPosition_vec3f(sp30);
sp24[0] = sp30[0];
sp24[1] = sp30[1] + 10000.0f;
sp24[2] = sp30[2];

View File

@ -63,7 +63,7 @@ void func_802CA92C(Actor *this){
f32 sp28[3];
this->marker->collidable = FALSE;
player_getPosition(this->position);
viewport_get_position_vec3f(sp34);
viewport_getPosition_vec3f(sp34);
ml_vec3f_diff_copy(sp28, sp34, this->position);
ml_vec3f_set_length_copy(sp28, sp28, 180.0f);
this->position_x += sp28[0];

View File

@ -434,8 +434,8 @@ void func_802CCC5C(Actor *this) {
}
if (this->state == 1) {
player_getPosition(sp8C);
viewport_get_position_vec3f(sp80);
func_8024C5A8(sp74);
viewport_getPosition_vec3f(sp80);
viewport_getLookVector(sp74);
sp5C[0] = this->position[0] - sp80[0];
sp5C[1] = this->position[1] - sp80[1];
sp5C[2] = this->position[2] - sp80[2];

View File

@ -38,7 +38,7 @@ void func_802D8730(Actor *this) {
if(sp38 < this->position_y)
return;
func_8024E3A8(this->position, 40.0f);
viewport_adjustPointDistance(this->position, 40.0f);
this->position_y = sp38;
this->velocity_y -= sp3C;
if (this->velocity_y < 0.0f) {

View File

@ -31,17 +31,17 @@ Actor *func_802DC320(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
this = marker_getActor(marker);
modelRender_preDraw( (GenFunction_1)actor_predrawMethod, (s32)this);
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)marker);
func_8024E258();
viewport_backupState();
vp_position[0] = 0.0f;
vp_position[1] = 0.0f;
vp_position[2] = 937.5f;
vp_rotation[0] = 0.0f;
vp_rotation[1] = 0.0f;
vp_rotation[2] = 0.0f;
viewport_set_position_vec3f(vp_position);
viewport_set_rotation_vec3f(vp_rotation);
viewport_setPosition_vec3f(vp_position);
viewport_setRotation_vec3f(vp_rotation);
viewport_update();
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
model_position[0] = 0.0f;
model_position[1] = 0.0f;
model_position[2] = 0.0f;
@ -49,8 +49,8 @@ Actor *func_802DC320(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
sp34[1] = 137.5f;
sp34[2] = 0.0f;
modelRender_draw(gfx, mtx, model_position, NULL, 1.0f, sp34, marker_loadModelBin(marker));
func_8024E2FC();
func_8024C904(gfx, mtx);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
return this;
}

View File

@ -30,17 +30,17 @@ Actor *func_802DC7E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
this = marker_getActor(marker);
modelRender_preDraw( (GenFunction_1)actor_predrawMethod, (s32)this);
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)marker);
func_8024E258();
viewport_backupState();
sp58[0] = 0.0f;
sp58[1] = 0.0f;
sp58[2] = 860.0f;
sp4C[0] = 0.0f;
sp4C[1] = 0.0f;
sp4C[2] = 0.0f;
viewport_set_position_vec3f(sp58);
viewport_set_rotation_vec3f(sp4C);
viewport_setPosition_vec3f(sp58);
viewport_setRotation_vec3f(sp4C);
viewport_update();
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
sp40[0] = 0.0f;
sp40[1] = 0.0f;
sp40[2] = 0.0f;
@ -48,8 +48,8 @@ Actor *func_802DC7E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
sp34[1] = -87.0f;
sp34[2] = 0.0f;
modelRender_draw(gfx, mtx, sp40, NULL, 1.0f, sp34, marker_loadModelBin(marker));
func_8024E2FC();
func_8024C904(gfx, mtx);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
return this;
}

View File

@ -145,6 +145,6 @@ void func_802E08F0(Actor *this) {
if (actor_animationIsAt(this, 0.99f) != 0) {
marker_despawn(this->marker);
}
viewport_get_rotation_vec3f(sp24);
viewport_getRotation_vec3f(sp24);
this->yaw = sp24[1];
}

View File

@ -55,12 +55,12 @@ void func_802E329C(s32 arg0, Gfx **gfx_begin, Gfx **gfx_end) {
drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0);
}
if ((D_8037E8C0.unk14 == 0) || (D_8037E8C0.unk14 == 3)) {
func_8024C904(&gfx, &mtx);
viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx);
gcbound_draw(&gfx);
}
if (D_8037E8C0.unk14 == 1) {
drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0);
func_8024C904(&gfx, &mtx);
viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx);
func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx);
}
finishFrame(&gfx);

View File

@ -5,9 +5,9 @@
#include "gc/gctransition.h"
extern void func_8024C510(f32);
extern void viewport_set_position_f3(f32, f32, f32);
extern void viewport_set_rotation_f3(f32, f32, f32);
extern void viewport_set_near_far(f32, f32);
extern void viewport_setPosition_f3(f32, f32, f32);
extern void viewport_setRotation_f3(f32, f32, f32);
extern void viewport_setNearAndFar(f32, f32);
extern void func_802F5374(void);
extern void func_802FA0F8(void);
extern void timedFuncQueue_update(void);
@ -64,8 +64,8 @@ struct{
} D_8037E8E0;
void func_802E3800(void){
viewport_set_position_f3(0.0f, 0.0f, 0.0f);
viewport_set_rotation_f3(-30.0f, 30.0f, 0.0f);
viewport_setPosition_f3(0.0f, 0.0f, 0.0f);
viewport_setRotation_f3(-30.0f, 30.0f, 0.0f);
func_8024C510(3000.0f);
viewport_update();
}
@ -401,7 +401,7 @@ void func_802E4214(enum map_e map_id){
func_80253428(1);
animCache_init();
viewport_reset();
viewport_set_near_far(1.0f, 10000.0f);
viewport_setNearAndFar(1.0f, 10000.0f);
rand_reset();
scissorBox_setDefault();
func_80253FE8();

View File

@ -215,8 +215,8 @@ void func_802ECBD4(BKVertexList *dst, BKVertexList *src, f32 arg2[3], f32 rotati
f32 temp_f0;
s32 pad40;
viewport_get_position_vec3f(sp74);
func_8024C5A8(sp68);
viewport_getPosition_vec3f(sp74);
viewport_getLookVector(sp68);
mlMtxIdent();
func_80252CC4(arg2, rotation, 1.0f, NULL);
func_8025235C(sp74, sp74);

View File

@ -40,7 +40,7 @@ void func_802F1440(Struct_Core2_6A4B0_2 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx)
static s32 t_values[6] = {0x60, 0x60, 0x860, 0x60, 0x860, 0x860};
if (!arg0->unk10) {
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
}
gSPDisplayList((*gfx)++, D_803689D0);
@ -87,7 +87,7 @@ void func_802F1440(Struct_Core2_6A4B0_2 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx)
}
}
if (!arg0->unk10) {
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
}
@ -160,7 +160,7 @@ void func_802F1A10(Struct_Core2_6A4B0_2 *arg0, f32 angle_degrees) {
cos = cosf(angle_degrees * 2 * BAD_PI);
sin = sinf(angle_degrees * 2 * BAD_PI);
viewport_get_position_vec3f(spC0);
viewport_getPosition_vec3f(spC0);
spCC[0] = (-(framebuffer_width / 2) * 4) + 8;
spCC[1] = ((framebuffer_height / 2) * 4) - 0x38;
spCC[2] = -0xA;
@ -214,7 +214,7 @@ void func_802F1CAC(Struct_Core2_6A4B0_2 *arg0) {
s32 *var_s2;
viewport_get_position_vec3f(sp78);
viewport_getPosition_vec3f(sp78);
sp84[0] = (s32) ((1000.0f - sp78[0]) - 200.0f);
sp84[1] = (s32) ((0.0f - sp78[1]) + 300.0f);
sp84[2] = (s32) ((2000.0f - sp78[2]) + 0.0f);

View File

@ -67,11 +67,11 @@ void func_802F1FC0(Struct65s *self, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
s32 width;
s32 height;
viewport_get_position_vec3f(spDC);
viewport_getPosition_vec3f(spDC);
spD0[0] = self->unk0[0] - spDC[0];
spD0[1] = self->unk0[1] - spDC[1];
spD0[2] = self->unk0[2] - spDC[2];
mlMtxSet(func_8024DD90());
mlMtxSet(viewport_getMatrix());
func_80252330(spD0[0], spD0[1], spD0[2]);
mlMtxApply(*mtx);
gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -326,7 +326,7 @@ void func_802F2ED0(Struct64s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
f32 sp38[3];
if (arg0 != NULL && arg0->unk4) {
viewport_get_rotation_vec3f(sp38);
viewport_getRotation_vec3f(sp38);
mlMtxIdent();
mlMtxRotPitch(-sp38[0]);
mlMtxRotYaw(-sp38[1]);

View File

@ -36,7 +36,7 @@ ParticleEmitter *func_802F4274(f32 arg0[3]) {
ml_vec3f_copy(sp2C, arg0);
func_8024559C(sp2C, &sp20, &sp28);
sp2C[1] = sp28 + 14.0f;
viewport_get_position_vec3f(sp38);
viewport_getPosition_vec3f(sp38);
sp44[0] = sp38[0] - sp2C[0];
sp44[2] = sp38[2] - sp2C[2];
sp44[1] = 0.0f;

View File

@ -633,7 +633,7 @@ void _printbuffer_draw_letter(char letter, f32* xPtr, f32* yPtr, f32 arg3, Gfx *
//toggle letter gradient
D_80380AF4 ^= 1;
if(D_80380AF4){
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
gDPPipeSync((*gfx)++);
gDPSetTexturePersp((*gfx)++, G_TP_PERSP);
gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0xFF);
@ -883,7 +883,7 @@ void printbuffer_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
gDPPipeSync((*gfx)++);
gDPSetTexturePersp((*gfx)++, G_TP_PERSP);
gDPSetTextureFilter((*gfx)++, G_TF_BILERP);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}//*/
//adds a new string to the print buffer and updates string buffer end ptr

View File

@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern s32 func_8024DD34(f32,f32, f32);
extern s32 viewport_isPointPlane2_3f(f32,f32, f32);
/* .code */
void func_802F7EB0(struct3s *this){
@ -19,8 +19,8 @@ void func_802F7EB0(struct3s *this){
return;
player_getPosition(plyrPos);
func_8024C5A8(camNorm);
viewport_get_rotation_vec3f(camRot);
viewport_getLookVector(camNorm);
viewport_getRotation_vec3f(camRot);
sp50 = vector_pushBackNew(&this->unk20);
tmpf = randf2(50.0f, 1100.0f);
sp4C[0] = 0.0f;
@ -37,7 +37,7 @@ void func_802F7EB0(struct3s *this){
sp4C[1] = plyrPos[1] + sp4C[1];
sp4C[2] = plyrPos[2] + sp4C[2];
if(tmpf < 550.0)
for(i = 0; (i < 0xa) && func_8024DD34(sp4C[0],sp4C[1]- 10.0f, sp4C[2]); i++){
for(i = 0; (i < 0xa) && viewport_isPointPlane2_3f(sp4C[0],sp4C[1]- 10.0f, sp4C[2]); i++){
sp4C[1] += 100.0f;
}

View File

@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern int func_8024DD34(f32, f32, f32);
extern int viewport_isPointPlane2_3f(f32, f32, f32);
#define _SQ3(x, y, z) (((x) * (x)) + ((y) * (y)) + ((z) * (z)))
#define _SQ3v1(v) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2])
@ -20,8 +20,8 @@ void func_802F87B0(struct6s *this){
return;
player_getPosition(plyrPos);
func_8024C5A8(camNorm);
viewport_get_rotation_vec3f(camRot);
viewport_getLookVector(camNorm);
viewport_getRotation_vec3f(camRot);
ptr = vector_pushBackNew(&this->unk1C);
f20 = randf2(50.0f, 1200.0f);
sp4C[0] = 0.0f;
@ -39,7 +39,7 @@ void func_802F87B0(struct6s *this){
sp4C[1] += plyrPos[1];
sp4C[2] += plyrPos[2];
if(f20 < 600.0){
for(i = 0; i <10 && func_8024DD34(sp4C[0], sp4C[1] - 10.0f, sp4C[2]); i++){
for(i = 0; i <10 && viewport_isPointPlane2_3f(sp4C[0], sp4C[1] - 10.0f, sp4C[2]); i++){
sp4C[1] += 100.0f;
}
}

View File

@ -7,8 +7,8 @@ typedef struct {
f32 unkC[3];
}Struct_core2_72060_0;
extern f32 viewport_get_yaw();
extern int func_8024DD34(f32, f32, f32);
extern f32 viewport_getYaw();
extern int viewport_isPointPlane2_3f(f32, f32, f32);
extern void func_80251B5C(f32, f32, f32);
extern void mlMtx_rotate_pitch_deg(f32);
extern void mlMtx_rotate_yaw_deg(f32);
@ -166,12 +166,12 @@ void func_802F919C(void) {
} else {
var_f20 = 70.0f;
}
ml_vec3f_yaw_rotate_copy(sp4C, sp4C, viewport_get_yaw() + randf2(-var_f20, var_f20));
ml_vec3f_yaw_rotate_copy(sp4C, sp4C, viewport_getYaw() + randf2(-var_f20, var_f20));
sp4C[0] += D_80381040[0];
sp4C[1] += D_80381040[1];
sp4C[2] += D_80381040[2];
if (sp58 < 650.0) {
for(sp44 = 0; sp44 < 5 && func_8024DD34(sp4C[0], sp4C[1] - 10.0f, sp4C[2]) ; sp44++){
for(sp44 = 0; sp44 < 5 && viewport_isPointPlane2_3f(sp4C[0], sp4C[1] - 10.0f, sp4C[2]) ; sp44++){
sp4C[1] += 200.0f;
}
}
@ -200,8 +200,8 @@ void func_802F962C(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
void *phi_s0_2;
if ((D_80369280 != NULL) && (D_80369284 != 0)) {
viewport_get_position_vec3f(D_80381050);
viewport_get_rotation_vec3f(D_80381060);
viewport_getPosition_vec3f(D_80381050);
viewport_getRotation_vec3f(D_80381060);
D_80381090 = (s32)D_80369288 + D_80369288->gfx_list_offset_C + sizeof(BKGfxList);
temp_s3 = (BKVertexList *)((s32)D_80369288 + D_80369288->vtx_list_offset_10);
D_8038108C = vtxList_getGlobalNorm(temp_s3);

View File

@ -140,7 +140,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg4[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while(var_s1 < arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@ -150,7 +150,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg5[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while( var_s1 >= arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@ -166,7 +166,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg4[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while(var_s1 < arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@ -176,7 +176,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg5[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while(var_s1 >= arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@ -200,7 +200,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg4[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while( var_s1 < arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@ -210,7 +210,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg5[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while( var_s1 >= arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@ -226,7 +226,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg4[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while(var_s1 < arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@ -236,7 +236,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_s1 = arg5[2];
var_s0 = var_fp + var_s1*D_80381FA0.stride[1];
while(var_s1 >= arg3[2]) {
if ((var_s0->prop2Cnt != 0) && func_8024D9B0(var_s0) != 0) {
if ((var_s0->prop2Cnt != 0) && cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@ -267,7 +267,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
for(sp54 = arg4[2]; sp54 < arg3[2]; sp54++) {
var_fp = var_s0 + arg4[0];
for(var_s1 = arg4[0]; var_s1 < arg3[0]; var_s1++) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@ -275,7 +275,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_fp = var_s0 + arg5[0];
for(var_s1 = arg5[0]; var_s1 >= arg3[0]; var_s1--) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@ -288,7 +288,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
for(sp54 = arg5[2]; sp54 >= arg3[2]; sp54--) {
var_fp = var_s0 + arg4[0];
for(var_s1 = arg4[0]; var_s1 < arg3[0]; var_s1++) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@ -296,7 +296,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_fp = var_s0 + arg5[0];
for(var_s1 = arg5[0]; var_s1 >= arg3[0]; var_s1--) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@ -315,7 +315,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
for(sp54 = arg4[2]; sp54 < arg3[2]; sp54++) {
var_fp = var_s0 + arg4[0];
for(var_s1 = arg4[0]; var_s1 < arg3[0]; var_s1++) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@ -323,7 +323,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_fp = var_s0 + arg5[0];
for(var_s1 = arg5[0]; var_s1 >= arg3[0]; var_s1--) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@ -336,7 +336,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
for(sp54 = arg5[2]; sp54 >= arg3[2]; sp54--) {
var_fp = var_s0 + arg4[0];
for(var_s1 = arg4[0]; var_s1 < arg3[0]; var_s1++) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@ -344,7 +344,7 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
var_fp = var_s0 + arg5[0];
for(var_s1 = arg5[0]; var_s1 >= arg3[0]; var_s1--) {
if ((var_fp->prop2Cnt != 0) && func_8024D9B0(var_fp) != 0) {
if ((var_fp->prop2Cnt != 0) && cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@ -369,8 +369,8 @@ void func_80302C94(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
return;
func_8032D3A8();
viewport_get_position_vec3f(vp_position);
viewport_get_rotation_vec3f(vp_rotation);
viewport_getPosition_vec3f(vp_position);
viewport_getRotation_vec3f(vp_rotation);
func_80256664(vp_rotation);
cube_positionToIndices(vp_cube_indices, vp_position);
vp_cube_indices[0] -= D_80381FA0.min[0];\
@ -2404,8 +2404,8 @@ void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
do {
if (!func_80308F54(D_80382150[phi_s4])) {
temp_s3 = &D_80381FA0.cube_list[D_80382150[phi_s4]];
if (func_8024D8F4(temp_s3)) {
veiwport_get_position_vec3w(vp_pos);
if (cube_isInFrustum(temp_s3)) {
viewport_getPosition_vec3w(vp_pos);
vp_cube_index = cube_atPosition_s32(vp_pos) - D_80381FA0.cube_list;
for(phi_s0 = 0; (phi_s0 < D_80382150[phi_s4 + 1]) && (vp_cube_index != D_80382150[phi_s0 + 2]); phi_s0++) {
}

View File

@ -218,8 +218,8 @@ s32 func_8030CDE4(SfxSource *arg0){
f32 temp_f0;
f32 pad;
viewport_get_position_vec3f(&sp44);
func_8024C5A8(&sp38);
viewport_getPosition_vec3f(&sp44);
viewport_getLookVector(&sp38);
sp2C[0] = arg0->position[0] - sp44[0];
sp2C[1] = arg0->position[1] - sp44[1];
sp2C[2] = arg0->position[2] - sp44[2];

View File

@ -309,7 +309,7 @@ Actor *func_80325CAC(ActorMarker *marker, Gfx **gfx, Gfx **mtx, Vtx **vtx) {
this->position[1] -= D_8036E58C[1];
this->position[2] -= D_8036E58C[2];
}
viewport_get_rotation_vec3f(rotation);
viewport_getRotation_vec3f(rotation);
rotation[2] += this->roll;
func_80338338(0xFF, 0xFF, 0xFF);
if (this->unk124_11 != 0) {

View File

@ -101,7 +101,7 @@ void func_8032CB50(Cube *cube, bool global) {
if (cube->prop2Cnt >= 2) {
if (global == 0) {
veiwport_get_position_vec3w(ref_position); //distance from viewport
viewport_getPosition_vec3w(ref_position); //distance from viewport
} else {
ref_position[0] = 0;
ref_position[1] = 0;

View File

@ -19,7 +19,7 @@ u32 D_803835E0;
/* public */
void func_80335110(s32);
void func_80335128(s32);
void viewport_set_near_far(f32, f32);
void viewport_setNearAndFar(f32, f32);
void func_80335140(enum map_e);
void func_8033520C(s32);
@ -31,8 +31,8 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
if (D_803835E0 == 0) {
drawRectangle2D(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0);
func_802BBD2C(&sp44, &sp40);
viewport_set_near_far(sp44, sp40);
func_8024C904(gdl, mptr);
viewport_setNearAndFar(sp44, sp40);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
return;
}
if (func_80320708() == 0) {
@ -41,8 +41,8 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
spawnQueue_unlock();
sky_draw(gdl, mptr, vptr);
func_802BBD2C(&sp44, &sp40);
viewport_set_near_far(sp44, sp40);
func_8024C904(gdl, mptr);
viewport_setNearAndFar(sp44, sp40);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
if (mapModel_has_xlu_bin() != 0) {
mapModel_opa_draw(gdl, mptr, vptr);
if (game_is_frozen() == 0) {

View File

@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
Mtx *func_8024DD9C(void);
Mtx *viewport_getDefaultMatrix(void);
void mlMtxSet(Mtx *);
void func_80252330(f32, f32, f32);
void mlMtxApply(Mtx *);
@ -443,11 +443,11 @@ void func_803380F8(Gfx **gfx, Mtx **mtx, f32 arg2[3]) {
f32 sp2C[3];
f32 sp20[3];
viewport_get_position_vec3f(sp2C);
viewport_getPosition_vec3f(sp2C);
sp20[0] = arg2[0] - sp2C[0];
sp20[1] = arg2[1] - sp2C[1];
sp20[2] = arg2[2] - sp2C[2];
mlMtxSet(func_8024DD90());
mlMtxSet(viewport_getMatrix());
func_80252330(sp20[0], sp20[1], sp20[2]);
mlMtxApply(*mtx);
gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -457,11 +457,11 @@ void func_803381B4(Gfx **gfx, Mtx **mtx, f32 arg2[3]) {
f32 sp2C[3];
f32 sp20[3];
viewport_get_position_vec3f(sp2C);
viewport_getPosition_vec3f(sp2C);
sp20[0] = arg2[0] - sp2C[0];
sp20[1] = arg2[1] - sp2C[1];
sp20[2] = arg2[2] - sp2C[2];
mlMtxSet(func_8024DD9C());
mlMtxSet(viewport_getDefaultMatrix());
func_80252330(sp20[0], sp20[1], sp20[2]);
mlMtxApply(*mtx);
gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -40,10 +40,10 @@ void func_8033F7F0(u8 arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){
if(sp54->unk28_23 != 1){
ml_vec3f_copy(sp48, sp54->unk4);
sp48[1] += (sp54->unk1C*sp54->unk20[1])/100.0;
viewport_get_position_vec3f(sp3C);
viewport_getPosition_vec3f(sp3C);
ml_vec3f_diff_copy(sp30, sp48, sp3C);
if(sp54->unk28_12){
mlMtxSet(func_8024DD90());
mlMtxSet(viewport_getMatrix());
}
else{
mlMtxIdent();

View File

@ -7,7 +7,7 @@ extern void func_80252330(f32, f32, f32);
extern void mlMtxRotatePYR(f32, f32, f32);
extern void mlMtxApply(Mtx *);
extern void func_80349AD0(void);
extern void func_8024C5A8(f32[3]);
extern void viewport_getLookVector(f32[3]);
@ -51,8 +51,8 @@ void func_80344138(BKSpriteDisplayData *self, s32 frame, s32 mirrored, f32 posit
f32 sp38;
f32 sp34;
viewport_get_position_vec3f(sp6C);
func_8024C5A8(sp60);
viewport_getPosition_vec3f(sp6C);
viewport_getLookVector(sp60);
sp50[0] = position[0] - sp6C[0];
sp50[1] = position[1] - sp6C[1];
sp50[2] = position[2] - sp6C[2];
@ -81,7 +81,7 @@ void func_80344138(BKSpriteDisplayData *self, s32 frame, s32 mirrored, f32 posit
if (D_80371EC0.unk0 != NULL) {
D_80371EC0.unk0(D_80371EC0.unk4);
}
mlMtxSet(func_8024DD90());
mlMtxSet(viewport_getMatrix());
func_80252330(sp50[0], sp50[1], sp50[2]);
if ((scale != NULL) || mirrored) {
mlMtxScale_xyz((mirrored) ? -scale[0] : scale[0], sp38, sp34);
@ -109,8 +109,8 @@ void func_80344424(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi
f32 sp38;
f32 sp34;
viewport_get_position_vec3f(sp6C);
func_8024C5A8(sp60);
viewport_getPosition_vec3f(sp6C);
viewport_getLookVector(sp60);
sp50[0] = position[0] - sp6C[0];
sp50[1] = position[1] - sp6C[1];
sp50[2] = position[2] - sp6C[2];
@ -140,7 +140,7 @@ void func_80344424(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi
if (D_80371EC0.unk0 != NULL) {
D_80371EC0.unk0(D_80371EC0.unk4);
}
mlMtxSet(func_8024DD90());
mlMtxSet(viewport_getMatrix());
mlMtxRotatePYR(0.0f, 0.0f, rotation);
func_80252330(sp50[0], sp50[1], sp50[2]);
if ((scale != NULL) || mirrored) {
@ -167,8 +167,8 @@ void func_80344720(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi
f32 var_f14;
BKSpriteFrameDisplayData *temp_a3;
viewport_get_position_vec3f(sp5C);
func_8024C5A8(sp50);
viewport_getPosition_vec3f(sp5C);
viewport_getLookVector(sp50);
sp40[0] = position[0] - sp5C[0];
sp40[1] = position[1] - sp5C[1];
sp40[2] = position[2] - sp5C[2];

View File

@ -3,7 +3,7 @@
#include "variables.h"
extern bool func_8028F170(f32, f32);
extern void viewport_get_position_vec3f(f32[3]);
extern void viewport_getPosition_vec3f(f32[3]);
typedef struct {
f32 unk0;
@ -129,8 +129,8 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
temp_s1 = D_80386170.unk4;
if (( temp_s1 != NULL) && D_8038617C.unk0) {
viewport_get_position_vec3f(spDC);
viewport_get_rotation_vec3f(spD0);
viewport_getPosition_vec3f(spDC);
viewport_getRotation_vec3f(spD0);
sp9C[0] = temp_s1->unk4[0];
sp9C[1] = temp_s1->unk4[1];
sp9C[2] = temp_s1->unk4[2];
@ -196,7 +196,7 @@ void func_80350CA4(void) {
s32 var_v0;
if (D_80386170.unk4 != NULL) {
viewport_get_position_vec3f(sp54);
viewport_getPosition_vec3f(sp54);
sp48[0] = D_80386170.unk4->unk4[0];
sp48[1] = D_80386170.unk4->unk4[1];
sp48[2] = D_80386170.unk4->unk4[2];

View File

@ -97,7 +97,7 @@ void func_8036158C(Actor *this){
player_getPosition(sp24);
actor_collisionOff(this);
if( ml_distance_vec3f(this->position, sp24) < 1000.0f
&& func_8024DC04(this->position_x, this->position_y, this->position_z)
&& viewport_isPointOutsideFrustum_3f(this->position_x, this->position_y, this->position_z)
&& ml_timer_update(&local->unk4, sp30)
){
func_80361330(this, 2);

View File

@ -80,7 +80,7 @@ Struct62s D_803731E0[0x20] = {
/* .code */
void func_80361A30(f32 arg0[3], s32 arg1){
if(func_8024DD0C(arg0)){
if(viewport_isPointOutsideFrustum_vec3f(arg0)){
func_8030E6A4(arg1 >> 16, ((arg1 >> 8) & 0xff)*0.0078125, (arg1 & 0xff)*128.0);
}
}

View File

@ -68,7 +68,7 @@ void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
if (s_sprite != 0) {
gSPDisplayList((*gfx)++, s_fxairscore_context);
func_80347FC0(gfx, s_sprite, 0, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height);
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
//render all 6 air pieces
for(i_part = 0; i_part < AIRSCORE_COUNT; i_part++){
if ((i_part != 0) && (i_part != 5)) {
@ -104,7 +104,7 @@ void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
gDPPipeSync((*gfx)++);
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
}

View File

@ -143,7 +143,7 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){
if(arg0->unk20 == ITEM_C_NOTE){
gDPSetCombineMode((*gfx)++, G_CC_MODULATEIA, G_CC_MODULATEIA);
}
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
gSPVertex((*gfx)++, *vtx, 4, 0);
if(arg0->unk20 == ITEM_0_HOURGLASS_TIMER){
tmp_s2 = 0xC;
@ -184,7 +184,7 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){
gDPPipeSync((*gfx)++);
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
struct8s *fxcommon2score_new(enum item_e item_id) {

View File

@ -82,7 +82,7 @@ void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mt
gSPDisplayList((*gfx)++, D_8036A918);
func_80347FC0(gfx, D_8036A910, 0, 0, 0, 0, 0, 2, 2, &spEC, &spE8);
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
//loop over each honeycomb piece
for(i = D_80381F00-1; i >= 0; i--){//L80300E40
if(i != 0 && (i + 1 != D_80381F00 || D_80381F00 & 1)
@ -124,7 +124,7 @@ void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mt
gDPPipeSync((*gfx)++);
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
bool func_803012B8(f32 arg0, s32 arg1, s32 arg2){

View File

@ -115,7 +115,7 @@ void fxhoneycarrierscore_draw(s32 arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3,
sp118 = D_803815C0 == 2;
if (D_8036A010 != 0) {
func_80347FC0(arg2, (sp118 ) ? (D_8036A014 != 0) ? D_8036A014 : D_8036A010 : D_8036A010, 0, 0, 0, 0, 0, 2, 2, &sp13C, &sp138);
func_8024C7B8(arg2, arg3);
viewport_setRenderViewportAndOrthoMatrix(arg2, arg3);
gSPDisplayList((*arg2)++, D_8036A030);
for(sp134 = 0; sp134 < ((sp118)? ((D_8036A014 != 0) ? 2 : 1) : 6); sp134++){
sp110 = D_8036A018[sp134] * -0x3C;
@ -169,7 +169,7 @@ void fxhoneycarrierscore_draw(s32 arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3,
gDPPipeSync((*arg2)++);
gDPSetTextureLUT((*arg2)++, G_TT_NONE);
gDPPipelineMode((*arg2)++, G_PM_NPRIMITIVE);
func_8024C904(arg2, arg3);
viewport_setRenderViewportAndPerspectiveMatrix(arg2, arg3);
}
}

View File

@ -145,7 +145,7 @@ void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx
s32 j; // v0_2 (spF8)
gSPDisplayList((*gfx)++, D_8036A228);
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
pos_x = 44.0f;
// Draw all jinjo heads
for(jinjo_id = 0; jinjo_id < 5; jinjo_id++){
@ -200,7 +200,7 @@ void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx
gDPPipeSync((*gfx)++);
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
bool func_802FFA10(f32 arg0, s32 arg1, s32 arg2){

View File

@ -84,7 +84,7 @@ void fxlifescore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
if(1); //fake
if (D_80381EB0[D_80381EC4] != NULL) {
gSPDisplayList((*gfx)++, D_8036A278);
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
if(gfx);
gDPPipeSync((*gfx)++);
gDPSetCombineLERP((*gfx)++, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0);
@ -116,7 +116,7 @@ void fxlifescore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
gDPPipeSync((*gfx)++);
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
}

View File

@ -1208,7 +1208,7 @@ void __gcpausemenu_drawSprite(Gfx** gdl, Mtx** mptr, Vtx** vptr, BKSprite* sprit
func_80338338(0xFF, 0xFF, 0xFF);
func_803382FC(a);
func_8033837C(0);
viewport_get_position_vec3f(sp50);
viewport_getPosition_vec3f(sp50);
sp34 = func_8024DE1C(x, y, sp5C, sp44);
mlMtxIdent(); //matrix_stack_identity
@ -1319,7 +1319,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
if (D_80383010.unk3E[i] < 0.0) {
D_80383010.unk3E[i] += 360.0;
}
func_8024E258();
viewport_backupState();
sp98[0] = ((i-1)*0.4)*360 + -360.0f;
sp98[1] = 0.0f;
sp98[2] = 1000.0f;
@ -1327,10 +1327,10 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
sp8C[0] = 0.0f;
sp8C[1] = 0.0f;
sp8C[2] = 0.0f;
viewport_set_position_vec3f(sp98);
viewport_set_rotation_vec3f(sp8C);
viewport_setPosition_vec3f(sp98);
viewport_setRotation_vec3f(sp8C);
viewport_update();
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
sp98[0] = 0.0f;
sp98[1] = 0.0f;
sp98[2] = 0.0f;
@ -1350,8 +1350,8 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE);
modelRender_setAlpha(D_80383010.sns_alpha);
modelRender_draw(gfx, mtx, sp98, sp8C, 0.8f, sp80, D_80383010.sns_egg_model);
func_8024E2FC();
func_8024C904(gfx, mtx);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
}
if (sns_get_item_state(7, 0)) {
@ -1362,7 +1362,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
if (D_80383010.unk3E[0] < 0.0) {
D_80383010.unk3E[0] += 360.0;
}
func_8024E258();
viewport_backupState();
sp98[0] = 0.0f;
sp98[1] = 0.0f;
@ -1372,10 +1372,10 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
sp8C[1] = 0.0f;
sp8C[2] = 0.0f;
viewport_set_position_vec3f(sp98);
viewport_set_rotation_vec3f(sp8C);
viewport_setPosition_vec3f(sp98);
viewport_setRotation_vec3f(sp8C);
viewport_update();
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
sp98[0] = 0.0f;
sp98[1] = 0.0f;
@ -1391,8 +1391,8 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE);
modelRender_setAlpha(D_80383010.sns_alpha);
modelRender_draw(gfx, mtx, sp98, sp8C, 0.8f, sp80, D_80383010.ice_key_model);
func_8024E2FC();
func_8024C904(gfx, mtx);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
}

View File

@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern void viewport_set_near_far(f32, f32);
extern void viewport_setNearAndFar(f32, f32);
typedef struct {
s16 model_id;
@ -74,11 +74,11 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){
f32 rotation[3];
BKModelBin *iAsset;
viewport_set_near_far(5.0f, 15000.0f);
viewport_setNearAndFar(5.0f, 15000.0f);
if(gcSky.model_bins[0]){
drawRectangle2D(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black
func_8024C904(gfx, mtx);
viewport_get_position_vec3f(position);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
viewport_getPosition_vec3f(position);
for(i = 0; i < 3; i++){
iAsset = gcSky.model_bins[i];
if(iAsset){

View File

@ -7,7 +7,7 @@
void animctrl_setAnimTimer(AnimCtrl*, f32);
void func_8025AC20(s32, s32, s32, f32, char*, s32);
f32 func_80257618(void);
void viewport_set_near_far(f32, f32);
void viewport_setNearAndFar(f32, f32);
typedef enum {
TRANSITION_ID_1_BLACK_IN = 1,
@ -251,7 +251,7 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){
if(s_current_transition.state == 0)
return;
func_8024E258();
viewport_backupState();
if(s_current_transition.animctrl != NULL){
vp_position[0] = 0.0f;
vp_position[1] = 0.0f;
@ -265,11 +265,11 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){
vp_rotation[0] = 0.0f;
vp_rotation[1] = 0.0f;
vp_rotation[2] = 0.0f;
viewport_set_near_far(D_8036C440, D_8036C444);
viewport_set_position_vec3f(vp_position); //viewport_get_position_vec3f
viewport_set_rotation_vec3f(vp_rotation); //viewport_get_rotation_vec3f
viewport_setNearAndFar(D_8036C440, D_8036C444);
viewport_setPosition_vec3f(vp_position); //viewport_getPosition_vec3f
viewport_setRotation_vec3f(vp_rotation); //viewport_getRotation_vec3f
viewport_update(); //camera_updateNormal
func_8024C904(gdl, mptr);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
sp58[0] = 0.0f;
@ -367,8 +367,8 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){
if(s_current_transition.animctrl != NULL){
gDPSetTextureFilter((*gdl)++, G_TF_BILERP);
}
func_8024E2FC();
func_8024C904(gdl, mptr);
viewport_restoreState();
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);
}

View File

@ -849,7 +849,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s3
func_803382FC(this->unk168 * arg6);
func_803382E4(5);
func_80335D30(gfx);
func_8024C7B8(gfx, mtx);
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
mlMtxIdent();
if (this->unk1A4_24) {
mlMtxRotYaw(180.0f);
@ -867,7 +867,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s3
modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE);
func_80344090(arg5, this->unk186, gfx);
func_8033687C(gfx);
func_8024C904(gfx, mtx);
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
}
void func_80316764(GcZoombox *this, s32 arg1) {

View File

@ -10,10 +10,10 @@ extern bool func_802ED420(BKModelUnk20List *arg0, u8 *arg1, u32 arg2);
extern void func_802ED52C(BKModelUnk20List *, f32[3], f32);
extern void func_80252AF0(f32[3], f32[3], f32[3], f32, f32[3]);
extern void mlMtxRotatePYR(f32, f32, f32);
extern void viewport_get_position_vec3f(f32[3]);
extern void viewport_get_rotation_vec3f(f32[3]);
extern void viewport_set_position_vec3f(f32[3]);
extern void viewport_set_rotation_vec3f(f32[3]);
extern void viewport_getPosition_vec3f(f32[3]);
extern void viewport_getRotation_vec3f(f32[3]);
extern void viewport_setPosition_vec3f(f32[3]);
extern void viewport_setRotation_vec3f(f32[3]);
extern void viewport_update(void);
extern void func_8033BD4C(BKModelBin *);
extern s32 func_8024DB50(f32[3], f32);
@ -696,8 +696,8 @@ void modelRender_reset(void){
func_8033A45C(1,1);
func_8033A45C(2,0);
if(D_80383758.unk18){
viewport_set_position_vec3f(D_80383758.unk1C);
viewport_set_rotation_vec3f(D_80383758.unk28);
viewport_setPosition_vec3f(D_80383758.unk1C);
viewport_setRotation_vec3f(D_80383758.unk28);
viewport_update();
}
}
@ -942,7 +942,7 @@ void func_80338DCC(Gfx ** gfx, Mtx ** mtx, void *arg2){
sp20[0] = (f32)cmd->unkE[0] * modelRenderScale;
sp20[1] = (f32)cmd->unkE[1] * modelRenderScale;
sp20[2] = (f32)cmd->unkE[2] * modelRenderScale;
if(func_8024D374(sp2C, sp20)){
if(viewport_isBoundingBoxInFrustum(sp2C, sp20)){
func_80339124(gfx, mtx, (BKGeoList*)((s32)cmd + cmd->unk14));
}
}
@ -1034,8 +1034,8 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation
}
D_80370990 = 0;
viewport_get_position_vec3f(modelRenderCameraPosition);
viewport_get_rotation_vec3f(modelRenderCameraRotation);
viewport_getPosition_vec3f(modelRenderCameraPosition);
viewport_getRotation_vec3f(modelRenderCameraRotation);
if(D_80383758.unk18){
D_80383758.unk1C[0] = modelRenderCameraPosition[0];
D_80383758.unk1C[1] = modelRenderCameraPosition[1];
@ -1075,8 +1075,8 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation
modelRenderCameraRotation[0] = D_80383758.unkC[0],
modelRenderCameraRotation[1] = D_80383758.unkC[1],
modelRenderCameraRotation[2] = D_80383758.unkC[2];
viewport_set_position_vec3f(modelRenderCameraPosition);
viewport_set_rotation_vec3f(modelRenderCameraRotation);
viewport_setPosition_vec3f(modelRenderCameraPosition);
viewport_setRotation_vec3f(modelRenderCameraRotation);
viewport_update();
camera_focus[0] = object_position[0] - modelRenderCameraPosition[0];
camera_focus[1] = object_position[1] - modelRenderCameraPosition[1];
@ -1420,8 +1420,8 @@ void func_8033A28C(bool arg0){
void func_8033A298(bool arg0){
D_80383758.unk18 = arg0;
if(arg0){
viewport_get_position_vec3f(D_80383758.unk0);
viewport_get_rotation_vec3f(D_80383758.unkC);
viewport_getPosition_vec3f(D_80383758.unk0);
viewport_getRotation_vec3f(D_80383758.unkC);
}
}

View File

@ -7,8 +7,8 @@ void ncDynamicCamF_init(void){
f32 sp24[3];
f32 sp12[3];
viewport_get_position_vec3f(sp24);
viewport_get_rotation_vec3f(sp12);
viewport_getPosition_vec3f(sp24);
viewport_getRotation_vec3f(sp12);
ncDynamicCamera_setPosition(sp24);
ncDynamicCamera_setRotation(sp12);
player_getPosition(__playerStartPosition);

View File

@ -211,8 +211,8 @@ void func_802BCBD4(void) {
func_802C0120();
func_802C2258();
func_802C0F4C();
viewport_get_rotation_vec3f(cameraRotation);
viewport_get_position_vec3f(cameraPosition);
viewport_getRotation_vec3f(cameraRotation);
viewport_getPosition_vec3f(cameraPosition);
ml_vec3f_copy(D_8037D948, cameraPosition);
ml_vec3f_clear(D_8037D9C8);
ml_vec3f_clear(D_8037D9E0);
@ -365,8 +365,8 @@ void ncDynamicCamera_update(void){
if(dynamicCameraInFirstPerson){
ncFirstPersonCamera_getPositionAndRotation(sp24, sp18);
}
viewport_set_position_vec3f(sp24);
viewport_set_rotation_vec3f(sp18);
viewport_setPosition_vec3f(sp24);
viewport_setRotation_vec3f(sp18);
}
int ncDynamicCamera_getState(void){
@ -939,8 +939,8 @@ void func_802BE720(void){
f32 sp28[3];
f32 sp1C[3];
viewport_get_position_vec3f(sp28);
viewport_get_rotation_vec3f(sp1C);
viewport_getPosition_vec3f(sp28);
viewport_getRotation_vec3f(sp1C);
ncDynamicCamera_setPosition(sp28);
ncDynamicCamera_setRotation(sp1C);
@ -960,8 +960,8 @@ void func_802BE794(void){
sp2C[1] += 100.0f;
player_getRotation(sp20);
sp20[1] = mlNormalizeAngle(sp20[1] + 180.0f);
viewport_set_position_vec3f(sp2C);
viewport_set_rotation_vec3f(sp20);
viewport_setPosition_vec3f(sp2C);
viewport_setRotation_vec3f(sp20);
func_8024C510(300.0f);
func_802BE720();
}//L802BE828

View File

@ -15,8 +15,8 @@ void ncRandomCamera_init(void) {
s32 sp24[3];
s32 sp18[3];
viewport_get_position_vec3f(D_8037DA50.storedPosition);
viewport_get_rotation_vec3f(D_8037DA50.storedRotation);
viewport_getPosition_vec3f(D_8037DA50.storedPosition);
viewport_getRotation_vec3f(D_8037DA50.storedRotation);
mapModel_getBounds(sp24, sp18);
D_8037DA50.minPosition[0] = (f32) sp24[0];
@ -30,8 +30,8 @@ void ncRandomCamera_init(void) {
void ncRandomCamera_end(void){
viewport_set_position_vec3f(D_8037DA50.storedPosition);
viewport_set_rotation_vec3f(D_8037DA50.storedRotation);
viewport_setPosition_vec3f(D_8037DA50.storedPosition);
viewport_setRotation_vec3f(D_8037DA50.storedRotation);
}
void ncRandomCamera_update(void) {
@ -45,6 +45,6 @@ void ncRandomCamera_update(void) {
sp18[0] = randf2(-90.0f, 90.0f);\
sp18[1] = randf2(0.0f, 360.0f);\
sp18[2] = 0.0f;
viewport_set_position_vec3f(sp24);
viewport_set_rotation_vec3f(sp18);
viewport_setPosition_vec3f(sp24);
viewport_setRotation_vec3f(sp18);
}

View File

@ -33,8 +33,8 @@ void ncStaticCamera_setPosition(f32 arg0[3]){
}
void ncStaticCamera_update(void){
viewport_set_position_vec3f(ncStaticCameraPosition);
viewport_set_rotation_vec3f(ncStaticCameraRotation);
viewport_setPosition_vec3f(ncStaticCameraPosition);
viewport_setRotation_vec3f(ncStaticCameraRotation);
}
void __ncStaticCamera_setToNode(s32 camera_node_index){

View File

@ -5,7 +5,7 @@
#include "core2/particle.h"
extern void viewport_get_position_vec3f(f32 (*)[3]);
extern void viewport_getPosition_vec3f(f32 (*)[3]);
extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
extern void func_80386654(f32 arg0, f32 (*arg1)[4], f32 (*arg2)[4]);
extern void func_80324CFC(f32, enum comusic_e, s32);
@ -325,7 +325,7 @@ void func_8038CED8(f32 arg0[3], enum asset_e model_id, f32 arg2, f32 arg3){
f32 sp40[3];
f32 sp34[3];
viewport_get_position_vec3f(&sp40);
viewport_getPosition_vec3f(&sp40);
sp34[0] = sp40[0] - arg0[0];
sp34[1] = sp40[1] - arg0[1];