1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 23:36:22 +00:00

Some cleanup on bgcheck waterbox y funcs

This commit is contained in:
Dragorn421 2022-10-05 12:39:55 +02:00
parent 1cb00350d9
commit 403221a02b
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118

View file

@ -4249,7 +4249,7 @@ s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f3
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 (room == 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) {
@ -4287,21 +4287,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;
}
}
}
}
}
}
@ -4359,7 +4356,7 @@ s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32*
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 ((room == 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)) {