diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 542d72370..2c8f2ca18 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -30,11 +30,11 @@ #define STAT_STAGE_EVASION 1 // size: 0x8 -typedef struct unkStruct_8044CC8 +typedef struct ActionParameter { /* 0x0 */ u8 actionUseIndex; /* 0x4 */ DungeonPos lastItemThrowPosition; -} unkStruct_8044CC8; +} ActionParameter; // size: 0x18 typedef struct ActionContainer @@ -43,7 +43,7 @@ typedef struct ActionContainer /* 0x2 */ u8 direction; u8 unk3; // Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset. - /* 0x4 */ unkStruct_8044CC8 unk4[2]; + /* 0x4 */ ActionParameter actionParameters[2]; // Position of the target that the Pokémon wants throw an item at. /* 0x14 */ DungeonPos itemTargetPosition; } ActionContainer; diff --git a/src/code_8044CC8.c b/src/code_8044CC8.c index ca7285cf3..89bd2e46c 100644 --- a/src/code_8044CC8.c +++ b/src/code_8044CC8.c @@ -36,7 +36,7 @@ extern u8 GetFloorType(void); void sub_80460F8(DungeonPos *, Item *, u32); bool8 sub_80461C8(DungeonPos *, u32); -Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2) +Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2) { const Tile *tile; Item *item; @@ -67,9 +67,9 @@ Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2) bool8 sub_8044D40(ActionContainer *param_1,s32 index) { Item *item; - unkStruct_8044CC8 *puVar1; + ActionParameter *puVar1; - puVar1 = ¶m_1->unk4[index]; + puVar1 = ¶m_1->actionParameters[index]; if ((u8)(puVar1->actionUseIndex - 1) < INVENTORY_SIZE) { item = &gTeamInventoryRef->teamItems[puVar1->actionUseIndex - 1]; item->id = ITEM_NOTHING; @@ -88,14 +88,18 @@ bool8 sub_8044D40(ActionContainer *param_1,s32 index) Item *sub_8044D90(Entity *entity, s32 index, s32 unused) { EntityInfo *info = GetEntInfo(entity); - register unkStruct_8044CC8 *puVar1 asm("r3") = &info->action.unk4[index]; +#ifdef NONMATCHING + ActionParameter *puVar1 = &info->action.actionParameters[index]; +#else + register ActionParameter *puVar1 asm("r3") = &info->action.actionParameters[index]; +#endif return sub_8044CC8(entity, puVar1); } Entity *sub_8044DA4(Entity *entity, s32 index) { EntityInfo *info = GetEntInfo(entity); - return gDungeon->teamPokemon[info->action.unk4[index].actionUseIndex]; + return gDungeon->teamPokemon[info->action.actionParameters[index].actionUseIndex]; } u16 sub_8044DC8(Item *param_1) @@ -115,8 +119,8 @@ void sub_8044DF0(Entity *entity, s32 index, u32 unused) info = GetEntInfo(entity); item = sub_8044D90(entity,index,unused); - if ((info->action).unk4[0].actionUseIndex == 0x80) { - sub_80461C8(&(info->action).unk4[0].lastItemThrowPosition,1); + if ((info->action).actionParameters[0].actionUseIndex == 0x80) { + sub_80461C8(&(info->action).actionParameters[0].lastItemThrowPosition,1); } else { item->id = ITEM_NOTHING; @@ -138,9 +142,9 @@ void sub_8044E24(Entity *entity,int index,u32 unused) info = GetEntInfo(entity); if (!IsHMItem(itemPtr->id)) { if (GetItemCategory(itemPtr->id) == CATEGORY_TMS_HMS) { - if (info->action.unk4[index].actionUseIndex == 0x80) { + if (info->action.actionParameters[index].actionUseIndex == 0x80) { item = *itemPtr; - pos = &info->action.unk4[index].lastItemThrowPosition; + pos = &info->action.actionParameters[index].lastItemThrowPosition; sub_80461C8(pos,1); item.quantity = itemPtr->id - 125; item.id = ITEM_TM_USED_TM; diff --git a/src/code_805D8C8_1.c b/src/code_805D8C8_1.c index 1fd19e071..4ffc2fe36 100644 --- a/src/code_805D8C8_1.c +++ b/src/code_805D8C8_1.c @@ -192,7 +192,7 @@ void DungeonHandlePlayerInput(void) if (gDungeon->unk644.unk28 != 0) { if (sub_805E874() != 0) { leaderInfo->action.action = 2; - leaderInfo->action.unk4[0].actionUseIndex = 0; + leaderInfo->action.actionParameters[0].actionUseIndex = 0; break; } sub_805E804(); @@ -305,8 +305,8 @@ void DungeonHandlePlayerInput(void) } else { SetMonsterActionFields(&leaderInfo->action, ACTION_USE_MOVE_PLAYER); - leaderInfo->action.unk4[0].actionUseIndex = GetTeamMemberEntityIndex(leader); - leaderInfo->action.unk4[1].actionUseIndex = i; + leaderInfo->action.actionParameters[0].actionUseIndex = GetTeamMemberEntityIndex(leader); + leaderInfo->action.actionParameters[1].actionUseIndex = i; } break; } @@ -412,9 +412,9 @@ void DungeonHandlePlayerInput(void) for (i = 0; i < INVENTORY_SIZE; i++) { if (ItemExists(&gTeamInventoryRef->teamItems[i]) && ItemSet(&gTeamInventoryRef->teamItems[i])) { sub_8044C50(ACTION_THROW_ITEM_PLAYER); - leaderInfo->action.unk4[0].actionUseIndex = i +1; - leaderInfo->action.unk4[0].lastItemThrowPosition.x = 0; - leaderInfo->action.unk4[0].lastItemThrowPosition.y = 0; + leaderInfo->action.actionParameters[0].actionUseIndex = i +1; + leaderInfo->action.actionParameters[0].lastItemThrowPosition.x = 0; + leaderInfo->action.actionParameters[0].lastItemThrowPosition.y = 0; break; } } @@ -536,10 +536,10 @@ void DungeonHandlePlayerInput(void) if (GetEntInfo(leader)->cringeClassStatus.status != STATUS_CONFUSED) { gDungeon->unk644.unk28 = 1; } - leaderInfo->action.unk4[0].actionUseIndex = 0; + leaderInfo->action.actionParameters[0].actionUseIndex = 0; } else { - leaderInfo->action.unk4[0].actionUseIndex = 1; + leaderInfo->action.actionParameters[0].actionUseIndex = 1; } } break; @@ -963,15 +963,15 @@ bool8 sub_805EC4C(Entity *a0, u8 a1) SetMonsterActionFields(&entityInfo->action, ACTION_WALK); if (gRealInputs.held & B_BUTTON) { - entityInfo->action.unk4[0].actionUseIndex = 0; + entityInfo->action.actionParameters[0].actionUseIndex = 0; } else { - entityInfo->action.unk4[0].actionUseIndex = 1; + entityInfo->action.actionParameters[0].actionUseIndex = 1; } entityInfo->flags |= 0x8000; SetMonsterActionFields(&tileMonsterInfo->action, ACTION_WALK); - tileMonsterInfo->action.unk4[0].actionUseIndex = 0; + tileMonsterInfo->action.actionParameters[0].actionUseIndex = 0; tileMonsterInfo->action.direction = (entityInfo->action.direction + 4) & 7; tileMonsterInfo->flags |= 0x8000; tileMonsterInfo->targetPos.x = tileMonster->pos.x; @@ -1161,7 +1161,7 @@ u16 GetLeaderActionId(void) // Could this be a start of a new file? static UNUSED EWRAM_DATA u8 sUnused[4] = {0}; -static EWRAM_DATA unkStruct_8044CC8 sUnknownActionUnk4 = {0}; +static EWRAM_DATA ActionParameter sUnknownActionUnk4 = {0}; static EWRAM_DATA s32 sUnknown_202F240 = 0; static UNUSED EWRAM_DATA u8 sUnused2[4] = {0}; static EWRAM_DATA s16 sUnknown_202F248[8] = {0}; @@ -1322,7 +1322,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1) for (i = 0; i < MAX_TEAM_MEMBERS; i++) { Entity *teamMon = gDungeon->teamPokemon[i]; if (EntityExists(teamMon)) { - if (i == GetLeaderActionContainer()->unk4[0].actionUseIndex) { + if (i == GetLeaderActionContainer()->actionParameters[0].actionUseIndex) { sTeamMenuChosenId = count; if (GetLeaderActionId() != 0) { sub_806A2BC(teamMon, 0); @@ -1376,7 +1376,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1) sub_806A2BC(r6, 0); sub_804A728(&r6->pos, 0, 1, 1); - GetLeaderInfo()->action.unk4[0].actionUseIndex = r7; + GetLeaderInfo()->action.actionParameters[0].actionUseIndex = r7; sub_8044C10(0); if (sub_8062F90(r6, 0, 1, r9, r8)) { r10 = -1; @@ -1392,7 +1392,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1) if (sub_8071A8C(r6)) break; } - GetLeaderInfo()->action.unk4[0].actionUseIndex = r7; + GetLeaderInfo()->action.actionParameters[0].actionUseIndex = r7; if (r4 != r7) { sub_8083CE0(0); } @@ -1408,7 +1408,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1) if (sub_8071A8C(r6)) break; } - GetLeaderInfo()->action.unk4[0].actionUseIndex = r7; + GetLeaderInfo()->action.actionParameters[0].actionUseIndex = r7; if (r4 != r7) { sub_8083CE0(0); } @@ -1962,7 +1962,7 @@ bool8 sub_805FD74(Entity * a0, struct UnkMenuBitsStruct *a1) } else if (r9 == 3) { SetMonsterActionFields(&a0Info->action, 0xC); - a0Info->action.unk4[0] = sUnknownActionUnk4; + a0Info->action.actionParameters[0] = sUnknownActionUnk4; sub_803EAF0(0, NULL); r9 = 0; break; @@ -1970,7 +1970,7 @@ bool8 sub_805FD74(Entity * a0, struct UnkMenuBitsStruct *a1) else { sUnknown_202F240 = gUnknown_202EE10.menuIndex; if (var_2C != 0) { - a0Info->action.unk4[1] = sUnknownActionUnk4; + a0Info->action.actionParameters[1] = sUnknownActionUnk4; sub_803EAF0(0, NULL); r9 = 0; break; @@ -2012,7 +2012,7 @@ bool8 sub_805FD74(Entity * a0, struct UnkMenuBitsStruct *a1) if (a0Info->action.action == 0x37 || a0Info->action.action == 0x38 || a0Info->action.action == 0x3E) { // Hm... int newAction = sUnknownActionUnk4.actionUseIndex - 0x90; - a0Info->action.unk4[0].actionUseIndex = newAction; + a0Info->action.actionParameters[0].actionUseIndex = newAction; sub_803EAF0(0, 0); r9 = 0; break; @@ -2020,7 +2020,7 @@ bool8 sub_805FD74(Entity * a0, struct UnkMenuBitsStruct *a1) else if (a0Info->action.action == 0x36) { u32 var_38; if (DrawFieldGiveItemMenu((void*)&var_38, 2) != NULL) { - a0Info->action.unk4[1].actionUseIndex = var_38; + a0Info->action.actionParameters[1].actionUseIndex = var_38; sub_803EAF0(0, 0); r9 = 0; break; @@ -2259,7 +2259,7 @@ void sub_8060890(DungeonPos *a0) sUnknownActionUnk4.lastItemThrowPosition.y = a0->y; } -extern Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2, UNUSED s32 a3); +extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); extern void sub_8044F5C(u16 param_1, u8 param_2); extern void sub_8044FF0(u16 param_1); extern u16 sub_8044DC8(Item *param_1); @@ -2455,10 +2455,10 @@ void sub_8060900(Entity *a0) void sub_8060CE8(ActionContainer *a0) { SetMonsterActionFields(a0, gUnknown_202EE44[gUnknown_202EE10.menuIndex].unk0); - a0->unk4[0] = sUnknownActionUnk4; - a0->unk4[1].actionUseIndex = 0; - a0->unk4[1].lastItemThrowPosition.x = 0; - a0->unk4[1].lastItemThrowPosition.y = 0; + a0->actionParameters[0] = sUnknownActionUnk4; + a0->actionParameters[1].actionUseIndex = 0; + a0->actionParameters[1].lastItemThrowPosition.x = 0; + a0->actionParameters[1].lastItemThrowPosition.y = 0; } void sub_8060D24(UNUSED ActionContainer *a0) @@ -2621,7 +2621,7 @@ bool8 sub_8060E38(Entity *a0) if (r10) { EntityInfo *info = GetEntInfo(a0); SetMonsterActionFields(&info->action, 0x1B); - info->action.unk4[0].actionUseIndex = sp.unk4[sp.unk0]; + info->action.actionParameters[0].actionUseIndex = sp.unk4[sp.unk0]; ret = FALSE; break; } @@ -2871,7 +2871,7 @@ void sub_806145C(struct UnkFieldTeamMenuStruct *a0) void sub_80615B4(ActionContainer *a0, struct UnkFieldTeamMenuStruct *a1) { SetMonsterActionFields(a0, gUnknown_202EE44[gUnknown_202EE10.menuIndex].unk0); - a0->unk4[0].actionUseIndex = a1->unk4[a1->unk0]; + a0->actionParameters[0].actionUseIndex = a1->unk4[a1->unk0]; } void PrintMonTactics(s32 a0, u8 *tacticIds, EntityInfo *mon, s32 windowId); @@ -2906,7 +2906,7 @@ void ShowTacticsMenu(ActionContainer *a0) Entity *teamMon; SetTxtStruct(&sp); - teamMon = gDungeon->teamPokemon[a0->unk4[0].actionUseIndex]; + teamMon = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex]; monInfo = GetEntInfo(teamMon); menuIndex = 0; scrollFirstId = 0; diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 1c5eb7a32..9462a3811 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -37,7 +37,7 @@ extern void sub_8045DB4(DungeonPos *, u32); void HandlePickUpPlayerAction(Entity *entity) { - GetEntInfo(entity)->action.unk4[0].actionUseIndex = 1; + GetEntInfo(entity)->action.actionParameters[0].actionUseIndex = 1; sub_8045DB4(&entity->pos,0); } @@ -125,7 +125,7 @@ void HandleGiveItemAction(Entity *param_1) info2 = GetEntInfo(entity); item = sub_8044D90(param_1,0,2); - if((info1->action).unk4[0].actionUseIndex == 0x80) + if((info1->action).actionParameters[0].actionUseIndex == 0x80) bVar3 = TRUE; else bVar3 = FALSE; @@ -285,13 +285,13 @@ void HandlePlaceItemAction(Entity *entity) Item *item = sub_8044D90(entity,0,4); sub_8045BF8(gFormatBuffer_Items[0],item); - if (info->action.unk4[0].actionUseIndex == 0x80) { + if (info->action.actionParameters[0].actionUseIndex == 0x80) { LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8DE0); } - else if (info->action.unk4[0].actionUseIndex < 0x15 && (item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) { + else if (info->action.actionParameters[0].actionUseIndex < 0x15 && (item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) { LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8BE0); } - else if (info->action.unk4[0].actionUseIndex == 0x81 && (item->flags & ITEM_FLAG_STICKY)) { + else if (info->action.actionParameters[0].actionUseIndex == 0x81 && (item->flags & ITEM_FLAG_STICKY)) { LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8BE0); } else { diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 866b1506d..f3be3a10c 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -225,8 +225,8 @@ void sub_8044C10(u8 param_1) if(param_1) { - entityInfo->action.unk4[0].actionUseIndex = 0; - entityInfo->action.unk4[1].actionUseIndex = 0; + entityInfo->action.actionParameters[0].actionUseIndex = 0; + entityInfo->action.actionParameters[1].actionUseIndex = 0; entityInfo->action.itemTargetPosition.x = -1; entityInfo->action.itemTargetPosition.y = -1; } @@ -237,8 +237,8 @@ void sub_8044C50(u16 action) EntityInfo * entityInfo = GetLeaderInfo(); entityInfo->action.action = action; - entityInfo->action.unk4[0].actionUseIndex = 0; - entityInfo->action.unk4[1].actionUseIndex = 0; + entityInfo->action.actionParameters[0].actionUseIndex = 0; + entityInfo->action.actionParameters[1].actionUseIndex = 0; entityInfo->action.itemTargetPosition.x = -1; entityInfo->action.itemTargetPosition.y = -1; @@ -247,15 +247,15 @@ void sub_8044C50(u16 action) void ClearMonsterActionFields(ActionContainer *actionPointer) { actionPointer->action = ACTION_NOTHING; - actionPointer->unk4[0].actionUseIndex = 0; - actionPointer->unk4[1].actionUseIndex = 0; + actionPointer->actionParameters[0].actionUseIndex = 0; + actionPointer->actionParameters[1].actionUseIndex = 0; } void SetMonsterActionFields(ActionContainer *actionPointer, u16 action) { actionPointer->action = action; - actionPointer->unk4[0].actionUseIndex = 0; - actionPointer->unk4[1].actionUseIndex = 0; + actionPointer->actionParameters[0].actionUseIndex = 0; + actionPointer->actionParameters[1].actionUseIndex = 0; } void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species) @@ -268,6 +268,6 @@ void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species) { actionPointer->action = ACTION_PASS_TURN; } - actionPointer->unk4[0].actionUseIndex = 0; - actionPointer->unk4[1].actionUseIndex = 0; + actionPointer->actionParameters[0].actionUseIndex = 0; + actionPointer->actionParameters[1].actionUseIndex = 0; } diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 38b58a35e..b97a974c6 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -107,7 +107,7 @@ void ChooseAIMove(Entity *pokemon) } } } - pokemonInfo->action.unk4[0].actionUseIndex = chosenMoveIndex; + pokemonInfo->action.actionParameters[0].actionUseIndex = chosenMoveIndex; TargetTileInFront(pokemon); return; } @@ -331,7 +331,7 @@ void ChooseAIMove(Entity *pokemon) } } pokemonInfo->action.direction = aiPossibleMove[i].direction & DIRECTION_MASK; - pokemonInfo->action.unk4[0].actionUseIndex = chosenMoveIndex; + pokemonInfo->action.actionParameters[0].actionUseIndex = chosenMoveIndex; TargetTileInFront(pokemon); } else @@ -952,7 +952,7 @@ void HandleUseMoveAIAction(Entity *target) if (counter >= sub_8070828(target, TRUE)) break; entityInfo = GetEntInfo(target); - sub_8055A00(target, entityInfo->action.unk4[0].actionUseIndex, 1, 0, 0); + sub_8055A00(target, entityInfo->action.actionParameters[0].actionUseIndex, 1, 0, 0); if (!EntityExists(target)) break; if (sub_8044B28()) @@ -964,7 +964,7 @@ void HandleUseMoveAIAction(Entity *target) sub_8057588(target, 1); if (EntityExists(target)) - sub_806A9B4(target, GetEntInfo(target)->action.unk4[0].actionUseIndex); + sub_806A9B4(target, GetEntInfo(target)->action.actionParameters[0].actionUseIndex); sub_806A1B0(target); } diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index f12fb2501..5f0de764d 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -96,9 +96,9 @@ void AIDecideUseItem(Entity *pokemon) if (DungeonRandOutcome(gAIThrownItemProbabilities[targetIndex])) { SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI); - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; pokemonInfo->action.direction = gAIThrownItemDirections[targetIndex] & DIRECTION_MASK; break; } @@ -120,9 +120,9 @@ void AIDecideUseItem(Entity *pokemon) { u32 chosenTargetIndex = DungeonRandInt(gAIThrowItemActionChoiceCount); SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI); - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; pokemonInfo->action.direction = GetDirectionTowardsPosition(&pokemon->pos, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK; pokemonInfo->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex]; } @@ -133,9 +133,9 @@ void AIDecideUseItem(Entity *pokemon) if (itemTypeCompare < CATEGORY_HELD_ITEMS - 2) { SetMonsterActionFields(&pokemonInfo->action, ACTION_EAT_AI); - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; } else { @@ -205,9 +205,9 @@ void AIDecideUseItem(Entity *pokemon) { SetMonsterActionFields(&pokemonInfo->action, ACTION_EAT_AI); } - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; return; } } @@ -239,9 +239,9 @@ void AIDecideUseItem(Entity *pokemon) { u32 chosenTargetIndex = DungeonRandInt(gAIThrowItemActionChoiceCount); SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI); - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; pokemonInfo->action.direction = GetDirectionTowardsPosition(&pokemon->pos, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK; pokemonInfo->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex]; return; @@ -256,9 +256,9 @@ void AIDecideUseItem(Entity *pokemon) if (DungeonRandOutcome(potentialTargetWeights[targetIndex])) { SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI); - pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex; - pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x; - pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y; + pokemonInfo->action.actionParameters[0].actionUseIndex = selectedToolboxIndex; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.x = pokemon->pos.x; + pokemonInfo->action.actionParameters[0].lastItemThrowPosition.y = pokemon->pos.y; pokemonInfo->action.direction = gAIThrownItemDirections[targetIndex] & DIRECTION_MASK; return; } diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 0800f8b8e..599fb1882 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -262,7 +262,7 @@ bool8 sub_8072CF4(Entity *entity) HandleUnsetItemAction(entity, TRUE); break; case 0x3b: - gDungeon->unkBC = gDungeon->teamPokemon[(info->action).unk4[0].actionUseIndex]; + gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionParameters[0].actionUseIndex]; break; case ACTION_PLACE_ITEM: HandlePlaceItemAction(entity); diff --git a/src/status_checks.c b/src/status_checks.c index 8ee12c013..27f51831e 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -171,7 +171,7 @@ bool8 sub_80701A4(Entity *pokemon) (pokemonInfo->bideClassStatus.moveSlot == index)) { SetMonsterActionFields(&pokemonInfo->action, ACTION_USE_MOVE_PLAYER); index_1 = index; - r7 = &pokemonInfo->action.unk4[1].actionUseIndex; + r7 = &pokemonInfo->action.actionParameters[1].actionUseIndex; if((index > 0) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { do {