diff --git a/include/m_event.h b/include/m_event.h index 18051ae8..8dd65041 100644 --- a/include/m_event.h +++ b/include/m_event.h @@ -52,6 +52,20 @@ extern "C" { #define mEv_TO_DAY(month_day) ((lbRTC_day_t)(month_day)) #define mEv_TO_MONTH(month_day) ((lbRTC_month_t)((month_day) >> 8)) +enum { + mEv_TITLEDEMO_STAFFROLL = -9, + mEv_TITLEDEMO_LOGO = -1, + + mEv_TITLEDEMO_NONE = 0, + mEv_TITLEDEMO_START1, + mEv_TITLEDEMO_START2, + mEv_TITLEDEMO_START3, + mEv_TITLEDEMO_START4, + mEv_TITLEDEMO_START5, + + mEv_TITLEDEMO_NUM +}; + typedef union event_monthday_s { struct { u8 month; @@ -632,6 +646,8 @@ extern void mEv_SetGateway(); extern int mEv_CheckGateway(); extern void mEv_UnSetGateway(); extern int mEv_CheckTitleDemo(); +#define mEv_IsTitleDemo() (mEv_CheckTitleDemo() > mEv_TITLEDEMO_NONE) +#define mEv_IsNotTitleDemo() (!mEv_IsTitleDemo()) extern void mEv_SetTitleDemo(int demo_number); extern void mEv_RenewalDataEveryDay(); extern void mEv_GetEventWeather(s16* weather, s16* intensity); diff --git a/src/actor/ac_animal_logo.c b/src/actor/ac_animal_logo.c index 328bed63..ec5ef18d 100644 --- a/src/actor/ac_animal_logo.c +++ b/src/actor/ac_animal_logo.c @@ -110,8 +110,8 @@ static void aAL_actor_dt(ACTOR* actor, GAME* game) { Common_Set(clip.animal_logo_clip, NULL); } - if (mEv_CheckTitleDemo() != -1) { - mEv_SetTitleDemo(0); + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_LOGO) { + mEv_SetTitleDemo(mEv_TITLEDEMO_NONE); } cKF_SkeletonInfo_R_dt(&logo_actor->animal.skeleton); diff --git a/src/actor/ac_douzou_move.c_inc b/src/actor/ac_douzou_move.c_inc index 175f5d24..0631f4c4 100644 --- a/src/actor/ac_douzou_move.c_inc +++ b/src/actor/ac_douzou_move.c_inc @@ -18,7 +18,7 @@ static int aDOU_set_check(int house_no) { Private_c* priv = Save_GetPointer(private_data[player_no]); mHm_hs_c* house = Save_GetPointer(homes[house_no]); - if (mEv_CheckTitleDemo() != 0 && mEv_CheckTitleDemo() != -1 && mEv_CheckTitleDemo() != -9) { + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_NONE && mEv_CheckTitleDemo() != mEv_TITLEDEMO_LOGO && mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) { return FALSE; } else if (mLd_PlayerManKindCheckNo(player_no) || mPr_CheckPrivate(priv) == FALSE) { return FALSE; diff --git a/src/actor/ac_quest_manager.c b/src/actor/ac_quest_manager.c index 218a1ef0..518167c8 100644 --- a/src/actor/ac_quest_manager.c +++ b/src/actor/ac_quest_manager.c @@ -1360,7 +1360,7 @@ static void aQMgr_actor_move_main(ACTOR* actorx, GAME* game) { u8 mode = *manager->mode; - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { (*move_proc[mode])(manager); } diff --git a/src/actor/ac_train0_move.c_inc b/src/actor/ac_train0_move.c_inc index b05e10c8..c99ac36d 100644 --- a/src/actor/ac_train0_move.c_inc +++ b/src/actor/ac_train0_move.c_inc @@ -33,7 +33,7 @@ static void aTR0_set_effect(ACTOR* actor, GAME* game) { pos.x += 36.0f; pos.y += 110.0f; - if (mEv_CheckTitleDemo() == 0) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE) { eEC_CLIP->effect_make_proc(eEC_EFFECT_KISHA_KEMURI, pos, 1, 0, game, train0->actor_class.npc_id, 0, 0); } } else { @@ -52,7 +52,7 @@ static void aTR0_steam_work_sub(ACTOR* actor, GAME* game, int x_idx) { pos.y = train0->actor_class.world.position.y + 21.0f; pos.z = train0->actor_class.world.position.z + 42.0f; unk2c0 = train0->arg2; - if (mEv_CheckTitleDemo() == 0) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE) { (*Common_Get(clip.effect_clip)->effect_make_proc)(eEC_EFFECT_STEAM, pos, 1, angl[x_idx], game, train0->actor_class.npc_id, 0, 0); } @@ -177,7 +177,7 @@ static void aTR0_actor_move(ACTOR* actor, GAME* game) { aTR0_steam_work(actor, game); } - if (mEv_CheckTitleDemo() == 1) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_START1) { train0->arg0_f = -125.0f + train0->actor_class.world.position.x; } else { aTR0_ctrl_back_car(actor); diff --git a/src/actor/ac_train1_move.c_inc b/src/actor/ac_train1_move.c_inc index 73bfdfc2..d5d960dc 100644 --- a/src/actor/ac_train1_move.c_inc +++ b/src/actor/ac_train1_move.c_inc @@ -112,7 +112,7 @@ static void aTR1_setupAction(TRAIN1_ACTOR* train1, int action) { train1->action = action; if ((train1->action == 6) || (train1->action == 4)) { - if ((mEv_CheckTitleDemo() == 0) && (tr_speed != train1->arg0_f)) { + if ((mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE) && (tr_speed != train1->arg0_f)) { aTR1_OngenTrgStart((ACTOR*)train1, 43); } else { tr_speed = end; @@ -129,7 +129,7 @@ static void aTR1_actor_move(ACTOR* actor, GAME* game) { cKF_SkeletonInfo_R_c* keyframe = &train1->keyframe; train1->keyframe_state = cKF_SkeletonInfo_R_play(keyframe); - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { aTR1_position_move((ACTOR*)train1); } aTR1_passenger_ctrl((ACTOR*)train1); diff --git a/src/actor/ac_uki_draw.c_inc b/src/actor/ac_uki_draw.c_inc index 501f8fdc..0820a3be 100644 --- a/src/actor/ac_uki_draw.c_inc +++ b/src/actor/ac_uki_draw.c_inc @@ -74,7 +74,7 @@ static void aUKI_actor_draw(ACTOR* actorx, GAME* game) { gSPMatrix(POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, uki->color[0], uki->color[1], uki->color[2], 255); - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { item = mPlib_Get_controller_data_for_title_demo_p()->equipped_item; } else { item = Now_Private->equipment; diff --git a/src/actor/ac_weather.c b/src/actor/ac_weather.c index 5dd71c4c..0388e980 100644 --- a/src/actor/ac_weather.c +++ b/src/actor/ac_weather.c @@ -250,7 +250,7 @@ static void aWeather_ChangeEnvSE(ACTOR* actorx, GAME* game, s16 status, s16 leve weather->current_sound_effect = -1000; } - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { if (Save_Get(scene_no) == SCENE_START_DEMO || Save_Get(scene_no) == SCENE_START_DEMO2 || Save_Get(scene_no) == SCENE_START_DEMO3) { return; @@ -383,14 +383,14 @@ static void Weather_Actor_ct(ACTOR* actor, GAME* game) { aWeather_SetClip(actor, 0); - if (mEv_CheckTitleDemo() > 0) { - cur = mEv_CheckTitleDemo() - 1; + if (mEv_IsTitleDemo()) { + cur = mEv_CheckTitleDemo() - mEv_TITLEDEMO_START1; weather->current_status = DemoWeatherTbl[cur][0]; weather->next_status = DemoWeatherTbl[cur][0]; weather->current_level = DemoWeatherTbl[cur][1]; weather->current_aim_level = DemoWeatherTbl[cur][1]; - } else if (mFI_GetClimate() == 1) { + } else if (mFI_GetClimate() == mFI_CLIMATE_ISLAND) { weather->current_status = Common_Get(island_weather); weather->next_status = Common_Get(island_weather); weather->current_level = Common_Get(island_weather_intensity); @@ -595,7 +595,7 @@ static void aWeather_ChangeWeatherTime0(ACTOR* actorx) { s16 evWeather, evIntensity; s16 save_weather; - if ((mEv_CheckTitleDemo() <= 0)) { + if (mEv_IsNotTitleDemo()) { if ((Save_Get(scene_no) == SCENE_START_DEMO) || (Save_Get(scene_no) == SCENE_START_DEMO2) || Save_Get(scene_no) == SCENE_START_DEMO3) { return; @@ -607,21 +607,21 @@ static void aWeather_ChangeWeatherTime0(ACTOR* actorx) { rndWeather = evWeather; rndIntensity = evIntensity; } - if ((mEv_CheckRealArbeit() == 1) && (rndWeather == 1)) { - rndWeather = 0; - rndIntensity = 0; + if ((mEv_CheckRealArbeit() == TRUE) && (rndWeather == mEnv_WEATHER_RAIN)) { + rndWeather = mEnv_WEATHER_CLEAR; + rndIntensity = mEnv_WEATHER_INTENSITY_NONE; } mTM_off_renew_time(0); save_weather = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)); - if (rndWeather == 0 || rndWeather == 3) { - if (save_weather == 2 || save_weather == 1) { + if (rndWeather == mEnv_WEATHER_CLEAR || rndWeather == mEnv_WEATHER_SAKURA) { + if (save_weather == mEnv_WEATHER_SNOW || save_weather == mEnv_WEATHER_RAIN) { mEnv_PreRainNowFine_Init(); } } Save_Set(weather, rndIntensity | (rndWeather * 16)); - if (((mEv_CheckTitleDemo() != -9) || (weather->sound_flag != 1)) && (mFI_CheckInIsland() == 0)) { + if (((mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) || (weather->sound_flag != 1)) && (mFI_CheckInIsland() == 0)) { aWeather_RequestChangeWeather(actorx, rndWeather, rndIntensity); } Common_Set(weather_time, Common_Get(time.rtc_time)); diff --git a/src/actor/ac_weather_rain.c b/src/actor/ac_weather_rain.c index 38c1b2ea..942993cf 100644 --- a/src/actor/ac_weather_rain.c +++ b/src/actor/ac_weather_rain.c @@ -74,7 +74,7 @@ static void aWeatherRain_make(ACTOR* actor, GAME* game) { pos_mod.x += x; pos_mod.z += z; - if (mEv_CheckTitleDemo() == -9) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_STAFFROLL) { PLAYER_ACTOR* player = get_player_actor_withoutCheck(play); pos_mod.y = 70.0f + (120.0f + player->actor_class.world.position.y); @@ -108,7 +108,7 @@ static void aWeatherRain_MakePicha(ACTOR* actor, GAME* game, xyz_t pos) { f32 y; if (priv_num != -1) { - if (mEv_CheckTitleDemo() == -9) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_STAFFROLL) { PLAYER_ACTOR* player = get_player_actor_withoutCheck(play); y = player->actor_class.world.position.y; diff --git a/src/actor/npc/ac_npc_ct.c_inc b/src/actor/npc/ac_npc_ct.c_inc index 472fd3bf..77ffc7cc 100644 --- a/src/actor/npc/ac_npc_ct.c_inc +++ b/src/actor/npc/ac_npc_ct.c_inc @@ -343,7 +343,7 @@ static void aNPC_actor_ct(ACTOR* actorx, GAME* game, aNPC_ct_data_c* ct_data) { nactorx->draw.frame_sub_speed = 1.0f; - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { actorx->status_data.weight = 0; } diff --git a/src/actor/npc/ac_npc_ctrl.c_inc b/src/actor/npc/ac_npc_ctrl.c_inc index b5a62cf7..7ad2a76a 100644 --- a/src/actor/npc/ac_npc_ctrl.c_inc +++ b/src/actor/npc/ac_npc_ctrl.c_inc @@ -1046,7 +1046,7 @@ static void aNPC_actor_move_c(ACTOR* actorx, GAME* game) { GAME_PLAY* play = (GAME_PLAY*)game; aNPC_dma_cloth_data(actorx); - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { aNPC_greeting_area_check(play); } diff --git a/src/actor/npc/ac_npc_save.c_inc b/src/actor/npc/ac_npc_save.c_inc index ffcc6a4c..7eca7dd4 100644 --- a/src/actor/npc/ac_npc_save.c_inc +++ b/src/actor/npc/ac_npc_save.c_inc @@ -72,7 +72,7 @@ static void aNPC_actor_save_for_special(ACTOR* actorx) { static void aNPC_actor_save(ACTOR* actorx, GAME* game) { NPC_ACTOR* nactorx = (NPC_ACTOR*)actorx; - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { if (ITEM_NAME_GET_TYPE(actorx->npc_id) == NAME_TYPE_NPC) { aNPC_actor_save_for_normal(actorx); } else { diff --git a/src/actor/npc/ac_npc_station_master_schedule.c_inc b/src/actor/npc/ac_npc_station_master_schedule.c_inc index 075708b0..70929b2d 100644 --- a/src/actor/npc/ac_npc_station_master_schedule.c_inc +++ b/src/actor/npc/ac_npc_station_master_schedule.c_inc @@ -280,7 +280,7 @@ static void aSTM_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { } else if (mEv_CheckFirstJob() == TRUE) { think_idx = aSTM_THINK_5; } else { - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { actorx->world.position.x += mFI_UT_WORLDSIZE_X_F; } diff --git a/src/actor/npc/ac_npc_talk.c_inc b/src/actor/npc/ac_npc_talk.c_inc index cea83d9b..3e0aaa37 100644 --- a/src/actor/npc/ac_npc_talk.c_inc +++ b/src/actor/npc/ac_npc_talk.c_inc @@ -646,7 +646,7 @@ static void aNPC_talk_request_check(ACTOR* actorx, GAME* game) { if ((nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_TALK_CHECK) == 0 && nactorx->condition_info.talk_condition == aNPC_TALK_TYPE_NONE && !nactorx->condition_info.hide_flg) { - if (mEv_CheckTitleDemo() == 0 || mEv_CheckTitleDemo() == -9) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE || mEv_CheckTitleDemo() == mEv_TITLEDEMO_STAFFROLL) { if (nactorx->action.idx != aNPC_ACT_TALK) { #ifndef aNPC_NPC2 if (ITEM_NAME_GET_TYPE(actorx->npc_id) == NAME_TYPE_SPNPC && diff --git a/src/actor/npc/ac_npc_think.c_inc b/src/actor/npc/ac_npc_think.c_inc index f0ffc514..2459640a 100644 --- a/src/actor/npc/ac_npc_think.c_inc +++ b/src/actor/npc/ac_npc_think.c_inc @@ -45,7 +45,7 @@ static int aNPC_check_uzai(NPC_ACTOR* nactorx, GAME_PLAY* play) { // clang-format on int ret = FALSE; - if (mEv_CheckTitleDemo() > 0 || (nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_UZAI_CHECK)) { + if (mEv_IsTitleDemo() || (nactorx->condition_info.demo_flg & aNPC_COND_DEMO_SKIP_UZAI_CHECK)) { nactorx->uzai.flag = 0; return FALSE; } diff --git a/src/actor/npc/ac_npc_totakeke_talk.c_inc b/src/actor/npc/ac_npc_totakeke_talk.c_inc index ab7daa81..2aa6a479 100644 --- a/src/actor/npc/ac_npc_totakeke_talk.c_inc +++ b/src/actor/npc/ac_npc_totakeke_talk.c_inc @@ -156,8 +156,8 @@ static int aNTT_change_talk_proc(NPC_TOTAKEKE_ACTOR* totakeke, int talk) { aNTT_talk_submenu, aNTT_talk_submenu2, aNTT_talk_give }; totakeke->proc = proc[talk]; if (talk == aNTT_TALK_STOP_PLAYER) { - mEv_SetTitleDemo(-0x9); - mDemo_Set_talk_return_demo_wait(0x1); + mEv_SetTitleDemo(mEv_TITLEDEMO_STAFFROLL); + mDemo_Set_talk_return_demo_wait(TRUE); totakeke->_9ab = FALSE; } return TRUE; @@ -227,7 +227,7 @@ static int aNTT_talk_init(ACTOR* actorx, GAME* game) { case aNTT_THINK_GIVE_MERODY: case aNTT_THINK_POCKETS_FULL: case aNTT_THINK_GIVE_LATER: - mEv_SetTitleDemo(0); + mEv_SetTitleDemo(mEv_TITLEDEMO_NONE); break; } return TRUE; diff --git a/src/effect/ef_anahikari.c b/src/effect/ef_anahikari.c index 688f8017..500461db 100644 --- a/src/effect/ef_anahikari.c +++ b/src/effect/ef_anahikari.c @@ -50,7 +50,7 @@ static void eAnahikari_dw(eEC_Effect_c* effect, GAME* game) { idx = effect->arg0; play = (GAME_PLAY*)game; - if (mEv_CheckTitleDemo() != -9) { + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) { if (effect->state == eEC_STATE_NORMAL) { alpha = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 60, 200.0f, 0.0f); } else if (effect->state == eEC_STATE_FINISHED) { diff --git a/src/effect/ef_hanabi_switch.c b/src/effect/ef_hanabi_switch.c index 29823985..de994750 100644 --- a/src/effect/ef_hanabi_switch.c +++ b/src/effect/ef_hanabi_switch.c @@ -47,7 +47,7 @@ static void eHanabiSwitch_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) { static void eHanabiSwitch_mv(eEC_Effect_c* effect, GAME* game) { eEC_CLIP->set_continious_env_proc(effect, 300, 300); - if (mEv_CheckTitleDemo() != -9) { + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) { s16 alive_frames; if (effect->state == 0) { alive_frames = EFFECT_LIFETIME - effect->timer; diff --git a/src/effect/ef_shooting_set.c b/src/effect/ef_shooting_set.c index f92ba309..123c0f06 100644 --- a/src/effect/ef_shooting_set.c +++ b/src/effect/ef_shooting_set.c @@ -86,7 +86,7 @@ static void eShootingSet_mv(eEC_Effect_c* effect, GAME* game) { eEC_CLIP->set_continious_env_proc(effect, 100, 100); - if (mEv_CheckTitleDemo() != -9) { + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) { if (effect->effect_specific[0] >= effect->effect_specific[1]) { effect->effect_specific[0] = 0; effect->effect_specific[1] = eShootingSet_GetFrame_MakeNextShooting(); diff --git a/src/game/m_banti.c b/src/game/m_banti.c index 6c8df602..5b8766ef 100644 --- a/src/game/m_banti.c +++ b/src/game/m_banti.c @@ -116,7 +116,7 @@ static void banti_chk_disp_left(GAME_PLAY* play) { } static f32 banti_calc_disp_alpha_rate(GAME_PLAY* play) { - if (mDemo_CheckDemo() || mEv_CheckTitleDemo() > 0 || banti.disabled) { + if (mDemo_CheckDemo() || mEv_IsTitleDemo() || banti.disabled) { banti.addressable_type = mPlayer_ADDRESSABLE_FALSE_MOVEMENT; add_calc(&banti.alpha, 0.0f, 1.0f - sqrtf(0.8), 0.1f, 0.005f); /* quickly fade out on demo screen or title or force disabled */ diff --git a/src/game/m_bgm.c b/src/game/m_bgm.c index 4a2701a5..54c79715 100644 --- a/src/game/m_bgm.c +++ b/src/game/m_bgm.c @@ -661,7 +661,7 @@ static void mBGMRoom_ct(mBGMRoom* room) { static void mBGMTime_signal_melody(mBGMTime* time, GAME* game) { static u8 signal_melody_buf[mMld_MELODY_LEN]; - if (mEv_CheckFirstIntro() == FALSE && mEv_CheckTitleDemo() != -9 && mFI_CheckFieldData() && + if (mEv_CheckFirstIntro() == FALSE && mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL && mFI_CheckFieldData() && mFI_GET_TYPE(mFI_GetFieldId()) != mFI_FIELD_DEMO_STARTDEMO && time->new_year_ev_flag == FALSE && mPlib_get_player_actor_main_index(game) != mPlayer_INDEX_DEMO_GETON_BOAT && mPlib_get_player_actor_main_index(game) != mPlayer_INDEX_DEMO_GETON_BOAT_SITDOWN && @@ -2564,7 +2564,7 @@ extern void mBGM_init() { mBGMForce* force = &M_bgm.force; if (field_type == mFI_FIELD_FG) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { mBGMPsComp_make_ps_demo(70, 0x168); // Play title music } else { if ((force->inform != mBGMForce_INFORM_3 && force->inform != mBGMForce_INFORM_7) || force->flag) { @@ -2596,7 +2596,7 @@ extern void mBGM_cleanup() { mActor_name_t field_type = mFI_GET_TYPE(field_id); if (field_type == mFI_FIELD_FG) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { mBGMPsComp_delete_ps_demo(70, 0x168); // Stop title music } else { if ((force->inform != mBGMForce_INFORM_3 && force->inform != mBGMForce_INFORM_7) || force->flag) { diff --git a/src/game/m_controller.c b/src/game/m_controller.c index 9c1cb8a7..10f25f82 100644 --- a/src/game/m_controller.c +++ b/src/game/m_controller.c @@ -84,7 +84,7 @@ extern void mCon_main(GAME* game) { * @return TRUE when the button combination is pressed, FALSE otherwise **/ extern int chkButton(u16 mask) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return FALSE; } @@ -97,7 +97,7 @@ extern int chkButton(u16 mask) { * @return Pressed buttons **/ extern u16 getButton() { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return BUTTON_NONE; } @@ -111,7 +111,7 @@ extern u16 getButton() { * @return TRUE when the button combination was pressed this frame, FALSE otherwise **/ extern int chkTrigger(u16 mask) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return FALSE; } @@ -124,7 +124,7 @@ extern int chkTrigger(u16 mask) { * @return Buttons pressed on the current frame **/ extern u16 getTrigger() { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return BUTTON_NONE; } @@ -137,7 +137,7 @@ extern u16 getTrigger() { * @return Joystick X position **/ extern int getJoystick_X() { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return 0; } @@ -150,7 +150,7 @@ extern int getJoystick_X() { * @return Joystick Y position **/ extern int getJoystick_Y() { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return 0; } diff --git a/src/game/m_demo.c b/src/game/m_demo.c index 374c18bf..44ca070a 100644 --- a/src/game/m_demo.c +++ b/src/game/m_demo.c @@ -816,8 +816,8 @@ static int choice_demo_sub() { mDemo_Request_c* request = &demo->request[i]; int type = request->type; - if (((mEv_CheckTitleDemo() == 0 || type == mDemo_TYPE_SCROLL || - (mEv_CheckTitleDemo() == -9 && type == mDemo_TYPE_SPEAK && request->actor != NULL && + if (((mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE || type == mDemo_TYPE_SCROLL || + (mEv_CheckTitleDemo() == mEv_TITLEDEMO_STAFFROLL && type == mDemo_TYPE_SPEAK && request->actor != NULL && request->actor->id == mAc_PROFILE_NPC_TOTAKEKE)) && (demo->request_save.type != mDemo_TYPE_NONE || type >= demo->priority_type)) && (*check_func[type])() != FALSE) { diff --git a/src/game/m_event.c b/src/game/m_event.c index 46e1dafe..0afe6406 100644 --- a/src/game/m_event.c +++ b/src/game/m_event.c @@ -255,7 +255,7 @@ extern void mEv_UnSetGateway() { } } -static int title_demo_number = -1; +static int title_demo_number = mEv_TITLEDEMO_LOGO; extern int mEv_CheckTitleDemo() { return title_demo_number; @@ -1895,7 +1895,7 @@ static void init_event(Event_c* event, int renewal_flag) { extern void mEv_init(Event_c* event) { int renewal_flag = mEv_INIT_NO_RENEWAL; - if (mEv_CheckTitleDemo() == 0 && effective_scene()) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE && effective_scene()) { renewal_flag = mEv_INIT_RENEWAL; } @@ -1905,7 +1905,7 @@ extern void mEv_init(Event_c* event) { extern void mEv_init_force(Event_c* event) { int renewal_flag = mEv_INIT_NO_RENEWAL; - if (mEv_CheckTitleDemo() == 0) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE) { renewal_flag = mEv_INIT_FORCE_RENEWAL; } @@ -1940,7 +1940,7 @@ extern int mEv_PlayerOK() { extern void mEv_run(Event_c* event) { status_edge = 0; - if (mEv_CheckTitleDemo() == 0) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE) { if (Save_Get(scene_no) == SCENE_START_DEMO || Save_Get(scene_no) == SCENE_START_DEMO2 || Save_Get(scene_no) == SCENE_START_DEMO3 || Save_Get(scene_no) == SCENE_PLAYERSELECT || Save_Get(scene_no) == SCENE_PLAYERSELECT_2 || Save_Get(scene_no) == SCENE_PLAYERSELECT_3 || @@ -2537,7 +2537,7 @@ extern int mEv_LiveSonchoPresent() { } extern int mEv_LivePlayer(u32 player_no) { - if (mEv_CheckTitleDemo() != 0) { + if (mEv_CheckTitleDemo() != mEv_TITLEDEMO_NONE) { return FALSE; } @@ -2660,7 +2660,7 @@ extern void mEv_sp_debug_print4f(gfxprint_t* gfxprint) { ); gfxprint_locate8x8(gfxprint, 30, 11); - gfxprint_printf(gfxprint, "%c%c%c%c%c%c%c%c", mEv_CheckTitleDemo() ? 'T' : '.', mEv_CheckFirstIntro() ? 'F' : '.', + gfxprint_printf(gfxprint, "%c%c%c%c%c%c%c%c", mEv_CheckTitleDemo() != mEv_TITLEDEMO_NONE ? 'T' : '.', mEv_CheckFirstIntro() ? 'F' : '.', mEv_CheckGateway() ? 'G' : '.', mEv_CheckRealArbeit() ? 'R' : '.', mEv_CheckArbeit() ? 'A' : '.', mDemo_CheckDemo() ? 'D' : '.', !mEv_PlayerOK() ? 'P' : '.', !mEv_LivePlayer(Common_Get(player_no)) ? 'L' : '.'); diff --git a/src/game/m_kankyo.c b/src/game/m_kankyo.c index a4f64953..fd9c79e6 100644 --- a/src/game/m_kankyo.c +++ b/src/game/m_kankyo.c @@ -1295,7 +1295,7 @@ static void mEnv_RoomTypeLightSet(GAME* game, Kankyo* kankyo) { } static void mEnv_rainbow_check_set() { - if (mFI_CheckFieldData() != FALSE && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_FIELD_FG && mEv_CheckTitleDemo() <= 0) { + if (mFI_CheckFieldData() != FALSE && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_FIELD_FG && mEv_IsNotTitleDemo()) { if (Save_Get(rainbow_reserved)) { if (Common_Get(time).rtc_time.month == Save_Get(rainbow_month) && Common_Get(time).rtc_time.day == Save_Get(rainbow_day)) { @@ -2159,7 +2159,7 @@ static void mEnv_JudgeSwitchStatus() { static void mEnv_rainbow_power_calc() { if (Save_Get(rainbow_reserved) && mFI_CheckFieldData() && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_FIELD_FG && - mEv_CheckTitleDemo() <= 0 && Common_Get(time.rtc_time).month == Save_Get(rainbow_month) && + mEv_IsNotTitleDemo() && Common_Get(time.rtc_time).month == Save_Get(rainbow_month) && Common_Get(time.rtc_time).day == Save_Get(rainbow_day) && Common_Get(time).now_sec >= mEnv_RAINBOW_TIME_START && Common_Get(time).now_sec < mEnv_RAINBOW_TIME_END && Common_Get(time).season == mTM_SEASON_SUMMER) { if (chase_f(Common_GetPointer(rainbow_opacity), 1.0f, (1.0f / 1800.0f)) != FALSE) { diff --git a/src/game/m_kankyo_weather.c_inc b/src/game/m_kankyo_weather.c_inc index f102be81..0b9498d6 100644 --- a/src/game/m_kankyo_weather.c_inc +++ b/src/game/m_kankyo_weather.c_inc @@ -535,14 +535,14 @@ extern void mEnv_DecideWeather_NormalGameStart() { extern int mEnv_NowWeather() { switch (mEv_CheckTitleDemo()) { - case 1: + case mEv_TITLEDEMO_START1: return mEnv_WEATHER_SAKURA; - case 2: + case mEv_TITLEDEMO_START2: return mEnv_WEATHER_RAIN; - case 3: - case 4: + case mEv_TITLEDEMO_START3: + case mEv_TITLEDEMO_START4: return mEnv_WEATHER_CLEAR; - case 5: + case mEv_TITLEDEMO_START5: return mEnv_WEATHER_SNOW; } diff --git a/src/game/m_notice.c b/src/game/m_notice.c index 6c4836af..d3dd50a5 100644 --- a/src/game/m_notice.c +++ b/src/game/m_notice.c @@ -655,7 +655,7 @@ extern void mNtc_set_auto_nwrite_data() { lbRTC_year_t set_nwrite_years[mNtc_NWRITE_NUM]; int write_count; - if (mEv_CheckTitleDemo() == FALSE && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_TYPE(mFI_FIELDTYPE_FG)) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_NONE && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_TYPE(mFI_FIELDTYPE_FG)) { int fishing_day; now_nwrite_year = Common_Get(auto_nwrite_year); if (now_nwrite_year != 0) { diff --git a/src/game/m_play.c b/src/game/m_play.c index f435da7d..9bd66cc1 100644 --- a/src/game/m_play.c +++ b/src/game/m_play.c @@ -779,8 +779,21 @@ static void draw_version(GRAPH* graph) { static void Game_play_draw(GAME_PLAY* play) { GRAPH* graph = play->game.graph; + u8 fill_r = 0; + u8 fill_g = 0; + u8 fill_b = 0; - DisplayList_initialize(graph, 0, 0, 0, &play->game); + // @BUG - when removing display list segment function present in N64, the devs went slightly too far + // and removed setting the background fill color while in the main field area. +#ifdef BUGFIXES + if (Common_Get(field_type) == mFI_FIELDTYPE2_FG && mEv_CheckTitleDemo() != mEv_TITLEDEMO_STAFFROLL) { + fill_r = play->kankyo.base_light.background_color[0]; + fill_g = play->kankyo.base_light.background_color[1]; + fill_b = play->kankyo.base_light.background_color[2]; + } +#endif + + DisplayList_initialize(graph, fill_r, fill_g, fill_b, &play->game); if ((GETREG(HREG, 80) != 10) || (GETREG(HREG, 82) != 0)) { setupFog(play, graph); @@ -795,13 +808,13 @@ static void Game_play_draw(GAME_PLAY* play) { } if (zurumode_flag != 0) { switch (mEv_CheckTitleDemo()) { - case -9: - case -1: + case mEv_TITLEDEMO_STAFFROLL: + case mEv_TITLEDEMO_LOGO: default: draw_version(graph); break; - case 0: + case mEv_TITLEDEMO_NONE: break; } } diff --git a/src/game/m_player.c b/src/game/m_player.c index 5c01cbfe..07f3a28c 100644 --- a/src/game/m_player.c +++ b/src/game/m_player.c @@ -621,7 +621,7 @@ static void Player_actor_init_value(ACTOR* actorx, GAME* game) { extern void Player_actor_ct(ACTOR* actorx, GAME* game) { GAME_PLAY* play = (GAME_PLAY*)game; - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { actorx->status_data.weight = 255; } else { actorx->status_data.weight = 50; @@ -650,7 +650,7 @@ extern void Player_actor_dt(ACTOR* actorx, GAME* game) { Player_actor_Reset_bee_chase(actorx); // Player_actor_Check_player_sunburn_for_dt(actorx); // - if (mEv_CheckTitleDemo() <= 0 && player->bgm_volume_mode != mPlayer_BGM_VOLUME_MODE_NORMAL) { + if (mEv_IsNotTitleDemo() && player->bgm_volume_mode != mPlayer_BGM_VOLUME_MODE_NORMAL) { switch (player->bgm_volume_mode) { case mPlayer_BGM_VOLUME_MODE_COLLECT_INSECTS: mBGMPsComp_volume_collect_insects_end(); diff --git a/src/game/m_player_common.c_inc b/src/game/m_player_common.c_inc index efcd25cc..65ff354b 100644 --- a/src/game/m_player_common.c_inc +++ b/src/game/m_player_common.c_inc @@ -1153,7 +1153,7 @@ static void Player_actor_SetupItemScale(ACTOR* actorx, GAME* game) { } static void Player_actor_SetupWeight(ACTOR* actorx) { - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; int main_idx = player->now_main_index; @@ -3427,7 +3427,7 @@ static int Player_actor_Check_axe_after(ACTOR* actorx, xyz_t* target_pos_p, mAct } static mActor_name_t Player_actor_GetitemNo_forDamageAxe(mActor_name_t itemNo, int reflected) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return itemNo; } @@ -6856,7 +6856,7 @@ static int Player_actor_CheckAndRequest_ItemInOut(ACTOR* actorx, GAME* game, int } static void Player_actor_Set_bgm_volume(ACTOR* actorx, int main_index) { - if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE && mEv_CheckTitleDemo() <= 0) { + if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE && mEv_IsNotTitleDemo()) { // clang-format off static const s8 data[] = { mPlayer_BGM_VOLUME_MODE_NORMAL, @@ -7059,7 +7059,7 @@ static int Player_actor_GetSnowballPos_forWadeSnowball(ACTOR* actorx, xyz_t* pos static int Player_actor_CheckCondition_forWadeSnowball(GAME* game, const xyz_t* pos_p, s16 angle_y) { return Player_actor_CheckAbleMoveWadeBlock(game, pos_p, angle_y, 0.65f, DEG2SHORT_ANGLE2(5.0f), - mEv_CheckTitleDemo() <= 0); + mEv_IsNotTitleDemo()); } static void Player_actor_Culc_player_frame_counter(ACTOR* actorx) { @@ -7446,7 +7446,7 @@ static int Player_actor_CheckAndRequest_main_pickup_all(GAME* game) { Player_actor_check_cancel_request_change_proc_index(mPlayer_INDEX_PICKUP) == FALSE) { int can_exchange = field_type == mFI_FIELDTYPE2_FG; - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { /* Check for picking up items in your house */ if (Common_Get(clip).my_room_clip != NULL) { mActor_name_t item = Common_Get(clip).my_room_clip->search_pickup_ftr_proc(game); @@ -7528,7 +7528,7 @@ static int Player_actor_CheckAndRequest_main_pickup_all(GAME* game) { mActor_name_t changed_item = ITEM_IS_SIGNBOARD(item) ? ITM_SIGNBOARD : item; int item_is_signboard = item != changed_item; - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { if (Player_actor_request_main_pickup(game, changed_item, &target_pos, &item_pos, -1, item_is_signboard)) { return TRUE; @@ -7835,7 +7835,7 @@ static void Player_actor_Reset_bee_chase(ACTOR* actorx) { } static void Player_actor_Check_player_sunburn_ChangeDay(void) { - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { mActor_name_t field_id = mFI_GetFieldId(); if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) { @@ -7856,7 +7856,7 @@ static void Player_actor_Check_player_sunburn_ChangeDay(void) { } static void Player_actor_Check_player_sunburn_rankdown_interval(ACTOR* actorx) { - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { mActor_name_t field_id = mFI_GetFieldId(); if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) { @@ -7902,7 +7902,7 @@ static void Player_actor_Check_player_sunburn_rankdown_interval(ACTOR* actorx) { static void Player_actor_Check_player_sunburn_rankdown(ACTOR* actorx) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { mActor_name_t field_id = mFI_GetFieldId(); if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) { @@ -7927,7 +7927,7 @@ static void Player_actor_Check_player_sunburn_rankdown(ACTOR* actorx) { static void Player_actor_Check_player_sunburn_rankup(ACTOR* actorx) { PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; - if (player->player_sunburn_rankup == FALSE && mEv_CheckTitleDemo() <= 0) { + if (player->player_sunburn_rankup == FALSE && mEv_IsNotTitleDemo()) { mActor_name_t field_id = mFI_GetFieldId(); if (mFI_GET_TYPE(field_id) == mFI_FIELD_FG) { @@ -8377,7 +8377,7 @@ static int Player_actor_check_able_change_camera_normal_index(ACTOR* actorx) { return FALSE; } - if (mEv_CheckTitleDemo() <= 0 && mPlib_Check_scene_able_change_camera_pos()) { + if (mEv_IsNotTitleDemo() && mPlib_Check_scene_able_change_camera_pos()) { int main_index = player->now_main_index; if (mPlayer_MAIN_INDEX_VALID(main_index) != FALSE) { diff --git a/src/game/m_player_controller.c_inc b/src/game/m_player_controller.c_inc index 3b93d478..4db64eb4 100644 --- a/src/game/m_player_controller.c_inc +++ b/src/game/m_player_controller.c_inc @@ -1,5 +1,5 @@ static int Player_actor_CheckController_forPickup(GAME* game) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p(); ACTOR* actorx = GET_PLAYER_ACTOR_GAME_ACTOR(game); PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx; @@ -18,7 +18,7 @@ static int Player_actor_CheckController_forAxe(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_AXE(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->trigger_btn_a; } return chkTrigger(BUTTON_A); @@ -33,7 +33,7 @@ static int Player_actor_CheckController_forNet(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_NET(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->btn_a; } return chkButton(BUTTON_A); @@ -48,7 +48,7 @@ static int Player_actor_CheckController_forRod(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_ROD(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->trigger_btn_a; } return chkTrigger(BUTTON_A); @@ -63,7 +63,7 @@ static int Player_actor_CheckController_forScoop(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_SHOVEL(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->trigger_btn_a; } return chkTrigger(BUTTON_A); @@ -78,7 +78,7 @@ static int Player_actor_CheckController_forUmbrella(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_UMBRELLA(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->trigger_btn_a; } return chkTrigger(BUTTON_A); @@ -93,7 +93,7 @@ static int Player_actor_CheckController_forFan(GAME* game, int type) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (mPlayer_ITEM_IS_FAN(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p(); if (type != 0) { return data->trigger_btn_a; @@ -117,7 +117,7 @@ static int Player_actor_CheckController_forShake_tree(GAME* game) { s8 kind = Player_actor_Get_ItemKind(actorx, player->now_main_index); if (!mPlayer_ITEM_KIND_CHECK(kind, 0, mPlayer_ITEM_KIND_NUM) || mPlayer_ITEM_IS_NOT_TOOL(kind) != FALSE) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { mPlayer_Controller_Data_c* data = mPlib_Get_controller_data_for_title_demo_p(); return (data->trigger_btn_a != 0) && (data->btn_b == 0); } else { @@ -132,47 +132,47 @@ static f32 Player_actor_CheckController_forStruggle_pitfall(void) { } static int Player_actor_CheckController_forDush(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->btn_b + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->btn_b : mPlib_CheckButtonOnly_forDush(); } static f32 Player_actor_GetController_move_percentX(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pX + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pX : gamePT->mcon.move_pX; } static f32 Player_actor_GetController_move_percentY(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pY + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pY : gamePT->mcon.move_pY; } static f32 Player_actor_GetController_move_percentR(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pR + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_pR : gamePT->mcon.move_pR; } static s16 Player_actor_GetController_move_angle(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_angle + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.move_angle : gamePT->mcon.move_angle; } static s16 Player_actor_GetController_old_move_angle(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_move_angle + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_move_angle : gamePT->mcon.last_move_angle; } static f32 Player_actor_GetController_recognize_percentR(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.adjusted_pR + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.adjusted_pR : gamePT->mcon.adjusted_pR; } static f32 Player_actor_GetController_old_recognize_percentR(void) { - return (mEv_CheckTitleDemo() > 0) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_adjusted_pR + return (mEv_IsTitleDemo()) ? mPlib_Get_controller_data_for_title_demo_p()->mcon.last_adjusted_pR : gamePT->mcon.last_adjusted_pR; } static int Player_actor_CheckController_forRadio_exercise(GAME* game) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return -1; } diff --git a/src/game/m_player_item_common.c_inc b/src/game/m_player_item_common.c_inc index 35246136..f6b309b2 100644 --- a/src/game/m_player_item_common.c_inc +++ b/src/game/m_player_item_common.c_inc @@ -1,11 +1,11 @@ static void Player_actor_Set_ItemNoSubmenu(mActor_name_t item) { - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { Common_Get(now_private)->equipment = item; } } static mActor_name_t Player_actor_Get_ItemNoSubmenu(void) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return mPlib_Get_controller_data_for_title_demo_p()->equipped_item; } else { return Common_Get(now_private)->equipment; diff --git a/src/game/m_player_lib.c b/src/game/m_player_lib.c index e0d9be1a..df55c2c6 100644 --- a/src/game/m_player_lib.c +++ b/src/game/m_player_lib.c @@ -3568,7 +3568,7 @@ extern mActor_name_t mPlib_Get_itemNo_forWindow(void) { extern int mPlib_able_birth_bee(void) { if (mEv_CheckFirstIntro() != FALSE || Common_Get(reset_flag) != FALSE || - Common_Get(player_bee_chase_flag) != FALSE || mEv_CheckTitleDemo() > 0) { + Common_Get(player_bee_chase_flag) != FALSE || mEv_IsTitleDemo()) { return FALSE; } diff --git a/src/game/m_player_main_dash.c_inc b/src/game/m_player_main_dash.c_inc index 4c80cda4..4539076a 100644 --- a/src/game/m_player_main_dash.c_inc +++ b/src/game/m_player_main_dash.c_inc @@ -146,7 +146,7 @@ static void Player_actor_request_proc_index_fromDash_common(ACTOR* actor, GAME* player = (PLAYER_ACTOR*)actor; play = (GAME_PLAY*)game; - Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_CheckTitleDemo() <= 0); + Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_IsNotTitleDemo()); if (!player->actor_class.bg_collision_check.result.on_ground) { Player_actor_request_main_fall_all(game, -5.0f, 1, mPlayer_REQUEST_PRIORITY_1); @@ -179,7 +179,7 @@ static void Player_actor_request_proc_index_fromDash_common(ACTOR* actor, GAME* Player_actor_request_main_run_all(game, -5.0f, 0, mPlayer_REQUEST_PRIORITY_1); } - if (mEv_CheckTitleDemo() <= 0 && + if (mEv_IsNotTitleDemo() && (Common_Get(now_private)->destiny.type == 3 && Player_actor_Check_FlatPlace(actor))) { if (player->actor_class.speed / 7.5f >= 0.75f && !((int)(RANDOM_F(32768) * 2.0f) % 600)) { Player_actor_request_main_tumble(game, mPlayer_REQUEST_PRIORITY_6); diff --git a/src/game/m_player_main_pickup.c_inc b/src/game/m_player_main_pickup.c_inc index 4d36f93e..59c5efa9 100644 --- a/src/game/m_player_main_pickup.c_inc +++ b/src/game/m_player_main_pickup.c_inc @@ -53,7 +53,7 @@ static void Player_actor_setup_main_Pickup(ACTOR* actorx, GAME* game) { if (slot_idx >= 0) { main_pickup_p->exchange_flag = FALSE; - } else if (mEv_CheckTitleDemo() > 0) { + } else if (mEv_IsTitleDemo()) { main_pickup_p->exchange_flag = FALSE; } else { main_pickup_p->exchange_flag = TRUE; diff --git a/src/game/m_player_main_run.c_inc b/src/game/m_player_main_run.c_inc index 68214441..b5797bcc 100644 --- a/src/game/m_player_main_run.c_inc +++ b/src/game/m_player_main_run.c_inc @@ -70,7 +70,7 @@ static void Player_actor_request_proc_index_fromRun_common(ACTOR* actor, GAME* g PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor; f32 speed; - Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_CheckTitleDemo() <= 0); + Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_IsNotTitleDemo()); if (!actor->bg_collision_check.result.on_ground) { Player_actor_request_main_fall_all(game, -5.0f, 1, mPlayer_REQUEST_PRIORITY_1); diff --git a/src/game/m_player_main_stung_mosquito.c_inc b/src/game/m_player_main_stung_mosquito.c_inc index e59ff2a1..7291ff87 100644 --- a/src/game/m_player_main_stung_mosquito.c_inc +++ b/src/game/m_player_main_stung_mosquito.c_inc @@ -2,7 +2,7 @@ static int Player_actor_request_main_stung_mosquito_all(GAME* game, void* label, PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game); int main_index = player->now_main_index; - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { return FALSE; } diff --git a/src/game/m_player_main_walk.c_inc b/src/game/m_player_main_walk.c_inc index e9872fc8..f4609f10 100644 --- a/src/game/m_player_main_walk.c_inc +++ b/src/game/m_player_main_walk.c_inc @@ -233,7 +233,7 @@ static void Player_actor_request_proc_index_fromWalk(ACTOR* actor, GAME* game) { f32 percent_x; f32 percent_y; - Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_CheckTitleDemo() <= 0); + Player_actor_Set_ScrollDemo_forWade(actor, game, mEv_IsNotTitleDemo()); if (!actor->bg_collision_check.result.on_ground) { Player_actor_request_main_fall_all(game, -5.0f, 1, mPlayer_REQUEST_PRIORITY_1); diff --git a/src/game/m_player_other_func.c_inc b/src/game/m_player_other_func.c_inc index b7c22547..0a373d43 100644 --- a/src/game/m_player_other_func.c_inc +++ b/src/game/m_player_other_func.c_inc @@ -176,7 +176,7 @@ static void Player_actor_check_nextgoto(ACTOR* actor, GAME* game) { mActor_name_t door = player->item_in_front; if (ITEM_NAME_GET_TYPE(door) == NAME_TYPE_WARP && Player_actor_check_bg_for_next_goto(actor, door) != FALSE && - mEv_CheckTitleDemo() <= 0 && play->fb_wipe_mode == WIPE_MODE_NONE) { + mEv_IsNotTitleDemo() && play->fb_wipe_mode == WIPE_MODE_NONE) { if (door >= EXIT_DOOR && door < EXIT_DOOR1) { mDemo_Request(mDemo_TYPE_EXITSCENE, actor, Player_actor_set_nextgoto_info_type0); diff --git a/src/game/m_titledemo.c b/src/game/m_titledemo.c index 7c676bcf..3b60e879 100644 --- a/src/game/m_titledemo.c +++ b/src/game/m_titledemo.c @@ -14,7 +14,7 @@ #define mTD_HEADER_TOOL 4 #define mTD_HEADER_SIZE 5 -static int S_now_demono = -1; +static int S_now_demono = mEv_TITLEDEMO_LOGO; static int S_tdemo_frame; static u16 S_titledemo_to_play; @@ -26,12 +26,12 @@ static u16 get_demo_header(int titledemo_no, int key) { } extern int mTD_demono_get() { - if (S_now_demono == -1) { - S_now_demono = 1; + if (S_now_demono == mEv_TITLEDEMO_LOGO) { + S_now_demono = mEv_TITLEDEMO_START1; } else { S_now_demono++; if (S_now_demono > mTD_TITLE_DEMO_NUM) { - S_now_demono = 1; + S_now_demono = mEv_TITLEDEMO_START1; } } @@ -41,9 +41,9 @@ extern int mTD_demono_get() { extern void mTD_player_keydata_init(GAME_PLAY* play) { PLAYER_ACTOR* player = get_player_actor_withoutCheck(play); - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { u16 angle; - mActor_name_t tool = get_demo_header(mEv_CheckTitleDemo() - 1, mTD_HEADER_TOOL); + mActor_name_t tool = get_demo_header(mEv_CheckTitleDemo() - mEv_TITLEDEMO_START1, mTD_HEADER_TOOL); if (tool == ITM_AXE) { tool = ITM_AXE; @@ -54,7 +54,7 @@ extern void mTD_player_keydata_init(GAME_PLAY* play) { } mPlib_SetData2_controller_data_for_title_demo(tool); - angle = get_demo_header(mEv_CheckTitleDemo() - 1, mTD_HEADER_ROTATION); + angle = get_demo_header(mEv_CheckTitleDemo() - mEv_TITLEDEMO_START1, mTD_HEADER_ROTATION); player->actor_class.shape_info.rotation.y = angle; player->actor_class.world.angle.y = angle; @@ -68,7 +68,7 @@ static u16 get_tdemo_keydata(int frame) { u16* pact_data_keydata_pt[mTD_TITLE_DEMO_NUM] = { pact0_key_data, pact1_key_data, pact2_key_data, pact3_key_data, pact4_key_data }; - return pact_data_keydata_pt[mEv_CheckTitleDemo() - 1][frame]; + return pact_data_keydata_pt[mEv_CheckTitleDemo() - mEv_TITLEDEMO_START1][frame]; } /* @fakematch? - the weirdness with btn_a needing to be assigned to a u8 then int needs to be investigated */ @@ -131,7 +131,7 @@ static void mTD_game_end_init(GAME_PLAY* play) { } extern void title_demo_move(GAME_PLAY* play) { - if (mEv_CheckTitleDemo() > 0) { + if (mEv_IsTitleDemo()) { set_player_demo_keydata(S_tdemo_frame); S_tdemo_frame++; @@ -162,11 +162,11 @@ extern void mTD_rtc_reserve() { extern int mTD_get_titledemo_no() { int titledemo_no = S_now_demono; - if (titledemo_no <= 0) { - titledemo_no = 1; + if (titledemo_no <= mEv_TITLEDEMO_NONE) { + titledemo_no = mEv_TITLEDEMO_START1; } - return titledemo_no - 1; + return titledemo_no - mEv_TITLEDEMO_START1; } extern int mTD_tdemo_button_ok_check() { diff --git a/src/game/m_trademark.c b/src/game/m_trademark.c index 3cc02c68..cb38575c 100644 --- a/src/game/m_trademark.c +++ b/src/game/m_trademark.c @@ -133,8 +133,8 @@ static void trademark_goto_demo_scene(GAME_TRADEMARK* trademark) { mEv_ClearEventInfo(); demo_no = mEv_CheckTitleDemo(); - if (demo_no > 0) { - Door_data_c* demo_door_data = l_demo_door_data_table[demo_no - 1]; + if (demo_no > mEv_TITLEDEMO_NONE) { + Door_data_c* demo_door_data = l_demo_door_data_table[demo_no -mEv_TITLEDEMO_START1 ]; Common_Set(door_data, *demo_door_data); Common_Set(door_data.next_scene_id, demo_door_data->next_scene_id + 1); // go to next demo scene diff --git a/src/game/m_train_control.c b/src/game/m_train_control.c index 9fdc4b3b..928f24e3 100644 --- a/src/game/m_train_control.c +++ b/src/game/m_train_control.c @@ -101,7 +101,7 @@ static int mTRC_go_process() { int res = FALSE; int demo_no = mEv_CheckTitleDemo(); - if (((int)demo_no == 0 || demo_no == 1 || demo_no == -9) && Common_Get(field_draw_type) != FIELD_DRAW_TYPE_TRAIN && + if (((int)demo_no == mEv_TITLEDEMO_NONE || demo_no == mEv_TITLEDEMO_START1 || demo_no == mEv_TITLEDEMO_STAFFROLL) && Common_Get(field_draw_type) != FIELD_DRAW_TYPE_TRAIN && Common_Get(field_draw_type) != FIELD_DRAW_TYPE_PLAYER_SELECT) { res = TRUE; } @@ -212,7 +212,7 @@ static void mTRC_norm_init() { static int mTRC_schedule(GAME_PLAY* play) { int res = -1; - if (mEv_CheckTitleDemo() == 1) { + if (mEv_CheckTitleDemo() == mEv_TITLEDEMO_START1) { if (Common_Get(train_action) == mTRC_ACTION_NONE) { mTRC_mati_init(); } diff --git a/src/game/m_vibctl.c b/src/game/m_vibctl.c index 476663a4..07981961 100644 --- a/src/game/m_vibctl.c +++ b/src/game/m_vibctl.c @@ -439,7 +439,7 @@ static void mVibInfo_move(mVibInfo_c* vib_info) { } static void mVibctl_check_title_demo() { - if (mFI_CheckFieldData() && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_FIELDTYPE_FG && mEv_CheckTitleDemo() > 0) { + if (mFI_CheckFieldData() && mFI_GET_TYPE(mFI_GetFieldId()) == mFI_FIELDTYPE_FG && mEv_IsTitleDemo()) { mVibctl_set_force_stop(mVibctl_FLAG_FORCE_STOP2); } else { diff --git a/src/game/m_watch_my_step.c b/src/game/m_watch_my_step.c index 587b10a5..3c4631b7 100644 --- a/src/game/m_watch_my_step.c +++ b/src/game/m_watch_my_step.c @@ -80,7 +80,7 @@ extern void watch_my_step_move(GAME_PLAY* play) { S_watch_my_step.draw_type = 0; - if (mEv_CheckTitleDemo() <= 0) { + if (mEv_IsNotTitleDemo()) { window_item = mPlib_Get_itemNo_forWindow(); switch (S_watch_my_step.mode) {