Skip to content

Commit

Permalink
Minor Misc Cleanup 3 (#1502)
Browse files Browse the repository at this point in the history
* more misc cleanup

* remove z64 conflicts

* undo ISVDbg
  • Loading branch information
engineer124 authored Jul 5, 2023
1 parent 54638f9 commit 0ce0313
Show file tree
Hide file tree
Showing 27 changed files with 155 additions and 151 deletions.
50 changes: 25 additions & 25 deletions include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ typedef struct {
} KaleidoMgrOverlay; // size = 0x1C

typedef enum {
/* 0x00 */ KALEIDO_OVL_KALEIDO_SCOPE,
/* 0x01 */ KALEIDO_OVL_PLAYER_ACTOR,
/* 0x02 */ KALEIDO_OVL_MAX
/* 0 */ KALEIDO_OVL_KALEIDO_SCOPE,
/* 1 */ KALEIDO_OVL_PLAYER_ACTOR,
/* 2 */ KALEIDO_OVL_MAX
} KaleidoOverlayType;

typedef enum {
Expand Down Expand Up @@ -791,7 +791,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 numActors;
/* 0x04 */ TransitionActorEntry* list;
} TransitionActorContext;
} TransitionActorContext; // size = 0x8

typedef enum {
/* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing.
Expand Down Expand Up @@ -1086,8 +1086,8 @@ typedef struct DebugDispObject {
} DebugDispObject; // size = 0x2C

typedef enum {
MTXMODE_NEW, // generates a new matrix
MTXMODE_APPLY // applies transformation to the current matrix
/* 0 */ MTXMODE_NEW, // generates a new matrix
/* 1 */ MTXMODE_APPLY // applies transformation to the current matrix
} MatrixMode;

typedef struct StackEntry {
Expand All @@ -1101,9 +1101,9 @@ typedef struct StackEntry {
} StackEntry;

typedef enum {
STACK_STATUS_OK = 0,
STACK_STATUS_WARNING = 1,
STACK_STATUS_OVERFLOW = 2
/* 0 */ STACK_STATUS_OK,
/* 1 */ STACK_STATUS_WARNING,
/* 2 */ STACK_STATUS_OVERFLOW
} StackStatus;

typedef struct {
Expand Down Expand Up @@ -1328,22 +1328,22 @@ typedef enum {
} ViModeEditState;

typedef struct {
/* 0x0000 */ OSViMode customViMode;
/* 0x0050 */ s32 viHeight;
/* 0x0054 */ s32 viWidth;
/* 0x0058 */ s32 rightAdjust;
/* 0x005C */ s32 leftAdjust;
/* 0x0060 */ s32 lowerAdjust;
/* 0x0064 */ s32 upperAdjust;
/* 0x0068 */ s32 editState;
/* 0x006C */ s32 tvType;
/* 0x0070 */ u32 loRes;
/* 0x0074 */ u32 antialiasOff;
/* 0x0078 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution
/* 0x007C */ u32 fb16Bit;
/* 0x0080 */ u32 viFeatures;
/* 0x0084 */ u32 unk_84;
} ViMode;
/* 0x00 */ OSViMode customViMode;
/* 0x50 */ s32 viHeight;
/* 0x54 */ s32 viWidth;
/* 0x58 */ s32 rightAdjust;
/* 0x5C */ s32 leftAdjust;
/* 0x60 */ s32 lowerAdjust;
/* 0x64 */ s32 upperAdjust;
/* 0x68 */ s32 editState;
/* 0x6C */ s32 tvType;
/* 0x70 */ u32 loRes;
/* 0x74 */ u32 antialiasOff;
/* 0x78 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution
/* 0x7C */ u32 fb16Bit;
/* 0x80 */ u32 viFeatures;
/* 0x84 */ u32 unk_84;
} ViMode; // size = 0x88

// Vis...
typedef struct {
Expand Down
12 changes: 6 additions & 6 deletions include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ typedef enum {
} ButtonStatus;

typedef enum {
/* 0x00 */ CHAMBER_CS_FOREST,
/* 0x01 */ CHAMBER_CS_FIRE,
/* 0x02 */ CHAMBER_CS_WATER,
/* 0x03 */ CHAMBER_CS_SPIRIT,
/* 0x04 */ CHAMBER_CS_SHADOW,
/* 0x05 */ CHAMBER_CS_LIGHT
/* 0 */ CHAMBER_CS_FOREST,
/* 1 */ CHAMBER_CS_FIRE,
/* 2 */ CHAMBER_CS_WATER,
/* 3 */ CHAMBER_CS_SPIRIT,
/* 4 */ CHAMBER_CS_SHADOW,
/* 5 */ CHAMBER_CS_LIGHT
} ChamberCutsceneNum;

typedef enum {
Expand Down
12 changes: 10 additions & 2 deletions src/code/z_bgcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -2880,21 +2880,25 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) &&
(BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) {
s32 pi;

for (pi = *polyStartIndex; pi < *polyStartIndex + pbgdata->numPolygons; pi++) {
CollisionPoly* poly = &dyna->polyList[pi];
s16 normalY = poly->normal.y;

if (normalY > COLPOLY_SNORMAL(0.5f)) {
s16 polyIndex = pi;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyIndex);
} else if (normalY < COLPOLY_SNORMAL(-0.8f)) {
if (!(dyna->bgActorFlags[bgId] & BGACTOR_CEILING_COLLISION_DISABLED)) {
s16 polyIndex = pi;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling,
&polyIndex);
}
} else {
s16 polyIndex = pi;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyIndex);
}
}
Expand All @@ -2914,6 +2918,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
for (i = 0; i < pbgdata->numVertices; i++) {
Vec3f vtx;
Vec3f vtxT; // Vtx after mtx transform

Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]);
SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT);
BgCheck_Vec3fToVec3s(&dyna->vtxList[*vtxStartIndex + i], &vtxT);
Expand All @@ -2936,7 +2941,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
sphere->center.x = newCenterPoint.x;
sphere->center.y = newCenterPoint.y;
sphere->center.z = newCenterPoint.z;
newRadiusSq = -100.0f;
newRadiusSq = -SQ(10.0f);

