Merge branch 'mr-origin-69'

This commit is contained in:
Banjo Kazooie
2024-09-13 20:26:40 -05:00
80 changed files with 806 additions and 660 deletions

58
include/core1/viewport.h Normal file
View File

@@ -0,0 +1,58 @@
#ifndef BANJO_KAZOOIE_VIEWPORT_H
#define BANJO_KAZOOIE_VIEWPORT_H
#include <ultra64.h>
#include <prop.h> // for Cube
#include "ml/mtx.h" // for MtxF
void viewport_moveAlongZAxis(f32 offset);
f32 viewport_getDistance(f32 arg0[3]);
void viewport_getLookVector(f32 arg0[3]);
void viewport_getPosition_vec3f(f32 arg0[3]);
void viewport_getPosition_vec3w(s32 dst[3]);
void viewport_getPosition_vec3s(s16 dst[3]);
void viewport_getRotation_vec3f(f32 arg0[3]);
f32 viewport_getYaw(void);
void viewport_getRotation_f3(f32 *pitch, f32 *yaw, f32 *roll);
void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx);
void viewport_setRenderViewportAndPerspectiveMatrix(Gfx **gfx, Mtx **mtx);
void viewport_setRenderPerspectiveMatrix(Gfx **gfx, Mtx **mtx, f32 near, f32 far);
void viewport_debug(void);
void viewport_debug2(f32 arg0);
f32 viewport_debug3(void);
void viewport_pushFramebufferExtendsToVpStack(void);
void viewport_reset(void);
void viewport_debug4(int arg0);
void viewport_setPosition_vec3f(f32 src[3]);
void viewport_setPosition_vec3w(s32 src[3]);
void viewport_setPosition_f3(f32 x, f32 y, f32 z);
void viewport_setRotation_vec3f(f32 src[3]);
void viewport_setRotation_f3(f32 pitch, f32 yaw, f32 roll);
void viewport_setNearAndFar(f32 near, f32 far);
void viewport_pushVpScaleAndTranslation(s32 scale_x, s32 scale_y, s32 translation_x, s32 translation_y);
void viewport_unused_pushVpScaleAndTranslation(f32 scale_x, f32 scale_y, f32 translation_x, f32 translation_y);
void viewport_update(void);
void viewport_getFrustumPlanes(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]);
bool viewport_isBoundingBoxInFrustum(f32 min[3], f32 max[3]);
bool viewport_cube_isInFrustum(Cube *cube);
bool viewport_cube_isInFrustum2(Cube *cube);
bool viewport_func_8024DB50(f32 pos[3], f32 distance);
bool viewport_isPointOutsideFrustum_3f(f32 x, f32 y, f32 z);
bool viewport_isPointOutsideFrustum_vec3f(f32 arg0[3]);
bool viewport_isPointPlane_3f(f32 arg0, f32 arg1, f32 arg2);
MtxF *viewport_getMatrix(void);
MtxF *viewport_getDefaultMatrix(void);
f32 viewport_getFOVy(void);
void viewport_setFOVy(f32 fovy);
f32 viewport_getAspectRatio(void);
f32 viewport_getNear(void);
f32 viewport_adjustAngleToRight(f32 pos[3], f32 angle);
f32 viewport_transformCoordinate(f32 x, f32 y, f32 viewport_translation[3], f32 viewport_rotation[3]);
bool viewport_func_8024E030(f32 pos[3], f32 *arg1);
void viewport_backupState(void);
void viewport_restoreState(void);
void viewport_adjustPointDistance(f32 pos[3], f32 distance);
#endif

View File

@@ -1,5 +1,5 @@
#ifndef LOCAL_FILE_H
#define LOCAL_FILE_H
#ifndef BANJO_KAZOOIE_FILE_H
#define BANJO_KAZOOIE_FILE_H
#include <ultra64.h>
#include <bool.h> // for bool

View File

@@ -250,8 +250,6 @@ 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);
OSContPad *func_8024F3F4(void);
OSMesgQueue *pfsManager_getFrameReplyQ(void);

View File

