This commit is contained in:
Kenix3 2024-04-10 21:29:43 -04:00 committed by GitHub
commit 52211f9eeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 547 additions and 76 deletions

View File

@ -135,10 +135,14 @@ typedef struct {
/* 0x0C */ ColliderJntSphElementInit* elements;
} ColliderJntSphInitToActor; // size = 0x10
#include "libultraship/color.h"
typedef struct {
/* 0x00 */ Collider base;
/* 0x18 */ ColliderInfo info;
/* 0x40 */ Cylinder16 dim;
int32_t hideColliderInCollisionViewer;
int32_t useColliderColor;
Color_RGBA8 color;
} ColliderCylinder; // size = 0x4C
typedef struct {

View File

@ -57,42 +57,75 @@ void ColViewerWindow::DrawElement() {
ImGui::End();
return;
}
UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled");
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames, COLVIEW_DISABLED);
if (UIWidgets::EnhancementCheckbox("Collision Goggles", "gCollisionGoggles")) {
if (CVarGetInteger("gCollisionGoggles", 0)) {
CVarSetInteger("gColViewerEnabled", 1);
CVarSetInteger("gColViewerDecal", 0);
CVarSetInteger("gColViewerShaded", 1);
CVarSetInteger("gColViewerScene", COLVIEW_SOLID);
CVarSetInteger("gColViewerBgActors", COLVIEW_SOLID);
CVarSetInteger("gColViewerColCheck", COLVIEW_SOLID);
CVarSetInteger("gColViewerWaterbox", COLVIEW_TRANSPARENT);
CVarSetInteger("gColViewerColorACR", 5);
CVarSetInteger("gColViewerColorACG", 130);
CVarSetInteger("gColViewerColorACB", 100);
} else {
CVarSetInteger("gColViewerEnabled", 0);
CVarSetInteger("gColViewerDecal", 1);
}
}
UIWidgets::Tooltip(
"Disables rendering of the scene and actors, and instead only shows the collision of everything.");
UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal");
UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
"with the scene geometry, but can cause other artifacts.");
UIWidgets::EnhancementCheckbox("Shaded", "gColViewerShaded");
UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display.");
if (!CVarGetInteger("gCollisionGoggles", 0)) {
UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled");
// This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered()
const std::string colorHelpText = "View and change the colors used for collision display.";
if (ImGui::TreeNode("Colors")) {
UIWidgets::InsertHelpHoverText(colorHelpText);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames,
COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames,
COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames,
COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames,
COLVIEW_DISABLED);
UIWidgets::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255),
false);
UIWidgets::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false);
UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface",
specialSurface_col, ImVec4(192, 255, 192, 255), false);
UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable",
interactable_col, ImVec4(192, 0, 192, 255), false);
UIWidgets::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false);
UIWidgets::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false);
UIWidgets::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false);
UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal", false,
"", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::InsertHelpHoverText(
"Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
"with the scene geometry, but can cause other artifacts.");
UIWidgets::EnhancementCheckbox("Shaded", "gColViewerShaded", false, "", UIWidgets::CheckboxGraphics::Cross,
true);
UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display.");
ImGui::TreePop();
} else {
UIWidgets::InsertHelpHoverText(colorHelpText);
// This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered()
const std::string colorHelpText = "View and change the colors used for collision display.";
if (ImGui::TreeNode("Colors")) {
UIWidgets::InsertHelpHoverText(colorHelpText);
UIWidgets::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255),
false);
UIWidgets::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255),
false);
UIWidgets::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255),
false);
UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface",
specialSurface_col, ImVec4(192, 255, 192, 255), false);
UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable",
interactable_col, ImVec4(192, 0, 192, 255), false);
UIWidgets::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false);
UIWidgets::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(5, 130, 100, 255), false);
UIWidgets::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255),
false);
ImGui::TreePop();
} else {
UIWidgets::InsertHelpHoverText(colorHelpText);
}
}
ImGui::End();
@ -308,7 +341,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
alpha = 0xFF;
}
if (CVarGetInteger("gColViewerDecal", 0) != 0) {
if (CVarGetInteger("gColViewerDecal", 1) != 0) {
rm |= ZMODE_DEC;
} else if (setting == ColRenderSetting::Transparent) {
rm |= ZMODE_XLU;
@ -520,20 +553,27 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
case COLSHAPE_CYLINDER: {
ColliderCylinder* cyl = (ColliderCylinder*)col;
Mtx m;
MtxF mt;
SkinMatrix_SetTranslate(&mt, cyl->dim.pos.x, cyl->dim.pos.y + cyl->dim.yShift, cyl->dim.pos.z);
MtxF ms;
int32_t radius = cyl->dim.radius == 0 ? 1 : cyl->dim.radius;
SkinMatrix_SetScale(&ms, radius / 128.0f, cyl->dim.height / 128.0f, radius / 128.0f);
MtxF dest;
SkinMatrix_MtxFMtxFMult(&mt, &ms, &dest);
guMtxF2L(&dest, &m);
mtxDl.push_back(m);
if (!cyl->hideColliderInCollisionViewer) {
Mtx m;
MtxF mt;
SkinMatrix_SetTranslate(&mt, cyl->dim.pos.x, cyl->dim.pos.y + cyl->dim.yShift, cyl->dim.pos.z);
MtxF ms;
int32_t radius = cyl->dim.radius == 0 ? 1 : cyl->dim.radius;
SkinMatrix_SetScale(&ms, radius / 128.0f, cyl->dim.height / 128.0f, radius / 128.0f);
MtxF dest;
SkinMatrix_MtxFMtxFMult(&mt, &ms, &dest);
guMtxF2L(&dest, &m);
mtxDl.push_back(m);
dl.push_back(gsSPMatrix(&mtxDl.back(), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH));
dl.push_back(gsSPDisplayList(cylinderGfx.data()));
dl.push_back(gsSPPopMatrix(G_MTX_MODELVIEW));
if (cyl->useColliderColor) {
dl.push_back(gsDPSetPrimColor(0, 0, cyl->color.r, cyl->color.g,
cyl->color.b, 255));
}
dl.push_back(gsSPMatrix(&mtxDl.back(), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH));
dl.push_back(gsSPDisplayList(cylinderGfx.data()));
dl.push_back(gsSPPopMatrix(G_MTX_MODELVIEW));
}
} break;
case COLSHAPE_TRIS: {
ColliderTris* tris = (ColliderTris*)col;
@ -582,8 +622,8 @@ void DrawColCheckCollision() {
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorOCR", 255), CVarGetInteger("gColViewerColorOCG", 255),
CVarGetInteger("gColViewerColorOCB", 255), 255));
DrawColCheckList(dl, col.colOC, col.colOCCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorACR", 0), CVarGetInteger("gColViewerColorACG", 0),
CVarGetInteger("gColViewerColorACB", 255), 255));
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorACR", 5), CVarGetInteger("gColViewerColorACG", 130),
CVarGetInteger("gColViewerColorACB", 100), 255));
DrawColCheckList(dl, col.colAC, col.colACCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorATR", 255), CVarGetInteger("gColViewerColorATG", 0),
CVarGetInteger("gColViewerColorATB", 0), 255));

