Skip to content

Commit e8f53b0

Browse files
committed
gustjar player fields
1 parent 5324928 commit e8f53b0

29 files changed

+133
-117
lines changed

asm/src/player.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ _080085E6:
8383
ldr r3, _080088A8 @ =gPlayerState
8484
ldrb r2, [r3, #0x1c]
8585
orrs r2, r2
86-
bne _0800861A // field_0x1c != 0
86+
bne _0800861A // gustJarState != 0
8787
ldrb r2, [r3, #5]
8888
orrs r2, r2
8989
bne _0800861A // heldObject != 0

include/player.h

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ typedef struct {
1111
/*0x6d*/ u8 unk_6d;
1212
/*0x6e*/ u8 unk_6e;
1313
/*0x6f*/ u8 unk_6f;
14-
/*0x70*/ Entity* unk_70;
15-
/*0x74*/ Entity* unk_74;
14+
/*0x70*/ Entity* pulledJarEntity;
15+
/*0x74*/ Entity* carriedEntity;
1616
/*0x78*/ u8 unk_78;
1717
/*0x79*/ u8 unk_79;
1818
/*0x7a*/ u16 unk_7a;
@@ -298,6 +298,24 @@ typedef enum {
298298
SWORD_MOVE_LOW_BEAM,
299299
} SwordMove;
300300

301+
typedef enum {
302+
PL_JAR_NONE = 0x0,
303+
PL_JAR_SUCK = 0x1,
304+
PL_JAR_2 = 0x2,
305+
PL_JAR_3 = 0x3,
306+
PL_JAR_BLAST_INIT = 0x4,
307+
PL_JAR_BLAST_UPDATE = 0x5,
308+
PL_JAR_BLAST_DONE = 0x6,
309+
PL_JAR_ENT_ATTACHED = 0x7,
310+
} GustJarState;
311+
312+
typedef enum {
313+
JAR_CHARGE_NONE = 0,
314+
JAR_CHARGE_SMALL = 1,
315+
JAR_CHARGE_MID = 2,
316+
JAR_CHARGE_BIG = 3,
317+
} GustJarCharge;
318+
301319
typedef enum {
302320
ANIM_DEFAULT = 0x100,
303321
ANIM_WALK = 0x104,
@@ -492,8 +510,8 @@ typedef struct {
492510
/*0x18*/ u16 startPosY;
493511
/*0x1a*/ u8 mobility;
494512
/*0x1b*/ u8 sword_state;
495-
/*0x1c*/ u8 field_0x1c;
496-
/*0x1d*/ u8 gustJarSpeed;
513+
/*0x1c*/ u8 gustJarState;
514+
/*0x1d*/ u8 gustJarCharge;
497515
/*0x1e*/ u8 dash_state;
498516
/*0x1f*/ u8 field_0x1f[2];
499517
/*0x21*/ u8 bow_state;

src/beanstalkSubtask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ u32 UpdatePlayerCollision(void) {
208208
((gPlayerState.sword_state & 0x10) != 0)) ||
209209
((sub_080806BC(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x,
210210
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
211-
(((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) ||
211+
(((gPlayerState.heldObject != 0 || ((gPlayerState.gustJarState & 0xf) != 0)) ||
212212
(sub_0807BD14(&gPlayerEntity.base, index) == 0)))))) {
213213
return 3;
214214
}

src/collision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ CollisionResult sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSetting
391391
CollisionResult sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
392392
if ((tgt->gustJarState & 4) != 0) {
393393
if (tgt->gustJarTolerance) {
394-
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarSpeed;
394+
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarCharge;
395395
if ((s8)tgt->gustJarTolerance <= 0) {
396396
tgt->gustJarTolerance = 0;
397397
tgt->subAction = 2;

src/enemy/bombPeahat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ void sub_0802A8F4(BombPeahatEntity* this) {
9696
}
9797

9898
void sub_0802A8FC(BombPeahatEntity* this) {
99-
if ((gPlayerState.field_0x1c & 0xf) == 0) {
100-
super->health = gPlayerState.field_0x1c & 0xf;
99+
if ((gPlayerState.gustJarState & 0xf) == 0) {
100+
super->health = gPlayerState.gustJarState & 0xf;
101101
}
102102
}
103103

src/enemy/dust.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void sub_08044550(DustEntity* this) {
303303
u8 uVar1;
304304
const s8* ptr;
305305

306-
if ((gPlayerState.field_0x1c & 0xf) == 1) {
306+
if ((gPlayerState.gustJarState & 0xf) == 1) {
307307
if (super->speed < 0x100) {
308308
super->speed += 0x10;
309309
}

src/enemy/flyingPot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void FlyingPot_SubAction2(FlyingPotEntity* this) {
156156
}
157157

158158
void FlyingPot_SubAction3(FlyingPotEntity* this) {
159-
if (!(gPlayerState.field_0x1c & 0xF)) {
159+
if (!(gPlayerState.gustJarState & 0xF)) {
160160
sub_08037408(this);
161161
}
162162
}

src/enemy/flyingSkull.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void sub_08039CE0(FlyingSkullEntity* this) {
100100
}
101101

102102
void sub_08039D4C(FlyingSkullEntity* this) {
103-
if ((gPlayerState.field_0x1c & 0xf) == 0) {
103+
if ((gPlayerState.gustJarState & 0xf) == 0) {
104104
sub_0803A0E0(this);
105105
}
106106
}

src/item/itemGustJar.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ void sub_08076DF4(ItemBehavior* this, u32 index) {
1818
this->playerAnimationState = gPlayerEntity.base.animationState;
1919
this->priority |= 0x80;
2020
this->priority++;
21-
gPlayerState.gustJarSpeed = 1;
22-
gPlayerEntity.unk_74 = NULL;
23-
gPlayerState.field_0x1c = 1;
21+
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
22+
gPlayerEntity.carriedEntity = NULL;
23+
gPlayerState.gustJarState = PL_JAR_SUCK;
2424
sub_08077BB8(this);
2525
} else {
2626
DeleteItemBehavior(this, index);
@@ -30,7 +30,7 @@ void sub_08076DF4(ItemBehavior* this, u32 index) {
3030
void sub_08076E60(ItemBehavior* this, u32 index) {
3131
Entity* playerItem;
3232

33-
if ((gPlayerState.field_0x1c & 0xf) == 0) {
33+
if ((gPlayerState.gustJarState & 0xf) == 0) {
3434
DeleteItemBehavior(this, index);
3535
}
3636
if ((this->playerFrame & 0x80) != 0) {
@@ -47,19 +47,19 @@ void sub_08076E60(ItemBehavior* this, u32 index) {
4747
}
4848

4949
void sub_08076EC8(ItemBehavior* this, u32 index) {
50-
if ((gPlayerState.field_0x1c & 0xf) == 0) {
50+
if ((gPlayerState.gustJarState & 0xf) == PL_JAR_NONE) {
5151
DeleteItemBehavior(this, index);
5252
return;
5353
}
5454

5555
if (IsItemActive(this)) {
5656
u32 animIndex;
5757
if (this->timer > 0xef) {
58-
gPlayerState.gustJarSpeed = 3;
58+
gPlayerState.gustJarCharge = JAR_CHARGE_BIG;
5959
} else if (++this->timer > 0x77) {
60-
gPlayerState.gustJarSpeed = 2;
60+
gPlayerState.gustJarCharge = JAR_CHARGE_MID;
6161
} else {
62-
gPlayerState.gustJarSpeed = 1;
62+
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
6363
}
6464

6565
if (gPlayerEntity.base.subAction == 0x1b) {
@@ -87,16 +87,16 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
8787
void sub_08076F64(ItemBehavior* this, u32 index) {
8888
Entity* item;
8989
PlayerEntity* player;
90-
switch (gPlayerState.field_0x1c & 0xf) {
91-
case 5:
90+
switch (gPlayerState.gustJarState & 0xf) {
91+
case PL_JAR_BLAST_UPDATE:
9292
if (this->playerFrame & 0x80) {
9393
if (this->subtimer) {
9494
this->subtimer = 0;
9595
this->timer = 0;
96-
gPlayerState.gustJarSpeed = 1;
96+
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
9797
player = &gPlayerEntity;
98-
player->unk_74 = NULL;
99-
gPlayerState.field_0x1c = 1;
98+
player->carriedEntity = NULL;
99+
gPlayerState.gustJarState = PL_JAR_SUCK;
100100
gPlayerState.field_0xa &= ~(8 >> index);
101101
this->stateID = 2;
102102
SetItemAnim(this, ANIM_GUSTJAR_SUCK);
@@ -106,7 +106,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
106106
}
107107
return;
108108
} else {
109-
gPlayerState.field_0x1c = 6;
109+
gPlayerState.gustJarState = PL_JAR_BLAST_DONE;
110110
SetItemAnim(this, ANIM_GUSTJAR_END);
111111
return;
112112
}
@@ -126,18 +126,18 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
126126
return;
127127
}
128128
return;
129-
case 3:
130-
gPlayerState.field_0x1c = 4;
131-
case 4:
129+
case PL_JAR_3:
130+
gPlayerState.gustJarState = PL_JAR_BLAST_INIT;
131+
case PL_JAR_BLAST_INIT:
132132
if (IsItemActive(this)) {
133133
this->subtimer = 1;
134134
}
135135

136136
UpdateItemAnim(this);
137137
if (this->playerFrame & 1) {
138-
gPlayerState.field_0x1c = 5;
139-
gPlayerEntity.unk_70 = NULL;
140-
if (gPlayerState.gustJarSpeed) {
138+
gPlayerState.gustJarState = PL_JAR_BLAST_UPDATE;
139+
gPlayerEntity.pulledJarEntity = NULL;
140+
if (gPlayerState.gustJarCharge) {
141141
CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
142142
}
143143
}
@@ -149,27 +149,27 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
149149
gPlayerEntity.base.speed = 0x80;
150150
UpdatePlayerMovement();
151151
return;
152-
case 6:
152+
case PL_JAR_BLAST_DONE:
153153
UpdateItemAnim(this);
154154
if ((this->playerFrame & 0x80) == 0)
155155
return;
156156
break;
157-
case 7:
157+
case PL_JAR_ENT_ATTACHED:
158158
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
159-
gPlayerState.field_0x1c = 3;
160-
gPlayerState.gustJarSpeed = 0;
159+
gPlayerState.gustJarState = PL_JAR_3;
160+
gPlayerState.gustJarCharge = JAR_CHARGE_NONE;
161161
return;
162-
case 1:
163-
case 2:
162+
case PL_JAR_SUCK:
163+
case PL_JAR_2:
164164
default:
165-
gPlayerState.field_0x1c = 3;
165+
gPlayerState.gustJarState = PL_JAR_3;
166166
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
167167
return;
168-
case 0:
168+
case PL_JAR_NONE:
169169
break;
170170
}
171-
gPlayerState.field_0x1c = 0;
172-
gPlayerEntity.unk_70 = NULL;
171+
gPlayerState.gustJarState = PL_JAR_NONE;
172+
gPlayerEntity.pulledJarEntity = NULL;
173173
DeleteItemBehavior(this, index);
174174
}
175175

src/item/itemPegasusBoots.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void sub_080768F8(ItemBehavior* this, u32 index) {
6262
u32 bVar1;
6363
u32 bVar2;
6464

65-
bVar1 = gPlayerState.field_0x1c | gPlayerState.attack_status | gPlayerState.heldObject | gPlayerState.jump_status;
65+
bVar1 = gPlayerState.gustJarState | gPlayerState.attack_status | gPlayerState.heldObject | gPlayerState.jump_status;
6666
bVar2 = (gPlayerState.flags & PL_IN_MINECART);
6767
bVar1 |= bVar2;
6868
if (bVar1 == 0) {

src/item/itemRocsCape.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void ItemRocsCape(ItemBehavior* this, u32 index) {
3535
}
3636
} else {
3737
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.attack_status |
38-
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) &&
38+
gPlayerState.heldObject | gPlayerState.gustJarState | gPlayerState.moleMittsState) == 0) &&
3939
((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
4040
gPlayerState.floor_type != SURFACE_PIT) ||
4141
(gPlayerEntity.base.z.WORD != 0)) ||

src/item/itemTryPickupObject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
5656
PlayerCancelHoldItem(this, param_3);
5757
} else {
5858
PlayerEntity* playerEnt = &gPlayerEntity;
59-
playerEnt->unk_74 = param_2;
59+
playerEnt->carriedEntity = param_2;
6060
playerEnt->base.subtimer = 0;
6161
param_2->child = this->field_0x18;
6262
param_2->carryFlags = playerEnt->base.carryFlags;

src/object/bush.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void Bush_Init(BushEntity* this) {
7373
}
7474

7575
void Bush_Action1(BushEntity* this) {
76-
if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
76+
if (((gPlayerState.gustJarState & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
7777
RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer);
7878
DeleteThisEntity();
7979
}
@@ -108,7 +108,7 @@ void Bush_Action2SubAction2(BushEntity* this) {
108108
super->spriteOffsetX = 0;
109109
sub_0807B9B8(this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
110110
}
111-
if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
111+
if (((gPlayerState.gustJarState & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
112112
Bush_Action2SubAction5(this);
113113
}
114114
if (sub_0806F3E4(super) && ((super->gustJarFlags & 0xf) == 1)) {

src/object/chuchuBossStartParticle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this) {
264264
DeleteThisEntity();
265265
}
266266

267-
if (gPlayerState.field_0x1c != 1) {
267+
if (gPlayerState.gustJarState != 1) {
268268
DeleteThisEntity();
269269
}
270270
} else {

src/object/gustJarParticle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void GustJarParticle_Action1(Entity* this) {
4444

4545
if (sub_0806F3E4(this)) {
4646
DeleteThisEntity();
47-
} else if ((gPlayerState.field_0x1c & 0xf) != 1) {
47+
} else if ((gPlayerState.gustJarState & 0xf) != 1) {
4848
DeleteThisEntity();
4949
}
5050
}

src/object/itemForSale.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
9191
PausePlayer();
9292
ResetActiveItems();
9393
gPlayerState.heldObject = 4;
94-
gPlayerEntity.unk_74 = super;
94+
gPlayerEntity.carriedEntity = super;
9595
gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP;
9696
MessageClose();
9797
}
@@ -104,7 +104,7 @@ void ItemForSale_Action2(ItemForSaleEntity* this) {
104104

105105
gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP;
106106
super->spriteSettings.draw = gPlayerEntity.base.spriteSettings.draw;
107-
if ((gPlayerState.heldObject == 0) || (super != gPlayerEntity.unk_74)) {
107+
if ((gPlayerState.heldObject == 0) || (super != gPlayerEntity.carriedEntity)) {
108108
sub_080819B4(this);
109109
} else {
110110
ptr = sub_080784E4();
@@ -129,7 +129,7 @@ void sub_080819B4(ItemForSaleEntity* this) {
129129
DeleteThisEntity();
130130
}
131131
gPlayerState.heldObject = 0;
132-
gPlayerEntity.unk_74 = 0;
132+
gPlayerEntity.carriedEntity = 0;
133133
ptr = &gUnk_0200AF00;
134134
gRoomVars.shopItemType = 0;
135135
ptr->rActionInteractObject = R_ACTION_NONE;

src/object/lilypadLarge.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) {
125125
this->unk_70 = 0;
126126
this->unk_6c = 0;
127127
}
128-
if (gPlayerState.field_0x1c == 3) {
129-
tmp = gUnk_08120620[gPlayerState.gustJarSpeed - 1];
128+
if (gPlayerState.gustJarState == PL_JAR_3) {
129+
tmp = gUnk_08120620[gPlayerState.gustJarCharge - 1];
130130
switch (gPlayerEntity.base.animationState & 6) {
131131
case 4:
132132
this->unk_70 -= tmp;
@@ -154,7 +154,7 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) {
154154
uVar4 = gPlayerEntity.base.y.HALF.HI + gUnk_08126EE4[gPlayerEntity.base.animationState | 1];
155155
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, sVar10, uVar4);
156156

157-
switch (gPlayerState.gustJarSpeed) {
157+
switch (gPlayerState.gustJarCharge) {
158158
case 3:
159159
tmp = 0x400;
160160
break;

src/object/minecart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void Minecart_Action1(MinecartEntity* this) {
7070
SoundReq(SFX_13B);
7171
} else {
7272
if (sub_0800445C(super) != 0) {
73-
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.field_0x1c ||
73+
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.gustJarState ||
7474
gPlayerState.heldObject || gPlayerState.jump_status)) {
7575
super->timer++;
7676
} else {

src/object/objectA8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ void ObjectA8_Action2Subaction0(ObjectA8Entity* this) {
116116
}
117117

118118
void ObjectA8_Action2Subaction1(ObjectA8Entity* this) {
119-
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
119+
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
120120
super->action = 3;
121121
} else {
122122
sub_0806F4E8(super);
123123
}
124124
}
125125

126126
void ObjectA8_Action2Subaction2(ObjectA8Entity* this) {
127-
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
127+
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
128128
super->action = 3;
129129
} else {
130130
if (sub_0806F3E4(super)) {

0 commit comments

Comments
 (0)