From 1cff7a161aff241841133c53131a123b99b97dbe Mon Sep 17 00:00:00 2001 From: MascaraSnake <jonassauer27@gmail.com> Date: Tue, 28 Dec 2021 09:58:45 +0100 Subject: [PATCH] Adapt ambient sound effects to UDMF --- extras/conf/udb/Includes/SRB222_things.cfg | 70 +---- src/info.c | 285 +-------------------- src/info.h | 12 +- src/m_cheat.c | 2 +- src/p_mobj.c | 13 +- src/p_mobj.h | 2 +- src/p_setup.c | 27 ++ 7 files changed, 53 insertions(+), 358 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index d2c13154dd..58c4fe53d6 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -4965,68 +4965,16 @@ udmf 700 { - title = "Water Ambience A (Large)"; - sprite = "internal:ambiance"; - } - - 701 - { - title = "Water Ambience B (Large)"; - sprite = "internal:ambiance"; - } - - 702 - { - title = "Water Ambience C (Medium)"; - sprite = "internal:ambiance"; - } - - 703 - { - title = "Water Ambience D (Medium)"; - sprite = "internal:ambiance"; - } - - 704 - { - title = "Water Ambience E (Small)"; - sprite = "internal:ambiance"; - } - - 705 - { - title = "Water Ambience F (Small)"; - sprite = "internal:ambiance"; - } - - 706 - { - title = "Water Ambience G (Extra Large)"; - sprite = "internal:ambiance"; - } - - 707 - { - title = "Water Ambience H (Extra Large)"; - sprite = "internal:ambiance"; - } - - 708 - { - title = "Disco Ambience"; - sprite = "internal:ambiance"; - } - - 709 - { - title = "Volcano Ambience"; - sprite = "internal:ambiance"; - } - - 710 - { - title = "Machine Ambience"; + title = "Ambient Sound Effect"; sprite = "internal:ambiance"; + arg0 + { + title = "Repeat speed"; + } + stringarg0 + { + title = "Sound"; + } } 750 diff --git a/src/info.c b/src/info.c index ddcf6709e9..51f9ea8e64 100644 --- a/src/info.c +++ b/src/info.c @@ -18056,209 +18056,13 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // ambient water 1a (large) - { // MT_AWATERA + // ambient sound effect + { // MT_AMBIENT 700, // doomednum S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr1, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 1b (large) - { // MT_AWATERB - 701, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr2, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 2a (medium) - { // MT_AWATERC - 702, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr3, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 2b (medium) - { // MT_AWATERD - 703, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr4, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 3a (small) - { // MT_AWATERE - 704, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr5, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 3b (small) - { // MT_AWATERF - 705, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr6, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 4a (extra large) - { // MT_AWATERG - 706, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr7, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 4b (extra large) - { // MT_AWATERH - 707, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth + 1000, // spawnhealth S_NULL, // seestate - sfx_amwtr8, // seesound + sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -18280,87 +18084,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_RANDOMAMBIENT - 708, // doomednum - S_INVISIBLE, // spawnstate - 512, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambint, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 255, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - { // MT_RANDOMAMBIENT2 - 709, // doomednum - S_INVISIBLE, // spawnstate - 220, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambin2, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 255, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - { // MT_MACHINEAMBIENCE - 710, // doomednum - S_INVISIBLE, // spawnstate - 24, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambmac, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 200, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 1*FRACUNIT, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 20, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - { // MT_CORK -1, // doomednum S_CORK, // spawnstate diff --git a/src/info.h b/src/info.h index d5fcc8504d..7b33f92ba8 100644 --- a/src/info.h +++ b/src/info.h @@ -4934,17 +4934,7 @@ typedef enum mobj_type MT_FINISHFLAG, // Finish flag // Ambient Sounds - MT_AWATERA, // Ambient Water Sound 1 - MT_AWATERB, // Ambient Water Sound 2 - MT_AWATERC, // Ambient Water Sound 3 - MT_AWATERD, // Ambient Water Sound 4 - MT_AWATERE, // Ambient Water Sound 5 - MT_AWATERF, // Ambient Water Sound 6 - MT_AWATERG, // Ambient Water Sound 7 - MT_AWATERH, // Ambient Water Sound 8 - MT_RANDOMAMBIENT, - MT_RANDOMAMBIENT2, - MT_MACHINEAMBIENCE, + MT_AMBIENT, MT_CORK, MT_LHRT, diff --git a/src/m_cheat.c b/src/m_cheat.c index b5c3b65635..2f90b54ee1 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1004,7 +1004,7 @@ static void OP_CycleThings(INT32 amt) } while (mobjinfo[op_currentthing].doomednum == -1 || op_currentthing == MT_NIGHTSDRONE - || mobjinfo[op_currentthing].flags & (MF_AMBIENT|MF_NOSECTOR) + || mobjinfo[op_currentthing].flags & MF_NOSECTOR || (states[mobjinfo[op_currentthing].spawnstate].sprite == SPR_NULL && states[mobjinfo[op_currentthing].seestate].sprite == SPR_NULL) ); diff --git a/src/p_mobj.c b/src/p_mobj.c index bf413572f7..55f7a729ad 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10230,10 +10230,12 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->flags2 & MF2_FIRING) P_FiringThink(mobj); - if (mobj->flags & MF_AMBIENT) + if (mobj->type == MT_AMBIENT) { - if (!(leveltime % mobj->health) && mobj->info->seesound) - S_StartSound(mobj, mobj->info->seesound); + if (leveltime % mobj->health) + return; + if (mobj->threshold) + S_StartSound(mobj, mobj->threshold); return; } @@ -13060,6 +13062,11 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->angle += ANGLE_22h; *doangle = false; break; + case MT_AMBIENT: + if (mthing->stringargs[0]) + mobj->threshold = get_number(mthing->stringargs[0]); + mobj->health = mthing->args[0] ? mthing->args[0] : TICRATE; + break; default: break; } diff --git a/src/p_mobj.h b/src/p_mobj.h index 2d096385bd..23028f9951 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -118,7 +118,7 @@ typedef enum // Don't apply gravity (every tic); object will float, keeping current height // or changing it actively. MF_NOGRAVITY = 1<<9, - // This object is an ambient sound. + // This object is an ambient sound. Obsolete, but keep this around for backwards compatibility. MF_AMBIENT = 1<<10, // Slide this object when it hits a wall. MF_SLIDEME = 1<<11, diff --git a/src/p_setup.c b/src/p_setup.c index 54f887d608..37893f4c8a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5006,6 +5006,33 @@ static void P_ConvertBinaryMap(void) if (mapthings[i].options & MTF_AMBUSH) mapthings[i].args[0] |= TMDS_ROTATEEXTRA; break; + case 700: //Water ambience A + case 701: //Water ambience A + case 702: //Water ambience A + case 703: //Water ambience A + case 704: //Water ambience A + case 705: //Water ambience A + case 706: //Water ambience A + case 707: //Water ambience A + mapthings[i].args[0] = 35; + P_WriteConstant(sfx_amwtr1 + mapthings[i].type - 700, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 708: //Disco ambience + mapthings[i].args[0] = 512; + P_WriteConstant(sfx_ambint, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 709: //Volcano ambience + mapthings[i].args[0] = 220; + P_WriteConstant(sfx_ambin2, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 710: //Machine ambience + mapthings[i].args[0] = 24; + P_WriteConstant(sfx_ambmac, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; case 750: //Slope vertex mapthings[i].args[0] = mapthings[i].extrainfo; break; -- GitLab