Files
dusklight/src/d/actor/d_a_obj_timeFire.cpp
T
Huitzi 56890c32e8 Actor status consolidation & process profile definition editing (#3117)
* 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>
2026-03-09 18:33:31 -07:00

173 lines
4.8 KiB
C++

/**
* @file d_a_obj_timeFire.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_timeFire.h"
#include "d/d_com_inf_game.h"
daTimeFire_HIO_c::daTimeFire_HIO_c() {
field_0x4 = 20;
}
void daTimeFire_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
}
int daTimeFire_c::create() {
fopAcM_ct(this, daTimeFire_c);
setBaseMtx();
field_0x570 = current.pos;
lightInit();
mStartTime = getStartTime();
mEndTime = getEndTime();
int scaleParam = getScale();
f32 fVar1 = scaleParam / 10.0f;
mParticleScale.set(fVar1, fVar1, fVar1);
field_0x56c = fireCheck(1);
if (!field_0x56c) {
cutLight();
field_0x56d = false;
} else {
setLight();
field_0x56d = true;
}
field_0x568 = 0;
field_0x569 = 0;
return cPhs_COMPLEATE_e;
}
void daTimeFire_c::lightInit() {
field_0x594 = field_0x570;
field_0x594.y += 10.0f;
mLightInfluence.mPosition = field_0x594;
mLightInfluence.mColor.r = 0xbc;
mLightInfluence.mColor.g = 0x66;
mLightInfluence.mColor.b = 0x42;
mLightInfluence.mPow = 500.0f;
mLightInfluence.mFluctuation = 1.0f;
}
void daTimeFire_c::setLight() {
dKy_plight_set(&mLightInfluence);
}
void daTimeFire_c::cutLight() {
dKy_plight_cut(&mLightInfluence);
}
int daTimeFire_c::Execute() {
bool prevFireCheck = field_0x56c;
field_0x56c = fireCheck(0);
if (prevFireCheck != field_0x56c) {
if (field_0x56c == 0) {
cutLight();
field_0x56d = false;
} else {
setLight();
field_0x56d = true;
}
}
if (field_0x56d) {
mParticleId1 = dComIfGp_particle_set(mParticleId1, 0x3ad, &field_0x570, NULL, &mParticleScale);
mParticleId2 = dComIfGp_particle_set(mParticleId2, 0x3af, &field_0x570, NULL, &mParticleScale);
mParticleId3 = dComIfGp_particle_set(mParticleId3, 0x3ae, &field_0x570, NULL, &mParticleScale);
s8 reverb = dComIfGp_getReverb(fopAcM_GetRoomNo(this));
mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &field_0x570, 0, reverb);
}
return 1;
}
bool daTimeFire_c::fireCheck(u8 param_1) {
bool inTime = false;
BOOL isSw;
if (getSw() == 0xff) {
isSw = 1;
} else {
isSw = fopAcM_isSwitch(this, getSw()) & 0xff;
}
if (mStartTime > mEndTime) {
if (dKy_getdaytime_hour() >= mStartTime || dKy_getdaytime_hour() <= mEndTime) {
inTime = true;
}
} else {
if (dKy_getdaytime_hour() >= mStartTime && dKy_getdaytime_hour() <= mEndTime) {
inTime = true;
}
}
if (inTime && (isSw & 0xff) && dKy_getdaytime_hour() == mStartTime && dKy_getdaytime_minute() == 0 &&
field_0x569 == 0 && param_1 == 0)
{
s8 reverb = dComIfGp_getReverb(fopAcM_GetRoomNo(this));
mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &field_0x570, 0, reverb);
field_0x569 = 1;
}
if (inTime && (isSw & 0xff) && dKy_getdaytime_hour() == mEndTime && dKy_getdaytime_minute() == 0 &&
field_0x569 == 1 && param_1 == 0)
{
s8 reverb = dComIfGp_getReverb(fopAcM_GetRoomNo(this));
mDoAud_seStart(Z2SE_OBJ_FIRE_OFF, &field_0x570, 0, reverb);
field_0x569 = 2;
}
if (inTime && (isSw & 0xff)) {
return 1;
}
field_0x569 = 0;
return 0;
}
int daTimeFire_c::Draw() {
return 1;
}
int daTimeFire_c::Delete() {
dKy_plight_cut(&mLightInfluence);
return 1;
}
static int daTimeFire_Draw(daTimeFire_c* i_this) {
return i_this->Draw();
}
static int daTimeFire_Execute(daTimeFire_c* i_this) {
return i_this->Execute();
}
static int daTimeFire_Delete(daTimeFire_c* i_this) {
return i_this->Delete();
}
static int daTimeFire_Create(fopAc_ac_c* i_this) {
return static_cast<daTimeFire_c*>(i_this)->create();
}
static daTimeFire_HIO_c l_HIO;
static actor_method_class l_daTimeFire_Method = {
(process_method_func)daTimeFire_Create,
(process_method_func)daTimeFire_Delete,
(process_method_func)daTimeFire_Execute,
NULL,
(process_method_func)daTimeFire_Draw,
};
actor_process_profile_definition g_profile_Obj_TimeFire = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 7,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_TimeFire_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daTimeFire_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_TimeFire_e,
/* Actor SubMtd */ &l_daTimeFire_Method,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_NOPAUSE_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};