mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 14:41:38 -04:00
Implement & link m_fuusen
This commit is contained in:
@@ -2,5 +2,6 @@ trim_ctors: true
|
||||
trim_dtors: true
|
||||
symbol_aligns:
|
||||
0x8064d500 : 0x20
|
||||
0x81295C80 : 0x20 # .bss m_handbill.o
|
||||
0x8125a7c0 : 0x20 # construct_skip
|
||||
0x81361820 : 0x20 # S_back_title_timer
|
||||
@@ -45,6 +45,10 @@ m_fbdemo_fade.c:
|
||||
.text: [0x803A12F8, 0x803A1508]
|
||||
.rodata: [0x80641FC0, 0x80641FD8]
|
||||
.data: [0x80653558, 0x806535A0]
|
||||
m_fuusen.c:
|
||||
.text: [0x803B15E0, 0x803B1908]
|
||||
.rodata: [0x80642258, 0x80642288]
|
||||
.bss: [0x81295C70, 0x81295C80]
|
||||
m_huusui_room.c:
|
||||
.text: [0x803B1908, 0x803B1968]
|
||||
m_home.c:
|
||||
|
||||
@@ -2,13 +2,31 @@
|
||||
#define M_FUUSEN_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_play_h.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
Balloon_STATE_DEAD, /* Doesn't exist */
|
||||
Balloon_STATE_CHK_SPAWN, /* Check should spawn */
|
||||
Balloon_STATE_SPAWNED, /* Sucessfully spawned */
|
||||
Balloon_STATE_LOOK_UP, /* Flew away after hitting a tree? */
|
||||
Balloon_STATE_PENDING_SPAWN, /* Didn't successfully spawn, trying again */
|
||||
|
||||
Balloon_STATE_NUM
|
||||
};
|
||||
|
||||
extern int fuusen_DEBUG_mode_flag;
|
||||
|
||||
extern void Balloon_init();
|
||||
extern void Balloon_make_fuusen(GAME_PLAY* play);
|
||||
extern void Balloon_chk_make_fuusen(GAME_PLAY* play);
|
||||
extern void Balloon_move(GAME_PLAY* play);
|
||||
extern void Balloon_kill();
|
||||
extern void Balloon_look_up();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,10 @@ extern "C" {
|
||||
#define mPr_FLAG_POSTOFFICE_GIFT2 (1 << 4) // 100,000,000 Bells
|
||||
#define mPr_FLAG_POSTOFFICE_GIFT3 (1 << 5) // 999,999,999 Bells
|
||||
|
||||
#define mPr_MONEY_POWER_MIN -80
|
||||
|
||||
#define mPr_GOODS_POWER_MIN -30
|
||||
#define mPr_GOODS_POWER_MAX 50
|
||||
|
||||
enum {
|
||||
mPr_PLAYER_0,
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "m_fuusen.h"
|
||||
|
||||
#include "m_name_table.h"
|
||||
#include "m_play.h"
|
||||
#include "m_field_assessment.h"
|
||||
#include "m_private.h"
|
||||
#include "m_event.h"
|
||||
#include "m_common_data.h"
|
||||
|
||||
int fuusen_DEBUG_mode_flag;
|
||||
|
||||
extern void Balloon_init() {
|
||||
Common_Set(balloon_state, Balloon_STATE_DEAD);
|
||||
Common_Set(balloon_last_spawn_min, 0);
|
||||
Common_Set(balloon_spawn_percent, 0.05f);
|
||||
}
|
||||
|
||||
extern void Balloon_make_fuusen(GAME_PLAY* play) {
|
||||
ACTOR* balloon_actor = Actor_info_make_actor(&play->actor_info, (GAME*)play, mAc_PROFILE_FUUSEN, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, EMPTY_NO, 0, -1, -1);
|
||||
if (balloon_actor != NULL) {
|
||||
Common_Set(balloon_state, Balloon_STATE_SPAWNED);
|
||||
Common_Set(balloon_spawn_percent, (1.0f - Common_Get(balloon_spawn_percent)) * 0.1f);
|
||||
fuusen_DEBUG_mode_flag = TRUE;
|
||||
}
|
||||
else {
|
||||
Common_Set(balloon_state, Balloon_STATE_PENDING_SPAWN);
|
||||
}
|
||||
}
|
||||
|
||||
extern void Balloon_chk_make_fuusen(GAME_PLAY* play) {
|
||||
f32 rng = fqrand();
|
||||
f32 spawn_percent = Common_Get(balloon_spawn_percent);
|
||||
|
||||
if (rng < spawn_percent) {
|
||||
Balloon_make_fuusen(play);
|
||||
}
|
||||
else {
|
||||
f32 goods_power_mod;
|
||||
f32 field_rank_mod;
|
||||
f32 balloon_spawn_percentage_inc;
|
||||
|
||||
field_rank_mod = (f32)mFAs_GetFieldRank() / (f32)mFAs_FIELDRANK_SIX;
|
||||
goods_power_mod = (f32)mPr_GetGoodsPower() / (f32)mPr_GOODS_POWER_MAX;
|
||||
balloon_spawn_percentage_inc = 0.025f + goods_power_mod * 0.025f + field_rank_mod * 0.025f + RANDOM_F(0.025f);
|
||||
|
||||
Common_Get(balloon_spawn_percent) += balloon_spawn_percentage_inc;
|
||||
}
|
||||
}
|
||||
|
||||
extern void Balloon_move(GAME_PLAY* play) {
|
||||
s16 min;
|
||||
|
||||
if (mFI_GET_TYPE(mFI_GetFieldId()) != mFI_FIELDTYPE_FG) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEv_CheckFirstIntro()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Common_Get(balloon_state)) {
|
||||
case Balloon_STATE_DEAD:
|
||||
case Balloon_STATE_CHK_SPAWN:
|
||||
case Balloon_STATE_LOOK_UP:
|
||||
break;
|
||||
|
||||
case Balloon_STATE_PENDING_SPAWN:
|
||||
Balloon_make_fuusen(play);
|
||||
/* Fallthrough */
|
||||
case Balloon_STATE_SPAWNED:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
min = Common_Get(time.rtc_time.min);
|
||||
if ((min % 5) == 3 && min != Common_Get(balloon_last_spawn_min)) {
|
||||
Common_Set(balloon_last_spawn_min, min);
|
||||
|
||||
if (Common_Get(balloon_state) == Balloon_STATE_LOOK_UP) {
|
||||
Common_Get(balloon_spawn_percent) += 0.25f;
|
||||
}
|
||||
|
||||
Common_Set(balloon_state, Balloon_STATE_CHK_SPAWN);
|
||||
Balloon_chk_make_fuusen(play);
|
||||
}
|
||||
}
|
||||
|
||||
extern void Balloon_kill() {
|
||||
Common_Set(balloon_state, Balloon_STATE_DEAD);
|
||||
}
|
||||
|
||||
extern void Balloon_look_up() {
|
||||
Common_Set(balloon_state, Balloon_STATE_LOOK_UP);
|
||||
}
|
||||
+6
-6
@@ -694,8 +694,8 @@ extern s16 mPr_GetMoneyPower() {
|
||||
}
|
||||
}
|
||||
|
||||
if (money_power < -80) {
|
||||
money_power = -80;
|
||||
if (money_power < mPr_MONEY_POWER_MIN) {
|
||||
money_power = mPr_MONEY_POWER_MIN;
|
||||
}
|
||||
|
||||
return money_power;
|
||||
@@ -721,12 +721,12 @@ extern s16 mPr_GetGoodsPower() {
|
||||
}
|
||||
}
|
||||
|
||||
if (goods_power > 50) {
|
||||
return 50;
|
||||
if (goods_power > mPr_GOODS_POWER_MAX) {
|
||||
return mPr_GOODS_POWER_MAX;
|
||||
}
|
||||
|
||||
if (goods_power < -30) {
|
||||
goods_power = -30;
|
||||
if (goods_power < mPr_GOODS_POWER_MIN) {
|
||||
goods_power = mPr_GOODS_POWER_MIN;
|
||||
}
|
||||
|
||||
return goods_power;
|
||||
|
||||
Reference in New Issue
Block a user