1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-12 02:44:54 +00:00

Merge commit 'f643499462' into doc_pause_menu

This commit is contained in:
Dragorn421 2024-08-01 20:34:36 +02:00
commit 3786fa4062
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
35 changed files with 1445 additions and 1121 deletions

View file

@ -44,6 +44,15 @@
#include "terminal.h"
#include "alloca.h"
// For retail BSS ordering, the block number of sFaultInstance must be 0 or
// just above (the exact upper bound depends on the block numbers assigned to
// extern variables declared in headers).
#if OOT_DEBUG
#pragma increment_block_number 20
#else
#pragma increment_block_number 25
#endif
void FaultDrawer_Init(void);
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled);
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color);
@ -76,21 +85,11 @@ const char* sFpExceptionNames[] = {
"Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation",
};
#ifndef NON_MATCHING
// TODO: match .bss (has reordering issues)
extern FaultMgr* sFaultInstance;
extern u8 sFaultAwaitingInput;
extern STACK(sFaultStack, 0x600);
extern StackEntry sFaultThreadInfo;
extern FaultMgr gFaultMgr;
#else
// Non-matching version for struct shiftability
FaultMgr* sFaultInstance;
u8 sFaultAwaitingInput;
STACK(sFaultStack, 0x600);
StackEntry sFaultThreadInfo;
FaultMgr gFaultMgr;
#endif
typedef struct {
/* 0x00 */ s32 (*callback)(void*, void*);

View file

@ -99,15 +99,8 @@ FaultDrawer sFaultDrawerDefault = {
NULL,
};
#ifndef NON_MATCHING
// TODO: match .bss (has reordering issues)
extern FaultDrawer sFaultDrawer;
extern char D_8016B6C0[0x20];
#else
// Non-matching version for struct shiftability
FaultDrawer sFaultDrawer;
char D_8016B6C0[0x20];
#endif
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
sFaultDrawer.osSyncPrintfEnabled = enabled;

View file

@ -159,7 +159,9 @@ void Graph_Destroy(GraphicsContext* gfxCtx) {
}
void Graph_TaskSet00(GraphicsContext* gfxCtx) {
#if OOT_DEBUG
static Gfx* sPrevTaskWorkBuffer = NULL;
#endif
static s32 sGraphCfbInfoIdx = 0;
OSTime timeNow;

View file

@ -1,6 +1,10 @@
#include "global.h"
#include "terminal.h"
// For retail BSS ordering, the block number of cbf in Math3D_CylVsCylOverlapCenterDist
// must be 0.
#pragma increment_block_number 190
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA);
s32 Math3D_TriLineIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA,

View file

@ -8,6 +8,9 @@
#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
#include "assets/objects/object_bdoor/object_bdoor.h"
// For retail BSS ordering, the block number of sCurCeilingPoly
// must be between 2 and 243 inclusive.
static CollisionPoly* sCurCeilingPoly;
static s32 sCurCeilingBgId;
@ -1601,13 +1604,13 @@ s32 Actor_OfferTalkExchange(Actor* actor, PlayState* play, f32 xzRange, f32 yRan
if ((player->actor.flags & ACTOR_FLAG_TALK) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) ||
(!actor->isTargeted &&
((yRange < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) ||
((yRange < fabsf(actor->yDistToPlayer)) || (player->talkActorDistance < actor->xzDistToPlayer) ||
(xzRange < actor->xzDistToPlayer)))) {
return false;
}
player->targetActor = actor;
player->targetActorDistance = actor->xzDistToPlayer;
player->talkActor = actor;
player->talkActorDistance = actor->xzDistToPlayer;
player->exchangeItemId = exchangeItemId;
return true;
@ -1697,7 +1700,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange
if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) &&
Player_GetExplosiveHeld(player) < 0) {
if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) &&
if ((((player->heldActor != NULL) || (actor == player->talkActor)) && (getItemId > GI_NONE) &&
(getItemId < GI_MAX)) ||
(!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) {
if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) {
@ -1894,7 +1897,9 @@ s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId,
return false;
}
// Local data used for Farore's Wind light (stored in BSS, possibly a struct?)
#pragma increment_block_number 22
// Local data used for Farore's Wind light (stored in BSS)
LightInfo D_8015BC00;
LightNode* D_8015BC10;
s32 D_8015BC14;
@ -2204,7 +2209,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
}
if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) {
sp74 = player->targetActor;
sp74 = player->talkActor;
}
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, categoryFreezeMaskP++) {

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,8 @@ typedef struct {
/*==================================================================*/
// Data
#if OOT_DEBUG
s16 sOREGInit[] = {
0, // OREG(0)
1, // OREG(1)
@ -83,6 +85,7 @@ s16 sOREGInit[] = {
};
s16 sOREGInitCnt = ARRAY_COUNT(sOREGInit);
#endif
s16 sCamDataRegsInit[CAM_DATA_MAX] = {
-20, // CAM_DATA_Y_OFFSET
@ -116,6 +119,7 @@ s16 sCamDataRegsInit[CAM_DATA_MAX] = {
s16 sCamDataRegsInitCount = ARRAY_COUNT(sCamDataRegsInit);
#if OOT_DEBUG
char sCameraSettingNames[][12] = {
"NONE ", // CAM_SET_NONE
"NORMAL0 ", // CAM_SET_NORMAL0
@ -208,6 +212,7 @@ char sCameraModeNames[][12] = {
"PUSHPULL ", // CAM_MODE_PUSH_PULL
"BOOKEEPON ", // CAM_MODE_FOLLOW_BOOMERANG
};
#endif
/**
*=====================================================================
@ -2556,7 +2561,11 @@ s32 (*sCameraFunctions[])(Camera*) = {
s32 sInitRegs = 1;
s32 gDebugCamEnabled = false;
#if OOT_DEBUG
s32 sDbgModeIdx = -1;
#endif
s16 sNextUID = 0;
s32 sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_NONE, CAM_HUD_VISIBILITY_ALL, 1);
@ -2579,6 +2588,7 @@ s32 D_8011D3F0 = 0;
s32 sDemo5PrevAction12Frame = -16;
#if OOT_DEBUG
char sCameraFunctionNames[][8] = {
"NONE ", // CAM_FUNC_NONE
"NORM0()", // CAM_FUNC_NORM0
@ -2653,6 +2663,7 @@ char sCameraFunctionNames[][8] = {
"SPEC9()", // CAM_FUNC_SPEC9
"", "", "", "", "",
};
#endif
VecSph D_8011D658[] = {
{ 50.0f, 0xEE3A, 0xD558 },
@ -2668,371 +2679,10 @@ Vec3f D_8011D678[] = {
{ 0.0f, 3.0f, -3.0 },
};
/*******************************************************
* OnePoint initalization values for Attention Cutscenes (Demo5)
********************************************************/
s32 sDemo5PrevSfxFrame = -200;
// target is player, far from eye
OnePointCsFull D_8011D6AC[] = {
{
// viewFlags & 0x00FF (at): 2, atTarget is view lookAt + atInit
// viewFlags & 0xFF00 (eye): none
// action: 15, copy at, eye, roll, fov to camera
// result: eye remains in the same location, at is View's lookAt
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0002,
1,
0,
60.0f,
1.0f,
{ 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f },
},
{
// viewFlags & 0x00FF (at): 3, atTarget is camera's current at + atInit
// viewFlags & 0xFF00 (eye): 3, eyeTarget is the camera's current eye + eyeInit
// action: interpolate eye and at.
// result: eye and at's y interpolate to become +20 from their current location.
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0303,
19,
0,
45.0f,
1.0f,
{ 0.0f, 20.0f, 0.0f },
{ 0.0f, 20.0f, 0.0f },
},
{
// viewFlags & 0x00FF (at): 0 none
// viewFlags & 0xFF00 (eye): 0 none
// action: 18, copy this camera to default camera.
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// target is player close to current eye
OnePointCsFull D_8011D724[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2424,
1,
0,
60.0f,
1.0f,
{ 0.0f, 0.0f, 0.0f },
{ 0.0f, 10.0f, -20.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2121,
19,
0,
50.0f,
1.0f,
{ 0.0f, -10.0f, 0.0f },
{ 0.0f, 0.0f, 60.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// target is close to player
OnePointCsFull D_8011D79C[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0002,
1,
0,
60.0f,
1.0f,
{ 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0303,
19,
0,
45.0f,
1.0f,
{ 0.0f, -20.0f, 0.0f },
{ 0.0f, -10.0f, 5.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0303,
9,
0,
60.0f,
1.0f,
{ 0.0f, 10.0f, 0.0f },
{ 0.0f, 10.0f, 0.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// target is within 300 units of eye, and player is within 30 units of eye
OnePointCsFull D_8011D83C[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2141,
20,
0,
45.0f,
0.2f,
{ 0.0f, 0.0f, 10.0f },
{ 0.0f, 0.0f, 10.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// target is within 700 units of eye, angle between player/eye and target/eye is less than
// 76.9 degrees. The x/y coordinates of the target on screen is between (21, 41) and (300, 200),
// and the player is farther than 30 units of the eye
OnePointCsFull D_8011D88C[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0303,
20,
0,
45.0f,
1.0f,
{ 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// same as above, but the target is NOT within the screen area.
OnePointCsFull D_8011D8DC[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0404,
20,
1,
50.0f,
1.0f,
{ 0.0f, 5.0f, 10.0f },
{ 0.0f, 10.0f, -80.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2121,
5,
0,
60.0f,
1.0f,
{ 0.0f, 5.0f, 0.0f },
{ 5.0f, 5.0f, -200.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// target is a door.
OnePointCsFull D_8011D954[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0xC1C1,
20,
0,
60.0f,
1.0f,
{ 0.0f, 0.0f, 50.0f },
{ 0.0f, 0.0f, 250.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x05B1,
5,
0,
60.0f,
0.1f,
{ 0.0f, 10.0f, 50.0f },
{ 0.0f, 10.0f, 100.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2121,
5,
2,
60.0f,
1.0f,
{ 0.0f, 10.0f, 0.0f },
{ 0.0f, 20.0f, -150.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
// otherwise
OnePointCsFull D_8011D9F4[] = {
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0504,
20,
2,
60.0f,
1.0f,
{ 0.0f, 5.0f, 50.0f },
{ 0.0f, 20.0f, 300.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true),
ONEPOINT_CS_INIT_FIELD_NONE,
0x2121,
5,
2,
60.0f,
1.0f,
{ 0.0f, 10.0f, 0.0f },
{ 0.0f, 20.0f, -150.0f },
},
{
ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false),
ONEPOINT_CS_INIT_FIELD_NONE,
0x0000,
1,
0,
60.0f,
1.0f,
{ -1.0f, -1.0f, -1.0f },
{ -1.0f, -1.0f, -1.0f },
},
};
typedef enum {
/* 0 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR, // ACTOR_BG_HIDAN_ROCK
/* 1 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER, // ACTOR_BG_HIDAN_FSLIFT
/* 2 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER, // ACTOR_BG_HIDAN_SYOKU
/* 3 */ CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE // ACTOR_BG_JYA_1FLIFT
} CamElevatorPlatform;
Vec3f sCamElevatorPlatformLowerEyePoints[] = {
{ 3050.0f, 700.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR
{ 1755.0f, 3415.0f, -380.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER
{ -3120.0f, 3160.0f, 245.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER
{ 0.0f, -10.0f, 240.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE
};
Vec3f sCamElevatorPlatformUpperEyePoints[] = {
{ 3160.0f, 2150.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR
{ 1515.0f, 4130.0f, -835.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER
{ -3040.0f, 4135.0f, 230.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER
{ -50.0f, 600.0f, -75.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE
};
// Trigger player y position to swap eye points
f32 sCamElevatorPlatformTogglePosY[] = {
1570.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR
3680.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER
3700.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER
395.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE
};
f32 sCamElevatorPlatformFovRollParam[] = {
320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR
320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER
320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER
0.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE
};
s16 sCamElevatorPlatformRolls[] = {
-2000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR
-1000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER
0, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER
0 // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE
};
// unused
s32 D_8011DAF4 = 0;
s32 D_8011DAF8 = 0;
s16 D_8011DAFC[] = {
CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2,
};
PlayState* D_8015BD7C;
#if OOT_DEBUG
DebugCam D_8015BD80;
#endif
CollisionPoly* playerFloorPoly;

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

View file

@ -1,5 +1,10 @@
#include "global.h"
// For retail BSS ordering, the block number of D_8015FA88 must be 0 or
// just above (the exact upper bound depends on the block numbers assigned to
// extern variables declared in headers).
#pragma increment_block_number 60
ALIGNED(16) SaveContext gSaveContext;
u32 D_8015FA88;
u32 D_8015FA8C;

View file

@ -1,6 +1,11 @@
#include "global.h"
#include "terminal.h"
// For retail BSS ordering, the block number of sKaleidoScopeUpdateFunc must be 0 or
// just above (the exact upper bound depends on the block numbers assigned to
// extern variables declared in headers).
#pragma increment_block_number 60
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
f32 gBossMarkScale;

View file

@ -4,6 +4,11 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
// For retail BSS ordering, the block number of sLensFlareUnused must be lower
// than the extern variables declared in the header (e.g. gLightningStrike)
// while the block number of sNGameOverLightNode must be higher.
#pragma increment_block_number 80
typedef enum {
/* 0x00 */ LIGHTNING_BOLT_START,
/* 0x01 */ LIGHTNING_BOLT_WAIT,
@ -183,7 +188,7 @@ f32 sSandstormLerpScale = 0.0f;
u8 gCustomLensFlareOn;
Vec3f gCustomLensFlarePos;
s16 gLensFlareUnused;
s16 sLensFlareUnused;
s16 gLensFlareScale;
f32 gLensFlareColorIntensity;
s16 gLensFlareGlareStrength;
@ -207,6 +212,11 @@ s16 sLightningFlashAlpha;
s16 sSunDepthTestX;
s16 sSunDepthTestY;
// These variables could be moved farther down in the file to reduce the amount
// of block number padding here, but currently this causes BSS ordering issues
// for debug.
#pragma increment_block_number 230
LightNode* sNGameOverLightNode;
LightInfo sNGameOverLightInfo;
LightNode* sSGameOverLightNode;
@ -2208,7 +2218,7 @@ void Environment_DrawCustomLensFlare(PlayState* play) {
pos.y = gCustomLensFlarePos.y;
pos.z = gCustomLensFlarePos.z;
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, gLensFlareUnused,
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, sLensFlareUnused,
gLensFlareScale, gLensFlareColorIntensity, gLensFlareGlareStrength, false);
}
}

View file

@ -3060,7 +3060,6 @@ void Message_Update(PlayState* play) {
0x0015, 0x0016, 0x0017, 0x0003, 0x0000, 0x270B, 0x00C8, 0x012C, 0x012D, 0xFFDA, 0x0014, 0x0016, 0x0014, 0x0016,
};
static u8 D_80153D74 = 0;
static u16 D_80153D78 = 0;
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Player* player = GET_PLAYER(play);
@ -3073,10 +3072,12 @@ void Message_Update(PlayState* play) {
#if OOT_DEBUG
if (BREG(0) != 0) {
static u16 sMessageDebuggerTextboxCount = 0;
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) {
PRINTF("msgno=%d\n", D_80153D78);
PRINTF("msgno=%d\n", sMessageDebuggerTextboxCount);
Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL);
D_80153D78 = (D_80153D78 + 1) % 10;
sMessageDebuggerTextboxCount = (sMessageDebuggerTextboxCount + 1) % 10;
}
if (R_MESSAGE_DEBUGGER_SELECT != 0) {
while (R_MESSAGE_DEBUGGER_TEXTID != 0x8000) {
@ -3358,8 +3359,10 @@ void Message_SetTables(void) {
sStaffMessageEntryTablePtr = sStaffMessageEntryTable;
}
#if OOT_DEBUG
// Appears to be file padding
UNK_TYPE D_80153D7C = 0x00000000;
#endif
// This should be part of z_game_over.c, but cannot be moved there as the entire
// late_rodata section of this file is in the way

View file

@ -2,13 +2,16 @@
#include "quake.h"
#include "terminal.h"
#if OOT_DEBUG
void* gDebugCutsceneScript = NULL;
UNK_TYPE D_8012D1F4 = 0; // unused
#endif
Input* D_8012D1F8 = NULL;
TransitionTile sTransitionTile;
TransitionTile gTransitionTile;
s32 gTransitionTileState;
VisMono sPlayVisMono;
VisMono gPlayVisMono;
Color_RGBA8_u32 gVisMonoColor;
#if OOT_DEBUG
@ -196,7 +199,7 @@ void Play_Destroy(GameState* thisx) {
CollisionCheck_DestroyContext(this, &this->colChkCtx);
if (gTransitionTileState == TRANS_TILE_READY) {
TransitionTile_Destroy(&sTransitionTile);
TransitionTile_Destroy(&gTransitionTile);
gTransitionTileState = TRANS_TILE_OFF;
}
@ -208,7 +211,7 @@ void Play_Destroy(GameState* thisx) {
Letterbox_Destroy();
TransitionFade_Destroy(&this->transitionFadeFlash);
VisMono_Destroy(&sPlayVisMono);
VisMono_Destroy(&gPlayVisMono);
if (gSaveContext.save.linkAge != this->linkAgeOnLoad) {
Inventory_SwapAgeEquipment();
@ -406,7 +409,7 @@ void Play_Init(GameState* thisx) {
TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH);
TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255));
TransitionFade_Start(&this->transitionFadeFlash);
VisMono_Init(&sPlayVisMono);
VisMono_Init(&gPlayVisMono);
gVisMonoColor.a = 0;
CutsceneFlags_UnsetAll(this);
@ -518,18 +521,18 @@ void Play_Update(PlayState* this) {
if (gTransitionTileState != TRANS_TILE_OFF) {
switch (gTransitionTileState) {
case TRANS_TILE_PROCESS:
if (TransitionTile_Init(&sTransitionTile, 10, 7) == NULL) {
if (TransitionTile_Init(&gTransitionTile, 10, 7) == NULL) {
PRINTF("fbdemo_init呼出し失敗\n"); // "fbdemo_init call failed!"
gTransitionTileState = TRANS_TILE_OFF;
} else {
sTransitionTile.zBuffer = (u16*)gZBuffer;
gTransitionTile.zBuffer = (u16*)gZBuffer;
gTransitionTileState = TRANS_TILE_READY;
R_UPDATE_RATE = 1;
}
break;
case TRANS_TILE_READY:
TransitionTile_Update(&sTransitionTile);
TransitionTile_Update(&gTransitionTile);
break;
default:
@ -684,7 +687,7 @@ void Play_Update(PlayState* this) {
this->transitionMode = TRANS_MODE_OFF;
if (gTransitionTileState == TRANS_TILE_READY) {
TransitionTile_Destroy(&sTransitionTile);
TransitionTile_Destroy(&gTransitionTile);
gTransitionTileState = TRANS_TILE_OFF;
R_UPDATE_RATE = 3;
}
@ -1132,8 +1135,8 @@ void Play_Draw(PlayState* this) {
TransitionFade_Draw(&this->transitionFadeFlash, &gfxP);
if (gVisMonoColor.a > 0) {
sPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba;
VisMono_Draw(&sPlayVisMono, &gfxP);
gPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba;
VisMono_Draw(&gPlayVisMono, &gfxP);
}
gSPEndDisplayList(gfxP++);
@ -1144,7 +1147,7 @@ void Play_Draw(PlayState* this) {
if (gTransitionTileState == TRANS_TILE_READY) {
Gfx* sp88 = POLY_OPA_DISP;
TransitionTile_Draw(&sTransitionTile, &sp88);
TransitionTile_Draw(&gTransitionTile, &sp88);
POLY_OPA_DISP = sp88;
goto Play_Draw_DrawOverlayElements;
}