diff --git a/src/battle/item/coconut/aux.c b/src/battle/item/coconut/aux.c index 4ee0890cc7..7bdb8f65a7 100644 --- a/src/battle/item/coconut/aux.c +++ b/src/battle/item/coconut/aux.c @@ -3,77 +3,51 @@ MenuIcon* D_802A1E80; void* D_80108A64; // an image -#ifdef NON_MATCHING ApiStatus func_802A1000_72F720(ScriptInstance* script, s32 isInitialCall) { - BattleStatus* battleStatus; - Actor* player; - Actor* player2; - s32 sellValue; - s32 numCoins; - s32 pickupDelay; - f32 facingAngleSign; - s32 i; - + BattleStatus* battleStatus = BATTLE_STATUS; + Actor* player = PLAYER_ACTOR; + s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue; f32 posX; - f32 posY; + f32 posY = player->currentPos.y + player->size.y; f32 posZ; - - s32 iconX; - s32 iconY; - s32 iconZ; - - i = 0; - facingAngleSign = 0.0f; - - battleStatus = BATTLE_STATUS; - sellValue = gItemTable[battleStatus->selectedItemID].sellValue; - posY = battleStatus->playerActor->currentPos.y + battleStatus->playerActor->size.y; - - player = PLAYER_ACTOR; + f32 facingAngleSign = 0.0f; + s32 outVal = 0; // If Refund is equipped, the player gets - if (heroes_is_ability_active(battleStatus->playerActor, Ability_REFUND)) { - //player2 = player; + if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) { + s32 iconX; + s32 iconY; + s32 iconZ; + s32 i; - if (sellValue > 0) { - // 75% of the item's sell value, rounded up - sellValue = (sellValue * 75 + 99) / 100; + // 75% of the item's sell value, rounded up + sellValue = (sellValue * 75 + 99) / 100; - pickupDelay = 1; - player2 = player; + for (i = 0; i < sellValue; i++) { + posX = player->currentPos.x; + posZ = player->currentPos.z; - while (i < sellValue) { - posX = player2->currentPos.x; - posZ = player2->currentPos.z; + make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, 1 + 3 * i, facingAngleSign, 0); + add_coins(1); - make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, pickupDelay, facingAngleSign, 0); - add_coins(1); - - pickupDelay += 3; - facingAngleSign += 30.0f; - i++; - } - - i = (i * 3) + 30; - - //player2 = player; - posX = player2->currentPos.x; - posY = player2->currentPos.y; - posZ = player2->currentPos.z; - - get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconX, &iconY, &iconZ); - D_802A1E80 = create_icon(&D_80108A64); - set_icon_render_pos(D_802A1E80, iconX + 36, iconY - 63); + facingAngleSign += 30.0f; } + + outVal = (i * 3) + 30; + + posX = player->currentPos.x; + posY = player->currentPos.y; + posZ = player->currentPos.z; + + get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconX, &iconY, &iconZ); + D_802A1E80 = create_icon(&D_80108A64); + set_icon_render_pos(D_802A1E80, iconX + 36, iconY - 63); } - script->varTable[0] = i; + script->varTable[0] = outVal; return ApiStatus_DONE2; } -#else -INCLUDE_ASM(ApiStatus, "battle/item/coconut", func_802A1000_72F720, ScriptInstance* script, s32 isInitialCall); -#endif ApiStatus func_802A11D4_72F8F4(ScriptInstance* script, s32 isInitialCall) { BattleStatus* battleStatus = BATTLE_STATUS;