mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
decompile and document math_util.c (#595)
This commit is contained in:
@@ -5,7 +5,7 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the
|
||||
All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified.
|
||||
|
||||
<!-- README_SCORE_SUMMARY_BEGIN -->
|
||||
As of May 28, 2025, this is our current score:
|
||||
As of May 30, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 88.84%
|
||||
|
||||
@@ -117,7 +117,7 @@ s32 is_drumstick_unlocked(void) {
|
||||
```
|
||||
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of May 28, 2025, this is our current score:
|
||||
As of May 30, 2025, this is our current score:
|
||||
```
|
||||
===================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
|
||||
+3
-3
@@ -589,7 +589,7 @@ typedef struct TexCoords {
|
||||
#define BACKFACE_CULL 0x00
|
||||
#define BACKFACE_DRAW 0x40
|
||||
|
||||
#define DKR_TRIANGLE(flags, ind0, ind1, ind2) ((flags << 24) | (ind0 << 16) | (ind1 << 8) | (ind2 << 0))
|
||||
#define DKR_TRIANGLE(flags, ind0, ind1, ind2) (((flags) << 24) | ((ind0) << 16) | ((ind1) << 8) | ((ind2) << 0))
|
||||
|
||||
/* Size: 0x10 bytes */
|
||||
typedef struct Triangle {
|
||||
@@ -916,8 +916,8 @@ typedef struct ShadeProperties {
|
||||
typedef f32 FakeHalfMatrix[2][4];
|
||||
typedef struct Object_5C {
|
||||
union {
|
||||
/* 0x0000 */ Matrix matrices[4];
|
||||
/* 0x0000 */ FakeHalfMatrix _matrices[8]; // This is a hack. The Matrix[4] is the real one.
|
||||
/* 0x0000 */ MtxF matrices[4];
|
||||
/* 0x0000 */ FakeHalfMatrix _matrices[8]; // This is a hack. The MtxF[4] is the real one.
|
||||
};
|
||||
/* 0x0100 */ void *unk100;
|
||||
/* 0x0104 */ u8 unk104;
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
typedef float Matrix[4][4];
|
||||
typedef s32 MatrixS[4][4];
|
||||
typedef float MtxF[4][4];
|
||||
typedef s32 MtxS[4][4];
|
||||
typedef s16 VertexList;
|
||||
typedef u8 TriangleList;
|
||||
typedef u32 uintptr_t;
|
||||
|
||||
+2
-2
@@ -919,8 +919,8 @@ void audspat_debug_render_line(Gfx **dList, Vertex **verts, Triangle **tris, f32
|
||||
temp_verts = *verts;
|
||||
temp_tris = *tris;
|
||||
material_set_no_tex_offset(&temp_dlist, NULL, RENDER_NONE);
|
||||
gSPVertexDKR(temp_dlist++, OS_PHYSICAL_TO_K0(temp_verts), 4, 0);
|
||||
gSPPolygon(temp_dlist++, OS_PHYSICAL_TO_K0(temp_tris), 2, 0);
|
||||
gSPVertexDKR(temp_dlist++, OS_K0_TO_PHYSICAL(temp_verts), 4, 0);
|
||||
gSPPolygon(temp_dlist++, OS_K0_TO_PHYSICAL(temp_tris), 2, 0);
|
||||
temp_verts[0].x = x1;
|
||||
temp_verts[0].y = (y1 + 5);
|
||||
temp_verts[0].z = z1;
|
||||
|
||||
+2
-2
@@ -284,8 +284,8 @@ void racer_sound_car(Object *obj, u32 buttonsPressed, u32 buttonsHeld, s32 ticks
|
||||
// Add engine jitter effect for player cars to simulate engine vibration
|
||||
// Max pitch variation ±0.02, volume variation ±5
|
||||
if (gSoundRacerObj->playerIndex != PLAYER_COMPUTER) {
|
||||
if (get_random_number_from_range(0, 10) < 7) {
|
||||
gRacerSound->engineJitter += get_random_number_from_range(0, 10) - 5;
|
||||
if (rand_range(0, 10) < 7) {
|
||||
gRacerSound->engineJitter += rand_range(0, 10) - 5;
|
||||
if (gRacerSound->engineJitter > 5) {
|
||||
gRacerSound->engineJitter = 5;
|
||||
} else if (gRacerSound->engineJitter < -5) {
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ static u32 __amHandleFrameMsg(AudioInfo *info, AudioInfo *lastInfo) {
|
||||
#ifdef ANTI_TAMPER
|
||||
// Antipiracy measure
|
||||
if (gAntiPiracyAudioFreq) {
|
||||
osAiSetFrequency(get_random_number_from_range(0, 10000) + OUTPUT_RATE);
|
||||
osAiSetFrequency(rand_range(0, 10000) + OUTPUT_RATE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+84
-87
@@ -66,7 +66,7 @@ ObjectTransform D_800DD2A0 = {
|
||||
{ { { 0, 0, 0 } } }, { 0 }, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
};
|
||||
|
||||
Matrix gOrthoMatrixF = {
|
||||
MtxF gOrthoMatrixF = {
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
@@ -98,17 +98,17 @@ f32 gModelMatrixViewX[6];
|
||||
f32 gModelMatrixViewY[6];
|
||||
f32 gModelMatrixViewZ[5];
|
||||
u16 perspNorm;
|
||||
Matrix *gModelMatrixF[6];
|
||||
MatrixS *gModelMatrixS[6];
|
||||
MtxF *gModelMatrixF[6];
|
||||
Mtx *gModelMatrix[6];
|
||||
f32 D_80120DA0[5 * 16];
|
||||
Matrix gPerspectiveMatrixF;
|
||||
Matrix gViewMatrixF;
|
||||
Matrix gCameraMatrixF;
|
||||
Matrix gProjectionMatrixF;
|
||||
MatrixS gProjectionMatrixS;
|
||||
UNUSED MatrixS gUnusedProjectionMatrixS; // Copied to the same way as gProjectionMatrixS, but not actually used.
|
||||
Matrix gCurrentModelMatrixF;
|
||||
Matrix gCurrentModelMatrixS;
|
||||
MtxF gPerspectiveMatrixF;
|
||||
MtxF gViewMatrixF;
|
||||
MtxF gCameraMatrixF;
|
||||
MtxF gProjectionMatrixF;
|
||||
Mtx gProjectionMatrix;
|
||||
UNUSED Mtx gUnusedProjectionMatrix; // Copied to the same way as gProjectionMatrix, but not actually used.
|
||||
MtxF gCurrentModelMatrixF;
|
||||
MtxF gCurrentModelMatrixS;
|
||||
|
||||
/******************************/
|
||||
|
||||
@@ -122,7 +122,7 @@ void cam_init(void) {
|
||||
u32 stat;
|
||||
|
||||
// clang-format off
|
||||
for (i = 0; i < 5; i++) { gModelMatrixF[i] = (Matrix*)&D_80120DA0[i << 4]; }
|
||||
for (i = 0; i < 5; i++) { gModelMatrixF[i] = (MtxF*)&D_80120DA0[i << 4]; }
|
||||
// clang-format on
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
@@ -149,7 +149,7 @@ void cam_init(void) {
|
||||
|
||||
guPerspectiveF(gPerspectiveMatrixF, &perspNorm, CAMERA_DEFAULT_FOV, CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR,
|
||||
CAMERA_SCALE);
|
||||
f32_matrix_to_s16_matrix(&gPerspectiveMatrixF, &gProjectionMatrixS);
|
||||
mtxf_to_mtx(&gPerspectiveMatrixF, &gProjectionMatrix);
|
||||
gCurCamFOV = CAMERA_DEFAULT_FOV;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ void cam_set_fov(f32 camFieldOfView) {
|
||||
gCurCamFOV = camFieldOfView;
|
||||
guPerspectiveF(gPerspectiveMatrixF, &perspNorm, camFieldOfView, CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR,
|
||||
CAMERA_SCALE);
|
||||
f32_matrix_to_s16_matrix(&gPerspectiveMatrixF, &gProjectionMatrixS);
|
||||
mtxf_to_mtx(&gPerspectiveMatrixF, &gProjectionMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,13 +205,13 @@ void cam_set_fov(f32 camFieldOfView) {
|
||||
UNUSED void cam_reset_fov(void) {
|
||||
guPerspectiveF(gPerspectiveMatrixF, &perspNorm, CAMERA_DEFAULT_FOV, CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR,
|
||||
CAMERA_SCALE);
|
||||
f32_matrix_to_s16_matrix(&gPerspectiveMatrixF, &gProjectionMatrixS);
|
||||
mtxf_to_mtx(&gPerspectiveMatrixF, &gProjectionMatrix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current fixed point model matrix.
|
||||
*/
|
||||
UNUSED Matrix *matrix_get_model_s16(void) {
|
||||
UNUSED MtxF *matrix_get_model_s16(void) {
|
||||
return &gCurrentModelMatrixS;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ s32 get_current_viewport(void) {
|
||||
/**
|
||||
* Initialises the camera object for the tracks menu.
|
||||
*/
|
||||
void camera_init_tracks_menu(Gfx **dList, MatrixS **mtxS) {
|
||||
void camera_init_tracks_menu(Gfx **dList, Mtx **mtxS) {
|
||||
Camera *cam;
|
||||
s16 angleY;
|
||||
s16 angleX;
|
||||
@@ -606,7 +606,7 @@ UNUSED void copy_framebuffer_size_to_coords(s32 *x1, s32 *y1, s32 *x2, s32 *y2)
|
||||
*y2 = GET_VIDEO_HEIGHT(widthAndHeight);
|
||||
}
|
||||
|
||||
void viewport_main(Gfx **dlist, MatrixS **mats) {
|
||||
void viewport_main(Gfx **dlist, Mtx **mats) {
|
||||
u32 y;
|
||||
u32 x;
|
||||
u32 tempX;
|
||||
@@ -860,7 +860,7 @@ void viewport_scissor(Gfx **dList) {
|
||||
}
|
||||
|
||||
// Official Name: camGetPlayerProjMtx / camSetProjMtx - ??
|
||||
void func_80067D3C(Gfx **dList, UNUSED MatrixS **mats) {
|
||||
void func_80067D3C(Gfx **dList, UNUSED Mtx **mats) {
|
||||
s32 temp;
|
||||
|
||||
gSPPerspNormalize((*dList)++, perspNorm);
|
||||
@@ -882,8 +882,8 @@ void func_80067D3C(Gfx **dList, UNUSED MatrixS **mats) {
|
||||
}
|
||||
gCameraTransform.z_position = -gCameras[gActiveCameraID].trans.z_position;
|
||||
|
||||
object_inverse_transform_to_matrix(gCameraMatrixF, &gCameraTransform);
|
||||
f32_matrix_mult(&gCameraMatrixF, &gPerspectiveMatrixF, &gViewMatrixF);
|
||||
mtxf_from_inverse_transform(&gCameraMatrixF, &gCameraTransform);
|
||||
mtxf_mul(&gCameraMatrixF, &gPerspectiveMatrixF, &gViewMatrixF);
|
||||
|
||||
gCameraTransform.rotation.y_rotation = -0x8000 - gCameras[gActiveCameraID].trans.rotation.y_rotation;
|
||||
gCameraTransform.rotation.x_rotation =
|
||||
@@ -897,8 +897,8 @@ void func_80067D3C(Gfx **dList, UNUSED MatrixS **mats) {
|
||||
}
|
||||
gCameraTransform.z_position = gCameras[gActiveCameraID].trans.z_position;
|
||||
|
||||
object_transform_to_matrix(gProjectionMatrixF, &gCameraTransform);
|
||||
f32_matrix_to_s16_matrix(&gProjectionMatrixF, &gUnusedProjectionMatrixS);
|
||||
mtxf_from_transform(&gProjectionMatrixF, &gCameraTransform);
|
||||
mtxf_to_mtx(&gProjectionMatrixF, &gUnusedProjectionMatrix);
|
||||
|
||||
gActiveCameraID = temp;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ void set_ortho_matrix_height(f32 value) {
|
||||
* Used for drawing triangles on screen as HUD.
|
||||
* Official Name: camStandardOrtho
|
||||
*/
|
||||
void set_ortho_matrix_view(Gfx **dList, MatrixS **mtx) {
|
||||
void set_ortho_matrix_view(Gfx **dList, Mtx **mtx) {
|
||||
u32 widthAndHeight;
|
||||
s32 width, height;
|
||||
s32 i, j;
|
||||
@@ -925,8 +925,8 @@ void set_ortho_matrix_view(Gfx **dList, MatrixS **mtx) {
|
||||
widthAndHeight = fb_size();
|
||||
height = GET_VIDEO_HEIGHT(widthAndHeight);
|
||||
width = GET_VIDEO_WIDTH(widthAndHeight);
|
||||
f32_matrix_to_s16_matrix(&gOrthoMatrixF, *mtx);
|
||||
gModelMatrixS[0] = *mtx;
|
||||
mtxf_to_mtx(&gOrthoMatrixF, *mtx);
|
||||
gModelMatrix[0] = *mtx;
|
||||
gViewportStack[gActiveCameraID + 5].vp.vscale[0] = width * 2;
|
||||
gViewportStack[gActiveCameraID + 5].vp.vscale[1] = width * 2;
|
||||
gViewportStack[gActiveCameraID + 5].vp.vtrans[0] = width * 2;
|
||||
@@ -947,12 +947,12 @@ void set_ortho_matrix_view(Gfx **dList, MatrixS **mtx) {
|
||||
}
|
||||
|
||||
// Official Name: camStandardPersp?
|
||||
void func_8006807C(Gfx **dList, MatrixS **mtx) {
|
||||
object_inverse_transform_to_matrix(gCurrentModelMatrixF, &D_800DD288);
|
||||
f32_matrix_mult(&gCurrentModelMatrixF, &gPerspectiveMatrixF, &gViewMatrixF);
|
||||
object_inverse_transform_to_matrix((float(*)[4]) gModelMatrixF[0], &D_800DD2A0);
|
||||
f32_matrix_mult(gModelMatrixF[0], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
f32_matrix_to_s16_matrix(&gCurrentModelMatrixF, *mtx);
|
||||
void func_8006807C(Gfx **dList, Mtx **mtx) {
|
||||
mtxf_from_inverse_transform(&gCurrentModelMatrixF, &D_800DD288);
|
||||
mtxf_mul(&gCurrentModelMatrixF, &gPerspectiveMatrixF, &gViewMatrixF);
|
||||
mtxf_from_inverse_transform(gModelMatrixF[0], &D_800DD2A0);
|
||||
mtxf_mul(gModelMatrixF[0], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
mtxf_to_mtx(&gCurrentModelMatrixF, *mtx);
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_0);
|
||||
gModelMatrixStackPos = 0;
|
||||
gMatrixType = G_MTX_DKR_INDEX_0;
|
||||
@@ -1011,11 +1011,11 @@ UNUSED const char D_800E6F44[] = "cameraPushSprMtx: model stack overflow!!\n";
|
||||
* Used when the next thing rendered relies on there not being any matrix offset.
|
||||
* Official Name: camOffsetZero?
|
||||
*/
|
||||
void matrix_world_origin(Gfx **dList, MatrixS **mtx) {
|
||||
f32_matrix_from_position(gModelMatrixF[gModelMatrixStackPos], 0.0f, 0.0f, 0.0f);
|
||||
f32_matrix_mult(gModelMatrixF[gModelMatrixStackPos], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
f32_matrix_to_s16_matrix(&gCurrentModelMatrixF, *mtx);
|
||||
gModelMatrixS[gModelMatrixStackPos] = *mtx;
|
||||
void matrix_world_origin(Gfx **dList, Mtx **mtx) {
|
||||
mtxf_from_translation(gModelMatrixF[gModelMatrixStackPos], 0.0f, 0.0f, 0.0f);
|
||||
mtxf_mul(gModelMatrixF[gModelMatrixStackPos], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
mtxf_to_mtx(&gCurrentModelMatrixF, *mtx);
|
||||
gModelMatrix[gModelMatrixStackPos] = *mtx;
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), gMatrixType);
|
||||
}
|
||||
|
||||
@@ -1030,7 +1030,7 @@ void sprite_anim_off(s32 setting) {
|
||||
/**
|
||||
* Calculates angle from object to camera, then renders the sprite as a billboard, facing the camera.
|
||||
*/
|
||||
s32 render_sprite_billboard(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *obj, Sprite *arg4, s32 flags) {
|
||||
s32 render_sprite_billboard(Gfx **dList, Mtx **mtx, Vertex **vertexList, Object *obj, Sprite *arg4, s32 flags) {
|
||||
f32 diffX;
|
||||
f32 diffY;
|
||||
Vertex *v;
|
||||
@@ -1089,13 +1089,12 @@ s32 render_sprite_billboard(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Obj
|
||||
gCameraTransform.x_position = obj->segment.trans.x_position;
|
||||
gCameraTransform.y_position = obj->segment.trans.y_position;
|
||||
gCameraTransform.z_position = obj->segment.trans.z_position;
|
||||
object_transform_to_matrix(gCurrentModelMatrixF, &gCameraTransform);
|
||||
mtxf_from_transform(&gCurrentModelMatrixF, &gCameraTransform);
|
||||
gModelMatrixStackPos++;
|
||||
f32_matrix_mult(&gCurrentModelMatrixF, gModelMatrixF[gModelMatrixStackPos - 1],
|
||||
gModelMatrixF[gModelMatrixStackPos]);
|
||||
f32_matrix_mult(gModelMatrixF[gModelMatrixStackPos], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
f32_matrix_to_s16_matrix(&gCurrentModelMatrixF, *mtx);
|
||||
gModelMatrixS[gModelMatrixStackPos] = *mtx;
|
||||
mtxf_mul(&gCurrentModelMatrixF, gModelMatrixF[gModelMatrixStackPos - 1], gModelMatrixF[gModelMatrixStackPos]);
|
||||
mtxf_mul(gModelMatrixF[gModelMatrixStackPos], &gViewMatrixF, &gCurrentModelMatrixF);
|
||||
mtxf_to_mtx(&gCurrentModelMatrixF, *mtx);
|
||||
gModelMatrix[gModelMatrixStackPos] = *mtx;
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_2);
|
||||
gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(&gVehiclePartVertex), 1, 0);
|
||||
} else {
|
||||
@@ -1117,10 +1116,9 @@ s32 render_sprite_billboard(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Obj
|
||||
}
|
||||
textureFrame = obj->segment.animFrame;
|
||||
gModelMatrixStackPos++;
|
||||
f32_matrix_from_rotation_and_scale((f32(*)[4]) gModelMatrixF[gModelMatrixStackPos], angleDiff,
|
||||
obj->segment.trans.scale, gVideoAspectRatio);
|
||||
f32_matrix_to_s16_matrix(gModelMatrixF[gModelMatrixStackPos], *mtx);
|
||||
gModelMatrixS[gModelMatrixStackPos] = *mtx;
|
||||
mtxf_billboard(gModelMatrixF[gModelMatrixStackPos], angleDiff, obj->segment.trans.scale, gVideoAspectRatio);
|
||||
mtxf_to_mtx(gModelMatrixF[gModelMatrixStackPos], *mtx);
|
||||
gModelMatrix[gModelMatrixStackPos] = *mtx;
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_2);
|
||||
gDkrEnableBillboard((*dList)++);
|
||||
}
|
||||
@@ -1152,14 +1150,14 @@ s32 render_sprite_billboard(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Obj
|
||||
* Sets transform and scale matrices to set position and size, loads the texture, sets the rendermodes, then draws the
|
||||
* result onscreen.
|
||||
*/
|
||||
void render_ortho_triangle_image(Gfx **dList, MatrixS **mtx, Vertex **vtx, ObjectSegment *segment, Sprite *sprite,
|
||||
void render_ortho_triangle_image(Gfx **dList, Mtx **mtx, Vertex **vtx, ObjectSegment *segment, Sprite *sprite,
|
||||
s32 flags) {
|
||||
UNUSED s32 pad;
|
||||
f32 scale;
|
||||
s32 index;
|
||||
Vertex *temp_v1;
|
||||
Matrix aspectMtxF;
|
||||
Matrix scaleMtxF;
|
||||
MtxF aspectMtxF;
|
||||
MtxF scaleMtxF;
|
||||
|
||||
if (sprite != NULL) {
|
||||
temp_v1 = *vtx;
|
||||
@@ -1183,17 +1181,17 @@ void render_ortho_triangle_image(Gfx **dList, MatrixS **mtx, Vertex **vtx, Objec
|
||||
gCameraTransform.z_position = 0.0f;
|
||||
if (gAdjustViewportHeight) {
|
||||
scale = segment->trans.scale;
|
||||
f32_matrix_from_scale(scaleMtxF, scale, scale, 1.0f);
|
||||
f32_matrix_from_rotation_and_scale(aspectMtxF, 0, 1.0f, gVideoAspectRatio);
|
||||
f32_matrix_mult(&aspectMtxF, &scaleMtxF, &gCurrentModelMatrixF);
|
||||
mtxf_from_scale(&scaleMtxF, scale, scale, 1.0f);
|
||||
mtxf_billboard(&aspectMtxF, 0, 1.0f, gVideoAspectRatio);
|
||||
mtxf_mul(&aspectMtxF, &scaleMtxF, &gCurrentModelMatrixF);
|
||||
} else {
|
||||
scale = segment->trans.scale;
|
||||
f32_matrix_from_scale(gCurrentModelMatrixF, scale, scale, 1.0f);
|
||||
mtxf_from_scale(&gCurrentModelMatrixF, scale, scale, 1.0f);
|
||||
}
|
||||
object_inverse_transform_to_matrix(aspectMtxF, &gCameraTransform);
|
||||
f32_matrix_mult(&gCurrentModelMatrixF, &aspectMtxF, gModelMatrixF[gModelMatrixStackPos]);
|
||||
f32_matrix_to_s16_matrix(gModelMatrixF[gModelMatrixStackPos], *mtx);
|
||||
gModelMatrixS[gModelMatrixStackPos] = *mtx;
|
||||
mtxf_from_inverse_transform(&aspectMtxF, &gCameraTransform);
|
||||
mtxf_mul(&gCurrentModelMatrixF, &aspectMtxF, gModelMatrixF[gModelMatrixStackPos]);
|
||||
mtxf_to_mtx(gModelMatrixF[gModelMatrixStackPos], *mtx);
|
||||
gModelMatrix[gModelMatrixStackPos] = *mtx;
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_2);
|
||||
gDkrEnableBillboard((*dList)++);
|
||||
if (gSpriteAnimOff == FALSE) {
|
||||
@@ -1218,7 +1216,7 @@ void render_ortho_triangle_image(Gfx **dList, MatrixS **mtx, Vertex **vtx, Objec
|
||||
* Generate a matrix with rotation, scaling and shearing and run it.
|
||||
* Used for wavy type effects like the shield.
|
||||
*/
|
||||
void apply_object_shear_matrix(Gfx **dList, MatrixS **mtx, Object *arg2, Object *arg3, f32 shear) {
|
||||
void apply_object_shear_matrix(Gfx **dList, Mtx **mtx, Object *arg2, Object *arg3, f32 shear) {
|
||||
UNUSED s32 pad;
|
||||
f32 cossf_x_arg2;
|
||||
f32 cossf_y_arg2;
|
||||
@@ -1237,7 +1235,7 @@ void apply_object_shear_matrix(Gfx **dList, MatrixS **mtx, Object *arg2, Object
|
||||
f32 arg3_xPos;
|
||||
f32 arg3_yPos;
|
||||
f32 arg3_zPos;
|
||||
Matrix matrix_mult;
|
||||
MtxF matrix_mult;
|
||||
|
||||
cossf_x_arg2 = coss_f(arg2->segment.trans.rotation.x_rotation);
|
||||
sinsf_x_arg2 = sins_f(arg2->segment.trans.rotation.x_rotation);
|
||||
@@ -1313,41 +1311,40 @@ void apply_object_shear_matrix(Gfx **dList, MatrixS **mtx, Object *arg2, Object
|
||||
(arg2_zPos * (cossf_x_arg3 * cossf_y_arg3)) + arg3_zPos;
|
||||
matrix_mult[3][3] = 1.0f;
|
||||
|
||||
f32_matrix_mult(&matrix_mult, &gViewMatrixF, &gCurrentModelMatrixS);
|
||||
f32_matrix_to_s16_matrix(&gCurrentModelMatrixS, *mtx);
|
||||
mtxf_mul(&matrix_mult, &gViewMatrixF, &gCurrentModelMatrixS);
|
||||
mtxf_to_mtx(&gCurrentModelMatrixS, *mtx);
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Official Name: camPushModelMtx
|
||||
*/
|
||||
s32 cam_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 scaleY, f32 offsetY) {
|
||||
s32 cam_push_model_mtx(Gfx **dList, Mtx **mtx, ObjectTransform *trans, f32 scaleY, f32 offsetY) {
|
||||
f32 tempX;
|
||||
f32 tempY;
|
||||
f32 tempZ;
|
||||
s32 index;
|
||||
f32 scaleFactor;
|
||||
|
||||
object_transform_to_matrix(gCurrentModelMatrixF, trans);
|
||||
mtxf_from_transform(&gCurrentModelMatrixF, trans);
|
||||
if (offsetY != 0.0f) {
|
||||
f32_matrix_translate_y_axis(&gCurrentModelMatrixF, offsetY);
|
||||
mtxf_translate_y(&gCurrentModelMatrixF, offsetY);
|
||||
}
|
||||
if (scaleY != 1.0f) {
|
||||
f32_matrix_scale_y_axis(&gCurrentModelMatrixF, scaleY);
|
||||
mtxf_scale_y(&gCurrentModelMatrixF, scaleY);
|
||||
}
|
||||
f32_matrix_mult(&gCurrentModelMatrixF, gModelMatrixF[gModelMatrixStackPos],
|
||||
gModelMatrixF[gModelMatrixStackPos + 1]);
|
||||
f32_matrix_mult(gModelMatrixF[gModelMatrixStackPos + 1], &gViewMatrixF, &gCurrentModelMatrixS);
|
||||
f32_matrix_to_s16_matrix(&gCurrentModelMatrixS, *mtx);
|
||||
mtxf_mul(&gCurrentModelMatrixF, gModelMatrixF[gModelMatrixStackPos], gModelMatrixF[gModelMatrixStackPos + 1]);
|
||||
mtxf_mul(gModelMatrixF[gModelMatrixStackPos + 1], &gViewMatrixF, &gCurrentModelMatrixS);
|
||||
mtxf_to_mtx(&gCurrentModelMatrixS, *mtx);
|
||||
gModelMatrixStackPos++;
|
||||
gModelMatrixS[0, gModelMatrixStackPos] = *mtx; // Should be [gModelMatrixStackPos]
|
||||
if (gModelMatrixStackPos >= ARRAY_COUNT(gModelMatrixS)) {
|
||||
gModelMatrix[0, gModelMatrixStackPos] = *mtx; // Should be [gModelMatrixStackPos]
|
||||
if (gModelMatrixStackPos >= ARRAY_COUNT(gModelMatrix)) {
|
||||
stubbed_printf("cameraPushModelMtx: model stack overflow!!\n");
|
||||
}
|
||||
if (1) {}
|
||||
if (1) {}; // Fakematch
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_1);
|
||||
guMtxXFMF(*gModelMatrixF[gModelMatrixStackPos], 0.0f, 0.0f, 0.0f, &tempX, &tempY, &tempZ);
|
||||
mtxf_transform_point(gModelMatrixF[gModelMatrixStackPos], 0.0f, 0.0f, 0.0f, &tempX, &tempY, &tempZ);
|
||||
index = gActiveCameraID;
|
||||
if (gCutsceneCameraActive) {
|
||||
index += 4;
|
||||
@@ -1362,8 +1359,8 @@ s32 cam_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 s
|
||||
gCameraTransform.y_position = 0.0f;
|
||||
gCameraTransform.z_position = 0.0f;
|
||||
gCameraTransform.scale = 1.0f;
|
||||
object_inverse_transform_to_matrix(gCurrentModelMatrixF, &gCameraTransform);
|
||||
guMtxXFMF(gCurrentModelMatrixF, tempX, tempY, tempZ, &tempX, &tempY, &tempZ);
|
||||
mtxf_from_inverse_transform(&gCurrentModelMatrixF, &gCameraTransform);
|
||||
mtxf_transform_point(&gCurrentModelMatrixF, tempX, tempY, tempZ, &tempX, &tempY, &tempZ);
|
||||
scaleFactor = 1.0f / trans->scale;
|
||||
tempX *= scaleFactor;
|
||||
tempY *= scaleFactor;
|
||||
@@ -1381,7 +1378,7 @@ s32 cam_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 s
|
||||
/**
|
||||
* Calculate the rotation matrix for an actors head, then run it.
|
||||
*/
|
||||
void apply_head_turning_matrix(Gfx **dList, MatrixS **mtx, Object_68 *objGfx, s16 headAngle) {
|
||||
void apply_head_turning_matrix(Gfx **dList, Mtx **mtx, Object_68 *objGfx, s16 headAngle) {
|
||||
f32 coss_headAngle;
|
||||
f32 sins_headAngle;
|
||||
f32 offsetX;
|
||||
@@ -1389,8 +1386,8 @@ void apply_head_turning_matrix(Gfx **dList, MatrixS **mtx, Object_68 *objGfx, s1
|
||||
f32 offsetZ;
|
||||
f32 coss_unk1C;
|
||||
f32 sins_unk1C;
|
||||
Matrix rotationMtxF;
|
||||
Matrix headMtxF;
|
||||
MtxF rotationMtxF;
|
||||
MtxF headMtxF;
|
||||
|
||||
offsetX = (f32) objGfx->offsetX;
|
||||
offsetY = (f32) objGfx->offsetY;
|
||||
@@ -1417,8 +1414,8 @@ void apply_head_turning_matrix(Gfx **dList, MatrixS **mtx, Object_68 *objGfx, s1
|
||||
(-offsetZ * (sins_headAngle * sins_unk1C)) + offsetY;
|
||||
headMtxF[3][2] = (-offsetX * -sins_headAngle) + (-offsetZ * coss_headAngle) + offsetZ;
|
||||
headMtxF[3][3] = 1.0f;
|
||||
f32_matrix_mult(&headMtxF, &gCurrentModelMatrixS, &rotationMtxF);
|
||||
f32_matrix_to_s16_matrix(&rotationMtxF, *mtx);
|
||||
mtxf_mul(&headMtxF, &gCurrentModelMatrixS, &rotationMtxF);
|
||||
mtxf_to_mtx(&rotationMtxF, *mtx);
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_DKR_INDEX_2);
|
||||
gSPSelectMatrixDKR((*dList)++, G_MTX_DKR_INDEX_1);
|
||||
}
|
||||
@@ -1451,7 +1448,7 @@ void apply_matrix_from_stack(Gfx **dList) {
|
||||
} // Fakematch
|
||||
|
||||
if (gModelMatrixStackPos > 0) {
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL(gModelMatrixS[gModelMatrixStackPos]), G_MTX_DKR_INDEX_1);
|
||||
gSPMatrixDKR((*dList)++, OS_K0_TO_PHYSICAL(gModelMatrix[gModelMatrixStackPos]), G_MTX_DKR_INDEX_1);
|
||||
} else {
|
||||
gSPSelectMatrixDKR((*dList)++, G_MTX_DKR_INDEX_0);
|
||||
}
|
||||
@@ -1524,21 +1521,21 @@ Camera *get_cutscene_camera_segment(void) {
|
||||
/**
|
||||
* Return the current floating point projection matrix.
|
||||
*/
|
||||
Matrix *get_projection_matrix_f32(void) {
|
||||
MtxF *get_projection_matrix_f32(void) {
|
||||
return &gProjectionMatrixF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current fixed point projection matrix.
|
||||
*/
|
||||
MatrixS *get_projection_matrix_s16(void) {
|
||||
return &gProjectionMatrixS;
|
||||
Mtx *get_projection_matrix_s16(void) {
|
||||
return &gProjectionMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current camera matrix.
|
||||
*/
|
||||
Matrix *get_camera_matrix(void) {
|
||||
MtxF *get_camera_matrix(void) {
|
||||
return &gCameraMatrixF;
|
||||
}
|
||||
|
||||
@@ -1548,7 +1545,7 @@ Matrix *get_camera_matrix(void) {
|
||||
f32 get_distance_to_camera(f32 x, f32 y, f32 z) {
|
||||
f32 ox, oy, oz;
|
||||
|
||||
guMtxXFMF(gCameraMatrixF, x, y, z, &ox, &oy, &oz);
|
||||
mtxf_transform_point(&gCameraMatrixF, x, y, z, &ox, &oy, &oz);
|
||||
|
||||
return oz;
|
||||
}
|
||||
|
||||
+15
-15
@@ -99,10 +99,10 @@ void func_800660C0(void);
|
||||
void func_800660D0(void);
|
||||
UNUSED f32 cam_get_fov(void);
|
||||
void cam_set_fov(f32 camFieldOfView);
|
||||
Matrix *matrix_get_model_s16(void);
|
||||
MtxF *matrix_get_model_s16(void);
|
||||
s32 cam_get_viewport_layout(void);
|
||||
s32 get_current_viewport(void);
|
||||
void camera_init_tracks_menu(Gfx **dList, MatrixS **mtxS);
|
||||
void camera_init_tracks_menu(Gfx **dList, Mtx **mtxS);
|
||||
f32 get_distance_to_active_camera(f32 xPos, f32 yPos, f32 zPos);
|
||||
void camera_reset(s32 xPos, s32 yPos, s32 zPos, s32 angleZ, s32 angleX, s32 angleY);
|
||||
void write_to_object_render_stack(s32 stackPos, f32 xPos, f32 yPos, f32 zPos, s16 arg4, s16 arg5, s16 arg6);
|
||||
@@ -119,31 +119,31 @@ s32 copy_viewport_background_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1,
|
||||
void copy_viewport_frame_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 *x2, s32 *y2);
|
||||
void copy_framebuffer_size_to_coords(s32 *x1, s32 *y1, s32 *x2, s32 *y2);
|
||||
void set_ortho_matrix_height(f32 value);
|
||||
void set_ortho_matrix_view(Gfx **dList, MatrixS **mtx);
|
||||
void func_8006807C(Gfx **dList, MatrixS **mtx);
|
||||
void set_ortho_matrix_view(Gfx **dList, Mtx **mtx);
|
||||
void func_8006807C(Gfx **dList, Mtx **mtx);
|
||||
void viewport_rsp_set(Gfx **dList, s32 halfWidth, s32 halfHeight, s32 centerX, s32 centerY);
|
||||
void viewport_reset(Gfx **dList);
|
||||
void matrix_world_origin(Gfx **dList, MatrixS **mtx);
|
||||
void matrix_world_origin(Gfx **dList, Mtx **mtx);
|
||||
void sprite_anim_off(s32 setting);
|
||||
Camera *cam_get_active_camera_no_cutscenes(void);
|
||||
Camera *cam_get_active_camera(void);
|
||||
Camera *get_cutscene_camera_segment(void);
|
||||
Matrix *get_projection_matrix_f32(void);
|
||||
MatrixS *get_projection_matrix_s16(void);
|
||||
Matrix *get_camera_matrix(void);
|
||||
MtxF *get_projection_matrix_f32(void);
|
||||
Mtx *get_projection_matrix_s16(void);
|
||||
MtxF *get_camera_matrix(void);
|
||||
f32 get_distance_to_camera(f32 x, f32 y, f32 z);
|
||||
void set_camera_shake_by_distance(f32 x, f32 y, f32 z, f32 dist, f32 magnitude);
|
||||
void set_camera_shake(f32 magnitude);
|
||||
void func_80067D3C(Gfx **dList, MatrixS **mats);
|
||||
void render_ortho_triangle_image(Gfx **dList, MatrixS **mtx, Vertex **vtx, ObjectSegment *segment, Sprite *sprite, s32 flags);
|
||||
s32 render_sprite_billboard(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *obj, Sprite *arg4, s32 flags);
|
||||
s32 cam_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 scaleY, f32 offsetY);
|
||||
void func_80067D3C(Gfx **dList, Mtx **mats);
|
||||
void render_ortho_triangle_image(Gfx **dList, Mtx **mtx, Vertex **vtx, ObjectSegment *segment, Sprite *sprite, s32 flags);
|
||||
s32 render_sprite_billboard(Gfx **dList, Mtx **mtx, Vertex **vertexList, Object *obj, Sprite *arg4, s32 flags);
|
||||
s32 cam_push_model_mtx(Gfx **dList, Mtx **mtx, ObjectTransform *trans, f32 scaleY, f32 offsetY);
|
||||
void viewport_scissor(Gfx **dList);
|
||||
void apply_matrix_from_stack(Gfx **dList);
|
||||
void copy_viewports_to_stack(void);
|
||||
void apply_head_turning_matrix(Gfx **dList, MatrixS **mtx, Object_68 *objGfx, s16 headAngle);
|
||||
void apply_object_shear_matrix(Gfx **dList, MatrixS **mtx, Object *arg2, Object *arg3, f32 shear);
|
||||
void apply_head_turning_matrix(Gfx **dList, Mtx **mtx, Object_68 *objGfx, s16 headAngle);
|
||||
void apply_object_shear_matrix(Gfx **dList, Mtx **mtx, Object *arg2, Object *arg3, f32 shear);
|
||||
void cam_init(void);
|
||||
void viewport_main(Gfx **dlist, MatrixS **mats);
|
||||
void viewport_main(Gfx **dlist, Mtx **mats);
|
||||
|
||||
#endif
|
||||
|
||||
+20
-20
@@ -322,7 +322,7 @@ s32 transition_update(s32 updateRate) {
|
||||
* The rendering portion of transitions.
|
||||
* First establishes an orthogonal matrix, then renders a transition effect onscreen.
|
||||
*/
|
||||
void transition_render(Gfx **dList, MatrixS **mtx, Vertex **vtx) {
|
||||
void transition_render(Gfx **dList, Mtx **mtx, Vertex **vtx) {
|
||||
if (sTransitionStatus != TRANSITION_NONE) {
|
||||
if (osTvType == OS_TV_TYPE_PAL) {
|
||||
set_ortho_matrix_height(1.4f);
|
||||
@@ -436,7 +436,7 @@ void transition_update_fullscreen(s32 updateRate) {
|
||||
/**
|
||||
* Draws a simple fillrect covering the whole screen that fades in or out.
|
||||
*/
|
||||
void transition_render_fullscreen(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_fullscreen(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
s32 screenSize = fb_size();
|
||||
gSPDisplayList((*dList)++, dTransitionFadeSettings);
|
||||
gDPSetPrimColor((*dList)++, 0, 0, gCurFadeRed, gCurFadeGreen, gCurFadeBlue, gCurFadeAlpha);
|
||||
@@ -564,11 +564,11 @@ void transition_update_shape(s32 updateRate) {
|
||||
/**
|
||||
* Renders a transition effect on screen that will close in from both sides horizonally.
|
||||
*/
|
||||
void transition_render_barndoor_hor(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_barndoor_hor(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
rendermode_reset(dList);
|
||||
gSPDisplayList((*dList)++, dTransitionShapeSettings);
|
||||
gSPVertexDKR((*dList)++, OS_PHYSICAL_TO_K0(sTransitionVtx[sTransitionTaskNum]), 12, 0);
|
||||
gSPPolygon((*dList)++, OS_PHYSICAL_TO_K0(sTransitionTris[sTransitionTaskNum]), 8, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(sTransitionVtx[sTransitionTaskNum]), 12, 0);
|
||||
gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(sTransitionTris[sTransitionTaskNum]), 8, TRIN_DISABLE_TEXTURE);
|
||||
rendermode_reset(dList);
|
||||
}
|
||||
|
||||
@@ -576,11 +576,11 @@ void transition_render_barndoor_hor(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Ve
|
||||
* Renders a transition effect on screen that will close in from both sides vertically.
|
||||
* Codewise, exactly the same as above, but uses a different vertex layout to make the difference.
|
||||
*/
|
||||
void transition_render_barndoor_vert(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_barndoor_vert(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
rendermode_reset(dList);
|
||||
gSPDisplayList((*dList)++, dTransitionShapeSettings);
|
||||
gSPVertexDKR((*dList)++, OS_PHYSICAL_TO_K0(sTransitionVtx[sTransitionTaskNum]), 12, 0);
|
||||
gSPPolygon((*dList)++, OS_PHYSICAL_TO_K0(sTransitionTris[sTransitionTaskNum]), 8, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(sTransitionVtx[sTransitionTaskNum]), 12, 0);
|
||||
gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(sTransitionTris[sTransitionTaskNum]), 8, TRIN_DISABLE_TEXTURE);
|
||||
rendermode_reset(dList);
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ void transition_update_circle(s32 updateRate) {
|
||||
/**
|
||||
* Render a circle shape transition onscreen using previously allocated geometry.
|
||||
*/
|
||||
void transition_render_circle(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_circle(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
Vertex *vertsToRender;
|
||||
Triangle *trisToRender;
|
||||
Gfx *gfx;
|
||||
@@ -758,8 +758,8 @@ void transition_render_circle(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex *
|
||||
gSPDisplayList(gfx++, dTransitionShapeSettings);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSPVertexDKR(gfx++, OS_PHYSICAL_TO_K0(vertsToRender), NUM_OF_VERTS, 0);
|
||||
gSPPolygon(gfx++, OS_PHYSICAL_TO_K0(trisToRender), NUM_OF_TRIS, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR(gfx++, OS_K0_TO_PHYSICAL(vertsToRender), NUM_OF_VERTS, 0);
|
||||
gSPPolygon(gfx++, OS_K0_TO_PHYSICAL(trisToRender), NUM_OF_TRIS, TRIN_DISABLE_TEXTURE);
|
||||
vertsToRender += NUM_OF_VERTS;
|
||||
trisToRender += NUM_OF_TRIS;
|
||||
}
|
||||
@@ -771,7 +771,7 @@ void transition_render_circle(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex *
|
||||
/**
|
||||
* Render the wavy transition onscreen using the vertex data allocated earlier.
|
||||
*/
|
||||
void transition_render_waves(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_waves(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
Gfx *gfx;
|
||||
s32 i;
|
||||
Vertex *v;
|
||||
@@ -791,13 +791,13 @@ void transition_render_waves(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **
|
||||
*/
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (i == 1 || i == 4) { // Is middle third?
|
||||
gSPVertexDKR(gfx++, OS_PHYSICAL_TO_K0(v), 14, 0);
|
||||
gSPPolygon(gfx++, OS_PHYSICAL_TO_K0(t), 12, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR(gfx++, OS_K0_TO_PHYSICAL(v), 14, 0);
|
||||
gSPPolygon(gfx++, OS_K0_TO_PHYSICAL(t), 12, TRIN_DISABLE_TEXTURE);
|
||||
v += 14;
|
||||
t += 12;
|
||||
} else {
|
||||
gSPVertexDKR(gfx++, OS_PHYSICAL_TO_K0(v), 16, 0);
|
||||
gSPPolygon(gfx++, OS_PHYSICAL_TO_K0(t), 14, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR(gfx++, OS_K0_TO_PHYSICAL(v), 16, 0);
|
||||
gSPPolygon(gfx++, OS_K0_TO_PHYSICAL(t), 14, TRIN_DISABLE_TEXTURE);
|
||||
v += 16;
|
||||
t += 14;
|
||||
}
|
||||
@@ -809,11 +809,11 @@ void transition_render_waves(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **
|
||||
/**
|
||||
* Renders a transition effect on screen that will close in from the opposite corners of the screen.
|
||||
*/
|
||||
void transition_render_barndoor_diag(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_barndoor_diag(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
rendermode_reset(dList);
|
||||
gSPDisplayList((*dList)++, dTransitionShapeSettings);
|
||||
gSPVertexDKR((*dList)++, OS_PHYSICAL_TO_K0(sTransitionVtx[sTransitionTaskNum]), 10, 0);
|
||||
gSPPolygon((*dList)++, OS_PHYSICAL_TO_K0(sTransitionTris[sTransitionTaskNum]), 6, TRIN_DISABLE_TEXTURE);
|
||||
gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(sTransitionVtx[sTransitionTaskNum]), 10, 0);
|
||||
gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(sTransitionTris[sTransitionTaskNum]), 6, TRIN_DISABLE_TEXTURE);
|
||||
rendermode_reset(dList);
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ void transition_update_blank(s32 updateRate) {
|
||||
/**
|
||||
* Fill the whole screen with a solid colour.
|
||||
*/
|
||||
void transition_render_blank(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx) {
|
||||
void transition_render_blank(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx) {
|
||||
s32 screenSize = fb_size();
|
||||
gSPDisplayList((*dList)++, dTransitionFadeSettings);
|
||||
gDPSetPrimColor((*dList)++, 0, 0, (gLastFadeRed >> 16), (gLastFadeGreen >> 16), (gLastFadeBlue >> 16), 255);
|
||||
|
||||
@@ -54,23 +54,23 @@ void disable_new_screen_transitions(void);
|
||||
u32 check_fadeout_transition(void);
|
||||
void transition_end(void);
|
||||
s32 transition_update(s32 updateRate);
|
||||
void transition_render(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_fullscreen(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_hor(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_vert(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_diag(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_blank(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_render_fullscreen(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_hor(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_vert(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_render_barndoor_diag(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_render_blank(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_fullscreen_start(FadeTransition *transition);
|
||||
void transition_init_blank(FadeTransition *transition);
|
||||
void transition_update_fullscreen(s32 updateRate);
|
||||
void transition_update_blank(s32 updateRate);
|
||||
s32 transition_begin(FadeTransition *transition);
|
||||
void transition_render_circle(Gfx **dList, MatrixS **mtx, Vertex **vtx);
|
||||
void transition_render_circle(Gfx **dList, Mtx **mtx, Vertex **vtx);
|
||||
void transition_update_shape(s32 updateRate);
|
||||
void transition_init_shape(FadeTransition *transition, s32 numVerts, s32 numTris, s16 *coords, u8 *nextPos,
|
||||
u8 *targetPos, u8 *nextAlpha, u8 *targetAlpha, u8 *vertIndices);
|
||||
void transition_update_circle(s32 updateRate);
|
||||
void transition_render_waves(Gfx **dList, UNUSED MatrixS **mtx, UNUSED Vertex **vtx);
|
||||
void transition_render_waves(Gfx **dList, UNUSED Mtx **mtx, UNUSED Vertex **vtx);
|
||||
void transition_init_circle(FadeTransition *transition);
|
||||
|
||||
#endif
|
||||
|
||||
+11
-11
@@ -466,7 +466,7 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali
|
||||
if (lastTextureIndex != textureIndex) {
|
||||
lastTextureIndex = textureIndex;
|
||||
texture = fontData->texturePointers[textureIndex];
|
||||
gDkrDmaDisplayList((*dList)++, OS_PHYSICAL_TO_K0(texture->cmd), texture->numberOfCommands);
|
||||
gDkrDmaDisplayList((*dList)++, OS_K0_TO_PHYSICAL(texture->cmd), texture->numberOfCommands);
|
||||
}
|
||||
textureWidth = fontData->letter[curChar].width;
|
||||
textureHeight = fontData->letter[curChar].height;
|
||||
@@ -1120,7 +1120,7 @@ void clear_dialogue_box_open_flag(s32 dialogueBoxID) {
|
||||
* when the player exits out of one.
|
||||
* Official Name: fontWindowsDraw
|
||||
*/
|
||||
void render_dialogue_boxes(Gfx **dList, MatrixS **mat, Vertex **verts) {
|
||||
void render_dialogue_boxes(Gfx **dList, Mtx **mat, Vertex **verts) {
|
||||
s32 i;
|
||||
|
||||
if (sDialogueBoxIsOpen) {
|
||||
@@ -1210,7 +1210,7 @@ void render_fill_rectangle(Gfx **dList, s32 ulx, s32 uly, s32 lrx, s32 lry) {
|
||||
* Render the selected dialogue box. Background first, then text.
|
||||
* Official Name: fontWindowDraw
|
||||
*/
|
||||
void render_dialogue_box(Gfx **dList, MatrixS **mat, Vertex **verts, s32 dialogueBoxID) {
|
||||
void render_dialogue_box(Gfx **dList, Mtx **mat, Vertex **verts, s32 dialogueBoxID) {
|
||||
DialogueBoxBackground *dialogueBox;
|
||||
DialogueBox *dialogueTextBox;
|
||||
s32 i;
|
||||
@@ -1501,7 +1501,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
}
|
||||
|
||||
if (asset->unk4 != NULL) {
|
||||
gDPLoadTextureBlockS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, height,
|
||||
gDPLoadTextureBlockS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
@@ -1510,7 +1510,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD, // shifts
|
||||
G_TX_NOLOD); // shiftt
|
||||
|
||||
gDPLoadMultiBlock_4bS(dList++, OS_PHYSICAL_TO_K0(asset->unk4), 0x100, 1, G_IM_FMT_I, width, height,
|
||||
gDPLoadMultiBlock_4bS(dList++, OS_K0_TO_PHYSICAL(asset->unk4), 0x100, 1, G_IM_FMT_I, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
@@ -1524,7 +1524,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
} else {
|
||||
switch (asset->unk8) {
|
||||
case 0: // RGBA32
|
||||
gDPLoadTextureBlockS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_32b, width,
|
||||
gDPLoadTextureBlockS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_32b, width,
|
||||
height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
@@ -1535,7 +1535,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD); // shiftt
|
||||
break;
|
||||
case 1: // RGBA16
|
||||
gDPLoadTextureBlockS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_16b, width,
|
||||
gDPLoadTextureBlockS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_RGBA, G_IM_SIZ_16b, width,
|
||||
height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
@@ -1546,7 +1546,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD); // shiftt
|
||||
break;
|
||||
case 5: // IA8
|
||||
gDPLoadTextureBlockS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_IA, G_IM_SIZ_8b, width, height,
|
||||
gDPLoadTextureBlockS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_IA, G_IM_SIZ_8b, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
@@ -1556,7 +1556,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD); // shiftt
|
||||
break;
|
||||
case 6: // IA4
|
||||
gDPLoadTextureBlock_4bS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_IA, width, height,
|
||||
gDPLoadTextureBlock_4bS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_IA, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
@@ -1566,7 +1566,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD); // shiftt
|
||||
break;
|
||||
case 3: // I4
|
||||
gDPLoadTextureBlock_4bS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_I, width, height,
|
||||
gDPLoadTextureBlock_4bS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_I, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
@@ -1576,7 +1576,7 @@ void fontCreateDisplayList(Gfx *dList, Asset46 *asset, s32 width, s32 height) {
|
||||
G_TX_NOLOD); // shiftt
|
||||
break;
|
||||
case 2: // I8
|
||||
gDPLoadTextureBlockS(dList++, OS_PHYSICAL_TO_K0(asset->unk0), G_IM_FMT_I, G_IM_SIZ_8b, width, height,
|
||||
gDPLoadTextureBlockS(dList++, OS_K0_TO_PHYSICAL(asset->unk0), G_IM_FMT_I, G_IM_SIZ_8b, width, height,
|
||||
0, // palette
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cms
|
||||
G_TX_NOMIRROR | G_TX_WRAP, // cmt
|
||||
|
||||
+2
-2
@@ -175,9 +175,9 @@ void dialogue_clear(s32 dialogueBoxID);
|
||||
void open_dialogue_box(s32 dialogueBoxID);
|
||||
void dialogue_close(s32 dialogueBoxID);
|
||||
void clear_dialogue_box_open_flag(s32 dialogueBoxID);
|
||||
void render_dialogue_boxes(Gfx **dList, MatrixS **mat, Vertex **verts);
|
||||
void render_dialogue_boxes(Gfx **dList, Mtx **mat, Vertex **verts);
|
||||
void render_fill_rectangle(Gfx **dList, s32 ulx, s32 uly, s32 lrx, s32 lry);
|
||||
void render_dialogue_box(Gfx **dList, MatrixS **mat, Vertex **verts, s32 dialogueBoxID);
|
||||
void render_dialogue_box(Gfx **dList, Mtx **mat, Vertex **verts, s32 dialogueBoxID);
|
||||
void parse_string_with_number(char *input, char *output, s32 number);
|
||||
void s32_to_string(char **outString, s32 number);
|
||||
void load_font(s32 fontID);
|
||||
|
||||
+18
-19
@@ -255,7 +255,7 @@ s16 *gAssetHudElementIds;
|
||||
HudElements *gAssetHudElements;
|
||||
s32 gAssetHudElementIdsCount;
|
||||
Gfx *gHudDL;
|
||||
MatrixS *gHudMtx;
|
||||
Mtx *gHudMtx;
|
||||
Vertex *gHudVtx;
|
||||
s32 gHudCurrentViewport;
|
||||
s32 gHUDNumPlayers;
|
||||
@@ -426,7 +426,7 @@ void hud_init_element(void) {
|
||||
gHudPALScale = FALSE;
|
||||
gAdventurePlayerFinish = FALSE;
|
||||
D_80126D4C = -100;
|
||||
D_80126D50 = get_random_number_from_range(120, 360);
|
||||
D_80126D50 = rand_range(120, 360);
|
||||
D_8012718A = func_8000E158();
|
||||
gStopwatchErrorX = 55;
|
||||
gStopwatchErrorY = 179;
|
||||
@@ -672,7 +672,7 @@ u8 race_starting(void) {
|
||||
* Root function for the HUD updating and rendering for individual players.
|
||||
* The player can toggle specific overrides and settings for displays based on their current game modes.
|
||||
*/
|
||||
void hud_render_player(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *obj, s32 updateRate) {
|
||||
void hud_render_player(Gfx **dList, Mtx **mtx, Vertex **vertexList, Object *obj, s32 updateRate) {
|
||||
s32 countdown;
|
||||
Object_Racer *racer;
|
||||
|
||||
@@ -1612,9 +1612,9 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
if ((D_80126D4C == 0) && (!curRacer->raceFinished)) {
|
||||
D_80126D4C = -100;
|
||||
if (gHUDVoiceSoundMask == 0) {
|
||||
soundID = get_random_number_from_range(0, D_80126D64 + 2) + SOUND_VOICE_TT_OH_NO;
|
||||
soundID = rand_range(0, D_80126D64 + 2) + SOUND_VOICE_TT_OH_NO;
|
||||
while (soundID == gHudTTSoundID) {
|
||||
soundID = get_random_number_from_range(0, D_80126D64 + 2) + SOUND_VOICE_TT_OH_NO;
|
||||
soundID = rand_range(0, D_80126D64 + 2) + SOUND_VOICE_TT_OH_NO;
|
||||
}
|
||||
gHudTTSoundID = soundID;
|
||||
sound_play(soundID, &gHUDVoiceSoundMask);
|
||||
@@ -1649,13 +1649,13 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
posZ = ttSWBodyObject->segment.trans.z_position - playerRacerObj->segment.trans.z_position;
|
||||
if ((sqrtf((posX * posX) + (posY * posY) + (posZ * posZ)) < 600.0f) && (gHUDVoiceSoundMask == 0) &&
|
||||
(D_80126D50 == 0)) {
|
||||
soundID = SOUND_VOICE_TT_GO_FOR_IT + get_random_number_from_range(0, 2);
|
||||
soundID = SOUND_VOICE_TT_GO_FOR_IT + rand_range(0, 2);
|
||||
while (soundID == gHudTTSoundID) {
|
||||
soundID = SOUND_VOICE_TT_GO_FOR_IT + get_random_number_from_range(0, 2);
|
||||
soundID = SOUND_VOICE_TT_GO_FOR_IT + rand_range(0, 2);
|
||||
}
|
||||
gHudTTSoundID = soundID;
|
||||
sound_play(soundID, &gHUDVoiceSoundMask);
|
||||
D_80126D50 = get_random_number_from_range(120, 1200);
|
||||
D_80126D50 = rand_range(120, 1200);
|
||||
}
|
||||
D_80126D50 -= updateRate;
|
||||
if (D_80126D50 < 0) {
|
||||
@@ -1915,16 +1915,15 @@ void hud_race_start(s32 countdown, s32 updateRate) {
|
||||
Object_Racer *racer;
|
||||
s32 numRacerObjects;
|
||||
racerGroup = get_racer_objects(&numRacerObjects);
|
||||
randomRacer = racerGroup[get_random_number_from_range(1, numRacerObjects) - 1];
|
||||
randomRacer = racerGroup[rand_range(1, numRacerObjects) - 1];
|
||||
racer = &randomRacer->unk64->racer;
|
||||
if (racer->vehicleID == VEHICLE_CAR) {
|
||||
if (get_random_number_from_range(0, 100) >= 96) {
|
||||
frequency = 1.25 - ((get_random_number_from_range(0, 7) * 0.5) / 7.0);
|
||||
if (rand_range(0, 100) >= 96) {
|
||||
frequency = 1.25 - ((rand_range(0, 7) * 0.5) / 7.0);
|
||||
audspat_play_sound_direct(
|
||||
76, randomRacer->segment.trans.x_position, randomRacer->segment.trans.y_position,
|
||||
randomRacer->segment.trans.z_position, AUDIO_POINT_FLAG_ONE_TIME_TRIGGER,
|
||||
((get_random_number_from_range(0, 7) * 63) / 7) + 24, frequency * 100.0f,
|
||||
&gRaceStartSoundMask);
|
||||
((rand_range(0, 7) * 63) / 7) + 24, frequency * 100.0f, &gRaceStartSoundMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2457,10 +2456,10 @@ void hud_wrong_way(Object_Racer *obj, s32 updateRate) {
|
||||
!is_game_paused()) {
|
||||
if ((gWrongWayNagPrefix || gWrongWayNagTimer == 0) && gHUDVoiceSoundMask == NULL) {
|
||||
// 20% chance that T.T decides not to precede his nagging with "No no no!"
|
||||
if (gWrongWayNagPrefix || get_random_number_from_range(1, 10) >= 8) {
|
||||
if (gWrongWayNagPrefix || rand_range(1, 10) >= 8) {
|
||||
gWrongWayNagPrefix = FALSE;
|
||||
sound_play(SOUND_VOICE_TT_WRONG_WAY, &gHUDVoiceSoundMask);
|
||||
gWrongWayNagTimer = get_random_number_from_range(1, 480) + 120;
|
||||
gWrongWayNagTimer = rand_range(1, 480) + 120;
|
||||
} else {
|
||||
gWrongWayNagPrefix = TRUE;
|
||||
sound_play(SOUND_VOICE_TT_NONONO, &gHUDVoiceSoundMask);
|
||||
@@ -3316,7 +3315,7 @@ s8 hud_setting(void) {
|
||||
* Renders HUD elements concerning all players.
|
||||
* This includes the minimap and score counters for challenge modes.
|
||||
*/
|
||||
void hud_render_general(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 updateRate) {
|
||||
void hud_render_general(Gfx **dList, Mtx **mtx, Vertex **vtx, s32 updateRate) {
|
||||
Object_Racer *curRacerObj;
|
||||
LevelModel *lvlMdl;
|
||||
Sprite *minimap;
|
||||
@@ -3811,7 +3810,7 @@ void minimap_marker_pos(f32 x, f32 z, f32 angleSin, f32 angleCos, f32 modelAspec
|
||||
* Since hud elements can be all sorts of things, the function checks what asset type it is, before
|
||||
* deciding to draw a texture rectangle, ortho tris, or a 3D model entirely.
|
||||
*/
|
||||
void hud_element_render(Gfx **dList, MatrixS **mtx, Vertex **vtxList, HudElement *hud) {
|
||||
void hud_element_render(Gfx **dList, Mtx **mtx, Vertex **vtxList, HudElement *hud) {
|
||||
TextureHeader **textureHeader3;
|
||||
TextureHeader *textureHeader2;
|
||||
TextureHeader *textureHeader;
|
||||
@@ -4029,11 +4028,11 @@ void hud_draw_model(ObjectModel *objModel) {
|
||||
texPtr = objModel->textures[texIndex].texture;
|
||||
}
|
||||
material_set_no_tex_offset(&gHudDL, texPtr, flags & ~RENDER_Z_COMPARE);
|
||||
gSPVertexDKR(gHudDL++, OS_PHYSICAL_TO_K0(verts), numVerts, 0);
|
||||
gSPVertexDKR(gHudDL++, OS_K0_TO_PHYSICAL(verts), numVerts, 0);
|
||||
if (texPtr == NULL) {
|
||||
textureEnabled = TRIN_DISABLE_TEXTURE;
|
||||
}
|
||||
gSPPolygon(gHudDL++, OS_PHYSICAL_TO_K0(tris), numTris, textureEnabled);
|
||||
gSPPolygon(gHudDL++, OS_K0_TO_PHYSICAL(tris), numTris, textureEnabled);
|
||||
numBatches = objModel->numberOfBatches;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -420,14 +420,14 @@ void hud_race_time(Object_Racer *racer, s32 updateRate);
|
||||
void hud_wrong_way(Object_Racer *obj, s32 updateRate);
|
||||
void hud_course_arrows(Object_Racer *racer, s32 updateRate);
|
||||
void hud_main_hub(Object *obj, s32 updateRate);
|
||||
void hud_render_player(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *obj, s32 updateRate);
|
||||
void hud_render_player(Gfx **dList, Mtx **mtx, Vertex **vertexList, Object *obj, s32 updateRate);
|
||||
void hud_weapon(Object *obj, s32 updateRate);
|
||||
void hud_race_start(s32 countdown, s32 updateRate);
|
||||
void hud_bananas(Object_Racer *racer, s32 updateRate);
|
||||
void hud_race_finish_1player(Object_Racer *racer, s32 updateRate);
|
||||
void hud_speedometre(Object *obj, s32 updateRate);
|
||||
void hud_lap_count(Object_Racer *racer, s32 updateRate);
|
||||
void hud_render_general(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 updateRate);
|
||||
void hud_render_general(Gfx **dList, Mtx **mtx, Vertex **vtx, s32 updateRate);
|
||||
void hud_init(s32 viewportCount);
|
||||
void hud_main_battle(s32 countdown, Object *obj, s32 updateRate);
|
||||
void hud_lives_render(Object_Racer *racer, s32 updateRate);
|
||||
@@ -446,7 +446,7 @@ void hud_treasure(Object_Racer *racer);
|
||||
void minimap_marker_pos(f32 x, f32 z, f32 angleSin, f32 angleCos, f32 modelAspectRatio);
|
||||
void hud_timer_render(s32 x, s32 y, s32 minutes, s32 seconds, s32 hundredths, s32 smallFont);
|
||||
void hud_draw_model(ObjectModel *objModel);
|
||||
void hud_element_render(Gfx **dList, MatrixS **mtx, Vertex **vtxList, HudElement *hud);
|
||||
void hud_element_render(Gfx **dList, Mtx **mtx, Vertex **vtxList, HudElement *hud);
|
||||
void hud_main_time_trial(s32, Object*, s32);
|
||||
void hud_race_finish_multiplayer(Object_Racer *racer, s32 updateRate);
|
||||
void func_800A1E48(Object*, s32 updateRate);
|
||||
|
||||
+478
-370
File diff suppressed because it is too large
Load Diff
+48
-48
@@ -72,7 +72,7 @@ leaf get_gIntDisFlag
|
||||
/* 70178 8006F578 9042D430 */ lbu $v0, %lo(gIntDisFlag)($v0)
|
||||
.end get_gIntDisFlag
|
||||
|
||||
leaf s32_matrix_to_s16_matrix
|
||||
leaf mtx_to_mtxs
|
||||
/* 7017C 8006F57C 34080004 */ ori $t0, $zero, 0x4
|
||||
/* 70180 8006F580 3C0FFFFF */ lui $t7, (0xFFFF0000 >> 16)
|
||||
.L8006F584:
|
||||
@@ -99,9 +99,9 @@ leaf s32_matrix_to_s16_matrix
|
||||
/* 701D4 8006F5D4 00000000 */ nop
|
||||
/* 701D8 8006F5D8 03E00008 */ jr $ra
|
||||
/* 701DC 8006F5DC 00000000 */ nop
|
||||
.end s32_matrix_to_s16_matrix
|
||||
.end mtx_to_mtxs
|
||||
|
||||
leaf f32_matrix_to_s32_matrix
|
||||
leaf mtxf_to_mtxs
|
||||
/* 701E0 8006F5E0 3C014780 */ lui $at, (0x47800000 >> 16)
|
||||
/* 701E4 8006F5E4 44816000 */ mtc1 $at, $f12
|
||||
/* 701E8 8006F5E8 34080004 */ ori $t0, $zero, 0x4
|
||||
@@ -130,10 +130,10 @@ leaf f32_matrix_to_s32_matrix
|
||||
/* 70240 8006F640 00000000 */ nop
|
||||
/* 70244 8006F644 03E00008 */ jr $ra
|
||||
/* 70248 8006F648 00000000 */ nop
|
||||
.end f32_matrix_to_s32_matrix
|
||||
.end mtxf_to_mtxs
|
||||
|
||||
/* Official Name: mathMtxXFMF */
|
||||
leaf guMtxXFMF
|
||||
leaf mtxf_transform_point
|
||||
/* 7024C 8006F64C 44856000 */ mtc1 $a1, $f12
|
||||
/* 70250 8006F650 C4840000 */ lwc1 $f4, 0x0($a0)
|
||||
/* 70254 8006F654 44867000 */ mtc1 $a2, $f14
|
||||
@@ -174,10 +174,10 @@ leaf guMtxXFMF
|
||||
/* 702E0 8006F6E0 460A4100 */ add.s $f4, $f8, $f10
|
||||
/* 702E4 8006F6E4 03E00008 */ jr $ra
|
||||
/* 702E8 8006F6E8 E7040000 */ swc1 $f4, 0x0($t8)
|
||||
.end guMtxXFMF
|
||||
.end mtxf_transform_point
|
||||
|
||||
/* Official Name: mathMtxFastXFMF */
|
||||
leaf f32_matrix_dot
|
||||
leaf mtxf_transform_dir
|
||||
/* 702EC 8006F6EC C4A40000 */ lwc1 $f4, 0x0($a1)
|
||||
/* 702F0 8006F6F0 C48A0000 */ lwc1 $f10, 0x0($a0)
|
||||
/* 702F4 8006F6F4 C4A60004 */ lwc1 $f6, 0x4($a1)
|
||||
@@ -209,10 +209,10 @@ leaf f32_matrix_dot
|
||||
/* 7035C 8006F75C 460E6380 */ add.s $f14, $f12, $f14
|
||||
/* 70360 8006F760 03E00008 */ jr $ra
|
||||
/* 70364 8006F764 E4CE0008 */ swc1 $f14, 0x8($a2)
|
||||
.end f32_matrix_dot
|
||||
.end mtxf_transform_dir
|
||||
|
||||
/* Official Name: mathMtxCatF */
|
||||
leaf f32_matrix_mult
|
||||
leaf mtxf_mul
|
||||
/* 70368 8006F768 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 7036C 8006F76C F7A20000 */ sdc1 $f2, 0x0($sp)
|
||||
/* 70370 8006F770 34080004 */ ori $t0, $zero, 0x4
|
||||
@@ -280,10 +280,10 @@ leaf f32_matrix_mult
|
||||
/* 70464 8006F864 D7A20000 */ ldc1 $f2, 0x0($sp)
|
||||
/* 70468 8006F868 03E00008 */ jr $ra
|
||||
/* 7046C 8006F86C 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
.end f32_matrix_mult
|
||||
.end mtxf_mul
|
||||
|
||||
/* Official Name: mathMtxF2L */
|
||||
leaf f32_matrix_to_s16_matrix
|
||||
leaf mtxf_to_mtx
|
||||
/* 70470 8006F870 3C014780 */ lui $at, (0x47800000 >> 16)
|
||||
/* 70474 8006F874 44816000 */ mtc1 $at, $f12
|
||||
/* 70478 8006F878 34080004 */ ori $t0, $zero, 0x4
|
||||
@@ -324,7 +324,7 @@ leaf f32_matrix_to_s16_matrix
|
||||
/* 70500 8006F900 00000000 */ nop
|
||||
/* 70504 8006F904 03E00008 */ jr $ra
|
||||
/* 70508 8006F908 00000000 */ nop
|
||||
.end f32_matrix_to_s16_matrix
|
||||
.end mtxf_to_mtx
|
||||
|
||||
/* Official Name: mathSeed */
|
||||
leaf set_rng_seed
|
||||
@@ -356,7 +356,7 @@ leaf get_rng_seed
|
||||
.end get_rng_seed
|
||||
|
||||
/* Official Name: mathRnd */
|
||||
leaf get_random_number_from_range
|
||||
leaf rand_range
|
||||
/* 7054C 8006F94C 3C08800E */ lui $t0, %hi(gCurrentRNGSeed)
|
||||
/* 70550 8006F950 8D08D434 */ lw $t0, %lo(gCurrentRNGSeed)($t0)
|
||||
/* 70554 8006F954 3C01800E */ lui $at, %hi(gCurrentRNGSeed)
|
||||
@@ -385,10 +385,10 @@ leaf get_random_number_from_range
|
||||
.L8006F9B0:
|
||||
/* 705B0 8006F9B0 03E00008 */ jr $ra
|
||||
/* 705B4 8006F9B4 00000000 */ nop
|
||||
.end get_random_number_from_range
|
||||
.end rand_range
|
||||
|
||||
/* Official Name: fastShortReflection */
|
||||
leaf s16_matrix_rotate
|
||||
leaf vec3s_reflect
|
||||
/* 705B8 8006F9B8 84880000 */ lh $t0, 0x0($a0)
|
||||
/* 705BC 8006F9BC 84AB0000 */ lh $t3, 0x0($a1)
|
||||
/* 705C0 8006F9C0 84890002 */ lh $t1, 0x2($a0)
|
||||
@@ -423,9 +423,9 @@ leaf s16_matrix_rotate
|
||||
/* 70634 8006FA34 01A86822 */ sub $t5, $t5, $t0 /* handwritten instruction */
|
||||
/* 70638 8006FA38 03E00008 */ jr $ra
|
||||
/* 7063C 8006FA3C A48D000A */ sh $t5, 0xA($a0)
|
||||
.end s16_matrix_rotate
|
||||
.end vec3s_reflect
|
||||
|
||||
leaf s16_matrix_to_s32_matrix
|
||||
leaf mtx_to_mtxs_2
|
||||
/* 70640 8006FA40 340A0010 */ ori $t2, $zero, 0x10
|
||||
/* 70644 8006FA44 016B5826 */ xor $t3, $t3, $t3
|
||||
.L8006FA48:
|
||||
@@ -441,9 +441,9 @@ leaf s16_matrix_to_s32_matrix
|
||||
/* 7066C 8006FA6C 00000000 */ nop
|
||||
/* 70670 8006FA70 03E00008 */ jr $ra
|
||||
/* 70674 8006FA74 00000000 */ nop
|
||||
.end s16_matrix_to_s32_matrix
|
||||
.end mtx_to_mtxs_2
|
||||
|
||||
leaf s16_vec3_mult_by_s32_matrix_full
|
||||
leaf mtxs_transform_point
|
||||
/* 70678 8006FA78 84A80000 */ lh $t0, 0x0($a1)
|
||||
/* 7067C 8006FA7C 8C8B0000 */ lw $t3, 0x0($a0)
|
||||
/* 70680 8006FA80 84A90002 */ lh $t1, 0x2($a1)
|
||||
@@ -502,9 +502,9 @@ leaf s16_vec3_mult_by_s32_matrix_full
|
||||
/* 70754 8006FB54 000C6403 */ sra $t4, $t4, 16
|
||||
/* 70758 8006FB58 03E00008 */ jr $ra
|
||||
/* 7075C 8006FB5C A4AC0004 */ sh $t4, 0x4($a1)
|
||||
.end s16_vec3_mult_by_s32_matrix_full
|
||||
.end mtxs_transform_point
|
||||
|
||||
leaf s16_vec3_mult_by_s32_matrix
|
||||
leaf mtxs_transform_dir
|
||||
/* 70760 8006FB60 8C8B0000 */ lw $t3, 0x0($a0)
|
||||
/* 70764 8006FB64 84A80000 */ lh $t0, 0x0($a1)
|
||||
/* 70768 8006FB68 84A90002 */ lh $t1, 0x2($a1)
|
||||
@@ -557,9 +557,9 @@ leaf s16_vec3_mult_by_s32_matrix
|
||||
/* 70824 8006FC24 000C6403 */ sra $t4, $t4, 16
|
||||
/* 70828 8006FC28 03E00008 */ jr $ra
|
||||
/* 7082C 8006FC2C A4AC0004 */ sh $t4, 0x4($a1)
|
||||
.end s16_vec3_mult_by_s32_matrix
|
||||
.end mtxs_transform_dir
|
||||
|
||||
leaf object_transform_to_matrix
|
||||
leaf mtxf_from_transform
|
||||
/* 70830 8006FC30 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70834 8006FC34 3C013780 */ lui $at, (0x37800000 >> 16)
|
||||
/* 70838 8006FC38 FFBF0000 */ sd $ra, 0x0($sp)
|
||||
@@ -677,10 +677,10 @@ leaf object_transform_to_matrix
|
||||
/* 709F8 8006FDF8 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 709FC 8006FDFC 03E00008 */ jr $ra
|
||||
/* 70A00 8006FE00 00000000 */ nop
|
||||
.end object_transform_to_matrix
|
||||
.end mtxf_from_transform
|
||||
|
||||
/* Official Name: mathSquashY */
|
||||
leaf f32_matrix_scale_y_axis
|
||||
leaf mtxf_scale_y
|
||||
/* 70A04 8006FE04 44859000 */ mtc1 $a1, $f18
|
||||
/* 70A08 8006FE08 C4900010 */ lwc1 $f16, 0x10($a0)
|
||||
/* 70A0C 8006FE0C 46128402 */ mul.s $f16, $f16, $f18
|
||||
@@ -692,10 +692,10 @@ leaf f32_matrix_scale_y_axis
|
||||
/* 70A24 8006FE24 46128402 */ mul.s $f16, $f16, $f18
|
||||
/* 70A28 8006FE28 03E00008 */ jr $ra
|
||||
/* 70A2C 8006FE2C E4900018 */ swc1 $f16, 0x18($a0)
|
||||
.end f32_matrix_scale_y_axis
|
||||
.end mtxf_scale_y
|
||||
|
||||
/* Official Name: mathTransY */
|
||||
leaf f32_matrix_translate_y_axis
|
||||
leaf mtxf_translate_y
|
||||
/* 70A30 8006FE30 44858000 */ mtc1 $a1, $f16
|
||||
/* 70A34 8006FE34 C4800010 */ lwc1 $f0, 0x10($a0)
|
||||
/* 70A38 8006FE38 C4840014 */ lwc1 $f4, 0x14($a0)
|
||||
@@ -713,10 +713,10 @@ leaf f32_matrix_translate_y_axis
|
||||
/* 70A68 8006FE68 E4840034 */ swc1 $f4, 0x34($a0)
|
||||
/* 70A6C 8006FE6C 03E00008 */ jr $ra
|
||||
/* 70A70 8006FE70 E4880038 */ swc1 $f8, 0x38($a0)
|
||||
.end f32_matrix_translate_y_axis
|
||||
.end mtxf_translate_y
|
||||
|
||||
/* Official Name: mathRpyXyzMtx */
|
||||
leaf object_inverse_transform_to_matrix
|
||||
leaf mtxf_from_inverse_transform
|
||||
/* 70A74 8006FE74 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70A78 8006FE78 3C013780 */ lui $at, (0x37800000 >> 16)
|
||||
/* 70A7C 8006FE7C FFBF0000 */ sd $ra, 0x0($sp)
|
||||
@@ -838,7 +838,7 @@ leaf object_inverse_transform_to_matrix
|
||||
/* 70C4C 8007004C 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 70C50 80070050 03E00008 */ jr $ra
|
||||
/* 70C54 80070054 00000000 */ nop
|
||||
.end object_inverse_transform_to_matrix
|
||||
.end mtxf_from_inverse_transform
|
||||
|
||||
leaf func_80070058
|
||||
/* 70C58 80070058 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
@@ -897,7 +897,7 @@ leaf func_80070058
|
||||
/* 70D2C 8007012C 00000000 */ nop
|
||||
.end func_80070058
|
||||
|
||||
leaf f32_matrix_from_rotation_and_scale
|
||||
leaf mtxf_billboard
|
||||
/* 70D30 80070130 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70D34 80070134 00E0C825 */ or $t9, $a3, $zero
|
||||
/* 70D38 80070138 3C013780 */ lui $at, (0x37800000 >> 16)
|
||||
@@ -943,9 +943,9 @@ leaf f32_matrix_from_rotation_and_scale
|
||||
/* 70DD8 800701D8 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 70DDC 800701DC 03E00008 */ jr $ra
|
||||
/* 70DE0 800701E0 00000000 */ nop
|
||||
.end f32_matrix_from_rotation_and_scale
|
||||
.end mtxf_billboard
|
||||
|
||||
leaf s16_vec3_apply_object_rotation
|
||||
leaf vec3s_rotate_rpy
|
||||
/* 70DE4 800701E4 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70DE8 800701E8 FFBF0000 */ sd $ra, 0x0($sp)
|
||||
/* 70DEC 800701EC 00803025 */ or $a2, $a0, $zero
|
||||
@@ -1025,10 +1025,10 @@ leaf s16_vec3_apply_object_rotation
|
||||
/* 70F14 80070314 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 70F18 80070318 03E00008 */ jr $ra
|
||||
/* 70F1C 8007031C 00000000 */ nop
|
||||
.end s16_vec3_apply_object_rotation
|
||||
.end vec3s_rotate_rpy
|
||||
|
||||
/* Official Name: mathOneFloatRPY */
|
||||
leaf f32_vec3_apply_object_rotation
|
||||
leaf vec3f_rotate
|
||||
/* 70F20 80070320 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70F24 80070324 FFBF0000 */ sd $ra, 0x0($sp)
|
||||
/* 70F28 80070328 00803025 */ or $a2, $a0, $zero
|
||||
@@ -1075,10 +1075,10 @@ leaf f32_vec3_apply_object_rotation
|
||||
/* 70FCC 800703CC 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 70FD0 800703D0 03E00008 */ jr $ra
|
||||
/* 70FD4 800703D4 00000000 */ nop
|
||||
.end f32_vec3_apply_object_rotation
|
||||
.end vec3f_rotate
|
||||
|
||||
/* Official Name: mathOneFloatYPR */
|
||||
leaf f32_vec3_apply_object_rotation2
|
||||
leaf vec3f_rotate_ypr
|
||||
/* 70FD8 800703D8 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 70FDC 800703DC FFBF0000 */ sd $ra, 0x0($sp)
|
||||
/* 70FE0 800703E0 00803025 */ or $a2, $a0, $zero
|
||||
@@ -1125,10 +1125,10 @@ leaf f32_vec3_apply_object_rotation2
|
||||
/* 71084 80070484 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 71088 80070488 03E00008 */ jr $ra
|
||||
/* 7108C 8007048C 00000000 */ nop
|
||||
.end f32_vec3_apply_object_rotation2
|
||||
.end vec3f_rotate_ypr
|
||||
|
||||
/* Official Name: mathOneFloatPY */
|
||||
leaf f32_vec3_apply_object_rotation3
|
||||
leaf vec3f_rotate_py
|
||||
/* 71090 80070490 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
/* 71094 80070494 FFBF0000 */ sd $ra, 0x0($sp)
|
||||
/* 71098 80070498 00803025 */ or $a2, $a0, $zero
|
||||
@@ -1153,10 +1153,10 @@ leaf f32_vec3_apply_object_rotation3
|
||||
/* 710E4 800704E4 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 710E8 800704E8 03E00008 */ jr $ra
|
||||
/* 710EC 800704EC 00000000 */ nop
|
||||
.end f32_vec3_apply_object_rotation3
|
||||
.end vec3f_rotate_py
|
||||
|
||||
/* Official Name: mathXZInTri */
|
||||
leaf point_triangle_2d_xz_intersection
|
||||
leaf tri2d_xz_contains_point
|
||||
/* 710F0 800704F0 8FAE0010 */ lw $t6, 0x10($sp)
|
||||
/* 710F4 800704F4 84C80000 */ lh $t0, 0x0($a2)
|
||||
/* 710F8 800704F8 84C90004 */ lh $t1, 0x4($a2)
|
||||
@@ -1227,10 +1227,10 @@ leaf point_triangle_2d_xz_intersection
|
||||
.L800705F0:
|
||||
/* 711F0 800705F0 03E00008 */ jr $ra
|
||||
/* 711F4 800705F4 00000000 */ nop
|
||||
.end point_triangle_2d_xz_intersection
|
||||
.end tri2d_xz_contains_point
|
||||
|
||||
/* Official Name: mathTranslateMtx */
|
||||
leaf f32_matrix_from_position
|
||||
leaf mtxf_from_translation
|
||||
/* 711F8 800705F8 00804025 */ or $t0, $a0, $zero
|
||||
/* 711FC 800705FC 25090040 */ addiu $t1, $t0, 0x40
|
||||
.L80070600:
|
||||
@@ -1248,10 +1248,10 @@ leaf f32_matrix_from_position
|
||||
/* 7122C 8007062C AC860034 */ sw $a2, 0x34($a0)
|
||||
/* 71230 80070630 03E00008 */ jr $ra
|
||||
/* 71234 80070634 AC870038 */ sw $a3, 0x38($a0)
|
||||
.end f32_matrix_from_position
|
||||
.end mtxf_from_translation
|
||||
|
||||
/* Official Name: mathScaleMtx */
|
||||
leaf f32_matrix_from_scale
|
||||
leaf mtxf_from_scale
|
||||
/* 71238 80070638 00804025 */ or $t0, $a0, $zero
|
||||
/* 7123C 8007063C 25090040 */ addiu $t1, $t0, 0x40
|
||||
.L80070640:
|
||||
@@ -1266,7 +1266,7 @@ leaf f32_matrix_from_scale
|
||||
/* 71260 80070660 AC860014 */ sw $a2, 0x14($a0)
|
||||
/* 71264 80070664 03E00008 */ jr $ra
|
||||
/* 71268 80070668 AC870028 */ sw $a3, 0x28($a0)
|
||||
.end f32_matrix_from_scale
|
||||
.end mtxf_from_scale
|
||||
|
||||
leaf atan2s
|
||||
/* 7126C 8007066C 00854025 */ or $t0, $a0, $a1
|
||||
@@ -1352,7 +1352,7 @@ leaf arctan2_f
|
||||
/* 7137C 8007077C 00000000 */ nop
|
||||
.end arctan2_f
|
||||
|
||||
leaf s32_matrix_cell_sqrt
|
||||
leaf fix32_sqrt
|
||||
/* 71380 80070780 44840000 */ mtc1 $a0, $f0
|
||||
/* 71384 80070784 3C014780 */ lui $at, (0x47800000 >> 16)
|
||||
/* 71388 80070788 44811000 */ mtc1 $at, $f2
|
||||
@@ -1364,7 +1364,7 @@ leaf s32_matrix_cell_sqrt
|
||||
/* 713A0 800707A0 44020000 */ mfc1 $v0, $f0
|
||||
/* 713A4 800707A4 03E00008 */ jr $ra
|
||||
/* 713A8 800707A8 00000000 */ nop
|
||||
.end s32_matrix_cell_sqrt
|
||||
.end fix32_sqrt
|
||||
|
||||
leaf bad_int_sqrt
|
||||
/* 713AC 800707AC 44840000 */ mtc1 $a0, $f0
|
||||
|
||||
@@ -138,7 +138,7 @@ leaf calc_dynamic_lighting_for_object_2
|
||||
/* 253BC 800247BC 00000000 */ nop
|
||||
/* 253C0 800247C0 27A50010 */ addiu $a1, $sp, 0x10
|
||||
/* 253C4 800247C4 00402025 */ or $a0, $v0, $zero
|
||||
/* 253C8 800247C8 0C01BDBB */ jal f32_matrix_dot
|
||||
/* 253C8 800247C8 0C01BDBB */ jal mtxf_transform_dir
|
||||
/* 253CC 800247CC 00A03025 */ or $a2, $a1, $zero
|
||||
.L800247D0:
|
||||
/* 253D0 800247D0 86080000 */ lh $t0, 0x0($s0)
|
||||
@@ -158,11 +158,11 @@ leaf calc_dynamic_lighting_for_object_2
|
||||
/* 25408 80024808 A70A0004 */ sh $t2, 0x4($t8)
|
||||
/* 2540C 8002480C AF030010 */ sw $v1, 0x10($t8)
|
||||
/* 25410 80024810 AF030014 */ sw $v1, 0x14($t8)
|
||||
/* 25414 80024814 0C01BF9D */ jal object_inverse_transform_to_matrix
|
||||
/* 25414 80024814 0C01BF9D */ jal mtxf_from_inverse_transform
|
||||
/* 25418 80024818 03002825 */ or $a1, $t8, $zero
|
||||
/* 2541C 8002481C 27A50010 */ addiu $a1, $sp, 0x10
|
||||
/* 25420 80024820 27A40034 */ addiu $a0, $sp, 0x34
|
||||
/* 25424 80024824 0C01BDBB */ jal f32_matrix_dot
|
||||
/* 25424 80024824 0C01BDBB */ jal mtxf_transform_dir
|
||||
/* 25428 80024828 00A03025 */ or $a2, $a1, $zero
|
||||
/* 2542C 8002482C 8E190054 */ lw $t9, 0x54($s0)
|
||||
/* 25430 80024830 44933000 */ mtc1 $s3, $f6
|
||||
|
||||
+9
-9
@@ -273,7 +273,7 @@ void func_80032424(ObjectLight *light, s32 updateRate) {
|
||||
light->pos.x = light->homeX;
|
||||
light->pos.y = light->homeY;
|
||||
light->pos.z = light->homeZ;
|
||||
f32_vec3_apply_object_rotation(&light->owner->segment.trans, (f32 *) &light->pos);
|
||||
vec3f_rotate(&light->owner->segment.trans.rotation, &light->pos);
|
||||
light->pos.x += light->owner->segment.trans.x_position;
|
||||
light->pos.y += light->owner->segment.trans.y_position;
|
||||
light->pos.z += light->owner->segment.trans.z_position;
|
||||
@@ -385,17 +385,17 @@ void func_80032424(ObjectLight *light, s32 updateRate) {
|
||||
light->unk5A = light->pos.z + light->radius;
|
||||
}
|
||||
if (light->unk1 == 2) {
|
||||
light->unk84 = -1.0f;
|
||||
light->unk7C.z = -1.0f;
|
||||
rotation.y_rotation = light->unk70;
|
||||
rotation.x_rotation = light->unk72;
|
||||
rotation.z_rotation = 0;
|
||||
f32_vec3_apply_object_rotation3(&rotation, &light->unk7C);
|
||||
vec3f_rotate_py(&rotation, &light->unk7C);
|
||||
if (light->owner != NULL) {
|
||||
f32_vec3_apply_object_rotation(&light->owner->segment.trans, &light->unk7C);
|
||||
vec3f_rotate(&light->owner->segment.trans.rotation, &light->unk7C);
|
||||
}
|
||||
light->unk7C = -light->unk7C;
|
||||
light->unk80 = -light->unk80;
|
||||
light->unk84 = -light->unk84;
|
||||
light->unk7C.x = -light->unk7C.x;
|
||||
light->unk7C.y = -light->unk7C.y;
|
||||
light->unk7C.z = -light->unk7C.z;
|
||||
}
|
||||
light->unk5 = 0;
|
||||
}
|
||||
@@ -662,8 +662,8 @@ f32 light_direction_calc(ObjectLight *light) {
|
||||
distance = gLightDistance;
|
||||
if (distance > 0.0f) {
|
||||
mag = 1.0f / sqrtf(distance);
|
||||
distance = (gLightDiffX * mag * light->unk7C) + (gLightDiffY * mag * light->unk80) +
|
||||
(gLightDiffZ * mag * light->unk84);
|
||||
distance = (gLightDiffX * mag * light->unk7C.x) + (gLightDiffY * mag * light->unk7C.y) +
|
||||
(gLightDiffZ * mag * light->unk7C.z);
|
||||
if (distance < 0.0f) {
|
||||
distance = 0.0f;
|
||||
}
|
||||
|
||||
+1
-3
@@ -78,9 +78,7 @@ typedef struct ObjectLight {
|
||||
s16 unk76;
|
||||
u16 unk78;
|
||||
u16 unk7A;
|
||||
f32 unk7C; // Think this might be scale.
|
||||
f32 unk80; // Ditto.
|
||||
f32 unk84; // The evolved form of ditto.
|
||||
Vec3f unk7C; // Think this might be scale.
|
||||
} ObjectLight;
|
||||
|
||||
/* Size: 0x14 bytes */
|
||||
|
||||
+26
-20
@@ -5,6 +5,12 @@
|
||||
#include "structs.h"
|
||||
#include "memory.h"
|
||||
|
||||
typedef struct RPYAngles {
|
||||
s16 z_rotation;
|
||||
s16 x_rotation;
|
||||
s16 y_rotation;
|
||||
} RPYAngles;
|
||||
|
||||
/**
|
||||
* Keeps the value within the range.
|
||||
*/
|
||||
@@ -36,26 +42,26 @@ void set_rng_seed(s32 num);
|
||||
void save_rng_seed(void);
|
||||
void load_rng_seed(void);
|
||||
s32 get_rng_seed(void);
|
||||
s32 get_random_number_from_range(s32, s32);
|
||||
void f32_matrix_to_s32_matrix(Matrix *input, MatrixS *output);
|
||||
void guMtxXFMF(float mf[4][4], float x, float y, float z, float *ox, float *oy, float *oz);
|
||||
void f32_matrix_dot(Matrix *mat1, Matrix *mat2, Matrix *output);
|
||||
void f32_matrix_mult(Matrix *mat1, Matrix *mat2, Matrix *output);
|
||||
void f32_matrix_to_s16_matrix(Matrix *input, MatrixS *output);
|
||||
void s16_matrix_rotate(Vec3s *arg0, Vec3s *arg1);
|
||||
void s16_vec3_mult_by_s32_matrix(MatrixS input, Vec3s *output);
|
||||
void object_transform_to_matrix(Matrix mtx, ObjectTransform *trans);
|
||||
void f32_matrix_scale_y_axis(Matrix *input, f32 scale);
|
||||
void f32_matrix_translate_y_axis(Matrix *input, f32 offset);
|
||||
void object_inverse_transform_to_matrix(Matrix mtx, ObjectTransform *trans);
|
||||
void f32_matrix_from_rotation_and_scale(Matrix mtx, s32 angle, f32 scale, f32 scaleY);
|
||||
void s16_vec3_apply_object_rotation(ObjectTransform *trans, s16 *vec3Arg);
|
||||
void f32_vec3_apply_object_rotation(ObjectTransform *trans, f32 *vec3_f32);
|
||||
void f32_vec3_apply_object_rotation2(Vec3s *trans, f32 *arg1);
|
||||
void f32_vec3_apply_object_rotation3(Vec3s *trans, f32 *vec3_f32);
|
||||
s32 point_triangle_2d_xz_intersection(s32 x, s32 z, s16 *vec3A, s16 *vec3B, s16 *vec3C);
|
||||
void f32_matrix_from_position(Matrix *mtx, f32 x, f32 y, f32 z);
|
||||
void f32_matrix_from_scale(Matrix, f32, f32, f32);
|
||||
s32 rand_range(s32, s32);
|
||||
void mtxf_to_mtxs(MtxF *mf, MtxS *mi);
|
||||
void mtxf_transform_point(MtxF *mf, float x, float y, float z, float *ox, float *oy, float *oz);
|
||||
void mtxf_transform_dir(MtxF *mf, Vec3f *in, Vec3f *out);
|
||||
void mtxf_mul(MtxF *mat1, MtxF *mat2, MtxF *output);
|
||||
void mtxf_to_mtx(MtxF *input, Mtx *output);
|
||||
void vec3s_reflect(Vec3s *vec, Vec3s *n);
|
||||
void mtxs_transform_dir(MtxS *input, Vec3s *output);
|
||||
void mtxf_from_transform(MtxF *mtx, ObjectTransform *trans);
|
||||
void mtxf_scale_y(MtxF *input, f32 scale);
|
||||
void mtxf_translate_y(MtxF *input, f32 offset);
|
||||
void mtxf_from_inverse_transform(MtxF *mtx, ObjectTransform *trans);
|
||||
void mtxf_billboard(MtxF *mtx, s32 angle, f32 scale, f32 scaleY);
|
||||
void vec3s_rotate_rpy(RPYAngles *rotation, Vec3s *vec3Arg);
|
||||
void vec3f_rotate(Vec3s *rotation, Vec3f *vec);
|
||||
void vec3f_rotate_ypr(Vec3s *rotation, Vec3f *vec);
|
||||
void vec3f_rotate_py(Vec3s *rotation, Vec3f *vec);
|
||||
s32 tri2d_xz_contains_point(s32 x, s32 z, Vec3s *vec3A, Vec3s *vec3B, Vec3s *vec3C);
|
||||
void mtxf_from_translation(MtxF *mtx, f32 x, f32 y, f32 z);
|
||||
void mtxf_from_scale(MtxF *mtx, f32 scaleX, f32 scaleY, f32 scaleZ);
|
||||
s32 atan2s(s32 xDelta, s32 zDelta);
|
||||
f32 area_triangle_2d(f32 x0, f32 z0, f32 x1, f32 z1, f32 x2, f32 z2);
|
||||
void dmacopy_doubleword(void *src, void *dst, s32 end);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user