1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Fix misc 15 (#1298)

* Use `SCENE_` enum more

* Decimal for pos in `D_8011F9B8`

* `__osEventStateTab`: length `OS_NUM_EVENTS + 1` -> `OS_NUM_EVENTS`

* thone -> throne

* `s` on local data

* minor sfxId cleanup

* Run formatter

* Fixup 0x19 + 1 = 0x1A, not 0x20 lol

* Tlut -> TLUT

* DemoKankyo params usage cleanup

* Some proofreading (up to z_actor.c)

* Revert 0 -> sfxId, add todo comment (sfxId=0 is weird apparently)

* `sZdWaterBox` -> `sZorasDomainWaterBox`

* `msgMode == MSGMODE_`, not `GAMEMODE_` (my bad Sadge)
This commit is contained in:
Dragorn421 2022-06-24 16:45:05 -07:00 committed by GitHub
parent fe7afb9b07
commit 397e481f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 60 additions and 54 deletions

View file

@ -23,8 +23,7 @@ void GameState_FaultPrint(void) {
}
void GameState_SetFBFilter(Gfx** gfx) {
Gfx* gfxP;
gfxP = *gfx;
Gfx* gfxP = *gfx;
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
D_801664F0.type = R_FB_FILTER_TYPE;

View file

@ -164,11 +164,9 @@ s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, s8* out
u16 JpegDecoder_ReadBits(u8 len) {
u8 byteCount;
u8 data;
s32 ret;
s32 ret = 0;
u32 temp;
ret = 0; // this is required for some reason
for (byteCount = sJpegBitStreamBitIdx >> 3; byteCount > 0; byteCount--) {
data = sJpegBitStreamPtr[sJpegBitStreamByteIdx++];
if (sJpegBitStreamDontSkip) {
@ -184,7 +182,7 @@ u16 JpegDecoder_ReadBits(u8 len) {
sJpegBitStreamBitIdx -= 8;
}
ret = (sJpegBitStreamCurWord << (sJpegBitStreamBitIdx));
ret = sJpegBitStreamCurWord << sJpegBitStreamBitIdx;
temp = ret;
ret = temp >> -len;
sJpegBitStreamBitIdx += len;

View file

@ -64,7 +64,7 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0;
temp = ((f64)*sSpeedMeterTimeEntryPtr->time / gIrqMgrRetraceTime) * 64.0;
sSpeedMeterTimeEntryPtr->x = temp + baseX;
sSpeedMeterTimeEntryPtr++;
}

View file

@ -427,14 +427,14 @@ f32 Math3D_Dist2D(f32 x0, f32 y0, f32 x1, f32 y1) {
}
/**
* Returns the magntiude (length) squared of `vec`
* Returns the magnitude (length) squared of `vec`
*/
f32 Math3D_Vec3fMagnitudeSq(Vec3f* vec) {
return SQ(vec->x) + SQ(vec->y) + SQ(vec->z);
}
/**
* Returns the magnitude(length) of `vec`
* Returns the magnitude (length) of `vec`
*/
f32 Math3D_Vec3fMagnitude(Vec3f* vec) {
return sqrt(Math3D_Vec3fMagnitudeSq(vec));

View file

@ -1507,7 +1507,6 @@ u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play) {
s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId) {
Player* player = GET_PLAYER(play);
// This is convoluted but it seems like it must be a single if statement to match
if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) ||
(!actor->isTargeted &&
((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) ||
@ -2182,10 +2181,10 @@ void Actor_Draw(PlayState* play, Actor* actor) {
Lights_Draw(lights, play->state.gfxCtx);
if (actor->flags & ACTOR_FLAG_12) {
Matrix_SetTranslateRotateYXZ(
actor->world.pos.x + play->mainCamera.skyboxOffset.x,
actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x,
actor->world.pos.y +
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
} else {
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
actor->world.pos.z, &actor->shape.rot);
@ -4214,14 +4213,14 @@ void Flags_SetEventChkInf(s32 flag) {
}
/**
* Tests if "inf_table flag is set.
* Tests if inf_table flag is set.
*/
s32 Flags_GetInfTable(s32 flag) {
return GET_INFTABLE(flag);
}
/**
* Sets "inf_table" flag.
* Sets inf_table flag.
*/
void Flags_SetInfTable(s32 flag) {
SET_INFTABLE(flag);

View file

@ -4171,17 +4171,17 @@ u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32
/**
* Zora's Domain WaterBox in King Zora's Room
*/
WaterBox zdWaterBox = { -348, 877, -1746, 553, 780, 0x2104 };
WaterBox sZorasDomainWaterBox = { -348, 877, -1746, 553, 780, 0x2104 };
/**
* WaterBox's effective bounding box
*/
f32 zdWaterBoxMinX = -348.0f;
f32 zdWaterBoxMinY = 777.0f;
f32 zdWaterBoxMinZ = -1746.0f;
f32 zdWaterBoxMaxX = 205.0f;
f32 zdWaterBoxMaxY = 977.0f;
f32 zdWaterBoxMaxZ = -967.0f;
f32 sZorasDomainWaterBoxMinX = -348.0f;
f32 sZorasDomainWaterBoxMinY = 777.0f;
f32 sZorasDomainWaterBoxMinZ = -1746.0f;
f32 sZorasDomainWaterBoxMaxX = 205.0f;
f32 sZorasDomainWaterBoxMaxY = 977.0f;
f32 sZorasDomainWaterBoxMaxZ = -967.0f;
/**
* Public. Get the water surface at point (`x`, `ySurface`, `z`). `ySurface` doubles as position y input
@ -4191,10 +4191,10 @@ f32 zdWaterBoxMaxZ = -967.0f;
s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
if (play->sceneNum == SCENE_SPOT07) {
if (zdWaterBoxMinX < x && x < zdWaterBoxMaxX && zdWaterBoxMinY < *ySurface && *ySurface < zdWaterBoxMaxY &&
zdWaterBoxMinZ < z && z < zdWaterBoxMaxZ) {
*outWaterBox = &zdWaterBox;
*ySurface = zdWaterBox.ySurface;
if (sZorasDomainWaterBoxMinX < x && x < sZorasDomainWaterBoxMaxX && sZorasDomainWaterBoxMinY < *ySurface &&
*ySurface < sZorasDomainWaterBoxMaxY && sZorasDomainWaterBoxMinZ < z && z < sZorasDomainWaterBoxMaxZ) {
*outWaterBox = &sZorasDomainWaterBox;
*ySurface = sZorasDomainWaterBox.ySurface;
return true;
}
}

View file

@ -6534,7 +6534,7 @@ s32 Camera_Special5(Camera* camera) {
temp_f0_2 = Rand_ZeroOne();
sp74.yaw =
(s16)(playerPosRot->rot.y - 0x7FFF) + (s16)(spA4 < 0 ? -(s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f))
: (s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f)));
: (s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f)));
sp74.pitch = roData->pitch;
Camera_Vec3fVecSphGeoAdd(eyeNext, &spA8.pos, &sp74);
*eye = *eyeNext;

View file

@ -172,17 +172,21 @@ void func_8006D684(PlayState* play, Player* player) {
}
} else {
static struct_8011F9B8 D_8011F9B8[] = {
{ 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 },
{ 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 },
{ 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 },
{ 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
{ SCENE_SPOT12, 0xFFF0, { 3600, 1413, 360 }, 0x8001, 8 },
{ SCENE_SPOT20, 0xFFF0, { -250, 1, -1580 }, 0x4000, 6 },
{ SCENE_SPOT20, 0xFFF1, { 0, 0, 0 }, 0x0000, 5 },
{ SCENE_SPOT20, 0xFFF5, { 0, 0, 0 }, 0x0000, 7 },
{ SCENE_SPOT00, 0xFFF3, { -2961, 313, 7700 }, 0x0000, 7 },
{ SCENE_SPOT00, 0xFFF4, { -1900, 313, 7015 }, 0x0000, 7 },
{ SCENE_SPOT00, 0xFFF5, { -4043, 313, 6933 }, 0x0000, 7 },
{ SCENE_SPOT00, 0xFFF6, { -4043, 313, 6933 }, 0x0000, 7 },
};
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
if ((play->sceneNum == D_8011F9B8[i].scene) &&
(((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
if (D_8011F9B8[i].type == 7) {
if ((play->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
if ((play->sceneNum == SCENE_SPOT20) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
D_8011F9B8[i].pos.x = player->actor.world.pos.x;
D_8011F9B8[i].pos.y = player->actor.world.pos.y;
D_8011F9B8[i].pos.z = player->actor.world.pos.z;

View file

@ -919,7 +919,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
}
if ((pauseCtx->state == 0) && (gameOverCtx->state == GAMEOVER_INACTIVE)) {
if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == GAMEMODE_NORMAL)) ||
if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == MSGMODE_NONE)) ||
(((void)0, gSaveContext.gameMode) == GAMEMODE_END_CREDITS)) {
if ((envCtx->changeSkyboxTimer == 0) && !FrameAdvance_IsEnabled(play) &&
(play->transitionMode == TRANS_MODE_OFF || ((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL)) {

View file

@ -3172,6 +3172,7 @@ void Message_Update(PlayState* play) {
R_TEXTBOX_TEXHEIGHT = 512;
} else {
Message_GrowTextbox(msgCtx);
// TODO: this may be NA_SE_PL_WALK_GROUND - SFX_FLAG, or not, investigate sfxId=0
Audio_PlaySoundIfNotInCutscene(0);
msgCtx->stateTimer = 0;
msgCtx->msgMode = MSGMODE_TEXT_BOX_GROWING;