for (i = 0; i < pbgdata->numVertices; i++) {
f32 radiusSq;
Expand Down Expand Up @@ -2989,12 +2994,15 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
newPoly->dist = -DOTXYZ(newNormal, dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)]);
if (newNormal.y > 0.5f) {
s16 polyId = *polyStartIndex + i;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyId);
} else if (newNormal.y < -0.8f) {
s16 polyId = *polyStartIndex + i;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, &polyId);
} else {
s16 polyId = *polyStartIndex + i;

DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyId);
}
}
Expand All @@ -3013,7 +3021,7 @@ void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna,
dynaActor = DynaPoly_GetActor(&play->colCtx, i);
if (dynaActor != NULL && &dynaActor->actor == actor) {
DynaPolyActor_UnsetAllInteractFlags((DynaPolyActor*)actor);
return;
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_common_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void SaveContext_Init(void) {
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST;
gSaveContext.nextDayTime = NEXT_TIME_NONE;
gSaveContext.skyboxTime = 0;
gSaveContext.dogIsLost = true;
Expand Down
6 changes: 3 additions & 3 deletions src/code/z_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
case CS_DEST_CHAMBER_OF_SAGES_FOREST_MEDALLION:
play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0;
play->transitionTrigger = TRANS_TRIGGER_START;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST;
play->transitionType = TRANS_TYPE_FADE_WHITE;
break;

Expand All @@ -799,14 +799,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE;
Item_Give(play, ITEM_MEDALLION_FIRE);
gSaveContext.chamberCutsceneNum = 1;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_FIRE;
break;

case CS_DEST_CHAMBER_OF_SAGES_WATER_MEDALLION:
play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE;
gSaveContext.chamberCutsceneNum = 2;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER;
break;

case CS_DEST_HYRULE_FIELD_FLASHBACK:
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ void Environment_DrawSunAndMoon(PlayState* play) {

OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 2266);

if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
Math_SmoothStepToF(&play->envCtx.sunPos.x,
-(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f, 1.0f,
0.8f, 0.8f);
Expand Down
10 changes: 5 additions & 5 deletions src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void func_808AC908(BgSpot02Objects* this, PlayState* play) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f pos;

if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
if (play->csCtx.actorCues[3] != NULL && play->csCtx.actorCues[3]->id == 2) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GRAVE_EXPLOSION);
SET_EVENTCHKINF(EVENTCHKINF_1D);
Expand Down Expand Up @@ -199,7 +199,7 @@ void BgSpot02Objects_Draw(Actor* thisx, PlayState* play) {
}

void func_808ACC34(BgSpot02Objects* this, PlayState* play) {
if (play->csCtx.state != 0 && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) {
if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) {
this->unk_16A++;

if (this->unk_16A >= 12) {
Expand All @@ -225,7 +225,7 @@ void func_808ACCB8(Actor* thisx, PlayState* play) {

OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 600);

if (play->csCtx.state != 0 && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) {
if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) {
if (this->unk_16A < 5) {
rate = (this->unk_16A / 5.0f);
redPrim = greenPrim = bluePrim = 255;
Expand Down Expand Up @@ -265,7 +265,7 @@ void func_808ACCB8(Actor* thisx, PlayState* play) {
}

void func_808AD3D4(BgSpot02Objects* this, PlayState* play) {
if (play->csCtx.state != 0 && play->csCtx.actorCues[2] != NULL && play->csCtx.actorCues[2]->id == 2) {
if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[2] != NULL && play->csCtx.actorCues[2]->id == 2) {
if (this->timer == 2) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_EXPLOSION_ICE);
}
Expand All @@ -285,7 +285,7 @@ void func_808AD450(Actor* thisx, PlayState* play) {

OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 736);

if (play->csCtx.state != 0 && play->csCtx.actorCues[2] != NULL) {
if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[2] != NULL) {
u16 temp_v1 = CAM_BINANG_TO_DEG(play->csCtx.actorCues[2]->rot.z);

if (this->unk_170 != temp_v1) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Demo_Du/z_demo_du.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void func_80969FB4(DemoDu* this, PlayState* play) {
void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) {
s32 pad[2];

if ((gSaveContext.chamberCutsceneNum == 1) && !IS_CUTSCENE_LAYER) {
if ((gSaveContext.chamberCutsceneNum == CHAMBER_CS_FIRE) && !IS_CUTSCENE_LAYER) {
Player* player = GET_PLAYER(play);

this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void func_8097FCE4(DemoGt* this, PlayState* play) {
Vec3f vec;
u16 csCurFrame = play->csCtx.curFrame;

if (csCurFrame == 0x1F7 || kREG(1) == 4) {
if (csCurFrame == 503 || kREG(1) == 4) {
vec.x = this->dyna.actor.world.pos.x + 300.0f;
vec.y = this->dyna.actor.world.pos.y + 560.0f;
vec.z = this->dyna.actor.world.pos.z - 377.0f;
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Demo_Im/z_demo_im.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void func_80985430(DemoIm* this, PlayState* play) {
void func_8098544C(DemoIm* this, PlayState* play) {
s32 pad[2];

if ((gSaveContext.chamberCutsceneNum == 4) && !IS_CUTSCENE_LAYER) {
if ((gSaveContext.chamberCutsceneNum == CHAMBER_CS_SHADOW) && !IS_CUTSCENE_LAYER) {
Player* player = GET_PLAYER(play);

this->action = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void func_8098E960(DemoSa* this, PlayState* play) {
s32 pad[2];
Player* player;

if ((gSaveContext.chamberCutsceneNum == 0) && !IS_CUTSCENE_LAYER) {
if ((gSaveContext.chamberCutsceneNum == CHAMBER_CS_FOREST) && !IS_CUTSCENE_LAYER) {
player = GET_PLAYER(play);
this->action = 1;
play->csCtx.script = D_8099010C;
Expand Down
8 changes: 4 additions & 4 deletions src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play) {
Vec3f accel;
s32 i;

if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
if (play->csCtx.actorCues[1] != NULL) {
if (play->csCtx.actorCues[1]->id == 2) {
if (this->unk_150 == 30) {
Expand All @@ -73,7 +73,7 @@ void EfcErupc_UpdateAction(EfcErupc* this, PlayState* play) {
}
}
}
if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
if (play->csCtx.actorCues[2] != NULL) {
switch (play->csCtx.actorCues[2]->id) {
case 2:
Expand Down Expand Up @@ -135,7 +135,7 @@ void EfcErupc_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_efc_erupc.c", 321),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
if ((play->csCtx.actorCues[1] != NULL) && (play->csCtx.actorCues[1]->id == 2)) {
gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002570);
}
Expand All @@ -144,7 +144,7 @@ void EfcErupc_Draw(Actor* thisx, PlayState* play) {
Matrix_Scale(3.4f, 3.4f, 3.4f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_efc_erupc.c", 333),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (play->csCtx.state != 0) {
if (play->csCtx.state != CS_STATE_IDLE) {
CsCmdActorCue* cue = play->csCtx.actorCues[2];

if (cue != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Fish/z_en_fish.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void EnFish_RespawningUpdate(EnFish* this, PlayState* play) {
void EnFish_Update(Actor* thisx, PlayState* play) {
EnFish* this = (EnFish*)thisx;

if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (play->csCtx.state != 0) &&
if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (play->csCtx.state != CS_STATE_IDLE) &&
(play->csCtx.actorCues[1] != NULL)) {
EnFish_SetCutsceneData(this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Go/z_en_go.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) {
return 0;
}

xyzDistSq = (this->actor.scale.x / 0.01f) * 10000.0f;
xyzDistSq = (this->actor.scale.x / 0.01f) * SQ(100.0f);
if ((this->actor.params & 0xF0) == 0x90) {
Camera_ChangeSetting(mainCam, CAM_SET_DIRECTED_YAW);
xyzDistSq *= 4.8f;
Expand Down
Loading

0 comments on commit 0ce0313

Please sign in to comment.