From f2f6ba9a729935b7fbc06ad193aa33d2f806c6fd Mon Sep 17 00:00:00 2001 From: yamamama Date: Sun, 16 Nov 2025 11:24:36 -0500 Subject: [PATCH] Remove redundant KVOICE_ check, automatically allocate KARTVOICE fields in SOCs --- src/deh_soc.c | 11 ++++++++--- src/dehacked.c | 4 ---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index ab1a631fe..1f1eef330 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -32,6 +32,7 @@ #include "r_picformats.h" #include "r_things.h" // R_Char2Frame #include "r_sky.h" +#include "r_skins.h" // R_AllocVoice #include "fastcmp.h" #include "lua_script.h" // Reluctantly included for LUA_EvalMath #include "d_clisrv.h" @@ -4606,11 +4607,15 @@ useoddsfunc_f *get_useoddsfunc(const char *word) kartvoicetype_e get_kartvoice(const char *word) { // Returns the value of KVOICE_ enumerations kartvoicetype_e i; - if (fastncmp("KVOICE_",word,7)) - word += 7; // take off the KVOICE_ i = DEH_FindVoice(word); if (i == MAXSKINVOICES) - deh_warning("Couldn't find voice named 'KVOICE_%s'", word); + { + // Freeslot voices that don't exist yet. + const INT32 allocresult = R_AllocVoice(false, word, &i); + + if (allocresult < 0) + deh_warning("Voice '%s' could not be allocated.", word); + } return i; } diff --git a/src/dehacked.c b/src/dehacked.c index 6cdb8db65..6f70f2ded 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -391,10 +391,6 @@ INT32 DEH_ReadFreeslot(const char *type, const char *word, INT32 *out) K_RegisterItem(numkartitems); *out = numkartitems++; } - else if (fastcmp(type, "KVOICE")) - { - return R_AllocVoice(false, word, out); - } return -2; }