mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-04 02:16:03 -04:00
56890c32e8
* Consolidate fopAcM_STATUS into fopAc_Status_e * Add _e suffix to fopAcStts enums * Prepare for profile enumeration * Correct typo in scene_process_profile_definition * Manually handle g_profile_Obj_DamCps (inline preprocessing) * Correct g_profile_TAG_LV5SOUP procname to enum * Create d_priority.h * Update process profile definitions * Moved inline comments to the left * Add missing fopAcStts enums * Add d_priority.h include in f_pc_leaf.h * Manually update d_a_obj_damCps profile * Replace fopAcStts enums replacing and anticipatory profile size correction * Changed profile size from literal to sizeof() in anticipation of PR #3116 * Provided putative names to staff-related status enums * Replaced appropriate literals with fopAcStts enums * Fix borked merge * Rename item number enums and move to d_item_data.h * Rename process profile name & draw priority enums * Move process profile name & draw priority enums to appropriate files * Moved fpcNm_ enums from d/d_procname.h to f_pc/f_pc_name.h * Moved fpcDwPi_ enums from d/d_priority.h to f_pc/f_pc_draw_priority.h * ACTUALLY (whoops) stage merge * Correct item mistranslation Co-authored-by: LagoLunatic <LagoLunatic@users.noreply.github.com> --------- Co-authored-by: LagoLunatic <LagoLunatic@users.noreply.github.com>
150 lines
3.7 KiB
C++
150 lines
3.7 KiB
C++
/**
|
|
* @file d_a_obj_timer.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_timer.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "f_op/f_op_actor_mng.h"
|
|
|
|
int daObjTimer::Act_c::_create() {
|
|
fopAcM_ct(this, Act_c);
|
|
fopAcM_offDraw(this);
|
|
|
|
if (fopAcM_isSwitch(this, prm_get_sw2Save())) {
|
|
return cPhs_ERROR_e;
|
|
} else {
|
|
if (fopAcM_isSwitch(this, prm_get_swSave())) {
|
|
mode_count_init();
|
|
} else {
|
|
mode_wait_init();
|
|
}
|
|
return cPhs_COMPLEATE_e;
|
|
}
|
|
}
|
|
|
|
bool daObjTimer::Act_c::_delete() {
|
|
return true;
|
|
}
|
|
|
|
void daObjTimer::Act_c::mode_wait_init() {
|
|
field_0x56c = 0;
|
|
field_0x568 = 0;
|
|
}
|
|
|
|
void daObjTimer::Act_c::mode_wait() {
|
|
if (fopAcM_isSwitch(this, prm_get_swSave())) {
|
|
mode_count_init();
|
|
}
|
|
}
|
|
|
|
void daObjTimer::Act_c::mode_count_init() {
|
|
field_0x56c = prm_get_time() * 15;
|
|
field_0x568 = 1;
|
|
}
|
|
|
|
void daObjTimer::Act_c::mode_count() {
|
|
Z2SoundID soundID;
|
|
|
|
if (!field_0x570) {
|
|
field_0x56c--;
|
|
if (prm_get_SeStop() && field_0x56c % 30 == 0) {
|
|
if (dComIfGp_event_runCheck() && prm_get_demoStop()) {
|
|
field_0x56c += 30;
|
|
}
|
|
|
|
int iVar1 = field_0x56c / 30;
|
|
if (iVar1 <= 20) {
|
|
if (iVar1 > 10) {
|
|
soundID = JA_SE_SYS_EV_TIMER_20;
|
|
} else if (iVar1 > 5) {
|
|
soundID = JA_SE_SYS_EV_TIMER_10;
|
|
} else if (iVar1 > 0) {
|
|
soundID = JA_SE_SYS_EV_TIMER_5;
|
|
} else {
|
|
soundID = JA_SE_SYS_EV_TIMER_0;
|
|
}
|
|
|
|
mDoAud_seStart(soundID, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
if (field_0x56c > 0) {
|
|
if (fopAcM_isSwitch(this, prm_get_swSave())) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
fopAcM_offSwitch(this, prm_get_swSave());
|
|
mode_wait_init();
|
|
}
|
|
}
|
|
|
|
bool daObjTimer::Act_c::_execute() {
|
|
static daObjTimer::Act_c::modeProc const mode_proc[2] = {
|
|
&daObjTimer::Act_c::mode_wait,
|
|
&daObjTimer::Act_c::mode_count,
|
|
};
|
|
|
|
if (fopAcM_isSwitch(this, prm_get_sw2Save())) {
|
|
fopAcM_delete(this);
|
|
return true;
|
|
} else {
|
|
(this->*mode_proc[field_0x568])();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
namespace daObjTimer {
|
|
|
|
namespace {
|
|
int Mthd_Create(void* i_this) {
|
|
return static_cast<daObjTimer::Act_c*>(i_this)->_create();
|
|
}
|
|
|
|
int Mthd_Delete(void* i_this) {
|
|
return static_cast<daObjTimer::Act_c*>(i_this)->_delete();
|
|
}
|
|
|
|
int Mthd_Execute(void* i_this) {
|
|
return static_cast<daObjTimer::Act_c*>(i_this)->_execute();
|
|
}
|
|
|
|
int Mthd_Draw(void* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
int Mthd_IsDelete(void* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
actor_method_class l_daTimer_Method = {
|
|
(process_method_func)Mthd_Create,
|
|
(process_method_func)Mthd_Delete,
|
|
(process_method_func)Mthd_Execute,
|
|
(process_method_func)Mthd_IsDelete,
|
|
(process_method_func)Mthd_Draw,
|
|
};
|
|
} // namespace
|
|
|
|
}; // namespace daObjTimer
|
|
|
|
actor_process_profile_definition g_profile_Obj_Timer = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 10,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_Timer_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObjTimer::Act_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_Timer_e,
|
|
/* Actor SubMtd */ &daObjTimer::l_daTimer_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_0_e,
|
|
};
|