@@ -3,6 +3,7 @@
#include "variables.h"
#include "CC.h"
#include <core1/viewport.h>
#include "core2/modelRender.h"
typedef struct{
@@ -149,7 +150,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 +159,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

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/modelRender.h"
extern BKCollisionTri *func_8028EF48(void);
@@ -18,7 +19,6 @@ 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 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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
ActorMarker *unk0;
s32 unk4;
@@ -162,7 +165,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 +191,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

@@ -1,8 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern s32 func_8024DB50(f32[3], f32);
#include <core1/viewport.h>
void func_80390EB0(Actor *this);
@@ -72,7 +71,7 @@ void func_80390EB0(Actor *this){
marker_setCollisionScripts(this->marker, func_80390E78, NULL, NULL);
}
if(func_8024DB50(this->position, 150.0f) || func_80329530(this, 1200))
if(viewport_func_8024DB50(this->position, 150.0f) || func_80329530(this, 1200))
{
if( !(globalTimer_getTime() & 3) && randf() < 0.2){
func_80390C70(this->position);

View File

@@ -1,8 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern int func_8024DB50(f32[3], f32);
#include <core1/viewport.h>
void GV_func_8038A084(Actor *this);
@@ -54,7 +53,7 @@ void GV_func_8038A084(Actor *this){
}
if(this->unkF4_8 == 6
&& func_8024DB50(this->position, 50.0f)
&& viewport_func_8024DB50(this->position, 50.0f)
&& !this->unk38_31
&& randf() < 0.2
){

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
ActorMarker *jiggy_marker;
@@ -99,7 +100,7 @@ void chnapper_update(Actor *this){
ActorLocal_Napper *local = (ActorLocal_Napper *)&this->local;
f32 sp68;
Actor *jiggy;
f32 sp58[3];
f32 viewport[3];
f32 sp4C[3];
s32 pad;
f32 player_position[3];
@@ -153,10 +154,10 @@ void chnapper_update(Actor *this){
}//L80386DF4
if(this->state != 4){
viewport_get_position_vec3f(sp58);
sp4C[0] = this->position_x - sp58[0];
sp4C[1] = this->position_y - sp58[1];
sp4C[2] = this->position_z - sp58[2];
viewport_getPosition_vec3f(viewport);
sp4C[0] = this->position_x - viewport[0];
sp4C[1] = this->position_y - viewport[1];
sp4C[2] = this->position_z - viewport[2];
ml_vec3f_set_length(sp4C, 5.0f);
jiggy = marker_getActor(local->jiggy_marker);
jiggy->position_x = sp4C[0] + this->position_x;

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void sfxsource_setSampleRate(u8, s32);
extern f32 func_80258640(f32[3], f32[3]);
@@ -128,7 +129,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 +148,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

@@ -3,6 +3,8 @@
#include "variables.h"
#include "prop.h"
#include "actor.h"
#include <core1/viewport.h>
extern ActorInfo D_80390D20;
extern ActorInfo D_80390050;
@@ -133,22 +135,22 @@ s32 func_80386A30(f32 (*arg0)[3]){
}
void func_80386A7C(Actor *this){
f32 sp2C[3];
f32 viewport[3];
s32 sp28;
s32 temp_v0;
func_802D3D74(this);
this->depth_mode = 1;
viewport_get_position_vec3f(&sp2C);
viewport_getPosition_vec3f(&viewport);
sp28 = func_80386A30(&this->position);
temp_v0 = func_80386A30(&sp2C);
temp_v0 = func_80386A30(&viewport);
this->unk38_0 = 0;
if(sp2C[0] + 8000.0f < this->position_x || this->position_x < sp2C[0] - 8000.0f)
if(viewport[0] + 8000.0f < this->position_x || this->position_x < viewport[0] - 8000.0f)
return;
if( !( (sp28 ^ temp_v0) & 2
&& (-5000.0f < sp2C[0] && sp2C[0] < 6000.0f)
&& (sp2C[2] < -600.0f || 600.0f < sp2C[2])
&& (-5000.0f < viewport[0] && viewport[0] < 6000.0f)
&& (viewport[2] < -600.0f || 600.0f < viewport[2])
)
&& ( sp28 ^ temp_v0) != 3
){

View File

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct {
s32 unk0;
s32 unk4;
@@ -239,7 +241,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

@@ -3,6 +3,9 @@
#include "variables.h"
#include "version.h"
#include <core1/viewport.h>
/* .data*/
#if VERSION == VERSION_USA_1_0
u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS?
@@ -34,8 +37,6 @@ f32 ml_acosValTbl[90] = { //D_80276CBC
0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997
};
f32 viewport_get_yaw(void);
// .h
void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]);
void ml_vec3f_roll_rotate_copy(f32 arg0[3], f32 arg1[3], f32);
@@ -437,6 +438,7 @@ void func_80256D0C(f32 val1, f32 val2, f32 x, f32 y, f32 z, f32 *dstX, f32 *dstY
*dstZ = tmp * cosf(val2) - sinf(val2) * x;
}
// rotates direction vector (x, y, z)
void func_80256E24(f32 dst[3], f32 theta, f32 phi, f32 x, f32 y, f32 z)
{
f32 tmp;
@@ -1045,6 +1047,7 @@ f32 ml_cos_deg(f32 angle_deg)
return cosf(angle_deg * BAD_DTOR);
}
// brings angle in range between 0 and 360 degrees
f32 mlNormalizeAngle(f32 angle)
{
if (angle < 0.0) // f64
@@ -1485,7 +1488,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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
s32 D_80275860 = 0;
void func_802409C0(f32 arg0[3], f32 arg1){
@@ -17,7 +20,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 +62,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

@@ -2,9 +2,10 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 ml_cos_deg(f32);
extern f32 ml_sin_deg(f32);
extern void veiwport_get_position_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 +27,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 +96,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 +163,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 +210,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

@@ -2,95 +2,80 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include "core1/viewport.h"
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)
#define VIEWPORT_STACK_SIZE (8)
/* .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
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?
MtxF sViewportMatrix;
MtxF sViewportDefaultMatrix;
s32 sViewportStackIndex;
/* .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;
MtxF D_80280F98;
MtxF D_80280FD8;
s32 s_viewport_stack_index; //viewport indx
void viewport_moveAlongZAxis(f32 offset) {
f32 delta_position[3];
func_80256E24(delta_position, sViewportRotation[0], sViewportRotation[1], 0.0f, 0.0f, offset);
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 */
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];
sViewportPosition[0] += delta_position[0];
sViewportPosition[1] += delta_position[1];
sViewportPosition[2] += delta_position[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);
@@ -99,421 +84,457 @@ 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){
u16 sp5e;
void viewport_setRenderPerspectiveMatrix(Gfx **gfx, Mtx **mtx, f32 near, f32 far) {
u16 perspNorm;
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;
if(*(u32*)OS_PHYSICAL_TO_K1(0x1D8) + 0x53D4FFF0) { // what's this?
near = 750.0f;
far = 1250.0f;
}
guPerspective(*mtx, &sp5e, s_viewport_fovy, s_viewport_aspect, near, far, 0.5f);
gSPPerspNormalize((*gfx)++, sp5e);
guPerspective(*mtx, &perspNorm, sViewportFOVy, sViewportAspect, near, far, 0.5f);
gSPPerspNormalize((*gfx)++, perspNorm);
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){
if(90.0f < arg0) arg0 = 90.0f;
if(arg0 < 5.0f) arg0 = 10.0f;
D_80280ECC = arg0;
void viewport_debug2(f32 arg0) {
if (90.0f < arg0) arg0 = 90.0f;
if (arg0 < 5.0f) arg0 = 10.0f;
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 ((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 ((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 ((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;
}
bool func_8024D8F4(Cube *cube) {
f32 sp24[3];
f32 sp18[3];
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);
}
bool func_8024D9B0(Cube *cube) {
f32 sp34[3];
f32 sp28[3];
f32 sp1C[3];
if (cube->x == -0x10) {
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) {
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;
}
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);
}
bool func_8024DB50(f32 arg0[3], f32 arg1) {
f32 delta[3];
s32 i;
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 (((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 (((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;
delta[0] = arg0[0] - viewportPosition[0];
delta[1] = arg0[1] - viewportPosition[1];
delta[2] = arg0[2] - viewportPosition[2];
for(i = 0; i < 4; i++){
if(arg1 <= ml_dotProduct_vec3f(delta, D_80280ED0[i])){
return FALSE;
}
}
return TRUE;
}
bool viewport_cube_isInFrustum(Cube *cube) {
f32 min[3];
f32 max[3];
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)
) {
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 viewport_cube_isInFrustum2(Cube *cube) {
f32 min[3];
f32 max[3];
f32 rel_pos[3];
if (cube->x == -16) {
return TRUE;
}
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;
}
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);
}
// viewport_distanceFromPlane ?
bool viewport_func_8024DB50(f32 pos[3], f32 distance) {
f32 delta[3];
s32 i;
delta[0] = pos[0] - sViewportPosition[0];
delta[1] = pos[1] - sViewportPosition[1];
delta[2] = pos[2] - sViewportPosition[2];
for(i = 0; i < 4; i++) {
if(distance <= ml_dotProduct_vec3f(delta, sViewportFrustumPlanes[i])) {
return FALSE;
}
}
return TRUE;
}
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_isPointPlane_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);
}
MtxF *func_8024DD90(void){
return &D_80280F98;
MtxF *viewport_getMatrix(void) {
return &sViewportMatrix;
}
MtxF *func_8024DD9C(void){
return &D_80280FD8;
MtxF *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 viewport_adjustAngleToRight(f32 pos[3], f32 angle) {
return mlNormalizeAngle((sViewportRotation[1] + angle) + 90.0);
}
f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) {
f32 viewport_transformCoordinate(f32 x, f32 y, f32 viewport_translation[3], f32 viewport_rotation[3]) {
f32 fovy_rad;
static f32 D_8028101C;
static f32 D_80281020;
static f32 D_80281024;
static f32 fovy;
static f32 near;
static f32 scale;
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 != fovy) || (sViewportNear != near)) {
fovy_rad = (sViewportFOVy * M_PI) / 360.0;
scale = (500.0 + sViewportNear) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad));
fovy = sViewportFOVy;
near = 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];
arg2[0] = arg0 * D_80281024;
arg2[1] = arg1 * D_80281024;
arg2[2] = (-500.0 - s_viewport_near);
ml_vec3f_pitch_rotate_copy(arg2, arg2, arg3[0]);
ml_vec3f_yaw_rotate_copy(arg2, arg2, arg3[1]);
x = x - (framebuffer_width / (f32)2);
y = (framebuffer_height / (f32)2) - y;
viewport_rotation[0] = sViewportRotation[0];
viewport_rotation[1] = sViewportRotation[1];
viewport_rotation[2] = sViewportRotation[2];
viewport_translation[0] = x * scale;
viewport_translation[1] = y * scale;
viewport_translation[2] = (-500.0 - sViewportNear);
ml_vec3f_pitch_rotate_copy(viewport_translation, viewport_translation, viewport_rotation[0]);
ml_vec3f_yaw_rotate_copy(viewport_translation, viewport_translation, viewport_rotation[1]);
arg2[0] += viewportPosition[0];
arg2[1] += viewportPosition[1];
arg2[2] += viewportPosition[2];
return D_80281024;
viewport_translation[0] += sViewportPosition[0];
viewport_translation[1] += sViewportPosition[1];
viewport_translation[2] += sViewportPosition[2];
return scale;
}
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];
MtxF D_80281098;
f32 sViewportBackupPosition[3];
f32 sViewportBackupRotation[3];
f32 sViewportBackupFrustumPlanes[4][4];
f32 sViewportBackupLookVector[3];
MtxF sViewportBackupMatrix;
bool func_8024E030(f32 arg0[3], f32 *arg1)
// ??
bool viewport_func_8024E030(f32 pos[3], f32 *arg1)
{
f32 sp34[3];
f32 delta[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]) {
return 0;
f32 fovy_radians;
fovy_radians = (sViewportFOVy * M_PI) / 360.0;
delta[0] = pos[0] - sViewportPosition[0];
delta[1] = pos[1] - sViewportPosition[1];
delta[2] = pos[2] - sViewportPosition[2];
ml_vec3f_yaw_rotate_copy(delta, delta, -sViewportRotation[1]);
ml_vec3f_pitch_rotate_copy(delta, delta, -sViewportRotation[0]);
if ((-sViewportNear) <= delta[2]) {
return FALSE;
}
temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(sp28);
temp_f2 = gu_sqrtf((delta[1] * delta[1]) + (delta[2] * delta[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));
arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) framebuffer_width) / 2));
arg1[1] = (f32) ((1 - (delta[1] / temp_f2)) * (((f32) framebuffer_height) / 2));
if ((arg1[0] < (-((f32) framebuffer_width))) || ((((f32) framebuffer_width) * 2) < arg1[0])) {
return 0;
return FALSE;
}
if ((arg1[1] < (-((f32) framebuffer_height))) || ((((f32) framebuffer_height) * 2) < arg1[1])) {
return 0;
return FALSE;
}
return 1;
return TRUE;
}
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.m[i][j] = D_80280F98.m[i][j];
sViewportBackupMatrix.m[i][j] = sViewportMatrix.m[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.m[i][j] = D_80281098.m[i][j];
sViewportMatrix.m[i][j] = sViewportBackupMatrix.m[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

@@ -7,7 +7,6 @@
#include "SnS.h"
extern void func_803012F8(void);
extern f32 func_8024DDD8(f32[3], f32);
extern f32 ml_distanceSquared_vec3f(f32 arg0[3], f32 arg1[3]);
extern void __baMarker_8028BA00(s32);
extern void func_802C418C(void);

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/ba/physics.h"
extern void func_8028FDC8(f32);
@@ -34,9 +35,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/ba/physics.h"
@@ -282,7 +283,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

@@ -1,6 +1,8 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void __spawnQueue_add_2(void (*)(s32, s32), s32, s32);
@@ -88,7 +90,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_8025982C(f32[3], f32[3], f32[3], f32);
extern void func_8025A6CC(enum comusic_e arg0, s32 arg1);
@@ -50,7 +51,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 +123,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 +140,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

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#ifndef ABS
#define ABS(d) ((d) >= 0) ? (d) : -(d)
#endif
@@ -86,7 +88,7 @@ void chBottlesBonusCursor_func_802DF460(s32 indx, ActorMarker *caller, f32 arg2[
sp1C[0] = arg2[0] * 100.0f;
sp1C[1] = arg2[1] * 100.0f;
sp1C[2] = arg2[2] * 100.0f;
if (func_8024E030(sp1C, D_8037E068[indx]) == 0) {
if (viewport_func_8024E030(sp1C, D_8037E068[indx]) == 0) {
D_8037E068[indx][0] = D_8037E068[indx][1] = 0.0f;
}
}
@@ -149,7 +151,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)chBottlesBonusCursorMarker);
modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL);
actor_setOpacity(this, 0xB9);
func_8024E030(this->position, D_8037E5C0.unk18);
viewport_func_8024E030(this->position, D_8037E5C0.unk18);
sp3C = (this->scale * 650.0f);
func_80253208(gfx,
(s32)(D_8037E5C0.unk18[0] - sp3C/2), (s32)(D_8037E5C0.unk18[1] - sp3C/2),
@@ -157,7 +159,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
D_803A5D00[getActiveFramebuffer()]
);
modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, marker_loadModelBin(chBottlesBonusCursorMarker));
func_8024E030(this->position, D_8037E5C0.unk10);
viewport_func_8024E030(this->position, D_8037E5C0.unk10);
if (this->state == 1) {
D_8037E5C0.unk10[0] -= 24.0f;
D_8037E5C0.unk10[1] -= 8.0f;

View File

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
void func_802CD898(Actor *);
void func_802CD8C0(Actor *);
@@ -88,11 +89,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

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern int func_8024DB50(f32 arg0[3], f32 arg1);
#include <core1/viewport.h>
void chfirefx_update(Actor *this);
@@ -75,7 +75,7 @@ void chfirefx_update(Actor *this){
}
}//L80359934
if(subaddie_playerIsWithinSphere(this, 2000)){
if( func_8024DB50(this->position, 50.0f) && this->unk38_31 ){
if( viewport_func_8024DB50(this->position, 50.0f) && this->unk38_31 ){
if(!(globalTimer_getTime() & 3) && randf() < 0.1){
__chfirefx_spawnSmoke(this->position, this->scale);
} //L803599AC

View File

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern Actor *spawn_actor_f32(enum actor_e, f32[3], s32);
extern void actor_postdrawMethod(ActorMarker *marker);
@@ -37,18 +40,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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
extern void actor_predrawMethod(Actor *);
extern void actor_postdrawMethod(ActorMarker *);
@@ -47,18 +50,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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
bool func_8034A6FC(f32, f32);
void chTermite_update(Actor *this);
@@ -52,7 +55,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

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
f32 func_8024DDD8(f32[3], f32);
extern void func_8024E71C(s32, f32*);
extern f32 ml_acosf(f32);
extern f32 player_getYaw(void);
@@ -141,7 +141,7 @@ f32 func_8029B33C(void){
f32 sp1C[3];
_player_getPosition(sp1C);
return func_8024DDD8(sp1C, func_8029B2F4());
return viewport_adjustAngleToRight(sp1C, func_8029B2F4());
}
s32 func_8029B370(void){

View File

@@ -5,8 +5,8 @@
#include "core2/statetimer.h"
#include "core2/ba/anim.h"
#include "core2/ba/physics.h"
#include <core1/viewport.h>
f32 func_8024DDD8(f32[3], f32);
extern void func_8024E71C(s32, f32*);
extern f32 ml_acosf(f32);
extern f32 player_getYaw(void);
@@ -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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_802BEA4C(f32[3], f32[3], f32, f32[3]);
extern ActorProp *func_80320EB0(ActorMarker *, f32, s32);
@@ -33,8 +34,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

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "core2/nc/camera.h"
#include <core1/viewport.h>
extern Actor *func_80328230(enum actor_e, f32[3], f32[3]);
extern void func_802BEA4C(f32[3], f32[3], f32, f32[3]);
@@ -120,9 +121,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 +296,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 +353,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
u8 map_id;
@@ -94,7 +95,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

@@ -5,9 +5,9 @@
#include "prop.h"
#include "core2/statetimer.h"
#include "core2/ba/physics.h"
#include <core1/viewport.h>
extern f32 func_8024DDD8(f32[3], f32);
extern int func_80259254(f32 vec[3], f32 x, f32 z, f32 val);
extern f32 player_getYaw(void);
@@ -144,8 +144,8 @@ bool func_8028AE10(void) {
_player_getPosition(sp1C);
ideal_yaw = yaw_getIdeal();
sp2C = func_8024DDD8(sp1C, 90.0f);
sp28 = func_8024DDD8(sp1C, 270.0f);
sp2C = viewport_adjustAngleToRight(sp1C, 90.0f);
sp28 = viewport_adjustAngleToRight(sp1C, 270.0f);
if (sp28 < sp2C) {
return (sp2C < ideal_yaw) || (ideal_yaw < sp28);
}

View File

@@ -1,6 +1,8 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_8028E82C(void);
@@ -63,7 +65,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_8025715C(f32, f32);
extern f32 func_802575BC(f32);
@@ -434,8 +435,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_8028EF88(void);
void func_802D8730(Actor *this);
@@ -38,7 +39,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

@@ -2,9 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "core2/particle.h"
extern bool func_8024DB50(f32[3], f32);
#include <core1/viewport.h>
void func_802DC208(Actor *this);
@@ -57,7 +55,7 @@ void func_802DC208(Actor *this) {
actor_collisionOff(this);
this->marker->propPtr->unk8_3 = TRUE;
}
if( func_8024DB50(this->position, 50.0f)
if( viewport_func_8024DB50(this->position, 50.0f)
&& func_802DC188()
&& !(globalTimer_getTime() & 0x1F)
&& randf() < 0.1

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void actor_postdrawMethod(ActorMarker *);
@@ -31,17 +32,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 +50,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void actor_postdrawMethod(ActorMarker *);
@@ -30,17 +31,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 +49,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_802C71F0(Actor *);
extern void actor_postdrawMethod(ActorMarker *);
@@ -145,6 +146,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_8023DFF0(s32);
extern void comusicPlayer_update(void);
@@ -55,12 +56,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

@@ -2,12 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#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 func_802F5374(void);
extern void func_802FA0F8(void);
extern void timedFuncQueue_update(void);
@@ -64,9 +61,9 @@ 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);
func_8024C510(3000.0f);
viewport_setPosition_f3(0.0f, 0.0f, 0.0f);
viewport_setRotation_f3(-30.0f, 30.0f, 0.0f);
viewport_moveAlongZAxis(3000.0f);
viewport_update();
}
@@ -401,7 +398,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_80252CC4(f32[3], f32 [3], f32, f32[3]);
extern f32 func_8034A9D0(f32[4], f32);
@@ -215,8 +216,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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern s16 D_803A5D00[2][0xF660];
typedef struct Struct_Core2_6A4B0_2{
@@ -40,7 +43,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 +90,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 +163,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 +217,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

@@ -3,6 +3,8 @@
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
extern s16 D_803A5D00[2][0xF660];
@@ -69,11 +71,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);
@@ -328,7 +330,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern func_802EFAB0(ParticleEmitter *, s32, f32);
@@ -36,7 +37,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

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
@@ -633,7 +634,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 +884,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

@@ -1,8 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern s32 func_8024DD34(f32,f32, f32);
#include <core1/viewport.h>
/* .code */
void func_802F7EB0(struct3s *this){
@@ -19,8 +18,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 +36,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_isPointPlane_3f(sp4C[0],sp4C[1]- 10.0f, sp4C[2]); i++){
sp4C[1] += 100.0f;
}

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern int func_8024DD34(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_isPointPlane_3f(sp4C[0], sp4C[1] - 10.0f, sp4C[2]); i++){
sp4C[1] += 100.0f;
}
}

View File

@@ -2,18 +2,16 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
typedef struct {
u8 pad0[0xC];
f32 unkC[3];
}Struct_core2_72060_0;
extern f32 viewport_get_yaw();
extern int func_8024DD34(f32, f32, f32);
extern void func_80251B5C(f32, f32, f32);
extern void func_80252A38(f32, f32, f32);
extern f32 vtxList_getGlobalNorm(BKVertexList *);
extern bool func_8024DB50(f32[3], f32);
struct4Cs *D_80369280 = NULL;
@@ -164,12 +162,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_isPointPlane_3f(sp4C[0], sp4C[1] - 10.0f, sp4C[2]) ; sp44++){
sp4C[1] += 200.0f;
}
}
@@ -198,8 +196,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 = (Gfx*)((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);
@@ -229,7 +227,7 @@ bool func_802F989C(Gfx **gfx, Mtx **mtx, f32 arg2[3]) {
if( ((-17000.0f < D_80381070[0]) &&(D_80381070[0] < 17000.0f))
&& (arg2[1] > -200.0f)
&& ((-17000.0f < D_80381070[2]) && (D_80381070[2] < 17000.0f))
&& func_8024DB50(arg2, D_8038108C)
&& viewport_func_8024DB50(arg2, D_8038108C)
) {
func_80251B5C(D_80381070[0], D_80381070[1], D_80381070[2]);
mlMtxApply(*mtx);

View File

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include <core2/file.h>
#include "prop.h"
@@ -141,7 +142,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@@ -151,7 +152,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@@ -167,7 +168,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@@ -177,7 +178,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@@ -201,7 +202,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@@ -211,7 +212,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@@ -227,7 +228,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1++;
@@ -237,7 +238,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) && viewport_cube_isInFrustum2(var_s0) != 0) {
func_80301F10(var_s0, gfx, mtx, vtx);
}
var_s1--;
@@ -268,7 +269,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@@ -276,7 +277,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@@ -289,7 +290,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@@ -297,7 +298,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@@ -316,7 +317,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@@ -324,7 +325,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@@ -337,7 +338,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp++;
@@ -345,7 +346,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) && viewport_cube_isInFrustum2(var_fp) != 0) {
func_80301F10(var_fp, gfx, mtx, vtx);
}
var_fp--;
@@ -370,8 +371,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];\
@@ -2402,8 +2403,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 (viewport_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

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "n_libaudio.h"
#include <core1/viewport.h>
extern f32 func_80256AB4(f32, f32, f32, f32);
extern void func_80335394(s32, f32);
@@ -218,8 +219,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "actor.h"
#include "prop.h"
@@ -309,7 +310,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

@@ -3,6 +3,7 @@
#include "variables.h"
#include "enums.h"
#include <core1/viewport.h>
#include <core2/file.h>
#define AssetCacheSize 0x3D5
@@ -103,7 +104,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

@@ -1,11 +1,11 @@
#include <ultra64.h>
#include <core2/file.h>
#include "functions.h"
#include "variables.h"
#include "core2/particle.h"
#include <core1/viewport.h>
#include "core2/anim/sprite.h"
#include <core2/file.h>
#include "core2/particle.h"
/* .data */
extern u8 D_80370250 = 0;
@@ -22,7 +22,6 @@ u32 D_803835E0;
/* public */
void func_80335110(s32);
void func_80335128(s32);
void viewport_set_near_far(f32, f32);
void func_80335140(enum map_e);
void func_8033520C(s32);
@@ -34,8 +33,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) {
@@ -44,8 +43,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,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
void func_80252330(f32, f32, f32);
void func_803382D8(s32 arg0);
@@ -442,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);
@@ -456,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

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
extern void mlMtxRotatePYR(f32, f32, f32);
extern void func_80252330(f32, f32, f32);
@@ -40,10 +42,10 @@ void func_8033F7F0(u8 indx, Gfx **gfx, Mtx **mtx, Vtx **vtx){
if(sp54->unk28_23 != 1){
ml_vec3f_copy(sp48, sp54->position);
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

@@ -2,11 +2,12 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
extern void spriteRender_drawWithSegment(Gfx**, Vtx**, BKSprite *, s32, s32);
extern void func_80252330(f32, f32, f32);\
extern void func_80349AD0(void);
extern void func_8024C5A8(f32[3]);
@@ -50,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];
@@ -80,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);
@@ -108,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];
@@ -139,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) {
@@ -166,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

@@ -1,9 +1,9 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern bool func_8028F170(f32, f32);
extern void viewport_get_position_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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct {
u8 *unk0;
@@ -97,7 +98,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern void func_80288C7C(VLA**);
extern void func_80288D84(s32, f32, void (*)(s32,s32), s32, s32);
@@ -80,7 +81,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

@@ -2,7 +2,8 @@
#include "functions.h"
#include "variables.h"
extern int func_8024DB50(f32[3], f32 );
#include <core1/viewport.h>
extern void func_802EFF5C(ParticleEmitter *, f32, f32, f32);
extern void func_802EFF7C(ParticleEmitter *, f32, f32, f32);
extern void func_802EFF9C(ParticleEmitter *, f32);
@@ -487,17 +488,17 @@ void func_80362E94(Actor *this){
switch(this->unkF4_8){
case 0x3: //L80362ED8
if(func_8024DB50(this->position, 50.0f) && randf() < 0.2){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.2){
func_80362084(this->position);
}
break;
case 0xa: //L80362F24
if(func_8024DB50(this->position, 50.0f) && randf() < 0.1){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.1){
func_8036247C(this->position);
}
break;
case 0xc: //L80362F70
if(func_8024DB50(this->position, 50.0f)){
if(viewport_func_8024DB50(this->position, 50.0f)){
if(randf() < 0.4)
func_80362680(this->position);
if(randf() < 0.8)
@@ -505,27 +506,27 @@ void func_80362E94(Actor *this){
}
break;
case 0x10://L80362FE8
if(func_8024DB50(this->position, 50.0f) && randf() < 0.1){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.1){
func_80362A48(this->position);
}
break;
case 0x11://L80363034
if(func_8024DB50(this->position, 50.0f) && randf() < 0.06){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.06){
func_80362ADC(this->position);
}
break;
case 0x12://L80363080
if(func_8024DB50(this->position, 50.0f) && randf() < 0.06){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.06){
func_80362C04(this->position);
}
break;
case 0x13://L803630CC
if(func_8024DB50(this->position, 50.0f) && randf() < 0.4){
if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.4){
func_80362B70(this->position);
}
break;
case 0x14://L80363118
if(func_8024DB50(this->position, 300.0f)){
if(viewport_func_8024DB50(this->position, 300.0f)){
if(randf() < 0.01)
func_80362C98(this->position);
func_80362D2C(this->position);

View File

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#define AIRSCORE_COUNT (6)
#define FXAIRSCORE_SCALE (0.68f)
@@ -68,7 +71,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 +107,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

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
f32 time_getDelta(void);
f32 func_802FB0DC(struct8s *);
f32 func_802FB0E4(struct8s *);
@@ -143,7 +145,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 +186,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

@@ -2,7 +2,8 @@
#include "functions.h"
#include "variables.h"
extern f32 func_8024DE1C(f32, f32, f32[3], f32[3]);
#include <core1/viewport.h>
extern f32 vtxList_getGlobalNorm(BKVertexList *);
extern void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
@@ -192,7 +193,7 @@ void fxcommon3score_draw(enum item_e item_id, void *arg1, Gfx **gfx, Mtx **mtx,
a1->value_string[0] = '\0';
strIToA(a1->value_string, itemPrint_getValue(item_id));
print_bold_spaced(a1->unk30 + a1->unk40, sp40 + a1->unk44, a1->value_string);
sp3C = func_8024DE1C(a1->unk30, sp40, sp5C, sp68);
sp3C = viewport_transformCoordinate(a1->unk30, sp40, sp5C, sp68);
sp44[0] = 0.0f;
sp44[1] = a1->unk38;

View File

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_802FB0E4(struct8s*);
extern s32 framebuffer_width;
@@ -82,7 +84,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 +126,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

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#define _76D90_MAX(s,t) ((s < t)? t : s)
#define _76D90_MIN(s,t) ((s > t)? t : s)
@@ -115,7 +117,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 +171,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

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_802FB0E4(struct8s *);
/* .data */
@@ -145,7 +147,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 +202,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

@@ -2,6 +2,9 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern f32 func_802FB0E4(struct8s*);
/* .code */
@@ -84,7 +87,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 +119,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

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
#include "zoombox.h"
@@ -1208,9 +1209,9 @@ 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);
sp34 = viewport_transformCoordinate(x, y, sp5C, sp44);
mlMtxIdent(); //matrix_stack_identity
sp38[0] = sp5C[0] - sp50[0];
sp38[1] = sp5C[1] - sp50[1];
@@ -1319,7 +1320,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 +1328,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 +1351,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 +1363,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 +1373,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 +1392,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

@@ -1,8 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void viewport_set_near_far(f32, f32);
#include <core1/viewport.h>
typedef struct {
s16 model_id;
@@ -74,11 +73,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

@@ -2,12 +2,12 @@
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "gc/gctransition.h"
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);
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

@@ -3,8 +3,9 @@
#include "variables.h"
#include "zoombox.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
extern f32 func_8024DE1C(f32, f32, f32[3], f32[3]);
void func_80252330(f32, f32, f32);
extern f32 func_8033DDB8(void);
extern void func_8024E60C(s32, void *);
@@ -826,7 +827,7 @@ void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx) {
f32 sp38[3];
f32 sp34;
sp34 = func_8024DE1C(this->unk170, this->unk172, sp50, sp5C);
sp34 = viewport_transformCoordinate(this->unk170, this->unk172, sp50, sp5C);
if (this->unk1A4_24) {
sp5C[1] += 180.0f;
sp5C[0] -= 2*sp5C[0];
@@ -852,7 +853,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BK
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);
@@ -870,7 +871,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BK
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

@@ -1,7 +1,10 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/modelRender.h"
#include "animation.h"
#include "ml/mtx.h"
@@ -11,11 +14,6 @@ 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_update(void);
extern void func_8033BD4C(BKModelBin *);
extern s32 func_8024DB50(f32[3], f32);
extern AnimMtxList *animMtxList_new();
@@ -695,8 +693,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();
}
}
@@ -941,7 +939,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));
}
}
@@ -958,7 +956,7 @@ void func_80338EB8(Gfx ** gfx, Mtx ** mtx, void *arg2){
sp34[1] = (f32)cmd->unk8[1] * modelRenderScale;
sp34[2] = (f32)cmd->unk8[2] * modelRenderScale;
sp30 = (f32)cmd->unkE*modelRenderScale;
if(func_8024DB50(sp34, sp30) && cmd->unk10){
if(viewport_func_8024DB50(sp34, sp30) && cmd->unk10){
func_80339124(gfx, mtx, (BKGeoList*)((s32)cmd + cmd->unk10));
}
}
@@ -980,7 +978,7 @@ void func_80338EB8(Gfx ** gfx, Mtx ** mtx, void *arg2){
sp34[0] += modelRenderCameraPosition[0];
sp34[1] += modelRenderCameraPosition[1];
sp34[2] += modelRenderCameraPosition[2];
if(func_8024DB50(sp34, sp30) && cmd->unk10){
if(viewport_func_8024DB50(sp34, sp30) && cmd->unk10){
func_80339124(gfx, mtx, (BKGeoList*)((s32)cmd + cmd->unk10));
}
@@ -1033,8 +1031,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];
@@ -1074,8 +1072,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];
@@ -1101,7 +1099,7 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation
return 0;
}
D_80370990 = (D_80383704) ? func_8024DB50(object_position, spD0*scale) : 1;
D_80370990 = (D_80383704) ? viewport_func_8024DB50(object_position, spD0*scale) : 1;
if(D_80370990 == 0){
modelRender_reset();
return 0;
@@ -1419,8 +1417,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

@@ -1,5 +1,6 @@
#include <ultra64.h>
#include "functions.h"
#include <core1/viewport.h>
static f32 __playerStartPosition[3];
@@ -7,8 +8,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

@@ -1,11 +1,12 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
extern bool func_80245314(f32[3], f32[3], f32, f32, u32);
extern int func_80244D94(f32[3], f32[3], f32[3], u32, f32);
extern int func_8024575C(f32[3], f32[3], f32, f32[3], s32, u32);
extern void func_8024C510(f32);
extern f32 func_80258708(f32[3], f32[3]);
extern f32 func_80259198(f32, f32);
extern f32 func_8028E82C(void);
@@ -211,8 +212,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 +366,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 +940,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,9 +961,9 @@ 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);
func_8024C510(300.0f);
viewport_setPosition_vec3f(sp2C);
viewport_setRotation_vec3f(sp20);
viewport_moveAlongZAxis(300.0f);
func_802BE720();
}//L802BE828
}

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
/* .bss */
struct {
@@ -15,8 +16,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 +31,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 +46,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

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/nc/camera.h"
@@ -33,8 +34,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

@@ -1,9 +1,9 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/particle.h"
extern int func_8024DB50(f32 (*)[3], f32);
extern s32 spriteGetFrameCount(BKSprite *);
extern void func_80344720(s32 SpriteGfx, s32 frame, s32, f32[3], f32[3], f32[3], Gfx **, Mtx **);
extern void func_80344424(s32 SpriteGfx, s32 frame, s32, f32[3], f32[3], f32, Gfx **, Mtx **);
@@ -645,7 +645,7 @@ void particleEmitter_update(ParticleEmitter *this){
}//L802F0254
if( 0.0f != this->unkFC
&& !func_8024DB50(&particle->position, this->unkFC)
&& !viewport_func_8024DB50(&particle->position, this->unkFC)
){
memcpy(particle, --this->pList_end_128, sizeof(Particle));
}

View File

@@ -2,10 +2,9 @@
#include "functions.h"
#include "variables.h"
#include "fight.h"
#include <core1/viewport.h>
#include "core2/particle.h"
extern void viewport_get_position_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);
@@ -322,14 +321,14 @@ void chBossJinjo_update(Actor *this){
void func_8038CED8(f32 arg0[3], enum asset_e model_id, f32 arg2, f32 arg3){
ParticleEmitter *s0 = partEmitMgr_newEmitter(1);
f32 sp40[3];
f32 viewport[3];
f32 sp34[3];
viewport_get_position_vec3f(&sp40);
viewport_getPosition_vec3f(&viewport);
sp34[0] = sp40[0] - arg0[0];
sp34[1] = sp40[1] - arg0[1];
sp34[2] = sp40[2] - arg0[2];
sp34[0] = viewport[0] - arg0[0];
sp34[1] = viewport[1] - arg0[1];
sp34[2] = viewport[2] - arg0[2];
ml_vec3f_set_length(sp34, 20.0f);
particleEmitter_setModel(s0, model_id);