mirror of https://github.com/zeldaret/tmc.git
Use PlayerFlags where possible
This commit is contained in:
parent
d34aa9166f
commit
b4f8429a2c
|
@ -96,6 +96,7 @@ typedef enum {
|
|||
|
||||
enum PlayerFlags {
|
||||
PL_BUSY = 0x1,
|
||||
PL_FLAGS2 = 0x2,
|
||||
PL_DROWNING = 0x4,
|
||||
PL_NO_CAP = 0x8,
|
||||
PL_CAPTURED = 0x10,
|
||||
|
@ -108,6 +109,9 @@ enum PlayerFlags {
|
|||
PL_FROZEN = 0x800,
|
||||
PL_IN_MINECART = 0x1000,
|
||||
PL_DRUGGED = 0x4000,
|
||||
PL_FLAGS8000 = 0x8000,
|
||||
PL_FLAGS10000 = 0x10000,
|
||||
PL_FLAGS20000 = 0x20000,
|
||||
PL_ROLLING = 0x40000,
|
||||
PL_MOLDWORM_CAPTURED = 0x80000,
|
||||
PL_IN_HOLE = 0x100000,
|
||||
|
@ -115,6 +119,7 @@ enum PlayerFlags {
|
|||
PL_CLONING = 0x400000,
|
||||
PL_USE_LANTERN = 0x800000,
|
||||
PL_PARACHUTE = 0x1000000,
|
||||
PL_FLAGS2000000 = 0x2000000,
|
||||
PL_ENTER_MINECART = 0x4000000,
|
||||
PL_SWORD_THRUST = 0x8000000,
|
||||
PL_USE_OCARINA = 0x10000000,
|
||||
|
|
|
@ -512,7 +512,7 @@ void sub_0806FD3C(Entity* this) {
|
|||
|
||||
bool32 sub_0806FD54(Entity* this) {
|
||||
u32 rv;
|
||||
if ((gPlayerState.flags & 0x800000) == 0) {
|
||||
if ((gPlayerState.flags & PL_USE_LANTERN) == 0) {
|
||||
rv = 0;
|
||||
} else {
|
||||
rv = EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 9, 0x48);
|
||||
|
|
|
@ -133,7 +133,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
|
|||
|
||||
sub_08078930(super);
|
||||
} else {
|
||||
if ((gPlayerState.flags & 0x80) == 0) {
|
||||
if ((gPlayerState.flags & PL_MINISH) == 0) {
|
||||
Entity* ent = &gPlayerEntity;
|
||||
if (EntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
|
||||
if (super->type == 1) {
|
||||
|
|
|
@ -213,7 +213,7 @@ void sub_0802805C(Entity* this) {
|
|||
NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) {
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags &= 0xffffffef;
|
||||
gPlayerState.flags &= PL_CAPTURED;
|
||||
gPlayerEntity.flags |= ENT_COLLIDE;
|
||||
gPlayerEntity.zVelocity = Q_16_16(1.5);
|
||||
gPlayerEntity.iframes = -60;
|
||||
|
|
|
@ -91,7 +91,7 @@ void sub_080230E4(Entity* this) {
|
|||
gPlayerEntity.direction = 0xff;
|
||||
gPlayerEntity.iframes = -0x14;
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.flags &= 0xfff7ffff;
|
||||
gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED;
|
||||
}
|
||||
|
||||
sub_0804AA30(this, gUnk_080CBC38);
|
||||
|
|
|
@ -342,7 +342,7 @@ void sub_080171F0(void) {
|
|||
if (gPlayerEntity.action != PLAYER_DROWN)
|
||||
COPY_FLAG_FROM_TO(gPlayerState.flags, 0x2, 0x10000);
|
||||
|
||||
gPlayerState.flags &= ~2;
|
||||
gPlayerState.flags &= ~PL_FLAGS2;
|
||||
sub_080028E0(&gPlayerEntity);
|
||||
|
||||
if (gPlayerState.flags & PL_CLONING)
|
||||
|
|
|
@ -21,7 +21,7 @@ void ItemSword(ItemBehavior* this, u32 arg1) {
|
|||
|
||||
void sub_08075338(ItemBehavior* this, u32 arg1) {
|
||||
u32 temp, temp2;
|
||||
if (gPlayerState.flags & 0x80) {
|
||||
if (gPlayerState.flags & PL_MINISH) {
|
||||
this->field_0x5[4] |= 0x80;
|
||||
sub_08077D38(this, arg1);
|
||||
gPlayerState.animation = 0xc00;
|
||||
|
@ -51,7 +51,7 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (gPlayerState.flags & 0x40000) {
|
||||
if (gPlayerState.flags & PL_ROLLING) {
|
||||
if ((gPlayerState.field_0xac & 2) == 0) {
|
||||
if (gPlayerState.item == NULL)
|
||||
return;
|
||||
|
@ -71,7 +71,7 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
|
|||
this->field_0xf = 6;
|
||||
this->field_0x5[4] |= 0x80;
|
||||
gPlayerState.field_0xab = 2;
|
||||
gPlayerState.flags |= 0x8000000;
|
||||
gPlayerState.flags |= PL_SWORD_THRUST;
|
||||
sub_08077DF4(this, 0x130);
|
||||
SoundReq(SFX_PLY_VO3);
|
||||
return;
|
||||
|
|
|
@ -137,8 +137,8 @@ u32 sub_0805B1CC(Manager1A* this) {
|
|||
u32 re = 0;
|
||||
if (CheckPlayerProximity(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
|
||||
if ((gPlayerState.flags & PL_DROWNING) && (gPlayerState.flags & PL_BUSY)) {
|
||||
gPlayerState.flags |= 0x8000;
|
||||
} else if (gPlayerState.flags & 0x8000) {
|
||||
gPlayerState.flags |= PL_FLAGS8000;
|
||||
} else if (gPlayerState.flags & PL_FLAGS8000) {
|
||||
re = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ void ShowNPCDialogue(Entity* ent, Dialog* dia) {
|
|||
uVar2 = dia->data.indices.b;
|
||||
break;
|
||||
case 6:
|
||||
if ((gPlayerState.flags & 0x80) != 0) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
uVar2 = dia->data.indices.b;
|
||||
} else {
|
||||
uVar2 = dia->data.indices.a;
|
||||
|
|
|
@ -60,7 +60,7 @@ void BigPushableLever_Idle(BigPushableLeverEntity* this) {
|
|||
if (sub_08079F8C()) {
|
||||
gPlayerState.pushedObject = 0x98;
|
||||
gPlayerState.queued_action = 5;
|
||||
gPlayerState.flags |= 1;
|
||||
gPlayerState.flags |= PL_BUSY;
|
||||
gPlayerEntity.x.HALF.LO = 0;
|
||||
gPlayerEntity.y.HALF.LO = 0;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
|
|
|
@ -90,7 +90,7 @@ void sub_080A1704(GyorgBossObjectEntity* this) {
|
|||
this->unk_76 = 0xc0;
|
||||
this->unk_78 = 0xc0;
|
||||
gRoomTransition.field_0x39 = 1;
|
||||
gPlayerState.flags |= 0x20000;
|
||||
gPlayerState.flags |= PL_FLAGS20000;
|
||||
gPlayerState.startPosX = gRoomControls.origin_x + 0x200;
|
||||
gPlayerState.startPosY = gRoomControls.origin_y + 0x210;
|
||||
#ifndef EU
|
||||
|
@ -219,7 +219,7 @@ void sub_080A1B4C(GyorgBossObjectEntity* this) {
|
|||
this->unk_6e = 0x1a4;
|
||||
super->direction = 0;
|
||||
super->speed = 0x60;
|
||||
gPlayerState.flags &= ~0x20000;
|
||||
gPlayerState.flags &= ~PL_FLAGS20000;
|
||||
CopyPosition(&gPlayerEntity, super);
|
||||
gRoomControls.camera_target = super;
|
||||
SetPlayerControl(2);
|
||||
|
|
|
@ -96,7 +96,7 @@ ASM_FUNC("asm/non_matching/lilypadLarge/sub_080855E8.inc", void sub_080855E8(Lil
|
|||
|
||||
void sub_08085A1C(LilypadLargeEntity* this) {
|
||||
gUnk_0812062C[super->subAction](this);
|
||||
gPlayerState.flags |= 2;
|
||||
gPlayerState.flags |= PL_FLAGS2;
|
||||
sub_08078B48();
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ void sub_08085C5C(LilypadLargeEntity* this) {
|
|||
gPlayerEntity.speed = super->speed;
|
||||
gPlayerEntity.direction = super->direction;
|
||||
LinearMoveUpdate(&gPlayerEntity);
|
||||
gPlayerState.flags |= 2;
|
||||
gPlayerState.flags |= PL_FLAGS2;
|
||||
if (super->collisionLayer == 1) {
|
||||
ResetCollisionLayer(&gPlayerEntity);
|
||||
} else {
|
||||
|
@ -228,7 +228,7 @@ void sub_08085D10(LilypadLargeEntity* this) {
|
|||
}
|
||||
|
||||
void sub_08085D28(LilypadLargeEntity* this) {
|
||||
if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & 2) != 0)) &&
|
||||
if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & PL_FLAGS2) != 0)) &&
|
||||
(sub_080002B4(super, 0, 0x18) == 0x11)) {
|
||||
super->action = 2;
|
||||
super->subAction = 0;
|
||||
|
@ -239,7 +239,7 @@ void sub_08085D28(LilypadLargeEntity* this) {
|
|||
NONMATCH("asm/non_matching/lilypadLarge/sub_08085D60.inc", void sub_08085D60(LilypadLargeEntity* this)) {
|
||||
u32 r4; // horizontal direction?
|
||||
u32 r6; // vertical direction?
|
||||
if ((gPlayerState.flags & 2) != 0) {
|
||||
if ((gPlayerState.flags & PL_FLAGS2) != 0) {
|
||||
if (gPlayerState.framestate != PL_STATE_DIE) {
|
||||
if (gPlayerState.jump_status == 0) {
|
||||
if ((super->direction & 7) == 0) { // North or South
|
||||
|
@ -351,7 +351,7 @@ void sub_08085F48(LilypadLargeEntity* this) {
|
|||
super->actionDelay = 0;
|
||||
}
|
||||
} else {
|
||||
if ((gPlayerState.flags & 2) != 0) {
|
||||
if ((gPlayerState.flags & PL_FLAGS2) != 0) {
|
||||
if (super->actionDelay != 0) {
|
||||
if (this->unk_78.WORD_U < 0x1200000) {
|
||||
this->unk_78.WORD_U += 0x8000;
|
||||
|
|
|
@ -69,5 +69,5 @@ void sub_08099ECC(Entity* this) {
|
|||
CopyPosition(this, &gPlayerEntity);
|
||||
gPlayerState.queued_action = PLAYER_FALL;
|
||||
gPlayerState.field_0x34[4] = 0;
|
||||
gPlayerState.flags |= 0x8000;
|
||||
gPlayerState.flags |= PL_FLAGS8000;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void PushableLever_Idle(PushableLeverEntity* this) {
|
|||
if (sub_08079F8C()) {
|
||||
gPlayerState.pushedObject = 0x90;
|
||||
gPlayerState.queued_action = 5;
|
||||
gPlayerState.flags |= 1;
|
||||
gPlayerState.flags |= PL_BUSY;
|
||||
gPlayerEntity.x.HALF.LO = 0;
|
||||
gPlayerEntity.y.HALF.LO = 0;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
|
|
26
src/player.c
26
src/player.c
|
@ -473,7 +473,7 @@ static void PlayerNormal(Entity* this) {
|
|||
}
|
||||
}
|
||||
gPlayerState.pushedObject |= 0x80;
|
||||
if ((gPlayerState.flags & (PL_USE_OCARINA | 2)) == 0) {
|
||||
if ((gPlayerState.flags & (PL_USE_OCARINA | PL_FLAGS2)) == 0) {
|
||||
UpdateFloorType();
|
||||
}
|
||||
|
||||
|
@ -486,14 +486,14 @@ static void PlayerNormal(Entity* this) {
|
|||
if (gRoomVars.shopItemType == 0) {
|
||||
ResetPlayer();
|
||||
}
|
||||
if ((gPlayerState.flags & (PL_USE_OCARINA | 2)) == 0) {
|
||||
if ((gPlayerState.flags & (PL_USE_OCARINA | PL_FLAGS2)) == 0) {
|
||||
UpdateFloorType();
|
||||
RunQueuedAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (((gPlayerState.flags &
|
||||
(PL_BUSY | PL_DROWNING | PL_USE_PORTAL | 0x10 | PL_FALLING | PL_BURNING | 0x1000 | PL_ROLLING)) |
|
||||
if (((gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_CAPTURED | PL_FALLING | PL_BURNING |
|
||||
PL_IN_MINECART | PL_ROLLING)) |
|
||||
gPlayerState.field_0xaa) == 0) {
|
||||
switch (UpdatePlayerCollision()) {
|
||||
case 0:
|
||||
|
@ -560,7 +560,7 @@ static void PlayerNormal(Entity* this) {
|
|||
gPlayerState.framestate = PL_STATE_SWIM;
|
||||
sub_0807ACCC(this);
|
||||
} else {
|
||||
if ((gPlayerState.flags & 0x2000000) == 0)
|
||||
if ((gPlayerState.flags & PL_FLAGS2000000) == 0)
|
||||
this->spritePriority.b1 = 1;
|
||||
if (gPlayerState.dash_state & 0x40) {
|
||||
sub_08008AA0(this);
|
||||
|
@ -654,11 +654,11 @@ static void PlayerFallInit(Entity* this) {
|
|||
static void PlayerFallUpdate(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
if ((gSave.stats.health != 0) && (gPlayerState.flags & 0x8000)) {
|
||||
if ((gSave.stats.health != 0) && (gPlayerState.flags & PL_FLAGS8000)) {
|
||||
gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING);
|
||||
this->spriteSettings.draw = 0;
|
||||
} else {
|
||||
gPlayerState.flags &= ~(PL_DROWNING | 0x8000);
|
||||
gPlayerState.flags &= ~(PL_DROWNING | PL_FLAGS8000);
|
||||
RespawnPlayer();
|
||||
gPlayerState.field_0xa = 0;
|
||||
this->iframes = 32;
|
||||
|
@ -995,7 +995,7 @@ static void PlayerDrownInit(Entity* this) {
|
|||
gPlayerState.animation = 0xc19;
|
||||
SoundReq(SFX_WATER_SPLASH);
|
||||
} else {
|
||||
if ((gPlayerState.flags & 0x10000) == 0)
|
||||
if ((gPlayerState.flags & PL_FLAGS10000) == 0)
|
||||
sub_08004168(this);
|
||||
|
||||
CreateFx(this, FX_WATER_SPLASH, 0);
|
||||
|
@ -1479,7 +1479,7 @@ static void PlayerMinishDieInit(Entity* this) {
|
|||
gPlayerState.animation = temp;
|
||||
|
||||
gPlayerState.flags &=
|
||||
~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | 0x100 | PL_BUSY);
|
||||
~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_BUSY);
|
||||
this->subAction = 1;
|
||||
this->animationState = IdleSouth;
|
||||
this->spritePriority.b1 = 1;
|
||||
|
@ -2045,7 +2045,7 @@ static void PlayerRollUpdate(Entity* this) {
|
|||
CreateFx(&gPlayerEntity, FX_DASH, 0x40);
|
||||
this->actionDelay = 4;
|
||||
}
|
||||
if ((gPlayerState.flags & 2) == 0) {
|
||||
if ((gPlayerState.flags & PL_FLAGS2) == 0) {
|
||||
UpdateFloorType();
|
||||
}
|
||||
if (RunQueuedAction()) {
|
||||
|
@ -2126,7 +2126,7 @@ static void PlayerWaitForScroll(Entity* this) {
|
|||
COLLISION_ON(this);
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
if ((gPlayerState.flags & 2) == 0) {
|
||||
if ((gPlayerState.flags & PL_FLAGS2) == 0) {
|
||||
UpdateFloorType();
|
||||
}
|
||||
}
|
||||
|
@ -3534,7 +3534,7 @@ void sub_08074808(Entity* this) {
|
|||
sub_08077AEC();
|
||||
if (GetInventoryValue(ITEM_FLIPPERS) == 1) {
|
||||
if (!gPlayerState.swim_state) {
|
||||
if ((gPlayerState.flags & 0x10000) != 0)
|
||||
if ((gPlayerState.flags & PL_FLAGS10000) != 0)
|
||||
gPlayerState.swim_state = 1;
|
||||
else
|
||||
gPlayerState.swim_state = 8;
|
||||
|
@ -3714,7 +3714,7 @@ static void conveyer_push(Entity* this) {
|
|||
ResetPlayer();
|
||||
this->spritePriority.b1 = 0;
|
||||
this->speed = WALK_SPEED;
|
||||
gPlayerState.flags |= 0x2000000;
|
||||
gPlayerState.flags |= PL_FLAGS2000000;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.field_0x27[0]++;
|
||||
|
|
|
@ -19,7 +19,7 @@ void ResetPlayer() {
|
|||
gPlayerState.sword_state = 0;
|
||||
gPlayerState.field_0x3[0] = 0;
|
||||
gPlayerState.heldObject = 0;
|
||||
gPlayerState.flags &= 0xf7fbffff;
|
||||
gPlayerState.flags &= ~(PL_ROLLING | PL_SWORD_THRUST);
|
||||
|
||||
gPlayerEntity.field_0x70.WORD = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue