mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 15:04:31 +00:00
Fix misc 17 (#1392)
* Some cleanup on bgcheck waterbox y funcs
* Fix some typo/spelling
* EnFz_ApplyDamage match fixup
* Turn another sus construction into a switch
* Fixup comment on restoring MS as adult
* "doesnt, isnt" -> "doesn't, isn't"
* Hunt down whitespace at end of lines
* Format (clang-format does not like figs bug comment on bongo cutscene unskip sadge)
* Viewport z scale/translation: `0x1FF` -> `G_MAXZ/2` (see proman "9.7 Mixing CPU and SP Addresses", "12.7.6 Depth Source")
* static symbols: g -> s prefix
* Link young/old -> child/adult
* Fixups
* Get rid of signed vs unsigned comparison warning by changing room temps to s32
* waterbox search funcs consistency
* Revert "waterbox search funcs consistency"
This reverts commit 8f386e038f
.
* `curWaterBox` -> `waterBox`
This commit is contained in:
parent
c3dc299448
commit
22b78f169f
27 changed files with 118 additions and 114 deletions
|
@ -16,7 +16,7 @@
|
|||
* A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/
|
||||
* The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked
|
||||
* version of the non-kanji section that includes extra English and Hylian glyphs.
|
||||
*
|
||||
*
|
||||
* @note This function assumes that its argument is a valid Shift-JIS codepoint;
|
||||
* there is no range protection at all.
|
||||
*
|
||||
|
@ -26,15 +26,15 @@
|
|||
* @remark Original name: "LeoGetKadr"
|
||||
*/
|
||||
LEAF(Kanji_OffsetFromShiftJIS)
|
||||
// Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
|
||||
// Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
|
||||
// so convert index directly.
|
||||
li $at, 0x8800
|
||||
slt $at, $a0, $at
|
||||
bnez $at, .nonkanji
|
||||
// 0xBC is number of glyphs in one block in the `kanji` file:
|
||||
// 0x100 possible codepoints with the same byte1
|
||||
// - 0x40 unused at beginning
|
||||
// - 1 unused at 0x7F
|
||||
// - 0x40 unused at beginning
|
||||
// - 1 unused at 0x7F
|
||||
// - 3 unused at 0xFD, 0xFE, 0xFF
|
||||
li $a2, 0xBC
|
||||
// Get byte1 and adjust so starts at 0
|
||||
|
@ -99,7 +99,7 @@ END(Kanji_OffsetFromShiftJIS)
|
|||
* if (byte2 >= 0x40) {
|
||||
* byte2--;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* if (sjis >= 0x8800) {
|
||||
* byte1 -= 0x88;
|
||||
* return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE;
|
||||
|
@ -134,7 +134,7 @@ DATA(sNonKanjiIndices)
|
|||
/* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092
|
||||
/* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB
|
||||
/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4
|
||||
/* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0
|
||||
/* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0
|
||||
|
|
|
@ -4239,22 +4239,21 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z
|
|||
s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
|
||||
WaterBox** outWaterBox) {
|
||||
CollisionHeader* colHeader = colCtx->colHeader;
|
||||
u32 room;
|
||||
WaterBox* curWaterBox;
|
||||
s32 room;
|
||||
WaterBox* waterBox;
|
||||
|
||||
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
|
||||
curWaterBox++) {
|
||||
room = WATERBOX_ROOM(curWaterBox->properties);
|
||||
if (room == (u32)play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(curWaterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) {
|
||||
if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) {
|
||||
*outWaterBox = curWaterBox;
|
||||
*ySurface = curWaterBox->ySurface;
|
||||
for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(waterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (waterBox->xMin < x && x < waterBox->xMin + waterBox->xLength) {
|
||||
if (waterBox->zMin < z && z < waterBox->zMin + waterBox->zLength) {
|
||||
*outWaterBox = waterBox;
|
||||
*ySurface = waterBox->ySurface;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4287,21 +4286,18 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos,
|
|||
waterBox = &colHeader->waterBoxes[i];
|
||||
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if (!(room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL)) {
|
||||
continue;
|
||||
}
|
||||
if (waterBox->properties & WATERBOX_FLAG_19) {
|
||||
continue;
|
||||
}
|
||||
if (!(waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength)) {
|
||||
continue;
|
||||
}
|
||||
if (!(waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength)) {
|
||||
continue;
|
||||
}
|
||||
if (pos->y - surfaceChkDist < waterBox->ySurface && waterBox->ySurface < pos->y + surfaceChkDist) {
|
||||
*outWaterBox = waterBox;
|
||||
return i;
|
||||
if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(waterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength) {
|
||||
if (waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength) {
|
||||
if (pos->y - surfaceChkDist < waterBox->ySurface &&
|
||||
waterBox->ySurface < pos->y + surfaceChkDist) {
|
||||
*outWaterBox = waterBox;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4349,22 +4345,21 @@ u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox) {
|
|||
*/
|
||||
s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) {
|
||||
CollisionHeader* colHeader = colCtx->colHeader;
|
||||
u32 room;
|
||||
WaterBox* curWaterBox;
|
||||
s32 room;
|
||||
WaterBox* waterBox;
|
||||
|
||||
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
|
||||
curWaterBox++) {
|
||||
room = WATERBOX_ROOM(curWaterBox->properties);
|
||||
if ((room == (u32)play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
|
||||
if (curWaterBox->properties & WATERBOX_FLAG_19) {
|
||||
if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) {
|
||||
if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) {
|
||||
*outWaterBox = curWaterBox;
|
||||
*ySurface = curWaterBox->ySurface;
|
||||
for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if ((room == play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
|
||||
if (waterBox->properties & WATERBOX_FLAG_19) {
|
||||
if (waterBox->xMin < x && x < (waterBox->xMin + waterBox->xLength)) {
|
||||
if (waterBox->zMin < z && z < (waterBox->zMin + waterBox->zLength)) {
|
||||
*outWaterBox = waterBox;
|
||||
*ySurface = waterBox->ySurface;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, Vec3f* vec) {
|
|||
* a light to it. Then apply color and positional/directional info for each light
|
||||
* based on the parameters supplied by the node.
|
||||
*
|
||||
* Note: Lights in a given list can only be binded to however many free slots are
|
||||
* Note: Lights in a given list can only be bound to however many free slots are
|
||||
* available in the Lights group. This is at most 7 slots for a new group, but could be less.
|
||||
*/
|
||||
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec) {
|
||||
|
@ -217,7 +217,7 @@ void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear,
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocate a new Lights group and initilize the ambient color with that provided by LightContext
|
||||
* Allocate a new Lights group and initialize the ambient color with that provided by LightContext
|
||||
*/
|
||||
Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) {
|
||||
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
|
||||
|
|
|
@ -312,7 +312,7 @@ static s16 sDungeonEntrances[] = {
|
|||
* - If health is less than 3 hearts, give 3 hearts
|
||||
* - If either scarecrow song is set, copy them from save context to the proper location
|
||||
* - Handle a case where the player saved and quit after zelda cutscene but didnt get the song
|
||||
* - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?)
|
||||
* - Give and equip master sword if player is adult and doesn't have master sword
|
||||
* - Revert any trade items that spoil
|
||||
*/
|
||||
void Sram_OpenSave(SramContext* sramCtx) {
|
||||
|
|
|
@ -12,11 +12,11 @@ void View_ViewportToVp(Vp* dest, Viewport* src) {
|
|||
|
||||
dest->vp.vscale[0] = width * 2;
|
||||
dest->vp.vscale[1] = height * 2;
|
||||
dest->vp.vscale[2] = 0x01FF;
|
||||
dest->vp.vscale[2] = G_MAXZ / 2;
|
||||
dest->vp.vscale[3] = 0;
|
||||
dest->vp.vtrans[0] = ((src->leftX * 2) + width) * 2;
|
||||
dest->vp.vtrans[1] = ((src->topY * 2) + height) * 2;
|
||||
dest->vp.vtrans[2] = 0x01FF;
|
||||
dest->vp.vtrans[2] = G_MAXZ / 2;
|
||||
dest->vp.vtrans[3] = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue