From 8ce5dc69ff69e71244233c3a56b264d5a0a8c60e Mon Sep 17 00:00:00 2001 From: lachablock Date: Fri, 10 Sep 2021 10:28:20 +1000 Subject: [PATCH 01/14] Add SegaSonic Arcade sounds --- src/sounds.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/sounds.h | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 264 insertions(+) diff --git a/src/sounds.c b/src/sounds.c index b46e11ba1..e9a13da77 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -908,6 +908,138 @@ sfxinfo_t S_sfx[NUMSFX] = {"mbv96", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"mbv97", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + // SegaSonic Arcade sounds + {"ssa001", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa002", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa003", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa004", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa005", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa006", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa007", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa008", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa009", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa010", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa011", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa012", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa013", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa014", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa015", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa016", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa017", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa018", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa019", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa020", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa021", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa022", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa023", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa024", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa025", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa026", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa027", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa028", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa029", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa030", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa031", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa032", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa033", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa034", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa035", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa036", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa037", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa038", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa039", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa040", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa041", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa042", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa043", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa044", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa045", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa046", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa047", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa048", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa049", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa050", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa051", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa052", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa053", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa054", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa055", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa056", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa057", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa058", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa059", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa060", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa061", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa062", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa063", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa064", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa065", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa066", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa067", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa068", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa069", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa070", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa071", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa072", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa073", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa074", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa075", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa076", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa077", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa078", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa079", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa080", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa081", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa082", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa083", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa084", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa085", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa086", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa087", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa088", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa089", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa090", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa091", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa092", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa093", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa094", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa095", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa096", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa097", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa098", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa099", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa100", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa101", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa102", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa103", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa104", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa105", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa106", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa107", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa108", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa109", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa110", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa111", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa112", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa113", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa114", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa115", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa116", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa117", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa118", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa119", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa120", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa121", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa122", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa123", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa124", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa125", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa126", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa127", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa128", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa129", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"ssa130", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + // SRB2kart {"slip", false, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Spinout {"screec", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Tight turning screech diff --git a/src/sounds.h b/src/sounds.h index 8d81aae20..9abf99117 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -972,6 +972,138 @@ typedef enum sfx_mbv96, sfx_mbv97, + // SegaSonic Arcade sounds + sfx_ssa001, + sfx_ssa002, + sfx_ssa003, + sfx_ssa004, + sfx_ssa005, + sfx_ssa006, + sfx_ssa007, + sfx_ssa008, + sfx_ssa009, + sfx_ssa010, + sfx_ssa011, + sfx_ssa012, + sfx_ssa013, + sfx_ssa014, + sfx_ssa015, + sfx_ssa016, + sfx_ssa017, + sfx_ssa018, + sfx_ssa019, + sfx_ssa020, + sfx_ssa021, + sfx_ssa022, + sfx_ssa023, + sfx_ssa024, + sfx_ssa025, + sfx_ssa026, + sfx_ssa027, + sfx_ssa028, + sfx_ssa029, + sfx_ssa030, + sfx_ssa031, + sfx_ssa032, + sfx_ssa033, + sfx_ssa034, + sfx_ssa035, + sfx_ssa036, + sfx_ssa037, + sfx_ssa038, + sfx_ssa039, + sfx_ssa040, + sfx_ssa041, + sfx_ssa042, + sfx_ssa043, + sfx_ssa044, + sfx_ssa045, + sfx_ssa046, + sfx_ssa047, + sfx_ssa048, + sfx_ssa049, + sfx_ssa050, + sfx_ssa051, + sfx_ssa052, + sfx_ssa053, + sfx_ssa054, + sfx_ssa055, + sfx_ssa056, + sfx_ssa057, + sfx_ssa058, + sfx_ssa059, + sfx_ssa060, + sfx_ssa061, + sfx_ssa062, + sfx_ssa063, + sfx_ssa064, + sfx_ssa065, + sfx_ssa066, + sfx_ssa067, + sfx_ssa068, + sfx_ssa069, + sfx_ssa070, + sfx_ssa071, + sfx_ssa072, + sfx_ssa073, + sfx_ssa074, + sfx_ssa075, + sfx_ssa076, + sfx_ssa077, + sfx_ssa078, + sfx_ssa079, + sfx_ssa080, + sfx_ssa081, + sfx_ssa082, + sfx_ssa083, + sfx_ssa084, + sfx_ssa085, + sfx_ssa086, + sfx_ssa087, + sfx_ssa088, + sfx_ssa089, + sfx_ssa090, + sfx_ssa091, + sfx_ssa092, + sfx_ssa093, + sfx_ssa094, + sfx_ssa095, + sfx_ssa096, + sfx_ssa097, + sfx_ssa098, + sfx_ssa099, + sfx_ssa100, + sfx_ssa101, + sfx_ssa102, + sfx_ssa103, + sfx_ssa104, + sfx_ssa105, + sfx_ssa106, + sfx_ssa107, + sfx_ssa108, + sfx_ssa109, + sfx_ssa110, + sfx_ssa111, + sfx_ssa112, + sfx_ssa113, + sfx_ssa114, + sfx_ssa115, + sfx_ssa116, + sfx_ssa117, + sfx_ssa118, + sfx_ssa119, + sfx_ssa120, + sfx_ssa121, + sfx_ssa122, + sfx_ssa123, + sfx_ssa124, + sfx_ssa125, + sfx_ssa126, + sfx_ssa127, + sfx_ssa128, + sfx_ssa129, + sfx_ssa130, + // SRB2kart sfx_slip, sfx_screec, From e82bba18f6925c3710aaa646cd220cb0b25dee39 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 8 Nov 2021 18:50:19 -0800 Subject: [PATCH 02/14] Use volume field of sound, access with SOC/lua Volumes may be defined on a 0-100 scale, but any number is accepted. If the volume is negative then the sound will play at normal volume (therefore the info table won't need to be modified.) --- src/deh_soc.c | 4 ++++ src/lua_infolib.c | 13 +++++++++++++ src/s_sound.c | 12 ++++++++++-- src/s_sound.h | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 7b5318f2b..4ab4a29aa 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2683,6 +2683,10 @@ void readsound(MYFILE *f, INT32 num) { S_sfx[num].pitch = value; } + else if (fastcmp(word, "VOLUME")) + { + S_sfx[num].volume = value; + } else if (fastcmp(word, "CAPTION") || fastcmp(word, "DESCRIPTION")) { deh_strlcpy(S_sfx[num].caption, word2, diff --git a/src/lua_infolib.c b/src/lua_infolib.c index bbf640b85..880496770 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -41,6 +41,7 @@ enum sfxinfo_read { sfxinfor_singular, sfxinfor_priority, sfxinfor_flags, // "pitch" + sfxinfor_volume, sfxinfor_caption, sfxinfor_skinsound }; @@ -49,6 +50,7 @@ const char *const sfxinfo_ropt[] = { "singular", "priority", "flags", + "volume", "caption", "skinsound", NULL}; @@ -57,12 +59,14 @@ enum sfxinfo_write { sfxinfow_singular = 0, sfxinfow_priority, sfxinfow_flags, // "pitch" + sfxinfow_volume, sfxinfow_caption }; const char *const sfxinfo_wopt[] = { "singular", "priority", "flags", + "volume", "caption", NULL}; @@ -1328,6 +1332,9 @@ static int lib_setSfxInfo(lua_State *L) case sfxinfow_flags: info->pitch = (INT32)luaL_checkinteger(L, 3); break; + case sfxinfow_volume: + info->volume = (INT32)luaL_checkinteger(L, 3); + break; case sfxinfow_caption: strlcpy(info->caption, luaL_checkstring(L, 3), sizeof(info->caption)); break; @@ -1368,6 +1375,9 @@ static int sfxinfo_get(lua_State *L) case sfxinfor_flags: lua_pushinteger(L, sfx->pitch); return 1; + case sfxinfor_volume: + lua_pushinteger(L, sfx->volume); + return 1; case sfxinfor_caption: lua_pushstring(L, sfx->caption); return 1; @@ -1408,6 +1418,9 @@ static int sfxinfo_set(lua_State *L) case sfxinfow_flags: sfx->pitch = luaL_checkinteger(L, 1); break; + case sfxinfow_volume: + sfx->volume = luaL_checkinteger(L, 1); + break; case sfxinfow_caption: strlcpy(sfx->caption, luaL_checkstring(L, 1), sizeof(sfx->caption)); break; diff --git a/src/s_sound.c b/src/s_sound.c index c4af37082..d4a63b59e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -693,7 +693,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) channels[cnum].sfxinfo = sfx; channels[cnum].origin = origin; channels[cnum].volume = initial_volume; - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); + channels[cnum].handle = I_StartSound(sfx_id, S_GetSoundVolume(sfx, volume), sep, pitch, priority, cnum); } } @@ -899,7 +899,7 @@ void S_UpdateSounds(void) } if (audible) - I_UpdateSoundParams(c->handle, volume, sep, pitch); + I_UpdateSoundParams(c->handle, S_GetSoundVolume(c->sfxinfo, volume), sep, pitch); else S_StopChannel(cnum); } @@ -1011,6 +1011,14 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t return FixedDiv(approx_dist, mapobjectscale); // approx_dist } +INT32 S_GetSoundVolume(sfxinfo_t *sfx, INT32 volume) +{ + if (sfx->volume < 0) + return volume; + else + return volume * sfx->volume / 100; +} + // // Changes volume, stereo-separation, and pitch variables // from the norm of a sound effect to be played. diff --git a/src/s_sound.h b/src/s_sound.h index 80a53fb3e..816a90fb5 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -295,6 +295,8 @@ void S_UpdateClosedCaptions(void); FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2); +INT32 S_GetSoundVolume(sfxinfo_t *sfx, INT32 volume); + void S_SetSfxVolume(INT32 volume); void S_SetMusicVolume(INT32 digvolume); #define S_SetDigMusicVolume S_SetMusicVolume From d7e5d178e795fe7c713813c130b190bcc3b78635 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 25 Nov 2021 17:01:41 +0000 Subject: [PATCH 03/14] Fix ring capsules popping for you if you have an SPB. --- src/p_inter.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index e0ba88296..1b0ca880d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -278,19 +278,27 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_KillMobj(special, toucher, toucher, DMG_NORMAL); break; case MT_ITEMCAPSULE: - if (special->threshold != KITEM_SUPERRING - && special->threshold != KITEM_SPB - && !P_CanPickupItem(player, 1)) - return; - if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0) return; if (special->scale < special->extravalue1) // don't break it while it's respawning return; - if (special->threshold == KITEM_SPB && K_IsSPBInGame()) // don't spawn a second SPB - return; + switch (special->threshold) + { + case KITEM_SPB: + if (K_IsSPBInGame()) // don't spawn a second SPB + return; + break; + case KITEM_SUPERRING: + if (player->pflags & PF_RINGLOCK) // no cheaty rings + return; + break; + default: + if (!P_CanPickupItem(player, 1)) + return; + break; + } S_StartSound(toucher, special->info->deathsound); P_KillMobj(special, toucher, toucher, DMG_NORMAL); From 170d0a2fb9e03e3003b2fcf443479c06b45065f4 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 25 Nov 2021 13:43:17 -0800 Subject: [PATCH 04/14] Toaster suggestions for e82bba18 --- src/s_sound.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index d4a63b59e..7e44bb207 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1013,10 +1013,10 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t INT32 S_GetSoundVolume(sfxinfo_t *sfx, INT32 volume) { - if (sfx->volume < 0) - return volume; - else - return volume * sfx->volume / 100; + if (sfx->volume > 0) + return (volume * sfx->volume) / 100; + + return volume; } // From 1958f3f61c80388cfc2a708824f454cc06dc199b Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 26 Nov 2021 12:55:23 -0800 Subject: [PATCH 05/14] Sync respawn.airtimer Oops! --- src/p_saveg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 27e100ccd..740272874 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -334,6 +334,7 @@ static void P_NetArchivePlayers(void) WRITEFIXED(save_p, players[i].respawn.pointz); WRITEUINT8(save_p, players[i].respawn.flip); WRITEUINT32(save_p, players[i].respawn.timer); + WRITEUINT32(save_p, players[i].respawn.airtimer); WRITEUINT32(save_p, players[i].respawn.distanceleft); WRITEUINT32(save_p, players[i].respawn.dropdash); @@ -590,6 +591,7 @@ static void P_NetUnArchivePlayers(void) players[i].respawn.pointz = READFIXED(save_p); players[i].respawn.flip = (boolean)READUINT8(save_p); players[i].respawn.timer = READUINT32(save_p); + players[i].respawn.airtimer = READUINT32(save_p); players[i].respawn.distanceleft = READUINT32(save_p); players[i].respawn.dropdash = READUINT32(save_p); From 5f625437a827b750f2128bca01107e8386fb4e0f Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 26 Nov 2021 18:20:16 -0800 Subject: [PATCH 06/14] Move level music check out of player thinker Hitlag during this tic will skip playing the music. --- src/k_kart.c | 7 ------- src/p_tick.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 3d46bbfca..629eecf94 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6983,13 +6983,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // Handle invincibility sfx K_UpdateInvincibilitySounds(player); // Also thanks, VAda! - - // Plays the music after the starting countdown. - if (P_IsLocalPlayer(player) && leveltime == (starttime + (TICRATE/2))) - { - S_ChangeMusic(mapmusname, mapmusflags, true); - S_ShowMusicCredit(); - } } void K_KartPlayerAfterThink(player_t *player) diff --git a/src/p_tick.c b/src/p_tick.c index 5e92649cb..be82b9d40 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -608,6 +608,13 @@ void P_Ticker(boolean run) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); + // Plays the music after the starting countdown. + if (leveltime == (starttime + (TICRATE/2))) + { + S_ChangeMusic(mapmusname, mapmusflags, true); + S_ShowMusicCredit(); + } + ps_lua_thinkframe_time = I_GetPreciseTime(); LUAh_ThinkFrame(); ps_lua_thinkframe_time = I_GetPreciseTime() - ps_lua_thinkframe_time; From 25c6852482c60fb22443b7e8b1c306c72ab0fb49 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 26 Nov 2021 19:17:53 -0800 Subject: [PATCH 07/14] Let the player touch balloons --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index e333de1b0..c28c81dfd 100644 --- a/src/info.c +++ b/src/info.c @@ -8686,7 +8686,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 20*FRACUNIT, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY, // flags + MF_SPECIAL|MF_NOGRAVITY, // flags S_BALLOONPOP1 // raisestate }, From db4bb74c424e1267fd2dd3f2493f6b0985389410 Mon Sep 17 00:00:00 2001 From: SteelT Date: Fri, 26 Nov 2021 23:13:17 -0500 Subject: [PATCH 08/14] All springs give spring grease --- src/d_player.h | 2 +- src/k_kart.c | 2 +- src/p_map.c | 21 +++++++++------------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index dd765bb0b..b8add36aa 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -390,7 +390,7 @@ typedef struct player_s fixed_t offroad; // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed UINT8 waterskip; // Water skipping counter - UINT16 tiregrease; // Reduced friction timer after hitting a horizontal spring + UINT16 tiregrease; // Reduced friction timer after hitting a spring UINT16 springstars; // Spawn stars around a player when they hit a spring UINT16 springcolor; // Color of spring stars UINT8 dashpadcooldown; // Separate the vanilla SA-style dash pads from using flashing diff --git a/src/k_kart.c b/src/k_kart.c index 3d46bbfca..20e1df91f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8342,7 +8342,7 @@ void K_AdjustPlayerFriction(player_t *player) return; } - // Reduce friction after hitting a horizontal spring + // Reduce friction after hitting a spring if (player->tiregrease) { player->mo->friction += ((FRACUNIT - prevfriction) / greasetics) * player->tiregrease; diff --git a/src/p_map.c b/src/p_map.c index 829393d32..28c747997 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -347,20 +347,17 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (object->player) { - // Less friction when hitting horizontal springs - if (!vertispeed) + // Less friction when hitting springs + if (!object->player->tiregrease) { - if (!object->player->tiregrease) + UINT8 i; + for (i = 0; i < 2; i++) { - UINT8 i; - for (i = 0; i < 2; i++) - { - mobj_t *grease; - grease = P_SpawnMobj(object->x, object->y, object->z, MT_TIREGREASE); - P_SetTarget(&grease->target, object); - grease->angle = K_MomentumAngle(object); - grease->extravalue1 = i; - } + mobj_t *grease; + grease = P_SpawnMobj(object->x, object->y, object->z, MT_TIREGREASE); + P_SetTarget(&grease->target, object); + grease->angle = K_MomentumAngle(object); + grease->extravalue1 = i; } object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS From d1a5a829806c84352ddfaac59fd388e1dc77db2b Mon Sep 17 00:00:00 2001 From: SteelT Date: Fri, 26 Nov 2021 23:44:06 -0500 Subject: [PATCH 09/14] Spring grease vfx is no longer visible when you're airborne --- src/p_mobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 34b48dc9c..2204003b4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6889,6 +6889,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) z); mobj->angle = ang; + if (!P_IsObjectOnGround(mobj->target)) + mobj->renderflags |= RF_DONTDRAW; + if (leveltime & 1) mobj->renderflags |= RF_DONTDRAW; From 059058476eb697a09312238fdc597fae70bdc856 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 26 Nov 2021 21:55:32 -0800 Subject: [PATCH 10/14] Elimination timer for karma bombs during overtime Every hit on another player while you are alive awards you five seconds of karma bomb time during overtime. When this timer is empty, you will DIE. --- src/d_player.h | 1 + src/g_game.c | 1 + src/k_hud.c | 5 ++++- src/k_kart.c | 26 ++++++++++++++++++-------- src/p_inter.c | 4 ++++ src/p_saveg.c | 2 ++ 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index dd765bb0b..993a9de4d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -468,6 +468,7 @@ typedef struct player_s UINT8 emeralds; UINT8 bumpers; INT16 karmadelay; + tic_t overtimekarma; // time to live in overtime comeback INT16 spheres; SINT8 glanceDir; // Direction the player is trying to look backwards in diff --git a/src/g_game.c b/src/g_game.c index 580b3bf0d..c675e9a22 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2281,6 +2281,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->growshrinktimer = growshrinktimer; p->bumpers = bumper; p->karmadelay = comebacktime; + p->overtimekarma = 0; p->eggmanblame = -1; p->lastdraft = -1; p->karthud[khud_fault] = khudfault; diff --git a/src/k_hud.c b/src/k_hud.c index 1b7894da9..2d821ddd4 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2460,7 +2460,10 @@ static void K_drawKartBumpersOrKarma(void) else V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_bumpersticker, colormap); - V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d/%d", stplyr->bumpers, maxbumper)); + if (stplyr->bumpers > 0) + V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d/%d", stplyr->bumpers, maxbumper)); + else // TODO - BETTER HUD + V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d", stplyr->overtimekarma / TICRATE)); } } } diff --git a/src/k_kart.c b/src/k_kart.c index 3d46bbfca..5fe2b7ef6 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6890,18 +6890,28 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_KartPlayerHUDUpdate(player); - if ((battleovertime.enabled >= 10*TICRATE) && !(player->pflags & PF_ELIMINATED)) + if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED)) { - fixed_t distanceToBarrier = 0; - - if (battleovertime.radius > 0) + if (battleovertime.enabled >= 10*TICRATE) { - distanceToBarrier = R_PointToDist2(player->mo->x, player->mo->y, battleovertime.x, battleovertime.y) - (player->mo->radius * 2); + fixed_t distanceToBarrier = 0; + + if (battleovertime.radius > 0) + { + distanceToBarrier = R_PointToDist2(player->mo->x, player->mo->y, battleovertime.x, battleovertime.y) - (player->mo->radius * 2); + } + + if (distanceToBarrier > battleovertime.radius) + { + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); + } } - - if (distanceToBarrier > battleovertime.radius) + else if (player->bumpers <= 0) { - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); + if (player->overtimekarma) + player->overtimekarma--; + else + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); } } diff --git a/src/p_inter.c b/src/p_inter.c index e0ba88296..ea14e5f7c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1972,6 +1972,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da // Destroy any remainder bumpers from the player for karma comeback damage K_DestroyBumpers(player, player->bumpers); } + else + { + source->player->overtimekarma += 5*TICRATE; + } if (damagetype & DMG_STEAL) { diff --git a/src/p_saveg.c b/src/p_saveg.c index 27e100ccd..cd8f1d208 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -317,6 +317,7 @@ static void P_NetArchivePlayers(void) WRITEUINT8(save_p, players[i].emeralds); WRITEUINT8(save_p, players[i].bumpers); WRITEINT16(save_p, players[i].karmadelay); + WRITEUINT32(save_p, players[i].overtimekarma); WRITEINT16(save_p, players[i].spheres); WRITESINT8(save_p, players[i].glanceDir); @@ -573,6 +574,7 @@ static void P_NetUnArchivePlayers(void) players[i].emeralds = READUINT8(save_p); players[i].bumpers = READUINT8(save_p); players[i].karmadelay = READINT16(save_p); + players[i].overtimekarma = READUINT32(save_p); players[i].spheres = READINT16(save_p); players[i].glanceDir = READSINT8(save_p); From 5f9ec5caa6b604367cde67130d9910212c889181 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 27 Nov 2021 00:06:01 -0800 Subject: [PATCH 11/14] Fix karma overtime not counting down after 10 seconds :) --- src/k_hud.c | 6 ++---- src/k_kart.c | 34 ++++++++++++++++------------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 2d821ddd4..87cc99f17 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2460,10 +2460,8 @@ static void K_drawKartBumpersOrKarma(void) else V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_bumpersticker, colormap); - if (stplyr->bumpers > 0) - V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d/%d", stplyr->bumpers, maxbumper)); - else // TODO - BETTER HUD - V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d", stplyr->overtimekarma / TICRATE)); + // TODO BETTER HUD + V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d - %d", stplyr->bumpers, stplyr->overtimekarma / TICRATE)); } } } diff --git a/src/k_kart.c b/src/k_kart.c index 5fe2b7ef6..b6587364a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6890,28 +6890,26 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_KartPlayerHUDUpdate(player); - if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED)) + if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0) { - if (battleovertime.enabled >= 10*TICRATE) + if (player->overtimekarma) + player->overtimekarma--; + else + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); + } + + if ((battleovertime.enabled >= 10*TICRATE) && !(player->pflags & PF_ELIMINATED)) + { + fixed_t distanceToBarrier = 0; + + if (battleovertime.radius > 0) { - fixed_t distanceToBarrier = 0; - - if (battleovertime.radius > 0) - { - distanceToBarrier = R_PointToDist2(player->mo->x, player->mo->y, battleovertime.x, battleovertime.y) - (player->mo->radius * 2); - } - - if (distanceToBarrier > battleovertime.radius) - { - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); - } + distanceToBarrier = R_PointToDist2(player->mo->x, player->mo->y, battleovertime.x, battleovertime.y) - (player->mo->radius * 2); } - else if (player->bumpers <= 0) + + if (distanceToBarrier > battleovertime.radius) { - if (player->overtimekarma) - player->overtimekarma--; - else - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); } } From fd6c65a339dab2f1907ebb3e85b7a2370eae34da Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 27 Nov 2021 00:14:48 -0800 Subject: [PATCH 12/14] Don't count down overtime karma timer while waiting to become bomb --- src/k_hud.c | 2 +- src/k_kart.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 87cc99f17..7143396e5 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -2461,7 +2461,7 @@ static void K_drawKartBumpersOrKarma(void) V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_bumpersticker, colormap); // TODO BETTER HUD - V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d - %d", stplyr->bumpers, stplyr->overtimekarma / TICRATE)); + V_DrawKartString(LAPS_X+47, LAPS_Y+3, V_HUDTRANS|V_SLIDEIN|splitflags, va("%d/%d %d", stplyr->bumpers, maxbumper, stplyr->overtimekarma / TICRATE)); } } } diff --git a/src/k_kart.c b/src/k_kart.c index b6587364a..0282f8c90 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6890,7 +6890,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_KartPlayerHUDUpdate(player); - if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0) + if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0 && player->karmadelay <= 0) { if (player->overtimekarma) player->overtimekarma--; From f6e6c2010ebcf7d88b06954a7c539e73516a10c7 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 27 Nov 2021 01:21:46 -0800 Subject: [PATCH 13/14] Reintroduce battle overtime barrier minimum radius - 768 fracunit minimum. - Emerald spawning arc reduced so they spawn right next to the barrier at minimum radius. - Items always spawn. --- src/k_battle.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/k_battle.c b/src/k_battle.c index 5fc7cc05a..c33ea6bcc 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -179,7 +179,7 @@ mobj_t *K_SpawnChaosEmerald(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT P_Thrust(emerald, FixedAngle(P_RandomFixed() * 180) + angle, - 32 * mapobjectscale); + 24 * mapobjectscale); emerald->momz = flip * 24 * mapobjectscale; if (emerald->eflags & MFE_UNDERWATER) @@ -288,12 +288,6 @@ void K_RunPaperItemSpawners(void) if (overtime == true) { - if (battleovertime.radius < 512*mapobjectscale) - { - // Barrier has closed in too much - return; - } - // Double frequency of items interval /= 2; } @@ -557,10 +551,12 @@ void K_RunBattleOvertime(void) } else if (battleovertime.radius > 0) { - if (battleovertime.radius > 2*mapobjectscale) + const fixed_t minradius = 768 * mapobjectscale; + + if (battleovertime.radius > minradius) battleovertime.radius -= 2*mapobjectscale; else - battleovertime.radius = 0; + battleovertime.radius = minradius; } if (battleovertime.radius > 0) From 0d3a1b72cb4535ebfce2662d16f78e618f6b7711 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 27 Nov 2021 03:05:04 -0800 Subject: [PATCH 14/14] Apply grease to vertical only springs too --- src/p_map.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 28c747997..ff83a22a4 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -345,25 +345,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } - if (object->player) - { - // Less friction when hitting springs - if (!object->player->tiregrease) - { - UINT8 i; - for (i = 0; i < 2; i++) - { - mobj_t *grease; - grease = P_SpawnMobj(object->x, object->y, object->z, MT_TIREGREASE); - P_SetTarget(&grease->target, object); - grease->angle = K_MomentumAngle(object); - grease->extravalue1 = i; - } - - object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS - } - } - // Horizontal speed is used as a minimum thrust, not a direct replacement finalSpeed = max(objectSpeed, finalSpeed); @@ -386,6 +367,22 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) object->player->springstars = max(vertispeed, horizspeed) / FRACUNIT / 2; object->player->springcolor = starcolor; + + // Less friction when hitting springs + if (!object->player->tiregrease) + { + UINT8 i; + for (i = 0; i < 2; i++) + { + mobj_t *grease; + grease = P_SpawnMobj(object->x, object->y, object->z, MT_TIREGREASE); + P_SetTarget(&grease->target, object); + grease->angle = K_MomentumAngle(object); + grease->extravalue1 = i; + } + + object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS + } } return true;