mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-09 18:27:17 -04:00
5d68762590
* Add a *ton* of const and constexpr around the codebase. This makes the codebase compile without strings being cast to non-const char*. I also went through and added constexpr where appropriate for tons of static data. * Make process definitions const too Might as well
98 lines
2.6 KiB
C++
98 lines
2.6 KiB
C++
/**
|
|
* d_a_econt.cpp
|
|
* Encounter
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_econt.h"
|
|
#include "d/d_timer.h"
|
|
#include "d/d_meter2_info.h"
|
|
#include "f_pc/f_pc_executor.h"
|
|
|
|
u8 data_805197E0[4];
|
|
|
|
static int daEcont_Draw(econt_class* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
static void* s_rd_sub(void* i_this, void* param_1) {
|
|
if (fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == fpcNm_E_RD_e) {
|
|
data_805197E0[0]++;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static void rider_game(econt_class* i_this) {
|
|
if (dComIfGs_isSwitch(0x2e,fopAcM_GetRoomNo(i_this)) && !dComIfGp_event_runCheck()) {
|
|
data_805197E0[0] = 0;
|
|
fpcM_Search(s_rd_sub,i_this);
|
|
|
|
if (i_this->field_0x5b4 == 0) {
|
|
if (i_this->field_0x5b8[0] == 0) {
|
|
i_this->field_0x5b4 = 1;
|
|
dMeter2Info_setMaxCount(data_805197E0[0]);
|
|
dComIfG_TimerStart(8,0);
|
|
}
|
|
} else if (data_805197E0[0] == 0) {
|
|
fopAcM_delete(i_this);
|
|
return;
|
|
}
|
|
|
|
dMeter2Info_setNowCount(data_805197E0[0]);
|
|
}
|
|
}
|
|
|
|
static int daEcont_Execute(econt_class* i_this) {
|
|
for (int i = 0; i < 3; i++) {
|
|
if (i_this->field_0x5b8[i] != 0) {
|
|
i_this->field_0x5b8[i] -= 1;
|
|
}
|
|
}
|
|
rider_game(i_this);
|
|
return 1;
|
|
}
|
|
|
|
static int daEcont_IsDelete(econt_class* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
static int daEcont_Delete(econt_class* i_this) {
|
|
dComIfG_TimerDeleteRequest(8);
|
|
return 1;
|
|
}
|
|
|
|
static int daEcont_Create(fopAc_ac_c* i_this) {
|
|
econt_class* encounter = (econt_class*)i_this;
|
|
fopAcM_ct(i_this, econt_class);
|
|
dTimer_createTimer(8,0x989298,2,0,210.0f,410.0f,32.0f,419.0f);
|
|
encounter->field_0x5b8[0] = 0x14;
|
|
return cPhs_COMPLEATE_e;
|
|
|
|
}
|
|
|
|
static DUSK_CONST actor_method_class l_daEcont_Method = {
|
|
(process_method_func)daEcont_Create,
|
|
(process_method_func)daEcont_Delete,
|
|
(process_method_func)daEcont_Execute,
|
|
(process_method_func)daEcont_IsDelete,
|
|
(process_method_func)daEcont_Draw
|
|
};
|
|
|
|
DUSK_PROFILE actor_process_profile_definition DUSK_CONST g_profile_ECONT = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 8,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_ECONT_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(econt_class),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_ECONT_e,
|
|
/* Actor SubMtd */ &l_daEcont_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_UNK_0x4000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_0_e,
|
|
};
|