1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-20 14:01:15 +00:00

PlayState Rename (#1231)

* global context -> play

* fix PlayState* PlayState
This commit is contained in:
fig02 2022-05-21 14:23:43 -04:00 committed by GitHub
parent 154f44b6da
commit 2e6279bc8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
912 changed files with 40489 additions and 41078 deletions

View file

@ -9,12 +9,12 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx);
void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx);
void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnBoom_Init(Actor* thisx, PlayState* play);
void EnBoom_Destroy(Actor* thisx, PlayState* play);
void EnBoom_Update(Actor* thisx, PlayState* play);
void EnBoom_Draw(Actor* thisx, PlayState* play);
void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx);
void EnBoom_Fly(EnBoom* this, PlayState* play);
const ActorInit En_Boom_InitVars = {
ACTOR_EN_BOOM,
@ -57,7 +57,7 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnBoom_Init(Actor* thisx, PlayState* play) {
EnBoom* this = (EnBoom*)thisx;
EffectBlureInit1 blure;
@ -89,22 +89,22 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) {
blure.unkFlag = 0;
blure.calcMode = 0;
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure);
Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure);
Collider_InitQuad(globalCtx, &this->collider);
Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit);
Collider_InitQuad(play, &this->collider);
Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit);
EnBoom_SetupAction(this, EnBoom_Fly);
}
void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnBoom_Destroy(Actor* thisx, PlayState* play) {
EnBoom* this = (EnBoom*)thisx;
Effect_Delete(globalCtx, this->effectIndex);
Collider_DestroyQuad(globalCtx, &this->collider);
Effect_Delete(play, this->effectIndex);
Collider_DestroyQuad(play, &this->collider);
}
void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
void EnBoom_Fly(EnBoom* this, PlayState* play) {
Actor* target;
Player* player;
s32 collided;
@ -120,7 +120,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
Vec3f hitPoint;
s32 pad2;
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
target = this->moveTo;
// If the boomerang is moving toward a targeted actor, handle setting the proper x and y angle to fly toward it.
@ -196,20 +196,19 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
// Copy the position from the prevous frame to the boomerang to start the bounce back.
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
} else {
collided = BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos,
&hitPoint, &this->actor.wallPoly, true, true, true, true, &hitDynaID);
collided = BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint,
&this->actor.wallPoly, true, true, true, true, &hitDynaID);
if (collided) {
// If the boomerang collides with something and it's is a Jabu Object actor with params equal to 0, then
// set collided to 0 so that the boomerang will go through the wall.
// Otherwise play a clank sound and keep collided set to bounce back.
if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 ||
(hitDynaID != BGCHECK_SCENE &&
((hitActor = DynaPoly_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) &&
if (func_8002F9EC(play, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 ||
(hitDynaID != BGCHECK_SCENE && ((hitActor = DynaPoly_GetActor(&play->colCtx, hitDynaID)) != NULL) &&
hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS && hitActor->actor.params == 0)) {
collided = false;
} else {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &hitPoint);
CollisionCheck_SpawnShieldParticlesMetal(play, &hitPoint);
}
}
}
@ -236,25 +235,25 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) {
}
}
void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnBoom_Update(Actor* thisx, PlayState* play) {
EnBoom* this = (EnBoom*)thisx;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
if (!(player->stateFlags1 & PLAYER_STATE1_29)) {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 0.0f);
this->activeTimer = this->activeTimer + 1;
}
}
void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnBoom_Draw(Actor* thisx, PlayState* play) {
static Vec3f sMultVec1 = { -960.0f, 0.0f, 0.0f };
static Vec3f sMultVec2 = { 960.0f, 0.0f, 0.0f };
EnBoom* this = (EnBoom*)thisx;
Vec3f vec1;
Vec3f vec2;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 567);
OPEN_DISPS(play->state.gfxCtx, "../z_en_boom.c", 567);
Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(0x1F40), MTXMODE_APPLY);
@ -262,16 +261,16 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_MultVec3f(&sMultVec1, &vec1);
Matrix_MultVec3f(&sMultVec2, &vec2);
if (func_80090480(globalCtx, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) {
if (func_80090480(play, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2);
}
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
Matrix_RotateY(BINANG_TO_RAD(this->activeTimer * 12000), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_boom.c", 601),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_boom.c", 601),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gBoomerangRefDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 604);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_boom.c", 604);
}

View file

@ -6,7 +6,7 @@
struct EnBoom;
typedef void (*EnBoomActionFunc)(struct EnBoom*, GlobalContext*);
typedef void (*EnBoomActionFunc)(struct EnBoom*, PlayState*);
typedef struct EnBoom {
/* 0x0000 */ Actor actor;