Add a *ton* of const and constexpr around the codebase. (#1864)

* 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
This commit is contained in:
Pieter-Jan Briers
2026-05-28 07:12:16 +02:00
committed by GitHub
parent db39a9c7f3
commit 5d68762590
954 changed files with 4693 additions and 4682 deletions
+6 -6
View File
@@ -52,7 +52,7 @@ static u32 const l_gate_heap[] = {0x1940, 0x1940, 0x1940};
static u32 const l_key_heap[] = {0x1000, 0x1000, 0x1000};
static cull_box const l_cull_box = {
static DUSK_CONSTEXPR cull_box const l_cull_box = {
{-300.0f, 0.0f, -350.0f},
{300.0f, 450.0f, 350.0f},
};
@@ -205,14 +205,14 @@ void daObjKGate_c::setBaseMtx() {
}
}
static char* l_arcName[] = {
static DUSK_CONST char* l_arcName[] = {
"D_Kgate00",
"D_Kgate01",
"M_RGate00",
};
int daObjKGate_c::Create() {
static char* l_evName[] = {"KOKI_GATE_OPEN00", NULL, "RIDER_GATE_OPEN00"};
static DUSK_CONST char* l_evName[] = {"KOKI_GATE_OPEN00", NULL, "RIDER_GATE_OPEN00"};
u8 sw_no = getSwNo();
@@ -910,7 +910,7 @@ void daObjKGate_c::demoProc() {
}
int daObjKGate_c::getDemoAction() {
static char* action_table[] = {"WAIT", "ADJUSTMENT", "UNLOCK", "OPEN"};
static DUSK_CONST char* action_table[] = {"WAIT", "ADJUSTMENT", "UNLOCK", "OPEN"};
return dComIfGp_evmng_getMyActIdx(mStaffID, action_table, ARRAY_SIZEU(action_table), 0, 0);
}
@@ -981,13 +981,13 @@ static int daObjKGate_MoveBGDraw(daObjKGate_c* i_this) {
return i_this->MoveBGDraw();
}
static actor_method_class daObjKGate_METHODS = {
static DUSK_CONST actor_method_class daObjKGate_METHODS = {
(process_method_func)daObjKGate_create1st, (process_method_func)daObjKGate_MoveBGDelete,
(process_method_func)daObjKGate_MoveBGExecute, (process_method_func)NULL,
(process_method_func)daObjKGate_MoveBGDraw,
};
actor_process_profile_definition g_profile_Obj_KkrGate = {
DUSK_PROFILE actor_process_profile_definition DUSK_CONST g_profile_Obj_KkrGate = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,