diff --git a/src/d_netcmd.c b/src/d_netcmd.c index eed2c2237..9feeba5b2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1407,7 +1407,7 @@ static void Skin_FindRealNameSkin(consvar_t *cvar) } } -static UINT8 Skin_FindValidDub(consvar_t *cvar, UINT16 skin_id, kartvoice_t *voice, boolean forceme, boolean silent) +static UINT8 Skin_FindValidDub(consvar_t *cvar, UINT16 skin_id, kartvoice_t *voice, boolean silent) { // Not the best way to implements this but it will do. @@ -2066,7 +2066,7 @@ static void SendNameAndColor(UINT8 n) { CV_StealthSet(&cv_skin[n], skins[player->skin].name); - if (Skin_FindValidDub(&cv_voice[n], cv_skin[n].value, voice, false, true)) + if (Skin_FindValidDub(&cv_voice[n], cv_skin[n].value, voice, true)) { // Our voice is no longer valid, set it to that of our skin's. strlcpy(voicebuf, skins[player->skin].voices[0].name, sizeof(voicebuf)); @@ -2100,7 +2100,7 @@ static void SendNameAndColor(UINT8 n) if (!permamute) { - if (Skin_FindValidDub(&cv_voice[n], cv_skin[n].value, voice, false, true)) + if (Skin_FindValidDub(&cv_voice[n], cv_skin[n].value, voice, true)) { // In the chance our current voice isn't valid, // rescan our current voice and send that over the network. @@ -7550,7 +7550,7 @@ static void __voice_cvar_func(INT32 pid, UINT8 pnum) } } - Skin_FindValidDub(&cv_voice[pnum], players[pid].skin, myvoice, false, false); + Skin_FindValidDub(&cv_voice[pnum], players[pid].skin, myvoice, false); if (!Playing()) return; // do whatever you want diff --git a/src/deh_soc.c b/src/deh_soc.c index 62990b4cc..c128b1691 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -32,7 +32,6 @@ #include "r_picformats.h" #include "r_things.h" // R_Char2Frame #include "r_sky.h" -#include "r_skins.h" // R_AllocKartVoice #include "fastcmp.h" #include "lua_script.h" // Reluctantly included for LUA_EvalMath #include "d_clisrv.h" @@ -4242,189 +4241,6 @@ void readkartresult(MYFILE *f, kartresult_t *result) #undef WARN #undef WARN0 -/* -#define WARN(str, ...) deh_warning("KartVoice %s: " str, voice->name, __VA_ARGS__) -#define WARN0(str) deh_warning("KartVoice %s: " str, voice->name) - -// Necessary for sound adding, so we can gather flags and singularity data. -static sfxenum_t skinsoundreroute[] = { - sfx_kwin, - sfx_klose, - sfx_khurt1, - sfx_khurt2, - sfx_kattk1, // Offense item taunt - sfx_kattk2, - sfx_kbost1, // Boost item taunt - sfx_kbost2, - sfx_kslow, // Overtake taunt - sfx_khitem, // Hit confirm taunt - sfx_kgloat, // Power item taunt -}; - -// Extremely shitty and lifted almost entirely from r_skins.c -// Sets the sound effect value for a voice, given a valid skinsound value is passed. -static UINT8 reallygrossvoicesfxadder(INT32 skinsound, const char *value, kartvoice_t *voice) -{ - sfxenum_t i, j, reroute; - char printval[6]; - - // Remove the prefix. (We can affect this directly since we're not going to use it again.) - if ((value[0] == 'D' || value[0] == 'd') && (value[1] == 'S' || value[1] == 's')) // DS* - value += 2; - else // sfx_* - value += 4; - - strncpy(printval, value, 6); - - reroute = skinsoundreroute[skinsound]; - - // Automatically allocate any defined voice sounds. - // Freeslotted voice clips won't ever belong to a skin. - - i = sfx_None; - - // Find if this sound already exists first. - for (j = 0; j < NUMSFX; j++) - { - if (!S_sfx[j].name) - continue; - - if (!stricmp(S_sfx[j].name, value)) - { - // Found an existing sound. - i = j; - break; - } - } - - // This sound doesn't seem to exist, so let's add a new one. - if (i == sfx_None) - { - CONS_Printf("Sound sfx_%s allocated.\n", value); - i = S_AddSoundFx(value, S_sfx[reroute].singularity, S_sfx[reroute].flags, false); - } - - if (i != sfx_None) - { - if (voice) - { - Sk_SetSkinVoiceValue(voice, skinsound, i); - return 0; - } - } - - WARN0("Ran out of free SFX slots!"); - return 1; -} - -void readkartvoice(MYFILE *f, kartvoice_t *voice) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word = s; - char *word2; - char *tmp; - INT32 i; - - do if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - // First remove trailing newline, if there is one - tmp = strchr(s, '\n'); - if (tmp) - *tmp = '\0'; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - if (s == tmp) - continue; // Skip comment lines, but don't break. - - // Get the part before the " = " - tmp = strchr(s, '='); - if (tmp) - *(tmp-1) = '\0'; - else - break; - strupr(word); - - // Now get the part after - word2 = (tmp += 2); - strupr(word2); - - if (fastcmp(word, "SKIN")) - { - i = R_SkinAvailable(word2); - - if (i == -1) - { - strlwr(word2); - WARN("skin '%s' does not exist or cannot be used", word2); - } - else - { - voice->parent = (UINT16)i; - } - } - else if (fastcmp(word, "GLOAT")) - { - reallygrossvoicesfxadder(SKSKPOWR, word2, voice); - } - else if (fastcmp(word, "WIN")) - { - reallygrossvoicesfxadder(SKSKWIN, word2, voice); - } - else if (fastcmp(word, "LOSE")) - { - reallygrossvoicesfxadder(SKSKLOSE, word2, voice); - } - else if (fastcmp(word, "SLOW") || fastcmp(word, "OVERTAKE") || fastcmp(word, "PASS")) - { - reallygrossvoicesfxadder(SKSKSLOW, word2, voice); - } - else if (fastcmp(word, "PAIN1") || fastcmp(word, "HURT1") || fastcmp(word, "DAMAGE1")) - { - reallygrossvoicesfxadder(SKSKPAN1, word2, voice); - } - else if (fastcmp(word, "PAIN2") || fastcmp(word, "HURT2") || fastcmp(word, "DAMAGE2")) - { - reallygrossvoicesfxadder(SKSKPAN2, word2, voice); - } - else if (fastcmp(word, "ATTACK1")) - { - reallygrossvoicesfxadder(SKSKATK1, word2, voice); - } - else if (fastcmp(word, "ATTACK2")) - { - reallygrossvoicesfxadder(SKSKATK2, word2, voice); - } - else if (fastcmp(word, "BOOST1")) - { - reallygrossvoicesfxadder(SKSKBST1, word2, voice); - } - else if (fastcmp(word, "BOOST2")) - { - reallygrossvoicesfxadder(SKSKBST2, word2, voice); - } - else if (fastcmp(word, "HITEM") || fastcmp(word, "HITCONFIRM")) - { - reallygrossvoicesfxadder(SKSKHITM, word2, voice); - } - else - WARN("unknown word '%s'", word); - } - while (!myfeof(f)); // finish when the line is empty - - // Set our ID afterwards. - //voice->id = (UINT32)(voice - skinvoices); - - Z_Free(s); -} - -#undef WARN -#undef WARN0*/ - // // // diff --git a/src/dehacked.c b/src/dehacked.c index f582be246..dd0fd670e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -390,6 +390,7 @@ INT32 DEH_ReadFreeslot(const char *type, const char *word, INT32 *out) DEH_Link(word, &kartitems[numkartitems].info, &kartitemnames); K_RegisterItem(numkartitems); *out = numkartitems++; + return 0; } return -2; @@ -786,32 +787,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) result = K_RegisterResult(word2, alternate); readkartresult(f, result); } - /*else if (fastncmp(word, "KARTVOICE", 9)) (Deprecated; getting merged into skins) - { - if (i == 0 && word2[0] != '0') // If word2 isn't a number - i = DEH_FindKartVoice(word2); // find a voice by name - - if (i == MAXSKINVOICES) - { - // Found nothing; auto-allocate our voice. - const INT32 allocresult = R_AllocKartVoice(false, word2, &i); - - if (allocresult < 0) - { - deh_warning("Voice '%s' could not be allocated.", word2); - ignorelines(f); - } - } - - if (i >= 0 && i < numskinvoices) - readkartvoice(f, &skinvoices[i]); - else - { - // zero-based, but let's start at 1 - deh_warning("KartVoice number %d out of range (0 - %d)", i, numskinvoices); - ignorelines(f); - } - }*/ else if (fastcmp(word, "WEATHER") || fastcmp(word, "PRECIP") || fastcmp(word, "PRECIPITATION")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number diff --git a/src/g_demo.c b/src/g_demo.c index a15fc2028..ae31ec6a3 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -41,7 +41,6 @@ #include "lua_hook.h" #include "p_saveg.h" // savebuffer_t #include "g_party.h" -#include "deh_tables.h" // SRB2Kart #include "d_netfil.h" // nameonly @@ -55,7 +54,6 @@ #include "k_color.h" #include "k_follower.h" #include "k_grandprix.h" -//#include "strbuf.h" static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}}; consvar_t cv_recordmultiplayerdemos = CVAR_INIT ("netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL); diff --git a/src/info.c b/src/info.c index 4a48dc8e3..28513667c 100644 --- a/src/info.c +++ b/src/info.c @@ -240,7 +240,7 @@ void P_ResetData(INT32 flags) for (i = 0; i < MN_FIRSTFREESLOT; i++, name += strlen(name)+1) DEH_Link(name, &menudefs[i].info, &menunames); } - + // kartitems if (init) { diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 195720491..2c1d8dc0f 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -27,7 +27,6 @@ #include "y_inter.h" #include "hu_stuff.h" // HU_AddChatText #include "console.h" -#include "deh_tables.h" // DEH_FindKartVoice #include "k_kart.h" // SRB2Kart #include "k_battle.h" #include "k_boss.h" diff --git a/src/r_skins.c b/src/r_skins.c index 508eacb86..80913aa67 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -28,7 +28,6 @@ #include "dehacked.h" // get_number (for thok) #include "m_cond.h" #include "d_main.h" // MAINWAD_CHARS -#include "deh_tables.h" // Voice freeslotting #if 0 #include "k_kart.h" // K_KartResetPlayerColor #endif @@ -40,10 +39,8 @@ #include "discord.h" INT32 numskins = 0; -INT32 numskinvoices = 0; skin_t skins[MAXSKINS]; INT32 skinsorted[MAXSKINS]; -//kartvoice_t skinvoices[MAXSKINVOICES]; // FIXTHIS: don't work because it must be inistilised before the config load //#define SKINVALUES @@ -298,13 +295,6 @@ sfxenum_t P_GetKartVoiceSFX(kartvoice_t *voice, INT32 skinsound) return sfx_thok; } -void R_ClearVoice(skin_t *skin, INT32 voicetype) -{ - kartvoice_t *voice = &skin->voices[voicetype]; - - memset(voice, 0, sizeof(kartvoice_t)); -} - static void Sk_SetDefaultValue(skin_t *skin, kartvoice_t *skin_voice) { INT32 i; @@ -1817,8 +1807,6 @@ void R_PatchSkins(UINT16 wadnum) } else if (!R_ProcessPatchableFields(skin, stoken, value)) CONS_Debug(DBG_SETUP, "R_PatchSkins: Unknown keyword '%s' in P_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename); - - } if (!skin) diff --git a/src/r_skins.h b/src/r_skins.h index 519ab06d3..f7d9a323c 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -124,10 +124,9 @@ enum skinmenusortoption }; /// Externs -extern INT32 numskins, numskinvoices; +extern INT32 numskins; extern skin_t skins[MAXSKINS]; extern INT32 skinsorted[MAXSKINS]; -//extern kartvoice_t skinvoices[MAXSKINVOICES]; extern CV_PossibleValue_t Forceskin_cons_t[]; @@ -150,7 +149,6 @@ UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player); UINT8 P_KartFrameToSprite2(skin_t *skin, UINT8 inframe, UINT8 *outframe); INT32 R_AllocKartVoice(skin_t *skin, const char* name, INT32 *out); -void R_ClearVoice(skin_t *skin, INT32 voicetype); void Sk_SetSkinVoiceValue(kartvoice_t *voice, INT32 skinsound, INT32 writesound); INT32 R_FindIDForVoice(skin_t *skin, const char *voicename);