Match retail BSS ordering (#1927)

* Match retail BSS ordering

* Revert moving some global variables to headers

* Adjust block numbers after header changes

* Fix debug build

* Overlay bss ordering

* Fix BSS ordering after header changes

* gc-eu-mq OK

* Implement preprocessor for #pragma increment_block_number

* Transfer usage comment from reencode.sh

* Use temporary directory instead of temporary file

* Move ColChkMassType back
This commit is contained in:
cadmic
2024-04-14 14:51:32 -07:00
committed by GitHub
parent a94661054e
commit f643499462
25 changed files with 224 additions and 165 deletions
+22 -4
View File
@@ -7,6 +7,10 @@ typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);
typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*);
typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*);
// For retail BSS ordering, the block number of sparkInit in CollisionCheck_BlueBlood
// must be between 183 and 255 inclusive.
#pragma increment_block_number 50
#if OOT_DEBUG
/**
* Draws a red triangle with vertices vA, vB, and vC.
@@ -2238,8 +2242,10 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk
}
}
#if OOT_DEBUG
static s8 sBssDummy0;
static s8 sBssDummy1;
#endif
void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol, Collider* acCol) {
static TriNorm tri1;
@@ -2300,10 +2306,12 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk
}
}
#if OOT_DEBUG
static s8 sBssDummy3;
static s8 sBssDummy4;
static s8 sBssDummy5;
static s8 sBssDummy6;
#endif
void CollisionCheck_ATTrisVsACTris(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol,
Collider* acCol) {
@@ -2350,10 +2358,12 @@ void CollisionCheck_ATTrisVsACTris(PlayState* play, CollisionCheckContext* colCh
}
}
#if OOT_DEBUG
static s8 sBssDummy7;
static s8 sBssDummy8;
static s8 sBssDummy9;
static s8 sBssDummy10;
#endif
void CollisionCheck_ATTrisVsACQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol,
Collider* acCol) {
@@ -2586,9 +2596,10 @@ static ColChkApplyFunc sColChkApplyFuncs[] = {
*/
void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colChkCtx) {
Collider** acColP;
Collider* acCol;
for (acColP = colChkCtx->colAC; acColP < colChkCtx->colAC + colChkCtx->colACCount; acColP++) {
Collider* acCol = *acColP;
acCol = *acColP;
if (acCol != NULL && acCol->acFlags & AC_ON) {
if (acCol->actor != NULL && acCol->actor->update == NULL) {
@@ -2635,9 +2646,10 @@ static ColChkVsFunc sACVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX] = {
*/
void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol) {
Collider** acColP;
Collider* acCol;
for (acColP = colChkCtx->colAC; acColP < colChkCtx->colAC + colChkCtx->colACCount; acColP++) {
Collider* acCol = *acColP;
acCol = *acColP;
if (acCol != NULL && acCol->acFlags & AC_ON) {
if (acCol->actor != NULL && acCol->actor->update == NULL) {
@@ -2661,12 +2673,13 @@ void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colChkCtx, Collid
*/
void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx) {
Collider** atColP;
Collider* atCol;
if (colChkCtx->colATCount == 0 || colChkCtx->colACCount == 0) {
return;
}
for (atColP = colChkCtx->colAT; atColP < colChkCtx->colAT + colChkCtx->colATCount; atColP++) {
Collider* atCol = *atColP;
atCol = *atColP;
if (atCol != NULL && atCol->atFlags & AT_ON) {
if (atCol->actor != NULL && atCol->actor->update == NULL) {
@@ -2684,6 +2697,8 @@ typedef enum {
/* 2 */ MASSTYPE_NORMAL
} ColChkMassType;
#pragma increment_block_number 253
/**
* Get mass type. Immovable colliders cannot be pushed, while heavy colliders can only be pushed by heavy and immovable
* colliders.
@@ -3134,9 +3149,10 @@ static ColChkApplyFunc sApplyDamageFuncs[COLSHAPE_MAX] = {
*/
void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colChkCtx) {
s32 i;
Collider* col;
for (i = 0; i < colChkCtx->colACCount; i++) {
Collider* col = colChkCtx->colAC[i];
col = colChkCtx->colAC[i];
if (col == NULL) {
continue;
@@ -3312,12 +3328,14 @@ void Collider_SetTrisDim(PlayState* play, ColliderTris* tris, s32 elemIndex, Col
Collider_SetTrisElementDim(play, &trisElem->dim, src);
}
#if OOT_DEBUG
// Due to an unknown reason, bss ordering changed between the 2 static Vec3f variables in the function below.
// In order to reproduce this behavior, we need a specific number of bss variables in the file before that point.
// For this, we introduce a certain amount of dummy variables throughout the file, which we fit inside padding added
// by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in bss.
static s8 sBssDummy11;
static s8 sBssDummy12;
#endif
/**
* Updates the world spheres for all of the collider's JntSph elements attached to the specified limb