mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Match audioline_init (#497)
* Fix some AVOID_UB stuff, and some small documenting. * Fix m2ctx.py and add NON_EQUIV func_80045C48 * Minor issue cleanups * Clean up audioline_ambient_create match * Match func_80008040 as audioline_init, fix the generate ctx script, and some small warning stuff. * Minor work on func_80008174 so it can be NON_EQUIVALENT again * redefine asm abs * Hackishly fix the ctx file when generated. * Use some more constants and got rid of some start: auto stuff which is not recommended in splat anymore for BSS * Do some documenting, and slightly better matches using JFG source. * Formatting * Clean up some more audio stuff * Further cleanup and naming of things
This commit is contained in:
+15
-2
@@ -1,4 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
find include/ src/ -type f -name "*.h" | sed -e 's/.*/#include "\0"/' > ctx_includes.c
|
||||
.venv/bin/python3 tools/m2ctx.py ctx_includes.c
|
||||
if [ $# -eq 0 ]; then
|
||||
.venv/bin/python3 tools/python/m2ctx.py
|
||||
else
|
||||
find include/ src/ libultra/ -type f -name "*.h" | sed -e 's/.*/#include "\0"/' > ctx_includes.c
|
||||
.venv/bin/python3 tools/m2ctx.py ctx_includes.c
|
||||
fi
|
||||
|
||||
#Forcefully fix issues in the ctx.c file in the hackiest way for now. These defines mess things up.
|
||||
sed -i "/TT_COURSES$/d" ctx.c
|
||||
sed -i "/SAVE_COURSES$/d" ctx.c
|
||||
|
||||
sed -i 's/ u32 courseTime\[COURSE_RECORD_TOTAL\];/ u32 courseTime[47];/' ctx.c
|
||||
sed -i 's/ HudElement entry\[HUD_ELEMENT_COUNT\];/ HudElement entry[59];/' ctx.c
|
||||
sed -i 's/ void \*entry\[HUD_ELEMENT_COUNT\];/ void \*entry\[59\];/' ctx.c
|
||||
|
||||
+27
-3
@@ -486,6 +486,7 @@ enum AL_MIDIstatus {
|
||||
|
||||
enum AL_MIDIctrl {
|
||||
AL_MIDI_VOLUME_CTRL = 0x07,
|
||||
AL_MIDI_UNK_8 = 0x08,
|
||||
AL_MIDI_PAN_CTRL = 0x0A,
|
||||
AL_MIDI_PRIORITY_CTRL = 0x10, /* use general purpose controller for priority */
|
||||
AL_MIDI_FX_CTRL_0 = 0x14,
|
||||
@@ -591,6 +592,28 @@ typedef struct {
|
||||
u8 chan;
|
||||
} ALOscEvent;
|
||||
|
||||
typedef struct ALSoundState {
|
||||
/* 0x00 */ struct ALSoundState *next;
|
||||
/* 0x04 */ struct ALSoundState *prev;
|
||||
/* 0x08 */ struct ALSoundState *unk8;
|
||||
/* 0x0C */ ALVoice voice;
|
||||
/* 0x28 */ ALSound *sound; /* sound referenced here */
|
||||
/* 0x2C */ s16 priority;
|
||||
/* 0x30 */ f32 pitch; /* current playback pitch */
|
||||
/* 0x34 */ u8 pad34[0x2];
|
||||
/* 0x34 */ u8 soundPriority;
|
||||
/* 0x38 */ s16 vol; /* volume - combined with volume from bank */
|
||||
/* 0x3A */ ALPan pan; /* pan - 0 = left, 127 = right */
|
||||
/* 0x3C */ u8 fxMix; /* wet/dry mix - 0 = dry, 127 = wet */
|
||||
/* 0x3C */ u8 pad3C[2];
|
||||
/* 0x3E */ u8 flags;
|
||||
/* 0x3F */ u8 soundState;
|
||||
} ALSoundState;
|
||||
|
||||
typedef struct {
|
||||
ALSoundState *soundState;
|
||||
} ALSoundEvent;
|
||||
|
||||
typedef struct {
|
||||
s16 type;
|
||||
union {
|
||||
@@ -601,10 +624,11 @@ typedef struct {
|
||||
ALVolumeEvent vol;
|
||||
ALSeqpLoopEvent loop;
|
||||
ALSeqpVolEvent spvol;
|
||||
ALSeqpPriorityEvent sppriority;
|
||||
ALSeqpSeqEvent spseq;
|
||||
ALSeqpBankEvent spbank;
|
||||
ALSeqpPriorityEvent sppriority;
|
||||
ALSeqpSeqEvent spseq;
|
||||
ALSeqpBankEvent spbank;
|
||||
ALOscEvent osc;
|
||||
ALSoundEvent sndpevent;
|
||||
} msg;
|
||||
} ALEvent;
|
||||
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
f32 sinf(f32 x); //official name: fsin
|
||||
f32 cosf(f32 x);
|
||||
f32 sqrtf(f32 x);
|
||||
float sinf(float x); //official name: fsin
|
||||
float cosf(float x);
|
||||
float sqrtf(float x);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
#include "types.h"
|
||||
#include "structs.h"
|
||||
#include "macros.h"
|
||||
#include "save_layout.h"
|
||||
#include "src/save_data.h"
|
||||
#include "PR/os_cont.h"
|
||||
|
||||
/**
|
||||
* File contains the struct and macro definitions for the save layout for DKR.
|
||||
*/
|
||||
|
||||
#define NUMBER_OF_SAVE_FILES 3
|
||||
|
||||
#define TT_COURSES \
|
||||
unsigned courseAL : 1; \
|
||||
unsigned courseFC : 1; \
|
||||
|
||||
@@ -711,7 +711,7 @@ void __CSPHandleMIDIMsg(ALCSPlayer_Custom *seqp, ALEvent *event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (8):
|
||||
case (AL_MIDI_UNK_8):
|
||||
seqp->chanState[chan].fade = byte2;
|
||||
seqp->chanState[chan].vol = (seqp->chanState[chan].unk11 * seqp->chanState[chan].fade) / 127.0f;
|
||||
|
||||
@@ -770,7 +770,7 @@ void __CSPHandleMIDIMsg(ALCSPlayer_Custom *seqp, ALEvent *event)
|
||||
alSynSetFXMix(seqp->drvr, &vs->voice, byte2);
|
||||
}
|
||||
break;
|
||||
case (0x5F):
|
||||
case (AL_MIDI_UNK_5F):
|
||||
seqp->unk36 = byte2;
|
||||
for (i = 0; i < seqp->maxChannels; i++)
|
||||
{
|
||||
|
||||
+14
-12
@@ -13,8 +13,8 @@
|
||||
|
||||
/************ .data ************/
|
||||
|
||||
ALCSPlayer *gMusicPlayer = NULL;
|
||||
ALCSPlayer *gJinglePlayer = NULL;
|
||||
ALCSPlayer *gMusicPlayer = NULL; // Official Name: tuneSeqPlayer
|
||||
ALCSPlayer *gJinglePlayer = NULL; // Official Name: ambientSeqPlayer
|
||||
u8 gMusicBaseVolume = 127;
|
||||
u8 sfxRelativeVolume = 127;
|
||||
u8 gCanPlayMusic = TRUE;
|
||||
@@ -77,7 +77,7 @@ SoundMask *gRacerSoundMask;
|
||||
* Afterwards, set up the audio thread and start it.
|
||||
*/
|
||||
void audio_init(OSSched *sc) {
|
||||
s32 iCnt;
|
||||
s32 i;
|
||||
ALSynConfig synth_config;
|
||||
s32 *addrPtr;
|
||||
u32 seqfSize;
|
||||
@@ -116,14 +116,14 @@ void audio_init(OSSched *sc) {
|
||||
alSeqFileNew(gSequenceTable, get_rom_offset_of_asset(ASSET_AUDIO, addrPtr[ASSET_AUDIO_4]));
|
||||
gSeqLengthTable = (u32 *) mempool_alloc_safe((gSequenceTable->seqCount) * 4, COLOUR_TAG_CYAN);
|
||||
|
||||
for (iCnt = 0; iCnt < gSequenceTable->seqCount; iCnt++) {
|
||||
pad = (u32) (gSequenceTable + 8 + iCnt * 8); // Fakematch
|
||||
gSeqLengthTable[iCnt] = gSequenceTable->seqArray[iCnt].len;
|
||||
if (gSeqLengthTable[iCnt] & 1) {
|
||||
gSeqLengthTable[iCnt]++;
|
||||
for (i = 0; i < gSequenceTable->seqCount; i++) {
|
||||
pad = (u32) (gSequenceTable + 8 + i * 8); // Fakematch
|
||||
gSeqLengthTable[i] = gSequenceTable->seqArray[i].len;
|
||||
if (gSeqLengthTable[i] & 1) {
|
||||
gSeqLengthTable[i]++;
|
||||
}
|
||||
if (seqLength < gSeqLengthTable[iCnt]) {
|
||||
seqLength = gSeqLengthTable[iCnt];
|
||||
if (seqLength < gSeqLengthTable[i]) {
|
||||
seqLength = gSeqLengthTable[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ void audio_init(OSSched *sc) {
|
||||
synth_config.maxPVoices = 40;
|
||||
synth_config.maxUpdates = 96;
|
||||
synth_config.dmaproc = NULL;
|
||||
synth_config.fxType[0] = 6;
|
||||
synth_config.fxType[1] = 2;
|
||||
synth_config.fxType[0] = AL_FX_CUSTOM;
|
||||
synth_config.fxType[1] = AL_FX_BIGROOM;
|
||||
synth_config.outputRate = 0;
|
||||
synth_config.heap = &gALHeap;
|
||||
amCreateAudioMgr(&synth_config, 12, sc);
|
||||
@@ -650,6 +650,7 @@ u8 music_can_play(void) {
|
||||
|
||||
/**
|
||||
* Stops the currently playing jingle.
|
||||
* Official Name: amAmbientStop
|
||||
*/
|
||||
void music_jingle_stop(void) {
|
||||
if (music_jingle_playing() == SEQUENCE_NONE) {
|
||||
@@ -757,6 +758,7 @@ void music_jingle_play(u8 seqID) {
|
||||
|
||||
/**
|
||||
* If there's a jingle playing, return that, otherwise, return 0.
|
||||
* Official Name: amDittyPlaying
|
||||
*/
|
||||
u32 music_jingle_playing(void) {
|
||||
if (gCurrentJingleID && gCanPlayJingle && (gJinglePlayer->state == AL_PLAYING)) {
|
||||
|
||||
+67
-58
@@ -38,36 +38,32 @@ extern s8 gAudioLinesOff;
|
||||
extern SoundData *D_80119C40;
|
||||
extern unk80119C58 D_80119C58[];
|
||||
extern unk8011A6D8 D_8011A6D8[];
|
||||
extern SoundMask *gSoundMaskHeap;
|
||||
|
||||
#define SOUND_MASK_HEAP_COUNT 40
|
||||
|
||||
/*******************************/
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
// audioline_init
|
||||
void func_80008040(void) {
|
||||
s32 var_v0;
|
||||
void audioline_init(void) {
|
||||
s32 i;
|
||||
|
||||
sound_table_properties(&D_80119C40, NULL, NULL);
|
||||
gSoundMaskHeap = mempool_alloc_safe(0x5A0, COLOUR_TAG_CYAN);
|
||||
gSoundMaskHeapFree = mempool_alloc_safe(0xA0, COLOUR_TAG_CYAN);
|
||||
gSoundMaskHeapUsed = mempool_alloc_safe(0xA0, COLOUR_TAG_CYAN);
|
||||
gSoundMaskHeap = mempool_alloc_safe(sizeof(SoundMask) * SOUND_MASK_HEAP_COUNT, COLOUR_TAG_CYAN);
|
||||
gSoundMaskHeapFree = mempool_alloc_safe(sizeof(uintptr_t) * SOUND_MASK_HEAP_COUNT, COLOUR_TAG_CYAN);
|
||||
gSoundMaskHeapUsed = mempool_alloc_safe(sizeof(uintptr_t) * SOUND_MASK_HEAP_COUNT, COLOUR_TAG_CYAN);
|
||||
gUsedMasks = 0;
|
||||
for (var_v0 = 0; var_v0 < 7; var_v0++) {
|
||||
D_80119C58[var_v0].unk4 = NULL;
|
||||
for (i = 0; i < 7; i++) {
|
||||
D_80119C58[i].unk178 = NULL;
|
||||
}
|
||||
for (var_v0 = 0; var_v0 < 10; var_v0++) {
|
||||
gSoundMaskHeap[var_v0]->unk18 = 0;
|
||||
gSoundMaskHeap[var_v0]->unk3C = 0;
|
||||
gSoundMaskHeap[var_v0]->unk60 = 0;
|
||||
gSoundMaskHeap[var_v0]->unk84 = 0;
|
||||
for (i = 0; i < SOUND_MASK_HEAP_COUNT; i++) {
|
||||
gSoundMaskHeap[i].unk18 = 0;
|
||||
}
|
||||
func_80008174();
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/audio_spatial/func_80008040.s")
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Stop any playing jingles, then block audio lines from playing anymore.
|
||||
* Official Name: amAmbientPause
|
||||
*/
|
||||
void audioline_off(void) {
|
||||
music_jingle_stop();
|
||||
@@ -76,6 +72,7 @@ void audioline_off(void) {
|
||||
|
||||
/**
|
||||
* Allow audio lines to play jingles.
|
||||
* Official Name: amAmbientRestart
|
||||
*/
|
||||
void audioline_on(void) {
|
||||
gAudioLinesOff = FALSE;
|
||||
@@ -83,22 +80,26 @@ void audioline_on(void) {
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
extern f32 D_80119C60[672];
|
||||
extern f32 D_8011A6E0[336]; //[7][48];
|
||||
extern f32 D_8011A6E0[7][48];
|
||||
extern unk8011A6D8 **D_8011A6DC;
|
||||
extern unk80119C58 **D_80119C5C;
|
||||
// extern void sound_stop(u8 *arg0);
|
||||
// audioline_reset
|
||||
void func_80008174(void) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
u8 *sound;
|
||||
|
||||
for (gFreeMasks = 0; gFreeMasks < 40; gFreeMasks++) {
|
||||
gSoundMaskHeapFree[gFreeMasks] = (SoundMask *) gSoundMaskHeap[gFreeMasks];
|
||||
for (gFreeMasks = 0; gFreeMasks < SOUND_MASK_HEAP_COUNT; gFreeMasks++) {
|
||||
gSoundMaskHeapFree[gFreeMasks] = &gSoundMaskHeap[gFreeMasks];
|
||||
}
|
||||
gFreeMasks--;
|
||||
|
||||
for (i = 0; i < gUsedMasks; i++) {
|
||||
sound = (u8 *) gSoundMaskHeapUsed[i]->unk18;
|
||||
gSoundMaskHeapUsed[i]->unk12 = 0;
|
||||
if (gSoundMaskHeapUsed[i]->unk18 != NULL) {
|
||||
sound_stop(gSoundMaskHeapUsed[i]->unk18);
|
||||
if (sound != NULL) {
|
||||
sound_stop(sound);
|
||||
}
|
||||
}
|
||||
gUsedMasks = 0;
|
||||
@@ -114,19 +115,20 @@ void func_80008174(void) {
|
||||
D_80119C58[i].unk178 = 0;
|
||||
}
|
||||
D_80119C58[i].unk17C = -1;
|
||||
D_80119C5C[i]->unk0.unk0_01 = -100000.0f;
|
||||
|
||||
D_80119C60[i] = -100000.0;
|
||||
D_80119C60[i] = -100000.0f;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8011A6E0); i++) {
|
||||
D_8011A6D8[i].unkB8 = -1;
|
||||
D_8011A6D8[i].unk0.unk0_01 = 0.0f;
|
||||
D_8011A6D8[i].unkBC = 0.0f;
|
||||
D_8011A6DC[i]->unk0.unk0_01 = -100000.0;
|
||||
D_8011A6E0[i] = -100000.0;
|
||||
// for (j = 0; j < ARRAY_COUNT(D_8011A6E0[0]); j++) {
|
||||
// D_8011A6E0[i][j] = -100000.0;
|
||||
// }
|
||||
D_8011A6DC[i]->unk0.unk0_01 = -100000.0f;
|
||||
D_8011A6E0[i][0] = -100000.0f;
|
||||
for (j = 0; j < ARRAY_COUNT(D_8011A6E0[0]); j++) {
|
||||
D_8011A6E0[i][j] = -100000.0f;
|
||||
}
|
||||
}
|
||||
|
||||
gAudioLinesOff = 0;
|
||||
@@ -136,26 +138,30 @@ void func_80008174(void) {
|
||||
#endif
|
||||
|
||||
// audioline_ambient
|
||||
// Official Name: amPlayAudioMap
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/audio_spatial/func_80008438.s")
|
||||
|
||||
s32 func_800090C0(f32 arg0, f32 arg1, s32 arg2) {
|
||||
/**
|
||||
* Official Name: amCalcSfxStereo
|
||||
*/
|
||||
s32 func_800090C0(f32 x, f32 z, s32 yRot) {
|
||||
s32 temp_v1;
|
||||
s32 ret;
|
||||
f32 sp1C;
|
||||
|
||||
sp1C = sqrtf((arg0 * arg0) + (arg1 * arg1));
|
||||
temp_v1 = 0xFFFF - arctan2_f(arg0, arg1);
|
||||
sp1C = sqrtf((x * x) + (z * z));
|
||||
temp_v1 = 0xFFFF - arctan2_f(x, z);
|
||||
|
||||
if (temp_v1 < arg2) {
|
||||
if (temp_v1 < yRot) {
|
||||
if (sp1C <= 1.0f) {
|
||||
ret = 64 - ((sins_s16(arg2 - temp_v1) / 1024) * (sp1C * 1));
|
||||
ret = 64 - ((sins_s16(yRot - temp_v1) / 1024) * (sp1C * 1));
|
||||
} else {
|
||||
ret = 64 - (sins_2(arg2 - temp_v1) / 1024);
|
||||
ret = 64 - (sins_2(yRot - temp_v1) / 1024);
|
||||
}
|
||||
} else if (sp1C <= 1.0f) {
|
||||
ret = (sins_s16(temp_v1 - arg2) / 1024) * (sp1C * 1) + 64;
|
||||
ret = (sins_s16(temp_v1 - yRot) / 1024) * (sp1C * 1) + 64;
|
||||
} else {
|
||||
ret = (sins_2(temp_v1 - arg2) / 1024) + 64;
|
||||
ret = (sins_2(temp_v1 - yRot) / 1024) + 64;
|
||||
}
|
||||
|
||||
if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) {
|
||||
@@ -241,10 +247,13 @@ void update_spatial_audio_position(SoundMask *arg0, f32 x, f32 y, f32 z) {
|
||||
arg0->pos.z = z;
|
||||
}
|
||||
|
||||
void func_800096F8(SoundMask *arg0) {
|
||||
/**
|
||||
* Official Name: amSndStopXYZ
|
||||
*/
|
||||
void func_800096F8(SoundMask *soundMask) {
|
||||
s32 i;
|
||||
for (i = 0; i < 40; i++) {
|
||||
if (arg0 == gSoundMaskHeapUsed[i]) {
|
||||
for (i = 0; i < SOUND_MASK_HEAP_COUNT; i++) {
|
||||
if (soundMask == gSoundMaskHeapUsed[i]) {
|
||||
func_8000A2E8(i);
|
||||
break;
|
||||
}
|
||||
@@ -258,7 +267,7 @@ void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volu
|
||||
if (soundMask != NULL) {
|
||||
func_800245B4(soundBite | 0xE000);
|
||||
}
|
||||
if (gUsedMasks == 40) {
|
||||
if (gUsedMasks == SOUND_MASK_HEAP_COUNT) {
|
||||
if (soundMask != NULL) {
|
||||
*soundMask = NULL;
|
||||
}
|
||||
@@ -287,27 +296,27 @@ void func_8000974C(u16 soundBite, f32 x, f32 y, f32 z, u8 arg4, u8 arg5, u8 volu
|
||||
|
||||
void audioline_ambient_create(u8 arg0, u16 soundId, f32 x, f32 y, f32 z, u8 arg5, u8 arg6, u8 arg7, u8 arg8, u16 arg9,
|
||||
u8 argA, u8 lineID, u8 argC) {
|
||||
Vec3f *temp_a0;
|
||||
unk80119C58 *temp_v1;
|
||||
f32 *temp_a0;
|
||||
|
||||
if ((lineID < 7) && (argC < 30)) {
|
||||
if (lineID < 7 && argC < 30) {
|
||||
temp_v1 = &D_80119C58[lineID];
|
||||
temp_a0 = (Vec3f *) (((u32 *) &temp_v1->unk4) + argC * 3); // This can't be right...
|
||||
temp_a0->x = x;
|
||||
temp_a0->y = y;
|
||||
temp_a0->z = z;
|
||||
temp_a0 = &temp_v1->unk4[argC * 3];
|
||||
temp_a0[0] = x;
|
||||
temp_a0[1] = y;
|
||||
temp_a0[2] = z;
|
||||
if (argC == 0) {
|
||||
(&D_80119C58[lineID])->soundID = soundId;
|
||||
(&D_80119C58[lineID])->unk0.unk0_02 = arg0;
|
||||
(&D_80119C58[lineID])->unk170 = arg9;
|
||||
(&D_80119C58[lineID])->unk17D = argA;
|
||||
(&D_80119C58[lineID])->unk174 = arg6;
|
||||
(&D_80119C58[lineID])->unk175 = arg5;
|
||||
(&D_80119C58[lineID])->unk176 = arg7;
|
||||
(&D_80119C58[lineID])->unk17E = arg8;
|
||||
temp_v1->soundID = soundId;
|
||||
temp_v1->unk0.unk0_02 = arg0;
|
||||
temp_v1->unk170 = arg9;
|
||||
temp_v1->unk17D = argA;
|
||||
temp_v1->unk174 = arg6;
|
||||
temp_v1->unk175 = arg5;
|
||||
temp_v1->unk176 = arg7;
|
||||
temp_v1->unk17E = arg8;
|
||||
}
|
||||
if ((&D_80119C58[lineID])->unk17C < argC) {
|
||||
(&D_80119C58[lineID])->unk17C = argC;
|
||||
if (temp_v1->unk17C < argC) {
|
||||
temp_v1->unk17C = argC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -537,7 +546,7 @@ void debug_render_line(Gfx **dList, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
temp_verts[3].a = 255;
|
||||
temp_verts += 4;
|
||||
|
||||
temp_tris[0].flags = 0x40; // 0x40 = Draw backface.
|
||||
temp_tris[0].flags = BACKFACE_DRAW;
|
||||
temp_tris[0].vi0 = 2;
|
||||
temp_tris[0].vi1 = 1;
|
||||
temp_tris[0].vi2 = 0;
|
||||
@@ -547,7 +556,7 @@ void debug_render_line(Gfx **dList, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
temp_tris[0].uv1.v = 0;
|
||||
temp_tris[0].uv2.u = 1;
|
||||
temp_tris[0].uv2.v = 0;
|
||||
temp_tris[1].flags = 0x40;
|
||||
temp_tris[1].flags = BACKFACE_DRAW;
|
||||
temp_tris[1].vi0 = 3;
|
||||
temp_tris[1].vi1 = 2;
|
||||
temp_tris[1].vi2 = 1;
|
||||
|
||||
+1
-1
@@ -66,11 +66,11 @@ void debug_render_line(Gfx **dList, Vertex **verts, Triangle **tris, floatXYZVal
|
||||
void func_80006BFC(Object *obj, ObjectSegment *segment, Object *obj2, s32 updateRate);
|
||||
void update_spatial_audio_position(SoundMask *arg0, f32 x, f32 y, f32 z);
|
||||
s32 func_80009AB4(u8 arg0);
|
||||
void audioline_init(void);
|
||||
|
||||
s32 audioline_distance(f32 inX, f32 inY, f32 inZ, floatXYZVals *floatXYZ, f32 *outX, f32 *outY, f32 *outZ);
|
||||
void func_80009968(f32, f32, f32, u8, u8, u8); // Non Matching
|
||||
void func_80008174(void); // Non Matching
|
||||
void func_80008040(void); // Non Matching
|
||||
void func_80008438(Object **arg0, s32 numRacers, s32 updateRate); // Non Matching
|
||||
void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3, s32 updateRate); // Non Matching
|
||||
|
||||
|
||||
+4
-4
@@ -27,7 +27,7 @@ VehicleSoundData *gRacerSound;
|
||||
Object_Racer *gSoundRacerObj;
|
||||
SoundData *D_80119C40; // This should be in audio_spatial?
|
||||
SoundMask **gSoundMaskHeapUsed;
|
||||
unk80119C48 **gSoundMaskHeap; // 0x24 struct size - 0x5A0 total size - should be 40 elements
|
||||
SoundMask **gSoundMaskHeap; // 0x24 struct size - 0x5A0 total size - should be 40 elements
|
||||
u8 gFreeMasks;
|
||||
SoundMask **gSoundMaskHeapFree;
|
||||
s32 D_80119C54; // Padding?
|
||||
@@ -748,7 +748,7 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
objs[loopCount1]->segment.trans.z_position);
|
||||
sound_event_update((s32) gRacerSound->unk50, 8, temp_s3 << 8);
|
||||
sound_event_update((s32) gRacerSound->unk50, 16, *((u32 *) &sp8C));
|
||||
func_80004604(gRacerSound->unk50, 80);
|
||||
func_80004604((ALSoundState *) gRacerSound->unk50, 80);
|
||||
sound_event_update((s32) gRacerSound->unk50, 4, gRacerSound->unk91[0]);
|
||||
}
|
||||
} else if (gRacerSound->unk50 != NULL) {
|
||||
@@ -785,7 +785,7 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
objs[loopCount1]->segment.trans.y_position, objs[loopCount1]->segment.trans.z_position);
|
||||
sound_event_update((s32) gRacerSound->unk48[loopCount2], 8, temp_s3 << 8);
|
||||
sound_event_update((s32) gRacerSound->unk48[loopCount2], 16, *((u32 *) &sp8C));
|
||||
func_80004604(gRacerSound->unk48[loopCount2], 80);
|
||||
func_80004604((ALSoundState *) gRacerSound->unk48[loopCount2], 80);
|
||||
if (arg3 != 1) {
|
||||
gRacerSound->unk91[0] = 64;
|
||||
}
|
||||
@@ -930,7 +930,7 @@ void func_80006FC8(Object **objs, s32 numRacers, ObjectSegment *segment, u8 arg3
|
||||
temp->unk91[0] = 64;
|
||||
}
|
||||
sound_event_update((s32) temp->unk48[0], 4, temp->unk91[0]);
|
||||
func_80004604(temp->unk48[0], 70);
|
||||
func_80004604((ALSoundState *) temp->unk48[0], 70);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-11
@@ -5,22 +5,14 @@
|
||||
#include "structs.h"
|
||||
#include "audio.h"
|
||||
|
||||
/* Size: 0x90 / 144 bytes */
|
||||
typedef struct unk80119C48 {
|
||||
s32 unk18;
|
||||
s32 unk3C;
|
||||
s32 unk60;
|
||||
s32 unk84;
|
||||
} unk80119C48;
|
||||
|
||||
/* Size: 0x180 / 384 bytes */
|
||||
typedef struct unk80119C58 {
|
||||
union {
|
||||
/* 0x00 */ f32 unk0_01;
|
||||
/* 0x00 */ u8 unk0_02;
|
||||
/* 0x00 */ s32 unk0_03;
|
||||
} unk0;
|
||||
/* 0x004 */ Vec3f *unk4;
|
||||
/* 0x008 */ u8 pad9[0x164];
|
||||
/* 0x004 */ f32 unk4[30 * 3]; // Should be a Vec3f, but that just doesn't match
|
||||
/* 0x16C */ s32 soundID;
|
||||
/* 0x170 */ s32 unk170;
|
||||
/* 0x174 */ u8 unk174;
|
||||
@@ -133,7 +125,6 @@ extern u8 gVehicleSounds;
|
||||
extern s32 D_800DC6D8;
|
||||
extern s32 D_800DC6DC;
|
||||
extern u16 gUsedMasks;
|
||||
extern unk80119C48 **gSoundMaskHeap;
|
||||
extern SoundMask **gSoundMaskHeapUsed;
|
||||
extern SoundMask **gSoundMaskHeapFree;
|
||||
extern u8 gFreeMasks;
|
||||
|
||||
+56
-28
@@ -49,6 +49,7 @@ void set_sound_channel_count(s32 numChannels) {
|
||||
|
||||
/**
|
||||
* Initialise a sound player and ready it for use with the sound event system.
|
||||
* Official Name: gsSndpNew
|
||||
*/
|
||||
void alSndPNew(audioMgrConfig *c) {
|
||||
u32 i;
|
||||
@@ -121,7 +122,7 @@ ALMicroTime _sndpVoiceHandler(void *node) {
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/audiosfx/_handleEvent.s")
|
||||
|
||||
void func_8000410C(ALSoundState *state) {
|
||||
if (state->unk3E & 4) {
|
||||
if (state->flags & AL_SNDP_PAN_EVT) {
|
||||
alSynStopVoice(gAlSndPlayerPtr->drvr, &state->voice);
|
||||
alSynFreeVoice(gAlSndPlayerPtr->drvr, &state->voice);
|
||||
}
|
||||
@@ -169,6 +170,9 @@ static void _removeEvents(ALEventQueue *evtq, ALSoundState *state, u16 eventType
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Official Name: getSoundStateCounts
|
||||
*/
|
||||
u16 func_800042CC(u16 *lastAllocListIndex, u16 *lastFreeListIndex) {
|
||||
OSIntMask mask;
|
||||
u16 freeListNextIndex;
|
||||
@@ -207,7 +211,7 @@ u16 func_800042CC(u16 *lastAllocListIndex, u16 *lastFreeListIndex) {
|
||||
|
||||
// This function is full of names like next / prev that I made up based on other funcs.
|
||||
// It's in no way guaranteed to be correct.
|
||||
// I"m really not even sure what it's supposed to be returning as a type.
|
||||
// I'm really not even sure what it's supposed to be returning as a type.
|
||||
ALSound *func_80004384(UNUSED ALBank *arg0, ALSound *arg1) {
|
||||
s32 temp;
|
||||
ALKeyMap *temp_a2;
|
||||
@@ -260,17 +264,24 @@ ALSound *func_80004384(UNUSED ALBank *arg0, ALSound *arg1) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/audiosfx/func_80004520.s")
|
||||
|
||||
void func_80004604(u8 *arg0, u8 arg1) {
|
||||
if (arg0) {
|
||||
arg0[0x36] = arg1;
|
||||
/**
|
||||
* Official Name: gsSndpSetPriority
|
||||
*/
|
||||
void func_80004604(ALSoundState *sndp, u8 priority) {
|
||||
if (sndp != NULL) {
|
||||
sndp->soundPriority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED u8 func_8000461C(u8 *arg0) {
|
||||
if (arg0) {
|
||||
return arg0[0x3F];
|
||||
/**
|
||||
* Official Name: gsSndpGetState
|
||||
*/
|
||||
UNUSED u8 func_8000461C(ALSoundState *sndp) {
|
||||
if (sndp != NULL) {
|
||||
return sndp->soundState;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_80004638(ALBank *bnk, s16 sndIndx, SoundMask *soundMask) {
|
||||
@@ -285,48 +296,61 @@ s32 func_80004668(ALBank *bnk, s16 sndIndx, u8 arg2, SoundMask *soundMask) {
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/audiosfx/func_80004668.s")
|
||||
#endif
|
||||
|
||||
// input typing not right (some type of struct)
|
||||
// 99% sure this function will clear the audio buffer associated with a given sound mask.
|
||||
void sound_stop(u8 *arg0) {
|
||||
ALEvent sp_18;
|
||||
sp_18.type = 1024;
|
||||
//((u32 *)(&sp_18))[1] = (u32)arg0;
|
||||
sp_18.msg.osc.vs = (ALVoiceState *) arg0; // Not really a voice state, but not sure what else it is.
|
||||
if (arg0) {
|
||||
arg0[0x3e] &= ~(1 << 4);
|
||||
alEvtqPostEvent(&(gAlSndPlayerPtr->evtq), &sp_18, 0);
|
||||
/**
|
||||
* input typing not right (some type of struct)
|
||||
* 99% sure this function will clear the audio buffer associated with a given sound mask.
|
||||
* Official Name: gsSndpStop
|
||||
*/
|
||||
void sound_stop(ALSoundState *sndp) {
|
||||
ALEvent alEvent;
|
||||
|
||||
alEvent.type = AL_SNDP_UNK_10_EVT;
|
||||
alEvent.msg.sndpevent.soundState = sndp;
|
||||
if (sndp != NULL) {
|
||||
sndp->flags &= ~AL_SNDP_PITCH_EVT;
|
||||
alEvtqPostEvent(&gAlSndPlayerPtr->evtq, &alEvent, 0);
|
||||
} else {
|
||||
// From JFG
|
||||
// osSyncPrintf("WARNING: Attempt to stop NULL sound aborted\n");
|
||||
}
|
||||
}
|
||||
|
||||
void func_800048D8(u8 event) {
|
||||
u32 intMask;
|
||||
OSIntMask mask;
|
||||
ALEvent evt;
|
||||
ALSoundState *queue;
|
||||
|
||||
intMask = osSetIntMask(OS_IM_NONE);
|
||||
mask = osSetIntMask(OS_IM_NONE);
|
||||
queue = D_800DC6B0.next;
|
||||
while (queue != NULL) {
|
||||
evt.type = AL_SNDP_UNK_10_EVT;
|
||||
evt.msg.end.ticks = (s32) queue; // TODO: find the correct value for this.
|
||||
if ((queue->unk3E & event) == event) {
|
||||
queue->unk3E &= ~AL_SNDP_PITCH_EVT;
|
||||
evt.msg.sndpevent.soundState = queue;
|
||||
if ((queue->flags & event) == event) {
|
||||
evt.msg.sndpevent.soundState->flags &= ~AL_SNDP_PITCH_EVT;
|
||||
alEvtqPostEvent(&gAlSndPlayerPtr->evtq, &evt, 0);
|
||||
}
|
||||
queue = (ALSoundState *) queue->next;
|
||||
queue = queue->next;
|
||||
}
|
||||
osSetIntMask(intMask);
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Official Name: gsSndpStopAll
|
||||
*/
|
||||
UNUSED void func_80004998(void) {
|
||||
func_800048D8(AL_SNDP_PLAY_EVT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Official Name: gsSndpStopAllRetrigger
|
||||
*/
|
||||
UNUSED void func_800049B8(void) {
|
||||
func_800048D8(AL_SNDP_PLAY_EVT | AL_SNDP_PITCH_EVT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops all sounds from playing.
|
||||
* Official Name: gsSndpStopAllLooped
|
||||
*/
|
||||
void sound_stop_all(void) {
|
||||
func_800048D8(AL_SNDP_PLAY_EVT | AL_SNDP_STOP_EVT);
|
||||
@@ -334,14 +358,18 @@ void sound_stop_all(void) {
|
||||
|
||||
/**
|
||||
* Send a message to the sound player to update an existing property of the sound entry.
|
||||
* Official Name: gsSndpSetParam
|
||||
*/
|
||||
void sound_event_update(s32 soundMask, s16 type, u32 volume) {
|
||||
ALEvent2 sndEvt;
|
||||
sndEvt.snd_event.type = type;
|
||||
sndEvt.snd_event.state = (void *) soundMask;
|
||||
sndEvt.snd_event.param = volume;
|
||||
if (soundMask) {
|
||||
alEvtqPostEvent(&(gAlSndPlayerPtr->evtq), (ALEvent *) &sndEvt, 0);
|
||||
if (soundMask != NULL) {
|
||||
alEvtqPostEvent(&gAlSndPlayerPtr->evtq, (ALEvent *) &sndEvt, 0);
|
||||
} else {
|
||||
// From JFG
|
||||
// osSyncPrintf("WARNING: Attempt to modify NULL sound aborted\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-16
@@ -28,21 +28,13 @@ typedef struct ALUnkStruct {
|
||||
/* 0x08 */ struct ALSoundState *unk8;
|
||||
} ALUnkStruct;
|
||||
|
||||
typedef struct ALSoundState {
|
||||
/* 0x00 */ struct ALSoundState *next;
|
||||
/* 0x04 */ struct ALSoundState *prev;
|
||||
/* 0x08 */ struct ALSoundState *unk8;
|
||||
/* 0x0C */ ALVoice voice;
|
||||
/* 0x28 */ ALSound *sound; /* sound referenced here */
|
||||
/* 0x2C */ s16 priority;
|
||||
/* 0x30 */ f32 pitch; /* current playback pitch */
|
||||
/* 0x34 */ s32 state; /* play state for this sound */
|
||||
/* 0x38 */ s16 vol; /* volume - combined with volume from bank */
|
||||
/* 0x3A */ ALPan pan; /* pan - 0 = left, 127 = right */
|
||||
/* 0x3C */ u8 fxMix; /* wet/dry mix - 0 = dry, 127 = wet */
|
||||
/* 0x3C */ u8 pad3C[2];
|
||||
/* 0x3E */ u8 unk3E;
|
||||
} ALSoundState;
|
||||
// typedef struct {
|
||||
// u8 pad[0x36];
|
||||
// u8 priority;
|
||||
// u8 pad37[0x7];
|
||||
// u8 flags;
|
||||
// u8 state;
|
||||
// } AlMsgUnk400Type_Unk0;
|
||||
|
||||
typedef struct unk80004384 {
|
||||
/* 0x00 */ struct ALSoundState *next;
|
||||
@@ -167,7 +159,7 @@ void alSndPNew(audioMgrConfig *c);
|
||||
ALMicroTime _sndpVoiceHandler(void *node);
|
||||
void func_8000410C(ALSoundState *state);
|
||||
u16 func_800042CC(u16 *lastAllocListIndex, u16 *lastFreeListIndex);
|
||||
void func_80004604(u8 *arg0, u8 arg1);
|
||||
void func_80004604(ALSoundState *sndp, u8 priority);
|
||||
s32 func_80004638(ALBank *bnk, s16 sndIndx, SoundMask *soundMask);
|
||||
void sound_stop_all(void);
|
||||
void sound_event_update(s32 soundMask, s16 type, u32 volume);
|
||||
|
||||
+1
-1
@@ -513,7 +513,7 @@ void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, Ali
|
||||
}
|
||||
}
|
||||
#else
|
||||
void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, enum AlignmentFlags alignmentFlags,
|
||||
void render_text_string(Gfx **dList, DialogueBoxBackground *box, char *text, AlignmentFlags alignmentFlags,
|
||||
f32 scisScale) {
|
||||
s32 jpTexS;
|
||||
s32 prevFont;
|
||||
|
||||
@@ -380,4 +380,4 @@ leaf obj_animate
|
||||
/* 62E80 80062280 8FB10004 */ lw $s1, 0x4($sp)
|
||||
/* 62E84 80062284 03E00008 */ jr $ra
|
||||
/* 62E88 80062288 27BD0008 */ addiu $sp, $sp, 0x8
|
||||
.end obj_animate
|
||||
.end obj_animate
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ 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(Matrix mf, float x, float y, float z, float *ox, float *oy, float *oz);
|
||||
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);
|
||||
|
||||
@@ -639,9 +639,7 @@ UNUSED s32 find_active_pool_slot_colours(void) {
|
||||
stubbed_printf("Unable to record %d slots, colours overflowed table.\n", numOverflows);
|
||||
}
|
||||
numOverflows = slotColour;
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-4
@@ -1217,10 +1217,11 @@ s16 gTrackSelectPreviewObjectIndices[36] = { 0x0004, 0x0000, 0x0001, 0x0002, 0x0
|
||||
0x001C, 0x001D, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A,
|
||||
0x002B, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x002C, 0x002D,
|
||||
#if VERSION >= VERSION_79
|
||||
0x002E, 0x002F, 0x0030, 0x0031, 0x0040, 0x0041, 0x0043, 0x0069, 0xFFFF };
|
||||
0x002E, 0x002F, 0x0030, 0x0031, 0x0040, 0x0041, 0x0043, 0x0069, 0xFFFF
|
||||
#else
|
||||
0x002E, 0x002F, 0x0030, 0x0031, 0x0040, 0x0041, 0x0043, 0x005E, 0xFFFF };
|
||||
0x002E, 0x002F, 0x0030, 0x0031, 0x0040, 0x0041, 0x0043, 0x005E, 0xFFFF
|
||||
#endif
|
||||
};
|
||||
|
||||
s16 gTrackSelectPreviewImageIndices[8] = { 0x07, 0x00, 0x01, 0x02, 0x03, 0x0B, 0x0C, -1 };
|
||||
|
||||
@@ -1413,10 +1414,11 @@ s32 gIndexOfCurInputCharacter = 0;
|
||||
|
||||
s16 gAdvTrackInitObjectIndices[18] = { 0x0004, 0x0000, 0x0001, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
|
||||
#if VERSION >= VERSION_79
|
||||
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0030, 0x0069, -1 };
|
||||
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0030, 0x0069, -1
|
||||
#else
|
||||
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0030, 0x005E, -1 };
|
||||
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0030, 0x005E, -1
|
||||
#endif
|
||||
};
|
||||
|
||||
s16 gAdvTrackInitImageIndices[6] = { 7, 0, 1, 2, 3, -1 };
|
||||
|
||||
|
||||
+3
-4
@@ -197,13 +197,12 @@ void func_800B4A08(s32 setting) {
|
||||
|
||||
/* Official name: sprintf */
|
||||
UNUSED int sprintf(char *s, const char *format, ...) {
|
||||
s32 ret;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsprintf(s, format, args);
|
||||
ret = vsprintf(s, format, args);
|
||||
va_end(args);
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Official Name: vsprintf
|
||||
|
||||
+218
@@ -675,7 +675,225 @@ void func_80045128(Object **racerObjs) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/racer/func_800452A0.s")
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
void func_80045C48(Object *obj, Object_Racer *racer, s32 updateRate) {
|
||||
s32 overrideMagnitude;
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
f32 xDerivative;
|
||||
f32 yDerivative;
|
||||
f32 zDerivative;
|
||||
CheckpointNode *checkpoint;
|
||||
f32 splineX[5];
|
||||
f32 splineY[5];
|
||||
f32 splineZ[5];
|
||||
f32 temp_f0;
|
||||
f32 temp_f0_3;
|
||||
f32 temp_f20_2;
|
||||
f32 magnitude;
|
||||
s16 temp_a1;
|
||||
s16 temp_s0;
|
||||
s16 temp_t5;
|
||||
s16 temp_v0_3;
|
||||
s16 temp_v0_5;
|
||||
s32 temp_a0;
|
||||
s32 temp_s0_2;
|
||||
s32 splineEnd;
|
||||
s32 var_a0;
|
||||
s32 var_a0_2;
|
||||
s32 splinePos;
|
||||
s32 i;
|
||||
s32 var_v0;
|
||||
s32 var_v1_2;
|
||||
s32 var_v1_4;
|
||||
|
||||
gCurrentRacerInput = 0;
|
||||
gCurrentButtonsPressed = 0;
|
||||
gCurrentButtonsReleased = 0;
|
||||
gCurrentStickX = 0;
|
||||
gCurrentStickY = 0;
|
||||
splineEnd = get_checkpoint_count();
|
||||
if (splineEnd == 0) {
|
||||
gCurrentStickX = 25;
|
||||
return;
|
||||
}
|
||||
overrideMagnitude = FALSE;
|
||||
magnitude = 1.0 - racer->checkpoint_distance;
|
||||
splinePos = racer->checkpoint - 2;
|
||||
if (magnitude < 0.0) {
|
||||
magnitude = 0.0f;
|
||||
}
|
||||
if (magnitude > 1.0) {
|
||||
magnitude = 1.0f;
|
||||
}
|
||||
if (splinePos < 0) {
|
||||
splinePos += splineEnd;
|
||||
}
|
||||
if (splinePos >= splineEnd) {
|
||||
splinePos -= splineEnd;
|
||||
}
|
||||
for (i = 0; i < 5; i++) {
|
||||
checkpoint = find_next_checkpoint_node(splinePos, racer->unk1C8);
|
||||
splineX[i] = checkpoint->x;
|
||||
splineY[i] = checkpoint->y;
|
||||
splineZ[i] = checkpoint->z;
|
||||
splinePos++;
|
||||
if (racer->unk1C9 == 0) {
|
||||
checkpoint[i + 1].unk24 = (f32) checkpoint->unk2E[racer->unk1CA];
|
||||
checkpoint[i + 2].unk24 = (f32) checkpoint->unk32[racer->unk1CA];
|
||||
//(sp + i)->unk74 = (f32) checkpoint->unk2E[racer->unk1CA];
|
||||
//(sp + i)->unk64 = (f32) checkpoint->unk32[racer->unk1CA];
|
||||
splineX[i] += checkpoint->scale * checkpoint->rotationZFrac * (f32) checkpoint->unk2E[racer->unk1CA];
|
||||
splineY[i] += checkpoint->scale * (f32) checkpoint->unk32[racer->unk1CA];
|
||||
splineZ[i] += checkpoint->scale * -checkpoint->rotationXFrac * (f32) checkpoint->unk2E[racer->unk1CA];
|
||||
}
|
||||
if (splinePos == splineEnd) {
|
||||
splinePos = 0;
|
||||
}
|
||||
}
|
||||
if (racer->unk1C9 == 0) {
|
||||
racer->unk1BA = magnitude; //(s16) (s32) (((sp7C - sp78) * var_f20) + sp78);
|
||||
racer->unk1BC = magnitude; //(s16) (s32) (((sp6C - sp68) * var_f20) + sp68);
|
||||
}
|
||||
xDerivative = func_8002277C(splineX, 0, magnitude);
|
||||
yDerivative = func_8002277C(splineY, 0, magnitude);
|
||||
zDerivative = func_8002277C(splineZ, 0, magnitude);
|
||||
temp_f0 = sqrtf((xDerivative * xDerivative) + (yDerivative * yDerivative) + (zDerivative * zDerivative));
|
||||
if (temp_f0 != 0.0f) {
|
||||
temp_f0 = 100.0f / temp_f0;
|
||||
xDerivative *= temp_f0;
|
||||
yDerivative *= temp_f0;
|
||||
zDerivative *= temp_f0;
|
||||
}
|
||||
temp_s0 = arctan2_f(xDerivative, zDerivative) - 0x8000;
|
||||
temp_v0_3 = arctan2_f(yDerivative, 100.0f);
|
||||
racer->unk1C2 = racer->unk1BE;
|
||||
temp_a1 = temp_v0_3 & 0xFFFF;
|
||||
temp_t5 = racer->unk1C0;
|
||||
racer->unk1BE = temp_s0;
|
||||
racer->unk1C0 = temp_a1;
|
||||
racer->unk1C4 = temp_t5;
|
||||
var_a0 = temp_s0 - (racer->unk1C2 & 0xFFFF);
|
||||
if (var_a0 > 0x8000) {
|
||||
var_a0 -= 0xFFFF;
|
||||
}
|
||||
if (var_a0 < -0x8000) {
|
||||
var_a0 += 0xFFFF;
|
||||
}
|
||||
var_v1_2 = temp_a1 - (racer->unk1C4 & 0xFFFF);
|
||||
if (var_v1_2 > 0x8000) {
|
||||
var_v1_2 -= 0xFFFF;
|
||||
}
|
||||
if (var_v1_2 < -0x8000) {
|
||||
var_v1_2 += 0xFFFF;
|
||||
}
|
||||
gCurrentStickX = -(var_a0 >> 3);
|
||||
gCurrentStickY = -(var_v1_2 >> 3);
|
||||
var_a0_2 = temp_s0 - (racer->steerVisualRotation & 0xFFFF);
|
||||
if (var_a0_2 > 0x8000) {
|
||||
var_a0_2 -= 0xFFFF;
|
||||
}
|
||||
if (var_a0_2 < -0x8000) {
|
||||
var_a0_2 += 0xFFFF;
|
||||
}
|
||||
if (var_a0_2 > 0x3000 || var_a0_2 < -0x3000) {
|
||||
overrideMagnitude = TRUE;
|
||||
}
|
||||
magnitude = 1.0 - racer->checkpoint_distance;
|
||||
splinePos = racer->checkpoint - 2;
|
||||
if (magnitude < 0.0) {
|
||||
magnitude = 0.0f;
|
||||
}
|
||||
if (magnitude > 1.0) {
|
||||
magnitude = 1.0f;
|
||||
}
|
||||
if (overrideMagnitude) {
|
||||
magnitude = 1.0f;
|
||||
}
|
||||
if (racer->unk1C9 != 0) {
|
||||
if (splinePos < 0) {
|
||||
splinePos += splineEnd;
|
||||
}
|
||||
if (splinePos >= splineEnd) {
|
||||
splinePos -= splineEnd;
|
||||
}
|
||||
for (i = 0; i < 5; i++) {
|
||||
checkpoint = find_next_checkpoint_node(splinePos, racer->unk1C8);
|
||||
splineX[i] = (checkpoint->x + (checkpoint->scale * checkpoint->rotationZFrac * racer->unk1BA));
|
||||
splineY[i] = (checkpoint->y + (checkpoint->scale * racer->unk1BC));
|
||||
splineZ[i] = (checkpoint->z + (checkpoint->scale * -checkpoint->rotationXFrac * racer->unk1BA));
|
||||
splinePos++;
|
||||
if (splinePos == splineEnd) {
|
||||
splinePos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
x = cubic_spline_interpolation(splineX, 0, magnitude, &xDerivative);
|
||||
y = cubic_spline_interpolation(splineY, 0, magnitude, &yDerivative);
|
||||
z = cubic_spline_interpolation(splineZ, 0, magnitude, &zDerivative);
|
||||
temp_f0_3 = sqrtf((xDerivative * xDerivative) + (yDerivative * yDerivative) + (zDerivative * zDerivative));
|
||||
if (temp_f0_3 != 0.0f) {
|
||||
temp_f20_2 = 500.0f / temp_f0_3;
|
||||
xDerivative *= temp_f20_2;
|
||||
yDerivative *= temp_f20_2;
|
||||
zDerivative *= temp_f20_2;
|
||||
}
|
||||
xDerivative = (x + xDerivative) - obj->segment.trans.x_position;
|
||||
yDerivative = (y + yDerivative) - obj->segment.trans.y_position;
|
||||
zDerivative = (z + zDerivative) - obj->segment.trans.z_position;
|
||||
temp_s0_2 = (arctan2_f(xDerivative, zDerivative) - 0x8000) & 0xFFFF;
|
||||
temp_v0_5 = arctan2_f(yDerivative, 500.0f);
|
||||
temp_a0 = temp_s0_2 - (racer->steerVisualRotation & 0xFFFF);
|
||||
if (temp_a0 > 0x8000) {
|
||||
temp_a0 -= 0xFFFF;
|
||||
}
|
||||
if (temp_a0 < -0x8000) {
|
||||
temp_a0 += 0xFFFF;
|
||||
}
|
||||
temp_a0 = -temp_a0;
|
||||
var_v1_4 = (temp_v0_5 & 0xFFFF) - (obj->segment.trans.rotation.x_rotation & 0xFFFF);
|
||||
if (var_v1_4 > 0x8000) {
|
||||
var_v1_4 -= 0xFFFF;
|
||||
}
|
||||
var_v0 = 5;
|
||||
if (var_v1_4 < -0x8000) {
|
||||
var_v1_4 += 0xFFFF;
|
||||
}
|
||||
var_v1_4 = -var_v1_4;
|
||||
if (racer->vehicleID == VEHICLE_PLANE) {
|
||||
var_v0 = 6;
|
||||
}
|
||||
if (racer->vehicleID == VEHICLE_HOVERCRAFT && racer->unk1D4 == 0) {
|
||||
racer->steerVisualRotation = racer->steerVisualRotation - (temp_a0 >> 1);
|
||||
}
|
||||
switch (racer->vehicleID) {
|
||||
case VEHICLE_LOOPDELOOP:
|
||||
gCurrentStickY = 0;
|
||||
break;
|
||||
case VEHICLE_HOVERCRAFT:
|
||||
gCurrentStickY = 0;
|
||||
gCurrentStickX += temp_a0 >> var_v0;
|
||||
break;
|
||||
case VEHICLE_TRICKY:
|
||||
gCurrentStickX += temp_a0 >> (var_v0 + 0x1F);
|
||||
gCurrentStickY = 0;
|
||||
break;
|
||||
case VEHICLE_SMOKEY:
|
||||
gCurrentStickX += temp_a0 >> (var_v0 - 1);
|
||||
gCurrentStickY += var_v1_4 >> (var_v0 - 1);
|
||||
break;
|
||||
default:
|
||||
gCurrentStickX += temp_a0 >> var_v0;
|
||||
gCurrentStickY += var_v1_4 >> var_v0;
|
||||
break;
|
||||
}
|
||||
func_80042D20(obj, racer, updateRate);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/racer/func_80045C48.s")
|
||||
#endif
|
||||
|
||||
void func_80046524(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *racer) {
|
||||
s32 objectMoved;
|
||||
|
||||
+3
-9
@@ -3,8 +3,11 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "structs.h"
|
||||
#include "save_layout.h"
|
||||
#include "PR/os_pfs.h"
|
||||
#include "PR/os_cont.h"
|
||||
#include "PR/os_libc.h"
|
||||
#include "libc/string.h"
|
||||
#include "common.h"
|
||||
|
||||
#define GAMD 0x47414D44 // 'GAMD' ASCII - Game Data?
|
||||
@@ -22,8 +25,6 @@
|
||||
// This is RARE's unique code
|
||||
#define COMPANY_CODE 0x3459
|
||||
|
||||
#define NUMBER_OF_SAVE_FILES 3
|
||||
|
||||
#define MAX_CPAK_FILES 16
|
||||
|
||||
#if REGION == REGION_JP
|
||||
@@ -117,13 +118,6 @@ typedef struct unk80075000 {
|
||||
unk80075000_body data[1];
|
||||
} unk80075000;
|
||||
|
||||
extern s8 *gPakFileList;
|
||||
extern u8 gN64FontCodes[68];
|
||||
extern s32 gRumbleKillTimer;
|
||||
extern OSPfs pfs[MAXCONTROLLERS];
|
||||
extern int bcmp(const void *, const void *, int);
|
||||
size_t strlen(const char *str);
|
||||
|
||||
u8 input_get_id(s32 controllerIndex);
|
||||
void rumble_init(u8 canRumble);
|
||||
s32 rumble_exists(s16 controllerIndex);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user