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
912 changed files with 40489 additions and 41078 deletions
+75 -75
View File
@@ -43,7 +43,7 @@ The general rule for order of decompilation is
- Next, decompile any other functions from the actor you have found in `Init`. You generally start with the action functions, because they return nothing and all take the same arguments,
```C
void func_80whatever(EnJj* this, GlobalContext* globalCtx);
void func_80whatever(EnJj* this, PlayState* play);
```
- Decompile each action function in turn until you run out. Along the way, do any other functions in the actor for which you have discovered the argument types. (You are probably better doing depth-first on action functions than breadth-first: it's normally easier to follow along one branch of the actions than )
@@ -103,7 +103,7 @@ Copy the entire contents of this file into the upper box, labelled "MIPS assembl
Now press "Decompile". This should produce C code:
```C
void EnJj_Init(EnJj *this, GlobalContext *globalCtx) {
void EnJj_Init(EnJj *this, PlayState *play) {
CollisionHeader *sp4C;
DynaCollisionContext *sp44;
DynaCollisionContext *temp_a1;
@@ -146,7 +146,7 @@ While we are carrying out initial changes, you can also find-and-replace any ins
</summary>
```C
void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Init(Actor *thisx, PlayState *play) {
EnJj* this = THIS;
CollisionHeader *sp4C;
@@ -164,7 +164,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
temp_a1 = this + 0x164;
if (temp_v0 == -1) {
sp44 = temp_a1;
SkelAnime_InitFlex(globalCtx, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16);
SkelAnime_InitFlex(play, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16);
Animation_PlayLoop((SkelAnime *) sp44, (AnimationHeader *) &D_06001F4C);
this->unk30A = (u16)0;
this->unk30E = (u8)0;
@@ -176,25 +176,25 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
} else {
func_80A87800(this, &func_80A87C30);
}
this->unk300 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, (u16)0x5A, this->actor.world.pos.x - 10.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, (?32) this->actor.world.rot.y, 0, 0);
this->unk300 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, (u16)0x5A, this->actor.world.pos.x - 10.0f, this->actor.world.pos.y, this->actor.world.pos.z, 0, (?32) this->actor.world.rot.y, 0, 0);
DynaPolyActor_Init((DynaPolyActor *) this, 0);
CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C);
this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C);
this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C);
temp_a1_3 = this + 0x2B0;
sp44 = temp_a1_3;
Collider_InitCylinder(globalCtx, (ColliderCylinder *) temp_a1_3);
Collider_SetCylinder(globalCtx, (ColliderCylinder *) temp_a1_3, &this->actor, &D_80A88CB4);
Collider_InitCylinder(play, (ColliderCylinder *) temp_a1_3);
Collider_SetCylinder(play, (ColliderCylinder *) temp_a1_3, &this->actor, &D_80A88CB4);
this->actor.colChkInfo.mass = 0xFF;
return;
}
if (temp_v0 == 0) {
DynaPolyActor_Init((DynaPolyActor *) this, 0);
CollisionHeader_GetVirtual((void *) &D_06001830, &sp4C);
temp_a1_2 = &globalCtx->colCtx.dyna;
temp_a1_2 = &play->colCtx.dyna;
sp44 = temp_a1_2;
temp_v0_2 = DynaPoly_SetBgActor(globalCtx, temp_a1_2, &this->actor, sp4C);
temp_v0_2 = DynaPoly_SetBgActor(play, temp_a1_2, &this->actor, sp4C);
this->unk_14C = temp_v0_2;
func_8003ECA8(globalCtx, temp_a1_2, (s32) temp_v0_2);
func_8003ECA8(play, temp_a1_2, (s32) temp_v0_2);
this->actor.update = &func_80A87F44;
this->actor.draw = NULL;
Actor_SetScale(&this->actor, 0.087f);
@@ -205,7 +205,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
}
DynaPolyActor_Init((DynaPolyActor *) this, 0);
CollisionHeader_GetVirtual((void *) &D_0600BA8C, &sp4C);
this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C);
this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C);
this->actor.update = &func_80A87F44;
this->actor.draw = NULL;
Actor_SetScale(&this->actor, 0.087f);
@@ -281,7 +281,7 @@ Glancing through the rest of `EnJj_Init`, we notice some references to DynaPoly,
```C
DynaPolyActor_Init((DynaPolyActor *) this, 0);
CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C);
this->unk_14C = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp4C);
this->unk_14C = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->actor, sp4C);
```
This means that EnJj is not an ordinary actor: it is instead a DynaPoly actor. In-game this is to do with how the actor interacts with Link and the environment (a good rule of thumb is that Link can often stand on DynaPoly actors as if they were ground). For decompilation purposes, it means that the actor struct is wrong: the first element of a DynaPoly actor's struct is not an `Actor` struct, but a `DynaPolyActor`, usually called `dyna`. We should fix this immediately to avoid confusion later. (Some actors have this correctly identified already; we were unlucky with this one.)
@@ -318,7 +318,7 @@ Now that we know this, it is worth remaking the context file and running mips2c
```C
DynaPolyActor_Init((DynaPolyActor *) this, 0);
CollisionHeader_GetVirtual((void *) &D_06000A1C, &sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
```
Next, replace `(DynaPolyActor *) this` by `&this->dyna`. There's not a lot more we can do to the DynaPoly stuff right now, so just remove the casts to void and move on.
@@ -331,8 +331,8 @@ The relevant functions in this actor are
```C
temp_a1_3 = this + 0x2B0;
sp44 = temp_a1_3;
Collider_InitCylinder(globalCtx, (ColliderCylinder *) temp_a1_3);
Collider_SetCylinder(globalCtx, (ColliderCylinder *) temp_a1_3, &this->dyna.actor, &D_80A88CB4);
Collider_InitCylinder(play, (ColliderCylinder *) temp_a1_3);
Collider_SetCylinder(play, (ColliderCylinder *) temp_a1_3, &this->dyna.actor, &D_80A88CB4);
```
Notice that `sp44` is set, but actually not used anywhere in the actor. This is a good indication that it is fake. We'll get back to that. Similarly, `temp_a1_3` is only used in these functions, so is likely to be fake as well: it's simply trying to get the pointer into the `a1` register.
@@ -349,8 +349,8 @@ typedef struct EnJj {
Now replace the temps, so we have
```C
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4);
```
(You may prefer to just comment out temps initially, to keep track of where they were.)
@@ -398,7 +398,7 @@ This is the combined system that handles actors' skeletons and their animations.
temp_a1 = this->unk_164;
...
sp44 = (DynaCollisionContext *) temp_a1;
SkelAnime_InitFlex(globalCtx, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16);
SkelAnime_InitFlex(play, (SkelAnime *) temp_a1, (FlexSkeletonHeader *) &D_0600B9A8, (AnimationHeader *) &D_06001F4C, this + 0x1A8, this + 0x22C, 0x16);
Animation_PlayLoop((SkelAnime *) sp44, (AnimationHeader *) &D_06001F4C);
```
@@ -438,7 +438,7 @@ extern UNK_TYPE D_0600BA8C;
and removing the temps,
```C
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
Animation_PlayLoop(&this->skelAnime, &D_06001F4C);
```
@@ -446,13 +446,13 @@ Animation_PlayLoop(&this->skelAnime, &D_06001F4C);
This function also gives us information about other things in the struct. One obvious thing that sticks out is
```C
this->unk300 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, (u16)0x5A, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, (?32) this->dyna.actor.world.rot.y, 0, 0);
this->unk300 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, (u16)0x5A, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, (?32) this->dyna.actor.world.rot.y, 0, 0);
```
Hovering over this function tells us it outputs a pointer to the spawned actor, so `this->unk_300` is an `Actor*`. We may or may not care what this actor actually is, depending on how it is used later on, so let's just add `/* 0x0300 */ Actor* childActor` to the struct for now.
We can look up what the actor with ID 0x5A is in `z64actor.h`: we find it is `ACTOR_EN_JJ`. So some Jabus spawn another Jabu. Filling this in and removing the spurious cast, we have
```C
this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
this->childActor = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
```
Finally, we have this block:
@@ -491,7 +491,7 @@ typedef struct EnJj {
We can remove a few more temps that don't look real, and end up with
```C
void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Init(Actor *thisx, PlayState *play) {
EnJj* this = THIS;
CollisionHeader *sp4C;
@@ -509,7 +509,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
// temp_a1 = this->unk_164;
if (temp_v0 == -1) {
// sp44 = (DynaCollisionContext *) temp_a1;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
Animation_PlayLoop(&this->skelAnime, &D_06001F4C);
this->unk_30A = 0;
this->unk_30E = 0;
@@ -521,24 +521,24 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
} else {
func_80A87800(this, &func_80A87C30);
}
this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
this->childActor = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06000A1C, &sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
// temp_a1_3 = this + 0x2B0;
// sp44 = temp_a1_3;
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4);
this->dyna.actor.colChkInfo.mass = 0xFF;
return;
}
if (temp_v0 == 0) {
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06001830, &sp4C);
// temp_a1_2 = &globalCtx->colCtx.dyna;
// temp_a1_2 = &play->colCtx.dyna;
// sp44 = temp_a1_2;
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId);
this->dyna.actor.update = &func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -549,7 +549,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
}
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.actor.update = &func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -563,12 +563,12 @@ This will still not compile without errors: we need to know what the functions i
Function pointers do not need `&`, so remove all those. There are three functions that are called in this actor. Firstly, `this->dyna.actor.update = func_80A87F44;` tells us that `func_80A87F44` is an alternative update function for this actor. We therefore give it a prototype similar to the original Update:
```C
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Init(Actor* thisx, PlayState* play);
void EnJj_Destroy(Actor* thisx, PlayState* play);
void EnJj_Update(Actor* thisx, PlayState* play);
void EnJj_Draw(Actor* thisx, PlayState* play);
void func_80A87F44(Actor* thisx, GlobalContext* globalCtx);
void func_80A87F44(Actor* thisx, PlayState* play);
```
Unfortunately the others are not so easy to deal with. In order to find out what type the functions called by `func_80A87800`, we have to look at `func_80A87800` itself. But fortunately, this is the entire MIPS for `func_80A87800`:
@@ -583,7 +583,7 @@ This is simple enough to read that we don't even need to appeal to mips2c: it sa
*Action functions* are the main other kind of function in most actors: they are usually run by Update every frame, and carry out the main actions that the actor does (hence the name). They all have the same arguments, and so we have a typedef for such things: it is
```C
typedef void (*EnJjActionFunc)(struct EnJj*, GlobalContext*);
typedef void (*EnJjActionFunc)(struct EnJj*, PlayState*);
```
Put this between `struct EnJj;` and the actor struct in the header file. This also gives us another bit of the struct, conveniently plugging the gap at `0x2FC`:
```C
@@ -599,14 +599,14 @@ void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) {
and that `func_80A87BEC` and `func_80A87C30`, passed to it in `EnJj_Init`, are action functions. Since they are first used above where they are defined, we prototype them at the top as well,
```C
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Init(Actor* thisx, PlayState* play);
void EnJj_Destroy(Actor* thisx, PlayState* play);
void EnJj_Update(Actor* thisx, PlayState* play);
void EnJj_Draw(Actor* thisx, PlayState* play);
void func_80A87F44(Actor* thisx, GlobalContext* globalCtx);
void func_80A87BEC(EnJj* this, GlobalContext* globalCtx);
void func_80A87C30(EnJj* this, GlobalContext* globalCtx);
void func_80A87F44(Actor* thisx, PlayState* play);
void func_80A87BEC(EnJj* this, PlayState* play);
void func_80A87C30(EnJj* this, PlayState* play);
```
@@ -629,14 +629,14 @@ With all of this implemented, the function should now compile without errors. Th
</summary>
```C
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnJj_Init(Actor* thisx, PlayState* play);
void EnJj_Destroy(Actor* thisx, PlayState* play);
void EnJj_Update(Actor* thisx, PlayState* play);
void EnJj_Draw(Actor* thisx, PlayState* play);
void func_80A87F44(Actor* thisx, GlobalContext* globalCtx);
void func_80A87BEC(EnJj* this, GlobalContext* globalCtx);
void func_80A87C30(EnJj* this, GlobalContext* globalCtx);
void func_80A87F44(Actor* thisx, PlayState* play);
void func_80A87BEC(EnJj* this, PlayState* play);
void func_80A87C30(EnJj* this, PlayState* play);
/*
const ActorInit En_Jj_InitVars = {
@@ -699,7 +699,7 @@ void func_80A87800(EnJj* this, EnJjActionFunc actionFunc) {
}
// #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/EnJj_Init.s")
void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Init(Actor *thisx, PlayState *play) {
EnJj* this = THIS;
CollisionHeader *sp4C;
@@ -717,7 +717,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
// temp_a1 = this->unk_164;
if (temp_v0 == -1) {
// sp44 = (DynaCollisionContext *) temp_a1;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable, this->morphTable, 22);
Animation_PlayLoop(&this->skelAnime, &D_06001F4C);
this->unk_30A = 0;
this->unk_30E = 0;
@@ -729,24 +729,24 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
} else {
func_80A87800(this, func_80A87C30);
}
this->childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
this->childActor = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06000A1C, &sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
// temp_a1_3 = this + 0x2B0;
// sp44 = temp_a1_3;
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4);
this->dyna.actor.colChkInfo.mass = 0xFF;
return;
}
if (temp_v0 == 0) {
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06001830, &sp4C);
// temp_a1_2 = &globalCtx->colCtx.dyna;
// temp_a1_2 = &play->colCtx.dyna;
// sp44 = temp_a1_2;
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId);
this->dyna.actor.update = func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -757,7 +757,7 @@ void EnJj_Init(Actor *thisx, GlobalContext *globalCtx) {
}
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.actor.update = func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -827,7 +827,7 @@ You can keep the diff open in the terminal, and it will refresh when the C file
In this case, we see that various branches are happening in the wrong place. Here I fear experience is necessary: notice that the function has three blocks that look quite similar, and three separate conditionals that depend on the same variable. This is a good indicator of a switch. Changing the function to use a switch,
```C
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnJj_Init(Actor* thisx, PlayState* play) {
EnJj* this = THIS;
s32 sp4C;
@@ -840,7 +840,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (temp_v0) {
case -1:
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable,
SkelAnime_InitFlex(play, &this->skelAnime, &D_0600B9A8, &D_06001F4C, this->jointTable,
this->morphTable, 22);
Animation_PlayLoop(&this->skelAnime, &D_06001F4C);
this->unk_30A = 0;
@@ -854,24 +854,24 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) {
func_80A87800(this, func_80A87C30);
}
this->childActor = Actor_SpawnAsChild(
&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f,
&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f,
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0);
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06000A1C, &sp4C);
this->dyna.bgId =
DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &D_80A88CB4);
DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &D_80A88CB4);
this->dyna.actor.colChkInfo.mass = 0xFF;
break;
case 0:
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_06001830, &sp4C);
// temp_a1_2 = &globalCtx->colCtx.dyna;
// temp_a1_2 = &play->colCtx.dyna;
// sp44 = temp_a1_2;
this->dyna.bgId =
DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
func_8003ECA8(play, &play->colCtx.dyna, this->dyna.bgId);
this->dyna.actor.update = func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -880,7 +880,7 @@ void EnJj_Init(Actor* thisx, GlobalContext* globalCtx) {
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&D_0600BA8C, &sp4C);
this->dyna.bgId =
DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp4C);
DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C);
this->dyna.actor.update = func_80A87F44;
this->dyna.actor.draw = NULL;
Actor_SetScale(&this->dyna.actor, 0.087f);
@@ -899,10 +899,10 @@ we see that the diff is nearly correct (note that `-3` lets you compare current
![Init diff 2](images/init_diff2.png)
</details>
except we still have some stack issues. Now that `temp_v0` is only used once, it looks fake. Eliminating it actually seems to make the stack worse. To fix this, we employ something that we have evidence that the developers did: namely, we make a copy of `globalCtx` (the theory is that they actually used `gameState` as an argument of the main 4 functions, just like we used `Actor* thisx` as the first argument.) The quick way to do this is to change the top of the function to
except we still have some stack issues. Now that `temp_v0` is only used once, it looks fake. Eliminating it actually seems to make the stack worse. To fix this, we employ something that we have evidence that the developers did: namely, we make a copy of `play` (the theory is that they actually used `gameState` as an argument of the main 4 functions, just like we used `Actor* thisx` as the first argument.) The quick way to do this is to change the top of the function to
```C
void EnJj_Init(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
void EnJj_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EnJj* this = THIS;
...
```
+12 -12
View File
@@ -84,10 +84,10 @@ Large code block, click to show
#define THIS ((EnTg*)thisx)
void EnTg_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTg_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTg_Update(Actor* thisx, GlobalContext* globalCtx);
void EnTg_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnTg_Init(Actor* thisx, PlayState* play);
void EnTg_Destroy(Actor* thisx, PlayState* play);
void EnTg_Update(Actor* thisx, PlayState* play);
void EnTg_Draw(Actor* thisx, PlayState* play);
s32 D_80B18910[] = { 0x0A000039, 0x20010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00140040, 0x00000000, 0x00000000 };
@@ -136,18 +136,18 @@ to tell the compiler not to look for the data in that file any more. Now run `ma
Now carry out the usual steps to decompile `Init`. The usual cleanup and struct population gets us to
```C
void EnTg_Init(Actor *thisx, GlobalContext *globalCtx) {
void EnTg_Init(Actor *thisx, PlayState *play) {
EnTg *this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 28.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600AE40, &D_06005040, 0, 0, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, (ColliderCylinderInit *) D_80B18910);
SkelAnime_InitFlex(play, &this->skelAnime, &D_0600AE40, &D_06005040, 0, 0, 0);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, (ColliderCylinderInit *) D_80B18910);
func_80061EFC(&this->actor.colChkInfo, NULL, (CollisionCheckInfoInit2 *) D_80B1893C);
this->actor.unk_1F = 6;
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = func_80B185C0;
this->unk_208 = globalCtx->state.frames & 1;
this->unk_208 = play->state.frames & 1;
}
```
and it remains to deal with the data. mips2c has told us what the types should be. We run `colliderinit` on `D_80B18910` as usual, which gives
@@ -182,7 +182,7 @@ CollisionCheckInfoInit2 D_80B1893C = { 0, 0, 0, 0, 0xFF };
One more thing needs to change: since both are no longer arrays, we need to make the uses in the functions pointers:
```C
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80B18910);
Collider_SetCylinder(play, &this->collider, &this->actor, &D_80B18910);
func_80061EFC(&this->actor.colChkInfo, NULL, &D_80B1893C);
```
@@ -190,7 +190,7 @@ A quick check of the diff shows that we just need to put the action function set
Following the function tree as usual, we find the only other place any data is used is in `func_80B1871C`. From its use in `EnTg_Draw`, we realise that this is a `PostLimbDraw` function. Giving mips2c the correct prototype, it comes out as
```C
void func_80B1871C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void func_80B1871C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
? sp18;
sp18.unk0 = (s32) D_80B18968->unk0;
@@ -207,7 +207,7 @@ Vec3f D_80B18968 = { 0.0f, 800.0f, 0.0f };
```
and the function matches as
```C
void func_80B1871C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void func_80B1871C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnTg* this = THIS;
Vec3f sp18 = D_80B18968;
+41 -41
View File
@@ -12,13 +12,13 @@ For this tutorial we will first look at the `EnJj` draw function, `EnJj_Draw`, t
Unless it is completely invisible, an actor usually has a draw function as one of the main four actor functions. Hence its prototype looks like
```C
EnJj_Draw(Actor* thisx, GlobalContext* globalCtx);
EnJj_Draw(Actor* thisx, PlayState* play);
```
As in Init, Destroy and Update, it is much more convenient to feed mips2c the fake prototype
```C
EnJj_Draw(EnJj* this, GlobalContext* globalCtx);
EnJj_Draw(EnJj* this, PlayState* play);
```
so that it fills out the struct fields from the actuar actor; we then put a
@@ -29,7 +29,7 @@ EnJj* this = THIS;
in the declarations as before. From now on, the process is rather different from the decompilation process used for the other functions. Here is the output of mips2c after sorting out the actor struct from Init, and with the arguments set back to `Actor* thisx`:
```C
void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Draw(Actor *thisx, PlayState *play) {
EnJj* this = THIS;
GraphicsContext *sp4C;
@@ -39,10 +39,10 @@ void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) {
GraphicsContext *temp_a1;
s32 temp_a0;
temp_a1 = globalCtx->state.gfxCtx;
temp_a1 = play->state.gfxCtx;
sp4C = temp_a1;
Graph_OpenDisps(&sp3C, temp_a1, (const char *) "../z_en_jj.c", 0x36F);
func_800943C8(globalCtx->state.gfxCtx);
func_800943C8(play->state.gfxCtx);
Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, (u8)1U);
Matrix_Scale(10.0f, 10.0f, 10.0f, (u8)1U);
temp_v1 = temp_a1->polyOpa.p;
@@ -51,8 +51,8 @@ void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) {
temp_a0 = *(&D_80A88CFC + (this->unk_30E * 4));
temp_v1->words.w1 = (temp_a0 & 0xFFFFFF) + gSegments[(u32) (temp_a0 * 0x10) >> 0x1C] + 0x80000000;
sp18 = this;
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, 0, 0);
Graph_CloseDisps(&sp3C, globalCtx->state.gfxCtx, (const char *) "../z_en_jj.c", 0x382);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, 0, 0);
Graph_CloseDisps(&sp3C, play->state.gfxCtx, (const char *) "../z_en_jj.c", 0x382);
}
```
@@ -131,7 +131,7 @@ OPEN_DISPS(temp_a1, "../z_en_jj.c", 879);
```
(the last argument is a line number, so should be in decimal).
The function may or may not use a temp for `globalCtx->state.gfxCtx`: you have to work it out using the diff.
The function may or may not use a temp for `play->state.gfxCtx`: you have to work it out using the diff.
Once you've replaced all the blocks and the open and close with macros, you proceed with the function as usual.
@@ -141,21 +141,21 @@ Two last things: the last argument of the matrix functions tells the compiler wh
After all that, it turns out that
```C
void EnJj_Draw(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Draw(Actor *thisx, PlayState *play) {
EnJj *this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 879);
func_800943C8(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879);
func_800943C8(play->state.gfxCtx);
Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI/41.0f)) * 10.0f) - 10.0f, 0.0f, 1);
Matrix_Scale(10.0f, 10.0f, 10.0f, 1);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80A88CFC[this->unk_30E]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, 0, 0, this);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_jj.c", 898);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_jj.c", 898);
}
```
matches apart from a couple of stack differences. This can be resolved by giving it `GlobalContext* globalCtx = globalCtx2;` at the top of the function and changing the second argument to `globalCtx2` as usual.
matches apart from a couple of stack differences. This can be resolved by giving it `PlayState* play = play2;` at the top of the function and changing the second argument to `play2` as usual.
We have enums for the last argument of the matrix functions: `0` is `MTXMODE_NEW`, `1` is `MTXMODE_APPLY`.
@@ -169,7 +169,7 @@ For more examples of graphics macros and the structure of Draw functions, we loo
The mips2c output for
```C
void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
void func_809F5A6C(Actor *thisx, PlayState *play) {
? sp60;
Gfx *sp48;
Gfx *sp38;
@@ -187,17 +187,17 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
sp60.unk0 = (s32) D_809F5E94.unk0;
sp60.unk4 = (s32) D_809F5E94.unk4;
sp60.unk8 = (s32) D_809F5E94.unk8;
temp_a1 = globalCtx->state.gfxCtx;
temp_a1 = play->state.gfxCtx;
temp_s0 = temp_a1;
Graph_OpenDisps(&sp48, temp_a1, (const char *) "../z_en_dnt_nomal.c", 0x6FE);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
temp_v0 = temp_s0->polyOpa.p;
temp_s0->polyOpa.p = temp_v0 + 8;
temp_v0->words.w0 = 0xDB060020;
temp_a0 = *(&D_809F5EA0 + (thisx->unk268 * 4));
temp_v0->words.w1 = (temp_a0 & 0xFFFFFF) + gSegments[(u32) (temp_a0 * 0x10) >> 0x1C] + 0x80000000;
sp14 = thisx;
SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4);
SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4);
Matrix_Translate(thisx->unk21C, thisx->unk220, (bitwise f32) thisx->unk224, (u8)0U);
Matrix_Scale(0.01f, 0.01f, 0.01f, (u8)1U);
temp_v0_2 = temp_s0->polyOpa.p;
@@ -213,14 +213,14 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
temp_s0->polyOpa.p = temp_v0_4 + 8;
temp_v0_4->words.w0 = 0xDA380003;
sp38 = temp_v0_4;
sp38->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716);
sp38->words.w1 = Matrix_NewMtx(play->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716);
temp_v0_5 = temp_s0->polyOpa.p;
temp_s0->polyOpa.p = temp_v0_5 + 8;
temp_v0_5->words.w1 = (u32) &D_06001B00;
temp_v0_5->words.w0 = 0xDE000000;
Graph_CloseDisps(&sp48, globalCtx->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x719);
Graph_CloseDisps(&sp48, play->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x719);
if (&func_809F49A4 == thisx->unk214) {
func_80033C30((Vec3f *) &thisx->world, (Vec3f *) &sp60, (u8)0xFFU, globalCtx);
func_80033C30((Vec3f *) &thisx->world, (Vec3f *) &sp60, (u8)0xFFU, play);
}
}
```
@@ -328,7 +328,7 @@ temp_v0_4 = temp_s0->polyOpa.p;
temp_s0->polyOpa.p = temp_v0_4 + 8;
temp_v0_4->words.w0 = 0xDA380003;
sp38 = temp_v0_4;
sp38->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716);
sp38->words.w1 = Matrix_NewMtx(play->state.gfxCtx, (char *) "../z_en_dnt_nomal.c", 0x716);
```
The macro is
```
@@ -337,7 +337,7 @@ gSPMatrix(POLY_OPA_DISP++, 0x12345678, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVI
```
and the second argument is filled by the `Matrix_NewMtx` function:
```C
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
```
Lastly,
@@ -359,7 +359,7 @@ gSPDisplayList(POLY_OPA_DISP++, D_06001B00);
Putting this all together
```C
void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
void func_809F5A6C(Actor *thisx, PlayState *play) {
EnDntNormal *this = THIS;
? sp60;
Actor *sp14;
@@ -369,26 +369,26 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
sp60.unk4 = (s32) D_809F5E94.unk4;
sp60.unk8 = (s32) D_809F5E94.unk8;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1790);
func_80093D18(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1790);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809F5EA0[this->unk_268]));
sp14 = this;
SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4);
SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, &func_809F58E4, &func_809F59E4);
Matrix_Translate(thisx->unk21C, thisx->unk220, (bitwise f32) thisx->unk224, (u8)0U);
Matrix_Scale(0.01f, 0.01f, 0.01f, (u8)1U);
gDPPipeSync(POLY_OPA_DISP++);
temp_v1 = D_809F5E4C[this->unk_26A - 1];
gDPSetEnvColor(POLY_OPA_DISP++, temp_v1.r, temp_v1.g, temp_v1.r, 0xFF);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06001B00);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1817);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1817);
if (&func_809F49A4 == this->unk214) {
func_80033C30((Vec3f *) &this.actor->world, (Vec3f *) &sp60, (u8)0xFFU, globalCtx);
func_80033C30((Vec3f *) &this.actor->world, (Vec3f *) &sp60, (u8)0xFFU, play);
}
}
```
@@ -398,23 +398,23 @@ void func_809F5A6C(Actor *thisx, GlobalContext *globalCtx) {
Some more general tidying up can be done here (`sp60` and so `D_809F5E94` are `Vec3f`, for example, and under normal circumstances we'd know that ), but the big remaining issue is
```C
sp14 = this;
SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4);
SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4);
```
If we look at the definition of `SkelAnime_DrawOpa`, we find that it's missing the last argument. This is mips2c not noticing why `this` has been put on the stack: this code should actually be
```C
SkelAnime_DrawOpa(globalCtx, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4, this);
SkelAnime_DrawOpa(play, thisx->unk150, thisx->unk16C, func_809F58E4, func_809F59E4, this);
```
mips2c doing this is not especially unusual, so bear it in mind.
The other thing this tells us is that `func_809F58E4` is of type `OverrideLimbDraw`, and `func_809F59E4` of type `PostLimbDraw`. Their names are fairly self-explanatory. Filling in the prototypes as
```C
s32 func_809F58E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx);
void func_809F59E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
s32 func_809F58E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx);
void func_809F59E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
```
and running mips2c gives
```C
s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) {
s32 func_809F58E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) {
GraphicsContext *sp38;
Gfx *sp28;
Gfx *temp_v1;
@@ -423,7 +423,7 @@ s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p
void *temp_v0;
if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) {
temp_a1 = globalCtx->state.gfxCtx;
temp_a1 = play->state.gfxCtx;
sp38 = temp_a1;
Graph_OpenDisps(&sp28, temp_a1, (const char *) "../z_en_dnt_nomal.c", 0x6C5);
temp_v1 = sp38->polyOpa.p;
@@ -435,12 +435,12 @@ s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p
temp_v1_2->words.w0 = 0xFB000000;
temp_v0 = (thisx->unk26A * 4) + &D_809F5E4C;
temp_v1_2->words.w1 = (temp_v0->unk-2 << 8) | (temp_v0->unk-4 << 0x18) | (temp_v0->unk-3 << 0x10) | 0xFF;
Graph_CloseDisps(&sp28, globalCtx->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x6CF);
Graph_CloseDisps(&sp28, play->state.gfxCtx, (const char *) "../z_en_dnt_nomal.c", 0x6CF);
}
return 0;
}
void func_809F59E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3s *rot, void *thisx) {
void func_809F59E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3s *rot, void *thisx) {
? sp18;
sp18.unk0 = (s32) D_809F5E88.unk0;
@@ -459,14 +459,14 @@ void func_809F59E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3s *
This structure is pretty typical: both edit what certain limbs do. Both also usually need a `ActorName *this = THIS;` at the top. We have seen both of the macros in the former before: applying the usual procedure, we find that it becomes
```C
s32 func_809F58E4(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) {
s32 func_809F58E4(PlayState *play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, void *thisx) {
EnDntNormal *this = THIS;
if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1733);
OPEN_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1733);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, D_809F5E4C[this->type - 1].r, D_809F5E4C[this->type - 1].g, D_809F5E4C[this->type - 1].b, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1743);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_dnt_nomal.c", 1743);
}
return 0;
}
+83 -83
View File
@@ -20,7 +20,7 @@ glabel func_80A87F44
```
This is a classic "function with two arguments that does nothing". So we can simply comment out the appropriate pragma and put
```C
void func_80A87F44(Actor* thisx, GlobalContext* globalCtx) {
void func_80A87F44(Actor* thisx, PlayState* play) {
}
```
@@ -30,16 +30,16 @@ in the C file.
Destroy will be a dead end, but we might as well do it now. Remaking the context and using mips2c on it (main 4 function, so change the prototype to use `EnJj* this`!) gives
```C
void EnJj_Destroy(EnJj *this, GlobalContext *globalCtx) {
GlobalContext *temp_a3;
void EnJj_Destroy(EnJj *this, PlayState *play) {
PlayState *temp_a3;
s16 temp_v0;
temp_v0 = this->dyna.actor.params;
temp_a3 = globalCtx;
temp_a3 = play;
if (temp_v0 == -1) {
globalCtx = temp_a3;
play = temp_a3;
DynaPoly_DeleteBgActor(temp_a3, &temp_a3->colCtx.dyna, (s32) this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
return;
}
if ((temp_v0 != 0) && (temp_v0 != 1)) {
@@ -51,15 +51,15 @@ void EnJj_Destroy(EnJj *this, GlobalContext *globalCtx) {
Again remember to return the first argument to `Actor* this` and put `EnJj* this = THIS;` in the function body. Based on what we know about this actor already, we expect this to be another switch. Rearranging it as such, and removing the likely fake `temp_v0` gives
```C
void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnJj_Destroy(Actor* thisx, PlayState* play) {
EnJj* this = THIS;
GlobalContext* temp_a3;
temp_a3 = globalCtx;
PlayState* temp_a3;
temp_a3 = play;
switch (this->dyna.actor.params) {
case -1:
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->collider);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->collider);
break;
case 0:
case 1:
@@ -70,23 +70,23 @@ void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
```
Using `./diff.py -mwo3 EnJj_Destroy` shows that this matches already, but it seems like the temp usage should be more consistent. A little experimentation shows that
```C
void EnJj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnJj_Destroy(Actor* thisx, PlayState* play) {
EnJj* this = THIS;
switch (this->dyna.actor.params) {
case -1:
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->collider);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->collider);
break;
case 0:
case 1:
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
break;
}
}
```
also matches, with no need for the `GlobalContext*` temp.
also matches, with no need for the `PlayState*` temp.
## Action Functions
@@ -94,7 +94,7 @@ also matches, with no need for the `GlobalContext*` temp.
Of the two functions we have available, `func_80A87BEC` is shorter, so we do that next. Since we haven't changed any types or header file information, there is no need to remake the context. mips2c gives
```C
void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) {
void func_80A87BEC(EnJj *this, PlayState *play) {
if (this->dyna.actor.xzDistToPlayer < 300.0f) {
func_80A87800(this, &func_80A87B9C);
}
@@ -104,10 +104,10 @@ void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) {
We see that this function just sets another action function when Link is close enough to the actor. All we have to do to this is remove the `&`, and prototype `func_80A87B9C` to be an action function. Notably, this time it is not used before it is defined, so we don't need a prototype at the top: putting a placeholder one in at the function position will do, i.e. our total edits this time are
```C
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/func_80A87B9C.s")
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx);
void func_80A87B9C(EnJj *this, PlayState *play);
// #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jj/func_80A87BEC.s")
void func_80A87BEC(EnJj *this, GlobalContext *globalCtx) {
void func_80A87BEC(EnJj *this, PlayState *play) {
if (this->dyna.actor.xzDistToPlayer < 300.0f) {
func_80A87800(this, func_80A87B9C);
}
@@ -120,14 +120,14 @@ We can now either follow this chain of action functions down, or start with the
We can remake the context, but it's simpler to just stick the function prototype we made at the bottom of the context. Either way, mips2c gives us
```C
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) {
void func_80A87B9C(EnJj *this, PlayState *play) {
s16 temp_v0;
temp_v0 = this->unk308;
if ((s32) temp_v0 >= -0x1450) {
this->unk308 = (s16) (temp_v0 - 0x66);
if ((s32) this->unk308 < -0xA28) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->unk14C);
func_8003EBF8(play, &play->colCtx.dyna, this->childActor->unk14C);
}
}
}
@@ -163,11 +163,11 @@ this->childActor = (DynaPolyActor*)Actor_SpawnAsChild(...)
Doing so, we are left with
```C
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) {
void func_80A87B9C(EnJj *this, PlayState *play) {
if (this->unk_308 >= -0x1450) {
this->unk_308 -= 0x66;
if (this->unk_308 < -0xA28) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->bgId);
func_8003EBF8(play, &play->colCtx.dyna, this->childActor->bgId);
}
}
}
@@ -204,7 +204,7 @@ The first suggestion looks plausible:
+++ after
@@ -1390,12 +1390,14 @@
} EnJj;
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx)
void func_80A87B9C(EnJj *this, PlayState *play)
{
- if (this->unk_308 >= (-0x1450))
+ DynaPolyActor *new_var;
@@ -214,8 +214,8 @@ The first suggestion looks plausible:
this->unk_308 -= 0x66;
if (this->unk_308 < (-0xA28))
{
- func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->childActor->bgId);
+ func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, new_var->bgId);
- func_8003EBF8(play, &play->colCtx.dyna, this->childActor->bgId);
+ func_8003EBF8(play, &play->colCtx.dyna, new_var->bgId);
}
}
@@ -223,13 +223,13 @@ The first suggestion looks plausible:
In particular, adding a temp for the actor. Some of the rest is rather puzzling, but let's just try the actor temp,
```C
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) {
void func_80A87B9C(EnJj *this, PlayState *play) {
DynaPolyActor* child = this->childActor;
if (this->unk_308 >= -0x1450) {
this->unk_308 -= 0x66;
if (this->unk_308 < -0xA28) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId);
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
}
}
}
@@ -241,13 +241,13 @@ Hooray, that worked. The function now matches (as you can check by running `make
However, the hex values look a bit strange, and it turns out the decimal equivalents look less strange, so it's a good idea to translate them:
```C
void func_80A87B9C(EnJj *this, GlobalContext *globalCtx) {
void func_80A87B9C(EnJj *this, PlayState *play) {
DynaPolyActor* child = this->childActor;
if (this->unk_308 >= -5200) {
this->unk_308 -= 102;
if (this->unk_308 < -2600) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId);
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
}
}
}
@@ -259,29 +259,29 @@ With that, we have reached the end of this action function chain, and now have t
Remaking the context and running mips2c on the assembly gives
```C
void func_80A87C30(EnJj *this, GlobalContext *globalCtx) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, globalCtx->unk1C44 + 0x24) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) {
void func_80A87C30(EnJj *this, PlayState *play) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, play->unk1C44 + 0x24) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) {
this->unk_30C = 0x64;
func_80A87800(this, &func_80A87CEC);
}
this->collider.dim.pos.x = -0x4DD;
this->collider.dim.pos.y = 0x14;
this->collider.dim.pos.z = -0x30;
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider *) &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, (Collider *) &this->collider);
}
```
If you know anything about this game, this is obviously the function that begins the process of the swallowing Link cutscene. Performing minor cleanups reduces us to
```C
void func_80A87C30(EnJj *this, GlobalContext *globalCtx) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, globalCtx->unk1C44 + 0x24) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) {
void func_80A87C30(EnJj *this, PlayState *play) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, play->unk1C44 + 0x24) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) {
this->unk_30C = 100;
func_80A87800(this, func_80A87CEC);
}
this->collider.dim.pos.x = -1245;
this->collider.dim.pos.y = 20;
this->collider.dim.pos.z = -48;
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider);
}
```
@@ -294,23 +294,23 @@ extern Vec3f D_80A88CF0;
```
(you must include the `.0f` parts even for integer floats: it can affect codegen, and as such it is part of our style).
- replace the mysterious `globalCtx->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = GET_PLAYER(globalCtx)` at the top of the function.
- replace the mysterious `play->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = GET_PLAYER(play)` at the top of the function.
**NOTE:** mips_to_c will now output something like `&globalCtx->actorCtx.actorLists[2].head` for the Player pointer instead: this makes a lot more sense, but is not so easy to spot in the ASM without the characteristic `1C44`.
**NOTE:** mips_to_c will now output something like `&play->actorCtx.actorLists[2].head` for the Player pointer instead: this makes a lot more sense, but is not so easy to spot in the ASM without the characteristic `1C44`.
After all this, the function becomes
```C
void func_80A87C30(EnJj *this, GlobalContext *globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80A87C30(EnJj *this, PlayState *play) {
Player* player = GET_PLAYER(play);
if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) {
this->unk_30C = 100;
func_80A87800(this, func_80A87CEC);
}
this->collider.dim.pos.x = -1245;
this->collider.dim.pos.y = 20;
this->collider.dim.pos.z = -48;
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider);
}
```
@@ -341,19 +341,19 @@ typedef struct EnJj {
} EnJj; // size = 0x0314
```
The diff now looks fine for this function, but it gives compiler warnings about `CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);`: the last argument is the wrong type: we need to give it `&this->collider.base` instead, which points to the same address, but is the right type. So the matching function is
The diff now looks fine for this function, but it gives compiler warnings about `CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider);`: the last argument is the wrong type: we need to give it `&this->collider.base` instead, which points to the same address, but is the right type. So the matching function is
```C
void func_80A87C30(EnJj *this, GlobalContext *globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80A87C30(EnJj *this, PlayState *play) {
Player* player = GET_PLAYER(play);
if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) {
if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (play->isPlayerDroppingFish(play) != 0)) {
this->unk_30C = 100;
func_80A87800(this, func_80A87CEC);
}
this->collider.dim.pos.x = -1245;
this->collider.dim.pos.y = 20;
this->collider.dim.pos.z = -48;
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
```
@@ -363,7 +363,7 @@ Again we have only one choice for our next function, namely `func_80A87CEC`.
Remaking the context and running mips2c on the assembly gives
```C
void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) {
void func_80A87CEC(EnJj *this, PlayState *play) {
DynaPolyActor *sp1C;
DynaPolyActor *temp_v1;
s16 temp_v0;
@@ -375,12 +375,12 @@ void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) {
return;
}
sp1C = temp_v1;
globalCtx = globalCtx;
play = play;
func_80A87800(this, &func_80A87EF0);
globalCtx->csCtx.segment = &D_80A88164;
play->csCtx.segment = &D_80A88164;
gSaveContext.cutsceneTrigger = (u8)1U;
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, (s32) temp_v1->bgId);
func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamId]);
func_8003EBF8(play, &play->colCtx.dyna, (s32) temp_v1->bgId);
func_8005B1A4(play->cameraPtrs[play->activeCamId]);
gSaveContext.unkEDA = (u16) (gSaveContext.unkEDA | 0x400);
func_80078884((u16)0x4802U);
}
@@ -394,9 +394,9 @@ Easy things to sort out:
- We can remove the casts from `(u8)1U` and just leave `1`.
- `globalCtx->cameraPtrs[globalCtx->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(globalCtx)`, so this line can be written as
- `play->cameraPtrs[play->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(play)`, so this line can be written as
```C
func_8005B1A4(GET_ACTIVE_CAM(globalCtx));
func_8005B1A4(GET_ACTIVE_CAM(play));
```
- `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as
@@ -408,17 +408,17 @@ gSaveContext.unkEDA |= 0x400
It remains to work out which, if any, of the temps are real. Based on our previous experience, we expect `temp_v1` to be real. `sp1C` is unused and hence unlikely to be real. `temp_v0` is only used in the short if and so probably not real. Checking the diff shows that our suspicions were correct:
```C
void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) {
void func_80A87CEC(EnJj *this, PlayState *play) {
DynaPolyActor *child = this->childActor;
if (this->unk_30C > 0) {
this->unk_30C--;
return;
}
func_80A87800(this, func_80A87EF0);
globalCtx->csCtx.segment = &D_80A88164;
play->csCtx.segment = &D_80A88164;
gSaveContext.cutsceneTrigger = 1;
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(globalCtx));
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(play));
gSaveContext.eventChkInf[3] |= 0x400;
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
@@ -428,16 +428,16 @@ matches, but generates a complier warning for `func_8005B1A4`, which it can't fi
Lastly, we prefer to limit use of early `return`s, and use `else`s instead if possible. That applies here: the function can be rewritten as
```C
void func_80A87CEC(EnJj* this, GlobalContext* globalCtx) {
void func_80A87CEC(EnJj* this, PlayState* play) {
DynaPolyActor* child = this->childActor;
if (this->unk_30C > 0) {
this->unk_30C--;
} else {
func_80A87800(this, func_80A87EF0);
globalCtx->csCtx.segment = &D_80A88164;
play->csCtx.segment = &D_80A88164;
gSaveContext.cutsceneTrigger = 1;
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(globalCtx));
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(play));
gSaveContext.eventChkInf[3] |= 0x400;
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
@@ -450,7 +450,7 @@ and still match. (Early `return`s are used after an `Actor_Kill` and in a few ot
mips2c with updated context gives
```C
void func_80A87EF0(EnJj *this, GlobalContext *globalCtx) {
void func_80A87EF0(EnJj *this, PlayState *play) {
char *temp_a0;
u16 temp_v0;
@@ -475,7 +475,7 @@ lhu $v0, 0x030A($a0)
```
which at last tells us that `unk_30A` is actually a `u16`. We can now eliminate `temp_v0`, and replace the ` == 0` by a `!(...)`, which leaves
```C
void func_80A87EF0(EnJj *this, GlobalContext *globalCtx) {
void func_80A87EF0(EnJj *this, PlayState *play) {
Actor *temp_a0;
if (!(this->unk_30A & 4)) {
@@ -496,8 +496,8 @@ Again we have run out of action functions. The rules suggest that we now look at
Update runs every frame and updates the properties of the actor, and usually runs the action functions once per frame. As before we change the first argument to `EnJj* this` to get it to use our actor's struct. mips2c gives
```C
void EnJj_Update(EnJj *this, GlobalContext *globalCtx) {
if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->unk1D94 != 0)) {
void EnJj_Update(EnJj *this, PlayState *play) {
if ((play->csCtx.state != CS_STATE_IDLE) && (play->unk1D94 != 0)) {
func_80A87D94();
} else {
this->actionFunc(this);
@@ -512,19 +512,19 @@ void EnJj_Update(EnJj *this, GlobalContext *globalCtx) {
}
```
This has several problems: firstly, the action function is called with the wrong argument. We should thus be suspicious of previous functions this actor calls, and decompile them mith mips2c without context if necessary, if only to find out how many arguments they have. We find that `func_80A87D94` definitely takes `EnJj* this, GlobalContext* globalCtx` as arguments. Again, put this prototype at the function location above to avoid compiler warnings.
This has several problems: firstly, the action function is called with the wrong argument. We should thus be suspicious of previous functions this actor calls, and decompile them mith mips2c without context if necessary, if only to find out how many arguments they have. We find that `func_80A87D94` definitely takes `EnJj* this, PlayState* play` as arguments. Again, put this prototype at the function location above to avoid compiler warnings.
`unk40` of an array of `Vec3s`s is `0x40 = 0x6 * 0xA + 0x4`, so is actually `this->skelAnime.jointTable[10].z`
Lastly, what is `globalCtx->unk1D94`? It is at `globalCtx->csCtx + 0x30`, or `globalCtx->csCtx.npcActions + 0x8`, which is `globalCtx->csCtx.npcActions[2]` since this is an array of pointers. Hence it is a pointer, and so should be compared to `NULL`. Looking up the sfx Id again, we end up with
Lastly, what is `play->unk1D94`? It is at `play->csCtx + 0x30`, or `play->csCtx.npcActions + 0x8`, which is `play->csCtx.npcActions[2]` since this is an array of pointers. Hence it is a pointer, and so should be compared to `NULL`. Looking up the sfx Id again, we end up with
```C
void EnJj_Update(Actor *thisx, GlobalContext *globalCtx) {
void EnJj_Update(Actor *thisx, PlayState *play) {
EnJj* this = THIS;
if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[2] != NULL)) {
func_80A87D94(this, globalCtx);
if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[2] != NULL)) {
func_80A87D94(this, play);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->skelAnime.curFrame == 41.0f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN);
}
@@ -631,7 +631,7 @@ You will also find that the permuter is essentially useless here: most solutions
This is our last ordinary function. Unfortunately, even with new context, mips2c gives us a bit of a mess:
```C
void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
void func_80A87D94(EnJj *this, PlayState *play) {
s16 temp_v0_2;
u16 temp_t1;
u16 temp_t4;
@@ -643,7 +643,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
u16 temp_v1_3;
u16 phi_v1;
temp_v0 = *globalCtx->unk1D94;
temp_v0 = *play->unk1D94;
if (temp_v0 != 1) {
if (temp_v0 != 2) {
if (temp_v0 != 3) {
@@ -667,7 +667,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
this->unk_30A = temp_t1;
phi_v1 = temp_v1_2;
if ((temp_v1_2 & 8) == 0) {
this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, (Actor *) this, globalCtx, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0);
this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, (Actor *) this, play, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0);
temp_t4 = this->unk_30A | 8;
this->unk_30A = temp_t4;
phi_v1 = temp_t4 & 0xFFFF;
@@ -698,16 +698,16 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
At the top we have
```C
temp_v0 = *globalCtx->unk1D94;
temp_v0 = *play->unk1D94;
if (temp_v0 != 1) {
if (temp_v0 != 2) {
if (temp_v0 != 3) {
```
Firstly, we are now comparing with the value of `globalCtx->unk1D94`, not just using a pointer, so we need the first thing in `globalCtx->csCtx.npcActions[2]`. This turns out to be `globalCtx->csCtx.npcActions[2]->action`.
Firstly, we are now comparing with the value of `play->unk1D94`, not just using a pointer, so we need the first thing in `play->csCtx.npcActions[2]`. This turns out to be `play->csCtx.npcActions[2]->action`.
The if structure here is another classic indicator of a switch: nested, with the same variable compared multiple times. If you were to diff this as-is, you would find that the code is in completely the wrong order. Reading how the ifs work, we see that if `temp_v0` is `1`, it executes the outermost else block, if it is `2`, the middle, if `3`, the innermost, and if it is anything else, the contents of the innermost if. Hence this becomes
```C
void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
void func_80A87D94(EnJj *this, PlayState *play) {
s16 temp_v0_2;
u16 temp_t1;
u16 temp_t4;
@@ -719,7 +719,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
u16 temp_v1_3;
u16 phi_v1;
switch (globalCtx->csCtx.npcActions[2]->action) {
switch (play->csCtx.npcActions[2]->action) {
case 1:
temp_v1_3 = this->unk_30A;
phi_v1 = temp_v1_3;
@@ -739,7 +739,7 @@ void func_80A87D94(EnJj *this, GlobalContext *globalCtx) {
this->unk_30A = temp_t1;
phi_v1 = temp_v1_2;
if ((temp_v1_2 & 8) == 0) {
this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, (Actor *) this, globalCtx, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0);
this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, (Actor *) this, play, (u16)0x101, -1100.0f, 105.0f, -27.0f, 0, 0, 0, 0);
temp_t4 = this->unk_30A | 8;
this->unk_30A = temp_t4;
phi_v1 = temp_t4 & 0xFFFF;
@@ -784,8 +784,8 @@ As usual, most of the remaining temps look fake. The only one that does not is p
</summary>
```C
void func_80A87D94(EnJj* this, GlobalContext* globalCtx) {
switch (globalCtx->csCtx.npcActions[2]->action) {
void func_80A87D94(EnJj* this, PlayState* play) {
switch (play->csCtx.npcActions[2]->action) {
case 1:
if ((this->unk_30A & 2) != 0) {
this->unk_30E = 0;
@@ -798,7 +798,7 @@ void func_80A87D94(EnJj* this, GlobalContext* globalCtx) {
case 2:
this->unk_30A |= 1;
if ((this->unk_30A & 8) == 0) {
this->unk_304 = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EFF_DUST,
this->unk_304 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST,
-1100.0f, 105.0f, -27.0f, 0, 0, 0, 0);
this->unk_30A |= 8;
}
+1 -1
View File
@@ -29,7 +29,7 @@ Useful data for guessing types:
Another useful thing to put here: the prototype for an action function is
```C
typedef void (*ActorNameActionFunc)(struct ActorName*, GlobalContext*);
typedef void (*ActorNameActionFunc)(struct ActorName*, PlayState*);
```
where you replace `ActorName` by the actual actor name as used elsewhere in the actor, e.g. `EnJj`.
+540 -540
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -20,9 +20,9 @@
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamId])
#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
#define LINK_IS_ADULT (gSaveContext.linkAge == LINK_AGE_ADULT)
#define LINK_IS_CHILD (gSaveContext.linkAge == LINK_AGE_CHILD)
+1 -1
View File
@@ -91,7 +91,7 @@ extern u32 gGsFlagsMasks[4];
extern u32 gGsFlagsShifts[4];
extern void* gItemIcons[0x82];
extern u8 gItemSlots[56];
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*);
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*);
extern s16 gLinkObjectIds[2];
extern u32 gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];
+11 -12
View File
@@ -1177,8 +1177,7 @@ typedef struct {
/* 0x04 */ TransitionActorEntry* list;
} TransitionActorContext;
// Global Context (dbg ram start: 80212020)
typedef struct GlobalContext {
typedef struct PlayState {
/* 0x00000 */ GameState state;
/* 0x000A4 */ s16 sceneNum;
/* 0x000A6 */ u8 sceneConfig;
@@ -1208,15 +1207,15 @@ typedef struct GlobalContext {
/* 0x117A4 */ ObjectContext objectCtx;
/* 0x11CBC */ RoomContext roomCtx;
/* 0x11D34 */ TransitionActorContext transiActorCtx;
/* 0x11D3C */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader);
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input);
/* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct GlobalContext* globalCtx);
/* 0x11D48 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx);
/* 0x11D4C */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player);
/* 0x11D50 */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Actor* actor, s32 mode);
/* 0x11D54 */ void (*func_11D54)(Player* player, struct GlobalContext* globalCtx);
/* 0x11D58 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage);
/* 0x11D5C */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor);
/* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
/* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play);
/* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
/* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
/* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 mode);
/* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play);
/* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage);
/* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor);
/* 0x11D60 */ MtxF viewProjectionMtxF;
/* 0x11DA0 */ MtxF billboardMtxF;
/* 0x11DE0 */ Mtx* billboardMtx;
@@ -1257,7 +1256,7 @@ typedef struct GlobalContext {
/* 0x1242B */ u8 unk_1242B;
/* 0x1242C */ SceneTableEntry* loadedScene;
/* 0x12430 */ char unk_12430[0xE8];
} GlobalContext; // size = 0x12518
} PlayState; // size = 0x12518
typedef struct {
/* 0x0000 */ GameState state;
+7 -7
View File
@@ -13,13 +13,13 @@
#define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass.
struct Actor;
struct GlobalContext;
struct PlayState;
struct Lights;
typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*);
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct GlobalContext*);
typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*);
typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*);
typedef void (*ActorFunc)(struct Actor*, struct PlayState*);
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*);
typedef u16 (*callback1_800343CC)(struct PlayState*, struct Actor*);
typedef s16 (*callback2_800343CC)(struct PlayState*, struct Actor*);
typedef struct {
Vec3f pos;
@@ -272,7 +272,7 @@ typedef enum {
struct EnItem00;
typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*);
typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct PlayState*);
typedef struct EnItem00 {
/* 0x000 */ Actor actor;
@@ -306,7 +306,7 @@ typedef enum {
struct EnAObj;
typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*);
typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*);
typedef struct EnAObj {
/* 0x000 */ DynaPolyActor dyna;
+6 -6
View File
@@ -5,7 +5,7 @@
#include "z64dma.h"
#include "z64math.h"
struct GlobalContext;
struct PlayState;
struct Actor;
struct SkelAnime;
@@ -106,15 +106,15 @@ typedef struct {
/* 0x08 */ JointKey* jointKey;
} LegacyAnimationHeader; // size = 0xC
typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void*);
typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*);
typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*);
typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void*, Gfx** gfx);
typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx);
typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx);
typedef enum {
ANIMENTRY_LOADFRAME,
@@ -187,7 +187,7 @@ typedef struct AnimationContext {
AnimationEntry entries[ANIMATION_ENTRY_MAX];
} AnimationContext; // size = 0xC84
typedef void (*AnimationEntryCallback)(struct GlobalContext* globalCtx, AnimationEntryData* data);
typedef void (*AnimationEntryCallback)(struct PlayState* play, AnimationEntryData* data);
typedef s32 (*AnimUpdateFunc)();
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef Z_BGCHECK_H
#define Z_BGCHECK_H
struct GlobalContext;
struct PlayState;
struct Actor;
struct DynaPolyActor;
@@ -165,7 +165,7 @@ typedef struct CollisionContext {
} CollisionContext; // size = 0x1464
typedef struct {
/* 0x00 */ struct GlobalContext* globalCtx;
/* 0x00 */ struct PlayState* play;
/* 0x04 */ struct CollisionContext* colCtx;
/* 0x08 */ u16 xpFlags;
/* 0x0C */ CollisionPoly** resultPoly;
+4 -4
View File
@@ -16,7 +16,7 @@
#define NUM_CAMS 4
// Camera IDs are indices into `GlobalContext.cameraPtrs`
// Camera IDs are indices into `PlayState.cameraPtrs`
#define CAM_ID_MAIN 0 // The index of the main camera
#define CAM_ID_SUB_FIRST 1 // The index sub cameras start at
#define CAM_ID_NONE -1 // Used to indicate no camera. Can be used to default to the active camera in some scenarios
@@ -24,8 +24,8 @@
#define SUB_CAM_ID_DONE 0 // Used in some actors for variables holding sub camera IDs to indicate "subcam is finished"
#define ONEPOINT_CS_INFO(camera) (&camera->paramData.uniq9.csInfo)
#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamId])
#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamId])
#define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamId])
#define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamId])
typedef enum {
/* 0x00 */ CAM_SET_NONE,
@@ -1342,7 +1342,7 @@ typedef struct {
/* 0x068 */ Vec3f up;
/* 0x074 */ Vec3f eyeNext;
/* 0x080 */ Vec3f skyboxOffset;
/* 0x08C */ struct GlobalContext* globalCtx;
/* 0x08C */ struct PlayState* play;
/* 0x090 */ struct Player* player;
/* 0x094 */ PosRot playerPosRot;
/* 0x0A8 */ struct Actor* target;
+7 -7
View File
@@ -4,7 +4,7 @@
#include "ultra64/types.h"
#include "z64math.h"
struct GlobalContext;
struct PlayState;
typedef struct {
/* 0x0 */ u16 flags; // Only the bottom two bits are used, although others are set in objects
@@ -44,19 +44,19 @@ typedef struct {
/* 0x1C */ s16 (*jointTable)[9];
} SkelCurve; // size = 0x20
typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, void* thisx);
typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, void* thisx);
typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, void* thisx);
typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, void* thisx);
f32 Curve_Interpolate(f32 x, CurveInterpKnot* transData, s32 refIdx);
void SkelCurve_Clear(SkelCurve* skelCurve);
s32 SkelCurve_Init(struct GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* limbListSeg, CurveAnimationHeader* transUpdIdx);
void SkelCurve_Destroy(struct GlobalContext* globalCtx, SkelCurve* skelCurve);
s32 SkelCurve_Init(struct PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* limbListSeg, CurveAnimationHeader* transUpdIdx);
void SkelCurve_Destroy(struct PlayState* play, SkelCurve* skelCurve);
void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* transUpdIdx, f32 arg2, f32 endFrame, f32 curFrame, f32 playSpeed);
s32 SkelCurve_Update(struct GlobalContext* globalCtx, SkelCurve* skelCurve);
void SkelCurve_Draw(Actor* actor, struct GlobalContext* globalCtx, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* thisx);
s32 SkelCurve_Update(struct PlayState* play, SkelCurve* skelCurve);
void SkelCurve_Draw(Actor* actor, struct PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* thisx);
// ZAPD compatibility typedefs
+5 -5
View File
@@ -4,7 +4,7 @@
#include "color.h"
struct GraphicsContext;
struct GlobalContext;
struct PlayState;
/* Effects */
@@ -158,7 +158,7 @@ typedef struct {
} EffectShieldParticle; // size = 0x1C8
typedef struct {
/* 0x0000 */ struct GlobalContext* globalCtx;
/* 0x0000 */ struct PlayState* play;
struct {
EffectStatus status;
EffectSpark effect;
@@ -192,9 +192,9 @@ typedef enum {
struct EffectSs;
typedef u32 (*EffectSsInitFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs, void* initParams);
typedef void (*EffectSsUpdateFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs);
typedef void (*EffectSsDrawFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs);
typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs, void* initParams);
typedef void (*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs);
typedef void (*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs);
typedef struct {
/* 0x00 */ u32 type;
+3 -3
View File
@@ -458,9 +458,9 @@ typedef struct {
#define PLAYER_STATE3_6 (1 << 6)
#define PLAYER_STATE3_7 (1 << 7)
typedef void (*PlayerFunc674)(struct Player*, struct GlobalContext*);
typedef s32 (*PlayerFunc82C)(struct Player*, struct GlobalContext*);
typedef void (*PlayerFuncA74)(struct GlobalContext*, struct Player*);
typedef void (*PlayerFunc674)(struct Player*, struct PlayState*);
typedef s32 (*PlayerFunc82C)(struct Player*, struct PlayState*);
typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*);
typedef struct Player {
/* 0x0000 */ Actor actor;
+2 -2
View File
@@ -74,8 +74,8 @@ typedef struct {
/* 0x04C */ SkelAnime skelAnime;
} Skin; // size = 0x90
typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*);
typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*);
typedef void (*SkinPostDraw)(struct Actor*, struct PlayState*, Skin*);
typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct PlayState*, s32, Skin*);
#define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0)
#define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1)
+3 -3
View File
@@ -76,7 +76,7 @@ s32 func_800435B4(DynaPolyActor* dynaActor) {
}
}
s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) {
s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) {
Vec3f posA;
Vec3f posB;
Vec3f posResult;
@@ -98,7 +98,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2,
posB.y = posA.y;
posB.z = sign * a3 * cos + posA.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
&dynaActor->actor, 0.0f)) {
return false;
}
@@ -106,7 +106,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2,
posA.z = (dynaActor->actor.world.pos.z * 2) - posA.z;
posB.x = sign * a3 * sin + posA.x;
posB.z = sign * a3 * cos + posA.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
&dynaActor->actor, 0.0f)) {
return false;
}
+9 -9
View File
@@ -1,33 +1,33 @@
#include "global.h"
void Flags_UnsetAllEnv(GlobalContext* globalCtx) {
void Flags_UnsetAllEnv(PlayState* play) {
u8 i;
for (i = 0; i < ARRAY_COUNT(globalCtx->envFlags); i++) {
globalCtx->envFlags[i] = 0;
for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) {
play->envFlags[i] = 0;
}
}
void Flags_SetEnv(GlobalContext* globalCtx, s16 flag) {
void Flags_SetEnv(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
globalCtx->envFlags[index] |= mask;
play->envFlags[index] |= mask;
}
void Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag) {
void Flags_UnsetEnv(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = (1 << bit) ^ 0xFFFF;
globalCtx->envFlags[index] &= mask;
play->envFlags[index] &= mask;
}
s32 Flags_GetEnv(GlobalContext* globalCtx, s16 flag) {
s32 Flags_GetEnv(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
return globalCtx->envFlags[index] & mask;
return play->envFlags[index] & mask;
}
+4 -4
View File
@@ -229,8 +229,8 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) {
gSaveContext.equips.equipment |= value << gEquipShifts[equipment];
}
u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
Player* player = GET_PLAYER(globalCtx);
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
Player* player = GET_PLAYER(play);
s32 pad;
u16 equipValue = gSaveContext.equips.equipment & gEquipMasks[equipment];
@@ -252,8 +252,8 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
gSaveContext.infTable[INFTABLE_1DX_INDEX] = 1;
}
Player_SetEquipmentData(globalCtx, player);
globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
Player_SetEquipmentData(play, player);
play->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
}
return equipValue;
+101 -101
View File
@@ -1,7 +1,7 @@
#include "ultra64.h"
#include "global.h"
static GlobalContext* sGlobalCtx;
static PlayState* sPlay;
// TODO: cleanup these arrays and UB access
char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" };
@@ -346,7 +346,7 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
void func_800B44E0(DbCamera* dbCamera, Camera* cam) {
s32 i;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) {
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_0A = 1;
sDbCamAnim.curFrame = 0.0f;
@@ -522,7 +522,7 @@ void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr) {
dbCamera->sub.unk_104A.x = dbCamera->sub.unk_104A.z;
dbCamera->fov = 0.0f;
dbCamera->rollDegrees = 0.0f;
sGlobalCtx = cameraPtr->globalCtx;
sPlay = cameraPtr->play;
dbCamera->sub.mode = 0;
dbCamera->sub.nFrames = -1;
dbCamera->sub.nPoints = 1;
@@ -597,7 +597,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
sp80 = &dbCamera->eye;
sp7C = &dbCamera->at;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_Z)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_Z)) {
dbCamera->unk_00++;
dbCamera->unk_00 %= 3;
dbCamera->unk_38 = 1;
@@ -688,7 +688,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
dbCamera->unk_3C = D_80161140;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B | BTN_L)) {
sp104.r += temp_f2;
if (sp104.r > 30000.0f) {
@@ -702,7 +702,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
dbCamera->unk_40 = 7;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B)) {
spFC = sp104;
spFC.r = temp_f2;
if (!D_80161144) {
@@ -719,7 +719,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 0xB;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A | BTN_L)) {
sp104.r -= temp_f2;
if (sp104.r < 10.0f) {
sp104.r = 10.0f;
@@ -730,7 +730,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 8;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A)) {
spFC = sp104;
spFC.r = -temp_f2;
if (!D_80161144) {
@@ -752,7 +752,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_40 = -1;
}
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DDOWN | BTN_L)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@@ -770,7 +770,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 1;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DUP | BTN_L)) {
spFC = sp104;
spFC.r = -temp_f2;
spFC.pitch = 0;
@@ -787,7 +787,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 2;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DUP)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0x3FFF;
@@ -803,7 +803,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 3;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DDOWN)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = -0x3FFF;
@@ -819,8 +819,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 4;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) ||
CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DRIGHT)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@@ -837,8 +837,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 5;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) ||
CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DLEFT)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@@ -855,7 +855,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 6;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B | BTN_L)) {
sp104.r = sp104.r + temp_f2;
if (sp104.r > 30000.0f) {
sp104.r = 30000.0f;
@@ -866,7 +866,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 7;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_B)) {
spFC = sp104;
spFC.r = temp_f2;
if (!D_80161144) {
@@ -883,7 +883,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 0xB;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A | BTN_L)) {
sp104.r -= temp_f2;
if (sp104.r < 10.0f) {
@@ -895,7 +895,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 8;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_A)) {
spFC = sp104;
spFC.r = -temp_f2;
if (!D_80161144) {
@@ -917,7 +917,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_40 = -1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_R)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_R)) {
if (dbCamera->unk_00 == 0) {
dbCamera->sub.unk_104A = cam->inputDir;
*sp7C = cam->at;
@@ -932,13 +932,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
func_800B41DC(dbCamera, dbCamera->sub.unkIdx, cam);
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R) &&
CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.nPoints = dbCamera->sub.unkIdx + 1;
func_800B4088(dbCamera, cam);
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R)) {
if (dbCamera->sub.unkIdx == 0x80) {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -955,8 +955,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
} else {
temp_f0_5 = sGlobalCtx->state.input[2].rel.stick_y;
temp_f2_2 = sGlobalCtx->state.input[2].rel.stick_x;
temp_f0_5 = sPlay->state.input[2].rel.stick_y;
temp_f2_2 = sPlay->state.input[2].rel.stick_x;
pitch = CAM_DEG_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f);
yaw = CAM_DEG_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f);
if (!D_80161144) {
@@ -977,7 +977,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw,
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
if (dbCamera->unk_00 == 1) {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_CRIGHT)) {
cam->inputDir = dbCamera->sub.unk_104A;
new_var2 = OLib_Vec3fDist(&cam->at, &cam->eye);
cam->at = *sp7C;
@@ -991,12 +991,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
if (dbCamera->unk_00 == 1) {
OREG(0) = 8;
func_8006376C(0xC, 5, 0, D_8012CEF4);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT) &&
!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_CRIGHT) &&
!CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
func_800B44E0(dbCamera, cam);
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT) &&
CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** start here *** */\n@@@\n");
@@ -1006,14 +1006,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", dbCamera->sub.nFrames);
osSyncPrintf("@@@static short Mode = %d;\n@@@\n", dbCamera->sub.mode);
osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** finish! *** */\n@@@\n");
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.unk_08 = (dbCamera->sub.unk_08 + 1) % 3;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP) &&
CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unkIdx > 0) {
@@ -1022,7 +1022,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unkIdx = dbCamera->sub.nPoints - 1;
}
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unkIdx > 0) {
@@ -1043,8 +1043,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) {
@@ -1053,7 +1053,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unkIdx = 0;
}
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) {
@@ -1123,7 +1123,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
break;
case 1:
dbCamera->unk_3C = true;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unk_0A == 0) {
@@ -1132,7 +1132,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0A--;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.unk_0A == 5) {
@@ -1141,12 +1141,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0A++;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
switch (dbCamera->sub.unk_0A) {
case 1:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame -= 5;
} else {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame--;
@@ -1178,7 +1178,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0C = false;
break;
case 2:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll -= 5;
dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll;
} else {
@@ -1190,7 +1190,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DLEFT)) {
if ((D_8012D10C++ % 5) == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
@@ -1199,7 +1199,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
switch (dbCamera->sub.unk_0A) {
case 0:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle -= 1.0f;
dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle;
} else {
@@ -1208,7 +1208,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
break;
case 5:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.nFrames -= 10;
} else {
dbCamera->sub.nFrames--;
@@ -1230,13 +1230,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
switch (dbCamera->sub.unk_0A) {
case 1:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame += 5;
} else {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame++;
@@ -1267,7 +1267,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0C = true;
break;
case 2:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll += 5;
dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll;
} else {
@@ -1278,7 +1278,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
break;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_DRIGHT)) {
if ((D_8012D10C++ % 5) == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
@@ -1287,7 +1287,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
switch (dbCamera->sub.unk_0A) {
case 0:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle += 1.0f;
dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle;
} else {
@@ -1296,7 +1296,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
break;
case 5:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.nFrames += 10;
} else {
dbCamera->sub.nFrames++;
@@ -1398,11 +1398,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f,
0xFF, 0xFF, 0x7F, 0x40, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0xFF, 0x7F, 0x40, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f,
0x7F, 0xFF, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0xFF, 0x40, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f,
0xFF, 0x7F, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0xFF, 0x40, 0, cam->play->view.gfxCtx);
if (dbCamera->sub.unk_08 == 2) {
for (i = 0; i < (dbCamera->sub.nPoints - 1); i++) {
if (dbCamera->sub.mode != 1) {
@@ -1416,14 +1416,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6;
if (i == dbCamera->sub.unkIdx) {
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
0x7F, 0xFF, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f,
1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
} else {
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
0xFF, 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f,
1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
}
}
}
@@ -1433,7 +1433,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->roll = 0;
dbCamera->fov = 60.0f;
dbCamera->rollDegrees = dbCamera->roll * 1.40625f;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->unk_78 = (dbCamera->unk_78 + 1) % 3;
@@ -1482,18 +1482,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF,
0xFF, 0x7F, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F,
0xFF, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0xFF, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, 0xFF,
0x7F, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(cam->eye.x, cam->eye.y, cam->eye.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, .5f, 0xFF,
0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF,
0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at);
DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f,
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->globalCtx->view.gfxCtx);
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx);
}
}
@@ -1862,8 +1862,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
case DEMO_CTRL_MENU(ACTION_LOAD, MENU_INFO):
case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_INFO): {
if ((1 << sCurFileIdx) & sMempakFiles) {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT) ||
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
@@ -1876,7 +1876,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x11, 8, dbCamera->sub.demoCtrlToggleSwitch ? 4 : 7, D_8012CF94);
func_8006376C(0x15, 8, dbCamera->sub.demoCtrlToggleSwitch ? 7 : 4, D_8012CF98);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) {
if (dbCamera->sub.demoCtrlToggleSwitch == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -1898,7 +1898,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0xD, 9, dbCamera->sub.demoCtrlToggleSwitch ? 1 : 6, "PRESS B BUTTON");
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlMenu = 0;
@@ -1934,8 +1934,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (dbCamera->sub.demoCtrlMenu == DEMO_CTRL_MENU(ACTION_LOAD, MENU_SUCCESS)) {
@@ -1957,8 +1957,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlMenu -= 9;
@@ -1993,7 +1993,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sp74[i * 2 + 0] = '-';
sp74[i * 2 + 1] = '\0';
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (sCurFileIdx >= 4) {
@@ -2010,7 +2010,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.demoCtrlActionIdx = ACTION_SAVE;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (sCurFileIdx <= 0) {
@@ -2053,24 +2053,24 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0xD, 0x1A, 5, D_8012CF60[0]);
func_8006376C(0x14, 0x1A, 5, D_8012CF70);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlToggleSwitch = 0;
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(dbCamera->sub.demoCtrlActionIdx, MENU_INFO);
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlActionIdx = ACTION_E;
@@ -2080,9 +2080,9 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
} else {
func_8006376C(0xC, 0x1A, 4, D_8012CF60[0]);
func_8006376C(0x13, 0x1A, 4, D_8012CF80);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B) ||
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP) ||
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -2096,14 +2096,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
break;
default: {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u;
sCurFileIdx = 0;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO);
@@ -2117,7 +2117,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(4, 7, 5, D_8012CF4C);
func_8006376C(D_8016110C * 2 + 6, 7, 7, ">");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CUP)) {
if (D_8016110C > 0) {
D_8016110C--;
}
@@ -2125,7 +2125,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CDOWN)) {
if (D_8016110C < 14) {
D_8016110C++;
}
@@ -2133,7 +2133,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) {
sDbCamAnim.unk_0A = 0;
Interface_ChangeAlpha(2);
ShrinkWindow_SetVal(0);
@@ -2153,7 +2153,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
return 2;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[1].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[1].press.button, BTN_CRIGHT)) {
D_8015FCC8 = 0;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
@@ -2167,7 +2167,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_L)) {
if (sp74[sCurFileIdx] == '?') {
sLastFileIdx = -1;
D_801612EA = '*';
@@ -2176,7 +2176,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
D_801612EA = sDbCameraCuts[idx1].letter;
}
if (1) {}
} else if (!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
} else if (!CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L)) {
if (sLastFileIdx != -1) {
switch (sp74[sCurFileIdx]) {
case '?':
@@ -2218,7 +2218,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sLastFileIdx = -1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_A)) {
if (sp74[sCurFileIdx] == '?') {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -2229,7 +2229,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_B)) {
if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -2238,7 +2238,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_R)) {
if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@@ -2262,7 +2262,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (sCurFileIdx == 0x1E) {
@@ -2271,22 +2271,22 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sCurFileIdx++;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sCurFileIdx = (sCurFileIdx == 0) ? 0x1E : sCurFileIdx - 1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) {
for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) {
osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDbCameraCuts[i].letter,
sDbCameraCuts[i].position, sDbCameraCuts[i].lookAt, sDbCameraCuts[i].nFrames,
sDbCameraCuts[i].nPoints, sDbCameraCuts[i].mode);
}
DbCamera_PrintAllCuts(cam);
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) {
@@ -2295,7 +2295,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
DbCamera_PrintCutBytes(&sDbCameraCuts[i]);
}
}
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CRIGHT)) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0.0f;
+4 -4
View File
@@ -1,6 +1,6 @@
#include "global.h"
void FlagSet_Update(GlobalContext* globalCtx) {
void FlagSet_Update(PlayState* play) {
static s32 entryIdx = 0;
static u32 curBit = 0;
static s32 timer = 0;
@@ -35,8 +35,8 @@ void FlagSet_Update(GlobalContext* globalCtx) {
{ &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" },
};
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Input* input = &globalCtx->state.input[0];
GraphicsContext* gfxCtx = play->state.gfxCtx;
Input* input = &play->state.input[0];
Gfx* gfx;
Gfx* polyOpa;
@@ -145,7 +145,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
globalCtx->pauseCtx.debugState = 0;
play->pauseCtx.debugState = 0;
}
CLOSE_DISPS(gfxCtx, "../flg_set.c", 241);
+2 -2
View File
@@ -2147,8 +2147,8 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
return false;
}
void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph) {
void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
}
void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl) {
void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) {
}
+532 -541
View File
File diff suppressed because it is too large Load Diff
+91 -96
View File
@@ -93,7 +93,7 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16*
/**
* Initialize DynaSSNodeList
*/
void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeList) {
void DynaSSNodeList_Initialize(PlayState* play, DynaSSNodeList* nodeList) {
nodeList->tbl = NULL;
nodeList->count = 0;
}
@@ -101,8 +101,8 @@ void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeLis
/**
* Initialize DynaSSNodeList tbl
*/
void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* nodeList, s32 max) {
nodeList->tbl = THA_AllocEndAlign(&globalCtx->state.tha, max * sizeof(SSNode), -2);
void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* nodeList, s32 max) {
nodeList->tbl = THA_AllocEndAlign(&play->state.tha, max * sizeof(SSNode), -2);
ASSERT(nodeList->tbl != NULL, "psst->tbl != NULL", "../z_bgcheck.c", 1811);
@@ -1344,7 +1344,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol
* Initialize StaticLookup Table
* returns size of table, in bytes
*/
u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) {
u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) {
Vec3s* vtxList;
CollisionPoly* polyList;
s32 polyMax;
@@ -1428,7 +1428,7 @@ u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* glob
/**
* Is current scene a SPOT scene
*/
s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) {
s32 BgCheck_IsSpotScene(PlayState* play) {
static s16 spotScenes[] = {
SCENE_SPOT00, SCENE_SPOT01, SCENE_SPOT02, SCENE_SPOT03, SCENE_SPOT04, SCENE_SPOT05, SCENE_SPOT06,
SCENE_SPOT07, SCENE_SPOT08, SCENE_SPOT09, SCENE_SPOT10, SCENE_SPOT11, SCENE_SPOT12, SCENE_SPOT13,
@@ -1437,7 +1437,7 @@ s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) {
s16* i;
for (i = spotScenes; i < spotScenes + ARRAY_COUNT(spotScenes); i++) {
if (globalCtx->sceneNum == *i) {
if (play->sceneNum == *i) {
return true;
}
}
@@ -1491,7 +1491,7 @@ typedef struct {
/**
* Allocate CollisionContext
*/
void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) {
void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) {
static BgCheckSceneSubdivisionEntry sceneSubdivisionList[] = {
{ SCENE_HAKADAN, { 23, 7, 14 }, -1 },
{ SCENE_BMORI1, { 38, 1, 38 }, -1 },
@@ -1512,7 +1512,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
osSyncPrintf("/*---------------- BGCheck バッファーメモリサイズ -------------*/\n");
if (YREG(15) == 0x10 || YREG(15) == 0x20 || YREG(15) == 0x30 || YREG(15) == 0x40) {
if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
if (play->sceneNum == SCENE_MALON_STABLE) {
// "/* BGCheck LonLon Size %dbyte */\n"
osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520);
colCtx->memSize = 0x3520;
@@ -1527,7 +1527,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->subdivAmount.x = 2;
colCtx->subdivAmount.y = 2;
colCtx->subdivAmount.z = 2;
} else if (BgCheck_IsSpotScene(globalCtx) == true) {
} else if (BgCheck_IsSpotScene(play) == true) {
colCtx->memSize = 0xF000;
// "/* BGCheck Spot Size %dbyte */\n"
osSyncPrintf("/* BGCheck Spot用サイズ %dbyte */\n", 0xF000);
@@ -1538,7 +1538,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->subdivAmount.y = 4;
colCtx->subdivAmount.z = 16;
} else {
if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) {
if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) {
colCtx->memSize = customMemSize;
} else {
colCtx->memSize = 0x1CC00;
@@ -1551,7 +1551,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
useCustomSubdivisions = false;
for (i = 0; i < ARRAY_COUNT(sceneSubdivisionList); i++) {
if (globalCtx->sceneNum == sceneSubdivisionList[i].sceneId) {
if (play->sceneNum == sceneSubdivisionList[i].sceneId) {
colCtx->subdivAmount.x = sceneSubdivisionList[i].subdivAmount.x;
colCtx->subdivAmount.y = sceneSubdivisionList[i].subdivAmount.y;
colCtx->subdivAmount.z = sceneSubdivisionList[i].subdivAmount.z;
@@ -1566,7 +1566,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
}
colCtx->lookupTbl = THA_AllocEndAlign(
&globalCtx->state.tha,
&play->state.tha,
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1);
if (colCtx->lookupTbl == NULL) {
LogUtils_HungupThread("../z_bgcheck.c", 4176);
@@ -1599,15 +1599,15 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
SSNodeList_Initialize(&colCtx->polyNodes);
SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, globalCtx, colCtx->lookupTbl);
lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, play, colCtx->lookupTbl);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("/*---結局 BG使用サイズ %dbyte---*/\n", memSize + lookupTblMemSize);
osSyncPrintf(VT_RST);
DynaPoly_Init(globalCtx, &colCtx->dyna);
DynaPoly_Alloc(globalCtx, &colCtx->dyna);
DynaPoly_Init(play, &colCtx->dyna);
DynaPoly_Alloc(play, &colCtx->dyna);
}
/**
@@ -1650,7 +1650,7 @@ s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos) {
* returns the yIntersect of the nearest poly found directly below `pos`, or BGCHECK_Y_MIN if no floor detected
* returns the poly found in `outPoly`, and the bgId of the entity in `outBgId`
*/
f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly,
f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly,
s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist) {
f32 yIntersectDyna;
@@ -1695,7 +1695,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
dynaRaycast.actor = actor;
dynaRaycast.unk_20 = arg7;
dynaRaycast.chkDist = chkDist;
dynaRaycast.globalCtx = globalCtx;
dynaRaycast.play = play;
dynaRaycast.resultPoly = outPoly;
dynaRaycast.bgId = outBgId;
@@ -1735,11 +1735,10 @@ f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPol
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly,
Vec3f* pos) {
f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos) {
s32 bgId;
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f);
}
/**
@@ -1763,9 +1762,9 @@ f32 BgCheck_EntityRaycastFloor4(CollisionContext* colCtx, CollisionPoly** outPol
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor5(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId,
f32 BgCheck_EntityRaycastFloor5(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId,
Actor* actor, Vec3f* pos) {
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f);
}
/**
@@ -2412,14 +2411,14 @@ void SSNodeList_Initialize(SSNodeList* this) {
* tblMax is the number of SSNode records to allocate
* numPolys is the number of polygons defined within the CollisionHeader
*/
void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys) {
void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) {
this->max = tblMax;
this->count = 0;
this->tbl = THA_AllocEndAlign(&globalCtx->state.tha, tblMax * sizeof(SSNode), -2);
this->tbl = THA_AllocEndAlign(&play->state.tha, tblMax * sizeof(SSNode), -2);
ASSERT(this->tbl != NULL, "this->short_slist_node_tbl != NULL", "../z_bgcheck.c", 5975);
this->polyCheckTbl = GameState_Alloc(&globalCtx->state, numPolys, "../z_bgcheck.c", 5979);
this->polyCheckTbl = GameState_Alloc(&play->state, numPolys, "../z_bgcheck.c", 5979);
ASSERT(this->polyCheckTbl != NULL, "this->polygon_check != NULL", "../z_bgcheck.c", 5981);
}
@@ -2506,7 +2505,7 @@ void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex) {
/**
* Initialize BgActor
*/
void BgActor_Initialize(GlobalContext* globalCtx, BgActor* bgActor) {
void BgActor_Initialize(PlayState* play, BgActor* bgActor) {
bgActor->actor = NULL;
bgActor->colHeader = NULL;
ScaleRotPos_Initialize(&bgActor->prevTransform);
@@ -2549,8 +2548,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) {
/**
* Allocate dyna.polyList
*/
void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&globalCtx->state.tha, numPolys * sizeof(CollisionPoly), -2);
void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2);
ASSERT(*polyList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6247);
}
@@ -2564,15 +2563,15 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) {
/**
* Allocate dyna.vtxList
*/
void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&globalCtx->state.tha, numVtx * sizeof(Vec3s), -2);
void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2);
ASSERT(*vtxList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6277);
}
/**
* Update BgActor's prevTransform
*/
void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) {
void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) {
bgActor->prevTransform = bgActor->curTransform;
}
@@ -2589,39 +2588,38 @@ s32 DynaPoly_IsBgIdBgActor(s32 bgId) {
/**
* Init DynaCollisionContext
*/
void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag = DYNAPOLY_INVALIDATE_LOOKUP;
DynaPoly_NullPolyList(&dyna->polyList);
DynaPoly_NullVtxList(&dyna->vtxList);
DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Initialize(play, &dyna->polyNodes);
}
/**
* Set DynaCollisionContext
*/
void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna) {
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
BgActor_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(play, &dyna->bgActors[i]);
dyna->bgActorFlags[i] = 0;
}
DynaPoly_NullPolyList(&dyna->polyList);
DynaPoly_AllocPolyList(globalCtx, &dyna->polyList, dyna->polyListMax);
DynaPoly_AllocPolyList(play, &dyna->polyList, dyna->polyListMax);
DynaPoly_NullVtxList(&dyna->vtxList);
DynaPoly_AllocVtxList(globalCtx, &dyna->vtxList, dyna->vtxListMax);
DynaPoly_AllocVtxList(play, &dyna->vtxList, dyna->vtxListMax);
DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax);
DynaSSNodeList_Initialize(play, &dyna->polyNodes);
DynaSSNodeList_Alloc(play, &dyna->polyNodes, dyna->polyNodesMax);
}
/**
* Set BgActor
* original name: DynaPolyInfo_setActor
*/
s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor,
CollisionHeader* colHeader) {
s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader) {
s32 bgId;
s32 foundSlot = false;
@@ -2662,28 +2660,28 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) {
return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor;
}
void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003ED00(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
@@ -2693,7 +2691,7 @@ void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgI
/**
* original name: DynaPolyInfo_delReserve
*/
void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
DynaPolyActor* actor;
osSyncPrintf(VT_FGCOL(GREEN));
@@ -2718,7 +2716,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna
return;
}
}
actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) {
actor->bgId = BGACTOR_NEG_ONE;
@@ -2727,14 +2725,14 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna
}
}
void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
/**
* original name: DynaPolyInfo_expandSRT
*/
void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex,
void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex,
s32* polyStartIndex) {
MtxF mtx;
Actor* actor;
@@ -2915,13 +2913,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3
}
}
void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) {
void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor) {
DynaPolyActor* dynaActor;
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & 1) {
dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, i);
dynaActor = DynaPoly_GetActor(&play->colCtx, i);
if (dynaActor != NULL && &dynaActor->actor == actor) {
func_800434A0((DynaPolyActor*)actor);
return;
@@ -2933,7 +2931,7 @@ void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor*
/**
* DynaPolyInfo_setup
*/
void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) {
DynaPolyActor* actor;
s32 vtxStartIndex;
s32 polyStartIndex;
@@ -2953,7 +2951,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
osSyncPrintf(VT_RST);
dyna->bgActorFlags[i] = 0;
BgActor_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) {
@@ -2961,14 +2959,14 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("DynaPolyInfo_setup():削除 index=%d\n", i);
osSyncPrintf(VT_RST);
actor = DynaPoly_GetActor(&globalCtx->colCtx, i);
actor = DynaPoly_GetActor(&play->colCtx, i);
if (actor == NULL) {
return;
}
actor->bgId = BGACTOR_NEG_ONE;
dyna->bgActorFlags[i] = 0;
BgActor_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
@@ -2976,7 +2974,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
polyStartIndex = 0;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & 1) {
DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex);
DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex);
}
}
dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP;
@@ -2985,12 +2983,12 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
/**
* Update all BgActor's previous ScaleRotPos
*/
void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna) {
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & 1) {
DynaPoly_SetBgActorPrevTransform(globalCtx, &dyna->bgActors[i]);
DynaPoly_SetBgActorPrevTransform(play, &dyna->bgActors[i]);
}
}
}
@@ -3129,10 +3127,10 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) {
}
dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId);
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->globalCtx != NULL)) {
pauseState = dynaRaycast->globalCtx->pauseCtx.state != 0;
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) {
pauseState = dynaRaycast->play->pauseCtx.state != 0;
if (pauseState == 0) {
pauseState = dynaRaycast->globalCtx->pauseCtx.debugState != 0;
pauseState = dynaRaycast->play->pauseCtx.debugState != 0;
}
if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) {
curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform;
@@ -3787,7 +3785,7 @@ void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest) {
/**
* SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders
*/
void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) {
void func_800418D0(CollisionContext* colCtx, PlayState* play) {
DynaCollisionContext* dyna = &colCtx->dyna;
s32 i;
u16 flag;
@@ -3795,7 +3793,7 @@ void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) {
for (i = 0; i < BG_ACTOR_MAX; i++) {
flag = dyna->bgActorFlags[i];
if ((flag & 1) && !(flag & 2)) {
Actor_SetObjectDependency(globalCtx, dyna->bgActors[i].actor);
Actor_SetObjectDependency(play, dyna->bgActors[i].actor);
CollisionHeader_SegmentedToVirtual(dyna->bgActors[i].colHeader);
}
}
@@ -4173,9 +4171,9 @@ f32 zdWaterBoxMaxZ = -967.0f;
* returns true if point is within the xz boundaries of an active water box, else false
* `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox
*/
s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
if (globalCtx->sceneNum == SCENE_SPOT07) {
if (play->sceneNum == SCENE_SPOT07) {
if (zdWaterBoxMinX < x && x < zdWaterBoxMaxX && zdWaterBoxMinY < *ySurface && *ySurface < zdWaterBoxMaxY &&
zdWaterBoxMinZ < z && z < zdWaterBoxMaxZ) {
*outWaterBox = &zdWaterBox;
@@ -4183,7 +4181,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32
return true;
}
}
return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox);
return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox);
}
/**
@@ -4191,7 +4189,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32
* returns true if point is within the xz boundaries of an active water box, else false
* `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox
*/
s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
u32 room;
@@ -4204,7 +4202,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = (curWaterBox->properties >> 13) & 0x3F;
if (room == (u32)globalCtx->roomCtx.curRoom.num || room == 0x3F) {
if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) {
if ((curWaterBox->properties & 0x80000) == 0) {
if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) {
if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) {
@@ -4225,7 +4223,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
* returns the index of the waterbox found, or -1 if no waterbox is found
* `outWaterBox` returns the pointer to the waterbox found, or NULL if none is found
*/
s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist,
s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist,
WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
s32 room;
@@ -4242,7 +4240,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec
waterBox = &colHeader->waterBoxes[i];
room = WATERBOX_ROOM(waterBox->properties);
if (!(room == globalCtx->roomCtx.curRoom.num || room == 0x3F)) {
if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) {
continue;
}
if (waterBox->properties & 0x80000) {
@@ -4302,8 +4300,7 @@ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox)
* returns true if point is within the xz boundaries of an active water box, else false
* `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox
*/
s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
u32 room;
WaterBox* curWaterBox;
@@ -4315,7 +4312,7 @@ s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = (curWaterBox->properties >> 0xD) & 0x3F;
if ((room == (u32)globalCtx->roomCtx.curRoom.num) || (room == 0x3F)) {
if ((room == (u32)play->roomCtx.curRoom.num) || (room == 0x3F)) {
if ((curWaterBox->properties & 0x80000) != 0) {
if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) {
if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) {
@@ -4371,8 +4368,8 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec
/**
* Draw a list of dyna polys, specified by `ssList`
*/
void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, DynaCollisionContext* dyna,
SSList* ssList, u8 r, u8 g, u8 b) {
void BgCheck_DrawDynaPolyList(PlayState* play, CollisionContext* colCtx, DynaCollisionContext* dyna, SSList* ssList,
u8 r, u8 g, u8 b) {
s16 curPolyId;
CollisionPoly* poly;
SSNode* curNode;
@@ -4405,7 +4402,7 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx
vC.y += AREG(26) * ny;
vC.z += AREG(26) * nz;
}
Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b);
Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b);
if (curNode->next == SS_NULL) {
break;
}
@@ -4418,25 +4415,23 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx
* Draw a BgActor's dyna polys
* `bgId` is the BgActor index that should be drawn
*/
void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32 bgId) {
void BgCheck_DrawBgActor(PlayState* play, CollisionContext* colCtx, s32 bgId) {
if (AREG(21)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255,
0, 0);
}
if (AREG(22)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255,
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255, 0,
0);
}
if (AREG(22)) {
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255, 0);
}
if (AREG(23)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0,
255);
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0, 255);
}
}
/**
* Draw all dyna polys
*/
void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCtx) {
void BgCheck_DrawDynaCollision(PlayState* play, CollisionContext* colCtx) {
s32 bgId;
for (bgId = 0; bgId < BG_ACTOR_MAX; bgId++) {
@@ -4444,14 +4439,14 @@ void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCt
if (!(colCtx->dyna.bgActorFlags[bgId] & 1)) {
continue;
}
BgCheck_DrawBgActor(globalCtx, colCtx, bgId);
BgCheck_DrawBgActor(play, colCtx, bgId);
}
}
/**
* Draw a static poly
*/
void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) {
void BgCheck_DrawStaticPoly(PlayState* play, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) {
Vec3f vA;
Vec3f vB;
Vec3f vC;
@@ -4476,13 +4471,13 @@ void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx,
vC.y += AREG(26) * ny;
vC.z += AREG(26) * nz;
}
Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b);
Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b);
}
/**
* Draw a list of static polys, specified by `ssList`
*/
void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) {
void BgCheck_DrawStaticPolyList(PlayState* play, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) {
SSNode* curNode;
CollisionPoly* polyList = colCtx->colHeader->polyList;
s16 curPolyId;
@@ -4491,7 +4486,7 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC
curNode = &colCtx->polyNodes.tbl[ssList->head];
while (true) {
curPolyId = curNode->polyId;
BgCheck_DrawStaticPoly(globalCtx, colCtx, &polyList[curPolyId], r, g, b);
BgCheck_DrawStaticPoly(play, colCtx, &polyList[curPolyId], r, g, b);
if (curNode->next == SS_NULL) {
break;
}
@@ -4503,17 +4498,17 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC
/**
* Draw scene collision
*/
void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* colCtx) {
Player* player = GET_PLAYER(globalCtx);
void BgCheck_DrawStaticCollision(PlayState* play, CollisionContext* colCtx) {
Player* player = GET_PLAYER(play);
StaticLookup* lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos);
if (AREG(23) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->floor, 0, 0, 255);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->floor, 0, 0, 255);
}
if (AREG(22) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->wall, 0, 255, 0);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->wall, 0, 255, 0);
}
if (AREG(21) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->ceiling, 255, 0, 0);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->ceiling, 255, 0, 0);
}
}
+122 -125
View File
@@ -215,7 +215,7 @@ Vec3f* Camera_Vec3fTranslateByUnitVector(Vec3f* dest, Vec3f* src, Vec3f* unitVec
* Detects the collision poly between `from` and `to`, places collision info in `to`
*/
s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) {
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
Vec3f toNewPos;
Vec3f toPoint;
Vec3f fromToNorm;
@@ -278,7 +278,7 @@ s32 Camera_BGCheck(Camera* camera, Vec3f* from, Vec3f* to) {
}
s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) {
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
Vec3f toNewPos;
Vec3f toPos;
Vec3f fromToNorm;
@@ -363,7 +363,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
s32 pad2;
s32 bgId;
CollisionPoly* poly;
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
poly = NULL;
if (BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, 1, 1, 1, 0, &bgId) &&
@@ -382,7 +382,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
f32 Camera_GetFloorYNorm(Camera* camera, Vec3f* floorNorm, Vec3f* chkPos, s32* bgId) {
s32 pad;
CollisionPoly* floorPoly;
f32 floorY = BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, bgId, chkPos);
f32 floorY = BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, bgId, chkPos);
if (floorY == BGCHECK_Y_MIN) {
// no floor
@@ -418,7 +418,7 @@ f32 Camera_GetFloorY(Camera* camera, Vec3f* pos) {
*/
f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
CollisionPoly* floorPoly;
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
f32 floorY;
s32 i;
@@ -453,14 +453,14 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
* Returns the CameraSettingType of the camera at index `camDataIdx`
*/
s16 Camera_GetCamDataSetting(Camera* camera, s32 camDataIdx) {
return func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, BGCHECK_SCENE);
return func_80041A4C(&camera->play->colCtx, camDataIdx, BGCHECK_SCENE);
}
/**
* Returns the scene camera info for the current camera data index
*/
Vec3s* Camera_GetCamBGData(Camera* camera) {
return func_80041C10(&camera->globalCtx->colCtx, camera->camDataIdx, BGCHECK_SCENE);
return func_80041C10(&camera->play->colCtx, camera->camDataIdx, BGCHECK_SCENE);
}
/**
@@ -473,9 +473,9 @@ s32 Camera_GetDataIdxForPoly(Camera* camera, s32* bgId, CollisionPoly* poly) {
s32 ret;
Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); // unused.
camDataIdx = SurfaceType_GetCamDataIndex(&camera->globalCtx->colCtx, poly, *bgId);
camDataIdx = SurfaceType_GetCamDataIndex(&camera->play->colCtx, poly, *bgId);
if (func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) {
if (func_80041A4C(&camera->play->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) {
ret = -1;
} else {
ret = camDataIdx;
@@ -496,13 +496,12 @@ Vec3s* Camera_GetCamBgDataUnderPlayer(Camera* camera, u16* dataCnt) {
Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor);
playerPosShape.pos.y += Player_GetHeight(camera->player);
if (BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, &bgId, &playerPosShape.pos) ==
BGCHECK_Y_MIN) {
if (BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) {
// no floor
return NULL;
}
*dataCnt = SurfaceType_GetNumCameras(&camera->globalCtx->colCtx, floorPoly, bgId);
return SurfaceType_GetCamPosData(&camera->globalCtx->colCtx, floorPoly, bgId);
*dataCnt = SurfaceType_GetNumCameras(&camera->play->colCtx, floorPoly, bgId);
return SurfaceType_GetCamPosData(&camera->play->colCtx, floorPoly, bgId);
}
/**
@@ -519,8 +518,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) {
Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor);
*waterY = playerPosShape.pos.y;
if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, playerPosShape.pos.x, playerPosShape.pos.z,
waterY, &waterBox)) {
if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, waterY,
&waterBox)) {
// player's position is not in a water box.
*waterY = BGCHECK_Y_MIN;
return -1;
@@ -532,8 +531,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) {
return -1;
}
ret = WaterBox_GetCamDataIndex(&camera->globalCtx->colCtx, waterBox);
if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->globalCtx->colCtx, waterBox) <= 0)) {
ret = WaterBox_GetCamDataIndex(&camera->play->colCtx, waterBox);
if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->play->colCtx, waterBox) <= 0)) {
// no camera data index, or no CameraSettingType
return -2;
}
@@ -554,8 +553,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor);
waterY = playerPosRot.pos.y;
if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, chkPos->x, chkPos->z, &waterY,
&waterBox)) {
if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, chkPos->x, chkPos->z, &waterY, &waterBox)) {
// chkPos is not within the x/z boundaries of a water box.
return BGCHECK_Y_MIN;
}
@@ -566,7 +564,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
return BGCHECK_Y_MIN;
}
*envProp = WaterBox_GetLightSettingIndex(&camera->globalCtx->colCtx, waterBox);
*envProp = WaterBox_GetLightSettingIndex(&camera->play->colCtx, waterBox);
return waterY;
}
@@ -608,7 +606,7 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
rotatedPos.x = playerPos.x + (sp30 * sinYaw);
rotatedPos.y = playerPos.y;
rotatedPos.z = playerPos.z + (sp30 * cosYaw);
if (arg2 || (camera->globalCtx->state.frames % 2) == 0) {
if (arg2 || (camera->play->state.frames % 2) == 0) {
D_8015CE58.pos.x = playerPos.x + (sp2C * sinYaw);
D_8015CE58.pos.y = playerPos.y;
D_8015CE58.pos.z = playerPos.z + (sp2C * cosYaw);
@@ -1638,7 +1636,7 @@ s32 Camera_Normal1(Camera* camera) {
}
// crit wiggle
if (gSaveContext.health <= 16 && ((camera->globalCtx->state.frames % 256) == 0)) {
if (gSaveContext.health <= 16 && ((camera->play->state.frames % 256) == 0)) {
wiggleAdj = Rand_ZeroOne() * 10000.0f;
camera->inputDir.y = wiggleAdj + camera->inputDir.y;
}
@@ -1805,7 +1803,7 @@ s32 Camera_Normal2(Camera* camera) {
if (camera->status == CAM_STAT_ACTIVE) {
bgChk.pos = *eyeNext;
if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) {
if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &bgChk);
*eye = bgChk.pos;
} else {
@@ -2140,7 +2138,7 @@ s32 Camera_Parallel1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8);
if (camera->status == CAM_STAT_ACTIVE) {
sp6C.pos = *eyeNext;
if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) {
if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &sp6C);
*eye = sp6C.pos;
} else {
@@ -2950,7 +2948,7 @@ s32 Camera_Battle1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4);
spBC.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->globalCtx->envCtx.skyboxDisabled || roData->flags & 1) {
if (!camera->play->envCtx.skyboxDisabled || roData->flags & 1) {
Camera_BGCheckInfo(camera, at, &spBC);
} else if (roData->flags & 2) {
func_80043F94(camera, at, &spBC);
@@ -3277,7 +3275,7 @@ s32 Camera_KeepOn1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8);
sp8C.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->globalCtx->envCtx.skyboxDisabled || roData->interfaceFlags & 1) {
if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 1) {
Camera_BGCheckInfo(camera, at, &sp8C);
} else if (roData->interfaceFlags & 2) {
func_80043F94(camera, at, &sp8C);
@@ -3343,9 +3341,9 @@ s32 Camera_KeepOn3(Camera* camera) {
return 1;
}
if (RELOAD_PARAMS(camera)) {
if (camera->globalCtx->view.unk_124 == 0) {
if (camera->play->view.unk_124 == 0) {
camera->unk_14C |= 0x20;
camera->globalCtx->view.unk_124 = camera->camId | 0x50;
camera->play->view.unk_124 = camera->camId | 0x50;
return 1;
}
camera->unk_14C &= ~0x20;
@@ -3433,7 +3431,7 @@ s32 Camera_KeepOn3(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &rwData->atTarget, &atToEyeAdj);
if (!(roData->flags & 0x80)) {
while (i < angleCnt) {
if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &rwData->atTarget,
if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &rwData->atTarget,
&lineChkPointB, colChkActors, 2) &&
!Camera_BGCheck(camera, &rwData->atTarget, &lineChkPointB)) {
break;
@@ -3517,15 +3515,15 @@ s32 Camera_KeepOn4(Camera* camera) {
KeepOn4ReadWriteData* rwData = &camera->paramData.keep4.rwData;
s32 pad;
f32 playerHeight;
Player* player = GET_PLAYER(camera->globalCtx);
Player* player = GET_PLAYER(camera->play);
s16 angleCnt;
s32 i;
if (RELOAD_PARAMS(camera)) {
if (camera->globalCtx->view.unk_124 == 0) {
if (camera->play->view.unk_124 == 0) {
camera->unk_14C |= 0x20;
camera->unk_14C &= ~(0x4 | 0x2);
camera->globalCtx->view.unk_124 = camera->camId | 0x50;
camera->play->view.unk_124 = camera->camId | 0x50;
return 1;
}
rwData->unk_14 = *temp_s0;
@@ -3538,7 +3536,7 @@ s32 Camera_KeepOn4(Camera* camera) {
camera->animState = 20;
camera->unk_14C |= 0x20;
camera->unk_14C &= ~(0x4 | 0x2);
camera->globalCtx->view.unk_124 = camera->camId | 0x50;
camera->play->view.unk_124 = camera->camId | 0x50;
return 1;
}
@@ -3656,7 +3654,7 @@ s32 Camera_KeepOn4(Camera* camera) {
OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
D_8015BD50 = playerPosRot->pos;
D_8015BD50.y += playerHeight;
temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->globalCtx->colCtx, &spC0, &i, &D_8015BD50);
temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->play->colCtx, &spC0, &i, &D_8015BD50);
if (temp_f0_2 > (roData->unk_00 + D_8015BD50.y)) {
D_8015BD50.y = temp_f0_2 + 10.0f;
} else {
@@ -3716,8 +3714,8 @@ s32 Camera_KeepOn4(Camera* camera) {
if (!(roData->unk_1C & 1)) {
angleCnt = ARRAY_COUNT(D_8011D3B0);
for (i = 0; i < angleCnt; i++) {
if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &D_8015BD50,
&D_8015BD70, spCC, sp9C) &&
if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &D_8015BD50, &D_8015BD70,
spCC, sp9C) &&
!Camera_BGCheck(camera, &D_8015BD50, &D_8015BD70)) {
break;
}
@@ -4204,8 +4202,8 @@ s32 Camera_Subj3(Camera* camera) {
Actor_GetFocus(&sp60, &camera->player->actor);
playerHeight = Player_GetHeight(camera->player);
if (camera->globalCtx->view.unk_124 == 0) {
camera->globalCtx->view.unk_124 = camera->camId | 0x50;
if (camera->play->view.unk_124 == 0) {
camera->play->view.unk_124 = camera->camId | 0x50;
return true;
}
@@ -4266,7 +4264,7 @@ s32 Camera_Subj3(Camera* camera) {
*eye = *eyeNext;
rwData->animTimer--;
if (!camera->globalCtx->envCtx.skyboxDisabled) {
if (!camera->play->envCtx.skyboxDisabled) {
Camera_BGCheck(camera, at, eye);
} else {
func_80044340(camera, at, eye);
@@ -4333,8 +4331,8 @@ s32 Camera_Subj4(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
if (camera->globalCtx->view.unk_124 == 0) {
camera->globalCtx->view.unk_124 = (camera->camId | 0x50);
if (camera->play->view.unk_124 == 0) {
camera->play->view.unk_124 = (camera->camId | 0x50);
rwData->unk_24 = camera->xzSpeed;
return true;
}
@@ -5128,11 +5126,11 @@ s32 Camera_Unique9(Camera* camera) {
Camera_UpdateInterface(0xF000 | ((rwData->curKeyFrame->unk_01 & 0xF) << 8));
} else if (camera->player->stateFlags1 & PLAYER_STATE1_27 &&
player->currentBoots != PLAYER_BOOTS_IRON) {
func_8002DF38(camera->globalCtx, camera->target, 8);
func_8002DF38(camera->play, camera->target, 8);
osSyncPrintf("camera: demo: player demo set WAIT\n");
} else {
osSyncPrintf("camera: demo: player demo set %d\n", rwData->curKeyFrame->unk_01);
func_8002DF38(camera->globalCtx, camera->target, rwData->curKeyFrame->unk_01);
func_8002DF38(camera->play, camera->target, rwData->curKeyFrame->unk_01);
}
}
} else {
@@ -5151,9 +5149,9 @@ s32 Camera_Unique9(Camera* camera) {
rwData->atTarget = rwData->curKeyFrame->atTargetInit;
} else if (atInitFlags == 2) {
if (rwData->isNewKeyFrame) {
rwData->atTarget.x = camera->globalCtx->view.at.x + rwData->curKeyFrame->atTargetInit.x;
rwData->atTarget.y = camera->globalCtx->view.at.y + rwData->curKeyFrame->atTargetInit.y;
rwData->atTarget.z = camera->globalCtx->view.at.z + rwData->curKeyFrame->atTargetInit.z;
rwData->atTarget.x = camera->play->view.at.x + rwData->curKeyFrame->atTargetInit.x;
rwData->atTarget.y = camera->play->view.at.y + rwData->curKeyFrame->atTargetInit.y;
rwData->atTarget.z = camera->play->view.at.z + rwData->curKeyFrame->atTargetInit.z;
}
} else if (atInitFlags == 3) {
if (rwData->isNewKeyFrame) {
@@ -5233,9 +5231,9 @@ s32 Camera_Unique9(Camera* camera) {
rwData->eyeTarget = rwData->curKeyFrame->eyeTargetInit;
} else if (eyeInitFlags == 0x200) {
if (rwData->isNewKeyFrame) {
rwData->eyeTarget.x = camera->globalCtx->view.eye.x + rwData->curKeyFrame->eyeTargetInit.x;
rwData->eyeTarget.y = camera->globalCtx->view.eye.y + rwData->curKeyFrame->eyeTargetInit.y;
rwData->eyeTarget.z = camera->globalCtx->view.eye.z + rwData->curKeyFrame->eyeTargetInit.z;
rwData->eyeTarget.x = camera->play->view.eye.x + rwData->curKeyFrame->eyeTargetInit.x;
rwData->eyeTarget.y = camera->play->view.eye.y + rwData->curKeyFrame->eyeTargetInit.y;
rwData->eyeTarget.z = camera->play->view.eye.z + rwData->curKeyFrame->eyeTargetInit.z;
}
} else if (eyeInitFlags == 0x300) {
if (rwData->isNewKeyFrame) {
@@ -5322,7 +5320,7 @@ s32 Camera_Unique9(Camera* camera) {
}
if (rwData->curKeyFrame->initFlags == 2) {
rwData->fovTarget = camera->globalCtx->view.fovy;
rwData->fovTarget = camera->play->view.fovy;
rwData->rollTarget = 0;
} else if (rwData->curKeyFrame->initFlags == 0) {
rwData->fovTarget = camera->fov;
@@ -5477,12 +5475,12 @@ s32 Camera_Unique9(Camera* camera) {
// Change the parent camera (or default)'s mode to normal
s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera_ChangeModeFlags(camera->globalCtx->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
}
case 18: {
// copy the current camera to the parent (or default)'s camera.
s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera* cam = camera->globalCtx->cameraPtrs[camIdx];
Camera* cam = camera->play->cameraPtrs[camIdx];
*eye = *eyeNext;
Camera_Copy(cam, camera);
@@ -5603,8 +5601,8 @@ s32 Camera_Demo1(Camera* camera) {
rwData->curFrame = 0.0f;
camera->animState++;
// "absolute" : "relative"
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n",
camera->globalCtx->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対");
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", camera->play->state.frames,
*relativeToPlayer == 0 ? "絶対" : "相対");
if (PREG(93)) {
Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints);
@@ -5700,7 +5698,7 @@ s32 Camera_Demo3(Camera* camera) {
sp68.x = rwData->initialAt.x + (Math_SinS(angle) * 40.0f);
sp68.y = rwData->initialAt.y + 40.0f;
sp68.z = rwData->initialAt.z + (Math_CosS(angle) * 40.0f);
if (camera->globalCtx->state.frames & 1) {
if (camera->play->state.frames & 1) {
angle -= 0x3FFF;
rwData->yawDir = 1;
} else {
@@ -5899,7 +5897,7 @@ s32 Camera_Demo5(Camera* camera) {
Actor_GetFocus(&camera->targetPosRot, camera->target);
OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos);
D_8011D3AC = camera->target->category;
Actor_GetScreenPos(camera->globalCtx, camera->target, &targetScreenPosX, &targetScreenPosY);
Actor_GetScreenPos(camera->play, camera->target, &targetScreenPosX, &targetScreenPosY);
eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye);
OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext);
sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw;
@@ -5997,7 +5995,7 @@ s32 Camera_Demo5(Camera* camera) {
// the target is a door.
D_8011D954[0].timerInit = camera->timer - 5;
sp4A = 0;
if (!func_800C0D34(camera->globalCtx, camera->target, &sp4A)) {
if (!func_800C0D34(camera->play, camera->target, &sp4A)) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: attention demo: this door is dummy door!\n" VT_RST);
if (ABS(playerTargetGeo.yaw - camera->target->shape.rot.y) >= 0x4000) {
sp4A = camera->target->shape.rot.y;
@@ -6050,7 +6048,7 @@ s32 Camera_Demo5(Camera* camera) {
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4);
if (camera->parentCamId != CAM_ID_MAIN) {
if (camera->globalCtx->state.frames & 1) {
if (camera->play->state.frames & 1) {
D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit;
D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit;
}
@@ -6061,12 +6059,12 @@ s32 Camera_Demo5(Camera* camera) {
}
}
framesDiff = sDemo5PrevSfxFrame - camera->globalCtx->state.frames;
framesDiff = sDemo5PrevSfxFrame - camera->play->state.frames;
if ((framesDiff > 50) || (framesDiff < -50)) {
func_80078884(camera->data1);
}
sDemo5PrevSfxFrame = camera->globalCtx->state.frames;
sDemo5PrevSfxFrame = camera->play->state.frames;
if (camera->player->stateFlags1 & PLAYER_STATE1_27 && (player->currentBoots != PLAYER_BOOTS_IRON)) {
// swimming, and not iron boots
@@ -6076,21 +6074,21 @@ s32 Camera_Demo5(Camera* camera) {
} else {
sp4A = playerhead.rot.y - playerTargetGeo.yaw;
if (camera->target->category == ACTORCAT_PLAYER) {
framesDiff = camera->globalCtx->state.frames - sDemo5PrevAction12Frame;
framesDiff = camera->play->state.frames - sDemo5PrevAction12Frame;
if (player->stateFlags1 & PLAYER_STATE1_11) {
// holding object over head.
func_8002DF54(camera->globalCtx, camera->target, 8);
func_8002DF54(camera->play, camera->target, 8);
} else if (ABS(framesDiff) > 3000) {
func_8002DF54(camera->globalCtx, camera->target, 12);
func_8002DF54(camera->play, camera->target, 12);
} else {
func_8002DF54(camera->globalCtx, camera->target, 69);
func_8002DF54(camera->play, camera->target, 69);
}
} else {
func_8002DF54(camera->globalCtx, camera->target, 1);
func_8002DF54(camera->play, camera->target, 1);
}
}
sDemo5PrevAction12Frame = camera->globalCtx->state.frames;
sDemo5PrevAction12Frame = camera->play->state.frames;
Camera_ChangeSettingFlags(camera, CAM_SET_CS_C, (4 | 1));
Camera_Unique9(camera);
return true;
@@ -6111,7 +6109,7 @@ s32 Camera_Demo6(Camera* camera) {
s16 stateTimers[4];
Demo6ReadWriteData* rwData = &camera->paramData.demo6.rwData;
mainCam = Play_GetCamera(camera->globalCtx, CAM_ID_MAIN);
mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN);
camFocus = camera->target;
stateTimers[1] = 0x37;
stateTimers[2] = 0x46;
@@ -6145,7 +6143,7 @@ s32 Camera_Demo6(Camera* camera) {
camera->animState++;
case 1:
if (stateTimers[camera->animState] < rwData->animTimer) {
func_8002DF54(camera->globalCtx, &camera->player->actor, 8);
func_8002DF54(camera->play, &camera->player->actor, 8);
Actor_GetWorld(&focusPosRot, camFocus);
rwData->atTarget.x = focusPosRot.pos.x;
rwData->atTarget.y = focusPosRot.pos.y - 20.0f;
@@ -6216,7 +6214,7 @@ s32 Camera_Demo9(Camera* camera) {
f32* camFOV = &camera->fov;
Demo9ReadWriteData* rwData = &camera->paramData.demo9.rwData;
mainCam = Play_GetCamera(camera->globalCtx, CAM_ID_MAIN);
mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN);
mainCamPlayerPosRot = &mainCam->playerPosRot;
if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) {
values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
@@ -6306,7 +6304,7 @@ s32 Camera_Demo9(Camera* camera) {
if (rwData->finishAction == 0x2000) {
// finish action = 0x2000, run OnePointCs 0x3FC (Dramatic Return to Link)
onePointTimer = onePointCamData->initTimer < 50 ? 5 : onePointCamData->initTimer / 5;
OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamId);
OnePointCutscene_Init(camera->play, 1020, onePointTimer, NULL, camera->parentCamId);
}
} else {
// finish action = 0x1000, copy the current camera's values to the
@@ -6529,7 +6527,7 @@ s32 Camera_Special7(Camera* camera) {
yOffset = Player_GetHeight(camera->player);
if (camera->animState == 0) {
if (camera->globalCtx->sceneNum == SCENE_JYASINZOU) {
if (camera->play->sceneNum == SCENE_JYASINZOU) {
// Spirit Temple
rwData->index = 3;
} else if (playerPosRot->pos.x < 1500.0f) {
@@ -6754,7 +6752,7 @@ s32 Camera_Special9(Camera* camera) {
// 0xE38 ~ 20 degrees
eyeAdjustment.pitch = 0xE38;
// 0xAAA ~ 15 degrees.
yaw = 0xAAA * ((camera->globalCtx->state.frames & 1) ? 1 : -1);
yaw = 0xAAA * ((camera->play->state.frames & 1) ? 1 : -1);
eyeAdjustment.yaw = rwData->targetYaw + yaw;
eyeAdjustment.r = 200.0f * yNormal;
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
@@ -6826,12 +6824,12 @@ s32 Camera_Special9(Camera* camera) {
return true;
}
Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globalCtx) {
Camera* Camera_Create(View* view, CollisionContext* colCtx, PlayState* play) {
Camera* newCamera = ZeldaArena_MallocDebug(sizeof(*newCamera), "../z_camera.c", 9370);
if (newCamera != NULL) {
osSyncPrintf(VT_FGCOL(BLUE) "camera: create --- allocate %d byte" VT_RST "\n", sizeof(*newCamera) * 4);
Camera_Init(newCamera, view, colCtx, globalCtx);
Camera_Init(newCamera, view, colCtx, play);
} else {
osSyncPrintf(VT_COL(RED, WHITE) "camera: create: not enough memory\n" VT_RST);
}
@@ -6847,7 +6845,7 @@ void Camera_Destroy(Camera* camera) {
}
}
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx) {
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play) {
Camera* camP;
s32 i;
s16 curUID;
@@ -6867,7 +6865,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
sInitRegs = false;
PREG(88) = -1;
}
camera->globalCtx = D_8015BD7C = globalCtx;
camera->play = D_8015BD7C = play;
DbCamera_Init(&D_8015BD80, camera);
curUID = sNextUID;
sNextUID++;
@@ -6877,7 +6875,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
}
for (j = 0; j < NUM_CAMS; j++) {
camP = camera->globalCtx->cameraPtrs[j];
camP = camera->play->cameraPtrs[j];
if (camP != NULL && curUID == camP->uid) {
break;
}
@@ -6926,11 +6924,11 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
}
void func_80057FC4(Camera* camera) {
if (camera != &camera->globalCtx->mainCamera) {
if (camera != &camera->play->mainCamera) {
camera->prevSetting = camera->setting = CAM_SET_FREE0;
camera->unk_14C &= ~0x4;
} else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) {
switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) {
} else if (camera->play->roomCtx.curRoom.meshHeader->base.type != 1) {
switch (camera->play->roomCtx.curRoom.behaviorType1) {
case ROOM_BEHAVIOR_TYPE1_1:
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_DUNGEON0;
@@ -6941,8 +6939,7 @@ void func_80057FC4(Camera* camera) {
camera->prevSetting = camera->setting = CAM_SET_NORMAL0;
break;
default:
osSyncPrintf("camera: room type: default set etc (%d)\n",
camera->globalCtx->roomCtx.curRoom.behaviorType1);
osSyncPrintf("camera: room type: default set etc (%d)\n", camera->play->roomCtx.curRoom.behaviorType1);
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_NORMAL0;
camera->unk_14C |= 4;
@@ -7005,7 +7002,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) {
camera->waterPrevCamSetting = -1;
camera->unk_14C |= 4;
if (camera == &camera->globalCtx->mainCamera) {
if (camera == &camera->play->mainCamera) {
sCameraInterfaceFlags = 0xB200;
} else {
sCameraInterfaceFlags = 0;
@@ -7059,13 +7056,13 @@ void Camera_PrintSettings(Camera* camera) {
char sp48[8];
s32 i;
if ((OREG(0) & 1) && (camera->globalCtx->activeCamId == camera->camId) && !gDbgCamEnabled) {
if ((OREG(0) & 1) && (camera->play->activeCamId == camera->camId) && !gDbgCamEnabled) {
for (i = 0; i < NUM_CAMS; i++) {
if (camera->globalCtx->cameraPtrs[i] == NULL) {
if (camera->play->cameraPtrs[i] == NULL) {
sp58[i] = '-';
sp48[i] = ' ';
} else {
switch (camera->globalCtx->cameraPtrs[i]->status) {
switch (camera->play->cameraPtrs[i]->status) {
case 0:
sp58[i] = 'c';
break;
@@ -7091,7 +7088,7 @@ void Camera_PrintSettings(Camera* camera) {
sp58[i] = '\0';
sp48[i] = '\0';
sp48[camera->globalCtx->activeCamId] = 'a';
sp48[camera->play->activeCamId] = 'a';
func_8006376C(3, 0x16, 5, sp58);
func_8006376C(3, 0x16, 1, sp48);
func_8006376C(3, 0x17, 5, "S:");
@@ -7205,7 +7202,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (!(camera->unk_14C & 0x100)) {
camera->unk_14C |= 0x100;
osSyncPrintf("kankyo changed water, sound on\n");
Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex);
Environment_EnableUnderwaterLights(camera->play, waterLightsIndex);
camera->waterDistortionTimer = 80;
}
@@ -7228,7 +7225,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (camera->waterDistortionTimer > 0) {
camera->waterDistortionTimer--;
camera->distortionFlags |= DISTORTION_UNDERWATER_STRONG;
} else if (camera->globalCtx->sceneNum == SCENE_TURIBORI) {
} else if (camera->play->sceneNum == SCENE_TURIBORI) {
camera->distortionFlags |= DISTORTION_UNDERWATER_FISHING;
} else {
camera->distortionFlags |= DISTORTION_UNDERWATER_WEAK;
@@ -7237,7 +7234,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (camera->unk_14C & 0x100) {
camera->unk_14C &= ~0x100;
osSyncPrintf("kankyo changed water off, sound off\n");
Environment_DisableUnderwaterLights(camera->globalCtx);
Environment_DisableUnderwaterLights(camera->play);
if (*quakeId != 0) {
Quake_RemoveFromIdx(*quakeId);
}
@@ -7251,7 +7248,7 @@ s32 Camera_UpdateWater(Camera* camera) {
s32 Camera_UpdateHotRoom(Camera* camera) {
camera->distortionFlags &= ~DISTORTION_HOT_ROOM;
if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) {
if (camera->play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) {
camera->distortionFlags |= DISTORTION_HOT_ROOM;
}
@@ -7261,7 +7258,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) {
s32 Camera_DbgChangeMode(Camera* camera) {
s32 changeDir = 0;
if (!gDbgCamEnabled && camera->globalCtx->activeCamId == CAM_ID_MAIN) {
if (!gDbgCamEnabled && camera->play->activeCamId == CAM_ID_MAIN) {
if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) {
osSyncPrintf("attention sound URGENCY\n");
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
@@ -7357,17 +7354,17 @@ void Camera_UpdateDistortion(Camera* camera) {
depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep);
screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f,
Math_SinS(depthPhase) * 0.0f, Math_SinS(screenPlanePhase) * 0.0f);
View_SetDistortionScale(&camera->globalCtx->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f,
View_SetDistortionOrientation(&camera->play->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f,
Math_SinS(screenPlanePhase) * 0.0f);
View_SetDistortionScale(&camera->play->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f,
Math_CosS(screenPlanePhase) * (yScale * scaleFactor) + 1.0f,
Math_CosS(depthPhase) * (zScale * scaleFactor) + 1.0f);
View_SetDistortionSpeed(&camera->globalCtx->view, speed * speedFactor);
View_SetDistortionSpeed(&camera->play->view, speed * speedFactor);
camera->unk_14C |= 0x40;
} else if (camera->unk_14C & 0x40) {
View_ClearDistortion(&camera->globalCtx->view);
View_ClearDistortion(&camera->play->view);
camera->unk_14C &= ~0x40;
}
}
@@ -7388,7 +7385,7 @@ Vec3s Camera_Update(Camera* camera) {
QuakeCamCalc quake;
Player* player;
player = camera->globalCtx->cameraPtrs[CAM_ID_MAIN]->player;
player = camera->play->cameraPtrs[CAM_ID_MAIN]->player;
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: in %x\n", camera);
@@ -7415,8 +7412,8 @@ Vec3s Camera_Update(Camera* camera) {
spAC = curPlayerPosRot.pos;
spAC.y += Player_GetHeight(camera->player);
playerGroundY = BgCheck_EntityRaycastFloor5(camera->globalCtx, &camera->globalCtx->colCtx, &playerFloorPoly,
&bgId, &camera->player->actor, &spAC);
playerGroundY = BgCheck_EntityRaycastFloor5(camera->play, &camera->play->colCtx, &playerFloorPoly, &bgId,
&camera->player->actor, &spAC);
if (playerGroundY != BGCHECK_Y_MIN) {
// player is above ground.
sOOBTimer = 0;
@@ -7499,10 +7496,10 @@ Vec3s Camera_Update(Camera* camera) {
D_8011D3F0--;
sCameraInterfaceFlags = 0x3200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else if (camera->globalCtx->transitionMode != TRANS_MODE_OFF) {
} else if (camera->play->transitionMode != TRANS_MODE_OFF) {
sCameraInterfaceFlags = 0xF200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) {
} else if (camera->play->csCtx.state != CS_STATE_IDLE) {
sCameraInterfaceFlags = 0x3200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else {
@@ -7511,7 +7508,7 @@ Vec3s Camera_Update(Camera* camera) {
}
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->globalCtx->transitionMode);
osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->play->transitionMode);
}
if (R_DBG_CAM_UPDATE) {
@@ -7526,16 +7523,16 @@ Vec3s Camera_Update(Camera* camera) {
gDbgCamEnabled ^= 1;
if (gDbgCamEnabled) {
DbgCamera_Enable(&D_8015BD80, camera);
} else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) {
func_80064534(camera->globalCtx, &camera->globalCtx->csCtx);
} else if (camera->play->csCtx.state != CS_STATE_IDLE) {
func_80064534(camera->play, &camera->play->csCtx);
}
}
// Debug cam update
if (gDbgCamEnabled) {
camera->globalCtx->view.fovy = D_8015BD80.fov;
camera->play->view.fovy = D_8015BD80.fov;
DbCamera_Update(&D_8015BD80, camera);
View_LookAt(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: debug out\n");
}
@@ -7580,13 +7577,13 @@ Vec3s Camera_Update(Camera* camera) {
Camera_UpdateDistortion(camera);
if ((camera->globalCtx->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) {
View_SetScale(&camera->globalCtx->view, 0.79f);
if ((camera->play->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) {
View_SetScale(&camera->play->view, 0.79f);
} else {
View_SetScale(&camera->globalCtx->view, 1.0f);
View_SetScale(&camera->play->view, 1.0f);
}
camera->globalCtx->view.fovy = viewFov;
View_LookAt(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp);
camera->play->view.fovy = viewFov;
View_LookAt(&camera->play->view, &viewEye, &viewAt, &viewUp);
camera->camDir.x = eyeAtAngle.pitch;
camera->camDir.y = eyeAtAngle.yaw;
camera->camDir.z = 0;
@@ -7627,18 +7624,18 @@ Vec3s Camera_Update(Camera* camera) {
* When the camera's timer is 0, change the camera to its parent
*/
void Camera_Finish(Camera* camera) {
Camera* mainCam = camera->globalCtx->cameraPtrs[CAM_ID_MAIN];
Player* player = GET_PLAYER(camera->globalCtx);
Camera* mainCam = camera->play->cameraPtrs[CAM_ID_MAIN];
Player* player = GET_PLAYER(camera->play);
if (camera->timer == 0) {
Play_ChangeCameraStatus(camera->globalCtx, camera->parentCamId, CAM_STAT_ACTIVE);
Play_ChangeCameraStatus(camera->play, camera->parentCamId, CAM_STAT_ACTIVE);
if ((camera->parentCamId == CAM_ID_MAIN) && (camera->csId != 0)) {
player->actor.freezeTimer = 0;
player->stateFlags1 &= ~PLAYER_STATE1_29;
if (player->csMode != 0) {
func_8002DF54(camera->globalCtx, &player->actor, 7);
func_8002DF54(camera->play, &player->actor, 7);
osSyncPrintf("camera: player demo end!!\n");
}
@@ -7659,9 +7656,9 @@ void Camera_Finish(Camera* camera) {
camera->childCamId = camera->parentCamId = CAM_ID_MAIN;
camera->timer = -1;
camera->globalCtx->envCtx.fillScreen = false;
camera->play->envCtx.fillScreen = false;
Play_ClearCamera(camera->globalCtx, camera->camId);
Play_ClearCamera(camera->play, camera->camId);
}
}
@@ -7675,7 +7672,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
static s32 modeChangeFlags = 0;
if (QREG(89)) {
osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->globalCtx->state.frames, sCameraModeNames[mode]);
osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, sCameraModeNames[mode]);
}
if (camera->unk_14C & 0x20 && flags == 0) {
@@ -7777,7 +7774,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
func_80078884(0);
break;
case 2:
if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) {
if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) {
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
} else {
func_80078884(NA_SE_SY_ATTENTION_ON);
@@ -7824,7 +7821,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
}
}
if (((setting == CAM_SET_MEADOW_BIRDS_EYE) || (setting == CAM_SET_MEADOW_UNUSED)) && LINK_IS_ADULT &&
(camera->globalCtx->sceneNum == SCENE_SPOT05)) {
(camera->play->sceneNum == SCENE_SPOT05)) {
camera->unk_14A |= 0x10;
return -5;
}
@@ -7871,7 +7868,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
Camera_CopyDataToRegs(camera, camera->mode);
}
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames,
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames,
camera->camId, sCameraSettingNames[camera->setting]);
return setting;
@@ -8198,9 +8195,9 @@ s32 func_8005B198(void) {
s16 func_8005B1A4(Camera* camera) {
camera->unk_14C |= 0x8;
if ((camera->camId == CAM_ID_MAIN) && (camera->globalCtx->activeCamId != CAM_ID_MAIN)) {
GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8;
return camera->globalCtx->activeCamId;
if ((camera->camId == CAM_ID_MAIN) && (camera->play->activeCamId != CAM_ID_MAIN)) {
GET_ACTIVE_CAM(camera->play)->unk_14C |= 0x8;
return camera->play->activeCamId;
}
return camera->camId;
+1 -1
View File
@@ -2398,6 +2398,6 @@ s16 D_8011DAFC[] = {
CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2,
};
GlobalContext* D_8015BD7C;
PlayState* D_8015BD7C;
DbCamera D_8015BD80;
CollisionPoly* playerFloorPoly;
+10 -10
View File
@@ -1,23 +1,23 @@
#include "global.h"
void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214);
void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 214);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_cheap_proc.c", 216),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 219);
CLOSE_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 219);
}
void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 228);
void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) {
OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 228);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_cheap_proc.c", 230),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 233);
CLOSE_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 233);
}
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -1,11 +1,11 @@
#include "global.h"
void func_80110990(GlobalContext* globalCtx) {
Map_Destroy(globalCtx);
void func_80110990(PlayState* play) {
Map_Destroy(play);
}
void func_801109B0(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void func_801109B0(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
u32 parameterSize;
u16 doActionOffset;
u8 temp;
@@ -13,7 +13,7 @@ void func_801109B0(GlobalContext* globalCtx) {
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx);
View_Init(&interfaceCtx->view, play->state.gfxCtx);
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
@@ -32,7 +32,7 @@ void func_801109B0(GlobalContext* globalCtx) {
// "Permanent PARAMETER Segment = %x"
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize, "../z_construct.c", 159);
interfaceCtx->parameterSegment = GameState_Alloc(&play->state, parameterSize, "../z_construct.c", 159);
osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment);
@@ -40,7 +40,7 @@ void func_801109B0(GlobalContext* globalCtx) {
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize,
"../z_construct.c", 162);
interfaceCtx->doActionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
interfaceCtx->doActionSegment = GameState_Alloc(&play->state, 0x480, "../z_construct.c", 166);
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization"
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment);
@@ -69,7 +69,7 @@ void func_801109B0(GlobalContext* globalCtx) {
DmaMgr_SendRequest1(interfaceCtx->doActionSegment + 0x300, (u32)_do_action_staticSegmentRomStart + doActionOffset,
0x180, "../z_construct.c", 178);
interfaceCtx->iconItemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
interfaceCtx->iconItemSegment = GameState_Alloc(&play->state, 0x4000, "../z_construct.c", 190);
// "Icon Item Texture Initialization = %x"
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
@@ -146,8 +146,8 @@ void func_801109B0(GlobalContext* globalCtx) {
osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300); // "Parameter Area = %x"
Health_InitMeter(globalCtx);
Map_Init(globalCtx);
Health_InitMeter(play);
Map_Init(play);
interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0;
@@ -164,29 +164,29 @@ void func_801109B0(GlobalContext* globalCtx) {
R_A_BTN_COLOR(2) = 50;
}
void Message_Init(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_Init(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
s32 pad;
Message_SetTables();
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00;
play->msgCtx.ocarinaMode = OCARINA_MODE_00;
msgCtx->msgMode = MSGMODE_NONE;
msgCtx->msgLength = 0;
msgCtx->textId = msgCtx->textboxEndType = msgCtx->choiceIndex = msgCtx->ocarinaAction = msgCtx->textUnskippable = 0;
msgCtx->textColorAlpha = 255;
View_Init(&msgCtx->view, globalCtx->state.gfxCtx);
View_Init(&msgCtx->view, play->state.gfxCtx);
msgCtx->textboxSegment = GameState_Alloc(&globalCtx->state, 0x2200, "../z_construct.c", 349);
msgCtx->textboxSegment = GameState_Alloc(&play->state, 0x2200, "../z_construct.c", 349);
osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment);
osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); // "Textbox game_alloc=%x"
ASSERT(msgCtx->textboxSegment != NULL, "message->fukidashiSegment != NULL", "../z_construct.c", 352);
Font_LoadOrderedFont(&globalCtx->msgCtx.font);
Font_LoadOrderedFont(&play->msgCtx.font);
YREG(31) = 0;
}
@@ -600,6 +600,6 @@ void func_80111070(void) {
VREG(92) = -63;
}
void func_80112098(GlobalContext* globalCtx) {
void func_80112098(PlayState* play) {
func_80111070();
}
+16 -16
View File
@@ -6,10 +6,10 @@ typedef struct {
/* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw function when called
} DebugDispObjectInfo; // size = 0x8
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*);
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play);
static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = {
DebugDisplay_DrawSpriteI8,
@@ -55,43 +55,43 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX,
return sDebugObjectListHead;
}
void DebugDisplay_DrawObjects(GlobalContext* globalCtx) {
void DebugDisplay_DrawObjects(PlayState* play) {
DebugDispObject* dispObj = sDebugObjectListHead;
DebugDispObjectInfo* objInfo;
while (dispObj != NULL) {
objInfo = &sDebugObjectInfoTable[dispObj->type];
sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx);
sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, play);
dispObj = dispObj->next;
}
}
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 169);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_debug_display.c", 169);
func_80094678(globalCtx->state.gfxCtx);
func_80094678(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_debug_display.c", 189),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gDebugSpriteDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 192);
CLOSE_DISPS(play->state.gfxCtx, "../z_debug_display.c", 192);
}
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 211);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_debug_display.c", 211);
func_8009435C(globalCtx->state.gfxCtx);
func_8009435C(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
@@ -100,9 +100,9 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte
Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_debug_display.c", 228),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 231);
CLOSE_DISPS(play->state.gfxCtx, "../z_debug_display.c", 231);
}
+558 -559
View File
File diff suppressed because it is too large Load Diff
+213 -266
View File
@@ -79,35 +79,35 @@
#include "objects/object_st/object_st.h"
// "Get Item" Model Draw Functions
void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId);
void GetItem_DrawSoldOut(PlayState* play, s16 drawId);
void GetItem_DrawBlueFire(PlayState* play, s16 drawId);
void GetItem_DrawPoes(PlayState* play, s16 drawId);
void GetItem_DrawFairy(PlayState* play, s16 drawId);
void GetItem_DrawMirrorShield(PlayState* play, s16 drawId);
void GetItem_DrawSkullToken(PlayState* play, s16 drawId);
void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId);
void GetItem_DrawCompass(PlayState* play, s16 drawId);
void GetItem_DrawPotion(PlayState* play, s16 drawId);
void GetItem_DrawGoronSword(PlayState* play, s16 drawId);
void GetItem_DrawDekuNuts(PlayState* play, s16 drawId);
void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId);
void GetItem_DrawFish(PlayState* play, s16 drawId);
void GetItem_DrawOpa0(PlayState* play, s16 drawId);
void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId);
void GetItem_DrawXlu01(PlayState* play, s16 drawId);
void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId);
void GetItem_DrawMagicArrow(PlayState* play, s16 drawId);
void GetItem_DrawMagicSpell(PlayState* play, s16 drawId);
void GetItem_DrawOpa1023(PlayState* play, s16 drawId);
void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId);
void GetItem_DrawSmallRupee(PlayState* play, s16 drawId);
void GetItem_DrawScale(PlayState* play, s16 drawId);
void GetItem_DrawBulletBag(PlayState* play, s16 drawId);
void GetItem_DrawWallet(PlayState* play, s16 drawId);
typedef struct {
/* 0x00 */ void (*drawFunc)(GlobalContext*, s16);
/* 0x00 */ void (*drawFunc)(PlayState*, s16);
/* 0x04 */ Gfx* dlists[8];
} DrawItemTableEntry; // size = 0x24
@@ -373,501 +373,448 @@ DrawItemTableEntry sDrawItemTable[] = {
* Draw "Get Item" Model
* Calls the corresponding draw function for the given draw ID
*/
void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) {
sDrawItemTable[drawId].drawFunc(globalCtx, drawId);
void GetItem_Draw(PlayState* play, s16 drawId) {
sDrawItemTable[drawId].drawFunc(play, drawId);
}
// All remaining functions in this file are draw functions referenced in the table and called by the function above
void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 556);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 556);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093BA8(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 560), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 565);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 565);
}
void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSoldOut(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 572);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 572);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 576), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 581);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 581);
}
void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawBlueFire(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 588);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 588);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 592), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 8), 16, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 16,
32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 8), 16, 32));
Matrix_Push();
Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615),
G_MTX_MODELVIEW | G_MTX_LOAD);
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 621);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 621);
}
void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawPoes(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 628);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 628);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 632), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 641), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 6), 16, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 16,
32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 6), 16, 32));
Matrix_Push();
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656),
G_MTX_MODELVIEW | G_MTX_LOAD);
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 663);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 663);
}
void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawFairy(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 670);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 670);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 674), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 683), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 6), 32, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 32,
32, 1, 1 * (play->state.frames * 1), 1 * -(play->state.frames * 6), 32, 32));
Matrix_Push();
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698),
G_MTX_MODELVIEW | G_MTX_LOAD);
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 704);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 704);
}
void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMirrorShield(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 712);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 712);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256,
1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1,
0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32,
32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0) % 256,
1 * (play->state.frames * 2) % 256, 64, 64, 1, 0 * (play->state.frames * 0) % 128,
1 * (play->state.frames * 1) % 128, 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 723), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 730), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 735);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 735);
}
void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSkullToken(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 742);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 742);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 746), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 32, 64));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 1 * -(play->state.frames * 5), 32,
32, 1, 0 * (play->state.frames * 0), 0 * (play->state.frames * 0), 32, 64));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 760), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 765);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 765);
}
void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 772);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 772);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093BA8(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 783);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 783);
}
void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawCompass(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 811);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 811);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 815), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 822), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 827);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 827);
}
void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawPotion(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 834);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 834);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1),
1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1),
1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, -1 * (play->state.frames * 1), 1 * (play->state.frames * 1), 32,
32, 1, -1 * (play->state.frames * 1), 1 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 845), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 855), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[5]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 861);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 861);
}
void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawGoronSword(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 868);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 868);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1),
0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1),
0 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 1), 0 * (play->state.frames * 1), 32,
32, 1, 0 * (play->state.frames * 1), 0 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 878), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 883);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 883);
}
void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 890);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 890);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), 1 * (play->state.frames * 6), 32,
32, 1, 1 * (play->state.frames * 6), 1 * (play->state.frames * 6), 32, 32));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 901), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 906);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 906);
}
void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 913);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 913);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 1), 1 * -(play->state.frames * 3), 32,
32, 1, 0 * (play->state.frames * 1), 1 * -(play->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 924), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 929);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 929);
}
void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawFish(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 936);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 936);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0),
1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0), 1 * (play->state.frames * 1), 32,
32, 1, 0 * (play->state.frames * 0), 1 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 947), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 952);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 952);
}
void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa0(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 959);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 959);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 963), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 968);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 968);
}
void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 975);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 975);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 979), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 986), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 991);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 991);
}
void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawXlu01(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 998);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 998);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1008);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1008);
}
void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1015);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1015);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1019), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1027), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1032);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1032);
}
void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMagicArrow(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1039);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1039);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1043), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1050), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1056);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1056);
}
void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMagicSpell(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1063);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1063);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2),
1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1),
-1 * (globalCtx->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), 1 * -(play->state.frames * 6), 32,
32, 1, 1 * (play->state.frames * 1), -1 * (play->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1074), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1081);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1081);
}
void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa1023(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1088);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1088);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1092), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1100);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1100);
}
void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1108);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1108);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1112), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1120), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1126);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1126);
}
void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1133);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1133);
Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1148), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1154);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1154);
}
void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawScale(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1162);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1162);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2),
-1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4),
1 * -(globalCtx->state.frames * 4), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173),
G_MTX_MODELVIEW | G_MTX_LOAD);
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), -1 * (play->state.frames * 2), 64,
64, 1, 1 * (play->state.frames * 4), 1 * -(play->state.frames * 4), 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1173), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1181);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1181);
}
void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawBulletBag(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1188);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1188);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1207);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1207);
}
void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawWallet(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1214);
OPEN_DISPS(play->state.gfxCtx, "../z_draw.c", 1214);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218),
G_MTX_MODELVIEW | G_MTX_LOAD);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_draw.c", 1218), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]);
@@ -877,5 +824,5 @@ void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) {
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[6]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[7]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1230);
CLOSE_DISPS(play->state.gfxCtx, "../z_draw.c", 1230);
}
+4 -4
View File
@@ -52,7 +52,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
this->lightInfo.type = LIGHT_POINT_NOGLOW;
this->lightInfo.params.point = initParams->lightPoint;
this->lightNode =
LightContext_InsertLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, &this->lightInfo);
LightContext_InsertLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, &this->lightInfo);
} else {
this->lightNode = NULL;
}
@@ -63,10 +63,10 @@ void EffectShieldParticle_Destroy(void* thisx) {
EffectShieldParticle* this = (EffectShieldParticle*)thisx;
if ((this != NULL) && (this->lightDecay == true)) {
if (this->lightNode == Effect_GetGlobalCtx()->lightCtx.listHead) {
Effect_GetGlobalCtx()->lightCtx.listHead = this->lightNode->next;
if (this->lightNode == Effect_GetPlayState()->lightCtx.listHead) {
Effect_GetPlayState()->lightCtx.listHead = this->lightNode->next;
}
LightContext_RemoveLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, this->lightNode);
LightContext_RemoveLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, this->lightNode);
}
}
+2 -2
View File
@@ -131,7 +131,7 @@ s32 EffectSpark_Update(void* thisx) {
void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
Vtx* vertices;
EffectSpark* this = (EffectSpark*)thisx;
GlobalContext* globalCtx = Effect_GetGlobalCtx();
PlayState* play = Effect_GetPlayState();
s32 i;
s32 j;
u8 sp1D3;
@@ -210,7 +210,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z);
temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f;
SkinMatrix_SetScale(&spAC, temp, temp, 1.0f);
SkinMatrix_MtxFMtxFMult(&spEC, &globalCtx->billboardMtxF, &sp6C);
SkinMatrix_MtxFMtxFMult(&spEC, &play->billboardMtxF, &sp6C);
SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C);
vertices[j].v.ob[0] = -32;
+20 -20
View File
@@ -1,11 +1,11 @@
#include "global.h"
void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
f32 absCos;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 113);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 113);
displayListHead = POLY_OPA_DISP;
cos = Math_CosS((0x8000 / arg3) * arg2);
@@ -25,15 +25,15 @@ void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
if (1) {} // Necessary to match
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 129);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 129);
}
void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
Gfx* displayListHead;
f32 cos;
if (arg3 != 0) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 141);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 141);
cos = Math_CosS((0x4000 / arg3) * arg2);
displayListHead = POLY_OPA_DISP;
@@ -46,27 +46,27 @@ void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
if (1) {} // Necessary to match
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 153);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 153);
}
}
void func_80026608(GlobalContext* globalCtx) {
void func_80026608(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 159);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 159);
gDPPipeSync(POLY_OPA_DISP++);
POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 164);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 164);
}
void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
f32 absCos;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 178);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 178);
displayListHead = POLY_XLU_DISP;
cos = Math_CosS((0x8000 / arg3) * arg2);
@@ -86,14 +86,14 @@ void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
if (1) {} // Necessary to match
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 194);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 194);
}
void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 201);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 201);
displayListHead = POLY_XLU_DISP;
cos = Math_CosS((0x4000 / arg3) * arg2);
@@ -106,16 +106,16 @@ void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
if (1) {} // Necessary to match
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 212);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 212);
}
void func_80026A6C(GlobalContext* globalCtx) {
void func_80026A6C(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 217);
OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 217);
gDPPipeSync(POLY_XLU_DISP++);
POLY_XLU_DISP = Play_SetFog(globalCtx, POLY_XLU_DISP);
POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 222);
CLOSE_DISPS(play->state.gfxCtx, "../z_eff_ss_dead.c", 222);
}
+12 -12
View File
@@ -33,8 +33,8 @@ EffectInfo sEffectInfoTable[] = {
},
};
GlobalContext* Effect_GetGlobalCtx(void) {
return sEffectContext.globalCtx;
PlayState* Effect_GetPlayState(void) {
return sEffectContext.play;
}
void* Effect_GetByIndex(s32 index) {
@@ -77,7 +77,7 @@ void Effect_InitStatus(EffectStatus* status) {
status->unk_02 = 0;
}
void Effect_InitContext(GlobalContext* globalCtx) {
void Effect_InitContext(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
@@ -93,10 +93,10 @@ void Effect_InitContext(GlobalContext* globalCtx) {
Effect_InitStatus(&sEffectContext.blures[i].status);
}
sEffectContext.globalCtx = globalCtx;
sEffectContext.play = play;
}
void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) {
void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) {
s32 i;
u32 slotFound;
void* effect = NULL;
@@ -104,7 +104,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg
*pIndex = TOTAL_EFFECT_COUNT;
if (FrameAdvance_IsEnabled(globalCtx) != true) {
if (FrameAdvance_IsEnabled(play) != true) {
slotFound = false;
switch (type) {
case EFFECT_SPARK:
@@ -181,13 +181,13 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) {
}
}
void Effect_UpdateAll(GlobalContext* globalCtx) {
void Effect_UpdateAll(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
if (sEffectContext.sparks[i].status.active) {
if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) {
Effect_Delete(globalCtx, i);
Effect_Delete(play, i);
}
}
}
@@ -195,7 +195,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
for (i = 0; i < BLURE_COUNT; i++) {
if (sEffectContext.blures[i].status.active) {
if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) {
Effect_Delete(globalCtx, i + SPARK_COUNT);
Effect_Delete(play, i + SPARK_COUNT);
}
}
}
@@ -203,13 +203,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
if (sEffectContext.shieldParticles[i].status.active) {
if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) {
Effect_Delete(globalCtx, i + SPARK_COUNT + BLURE_COUNT);
Effect_Delete(play, i + SPARK_COUNT + BLURE_COUNT);
}
}
}
}
void Effect_Delete(GlobalContext* globalCtx, s32 index) {
void Effect_Delete(PlayState* play, s32 index) {
if (index == TOTAL_EFFECT_COUNT) {
return;
}
@@ -235,7 +235,7 @@ void Effect_Delete(GlobalContext* globalCtx, s32 index) {
}
}
void Effect_DeleteAll(GlobalContext* globalCtx) {
void Effect_DeleteAll(PlayState* play) {
s32 i;
osSyncPrintf("エフェクト総て解放\n"); // "All effect release"
+18 -19
View File
@@ -3,7 +3,7 @@
EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info"
void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
void EffectSs_InitInfo(PlayState* play, s32 tableSize) {
u32 i;
EffectSs* effectSs;
EffectSsOverlay* overlay;
@@ -14,8 +14,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
(u32)overlay->vramEnd - (u32)overlay->vramStart, overlay->vromEnd - overlay->vromStart);
}
sEffectSsInfo.table =
GameState_Alloc(&globalCtx->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289);
sEffectSsInfo.table = GameState_Alloc(&play->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289);
ASSERT(sEffectSsInfo.table != NULL, "EffectSS2Info.data_table != NULL", "../z_effect_soft_sprite.c", 290);
sEffectSsInfo.searchStartIndex = 0;
@@ -32,7 +31,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
}
}
void EffectSs_ClearAll(GlobalContext* globalCtx) {
void EffectSs_ClearAll(PlayState* play) {
u32 i;
EffectSs* effectSs;
EffectSsOverlay* overlay;
@@ -153,10 +152,10 @@ s32 EffectSs_FindSlot(s32 priority, s32* pIndex) {
return 0;
}
void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
void EffectSs_Insert(PlayState* play, EffectSs* effectSs) {
s32 index;
if (FrameAdvance_IsEnabled(globalCtx) != true) {
if (FrameAdvance_IsEnabled(play) != true) {
if (EffectSs_FindSlot(effectSs->priority, &index) == 0) {
sEffectSsInfo.searchStartIndex = index + 1;
sEffectSsInfo.table[index] = *effectSs;
@@ -165,7 +164,7 @@ void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
}
// original name: "EffectSoftSprite2_makeEffect"
void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams) {
void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
s32 index;
u32 overlaySize;
EffectSsOverlay* overlayEntry;
@@ -234,7 +233,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
sEffectSsInfo.table[index].type = type;
sEffectSsInfo.table[index].priority = priority;
if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) {
if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Construction failed for some reason. The constructor returned an error.
// Ceasing effect addition."
@@ -246,7 +245,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
}
}
void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
void EffectSs_Update(PlayState* play, s32 index) {
EffectSs* effectSs = &sEffectSsInfo.table[index];
if (effectSs->update != NULL) {
@@ -258,11 +257,11 @@ void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
effectSs->pos.y += effectSs->velocity.y;
effectSs->pos.z += effectSs->velocity.z;
effectSs->update(globalCtx, index, effectSs);
effectSs->update(play, index, effectSs);
}
}
void EffectSs_UpdateAll(GlobalContext* globalCtx) {
void EffectSs_UpdateAll(PlayState* play) {
s32 i;
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
@@ -275,26 +274,26 @@ void EffectSs_UpdateAll(GlobalContext* globalCtx) {
}
if (sEffectSsInfo.table[i].life > -1) {
EffectSs_Update(globalCtx, i);
EffectSs_Update(play, i);
}
}
}
void EffectSs_Draw(GlobalContext* globalCtx, s32 index) {
void EffectSs_Draw(PlayState* play, s32 index) {
EffectSs* effectSs = &sEffectSsInfo.table[index];
if (effectSs->draw != NULL) {
effectSs->draw(globalCtx, index, effectSs);
effectSs->draw(play, index, effectSs);
}
}
// original name: "EffectSoftSprite2_disp"
void EffectSs_DrawAll(GlobalContext* globalCtx) {
Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
void EffectSs_DrawAll(PlayState* play) {
Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
s32 i;
Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL);
Lights_Draw(lights, globalCtx->state.gfxCtx);
Lights_BindAll(lights, play->lightCtx.listHead, NULL);
Lights_Draw(lights, play->state.gfxCtx);
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
if (sEffectSsInfo.table[i].life > -1) {
@@ -317,7 +316,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) {
EffectSs_Delete(&sEffectSsInfo.table[i]);
} else {
EffectSs_Draw(globalCtx, i);
EffectSs_Draw(play, i);
}
}
}
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -148,12 +148,12 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) {
}
}
u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
u16 ElfMessage_GetSariaText(PlayState* play) {
Player* player = GET_PLAYER(play);
ElfMessage* msgs;
if (!LINK_IS_ADULT) {
if (Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) {
if (Actor_FindNearby(play, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) {
msgs = sChildSariaMsgs;
} else {
return 0x0160; // Special text about Saria preferring to talk to you face-to-face
@@ -165,10 +165,10 @@ u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) {
return ElfMessage_GetTextFromMsgs(msgs);
}
u16 ElfMessage_GetCUpText(GlobalContext* globalCtx) {
if (globalCtx->cUpElfMsgs == NULL) {
u16 ElfMessage_GetCUpText(PlayState* play) {
if (play->cUpElfMsgs == NULL) {
return 0;
} else {
return ElfMessage_GetTextFromMsgs(globalCtx->cUpElfMsgs);
return ElfMessage_GetTextFromMsgs(play->cUpElfMsgs);
}
}
+36 -36
View File
@@ -4,16 +4,16 @@
#define FLAGS ACTOR_FLAG_4
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Init(Actor* thisx, PlayState* play);
void EnAObj_Destroy(Actor* thisx, PlayState* play);
void EnAObj_Update(Actor* thisx, PlayState* play);
void EnAObj_Draw(Actor* thisx, PlayState* play);
void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play);
void EnAObj_WaitTalk(EnAObj* this, PlayState* play);
void EnAObj_BlockRot(EnAObj* this, PlayState* play);
void EnAObj_BoulderFragment(EnAObj* this, PlayState* play);
void EnAObj_Block(EnAObj* this, PlayState* play);
void EnAObj_SetupWaitTalk(EnAObj* this, s16 type);
void EnAObj_SetupBlockRot(EnAObj* this, s16 type);
@@ -82,7 +82,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
s32 pad;
EnAObj* this = (EnAObj*)thisx;
@@ -129,13 +129,13 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
case A_OBJ_BLOCK_LARGE:
case A_OBJ_BLOCK_HUGE:
this->dyna.bgId = 1;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG);
EnAObj_SetupBlock(this, thisx->params);
break;
case A_OBJ_BLOCK_SMALL_ROT:
case A_OBJ_BLOCK_LARGE_ROT:
this->dyna.bgId = 3;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG);
EnAObj_SetupBlockRot(this, thisx->params);
break;
case A_OBJ_UNKNOWN_6:
@@ -157,8 +157,8 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
this->focusYoffset = 45.0f;
EnAObj_SetupWaitTalk(this, thisx->params);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
thisx->targetMode = 0;
break;
@@ -178,25 +178,25 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
if (this->dyna.bgId != BGACTOR_NEG_ONE) {
CollisionHeader_GetVirtual(sColHeaders[this->dyna.bgId], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
}
}
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Destroy(Actor* thisx, PlayState* play) {
EnAObj* this = (EnAObj*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
switch (this->dyna.actor.params) {
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
break;
}
}
void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) {
void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->dyna.actor, play)) {
EnAObj_SetupWaitTalk(this, this->dyna.actor.params);
}
}
@@ -205,17 +205,17 @@ void EnAObj_SetupWaitTalk(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_WaitTalk);
}
void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_WaitTalk(EnAObj* this, PlayState* play) {
s16 relYawTowardsPlayer;
if (this->dyna.actor.textId != 0) {
relYawTowardsPlayer = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
if (ABS(relYawTowardsPlayer) < 0x2800 ||
(this->dyna.actor.params == A_OBJ_SIGNPOST_ARROW && ABS(relYawTowardsPlayer) > 0x5800)) {
if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) {
EnAObj_SetupAction(this, EnAObj_WaitFinishedTalking);
} else {
func_8002F2F4(&this->dyna.actor, globalCtx);
func_8002F2F4(&this->dyna.actor, play);
}
}
}
@@ -229,7 +229,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_BlockRot);
}
void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_BlockRot(EnAObj* this, PlayState* play) {
if (this->rotateState == 0) {
if (this->dyna.unk_160 != 0) {
this->rotateState++;
@@ -272,7 +272,7 @@ void EnAObj_SetupBoulderFragment(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_BoulderFragment);
}
void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_BoulderFragment(EnAObj* this, PlayState* play) {
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f);
this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x >> 1;
this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z >> 1;
@@ -301,7 +301,7 @@ void EnAObj_SetupBlock(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_Block);
}
void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_Block(EnAObj* this, PlayState* play) {
this->dyna.actor.speedXZ += this->dyna.unk_150;
this->dyna.actor.world.rot.y = this->dyna.unk_158;
this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f);
@@ -316,19 +316,19 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) {
this->dyna.unk_150 = 0.0f;
}
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Update(Actor* thisx, PlayState* play) {
EnAObj* this = (EnAObj*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Actor_MoveForward(&this->dyna.actor);
if (this->dyna.actor.gravity != 0.0f) {
if (this->dyna.actor.params != A_OBJ_BOULDER_FRAGMENT) {
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f,
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 40.0f, 0.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4);
} else {
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f,
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 20.0f, 0.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4);
}
@@ -341,17 +341,17 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
break;
}
}
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Draw(Actor* thisx, PlayState* play) {
s32 type = thisx->params;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 701);
OPEN_DISPS(play->state.gfxCtx, "../z_en_a_keep.c", 701);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
if (type >= A_OBJ_MAX) {
type = A_OBJ_BOULDER_FRAGMENT;
@@ -361,9 +361,9 @@ void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 1, 60, 60, 60, 50);
}
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_a_keep.c", 712),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDLists[type]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_a_keep.c", 715);
}
+139 -140
View File
@@ -5,20 +5,20 @@
#define FLAGS 0
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Init(Actor* thisx, PlayState* play);
void EnItem00_Destroy(Actor* thisx, PlayState* play);
void EnItem00_Update(Actor* thisx, PlayState* play);
void EnItem00_Draw(Actor* thisx, PlayState* play);
void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx);
void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx);
void func_8001E304(EnItem00* this, GlobalContext* globalCtx);
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx);
void func_8001DFC8(EnItem00* this, PlayState* play);
void func_8001E1C8(EnItem00* this, PlayState* play);
void func_8001E304(EnItem00* this, PlayState* play);
void func_8001E5C8(EnItem00* this, PlayState* play);
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
void EnItem00_DrawCollectible(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
const ActorInit En_Item00_InitVars = {
ACTOR_EN_ITEM00,
@@ -136,7 +136,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Init(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
f32 yOffset = 980.0f;
@@ -149,14 +149,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.params &= 0xFF;
if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) {
if (Flags_GetCollectible(play, this->collectibleFlag)) {
Actor_Kill(&this->actor);
return;
}
Actor_ProcessInitChain(&this->actor, sInitChain);
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);
this->unk_158 = 1;
@@ -236,8 +236,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->scale = 0.01f;
break;
case ITEM00_SHIELD_DEKU:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@@ -245,8 +245,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.world.rot.x = 0x4000;
break;
case ITEM00_SHIELD_HYLIAN:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@@ -255,8 +255,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
case ITEM00_TUNIC_ZORA:
case ITEM00_TUNIC_GORON:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@@ -286,41 +286,41 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
Item_Give(play, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
Item_Give(play, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
Item_Give(globalCtx, ITEM_RUPEE_RED);
Item_Give(play, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_GOLD);
Item_Give(play, ITEM_RUPEE_GOLD);
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
Health_ChangeBy(globalCtx, 0x70);
Health_ChangeBy(play, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
Item_Give(play, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_SINGLE:
Item_Give(globalCtx, ITEM_BOW);
Item_Give(play, ITEM_BOW);
break;
case ITEM00_ARROWS_SMALL:
Item_Give(globalCtx, ITEM_ARROWS_SMALL);
Item_Give(play, ITEM_ARROWS_SMALL);
break;
case ITEM00_ARROWS_MEDIUM:
Item_Give(globalCtx, ITEM_ARROWS_MEDIUM);
Item_Give(play, ITEM_ARROWS_MEDIUM);
break;
case ITEM00_ARROWS_LARGE:
Item_Give(globalCtx, ITEM_ARROWS_LARGE);
Item_Give(play, ITEM_ARROWS_LARGE);
break;
case ITEM00_MAGIC_LARGE:
getItemId = GI_MAGIC_SMALL;
@@ -329,7 +329,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_MAGIC_LARGE;
break;
case ITEM00_SMALL_KEY:
Item_Give(globalCtx, ITEM_KEY_SMALL);
Item_Give(play, ITEM_KEY_SMALL);
break;
case ITEM00_SEEDS:
getItemId = GI_SEEDS_5;
@@ -350,21 +350,21 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
}
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
func_8002F554(&this->actor, globalCtx, getItemId);
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) {
func_8002F554(&this->actor, play, getItemId);
}
EnItem00_SetupAction(this, func_8001E5C8);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Destroy(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
void func_8001DFC8(EnItem00* this, PlayState* play) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960;
@@ -410,7 +410,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E1C8(EnItem00* this, PlayState* play) {
f32 originalVelocity;
Vec3f effectPos;
@@ -418,11 +418,11 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += 960;
}
if (globalCtx->gameplayFrames & 1) {
if (play->gameplayFrames & 1) {
effectPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
effectPos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f);
effectPos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f);
EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
EffectSsKiraKira_SpawnSmall(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
}
@@ -438,7 +438,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E304(EnItem00* this, PlayState* play) {
s32 pad;
Vec3f pos;
s32 rotOffset;
@@ -477,12 +477,11 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
}
}
if (!(globalCtx->gameplayFrames & 1)) {
if (!(play->gameplayFrames & 1)) {
pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f;
pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f;
pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f;
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
EffectSsKiraKira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
@@ -493,12 +492,12 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8001E5C8(EnItem00* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->getItemId != GI_NONE) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f);
if (!Actor_HasParent(&this->actor, play)) {
func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f);
this->unk_15A++;
} else {
this->getItemId = GI_NONE;
@@ -526,7 +525,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
}
// The BSS in the function acted weird in the past. It is matching now but might cause issues in the future
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Update(Actor* thisx, PlayState* play) {
static u32 D_80157D90;
static s16 D_80157D94[1];
s16* params;
@@ -546,7 +545,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk_156 = this->unk_15A;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Math_SmoothStepToF(&this->actor.scale.x, this->scale, 0.1f, this->scale * 0.1f, 0.0f);
temp = &D_80157D90;
@@ -555,12 +554,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.gravity) {
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
if (*temp != globalCtx->gameplayFrames) {
D_80157D90 = globalCtx->gameplayFrames;
if (*temp != play->gameplayFrames) {
D_80157D90 = play->gameplayFrames;
D_80157D94[0] = 0;
for (i = 0; i < 50; i++) {
if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) {
dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor;
if (play->colCtx.dyna.bgActorFlags[i] & 1) {
dynaActor = play->colCtx.dyna.bgActors[i].actor;
if ((dynaActor != NULL) && (dynaActor->update != NULL)) {
if ((dynaActor->world.pos.x != dynaActor->prevPos.x) ||
(dynaActor->world.pos.y != dynaActor->prevPos.y) ||
@@ -579,7 +578,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (sp3A || D_80157D94[0]) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f,
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 15.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4);
@@ -591,7 +590,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) ||
(this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) {
@@ -605,30 +604,30 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if (!((this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) &&
(this->actor.yDistToPlayer <= 50.0f))) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
if (!Actor_HasParent(&this->actor, play)) {
return;
}
}
if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) {
if (play->gameOverCtx.state != GAMEOVER_INACTIVE) {
return;
}
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
Item_Give(play, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
Item_Give(play, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
Item_Give(globalCtx, ITEM_RUPEE_RED);
Item_Give(play, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_GOLD);
Item_Give(play, ITEM_RUPEE_GOLD);
break;
case ITEM00_STICK:
getItemId = GI_STICKS_1;
@@ -637,26 +636,26 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_NUTS_5;
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
Health_ChangeBy(globalCtx, 0x70);
Health_ChangeBy(play, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
Item_Give(play, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_SINGLE:
Item_Give(globalCtx, ITEM_BOW);
Item_Give(play, ITEM_BOW);
break;
case ITEM00_ARROWS_SMALL:
Item_Give(globalCtx, ITEM_ARROWS_SMALL);
Item_Give(play, ITEM_ARROWS_SMALL);
break;
case ITEM00_ARROWS_MEDIUM:
Item_Give(globalCtx, ITEM_ARROWS_MEDIUM);
Item_Give(play, ITEM_ARROWS_MEDIUM);
break;
case ITEM00_ARROWS_LARGE:
Item_Give(globalCtx, ITEM_ARROWS_LARGE);
Item_Give(play, ITEM_ARROWS_LARGE);
break;
case ITEM00_SEEDS:
getItemId = GI_SEEDS_5;
@@ -694,8 +693,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
params = &this->actor.params;
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
func_8002F554(&this->actor, globalCtx, getItemId);
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) {
func_8002F554(&this->actor, play, getItemId);
}
switch (*params) {
@@ -706,8 +705,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_SHIELD_HYLIAN:
case ITEM00_TUNIC_ZORA:
case ITEM00_TUNIC_GORON:
if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag);
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_Kill(&this->actor);
}
return;
@@ -717,8 +716,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else if (getItemId != GI_NONE) {
if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag);
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_Kill(&this->actor);
}
return;
@@ -727,7 +726,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
Flags_SetCollectible(globalCtx, this->collectibleFlag);
Flags_SetCollectible(play, this->collectibleFlag);
this->unk_15A = 15;
this->unk_154 = 35;
@@ -742,7 +741,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00_SetupAction(this, func_8001E5C8);
}
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Draw(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
f32 mtxScale;
@@ -753,28 +752,28 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_RUPEE_RED:
case ITEM00_RUPEE_ORANGE:
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, globalCtx);
EnItem00_DrawRupee(this, play);
break;
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, globalCtx);
EnItem00_DrawHeartPiece(this, play);
break;
case ITEM00_HEART_CONTAINER:
EnItem00_DrawHeartContainer(this, globalCtx);
EnItem00_DrawHeartContainer(this, play);
break;
case ITEM00_HEART:
if (this->unk_15A < 0) {
if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(globalCtx, &this->actor);
Actor_SetObjectDependency(play, &this->actor);
this->unk_15A = -2;
}
} else {
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(globalCtx, GID_HEART);
GetItem_Draw(play, GID_HEART);
}
break;
}
@@ -791,19 +790,19 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_MAGIC_SMALL:
case ITEM00_SEEDS:
case ITEM00_SMALL_KEY:
EnItem00_DrawCollectible(this, globalCtx);
EnItem00_DrawCollectible(this, play);
break;
case ITEM00_SHIELD_DEKU:
GetItem_Draw(globalCtx, GID_SHIELD_DEKU);
GetItem_Draw(play, GID_SHIELD_DEKU);
break;
case ITEM00_SHIELD_HYLIAN:
GetItem_Draw(globalCtx, GID_SHIELD_HYLIAN);
GetItem_Draw(play, GID_SHIELD_HYLIAN);
break;
case ITEM00_TUNIC_ZORA:
GetItem_Draw(globalCtx, GID_TUNIC_ZORA);
GetItem_Draw(play, GID_TUNIC_ZORA);
break;
case ITEM00_TUNIC_GORON:
GetItem_Draw(globalCtx, GID_TUNIC_GORON);
GetItem_Draw(play, GID_TUNIC_GORON);
break;
case ITEM00_FLEXIBLE:
break;
@@ -814,14 +813,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
/**
* Draw Function used for Rupee types of En_Item00.
*/
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
s32 pad;
s32 texIndex;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1546);
OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1546);
func_80093D18(globalCtx->state.gfxCtx);
func_8002EBCC(&this->actor, globalCtx, 0);
func_80093D18(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
if (this->actor.params <= ITEM00_RUPEE_RED) {
texIndex = this->actor.params;
@@ -829,25 +828,25 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
texIndex = this->actor.params - 0x10;
}
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1562),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[texIndex]));
gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1568);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1568);
}
/**
* Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...).
*/
void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) {
s32 texIndex = this->actor.params - 3;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594);
OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1594);
POLY_OPA_DISP = Play_SetFog(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
texIndex = 1;
@@ -859,51 +858,51 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[texIndex]));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1607),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1611);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1611);
}
/**
* Draw Function used for the Heart Container type of En_Item00.
*/
void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1623);
OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1623);
func_80093D18(globalCtx->state.gfxCtx);
func_8002EBCC(&this->actor, globalCtx, 0);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634),
func_80093D18(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1634),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gHeartPieceExteriorDL);
func_80093D84(globalCtx->state.gfxCtx);
func_8002ED80(&this->actor, globalCtx, 0);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644),
func_80093D84(play->state.gfxCtx);
func_8002ED80(&this->actor, play, 0);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1644),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gHeartContainerInteriorDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1647);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1647);
}
/**
* Draw Function used for the Piece of Heart type of En_Item00.
*/
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1658);
OPEN_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1658);
func_80093D84(globalCtx->state.gfxCtx);
func_8002ED80(&this->actor, globalCtx, 0);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670),
func_80093D84(play->state.gfxCtx);
func_8002ED80(&this->actor, play, 0);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_item00.c", 1670),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1673);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_item00.c", 1673);
}
/**
@@ -942,7 +941,7 @@ s16 func_8001F404(s16 dropId) {
// External functions used by other actors to drop collectibles, which usually results in spawning an En_Item00 actor.
EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) {
EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) {
s32 pad[2];
EnItem00* spawnedActor = NULL;
s16 param4000 = params & 0x4000;
@@ -953,18 +952,18 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF,
40);
} else {
if (!param8000) {
params = func_8001F404(params & 0x00FF);
}
if (params != -1) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
if ((spawnedActor != NULL) && !param8000) {
spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f;
spawnedActor->actor.speedXZ = 2.0f;
@@ -985,7 +984,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
return spawnedActor;
}
EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) {
EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params) {
EnItem00* spawnedActor = NULL;
s32 pad;
s16 param4000 = params & 0x4000;
@@ -996,15 +995,15 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF,
40);
} else {
params = func_8001F404(params & 0x00FF);
if (params != -1) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
if ((spawnedActor != NULL) && !param8000) {
spawnedActor->actor.velocity.y = 0.0f;
spawnedActor->actor.speedXZ = 0.0f;
@@ -1018,7 +1017,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
return spawnedActor;
}
void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) {
void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) {
s32 pad;
EnItem00* spawnedActor;
s16 dropQuantity;
@@ -1065,9 +1064,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (dropId == ITEM00_FLEXIBLE) {
if (gSaveContext.health <= 0x10) { // 1 heart or less
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0,
0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0,
FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
return;
} else if (gSaveContext.health <= 0x30) { // 3 hearts or less
@@ -1113,7 +1112,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (!param8000) {
dropId = func_8001F404(dropId);
if (dropId != ITEM00_NONE) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != NULL) && (dropId != ITEM00_NONE)) {
spawnedActor->actor.velocity.y = 8.0f;
@@ -1132,7 +1131,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
}
}
} else {
Item_DropCollectible(globalCtx, spawnPos, params | 0x8000);
Item_DropCollectible(play, spawnPos, params | 0x8000);
}
dropQuantity--;
}
+2 -2
View File
@@ -63,8 +63,8 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 },
};
u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) {
u8 currentMask = Player_GetMask(globalCtx);
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u8 currentMask = Player_GetMask(play);
return sReactionTextIds[reactionSet][currentMask];
}
+17 -17
View File
@@ -44,7 +44,7 @@ void SkelCurve_Clear(SkelCurve* skelCurve) {
*
* @return bool always true
*/
s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg,
s32 SkelCurve_Init(PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg,
CurveAnimationHeader* animation) {
SkelCurveLimb** limbs;
CurveSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
@@ -62,7 +62,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeleton
/**
* Frees the joint table.
*/
void SkelCurve_Destroy(GlobalContext* globalCtx, SkelCurve* skelCurve) {
void SkelCurve_Destroy(PlayState* play, SkelCurve* skelCurve) {
if (skelCurve->jointTable != NULL) {
ZeldaArena_FreeDebug(skelCurve->jointTable, "../z_fcurve_data_skelanime.c", 146);
}
@@ -92,7 +92,7 @@ typedef enum {
*
* @return bool true when the animation has finished.
*/
s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) {
s32 SkelCurve_Update(PlayState* play, SkelCurve* skelCurve) {
s16* jointData;
u8* knotCounts;
CurveAnimationHeader* animation;
@@ -156,16 +156,16 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) {
/**
* Recursively draws limbs with appropriate properties.
*/
void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw,
PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->skeleton[limbIndex]);
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279);
OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279);
Matrix_Push();
if ((overrideLimbDraw == NULL) ||
((overrideLimbDraw != NULL) && overrideLimbDraw(globalCtx, skelCurve, limbIndex, data))) {
((overrideLimbDraw != NULL) && overrideLimbDraw(play, skelCurve, limbIndex, data))) {
Vec3f scale;
Vec3s rot;
Vec3f pos;
@@ -192,7 +192,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
dList = limb->dList[0];
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
@@ -201,13 +201,13 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
dList = limb->dList[0];
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
dList = limb->dList[1];
if (dList != NULL) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, dList);
}
@@ -218,25 +218,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, skelCurve, limbIndex, data);
postLimbDraw(play, skelCurve, limbIndex, data);
}
if (limb->child != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371);
CLOSE_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371);
}
void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
void SkelCurve_Draw(Actor* actor, PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw,
PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
if (skelCurve->jointTable != NULL) {
SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ GameStateOverlay gGameStateOverlayTable[] = {
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)),
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(GlobalContext)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)),
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
};
+13 -13
View File
@@ -1,23 +1,23 @@
#include "global.h"
void GameOver_Init(GlobalContext* globalCtx) {
globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE;
void GameOver_Init(PlayState* play) {
play->gameOverCtx.state = GAMEOVER_INACTIVE;
}
void GameOver_FadeInLights(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_FadeInLights(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) ||
(gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) {
Environment_FadeInGameOverLights(globalCtx);
Environment_FadeInGameOverLights(play);
}
}
// This variable cannot be moved into this file as all of z_message_PAL rodata is in the way
extern s16 gGameOverTimer;
void GameOver_Update(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_Update(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
s16 i;
s16 j;
s32 v90;
@@ -26,7 +26,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
switch (gameOverCtx->state) {
case GAMEOVER_DEATH_START:
Message_CloseTextbox(globalCtx);
Message_CloseTextbox(play);
gSaveContext.timer1State = 0;
gSaveContext.timer2State = 0;
@@ -41,7 +41,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) {
if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) {
gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i];
Interface_LoadItemIcon1(globalCtx, j);
Interface_LoadItemIcon1(play, j);
}
}
}
@@ -72,7 +72,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Environment_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(play);
gGameOverTimer = 20;
if (1) {}
v90 = VREG(90);
@@ -92,7 +92,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gGameOverTimer--;
if (gGameOverTimer == 0) {
globalCtx->pauseCtx.state = 8;
play->pauseCtx.state = 8;
gameOverCtx->state++;
func_800AA15C();
}
@@ -101,7 +101,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
case GAMEOVER_REVIVE_START:
gameOverCtx->state++;
gGameOverTimer = 0;
Environment_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(play);
ShrinkWindow_SetVal(0x20);
return;
@@ -137,7 +137,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
break;
case GAMEOVER_REVIVE_FADE_OUT:
Environment_FadeOutGameOverLights(globalCtx);
Environment_FadeOutGameOverLights(play);
gGameOverTimer--;
if (gGameOverTimer == 0) {
+57 -60
View File
@@ -15,7 +15,7 @@ s32 func_8006CFC0(s32 scene) {
return 0;
}
void func_8006D074(GlobalContext* globalCtx) {
void func_8006D074(PlayState* play) {
gSaveContext.horseData.scene = SCENE_SPOT00;
gSaveContext.horseData.pos.x = -1840;
gSaveContext.horseData.pos.y = 72;
@@ -23,7 +23,7 @@ void func_8006D074(GlobalContext* globalCtx) {
gSaveContext.horseData.angle = -27353;
}
void func_8006D0AC(GlobalContext* globalCtx) {
void func_8006D0AC(PlayState* play) {
if (gSaveContext.horseData.scene == SCENE_SPOT06) {
gSaveContext.horseData.scene = SCENE_SPOT06;
gSaveContext.horseData.pos.x = -2065;
@@ -40,7 +40,7 @@ typedef struct {
/* 0x0A */ s16 type;
} HorseSpawn;
void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
void func_8006D0EC(PlayState* play, Player* player) {
s32 i;
HorseSpawn horseSpawns[] = {
{ SCENE_SPOT00, -460, 100, 6640, 0, 2 }, { SCENE_SPOT06, -1929, -1025, 768, 0, 2 },
@@ -49,41 +49,40 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
};
if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0))) {
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x,
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x,
player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x,
player->actor.shape.rot.y, player->actor.shape.rot.z, 9);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 343);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
player->rideActor->room = -1;
}
} else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) {
} else if ((play->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) {
Actor* horseActor;
gSaveContext.minigameState = 0;
horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
horseActor->room = -1;
} else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_18)) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389);
} else if ((globalCtx->sceneNum == gSaveContext.horseData.scene) &&
} else if ((play->sceneNum == gSaveContext.horseData.scene) &&
(Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0)) {
// "Set by existence of horse %d %d %d"
osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.scene,
Flags_GetEventChkInf(EVENTCHKINF_18), DREG(1));
if (func_8006CFC0(gSaveContext.horseData.scene)) {
Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y,
gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1);
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x,
gSaveContext.horseData.pos.y, gSaveContext.horseData.pos.z, 0,
gSaveContext.horseData.angle, 0, 1);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 414);
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
horseActor->room = -1;
}
} else {
@@ -91,21 +90,20 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
// "Horse_SetNormal():%d set spot is no good."
osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horseData.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
func_8006D074(play);
}
} else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
} else if ((play->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443);
} else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) {
for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) {
HorseSpawn* horseSpawn = &horseSpawns[i];
if (horseSpawn->scene == globalCtx->sceneNum) {
if (horseSpawn->scene == play->sceneNum) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y,
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y,
horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 466);
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
horseActor->room = -1;
}
@@ -113,8 +111,8 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
}
}
} else if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) && !IS_DAY) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
if ((DREG(1) == 0) && (play->sceneNum == SCENE_SOUKO) && !IS_DAY) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
}
}
}
@@ -127,7 +125,7 @@ typedef struct {
/* 0x10 */ s16 type;
} struct_8011F9B8;
void func_8006D684(GlobalContext* globalCtx, Player* player) {
void func_8006D684(PlayState* play, Player* player) {
s32 pad;
s32 i;
Vec3s spawnPos;
@@ -152,24 +150,24 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
spawnPos = spawnPositions[3];
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y,
spawnPos.z, 0, player->actor.world.rot.y, 0, 7);
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, spawnPos.z, 0,
player->actor.world.rot.y, 0, 7);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 561);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
} else if ((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
} else if ((play->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
player->rideActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
player->rideActor->room = -1;
}
} else {
@@ -181,22 +179,22 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
};
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
if ((globalCtx->sceneNum == D_8011F9B8[i].scene) &&
if ((play->sceneNum == D_8011F9B8[i].scene) &&
(((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
if (D_8011F9B8[i].type == 7) {
if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
if ((play->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
D_8011F9B8[i].pos.x = player->actor.world.pos.x;
D_8011F9B8[i].pos.y = player->actor.world.pos.y;
D_8011F9B8[i].pos.z = player->actor.world.pos.z;
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0,
player->actor.world.rot.y, 0, D_8011F9B8[i].type);
player->rideActor =
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y,
D_8011F9B8[i].pos.z, 0, player->actor.world.rot.y, 0, D_8011F9B8[i].type);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 628);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
} else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) {
Vec3f sp54;
s32 temp = 0;
@@ -205,9 +203,9 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
temp = 0x8000;
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0,
D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp);
player->rideActor =
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y,
D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 667);
player->actor.world.pos.x = D_8011F9B8[i].pos.x;
@@ -216,18 +214,17 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
player->actor.shape.rot.x = player->actor.shape.rot.z = 0;
player->actor.shape.rot.y = D_8011F9B8[i].angle;
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
sp54.x = player->actor.world.pos.x - 200.0f;
sp54.y = player->actor.world.pos.y + 100.0f;
sp54.z = player->actor.world.pos.z;
Play_CameraSetAtEye(globalCtx, globalCtx->activeCamId, &player->actor.world.pos, &sp54);
Play_CameraSetAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54);
} else {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x,
D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0,
D_8011F9B8[i].type);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y,
D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type);
}
break;
}
@@ -235,26 +232,26 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
}
}
void func_8006DC68(GlobalContext* globalCtx, Player* player) {
void func_8006DC68(PlayState* play, Player* player) {
if (LINK_IS_ADULT) {
if (!func_8006CFC0(gSaveContext.horseData.scene)) {
osSyncPrintf(VT_COL(RED, WHITE));
// "Horse_Set_Check():%d set spot is no good."
osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horseData.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
func_8006D074(play);
}
if (func_8006CFC0(globalCtx->sceneNum)) {
if (func_8006CFC0(play->sceneNum)) {
if ((gSaveContext.sceneSetupIndex > 3) ||
((gSaveContext.entranceIndex == ENTR_SPOT00_11 || gSaveContext.entranceIndex == ENTR_SPOT00_12 ||
gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) &&
(gSaveContext.respawnFlag == 0)) ||
((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
((play->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) {
func_8006D684(globalCtx, player);
func_8006D684(play, player);
} else {
func_8006D0EC(globalCtx, player);
func_8006D0EC(play, player);
}
}
}
+2 -2
View File
@@ -41,7 +41,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) {
}
}
void KaleidoManager_Init(GlobalContext* globalCtx) {
void KaleidoManager_Init(PlayState* play) {
s32 largestSize = 0;
s32 size;
u32 i;
@@ -57,7 +57,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) {
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize);
osSyncPrintf(VT_RST);
sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestSize, "../z_kaleido_manager.c", 150);
sKaleidoAreaPtr = GameState_Alloc(&play->state, largestSize, "../z_kaleido_manager.c", 150);
LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 151);
osSyncPrintf(VT_FGCOL(GREEN));
+16 -16
View File
@@ -1,14 +1,14 @@
#include "global.h"
#include "vt.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
f32 gBossMarkScale;
u32 D_8016139C;
PauseMapMarksData* gLoadedPauseMarkDataTable;
extern void KaleidoScope_Update(GlobalContext* globalCtx);
extern void KaleidoScope_Draw(GlobalContext* globalCtx);
extern void KaleidoScope_Update(PlayState* play);
extern void KaleidoScope_Draw(PlayState* play);
void KaleidoScopeCall_LoadPlayer(void) {
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
@@ -30,7 +30,7 @@ void KaleidoScopeCall_LoadPlayer(void) {
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
void KaleidoScopeCall_Init(PlayState* play) {
// "Kaleidoscope replacement construction"
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
@@ -42,19 +42,19 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw, "../z_kaleido_scope_call.c", 100);
LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101);
KaleidoSetup_Init(globalCtx);
KaleidoSetup_Init(play);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
void KaleidoScopeCall_Destroy(PlayState* play) {
// "Kaleidoscope replacement destruction"
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
KaleidoSetup_Destroy(globalCtx);
KaleidoSetup_Destroy(play);
}
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
PauseContext* pauseCtx = &play->pauseCtx;
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
if (pauseCtx->state == 1) {
@@ -99,9 +99,9 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
}
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeUpdateFunc(globalCtx);
sKaleidoScopeUpdateFunc(play);
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope Emission"
osSyncPrintf("カレイド領域 カレイドスコープ排出\n");
@@ -115,14 +115,14 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
}
}
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
void KaleidoScopeCall_Draw(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (R_PAUSE_MENU_MODE >= 3) {
if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) ||
((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 18))) {
if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) ||
((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeDrawFunc(globalCtx);
sKaleidoScopeDrawFunc(play);
}
}
}
+12 -12
View File
@@ -8,15 +8,15 @@ s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM
f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f };
f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f };
void KaleidoSetup_Update(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
void KaleidoSetup_Update(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0];
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE &&
globalCtx->transitionTrigger == TRANS_TRIGGER_OFF && globalCtx->transitionMode == TRANS_MODE_OFF &&
gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(globalCtx) &&
globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
(globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) {
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF &&
gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
play->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
(play->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) {
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
if (BREG(0)) {
@@ -61,8 +61,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
}
}
void KaleidoSetup_Init(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void KaleidoSetup_Init(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
u64 temp = 0; // Necessary to match
pauseCtx->state = 0;
@@ -114,8 +114,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
pauseCtx->ocarinaSongIdx = -1;
pauseCtx->cursorSpecialPos = 0;
View_Init(&pauseCtx->view, globalCtx->state.gfxCtx);
View_Init(&pauseCtx->view, play->state.gfxCtx);
}
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
void KaleidoSetup_Destroy(PlayState* play) {
}
+283 -296
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -111,8 +111,8 @@ s16 sBeatingHeartsDDEnv[3];
s16 sHeartsDDPrim[2][3];
s16 sHeartsDDEnv[2][3];
void Health_InitMeter(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void Health_InitMeter(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 = gSaveContext.health;
@@ -144,8 +144,8 @@ void Health_InitMeter(GlobalContext* globalCtx) {
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HEARTS_DD_ENV_B;
}
void Health_UpdateMeter(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void Health_UpdateMeter(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
f32 factor = interfaceCtx->heartColorOscillator * 0.1f;
f32 ddFactor;
s32 type = 0;
@@ -241,14 +241,14 @@ void Health_UpdateMeter(GlobalContext* globalCtx) {
}
// Unused
s32 func_80078E18(GlobalContext* globalCtx) {
gSaveContext.health = globalCtx->interfaceCtx.unk_226;
s32 func_80078E18(PlayState* play) {
gSaveContext.health = play->interfaceCtx.unk_226;
return 1;
}
// Unused
s32 func_80078E34(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 func_80078E34(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 += 0x10;
@@ -262,8 +262,8 @@ s32 func_80078E34(GlobalContext* globalCtx) {
}
// Unused
s32 func_80078E84(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 func_80078E84(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->unk_228 != 0) {
interfaceCtx->unk_228--;
@@ -272,7 +272,7 @@ s32 func_80078E84(GlobalContext* globalCtx) {
interfaceCtx->unk_226 -= 0x10;
if (interfaceCtx->unk_226 <= 0) {
interfaceCtx->unk_226 = 0;
globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1));
play->damagePlayer(play, -(gSaveContext.health + 1));
return 1;
}
}
@@ -295,7 +295,7 @@ static void* sHeartDDTextures[] = {
gDefenseHeartThreeQuarterTex,
};
void Health_DrawMeter(GlobalContext* globalCtx) {
void Health_DrawMeter(PlayState* play) {
s32 pad[5];
void* heartBgImg;
u32 curColorSet;
@@ -306,8 +306,8 @@ void Health_DrawMeter(GlobalContext* globalCtx) {
f32 heartCenterX;
f32 heartCenterY;
f32 heartTexCoordPerPixel;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx;
s32 curHeartFraction = gSaveContext.health % 0x10;
s16 totalHeartCount = gSaveContext.healthCapacity / 0x10;
@@ -498,16 +498,16 @@ void Health_DrawMeter(GlobalContext* globalCtx) {
CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606);
}
void Health_UpdateBeatingHeart(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void Health_UpdateBeatingHeart(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->beatingHeartOscillatorDirection != 0) {
interfaceCtx->beatingHeartOscillator--;
if (interfaceCtx->beatingHeartOscillator <= 0) {
interfaceCtx->beatingHeartOscillator = 0;
interfaceCtx->beatingHeartOscillatorDirection = 0;
if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.debugState == 0) && Health_IsCritical() && !Play_InCsMode(globalCtx)) {
if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
Health_IsCritical() && !Play_InCsMode(play)) {
func_80078884(NA_SE_SY_HITPOINT_ALARM);
}
}
+15 -15
View File
@@ -195,8 +195,8 @@ s32 Lights_FreeNode(LightNode* light) {
}
}
void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) {
LightContext_InitList(globalCtx, lightCtx);
void LightContext_Init(PlayState* play, LightContext* lightCtx) {
LightContext_InitList(play, lightCtx);
LightContext_SetAmbientColor(lightCtx, 80, 80, 80);
LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800);
bzero(&sLightsBuffer, sizeof(sLightsBuffer));
@@ -223,13 +223,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx)
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
}
void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) {
void LightContext_InitList(PlayState* play, LightContext* lightCtx) {
lightCtx->listHead = NULL;
}
void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) {
void LightContext_DestroyList(PlayState* play, LightContext* lightCtx) {
while (lightCtx->listHead != NULL) {
LightContext_RemoveLight(globalCtx, lightCtx, lightCtx->listHead);
LightContext_RemoveLight(play, lightCtx, lightCtx->listHead);
lightCtx->listHead = lightCtx->listHead->next;
}
}
@@ -240,7 +240,7 @@ void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx)
* Note: Due to the limited number of slots in a Lights group, inserting too many lights in the
* list may result in older entries not being bound to a Light when calling Lights_BindAll
*/
LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info) {
LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info) {
LightNode* node;
node = Lights_FindBufSlot();
@@ -260,7 +260,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh
return node;
}
void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node) {
void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node) {
if (node != NULL) {
if (node->prev != NULL) {
node->prev->next = node->next;
@@ -316,7 +316,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient
return lights;
}
void Lights_GlowCheck(GlobalContext* globalCtx) {
void Lights_GlowCheck(PlayState* play) {
LightNode* node;
LightPoint* params;
Vec3f pos;
@@ -327,7 +327,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
s32 wZ;
s32 zBuf;
node = globalCtx->lightCtx.listHead;
node = play->lightCtx.listHead;
while (node != NULL) {
params = &node->info->params.point;
@@ -336,7 +336,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
pos.x = params->x;
pos.y = params->y;
pos.z = params->z;
Actor_ProjectPos(globalCtx, &pos, &multDest, &cappedInvWDest);
Actor_ProjectPos(play, &pos, &multDest, &cappedInvWDest);
params->drawGlow = false;
wX = multDest.x * cappedInvWDest;
wY = multDest.y * cappedInvWDest;
@@ -356,13 +356,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
}
}
void Lights_DrawGlow(GlobalContext* globalCtx) {
void Lights_DrawGlow(PlayState* play) {
s32 pad;
LightNode* node;
node = globalCtx->lightCtx.listHead;
node = play->lightCtx.listHead;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_lights.c", 887);
OPEN_DISPS(play->state.gfxCtx, "../z_lights.c", 887);
POLY_XLU_DISP = func_800947AC(POLY_XLU_DISP++);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
@@ -384,7 +384,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_lights.c", 918),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_lights.c", 918),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL);
}
@@ -392,5 +392,5 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
node = node->next;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_lights.c", 927);
CLOSE_DISPS(play->state.gfxCtx, "../z_lights.c", 927);
}
+73 -74
View File
@@ -10,17 +10,17 @@ s16 sPlayerInitialPosZ = 0;
s16 sPlayerInitialDirection = 0;
s16 sEntranceIconMapIndex = 0;
void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void Map_SavePlayerInitialInfo(PlayState* play) {
Player* player = GET_PLAYER(play);
sPlayerInitialPosX = player->actor.world.pos.x;
sPlayerInitialPosZ = player->actor.world.pos.z;
sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400);
}
void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) {
void Map_SetPaletteData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 paletteIndex = gMapData->roomPalette[mapIndex][room];
if (interfaceCtx->mapRoomNum == room) {
@@ -37,9 +37,9 @@ void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) {
interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF;
}
void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
void Map_SetFloorPalettesData(PlayState* play, s16 floor) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 room;
s16 i;
@@ -53,7 +53,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
interfaceCtx->mapPalette[31] = 1;
}
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@@ -75,19 +75,19 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
for (i = 0; i < gMapData->maxPaletteCount[mapIndex]; i++) {
room = gMapData->paletteRoom[mapIndex][floor][i];
if ((room != 0xFF) && (gSaveContext.sceneFlags[mapIndex].rooms & gBitFlags[room])) {
Map_SetPaletteData(globalCtx, room);
Map_SetPaletteData(play, room);
}
}
break;
}
}
void Map_InitData(GlobalContext* globalCtx, s16 room) {
void Map_InitData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 extendedMapIndex;
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT01:
case SCENE_SPOT02:
@@ -109,19 +109,19 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
extendedMapIndex = mapIndex;
if (globalCtx->sceneNum == SCENE_SPOT02) {
if (play->sceneNum == SCENE_SPOT02) {
if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) {
extendedMapIndex = 0x14;
}
} else if (globalCtx->sceneNum == SCENE_SPOT06) {
} else if (play->sceneNum == SCENE_SPOT06) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) {
extendedMapIndex = 0x15;
}
} else if (globalCtx->sceneNum == SCENE_SPOT09) {
} else if (play->sceneNum == SCENE_SPOT09) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
extendedMapIndex = 0x16;
}
} else if (globalCtx->sceneNum == SCENE_SPOT12) {
} else if (play->sceneNum == SCENE_SPOT12) {
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
extendedMapIndex = 0x17;
}
@@ -158,27 +158,27 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
osSyncPrintf("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n", room,
mapIndex, VREG(30));
osSyncPrintf(VT_RST);
DmaMgr_SendRequest1(globalCtx->interfaceCtx.mapSegment,
DmaMgr_SendRequest1(play->interfaceCtx.mapSegment,
(u32)_map_i_staticSegmentRomStart +
((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0),
0xFF0, "../z_map_exp.c", 346);
R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room];
R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room];
Map_SetFloorPalettesData(globalCtx, VREG(30));
Map_SetFloorPalettesData(play, VREG(30));
osSyncPrintf("MAP 各階ONチェック\n"); // "MAP Individual Floor ON Check"
break;
}
}
void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
void Map_InitRoomData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
osSyncPrintf("*******\n*******\nroom_no=%d (%d)(%d)\n*******\n*******\n", room,
mapIndex, globalCtx->sceneNum);
mapIndex, play->sceneNum);
if (room >= 0) {
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@@ -201,11 +201,11 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
osSyncPrintf("ROOM_INF=%d\n", gSaveContext.sceneFlags[mapIndex].rooms);
interfaceCtx->mapRoomNum = room;
interfaceCtx->unk_25A = mapIndex;
Map_SetPaletteData(globalCtx, room);
Map_SetPaletteData(play, room);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("部屋部屋=%d\n", room); // "Room Room = %d"
osSyncPrintf(VT_RST);
Map_InitData(globalCtx, room);
Map_InitData(play, room);
break;
}
} else {
@@ -217,27 +217,27 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
}
}
void Map_Destroy(GlobalContext* globalCtx) {
MapMark_ClearPointers(globalCtx);
void Map_Destroy(PlayState* play) {
MapMark_ClearPointers(play);
gMapData = NULL;
}
void Map_Init(GlobalContext* globalCtx) {
void Map_Init(PlayState* play) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
gMapData = &gMapDataTable;
interfaceCtx->unk_258 = -1;
interfaceCtx->unk_25A = -1;
interfaceCtx->mapSegment = GameState_Alloc(&globalCtx->state, 0x1000, "../z_map_exp.c", 457);
interfaceCtx->mapSegment = GameState_Alloc(&play->state, 0x1000, "../z_map_exp.c", 457);
// "MAP texture initialization scene_data_ID=%d mapSegment=%x"
osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum,
interfaceCtx->mapSegment, globalCtx);
osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum,
interfaceCtx->mapSegment, play);
ASSERT(interfaceCtx->mapSegment != NULL, "parameter->mapSegment != NULL", "../z_map_exp.c", 459);
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT01:
case SCENE_SPOT02:
@@ -258,13 +258,13 @@ void Map_Init(GlobalContext* globalCtx) {
case SCENE_SPOT18:
case SCENE_SPOT20:
case SCENE_GANON_TOU:
mapIndex = globalCtx->sceneNum - SCENE_SPOT00;
mapIndex = play->sceneNum - SCENE_SPOT00;
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0];
R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1];
R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2];
R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3];
Map_InitData(globalCtx, mapIndex);
Map_InitData(play, mapIndex);
R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex];
R_OW_MINIMAP_Y = gMapData->owMinimapPosY[mapIndex];
break;
@@ -293,31 +293,30 @@ void Map_Init(GlobalContext* globalCtx) {
case SCENE_MIZUSIN_BS:
case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS:
mapIndex =
(globalCtx->sceneNum >= SCENE_YDAN_BOSS) ? globalCtx->sceneNum - SCENE_YDAN_BOSS : globalCtx->sceneNum;
mapIndex = (play->sceneNum >= SCENE_YDAN_BOSS) ? play->sceneNum - SCENE_YDAN_BOSS : play->sceneNum;
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
if ((globalCtx->sceneNum <= SCENE_ICE_DOUKUTO) || (globalCtx->sceneNum >= SCENE_YDAN_BOSS)) {
if ((play->sceneNum <= SCENE_ICE_DOUKUTO) || (play->sceneNum >= SCENE_YDAN_BOSS)) {
R_COMPASS_SCALE_X = gMapData->dgnCompassInfo[mapIndex][0];
R_COMPASS_SCALE_Y = gMapData->dgnCompassInfo[mapIndex][1];
R_COMPASS_OFFSET_X = gMapData->dgnCompassInfo[mapIndex][2];
R_COMPASS_OFFSET_Y = gMapData->dgnCompassInfo[mapIndex][3];
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE = gMapData->dgnTexIndexBase[mapIndex];
Map_InitRoomData(globalCtx, globalCtx->roomCtx.curRoom.num);
MapMark_Init(globalCtx);
Map_InitRoomData(play, play->roomCtx.curRoom.num);
MapMark_Init(play);
}
break;
}
}
void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
void Minimap_DrawCompassIcons(PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s16 tempX, tempZ;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565);
OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 565);
if (globalCtx->interfaceCtx.minimapAlpha >= 0xAA) {
func_80094A14(globalCtx->state.gfxCtx);
if (play->interfaceCtx.minimapAlpha >= 0xAA) {
func_80094A14(play->state.gfxCtx);
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
@@ -334,7 +333,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Matrix_RotateX(-1.6f, MTXMODE_APPLY);
tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400;
Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585),
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_map_exp.c", 585),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 0, 255);
@@ -348,25 +347,25 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY);
Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY);
Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 603),
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_map_exp.c", 603),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 0, 0, 255);
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 607);
CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 607);
}
void Minimap_Draw(GlobalContext* globalCtx) {
void Minimap_Draw(PlayState* play) {
s32 pad[2];
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s32 mapIndex = gSaveContext.mapIndex;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 626);
OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 626);
if (globalCtx->pauseCtx.state < 4) {
switch (globalCtx->sceneNum) {
if (play->pauseCtx.state < 4) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@@ -378,7 +377,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
if (!R_MINIMAP_DISABLED) {
func_80094520(globalCtx->state.gfxCtx);
func_80094520(play->state.gfxCtx);
gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0,
TEXEL0, 0, PRIMITIVE, 0);
@@ -395,14 +394,14 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) {
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
func_80094520(globalCtx->state.gfxCtx);
MapMark_Draw(globalCtx);
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
func_80094520(play->state.gfxCtx);
MapMark_Draw(play);
}
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Play_InCsMode(globalCtx)) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(globalCtx));
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(play));
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
@@ -438,7 +437,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
if (!R_MINIMAP_DISABLED) {
func_80094520(globalCtx->state.gfxCtx);
func_80094520(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2),
@@ -454,8 +453,8 @@ void Minimap_Draw(GlobalContext* globalCtx) {
(R_OW_MINIMAP_Y + gMapData->owMinimapHeight[mapIndex]) << 2, G_TX_RENDERTILE, 0,
0, 1 << 10, 1 << 10);
if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) &&
(globalCtx->sceneNum != SCENE_SPOT08)) ||
if (((play->sceneNum != SCENE_SPOT01) && (play->sceneNum != SCENE_SPOT04) &&
(play->sceneNum != SCENE_SPOT08)) ||
(LINK_AGE_IN_YEARS != YEARS_ADULT)) {
if ((gMapData->owEntranceFlag[sEntranceIconMapIndex] == 0xFFFF) ||
((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) &&
@@ -475,7 +474,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
if ((globalCtx->sceneNum == SCENE_SPOT08) &&
if ((play->sceneNum == SCENE_SPOT08) &&
(gSaveContext.infTable[INFTABLE_1AX_INDEX] & gBitFlags[INFTABLE_1A9_SHIFT])) {
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8,
8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
@@ -485,10 +484,10 @@ void Minimap_Draw(GlobalContext* globalCtx) {
0, 1 << 10, 1 << 10);
}
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Play_InCsMode(globalCtx)) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) {
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
@@ -506,23 +505,23 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 782);
CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 782);
}
s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) {
return gMapData->floorTexIndexOffset[mapIndex][floor];
}
void Map_Update(GlobalContext* globalCtx) {
void Map_Update(PlayState* play) {
static s16 sLastRoomNum = 99;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 floor;
s16 i;
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
switch (globalCtx->sceneNum) {
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@@ -568,9 +567,9 @@ void Map_Update(GlobalContext* globalCtx) {
// "Layer switching = %x"
osSyncPrintf("階層切替=%x\n", interfaceCtx->mapRoomNum);
osSyncPrintf(VT_RST);
Map_InitData(globalCtx, interfaceCtx->mapRoomNum);
Map_InitData(play, interfaceCtx->mapRoomNum);
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
Map_SavePlayerInitialInfo(globalCtx);
Map_SavePlayerInitialInfo(play);
}
}
@@ -584,9 +583,9 @@ void Map_Update(GlobalContext* globalCtx) {
case SCENE_MIZUSIN_BS:
case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS:
VREG(30) = gMapData->bossFloor[globalCtx->sceneNum - SCENE_YDAN_BOSS];
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE +
gMapData->floorTexIndexOffset[globalCtx->sceneNum - SCENE_YDAN_BOSS][VREG(30)];
VREG(30) = gMapData->bossFloor[play->sceneNum - SCENE_YDAN_BOSS];
R_MAP_TEX_INDEX =
R_MAP_TEX_INDEX_BASE + gMapData->floorTexIndexOffset[play->sceneNum - SCENE_YDAN_BOSS][VREG(30)];
break;
}
}
+13 -13
View File
@@ -53,11 +53,11 @@ static MapMarkDataOverlay sMapMarkDataOvl = {
static MapMarkData** sLoadedMarkDataTable;
void MapMark_Init(GlobalContext* globalCtx) {
void MapMark_Init(PlayState* play) {
MapMarkDataOverlay* overlay = &sMapMarkDataOvl;
u32 overlaySize = (u32)overlay->vramEnd - (u32)overlay->vramStart;
overlay->loadedRamAddr = GameState_Alloc(&globalCtx->state, overlaySize, "../z_map_mark.c", 235);
overlay->loadedRamAddr = GameState_Alloc(&play->state, overlaySize, "../z_map_mark.c", 235);
LogUtils_CheckNullPointer("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236);
Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
@@ -69,12 +69,12 @@ void MapMark_Init(GlobalContext* globalCtx) {
: NULL);
}
void MapMark_ClearPointers(GlobalContext* globalCtx) {
void MapMark_ClearPointers(PlayState* play) {
sMapMarkDataOvl.loadedRamAddr = NULL;
sLoadedMarkDataTable = NULL;
}
void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
void MapMark_DrawForDungeon(PlayState* play) {
InterfaceContext* interfaceCtx;
MapMarkIconData* mapMarkIconData;
MapMarkPoint* markPoint;
@@ -84,18 +84,18 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
s32 rectLeft;
s32 rectTop;
interfaceCtx = &globalCtx->interfaceCtx;
interfaceCtx = &play->interfaceCtx;
if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
if ((gMapData != NULL) && (play->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
// "Room number exceeded, yikes %d/%d MapMarkDraw processing interrupted"
osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n",
VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
VT_RST, play->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
return;
}
mapMarkIconData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 303);
OPEN_DISPS(play->state.gfxCtx, "../z_map_mark.c", 303);
while (true) {
if (mapMarkIconData->markType == MAP_MARK_NONE) {
@@ -109,7 +109,7 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
markPoint = &mapMarkIconData->points[0];
for (i = 0; i < mapMarkIconData->count; i++) {
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(play, markPoint->chestFlag)) {
markInfo = &sMapMarkInfoTable[mapMarkIconData->markType];
gDPPipeSync(OVERLAY_DISP++);
@@ -128,11 +128,11 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
mapMarkIconData++;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 339);
CLOSE_DISPS(play->state.gfxCtx, "../z_map_mark.c", 339);
}
void MapMark_Draw(GlobalContext* globalCtx) {
switch (globalCtx->sceneNum) {
void MapMark_Draw(PlayState* play) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@@ -148,7 +148,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS:
MapMark_DrawForDungeon(globalCtx);
MapMark_DrawForDungeon(play);
break;
}
}
+214 -217
View File
File diff suppressed because it is too large Load Diff
+270 -270
View File
File diff suppressed because it is too large Load Diff
+237 -240
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,10 +1,10 @@
#include "global.h"
Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) {
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) {
Path* path;
if (index != max) {
path = &globalCtx->setupPathList[index];
path = &play->setupPathList[index];
} else {
path = NULL;
}
+51 -51
View File
@@ -13,13 +13,13 @@ FaultClient D_801614B8;
s16 sTransitionFillTimer;
u64 D_801614D0[0xA00];
void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn);
void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn);
void func_800BC450(GlobalContext* this) {
void func_800BC450(PlayState* this) {
Camera_ChangeDataIdx(GET_ACTIVE_CAM(this), this->unk_1242B - 1);
}
void func_800BC490(GlobalContext* this, s16 point) {
void func_800BC490(PlayState* this, s16 point) {
ASSERT(point == 1 || point == 2, "point == 1 || point == 2", "../z_play.c", 2160);
this->unk_1242B = point;
@@ -32,12 +32,12 @@ void func_800BC490(GlobalContext* this, s16 point) {
func_800BC450(this);
}
s32 func_800BC56C(GlobalContext* this, s16 arg1) {
s32 func_800BC56C(PlayState* this, s16 arg1) {
return (arg1 == this->unk_1242B);
}
// original name: "Game_play_shop_pr_vr_switch_set"
void func_800BC590(GlobalContext* this) {
void func_800BC590(PlayState* this) {
osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n");
if (YREG(15) == 0x10) {
@@ -45,7 +45,7 @@ void func_800BC590(GlobalContext* this) {
}
}
void Play_SetupTransition(GlobalContext* this, s32 transitionType) {
void Play_SetupTransition(PlayState* this, s32 transitionType) {
TransitionContext* transitionCtx = &this->transitionCtx;
bzero(transitionCtx, sizeof(TransitionContext));
@@ -143,17 +143,17 @@ void Play_SetupTransition(GlobalContext* this, s32 transitionType) {
}
}
void func_800BC88C(GlobalContext* this) {
void func_800BC88C(PlayState* this) {
this->transitionCtx.transitionType = -1;
}
Gfx* Play_SetFog(GlobalContext* this, Gfx* gfx) {
Gfx* Play_SetFog(PlayState* this, Gfx* gfx) {
return Gfx_SetFog2(gfx, this->lightCtx.fogColor[0], this->lightCtx.fogColor[1], this->lightCtx.fogColor[2], 0,
this->lightCtx.fogNear, 1000);
}
void Play_Destroy(GameState* thisx) {
GlobalContext* this = (GlobalContext*)thisx;
PlayState* this = (PlayState*)thisx;
Player* player = GET_PLAYER(this);
this->state.gfxCtx->callback = NULL;
@@ -195,7 +195,7 @@ void Play_Destroy(GameState* thisx) {
}
void Play_Init(GameState* thisx) {
GlobalContext* this = (GlobalContext*)thisx;
PlayState* this = (PlayState*)thisx;
GraphicsContext* gfxCtx = this->state.gfxCtx;
u32 zAlloc;
u32 zAllocAligned;
@@ -418,7 +418,7 @@ void Play_Init(GameState* thisx) {
}
}
void Play_Update(GlobalContext* this) {
void Play_Update(PlayState* this) {
s32 pad1;
s32 sp80;
Input* input;
@@ -603,7 +603,7 @@ void Play_Update(GlobalContext* this) {
this->state.running = false;
if (gSaveContext.gameMode != 2) {
SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
gSaveContext.entranceIndex = this->nextEntranceIndex;
if (gSaveContext.minigameState == 1) {
@@ -654,7 +654,7 @@ void Play_Update(GlobalContext* this) {
if (sTransitionFillTimer >= 20) {
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
gSaveContext.entranceIndex = this->nextEntranceIndex;
this->transitionTrigger = TRANS_TRIGGER_OFF;
this->transitionMode = TRANS_MODE_OFF;
@@ -696,7 +696,7 @@ void Play_Update(GlobalContext* this) {
case TRANS_MODE_INSTANT:
if (this->transitionTrigger != TRANS_TRIGGER_END) {
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
gSaveContext.entranceIndex = this->nextEntranceIndex;
this->transitionTrigger = TRANS_TRIGGER_OFF;
this->transitionMode = TRANS_MODE_OFF;
@@ -742,7 +742,7 @@ void Play_Update(GlobalContext* this) {
} else {
if (this->envCtx.sandstormEnvA == 255) {
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
gSaveContext.entranceIndex = this->nextEntranceIndex;
this->transitionTrigger = TRANS_TRIGGER_OFF;
this->transitionMode = TRANS_MODE_OFF;
@@ -1073,7 +1073,7 @@ skip:
this->state.gfxCtx);
}
void Play_DrawOverlayElements(GlobalContext* this) {
void Play_DrawOverlayElements(PlayState* this) {
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) {
KaleidoScopeCall_Draw(this);
}
@@ -1089,7 +1089,7 @@ void Play_DrawOverlayElements(GlobalContext* this) {
}
}
void Play_Draw(GlobalContext* this) {
void Play_Draw(PlayState* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
Lights* sp228;
Vec3f sp21C;
@@ -1346,7 +1346,7 @@ void Play_Draw(GlobalContext* this) {
}
void Play_Main(GameState* thisx) {
GlobalContext* this = (GlobalContext*)thisx;
PlayState* this = (PlayState*)thisx;
D_8012D1F8 = &this->state.input[0];
@@ -1389,11 +1389,11 @@ void Play_Main(GameState* thisx) {
}
// original name: "Game_play_demo_mode_check"
s32 Play_InCsMode(GlobalContext* this) {
s32 Play_InCsMode(PlayState* this) {
return (this->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(this);
}
f32 func_800BFCB8(GlobalContext* this, MtxF* mf, Vec3f* vec) {
f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* vec) {
CollisionPoly poly;
f32 temp1;
f32 temp2;
@@ -1459,7 +1459,7 @@ f32 func_800BFCB8(GlobalContext* this, MtxF* mf, Vec3f* vec) {
return floorY;
}
void* Play_LoadFile(GlobalContext* this, RomFile* file) {
void* Play_LoadFile(PlayState* this, RomFile* file) {
u32 size;
void* allocp;
@@ -1470,12 +1470,12 @@ void* Play_LoadFile(GlobalContext* this, RomFile* file) {
return allocp;
}
void Play_InitEnvironment(GlobalContext* this, s16 skyboxId) {
void Play_InitEnvironment(PlayState* this, s16 skyboxId) {
Skybox_Init(&this->state, &this->skyboxCtx, skyboxId);
Environment_Init(this, &this->envCtx, 0);
}
void Play_InitScene(GlobalContext* this, s32 spawn) {
void Play_InitScene(PlayState* this, s32 spawn) {
this->curSpawn = spawn;
this->linkActorEntry = NULL;
this->unk_11DFC = NULL;
@@ -1494,7 +1494,7 @@ void Play_InitScene(GlobalContext* this, s32 spawn) {
Play_InitEnvironment(this, this->skyboxId);
}
void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn) {
void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn) {
SceneTableEntry* scene = &gSceneTable[sceneNum];
scene->unk_13 = 0;
@@ -1515,7 +1515,7 @@ void Play_SpawnScene(GlobalContext* this, s32 sceneNum, s32 spawn) {
osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(this, &this->roomCtx) / 1024.0f);
}
void Play_GetScreenPos(GlobalContext* this, Vec3f* src, Vec3f* dest) {
void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest) {
f32 w;
Matrix_Mult(&this->viewProjectionMtxF, MTXMODE_NEW);
@@ -1528,7 +1528,7 @@ void Play_GetScreenPos(GlobalContext* this, Vec3f* src, Vec3f* dest) {
dest->y = (SCREEN_HEIGHT / 2) - ((dest->y / w) * (SCREEN_HEIGHT / 2));
}
s16 Play_CreateSubCamera(GlobalContext* this) {
s16 Play_CreateSubCamera(PlayState* this) {
s16 i;
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
@@ -1553,11 +1553,11 @@ s16 Play_CreateSubCamera(GlobalContext* this) {
return i;
}
s16 Play_GetActiveCamId(GlobalContext* this) {
s16 Play_GetActiveCamId(PlayState* this) {
return this->activeCamId;
}
s16 Play_ChangeCameraStatus(GlobalContext* this, s16 camId, s16 status) {
s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
if (status == CAM_STAT_ACTIVE) {
@@ -1567,7 +1567,7 @@ s16 Play_ChangeCameraStatus(GlobalContext* this, s16 camId, s16 status) {
return Camera_ChangeStatus(this->cameraPtrs[camIdx], status);
}
void Play_ClearCamera(GlobalContext* this, s16 camId) {
void Play_ClearCamera(PlayState* this, s16 camId) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
if (camIdx == CAM_ID_MAIN) {
@@ -1585,7 +1585,7 @@ void Play_ClearCamera(GlobalContext* this, s16 camId) {
}
}
void Play_ClearAllSubCameras(GlobalContext* this) {
void Play_ClearAllSubCameras(PlayState* this) {
s16 subCamId;
for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) {
@@ -1597,13 +1597,13 @@ void Play_ClearAllSubCameras(GlobalContext* this) {
this->activeCamId = CAM_ID_MAIN;
}
Camera* Play_GetCamera(GlobalContext* this, s16 camId) {
Camera* Play_GetCamera(PlayState* this, s16 camId) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
return this->cameraPtrs[camIdx];
}
s32 Play_CameraSetAtEye(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye) {
s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
s32 ret = 0;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
Camera* camera = this->cameraPtrs[camIdx];
@@ -1629,7 +1629,7 @@ s32 Play_CameraSetAtEye(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye) {
return ret;
}
s32 Play_CameraSetAtEyeUp(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
s32 ret = 0;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
Camera* camera = this->cameraPtrs[camIdx];
@@ -1657,14 +1657,14 @@ s32 Play_CameraSetAtEyeUp(GlobalContext* this, s16 camId, Vec3f* at, Vec3f* eye,
return ret;
}
s32 Play_CameraSetFov(GlobalContext* this, s16 camId, f32 fov) {
s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) {
s32 ret = Camera_SetParam(this->cameraPtrs[camId], 0x20, &fov) & 1;
if (1) {}
return ret;
}
s32 Play_SetCameraRoll(GlobalContext* this, s16 camId, s16 roll) {
s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
Camera* camera = this->cameraPtrs[camIdx];
@@ -1673,14 +1673,14 @@ s32 Play_SetCameraRoll(GlobalContext* this, s16 camId, s16 roll) {
return 1;
}
void Play_CopyCamera(GlobalContext* this, s16 destCamId, s16 srcCamId) {
void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) {
s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? this->activeCamId : srcCamId;
s16 destCamId1 = (destCamId == CAM_ID_NONE) ? this->activeCamId : destCamId;
Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]);
}
s32 func_800C0808(GlobalContext* this, s16 camId, Player* player, s16 setting) {
s32 func_800C0808(PlayState* this, s16 camId, Player* player, s16 setting) {
Camera* camera;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
@@ -1689,11 +1689,11 @@ s32 func_800C0808(GlobalContext* this, s16 camId, Player* player, s16 setting) {
return Camera_ChangeSetting(camera, setting);
}
s32 Play_CameraChangeSetting(GlobalContext* this, s16 camId, s16 setting) {
s32 Play_CameraChangeSetting(PlayState* this, s16 camId, s16 setting) {
return Camera_ChangeSetting(Play_GetCamera(this, camId), setting);
}
void func_800C08AC(GlobalContext* this, s16 camId, s16 arg2) {
void func_800C08AC(PlayState* this, s16 camId, s16 arg2) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
s16 i;
@@ -1716,7 +1716,7 @@ void func_800C08AC(GlobalContext* this, s16 camId, s16 arg2) {
}
}
s16 Play_CameraGetUID(GlobalContext* this, s16 camId) {
s16 Play_CameraGetUID(PlayState* this, s16 camId) {
Camera* camera = this->cameraPtrs[camId];
if (camera != NULL) {
@@ -1726,7 +1726,7 @@ s16 Play_CameraGetUID(GlobalContext* this, s16 camId) {
}
}
s16 func_800C09D8(GlobalContext* this, s16 camId, s16 arg2) {
s16 func_800C09D8(PlayState* this, s16 camId, s16 arg2) {
Camera* camera = this->cameraPtrs[camId];
if (camera != NULL) {
@@ -1740,7 +1740,7 @@ s16 func_800C09D8(GlobalContext* this, s16 camId, s16 arg2) {
}
}
void Play_SaveSceneFlags(GlobalContext* this) {
void Play_SaveSceneFlags(PlayState* this) {
SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[this->sceneNum];
savedSceneFlags->chest = this->actorCtx.flags.chest;
@@ -1749,7 +1749,7 @@ void Play_SaveSceneFlags(GlobalContext* this) {
savedSceneFlags->collect = this->actorCtx.flags.collect;
}
void Play_SetRespawnData(GlobalContext* this, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams,
void Play_SetRespawnData(PlayState* this, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams,
Vec3f* pos, s16 yaw) {
RespawnData* respawnData = &gSaveContext.respawn[respawnMode];
@@ -1762,7 +1762,7 @@ void Play_SetRespawnData(GlobalContext* this, s32 respawnMode, s16 entranceIndex
respawnData->tempCollectFlags = this->actorCtx.flags.tempCollect;
}
void Play_SetupRespawnPoint(GlobalContext* this, s32 respawnMode, s32 playerParams) {
void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams) {
Player* player = GET_PLAYER(this);
s32 entranceIndex;
s8 roomIndex;
@@ -1775,7 +1775,7 @@ void Play_SetupRespawnPoint(GlobalContext* this, s32 respawnMode, s32 playerPara
}
}
void Play_TriggerVoidOut(GlobalContext* this) {
void Play_TriggerVoidOut(PlayState* this) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = this->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.tempCollect;
gSaveContext.respawnFlag = 1;
@@ -1784,7 +1784,7 @@ void Play_TriggerVoidOut(GlobalContext* this) {
this->transitionType = TRANS_TYPE_FADE_BLACK;
}
void Play_LoadToLastEntrance(GlobalContext* this) {
void Play_LoadToLastEntrance(PlayState* this) {
gSaveContext.respawnFlag = -1;
this->transitionTrigger = TRANS_TRIGGER_START;
@@ -1802,21 +1802,21 @@ void Play_LoadToLastEntrance(GlobalContext* this) {
this->transitionType = TRANS_TYPE_FADE_BLACK;
}
void Play_TriggerRespawn(GlobalContext* this) {
void Play_TriggerRespawn(PlayState* this) {
Play_SetupRespawnPoint(this, RESPAWN_MODE_DOWN, 0xDFF);
Play_LoadToLastEntrance(this);
}
s32 func_800C0CB8(GlobalContext* this) {
s32 func_800C0CB8(PlayState* this) {
return (this->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) &&
(YREG(15) != 0x40) && (this->sceneNum != SCENE_HAIRAL_NIWA);
}
s32 FrameAdvance_IsEnabled(GlobalContext* this) {
s32 FrameAdvance_IsEnabled(PlayState* this) {
return !!this->frameAdvCtx.enabled;
}
s32 func_800C0D34(GlobalContext* this, Actor* actor, s16* yaw) {
s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw) {
TransitionActorEntry* transitionActor;
s32 frontRoom;
@@ -1840,7 +1840,7 @@ s32 func_800C0D34(GlobalContext* this, Actor* actor, s16* yaw) {
return 1;
}
s32 func_800C0DB4(GlobalContext* this, Vec3f* pos) {
s32 func_800C0DB4(PlayState* this, Vec3f* pos) {
WaterBox* waterBox;
CollisionPoly* poly;
Vec3f waterSurfacePos;
+20 -20
View File
@@ -2,20 +2,20 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26)
void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallUpdateFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallDrawFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallUpdateFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDrawFunc)(Actor* thisx, PlayState* play);
void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Init(Actor* thisx, PlayState* play);
void PlayerCall_Destroy(Actor* thisx, PlayState* play);
void PlayerCall_Update(Actor* thisx, PlayState* play);
void PlayerCall_Draw(Actor* thisx, PlayState* play);
void Player_Init(Actor* thisx, GlobalContext* globalCtx);
void Player_Destroy(Actor* thisx, GlobalContext* globalCtx);
void Player_Update(Actor* thisx, GlobalContext* globalCtx);
void Player_Draw(Actor* thisx, GlobalContext* globalCtx);
void Player_Init(Actor* thisx, PlayState* play);
void Player_Destroy(Actor* thisx, PlayState* play);
void Player_Update(Actor* thisx, PlayState* play);
void Player_Draw(Actor* thisx, PlayState* play);
const ActorInit Player_InitVars = {
ACTOR_PLAYER,
@@ -36,23 +36,23 @@ void PlayerCall_InitFuncPtrs(void) {
sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(Player_Draw);
}
void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Init(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
PlayerCall_InitFuncPtrs();
sPlayerCallInitFunc(thisx, globalCtx);
sPlayerCallInitFunc(thisx, play);
}
void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Destroy(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallDestroyFunc(thisx, globalCtx);
sPlayerCallDestroyFunc(thisx, play);
}
void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Update(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallUpdateFunc(thisx, globalCtx);
sPlayerCallUpdateFunc(thisx, play);
}
void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Draw(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallDrawFunc(thisx, globalCtx);
sPlayerCallDrawFunc(thisx, play);
}
+115 -119
View File
@@ -435,7 +435,7 @@ Vec3f sGetItemRefPos;
s32 sLeftHandType;
s32 sRightHandType;
void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
void Player_SetBootData(PlayState* play, Player* this) {
s32 currentBoots;
s16* bootRegs;
@@ -474,22 +474,22 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
IREG(69) = bootRegs[15];
MREG(95) = bootRegs[16];
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) {
if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) {
REG(45) = 500;
}
}
s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) {
s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
(globalCtx->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
(this->stateFlags3 & PLAYER_STATE3_7) ||
((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
}
s32 Player_InCsMode(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_InCsMode(PlayState* play) {
Player* this = GET_PLAYER(play);
return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4);
return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4);
}
s32 func_8008E9C4(Player* this) {
@@ -568,19 +568,19 @@ void func_8008EC70(Player* this) {
this->unk_6AD = 0;
}
void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) {
void Player_SetEquipmentData(PlayState* play, Player* this) {
if (this->csMode != 0x56) {
this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD));
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
this->currentSwordItemId = B_BTN_ITEM;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
Player_SetBootData(globalCtx, this);
Player_SetBootData(play, this);
}
}
void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s32 actionParam) {
Inventory_UpdateBottleItem(globalCtx, item, this->heldItemButton);
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) {
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
if (item != ITEM_BOTTLE) {
this->heldItemId = item;
@@ -609,30 +609,30 @@ void func_8008EE08(Player* this) {
func_8008EDF0(this);
}
void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
Player* this = GET_PLAYER(globalCtx);
void func_8008EEAC(PlayState* play, Actor* actor) {
Player* this = GET_PLAYER(play);
func_8008EE08(this);
this->unk_664 = actor;
this->unk_684 = actor;
this->stateFlags1 |= PLAYER_STATE1_16;
Camera_SetParam(Play_GetCamera(globalCtx, CAM_ID_MAIN), 8, actor);
Camera_ChangeMode(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET);
Camera_SetParam(Play_GetCamera(play, CAM_ID_MAIN), 8, actor);
Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET);
}
s32 func_8008EF30(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 func_8008EF30(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->stateFlags1 & PLAYER_STATE1_23);
}
s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) {
globalCtx->shootingGalleryStatus = ammo + 1;
s32 func_8008EF44(PlayState* play, s32 ammo) {
play->shootingGalleryStatus = ammo + 1;
return 1;
}
s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) {
Player* this = GET_PLAYER(play);
Vec3f diff;
s32 pad;
@@ -656,28 +656,28 @@ s32 Player_GetStrength(void) {
}
}
u8 Player_GetMask(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
u8 Player_GetMask(PlayState* play) {
Player* this = GET_PLAYER(play);
return this->currentMask;
}
Player* Player_UnsetMask(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
Player* Player_UnsetMask(PlayState* play) {
Player* this = GET_PLAYER(play);
this->currentMask = PLAYER_MASK_NONE;
return this;
}
s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_HasMirrorShieldEquipped(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->currentShield == PLAYER_SHIELD_MIRROR);
}
s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
}
@@ -770,12 +770,12 @@ return_neg:
return -1;
}
s32 func_8008F2F8(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 func_8008F2F8(PlayState* play) {
Player* this = GET_PLAYER(play);
TextTriggerEntry* triggerEntry;
s32 var;
if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
var = 0;
} else if ((this->unk_840 > 80) &&
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater
@@ -787,7 +787,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
}
// Trigger general textboxes under certain conditions, like "It's so hot in here!"
if (!Player_InCsMode(globalCtx)) {
if (!Player_InCsMode(play)) {
triggerEntry = &sTextTriggers[var];
if (0) {}
@@ -796,7 +796,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
(((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON)) ||
(((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) &&
(this->currentTunic != PLAYER_TUNIC_ZORA)))) {
Message_StartTextbox(globalCtx, triggerEntry->textId, NULL);
Message_StartTextbox(play, triggerEntry->textId, NULL);
gSaveContext.textTriggerFlags |= triggerEntry->flag;
}
}
@@ -858,14 +858,13 @@ Gfx* sBootDListGroups[][2] = {
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
};
void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* data) {
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots,
s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* data) {
Color_RGB8* color;
s32 eyeIndex = (jointTable[22].x & 0xF) - 1;
s32 mouthIndex = (jointTable[22].x >> 4) - 1;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1721);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1721);
if (eyeIndex < 0) {
eyeIndex = sEyeMouthIndices[face][0];
@@ -892,7 +891,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
sDListsLodOffset = lod * 2;
SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
if ((overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson) &&
(overrideLimbDraw != Player_OverrideLimbDrawGameplay_80090440) && (gSaveContext.gameMode != 3)) {
@@ -928,7 +927,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1803);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1803);
}
Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
@@ -945,8 +944,8 @@ f32 D_80126068[] = { 5.0f, 3.0f };
Vec3f D_80126070 = { 0.0f, -300.0f, 0.0f };
void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) {
void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, s32 thighLimbIndex,
s32 shinLimbIndex, s32 footLimbIndex) {
Vec3f spA4;
Vec3f sp98;
Vec3f footprintPos;
@@ -988,7 +987,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
footprintPos.y += 15.0f;
sp80 = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74;
sp80 = BgCheck_EntityRaycastFloor4(&play->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74;
if (sp98.y < sp80) {
sp70 = sp98.x - spA4.x;
@@ -1028,17 +1027,17 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1;
skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1;
temp3 = func_80041D4C(&globalCtx->colCtx, sp88, sp84);
temp3 = func_80041D4C(&play->colCtx, sp88, sp84);
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, sp88, sp84)) {
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, sp88, sp84)) {
footprintPos.y = sp80;
EffectSsGFire_Spawn(globalCtx, &footprintPos);
EffectSsGFire_Spawn(play, &footprintPos);
}
}
}
}
s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
Player* this = (Player*)thisx;
@@ -1097,10 +1096,10 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde
Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY);
}
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
PLAYER_LIMB_L_FOOT);
} else if (limbIndex == PLAYER_LIMB_R_THIGH) {
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
PLAYER_LIMB_R_FOOT);
return false;
} else {
@@ -1111,11 +1110,11 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde
return false;
}
s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
Player* this = (Player*)thisx;
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) {
if (limbIndex == PLAYER_LIMB_L_HAND) {
Gfx** dLists = this->leftHandDLists;
@@ -1168,11 +1167,11 @@ s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbInd
return false;
}
s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* thisx) {
s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
Player* this = (Player*)thisx;
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) {
if (this->unk_6AD != 2) {
*dList = NULL;
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
@@ -1194,20 +1193,19 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 lim
return false;
}
s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* thisx) {
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
s32 Player_OverrideLimbDrawGameplay_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) {
*dList = NULL;
}
return false;
}
u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip,
Vec3f* newBase) {
u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) {
if (weaponInfo->active == 0) {
if (collider != NULL) {
Collider_ResetQuadAT(globalCtx, &collider->base);
Collider_ResetQuadAT(play, &collider->base);
}
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
Math_Vec3f_Copy(&weaponInfo->base, newBase);
@@ -1217,13 +1215,13 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w
(weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) &&
(weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) {
if (collider != NULL) {
Collider_ResetQuadAT(globalCtx, &collider->base);
Collider_ResetQuadAT(play, &collider->base);
}
return 0;
} else {
if (collider != NULL) {
Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base);
}
Math_Vec3f_Copy(&weaponInfo->base, newBase);
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
@@ -1232,7 +1230,7 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w
}
}
void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
void func_80090604(PlayState* play, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
static u8 shieldColTypes[PLAYER_SHIELD_MAX] = {
COLTYPE_METAL,
COLTYPE_WOOD,
@@ -1251,8 +1249,8 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide
Matrix_MultVec3f(&quadSrc[3], &quadDest[3]);
Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base);
CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base);
}
}
@@ -1266,14 +1264,14 @@ Vec3f D_801260A4[3] = {
{ 0.0f, -400.0f, 1000.0f },
};
void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) {
Vec3f newBasePos[3];
Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]);
Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]);
Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]);
if (func_80090480(globalCtx, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) &&
if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) &&
!(this->stateFlags1 & PLAYER_STATE1_22)) {
EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip,
&this->meleeWeaponInfo[0].base);
@@ -1281,15 +1279,15 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
if ((this->meleeWeaponState > 0) &&
((this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || (this->stateFlags2 & PLAYER_STATE2_17))) {
func_80090480(globalCtx, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]);
func_80090480(globalCtx, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]);
func_80090480(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]);
func_80090480(play, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]);
}
}
void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2401);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2401);
gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment);
@@ -1298,18 +1296,18 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo
Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height,
refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW);
Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY);
Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY);
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
GetItem_Draw(globalCtx, drawIdPlusOne - 1);
GetItem_Draw(play, drawIdPlusOne - 1);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2421);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2421);
}
void Player_DrawGetItem(GlobalContext* globalCtx, Player* this) {
void Player_DrawGetItem(PlayState* play, Player* this) {
if (!this->giObjectLoading || osRecvMesg(&this->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
this->giObjectLoading = false;
Player_DrawGetItemImpl(globalCtx, this, &sGetItemRefPos, ABS(this->unk_862));
Player_DrawGetItemImpl(play, this, &sGetItemRefPos, ABS(this->unk_862));
}
}
@@ -1329,7 +1327,7 @@ void func_80090A28(Player* this, Vec3f* vecs) {
Matrix_MultVec3f(&D_80126098, &vecs[2]);
}
void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) {
void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) {
static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f };
CollisionPoly* sp9C;
s32 bgId;
@@ -1347,24 +1345,24 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2
if (1) {}
if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572);
if (BgCheck_AnyLineTest3(&play->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2572);
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07);
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp74, &sp68, &sp64);
sp60 = (sp64 < 200.0f) ? 0.08f : (sp64 / 200.0f) * 0.08f;
Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592);
}
}
@@ -1414,7 +1412,7 @@ Vec3f D_801261E0[] = {
{ 200.0f, 200.0f, 0.0f },
};
void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (*dList != NULL) {
@@ -1430,13 +1428,13 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
if (this->itemActionParam == PLAYER_AP_STICK) {
Vec3f sp124[3];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2633);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633);
if (this->actor.scale.y >= 0.0f) {
D_80126080.x = this->unk_85C * 5000.0f;
func_80090A28(this, sp124);
if (this->meleeWeaponState != 0) {
func_800906D4(globalCtx, this, sp124);
func_800906D4(play, this, sp124);
} else {
Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]);
}
@@ -1446,11 +1444,11 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY);
Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2653),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2656);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2656);
} else if ((this->actor.scale.y >= 0.0f) && (this->meleeWeaponState != 0)) {
Vec3f spE4[3];
@@ -1461,18 +1459,18 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
}
func_80090A28(this, spE4);
func_800906D4(globalCtx, this, spE4);
func_800906D4(play, this, spE4);
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2710);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2712),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[((void)0, gSaveContext.linkAge)]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2717);
}
if (this->actor.scale.y >= 0.0f) {
@@ -1509,7 +1507,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
(this->rightHandType == PLAYER_MODELTYPE_12)) {
BowStringData* stringData = &sBowStringData[gSaveContext.linkAge];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2783);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2783);
Matrix_Push();
Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY);
@@ -1540,16 +1538,16 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
Matrix_RotateZ(this->unk_858 * -0.2f, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2804),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2804),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, stringData->dList);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2809);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2809);
} else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) {
Matrix_Get(&this->shieldMf);
func_80090604(globalCtx, this, &this->shieldQuad, D_80126154);
func_80090604(play, this, &this->shieldQuad, D_80126154);
}
if (this->actor.scale.y >= 0.0f) {
@@ -1570,7 +1568,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
if (func_8002DD78(this) != 0) {
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
Player_DrawHookshotReticle(
globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
}
}
}
@@ -1595,7 +1593,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) &&
(this->rightHandType != PLAYER_MODELTYPE_RH_FF)) {
if (Player_IsChildWithHylianShield(this)) {
func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C);
func_80090604(play, this, &this->shieldQuad, D_8012619C);
}
Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8);
@@ -1611,7 +1609,7 @@ void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx**
}
}
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) {
s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.linkAge];
u32 size;
void* ptr;
@@ -1630,8 +1628,8 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
gSegments[6] =
VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE);
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9,
ptr, ptr, PLAYER_LIMB_MAX);
SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9, ptr,
ptr, PLAYER_LIMB_MAX);
return size + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE +
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
@@ -1643,8 +1641,7 @@ u8 D_801261F8[] = {
PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BGS
};
s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* arg) {
s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) {
u8* playerSwordAndShield = arg;
//! @bug `playerSwordAndShield[0]` can be 0 (`PLAYER_SWORD_NONE`), which indexes `D_801261F8[-1]`. The result
//! happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash
@@ -1687,9 +1684,9 @@ s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx**
return 0;
}
void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime,
Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width,
s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, Vec3f* pos,
Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height,
Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
// Note: the viewport x and y values are overwritten below, before usage
static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0,
(PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 };
@@ -1699,10 +1696,10 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li
Gfx* opaRef;
Gfx* xluRef;
u16 perspNorm;
Mtx* perspMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
Mtx* lookAtMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3129);
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3129);
{ s32 pad[2]; }
@@ -1772,15 +1769,15 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li
gSPSetLights1(POLY_OPA_DISP++, lights1);
func_80093C80(globalCtx);
func_80093C80(play);
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000);
func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
func_8002EABC(pos, &play->view.eye, &lightDir, play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield);
gSPEndDisplayList(POLY_OPA_DISP++);
@@ -1789,11 +1786,11 @@ void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* li
gSPBranchList(opaRef, POLY_OPA_DISP);
gSPBranchList(xluRef, POLY_XLU_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3288);
}
void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots) {
void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword,
s32 tunic, s32 shield, s32 boots) {
static Vec3f eye = { 0.0f, 0.0f, -400.0f };
static Vec3f at = { 0.0f, 0.0f, 0.0f };
Vec3s* destTable;
@@ -1826,10 +1823,9 @@ void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnim
*destTable++ = *srcTable++;
}
Player_DrawPauseImpl(globalCtx, segment + PAUSE_EQUIP_BUFFER_SIZE,
Player_DrawPauseImpl(play, segment + PAUSE_EQUIP_BUFFER_SIZE,
segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime,
pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH,
PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
globalCtx->state.gfxCtx->curFrameBuffer +
(PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
}
+3 -3
View File
@@ -317,9 +317,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
s32 ret;
u32 eq;
Vec3f vec;
GlobalContext* globalCtx;
PlayState* play;
globalCtx = camera->globalCtx;
play = camera->play;
vec.x = 0.0f;
vec.y = 0.0f;
vec.z = 0.0f;
@@ -342,7 +342,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
req = &sQuakeRequest[idx];
if (req->callbackIdx != 0) {
if (globalCtx->cameraPtrs[req->camPtrIdx] == NULL) {
if (play->cameraPtrs[req->camPtrIdx] == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
req->camPtrIdx);
Quake_Remove(req);
+3 -3
View File
@@ -1007,12 +1007,12 @@ void func_80093C14(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1443);
}
void func_80093C80(GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
void func_80093C80(PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
func_80093D18(gfxCtx);
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) {
if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) {
OPEN_DISPS(gfxCtx, "../z_rcp.c", 1460);
gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE);
+70 -70
View File
@@ -1,9 +1,9 @@
#include "global.h"
#include "vt.h"
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095AB4(PlayState* play, Room* room, u32 flags);
void func_80095D04(PlayState* play, Room* room, u32 flags);
void func_80096F6C(PlayState* play, Room* room, u32 flags);
Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f };
@@ -22,34 +22,34 @@ Gfx D_801270B0[] = {
gsSPEndDisplayList(),
};
void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = {
void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = {
func_80095AB4,
func_80096F6C,
func_80095D04,
};
void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3) {
void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3) {
}
// Room Draw Polygon Type 0
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80095AB4(PlayState* play, Room* room, u32 flags) {
s32 i;
PolygonType0* polygon0;
PolygonDlist* polygonDlist;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 193);
OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 193);
if (flags & 1) {
func_800342EC(&D_801270A0, globalCtx);
func_800342EC(&D_801270A0, play);
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
func_80093C80(globalCtx);
func_80093C80(play);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2) {
func_8003435C(&D_801270A0, globalCtx);
func_8003435C(&D_801270A0, play);
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
@@ -67,7 +67,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) {
polygonDlist++;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 239);
CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 239);
}
#define SHAPE_SORT_MAX 64
@@ -80,7 +80,7 @@ typedef struct struct_80095D04 {
} struct_80095D04; // size = 0x10
// Room Draw Polygon Type 2
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80095D04(PlayState* play, Room* room, u32 flags) {
PolygonType2* polygon2;
PolygonDlist2* polygonDlist;
struct_80095D04 spB8[SHAPE_SORT_MAX];
@@ -99,18 +99,18 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
PolygonDlist2* polygonDlistIter;
f32 temp_f2;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 287);
OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 287);
if (flags & 1) {
func_800342EC(&D_801270A0, globalCtx);
func_800342EC(&D_801270A0, play);
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
func_80093C80(globalCtx);
func_80093C80(play);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (1) {}
if (flags & 2) {
func_8003435C(&D_801270A0, globalCtx);
func_8003435C(&D_801270A0, play);
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
@@ -125,10 +125,10 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
pos.x = polygonDlist->pos.x;
pos.y = polygonDlist->pos.y;
pos.z = polygonDlist->pos.z;
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &pos, &projectedPos, &projectedW);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &projectedW);
if (-(f32)polygonDlist->unk_06 < projectedPos.z) {
temp_f2 = projectedPos.z - polygonDlist->unk_06;
if (temp_f2 < globalCtx->lightCtx.fogFar) {
if (temp_f2 < play->lightCtx.fogFar) {
spA4->unk_00 = polygonDlist;
spA4->unk_04 = temp_f2;
iter = spB4;
@@ -212,7 +212,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
iREG(88) = i - 1;
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 430);
CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 430);
}
#define JPEG_MARKER 0xFFD8FFE0
@@ -306,7 +306,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h
}
// Room Draw Polygon Type 1 - Single Format
void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096680(PlayState* play, Room* room, u32 flags) {
Camera* activeCam;
Gfx* spA8;
PolygonType1* polygon1;
@@ -316,9 +316,9 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
u32 drawOpa;
u32 drawXlu;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 628);
OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 628);
activeCam = GET_ACTIVE_CAM(globalCtx);
activeCam = GET_ACTIVE_CAM(play);
isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
@@ -330,7 +330,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
if (drawOpa) {
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa);
}
@@ -355,16 +355,16 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
if (drawXlu) {
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 691);
CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 691);
}
BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
Camera* activeCam = GET_ACTIVE_CAM(globalCtx);
BgImage* func_80096A74(PolygonType1* polygon1, PlayState* play) {
Camera* activeCam = GET_ACTIVE_CAM(play);
s32 camDataIdx;
s16 camDataIdx2;
Player* player;
@@ -373,12 +373,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
camDataIdx = activeCam->camDataIdx;
// jfifid
camDataIdx2 = func_80041C10(&globalCtx->colCtx, camDataIdx, BGCHECK_SCENE)[2].y;
camDataIdx2 = func_80041C10(&play->colCtx, camDataIdx, BGCHECK_SCENE)[2].y;
if (camDataIdx2 >= 0) {
camDataIdx = camDataIdx2;
}
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
player->actor.params = (player->actor.params & 0xFF00) | camDataIdx;
bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list);
@@ -397,7 +397,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
}
// Room Draw Polygon Type 1 - Multi Format
void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096B6C(PlayState* play, Room* room, u32 flags) {
Camera* activeCam;
Gfx* gfx;
PolygonType1* polygon1;
@@ -408,13 +408,13 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
u32 drawOpa;
u32 drawXlu;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 752);
OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 752);
activeCam = GET_ACTIVE_CAM(globalCtx);
activeCam = GET_ACTIVE_CAM(play);
isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
bgImage = func_80096A74(polygon1, globalCtx);
bgImage = func_80096A74(polygon1, play);
drawBg = (flags & 1) && isFixedCamera && bgImage->source && !(SREG(25) & 1);
drawOpa = (flags & 1) && (polygonDlist->opa != NULL) && !(SREG(25) & 2);
drawXlu = (flags & 2) && (polygonDlist->xlu != NULL) && !(SREG(25) & 4);
@@ -423,7 +423,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
if (drawOpa) {
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa);
}
@@ -449,35 +449,35 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
if (drawXlu) {
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 819);
CLOSE_DISPS(play->state.gfxCtx, "../z_room.c", 819);
}
// Room Draw Polygon Type 1
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096F6C(PlayState* play, Room* room, u32 flags) {
PolygonType1* polygon1 = &room->meshHeader->polygon1;
if (polygon1->format == 1) {
func_80096680(globalCtx, room, flags);
func_80096680(play, room, flags);
} else if (polygon1->format == 2) {
func_80096B6C(globalCtx, room, flags);
func_80096B6C(play, room, flags);
} else {
LogUtils_HungupThread("../z_room.c", 841);
}
}
void func_80096FD4(GlobalContext* globalCtx, Room* room) {
void func_80096FD4(PlayState* play, Room* room) {
room->num = -1;
room->segment = NULL;
}
u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
u32 maxRoomSize = 0;
RomFile* roomList = globalCtx->roomList;
RomFile* roomList = play->roomList;
u32 roomSize;
s32 i;
s32 j;
@@ -487,7 +487,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
u32 backRoomSize;
u32 cumulRoomSize;
for (i = 0; i < globalCtx->numRooms; i++) {
for (i = 0; i < play->numRooms; i++) {
roomSize = roomList[i].vromEnd - roomList[i].vromStart;
osSyncPrintf("ROOM%d size=%d\n", i, roomSize);
if (maxRoomSize < roomSize) {
@@ -495,13 +495,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
}
}
if (globalCtx->transiActorCtx.numActors != 0) {
RomFile* roomList = globalCtx->roomList;
TransitionActorEntry* transitionActor = &globalCtx->transiActorCtx.list[0];
if (play->transiActorCtx.numActors != 0) {
RomFile* roomList = play->roomList;
TransitionActorEntry* transitionActor = &play->transiActorCtx.list[0];
LOG_NUM("game_play->room_rom_address.num", globalCtx->numRooms, "../z_room.c", 912);
LOG_NUM("game_play->room_rom_address.num", play->numRooms, "../z_room.c", 912);
for (j = 0; j < globalCtx->transiActorCtx.numActors; j++) {
for (j = 0; j < play->transiActorCtx.numActors; j++) {
frontRoom = transitionActor->sides[0].room;
backRoom = transitionActor->sides[1].room;
frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart;
@@ -520,7 +520,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
osSyncPrintf(VT_FGCOL(YELLOW));
// "Room buffer size=%08x(%5.1fK)"
osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, maxRoomSize / 1024.0f);
roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946);
roomCtx->bufPtrs[0] = GameState_Alloc(&play->state, maxRoomSize, "../z_room.c", 946);
// "Room buffer initial pointer=%08x"
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize);
@@ -531,13 +531,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
roomCtx->status = 0;
frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex)
: globalCtx->setupEntranceList[globalCtx->curSpawn].room;
func_8009728C(globalCtx, roomCtx, frontRoom);
: play->setupEntranceList[play->curSpawn].room;
func_8009728C(play, roomCtx, frontRoom);
return maxRoomSize;
}
s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
u32 size;
if (roomCtx->status == 0) {
@@ -546,13 +546,13 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
roomCtx->curRoom.segment = NULL;
roomCtx->status = 1;
ASSERT(roomNum < globalCtx->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009);
ASSERT(roomNum < play->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009);
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
roomCtx->unk_34 = (void*)ALIGN16((u32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,
&roomCtx->loadQueue, NULL, "../z_room.c", 1036);
roomCtx->unk_30 ^= 1;
@@ -562,16 +562,16 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
return 0;
}
s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
s32 func_800973FC(PlayState* play, RoomContext* roomCtx) {
if (roomCtx->status == 1) {
if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
roomCtx->status = 0;
roomCtx->curRoom.segment = roomCtx->unk_34;
gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment);
Player_SetBootData(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
Scene_ExecuteCommands(play, roomCtx->curRoom.segment);
Player_SetBootData(play, GET_PLAYER(play));
Actor_SpawnTransitionActors(play, &play->actorCtx);
return 1;
}
@@ -582,23 +582,23 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
return 1;
}
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) {
void Room_Draw(PlayState* play, Room* room, u32 flags) {
if (room->segment != NULL) {
gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment);
ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers),
"this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125);
sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags);
sRoomDrawHandlers[room->meshHeader->base.type](play, room, flags);
}
}
void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) {
void func_80097534(PlayState* play, RoomContext* roomCtx) {
roomCtx->prevRoom.num = -1;
roomCtx->prevRoom.segment = NULL;
func_80031B14(globalCtx, &globalCtx->actorCtx);
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
Map_InitRoomData(globalCtx, roomCtx->curRoom.num);
if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) {
Map_SavePlayerInitialInfo(globalCtx);
func_80031B14(play, &play->actorCtx);
Actor_SpawnTransitionActors(play, &play->actorCtx);
Map_InitRoomData(play, roomCtx->curRoom.num);
if (!((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_SPOT20))) {
Map_SavePlayerInitialInfo(play);
}
Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo);
Audio_SetEnvReverb(play->roomCtx.curRoom.echo);
}
+1 -1
View File
@@ -2,7 +2,7 @@
void Sample_HandleStateChange(SampleContext* this) {
if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) {
SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
this->state.running = false;
}
}
+99 -98
View File
@@ -33,24 +33,24 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) {
return objectCtx->num - 1;
}
void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
GlobalContext* globalCtx2 = globalCtx; // Needs to be a new variable to match (possibly a sub struct?)
void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?)
u32 spaceSize;
s32 i;
if (globalCtx2->sceneNum == SCENE_SPOT00) {
if (play2->sceneNum == SCENE_SPOT00) {
spaceSize = 1024000;
} else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) {
} else if (play2->sceneNum == SCENE_GANON_DEMO) {
if (gSaveContext.sceneSetupIndex != 4) {
spaceSize = 1177600;
} else {
spaceSize = 1024000;
}
} else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) {
} else if (play2->sceneNum == SCENE_JYASINBOSS) {
spaceSize = 1075200;
} else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) {
} else if (play2->sceneNum == SCENE_KENJYANOMA) {
spaceSize = 1075200;
} else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) {
} else if (play2->sceneNum == SCENE_GANON_BOSS) {
spaceSize = 1075200;
} else {
spaceSize = 1024000;
@@ -69,7 +69,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
osSyncPrintf(VT_RST);
objectCtx->spaceStart = objectCtx->status[0].segment =
GameState_Alloc(&globalCtx->state, spaceSize, "../z_scene.c", 219);
GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219);
objectCtx->spaceEnd = (void*)((s32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
@@ -158,7 +158,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) {
return nextPtr;
}
s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
u32 cmdCode;
while (true) {
@@ -171,7 +171,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
}
if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) {
gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd);
gSceneCmdHandlers[cmdCode](play, sceneCmd);
} else {
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("code の値が異常です\n"); // "code variable is abnormal"
@@ -182,29 +182,29 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
return 0;
}
void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) +
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
ActorEntry* linkEntry = play->linkActorEntry =
(ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn;
s16 linkObjectId;
globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)];
gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId;
Object_Spawn(&globalCtx->objectCtx, linkObjectId);
Object_Spawn(&play->objectCtx, linkObjectId);
}
void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numSetupActors = cmd->actorList.num;
globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment);
void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) {
play->numSetupActors = cmd->actorList.num;
play->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment);
}
void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) {
play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
}
void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) {
CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment);
colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList);
@@ -213,41 +213,41 @@ void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
colHeader->cameraDataList = SEGMENTED_TO_VIRTUAL(colHeader->cameraDataList);
colHeader->waterBoxes = SEGMENTED_TO_VIRTUAL(colHeader->waterBoxes);
BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader);
BgCheck_Allocate(&play->colCtx, play, colHeader);
}
void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numRooms = cmd->roomList.num;
globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment);
void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) {
play->numRooms = cmd->roomList.num;
play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment);
}
void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment);
void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) {
play->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment);
}
void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
}
if (cmd->specialFiles.cUpElfMsgNum != 0) {
globalCtx->cUpElfMsgs = Play_LoadFile(globalCtx, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
play->cUpElfMsgs = Play_LoadFile(play, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
}
}
void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
}
void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
void Scene_CommandMeshHeader(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
}
void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
s32 i;
s32 j;
s32 k;
@@ -258,19 +258,19 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
void* nextPtr;
k = 0;
i = globalCtx->objectCtx.unk_09;
firstStatus = &globalCtx->objectCtx.status[0];
status = &globalCtx->objectCtx.status[i];
i = play->objectCtx.unk_09;
firstStatus = &play->objectCtx.status[0];
status = &play->objectCtx.status[i];
while (i < globalCtx->objectCtx.num) {
while (i < play->objectCtx.num) {
if (status->id != *objectEntry) {
status2 = &globalCtx->objectCtx.status[i];
for (j = i; j < globalCtx->objectCtx.num; j++) {
status2 = &play->objectCtx.status[i];
for (j = i; j < play->objectCtx.num; j++) {
status2->id = OBJECT_INVALID;
status2++;
}
globalCtx->objectCtx.num = i;
func_80031A28(globalCtx, &globalCtx->actorCtx);
play->objectCtx.num = i;
func_80031A28(play, &play->actorCtx);
continue;
}
@@ -285,7 +285,7 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
"../z_scene.c", 705);
while (k < cmd->objectList.num) {
nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry);
nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry);
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
firstStatus[i + 1].segment = nextPtr;
}
@@ -294,71 +294,72 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
objectEntry++;
}
globalCtx->objectCtx.num = i;
play->objectCtx.num = i;
}
void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
s32 i;
LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment);
for (i = 0; i < cmd->lightList.num; i++) {
LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo);
LightContext_InsertLight(play, &play->lightCtx, lightInfo);
lightInfo++;
}
}
void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment);
void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) {
play->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment);
}
void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->transiActorCtx.numActors = cmd->transiActorList.num;
globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment);
void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) {
play->transiActorCtx.numActors = cmd->transiActorList.num;
play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment);
}
void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx) {
transiActorCtx->numActors = 0;
}
void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num;
globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment);
void Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) {
play->envCtx.numLightSettings = cmd->lightSettingList.num;
play->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment);
}
void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->skyboxId = cmd->skyboxSettings.skyboxId;
globalCtx->envCtx.skyboxConfig = globalCtx->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.unk_05;
globalCtx->envCtx.lightMode = cmd->skyboxSettings.unk_06;
void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) {
play->skyboxId = cmd->skyboxSettings.skyboxId;
play->envCtx.skyboxConfig = play->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.unk_05;
play->envCtx.lightMode = cmd->skyboxSettings.unk_06;
}
void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) {
play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
}
void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) {
gSaveContext.skyboxTime = gSaveContext.dayTime =
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
}
if (cmd->timeSettings.unk_06 != 0xFF) {
globalCtx->envCtx.sceneTimeSpeed = cmd->timeSettings.unk_06;
play->envCtx.sceneTimeSpeed = cmd->timeSettings.unk_06;
} else {
globalCtx->envCtx.sceneTimeSpeed = 0;
play->envCtx.sceneTimeSpeed = 0;
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeSpeed = globalCtx->envCtx.sceneTimeSpeed;
gTimeSpeed = play->envCtx.sceneTimeSpeed;
}
globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f;
play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f;
if (((globalCtx->envCtx.sceneTimeSpeed == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
(gSaveContext.entranceIndex == ENTR_SPOT06_8)) {
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
if ((gSaveContext.skyboxTime > CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) {
gSaveContext.skyboxTime = CLOCK_TIME(5, 0) + 1;
} else if ((gSaveContext.skyboxTime >= CLOCK_TIME(6, 30)) && (gSaveContext.skyboxTime <= CLOCK_TIME(8, 0))) {
@@ -372,39 +373,39 @@ void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) {
s8 x = cmd->windSettings.x;
s8 y = cmd->windSettings.y;
s8 z = cmd->windSettings.z;
globalCtx->envCtx.windDirection.x = x;
globalCtx->envCtx.windDirection.y = y;
globalCtx->envCtx.windDirection.z = z;
play->envCtx.windDirection.x = x;
play->envCtx.windDirection.y = y;
play->envCtx.windDirection.z = z;
globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07;
play->envCtx.windSpeed = cmd->windSettings.unk_07;
}
void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment);
void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) {
play->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment);
}
void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) {
}
void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId;
globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
play->sequenceCtx.seqId = cmd->soundSettings.seqId;
play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) {
Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000);
}
}
void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo;
void Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.echo = cmd->echoSettings.echo;
}
void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
s32 pad;
SceneCmd* altHeader;
@@ -418,7 +419,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
if (1) {}
if (altHeader != NULL) {
Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader));
Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader));
(cmd + 1)->base.code = SCENE_CMD_ID_END;
} else {
// "Coughh! There is no specified dataaaaa!"
@@ -432,7 +433,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");
if (altHeader != NULL) {
Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader));
Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader));
(cmd + 1)->base.code = SCENE_CMD_ID_END;
}
}
@@ -440,24 +441,24 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) {
osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment);
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment);
void Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) {
osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment);
play->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment);
}
// Camera & World Map Area
void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {
YREG(15) = cmd->miscSettings.cameraMovement;
gSaveContext.worldMapArea = cmd->miscSettings.area;
if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) {
if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) {
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
gSaveContext.worldMapArea = 1;
}
}
if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) ||
((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) {
if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) ||
((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) {
if (gSaveContext.cutsceneIndex < 0xFFF0) {
gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea];
osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.worldMapAreaData,
@@ -466,7 +467,7 @@ void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = {
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = {
Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST
Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2
+441 -453
View File
File diff suppressed because it is too large Load Diff
+164 -173
View File
@@ -3,8 +3,8 @@
#define ANIM_INTERP 1
s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime);
s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime);
s32 SkelAnime_LoopFull(SkelAnime* skelAnime);
s32 SkelAnime_Once(SkelAnime* skelAnime);
s32 SkelAnime_LoopPartial(SkelAnime* skelAnime);
@@ -18,14 +18,14 @@ static u32 sAnimQueueFlags;
* Draw a limb of type `LodLimb`
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 773);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 773);
Matrix_Push();
limb = (LodLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
@@ -38,10 +38,10 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
dList = limb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 805), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 805), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
@@ -49,28 +49,28 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
if (1) {}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg);
postLimbDraw(play, limbIndex, &dList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
SkelAnime_DrawLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
SkelAnime_DrawLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 821);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 821);
}
/**
* Draw all limbs of type `LodLimb` in a given skeleton
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* rootLimb;
s32 pad;
Gfx* dList;
@@ -84,7 +84,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 849);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 849);
Matrix_Push();
@@ -96,32 +96,31 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
rot = jointTable[1];
dList = rootLimb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg);
postLimbDraw(play, 1, &dList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod);
SkelAnime_DrawLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 894);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 894);
}
/**
* Draw a limb of type `LodLimb` contained within a flexible skeleton
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod,
Mtx** mtx) {
LodLimb* limb;
@@ -143,15 +142,15 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
newDList = limbDList = limb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(*mtx, "../z_skelanime.c", 945);
{
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 946);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 946);
gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, newDList);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 949);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 949);
}
(*mtx)++;
} else if (limbDList != NULL) {
@@ -160,18 +159,18 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, mtx);
SkelAnime_DrawFlexLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod,
mtx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, mtx);
SkelAnime_DrawFlexLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod,
mtx);
}
}
@@ -180,7 +179,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* rootLimb;
s32 pad;
@@ -188,7 +187,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@@ -197,7 +196,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1000);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1000);
gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
Matrix_Push();
@@ -211,7 +210,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
newDList = limbDList = rootLimb->dLists[lod];
if ((overrideLimbDraw == 0) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == 0) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(mtx, "../z_skelanime.c", 1033);
@@ -225,29 +224,29 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg);
postLimbDraw(play, 1, &limbDList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, &mtx);
SkelAnime_DrawFlexLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod,
&mtx);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1053);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1053);
}
/**
* Draw a limb of type `StandardLimb` to the polyOpa buffer
*/
void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1076);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1076);
Matrix_Push();
limb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
@@ -258,10 +257,10 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
pos.z = limb->jointPos.z;
dList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
@@ -269,26 +268,26 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
if (1) {}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg);
postLimbDraw(play, limbIndex, &dList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1121);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1121);
}
/**
* Draw all limbs of type `StandardLimb` in a given skeleton to the polyOpa buffer
*/
void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* rootLimb;
s32 pad;
Gfx* dList;
@@ -302,7 +301,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1148);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1148);
Matrix_Push();
rootLimb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[0]);
@@ -314,31 +313,31 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
rot = jointTable[1];
dList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg);
postLimbDraw(play, 1, &dList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1190);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1190);
}
/**
* Draw a limb of type `StandardLimb` contained within a flexible skeleton to the polyOpa buffer
*/
void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg,
Mtx** limbMatrices) {
StandardLimb* limb;
@@ -347,7 +346,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1214);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1214);
Matrix_Push();
@@ -361,7 +360,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
newDList = limbDList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(*limbMatrices, "../z_skelanime.c", 1242);
@@ -375,21 +374,21 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
limbMatrices);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
limbMatrices);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1265);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1265);
}
/**
@@ -397,7 +396,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* rootLimb;
s32 pad;
@@ -405,7 +404,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@@ -414,7 +413,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1294);
OPEN_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1294);
gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
@@ -430,7 +429,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
newDList = limbDList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(mtx, "../z_skelanime.c", 1327);
@@ -444,16 +443,16 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg);
postLimbDraw(play, 1, &limbDList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
&mtx);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1347);
CLOSE_DISPS(play->state.gfxCtx, "../z_skelanime.c", 1347);
}
/**
@@ -502,7 +501,7 @@ s16 Animation_GetLastFrame(void* animation) {
/**
* Draw a limb of type `StandardLimb` to the specified display buffer
*/
Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* limb;
Gfx* dList;
@@ -522,28 +521,26 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
dList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1489), G_MTX_LOAD);
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1489), G_MTX_LOAD);
gSPDisplayList(gfx++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg, &gfx);
postLimbDraw(play, limbIndex, &dList, &rot, arg, &gfx);
}
if (limb->child != LIMB_DONE) {
gfx =
SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
gfx = SkelAnime_DrawLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx);
gfx = SkelAnime_DrawLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
}
return gfx;
@@ -552,7 +549,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
/**
* Draw all limbs of type `StandardLimb` in a given skeleton to the specified display buffer
*/
Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* rootLimb;
s32 pad;
@@ -580,21 +577,20 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
dList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1558), G_MTX_LOAD);
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx, "../z_skelanime.c", 1558), G_MTX_LOAD);
gSPDisplayList(gfx++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg, &gfx);
postLimbDraw(play, 1, &dList, &rot, arg, &gfx);
}
if (rootLimb->child != LIMB_DONE) {
gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx);
gfx = SkelAnime_DrawLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
}
Matrix_Pop();
@@ -605,7 +601,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
/**
* Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer
*/
Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Mtx** mtx,
Gfx* gfx) {
StandardLimb* limb;
@@ -625,7 +621,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
pos.z = limb->jointPos.z;
newDList = limbDList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(*mtx, "../z_skelanime.c", 1623);
@@ -638,18 +634,18 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg, &gfx);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg, &gfx);
}
if (limb->child != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
mtx, gfx);
gfx = SkelAnime_DrawFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, mtx,
gfx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
arg, mtx, gfx);
gfx = SkelAnime_DrawFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
mtx, gfx);
}
return gfx;
@@ -660,7 +656,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* rootLimb;
s32 pad;
@@ -668,7 +664,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(*mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(*mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@@ -690,7 +686,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
newDList = limbDList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
Matrix_ToMtx(mtx, "../z_skelanime.c", 1710);
@@ -703,11 +699,11 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg, &gfx);
postLimbDraw(play, 1, &limbDList, &rot, arg, &gfx);
}
if (rootLimb->child != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
arg, &mtx, gfx);
gfx = SkelAnime_DrawFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
&mtx, gfx);
}
Matrix_Pop();
@@ -810,14 +806,14 @@ void AnimationContext_Reset(AnimationContext* animationCtx) {
/**
* Shifts the queue flag to the next queue
*/
void AnimationContext_SetNextQueue(GlobalContext* globalCtx) {
void AnimationContext_SetNextQueue(PlayState* play) {
sAnimQueueFlags <<= 1;
}
/**
* Disables the current animation queue. Only load and move actor requests will be processed for that queue.
*/
void AnimationContext_DisableQueue(GlobalContext* globalCtx) {
void AnimationContext_DisableQueue(PlayState* play) {
sDisableAnimQueueFlags |= sAnimQueueFlags;
}
@@ -838,9 +834,9 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat
/**
* Requests loading frame data from the Link animation into frameTable
*/
void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
Vec3s* frameTable) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_LOADFRAME);
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_LOADFRAME);
if (entry != NULL) {
LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation);
@@ -857,8 +853,8 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader
/**
* Requests copying all vectors from src frame table into dst frame table
*/
void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYALL);
void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYALL);
if (entry != NULL) {
entry->data.copy.queueFlag = sAnimQueueFlags;
@@ -871,8 +867,8 @@ void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s*
/**
* Requests interpolating between base and mod frame tables with the given weight, placing the result in base
*/
void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_INTERP);
void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_INTERP);
if (entry != NULL) {
entry->data.interp.queueFlag = sAnimQueueFlags;
@@ -886,8 +882,8 @@ void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* b
/**
* Requests copying vectors from src frame table to dst frame table whose copy flag is true
*/
void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYTRUE);
void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYTRUE);
if (entry != NULL) {
entry->data.copy1.queueFlag = sAnimQueueFlags;
@@ -901,8 +897,8 @@ void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s*
/**
* Requests copying vectors from src frame table to dst frame table whose copy flag is false
*/
void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYFALSE);
void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYFALSE);
if (entry != NULL) {
entry->data.copy0.queueFlag = sAnimQueueFlags;
@@ -916,8 +912,8 @@ void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s
/**
* Requests moving an actor according to the translation of its root limb
*/
void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_MOVEACTOR);
void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_MOVEACTOR);
if (entry != NULL) {
entry->data.move.actor = actor;
@@ -929,7 +925,7 @@ void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelA
/**
* Receives the request for Link's animation frame data
*/
void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data) {
AnimEntryLoadFrame* entry = &data->load;
osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK);
@@ -938,7 +934,7 @@ void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* da
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table
*/
void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyAll* entry = &data->copy;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@@ -955,7 +951,7 @@ void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data
/**
* If the entry's queue is enabled, interpolates between the base and mod frame tables, placing the result in base
*/
void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_Interp(PlayState* play, AnimationEntryData* data) {
AnimEntryInterp* entry = &data->interp;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@@ -966,7 +962,7 @@ void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data)
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is true
*/
void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyTrue(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyTrue* entry = &data->copy1;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@@ -986,7 +982,7 @@ void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* dat
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is false
*/
void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyFalse(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyFalse* entry = &data->copy0;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@@ -1006,7 +1002,7 @@ void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* da
/**
* Moves an actor according to the translation of its root limb
*/
void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_MoveActor(PlayState* play, AnimationEntryData* data) {
AnimEntryMoveActor* entry = &data->move;
Actor* actor = entry->actor;
Vec3f diff;
@@ -1020,7 +1016,7 @@ void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* da
/**
* Performs all requests in the animation queue, then resets the queue flags.
*/
void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx) {
void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) {
static AnimationEntryCallback animFuncs[] = {
AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp,
AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor,
@@ -1028,7 +1024,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati
AnimationEntry* entry;
for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) {
animFuncs[entry->type](globalCtx, &entry->data);
animFuncs[entry->type](play, &entry->data);
}
sAnimQueueFlags = 1;
@@ -1039,7 +1035,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati
* Initializes a skeleton to be used with Link animations to a looping animation, dynamically allocating the frame
* tables if not given.
*/
void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable,
s32 limbBufCount) {
FlexSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
@@ -1084,7 +1080,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel
osSyncPrintf(VT_RST);
}
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
}
/**
@@ -1103,15 +1099,15 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) {
* Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it
* finishes.
*/
s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime) {
return skelAnime->update(globalCtx, skelAnime);
s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) {
return skelAnime->update(play, skelAnime);
}
/**
* Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the
* animation frame
*/
s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime) {
f32 prevMorphWeight = skelAnime->morphWeight;
f32 updateRate = R_UPDATE_RATE * 0.5f;
@@ -1121,7 +1117,7 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
LinkAnimation_SetUpdateFunction(skelAnime);
}
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
1.0f - (skelAnime->morphWeight / prevMorphWeight));
return 0;
}
@@ -1130,8 +1126,8 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
* Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between
* jointTable and morphTable
*/
void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetLoadFrame(globalCtx, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount,
void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetLoadFrame(play, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount,
skelAnime->jointTable);
if (skelAnime->morphWeight != 0) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
@@ -1140,7 +1136,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime)
if (skelAnime->morphWeight <= 0.0f) {
skelAnime->morphWeight = 0.0f;
} else {
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
skelAnime->morphWeight);
}
}
@@ -1149,7 +1145,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime)
/**
* Advances a Link animation that loops over its full length
*/
s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
skelAnime->curFrame += skelAnime->playSpeed * updateRate;
@@ -1158,18 +1154,18 @@ s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) {
} else if (skelAnime->animLength <= skelAnime->curFrame) {
skelAnime->curFrame -= skelAnime->animLength;
}
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 0;
}
/**
* Advances a Link animation that stops at endFrame and returns true when it is reached.
*/
s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
if (skelAnime->curFrame == skelAnime->endFrame) {
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 1;
}
skelAnime->curFrame += skelAnime->playSpeed * updateRate;
@@ -1180,14 +1176,14 @@ s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) {
} else if (skelAnime->animLength <= skelAnime->curFrame) {
skelAnime->curFrame -= skelAnime->animLength;
}
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 0;
}
/**
* Sets a new morph and resets the morph weight for the current animation.
*/
void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames) {
void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames) {
skelAnime->morphWeight = 1.0f;
skelAnime->morphRate = 1.0f / morphFrames;
}
@@ -1198,7 +1194,7 @@ void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morp
* animation, then start the new animation. Negative morph frames start the new animation immediately, modified by the
* pose immediately before the animation change.
*/
void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) {
skelAnime->mode = mode;
if ((morphFrames != 0.0f) && ((animation != skelAnime->animation) || (startFrame != skelAnime->curFrame))) {
@@ -1208,15 +1204,14 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn
morphFrames = -morphFrames;
} else {
skelAnime->update = LinkAnimation_Morph;
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount,
skelAnime->morphTable);
}
skelAnime->morphWeight = 1.0f;
skelAnime->morphRate = 1.0f / morphFrames;
} else {
LinkAnimation_SetUpdateFunction(skelAnime);
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
skelAnime->jointTable);
AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->jointTable);
skelAnime->morphWeight = 0.0f;
}
@@ -1232,105 +1227,101 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn
/**
* Immediately changes to a Link animation that plays once at the default speed.
*/
void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE,
void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE,
0.0f);
}
/**
* Immediately changes to a Link animation that plays once at the specified speed.
*/
void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 playSpeed) {
LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
ANIMMODE_ONCE, 0.0f);
LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE,
0.0f);
}
/**
* Immediately changes to a Link animation that loops at the default speed.
*/
void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP,
void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP,
0.0f);
}
/**
* Immediately changes to a Link animation that loops at the specified speed.
*/
void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 playSpeed) {
LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
ANIMMODE_LOOP, 0.0f);
LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP,
0.0f);
}
/**
* Requests copying jointTable to morphTable
*/
void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable);
void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable);
}
/**
* Requests copying morphTable to jointTable
* unused
*/
void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable);
void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable);
}
/**
* Requests loading frame data from the Link animation into morphTable
*/
void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 frame) {
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable);
void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) {
AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable);
}
/**
* Requests loading frame data from the Link animation into jointTable
*/
void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 frame) {
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable);
void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) {
AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable);
}
/**
* Requests interpolating between jointTable and morphTable, placing the result in jointTable
*/
void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 weight) {
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight);
void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight) {
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight);
}
/**
* Requests loading frame data from the Link animations and blending them, placing the result in jointTable
*/
void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
Vec3s* blendTable) {
void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1,
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) {
Vec3s* alignedBlendTable;
AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
}
/**
* Requests loading frame data from the Link animations and blending them, placing the result in morphTable
*/
void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
Vec3s* blendTable) {
void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1,
LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable) {
Vec3s* alignedBlendTable;
AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
}
/**
@@ -1380,8 +1371,8 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) {
/**
* Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided.
*/
s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation,
Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
skelAnime->limbCount = skeletonHeader->limbCount + 1;
@@ -1410,7 +1401,7 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade
/**
* Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given.
*/
s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
FlexSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
@@ -1444,7 +1435,7 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele
/**
* Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables.
*/
s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation) {
SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
@@ -1839,7 +1830,7 @@ s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame) {
/**
* Frees the frame tables for a skelAnime with dynamically allocated tables.
*/
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) {
void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play) {
if (skelAnime->jointTable != NULL) {
ZeldaArena_FreeDebug(skelAnime->jointTable, "../z_skelanime.c", 3729);
} else {
+12 -12
View File
@@ -185,12 +185,12 @@ void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlis
CLOSE_DISPS(gfxCtx, "../z_skin.c", 433);
}
void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
s32 i;
s32 segmentType;
SkinLimb** skeleton;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
s32 pad;
OPEN_DISPS(gfxCtx, "../z_skin.c", 471);
@@ -218,7 +218,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
s32 shouldDraw = true;
if (overrideLimbDraw != NULL) {
shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin);
shouldDraw = overrideLimbDraw(actor, play, i, skin);
}
segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType;
@@ -231,7 +231,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
}
if (postDraw != NULL) {
postDraw(actor, globalCtx, skin);
postDraw(actor, play, skin);
}
close_disps:
@@ -239,26 +239,26 @@ close_disps:
}
// allows specifying PostLimbDraw and setTranslation
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0);
void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0);
}
// allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
}
// allows specifying OverrideLimbDraw, PostLimbDraw, setTranslation, and arg6
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
}
// allows specifying all variables
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags);
}
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) {
+6 -6
View File
@@ -4,7 +4,7 @@
/**
* Initialises the Vtx buffers used for limb at index `limbIndex`
*/
void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) {
void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) {
s32 i;
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
SkinAnimatedLimbData* animatedLimbData =
@@ -36,7 +36,7 @@ void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex)
* Initializes a skin skeleton to looping animation, dynamically allocating the frame tables,
* and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs
*/
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
s32 limbCount;
s32 i;
SkinLimb** skeleton;
@@ -74,17 +74,17 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 240);
ASSERT(vtxEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
Skin_InitAnimatedLimb(globalCtx, skin, i);
Skin_InitAnimatedLimb(play, skin, i);
}
}
SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader);
SkelAnime_InitSkin(play, &skin->skelAnime, skeletonHeader, animationHeader);
}
/**
* Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables
*/
void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
void Skin_Free(PlayState* play, Skin* skin) {
if (skin->vtxTable != NULL) {
s32 i;
@@ -103,7 +103,7 @@ void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
ZeldaArena_FreeDebug(skin->vtxTable, "../z_skin_awb.c", 286);
}
SkelAnime_Free(&skin->skelAnime, globalCtx);
SkelAnime_Free(&skin->skelAnime, play);
}
}
+12 -12
View File
@@ -1,24 +1,24 @@
#include "global.h"
void SoundSource_InitAll(GlobalContext* globalCtx) {
SoundSource* sources = &globalCtx->soundSources[0];
void SoundSource_InitAll(PlayState* play) {
SoundSource* sources = &play->soundSources[0];
s32 i;
// clang-format off
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; }
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; }
// clang-format on
}
void SoundSource_UpdateAll(GlobalContext* globalCtx) {
SoundSource* source = &globalCtx->soundSources[0];
void SoundSource_UpdateAll(PlayState* play) {
SoundSource* source = &play->soundSources[0];
s32 i;
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
if (source->countdown != 0) {
if (DECR(source->countdown) == 0) {
Audio_StopSfxByPos(&source->projectedPos);
} else {
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
}
}
@@ -26,15 +26,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) {
}
}
void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) {
void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId) {
s32 countdown;
SoundSource* source;
s32 smallestCountdown = 0xFFFF;
SoundSource* backupSource;
s32 i;
source = &globalCtx->soundSources[0];
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
source = &play->soundSources[0];
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
if (source->countdown == 0) {
break;
}
@@ -49,7 +49,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
}
// If no sound source is available, replace the sound source with the smallest remaining countdown
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
if (i >= ARRAY_COUNT(play->soundSources)) {
source = backupSource;
Audio_StopSfxByPos(&source->projectedPos);
}
@@ -57,7 +57,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
source->worldPos = *worldPos;
source->countdown = duration;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
+1 -1
View File
@@ -899,5 +899,5 @@ void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295);
}
void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx) {
void Sram_Init(PlayState* play, SramContext* sramCtx) {
}
+61 -63
View File
@@ -370,7 +370,7 @@ void func_800AF178(SkyboxContext* skyboxCtx, s32 arg1) {
}
}
void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) {
void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
u32 size;
s16 i;
u8 skybox1Index;
@@ -390,25 +390,23 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
if (gSaveContext.skyboxTime >= gTimeBasedSkyboxConfigs[skyboxConfig][i].startTime &&
(gSaveContext.skyboxTime < gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime ||
gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime == 0xFFFF)) {
globalCtx->envCtx.skybox1Index = skybox1Index =
gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox1Index;
globalCtx->envCtx.skybox2Index = skybox2Index =
gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox2Index;
play->envCtx.skybox1Index = skybox1Index = gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox1Index;
play->envCtx.skybox2Index = skybox2Index = gTimeBasedSkyboxConfigs[skyboxConfig][i].skybox2Index;
if (gTimeBasedSkyboxConfigs[skyboxConfig][i].changeSkybox) {
globalCtx->envCtx.skyboxBlend =
play->envCtx.skyboxBlend =
Environment_LerpWeight(gTimeBasedSkyboxConfigs[skyboxConfig][i].endTime,
gTimeBasedSkyboxConfigs[skyboxConfig][i].startTime,
((void)0, gSaveContext.skyboxTime)) *
255.0f;
} else {
globalCtx->envCtx.skyboxBlend = 0;
play->envCtx.skyboxBlend = 0;
}
break;
}
}
size = gNormalSkyFiles[skybox1Index].file.vromEnd - gNormalSkyFiles[skybox1Index].file.vromStart;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1054);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1054);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1055);
@@ -416,7 +414,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
"../z_vr_box.c", 1058);
size = gNormalSkyFiles[skybox2Index].file.vromEnd - gNormalSkyFiles[skybox2Index].file.vromStart;
skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1060);
skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1060);
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
1061);
@@ -426,7 +424,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
if ((skybox1Index & 1) ^ ((skybox1Index & 4) >> 2)) {
size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1072);
skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1072);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1073);
@@ -437,7 +435,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
} else {
size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1085);
skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1085);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1086);
@@ -453,7 +451,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_SP1a_staticSegmentRomStart;
size = _vr_SP1a_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1127);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1127);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1128);
@@ -461,7 +459,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_SP1a_pal_staticSegmentRomStart;
size = _vr_SP1a_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1132);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1132);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1133);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1134);
@@ -470,13 +468,13 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
case SKYBOX_OVERCAST_SUNSET:
start = _vr_cloud2_staticSegmentRomStart;
size = _vr_cloud2_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1155);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1155);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1156);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1159);
skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1162);
skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1162);
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
1163);
@@ -484,7 +482,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_cloud2_pal_staticSegmentRomStart;
size = _vr_cloud2_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1170);
skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1170);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1171);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173);
@@ -495,7 +493,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_RUVR_staticSegmentRomStart;
size = _vr_RUVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1182);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1182);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1183);
@@ -505,7 +503,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
size = _vr_RUVR_pal_staticSegmentRomEnd - start;
osSyncPrintf("SIZE = %d\n", size);
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1188);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1188);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1189);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1190);
@@ -513,7 +511,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
case SKYBOX_CUTSCENE_MAP:
start = _vr_holy0_staticSegmentRomStart;
size = _vr_holy0_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1196);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1196);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1197);
@@ -521,7 +519,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_holy1_staticSegmentRomStart;
size = _vr_holy1_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1203);
skyboxCtx->staticSegments[1] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1203);
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
1204);
@@ -529,7 +527,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_holy0_pal_staticSegmentRomStart;
size = _vr_holy0_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1211);
skyboxCtx->palettes = GameState_Alloc(&play->state, size * 2, "../z_vr_box.c", 1211);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1212);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214);
@@ -541,7 +539,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LHVR_staticSegmentRomStart;
size = _vr_LHVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1226);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1226);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1227);
@@ -549,7 +547,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LHVR_pal_staticSegmentRomStart;
size = _vr_LHVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1231);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1231);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1232);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1233);
@@ -559,7 +557,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MDVR_staticSegmentRomStart;
size = _vr_MDVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1257);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1257);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1258);
@@ -567,7 +565,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MDVR_pal_staticSegmentRomStart;
size = _vr_MDVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1262);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1262);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1263);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1264);
@@ -577,7 +575,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MNVR_staticSegmentRomStart;
size = _vr_MNVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1271);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1271);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1272);
@@ -587,7 +585,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
size = _vr_MNVR_pal_staticSegmentRomEnd - start;
osSyncPrintf("SIZE = %d\n", size);
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1277);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1277);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1278);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1279);
@@ -597,7 +595,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_FCVR_staticSegmentRomStart;
size = _vr_FCVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1286);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1286);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1287);
@@ -605,7 +603,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_FCVR_pal_staticSegmentRomStart;
size = _vr_FCVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1291);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1291);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1292);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1293);
@@ -616,7 +614,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KHVR_staticSegmentRomStart;
size = _vr_KHVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1301);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1301);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1302);
@@ -624,7 +622,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KHVR_pal_staticSegmentRomStart;
size = _vr_KHVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1306);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1306);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1307);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1308);
@@ -634,7 +632,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K3VR_staticSegmentRomStart;
size = _vr_K3VR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1331);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1331);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1332);
@@ -642,7 +640,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K3VR_pal_staticSegmentRomStart;
size = _vr_K3VR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1336);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1336);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1337);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1338);
@@ -652,7 +650,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MLVR_staticSegmentRomStart;
size = _vr_MLVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1345);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1345);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1346);
@@ -660,7 +658,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MLVR_pal_staticSegmentRomStart;
size = _vr_MLVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1350);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1350);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1351);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1352);
@@ -670,7 +668,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KKRVR_staticSegmentRomStart;
size = _vr_KKRVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1359);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1359);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1360);
@@ -678,7 +676,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KKRVR_pal_staticSegmentRomStart;
size = _vr_KKRVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1364);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1364);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1365);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1366);
@@ -688,7 +686,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KSVR_staticSegmentRomStart;
size = _vr_KSVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1373);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1373);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1374);
@@ -696,7 +694,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KSVR_pal_staticSegmentRomStart;
size = _vr_KSVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1378);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1378);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1379);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1380);
@@ -707,7 +705,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_GLVR_staticSegmentRomStart;
size = _vr_GLVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1405);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1405);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1406);
@@ -715,7 +713,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_GLVR_pal_staticSegmentRomStart;
size = _vr_GLVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1410);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1410);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1411);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1412);
@@ -726,7 +724,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ZRVR_staticSegmentRomStart;
size = _vr_ZRVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1420);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1420);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1421);
@@ -734,7 +732,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ZRVR_pal_staticSegmentRomStart;
size = _vr_ZRVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1425);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1425);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1426);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1427);
@@ -745,7 +743,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_DGVR_staticSegmentRomStart;
size = _vr_DGVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1451);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1451);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1452);
@@ -753,7 +751,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_DGVR_pal_staticSegmentRomStart;
size = _vr_DGVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1456);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1456);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1457);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1458);
@@ -764,7 +762,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ALVR_staticSegmentRomStart;
size = _vr_ALVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1466);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1466);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1467);
@@ -772,7 +770,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ALVR_pal_staticSegmentRomStart;
size = _vr_ALVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1471);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1471);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1472);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1473);
@@ -783,7 +781,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_NSVR_staticSegmentRomStart;
size = _vr_NSVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1481);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1481);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1482);
@@ -791,7 +789,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_NSVR_pal_staticSegmentRomStart;
size = _vr_NSVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1486);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1486);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1487);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1488);
@@ -802,7 +800,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_IPVR_staticSegmentRomStart;
size = _vr_IPVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1512);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1512);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1513);
@@ -810,7 +808,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_IPVR_pal_staticSegmentRomStart;
size = _vr_IPVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1517);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1517);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1518);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1519);
@@ -820,7 +818,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LBVR_staticSegmentRomStart;
size = _vr_LBVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1526);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1526);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1527);
@@ -828,7 +826,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LBVR_pal_staticSegmentRomStart;
size = _vr_LBVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1531);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1531);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1532);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1533);
@@ -838,7 +836,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_TTVR_staticSegmentRomStart;
size = _vr_TTVR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1540);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1540);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1541);
@@ -846,7 +844,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_TTVR_pal_staticSegmentRomStart;
size = _vr_TTVR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1545);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1545);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1546);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1547);
@@ -856,7 +854,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K4VR_staticSegmentRomStart;
size = _vr_K4VR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1560);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1560);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1561);
@@ -864,7 +862,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K4VR_pal_staticSegmentRomStart;
size = _vr_K4VR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1565);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1565);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1566);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1567);
@@ -874,7 +872,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K5VR_staticSegmentRomStart;
size = _vr_K5VR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1574);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1574);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1575);
@@ -882,7 +880,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K5VR_pal_staticSegmentRomStart;
size = _vr_K5VR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1579);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1579);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1580);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1581);
@@ -892,7 +890,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KR3VR_staticSegmentRomStart;
size = _vr_KR3VR_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1588);
skyboxCtx->staticSegments[0] = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1588);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1589);
@@ -900,7 +898,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KR3VR_pal_staticSegmentRomStart;
size = _vr_KR3VR_pal_staticSegmentRomEnd - start;
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1593);
skyboxCtx->palettes = GameState_Alloc(&play->state, size, "../z_vr_box.c", 1593);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1594);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1595);
@@ -911,12 +909,12 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
}
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
GlobalContext* globalCtx = (GlobalContext*)state;
PlayState* play = (PlayState*)state;
skyboxCtx->unk_140 = 0;
skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f;
Skybox_Setup(globalCtx, skyboxCtx, skyboxId);
Skybox_Setup(play, skyboxCtx, skyboxId);
osSyncPrintf("\n\n\n********************\n\n\n"
"TYPE=%d"
"\n\n\n********************\n\n\n",
+33 -33
View File
@@ -3,13 +3,13 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Init(Actor* thisx, PlayState* play);
void ArmsHook_Destroy(Actor* thisx, PlayState* play);
void ArmsHook_Update(Actor* thisx, PlayState* play);
void ArmsHook_Draw(Actor* thisx, PlayState* play);
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx);
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx);
void ArmsHook_Wait(ArmsHook* this, PlayState* play);
void ArmsHook_Shoot(ArmsHook* this, PlayState* play);
const ActorInit Arms_Hook_InitVars = {
ACTOR_ARMS_HOOK,
@@ -62,33 +62,33 @@ void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Init(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
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);
ArmsHook_SetupAction(this, ArmsHook_Wait);
this->unk_1E8 = this->actor.world.pos;
}
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Destroy(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
if (this->grabbed != NULL) {
this->grabbed->flags &= ~ACTOR_FLAG_13;
}
Collider_DestroyQuad(globalCtx, &this->collider);
Collider_DestroyQuad(play, &this->collider);
}
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
void ArmsHook_Wait(ArmsHook* this, PlayState* play) {
if (this->actor.parent == NULL) {
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
// get correct timer length for hookshot or longshot
s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f);
this->actor.parent = &GET_PLAYER(globalCtx)->actor;
this->actor.parent = &GET_PLAYER(play)->actor;
this->timer = length;
}
}
@@ -137,8 +137,8 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff);
}
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Actor* touchedActor;
Actor* grabbed;
Vec3f bodyDistDiffVec;
@@ -257,18 +257,18 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x);
sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y);
sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z);
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true,
true, &bgId) &&
!func_8002F9EC(globalCtx, &this->actor, poly, bgId, &intersectPos)) {
if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true,
&bgId) &&
!func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) {
polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x);
polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z);
Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos);
this->actor.world.pos.x += 10.0f * polyNormalX;
this->actor.world.pos.z += 10.0f * polyNormalZ;
this->timer = 0;
if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) {
if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) {
if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
@@ -277,28 +277,28 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos);
CollisionCheck_SpawnShieldParticlesMetal(play, &this->actor.world.pos);
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_REFLECT, &this->actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
} else if (CHECK_BTN_ANY(globalCtx->state.input[0].press.button,
} else if (CHECK_BTN_ANY(play->state.input[0].press.button,
(BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN))) {
this->timer = 0;
}
}
}
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Update(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
this->unk_1F4 = this->unk_1E8;
}
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Draw(Actor* thisx, PlayState* play) {
s32 pad;
ArmsHook* this = (ArmsHook*)thisx;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
Vec3f sp78;
Vec3f hookNewTip;
Vec3f hookNewBase;
@@ -306,7 +306,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
f32 sp58;
if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850);
OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850);
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
@@ -319,9 +319,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_MultVec3f(&D_80865BAC, &hookNewBase);
}
func_80090480(globalCtx, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895),
func_80090480(play, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arms_hook.c", 895),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
@@ -331,10 +331,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY);
Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY);
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arms_hook.c", 910),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913);
CLOSE_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 913);
}
}
@@ -6,7 +6,7 @@
struct ArmsHook;
typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*);
typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*);
typedef struct ArmsHook {
/* 0x0000 */ Actor actor;
@@ -9,14 +9,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Init(Actor* thisx, PlayState* play);
void ArrowFire_Destroy(Actor* thisx, PlayState* play);
void ArrowFire_Update(Actor* thisx, PlayState* play);
void ArrowFire_Draw(Actor* thisx, PlayState* play);
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Charge(ArrowFire* this, PlayState* play);
void ArrowFire_Fly(ArrowFire* this, PlayState* play);
void ArrowFire_Hit(ArrowFire* this, PlayState* play);
#include "overlays/ovl_Arrow_Fire/ovl_Arrow_Fire.c"
@@ -40,7 +40,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowFire_Init(Actor* thisx, PlayState* play) {
ArrowFire* this = (ArrowFire*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@@ -53,12 +53,12 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_15C = 0.0f;
}
void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowFire_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅", "../z_arrow_fire.c", 421); // "Disappearance"
}
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Charge(ArrowFire* this, PlayState* play) {
EnArrow* arrow;
arrow = (EnArrow*)this->actor.parent;
@@ -91,7 +91,7 @@ void func_80865ECC(Vec3f* unkPos, Vec3f* firePos, f32 scale) {
unkPos->z += ((firePos->z - unkPos->z) * scale);
}
void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Hit(ArrowFire* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@@ -143,7 +143,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) {
}
}
void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Fly(ArrowFire* this, PlayState* play) {
EnArrow* arrow;
f32 distanceScaled;
s32 pad;
@@ -177,25 +177,24 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
}
}
void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowFire_Update(Actor* thisx, PlayState* play) {
ArrowFire* this = (ArrowFire*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
void ArrowFire_Draw(Actor* thisx, PlayState* play2) {
ArrowFire* this = (ArrowFire*)thisx;
GlobalContext* globalCtx = globalCtx2;
PlayState* play = play2;
u32 stateFrames;
EnArrow* arrow;
Actor* transform;
stateFrames = globalCtx->state.frames;
stateFrames = play->state.frames;
arrow = (EnArrow*)this->actor.parent;
if (1) {}
@@ -203,7 +202,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if (1) {}
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618);
OPEN_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 618);
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
@@ -222,7 +221,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
}
// Draw fire on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128);
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
@@ -233,14 +232,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 666),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_fire.c", 666),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1,
255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 682);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 682);
}
}
@@ -6,7 +6,7 @@
struct ArrowFire;
typedef void (*ArrowFireActionFunc)(struct ArrowFire*, GlobalContext*);
typedef void (*ArrowFireActionFunc)(struct ArrowFire*, PlayState*);
typedef struct ArrowFire {
/* 0x0000 */ Actor actor;
+23 -24
View File
@@ -10,14 +10,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Init(Actor* thisx, PlayState* play);
void ArrowIce_Destroy(Actor* thisx, PlayState* play);
void ArrowIce_Update(Actor* thisx, PlayState* play);
void ArrowIce_Draw(Actor* thisx, PlayState* play);
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Charge(ArrowIce* this, PlayState* play);
void ArrowIce_Fly(ArrowIce* this, PlayState* play);
void ArrowIce_Hit(ArrowIce* this, PlayState* play);
#include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c"
@@ -41,7 +41,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Init(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@@ -54,12 +54,12 @@ void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_164 = 0.0f;
}
void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowIce_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅", "../z_arrow_ice.c", 415); // "Disappearance"
}
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Charge(ArrowIce* this, PlayState* play) {
EnArrow* arrow;
arrow = (EnArrow*)this->actor.parent;
@@ -92,7 +92,7 @@ void func_80867E8C(Vec3f* unkPos, Vec3f* icePos, f32 scale) {
unkPos->z += ((icePos->z - unkPos->z) * scale);
}
void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Hit(ArrowIce* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@@ -144,7 +144,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) {
}
}
void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Fly(ArrowIce* this, PlayState* play) {
EnArrow* arrow;
f32 distanceScaled;
s32 pad;
@@ -178,22 +178,21 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
}
}
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Update(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Draw(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
s32 pad;
Actor* transform;
u32 stateFrames = globalCtx->state.frames;
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
if (1) {}
@@ -202,7 +201,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (1) {}
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610);
OPEN_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 610);
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
@@ -221,7 +220,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
// Draw ice on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128);
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
@@ -232,14 +231,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 660),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_ice.c", 660),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 676);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 676);
}
}
@@ -6,7 +6,7 @@
struct ArrowIce;
typedef void (*ArrowIceActionFunc)(struct ArrowIce*, GlobalContext*);
typedef void (*ArrowIceActionFunc)(struct ArrowIce*, PlayState*);
typedef struct ArrowIce {
/* 0x0000 */ Actor actor;
@@ -10,14 +10,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Init(Actor* thisx, PlayState* play);
void ArrowLight_Destroy(Actor* thisx, PlayState* play);
void ArrowLight_Update(Actor* thisx, PlayState* play);
void ArrowLight_Draw(Actor* thisx, PlayState* play);
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Charge(ArrowLight* this, PlayState* play);
void ArrowLight_Fly(ArrowLight* this, PlayState* play);
void ArrowLight_Hit(ArrowLight* this, PlayState* play);
#include "overlays/ovl_Arrow_Light/ovl_Arrow_Light.c"
@@ -41,7 +41,7 @@ void ArrowLight_SetupAction(ArrowLight* this, ArrowLightActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Init(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@@ -54,12 +54,12 @@ void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_164 = 0.0f;
}
void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowLight_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅", "../z_arrow_light.c", 403); // "Disappearance"
}
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Charge(ArrowLight* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
@@ -91,7 +91,7 @@ void func_80869E6C(Vec3f* unkPos, Vec3f* lightPos, f32 scale) {
unkPos->z += ((lightPos->z - unkPos->z) * scale);
}
void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Hit(ArrowLight* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@@ -143,7 +143,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) {
}
}
void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Fly(ArrowLight* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
f32 distanceScaled;
s32 pad;
@@ -176,21 +176,20 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
}
}
void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Update(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK || play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Draw(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
s32 pad;
u32 stateFrames = globalCtx->state.frames;
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Actor* transform;
@@ -200,7 +199,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (1) {}
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 598);
OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598);
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
@@ -219,7 +218,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
// Draw light on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128);
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
@@ -230,14 +229,14 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_light.c", 648),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 664);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664);
}
}
@@ -6,7 +6,7 @@
struct ArrowLight;
typedef void (*ArrowLightActionFunc)(struct ArrowLight*, GlobalContext*);
typedef void (*ArrowLightActionFunc)(struct ArrowLight*, PlayState*);
typedef struct ArrowLight {
/* 0x0000 */ Actor actor;
@@ -9,27 +9,27 @@
#define FLAGS ACTOR_FLAG_4
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Init(Actor* thisx, PlayState* play);
void BgBdanObjects_Destroy(Actor* thisx, PlayState* play);
void BgBdanObjects_Update(Actor* thisx, PlayState* play);
void BgBdanObjects_Draw(Actor* thisx, PlayState* play);
void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx);
void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C054(BgBdanObjects* this, PlayState* play);
void func_8086C1A0(BgBdanObjects* this, PlayState* play);
void func_8086C29C(BgBdanObjects* this, PlayState* play);
void func_8086C55C(BgBdanObjects* this, PlayState* play);
void func_8086C5BC(BgBdanObjects* this, PlayState* play);
void func_8086C618(BgBdanObjects* this, PlayState* play);
void func_8086C6EC(BgBdanObjects* this, PlayState* play);
void func_8086C76C(BgBdanObjects* this, PlayState* play);
void func_8086C7D0(BgBdanObjects* this, PlayState* play);
void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play);
void func_8086C874(BgBdanObjects* this, PlayState* play);
void func_8086C9A8(BgBdanObjects* this, PlayState* play);
void func_8086C9F0(BgBdanObjects* this, PlayState* play);
void func_8086CABC(BgBdanObjects* this, PlayState* play);
void func_8086CB10(BgBdanObjects* this, PlayState* play);
void func_8086CB8C(BgBdanObjects* this, PlayState* play);
const ActorInit Bg_Bdan_Objects_InitVars = {
ACTOR_BG_BDAN_OBJECTS,
@@ -104,7 +104,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) {
}
}
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgBdanObjects* this = (BgBdanObjects*)thisx;
CollisionHeader* colHeader = NULL;
@@ -115,30 +115,30 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->params &= 0xFF;
if (thisx->params == 2) {
thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5;
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y;
play->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y;
this->actionFunc = func_8086C9A8;
return;
}
if (thisx->params == 0) {
CollisionHeader_GetVirtual(&gJabuBigOctoPlatformCol, &colHeader);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
thisx->world.pos.y += -79.0f;
if (Flags_GetClear(globalCtx, thisx->room)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
if (Flags_GetClear(play, thisx->room)) {
Flags_SetSwitch(play, this->switchFlag);
this->actionFunc = func_8086C6EC;
} else {
if (BgBdanObjects_GetContactRu1(this, 4)) {
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA,
thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0,
thisx->shape.rot.y + 0x8000, 0, 3) != NULL) {
if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, thisx->home.pos.x,
thisx->home.pos.y, thisx->home.pos.z, 0, thisx->shape.rot.y + 0x8000, 0,
3) != NULL) {
thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f;
}
thisx->world.rot.y = 0;
this->actionFunc = func_8086C618;
thisx->world.pos.y = thisx->home.pos.y + -70.0f;
} else {
Flags_SetSwitch(globalCtx, this->switchFlag);
Flags_SetSwitch(play, this->switchFlag);
this->timer = 0;
this->actionFunc = func_8086C054;
}
@@ -151,7 +151,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_8086C874;
} else {
CollisionHeader_GetVirtual(&gJabuLoweringPlatformCol, &colHeader);
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (Flags_GetSwitch(play, this->switchFlag)) {
this->actionFunc = BgBdanObjects_DoNothing;
thisx->world.pos.y = thisx->home.pos.y - 400.0f;
} else {
@@ -159,26 +159,26 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
}
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
}
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Destroy(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if (thisx->params == 0) {
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
}
void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8086C054(BgBdanObjects* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (BgBdanObjects_GetContactRu1(this, 0)) {
if (this->dyna.actor.xzDistToPlayer < 250.0f) {
BgBdanObjects_SetContactRu1(this, 1);
this->timer = 20;
OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3070, -99, &this->dyna.actor, CAM_ID_MAIN);
player->actor.world.pos.x = -1130.0f;
player->actor.world.pos.y = -1025.0f;
player->actor.world.pos.z = -3300.0f;
@@ -193,14 +193,14 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
if (!Play_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) {
if (!Play_InCsMode(play) && !BgBdanObjects_GetContactRu1(this, 0)) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f;
} else {
this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y + -79.0f) - 5.0f;
}
}
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C1A0(BgBdanObjects* this, PlayState* play) {
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 500.0f, 0.5f, 7.5f, 1.0f) <
0.1f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
@@ -220,13 +220,13 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C29C(BgBdanObjects* this, PlayState* play) {
s32 temp;
if (this->timer != 0) {
this->timer--;
if (this->timer == 0) {
temp = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1);
temp = Quake_Add(GET_ACTIVE_CAM(play), 1);
Quake_SetSpeed(temp, 0x3A98);
Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
Quake_SetCountdown(temp, 0xA);
@@ -234,18 +234,18 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
}
if (BgBdanObjects_GetContactRu1(this, 3)) {
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA,
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f,
this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0);
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA, this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y + 140.0f, this->dyna.actor.world.pos.z, 0,
this->dyna.actor.shape.rot.y + 0x8000, 0, 0);
BgBdanObjects_SetContactRu1(this, 4);
this->timer = 10;
this->actionFunc = func_8086C55C;
func_8005B1A4(GET_ACTIVE_CAM(globalCtx));
func_8005B1A4(GET_ACTIVE_CAM(play));
}
}
void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8086C3D8(BgBdanObjects* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->dyna.actor.velocity.y += 0.5f;
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f,
@@ -255,7 +255,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f;
this->actionFunc = func_8086C5BC;
OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3080, -99, this->dyna.actor.child, CAM_ID_MAIN);
player->actor.world.pos.x = -1130.0f;
player->actor.world.pos.y = -1025.0f;
player->actor.world.pos.z = -3500.0f;
@@ -277,18 +277,18 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C55C(BgBdanObjects* this, PlayState* play) {
this->timer--;
if (this->timer == 0) {
Flags_UnsetSwitch(globalCtx, this->switchFlag);
Flags_UnsetSwitch(play, this->switchFlag);
} else if (this->timer == -40) {
this->timer = 0;
this->actionFunc = func_8086C3D8;
}
}
void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C5BC(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@@ -301,11 +301,11 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C618(BgBdanObjects* this, PlayState* play) {
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
if (Flags_GetClear(play, this->dyna.actor.room)) {
Flags_SetSwitch(play, this->switchFlag);
this->dyna.actor.home.rot.y = (s16)(this->dyna.actor.shape.rot.y + 0x2000) & 0xC000;
this->actionFunc = func_8086C6EC;
} else {
@@ -314,7 +314,7 @@ void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C6EC(BgBdanObjects* this, PlayState* play) {
s32 cond = Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.home.rot.y, 0x200);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -125.0f, 3.0f)) {
@@ -324,16 +324,16 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C76C(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
if (this->dyna.actor.xzDistToPlayer < 120.0f) {
this->actionFunc = func_8086C7D0;
OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3090, -99, &this->dyna.actor, CAM_ID_MAIN);
}
}
}
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C7D0(BgBdanObjects* this, PlayState* play) {
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 965.0f, 0.5f, 15.0f, 0.2f) <
0.01f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
@@ -343,22 +343,22 @@ void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx) {
void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play) {
}
void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C874(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
if (this->switchFlag == 0) {
if (func_8004356C(&this->dyna)) {
this->cameraSetting = globalCtx->cameraPtrs[CAM_ID_MAIN]->setting;
Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2);
func_8005AD1C(globalCtx->cameraPtrs[CAM_ID_MAIN], 4);
this->cameraSetting = play->cameraPtrs[CAM_ID_MAIN]->setting;
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2);
func_8005AD1C(play->cameraPtrs[CAM_ID_MAIN], 4);
this->switchFlag = 10;
}
} else {
Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2);
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2);
if (!func_8004356C(&this->dyna)) {
if (this->switchFlag != 0) {
this->switchFlag--;
@@ -366,8 +366,8 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
}
if (this->switchFlag == 0) {
if (1) {}
Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], this->cameraSetting);
func_8005ACFC(globalCtx->cameraPtrs[CAM_ID_MAIN], 4);
Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], this->cameraSetting);
func_8005ACFC(play->cameraPtrs[CAM_ID_MAIN], 4);
}
}
this->dyna.actor.world.pos.y =
@@ -377,17 +377,17 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
void func_8086C9A8(BgBdanObjects* this, PlayState* play) {
if (Flags_GetSwitch(play, this->switchFlag)) {
this->timer = 100;
this->actionFunc = func_8086C9F0;
}
}
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C9F0(BgBdanObjects* this, PlayState* play) {
if (this->timer == 0) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) {
Flags_UnsetSwitch(globalCtx, this->switchFlag);
Flags_UnsetSwitch(play, this->switchFlag);
this->actionFunc = func_8086C9A8;
}
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
@@ -397,10 +397,10 @@ void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y;
play->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y;
}
void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CABC(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@@ -410,17 +410,17 @@ void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CB10(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
Flags_SetSwitch(play, this->switchFlag);
this->timer = 50;
this->actionFunc = func_8086CB8C;
this->dyna.actor.home.pos.y -= 200.0f;
OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3100, 51, &this->dyna.actor, CAM_ID_MAIN);
}
}
void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CB8C(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@@ -431,20 +431,20 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->actionFunc = BgBdanObjects_DoNothing;
// Using `CAM_ID_NONE` here defaults to the active camera
Play_CopyCamera(globalCtx, CAM_ID_MAIN, CAM_ID_NONE);
Play_CopyCamera(play, CAM_ID_MAIN, CAM_ID_NONE);
} else {
func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG);
}
}
void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Update(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
Actor_SetFocus(thisx, 50.0f);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Draw(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
if (thisx->params == 0) {
@@ -456,8 +456,8 @@ void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
if (thisx->params == 2) {
Gfx_DrawDListXlu(globalCtx, gJabuWaterDL);
Gfx_DrawDListXlu(play, gJabuWaterDL);
} else {
Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]);
Gfx_DrawDListOpa(play, sDLists[thisx->params]);
}
}
@@ -6,7 +6,7 @@
struct BgBdanObjects;
typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, GlobalContext*);
typedef void (*BgBdanObjectsActionFunc)(struct BgBdanObjects*, PlayState*);
typedef struct BgBdanObjects {
/* 0x0000 */ DynaPolyActor dyna;
@@ -9,38 +9,38 @@
#define FLAGS ACTOR_FLAG_4
void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBdanSwitch_Init(Actor* thisx, PlayState* play);
void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play);
void BgBdanSwitch_Update(Actor* thisx, PlayState* play);
void BgBdanSwitch_Draw(Actor* thisx, PlayState* play);
void func_8086D5C4(BgBdanSwitch* this);
void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D5E0(BgBdanSwitch* this, PlayState* play);
void func_8086D67C(BgBdanSwitch* this);
void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D694(BgBdanSwitch* this, PlayState* play);
void func_8086D730(BgBdanSwitch* this);
void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D754(BgBdanSwitch* this, PlayState* play);
void func_8086D7FC(BgBdanSwitch* this);
void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D80C(BgBdanSwitch* this, PlayState* play);
void func_8086D86C(BgBdanSwitch* this);
void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D888(BgBdanSwitch* this, PlayState* play);
void func_8086D8BC(BgBdanSwitch* this);
void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086D8CC(BgBdanSwitch* this, PlayState* play);
void func_8086D95C(BgBdanSwitch* this, PlayState* play);
void func_8086D9F8(BgBdanSwitch* this);
void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DA1C(BgBdanSwitch* this, PlayState* play);
void func_8086DAB4(BgBdanSwitch* this);
void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DAC4(BgBdanSwitch* this, PlayState* play);
void func_8086DB24(BgBdanSwitch* this);
void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DB40(BgBdanSwitch* this, PlayState* play);
void func_8086DB4C(BgBdanSwitch* this);
void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DB68(BgBdanSwitch* this, PlayState* play);
void func_8086DC30(BgBdanSwitch* this);
void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DC48(BgBdanSwitch* this, PlayState* play);
void func_8086DCCC(BgBdanSwitch* this);
void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DCE8(BgBdanSwitch* this, PlayState* play);
void func_8086DDA8(BgBdanSwitch* this);
void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx);
void func_8086DDC0(BgBdanSwitch* this, PlayState* play);
const ActorInit Bg_Bdan_Switch_InitVars = {
ACTOR_BG_BDAN_SWITCH,
@@ -89,24 +89,24 @@ static InitChainEntry sInitChain[] = {
static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f };
void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, GlobalContext* globalCtx, CollisionHeader* collision, s32 flag) {
void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s16 pad1;
CollisionHeader* colHeader = NULL;
s16 pad2;
DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.bgId == BG_ACTOR_MAX) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325,
this->dyna.actor.id, this->dyna.actor.params);
}
}
void BgBdanSwitch_InitCollision(BgBdanSwitch* this, GlobalContext* globalCtx) {
void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) {
Actor* actor = &this->dyna.actor;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, actor, &sJntSphInit, this->colliderItems);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, actor, &sJntSphInit, this->colliderItems);
}
void func_8086D0EC(BgBdanSwitch* this) {
@@ -133,7 +133,7 @@ void func_8086D0EC(BgBdanSwitch* this) {
this->dyna.actor.shape.yOffset = 1.2f / this->unk_1D0;
}
void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
s32 pad;
s16 type;
@@ -155,17 +155,17 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
case BLUE:
case YELLOW_HEAVY:
case YELLOW:
BgBdanSwitch_InitDynaPoly(this, globalCtx, &gJabuFloorSwitchCol, DPM_PLAYER);
BgBdanSwitch_InitDynaPoly(this, play, &gJabuFloorSwitchCol, DPM_PLAYER);
break;
case YELLOW_TALL_1:
case YELLOW_TALL_2:
BgBdanSwitch_InitCollision(this, globalCtx);
BgBdanSwitch_InitCollision(this, play);
this->dyna.actor.flags |= ACTOR_FLAG_0;
this->dyna.actor.targetMode = 4;
break;
}
flag = Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
flag = Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
switch (type) {
case BLUE:
@@ -200,42 +200,42 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
osSyncPrintf("(巨大魚ダンジョン 専用スイッチ)(arg_data 0x%04x)\n", this->dyna.actor.params);
}
void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) {
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
switch (this->dyna.actor.params & 0xFF) {
case BLUE:
case YELLOW_HEAVY:
case YELLOW:
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
break;
case YELLOW_TALL_1:
case YELLOW_TALL_2:
Collider_DestroyJntSph(globalCtx, &this->collider);
Collider_DestroyJntSph(play, &this->collider);
break;
}
}
void func_8086D4B4(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D4B4(BgBdanSwitch* this, PlayState* play) {
s32 pad;
s32 type;
if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
type = this->dyna.actor.params & 0xFF;
Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
if (type == BLUE || type == YELLOW_TALL_2) {
OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
} else {
OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME);
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME);
}
}
}
void func_8086D548(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
Flags_UnsetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
void func_8086D548(BgBdanSwitch* this, PlayState* play) {
if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
if ((this->dyna.actor.params & 0xFF) == YELLOW_TALL_2) {
OnePointCutscene_AttentionSetSfx(globalCtx, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
}
}
}
@@ -245,18 +245,18 @@ void func_8086D5C4(BgBdanSwitch* this) {
this->unk_1C8 = 1.0f;
}
void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D5E0(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
case BLUE:
if (func_800435B4(&this->dyna)) {
func_8086D67C(this);
func_8086D4B4(this, globalCtx);
func_8086D4B4(this, play);
}
break;
case YELLOW:
if (func_8004356C(&this->dyna)) {
func_8086D67C(this);
func_8086D4B4(this, globalCtx);
func_8086D4B4(this, play);
}
break;
}
@@ -267,7 +267,7 @@ void func_8086D67C(BgBdanSwitch* this) {
this->unk_1DA = 0x64;
}
void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D694(BgBdanSwitch* this, PlayState* play) {
if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) {
this->unk_1C8 -= 0.2f;
if (this->unk_1C8 <= 0.1f) {
@@ -284,20 +284,20 @@ void func_8086D730(BgBdanSwitch* this) {
this->unk_1D8 = 6;
}
void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D754(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
case BLUE:
if (!func_800435B4(&this->dyna)) {
if (this->unk_1D8 <= 0) {
func_8086D7FC(this);
func_8086D548(this, globalCtx);
func_8086D548(this, play);
}
} else {
this->unk_1D8 = 6;
}
break;
case YELLOW:
if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
func_8086D7FC(this);
}
break;
@@ -308,7 +308,7 @@ void func_8086D7FC(BgBdanSwitch* this) {
this->actionFunc = func_8086D80C;
}
void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D80C(BgBdanSwitch* this, PlayState* play) {
this->unk_1C8 += 0.2f;
if (this->unk_1C8 >= 1.0f) {
func_8086D5C4(this);
@@ -321,7 +321,7 @@ void func_8086D86C(BgBdanSwitch* this) {
this->unk_1C8 = 1.0f;
}
void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D888(BgBdanSwitch* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
func_8086D8BC(this);
}
@@ -331,7 +331,7 @@ void func_8086D8BC(BgBdanSwitch* this) {
this->actionFunc = func_8086D8CC;
}
void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D8CC(BgBdanSwitch* this, PlayState* play) {
this->unk_1C8 -= 0.2f;
if (this->unk_1C8 <= 0.6f) {
func_8086D9F8(this);
@@ -345,7 +345,7 @@ void func_8086D944(BgBdanSwitch* this) {
this->unk_1DA = 0x64;
}
void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086D95C(BgBdanSwitch* this, PlayState* play) {
if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) {
this->unk_1C8 -= 0.2f;
if (this->unk_1C8 <= 0.1f) {
@@ -362,14 +362,14 @@ void func_8086D9F8(BgBdanSwitch* this) {
this->unk_1D8 = 6;
}
void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) {
Actor* heldActor = GET_PLAYER(globalCtx)->heldActor;
void func_8086DA1C(BgBdanSwitch* this, PlayState* play) {
Actor* heldActor = GET_PLAYER(play)->heldActor;
if (func_8004356C(&this->dyna)) {
if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) {
if (this->unk_1D8 <= 0) {
func_8086D944(this);
func_8086D4B4(this, globalCtx);
func_8086D4B4(this, play);
}
} else {
this->unk_1D8 = 6;
@@ -385,7 +385,7 @@ void func_8086DAB4(BgBdanSwitch* this) {
this->actionFunc = func_8086DAC4;
}
void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DAC4(BgBdanSwitch* this, PlayState* play) {
this->unk_1C8 += 0.2f;
if (this->unk_1C8 >= 1.0f) {
func_8086D86C(this);
@@ -398,7 +398,7 @@ void func_8086DB24(BgBdanSwitch* this) {
this->actionFunc = func_8086DB40;
}
void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DB40(BgBdanSwitch* this, PlayState* play) {
}
void func_8086DB4C(BgBdanSwitch* this) {
@@ -406,7 +406,7 @@ void func_8086DB4C(BgBdanSwitch* this) {
this->unk_1C8 = 2.0f;
}
void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DB68(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
default:
return;
@@ -414,14 +414,14 @@ void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (((this->collider.base.acFlags & AC_HIT) != 0) && this->unk_1D8 <= 0) {
this->unk_1D8 = 0xA;
func_8086DC30(this);
func_8086D4B4(this, globalCtx);
func_8086D4B4(this, play);
}
break;
case YELLOW_TALL_2:
if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) {
this->unk_1D8 = 0xA;
func_8086DC30(this);
func_8086D4B4(this, globalCtx);
func_8086D4B4(this, play);
}
break;
}
@@ -432,7 +432,7 @@ void func_8086DC30(BgBdanSwitch* this) {
this->unk_1DA = 0x64;
}
void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DC48(BgBdanSwitch* this, PlayState* play) {
if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) {
this->unk_1C8 -= 0.3f;
if (this->unk_1C8 <= 1.0f) {
@@ -447,10 +447,10 @@ void func_8086DCCC(BgBdanSwitch* this) {
this->unk_1C8 = 1.0f;
}
void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DCE8(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
case YELLOW_TALL_1:
if (!Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) {
func_8086DDA8(this);
}
break;
@@ -458,7 +458,7 @@ void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) {
this->unk_1D8 = 0xA;
func_8086DDA8(this);
func_8086D548(this, globalCtx);
func_8086D548(this, play);
}
break;
}
@@ -469,7 +469,7 @@ void func_8086DDA8(BgBdanSwitch* this) {
this->unk_1DA = 0x64;
}
void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) {
void func_8086DDC0(BgBdanSwitch* this, PlayState* play) {
if ((((this->dyna.actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->dyna.actor.category)) ||
(this->unk_1DA <= 0)) {
this->unk_1C8 += 0.3f;
@@ -480,7 +480,7 @@ void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) {
}
}
void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanSwitch_Update(Actor* thisx, PlayState* play) {
s32 pad;
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
s32 type;
@@ -488,47 +488,47 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->unk_1DA > 0) {
this->unk_1DA--;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
func_8086D0EC(this);
type = this->dyna.actor.params & 0xFF;
if (type != 3 && type != 4) {
this->unk_1D8--;
} else {
if (!Player_InCsMode(globalCtx) && this->unk_1D8 > 0) {
if (!Player_InCsMode(play) && this->unk_1D8 > 0) {
this->unk_1D8--;
}
this->unk_1DC = this->collider.base.acFlags;
this->collider.base.acFlags &= ~AC_HIT;
this->collider.elements[0].dim.modelSphere.radius = this->unk_1D4 * 370.0f;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
}
void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, Gfx* dlist) {
void func_8086DF58(BgBdanSwitch* this, PlayState* play, Gfx* dlist) {
Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0),
this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY);
Gfx_DrawDListOpa(globalCtx, dlist);
Gfx_DrawDListOpa(play, dlist);
}
void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanSwitch_Draw(Actor* thisx, PlayState* play) {
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
switch (this->dyna.actor.params & 0xFF) {
case YELLOW_HEAVY:
case YELLOW:
func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL);
func_8086DF58(this, play, gJabuYellowFloorSwitchDL);
break;
case YELLOW_TALL_1:
case YELLOW_TALL_2:
func_8086DF58(this, globalCtx, gJabuYellowFloorSwitchDL);
func_8086DF58(this, play, gJabuYellowFloorSwitchDL);
Collider_UpdateSpheres(0, &this->collider);
Matrix_MultVec3f(&D_8086E0E0, &this->dyna.actor.focus.pos);
break;
case BLUE:
func_8086DF58(this, globalCtx, gJabuBlueFloorSwitchDL);
func_8086DF58(this, play, gJabuBlueFloorSwitchDL);
break;
}
}
@@ -15,7 +15,7 @@ typedef enum {
struct BgBdanSwitch;
typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, GlobalContext*);
typedef void (*BgBdanSwitchActionFunc)(struct BgBdanSwitch*, PlayState*);
typedef struct BgBdanSwitch {
/* 0x0000 */ DynaPolyActor dyna;
@@ -11,11 +11,11 @@
#define FLAGS ACTOR_FLAG_4
void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBomGuard_Init(Actor* thisx, PlayState* play);
void BgBomGuard_Destroy(Actor* thisx, PlayState* play);
void BgBomGuard_Update(Actor* thisx, PlayState* play);
void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx);
void func_8086E638(BgBomGuard* this, PlayState* play);
const ActorInit Bg_Bom_Guard_InitVars = {
ACTOR_BG_BOM_GUARD,
@@ -33,14 +33,14 @@ void BgBomGuard_SetupAction(BgBomGuard* this, BgBomGuardActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBomGuard_Init(Actor* thisx, PlayState* play) {
BgBomGuard* this = (BgBomGuard*)thisx;
s32 pad[2];
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
osSyncPrintf("\n\n");
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n" VT_RST);
@@ -52,22 +52,22 @@ void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) {
BgBomGuard_SetupAction(this, func_8086E638);
}
void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBomGuard_Destroy(Actor* thisx, PlayState* play) {
BgBomGuard* this = (BgBomGuard*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) {
Actor* it = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head;
void func_8086E638(BgBomGuard* this, PlayState* play) {
Actor* it = play->actorCtx.actorLists[ACTORCAT_NPC].head;
Actor* thisx = &this->dyna.actor;
this->unk_168 = 0;
while (it != 0) {
if (it->id == ACTOR_EN_BOM_BOWL_MAN) {
if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(globalCtx->view.eye.x) > -20.0f) &&
(fabsf(globalCtx->view.eye.y) > 110.0f)) {
if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(play->view.eye.x) > -20.0f) &&
(fabsf(play->view.eye.y) > 110.0f)) {
this->unk_168 = 1;
}
break;
@@ -82,8 +82,8 @@ void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) {
}
}
void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBomGuard_Update(Actor* thisx, PlayState* play) {
BgBomGuard* this = (BgBomGuard*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
@@ -6,7 +6,7 @@
struct BgBomGuard;
typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, GlobalContext*);
typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, PlayState*);
typedef struct BgBomGuard {
/* 0x0000 */ DynaPolyActor dyna;
@@ -9,16 +9,16 @@
#define FLAGS ACTOR_FLAG_22
void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBombwall_Init(Actor* thisx, PlayState* play);
void BgBombwall_Destroy(Actor* thisx, PlayState* play);
void BgBombwall_Update(Actor* thisx, PlayState* play);
void BgBombwall_Draw(Actor* thisx, PlayState* play);
void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx);
void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx);
void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx);
void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx);
void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx);
void func_8086ED50(BgBombwall* this, PlayState* play);
void func_8086ED70(BgBombwall* this, PlayState* play);
void func_8086EDFC(BgBombwall* this, PlayState* play);
void func_8086EE40(BgBombwall* this, PlayState* play);
void func_8086EE94(BgBombwall* this, PlayState* play);
static ColliderTrisElementInit sTrisElementsInit[3] = {
{
@@ -81,14 +81,14 @@ const ActorInit Bg_Bombwall_InitVars = {
(ActorFunc)BgBombwall_Draw,
};
void BgBombwall_InitDynapoly(BgBombwall* this, GlobalContext* globalCtx) {
void BgBombwall_InitDynapoly(BgBombwall* this, PlayState* play) {
s32 pad;
s32 pad2;
CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&gBgBombwallCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.bgId == BG_ACTOR_MAX) {
// "Warning : move BG login failed"
@@ -109,7 +109,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
};
void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBombwall_Init(Actor* thisx, PlayState* play) {
s32 i;
s32 j;
Vec3f vecs[3];
@@ -122,13 +122,13 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
Actor_SetScale(&this->dyna.actor, 0.1f);
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
func_8086EE94(this, globalCtx);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
func_8086EE94(this, play);
} else {
BgBombwall_InitDynapoly(this, globalCtx);
BgBombwall_InitDynapoly(this, play);
this->unk_2A2 |= 2;
Collider_InitTris(globalCtx, &this->collider);
Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems);
Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems);
for (i = 0; i <= 2; i++) {
for (j = 0; j <= 2; j++) {
@@ -146,36 +146,36 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) {
}
this->unk_2A2 |= 1;
func_8086ED50(this, globalCtx);
func_8086ED50(this, play);
}
osSyncPrintf("(field keep 汎用爆弾壁)(arg_data 0x%04x)(angY %d)\n", this->dyna.actor.params,
this->dyna.actor.shape.rot.y);
}
void BgBombwall_DestroyCollision(BgBombwall* this, GlobalContext* globalCtx) {
void BgBombwall_DestroyCollision(BgBombwall* this, PlayState* play) {
if (this->unk_2A2 & 2) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
this->unk_2A2 &= ~2;
}
if (this->unk_2A2 & 1) {
Collider_DestroyTris(globalCtx, &this->collider);
Collider_DestroyTris(play, &this->collider);
this->unk_2A2 &= ~1;
}
}
void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBombwall_Destroy(Actor* thisx, PlayState* play) {
BgBombwall* this = (BgBombwall*)thisx;
BgBombwall_DestroyCollision(this, globalCtx);
BgBombwall_DestroyCollision(this, play);
}
static Vec3s D_8086F010[] = {
{ 40, 85, 21 }, { -43, 107, 14 }, { -1, 142, 14 }, { -27, 44, 27 }, { 28, 24, 20 }, { -39, 54, 21 }, { 49, 50, 20 },
};
void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086EB5C(BgBombwall* this, PlayState* play) {
s16 rand;
s16 rand2;
Vec3f sp88;
@@ -194,43 +194,43 @@ void func_8086EB5C(BgBombwall* this, GlobalContext* globalCtx) {
sp88.z = ((D_8086F010[i].z * cos) - (sin * D_8086F010[i].x)) + pos->z;
rand = ((s16)(Rand_ZeroOne() * 120.0f)) + 0x14;
rand2 = ((s16)(Rand_ZeroOne() * 240.0f)) + 0x14;
func_80033480(globalCtx, &sp88, 50.0f, 2, rand, rand2, 1);
func_80033480(play, &sp88, 50.0f, 2, rand, rand2, 1);
}
sp88.x = pos->x;
new_var = pos->y + 90.0f;
sp88.y = pos->y + 90.0f;
sp88.z = pos->z + 15.0f;
func_80033480(globalCtx, &sp88, 40.0f, 4, 0xA, 0x32, 1);
func_80033480(play, &sp88, 40.0f, 4, 0xA, 0x32, 1);
}
void func_8086ED50(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086ED50(BgBombwall* this, PlayState* play) {
this->dList = gBgBombwallNormalDL;
this->actionFunc = func_8086ED70;
}
void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086ED70(BgBombwall* this, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
func_8086EDFC(this, globalCtx);
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
func_8086EDFC(this, play);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
} else if (this->dyna.actor.xzDistToPlayer < 600.0f) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
}
void func_8086EDFC(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086EDFC(BgBombwall* this, PlayState* play) {
this->dList = gBgBombwallNormalDL;
this->unk_2A0 = 1;
func_8086EB5C(this, globalCtx);
func_8086EB5C(this, play);
this->actionFunc = func_8086EE40;
}
void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086EE40(BgBombwall* this, PlayState* play) {
if (this->unk_2A0 > 0) {
this->unk_2A0--;
} else {
func_8086EE94(this, globalCtx);
func_8086EE94(this, play);
if (((this->dyna.actor.params >> 0xF) & 1) != 0) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
@@ -238,22 +238,22 @@ void func_8086EE40(BgBombwall* this, GlobalContext* globalCtx) {
}
}
void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx) {
void func_8086EE94(BgBombwall* this, PlayState* play) {
this->dList = gBgBombwallBrokenDL;
BgBombwall_DestroyCollision(this, globalCtx);
BgBombwall_DestroyCollision(this, play);
this->actionFunc = NULL;
}
void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBombwall_Update(Actor* thisx, PlayState* play) {
BgBombwall* this = (BgBombwall*)thisx;
if (this->actionFunc != NULL) {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgBombwall_Draw(Actor* thisx, PlayState* play) {
BgBombwall* this = (BgBombwall*)thisx;
Gfx_DrawDListOpa(globalCtx, this->dList);
Gfx_DrawDListOpa(play, this->dList);
}
@@ -6,7 +6,7 @@
struct BgBombwall;
typedef void (*BgBombwallActionFunc)(struct BgBombwall*, GlobalContext*);
typedef void (*BgBombwallActionFunc)(struct BgBombwall*, PlayState*);
typedef struct BgBombwall {
/* 0x0000 */ DynaPolyActor dyna;
@@ -12,16 +12,16 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBowlWall_Init(Actor* thisx, PlayState* play);
void BgBowlWall_Destroy(Actor* thisx, PlayState* play);
void BgBowlWall_Update(Actor* thisx, PlayState* play);
void BgBowlWall_Draw(Actor* thisx, PlayState* play);
void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx);
void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx);
void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx);
void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx);
void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx);
void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play);
void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play);
void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play);
void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play);
void BgBowlWall_Reset(BgBowlWall* this, PlayState* play);
const ActorInit Bg_Bowl_Wall_InitVars = {
ACTOR_BG_BOWL_WALL,
@@ -44,7 +44,7 @@ static Vec3f sBullseyeOffset[] = {
static s16 sTargetRot[] = { 0x0000, 0x0000, 0x3FFF, -0x3FFF };
void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBowlWall_Init(Actor* thisx, PlayState* play) {
BgBowlWall* this = (BgBowlWall*)thisx;
s32 pad1;
s32 pad2;
@@ -58,7 +58,7 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) {
CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &colHeader);
}
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->initPos = this->dyna.actor.world.pos;
osSyncPrintf("\n\n");
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n" VT_RST, this->dyna.actor.params);
@@ -66,13 +66,13 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) {
this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f;
}
void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBowlWall_Destroy(Actor* thisx, PlayState* play) {
BgBowlWall* this = (BgBowlWall*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) {
void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play) {
s32 pad;
EnWallTubo* bullseye;
Actor* lookForGirl;
@@ -88,7 +88,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) {
this->bullseyeCenter.y = sBullseyeOffset[type].y + this->dyna.actor.world.pos.y;
this->bullseyeCenter.z = sBullseyeOffset[type].z + this->dyna.actor.world.pos.z;
if (1) {}
bullseye = (EnWallTubo*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_WALL_TUBO,
bullseye = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO,
this->bullseyeCenter.x, this->bullseyeCenter.y, this->bullseyeCenter.z,
0, 0, 0, this->dyna.actor.params);
if (bullseye != NULL) {
@@ -97,7 +97,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) {
bullseye->explosionCenter = this->bullseyeCenter = this->dyna.actor.world.pos;
}
if (this->chuGirl == NULL) {
lookForGirl = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].head;
lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head;
while (lookForGirl != NULL) {
if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) {
lookForGirl = lookForGirl->next;
@@ -111,13 +111,13 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) {
}
}
void BgBowlWall_WaitForHit(BgBowlWall* this, GlobalContext* globalCtx) {
void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play) {
if (this->isHit) {
this->actionFunc = BgBowlWall_FallDoEffects;
}
}
void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play) {
s16 pad;
Vec3f effectAccel = { 0.0f, 0.1f, 0.0f };
Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f };
@@ -146,12 +146,12 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
effectPos.x = Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x;
effectPos.y = -100.0f;
effectPos.z = Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z;
EffectSsBomb2_SpawnLayered(globalCtx, &effectPos, &effectVelocity, &effectAccel, 100, 30);
EffectSsBomb2_SpawnLayered(play, &effectPos, &effectVelocity, &effectAccel, 100, 30);
effectPos.y = -50.0f;
EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL);
EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION);
}
quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 30);
@@ -160,7 +160,7 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
}
}
void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) {
void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play) {
if (this->timer >= 2) {
if (this->dyna.actor.params == 0) {
Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0);
@@ -175,7 +175,7 @@ void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) {
}
}
void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) {
void BgBowlWall_Reset(BgBowlWall* this, PlayState* play) {
if (this->chuGirl->wallStatus[this->dyna.actor.params] != 2) {
Math_ApproachF(&this->dyna.actor.world.pos.y, this->initPos.y, 0.3f, 50.0f);
if (fabsf(this->dyna.actor.world.pos.y - this->initPos.y) <= 10.0f) {
@@ -186,28 +186,27 @@ void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) {
}
}
void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBowlWall_Update(Actor* thisx, PlayState* play) {
BgBowlWall* this = (BgBowlWall*)thisx;
if (this->timer != 0) {
this->timer--;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
void BgBowlWall_Draw(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
BgBowlWall* this = (BgBowlWall*)thisx;
u32 frames;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 441);
OPEN_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 441);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x8,
Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -2 * (frames = globalCtx->state.frames), 16, 16));
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x8, Gfx_TexScroll(play->state.gfxCtx, 0, -2 * (frames = play->state.frames), 16, 16));
gDPPipeSync(POLY_OPA_DISP++);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 453),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_bowl_wall.c", 453),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->dyna.actor.params == 0) {
@@ -216,5 +215,5 @@ void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) {
gSPDisplayList(POLY_OPA_DISP++, gBowlingRound2WallDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 464);
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 464);
}
@@ -7,7 +7,7 @@
struct BgBowlWall;
typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, GlobalContext*);
typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, PlayState*);
typedef struct BgBowlWall {
/* 0x0000 */ DynaPolyActor dyna;
@@ -17,14 +17,14 @@ typedef struct {
/* 0x08 */ s8 colType;
} BombableWallInfo;
void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBreakwall_Init(Actor* thisx, PlayState* play);
void BgBreakwall_Destroy(Actor* thisx, PlayState* play);
void BgBreakwall_Update(Actor* thisx, PlayState* play);
void BgBreakwall_Draw(Actor* thisx, PlayState* play);
void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx);
void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx);
void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx);
void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play);
void BgBreakwall_Wait(BgBreakwall* this, PlayState* play);
void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play);
const ActorInit Bg_Breakwall_InitVars = {
ACTOR_BG_BREAKWALL,
@@ -76,7 +76,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc
this->actionFunc = actionFunc;
}
void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBreakwall_Init(Actor* thisx, PlayState* play) {
BgBreakwall* this = (BgBreakwall*)thisx;
s32 pad;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
@@ -91,20 +91,20 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->bombableWallDList != NULL) {
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
Actor_Kill(&this->dyna.actor);
return;
}
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
Collider_InitQuad(globalCtx, &this->collider);
Collider_SetQuad(globalCtx, &this->collider, &this->dyna.actor, &sQuadInit);
Collider_InitQuad(play, &this->collider);
Collider_SetQuad(play, &this->collider, &this->dyna.actor, &sQuadInit);
} else {
this->dyna.actor.world.pos.y -= 40.0f;
}
this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&globalCtx->objectCtx, OBJECT_KINGDODONGO)
: Object_GetIndex(&globalCtx->objectCtx, OBJECT_BWALL);
this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO)
: Object_GetIndex(&play->objectCtx, OBJECT_BWALL);
if (this->bankIndex < 0) {
Actor_Kill(&this->dyna.actor);
@@ -113,18 +113,18 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBreakwall_Destroy(Actor* thisx, PlayState* play) {
BgBreakwall* this = (BgBreakwall*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
/**
* Spawns fragments using ACTOR_EN_A_OBJ whenever the wall or floor is exploded.
* Returns the last spawned actor
*/
Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY,
f32 scaleX, s32 count, f32 accel) {
Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos, f32 velocity, f32 scaleY, f32 scaleX,
s32 count, f32 accel) {
Actor* actor;
Vec3f actorPos;
s32 k;
@@ -171,13 +171,12 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V
for (j = 3; j >= 0; j--) {
for (k = 3; k >= 0; k--) {
Matrix_MultVec3f(&actorPosList[j][k], &actorPos);
actor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x,
Rand_CenteredFloat(20.0f) + actorPos.y, Rand_CenteredFloat(20.0f) + actorPos.z,
actorRotList[k].x, actorRotList[k].y + angle1, actorRotList[k].z, 0x000B);
actor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_A_OBJ, Rand_CenteredFloat(20.0f) + actorPos.x,
Rand_CenteredFloat(20.0f) + actorPos.y, Rand_CenteredFloat(20.0f) + actorPos.z,
actorRotList[k].x, actorRotList[k].y + angle1, actorRotList[k].z, 0x000B);
if ((j & 1) == 0) {
func_80033480(globalCtx, &actorPos, velocity * 200.0f, 1, 650, 150, 1);
func_80033480(play, &actorPos, velocity * 200.0f, 1, 650, 150, 1);
}
if (actor != NULL) {
@@ -201,17 +200,17 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V
/**
* Sets up the collision model as well is the object dependency and action function to use.
*/
void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) {
if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) {
void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) {
CollisionHeader* colHeader = NULL;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
this->dyna.actor.objBankIndex = this->bankIndex;
Actor_SetObjectDependency(globalCtx, &this->dyna.actor);
Actor_SetObjectDependency(play, &this->dyna.actor);
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
this->dyna.actor.draw = BgBreakwall_Draw;
CollisionHeader_GetVirtual(sBombableWallInfo[wallType].colHeader, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (wallType == BWALL_KD_LAVA_COVER) {
BgBreakwall_SetupAction(this, BgBreakwall_LavaCoverMove);
@@ -225,12 +224,12 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) {
* Checks for an explosion using quad collision. If the wall or floor is exploded then it will spawn fragments and
* despawn itself.
*/
void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) {
void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) {
if (this->collider.base.acFlags & 2) {
Vec3f effectPos;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
effectPos.y = effectPos.z = effectPos.x = 0.0f;
if (this->dyna.actor.world.rot.x == 0) {
@@ -240,8 +239,8 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) {
effectPos.y = -10.0f;
}
BgBreakwall_SpawnFragments(globalCtx, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f);
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
BgBreakwall_SpawnFragments(play, this, &effectPos, 0.0f, 6.4f, 5.0f, 1, 2.0f);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
if (wallType == BWALL_KD_FLOOR) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_EXPLOSION);
@@ -251,11 +250,11 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) {
if ((wallType == BWALL_DC_ENTRANCE) && !Flags_GetEventChkInf(EVENTCHKINF_B0)) {
Flags_SetEventChkInf(EVENTCHKINF_B0);
Cutscene_SetSegment(globalCtx, gDcOpeningCs);
Cutscene_SetSegment(play, gDcOpeningCs);
gSaveContext.cutsceneTrigger = 1;
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
func_8002DF54(globalCtx, NULL, 0x31);
func_8002DF54(play, NULL, 0x31);
}
if (this->dyna.actor.params < 0) {
@@ -271,14 +270,14 @@ void BgBreakwall_Wait(BgBreakwall* this, GlobalContext* globalCtx) {
* Moves the actor's y position to cover the lava floor in King Dodongo's lair after he is defeated so the player is no
* longer hurt by the lava.
*/
void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx) {
void BgBreakwall_LavaCoverMove(BgBreakwall* this, PlayState* play) {
Math_StepToF(&this->dyna.actor.world.pos.y, KREG(80) + this->dyna.actor.home.pos.y, 1.0f);
}
void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBreakwall_Update(Actor* thisx, PlayState* play) {
BgBreakwall* this = (BgBreakwall*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
/**
@@ -290,15 +289,15 @@ static Vec3f sColQuadList[][4] = {
{ { 10.0f, 0.0f, 10.0f }, { -10.0f, 0.0f, 10.0f }, { 10.0f, 0.0f, -10.0f }, { -10.0f, 0.0f, -10.0f } },
};
void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgBreakwall_Draw(Actor* thisx, PlayState* play) {
s32 pad;
BgBreakwall* this = (BgBreakwall*)thisx;
if (this->bombableWallDList != NULL) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 767);
OPEN_DISPS(play->state.gfxCtx, "../z_bg_breakwall.c", 767);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 771),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_breakwall.c", 771),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, this->bombableWallDList);
@@ -313,9 +312,9 @@ void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
Collider_SetQuadVertices(&this->collider, &colQuad[0], &colQuad[1], &colQuad[2], &colQuad[3]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 822);
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_breakwall.c", 822);
}
}
@@ -6,7 +6,7 @@
struct BgBreakwall;
typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, GlobalContext*);
typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, PlayState*);
typedef struct BgBreakwall {
/* 0x0000 */ DynaPolyActor dyna;
@@ -9,13 +9,13 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx);
void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx);
void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgDdanJd_Init(Actor* thisx, PlayState* play);
void BgDdanJd_Destroy(Actor* thisx, PlayState* play);
void BgDdanJd_Update(Actor* thisx, PlayState* play);
void BgDdanJd_Draw(Actor* thisx, PlayState* play);
void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx);
void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx);
void BgDdanJd_Idle(BgDdanJd* this, PlayState* play);
void BgDdanJd_Move(BgDdanJd* this, PlayState* play);
const ActorInit Bg_Ddan_Jd_InitVars = {
ACTOR_BG_DDAN_JD,
@@ -50,7 +50,7 @@ typedef enum {
#define DEFAULT_Y_SPEED 1
#define SHORTCUT_Y_SPEED 5
void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanJd_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgDdanJd* this = (BgDdanJd*)thisx;
CollisionHeader* colHeader = NULL;
@@ -58,14 +58,14 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->idleTimer = IDLE_FRAMES;
this->state = STATE_GO_BOTTOM;
// Missing check for actor.params < 0x40. This will cause inconsistent behavior if params >= 0x40 and the bound
// switch state is turned on while in the same room, as the shortcut behavior won't become enabled until the actor
// is reloaded.
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
if (Flags_GetSwitch(play, this->dyna.actor.params)) {
this->ySpeed = SHORTCUT_Y_SPEED;
} else {
this->ySpeed = DEFAULT_Y_SPEED;
@@ -73,25 +73,25 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = BgDdanJd_Idle;
}
void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanJd_Destroy(Actor* thisx, PlayState* play) {
BgDdanJd* this = (BgDdanJd*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) {
void BgDdanJd_Idle(BgDdanJd* this, PlayState* play) {
if (this->idleTimer != 0) {
this->idleTimer--;
}
// if this is the platform that rises all the way to the top, and the switch state has just changed to on
if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 &&
Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
Flags_GetSwitch(play, this->dyna.actor.params)) {
this->ySpeed = SHORTCUT_Y_SPEED;
this->state = STATE_GO_MIDDLE_FROM_BOTTOM;
this->idleTimer = 0;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE;
OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, CAM_ID_MAIN);
}
if (this->idleTimer == 0) {
this->idleTimer = IDLE_FRAMES;
@@ -125,25 +125,25 @@ void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) {
}
// Handles dust particles and sfx when moving
void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) {
void BgDdanJd_MoveEffects(BgDdanJd* this, PlayState* play) {
Vec3f dustPos;
// Generate random dust particles at the platform's base.
dustPos.y = this->dyna.actor.home.pos.y;
if (globalCtx->gameplayFrames & 1) {
if (play->gameplayFrames & 1) {
dustPos.x = this->dyna.actor.world.pos.x + 65.0f;
dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z;
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1);
dustPos.x = this->dyna.actor.world.pos.x - 65.0f;
dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.z;
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1);
} else {
dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x;
dustPos.z = this->dyna.actor.world.pos.z + 65.0f;
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1);
dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.world.pos.x;
dustPos.z = this->dyna.actor.world.pos.z - 65.0f;
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
func_80033480(play, &dustPos, 5.0f, 1, 20, 60, 1);
}
if (this->ySpeed == SHORTCUT_Y_SPEED) {
func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
@@ -151,29 +151,29 @@ void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) {
}
// Implements the platform's movement state
void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) {
void BgDdanJd_Move(BgDdanJd* this, PlayState* play) {
// if this is the platform that rises all the way to the top, and the switch state has just changed to on
if (this->ySpeed == DEFAULT_Y_SPEED && this->dyna.actor.params < 0x40 &&
Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
Flags_GetSwitch(play, this->dyna.actor.params)) {
this->ySpeed = SHORTCUT_Y_SPEED;
this->state = STATE_GO_MIDDLE_FROM_BOTTOM;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE;
this->idleTimer = 0;
this->actionFunc = BgDdanJd_Idle;
OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3060, -99, &this->dyna.actor, CAM_ID_MAIN);
} else if (Math_StepToF(&this->dyna.actor.world.pos.y, this->targetY, this->ySpeed)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_PILLAR_MOVE_STOP);
this->actionFunc = BgDdanJd_Idle;
}
BgDdanJd_MoveEffects(this, globalCtx);
BgDdanJd_MoveEffects(this, play);
}
void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanJd_Update(Actor* thisx, PlayState* play) {
BgDdanJd* this = (BgDdanJd*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgDdanJd_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, gDodongoRisingPlatformDL);
void BgDdanJd_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, gDodongoRisingPlatformDL);
}
@@ -6,7 +6,7 @@
struct BgDdanJd;
typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, GlobalContext*);
typedef void (*BgDdanJdActionFunc)(struct BgDdanJd*, PlayState*);
typedef struct BgDdanJd {
/* 0x0000 */ DynaPolyActor dyna;
@@ -9,14 +9,14 @@
#define FLAGS ACTOR_FLAG_4
void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx);
void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx);
void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgDdanKd_Init(Actor* thisx, PlayState* play);
void BgDdanKd_Destroy(Actor* thisx, PlayState* play);
void BgDdanKd_Update(Actor* thisx, PlayState* play);
void BgDdanKd_Draw(Actor* thisx, PlayState* play);
void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx);
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx);
void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx);
void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play);
void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play);
void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play);
const ActorInit Bg_Ddan_Kd_InitVars = {
ACTOR_BG_DDAN_KD,
@@ -61,7 +61,7 @@ void BgDdanKd_SetupAction(BgDdanKd* this, BgDdanKdActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanKd_Init(Actor* thisx, PlayState* play) {
BgDdanKd* this = (BgDdanKd*)thisx;
s32 pad;
CollisionHeader* colHeader = NULL;
@@ -70,13 +70,13 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
CollisionHeader_GetVirtual(&gDodongoFallingStairsCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
if (!Flags_GetSwitch(play, this->dyna.actor.params)) {
BgDdanKd_SetupAction(this, BgDdanKd_CheckForExplosions);
} else {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 200.0f - 20.0f;
@@ -84,17 +84,17 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanKd_Destroy(Actor* thisx, PlayState* play) {
BgDdanKd* this = (BgDdanKd*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->collider);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->collider);
}
void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) {
Actor* explosive;
explosive = Actor_GetCollidedExplosive(globalCtx, &this->collider.base);
explosive = Actor_GetCollidedExplosive(play, &this->collider.base);
if (explosive != NULL) {
osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage);
explosive->params = 2;
@@ -103,7 +103,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) &&
(Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) {
BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs);
OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3050, 999, &this->dyna.actor, CAM_ID_MAIN);
} else {
if (this->timer != 0) {
this->timer--;
@@ -115,11 +115,11 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
}
}
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
}
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) {
static Vec3f velocity = { 0.0f, 5.0f, 0.0f };
static Vec3f accel = { 0.0f, -0.45f, 0.0f };
Vec3f pos1;
@@ -131,16 +131,16 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f,
this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
Flags_SetSwitch(globalCtx, this->dyna.actor.params);
Flags_SetSwitch(play, this->dyna.actor.params);
BgDdanKd_SetupAction(this, BgDdanKd_DoNothing);
} else {
effectStrength =
(this->dyna.actor.prevPos.y - this->dyna.actor.world.pos.y) + (this->dyna.actor.speedXZ * 0.25f);
if (globalCtx->state.frames & 1) {
if (play->state.frames & 1) {
pos1 = pos2 = this->dyna.actor.world.pos;
if (globalCtx->state.frames & 2) {
if (play->state.frames & 2) {
pos1.z += 210.0f + Rand_ZeroOne() * 230.0f;
pos2.z += 210.0f + Rand_ZeroOne() * 230.0f;
} else {
@@ -152,38 +152,38 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
pos1.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
pos2.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_80033480(play, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1);
velocity.x = Rand_CenteredFloat(3.0f);
velocity.z = Rand_CenteredFloat(3.0f);
func_8003555C(globalCtx, &pos1, &velocity, &accel);
func_8003555C(globalCtx, &pos2, &velocity, &accel);
func_8003555C(play, &pos1, &velocity, &accel);
func_8003555C(play, &pos2, &velocity, &accel);
pos1 = this->dyna.actor.world.pos;
pos1.z += 560.0f + Rand_ZeroOne() * 5.0f;
pos1.x += (Rand_ZeroOne() - 0.5f) * 160.0f;
pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f);
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(globalCtx, &pos1, &velocity, &accel);
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(play, &pos1, &velocity, &accel);
}
Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3);
Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
}
void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx) {
void BgDdanKd_DoNothing(BgDdanKd* this, PlayState* play) {
}
void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgDdanKd_Update(Actor* thisx, PlayState* play) {
BgDdanKd* this = (BgDdanKd*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, gDodongoFallingStairsDL);
void BgDdanKd_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, gDodongoFallingStairsDL);
}
@@ -6,7 +6,7 @@
struct BgDdanKd;
typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, GlobalContext*);
typedef void (*BgDdanKdActionFunc)(struct BgDdanKd*, PlayState*);
typedef struct BgDdanKd {
/* 0x0000 */ DynaPolyActor dyna;
@@ -10,15 +10,15 @@
#define FLAGS 0
void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx);
void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx);
void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgDodoago_Init(Actor* thisx, PlayState* play);
void BgDodoago_Destroy(Actor* thisx, PlayState* play);
void BgDodoago_Update(Actor* thisx, PlayState* play);
void BgDodoago_Draw(Actor* thisx, PlayState* play);
void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx);
void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx);
void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx);
void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx);
void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play);
void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play);
void BgDodoago_DoNothing(BgDodoago* this, PlayState* play);
void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play);
const ActorInit Bg_Dodoago_InitVars = {
ACTOR_BG_DODOAGO,
@@ -84,7 +84,7 @@ void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) {
void BgDodoago_SpawnSparkles(Vec3f* meanPos, PlayState* play) {
Vec3f pos;
Color_RGBA8 primColor = { 100, 100, 100, 0 };
Color_RGBA8 envColor = { 40, 40, 40, 0 };
@@ -96,7 +96,7 @@ void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) {
pos.x = Rand_CenteredFloat(20.0f) + meanPos->x;
pos.y = Rand_CenteredFloat(10.0f) + meanPos->y;
pos.z = Rand_CenteredFloat(20.0f) + meanPos->z;
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &acceleration, &primColor, &envColor);
EffectSsKiraKira_SpawnSmall(play, &pos, &velocity, &acceleration, &primColor, &envColor);
}
}
@@ -107,7 +107,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
};
void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgDodoago_Init(Actor* thisx, PlayState* play) {
BgDodoago* this = (BgDodoago*)thisx;
s32 pad;
CollisionHeader* colHeader = NULL;
@@ -115,38 +115,38 @@ void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&gDodongoLowerJawCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
BgDodoago_SetupAction(this, BgDodoago_DoNothing);
this->dyna.actor.shape.rot.x = 0x1333;
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255;
play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255;
return;
}
Collider_InitCylinder(globalCtx, &this->colliderMain);
Collider_InitCylinder(globalCtx, &this->colliderLeft);
Collider_InitCylinder(globalCtx, &this->colliderRight);
Collider_SetCylinder(globalCtx, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain);
Collider_SetCylinder(globalCtx, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight);
Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight);
Collider_InitCylinder(play, &this->colliderMain);
Collider_InitCylinder(play, &this->colliderLeft);
Collider_InitCylinder(play, &this->colliderRight);
Collider_SetCylinder(play, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain);
Collider_SetCylinder(play, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight);
Collider_SetCylinder(play, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight);
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
sDisableBombCatcher = false;
}
void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgDodoago_Destroy(Actor* thisx, PlayState* play) {
BgDodoago* this = (BgDodoago*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->colliderMain);
Collider_DestroyCylinder(globalCtx, &this->colliderLeft);
Collider_DestroyCylinder(globalCtx, &this->colliderRight);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->colliderMain);
Collider_DestroyCylinder(play, &this->colliderLeft);
Collider_DestroyCylinder(play, &this->colliderRight);
}
void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) {
Actor* explosive = Actor_GetCollidedExplosive(globalCtx, &this->colliderMain.base);
void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) {
Actor* explosive = Actor_GetCollidedExplosive(play, &this->colliderMain.base);
if (explosive != NULL) {
this->state =
@@ -154,21 +154,21 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) {
? BGDODOAGO_EYE_RIGHT
: BGDODOAGO_EYE_LEFT;
if (((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) ||
((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) {
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
if (((play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) ||
((play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) {
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
this->state = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
BgDodoago_SetupAction(this, BgDodoago_OpenJaw);
OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, CAM_ID_MAIN);
} else if (globalCtx->roomCtx.unk_74[this->state] == 0) {
OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3380, 160, &this->dyna.actor, CAM_ID_MAIN);
} else if (play->roomCtx.unk_74[this->state] == 0) {
OnePointCutscene_Init(play, 3065, 40, &this->dyna.actor, CAM_ID_MAIN);
BgDodoago_SetupAction(this, BgDodoago_LightOneEye);
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else {
OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 3065, 20, &this->dyna.actor, CAM_ID_MAIN);
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sTimer += 30;
@@ -195,13 +195,13 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) {
this->colliderRight.dim.pos.z += 215;
this->colliderRight.dim.pos.x -= 90;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderMain.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderLeft.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderRight.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderMain.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderLeft.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderRight.base);
}
}
void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play) {
Vec3f pos;
Vec3f dustOffsets[] = {
{ 0.0f, -200.0f, 430.0f }, { 20.0f, -200.0f, 420.0f }, { -20.0f, -200.0f, 420.0f },
@@ -212,14 +212,14 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
s32 i;
// make both eyes red (one already is)
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) {
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5;
if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) {
play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5;
}
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) {
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5;
if (play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) {
play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5;
}
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) {
if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) {
sTimer--;
return;
}
@@ -229,19 +229,19 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x;
pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y;
pos.z = dustOffsets[i].z + this->dyna.actor.world.pos.z;
func_80033480(globalCtx, &pos, 2.0f, 3, 200, 75, 1);
func_80033480(play, &pos, 2.0f, 3, 200, 75, 1);
}
}
pos.x = this->dyna.actor.world.pos.x + 200.0f;
pos.y = this->dyna.actor.world.pos.y - 20.0f;
pos.z = this->dyna.actor.world.pos.z + 100.0f;
BgDodoago_SpawnSparkles(&pos, globalCtx);
BgDodoago_SpawnSparkles(&pos, play);
pos.x = this->dyna.actor.world.pos.x - 200.0f;
pos.y = this->dyna.actor.world.pos.y - 20.0f;
pos.z = this->dyna.actor.world.pos.z + 100.0f;
BgDodoago_SpawnSparkles(&pos, globalCtx);
BgDodoago_SpawnSparkles(&pos, play);
Math_StepToS(&this->state, 100, 3);
func_800AA000(500.0f, 0x78, 0x14, 0xA);
@@ -256,18 +256,18 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
}
}
void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx) {
void BgDodoago_DoNothing(BgDodoago* this, PlayState* play) {
}
void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx) {
globalCtx->roomCtx.unk_74[this->state] += 5;
void BgDodoago_LightOneEye(BgDodoago* this, PlayState* play) {
play->roomCtx.unk_74[this->state] += 5;
if (globalCtx->roomCtx.unk_74[this->state] == 255) {
if (play->roomCtx.unk_74[this->state] == 255) {
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
}
}
void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgDodoago_Update(Actor* thisx, PlayState* play) {
BgDodoago* this = (BgDodoago*)thisx;
Actor* actor;
EnBom* bomb;
@@ -296,9 +296,9 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) {
}
} else {
sTimer++;
Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
Flags_GetSwitch(play, this->dyna.actor.params & 0x3F);
if (!sDisableBombCatcher && sTimer > 140) {
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
// this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher
sDisableBombCatcher++;
} else {
@@ -306,18 +306,18 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 672);
void BgDodoago_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_dodoago.c", 672);
if (Flags_GetEventChkInf(EVENTCHKINF_B0)) {
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 677),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_dodoago.c", 677),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gDodongoLowerJawDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 681);
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_dodoago.c", 681);
}
@@ -11,7 +11,7 @@ typedef enum {
struct BgDodoago;
typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, GlobalContext*);
typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, PlayState*);
typedef struct BgDodoago {
/* 0x0000 */ DynaPolyActor dyna;

Some files were not shown because too many files have changed in this diff Show More