Merge branch 'fgsfdsfgs:port' into port

This commit is contained in:
Richard M authored and GitHub committed 2023-08-30 01:10:15 -06:00
commit 630b236ac0
7 files changed
+39 -11

No files matched your search

+5
View File
@@ -1079,7 +1079,12 @@ void creditsResetSlides(void)
g_CreditsData->coreteammap[i + 1] = pool[index]; g_CreditsData->coreteammap[i + 1] = pool[index];
#ifdef AVOID_UB
// don't overflow `pool`
while (index < NUM_CORE_TEAM - i - 1) {
#else
while (index < NUM_CORE_TEAM - i) { while (index < NUM_CORE_TEAM - i) {
#endif
pool[index] = pool[index + 1]; pool[index] = pool[index + 1];
index++; index++;
} }
+9 -3
View File
@@ -76,9 +76,15 @@ void navSetSeed(u32 upper, u32 lower)
struct waypoint *waypointFindClosestToPos(struct coord *pos, RoomNum *rooms) struct waypoint *waypointFindClosestToPos(struct coord *pos, RoomNum *rooms)
{ {
struct waypoint *closest = NULL; struct waypoint *closest = NULL;
#ifdef AVOID_UB
// prevent bgRoomGetNeighbours or roomsAppend from writing out of bounds
RoomNum allrooms[31];
RoomNum neighbours[11];
#else
RoomNum allrooms[30]; RoomNum allrooms[30];
s32 candlen = 0;
RoomNum neighbours[10]; RoomNum neighbours[10];
#endif
s32 candlen = 0;
s32 i; s32 i;
s32 j; s32 j;
struct waypoint *candwaypoints[10]; struct waypoint *candwaypoints[10];
@@ -94,8 +100,8 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, RoomNum *rooms)
allrooms[i] = -1; allrooms[i] = -1;
for (i = 0; rooms[i] != -1; i++) { for (i = 0; rooms[i] != -1; i++) {
bgRoomGetNeighbours(rooms[i], neighbours, ARRAYCOUNT(neighbours)); bgRoomGetNeighbours(rooms[i], neighbours, 10);
roomsAppend(neighbours, allrooms, ARRAYCOUNT(allrooms)); roomsAppend(neighbours, allrooms, 30);
} }
if (g_StageSetup.waypoints != NULL) { if (g_StageSetup.waypoints != NULL) {
+4
View File
@@ -243,7 +243,11 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, RoomNum *dstr
s32 stack3[2]; s32 stack3[2];
RoomNum tmppadrooms[2]; RoomNum tmppadrooms[2];
f32 bestsqdist; f32 bestsqdist;
#ifdef AVOID_UB
RoomNum neighbours[21]; // prevent bgRoomGetNeighbours from writing out of bounds
#else
RoomNum neighbours[20]; RoomNum neighbours[20];
#endif
// Iterate all spawn pads and populate the category arrays // Iterate all spawn pads and populate the category arrays
for (p = 0; p < numpads; p++) { for (p = 0; p < numpads; p++) {
+8
View File
@@ -1248,9 +1248,17 @@ void frEndSession(bool hidetargets)
s32 j; s32 j;
s16 propnums[256]; s16 propnums[256];
s16 *propnumptr; s16 *propnumptr;
#ifdef AVOID_UB
RoomNum rooms[21];
#else
RoomNum rooms[20]; RoomNum rooms[20];
#endif
u32 stack1; u32 stack1;
#ifdef AVOID_UB
RoomNum rooms2[11]; // prevent bgRoomGetNeighbours from writing out of bounds
#else
RoomNum rooms2[10]; RoomNum rooms2[10];
#endif
u32 stack2; u32 stack2;
if (g_FrDataLoaded) { if (g_FrDataLoaded) {
+10 -2
View File
@@ -856,7 +856,11 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2)
u32 stack2; u32 stack2;
struct coord distcamtobbmax; struct coord distcamtobbmax;
struct coord distcamtobbmin; struct coord distcamtobbmin;
#ifdef AVOID_UB
RoomNum neighbours[21];
#else
RoomNum neighbours[20]; RoomNum neighbours[20];
#endif
particledata = weather->particledata[arg2]; particledata = weather->particledata[arg2];
numtris = 0; numtris = 0;
@@ -1063,7 +1067,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2)
} }
for (scale = 1.0f, t = 0; t < numtestrooms; t++) { for (scale = 1.0f, t = 0; t < numtestrooms; t++) {
numneighbours = bgRoomGetNeighbours(testrooms[t], neighbours, ARRAYCOUNT(neighbours)); numneighbours = bgRoomGetNeighbours(testrooms[t], neighbours, 20);
for (n = 0; n < numneighbours; n++) { for (n = 0; n < numneighbours; n++) {
if (g_Rooms[neighbours[n]].flags & ROOMFLAG_ONSCREEN) { if (g_Rooms[neighbours[n]].flags & ROOMFLAG_ONSCREEN) {
@@ -2872,7 +2876,11 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2)
s32 i; // 184 s32 i; // 184
struct coord sp178; struct coord sp178;
struct coord sp16c; struct coord sp16c;
#ifdef AVOID_UB
RoomNum sp144[21]; // prevent bgRoomGetNeighbours from writing out of bounds
#else
RoomNum sp144[20]; RoomNum sp144[20];
#endif
struct coord sp124; struct coord sp124;
struct coord sp118; struct coord sp118;
f32 f26; f32 f26;
@@ -3003,7 +3011,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2)
// 4c54 // 4c54
for (i = 0; i < sp1268; i++) { for (i = 0; i < sp1268; i++) {
numneighbours = bgRoomGetNeighbours(sp126c[i], sp144, ARRAYCOUNT(sp144)); numneighbours = bgRoomGetNeighbours(sp126c[i], sp144, 20);
for (j2 = 0; j2 < numneighbours; j2++) { for (j2 = 0; j2 < numneighbours; j2++) {
a0 = true; a0 = true;
+1 -4
View File
@@ -3993,10 +3993,7 @@ struct gamefile {
}; };
struct mpchrconfig { struct mpchrconfig {
/*0x00*/ char name[12]; // up to 10 visible chars plus line break plus null byte /*0x00*/ char name[15];
/*0x0c*/ u8 unk0c;
/*0x0d*/ u8 unk0d;
/*0x0e*/ u8 unk0e;
/*0x0f*/ u8 mpheadnum; /*0x0f*/ u8 mpheadnum;
/*0x10*/ u8 mpbodynum; /*0x10*/ u8 mpbodynum;
/*0x11*/ u8 team; /*0x11*/ u8 team;
+2 -2
View File
@@ -2736,8 +2736,8 @@ bool mp3dec000427d8(struct asistream *stream, u32 gr)
f32 *sp0c = stream->unk4664[0][0].unk00; f32 *sp0c = stream->unk4664[0][0].unk00;
s32 i = 0; s32 i = 0;
if (stream->window_switching[gr][0] && stream->window_switching[gr][2] == 2) { if (stream->window_switching[gr][0] && stream->block_type[gr][0] == 2) {
if (stream->window_switching[gr][4]) { if (stream->mixed_block_flag[gr][0]) {
while (i++ < 36) { while (i++ < 36) {
*(sp10++) = *(sp0c++); *(sp10++) = *(sp0c++);
} }