mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 06:40:15 +00:00
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
This commit is contained in:
parent
612980f90c
commit
bb1aacbd0b
111 changed files with 614 additions and 1244 deletions
|
@ -142,9 +142,9 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->collider.dim.radius = 40;
|
||||
this->collider.dim.height = 50;
|
||||
this->collider.dim.yShift = -25;
|
||||
this->light = Lights_Insert(globalCtx, &globalCtx->lightCtx, (void*)(&this->unk_1A0));
|
||||
Lights_InitType0PositionalLight(&this->unk_1A0, thisx->posRot.pos.x, thisx->posRot.pos.y, thisx->posRot.pos.z,
|
||||
0xFF, 0xFF, 0xFF, 0xFF);
|
||||
this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo, thisx->posRot.pos.x, thisx->posRot.pos.y, thisx->posRot.pos.z, 0xFF,
|
||||
0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (thisx->params == 0x32) {
|
||||
Lights_Remove(globalCtx, &globalCtx->lightCtx, this->light);
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ typedef struct EnFhgFire {
|
|||
/* 0x0188 */ f32 unk_188;
|
||||
/* 0x018C */ f32 unk_18C;
|
||||
/* 0x0190 */ char unk_190[0x0C];
|
||||
/* 0x019C */ z_Light* light;
|
||||
/* 0x01A0 */ LightInfoPositional unk_1A0;
|
||||
/* 0x01AE */ char padding_1AE[2];
|
||||
/* 0x019C */ LightNode* lightNode;
|
||||
/* 0x01A0 */ LightInfo lightInfo;
|
||||
/* 0x01AE */ char unk_1AE[2];
|
||||
/* 0x01B0 */ ColliderCylinder collider;
|
||||
/* 0x01FC */ u8 unk_1FC;
|
||||
/* 0x01FD */ char unk_1FD;
|
||||
|
|
|
@ -55,17 +55,15 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
if (gSaveContext.gameMode == 3) {
|
||||
// special case for the credits
|
||||
yOffset = (this->actor.params < 0) ? 1 : 40;
|
||||
Lights_InitType0PositionalLight(&this->posLightInfo, this->actor.posRot.pos.x,
|
||||
yOffset + (s16)this->actor.posRot.pos.y, this->actor.posRot.pos.z, 255, 255,
|
||||
180, -1);
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.posRot.pos.x, yOffset + (s16)this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 255, 255, 180, -1);
|
||||
} else {
|
||||
yOffset = (this->actor.params < 0) ? 1 : 40;
|
||||
Lights_InitType2PositionalLight(&this->posLightInfo, this->actor.posRot.pos.x,
|
||||
yOffset + (s16)this->actor.posRot.pos.y, this->actor.posRot.pos.z, 255, 255,
|
||||
180, -1);
|
||||
Lights_PointGlowSetInfo(&this->lightInfo, this->actor.posRot.pos.x, yOffset + (s16)this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 255, 255, 180, -1);
|
||||
}
|
||||
|
||||
this->lightNode = Lights_Insert(globalCtx, &globalCtx->lightCtx, &this->posLightInfo);
|
||||
this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
|
||||
Actor_SetScale(&this->actor, D_80A9E840[this->actor.params & 0xF].scale * 0.0001f);
|
||||
this->timer = (s32)(Math_Rand_ZeroOne() * 255.0f);
|
||||
|
||||
|
@ -77,7 +75,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnLight* this = THIS;
|
||||
|
||||
Lights_Remove(globalCtx, &globalCtx->lightCtx, this->lightNode);
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode);
|
||||
}
|
||||
|
||||
void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) {
|
||||
|
@ -101,9 +99,9 @@ void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
flameParams = &D_80A9E840[this->actor.params & 0xF];
|
||||
intensity = (Math_Rand_ZeroOne() * 0.5f) + 0.5f;
|
||||
radius = (this->actor.params < 0) ? 100 : 300;
|
||||
Lights_SetPositionalLightColorAndRadius(&this->posLightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity),
|
||||
(flameParams->primColor.b * intensity), radius);
|
||||
Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity),
|
||||
radius);
|
||||
EnLight_UpdatePosRot(this, globalCtx);
|
||||
|
||||
if (this->actor.params >= 0) {
|
||||
|
@ -144,9 +142,9 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
Actor_SetScale(&this->actor, ((f32)flameParams->scale * 0.0001) * scale);
|
||||
intensity = (Math_Rand_ZeroOne() * 0.5f) + 0.5f;
|
||||
Lights_SetPositionalLightColorAndRadius(&this->posLightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity),
|
||||
(flameParams->primColor.b * intensity), 300.0f * scale);
|
||||
Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity),
|
||||
300.0f * scale);
|
||||
EnLight_UpdatePosRot(this, globalCtx);
|
||||
|
||||
if (this->actor.params >= 0) {
|
||||
|
|
|
@ -9,8 +9,8 @@ struct EnLight;
|
|||
typedef struct EnLight {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ u8 timer;
|
||||
/* 0x0150 */ z_Light* lightNode;
|
||||
/* 0x0154 */ LightInfoPositional posLightInfo;
|
||||
/* 0x0150 */ LightNode* lightNode;
|
||||
/* 0x0154 */ LightInfo lightInfo;
|
||||
} EnLight; // size = 0x0164
|
||||
|
||||
extern const ActorInit En_Light_InitVars;
|
||||
|
|
|
@ -48,13 +48,13 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
OceffSpot_SetupAction(this, OceffSpot_GrowCylinder);
|
||||
|
||||
Lights_InitType0PositionalLight(&this->lightInfo1, this->actor.posRot.pos.x, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 0x00, 0x00, 0x00, 0);
|
||||
this->light1 = Lights_Insert(globalCtx, &globalCtx->lightCtx, &this->lightInfo1);
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo1, this->actor.posRot.pos.x, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 0, 0, 0, 0);
|
||||
this->lightNode1 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo1);
|
||||
|
||||
Lights_InitType0PositionalLight(&this->lightInfo2, this->actor.posRot.pos.x, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 0x00, 0x00, 0x00, 0);
|
||||
this->light2 = Lights_Insert(globalCtx, &globalCtx->lightCtx, &this->lightInfo2);
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo2, this->actor.posRot.pos.x, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z, 0, 0, 0, 0);
|
||||
this->lightNode2 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo2);
|
||||
if (YREG(15)) {
|
||||
this->actor.scale.y = 2.4f;
|
||||
} else {
|
||||
|
@ -69,8 +69,8 @@ void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
OceffSpot* this = THIS;
|
||||
Player* player = PLAYER;
|
||||
|
||||
Lights_Remove(globalCtx, &globalCtx->lightCtx, this->light1);
|
||||
Lights_Remove(globalCtx, &globalCtx->lightCtx, this->light2);
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode1);
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode2);
|
||||
func_800876C8(globalCtx);
|
||||
if (gSaveContext.nayrusLoveTimer && globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].length) {
|
||||
player->unk_692 |= 0x40;
|
||||
|
@ -135,16 +135,15 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
temp = (2.0f - this->unk_174) * this->unk_174;
|
||||
func_800773A8(globalCtx, temp * 0.5F, 880.0f, 0.2f, 0.9f);
|
||||
|
||||
Lights_InitType0PositionalLight(&this->lightInfo1, (s16)this->actor.posRot.pos.x,
|
||||
(s16)this->actor.posRot.pos.y + 55.0f, (s16)this->actor.posRot.pos.z,
|
||||
(s32)(255.0f * temp), (s32)(255.0f * temp), (s32)(200.0f * temp),
|
||||
(s16)(100.0f * temp));
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo1, (s16)this->actor.posRot.pos.x, (s16)this->actor.posRot.pos.y + 55.0f,
|
||||
(s16)this->actor.posRot.pos.z, (s32)(255.0f * temp), (s32)(255.0f * temp),
|
||||
(s32)(200.0f * temp), (s16)(100.0f * temp));
|
||||
|
||||
Lights_InitType0PositionalLight(
|
||||
&this->lightInfo2, (s16)this->actor.posRot.pos.x + Math_Sins(player->actor.shape.rot.y) * 20.0f,
|
||||
(s16)this->actor.posRot.pos.y + 20.0f,
|
||||
(s16)this->actor.posRot.pos.z + Math_Coss(player->actor.shape.rot.y) * 20.0f, (s32)(255.0f * temp),
|
||||
(s32)(255.0f * temp), (s32)(200.0f * temp), (s16)(100.0f * temp));
|
||||
Lights_PointNoGlowSetInfo(&this->lightInfo2,
|
||||
(s16)this->actor.posRot.pos.x + Math_Sins(player->actor.shape.rot.y) * 20.0f,
|
||||
(s16)this->actor.posRot.pos.y + 20.0f,
|
||||
(s16)this->actor.posRot.pos.z + Math_Coss(player->actor.shape.rot.y) * 20.0f,
|
||||
(s32)(255.0f * temp), (s32)(255.0f * temp), (s32)(200.0f * temp), (s16)(100.0f * temp));
|
||||
}
|
||||
|
||||
void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -10,10 +10,10 @@ typedef void (*OceffSpotActionFunc)(struct OceffSpot*, GlobalContext*);
|
|||
|
||||
typedef struct OceffSpot {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ z_Light* light1;
|
||||
/* 0x0150 */ LightInfoPositional lightInfo1;
|
||||
/* 0x0160 */ z_Light* light2;
|
||||
/* 0x0164 */ LightInfoPositional lightInfo2;
|
||||
/* 0x014C */ LightNode* lightNode1;
|
||||
/* 0x0150 */ LightInfo lightInfo1;
|
||||
/* 0x0160 */ LightNode* lightNode2;
|
||||
/* 0x0164 */ LightInfo lightInfo2;
|
||||
/* 0x0174 */ f32 unk_174;
|
||||
/* 0x0178 */ u16 timer;
|
||||
/* 0x017C */ OceffSpotActionFunc actionFunc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue