mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Match func_80083098 + minor cleanups across codebase (#581)
* make Camera struct * wip * wip * fix gSPMatrix args * gfx macros renamed * wip * document matrix functions * match func_80083098 * update score and format * JP version not matched * build OK * PR suggestions
This commit is contained in:
@@ -5,9 +5,9 @@ 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 18, 2025, this is our current score:
|
||||
As of May 19, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 87.92%
|
||||
    Decomp progress: 88.06%
|
||||
|
||||
    Documentation progress: 56.98%
|
||||
<!-- README_SCORE_SUMMARY_END -->
|
||||
@@ -117,14 +117,14 @@ s32 is_drumstick_unlocked(void) {
|
||||
```
|
||||
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of May 18, 2025, this is our current score:
|
||||
As of May 19, 2025, this is our current score:
|
||||
```
|
||||
=====================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
--------------- 87.92% Complete (89.02% NON_MATCHING) ---------------
|
||||
# Decompiled functions: 1897
|
||||
# GLOBAL_ASM remaining: 54
|
||||
# NON_MATCHING functions: 6
|
||||
--------------- 88.06% Complete (89.02% NON_MATCHING) ---------------
|
||||
# Decompiled functions: 1898
|
||||
# GLOBAL_ASM remaining: 53
|
||||
# NON_MATCHING functions: 5
|
||||
# NON_EQUIVALENT WIP functions: 16
|
||||
---------------------------- Game Status ----------------------------
|
||||
Balloons: 41/47, Keys: 4/4, Trophies: 4/5
|
||||
|
||||
+10
-69
@@ -148,6 +148,12 @@
|
||||
#define G_SETGEOMETRYMODE (G_IMMFIRST-8)
|
||||
#define G_CLEARGEOMETRYMODE (G_IMMFIRST-9)
|
||||
#define G_LINE3D (G_IMMFIRST-10)
|
||||
#ifdef F3D_OLD
|
||||
#define G_PERSPNORM (G_IMMFIRST-11)
|
||||
#define G_RDPHALF_1 (G_IMMFIRST-12)
|
||||
#define G_RDPHALF_2 (G_IMMFIRST-13)
|
||||
#define G_RDPHALF_CONT (G_IMMFIRST-14)
|
||||
#else
|
||||
#define G_RDPHALF_1 (G_IMMFIRST-11)
|
||||
#define G_RDPHALF_2 (G_IMMFIRST-12)
|
||||
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI))
|
||||
@@ -158,6 +164,7 @@
|
||||
#else
|
||||
# define G_RDPHALF_CONT (G_IMMFIRST-13)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* We are overloading 2 of the immediate commands
|
||||
to keep the byte alignment of dmem the same */
|
||||
@@ -2798,12 +2805,12 @@ typedef union {
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_RDPHALF_1, 24, 8); \
|
||||
_g->words.w0 = _SHIFTL(G_PERSPNORM, 24, 8); \
|
||||
_g->words.w1 = (s); \
|
||||
}
|
||||
#define gsSPPerspNormalize(s) \
|
||||
{{ \
|
||||
_SHIFTL(G_RDPHALF_1, 24, 8), \
|
||||
_SHIFTL(G_PERSPNORM, 24, 8), \
|
||||
(s) \
|
||||
}}
|
||||
#else
|
||||
@@ -4493,72 +4500,6 @@ typedef union {
|
||||
_g->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
|
||||
}
|
||||
|
||||
#ifdef F3D_OLD
|
||||
#define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | \
|
||||
_SHIFTL(yh, 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \
|
||||
_SHIFTL(yl, 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)));\
|
||||
}
|
||||
|
||||
#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
/* like gSPTextureRectangle but accepts negative position arguments */
|
||||
# define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \
|
||||
_SHIFTL(MAX((s16)(xh),0), 12, 12) | \
|
||||
_SHIFTL(MAX((s16)(yh),0), 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL((tile), 24, 3) | \
|
||||
_SHIFTL(MAX((s16)(xl),0), 12, 12) | \
|
||||
_SHIFTL(MAX((s16)(yl),0), 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, \
|
||||
(_SHIFTL(((s) - \
|
||||
(((s16)(xl) < 0) ? \
|
||||
(((s16)(dsdx) < 0) ? \
|
||||
(MAX((((s16)(xl)*(s16)(dsdx))>>7),0)) : \
|
||||
(MIN((((s16)(xl)*(s16)(dsdx))>>7),0))) : 0)), \
|
||||
16, 16) | \
|
||||
_SHIFTL(((t) - \
|
||||
(((yl) < 0) ? \
|
||||
(((s16)(dtdy) < 0) ? \
|
||||
(MAX((((s16)(yl)*(s16)(dtdy))>>7),0)) : \
|
||||
(MIN((((s16)(yl)*(s16)(dtdy))>>7),0))) : 0)), \
|
||||
0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL((dsdx), 16, 16) | \
|
||||
_SHIFTL((dtdy), 0, 16))); \
|
||||
}
|
||||
|
||||
# define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \
|
||||
_SHIFTL(yh, 0, 12)), \
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
# define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) |\
|
||||
_SHIFTL(yh, 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \
|
||||
_SHIFTL(yl, 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \
|
||||
}
|
||||
#else
|
||||
#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
@@ -4623,7 +4564,7 @@ typedef union {
|
||||
gImmp1(pkt, G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define gsDPWord(wordhi, wordlo) \
|
||||
gsImmp1(G_RDPHALF_1, (unsigned int)(wordhi)), \
|
||||
gsImmp1(G_RDPHALF_2, (unsigned int)(wordlo))
|
||||
|
||||
+9
-7
@@ -77,14 +77,11 @@
|
||||
|
||||
#define G_TRIN 5
|
||||
#define G_DMADL 7
|
||||
#define G_MTX_DKR_INDEX_0 0x00
|
||||
#define G_MTX_DKR_INDEX_1 0x40
|
||||
#define G_MTX_DKR_INDEX_2 0x80
|
||||
#define G_MTX_DKR_INDEX_0 0
|
||||
#define G_MTX_DKR_INDEX_1 1
|
||||
#define G_MTX_DKR_INDEX_2 2
|
||||
#define G_MW_BILLBOARD 0x02 //0x01 = billboarding enabled, 0x00 = disabled
|
||||
#define G_MW_MVMATRIX 0x0A //Specifies the index of the modelview matrix.
|
||||
|
||||
#define gDkrInsertMatrix(pkt, where, num) \
|
||||
gMoveWd(pkt, G_MW_MVMATRIX, where, num)
|
||||
#define G_MW_MVPMATRIX 0x0A //Specifies the index of the mvp matrix.
|
||||
|
||||
#define gDkrEnableBillboard(pkt) \
|
||||
gMoveWd(pkt, G_MW_BILLBOARD, 0, 1)
|
||||
@@ -95,6 +92,11 @@
|
||||
#define gSPVertexDKR(pkt, v, n, v0) \
|
||||
gDma1p(pkt, G_VTX, v, (((n) * 8 + (n)) << 1) + 8, ((n)-1)<<3|(((u32)(v) & 6))|(v0))
|
||||
|
||||
#define gSPMatrixDKR(pkt, m, i) \
|
||||
gSPMatrix(pkt, m, (i) << 6)
|
||||
#define gSPSelectMatrixDKR(pkt, num) \
|
||||
gMoveWd(pkt, G_MW_MVPMATRIX, 0, (num) << 6)
|
||||
|
||||
#define TRIN_DISABLE_TEXTURE 0
|
||||
#define TRIN_ENABLE_TEXTURE 1
|
||||
|
||||
|
||||
+2
-14
@@ -1772,22 +1772,13 @@ typedef struct SegmentPropertiesObject {
|
||||
/* 0x002C */ s16 unk2C;
|
||||
/* 0x002E */ s16 segmentID;
|
||||
/* 0x0030 */ f32 distanceToCamera;
|
||||
/* 0x0034 */ s16 cameraSegmentID;
|
||||
/* 0x0036 */ s16 unk36;
|
||||
/* 0x0034 */ f32 unk34;
|
||||
/* 0x0038 */ s8 unk38;
|
||||
/* 0x0039 */ u8 opacity;
|
||||
/* 0x003A */ s8 modelIndex;
|
||||
/* 0x003B */ s8 animationID;
|
||||
} SegmentPropertiesObject;
|
||||
|
||||
typedef struct SegmentPropertiesCamera {
|
||||
/* 0x002C */ f32 unk2C;
|
||||
/* 0x0030 */ f32 distanceToCamera;
|
||||
/* 0x0034 */ f32 unk34;
|
||||
/* 0x0038 */ s16 unk38;
|
||||
/* 0x003A */ s16 unk3A;
|
||||
} SegmentPropertiesCamera;
|
||||
|
||||
/* Size: 0x44 bytes */
|
||||
typedef struct ObjectSegment {
|
||||
/* 0x0000 */ ObjectTransform trans;
|
||||
@@ -1797,10 +1788,7 @@ typedef struct ObjectSegment {
|
||||
/* 0x0020 */ f32 y_velocity;
|
||||
/* 0x0024 */ f32 z_velocity;
|
||||
/* 0x0028 */ f32 unk28;
|
||||
union {
|
||||
SegmentPropertiesObject object;
|
||||
SegmentPropertiesCamera camera;
|
||||
};
|
||||
/* 0x002C */ SegmentPropertiesObject object;
|
||||
/* 0x003C */ LevelObjectEntry* level_entry;
|
||||
/* 0x0040 */ ObjectHeader *header;
|
||||
} ObjectSegment;
|
||||
|
||||
+4
-4
@@ -158,7 +158,7 @@ void audspat_reset(void) {
|
||||
* Official Name: amPlayAudioMap
|
||||
*/
|
||||
void audspat_update_all(Object **objList, s32 numObjects, s32 updateRate) {
|
||||
s32 viewportCount;
|
||||
s32 viewportLayout;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
@@ -182,7 +182,7 @@ void audspat_update_all(Object **objList, s32 numObjects, s32 updateRate) {
|
||||
s32 inverseDistances[29];
|
||||
s32 sumOfDistances;
|
||||
s32 numCameras;
|
||||
ObjectSegment *cameras;
|
||||
Camera *cameras;
|
||||
f32 pitch1;
|
||||
f32 temp;
|
||||
f32 minDistance;
|
||||
@@ -192,8 +192,8 @@ void audspat_update_all(Object **objList, s32 numObjects, s32 updateRate) {
|
||||
f32 pitch3;
|
||||
|
||||
jingleVolume = 0;
|
||||
viewportCount = get_viewport_count();
|
||||
numCameras = set_active_viewports_and_max(viewportCount);
|
||||
viewportLayout = cam_get_viewport_layout();
|
||||
numCameras = cam_set_layout(viewportLayout);
|
||||
cameras = get_cutscene_camera_segment();
|
||||
|
||||
// Update audio points
|
||||
|
||||
+3
-2
@@ -6,6 +6,7 @@
|
||||
#include "structs.h"
|
||||
#include "PR/gbi.h"
|
||||
#include "PR/libaudio.h"
|
||||
#include "camera.h"
|
||||
|
||||
#define AUDIO_LINE_TYPE_SOUND 0
|
||||
#define AUDIO_LINE_TYPE_JINGLE 1
|
||||
@@ -68,7 +69,7 @@ void audspat_line_add_vertex(u8 type, u16 soundBite, f32 x, f32 y, f32 z, u8 arg
|
||||
u8 argA, u8 lineID, u8 vertexIndex);
|
||||
s32 audspat_line_validate(u8 lineID);
|
||||
void audspat_debug_render_line(Gfx **dList, Vertex **verts, Triangle **tris, f32 coords[6], u8 red, u8 green, u8 blue);
|
||||
void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 updateRate);
|
||||
void func_80006BFC(Object *obj, Camera *camera, Object *obj2, s32 updateRate);
|
||||
void audspat_point_set_position(AudioPoint *audioPoint, f32 x, f32 y, f32 z);
|
||||
s32 audspat_reverb_validate(u8 reverbLineID);
|
||||
void audspat_init(void);
|
||||
@@ -78,7 +79,7 @@ void audspat_calculate_echo(SoundHandle soundHandle, f32 x, f32 y, f32 z);
|
||||
s32 audspat_distance_to_segment(f32 inX, f32 inY, f32 inZ, f32 coords[6], f32 *outX, f32 *outY, f32 *outZ);
|
||||
void audspat_reset(void);
|
||||
void audspat_update_all(Object **objList, s32 numObjects, s32 updateRate); // Non Matching
|
||||
void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3, s32 updateRate); // Non Matching
|
||||
void func_80006FC8(Object **objs, s32 numRacers, Camera *segment, u8 arg3, s32 updateRate); // Non Matching
|
||||
u8 audspat_reverb_get_strength_at_point(ReverbLine *, f32, f32, f32);
|
||||
|
||||
#endif
|
||||
|
||||
+16
-16
@@ -546,7 +546,7 @@ void racer_sound_free(Object *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 updateRate) {
|
||||
void func_80006BFC(Object *obj, Camera *camera, Object *obj2, s32 updateRate) {
|
||||
Object_Racer *racer;
|
||||
f32 velocity;
|
||||
f32 xPos;
|
||||
@@ -565,10 +565,10 @@ void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 update
|
||||
racer2 = &obj2->unk64->racer;
|
||||
gRacerSound = (VehicleSoundData *) racer2->vehicleSound;
|
||||
if (gRacerSound != NULL) {
|
||||
if (segment != NULL) {
|
||||
xPos = segment[racer->playerIndex].trans.x_position;
|
||||
yPos = segment[racer->playerIndex].trans.y_position;
|
||||
zPos = segment[racer->playerIndex].trans.z_position;
|
||||
if (camera != NULL) {
|
||||
xPos = camera[racer->playerIndex].trans.x_position;
|
||||
yPos = camera[racer->playerIndex].trans.y_position;
|
||||
zPos = camera[racer->playerIndex].trans.z_position;
|
||||
sp1C = 1.0f;
|
||||
} else {
|
||||
xPos = obj->segment.trans.x_position;
|
||||
@@ -622,7 +622,7 @@ void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 update
|
||||
}
|
||||
}
|
||||
|
||||
void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3, s32 updateRate) {
|
||||
void func_80006FC8(Object **objs, s32 numRacers, Camera *camera, u8 arg3, s32 updateRate) {
|
||||
f32 tempxPos;
|
||||
f32 tempyPos;
|
||||
f32 tempzPos;
|
||||
@@ -652,17 +652,17 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
|
||||
if (gRacerSound != NULL && gRacerSound->unk0[0] != 0) {
|
||||
if (racer->raceFinished || check_if_showing_cutscene_camera()) {
|
||||
tempxPos = objs[loopCount1]->segment.trans.x_position - segment[loopCount1].trans.x_position;
|
||||
tempyPos = objs[loopCount1]->segment.trans.y_position - segment[loopCount1].trans.y_position;
|
||||
tempzPos = objs[loopCount1]->segment.trans.z_position - segment[loopCount1].trans.z_position;
|
||||
func_80006BFC(objs[loopCount1], segment, objs[loopCount1], updateRate);
|
||||
tempxPos = objs[loopCount1]->segment.trans.x_position - camera[loopCount1].trans.x_position;
|
||||
tempyPos = objs[loopCount1]->segment.trans.y_position - camera[loopCount1].trans.y_position;
|
||||
tempzPos = objs[loopCount1]->segment.trans.z_position - camera[loopCount1].trans.z_position;
|
||||
func_80006BFC(objs[loopCount1], camera, objs[loopCount1], updateRate);
|
||||
gRacerSound->unk84 = sqrtf((tempxPos * tempxPos) + (tempyPos * tempyPos) + (tempzPos * tempzPos));
|
||||
if (gRacerSound->unk84 < 1500.0f) {
|
||||
var_f26 = 2250000.0f; //(1500.0f * 1500.0f)
|
||||
var_f26 = (var_f26 - (gRacerSound->unk84 * gRacerSound->unk84)) / var_f26;
|
||||
var_f26 *= var_f26;
|
||||
gRacerSound->unk91[0] = audspat_calculate_spatial_pan(
|
||||
tempxPos, tempzPos, segment[loopCount1].trans.rotation.y_rotation);
|
||||
tempxPos, tempzPos, camera[loopCount1].trans.rotation.y_rotation);
|
||||
} else {
|
||||
var_f26 = 0.0f;
|
||||
}
|
||||
@@ -760,9 +760,9 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
gRacerSound = objs[loopCount2]->unk64->racer.vehicleSound;
|
||||
if (gRacerSound != 0) {
|
||||
if (racer->raceFinished != 0) {
|
||||
tempxPos = objs[loopCount2]->segment.trans.x_position - segment[loopCount1].trans.x_position;
|
||||
tempyPos = objs[loopCount2]->segment.trans.y_position - segment[loopCount1].trans.y_position;
|
||||
tempzPos = objs[loopCount2]->segment.trans.z_position - segment[loopCount1].trans.z_position;
|
||||
tempxPos = objs[loopCount2]->segment.trans.x_position - camera[loopCount1].trans.x_position;
|
||||
tempyPos = objs[loopCount2]->segment.trans.y_position - camera[loopCount1].trans.y_position;
|
||||
tempzPos = objs[loopCount2]->segment.trans.z_position - camera[loopCount1].trans.z_position;
|
||||
} else {
|
||||
tempxPos =
|
||||
objs[loopCount2]->segment.trans.x_position - objs[loopCount1]->segment.trans.x_position;
|
||||
@@ -783,9 +783,9 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
if (gRacerSound->unk88 < v0) {
|
||||
gRacerSound->unk88 = v0;
|
||||
gRacerSound->unk91[0] =
|
||||
audspat_calculate_spatial_pan(tempxPos, tempzPos, segment->trans.rotation.y_rotation);
|
||||
audspat_calculate_spatial_pan(tempxPos, tempzPos, camera->trans.rotation.y_rotation);
|
||||
if (racer->raceFinished != 0) {
|
||||
func_80006BFC(objs[loopCount1], segment, objs[loopCount2], updateRate);
|
||||
func_80006BFC(objs[loopCount1], camera, objs[loopCount2], updateRate);
|
||||
} else {
|
||||
func_80006BFC(objs[loopCount1], NULL, objs[loopCount2], updateRate);
|
||||
}
|
||||
|
||||
+8
-8
@@ -27,20 +27,20 @@ void divider_draw(Gfx **dList) {
|
||||
yOffset = height / 128;
|
||||
gDPSetCycleType((*dList)++, G_CYC_FILL);
|
||||
gDPSetFillColor((*dList)++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1)); // Black fill color
|
||||
switch (get_viewport_count()) {
|
||||
case VIEWPORTS_COUNT_2_PLAYERS:
|
||||
switch (cam_get_viewport_layout()) {
|
||||
case VIEWPORT_LAYOUT_2_PLAYERS:
|
||||
// Draws a solid horizontal black line in the middle of the screen.
|
||||
y = (height >> 1) - yOffset;
|
||||
gDPFillRectangle((*dList)++, height * 0, y, width, y + yOffset);
|
||||
break;
|
||||
case VIEWPORTS_COUNT_3_PLAYERS:
|
||||
case VIEWPORT_LAYOUT_3_PLAYERS:
|
||||
levelHeader = get_current_level_header();
|
||||
// Draw black square in the bottom-right corner.
|
||||
if (hud_setting() || (levelHeader->race_type & RACETYPE_CHALLENGE)) {
|
||||
gDPFillRectangle((*dList)++, width >> 1, height >> 1, width, height);
|
||||
}
|
||||
// There is no break statement here. This is intentional.
|
||||
case VIEWPORTS_COUNT_4_PLAYERS:
|
||||
case VIEWPORT_LAYOUT_4_PLAYERS:
|
||||
x = (width >> 1) - xOffset;
|
||||
// Draws 2 black lines in the middle of the screen. One vertical, another horizontal.
|
||||
gDPFillRectangle((*dList)++, height * 0, (height >> 1) - yOffset, width,
|
||||
@@ -72,13 +72,13 @@ void divider_clear_coverage(Gfx **dList) {
|
||||
gDPSetCombineMode((*dList)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||
gDPSetRenderMode((*dList)++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetPrimColor((*dList)++, 0, 0, 0, 0, 0, 0);
|
||||
switch (get_viewport_count()) {
|
||||
case VIEWPORTS_COUNT_2_PLAYERS:
|
||||
switch (cam_get_viewport_layout()) {
|
||||
case VIEWPORT_LAYOUT_2_PLAYERS:
|
||||
tempY = (screenHeight / 2) - (height / 2);
|
||||
gDPFillRectangle((*dList)++, 0, tempY, screenWidth, tempY + height);
|
||||
break;
|
||||
case VIEWPORTS_COUNT_3_PLAYERS:
|
||||
case VIEWPORTS_COUNT_4_PLAYERS:
|
||||
case VIEWPORT_LAYOUT_3_PLAYERS:
|
||||
case VIEWPORT_LAYOUT_4_PLAYERS:
|
||||
tempY = (screenHeight / 2) - (height / 2);
|
||||
tempX = (screenWidth / 2) - (width / 2);
|
||||
gDPFillRectangle((*dList)++, 0, tempY, screenWidth, tempY + height);
|
||||
|
||||
+176
-182
File diff suppressed because it is too large
Load Diff
+37
-15
@@ -38,10 +38,10 @@
|
||||
#define VIEWPORT_AUTO 0x8000
|
||||
|
||||
enum ViewportCount {
|
||||
VIEWPORTS_COUNT_1_PLAYER,
|
||||
VIEWPORTS_COUNT_2_PLAYERS,
|
||||
VIEWPORTS_COUNT_3_PLAYERS,
|
||||
VIEWPORTS_COUNT_4_PLAYERS
|
||||
VIEWPORT_LAYOUT_1_PLAYER,
|
||||
VIEWPORT_LAYOUT_2_PLAYERS,
|
||||
VIEWPORT_LAYOUT_3_PLAYERS,
|
||||
VIEWPORT_LAYOUT_4_PLAYERS
|
||||
};
|
||||
|
||||
enum ViewPortFlags {
|
||||
@@ -54,6 +54,28 @@ enum ViewPortFlags {
|
||||
VIEWPORT_HEIGHT_CUSTOM = 0x0040
|
||||
};
|
||||
|
||||
/* Size: 0x44 bytes */
|
||||
typedef struct Camera {
|
||||
/* 0x0000 */ ObjectTransform trans;
|
||||
/* 0x0018 */ f32 cam_unk_18;
|
||||
/* 0x001C */ f32 boomLength;
|
||||
/* 0x0020 */ f32 cam_unk_20;
|
||||
/* 0x0024 */ f32 x_velocity;
|
||||
/* 0x0028 */ f32 y_velocity;
|
||||
/* 0x002C */ f32 z_velocity;
|
||||
/* 0x0030 */ f32 shakeMagnitude;
|
||||
/* 0x0034 */ s16 cameraSegmentID;
|
||||
/* 0x0036 */ s16 mode;
|
||||
/* 0x0038 */ s16 pitch;
|
||||
/* 0x003A */ s8 shakeTimer;
|
||||
/* 0x003B */ u8 zoom;
|
||||
/* 0x003C */ u8 unk3C;
|
||||
/* 0x003D */ u8 unk3D;
|
||||
/* 0x003E */ u8 unk3E;
|
||||
/* 0x003F */ u8 unk3F;
|
||||
/* 0x0040 */ ObjectHeader *header;
|
||||
} Camera;
|
||||
|
||||
/* Size: 0x34 bytes. */
|
||||
typedef struct ScreenViewport {
|
||||
/* 0x00 */ s32 x1;
|
||||
@@ -71,14 +93,14 @@ typedef struct ScreenViewport {
|
||||
/* 0x30 */ s32 flags;
|
||||
} ScreenViewport;
|
||||
|
||||
void func_80066060(s32 cameraID, s32 zoomLevel);
|
||||
void set_viewport_tv_type(s8 setting);
|
||||
void cam_set_zoom(s32 cameraID, s32 zoomLevel);
|
||||
void enable_pal_viewport_height_adjust(s8 setting);
|
||||
void func_800660C0(void);
|
||||
void func_800660D0(void);
|
||||
UNUSED f32 get_current_camera_fov(void);
|
||||
void update_camera_fov(f32 camFieldOfView);
|
||||
UNUSED f32 cam_get_fov(void);
|
||||
void cam_set_fov(f32 camFieldOfView);
|
||||
Matrix *matrix_get_model_s16(void);
|
||||
s32 get_viewport_count(void);
|
||||
s32 cam_get_viewport_layout(void);
|
||||
s32 get_current_viewport(void);
|
||||
void camera_init_tracks_menu(Gfx **dList, MatrixS **mtxS);
|
||||
f32 get_distance_to_active_camera(f32 xPos, f32 yPos, f32 zPos);
|
||||
@@ -86,7 +108,7 @@ void camera_reset(s32 xPos, s32 yPos, s32 zPos, s32 angleZ, s32 angleX, s32 angl
|
||||
void write_to_object_render_stack(s32 stackPos, f32 xPos, f32 yPos, f32 zPos, s16 arg4, s16 arg5, s16 arg6);
|
||||
void disable_cutscene_camera(void);
|
||||
s8 check_if_showing_cutscene_camera(void);
|
||||
s32 set_active_viewports_and_max(s32 num);
|
||||
s32 cam_set_layout(s32 layoutID);
|
||||
void set_active_camera(s32 num);
|
||||
void camEnableUserView(s32 viewPortIndex, s32 arg1);
|
||||
void camDisableUserView(s32 viewPortIndex, s32 arg1);
|
||||
@@ -103,9 +125,9 @@ void viewport_rsp_set(Gfx **dList, s32 width, s32 height, s32 posX, s32 posY);
|
||||
void viewport_reset(Gfx **dList);
|
||||
void matrix_world_origin(Gfx **dList, MatrixS **mtx);
|
||||
void sprite_anim_off(s32 setting);
|
||||
ObjectSegment *get_active_camera_segment_no_cutscenes(void);
|
||||
ObjectSegment *get_active_camera_segment(void);
|
||||
ObjectSegment *get_cutscene_camera_segment(void);
|
||||
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);
|
||||
@@ -115,13 +137,13 @@ 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 camera_push_model_mtx(Gfx **dList, MatrixS **mtx, ObjectTransform *trans, f32 scale, f32 scaleY);
|
||||
s32 cam_push_model_mtx(Gfx **dList, MatrixS **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 camera_init(void);
|
||||
void cam_init(void);
|
||||
void viewport_main(Gfx **dlist, MatrixS **mats);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -585,7 +585,7 @@ void load_level(s32 levelId, s32 numberOfPlayers, s32 entranceId, Vehicle vehicl
|
||||
(PulsatingLightData *) get_misc_asset((s32) gCurrentLevelHeader->pulseLightData);
|
||||
init_pulsating_light_data(gCurrentLevelHeader->pulseLightData);
|
||||
}
|
||||
update_camera_fov(gCurrentLevelHeader->cameraFOV);
|
||||
cam_set_fov(gCurrentLevelHeader->cameraFOV);
|
||||
bgdraw_primcolour(gCurrentLevelHeader->bgColorRed, gCurrentLevelHeader->bgColorGreen,
|
||||
gCurrentLevelHeader->bgColorBlue);
|
||||
video_delta_reset();
|
||||
|
||||
+22
-22
@@ -319,8 +319,8 @@ void hud_init(UNUSED s32 viewportCount) {
|
||||
s32 i;
|
||||
s32 playerCount;
|
||||
|
||||
gHUDNumPlayers = get_viewport_count();
|
||||
gNumActivePlayers = set_active_viewports_and_max(gHUDNumPlayers);
|
||||
gHUDNumPlayers = cam_get_viewport_layout();
|
||||
gNumActivePlayers = cam_set_layout(gHUDNumPlayers);
|
||||
gHudSettings = get_settings();
|
||||
gHudSilverCoinRace = check_if_silver_coin_race();
|
||||
gAssetHudElementIds = (s16 *) load_asset_section_from_rom(ASSET_HUD_ELEMENT_IDS);
|
||||
@@ -839,7 +839,7 @@ void hud_render_player(Gfx **dList, MatrixS **mtx, Vertex **vertexList, Object *
|
||||
sprite_anim_off(TRUE);
|
||||
if (is_in_time_trial()) {
|
||||
hud_time_trial_finish(racer, updateRate);
|
||||
} else if (get_viewport_count() == VIEWPORTS_COUNT_1_PLAYER && racer->finishPosition == 1) {
|
||||
} else if (cam_get_viewport_layout() == VIEWPORT_LAYOUT_1_PLAYER && racer->finishPosition == 1) {
|
||||
if (is_in_two_player_adventure()) {
|
||||
if (get_current_level_race_type() == RACETYPE_BOSS) {
|
||||
goto showFinishRace;
|
||||
@@ -1437,7 +1437,7 @@ void hud_main_hub(Object *obj, s32 updateRate) {
|
||||
Object_Racer *racer;
|
||||
HudElement *portrait;
|
||||
|
||||
if (get_viewport_count() == PLAYER_ONE) {
|
||||
if (cam_get_viewport_layout() == PLAYER_ONE) {
|
||||
racer = (Object_Racer *) obj->unk64;
|
||||
sprite_anim_off(TRUE);
|
||||
hud_balloons(racer);
|
||||
@@ -1936,7 +1936,7 @@ void hud_race_start(s32 countdown, s32 updateRate) {
|
||||
if (gCurrentHud->entry[HUD_RACE_START_GO].raceStartGo.musicStartTimer[gHudCurrentViewport] >= 60) {
|
||||
if (gRaceStartShowHudStep == 4) {
|
||||
// Mute background music in 3/4 player.
|
||||
if (get_viewport_count() > TWO_PLAYERS) {
|
||||
if (cam_get_viewport_layout() > TWO_PLAYERS) {
|
||||
music_play(SEQUENCE_NONE);
|
||||
} else {
|
||||
start_level_music(1.0f);
|
||||
@@ -1998,9 +1998,9 @@ void hud_bananas(Object_Racer *racer, s32 updateRate) {
|
||||
}
|
||||
if (prevSprite == 0) {
|
||||
sprite_opaque(TRUE);
|
||||
set_viewport_tv_type(OS_TV_TYPE_NTSC);
|
||||
enable_pal_viewport_height_adjust(TRUE);
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BANANA_COUNT_ICON_STATIC]);
|
||||
set_viewport_tv_type(OS_TV_TYPE_PAL);
|
||||
enable_pal_viewport_height_adjust(FALSE);
|
||||
sprite_opaque(FALSE);
|
||||
gCurrentHud->entry[HUD_BANANA_COUNT_ICON_SPIN].spriteOffset = prevSprite;
|
||||
if (gCurrentHud->entry[HUD_BANANA_COUNT_SPARKLE].bananaCountSparkle.sparkleCounter) {
|
||||
@@ -2014,18 +2014,18 @@ void hud_bananas(Object_Racer *racer, s32 updateRate) {
|
||||
gCurrentHud->entry[HUD_BANANA_COUNT_SPARKLE].spriteOffset++;
|
||||
}
|
||||
}
|
||||
set_viewport_tv_type(OS_TV_TYPE_NTSC);
|
||||
enable_pal_viewport_height_adjust(TRUE);
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BANANA_COUNT_SPARKLE]);
|
||||
set_viewport_tv_type(OS_TV_TYPE_PAL);
|
||||
enable_pal_viewport_height_adjust(FALSE);
|
||||
}
|
||||
} else {
|
||||
gCurrentHud->entry[HUD_BANANA_COUNT_ICON_SPIN].spriteOffset = prevSprite + 128;
|
||||
sprite_anim_off(FALSE);
|
||||
sprite_opaque(TRUE);
|
||||
set_viewport_tv_type(OS_TV_TYPE_NTSC);
|
||||
enable_pal_viewport_height_adjust(TRUE);
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BANANA_COUNT_ICON_SPIN]);
|
||||
sprite_opaque(FALSE);
|
||||
set_viewport_tv_type(OS_TV_TYPE_PAL);
|
||||
enable_pal_viewport_height_adjust(FALSE);
|
||||
sprite_anim_off(TRUE);
|
||||
gCurrentHud->entry[HUD_BANANA_COUNT_ICON_SPIN].spriteOffset -= 128;
|
||||
}
|
||||
@@ -2984,13 +2984,13 @@ void hud_balloons(UNUSED Object_Racer *racer) {
|
||||
gCurrentHud->entry[HUD_BALLOON_COUNT_NUMBER_1].spriteOffset = balloonCount % 10;
|
||||
}
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BALLOON_COUNT_NUMBER_1]);
|
||||
set_viewport_tv_type(OS_TV_TYPE_NTSC);
|
||||
enable_pal_viewport_height_adjust(TRUE);
|
||||
if (osTvType == OS_TV_TYPE_PAL) {
|
||||
sprite_opaque(TRUE);
|
||||
}
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BALLOON_COUNT_ICON]);
|
||||
sprite_opaque(FALSE);
|
||||
set_viewport_tv_type(OS_TV_TYPE_PAL);
|
||||
enable_pal_viewport_height_adjust(FALSE);
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_BALLOON_COUNT_X]);
|
||||
}
|
||||
|
||||
@@ -3034,7 +3034,7 @@ void hud_weapon(Object *obj, s32 updateRate) {
|
||||
|
||||
racer = (Object_Racer *) obj->unk64;
|
||||
if (racer->raceFinished == FALSE) {
|
||||
set_viewport_tv_type(OS_TV_TYPE_NTSC);
|
||||
enable_pal_viewport_height_adjust(TRUE);
|
||||
temp_a0 = (racer->balloon_type * 3) + (racer->balloon_level);
|
||||
if (gCurrentHud->entry[HUD_WEAPON_DISPLAY].weaponDisplay.prevLevel != racer->balloon_level) {
|
||||
if (racer->balloon_level == 0) {
|
||||
@@ -3109,7 +3109,7 @@ void hud_weapon(Object *obj, s32 updateRate) {
|
||||
}
|
||||
}
|
||||
gDPSetPrimColor(gHudDL++, 0, 0, 255, 255, 255, 255);
|
||||
set_viewport_tv_type(OS_TV_TYPE_PAL);
|
||||
enable_pal_viewport_height_adjust(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3347,7 +3347,7 @@ void hud_render_general(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 updateRate
|
||||
s32 sp144;
|
||||
s32 racerCount;
|
||||
UNUSED s32 pad2;
|
||||
ObjectSegment *someObjSeg;
|
||||
Camera *someObjSeg;
|
||||
Object **racerGroup;
|
||||
s32 spBC;
|
||||
s32 temp_s0_2;
|
||||
@@ -3606,7 +3606,7 @@ void hud_render_general(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 updateRate
|
||||
if (lvlMdl == NULL) {
|
||||
return;
|
||||
}
|
||||
someObjSeg = get_active_camera_segment();
|
||||
someObjSeg = cam_get_active_camera();
|
||||
sprite_anim_off(TRUE);
|
||||
minimap = (Sprite *) lvlMdl->minimapSpriteIndex;
|
||||
switch (gHUDNumPlayers) {
|
||||
@@ -3815,7 +3815,7 @@ void hud_element_render(Gfx **dList, MatrixS **mtx, Vertex **vtxList, HudElement
|
||||
TextureHeader **textureHeader3;
|
||||
TextureHeader *textureHeader2;
|
||||
TextureHeader *textureHeader;
|
||||
ObjectSegment *objSegment;
|
||||
Camera *camera;
|
||||
LevelObjectEntry_Hud objEntry;
|
||||
UNUSED s32 pad1;
|
||||
Object *tempObject;
|
||||
@@ -3954,11 +3954,11 @@ void hud_element_render(Gfx **dList, MatrixS **mtx, Vertex **vtxList, HudElement
|
||||
rendermode_reset(&gHudDL);
|
||||
}
|
||||
} else if (gAssetHudElementIds[spriteID] & ASSET_MASK_SPRITE) {
|
||||
objSegment = get_active_camera_segment();
|
||||
camera = cam_get_active_camera();
|
||||
sprite = gAssetHudElements->entry[hud->spriteID];
|
||||
hud->rotation.z -= objSegment->trans.rotation.z;
|
||||
hud->rotation.z -= camera->trans.rotation.z;
|
||||
render_ortho_triangle_image(&gHudDL, &gHudMtx, &gHudVtx, (ObjectSegment *) hud, sprite, 0);
|
||||
hud->rotation.z += objSegment->trans.rotation.z;
|
||||
hud->rotation.z += camera->trans.rotation.z;
|
||||
} else if (gAssetHudElementIds[spriteID] & ASSET_MASK_OBJECT) {
|
||||
tempObject = gAssetHudElements->entry[spriteID];
|
||||
tempObject->segment.trans.rotation.x = hud->rotation.x;
|
||||
@@ -3972,7 +3972,7 @@ void hud_element_render(Gfx **dList, MatrixS **mtx, Vertex **vtxList, HudElement
|
||||
tempObject->segment.object.opacity = 0xFF;
|
||||
render_object(&gHudDL, &gHudMtx, &gHudVtx, tempObject);
|
||||
} else {
|
||||
camera_push_model_mtx(&gHudDL, &gHudMtx, (ObjectTransform *) hud, 1.0f, 0.0f);
|
||||
cam_push_model_mtx(&gHudDL, &gHudMtx, (ObjectTransform *) hud, 1.0f, 0.0f);
|
||||
if (0) {}
|
||||
textureHeader3 = gAssetHudElements->entry[hud->spriteID];
|
||||
hud_draw_model((ObjectModel *) *textureHeader3);
|
||||
|
||||
+74
-54
@@ -163,7 +163,7 @@ GLOBAL_ASM("asm/math_util/f32_matrix_mult.s")
|
||||
#ifdef NON_MATCHING
|
||||
/* Official name: mathMtxF2L */
|
||||
void f32_matrix_to_s16_matrix(Matrix *input, MatrixS *output) {
|
||||
guMtxF2L((float(*)[4]) input, (Mtx *) output);
|
||||
guMtxF2L((float (*)[4]) input, (Mtx *) output);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/math_util/f32_matrix_to_s16_matrix.s")
|
||||
@@ -267,7 +267,16 @@ void s16_vec3_mult_by_s32_matrix(MatrixS input, Vec3s *output) {
|
||||
GLOBAL_ASM("asm/math_util/s16_vec3_mult_by_s32_matrix.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
#ifdef NON_MATCHING
|
||||
/**
|
||||
* Converts an ObjectTransform into a transformation matrix and writes it to `mtx`.
|
||||
* The matrix is built by applying the following operations in order:
|
||||
* 1. Scaling
|
||||
* 2. Rotation around Z axis (roll)
|
||||
* 3. Rotation around X axis (pitch)
|
||||
* 4. Rotation around Y axis (yaw)
|
||||
* 5. Translation
|
||||
*/
|
||||
void object_transform_to_matrix(Matrix mtx, ObjectTransform *trans) {
|
||||
f32 yRotSine;
|
||||
f32 yRotCosine;
|
||||
@@ -277,30 +286,30 @@ void object_transform_to_matrix(Matrix mtx, ObjectTransform *trans) {
|
||||
f32 zRotCosine;
|
||||
f32 scale;
|
||||
|
||||
yRotSine = sins_s16(trans->rotation.y_rotation) * 0.000015f;
|
||||
yRotCosine = coss_s16(trans->rotation.y_rotation) * 0.000015f;
|
||||
xRotSine = sins_s16(trans->rotation.x_rotation) * 0.000015f;
|
||||
xRotCosine = coss_s16(trans->rotation.x_rotation) * 0.000015f;
|
||||
zRotSine = sins_s16(trans->rotation.z_rotation) * 0.000015f;
|
||||
zRotCosine = coss_s16(trans->rotation.z_rotation) * 0.000015f;
|
||||
scale = trans->scale * 0.000015f;
|
||||
yRotSine = sins_s16(trans->rotation.y_rotation) * (1.0f / 0x10000);
|
||||
yRotCosine = coss_s16(trans->rotation.y_rotation) * (1.0f / 0x10000);
|
||||
xRotSine = sins_s16(trans->rotation.x_rotation) * (1.0f / 0x10000);
|
||||
xRotCosine = coss_s16(trans->rotation.x_rotation) * (1.0f / 0x10000);
|
||||
zRotSine = sins_s16(trans->rotation.z_rotation) * (1.0f / 0x10000);
|
||||
zRotCosine = coss_s16(trans->rotation.z_rotation) * (1.0f / 0x10000);
|
||||
scale = trans->scale;
|
||||
|
||||
mtx[0][0] = ((xRotSine * yRotSine * zRotSine) + (scale * yRotCosine)) * scale;
|
||||
mtx[0][1] = (zRotSine * xRotCosine * scale);
|
||||
mtx[0][2] = (((xRotSine * yRotCosine * zRotSine) - (scale * yRotSine)) * scale);
|
||||
mtx[0][0] = (xRotSine * yRotSine * zRotSine + zRotCosine * yRotCosine) * scale;
|
||||
mtx[0][1] = (zRotSine * xRotCosine) * scale;
|
||||
mtx[0][2] = (xRotSine * yRotCosine * zRotSine - zRotCosine * yRotSine) * scale;
|
||||
mtx[0][3] = 0;
|
||||
mtx[1][0] = (((xRotSine * yRotSine * scale) - (zRotSine * yRotCosine)) * scale);
|
||||
mtx[1][1] = (scale * xRotCosine * scale);
|
||||
mtx[1][2] = (((xRotSine * yRotCosine * scale) + (zRotSine * yRotSine)) * scale);
|
||||
mtx[1][0] = (xRotSine * yRotSine * zRotCosine - zRotSine * yRotCosine) * scale;
|
||||
mtx[1][1] = (zRotCosine * xRotCosine) * scale;
|
||||
mtx[1][2] = (xRotSine * yRotCosine * zRotCosine + zRotSine * yRotSine) * scale;
|
||||
mtx[1][3] = 0;
|
||||
mtx[2][0] = (xRotCosine * yRotSine * scale);
|
||||
mtx[2][0] = (xRotCosine * yRotSine) * scale;
|
||||
mtx[2][1] = -(xRotSine * scale);
|
||||
mtx[2][2] = (xRotCosine * yRotCosine * scale);
|
||||
mtx[2][2] = (xRotCosine * yRotCosine) * scale;
|
||||
mtx[2][3] = 0;
|
||||
mtx[3][0] = trans->x_position;
|
||||
mtx[3][1] = trans->y_position;
|
||||
mtx[3][2] = 1.0f;
|
||||
mtx[3][3] = trans->z_position;
|
||||
mtx[3][2] = trans->z_position;
|
||||
mtx[3][3] = 1.0f;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/math_util/object_transform_to_matrix.s")
|
||||
@@ -308,57 +317,68 @@ GLOBAL_ASM("asm/math_util/object_transform_to_matrix.s")
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
/* Official name: mathSquashY */
|
||||
void f32_matrix_scale(Matrix *input, f32 scale) {
|
||||
void f32_matrix_scale_y_axis(Matrix *input, f32 scale) {
|
||||
input[0][1][0] *= scale;
|
||||
input[0][1][1] *= scale;
|
||||
input[0][1][2] *= scale;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/math_util/f32_matrix_scale.s")
|
||||
GLOBAL_ASM("asm/math_util/f32_matrix_scale_y_axis.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
/* Official name: mathTransY */
|
||||
void f32_matrix_y_scale(Matrix *input, f32 scale) {
|
||||
input[0][3][0] += input[0][1][0] * scale;
|
||||
input[0][3][1] += input[0][1][1] * scale;
|
||||
input[0][3][2] += input[0][1][2] * scale;
|
||||
void f32_matrix_translate_y_axis(Matrix *input, f32 offset) {
|
||||
input[0][3][0] += input[0][1][0] * offset;
|
||||
input[0][3][1] += input[0][1][1] * offset;
|
||||
input[0][3][2] += input[0][1][2] * offset;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/math_util/f32_matrix_y_scale.s")
|
||||
GLOBAL_ASM("asm/math_util/f32_matrix_translate_y_axis.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
/**
|
||||
* Writes an inverse transformation matrix to `mtx` based on a pre-inverted `ObjectTransform`.
|
||||
* This is used to convert world-space coordinates to local object-space coordinates.
|
||||
* Unlike the standard transform, this version:
|
||||
* - Omits scaling
|
||||
* - Applies the transformation steps in reverse order
|
||||
* - Assumes that the translation and rotation values in `trans` are already negated
|
||||
*
|
||||
* Operation order:
|
||||
* 1. Translate (negative offset)
|
||||
* 2. Rotate Y (negative yaw)
|
||||
* 3. Rotate X (negative pitch)
|
||||
* 4. Rotate Z (negative roll)
|
||||
*/
|
||||
/* Official Name: mathRpyXyzMtx */
|
||||
void object_transform_to_matrix_2(Matrix mtx, ObjectTransform *trans) {
|
||||
void object_inverse_transform_to_matrix(Matrix mtx, ObjectTransform *trans) {
|
||||
f32 yRotSine;
|
||||
f32 yRotCosine;
|
||||
f32 xRotSine;
|
||||
f32 xRotCosine;
|
||||
f32 zRotSine;
|
||||
f32 zRotCosine;
|
||||
f32 scale;
|
||||
|
||||
yRotCosine = coss_s16(trans->rotation.y_rotation) * 0.000015f;
|
||||
yRotSine = sins_s16(trans->rotation.y_rotation) * 0.000015f;
|
||||
xRotCosine = coss_s16(trans->rotation.x_rotation) * 0.000015f;
|
||||
xRotSine = sins_s16(trans->rotation.x_rotation) * 0.000015f;
|
||||
zRotCosine = coss_s16(trans->rotation.z_rotation) * 0.000015f;
|
||||
zRotSine = sins_s16(trans->rotation.z_rotation) * 0.000015f;
|
||||
yRotCosine = coss_s16(trans->rotation.y_rotation) * (1.0f / 0x10000);
|
||||
yRotSine = sins_s16(trans->rotation.y_rotation) * (1.0f / 0x10000);
|
||||
xRotCosine = coss_s16(trans->rotation.x_rotation) * (1.0f / 0x10000);
|
||||
xRotSine = sins_s16(trans->rotation.x_rotation) * (1.0f / 0x10000);
|
||||
zRotCosine = coss_s16(trans->rotation.z_rotation) * (1.0f / 0x10000);
|
||||
zRotSine = sins_s16(trans->rotation.z_rotation) * (1.0f / 0x10000);
|
||||
|
||||
scale = trans->scale * 0.000015f;
|
||||
|
||||
mtx[0][0] = (yRotSine * scale) - (xRotCosine * zRotCosine * yRotCosine);
|
||||
mtx[0][1] = (xRotCosine * scale * yRotCosine) + (yRotSine * zRotCosine);
|
||||
mtx[0][2] = -(yRotCosine * xRotSine);
|
||||
mtx[0][0] = yRotCosine * zRotCosine - xRotSine * zRotSine * yRotSine;
|
||||
mtx[0][1] = xRotSine * zRotCosine * yRotSine + yRotCosine * zRotSine;
|
||||
mtx[0][2] = -(yRotSine * xRotCosine);
|
||||
mtx[0][3] = 0;
|
||||
mtx[1][0] = -(xRotSine * zRotCosine);
|
||||
mtx[1][1] = xRotSine * scale;
|
||||
mtx[1][2] = xRotCosine;
|
||||
mtx[1][0] = -(xRotCosine * zRotSine);
|
||||
mtx[1][1] = xRotCosine * zRotCosine;
|
||||
mtx[1][2] = xRotSine;
|
||||
mtx[1][3] = 0;
|
||||
mtx[2][0] = (xRotCosine * zRotCosine * yRotSine) + (yRotCosine * scale);
|
||||
mtx[2][1] = (yRotCosine * zRotCosine) - (xRotCosine * scale * yRotSine);
|
||||
mtx[2][2] = yRotSine * xRotSine;
|
||||
mtx[2][0] = xRotSine * zRotSine * yRotCosine + yRotSine * zRotCosine;
|
||||
mtx[2][1] = yRotSine * zRotSine - xRotSine * zRotCosine * yRotCosine;
|
||||
mtx[2][2] = yRotCosine * xRotCosine;
|
||||
mtx[2][3] = 0;
|
||||
mtx[3][0] = (mtx[0][0] * trans->x_position) + (mtx[1][0] * trans->y_position) + (mtx[2][0] * trans->z_position);
|
||||
mtx[3][1] = (mtx[0][1] * trans->x_position) + (mtx[1][1] * trans->y_position) + (mtx[2][1] * trans->z_position);
|
||||
@@ -366,28 +386,28 @@ void object_transform_to_matrix_2(Matrix mtx, ObjectTransform *trans) {
|
||||
mtx[3][3] = 1.0f;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/math_util/object_transform_to_matrix_2.s")
|
||||
GLOBAL_ASM("asm/math_util/object_inverse_transform_to_matrix.s")
|
||||
#endif
|
||||
|
||||
GLOBAL_ASM("asm/math_util/func_80070058.s")
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void f32_matrix_from_rotation_and_scale(Matrix mtx, s32 angle, f32 arg2, f32 arg3) {
|
||||
void f32_matrix_from_rotation_and_scale(Matrix mtx, s32 angle, f32 scale, f32 scaleY) {
|
||||
f32 cosine, sine;
|
||||
|
||||
cosine = sins_s16(angle) * 0.000015f;
|
||||
sine = coss_s16(angle) * 0.000015f;
|
||||
mtx[0][0] = sine * arg2;
|
||||
mtx[0][1] = cosine * arg2;
|
||||
sine = sins_s16(angle) * (1.0f / 0x10000);
|
||||
cosine = coss_s16(angle) * (1.0f / 0x10000);
|
||||
mtx[0][0] = cosine * scale;
|
||||
mtx[0][1] = sine * scale;
|
||||
mtx[0][2] = 0;
|
||||
mtx[0][3] = 0;
|
||||
mtx[1][0] = -cosine * arg2;
|
||||
mtx[1][1] = (sine * arg2) * arg3;
|
||||
mtx[1][0] = -sine * scale;
|
||||
mtx[1][1] = (cosine * scale) * scaleY;
|
||||
mtx[1][2] = 0;
|
||||
mtx[1][3] = 0;
|
||||
mtx[2][0] = 0;
|
||||
mtx[2][1] = 0;
|
||||
mtx[2][2] = arg2;
|
||||
mtx[2][2] = scale;
|
||||
mtx[2][3] = 0;
|
||||
mtx[3][0] = 0;
|
||||
mtx[3][1] = 0;
|
||||
|
||||
@@ -680,7 +680,7 @@ leaf object_transform_to_matrix
|
||||
.end object_transform_to_matrix
|
||||
|
||||
/* Official Name: mathSquashY */
|
||||
leaf f32_matrix_scale
|
||||
leaf f32_matrix_scale_y_axis
|
||||
/* 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
|
||||
/* 70A24 8006FE24 46128402 */ mul.s $f16, $f16, $f18
|
||||
/* 70A28 8006FE28 03E00008 */ jr $ra
|
||||
/* 70A2C 8006FE2C E4900018 */ swc1 $f16, 0x18($a0)
|
||||
.end f32_matrix_scale
|
||||
.end f32_matrix_scale_y_axis
|
||||
|
||||
/* Official Name: mathTransY */
|
||||
leaf f32_matrix_y_scale
|
||||
leaf f32_matrix_translate_y_axis
|
||||
/* 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_y_scale
|
||||
/* 70A68 8006FE68 E4840034 */ swc1 $f4, 0x34($a0)
|
||||
/* 70A6C 8006FE6C 03E00008 */ jr $ra
|
||||
/* 70A70 8006FE70 E4880038 */ swc1 $f8, 0x38($a0)
|
||||
.end f32_matrix_y_scale
|
||||
.end f32_matrix_translate_y_axis
|
||||
|
||||
/* Official Name: mathRpyXyzMtx */
|
||||
leaf object_transform_to_matrix_2
|
||||
leaf object_inverse_transform_to_matrix
|
||||
/* 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_transform_to_matrix_2
|
||||
/* 70C4C 8007004C 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
/* 70C50 80070050 03E00008 */ jr $ra
|
||||
/* 70C54 80070054 00000000 */ nop
|
||||
.end object_transform_to_matrix_2
|
||||
.end object_inverse_transform_to_matrix
|
||||
|
||||
leaf func_80070058
|
||||
/* 70C58 80070058 27BDFFF8 */ addiu $sp, $sp, -0x8
|
||||
|
||||
@@ -158,7 +158,7 @@ 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_transform_to_matrix_2
|
||||
/* 25414 80024814 0C01BF9D */ jal object_inverse_transform_to_matrix
|
||||
/* 25418 80024818 03002825 */ or $a1, $t8, $zero
|
||||
/* 2541C 8002481C 27A50010 */ addiu $a1, $sp, 0x10
|
||||
/* 25420 80024820 27A40034 */ addiu $a0, $sp, 0x34
|
||||
|
||||
+3
-3
@@ -45,9 +45,9 @@ void f32_matrix_to_s16_matrix(Matrix *input, MatrixS *output);
|
||||
void s16_matrix_rotate(s16 *arg0[4][4], s16 arg1[4][4]);
|
||||
void s16_vec3_mult_by_s32_matrix(MatrixS input, Vec3s *output);
|
||||
void object_transform_to_matrix(Matrix mtx, ObjectTransform *trans);
|
||||
void f32_matrix_scale(Matrix *input, f32 scale);
|
||||
void f32_matrix_y_scale(Matrix *input, f32 scale);
|
||||
void object_transform_to_matrix_2(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 arg2, f32 arg3);
|
||||
void s16_vec3_apply_object_rotation(ObjectTransform *trans, s16 *vec3Arg);
|
||||
void f32_vec3_apply_object_rotation(ObjectTransform *trans, f32 *vec3_f32);
|
||||
|
||||
+40
-31
@@ -177,7 +177,6 @@ f32 gTitleAudioCounter;
|
||||
s8 *sTitleScreenDemoIds; // Misc Asset 66 - title_screen_demo_ids.bin - 12 or 13 values.
|
||||
s16 gTitleDemoTimer;
|
||||
unk80126878 D_80126878[8];
|
||||
u8 D_80126E78[0x20]; // NEW BSS, or BIGGER D_80126878?
|
||||
f32 D_801268D8;
|
||||
UNUSED s32 D_801268DC; // Set to 0 during the title screen, never read.
|
||||
s32 gOpeningNameID;
|
||||
@@ -395,9 +394,6 @@ s32 gTitleRevealTimer;
|
||||
f32 gTitleAudioCounter;
|
||||
s8 *sTitleScreenDemoIds; // Misc Asset 66 - title_screen_demo_ids.bin - 12 or 13 values.
|
||||
unk80126878 D_80126878[8];
|
||||
#if VERSION >= VERSION_79
|
||||
u8 D_80126E78[0x20]; // NEW BSS, or BIGGER D_80126878?
|
||||
#endif
|
||||
f32 D_801268D8;
|
||||
UNUSED s32 D_801268DC; // Set to 0 during the title screen, never read.
|
||||
s32 gOpeningNameID;
|
||||
@@ -718,11 +714,11 @@ char *D_800E142C_E202C[] = { D_800E13A4_E1FA4, D_800E13B0_E1FB0, D_800E13BC_E1FB
|
||||
s32 gTitleCinematicTextColourCount = 0;
|
||||
|
||||
// Colours used for the Character Names during the title screen cinematic
|
||||
MenuColour gTitleCinematicTextColours[] = {
|
||||
{ 255, 255, 0, 255, 204 }, // Yellow
|
||||
{ 0, 255, 0, 255, 153 }, // Green
|
||||
{ 0, 255, 255, 255, 102 }, // Cyan
|
||||
{ 0, 0, 255, 255, 51 } // Blue
|
||||
u8 gTitleCinematicTextColours[] = {
|
||||
255, 255, 0, 255, 204, // Yellow
|
||||
0, 255, 0, 255, 153, // Green
|
||||
0, 255, 255, 255, 102, // Cyan
|
||||
0, 0, 255, 255, 51 // Blue
|
||||
};
|
||||
|
||||
UNUSED u8 unused_800DFA0C[] = { 0, 0, 15, 120 };
|
||||
@@ -3205,18 +3201,18 @@ void init_title_screen_variables(void) {
|
||||
load_menu_text(get_language());
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Differs in v80
|
||||
// Single regswap diff
|
||||
void func_80083098(f32 updateRateF) {
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
s32 didUpdate;
|
||||
s32 xPos;
|
||||
s32 yPos;
|
||||
s32 i; // s1
|
||||
s32 i;
|
||||
s32 j;
|
||||
char *text;
|
||||
#if REGION == REGION_JP
|
||||
char *text2;
|
||||
#endif
|
||||
unk800DF83C *introCharData;
|
||||
|
||||
didUpdate = FALSE;
|
||||
@@ -3229,21 +3225,32 @@ void func_80083098(f32 updateRateF) {
|
||||
}
|
||||
|
||||
introCharData = &gTitleCinematicText[gOpeningNameID];
|
||||
#if REGION == REGION_JP
|
||||
text2 = D_800E142C_E202C[gOpeningNameID];
|
||||
#endif
|
||||
D_801268D8 += updateRateF;
|
||||
set_text_font(ASSET_FONTS_BIGFONT);
|
||||
set_text_background_colour(0, 0, 0, 0);
|
||||
i = 0;
|
||||
while (i < gTitleCinematicTextColourCount) {
|
||||
j = D_80126878[i].colourIndex;
|
||||
set_text_colour(gTitleCinematicTextColours[j].red, gTitleCinematicTextColours[j].green,
|
||||
gTitleCinematicTextColours[j].blue, gTitleCinematicTextColours[j].alpha,
|
||||
gTitleCinematicTextColours[j].opacity);
|
||||
j = 5 * D_80126878[i].colourIndex;
|
||||
set_text_colour(gTitleCinematicTextColours[j + 0], gTitleCinematicTextColours[j + 1],
|
||||
gTitleCinematicTextColours[j + 2], gTitleCinematicTextColours[j + 3],
|
||||
gTitleCinematicTextColours[j + 4]);
|
||||
draw_text(&sMenuCurrDisplayList, D_80126878[i].x, D_80126878[i].y, D_80126878[i].text, ALIGN_MIDDLE_CENTER);
|
||||
#if REGION == REGION_JP
|
||||
set_text_font(ASSET_FONTS_FUNFONT);
|
||||
draw_text(&sMenuCurrDisplayList, D_80126878[i].x, D_80126878[i].y - 24, D_80126878[i].text2, ALIGN_MIDDLE_CENTER);
|
||||
set_text_font(ASSET_FONTS_BIGFONT);
|
||||
#endif
|
||||
D_80126878[i].colourIndex++;
|
||||
if (D_80126878[i].colourIndex >= 4) {
|
||||
gTitleCinematicTextColourCount--;
|
||||
for (j = i; j < gTitleCinematicTextColourCount; j++) {
|
||||
D_80126878[j].text = D_80126878[j + 1].text;
|
||||
#if REGION == REGION_JP
|
||||
D_80126878[j].text2 = D_80126878[j + 1].text2;
|
||||
#endif
|
||||
D_80126878[j].x = D_80126878[j + 1].x;
|
||||
D_80126878[j].y = D_80126878[j + 1].y;
|
||||
D_80126878[j].colourIndex = D_80126878[j + 1].colourIndex;
|
||||
@@ -3278,8 +3285,6 @@ void func_80083098(f32 updateRateF) {
|
||||
}
|
||||
}
|
||||
|
||||
if (gTitleCinematicTextColours) {}
|
||||
|
||||
if (!didUpdate) {
|
||||
return;
|
||||
}
|
||||
@@ -3287,16 +3292,20 @@ void func_80083098(f32 updateRateF) {
|
||||
if (gTitleCinematicTextColourCount < 4) {
|
||||
D_80126878[gTitleCinematicTextColourCount].colourIndex = 0;
|
||||
D_80126878[gTitleCinematicTextColourCount].text = text;
|
||||
#if REGION == REGION_JP
|
||||
D_80126878[gTitleCinematicTextColourCount].text2 = text2;
|
||||
#endif
|
||||
D_80126878[gTitleCinematicTextColourCount].x = xPos;
|
||||
D_80126878[gTitleCinematicTextColourCount].y = yPos;
|
||||
gTitleCinematicTextColourCount++;
|
||||
}
|
||||
set_text_colour(255, 255, 255, 0, 255);
|
||||
draw_text(&sMenuCurrDisplayList, xPos, yPos, text, ALIGN_MIDDLE_CENTER);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/menu/func_80083098.s")
|
||||
#if REGION == REGION_JP
|
||||
set_text_font(ASSET_FONTS_FUNFONT);
|
||||
draw_text(&sMenuCurrDisplayList, xPos, yPos - 24, text2, ALIGN_MIDDLE_CENTER);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the title screen menu.
|
||||
@@ -3411,10 +3420,10 @@ s32 menu_title_screen_loop(s32 updateRate) {
|
||||
s8 *demo;
|
||||
s32 contrIndex;
|
||||
f32 updateRateF;
|
||||
ObjectSegment *sp18;
|
||||
Camera *sp18;
|
||||
s8 playerCount;
|
||||
|
||||
sp18 = get_active_camera_segment();
|
||||
sp18 = cam_get_active_camera();
|
||||
gOptionBlinkTimer = (gOptionBlinkTimer + updateRate) & 0x3F;
|
||||
menu_input();
|
||||
if (osTvType == OS_TV_TYPE_PAL) {
|
||||
@@ -3479,7 +3488,7 @@ s32 menu_title_screen_loop(s32 updateRate) {
|
||||
gTitleRevealTimer += updateRate;
|
||||
if (gTitleRevealTimer >= 32) {
|
||||
gTitleRevealTimer = 32;
|
||||
sp18->object.distanceToCamera = 8.0f;
|
||||
sp18->shakeMagnitude = 8.0f;
|
||||
sound_play(SOUND_EXPLOSION, NULL);
|
||||
}
|
||||
} else {
|
||||
@@ -6835,7 +6844,7 @@ void charselect_render_text(UNUSED s32 updateRate) {
|
||||
#endif
|
||||
}
|
||||
rendermode_reset(&sMenuCurrDisplayList);
|
||||
update_camera_fov(40.0f);
|
||||
cam_set_fov(40.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10420,7 +10429,7 @@ void postrace_start(s32 finishState, s32 worldID) {
|
||||
header = get_current_level_header();
|
||||
gPostraceFinishState = finishState;
|
||||
if (is_in_two_player_adventure()) {
|
||||
set_scene_viewport_num(VIEWPORTS_COUNT_1_PLAYER);
|
||||
set_scene_viewport_num(VIEWPORT_LAYOUT_1_PLAYER);
|
||||
}
|
||||
gPostRace1Player = FALSE;
|
||||
if (gNumberOfActivePlayers == 1 && gTrophyRaceWorldId == 0) {
|
||||
@@ -13351,7 +13360,7 @@ void credits_free(void) {
|
||||
* Write the original coordinates back once done.
|
||||
*/
|
||||
void menu_camera_centre(void) {
|
||||
ObjectSegment *cam;
|
||||
Camera *cam;
|
||||
s16 angleY;
|
||||
s16 angleX;
|
||||
s16 angleZ;
|
||||
@@ -13359,10 +13368,10 @@ void menu_camera_centre(void) {
|
||||
f32 posY;
|
||||
f32 posZ;
|
||||
|
||||
set_active_viewports_and_max(0);
|
||||
cam_set_layout(VIEWPORT_LAYOUT_1_PLAYER);
|
||||
set_active_camera(0);
|
||||
|
||||
cam = get_active_camera_segment();
|
||||
cam = cam_get_active_camera();
|
||||
|
||||
angleY = cam->trans.rotation.y_rotation;
|
||||
angleX = cam->trans.rotation.x_rotation;
|
||||
@@ -13849,7 +13858,7 @@ void menu_element_render(s32 elementID) {
|
||||
gDPSetPrimColor(sMenuCurrDisplayList++, 0, 0, 255, 255, 255, 255);
|
||||
};
|
||||
gDPSetEnvColor(sMenuCurrDisplayList++, 255, 255, 255, 0);
|
||||
camera_push_model_mtx(&sMenuCurrDisplayList, &sMenuCurrHudMat,
|
||||
cam_push_model_mtx(&sMenuCurrDisplayList, &sMenuCurrHudMat,
|
||||
(ObjectTransform *) (&gMenuImages[elementID]),
|
||||
gTrackSelectWoodFrameHeightScale, 0);
|
||||
model = ((ObjectModel **) gMenuAssets[gMenuImages[elementID].spriteID]);
|
||||
|
||||
+4
-1
@@ -416,9 +416,12 @@ typedef struct SaveFileData {
|
||||
/* 0x0C */ u32 fileSize; // Game Data File Size
|
||||
} SaveFileData;
|
||||
|
||||
// Size: 12 bytes
|
||||
// Size: 12 or 16 bytes
|
||||
typedef struct unk80126878 {
|
||||
/* 0x00 */ char *text;
|
||||
#if VERSION >= VERSION_79
|
||||
/* 0x00 */ char *text2;
|
||||
#endif
|
||||
/* 0x04 */ s16 x;
|
||||
/* 0x06 */ s16 y;
|
||||
/* 0x08 */ s32 colourIndex;
|
||||
|
||||
@@ -1162,7 +1162,7 @@ void try_to_collect_egg(Object *obj, Object_CollectEgg *egg) {
|
||||
transF.x_position = -interactedObj->segment.trans.x_position;
|
||||
transF.y_position = -interactedObj->segment.trans.y_position;
|
||||
transF.z_position = -interactedObj->segment.trans.z_position;
|
||||
object_transform_to_matrix_2(mat, &transF);
|
||||
object_inverse_transform_to_matrix(mat, &transF);
|
||||
guMtxXFMF(mat, obj->segment.trans.x_position, obj->segment.trans.y_position,
|
||||
obj->segment.trans.z_position, &obj->segment.trans.x_position, &obj->segment.trans.y_position,
|
||||
&obj->segment.trans.z_position);
|
||||
@@ -1542,7 +1542,7 @@ void obj_loop_fish(Object *fishObj, s32 updateRate) {
|
||||
Vertex *verts;
|
||||
s32 randNumber;
|
||||
|
||||
if (get_viewport_count() > 0) {
|
||||
if (cam_get_viewport_layout() > 0) {
|
||||
free_object(fishObj);
|
||||
return;
|
||||
}
|
||||
@@ -2151,7 +2151,7 @@ void obj_loop_animcamera(Object *obj, s32 updateRate) {
|
||||
obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE;
|
||||
camera = &obj->unk64->animation;
|
||||
if (temp_v0 == 0) {
|
||||
if (get_viewport_count() == VIEWPORTS_COUNT_1_PLAYER) {
|
||||
if (cam_get_viewport_layout() == VIEWPORT_LAYOUT_1_PLAYER) {
|
||||
updateCam = func_800210CC(camera->unk44);
|
||||
} else {
|
||||
updateCam = TRUE;
|
||||
@@ -2560,7 +2560,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) {
|
||||
u32 buttonsPressed;
|
||||
s8 spawnSmoke;
|
||||
LevelHeader *levelHeader;
|
||||
ObjectSegment *temp_v0_22;
|
||||
Camera *temp_v0_22;
|
||||
f32 var_f2;
|
||||
s32 arctan;
|
||||
s32 temp;
|
||||
|
||||
+69
-69
@@ -1011,7 +1011,7 @@ void func_8000CC7C(Vehicle vehicle, u32 arg1, s32 arg2) {
|
||||
s32 spB4[8];
|
||||
s32 sp94[8];
|
||||
LevelHeader *levelHeader;
|
||||
ObjectSegment *cutsceneCameraSegment; // sp74
|
||||
Camera *cutsceneCameraSegment; // sp74
|
||||
s16 objectId;
|
||||
s8 sp127;
|
||||
u8 raceType;
|
||||
@@ -1050,8 +1050,8 @@ void func_8000CC7C(Vehicle vehicle, u32 arg1, s32 arg2) {
|
||||
cutsceneID = -1;
|
||||
if (is_time_trial_enabled() && raceType == RACETYPE_DEFAULT) {
|
||||
cutsceneCameraSegment = get_cutscene_camera_segment();
|
||||
cutsceneID = (u8) cutsceneCameraSegment->object.animationID;
|
||||
cutsceneCameraSegment->object.animationID = 1;
|
||||
cutsceneID = (u8) cutsceneCameraSegment->zoom;
|
||||
cutsceneCameraSegment->zoom = 1;
|
||||
}
|
||||
gameMode = get_game_mode();
|
||||
settings = get_settings();
|
||||
@@ -1458,7 +1458,7 @@ void func_8000CC7C(Vehicle vehicle, u32 arg1, s32 arg2) {
|
||||
}
|
||||
*D_8011AD24 = 1;
|
||||
if (cutsceneID >= 0) {
|
||||
cutsceneCameraSegment->object.animationID = cutsceneID;
|
||||
cutsceneCameraSegment->zoom = cutsceneID;
|
||||
}
|
||||
if (func_8000E148() != 0) {
|
||||
rumble_init(FALSE);
|
||||
@@ -1805,7 +1805,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 arg1) {
|
||||
curObj->objectID = objType;
|
||||
func_800245B4(objType);
|
||||
curObj->segment.trans.scale = curObj->segment.header->scale;
|
||||
curObj->segment.camera.unk34 = curObj->segment.header->unk50 * curObj->segment.trans.scale;
|
||||
curObj->segment.object.unk34 = curObj->segment.header->unk50 * curObj->segment.trans.scale;
|
||||
curObj->segment.object.opacity = 0xFF;
|
||||
sp50 = obj_init_property_flags(curObj->segment.header->behaviorId);
|
||||
curObj->segment.header->unk52++;
|
||||
@@ -2789,9 +2789,9 @@ s32 move_object(Object *obj, f32 xPos, f32 yPos, f32 zPos) {
|
||||
* A much simpler, faster way to render an object model as opposed to render_3d_model
|
||||
*/
|
||||
void render_misc_model(Object *obj, Vertex *verts, u32 numVertices, Triangle *triangles, u32 numTriangles,
|
||||
TextureHeader *tex, u32 flags, u32 texOffset, f32 scale) {
|
||||
TextureHeader *tex, u32 flags, u32 texOffset, f32 scaleY) {
|
||||
s32 hasTexture = FALSE;
|
||||
camera_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix, &obj->segment.trans, scale, 0.0f);
|
||||
cam_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix, &obj->segment.trans, scaleY, 0.0f);
|
||||
gDPSetPrimColor(gObjectCurrDisplayList++, 0, 0, 255, 255, 255, 255);
|
||||
gDPSetEnvColor(gObjectCurrDisplayList++, 255, 255, 255, 0);
|
||||
if (tex != NULL) {
|
||||
@@ -2807,7 +2807,7 @@ void render_misc_model(Object *obj, Vertex *verts, u32 numVertices, Triangle *tr
|
||||
* A few objects use unconventional means to render. They are handled here.
|
||||
*/
|
||||
void render_3d_misc(Object *obj) {
|
||||
f32 scale;
|
||||
f32 scaleY;
|
||||
Object_64 *objData;
|
||||
|
||||
switch (obj->behaviorId) {
|
||||
@@ -2827,10 +2827,10 @@ void render_3d_misc(Object *obj) {
|
||||
break;
|
||||
case BHV_FISH:
|
||||
objData = obj->unk64;
|
||||
scale = obj->segment.level_entry->fish.unkD;
|
||||
scale *= 0.01f;
|
||||
scaleY = obj->segment.level_entry->fish.unkD;
|
||||
scaleY *= 0.01f;
|
||||
render_misc_model(obj, &objData->fish.vertices[objData->fish.unkFC * 6], 6, objData->fish.triangles, 8,
|
||||
objData->fish.texture, RENDER_Z_COMPARE | RENDER_FOG_ACTIVE | RENDER_CUTOUT, 0, scale);
|
||||
objData->fish.texture, RENDER_Z_COMPARE | RENDER_FOG_ACTIVE | RENDER_CUTOUT, 0, scaleY);
|
||||
break;
|
||||
case BHV_BOOST:
|
||||
if (obj->properties.common.unk0 && (obj->unk64->boost.unk70 > 0 || obj->unk64->boost.unk74 > 0.0f)) {
|
||||
@@ -3005,7 +3005,7 @@ void render_3d_model(Object *obj) {
|
||||
racerObj->playerIndex == PLAYER_COMPUTER) {
|
||||
flags = FALSE;
|
||||
}
|
||||
if (get_viewport_count() != VIEWPORTS_COUNT_1_PLAYER) {
|
||||
if (cam_get_viewport_layout() != VIEWPORT_LAYOUT_1_PLAYER) {
|
||||
flags = FALSE;
|
||||
}
|
||||
obj->curVertData = (Vertex *) obj68->vertices[obj68->animationTaskNum];
|
||||
@@ -3033,7 +3033,7 @@ void render_3d_model(Object *obj) {
|
||||
func_80011134(obj, objModel->unk52);
|
||||
obj68->objModel->unk52 = 0;
|
||||
}
|
||||
camera_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix, &obj->segment.trans, D_8011AD28, 0);
|
||||
cam_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix, &obj->segment.trans, D_8011AD28, 0);
|
||||
spB0 = FALSE;
|
||||
if (racerObj != NULL) {
|
||||
object_undo_player_tumble(obj);
|
||||
@@ -3131,7 +3131,7 @@ void render_3d_model(Object *obj) {
|
||||
render_sprite_billboard(&gObjectCurrDisplayList, &gObjectCurrMatrix,
|
||||
&gObjectCurrVertexList, loopObj, (Sprite *) something, flags);
|
||||
if (var_v0_2) {
|
||||
gDkrInsertMatrix(gObjectCurrDisplayList++, 0, 0);
|
||||
gSPSelectMatrixDKR(gObjectCurrDisplayList++, G_MTX_DKR_INDEX_0);
|
||||
func_80012CE8(&gObjectCurrDisplayList);
|
||||
}
|
||||
}
|
||||
@@ -3329,7 +3329,7 @@ void func_80012F94(Object *obj) {
|
||||
}
|
||||
batchNum = 0;
|
||||
bossAsset = (u8 *) get_misc_asset(var_t0); // 40 bytes of data u8[8][5]?
|
||||
bossAsset = &bossAsset[(get_viewport_count() * 10)];
|
||||
bossAsset = &bossAsset[(cam_get_viewport_layout() * 10)];
|
||||
var_a1 = bossAsset;
|
||||
if (get_current_viewport() != objRacer->playerIndex) {
|
||||
var_a1 += 5;
|
||||
@@ -3492,7 +3492,7 @@ void func_800135B8(Object *boostObj) {
|
||||
asset = (Object_Boost *) get_misc_asset(ASSET_MISC_20);
|
||||
asset = &asset[D_8011B058[idx]];
|
||||
object_do_player_tumble((Object *) boostObj->properties.common.unk0);
|
||||
camera_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix,
|
||||
cam_push_model_mtx(&gObjectCurrDisplayList, &gObjectCurrMatrix,
|
||||
(ObjectTransform *) boostObj->properties.common.unk0, 1.0f, 0.0f);
|
||||
object_undo_player_tumble((Object *) boostObj->properties.common.unk0);
|
||||
objTransform.trans.x_position = boostData->position.x;
|
||||
@@ -3538,14 +3538,14 @@ void render_bubble_trap(ObjectTransform *trans, Object_68 *gfxData, Object *obj,
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
ObjectSegment *cameraSegment;
|
||||
Camera *cameraSegment;
|
||||
f32 dist;
|
||||
|
||||
f32_vec3_apply_object_rotation(trans, &obj->segment.trans.x_position);
|
||||
obj->segment.trans.x_position += trans->x_position;
|
||||
obj->segment.trans.y_position += trans->y_position;
|
||||
obj->segment.trans.z_position += trans->z_position;
|
||||
cameraSegment = get_active_camera_segment();
|
||||
cameraSegment = cam_get_active_camera();
|
||||
x = cameraSegment->trans.x_position - obj->segment.trans.x_position;
|
||||
y = cameraSegment->trans.y_position - obj->segment.trans.y_position;
|
||||
z = cameraSegment->trans.z_position - obj->segment.trans.z_position;
|
||||
@@ -3625,7 +3625,7 @@ void render_racer_shield(Gfx **dList, MatrixS **mtx, Vertex **vtxList, Object *o
|
||||
}
|
||||
apply_object_shear_matrix(&gObjectCurrDisplayList, &gObjectCurrMatrix, gShieldEffectObject, obj, shear);
|
||||
render_mesh(mdl, gShieldEffectObject, 0, RENDER_SEMI_TRANSPARENT, 0);
|
||||
gDkrInsertMatrix(gObjectCurrDisplayList++, 0, G_MTX_DKR_INDEX_0);
|
||||
gSPSelectMatrixDKR(gObjectCurrDisplayList++, G_MTX_DKR_INDEX_0);
|
||||
if (racer->shieldTimer < 64) {
|
||||
gDPSetPrimColor(gObjectCurrDisplayList++, 0, 0, 255, 255, 255, 255);
|
||||
}
|
||||
@@ -3688,7 +3688,7 @@ void render_racer_magnet(Gfx **dList, MatrixS **mtx, Vertex **vtxList, Object *o
|
||||
gObjectTexAnim = TRUE;
|
||||
render_mesh(mdl, gMagnetEffectObject, 0, RENDER_SEMI_TRANSPARENT, 0);
|
||||
gObjectTexAnim = FALSE;
|
||||
gDkrInsertMatrix(gObjectCurrDisplayList++, 0, G_MTX_DKR_INDEX_0);
|
||||
gSPSelectMatrixDKR(gObjectCurrDisplayList++, G_MTX_DKR_INDEX_0);
|
||||
gDPSetPrimColor(gObjectCurrDisplayList++, 0, 0, 255, 255, 255, 255);
|
||||
rendermode_reset(&gObjectCurrDisplayList);
|
||||
*dList = gObjectCurrDisplayList;
|
||||
@@ -3790,14 +3790,14 @@ s32 render_mesh(ObjectModel *objModel, Object *obj, s32 startIndex, s32 flags, s
|
||||
} else {
|
||||
if (offsetStartVertex > 0) {
|
||||
gSPVertexDKR(dList++, OS_K0_TO_PHYSICAL(vtx), offsetStartVertex, 0);
|
||||
gDkrInsertMatrix(dList++, 0, G_MTX_DKR_INDEX_2);
|
||||
gSPSelectMatrixDKR(dList++, G_MTX_DKR_INDEX_2);
|
||||
gSPVertexDKR(dList++, OS_K0_TO_PHYSICAL(&vtx[offsetStartVertex]),
|
||||
(numVertices - offsetStartVertex), 1);
|
||||
} else {
|
||||
gDkrInsertMatrix(dList++, 0, G_MTX_DKR_INDEX_2);
|
||||
gSPSelectMatrixDKR(dList++, G_MTX_DKR_INDEX_2);
|
||||
gSPVertexDKR(dList++, OS_K0_TO_PHYSICAL(vtx), numVertices, 0);
|
||||
}
|
||||
gDkrInsertMatrix(dList++, 0, G_MTX_DKR_INDEX_1);
|
||||
gSPSelectMatrixDKR(dList++, G_MTX_DKR_INDEX_1);
|
||||
}
|
||||
gSPPolygon(dList++, OS_K0_TO_PHYSICAL(tris), numTris, texEnabled);
|
||||
}
|
||||
@@ -3902,11 +3902,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 0:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.x_position -
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.x_position -
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -3921,11 +3921,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 1:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.y_position -
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.y_position -
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -3940,11 +3940,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 2:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.z_position -
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.z_position -
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -3959,11 +3959,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 8:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.x_position +
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.x_position +
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -3978,11 +3978,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 9:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.y_position +
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.y_position +
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -3997,11 +3997,11 @@ s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3) {
|
||||
case 10:
|
||||
while (arg1 >= arg0) {
|
||||
while ((var_a1 >= arg0) && ((gObjPtrList[arg0]->segment.trans.z_position +
|
||||
gObjPtrList[arg0]->segment.camera.unk34) < arg2)) {
|
||||
gObjPtrList[arg0]->segment.object.unk34) < arg2)) {
|
||||
arg0++;
|
||||
}
|
||||
while ((arg1 >= var_a0) && (arg2 <= (gObjPtrList[arg1]->segment.trans.z_position +
|
||||
gObjPtrList[arg1]->segment.camera.unk34))) {
|
||||
gObjPtrList[arg1]->segment.object.unk34))) {
|
||||
arg1--;
|
||||
}
|
||||
if (arg0 < arg1) {
|
||||
@@ -4155,9 +4155,9 @@ void process_object_interactions(void) {
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_800159C8.s")
|
||||
|
||||
void func_80016500(Object *obj, Object_Racer *racer) {
|
||||
s32 sp3C;
|
||||
s32 shakeMagnitude;
|
||||
s32 volume;
|
||||
s32 angle;
|
||||
UNUSED s32 pad;
|
||||
f32 startVelocity;
|
||||
f32 cosAngle;
|
||||
f32 sinAngle;
|
||||
@@ -4175,37 +4175,37 @@ void func_80016500(Object *obj, Object_Racer *racer) {
|
||||
racer->lateral_velocity = (obj->segment.x_velocity * cosAngle) + (obj->segment.z_velocity * sinAngle);
|
||||
racer->velocity = (-obj->segment.x_velocity * sinAngle) + (obj->segment.z_velocity * cosAngle);
|
||||
if (racer->playerIndex != PLAYER_COMPUTER) {
|
||||
angle = (startVelocity - racer->velocity) * 14.0f;
|
||||
if (angle < 0) {
|
||||
angle = -angle;
|
||||
volume = (startVelocity - racer->velocity) * 14.0f;
|
||||
if (volume < 0) {
|
||||
volume = -volume;
|
||||
}
|
||||
angle += 35;
|
||||
if (angle >= 128) {
|
||||
angle = 127;
|
||||
volume += 35;
|
||||
if (volume > 127) {
|
||||
volume = 127;
|
||||
}
|
||||
if (racer->unk1F6 == 0) {
|
||||
sound_play(SOUND_CRASH_CHARACTER, &racer->unk220);
|
||||
sound_volume_set_relative(SOUND_CRASH_CHARACTER, racer->unk220, angle);
|
||||
sound_volume_set_relative(SOUND_CRASH_CHARACTER, racer->unk220, volume);
|
||||
}
|
||||
if (racer->unk1F6 == 0 && angle >= 56) {
|
||||
if (racer->unk1F6 == 0 && volume > 55) {
|
||||
if (!racer->raceFinished) {
|
||||
rumble_set(racer->playerIndex, RUMBLE_TYPE_18);
|
||||
}
|
||||
racer->unk1F3 |= 8;
|
||||
}
|
||||
if (angle >= 56) {
|
||||
if (volume > 55) {
|
||||
play_random_character_voice(obj, SOUND_VOICE_CHARACTER_NEGATIVE, 8, 1);
|
||||
}
|
||||
sp3C = (startVelocity - racer->velocity);
|
||||
if (sp3C < 0) {
|
||||
sp3C = -sp3C;
|
||||
shakeMagnitude = (startVelocity - racer->velocity);
|
||||
if (shakeMagnitude < 0) {
|
||||
shakeMagnitude = -shakeMagnitude;
|
||||
}
|
||||
if (sp3C >= 4) {
|
||||
sp3C = 3;
|
||||
if (shakeMagnitude > 3) {
|
||||
shakeMagnitude = 3;
|
||||
}
|
||||
racer->unk1F6 = 30;
|
||||
set_active_camera(racer->playerIndex);
|
||||
get_active_camera_segment()->object.distanceToCamera = sp3C;
|
||||
cam_get_active_camera()->shakeMagnitude = shakeMagnitude;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4241,12 +4241,12 @@ void func_80016748(Object *obj0, Object *obj1) {
|
||||
if (!((objModel->unk3C + 50.0) < sqrtf((xDiff * xDiff) + (yDiff * yDiff) + (zDiff * zDiff)))) {
|
||||
obj0Interact = obj0->interactObj;
|
||||
obj1Interact = obj1->interactObj;
|
||||
object_transform_to_matrix((float(*)[4]) obj1TransformMtx, &obj1->segment.trans);
|
||||
object_transform_to_matrix((float (*)[4]) obj1TransformMtx, &obj1->segment.trans);
|
||||
for (i = 0; i < objModel->unk20; i += 2) {
|
||||
xDiff = obj1->curVertData[objModel->unk1C[i]].x;
|
||||
yDiff = obj1->curVertData[objModel->unk1C[i]].y;
|
||||
zDiff = obj1->curVertData[objModel->unk1C[i]].z;
|
||||
guMtxXFMF((float(*)[4]) obj1TransformMtx, xDiff, yDiff, zDiff, &xDiff, &yDiff, &zDiff);
|
||||
guMtxXFMF((float (*)[4]) obj1TransformMtx, xDiff, yDiff, zDiff, &xDiff, &yDiff, &zDiff);
|
||||
temp = (((f32) objModel->unk1C[i + 1] / 64) * obj1->segment.trans.scale) * 50.0;
|
||||
xDiff -= obj0->segment.trans.x_position;
|
||||
yDiff -= obj0->segment.trans.y_position;
|
||||
@@ -4413,7 +4413,7 @@ void func_8001709C(Object *obj) {
|
||||
sp78.x_position = -obj->segment.trans.x_position;
|
||||
sp78.y_position = -obj->segment.trans.y_position;
|
||||
sp78.z_position = -obj->segment.trans.z_position;
|
||||
object_transform_to_matrix_2((float(*)[4]) sp6C, (ObjectTransform *) &sp78);
|
||||
object_inverse_transform_to_matrix((float (*)[4]) sp6C, (ObjectTransform *) &sp78);
|
||||
inverseScale = 1.0 / obj->segment.trans.scale;
|
||||
i = 0;
|
||||
while (i < 16) {
|
||||
@@ -4663,7 +4663,7 @@ void race_transition_adventure(s32 updateRate) {
|
||||
sndp_stop_all_looped();
|
||||
if (is_in_two_player_adventure()) {
|
||||
set_scene_viewport_num(0);
|
||||
set_active_viewports_and_max(0);
|
||||
cam_set_layout(VIEWPORT_LAYOUT_1_PLAYER);
|
||||
prevRacer0Obj = (*gRacers)[0];
|
||||
prevPort0Racer = gRacersByPort[0];
|
||||
racer = &prevRacer0Obj->unk64->racer;
|
||||
@@ -6199,9 +6199,9 @@ void func_8001F23C(Object *obj, LevelObjectEntry_Animation *animEntry) {
|
||||
if (newObj->segment.header->behaviorId == BHV_CAMERA_ANIMATION) {
|
||||
camera = &newObj->unk64->anim_camera;
|
||||
camera->unk44 = D_8011AD3E;
|
||||
viewportCount = get_viewport_count();
|
||||
viewportCount = cam_get_viewport_layout();
|
||||
if (is_two_player_adventure_race()) {
|
||||
viewportCount = VIEWPORTS_COUNT_2_PLAYERS;
|
||||
viewportCount = VIEWPORT_LAYOUT_2_PLAYERS;
|
||||
}
|
||||
for (i = 0; i < viewportCount;) {
|
||||
newObj = spawn_object(&newObjEntry, 1);
|
||||
@@ -6262,7 +6262,7 @@ s32 func_800210CC(s8 arg0) {
|
||||
}
|
||||
|
||||
void func_80021104(Object *obj, Object_Animation *animObj, LevelObjectEntry_Animation *entry) {
|
||||
ObjectSegment *seg;
|
||||
Camera *camera;
|
||||
ObjectTransform *animObjTrans;
|
||||
|
||||
animObjTrans = (ObjectTransform *) animObj->unk1C;
|
||||
@@ -6272,16 +6272,16 @@ void func_80021104(Object *obj, Object_Animation *animObj, LevelObjectEntry_Anim
|
||||
}
|
||||
if (entry->unk22 == 18) {
|
||||
set_active_camera(animObj->cameraID);
|
||||
seg = get_active_camera_segment_no_cutscenes();
|
||||
animObjTrans->x_position = seg->trans.x_position;
|
||||
animObjTrans->y_position = seg->trans.y_position;
|
||||
animObjTrans->z_position = seg->trans.z_position;
|
||||
animObjTrans->rotation.y_rotation = (0x8000 - seg->trans.rotation.y_rotation);
|
||||
animObjTrans->rotation.x_rotation = -seg->trans.rotation.x_rotation;
|
||||
animObjTrans->rotation.z_rotation = seg->trans.rotation.z_rotation;
|
||||
camera = cam_get_active_camera_no_cutscenes();
|
||||
animObjTrans->x_position = camera->trans.x_position;
|
||||
animObjTrans->y_position = camera->trans.y_position;
|
||||
animObjTrans->z_position = camera->trans.z_position;
|
||||
animObjTrans->rotation.y_rotation = (0x8000 - camera->trans.rotation.y_rotation);
|
||||
animObjTrans->rotation.x_rotation = -camera->trans.rotation.x_rotation;
|
||||
animObjTrans->rotation.z_rotation = camera->trans.rotation.z_rotation;
|
||||
}
|
||||
if ((entry->unk22 >= 10) && (entry->unk22 < 18)) {
|
||||
seg = &(*gRacers)[entry->unk22 - 10]->segment;
|
||||
ObjectSegment *seg = &(*gRacers)[entry->unk22 - 10]->segment;
|
||||
if (seg != NULL) {
|
||||
animObjTrans->x_position = seg->trans.x_position;
|
||||
animObjTrans->y_position = seg->trans.y_position;
|
||||
@@ -6664,7 +6664,7 @@ void mode_end_taj_race(s32 reason) {
|
||||
|
||||
CheckpointNode *func_800230D0(Object *obj, Object_Racer *racer) {
|
||||
CheckpointNode *lastCheckpointNode;
|
||||
ObjectSegment *activeCameraSegment;
|
||||
Camera *activeCameraSegment;
|
||||
s32 yOutCount;
|
||||
f32 yOut[9];
|
||||
Object *ptrList;
|
||||
@@ -6733,7 +6733,7 @@ CheckpointNode *func_800230D0(Object *obj, Object_Racer *racer) {
|
||||
racer->vehicleID = racer->vehicleIDPrev;
|
||||
if (racer->playerIndex != -1) {
|
||||
set_active_camera(racer->playerIndex);
|
||||
activeCameraSegment = get_active_camera_segment_no_cutscenes();
|
||||
activeCameraSegment = cam_get_active_camera_no_cutscenes();
|
||||
activeCameraSegment->trans.x_position = obj->segment.trans.x_position;
|
||||
activeCameraSegment->trans.y_position = obj->segment.trans.y_position;
|
||||
activeCameraSegment->trans.z_position = obj->segment.trans.z_position;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user