diff options
| author | fig02 <fig02srl@gmail.com> | 2020-09-05 09:45:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-05 09:45:10 -0400 |
| commit | bb1aacbd0b5cf2b4afd51da772c2ecf7a864e6d1 (patch) | |
| tree | 4c5285b433d8b9875b42f2c9c5d4a671fb56cdf9 /src/code/z_actor.c | |
| parent | 612980f90cab73253f83e3f0f9d87bfb08af32e8 (diff) | |
z_lights.c OK (#343)
* rename some structs
* changes
* rename stuff and start a func
* progress
* progress
* progress
* remove unwanted file
* progress
* match last few funcs
* done, i think
* small changes
* match Lights_Draw (thanks krim)
* comments
* cleanup
* most pr suggestions
* name changes
* rename
Diffstat (limited to 'src/code/z_actor.c')
| -rw-r--r-- | src/code/z_actor.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4f51d9485..019c3c239 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -12,7 +12,7 @@ void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3 shape->unk_14 = -1; } -void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { +void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; @@ -57,18 +57,18 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global } } -void ActorShadow_DrawFunc_Circle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { - func_8002B200(actor, lightMapper, globalCtx, &D_04049210, NULL); +void ActorShadow_DrawFunc_Circle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + func_8002B200(actor, lights, globalCtx, &D_04049210, NULL); } Color_RGBA8 D_80115F80 = { 255, 255, 255, 255 }; -void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { - func_8002B200(actor, lightMapper, globalCtx, &D_04049210, &D_80115F80); +void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + func_8002B200(actor, lights, globalCtx, &D_04049210, &D_80115F80); } -void ActorShadow_DrawFunc_Squiggly(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { - func_8002B200(actor, lightMapper, globalCtx, &D_04049AD0, NULL); +void ActorShadow_DrawFunc_Squiggly(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + func_8002B200(actor, lights, globalCtx, &D_04049AD0, NULL); } void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { @@ -97,7 +97,7 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, #ifdef NON_MATCHING // saved register, stack usage and minor ordering differences -void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { +void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* globalCtx) { MtxF spE8; f32 spE0[2]; s32 i; @@ -125,7 +125,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa temp_14 = actor->shape.unk_14; actor->shape.unk_10 *= 0.3f; actor->shape.unk_14 *= ((temp_f20 - 20.0f) * 0.02f) > 1.0f ? 1.0f : ((temp_f20 - 20.0f) * 0.02f); - ActorShadow_DrawFunc_Circle(actor, lightMapper, globalCtx); + ActorShadow_DrawFunc_Circle(actor, lights, globalCtx); actor->shape.unk_10 = temp_10; actor->shape.unk_14 = temp_14; } @@ -133,7 +133,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if (temp_f20 < 200.0f) { phi_s7 = &actor->unk_CC[0]; spAC = &spE0[0]; - temp_s6 = lightMapper->numLights; + temp_s6 = lights->numLights; temp_s6 -= 2; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1741); @@ -151,7 +151,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_f2 = phi_s7->y - *spAC; if ((phi_f2 >= -1.0f) && (phi_f2 < 500.0f)) { - phi_s0 = lightMapper->lights; + phi_s0 = &lights->l.l[0]; if (phi_f2 <= 0.0f) { actor->shape.unk_15++; @@ -1724,8 +1724,8 @@ s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, UNK_TYPE arg2, UNK_TYP } // Local data used for Farore's Wind light (stored in BSS, possibly a struct?) -LightInfoPositional D_8015BC00; -z_Light* D_8015BC10; +LightInfo D_8015BC00; +LightNode* D_8015BC10; s32 D_8015BC14; f32 D_8015BC18; @@ -1754,9 +1754,9 @@ void func_8002FA60(GlobalContext* globalCtx) { lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f; lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z; - Lights_InitType0PositionalLight(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1); + Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1); - D_8015BC10 = Lights_Insert(globalCtx, &globalCtx->lightCtx, &D_8015BC00); + D_8015BC10 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &D_8015BC00); D_8015BC14 = 0; D_8015BC18 = 0.0f; } @@ -1919,8 +1919,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + spD8; lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z; - Lights_InitType0PositionalLight(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, - 500.0f * spD4); + Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, 500.0f * spD4); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5474); } @@ -1930,7 +1929,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { #endif void func_80030488(GlobalContext* globalCtx) { - Lights_Remove(globalCtx, &globalCtx->lightCtx, D_8015BC10); + LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10); } void func_800304B0(GlobalContext* globalCtx) { @@ -2150,16 +2149,16 @@ void Actor_FaultPrint(Actor* actor, char* command) { void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { FaultClient faultClient; - LightMapper* lightMapper; + Lights* lights; Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw"); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6035); - lightMapper = Lights_CreateMapper(&globalCtx->lightCtx, globalCtx->state.gfxCtx); + lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - func_8007A474(lightMapper, globalCtx->lightCtx.lightsHead, (actor->flags & 0x400000) ? NULL : &actor->posRot.pos); - func_80079EFC(lightMapper, globalCtx->state.gfxCtx); + Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->posRot.pos); + Lights_Draw(lights, globalCtx->state.gfxCtx); if (actor->flags & 0x1000) { func_800D1694(actor->posRot.pos.x + globalCtx->mainCamera.unk_80.x, @@ -2206,7 +2205,7 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { } if (actor->shape.shadowDrawFunc != NULL) { - actor->shape.shadowDrawFunc(actor, lightMapper, globalCtx); + actor->shape.shadowDrawFunc(actor, lights, globalCtx); } CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6119); @@ -2425,7 +2424,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { func_8002FBAC(globalCtx); if (IREG(32) == 0) { - func_8007ABBC(globalCtx); + Lights_DrawGlow(globalCtx); } if ((HREG(64) != 1) || (HREG(75) != 0)) { |
