mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +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
|
@ -11,16 +11,16 @@ typedef enum {
|
|||
/* 0x2 */ ENCOUNT2_ACTIVE_GANONS_TOWER
|
||||
} Encount2State;
|
||||
|
||||
void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnEncount2_Init(Actor* thisx, PlayState* play);
|
||||
void EnEncount2_Update(Actor* thisx, PlayState* play);
|
||||
void EnEncount2_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx);
|
||||
void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx);
|
||||
void EnEncount2_Wait(EnEncount2* this, PlayState* play);
|
||||
void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play);
|
||||
|
||||
void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale);
|
||||
void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx);
|
||||
void EnEncount2_DrawEffects(Actor* thisx, PlayState* play);
|
||||
void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play);
|
||||
|
||||
const ActorInit En_Encount2_InitVars = {
|
||||
ACTOR_EN_ENCOUNT2,
|
||||
|
@ -34,10 +34,10 @@ const ActorInit En_Encount2_InitVars = {
|
|||
(ActorFunc)EnEncount2_Draw,
|
||||
};
|
||||
|
||||
void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnEncount2_Init(Actor* thisx, PlayState* play) {
|
||||
EnEncount2* this = (EnEncount2*)thisx;
|
||||
|
||||
if (globalCtx->sceneNum != SCENE_SPOT16) {
|
||||
if (play->sceneNum != SCENE_SPOT16) {
|
||||
this->isNotDeathMountain = true;
|
||||
}
|
||||
|
||||
|
@ -59,11 +59,11 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->actionFunc = EnEncount2_Wait;
|
||||
}
|
||||
|
||||
void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) {
|
||||
void EnEncount2_Wait(EnEncount2* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s16 quakeIndex;
|
||||
s16 spawnerState;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
spawnerState = ENCOUNT2_INACTIVE;
|
||||
if (!this->isNotDeathMountain) {
|
||||
|
@ -72,8 +72,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
(player->actor.world.pos.z > -3600.0f)) {
|
||||
spawnerState = ENCOUNT2_ACTIVE_DEATH_MOUNTAIN;
|
||||
}
|
||||
} else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37))) {
|
||||
s16 scene = globalCtx->sceneNum;
|
||||
} else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37))) {
|
||||
s16 scene = play->sceneNum;
|
||||
|
||||
if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) ||
|
||||
(scene == SCENE_GANONTIKA_SONOGO)) &&
|
||||
|
@ -92,7 +92,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
break;
|
||||
case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN:
|
||||
if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) {
|
||||
quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1);
|
||||
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
|
||||
Quake_SetSpeed(quakeIndex, 0x7FFF);
|
||||
Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0);
|
||||
Quake_SetCountdown(quakeIndex, 300);
|
||||
|
@ -113,8 +113,8 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
EnFireRock* spawnedRock;
|
||||
f32 tempVec1X;
|
||||
f32 tempVec1Y;
|
||||
|
@ -152,8 +152,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_VOLCANO - SFX_FLAG);
|
||||
} else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37) != 0)) {
|
||||
s16 scene = globalCtx->sceneNum;
|
||||
} else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(play, 0x37) != 0)) {
|
||||
s16 scene = play->sceneNum;
|
||||
|
||||
if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) ||
|
||||
(scene == SCENE_GANONTIKA_SONOGO)) &&
|
||||
|
@ -164,9 +164,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (spawnerState != ENCOUNT2_INACTIVE) {
|
||||
// Direction vector for the direction the camera is facing
|
||||
tempVec1X = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
tempVec1Y = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
tempVec1Z = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
tempVec1X = play->view.at.x - play->view.eye.x;
|
||||
tempVec1Y = play->view.at.y - play->view.eye.y;
|
||||
tempVec1Z = play->view.at.z - play->view.eye.z;
|
||||
|
||||
// Normalised direction vector for the direction the camera is facing
|
||||
magnitude = sqrtf(SQ(tempVec1X) + SQ(tempVec1Y) + SQ(tempVec1Z));
|
||||
|
@ -175,15 +175,15 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
tempVec2Z = tempVec1Z / magnitude;
|
||||
|
||||
// Position between 160 and 300 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y
|
||||
tempVec1X = globalCtx->view.eye.x + (tempVec2X * 300.0f);
|
||||
tempVec1Y = globalCtx->view.eye.y + (tempVec2Y * 160.0f) + 400.0f;
|
||||
tempVec1Z = globalCtx->view.eye.z + (tempVec2Z * 300.0f);
|
||||
tempVec1X = play->view.eye.x + (tempVec2X * 300.0f);
|
||||
tempVec1Y = play->view.eye.y + (tempVec2Y * 160.0f) + 400.0f;
|
||||
tempVec1Z = play->view.eye.z + (tempVec2Z * 300.0f);
|
||||
|
||||
// Position between 160 and 200 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y
|
||||
// (plus some random variation)
|
||||
effectPos.x = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 200.0f));
|
||||
effectPos.x = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 200.0f));
|
||||
effectPos.y = Rand_CenteredFloat(50.0f) + tempVec1Y;
|
||||
effectPos.z = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.z + (tempVec2Z * 200.0f));
|
||||
effectPos.z = Rand_CenteredFloat(200.0f) + (play->view.eye.z + (tempVec2Z * 200.0f));
|
||||
effectScale = Rand_CenteredFloat(0.005f) + 0.007f;
|
||||
|
||||
if (spawnerState == ENCOUNT2_ACTIVE_DEATH_MOUNTAIN) {
|
||||
|
@ -205,8 +205,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
if (player->linearVelocity != 0.0f) {
|
||||
// rock spawn pos is between 300 and 600 units from the camera depending on the camera yaw.
|
||||
// Rocks will generally spawn closer to the camera in the X axis than in the Z axis.
|
||||
tempVec2X = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 300.0f));
|
||||
tempVec2Z = Rand_CenteredFloat(50.0f) + (globalCtx->view.eye.z + (tempVec2Z * 600.0f));
|
||||
tempVec2X = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 300.0f));
|
||||
tempVec2Z = Rand_CenteredFloat(50.0f) + (play->view.eye.z + (tempVec2Z * 600.0f));
|
||||
} else {
|
||||
// rock spawn pos X, Z near player
|
||||
tempVec2X = Rand_CenteredFloat(10.0f) + player->actor.world.pos.x;
|
||||
|
@ -227,9 +227,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
tempVec2Z = Rand_CenteredFloat(70.0f) + player->actor.world.pos.z;
|
||||
}
|
||||
}
|
||||
spawnedRock =
|
||||
(EnFireRock*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FIRE_ROCK,
|
||||
tempVec2X, tempVec1Y, tempVec2Z, 0, 0, 0, spawnedRockType);
|
||||
spawnedRock = (EnFireRock*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FIRE_ROCK,
|
||||
tempVec2X, tempVec1Y, tempVec2Z, 0, 0, 0, spawnedRockType);
|
||||
if (spawnedRock != NULL) {
|
||||
spawnedRock->spawner = this;
|
||||
this->numSpawnedRocks++;
|
||||
|
@ -245,9 +244,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
void EnEncount2_Update(Actor* thisx, PlayState* play2) {
|
||||
EnEncount2* this = (EnEncount2*)thisx;
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
PlayState* play = play2;
|
||||
|
||||
if (this->deathMountainSpawnerTimer != 0) {
|
||||
this->deathMountainSpawnerTimer--;
|
||||
|
@ -261,30 +260,30 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
this->effectSpawnTimer--;
|
||||
}
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->actionFunc(this, play);
|
||||
|
||||
EnEncount2_UpdateEffects(this, globalCtx);
|
||||
EnEncount2_UpdateEffects(this, play);
|
||||
|
||||
if (!this->isNotDeathMountain) {
|
||||
this->unk_17C = this->envEffectsTimer / 60.0f;
|
||||
this->unk_160 = this->unk_17C * -50.0f;
|
||||
globalCtx->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f;
|
||||
globalCtx->envCtx.adjAmbientColor[1] = globalCtx->envCtx.adjAmbientColor[2] = this->unk_160;
|
||||
play->envCtx.adjAmbientColor[0] = (s16)this->unk_160 * -1.5f;
|
||||
play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = this->unk_160;
|
||||
this->unk_168 = this->unk_17C * -20.0f;
|
||||
globalCtx->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f;
|
||||
globalCtx->envCtx.adjLight1Color[1] = globalCtx->envCtx.adjLight1Color[2] = this->unk_168;
|
||||
play->envCtx.adjLight1Color[0] = (s16)this->unk_168 * -1.5f;
|
||||
play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = this->unk_168;
|
||||
this->unk_170 = this->unk_17C * -50.0f;
|
||||
globalCtx->envCtx.adjFogNear = this->unk_170;
|
||||
globalCtx->envCtx.adjFogColor[0] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[0]) * this->unk_17C);
|
||||
globalCtx->envCtx.adjFogColor[1] = (u8)((160.0f - globalCtx->envCtx.lightSettings.fogColor[1]) * this->unk_17C);
|
||||
globalCtx->envCtx.adjFogColor[2] = (u8)((150.0f - globalCtx->envCtx.lightSettings.fogColor[2]) * this->unk_17C);
|
||||
play->envCtx.adjFogNear = this->unk_170;
|
||||
play->envCtx.adjFogColor[0] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[0]) * this->unk_17C);
|
||||
play->envCtx.adjFogColor[1] = (u8)((160.0f - play->envCtx.lightSettings.fogColor[1]) * this->unk_17C);
|
||||
play->envCtx.adjFogColor[2] = (u8)((150.0f - play->envCtx.lightSettings.fogColor[2]) * this->unk_17C);
|
||||
}
|
||||
}
|
||||
|
||||
void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnEncount2_Draw(Actor* thisx, PlayState* play) {
|
||||
EnEncount2* this = (EnEncount2*)thisx;
|
||||
|
||||
EnEncount2_DrawEffects(&this->actor, globalCtx);
|
||||
EnEncount2_DrawEffects(&this->actor, play);
|
||||
}
|
||||
|
||||
void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale) {
|
||||
|
@ -307,10 +306,10 @@ void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) {
|
||||
void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) {
|
||||
s16 i;
|
||||
EnEncount2Effect* effect = this->effects;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Player* player = GET_PLAYER(play);
|
||||
Vec3f targetPos;
|
||||
|
||||
for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) {
|
||||
|
@ -326,7 +325,7 @@ void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
Math_ApproachF(&effect->pos.z, targetPos.z, 0.3f, 30.0f);
|
||||
Math_ApproachF(&effect->moveDirection.y, -20.0f, 0.9f, 1.0f);
|
||||
|
||||
if (globalCtx->sceneNum != SCENE_SPOT16) {
|
||||
if (play->sceneNum != SCENE_SPOT16) {
|
||||
if (effect->pos.y < (player->actor.floorHeight - 50.0f)) {
|
||||
effect->isAlive = 0;
|
||||
}
|
||||
|
@ -337,20 +336,20 @@ void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
EnEncount2* this = (EnEncount2*)thisx;
|
||||
EnEncount2Effect* effect = this->effects;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
s16 i;
|
||||
s32 objBankIndex;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_en_encount2.c", 642);
|
||||
|
||||
objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_EFC_STAR_FIELD);
|
||||
objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_EFC_STAR_FIELD);
|
||||
|
||||
if (objBankIndex >= 0) {
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment);
|
||||
|
||||
for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) {
|
||||
if (effect->isAlive) {
|
||||
|
@ -361,7 +360,7 @@ void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_encount2.c", 669),
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_encount2.c", 669),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct EnEncount2;
|
||||
|
||||
typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*);
|
||||
typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, PlayState*);
|
||||
|
||||
#define EN_ENCOUNT2_EFFECT_COUNT 50
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue