Slight organisation (#667)

* trole

* name particle dummy asset

* spatial audio debug strings

* home some strings and fix warns

* Update collision.c
This commit is contained in:
Fazana
2025-07-08 00:33:14 +01:00
committed by GitHub
parent 278112886b
commit 6b704ab45a
21 changed files with 244 additions and 226 deletions
+18 -17
View File
@@ -22,21 +22,6 @@ u16 gNumAudioPoints = 0;
/*******************************/
/************ .rodata ************/
UNUSED const char D_800E4D00[] = "OUT OF AUDIO POINTS\n";
UNUSED const char D_800E4D18[] = "amAudioLineAddVertex: Exceeded maximum number of lines (%d)\n";
UNUSED const char D_800E4D58[] = "amAudioLineAddVertex: Exceeded maximum number of line vertices (%d)\n";
UNUSED const char D_800E4DA0[] = "amReverbLineAddVertex: Exceeded maximum number of lines (%d)\n";
UNUSED const char D_800E4DE0[] = "amReverbLineAddVertex: Exceeded maximum number of line vertices (%d)\n";
UNUSED const char D_800E4E28[] = "Audio line definition error (less than 2 vertices on line %d)\n";
UNUSED const char D_800E4E68[] = "Audio line definition error (line=%d, vertex=%d)\n";
UNUSED const char D_800E4E9C[] = "Reverb line definition error (less than 2 vertices on line %d)\n";
UNUSED const char D_800E4EDC[] = "Reverb line definition error (line=%d, vertex=%d)\n";
/*********************************/
/************ .bss ************/
SoundData *gSpatialSoundTable;
@@ -565,6 +550,7 @@ void audspat_point_create(u16 soundBite, f32 x, f32 y, f32 z, u8 flags, u8 minVo
func_800245B4(soundBite | 0xE000);
}
if (gNumAudioPoints == MAX_AUDIO_POINTS) {
stubbed_printf("OUT OF AUDIO POINTS\n");
if (handlePtr != NULL) {
*handlePtr = NULL;
}
@@ -595,13 +581,18 @@ void audspat_point_create(u16 soundBite, f32 x, f32 y, f32 z, u8 flags, u8 minVo
* Adds a vertex to the audio line.
* An audio line is a sound source in the form of a polyline
* The first vertex defines the sound ID and other properties.
* Official Name: amAudioLineAddVertex
*/
void audspat_line_add_vertex(u8 type, u16 soundBite, f32 x, f32 y, f32 z, u8 arg5, u8 arg6, u8 arg7, u8 priority,
u16 arg9, u8 argA, u8 lineID, u8 vertexIndex) {
AudioLine *line;
f32 *coords;
if (lineID < MAX_AUDIO_LINES && vertexIndex < 30) {
if (lineID >= MAX_AUDIO_LINES) {
stubbed_printf("amAudioLineAddVertex: Exceeded maximum number of lines (%d)\n", MAX_AUDIO_LINES);
} else if (vertexIndex >= 30) {
stubbed_printf("amAudioLineAddVertex: Exceeded maximum number of line vertices (%d)\n", 30);
} else {
line = &gAudioLines[lineID];
coords = &line->coords[vertexIndex * 3];
coords[0] = x;
@@ -627,10 +618,15 @@ void audspat_line_add_vertex(u8 type, u16 soundBite, f32 x, f32 y, f32 z, u8 arg
* Adds a vertex to a reverb line.
* Reverb lines are used to calculate echo effects in the game.
* The first vertex defines the reverb intensity.
* Official Name: amReverbLineAddVertex
*/
void audspat_reverb_add_vertex(f32 x, f32 y, f32 z, u8 reverbAmount, u8 lineID, u8 vertexIndex) {
ReverbLine *line;
if (lineID < ARRAY_COUNT(gReverbLines) && vertexIndex < 15) {
if (lineID >= MAX_AUDIO_LINES) {
stubbed_printf("amReverbLineAddVertex: Exceeded maximum number of lines (%d)\n", MAX_AUDIO_LINES);
} else if (vertexIndex >= 15) {
stubbed_printf("amReverbLineAddVertex: Exceeded maximum number of line vertices (%d)\n", 15);
} else {
line = &gReverbLines[lineID];
line->coords[3 * vertexIndex + 0] = x;
line->coords[3 * vertexIndex + 1] = y;
@@ -658,12 +654,15 @@ s32 audspat_line_validate(u8 lineID) {
coords = line->coords;
if (line->numSegments <= 0) {
stubbed_printf("Audio line definition error (less than 2 vertices on line %d)\n", line->numSegments);
return FALSE;
}
for (i = 0; i < line->numSegments; i++) {
//!@bug: should be *(coords + 0), *(coords + 1), *(coords + 2)
if (*coords + 0 == -100000.0 || *coords + 1 == -100000.0 || *coords + 2 == -100000.0) {
stubbed_printf("Audio line definition error (line=%d, vertex=%d)\n", i,
1); // The 1 here is most likely the array index for the vertex coords.
ret = FALSE;
}
coords += 3;
@@ -686,12 +685,14 @@ s32 audspat_reverb_validate(u8 reverbLineID) {
coords = line->coords;
if (line->numSegments <= 0) {
stubbed_printf("Reverb line definition error (less than 2 vertices on line %d)\n", line->numSegments);
return FALSE;
}
for (i = 0; i < line->numSegments; i++) {
//!@bug: should be *(coords + 0), *(coords + 1), *(coords + 2)
if (*coords == -100000.0 || *coords + 1 == -100000.0 || *coords + 2 == -100000.0) {
stubbed_printf("Reverb line definition error (line=%d, vertex=%d)\n", i, 1); // Ditto
ret = FALSE;
}
coords += 3;
+1 -1
View File
@@ -179,7 +179,7 @@ void amCreateAudioMgr(ALSynConfig *c, OSPri pri, OSSched *audSched) {
#endif
for (i = 0; i < NUM_ACMD_LISTS; i++) {
__am.ACMDList[i] = (Acmd *) alHeapAlloc(c->heap, 1, 0xA000); // sizeof(Acmd) * DMA_BUFFER_LENGTH * 5?
__am.ACMDList[i] = (Acmd *) alHeapAlloc(c->heap, 1, AUDBUF_SIZE);
}
asset = mempool_alloc_fixed((maxFrameSize * 12), (u8 *) ((RAM_END - 0x200) - (maxFrameSize * 12)), COLOUR_TAG_CYAN);
+1
View File
@@ -11,6 +11,7 @@
#define MAX_UPDATES 32
#define MAX_EVENTS 32
#define AUDIO_HEAP_SIZE 0x29D88
#define AUDBUF_SIZE 0xA000 /* Audio command buffer size */
#define MAX_VOICES 22
#define EXTRA_SAMPLES 96
+1 -1
View File
@@ -8,7 +8,7 @@
enum CollisionModes { COLLISION_MODE_DEFAULT, COLLISION_MODE_1, COLLISION_MODE_NO_WALLS };
void generate_collision_candidates(s32, f32 *, f32 *, s32);
void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets, s32 vehicleID);
s32 compute_grid_overlap_mask(LevelModelSegmentBoundingBox *bbox, s32 x1, s32 z1, s32 x2, s32 z2);
s32 resolve_collisions(Vec3f *origin, Vec3f *target, f32 *radius, s8 *surface, s32 numEntries, s32 *numCollisions);
+13 -13
View File
@@ -1,6 +1,7 @@
#include "collision.h"
#include "macros.h"
#include "PR/R4300.h"
#include "textures_sprites.h"
#include "types.h"
@@ -20,7 +21,7 @@ extern s32 gNumCollisionCandidates;
// All handwritten assembly, below.
#ifdef NON_EQUIVALENT
#ifdef NON_MATCHING
/**
* Populates a list of triangle candidates that will be tested for collision in resolve_collisions.
* Calculates a single bounding rectangle that contains all origin and target points.
@@ -28,7 +29,6 @@ extern s32 gNumCollisionCandidates;
* Triangle batches are filtered based on visibility, surface type, and collision flags.
*/
void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets, s32 vehicleID) {
s32 i;
s32 minX, maxX, minZ, maxZ;
s32 counter;
LevelModelSegment *segments[10];
@@ -110,6 +110,7 @@ void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets
grid_mask[counter] =
compute_grid_overlap_mask(&gCurrentLevelModel->segmentsBoundingBoxes[i], minX, minZ, maxX, maxZ);
segments[counter] = &gCurrentLevelModel->segments[i];
counter++;
if (counter == 10) {
break;
}
@@ -122,7 +123,7 @@ void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets
LevelModelSegment *seg = segments[i];
// Insert the segment pointer encoded with MSB = 0 to differentiate from collision facets
gCollisionCandidates[j] = (s32) seg & ~0x80000000;
gCollisionCandidates[j] = (s32) K0_TO_PHYS(seg);
j++;
for (batchIndex = 0; batchIndex < seg->numberOfBatches; batchIndex++) {
@@ -146,8 +147,8 @@ void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets
// - SURFACE_INVIS_WALL can be passed through only by planes.
// - SURFACE_UNK12 is impassable only for cars, but passable by other vehicle types.
surface = gCurrentLevelModel->textures[seg->batches[batchIndex].textureIndex].surfaceType;
if (surface == SURFACE_WATER_CALM || vehicleID == VEHICLE_PLANE && surface == SURFACE_INVIS_WALL ||
vehicleID != VEHICLE_CAR && surface == SURFACE_UNK12) {
if (surface == SURFACE_WATER_CALM || (vehicleID == VEHICLE_PLANE && surface == SURFACE_INVIS_WALL) ||
(vehicleID != VEHICLE_CAR && surface == SURFACE_UNK12)) {
continue;
}
@@ -175,13 +176,12 @@ void generate_collision_candidates(s32 numPoints, Vec3f *origins, Vec3f *targets
out:
gNumCollisionCandidates = j;
return 0;
}
#else
GLOBAL_ASM("asm/collision/generate_collision_candidates.s")
#endif
#ifdef NON_EQUIVALENT
#ifdef NON_MATCHING
/**
* Computes the overlap between a rectangle and a segment's bounding box, returning a 16-bit grid mask.
* The bounding box is divided into an 8x8 grid. The function determines which grid columns (X) and rows (Z)
@@ -197,7 +197,7 @@ s32 compute_grid_overlap_mask(LevelModelSegmentBoundingBox *bbox, s32 x1, s32 z1
s32 cell_width;
s32 cell_height;
s32 cell_x, cell_z;
s32 bbox_x1, bbox_z1, bbox_x2, bbox_z2, t4;
s32 bbox_x1, bbox_z1, bbox_x2, bbox_z2;
if (bbox == NULL) {
return mask;
@@ -272,7 +272,7 @@ s32 compute_grid_overlap_mask(LevelModelSegmentBoundingBox *bbox, s32 x1, s32 z1
GLOBAL_ASM("asm/collision/compute_grid_overlap_mask.s")
#endif
#ifdef NON_EQUIVALENT
#ifdef NON_MATCHING
/**
* Resolves collisions for a list of moving objects against previously identified collision candidates.
* For each object, the function checks whether the path from `origin` to `target` intersects any collision plane.
@@ -313,7 +313,7 @@ s32 resolve_collisions(Vec3f *origin, Vec3f *target, f32 *radius, s8 *surface, s
for (i = 0; i < gNumCollisionCandidates; i++) {
if (gCollisionCandidates[i] >= 0) {
collisionPlanes = ((LevelModelSegment *) (gCollisionCandidates[i] | 0x80000000))->collisionPlanes;
collisionPlanes = ((LevelModelSegment *) (PHYS_TO_K0(gCollisionCandidates[i])))->collisionPlanes;
} else {
facet = (CollisionFacetPlanes *) gCollisionCandidates[i];
A = collisionPlanes[facet->basePlaneIndex * 4 + 0];
@@ -357,7 +357,7 @@ s32 resolve_collisions(Vec3f *origin, Vec3f *target, f32 *radius, s8 *surface, s
C1 = collisionPlanes[edgeBisectorPlane * 4 + 2];
D1 = collisionPlanes[edgeBisectorPlane * 4 + 3];
dist = intersectionPointX * A1 + intersectionPointY * B1 + intersectionPointX * C1 + D1;
dist = intersectionPointX * A1 + intersectionPointY * B1 + intersectionPointZ * C1 + D1;
if (flipSide) {
dist = -dist;
}
@@ -368,7 +368,7 @@ s32 resolve_collisions(Vec3f *origin, Vec3f *target, f32 *radius, s8 *surface, s
}
if (insideTriangle) {
if (B >= 0.707 && gCollisionSurfaces[i] != SURFACE_STONE &&
if (B >= 0.707f && gCollisionSurfaces[i] != SURFACE_STONE &&
gCollisionMode == COLLISION_MODE_DEFAULT) {
// Push up vertically if slope is gentle and not stone
outX = target->x;
@@ -433,7 +433,7 @@ s32 resolve_collisions(Vec3f *origin, Vec3f *target, f32 *radius, s8 *surface, s
for (i = 0; i < gNumCollisionCandidates; i++) {
if (gCollisionCandidates[i] >= 0) {
collisionPlanes = ((LevelModelSegment *) (gCollisionCandidates[i] | 0x80000000))->collisionPlanes;
collisionPlanes = ((LevelModelSegment *) (PHYS_TO_K0(gCollisionCandidates[i])))->collisionPlanes;
} else {
facet = (CollisionFacetPlanes *) gCollisionCandidates[i];
A = collisionPlanes[facet->basePlaneIndex * 4 + 0];
+6 -6
View File
@@ -138,7 +138,7 @@ void mtxf_transform_point(MtxF *mf, float x, float y, float z, float *ox, float
GLOBAL_ASM("asm/math_util/mtxf_transform_point.s")
#endif
#ifdef NON_MATCHING
#ifdef NON_EQUIVALENT
/**
* Transforms a direction vector in 3D space using the rotation part of a 4×4 matrix.
* This function multiplies the input vector by the upper-left 3×3 portion of the matrix mf,
@@ -147,9 +147,9 @@ GLOBAL_ASM("asm/math_util/mtxf_transform_point.s")
* Official name: mathMtxFastXFMF
*/
void mtxf_transform_dir(MtxF *mf, Vec3f *in, Vec3f *out) {
out->f[0] = (in->f[0] * mf[0][0]) + (in->f[1] * mf[1][0]) + (in->f[2] * mf[2][0]);
out->f[1] = (in->f[0] * mf[0][1]) + (in->f[1] * mf[1][1]) + (in->f[2] * mf[2][1]);
out->f[2] = (in->f[0] * mf[0][2]) + (in->f[1] * mf[1][2]) + (in->f[2] * mf[2][2]);
out->f[0] = (in->f[0] * (*mf)[0][0]) + (in->f[1] * *mf[1][0]) + (in->f[2] * (*mf)[2][0]);
out->f[1] = (in->f[0] * (*mf)[0][1]) + (in->f[1] * *mf[1][1]) + (in->f[2] * (*mf)[2][1]);
out->f[2] = (in->f[0] * (*mf)[0][2]) + (in->f[1] * *mf[1][2]) + (in->f[2] * (*mf)[2][2]);
}
#else
GLOBAL_ASM("asm/math_util/mtxf_transform_dir.s")
@@ -837,8 +837,8 @@ UNUSED s32 calc_dyn_lighting_for_level_segment(LevelModelSegment *segment, s32 *
batches = segment->batches;
vertCount = 0;
for (i = 0; i < numBatches; i++) {
// batches[i].unk6 is 0xFF if vertex colors are used. Otherwise dynamic lighting is used.
if ((batches[i].unk6 - 0xFF) != 0) {
// batches[i].miscData is 0xFF if vertex colors are used. Otherwise dynamic lighting is used.
if ((batches[i].miscData - 0xFF) != 0) {
verts = &segment->vertices[vertCount];
verts2C = &segment->unk2C[vertCount];
numVertsInBatch = batches[i + 1].verticesOffset - batches[i].verticesOffset;
+6 -6
View File
@@ -442,7 +442,7 @@ void obj_loop_laserbolt(Object *obj, s32 updateRate) {
dir.z = obj->trans.z_position + (obj->z_velocity * updateRateF);
radius = 9.0f;
generate_collision_candidates(1, &obj->trans.x_position, &dir.x, -1);
generate_collision_candidates(1, (Vec3f *) &obj->trans.x_position, &dir, -1);
hasCollision = FALSE;
resolve_collisions((Vec3f *) &obj->trans.x_position, &dir, &radius, &surface, 1, &hasCollision);
if (hasCollision) {
@@ -730,7 +730,7 @@ void obj_loop_collectegg(Object *obj, s32 updateRate) {
targetPos[1] = obj->trans.y_position + (obj->y_velocity * updateRateF);
targetPos[2] = obj->trans.z_position + (obj->z_velocity * updateRateF);
radius = 9.0f;
generate_collision_candidates(1, &obj->trans.x_position, targetPos, -1);
generate_collision_candidates(1, (Vec3f *) &obj->trans.x_position, (Vec3f *) targetPos, -1);
hasCollision = FALSE;
surface = SURFACE_DEFAULT;
resolve_collisions((Vec3f *) &obj->trans.x_position, (Vec3f *) targetPos, &radius, &surface, 1,
@@ -4346,7 +4346,7 @@ void obj_loop_banana(Object *obj, s32 updateRate) {
targetPos[1] = obj->trans.y_position + (obj->y_velocity * updateRateF);
targetPos[2] = obj->trans.z_position + (obj->z_velocity * updateRateF);
radius = 8.0f;
generate_collision_candidates(1, &obj->trans.x_position, targetPos, -1);
generate_collision_candidates(1, (Vec3f *) &obj->trans.x_position, (Vec3f *) targetPos, -1);
hasCollision = 0;
resolve_collisions((Vec3f *) &obj->trans.x_position, (Vec3f *) targetPos, &radius, &surface, 1,
&hasCollision);
@@ -4853,7 +4853,7 @@ void weapon_projectile(Object *obj, s32 updateRate) {
offset.z = obj->trans.z_position + (obj->z_velocity * updateRateF);
if (weapon->weaponID != WEAPON_MAGNET_LEVEL_3) {
radius = 16.0f;
generate_collision_candidates(1, &obj->trans.x_position, (f32 *) &offset, -1);
generate_collision_candidates(1, (Vec3f *) &obj->trans.x_position, &offset, -1);
hasCollision = FALSE;
surface = SURFACE_NONE;
resolve_collisions((Vec3f *) &obj->trans.x_position, &offset, &radius, &surface, 1, &hasCollision);
@@ -5157,10 +5157,10 @@ void weapon_trap(Object *weaponObj, s32 updateRate) {
intendedPos.y = weaponObj->trans.y_position + (weaponObj->y_velocity * updateRateF);
intendedPos.z = weaponObj->trans.z_position + (weaponObj->z_velocity * updateRateF);
radius = 9.0f;
generate_collision_candidates(1, &weaponObj->trans.x_position, &intendedPos.x, -1);
generate_collision_candidates(1, (Vec3f *) &weaponObj->trans.x_position, (Vec3f *) &intendedPos.x, -1);
hasCollision = FALSE;
surface = SURFACE_NONE;
resolve_collisions((Vec3f *) &weaponObj->trans.x_position, &intendedPos, &radius, &surface, 1, &hasCollision);
resolve_collisions((Vec3f *) &weaponObj->trans.x_position, (Vec3f *) &intendedPos, &radius, &surface, 1, &hasCollision);
weaponObj->x_velocity = (intendedPos.x - weaponObj->trans.x_position) / updateRateF;
weaponObj->y_velocity = (intendedPos.y - weaponObj->trans.y_position) / updateRateF;
weaponObj->z_velocity = (intendedPos.z - weaponObj->trans.z_position) / updateRateF;
+113 -98
View File
@@ -41,6 +41,7 @@
#include "waves.h"
#include "weather.h"
#define OBJECT_MAP_SIZE 0x3000
#define MAX_CHECKPOINTS 60
#define OBJECT_POOL_SIZE 0x15800
#define OBJECT_BLUEPRINT_SIZE 0x800
@@ -195,18 +196,6 @@ FadeTransition gRaceEndTransition = FADE_TRANSITION(FADE_FULLSCREEN, FADE_FLAG_O
UNUSED const char sObjectOutofMemString[] = "Objects out of ram(1) !!\n";
UNUSED const char sDoorNumberErrorString[] = "Door numbering error %d!!\n";
UNUSED const char sObjectScopeErrorString[] = "objGetScope: Unknown scope for object %d\n";
UNUSED const char sObjectListDataOverflowString[] = "ObjList (Part) Overflow %d!!!\n";
UNUSED const char sObjectSetupError1String[] = "ObjSetupObject(1) Memory fail!!\n";
UNUSED const char sObjectSetupError2String[] = "ObjSetupObject(2) Memory fail!!\n";
UNUSED const char sObjectSetupError5String[] = "ObjSetupObject(5) Memory fail!!\n";
UNUSED const char sObjectSetupError6String[] = "ObjSetupObject(6) Memory fail!!\n";
UNUSED const char sObjectSetupError3String[] = "ObjSetupObject(3) Memory fail!!\n";
UNUSED const char sObjectListOverflowString[] = "ObjList Overflow %d!!!\n";
UNUSED const char sObjectSetupError4String[] = "ObjSetupObject(4) Memory fail!!\n";
UNUSED const char sDuplicateCheckpointString[] = "Error: Multiple checkpoint no: %d !!\n";
UNUSED const char sErrorChannelString[] = "ERROR Channel %d\n";
UNUSED const char sReadOutErrorString[] = "RO error %d!!\n";
UNUSED const char sPureAnguishString[] = "ARGHHHHHHHHH\n";
/*********************************/
@@ -293,13 +282,13 @@ s32 D_8011AE88;
Gfx *gObjectCurrDisplayList;
Mtx *gObjectCurrMatrix;
Vertex *gObjectCurrVertexList;
u8 *D_8011AE98[2];
s32 D_8011AEA0[2];
s32 D_8011AEA8[2];
s32 *D_8011AEB0[2];
u8 *gObjectMapSpawnList[2];
s32 gObjectMapSize[2];
s32 gObjectMapID[2];
s32 *gObjectMap[2];
s16 *gAssetsLvlObjTranslationTable;
s32 gAssetsLvlObjTranslationTableLength;
s32 D_8011AEC0;
s32 gObjectMapIndex;
Object **gParticlePtrList;
s32 gFreeListCount;
CheckpointNode *gTrackCheckpoints; // Array of structs, unknown number of members
@@ -884,14 +873,14 @@ void free_all_objects(void) {
gParticlePtrList_flush();
len = gObjectCount;
for (i = 0; i < len; i++) {
func_800101AC(gObjPtrList[i], 1);
obj_destroy(gObjPtrList[i], 1);
}
gFreeListCount = 0;
gObjectCount = 0;
gObjectListStart = 0;
clear_object_pointers();
mempool_free((void *) D_8011AEB0[0]);
mempool_free((void *) D_8011AEB0[1]);
mempool_free((void *) gObjectMap[0]);
mempool_free((void *) gObjectMap[1]);
}
/**
@@ -954,7 +943,11 @@ s32 normalise_time(s32 timer) {
}
}
void func_8000C8F8(s32 arg0, s32 arg1) {
/**
* Load the object map into RAM, then start spawning objects into the world.
* Also decides whether this race type should be for silver coins or not.
*/
void track_spawn_objects(s32 mapID, s32 index) {
s32 assetSize;
Settings *settings;
s32 i;
@@ -968,33 +961,33 @@ void func_8000C8F8(s32 arg0, s32 arg1) {
settings = get_settings();
assetOffset = settings->bosses | 0x820; // 0x820 = Wizpig 2 and some unknown 0x800 boss bit
gIsSilverCoinRace =
((settings->courseFlagsPtr[settings->courseId] & 4) == 0) && (((1 << settings->worldId) & assetOffset) != 0);
gIsSilverCoinRace = ((settings->courseFlagsPtr[settings->courseId] & RACE_CLEARED_SILVER_COINS) == FALSE) &&
(((1 << settings->worldId) & assetOffset) != 0);
if (!(settings->courseFlagsPtr[settings->courseId] & 2)) {
gIsSilverCoinRace = 0;
if ((settings->courseFlagsPtr[settings->courseId] & RACE_CLEARED) == FALSE) {
gIsSilverCoinRace = FALSE;
}
if (is_in_tracks_mode()) {
gIsSilverCoinRace = 0;
gIsSilverCoinRace = FALSE;
}
if (get_current_level_race_type()) {
gIsSilverCoinRace = 0;
gIsSilverCoinRace = FALSE;
}
D_8011AD3E = 0;
mem = mempool_alloc_safe(0x3000, COLOUR_TAG_BLUE);
D_8011AEB0[arg1] = mem;
D_8011AE98[arg1] = (u8 *) (D_8011AEB0[arg1] + 4);
D_8011AEA0[arg1] = 0;
D_8011AEA8[arg1] = arg0;
mem = mempool_alloc_safe(OBJECT_MAP_SIZE, COLOUR_TAG_BLUE);
gObjectMap[index] = mem;
gObjectMapSpawnList[index] = (u8 *) (gObjectMap[index] + sizeof(uintptr_t));
gObjectMapSize[index] = NULL;
gObjectMapID[index] = mapID;
objMapTable = (u32 *) load_asset_section_from_rom(ASSET_LEVEL_OBJECT_MAPS_TABLE);
for (i = 0; objMapTable[i] != 0xFFFFFFFF; i++) {}
i--;
if (arg0 >= i) {
arg0 = 0;
if (mapID >= i) {
mapID = 0;
}
assetOffset = objMapTable[arg0];
assetSize = objMapTable[arg0 + 1] - assetOffset;
assetOffset = objMapTable[mapID];
assetSize = objMapTable[mapID + 1] - assetOffset;
if (assetSize != 0) {
compressedAsset = (u8 *) mem;
@@ -1004,14 +997,14 @@ void func_8000C8F8(s32 arg0, s32 arg1) {
load_asset_to_address(ASSET_LEVEL_OBJECT_MAPS, (u32) compressedAsset, assetOffset, assetSize);
gzip_inflate(compressedAsset, (u8 *) mem);
mempool_free(objMapTable);
D_8011AE98[arg1] = (u8 *) (D_8011AEB0[arg1] + 4);
D_8011AEA0[arg1] = *mem;
D_8011AEC0 = arg1;
for (var_s0 = 0; var_s0 < D_8011AEA0[arg1]; var_s0 += temp_t3) {
spawn_object((LevelObjectEntryCommon *) D_8011AE98[arg1], OBJECT_SPAWN_UNK01);
D_8011AE98[arg1] = &D_8011AE98[arg1][temp_t3 = D_8011AE98[arg1][1] & 0x3F];
gObjectMapSpawnList[index] = (u8 *) (gObjectMap[index] + sizeof(uintptr_t));
gObjectMapSize[index] = *mem;
gObjectMapIndex = index;
for (var_s0 = 0; var_s0 < gObjectMapSize[index]; var_s0 += temp_t3) {
spawn_object((LevelObjectEntryCommon *) gObjectMapSpawnList[index], OBJECT_SPAWN_UNK01);
gObjectMapSpawnList[index] = &gObjectMapSpawnList[index][temp_t3 = gObjectMapSpawnList[index][1] & 0x3F];
}
D_8011AE98[arg1] = (u8 *) (D_8011AEB0[arg1] + 4);
gObjectMapSpawnList[index] = (u8 *) (gObjectMap[index] + sizeof(uintptr_t));
gCollisionObjectCount = 0;
gNumFinishedRacers = 1;
if (gPathUpdateOff == FALSE) {
@@ -1723,12 +1716,12 @@ UNUSED void func_8000E4E8(s32 index) {
s32 i;
u8 *temp_a1;
temp_v0 = D_8011AEB0[index];
temp_v0[0] = D_8011AEA0[index];
temp_v0 = gObjectMap[index];
temp_v0[0] = gObjectMapSize[index];
temp_v0[3] = 0;
temp_v0[2] = 0;
temp_v0[1] = 0;
temp_a1 = &D_8011AE98[index][D_8011AEA0[index]];
temp_a1 = &gObjectMapSpawnList[index][gObjectMapSize[index]];
// The backslash here is needed to match. And no, a for loop doesn't match.
// clang-format off
@@ -1747,13 +1740,13 @@ UNUSED s32 func_8000E558(Object *arg0) {
return TRUE;
}
temp_v0 = (s32) arg0->level_entry;
new_var2 = (s32) D_8011AE98[0];
if ((temp_v0 >= new_var2) && (((D_8011AEA0[0] * 8) + new_var2) >= temp_v0)) {
new_var2 = (s32) gObjectMapSpawnList[0];
if ((temp_v0 >= new_var2) && (((gObjectMapSize[0] * 8) + new_var2) >= temp_v0)) {
return FALSE;
}
new_var = (s32) D_8011AE98[1];
new_var = (s32) gObjectMapSpawnList[1];
// Why even bother with this check?
if (temp_v0 >= new_var && temp_v0 <= ((D_8011AEA0[1] * 8) + new_var)) {
if (temp_v0 >= new_var && temp_v0 <= ((gObjectMapSize[1] * 8) + new_var)) {
return TRUE;
}
return TRUE;
@@ -1771,12 +1764,12 @@ void func_8000E5EC(LevelObjectEntryCommon *arg0) {
size = arg0->size & 0x3F;
sp30[0] = (s32) D_8011AE98[0] + D_8011AEA0[0];
sp30[1] = (s32) D_8011AE98[1] + D_8011AEA0[1];
sp30[0] = (s32) gObjectMapSpawnList[0] + gObjectMapSize[0];
sp30[1] = (s32) gObjectMapSpawnList[1] + gObjectMapSize[1];
if ((s32) arg0 >= (s32) D_8011AE98[0] && (s32) arg0 < sp30[0]) {
if ((s32) arg0 >= (s32) gObjectMapSpawnList[0] && (s32) arg0 < sp30[0]) {
sp1C = 0;
} else if ((s32) arg0 >= (s32) D_8011AE98[1] && (s32) arg0 < sp30[1]) {
} else if ((s32) arg0 >= (s32) gObjectMapSpawnList[1] && (s32) arg0 < sp30[1]) {
sp1C = 1;
}
#ifdef AVOID_UB
@@ -1793,7 +1786,7 @@ void func_8000E5EC(LevelObjectEntryCommon *arg0) {
*dst++ = *src++;
} while ((u32) src != (u32) end);
}
D_8011AEA0[sp1C] -= size;
gObjectMapSize[sp1C] -= size;
for (i = 0; i < gObjectCount; i++) {
Object *obj = gObjPtrList[i];
@@ -1822,8 +1815,8 @@ void func_8000E79C(u8 *arg0, u8 *arg1) {
arg0Value = arg0[1] & 0x3F;
arg0Value2 = arg0Value;
arg1Value = arg1[1] & 0x3F;
i = D_8011AEC0;
var_a3 = (u8 *) D_8011AEB0[i] + D_8011AEA0[i];
i = gObjectMapIndex;
var_a3 = (u8 *) gObjectMap[i] + gObjectMapSize[i];
var_a3 += 16;
if (arg1Value < arg0Value2) {
@@ -1853,7 +1846,7 @@ void func_8000E79C(u8 *arg0, u8 *arg1) {
j++;
} while (j < arg1Value);
D_8011AEA0[i] += arg1Value - arg0Value;
gObjectMapSize[i] += arg1Value - arg0Value;
}
UNUSED u8 *func_8000E898(u8 *arg0, s32 arg1) {
@@ -1865,10 +1858,10 @@ UNUSED u8 *func_8000E898(u8 *arg0, s32 arg1) {
temp_t6 = arg0[1] & 0x3F;
new_var = arg0;
new_var = &D_8011AE98[arg1][D_8011AEA0[arg1]];
new_var = &gObjectMapSpawnList[arg1][gObjectMapSize[arg1]];
new_var2 = arg0;
temp_v1 = new_var;
D_8011AEA0[arg1] += temp_t6;
gObjectMapSize[arg1] += temp_t6;
for (i = 0; i < temp_t6; i++) {
temp_v1[i] = new_var2[i];
}
@@ -1881,6 +1874,7 @@ UNUSED u8 *func_8000E898(u8 *arg0, s32 arg1) {
*/
Object *get_object(s32 index) {
if (index < 0 || index >= gObjectCount) {
stubbed_printf("ObjList (Part) Overflow %d!!!\n");
return 0;
}
return gObjPtrList[index];
@@ -1917,6 +1911,7 @@ void add_particle_to_entity_list(Object *obj) {
gParticleCount++;
}
// Official Name: ObjSetupObject
Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
s32 objType;
Settings *settings;
@@ -1959,6 +1954,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
}
if (curObj->header->behaviorId == BHV_ROCKET_SIGNPOST && (settings->cutsceneFlags & CUTSCENE_LIGHTHOUSE_ROCKET)) {
update_object_stack_trace(OBJECT_SPAWN, -1);
stubbed_printf("ObjSetupObject(1) Memory fail!!\n");
return NULL;
}
@@ -2085,6 +2081,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
if (failed) {
objFreeAssets(curObj, assetCount, objType);
try_free_object_header(headerType);
stubbed_printf("ObjSetupObject(2) Memory fail!!\n");
return NULL;
}
@@ -2102,6 +2099,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
if (sizeOfobj == 0) {
objFreeAssets(curObj, assetCount, objType);
try_free_object_header(headerType);
stubbed_printf("ObjSetupObject(5) Memory fail!!\n");
return NULL;
}
}
@@ -2114,6 +2112,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
}
objFreeAssets(curObj, assetCount, objType);
try_free_object_header(headerType);
stubbed_printf("ObjSetupObject(6) Memory fail!!\n");
return NULL;
}
}
@@ -2148,6 +2147,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
}
objFreeAssets(prevObj, assetCount, objType);
try_free_object_header(headerType);
stubbed_printf("ObjSetupObject(3) Memory fail!!\n");
return NULL;
}
@@ -2203,6 +2203,9 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
if (spawnFlags & OBJECT_SPAWN_UNK01) {
if (curObj && curObj) {} // Fakematch
gObjPtrList[gObjectCount++] = curObj;
if (gObjectCount > OBJECT_SLOT_COUNT) {
stubbed_printf("ObjList Overflow %d!!!\n", gObjectCount);
}
}
run_object_init_func(curObj, entry, 0);
if (curObj->interactObj != NULL) {
@@ -2223,6 +2226,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 spawnFlags) {
if (spawnFlags & OBJECT_SPAWN_UNK01) {
gObjectCount--;
}
stubbed_printf("ObjSetupObject(4) Memory fail!!\n");
return NULL;
}
if (curObj->header->numLightSources > 0) {
@@ -2546,12 +2550,12 @@ void gParticlePtrList_flush(void) {
gObjPtrList[j] = gObjPtrList[j + 1];
}
}
func_800101AC(searchObj, 0);
obj_destroy(searchObj, 0);
}
gFreeListCount = 0;
}
void func_800101AC(Object *obj, s32 arg1) {
void obj_destroy(Object *obj, s32 arg1) {
Object *tempObj;
Object_Weapon *weapon;
Object_Racer *racer;
@@ -5175,16 +5179,16 @@ void obj_collision_transform(Object *obj) {
trans.y_position = obj->trans.y_position;
trans.z_position = obj->trans.z_position;
#ifdef AVOID_UB
mtxf_from_transform(colData->matrices[(colData->mtxFlip + 2)], &trans);
mtxf_from_transform((MtxF *) colData->matrices[(colData->mtxFlip + 2)], &trans);
#else
mtxf_from_transform((MtxF *) colData->_matrices[(colData->mtxFlip + 2) << 1], &trans);
#endif
colData->collidedObj = NULL;
}
// https://decomp.me/scratch/RBmJV
// https://decomp.me/scratch/S3kHf
#ifdef NON_MATCHING
s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s8 *surface) {
s32 collision_objectmodel(Object *obj, s32 arg1, s32* arg2, Vec3f *arg3, f32* arg4, f32* arg5, s8* surface) {
ModelInstance *modInst;
s32 sp170;
s32 sp16C;
@@ -5208,19 +5212,16 @@ s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *a
MtxF *spDC;
s32 spB4[10];
f32 sp8C[10];
sp160 = 0;
for (sp170 = 0; sp170 < gCollisionObjectCount; sp170++) {
sp158 = gCollisionObjects[sp170];
modInst = sp158->modelInstances[sp158->modelIndex];
sp154 = modInst->objModel;
temp = sp158->trans.x_position - obj->trans.x_position;
dist = sqrtf(
(temp) * (temp) +
(sp158->trans.y_position - obj->trans.y_position) * (sp158->trans.y_position - obj->trans.y_position) +
(sp158->trans.z_position - obj->trans.z_position) * (sp158->trans.z_position - obj->trans.z_position));
dist = sqrtf((temp) * (temp) + (sp158->trans.y_position - obj->trans.y_position) * (sp158->trans.y_position - obj->trans.y_position) + (sp158->trans.z_position - obj->trans.z_position) * (sp158->trans.z_position - obj->trans.z_position));
j = dist;
if (sp158->interactObj->flags & 0x20) {
@@ -5260,33 +5261,40 @@ s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *a
modInst = sp158->modelInstances[sp158->modelIndex];
sp154 = modInst->objModel;
collision = sp158->collisionData;
#ifdef AVOID_UB
#ifdef AVOID_UB
spDC = &collision->matrices[((sp158->collisionData->mtxFlip + 1) & 1)];
#else
#else
spDC = (MtxF *) &collision->_matrices[((sp158->collisionData->mtxFlip + 1) & 1) << 1];
#endif
sp14C = func_8001790C((u32 *) obj, (u32 *) sp158);
#endif
sp14C = func_8001790C(obj, sp158);
if (sp14C != NULL) {
for (i = 0, j = 0; j < arg1; j++, i += 3) {
sp13C[j] = sp14C->unk0C[i + 0];
sp12C[j] = sp14C->unk0C[i + 1];
sp11C[j] = sp14C->unk0C[i + 2];
mtxf_transform_point(spDC, arg4[i], arg4[i + 1], arg4[i + 2], &sp100[j], &spF0[j], &spE0[j]);
mtxf_transform_point(spDC,
arg4[i], arg4[i + 1], arg4[i + 2],
&sp100[j], &spF0[j], &spE0[j]);
}
} else {
for (i = 0, j = 0; j < arg1; j++, i += 3) {
mtxf_transform_point(spDC, arg3[i], arg3[i + 1], arg3[i + 2], &sp13C[j], &sp12C[j], &sp11C[j]);
for (i = 0, j = 0; j < arg1; j++, i++) {
mtxf_transform_point(spDC,
arg3[i].x, arg3[i].y, arg3[i].z,
&sp13C[j], &sp12C[j], &sp11C[j]);
}
}
for (i = 0, j = 0; j < arg1; j++, i += 3) {
mtxf_transform_point(spDC, arg4[i], arg4[i + 1], arg4[i + 2], &sp100[j], &spF0[j], &spE0[j]);
for (i = 0, j = 0; j < arg1; j++, i+= 3) {
mtxf_transform_point(spDC,
arg4[i], arg4[i + 1], arg4[i + 2],
&sp100[j], &spF0[j], &spE0[j]);
}
arg2[0] = 0;
tempv0 = func_80017A18(sp154, arg1, arg2, sp13C, sp12C, sp11C, sp100, spF0, spE0, arg5, surface,
1.0 / sp158->trans.scale);
tempv0 = func_80017A18(sp154, arg1, arg2,
sp13C, sp12C, sp11C, sp100, spF0, spE0,
arg5, surface, 1.0 / sp158->trans.scale);
if (tempv0 != 0) {
// @fake
@@ -5294,20 +5302,20 @@ s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *a
sp158->collisionData->collidedObj = obj;
}
if (D_8011AD24[0] == 0) {
sp14C = func_80017978(obj, sp158);
}
#ifdef AVOID_UB
#ifdef AVOID_UB
spDC = &sp158->collisionData->matrices[(sp158->collisionData->mtxFlip + 2)];
#else
#else
spDC = (MtxF *) &sp158->collisionData->_matrices[(sp158->collisionData->mtxFlip + 2) << 1];
#endif
#endif
// @fake
if (sp158) {}
if (sp158){}
sp16C = 1;
for (i = 0, j = 0; j < arg1; j++, i += 3, sp16C <<= 1) {
if (sp14C != NULL) {
@@ -5316,7 +5324,9 @@ s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *a
sp14C->unk0C[i + 2] = spE0[j];
}
if (tempv0 & sp16C) {
mtxf_transform_point(spDC, sp100[j], spF0[j], spE0[j], &arg4[i + 0], &arg4[i + 1], &arg4[i + 2]);
mtxf_transform_point(spDC,
sp100[j], spF0[j], spE0[j],
&arg4[i + 0], &arg4[i + 1], &arg4[i + 2]);
}
}
@@ -5339,11 +5349,12 @@ s32 func_80017248(Object *obj, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4, f32 *a
}
return sp168;
}
#else
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_80017248.s")
#pragma GLOBAL_ASM("asm/nonmatchings/objects/collision_objectmodel.s")
#endif
unk800179D0 *func_8001790C(u32 *arg0, u32 *arg1) {
unk800179D0 *func_8001790C(Object *arg0, Object *arg1) {
unk800179D0 *entry;
s16 i;
@@ -5357,15 +5368,15 @@ unk800179D0 *func_8001790C(u32 *arg0, u32 *arg1) {
return NULL;
}
unk800179D0 *func_80017978(s32 arg0, s32 arg1) {
unk800179D0 *func_80017978(Object *obj1, Object *obj2) {
unk800179D0 *entry;
s16 i;
for (i = 0; i < 16; i++) {
entry = &D_8011AFF4[i];
if (entry->unk0 == 0) {
entry->unk04 = (u32 *) arg0;
entry->unk08 = (u32 *) arg1;
entry->unk04 = obj1;
entry->unk08 = obj2;
entry->unk0 = 2;
return entry;
}
@@ -5437,7 +5448,7 @@ s32 func_80017A18(ObjectModel *arg0, s32 arg1, s32 *arg2, f32 *arg3, f32 *arg4,
z2 = arg5[i];
for (j = 0; j < arg0->collisionFacetCount; j++) {
node = &arg0->collisionFacets[j];
node = (CollisionNode *) &arg0->collisionFacets[j];
triIndex = node->colPlaneIndex;
A = planes[4 * triIndex + 0];
@@ -5604,7 +5615,7 @@ void func_80017E98(void) {
gNumberOfCheckpoints -= var_t2;
if (duplicateCheckpoint) {
set_render_printf_position(20, 220);
render_printf(sDuplicateCheckpointString /* "Error: Multiple checkpoint no: %d !!\n"; */, checkpointNum);
render_printf("Error: Multiple checkpoint no: %d !!\n", checkpointNum);
}
for (i = gNumberOfCheckpoints; i < D_8011AED4; i++) {
temp_v1 = gTrackCheckpoints[i].unk2C - 255;
@@ -5925,6 +5936,7 @@ void func_80018CE0(Object *racerObj, f32 xPos, f32 yPos, f32 zPos, s32 updateRat
}
break;
default:
stubbed_printf("ERROR Channel %d\n", i);
break;
}
}
@@ -10824,3 +10836,6 @@ void func_800245B4(s16 arg0) {
D_800DC700 = 0;
}
}
UNUSED const char sReadOutErrorString[] = "RO error %d!!\n";
UNUSED const char sPureAnguishString[] = "ARGHHHHHHHHH\n";
+8 -7
View File
@@ -253,8 +253,8 @@ typedef struct CheckpointNode {
/* Size: 0x40 bytes */
typedef struct unk800179D0 {
s32 unk0;
u32 *unk04;
u32 *unk08;
Object *unk04;
Object *unk08;
f32 unk0C[12];
u32 unk3C;
} unk800179D0;
@@ -440,7 +440,7 @@ void func_80021104(Object *obj, Object_AnimatedObject *animObj, LevelObjectEntry
s32 func_8001955C(Object *obj, s32 checkpoint, u8 arg2, s32 arg3, s32 arg4, f32 checkpointDist, f32 *outX, f32 *outY,
f32 *outZ);
void func_80016500(Object *obj, Object_Racer *racer);
void func_8000C8F8(s32, s32);
void track_spawn_objects(s32, s32);
u8 timetrial_init_staff_ghost(s32 trackId);
s8 set_course_finish_flags(Settings *settings);
void process_object_interactions(void);
@@ -461,8 +461,8 @@ void func_8001E4C4(void);
void racerfx_alloc(s32 numberOfVertices, s32 numberOfTriangles);
s32 func_80014B50(s32 arg0, s32 arg1, f32 arg2, u32 arg3);
s32 ainode_find_next(s32 nodeId, s32 nextNodeId, s32 direction);
unk800179D0 *func_8001790C(u32 *arg0, u32 *arg1);
unk800179D0 *func_80017978(s32 arg0, s32 arg1);
unk800179D0 *func_8001790C(Object *arg0, Object *arg1);
unk800179D0 *func_80017978(Object *obj1, Object *obj2);
s8 func_800214E4(Object *obj, s32 updateRate);
f32 lerp_and_get_derivative(f32 *data, u32 index, f32 t, f32 *derivative);
void race_check_finish(s32 updateRate);
@@ -492,7 +492,7 @@ void obj_tex_animate(Object *, s32);
Object *find_furthest_telepoint(f32 x, f32 z);
void model_init_collision(ObjectModel *);
void set_temp_model_transforms(Object *);
void func_800101AC(Object *, s32);
void obj_destroy(Object *, s32);
void func_800135B8(Object *);
void track_setup_racers(Vehicle, u32, s32);
void func_80017E98(void);
@@ -508,6 +508,7 @@ void func_800159C8(Object *, Object *);
void obj_door_number(ObjectModel *, Object *);
s16 func_8001CD28(s32 arg0, s32 arg1, s32 arg2, s32 arg3); // NON MATCHING
f32 func_8001C6C4(Object_NPC *, Object *, f32, f32, s32);
s32 func_80017A18(ObjectModel *, s32, s32 *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *, s8 *surface,
s32 collision_objectmodel(Object *obj, s32 arg1, s32* arg2, Vec3f *arg3, f32* arg4, f32* arg5, s8* surface);
s32 func_80017A18(ObjectModel *, s32, s32 *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *, s8 *argA,
f32); // NON EQUIVALENT
#endif
+4 -4
View File
@@ -101,7 +101,7 @@ s32 gMaxRectangleParticles = 0;
s32 gMaxSpriteParticles = 0;
s32 gMaxLineParticles = 0;
s32 gMaxPointParticles = 0;
Sprite **gParticleDummys = NULL; // Sprites loaded from asset 47; appears to be unused
Sprite **gParticleDummys = NULL; // Placeholder sprite refs to keep them loaded in memory.
s32 gParticleDummyCount = 0; // Number of sprites in gParticleDummys
Vec2s gParticleCoordListTri[3] = {
@@ -292,9 +292,9 @@ void init_particle_assets(void) {
*
* Allocate buffers for particle objects.
* Generate particle shapes.
* Load sprites from asset 47.
* Load sprites from the dummy sprite ID list.
*/
#ifdef NON_EQUIVALENT
#ifdef NON_MATCHING
void init_particle_buffers(s32 maxTriangleParticles, s32 maxRectangleParticles, s32 maxSpriteParticles,
s32 maxLineParticles, s32 maxPointParticles, s32 unused_arg) {
s32 allocSize;
@@ -431,7 +431,7 @@ void init_particle_buffers(s32 maxTriangleParticles, s32 maxRectangleParticles,
}
if (gParticleDummys == NULL) {
asset2F = (s16 *) load_asset_section_from_rom(ASSET_BINARY_47);
asset2F = (s16 *) load_asset_section_from_rom(ASSET_DUMMY_PARTICLE_IDS);
gParticleDummyCount = 0;
while (asset2F[gParticleDummyCount] != -1) {
gParticleDummyCount++;
+4 -4
View File
@@ -6662,7 +6662,7 @@ void func_80054FD0(Object *racerObj, Object_Racer *racer, s32 updateRate) {
D_8011D54C = 0;
flags = 0;
if (racer->playerIndex != PLAYER_COMPUTER || racer->vehicleIDPrev < VEHICLE_BOSSES) {
flags = func_80017248(racerObj, 4, &numCollisions, (Vec3f *) racer->unkD8, sp134, spE0, sp58);
flags = collision_objectmodel(racerObj, 4, &numCollisions, (Vec3f *) racer->unkD8, sp134, spE0, sp58);
}
if (flags & 0x80) {
for (i = 0; i < 4; i++) {
@@ -6687,7 +6687,7 @@ void func_80054FD0(Object *racerObj, Object_Racer *racer, s32 updateRate) {
sp5C = 1;
}
}
generate_collision_candidates(4, racer->unkD8, sp134, racer->vehicleID);
generate_collision_candidates(4, (Vec3f *) racer->unkD8, (Vec3f *) sp134, racer->vehicleID);
numCollisions = 0;
racer->unk1E3 = resolve_collisions((Vec3f *) racer->unkD8, (Vec3f *) sp134, spE0, sp58, 4, &numCollisions);
sp184 = get_collision_normal(&sp180, &sp178, &sp17C);
@@ -6860,7 +6860,7 @@ void onscreen_ai_racer_physics(Object *obj, Object_Racer *racer, UNUSED s32 upda
hasCollision = FALSE;
flags = 0;
if (racer->playerIndex != PLAYER_COMPUTER || racer->vehicleIDPrev < VEHICLE_BOSSES) {
flags = func_80017248(obj, 1, &hasCollision, (Vec3f *) racer->unkD8, &tempPos.x, &radius, &surface);
flags = collision_objectmodel(obj, 1, &hasCollision, (Vec3f *) racer->unkD8, (f32 *) &tempPos, &radius, &surface);
}
if (flags & 0x80) {
D_8011D548 = tempPos.x - obj->trans.x_position;
@@ -6871,7 +6871,7 @@ void onscreen_ai_racer_physics(Object *obj, Object_Racer *racer, UNUSED s32 upda
if (flags && tempPos.y < obj->trans.y_position - 4.0) {
shouldSquish = TRUE;
}
generate_collision_candidates(1, racer->unkD8, &tempPos.x, racer->vehicleID);
generate_collision_candidates(1, (Vec3f *) racer->unkD8, &tempPos, racer->vehicleID);
hasCollision = FALSE;
racer->unk1E3 = resolve_collisions((Vec3f *) racer->unkD8, &tempPos, &radius, &surface, 1, &hasCollision);
racer->unk1E4 = flags;
-1
View File
@@ -219,7 +219,6 @@ void func_8004F7F4(s32 updateRate, f32 updateRateF, Object* racerObj, Object_Rac
//Non Matching
s32 timetrial_ghost_read(Object *obj);
void update_car_velocity_offground(Object *obj, Object_Racer *racer, s32, f32);
s32 func_80017248(Object *obj, s32 arg1, s32* arg2, f32 *arg3, f32* arg4, f32* arg5, s8* surface);
void func_80059208(Object* obj, Object_Racer* racer, s32 updateRate); /* extern */
void func_80049794(s32 updateRate, f32 updateRateF, Object* obj, Object_Racer* racer); /* extern */
void func_8004CC20(s32 updateRate, f32 updateRateF, Object *racerObj, Object_Racer *racer); /* extern */
+13 -12
View File
@@ -101,8 +101,8 @@ s32 gTTCamPlayerID;
s32 gTTCamID;
s32 gTTCamSmoothTimer;
s32 D_8011B10C;
s32 D_8011B110;
u32 D_8011B114;
s32 gTrackTexAnimOffset;
u32 gTrackTexAnimFlags;
s32 D_8011B118;
s32 D_8011B11C;
unk8011B120 D_8011B120[32]; // Struct sizeof(0x10) / sizeof(16)
@@ -237,11 +237,11 @@ void init_track(u32 geometry, u32 skybox, s32 numberOfPlayers, Vehicle vehicle,
cam_set_layout(numberOfPlayers);
skydome_spawn(skybox);
D_8011B110 = 0;
D_8011B114 = 0x10000;
gTrackTexAnimOffset = 0;
gTrackTexAnimFlags = RENDER_TEX_ANIM;
path_enable();
func_8000C8F8(arg6, 0);
func_8000C8F8(collectables, 1);
track_spawn_objects(arg6, 0);
track_spawn_objects(collectables, 1);
gScenePlayerViewports = numberOfPlayers;
track_setup_racers(vehicle, entranceId, numberOfPlayers);
racerfx_alloc(72, 64);
@@ -332,7 +332,7 @@ void render_scene(Gfx **dList, Mtx **mtx, Vertex **vtx, Triangle **tris, s32 upd
i = (gCurrentLevelHeader2->unkA4->height << 9) - 1;
gCurrentLevelHeader2->unkAA =
(gCurrentLevelHeader2->unkAA + (gCurrentLevelHeader2->unkA3 * tempUpdateRate)) & i;
tex_animate_texture(gCurrentLevelHeader2->unkA4, &D_8011B114, &D_8011B110, tempUpdateRate);
tex_animate_texture(gCurrentLevelHeader2->unkA4, &gTrackTexAnimFlags, &gTrackTexAnimOffset, tempUpdateRate);
}
flip = FALSE;
if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) {
@@ -1085,7 +1085,7 @@ s32 func_80027568(void) {
f32 playerDist;
f32 camDist;
f32 scalingFactor;
u32 curViewport;
s32 curViewport;
s32 flipSide;
s32 numRacers; // spC4
s32 i;
@@ -1123,7 +1123,8 @@ s32 func_80027568(void) {
if (racerObj == NULL) {
return FALSE;
}
generate_collision_candidates(1, &racerObj->trans.x_position, &gSceneActiveCamera->trans.x_position, -1);
generate_collision_candidates(1, (Vec3f *) &racerObj->trans.x_position,
(Vec3f *) &gSceneActiveCamera->trans.x_position, -1);
ret = FALSE;
for (var_t4 = 0; var_t4 < gNumCollisionCandidates && ret == FALSE; var_t4++) {
if (gCollisionCandidates[var_t4] > 0) {
@@ -1469,9 +1470,9 @@ void trackbg_render_flashy(void) {
var_t2 = *gCurrentLevelHeader2->unk74;
var_a2 = -1;
if ((u32) var_t2 != -1) {
if ((u32) var_t2 != -1U) {
levelHeader = gCurrentLevelHeader2->unk74[1];
if ((u32) levelHeader == -1) {
if ((u32) levelHeader == -1U) {
levelHeader = var_t2;
}
} else {
@@ -1486,7 +1487,7 @@ void trackbg_render_flashy(void) {
}
gfx_init_basic_xlu(&gTrackDL, 1, var_a2, var_a3);
texHeader = set_animated_texture_header(texHeader, D_8011B110 << 8);
texHeader = set_animated_texture_header(texHeader, gTrackTexAnimOffset << 8);
gDkrDmaDisplayList(gTrackDL++, OS_K0_TO_PHYSICAL(texHeader->cmd), texHeader->numberOfCommands);
gSPVertexDKR(gTrackDL++, OS_K0_TO_PHYSICAL(gTrackVtxPtr), 9, 0);
gSPPolygon(gTrackDL++, OS_K0_TO_PHYSICAL(gTrackTriPtr), 8, 1);
+1 -1
View File
@@ -184,7 +184,7 @@ void init_track(u32 geometry, u32 skybox, s32 numberOfPlayers, Vehicle vehicle,
void waves_init(LevelModel *, LevelHeader *, s32);
void void_init(s32);
void generate_track(s32 modelId);
void func_800304C8(unk8011C8B8 *arg0);
void func_800304C8(unk8011C8B8 arg0[3]);
s32 void_generate_primitive(f32 *arg0, f32 *arg1, f32 arg2, f32 arg3);
s32 func_8002FF6C(s32, unk8011C8B8 *, s32, Vec2f *);
s32 func_800BDC80(s32, unk8011C3B8 *, unk8011C8B8 *, f32, f32, f32, f32);
+2 -2
View File
@@ -318,8 +318,8 @@ void spawn_boss_hazard(Object *obj, Object_Racer *racer, f32 offset, s32 objectI
newObj->x_velocity = obj->x_velocity;
newObj->y_velocity = obj->y_velocity;
newObj->z_velocity = obj->z_velocity;
newObj->properties.common.unk0 = tempObj;
newObj->properties.common.unk4 = (s8) entry->animation.y_rotation * 60;
newObj->properties.fireball.obj = tempObj;
newObj->properties.fireball.timer = (s8) entry->animation.y_rotation * 60;
newObj->animFrame = rand_range(0, 255);
audspat_play_sound_at_position(soundID, newObj->trans.x_position, newObj->trans.y_position,
newObj->trans.z_position, AUDIO_POINT_FLAG_ONE_TIME_TRIGGER,
+3 -3
View File
@@ -30706,8 +30706,8 @@
"sha1": "9428062bff4e627639444509a29f79305f053eee"
},
{
"filename": "asset_binary_47",
"build-id": "ASSET_BINARY_47",
"filename": "asset_dummy_particle_ids",
"build-id": "ASSET_DUMMY_PARTICLE_IDS",
"type": "Binary",
"sha1": "5ec269b3714ca7427bb945e9cf7db57d0a2fec9e"
},
@@ -34049,7 +34049,7 @@
"default-type": "JPFonts"
},
{
"build-id": "ASSET_BINARY_47",
"build-id": "ASSET_DUMMY_PARTICLE_IDS",
"folder": "ids",
"default-type": "Binary"
},
+10 -10
View File
@@ -187,7 +187,7 @@ free_all_objects = 0x8000C604;
load_object_header = 0x8000C718;
try_free_object_header = 0x8000C844;
normalise_time = 0x8000C8B4;
func_8000C8F8 = 0x8000C8F8;
track_spawn_objects = 0x8000C8F8;
func_8000CBC0 = 0x8000CBC0;
func_8000CBF0 = 0x8000CBF0;
func_8000CC20 = 0x8000CC20;
@@ -232,7 +232,7 @@ free_object = 0x8000FFB8;
obj_table_ids = 0x80010018;
obj_id_valid = 0x80010028;
gParticlePtrList_flush = 0x8001004C;
func_800101AC = 0x800101AC;
obj_destroy = 0x800101AC;
obj_update = 0x80010994;
obj_tex_animate = 0x80011134;
obj_door_number = 0x80011264;
@@ -278,7 +278,7 @@ func_80016BC4 = 0x80016BC4;
obj_butterfly_node = 0x80016C68;
obj_dist_racer = 0x80016DE8;
obj_collision_transform = 0x8001709C;
func_80017248 = 0x80017248;
collision_objectmodel = 0x80017248;
func_8001790C = 0x8001790C;
func_80017978 = 0x80017978;
func_800179D0 = 0x800179D0;
@@ -3657,13 +3657,13 @@ D_8011AE88 = 0x8011C8F8;
gObjectCurrDisplayList = 0x8011C8FC;
gObjectCurrMatrix = 0x8011C900;
gObjectCurrVertexList = 0x8011C904;
D_8011AE98 = 0x8011C908;
D_8011AEA0 = 0x8011C910;
D_8011AEA8 = 0x8011C918;
D_8011AEB0 = 0x8011C920;
gObjectMapSpawnList = 0x8011C908;
gObjectMapSize = 0x8011C910;
gObjectMapID = 0x8011C918;
gObjectMap = 0x8011C920;
gAssetsLvlObjTranslationTable = 0x8011C928;
gAssetsLvlObjTranslationTableLength = 0x8011C92C;
D_8011AEC0 = 0x8011C930;
gObjectMapIndex = 0x8011C930;
gParticlePtrList = 0x8011C934;
gFreeListCount = 0x8011C938;
gTrackCheckpoints = 0x8011C93C;
@@ -3744,8 +3744,8 @@ gTTCamPlayerID = 0x8011CB70;
gTTCamID = 0x8011CB74;
gTTCamSmoothTimer = 0x8011CB78;
D_8011B10C = 0x8011CB7C;
D_8011B110 = 0x8011CB80;
D_8011B114 = 0x8011CB84;
gTrackTexAnimOffset = 0x8011CB80;
gTrackTexAnimFlags = 0x8011CB84;
D_8011B118 = 0x8011CB88;
D_8011B11C = 0x8011CB8C;
D_8011B120 = 0x8011CB90;
+10 -10
View File
@@ -187,7 +187,7 @@ free_all_objects = 0x8000C604;
load_object_header = 0x8000C718;
try_free_object_header = 0x8000C844;
normalise_time = 0x8000C8B4;
func_8000C8F8 = 0x8000C8F8;
track_spawn_objects = 0x8000C8F8;
func_8000CBC0 = 0x8000CBC0;
func_8000CBF0 = 0x8000CBF0;
func_8000CC20 = 0x8000CC20;
@@ -232,7 +232,7 @@ free_object = 0x8000FFB8;
obj_table_ids = 0x80010018;
obj_id_valid = 0x80010028;
gParticlePtrList_flush = 0x8001004C;
func_800101AC = 0x800101AC;
obj_destroy = 0x800101AC;
obj_update = 0x80010994;
obj_tex_animate = 0x80011134;
obj_door_number = 0x80011264;
@@ -278,7 +278,7 @@ func_80016BC4 = 0x80016BC4;
obj_butterfly_node = 0x80016C68;
obj_dist_racer = 0x80016DE8;
obj_collision_transform = 0x8001709C;
func_80017248 = 0x80017248;
collision_objectmodel = 0x80017248;
func_8001790C = 0x8001790C;
func_80017978 = 0x80017978;
func_800179D0 = 0x800179D0;
@@ -3395,13 +3395,13 @@ D_8011AE88 = 0x8011AF18;
gObjectCurrDisplayList = 0x8011AF1C;
gObjectCurrMatrix = 0x8011AF20;
gObjectCurrVertexList = 0x8011AF24;
D_8011AE98 = 0x8011AF28;
D_8011AEA0 = 0x8011AF30;
D_8011AEA8 = 0x8011AF38;
D_8011AEB0 = 0x8011AF40;
gObjectMapSpawnList = 0x8011AF28;
gObjectMapSize = 0x8011AF30;
gObjectMapID = 0x8011AF38;
gObjectMap = 0x8011AF40;
gAssetsLvlObjTranslationTable = 0x8011AF48;
gAssetsLvlObjTranslationTableLength = 0x8011AF4C;
D_8011AEC0 = 0x8011AF50;
gObjectMapIndex = 0x8011AF50;
gParticlePtrList = 0x8011AF54;
gFreeListCount = 0x8011AF58;
gTrackCheckpoints = 0x8011AF5C;
@@ -3480,8 +3480,8 @@ gTTCamPlayerID = 0x8011B190;
gTTCamID = 0x8011B194;
gTTCamSmoothTimer = 0x8011B198;
D_8011B10C = 0x8011B19C;
D_8011B110 = 0x8011B1A0;
D_8011B114 = 0x8011B1A4;
gTrackTexAnimOffset = 0x8011B1A0;
gTrackTexAnimFlags = 0x8011B1A4;
D_8011B118 = 0x8011B1A8;
D_8011B11C = 0x8011B1AC;
D_8011B120 = 0x8011B1B0;
+10 -10
View File
@@ -187,7 +187,7 @@ free_all_objects = 0x8000C604;
load_object_header = 0x8000C718;
try_free_object_header = 0x8000C844;
normalise_time = 0x8000C8B4;
func_8000C8F8 = 0x8000C8F8;
track_spawn_objects = 0x8000C8F8;
func_8000CBC0 = 0x8000CBC0;
func_8000CBF0 = 0x8000CBF0;
func_8000CC20 = 0x8000CC20;
@@ -232,7 +232,7 @@ free_object = 0x8000FFB8;
obj_table_ids = 0x80010018;
obj_id_valid = 0x80010028;
gParticlePtrList_flush = 0x8001004C;
func_800101AC = 0x800101AC;
obj_destroy = 0x800101AC;
obj_update = 0x80010994;
obj_tex_animate = 0x80011134;
obj_door_number = 0x80011264;
@@ -278,7 +278,7 @@ func_80016BC4 = 0x80016BF8;
obj_butterfly_node = 0x80016C9C;
obj_dist_racer = 0x80016E1C;
obj_collision_transform = 0x800170D0;
func_80017248 = 0x8001727C;
collision_objectmodel = 0x8001727C;
func_8001790C = 0x80017940;
func_80017978 = 0x800179AC;
func_800179D0 = 0x80017A04;
@@ -3325,13 +3325,13 @@ D_8011AE88 = 0x8011B498;
gObjectCurrDisplayList = 0x8011B49C;
gObjectCurrMatrix = 0x8011B4A0;
gObjectCurrVertexList = 0x8011B4A4;
D_8011AE98 = 0x8011B4A8;
D_8011AEA0 = 0x8011B4B0;
D_8011AEA8 = 0x8011B4B8;
D_8011AEB0 = 0x8011B4C0;
gObjectMapSpawnList = 0x8011B4A8;
gObjectMapSize = 0x8011B4B0;
gObjectMapID = 0x8011B4B8;
gObjectMap = 0x8011B4C0;
gAssetsLvlObjTranslationTable = 0x8011B4C8;
gAssetsLvlObjTranslationTableLength = 0x8011B4CC;
D_8011AEC0 = 0x8011B4D0;
gObjectMapIndex = 0x8011B4D0;
gParticlePtrList = 0x8011B4D4;
gFreeListCount = 0x8011B4D8;
gTrackCheckpoints = 0x8011B4DC;
@@ -3410,8 +3410,8 @@ gTTCamPlayerID = 0x8011B710;
gTTCamID = 0x8011B714;
gTTCamSmoothTimer = 0x8011B718;
D_8011B10C = 0x8011B71C;
D_8011B110 = 0x8011B720;
D_8011B114 = 0x8011B724;
gTrackTexAnimOffset = 0x8011B720;
gTrackTexAnimFlags = 0x8011B724;
D_8011B118 = 0x8011B728;
D_8011B11C = 0x8011B72C;
D_8011B120 = 0x8011B730;
+10 -10
View File
@@ -187,7 +187,7 @@ free_all_objects = 0x8000C604;
load_object_header = 0x8000C718;
try_free_object_header = 0x8000C844;
normalise_time = 0x8000C8B4;
func_8000C8F8 = 0x8000C8F8;
track_spawn_objects = 0x8000C8F8;
func_8000CBC0 = 0x8000CBC0;
func_8000CBF0 = 0x8000CBF0;
func_8000CC20 = 0x8000CC20;
@@ -232,7 +232,7 @@ free_object = 0x8000FFB8;
obj_table_ids = 0x80010018;
obj_id_valid = 0x80010028;
gParticlePtrList_flush = 0x8001004C;
func_800101AC = 0x800101AC;
obj_destroy = 0x800101AC;
obj_update = 0x80010994;
obj_tex_animate = 0x80011134;
obj_door_number = 0x80011264;
@@ -278,7 +278,7 @@ func_80016BC4 = 0x80016BC4;
obj_butterfly_node = 0x80016C68;
obj_dist_racer = 0x80016DE8;
obj_collision_transform = 0x8001709C;
func_80017248 = 0x80017248;
collision_objectmodel = 0x80017248;
func_8001790C = 0x8001790C;
func_80017978 = 0x80017978;
func_800179D0 = 0x800179D0;
@@ -3772,13 +3772,13 @@ D_8011AE88 = 0x8011AE88;
gObjectCurrDisplayList = 0x8011AE8C;
gObjectCurrMatrix = 0x8011AE90;
gObjectCurrVertexList = 0x8011AE94;
D_8011AE98 = 0x8011AE98;
D_8011AEA0 = 0x8011AEA0;
D_8011AEA8 = 0x8011AEA8;
D_8011AEB0 = 0x8011AEB0;
gObjectMapSpawnList = 0x8011AE98;
gObjectMapSize = 0x8011AEA0;
gObjectMapID = 0x8011AEA8;
gObjectMap = 0x8011AEB0;
gAssetsLvlObjTranslationTable = 0x8011AEB8;
gAssetsLvlObjTranslationTableLength = 0x8011AEBC;
D_8011AEC0 = 0x8011AEC0;
gObjectMapIndex = 0x8011AEC0;
gParticlePtrList = 0x8011AEC4;
gFreeListCount = 0x8011AEC8;
gTrackCheckpoints = 0x8011AECC;
@@ -3859,8 +3859,8 @@ gTTCamPlayerID = 0x8011B100;
gTTCamID = 0x8011B104;
gTTCamSmoothTimer = 0x8011B108;
D_8011B10C = 0x8011B10C;
D_8011B110 = 0x8011B110;
D_8011B114 = 0x8011B114;
gTrackTexAnimOffset = 0x8011B110;
gTrackTexAnimFlags = 0x8011B114;
D_8011B118 = 0x8011B118;
D_8011B11C = 0x8011B11C;
D_8011B120 = 0x8011B120;

Some files were not shown because too many files have changed in this diff Show More