mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
improve coconut
This commit is contained in:
parent
cad79eebda
commit
51dbb6e5d7
@ -37,6 +37,12 @@ typedef struct Vec3f {
|
||||
/* 0x08 */ f32 z;
|
||||
} Vec3f; // size = 0x0C
|
||||
|
||||
typedef struct Vec3i {
|
||||
/* 0x00 */ s32 x;
|
||||
/* 0x04 */ s32 y;
|
||||
/* 0x08 */ s32 z;
|
||||
} Vec3i; // size = 0x0C
|
||||
|
||||
typedef struct Vec2s {
|
||||
/* 0x00 */ s16 x;
|
||||
/* 0x02 */ s16 y;
|
||||
|
@ -100,6 +100,7 @@ Trigger* get_trigger_by_id(s32 triggerID);
|
||||
|
||||
Actor* get_actor(ActorID actorID);
|
||||
ActorPart* get_actor_part(Actor* actor, s32 partIndex);
|
||||
s32 add_coins(s32 amt);
|
||||
|
||||
s32 func_800494C0(Npc* npc, s32 arg1, s32 arg2);
|
||||
|
||||
@ -121,6 +122,9 @@ s32 func_80055464(s32, s32);
|
||||
void func_800561A4(s32);
|
||||
s32 osGetId();
|
||||
|
||||
s32* create_icon(s32 iconIndex);
|
||||
void set_icon_render_pos(s32 iconIndex, s32 posX, s32 posY);
|
||||
|
||||
void set_curtain_scale_goal(f32 scale);
|
||||
void set_curtain_fade(f32 scale);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define STATIC_ASSERT(condition) enum { static_assert_fail = 1/(!!(condition)) } // Causes division by zero ("not integer constant") if false
|
||||
|
||||
#define BATTLE_STATUS (&gBattleStatus)
|
||||
#define PLAYER (gBattleStatus.playerActor)
|
||||
#define GAME_STATUS (*gGameStatusPtr)
|
||||
#define PLAYER_STATUS (&gPlayerStatus)
|
||||
#define UI_STATUS (&gUIStatus)
|
||||
|
@ -4,54 +4,67 @@
|
||||
MenuIcon* D_802A1E80;
|
||||
void* D_80108A64; // an image
|
||||
|
||||
// TODO
|
||||
#ifdef NON_MATCHING
|
||||
ApiStatus func_802A1000_72F720(ScriptInstance* script, s32 isInitialCall) {
|
||||
MenuIcon *temp_a0;
|
||||
f32 playerTop;
|
||||
s32 sellValue;
|
||||
s32 temp_s0;
|
||||
s32 numCoins;
|
||||
s32 temp_v0;
|
||||
BattleStatus* battleStatus;
|
||||
Actor* player;
|
||||
Actor* player2;
|
||||
s32 sellValue;
|
||||
s32 numCoins;
|
||||
s32 pickupDelay;
|
||||
f32 facingAngleSign;
|
||||
s32 phi_s0;
|
||||
s32 i = 0;
|
||||
s32 phi_s0_2;
|
||||
s32 i;
|
||||
|
||||
f32 posX;
|
||||
f32 posY;
|
||||
f32 posZ;
|
||||
|
||||
s32 iconX;
|
||||
s32 iconY;
|
||||
s32 iconZ;
|
||||
|
||||
BattleStatus* battleStatus = BATTLE_STATUS;
|
||||
|
||||
player = &battleStatus->playerActor;
|
||||
sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
|
||||
playerTop = player->currentPos.y + (f32) player->size.y;
|
||||
|
||||
// If Refund is equipped, the player gets
|
||||
if (heroes_is_ability_active(player, Ability_REFUND)) {
|
||||
if (sellValue > 0) {
|
||||
// 75% of the item's sell value, rounded up
|
||||
numCoins = (sellValue * 75 + 99) / 100;
|
||||
|
||||
if (numCoins > 0) {
|
||||
pickupDelay = 1;
|
||||
i = 0;
|
||||
facingAngleSign = 0.0f;
|
||||
|
||||
for (i = 0; i < numCoins; i++) {
|
||||
make_item_entity(ItemId_COIN, player->currentPos.x, playerTop, player->currentPos.z, 0x17, pickupDelay, facingAngleSign, 0);
|
||||
battleStatus = BATTLE_STATUS;
|
||||
sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
|
||||
posY = battleStatus->playerActor->currentPos.y + battleStatus->playerActor->size.y;
|
||||
|
||||
player = PLAYER;
|
||||
|
||||
// If Refund is equipped, the player gets
|
||||
if (heroes_is_ability_active(battleStatus->playerActor, Ability_REFUND)) {
|
||||
//player2 = player;
|
||||
|
||||
if (sellValue > 0) {
|
||||
// 75% of the item's sell value, rounded up
|
||||
sellValue = (sellValue * 75 + 99) / 100;
|
||||
|
||||
pickupDelay = 1;
|
||||
player2 = player;
|
||||
|
||||
while (i < sellValue) {
|
||||
posX = player2->currentPos.x;
|
||||
posZ = player2->currentPos.z;
|
||||
|
||||
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, pickupDelay, facingAngleSign, 0);
|
||||
add_coins(1);
|
||||
|
||||
pickupDelay += 3;
|
||||
facingAngleSign += 30.0f;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
get_screen_coords(gCurrentCameraID, player->currentPos.x, player->currentPos.y, player->currentPos.z, &iconX, &iconY, &iconZ);
|
||||
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 + 0x24, iconY - 0x3F);
|
||||
i = (i * 2) + i + 0x1E;
|
||||
set_icon_render_pos(D_802A1E80, iconX + 36, iconY - 63);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +72,9 @@ ApiStatus func_802A1000_72F720(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
//INCLUDE_ASM(ApiStatus, "battle/item/coconut", func_802A1000_72F720, ScriptInstance* script, s32 isInitialCall);
|
||||
#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;
|
||||
|
@ -1088,7 +1088,7 @@ s32 is_partner_ability_active(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s16 add_coins(s32 amt) {
|
||||
s32 add_coins(s32 amt) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
s16 newCoins = playerData->coins + amt;
|
||||
|
||||
|
@ -21,8 +21,7 @@ void get_cam_viewport(s32 camID, u16* x, u16* y, u16* width, u16* height) {
|
||||
*y = CAM(camID)->viewportStartY;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(void, "code_8560", get_screen_coords, Cam camID, f32 x, f32 y, f32 z, f32* outX, f32* outY,
|
||||
f32* outZ);
|
||||
INCLUDE_ASM(void, "code_8560", get_screen_coords, Cam camID, f32 x, f32 y, f32 z, f32* outX, f32* outY, f32* outZ);
|
||||
|
||||
s32 func_8002E754(s32 camID, s32 x, s32 y) {
|
||||
s32 startX = CAM(camID)->viewportStartX;
|
||||
|
@ -29,7 +29,7 @@ INCLUDE_ASM(s32, "code_d5a50_len_5fd0", init_menu_icon_list);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", func_801413F8);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", create_icon);
|
||||
INCLUDE_ASM(s32*, "code_d5a50_len_5fd0", create_icon, s32 iconIndex);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", update_menu_icons);
|
||||
|
||||
@ -69,7 +69,7 @@ INCLUDE_ASM(s32, "code_d5a50_len_5fd0", get_menu_icon);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", free_icon);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", set_icon_render_pos);
|
||||
INCLUDE_ASM(void, "code_d5a50_len_5fd0", set_icon_render_pos, s32 iconIndex, s32 posX, s32 posY);
|
||||
|
||||
INCLUDE_ASM(s32, "code_d5a50_len_5fd0", get_icon_render_pos);
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
build_system = "ninja"
|
||||
[preserve_macros]
|
||||
SCRIPT = "void"
|
||||
|
Loading…
Reference in New Issue
Block a user