mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-21 06:21:16 +00:00
PlayState Rename (#1231)
* global context -> play * fix PlayState* PlayState
This commit is contained in:
parent
154f44b6da
commit
2e6279bc8e
912 changed files with 40489 additions and 41078 deletions
|
@ -10,11 +10,11 @@
|
|||
|
||||
#define FLAGS 0
|
||||
|
||||
void EnLight_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnLight_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnLight_Init(Actor* thisx, PlayState* play);
|
||||
void EnLight_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnLight_Update(Actor* thisx, PlayState* play);
|
||||
void EnLight_Draw(Actor* thisx, PlayState* play);
|
||||
void EnLight_UpdateSwitch(Actor* thisx, PlayState* play);
|
||||
|
||||
const ActorInit En_Light_InitVars = {
|
||||
ACTOR_EN_LIGHT,
|
||||
|
@ -45,7 +45,7 @@ static FlameParams D_80A9E840[] = {
|
|||
{ { 170, 255, 255, 255 }, { 0, 0, 255 }, 75 }, { { 170, 255, 255, 255 }, { 0, 150, 255 }, 75 },
|
||||
};
|
||||
|
||||
void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnLight_Init(Actor* thisx, PlayState* play) {
|
||||
EnLight* this = (EnLight*)thisx;
|
||||
s16 yOffset;
|
||||
|
||||
|
@ -60,7 +60,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->actor.world.pos.z, 255, 255, 180, -1);
|
||||
}
|
||||
|
||||
this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
|
||||
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
|
||||
Actor_SetScale(&this->actor, D_80A9E840[this->actor.params & 0xF].scale * 0.0001f);
|
||||
this->timer = (s32)(Rand_ZeroOne() * 255.0f);
|
||||
|
||||
|
@ -69,15 +69,15 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnLight_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnLight* this = (EnLight*)thisx;
|
||||
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode);
|
||||
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
|
||||
}
|
||||
|
||||
void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) {
|
||||
void EnLight_UpdatePosRot(EnLight* this, PlayState* play) {
|
||||
// update yaw for billboard effect
|
||||
this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
|
||||
this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000;
|
||||
|
||||
if (this->actor.parent != NULL) {
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &(this->actor.parent)->world.pos);
|
||||
|
@ -87,7 +87,7 @@ void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) {
|
|||
this->timer++;
|
||||
}
|
||||
|
||||
void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnLight_Update(Actor* thisx, PlayState* play) {
|
||||
f32 intensity;
|
||||
FlameParams* flameParams;
|
||||
s16 radius;
|
||||
|
@ -99,14 +99,14 @@ void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity),
|
||||
radius);
|
||||
EnLight_UpdatePosRot(this, globalCtx);
|
||||
EnLight_UpdatePosRot(this, play);
|
||||
|
||||
if (this->actor.params >= 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnLight_UpdateSwitch(Actor* thisx, PlayState* play) {
|
||||
f32 intensity;
|
||||
FlameParams* flameParams;
|
||||
EnLight* this = (EnLight*)thisx;
|
||||
|
@ -116,7 +116,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) {
|
|||
scale = this->actor.scale.x / ((f32)flameParams->scale * 0.0001);
|
||||
|
||||
if ((this->actor.params & 0x800) != 0) {
|
||||
if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) {
|
||||
if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) {
|
||||
Math_StepToF(&scale, 1.0f, 0.05f);
|
||||
} else {
|
||||
if (scale < 0.1f) {
|
||||
|
@ -126,7 +126,7 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Math_StepToF(&scale, 0.0f, 0.05f);
|
||||
}
|
||||
} else {
|
||||
if (Flags_GetSwitch(globalCtx, (this->actor.params & 0x3F0) >> 4)) {
|
||||
if (Flags_GetSwitch(play, (this->actor.params & 0x3F0) >> 4)) {
|
||||
if (scale < 0.1f) {
|
||||
Actor_SetScale(&this->actor, 0.0f);
|
||||
return;
|
||||
|
@ -142,14 +142,14 @@ void EnLight_UpdateSwitch(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Lights_PointSetColorAndRadius(&this->lightInfo, (flameParams->primColor.r * intensity),
|
||||
(flameParams->primColor.g * intensity), (flameParams->primColor.b * intensity),
|
||||
300.0f * scale);
|
||||
EnLight_UpdatePosRot(this, globalCtx);
|
||||
EnLight_UpdatePosRot(this, play);
|
||||
|
||||
if (this->actor.params >= 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_TORCH - SFX_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnLight_Draw(Actor* thisx, PlayState* play) {
|
||||
EnLight* this = (EnLight*)thisx;
|
||||
s32 pad;
|
||||
FlameParams* flameParams;
|
||||
|
@ -159,14 +159,13 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
flameParams = &D_80A9E840[this->actor.params & 0xF];
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 441);
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_en_light.c", 441);
|
||||
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
func_80093D84(play->state.gfxCtx);
|
||||
|
||||
if (this->actor.params >= 0) {
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128));
|
||||
|
||||
dList = gEffFire1DL;
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, flameParams->primColor.r, flameParams->primColor.g,
|
||||
|
@ -174,7 +173,7 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
gDPSetEnvColor(POLY_XLU_DISP++, flameParams->envColor.r, flameParams->envColor.g, flameParams->envColor.b, 0);
|
||||
} else {
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63),
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63),
|
||||
(this->timer * -6) & 127 * 1, 16, 32));
|
||||
|
||||
dList = gUnusedCandleDL;
|
||||
|
@ -182,18 +181,17 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
|
||||
}
|
||||
|
||||
Matrix_RotateY(
|
||||
BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000)),
|
||||
MTXMODE_APPLY);
|
||||
Matrix_RotateY(BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000)),
|
||||
MTXMODE_APPLY);
|
||||
|
||||
if (this->actor.params & 1) {
|
||||
Matrix_RotateY(M_PI, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_light.c", 488),
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_light.c", 488),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, dList);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 491);
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_en_light.c", 491);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue