@@ -1158,9 +1158,29 @@ void ResetPossibleInteraction(void) {
1158
1158
gPossibleInteraction .currentObject = (InteractableObject * )& gNoInteraction ;
1159
1159
}
1160
1160
1161
+ static inline bool32 InlinePlayerStateCheck () {
1162
+ u8 frameState ;
1163
+ if ((gPlayerState .field_0x27 [0 ] | gPlayerState .swim_state ) != 0 ) {
1164
+ return TRUE;
1165
+ }
1166
+ if (gPlayerState .framestate == 0 ) {
1167
+ frameState = gPlayerState .framestate_last ;
1168
+ } else {
1169
+ frameState = gPlayerState .framestate ;
1170
+ }
1171
+ switch (frameState ) {
1172
+ case PL_STATE_SWORD :
1173
+ case PL_STATE_GUSTJAR :
1174
+ case PL_STATE_DIE :
1175
+ case PL_STATE_ITEMGET :
1176
+ case PL_STATE_DROWN :
1177
+ return TRUE;
1178
+ }
1179
+ return FALSE;
1180
+ }
1181
+
1161
1182
// determines which (if any) object the player is currently able to interact with
1162
1183
InteractableObject * sub_080784E4 (void ) {
1163
- u8 frameState ;
1164
1184
PlayerFlags r7 ;
1165
1185
s32 r3 ;
1166
1186
PlayerFlags PVar4 ;
@@ -1177,26 +1197,12 @@ InteractableObject* sub_080784E4(void) {
1177
1197
if (gPossibleInteraction .isUpdated != 0 ) {
1178
1198
return gPossibleInteraction .currentObject ;
1179
1199
}
1180
- if ((gPlayerState .field_0x27 [0 ] | gPlayerState .swim_state ) != 0 ) {
1181
- goto l ;
1182
- }
1183
1200
1184
- if (gPlayerState .framestate == 0 ) {
1185
- frameState = gPlayerState .framestate_last ;
1186
- } else {
1187
- frameState = gPlayerState .framestate ;
1188
- }
1189
- switch (frameState ) {
1190
- case PL_STATE_SWORD :
1191
- case PL_STATE_GUSTJAR :
1192
- case PL_STATE_DIE :
1193
- case PL_STATE_ITEMGET :
1194
- case PL_STATE_DROWN :
1195
- l :
1196
- gPossibleInteraction .currentIndex = 0xFF ;
1197
- gPossibleInteraction .currentObject = (InteractableObject * )& gNoInteraction ;
1198
- gPossibleInteraction .isUpdated = 1 ;
1199
- return gPossibleInteraction .currentObject ;
1201
+ if (InlinePlayerStateCheck ()) {
1202
+ gPossibleInteraction .currentIndex = 0xFF ;
1203
+ gPossibleInteraction .currentObject = (InteractableObject * )& gNoInteraction ;
1204
+ gPossibleInteraction .isUpdated = 1 ;
1205
+ return gPossibleInteraction .currentObject ;
1200
1206
}
1201
1207
1202
1208
if (!(gPlayerState .flags & PL_MINISH )) {
0 commit comments