Skip to content

Commit

Permalink
Applied the enum for interactions (#647)
Browse files Browse the repository at this point in the history
* Interactions enum applied

* Interactions enum applied
  • Loading branch information
TimeStepYT authored Dec 11, 2023
1 parent aaa4415 commit b163eca
Show file tree
Hide file tree
Showing 71 changed files with 239 additions and 238 deletions.
8 changes: 4 additions & 4 deletions src/enemy/businessScrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ void sub_08028EDC(Entity* this) {
}

void sub_08028F0C(Entity* this) {
if (this->interactType == 2) {
if (this->interactType == INTERACTION_FUSE) {
this->action = 8;
this->interactType = 0;
this->interactType = INTERACTION_NONE;
InitializeNPCFusion(this);
} else if (this->interactType != 0) {
} else if (this->interactType != INTERACTION_NONE) {
u16 dialog;
const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD;

this->interactType = 0;
this->interactType = INTERACTION_NONE;
sub_0804AA1C(this);
this->direction = (GetAnimationState(this) << 3);
sub_080290E0(this, 3);
Expand Down
4 changes: 2 additions & 2 deletions src/npc/anju.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ void Anju(AnjuEntity* this) {
InitScriptForNPC(super);
return;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(
GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
Expand Down
2 changes: 1 addition & 1 deletion src/npc/beedle.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void Beedle_Action1(Entity* this) {
(animIndex = Beedle_GetAnimIndexFacingPlayer(this), this->animIndex != animIndex)) {
InitializeAnimation(this, animIndex);
}
if (this->interactType != 0) {
if (this->interactType != INTERACTION_NONE) {
MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01));
this->action++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/npc/bigGoron.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ void sub_0806D638(Entity* this) {

void sub_0806D640(Entity* this) {
this->y.HALF.HI += 0x20;
this->interactType = 0;
this->interactType = INTERACTION_NONE;
}

void sub_0806D650(Entity* this) {
Expand Down
8 changes: 4 additions & 4 deletions src/npc/bladeBrothers.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ void sub_08068A4C(Entity* this) {
if (iVar2 == 0) {
GetNextFrame(this);
}
if (this->interactType != 0) {
this->interactType = 0;
if (this->interactType != INTERACTION_NONE) {
this->interactType = INTERACTION_NONE;
this->action = 2;
MessageFromTarget(0);
}
Expand Down Expand Up @@ -311,9 +311,9 @@ void sub_08068AFC(BladeBrothersEntity* this) {

void sub_08068b2c(BladeBrothersEntity* this) {
u32 animationState;
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity));
InitAnimationForceUpdate(super, animationState);
InitializeNPCFusion(super);
Expand Down
6 changes: 3 additions & 3 deletions src/npc/brocco.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void sub_08063584(Entity* this) {
}
}

if (this->interactType != 0) {
if (this->interactType != INTERACTION_NONE) {
this->action = 2;
InitAnimationForceUpdate(this, GetAnimationState(this) + 4);
MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01));
Expand All @@ -88,9 +88,9 @@ void sub_0806362C(BroccoEntity* this) {
this->animIndex = 0;
sub_0807DD64(super);
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
this->animIndex = super->animIndex;
InitAnimationForceUpdate(super,
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4);
Expand Down
4 changes: 2 additions & 2 deletions src/npc/carpenter.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ void Carpenter(CarpenterEntity* this) {
sub_0807DD64(super);

case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
this->animIndex = super->animIndex;
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) +
4 + (super->type * 8));
Expand Down
4 changes: 2 additions & 2 deletions src/npc/castleMaid.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void sub_08064570(CastleMaidEntity* this) {
InitScriptForNPC(super);
case 1:
ExecuteScriptAndHandleAnimation(super, NULL);
if (super->interactType != 0) {
if (super->interactType != INTERACTION_NONE) {
super->action++;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
if (this->dialogFunc != NULL) {
this->dialogFunc();
Expand Down
4 changes: 2 additions & 2 deletions src/npc/castorWildsStatue.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void sub_080673C0(Entity* this) {
}

void sub_080673F4(Entity* this) {
if (this->interactType != 0) {
if (this->interactType != INTERACTION_NONE) {
this->action = 2;
this->interactType = 0;
this->interactType = INTERACTION_NONE;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/npc/cat.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void sub_08067C44(CatEntity* this) {

this->unk_69 = uVar5;

if (super->interactType == 0) {
if (super->interactType == INTERACTION_NONE) {
return;
}

Expand Down Expand Up @@ -403,15 +403,15 @@ void sub_08067C44(CatEntity* this) {
break;
}

if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 8;
InitializeNPCFusion(super);
} else {
super->action = 4;
sub_08067790(super);
SetDefaultPriority(super, PRIO_MESSAGE);
}
super->interactType = 0;
super->interactType = INTERACTION_NONE;
SoundReq(SFX_VO_CAT);
}

Expand Down
8 changes: 4 additions & 4 deletions src/npc/cow.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ void sub_0806920C(CowEntity* this) {
// Check if player interacting
void sub_0806924C(CowEntity* this) {
s8 itype = super->interactType;
if (itype != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (itype == 2) {
if (itype != INTERACTION_NONE) {
if (gPlayerState.flags & PL_MINISH) {
if (itype == INTERACTION_FUSE) {
super->action = 4;
InitializeNPCFusion(super);
} else {
Expand All @@ -248,7 +248,7 @@ void sub_0806924C(CowEntity* this) {
ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_COW);
super->interactType = 0;
super->interactType = INTERACTION_NONE;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/npc/cucco.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ void sub_0806E648(CuccoEntity* this) {
}

void sub_0806E65C(Entity* this) {
if (this->interactType != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (this->interactType == 2) {
if (this->interactType != INTERACTION_NONE) {
if (gPlayerState.flags & PL_MINISH) {
if (this->interactType == INTERACTION_FUSE) {
this->action = 4;
InitializeNPCFusion(this);
} else {
Expand All @@ -119,7 +119,7 @@ void sub_0806E65C(Entity* this) {
ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_CUCCO_CALL);
this->interactType = 0;
this->interactType = INTERACTION_NONE;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/npc/cuccoChick.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ void sub_0806E824(CuccoChickEntity* this) {
}

void sub_0806E838(CuccoChickEntity* this) {
if (super->interactType != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (super->interactType == 2) {
if (super->interactType != INTERACTION_NONE) {
if (gPlayerState.flags & PL_MINISH) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 3;
InitializeNPCFusion(super);
} else {
Expand All @@ -98,7 +98,7 @@ void sub_0806E838(CuccoChickEntity* this) {
ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_CHEEP);
super->interactType = 0;
super->interactType = INTERACTION_NONE;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/npc/dampe.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void Dampe(Entity* this) {
InitScriptForNPC(this);
return;
case 1:
if (this->interactType == 2) {
if (this->interactType == INTERACTION_FUSE) {
this->action = 2;
this->interactType = 0;
this->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(this,
GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)) + 4);
InitializeNPCFusion(this);
Expand Down
4 changes: 2 additions & 2 deletions src/npc/din.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ void Din(DinEntity* this) {
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitializeNPCFusion(super);
this->animIndex = super->animIndex;
InitAnimationForceUpdate(super,
Expand Down
6 changes: 3 additions & 3 deletions src/npc/dog.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ void sub_08069FE8(DogEntity* this) {
}

void sub_0806A028(DogEntity* this) {
if (super->interactType != 0) {
if (super->interactType != INTERACTION_NONE) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 6;
InitializeNPCFusion(super);
} else {
Expand All @@ -474,7 +474,7 @@ void sub_0806A028(DogEntity* this) {
SoundReq(SFX_VO_DOG);
ResetPlayerAnimationAndAction();
}
super->interactType = 0;
super->interactType = INTERACTION_NONE;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/npc/epona.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ void sub_08065A64(EponaEntity* this) {
}

void sub_08065AA4(EponaEntity* this) {
if (super->interactType != 0) {
if (super->interactType != INTERACTION_NONE) {
if (gPlayerState.flags & PL_MINISH) {
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 4;
InitializeNPCFusion(super);
} else {
Expand All @@ -110,7 +110,7 @@ void sub_08065AA4(EponaEntity* this) {
ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_EPONA);
super->interactType = 0;
super->interactType = INTERACTION_NONE;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/npc/farore.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ void Farore(FaroreEntity* this) {
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitializeNPCFusion(super);
this->animIndex = super->animIndex;
InitAnimationForceUpdate(super,
Expand Down
4 changes: 2 additions & 2 deletions src/npc/festari.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void sub_0805FE10(FestariEntity* this) {
void sub_0805FE48(FestariEntity* this) {
u32 uVar4;

if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/npc/forestMinish.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,9 @@ void ForestMinish(ForestMinishEntity* this) {
}
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitializeNPCFusion(super);
} else {
ExecuteScriptForEntity(super, NULL);
Expand Down
4 changes: 2 additions & 2 deletions src/npc/gentari.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ void Gentari(GentariEntity* this) {
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(super,
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
Expand Down
8 changes: 4 additions & 4 deletions src/npc/ghostBrothers.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ void sub_08065C0C(GhostBrothersEntity* this) {
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(super,
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
Expand Down Expand Up @@ -240,8 +240,8 @@ void sub_08065EDC(GhostBrothersEntity* this) {

void sub_08065F20(GhostBrothersEntity* this) {
UpdateAnimationSingleFrame(super);
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
MessageFromTarget(0);
super->animIndex++;
if (gSpriteAnimations_GhostBrothers[super->animIndex] == 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/npc/gina.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ void Gina(GinaEntity* this) {
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == 2) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = 0;
super->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(super,
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
Expand Down
8 changes: 4 additions & 4 deletions src/npc/gorman.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ void sub_080697EC(Entity* this) {
this->subtimer--;
}
}
if (this->interactType != 0) {
this->interactType = 0;
if (this->interactType != INTERACTION_NONE) {
this->interactType = INTERACTION_NONE;
sub_08069888(this);
}
}
Expand All @@ -118,8 +118,8 @@ void sub_08069838(GormanEntity* this) {
sub_0807DD64(super);
}
ExecuteScriptAndHandleAnimation(super, NULL);
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
sub_08069888(super);
}
}
Expand Down
Loading

0 comments on commit b163eca

Please sign in to comment.