mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-22 23:11:20 +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,25 +11,25 @@
|
|||
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23)
|
||||
|
||||
void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Init(Actor* thisx, PlayState* play);
|
||||
void ObjTsubo_Destroy(Actor* thisx, PlayState* play);
|
||||
void ObjTsubo_Update(Actor* thisx, PlayState* play);
|
||||
void ObjTsubo_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_ApplyGravity(ObjTsubo* this);
|
||||
s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_InitCollider(Actor* thisx, PlayState* play);
|
||||
void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_SetupWaitForObject(ObjTsubo* this);
|
||||
void ObjTsubo_WaitForObject(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_SetupIdle(ObjTsubo* this);
|
||||
void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Idle(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_SetupLiftedUp(ObjTsubo* this);
|
||||
void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play);
|
||||
void ObjTsubo_SetupThrown(ObjTsubo* this);
|
||||
void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx);
|
||||
void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play);
|
||||
|
||||
static s16 D_80BA1B50 = 0;
|
||||
static s16 D_80BA1B54 = 0;
|
||||
|
@ -82,12 +82,11 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) {
|
||||
s16 dropParams = this->actor.params & 0x1F;
|
||||
|
||||
if ((dropParams >= 0) && (dropParams < ITEM00_MAX)) {
|
||||
Item_DropCollectible(globalCtx, &this->actor.world.pos,
|
||||
(dropParams | (((this->actor.params >> 9) & 0x3F) << 8)));
|
||||
Item_DropCollectible(play, &this->actor.world.pos, (dropParams | (((this->actor.params >> 9) & 0x3F) << 8)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +97,7 @@ void ObjTsubo_ApplyGravity(ObjTsubo* this) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) {
|
||||
CollisionPoly* floorPoly;
|
||||
Vec3f pos;
|
||||
s32 bgID;
|
||||
|
@ -107,7 +106,7 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
pos.x = this->actor.world.pos.x;
|
||||
pos.y = this->actor.world.pos.y + 20.0f;
|
||||
pos.z = this->actor.world.pos.z;
|
||||
floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &floorPoly, &bgID, &this->actor, &pos);
|
||||
floorY = BgCheck_EntityRaycastFloor4(&play->colCtx, &floorPoly, &bgID, &this->actor, &pos);
|
||||
if (floorY > BGCHECK_Y_MIN) {
|
||||
this->actor.world.pos.y = floorY;
|
||||
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
|
||||
|
@ -118,25 +117,25 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void ObjTsubo_InitCollider(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_InitCollider(Actor* thisx, PlayState* play) {
|
||||
ObjTsubo* this = (ObjTsubo*)thisx;
|
||||
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
Collider_InitCylinder(play, &this->collider);
|
||||
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
}
|
||||
|
||||
void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_Init(Actor* thisx, PlayState* play) {
|
||||
ObjTsubo* this = (ObjTsubo*)thisx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
ObjTsubo_InitCollider(&this->actor, globalCtx);
|
||||
ObjTsubo_InitCollider(&this->actor, play);
|
||||
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit);
|
||||
if (!ObjTsubo_SnapToFloor(this, globalCtx)) {
|
||||
if (!ObjTsubo_SnapToFloor(this, play)) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
this->objTsuboBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]);
|
||||
this->objTsuboBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]);
|
||||
if (this->objTsuboBankIndex < 0) {
|
||||
osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410);
|
||||
Actor_Kill(&this->actor);
|
||||
|
@ -146,14 +145,14 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
ObjTsubo* this = (ObjTsubo*)thisx;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
}
|
||||
|
||||
void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) {
|
||||
s32 pad;
|
||||
f32 rand;
|
||||
s16 angle;
|
||||
|
@ -182,14 +181,14 @@ void ObjTsubo_AirBreak(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
arg5 = 32;
|
||||
}
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0,
|
||||
EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0,
|
||||
(Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE,
|
||||
sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]);
|
||||
}
|
||||
func_80033480(globalCtx, &this->actor.world.pos, 30.0f, 4, 20, 50, 1);
|
||||
func_80033480(play, &this->actor.world.pos, 30.0f, 4, 20, 50, 1);
|
||||
}
|
||||
|
||||
void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) {
|
||||
s32 pad[2];
|
||||
s16 angle;
|
||||
Vec3f pos = this->actor.world.pos;
|
||||
|
@ -198,7 +197,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
s32 i;
|
||||
|
||||
pos.y += this->actor.yDistToWater;
|
||||
EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 400);
|
||||
EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 400);
|
||||
for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) {
|
||||
f32 sins = Math_SinS(angle);
|
||||
f32 coss = Math_CosS(angle);
|
||||
|
@ -211,7 +210,7 @@ void ObjTsubo_WaterBreak(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
velocity.z = pos.z * 0.2f;
|
||||
Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos);
|
||||
phi_s0 = (Rand_ZeroOne() < .2f) ? 64 : 32;
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0,
|
||||
EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0,
|
||||
(Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE,
|
||||
sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]);
|
||||
}
|
||||
|
@ -221,8 +220,8 @@ void ObjTsubo_SetupWaitForObject(ObjTsubo* this) {
|
|||
this->actionFunc = ObjTsubo_WaitForObject;
|
||||
}
|
||||
|
||||
void ObjTsubo_WaitForObject(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->objTsuboBankIndex)) {
|
||||
void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) {
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objTsuboBankIndex)) {
|
||||
this->actor.draw = ObjTsubo_Draw;
|
||||
this->actor.objBankIndex = this->objTsuboBankIndex;
|
||||
ObjTsubo_SetupIdle(this);
|
||||
|
@ -234,39 +233,39 @@ void ObjTsubo_SetupIdle(ObjTsubo* this) {
|
|||
this->actionFunc = ObjTsubo_Idle;
|
||||
}
|
||||
|
||||
void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s16 temp_v0;
|
||||
s32 phi_v1;
|
||||
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
ObjTsubo_SetupLiftedUp(this);
|
||||
} else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) {
|
||||
ObjTsubo_WaterBreak(this, globalCtx);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
ObjTsubo_SpawnCollectible(this, globalCtx);
|
||||
ObjTsubo_WaterBreak(this, play);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
ObjTsubo_SpawnCollectible(this, play);
|
||||
Actor_Kill(&this->actor);
|
||||
} else if ((this->collider.base.acFlags & AC_HIT) &&
|
||||
(this->collider.info.acHitInfo->toucher.dmgFlags & 0x4FC1FFFC)) {
|
||||
ObjTsubo_AirBreak(this, globalCtx);
|
||||
ObjTsubo_SpawnCollectible(this, globalCtx);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
ObjTsubo_AirBreak(this, play);
|
||||
ObjTsubo_SpawnCollectible(this, play);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
if (this->actor.xzDistToPlayer < 600.0f) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
this->collider.base.acFlags &= ~AC_HIT;
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
|
||||
if (this->actor.xzDistToPlayer < 150.0f) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
if (this->actor.xzDistToPlayer < 100.0f) {
|
||||
temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y;
|
||||
temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y;
|
||||
phi_v1 = ABS(temp_v0);
|
||||
if (phi_v1 >= 0x5556) {
|
||||
// GI_NONE in this case allows the player to lift the actor
|
||||
func_8002F434(&this->actor, globalCtx, GI_NONE, 30.0f, 30.0f);
|
||||
func_8002F434(&this->actor, play, GI_NONE, 30.0f, 30.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,13 +278,13 @@ void ObjTsubo_SetupLiftedUp(ObjTsubo* this) {
|
|||
this->actor.flags |= ACTOR_FLAG_4;
|
||||
}
|
||||
|
||||
void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
if (Actor_HasNoParent(&this->actor, globalCtx)) {
|
||||
this->actor.room = globalCtx->roomCtx.curRoom.num;
|
||||
void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play) {
|
||||
if (Actor_HasNoParent(&this->actor, play)) {
|
||||
this->actor.room = play->roomCtx.curRoom.num;
|
||||
ObjTsubo_SetupThrown(this);
|
||||
ObjTsubo_ApplyGravity(this);
|
||||
func_8002D7EC(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f,
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f,
|
||||
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7);
|
||||
}
|
||||
}
|
||||
|
@ -301,19 +300,19 @@ void ObjTsubo_SetupThrown(ObjTsubo* this) {
|
|||
this->actionFunc = ObjTsubo_Thrown;
|
||||
}
|
||||
|
||||
void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play) {
|
||||
s32 pad[2];
|
||||
|
||||
if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) ||
|
||||
(this->collider.base.atFlags & AT_HIT)) {
|
||||
ObjTsubo_AirBreak(this, globalCtx);
|
||||
ObjTsubo_SpawnCollectible(this, globalCtx);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
ObjTsubo_AirBreak(this, play);
|
||||
ObjTsubo_SpawnCollectible(this, play);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
Actor_Kill(&this->actor);
|
||||
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) {
|
||||
ObjTsubo_WaterBreak(this, globalCtx);
|
||||
ObjTsubo_SpawnCollectible(this, globalCtx);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
ObjTsubo_WaterBreak(this, play);
|
||||
ObjTsubo_SpawnCollectible(this, play);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN);
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
ObjTsubo_ApplyGravity(this);
|
||||
|
@ -322,20 +321,20 @@ void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) {
|
|||
Math_StepToS(&D_80BA1B5C, D_80BA1B58, 0x64);
|
||||
this->actor.shape.rot.x += D_80BA1B54;
|
||||
this->actor.shape.rot.y += D_80BA1B5C;
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f,
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f,
|
||||
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void ObjTsubo_Update(Actor* thisx, PlayState* play) {
|
||||
ObjTsubo* this = (ObjTsubo*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_80BA1B84[(thisx->params >> 8) & 1]);
|
||||
void ObjTsubo_Draw(Actor* thisx, PlayState* play) {
|
||||
Gfx_DrawDListOpa(play, D_80BA1B84[(thisx->params >> 8) & 1]);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct ObjTsubo;
|
||||
|
||||
typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, GlobalContext*);
|
||||
typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, PlayState*);
|
||||
|
||||
typedef struct ObjTsubo {
|
||||
/* 0x0000 */ Actor actor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue