1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-11 19:43:44 +00:00

Match more ntsc-1.2 overlay draw functions (#2061)

* Match more overlay draw functions

* Review
This commit is contained in:
cadmic 2024-08-20 13:22:05 -07:00 committed by GitHub
parent ec70295357
commit 3e516f48f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 73 additions and 85 deletions

View file

@ -460,8 +460,8 @@ f32 Rand_CenteredFloat(f32 f);
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
void func_8003424C(PlayState* play, Vec3f* arg1);
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration);
Hilite* func_800342EC(Vec3f* object, PlayState* play);
Hilite* func_8003435C(Vec3f* object, PlayState* play);
void func_800342EC(Vec3f* object, PlayState* play);
void func_8003435C(Vec3f* object, PlayState* play);
s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange,
NpcGetTextIdFunc getTextId, NpcUpdateTalkStateFunc updateTalkState);
s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex);

View file

@ -3832,24 +3832,24 @@ void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s1
actor->colorFilterTimer = duration;
}
Hilite* func_800342EC(Vec3f* object, PlayState* play) {
void func_800342EC(Vec3f* object, PlayState* play) {
Vec3f lightDir;
lightDir.x = play->envCtx.dirLight1.params.dir.x;
lightDir.y = play->envCtx.dirLight1.params.dir.y;
lightDir.z = play->envCtx.dirLight1.params.dir.z;
return func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx);
func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx);
}
Hilite* func_8003435C(Vec3f* object, PlayState* play) {
void func_8003435C(Vec3f* object, PlayState* play) {
Vec3f lightDir;
lightDir.x = play->envCtx.dirLight1.params.dir.x;
lightDir.y = play->envCtx.dirLight1.params.dir.y;
lightDir.z = play->envCtx.dirLight1.params.dir.z;
return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx);
func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx);
}
/**

View file

@ -295,9 +295,9 @@ void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) {
}
}
Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 arg4, f32 arg5, s16 arg6,
Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* mtx, f32 arg4, f32 arg5, s16 arg6,
Gfx* arg7) {
f32 temp_f0;
MtxF* mtx2;
f32 temp_f2;
f32 phi_f12;
@ -312,14 +312,15 @@ Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3,
gDPSetPrimColor(arg7++, 0, 1, 255, 255, 0, 150);
gDPSetEnvColor(arg7++, 255, 0, 0, 255);
arg3->xx = arg3->yy = arg3->zz = (0.7f * phi_f12) + 0.5f;
mtx2 = mtx;
mtx2->xx = mtx2->yy = mtx2->zz = (0.7f * phi_f12) + 0.5f;
temp_f2 = (arg3->xx * 10.0f * phi_f12) + 20.0f;
arg3->xw = (temp_f2 * arg4) + this->dyna.actor.world.pos.x;
arg3->yw = this->dyna.actor.world.pos.y + 30.0f + (.7f * phi_f12);
arg3->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z;
temp_f2 = ((mtx2->xx * 10.0f) * phi_f12) + 20.0f;
mtx2->xw = (temp_f2 * arg4) + this->dyna.actor.world.pos.x;
mtx2->yw = this->dyna.actor.world.pos.y + 30.0f + (.7f * phi_f12);
mtx2->zw = (temp_f2 * arg5) + this->dyna.actor.world.pos.z;
gSPMatrix(arg7++,
Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(arg3, "../z_bg_hidan_sekizou.c", 711),
Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(mtx2, "../z_bg_hidan_sekizou.c", 711),
GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx))),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -15,11 +15,11 @@ void BgTokiHikari_Update(Actor* thisx, PlayState* play);
void BgTokiHikari_Draw(Actor* thisx, PlayState* play);
void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play);
void func_808BA018(BgTokiHikari* this, PlayState* play);
void func_808BA018(Actor* thisx, PlayState* play);
void func_808BA204(BgTokiHikari* this, PlayState* play);
void func_808BA22C(BgTokiHikari* this, PlayState* play);
void func_808BA274(BgTokiHikari* this, PlayState* play);
void func_808BA2CC(BgTokiHikari* this, PlayState* play);
void func_808BA2CC(Actor* thisx, PlayState* play);
ActorProfile Bg_Toki_Hikari_Profile = {
/**/ ACTOR_BG_TOKI_HIKARI,
@ -69,19 +69,17 @@ void BgTokiHikari_Update(Actor* thisx, PlayState* play) {
}
void BgTokiHikari_Draw(Actor* thisx, PlayState* play) {
BgTokiHikari* this = (BgTokiHikari*)thisx;
switch (this->actor.params) {
switch (thisx->params) {
case 0:
func_808BA018(this, play);
func_808BA018(thisx, play);
break;
case 1:
func_808BA2CC(this, play);
func_808BA2CC(thisx, play);
break;
}
}
void func_808BA018(BgTokiHikari* this, PlayState* play) {
void func_808BA018(Actor* thisx, PlayState* play) {
PlayState* play2 = (PlayState*)play;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 246);
@ -130,8 +128,9 @@ void func_808BA274(BgTokiHikari* this, PlayState* play) {
}
}
void func_808BA2CC(BgTokiHikari* this, PlayState* play) {
s32 pad[2];
void func_808BA2CC(Actor* thisx, PlayState* play) {
BgTokiHikari* this = (BgTokiHikari*)thisx;
s32 pad;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 350);
Matrix_Translate(0.0f, 276.0f, 1122.0f, MTXMODE_NEW);

View file

@ -1959,7 +1959,7 @@ void BossFd_DrawBody(PlayState* play, BossFd* this) {
SkelAnime_DrawOpa(play, this->skelAnimeHead.skeleton, this->skelAnimeHead.jointTable, BossFd_OverrideHeadDraw,
BossFd_PostHeadDraw, &this->actor);
PRINTF("SK\n");
{
if (1) {
Vec3f spB0 = { 0.0f, 1700.0f, 7000.0f };
Vec3f spA4 = { -1000.0f, 700.0f, 7000.0f };

View file

@ -4805,17 +4805,20 @@ static void* sLightningTextures[] = {
gGanondorfLightning12Tex,
};
static u8 sLightningPrimColors[] = {
0, 0, 0, 255, 255, 255, 231, 250, 231, 208, 245, 208, 185, 240, 185, 162, 235, 162, 139, 230,
139, 115, 225, 115, 92, 220, 92, 69, 215, 69, 46, 210, 46, 23, 205, 23, 0, 200, 0,
static u8 sLightningPrimColors[13][3] = {
{ 0, 0, 0 }, { 255, 255, 255 }, { 231, 250, 231 }, { 208, 245, 208 }, { 185, 240, 185 },
{ 162, 235, 162 }, { 139, 230, 139 }, { 115, 225, 115 }, { 92, 220, 92 }, { 69, 215, 69 },
{ 46, 210, 46 }, { 23, 205, 23 }, { 0, 200, 0 },
};
static u8 sLightningEnvColors[] = {
0, 0, 0, 255, 255, 0, 240, 231, 23, 226, 208, 46, 212, 185, 69, 198, 162, 92,
184, 139, 115, 170, 115, 139, 156, 92, 162, 142, 69, 185, 128, 46, 208, 114, 23, 231,
100, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
static u8 sLightningEnvColors[13][3] = {
{ 0, 0, 0 }, { 255, 255, 0 }, { 240, 231, 23 }, { 226, 208, 46 }, { 212, 185, 69 },
{ 198, 162, 92 }, { 184, 139, 115 }, { 170, 115, 139 }, { 156, 92, 162 }, { 142, 69, 185 },
{ 128, 46, 208 }, { 114, 23, 231 }, { 100, 0, 255 },
};
static s32 sUnknown[3] = { 0 };
void BossGanon_DrawEffects(PlayState* play) {
u8 materialFlag = 0;
s16 i;
@ -4926,11 +4929,10 @@ void BossGanon_DrawEffects(PlayState* play) {
for (i = 0; i < 150; i++, eff++) {
if (eff->type == GDF_EFF_LIGHTNING) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, sLightningPrimColors[(eff->timer * 3) + 0],
sLightningPrimColors[(eff->timer * 3) + 1], sLightningPrimColors[(eff->timer * 3) + 2],
255);
gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[(eff->timer * 3) + 0],
sLightningEnvColors[(eff->timer * 3) + 1], sLightningEnvColors[(eff->timer * 3) + 2], 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, sLightningPrimColors[eff->timer][0],
sLightningPrimColors[eff->timer][1], sLightningPrimColors[eff->timer][2], 255);
gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[eff->timer][0], sLightningEnvColors[eff->timer][1],
sLightningEnvColors[eff->timer][2], 0);
Matrix_Translate(sGanondorf->unk_260.x, sGanondorf->unk_260.y, sGanondorf->unk_260.z, MTXMODE_NEW);
Matrix_RotateY(eff->unk_48, MTXMODE_APPLY);
Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY);

View file

@ -571,27 +571,23 @@ void func_80967FFC(Actor* thisx, PlayState* play) {
{
s32 i;
s32 pad;
Color_RGB8 colors[6][2] = {
{ { 255, 170, 255 }, { 255, 0, 100 } }, { { 255, 255, 170 }, { 0, 255, 0 } },
{ { 255, 255, 170 }, { 255, 255, 0 } }, { { 255, 170, 255 }, { 50, 0, 255 } },
{ { 255, 255, 170 }, { 255, 100, 0 } }, { { 170, 255, 255 }, { 0, 100, 255 } },
s32 j;
Color_RGB8 colors[12] = {
{ 255, 170, 255 }, { 255, 0, 100 }, { 255, 255, 170 }, { 0, 255, 0 }, { 255, 255, 170 }, { 255, 255, 0 },
{ 255, 170, 255 }, { 50, 0, 255 }, { 255, 255, 170 }, { 255, 100, 0 }, { 170, 255, 255 }, { 0, 100, 255 },
};
Matrix_RotateZ(-M_PI / 2, MTXMODE_APPLY);
for (i = 0; i < 6; i++) {
for (i = 0, j = 0; i < 6; i++, j += 2) {
Matrix_RotateZ(M_PI / 3, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_6k.c", 1115),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255);
gDPSetEnvColor(POLY_XLU_DISP++, colors[i][1].r, colors[i][1].g, colors[i][1].b, 255);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[j + 0].r, colors[j + 0].g, colors[j + 0].b, 255);
gDPSetEnvColor(POLY_XLU_DISP++, colors[j + 1].r, colors[j + 1].g, colors[j + 1].b, 255);
gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0022B0);
}
// required to avoid optimizing out i
if ((s16)i) {}
}
CLOSE_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1127);
@ -725,8 +721,6 @@ void func_80968B70(Actor* thisx, PlayState* play) {
u8 primColor[4];
u8 envColor[3];
if (1) {}
OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1316);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
@ -785,10 +779,9 @@ void func_80968FB0(Actor* thisx, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x08, displayList);
gDPPipeSync(displayList++);
if (displayList) {}
gDPSetPrimColor(displayList++, 0, 0x80, 255, 255, 255, this->unk_293);
gDPSetRenderMode(displayList++, G_RM_PASS, G_RM_ZB_CLD_SURF2);
gSPEndDisplayList(displayList++);
gSPEndDisplayList(displayList);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 255);
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleSmallDL);

View file

@ -191,6 +191,7 @@ void DemoExt_DrawVortex(Actor* thisx, PlayState* play) {
s16* curScroll;
Vec3f* scale;
curScroll = this->curScroll;
scale = &this->scale;
gfxCtx = play->state.gfxCtx;
mtx = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
@ -206,8 +207,6 @@ void DemoExt_DrawVortex(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, kREG(33) + 128, kREG(25) + 140, kREG(26) + 80, kREG(27) + 140, this->primAlpha);
gDPSetEnvColor(POLY_XLU_DISP++, kREG(29) + 90, kREG(30) + 50, kREG(31) + 95, this->envAlpha);
curScroll = this->curScroll;
gSPSegment(
POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(gfxCtx, 0, curScroll[0], curScroll[1], 0x40, 0x40, 1, curScroll[2], curScroll[3], 0x40, 0x40));

View file

@ -65,11 +65,9 @@ Gfx* func_80A280BC(GraphicsContext* gfxCtx, BossGanon* dorf) {
displayList = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Gfx));
displayListHead = displayList;
gDPPipeSync(displayListHead++);
if (1) {}
if (1) {}
gDPSetEnvColor(displayListHead++, 25, 20, 0, dorf->organAlpha);
gDPSetRenderMode(displayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
gSPEndDisplayList(displayListHead);
gSPEndDisplayList(displayListHead++);
return displayList;
}
@ -79,13 +77,10 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) {
displayList = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Gfx));
displayListHead = displayList;
gDPPipeSync(displayListHead++);
if (1) {}
if (1) {}
gDPSetEnvColor(displayListHead++, 0, 0, 0, dorf->organAlpha);
gDPSetRenderMode(displayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
gSPEndDisplayList(displayListHead);
gSPEndDisplayList(displayListHead++);
return displayList;
}

View file

@ -4770,25 +4770,23 @@ void Fishing_DrawGroupFishes(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_fishing.c", 8048);
for (i = 0; i < GROUP_FISH_COUNT; i++, fish++) {
if (fish->type == FS_GROUP_FISH_NONE) {
continue;
}
if (fish->type != FS_GROUP_FISH_NONE) {
if (!materialFlag) {
gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255);
materialFlag++;
}
if (!materialFlag) {
gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255);
materialFlag++;
}
if (fish->shouldDraw) {
Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD_ALT2((f32)fish->unk_3E), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY);
Matrix_Scale(fish->scaleX * scale, scale, scale, MTXMODE_APPLY);
if (fish->shouldDraw) {
Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD_ALT2((f32)fish->unk_3E), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C), MTXMODE_APPLY);
Matrix_Scale(fish->scaleX * scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_fishing.c", 8093),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_fishing.c", 8093),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL);
}
}
}
@ -5830,8 +5828,7 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
if ((this->actor.projectedPos.z < 1500.0f) &&
(fabsf(this->actor.projectedPos.x) < (100.0f + this->actor.projectedPos.z))) {
if ((thisx->projectedPos.z < 1500.0f) && (fabsf(thisx->projectedPos.x) < (100.0f + thisx->projectedPos.z))) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sFishingOwnerEyeTexs[this->unk_160]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,

View file

@ -472,7 +472,7 @@ void MirRay_Draw(Actor* thisx, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 i;
MirRayShieldReflection reflection[6];
s32 temp;
s32 pad;
this->reflectIntensity = 0.0f;
if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(play)) {
@ -485,7 +485,7 @@ void MirRay_Draw(Actor* thisx, PlayState* play) {
Matrix_Scale(1.0f, 1.0f, this->reflectIntensity * 5.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_mir_ray.c", 972),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s16)(temp = this->reflectIntensity * 100.0f));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s32)(this->reflectIntensity * 100.0f) & 0xFF);
gSPDisplayList(POLY_XLU_DISP++, gShieldBeamGlowDL);
MirRay_SetupReflectionPolys(this, play, reflection);
MirRay_RemoveSimilarReflections(reflection);

View file

@ -68,6 +68,7 @@ void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) {
f32 scale;
s16 camYaw;
s32 pad[3];
s16 intensity;
s16 redGreen;
OPEN_DISPS(gfxCtx, "../z_eff_en_fire.c", 169);
@ -81,12 +82,13 @@ void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) {
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_eff_en_fire.c", 180),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
redGreen = this->life - 5;
intensity = this->life - 5;
if (redGreen < 0) {
redGreen = 0;
if (intensity < 0) {
intensity = 0;
}
redGreen = intensity;
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255);