View File

@ -2854,7 +2854,19 @@ void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invis
for (i = 0; i < numInvisibleActors; i++) {
// "Magic lens invisible Actor display"
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないc表示", i);
Actor_Draw(play, *(invisibleActor++));
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Actor_Draw(play, *(invisibleActor++));
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Actor_Draw(play, *(invisibleActor++));
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
// "Magic lens invisible Actor display END"
@ -2974,7 +2986,19 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
invisibleActorCounter++;
} else {
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) {
Actor_Draw(play, actor);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Actor_Draw(play, actor);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Actor_Draw(play, actor);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
actor->isDrawn = true;
}
}
@ -2986,11 +3010,35 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
}
if ((HREG(64) != 1) || (HREG(73) != 0)) {
Effect_DrawAll(play->state.gfxCtx);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Effect_DrawAll(play->state.gfxCtx);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Effect_DrawAll(play->state.gfxCtx);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if ((HREG(64) != 1) || (HREG(74) != 0)) {
EffectSs_DrawAll(play);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
EffectSs_DrawAll(play);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
EffectSs_DrawAll(play);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if ((HREG(64) != 1) || (HREG(72) != 0)) {
@ -3005,7 +3053,20 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
Actor_DrawFaroresWindPointer(play);
if (IREG(32) == 0) {
Lights_DrawGlow(play);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Lights_DrawGlow(play);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Lights_DrawGlow(play);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if ((HREG(64) != 1) || (HREG(75) != 0)) {

View File

@ -1610,19 +1610,56 @@ void Play_Draw(PlayState* play) {
(play->skyboxId == SKYBOX_CUTSCENE_MAP)) {
Environment_UpdateSkybox(play, play->skyboxId, &play->envCtx, &play->skyboxCtx);
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId,
play->envCtx.skyboxBlend, play->view.eye.x, play->view.eye.y,
play->view.eye.z);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, play->envCtx.skyboxBlend,
play->view.eye.x, play->view.eye.y, play->view.eye.z);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, play->envCtx.skyboxBlend,
play->view.eye.x, play->view.eye.y, play->view.eye.z);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
} else if (play->skyboxCtx.unk_140 == 0) {
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0,
play->view.eye.x, play->view.eye.y, play->view.eye.z);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, play->view.eye.x,
play->view.eye.y, play->view.eye.z);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, play->view.eye.x,
play->view.eye.y, play->view.eye.z);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
}
}
if ((HREG(80) != 10) || (HREG(90) & 2)) {
if (!play->envCtx.sunMoonDisabled) {
Environment_DrawSunAndMoon(play);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawSunAndMoon(play);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawSunAndMoon(play);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
}
@ -1632,7 +1669,19 @@ void Play_Draw(PlayState* play) {
if ((HREG(80) != 10) || (HREG(90) & 4)) {
Environment_UpdateLightningStrike(play);
Environment_DrawLightning(play, 0);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawLightning(play, 0);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawLightning(play, 0);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if ((HREG(80) != 10) || (HREG(90) & 8)) {
@ -1648,9 +1697,24 @@ void Play_Draw(PlayState* play) {
} else {
sp80 = HREG(84);
}
Scene_Draw(play);
Room_Draw(play, &play->roomCtx.curRoom, sp80 & 3);
Room_Draw(play, &play->roomCtx.prevRoom, sp80 & 3);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Scene_Draw(play);
Room_Draw(play, &play->roomCtx.curRoom, sp80 & 3);
Room_Draw(play, &play->roomCtx.prevRoom, sp80 & 3);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Scene_Draw(play);
Room_Draw(play, &play->roomCtx.curRoom, sp80 & 3);
Room_Draw(play, &play->roomCtx.prevRoom, sp80 & 3);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
}
@ -1660,14 +1724,38 @@ void Play_Draw(PlayState* play) {
Vec3f sp74;
Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(play));
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0,
play->view.eye.x + sp74.x, play->view.eye.y + sp74.y,
play->view.eye.z + sp74.z);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, play->view.eye.x + sp74.x,
play->view.eye.y + sp74.y, play->view.eye.z + sp74.z);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
SkyboxDraw_Draw(&play->skyboxCtx, gfxCtx, play->skyboxId, 0, play->view.eye.x + sp74.x,
play->view.eye.y + sp74.y, play->view.eye.z + sp74.z);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
}
if (play->envCtx.unk_EE[1] != 0) {
Environment_DrawRain(play, &play->view, gfxCtx);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawRain(play, &play->view, gfxCtx);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawRain(play, &play->view, gfxCtx);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if ((HREG(80) != 10) || (HREG(84) != 0)) {
@ -1687,23 +1775,75 @@ void Play_Draw(PlayState* play) {
sp21C.x = play->view.eye.x + play->envCtx.sunPos.x;
sp21C.y = play->view.eye.y + play->envCtx.sunPos.y;
sp21C.z = play->view.eye.z + play->envCtx.sunPos.z;
Environment_DrawSunLensFlare(play, &play->envCtx, &play->view, gfxCtx, sp21C, 0);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawSunLensFlare(play, &play->envCtx, &play->view, gfxCtx, sp21C, 0);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawSunLensFlare(play, &play->envCtx, &play->view, gfxCtx, sp21C, 0);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawCustomLensFlare(play);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawCustomLensFlare(play);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
Environment_DrawCustomLensFlare(play);
}
if ((HREG(80) != 10) || (HREG(87) != 0)) {
if (MREG(64) != 0) {
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
switch (play->envCtx.fillScreen) {
case 1:
Environment_FillScreen(
gfxCtx, play->envCtx.screenFillColor[0], play->envCtx.screenFillColor[1],
play->envCtx.screenFillColor[2], play->envCtx.screenFillColor[3],
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_FillScreen(gfxCtx, play->envCtx.screenFillColor[0],
play->envCtx.screenFillColor[1], play->envCtx.screenFillColor[2],
play->envCtx.screenFillColor[3],
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_FillScreen(gfxCtx, play->envCtx.screenFillColor[0],
play->envCtx.screenFillColor[1], play->envCtx.screenFillColor[2],
play->envCtx.screenFillColor[3],
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
break;
default:
break;
@ -1712,7 +1852,19 @@ void Play_Draw(PlayState* play) {
if ((HREG(80) != 10) || (HREG(88) != 0)) {
if (play->envCtx.sandstormState != SANDSTORM_OFF) {
Environment_DrawSandstorm(play, play->envCtx.sandstormState);
if (!CVarGetInteger("gCollisionGoggles", 0)) {
Environment_DrawSandstorm(play, play->envCtx.sandstormState);
} else {
Gfx* workDl = WORK_DISP;
Gfx* opaDl = POLY_OPA_DISP;
Gfx* xluDl = POLY_XLU_DISP;
Gfx* ovlDl = OVERLAY_DISP;
Environment_DrawSandstorm(play, play->envCtx.sandstormState);
WORK_DISP = workDl;
POLY_OPA_DISP = opaDl;
POLY_XLU_DISP = xluDl;
OVERLAY_DISP = ovlDl;
}
}
}

View File

@ -56,6 +56,26 @@ static ColliderCylinderInit sCylinderInit = {
{ 50, 10, 0, { 0 } },
};
static ColliderCylinderInit sUselessCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000048, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_NONE,
},
{ 25, 10, 0, { 0 } },
};
// array of entrance table entries to grotto destinations
static s16 sGrottoEntrances[] = {
ENTR_FAIRYS_FOUNTAIN_0, ENTR_GROTTOS_0, ENTR_GROTTOS_1, ENTR_GROTTOS_2, ENTR_GROTTOS_3,
@ -86,6 +106,17 @@ void DoorAna_Init(Actor* thisx, PlayState* play) {
} else {
DoorAna_SetupAction(this, DoorAna_WaitOpen);
}
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->useUselessCylinder = 1;
} else {
this->useUselessCylinder = 0;
}
if (this->useUselessCylinder) {
Collider_InitCylinder(play, &this->uselessCollider);
Collider_SetCylinder(play, &this->uselessCollider, &this->actor, &sUselessCylinderInit);
}
this->actor.targetMode = 0;
}
@ -96,6 +127,10 @@ void DoorAna_Destroy(Actor* thisx, PlayState* play) {
if ((this->actor.params & 0x200) != 0) {
Collider_DestroyCylinder(play, &this->collider);
}
if (this->useUselessCylinder) {
Collider_DestroyCylinder(play, &this->uselessCollider);
}
}
// update routine for grottos that are currently "hidden"/unopened
@ -185,6 +220,10 @@ void DoorAna_Update(Actor* thisx, PlayState* play) {
if (!CVarGetInteger("gDisableGrottoRotation", 0)) {
this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000;
}
if (this->useUselessCylinder) {
Collider_UpdateCylinder(&this->actor, &this->uselessCollider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->uselessCollider.base);
}
}
void DoorAna_Draw(Actor* thisx, PlayState* play) {

View File

@ -11,6 +11,8 @@ typedef void (*DoorAnaActionFunc)(struct DoorAna*, PlayState*);
typedef struct DoorAna {
/* 0x0000 */ Actor actor;
/* 0x014C */ ColliderCylinder collider;
s32 useUselessCylinder;
ColliderCylinder uselessCollider;
/* 0x0198 */ DoorAnaActionFunc actionFunc;
} DoorAna; // size = 0x019C

View File

@ -55,6 +55,26 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 4000, ICHAIN_STOP),
};
static ColliderCylinderInit sUselessCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000048, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_NONE,
},
{ 60, 20, 0, { 0 } },
};
s16 sWarpTimerTarget;
void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) {
@ -85,6 +105,16 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) {
osSyncPrintf("\nBOSSWARP arg_data=[%d]", this->actor.params);
DoorWarp1_ChooseInitialAction(this, play2);
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->useUselessCylinder = 1;
} else {
this->useUselessCylinder = 0;
}
if (this->useUselessCylinder) {
Collider_InitCylinder(play, &this->uselessCollider);
Collider_SetCylinder(play, &this->uselessCollider, &this->actor, &sUselessCylinderInit);
}
}
void DoorWarp1_Destroy(Actor* thisx, PlayState* play) {
@ -108,6 +138,10 @@ void DoorWarp1_Destroy(Actor* thisx, PlayState* play) {
default:
break;
}
if (this->useUselessCylinder) {
Collider_DestroyCylinder(play, &this->uselessCollider);
}
}
void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) {
@ -1043,6 +1077,11 @@ void DoorWarp1_Update(Actor* thisx, PlayState* play) {
if (this->actor.params != WARP_PURPLE_CRYSTAL) {
Actor_SetScale(&this->actor, this->scale / 100.0f);
}
if (this->useUselessCylinder) {
Collider_UpdateCylinder(&this->actor, &this->uselessCollider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->uselessCollider.base);
}
}
void DoorWarp1_DrawBlueCrystal(DoorWarp1* this, PlayState* play) {

View File

@ -58,6 +58,8 @@ typedef struct DoorWarp1 {
/* 0x01D8 */ LightNode* lowerLight;
/* 0x01DC */ LightInfo lowerLightInfo;
/* 0x01EC */ s32 rutoWarpState; // for state communication with En_Ru1 using DoorWarp1RutoState values
s32 useUselessCylinder;
ColliderCylinder uselessCollider;
} DoorWarp1; // size = 0x01F0
#endif

View File

@ -41,6 +41,26 @@ const ActorInit En_Ex_Ruppy_InitVars = {
NULL,
};
static ColliderCylinderInit sUselessCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000048, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_NONE,
},
{ 30, 30, 0, { 0 } },
};
void EnExRuppy_Init(Actor* thisx, PlayState* play) {
EnExRuppy* this = (EnExRuppy*)thisx;
EnDivingGame* divingGame;
@ -159,9 +179,24 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
this->actionFunc = EnExRuppy_GalleryTarget;
break;
}
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->useUselessCylinder = 1;
} else {
this->useUselessCylinder = 0;
}
if (this->useUselessCylinder) {
Collider_InitCylinder(play, &this->uselessCollider);
Collider_SetCylinder(play, &this->uselessCollider, &this->actor, &sUselessCylinderInit);
}
}
void EnExRuppy_Destroy(Actor* thisx, PlayState* play) {
EnExRuppy* this = (EnExRuppy*)thisx;
if (this->useUselessCylinder) {
Collider_DestroyCylinder(play, &this->uselessCollider);
}
}
void EnExRuppy_SpawnSparkles(EnExRuppy* this, PlayState* play, s16 numSparkles, s32 movementType) {
@ -372,6 +407,11 @@ void EnExRuppy_Update(Actor* thisx, PlayState* play) {
}
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1C);
if (this->useUselessCylinder) {
Collider_UpdateCylinder(&this->actor, &this->uselessCollider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->uselessCollider.base);
}
}
void EnExRuppy_Draw(Actor* thisx, PlayState* play) {

View File

@ -19,6 +19,8 @@ typedef struct EnExRuppy {
/* 0x015A */ s16 unk_15A;
/* 0x015C */ s16 galleryFlag;
/* 0x0160 */ f32 unk_160;
s32 useUselessCylinder;
ColliderCylinder uselessCollider;
} EnExRuppy; // size = 0x0164
#endif

View File

@ -440,7 +440,8 @@ void EnGSwitch_Update(Actor* thisx, PlayState* play) {
if (this->type == ENGSWITCH_TARGET_RUPEE) {
EnGSwitch_UpdateEffects(this, play);
}
if ((this->actionFunc != EnGSwitch_Kill) && (this->actionFunc != EnGSwitch_SilverRupeeIdle)) {
if ((this->actionFunc != EnGSwitch_Kill) &&
((this->actionFunc != EnGSwitch_SilverRupeeIdle) || CVarGetInteger("gCollisionGoggles", 0))) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}

View File

@ -216,6 +216,10 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) {
func_80ADA094(this, play);
} else if (this->unk_194 == 0) {
if (this->unk_195 == 0) {
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->collider.useColliderColor = 1;
this->collider.color = D_80ADD7E8[0];
}
this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER;
func_80AD9AA8(this, play);
} else {

View File

@ -36,6 +36,26 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
};
static ColliderCylinderInit sUselessCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000048, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_NONE,
},
{ 30, 40, 0, { 0 } },
};
void ItemBHeart_Init(Actor* thisx, PlayState* play) {
ItemBHeart* this = (ItemBHeart*)thisx;
@ -45,9 +65,24 @@ void ItemBHeart_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.8f);
}
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->useUselessCylinder = 1;
} else {
this->useUselessCylinder = 0;
}
if (this->useUselessCylinder) {
Collider_InitCylinder(play, &this->uselessCollider);
Collider_SetCylinder(play, &this->uselessCollider, &this->actor, &sUselessCylinderInit);
}
}
void ItemBHeart_Destroy(Actor* thisx, PlayState* play) {
ItemBHeart* this = (ItemBHeart*)thisx;
if (this->useUselessCylinder) {
Collider_DestroyCylinder(play, &this->uselessCollider);
}
}
void ItemBHeart_Update(Actor* thisx, PlayState* play) {
@ -66,6 +101,10 @@ void ItemBHeart_Update(Actor* thisx, PlayState* play) {
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 40.0f);
}
}
if (this->useUselessCylinder) {
Collider_UpdateCylinder(&this->actor, &this->uselessCollider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->uselessCollider.base);
}
}
void func_80B85264(ItemBHeart* this, PlayState* play) {

View File

@ -13,6 +13,8 @@ typedef struct ItemBHeart {
/* 0x015C */ char unk_15C[0x8];
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ char unk_166[0x6];
s32 useUselessCylinder;
ColliderCylinder uselessCollider;
} ItemBHeart; // size = 0x016C
#endif

View File

@ -36,6 +36,26 @@ const ActorInit Item_Etcetera_InitVars = {
NULL,
};
static ColliderCylinderInit sUselessCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK2,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000048, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_NONE,
},
{ 15, 50, 0, { 0 } },
};
static s16 sObjectIds[] = {
OBJECT_GI_BOTTLE, OBJECT_GI_BOTTLE_LETTER, OBJECT_GI_SHIELD_2, OBJECT_GI_ARROWCASE, OBJECT_GI_SCALE,
OBJECT_GI_SCALE, OBJECT_GI_KEY, OBJECT_GI_M_ARROW, OBJECT_GI_RUPY, OBJECT_GI_RUPY,
@ -106,9 +126,24 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) {
this->actor.world.pos.y += 15.0f;
break;
}
if (CVarGetInteger("gCollisionGoggles", 0)) {
this->useUselessCylinder = 1;
} else {
this->useUselessCylinder = 0;
}
if (this->useUselessCylinder) {
Collider_InitCylinder(play, &this->uselessCollider);
Collider_SetCylinder(play, &this->uselessCollider, &this->actor, &sUselessCylinderInit);
}
}
void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) {
ItemEtcetera* this = (ItemEtcetera*)thisx;
if (this->useUselessCylinder) {
Collider_DestroyCylinder(play, &this->uselessCollider);
}
}
void func_80B857D0(ItemEtcetera* this, PlayState* play) {
@ -221,6 +256,11 @@ void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play) {
void ItemEtcetera_Update(Actor* thisx, PlayState* play) {
ItemEtcetera* this = (ItemEtcetera*)thisx;
this->actionFunc(this, play);
if (this->useUselessCylinder) {
Collider_UpdateCylinder(&this->actor, &this->uselessCollider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->uselessCollider.base);
}
}
void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) {

View File

@ -16,6 +16,8 @@ typedef struct ItemEtcetera {
/* 0x0154 */ u8 objBankIndex;
/* 0x0158 */ ActorFunc drawFunc;
/* 0x015C */ ItemEtceteraActionFunc actionFunc;
s32 useUselessCylinder;
ColliderCylinder uselessCollider;
} ItemEtcetera; // size = 0x0160
typedef enum {

View File

@ -10846,6 +10846,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
if (this->actor.category == ACTORCAT_PLAYER) {
seqMode = SEQ_MODE_DEFAULT;
this->cylinder.hideColliderInCollisionViewer = 0;
if (this->csAction != 0) {
Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_NORMAL);
} else if (!(this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON)) {
@ -10912,6 +10913,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
} else {
// First person mode
seqMode = SEQ_MODE_STILL;
this->cylinder.hideColliderInCollisionViewer = 1;
}
if (play->actorCtx.targetCtx.bgmEnemy != NULL && !CVarGetInteger("gEnemyBGMDisable", 0)) {