Labeled PlayerState and PlayerAction stuff

This commit is contained in:
Reinmmar 2023-09-17 12:09:53 +02:00
parent 098e61f0e7
commit e8639051ba
5 changed files with 23 additions and 18 deletions

View File

@ -125,6 +125,8 @@ typedef enum {
PL_SWORD_THRUST = 0x8000000,
PL_USE_OCARINA = 0x10000000,
PL_CLIMBING = 0x20000000,
PL_FLAGS40000000 = 0x40000000,
PL_FLAGS80000000 = 0x80000000,
} PlayerFlags;
enum PlayerItemId {

View File

@ -170,7 +170,7 @@ u32 UpdatePlayerCollision(void) {
u32 index;
const s16* ptr1;
const s16* ptr2;
s32 tmp1;
s32 framestate;
u32 tmp2;
u32 tmp3;
// There are some weird assignment necessary to access gPlayerEntity.animationState correctly.
@ -178,18 +178,18 @@ u32 UpdatePlayerCollision(void) {
u32 animationState2;
u32 animationState3;
if (gPlayerState.framestate == 0) {
tmp1 = gPlayerState.framestate_last;
if (gPlayerState.framestate == PL_STATE_IDLE) {
framestate = gPlayerState.framestate_last;
} else {
tmp1 = gPlayerState.framestate;
framestate = gPlayerState.framestate;
}
switch (tmp1) {
case 3:
switch (framestate) {
case PL_STATE_GUSTJAR:
return 0;
case 0x12:
case PL_STATE_DIE:
return 0;
case 0x16:
case PL_STATE_DROWN:
return 0;
}

View File

@ -1225,7 +1225,10 @@ void sub_0803B724(Entity* param_1) {
void sub_0803B798(void) {
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerState.flags &= ~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED |
PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE |
PL_CONVEYOR_PUSHED | PL_ENTER_MINECART | PL_SWORD_THRUST | PL_USE_OCARINA |
PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000);
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;

View File

@ -11,7 +11,7 @@
typedef struct {
Entity base;
u8 filler[0x1C];
u8 filler[28];
MinecartData* minecartData;
} MinecartEntity;

View File

@ -1043,15 +1043,15 @@ void DetermineRButtonInteraction(void) {
}
bool32 sub_080782C0(void) {
u8 tmp;
u8 framestate;
Entity* entity;
if (gPlayerState.framestate == PL_STATE_IDLE) {
tmp = gPlayerState.framestate_last;
framestate = gPlayerState.framestate_last;
} else {
tmp = gPlayerState.framestate;
framestate = gPlayerState.framestate;
}
switch (tmp) {
switch (framestate) {
case PL_STATE_SWORD:
case PL_STATE_GUSTJAR:
case PL_STATE_C:
@ -1877,8 +1877,8 @@ void sub_080797EC(void) {
gPlayerState.prevAnim = 0x6c;
return;
} else if (gPlayerState.sword_state == 0) {
if (gPlayerState.framestate == 0) {
gPlayerState.framestate = 1;
if (gPlayerState.framestate == PL_STATE_IDLE) {
gPlayerState.framestate = PL_STATE_WALK;
}
animation = 0x404;
} else {
@ -1924,8 +1924,8 @@ void sub_080797EC(void) {
}
}
} else {
if (gPlayerState.framestate == 0) {
gPlayerState.framestate = 1;
if (gPlayerState.framestate == PL_STATE_IDLE) {
gPlayerState.framestate = PL_STATE_WALK;
}
if ((gPlayerState.flags & PL_USE_LANTERN) != 0) {
animation = 0x608;