diff --git a/src/d_main.c b/src/d_main.c index e26f60dc1..806919562 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -130,15 +130,9 @@ INT32 postimgparam[MAXSPLITSCREENPLAYERS]; // whether the respective sound system is disabled // or they're init'ed, but the player just toggled them #ifdef _XBOX -#ifndef NO_MIDI -boolean midi_disabled = true; -#endif boolean sound_disabled = true; boolean digital_disabled = true; #else -#ifndef NO_MIDI -boolean midi_disabled = false; -#endif boolean sound_disabled = false; boolean digital_disabled = false; #endif @@ -1388,17 +1382,11 @@ void D_SRB2Main(void) { sound_disabled = true; digital_disabled = true; -#ifndef NO_MIDI - midi_disabled = true; -#endif } if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic { sound_disabled = true; digital_disabled = true; -#ifndef NO_MIDI - midi_disabled = true; -#endif } else { @@ -1407,25 +1395,14 @@ void D_SRB2Main(void) if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic { digital_disabled = true; -#ifndef NO_MIDI - midi_disabled = true; -#endif } else { -#ifndef NO_MIDI - if (M_CheckParm("-nomidimusic")) - midi_disabled = true; // WARNING: DOS version initmusic in I_StartupSound -#endif if (M_CheckParm("-nodigmusic")) digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound } } - if (!( sound_disabled && digital_disabled -#ifndef NO_MIDI - && midi_disabled -#endif - )) + if (!( sound_disabled && digital_disabled )) { CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n"); I_StartupSound(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ee3898da5..078362f7e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1106,9 +1106,6 @@ void D_RegisterClientCommands(void) // s_sound.c CV_RegisterVar(&cv_soundvolume); CV_RegisterVar(&cv_digmusicvolume); -#ifndef NO_MIDI - CV_RegisterVar(&cv_midimusicvolume); -#endif CV_RegisterVar(&cv_numChannels); // i_cdmus.c diff --git a/src/d_player.h b/src/d_player.h index b9c44ed0e..ea892bcdd 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -57,7 +57,7 @@ typedef enum typedef enum { // Flip camera angle with gravity flip prefrence. - PF_FLIPCAM = 1, + PF_FAULT = 1, // Cheats PF_GODMODE = 1<<1, @@ -113,7 +113,8 @@ typedef enum // Spill rings after falling PF_NIGHTSFALL = 1<<24, PF_DRILLING = 1<<25, - PF_SKIDDOWN = 1<<26, + + // free: 1<<26 /*** TAG STUFF ***/ PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek. @@ -257,6 +258,25 @@ typedef enum NUMKARTSHIELDS } kartshields_t; +typedef enum +{ + KSPIN_THRUST = (1<<0), + KSPIN_IFRAMES = (1<<1), + KSPIN_AIRTIMER = (1<<2), + + KSPIN_TYPEBIT = (1<<3), + KSPIN_TYPEMASK = ~( KSPIN_TYPEBIT - 1 ), + +#define KSPIN_TYPE( type ) ( KSPIN_TYPEBIT << type ) + + KSPIN_SPINOUT = KSPIN_TYPE(0)|KSPIN_IFRAMES|KSPIN_THRUST, + KSPIN_WIPEOUT = KSPIN_TYPE(1)|KSPIN_IFRAMES, + KSPIN_STUNG = KSPIN_TYPE(2), + KSPIN_EXPLOSION = KSPIN_TYPE(3)|KSPIN_IFRAMES|KSPIN_AIRTIMER, + +#undef KSPIN_TYPE +} kartspinoutflags_t; + //{ SRB2kart - kartstuff typedef enum { @@ -270,7 +290,7 @@ typedef enum k_instashield, // Instashield no-damage animation timer k_floorboost, // Prevents Sneaker sounds for a breif duration when triggered by a floor panel - k_spinouttype, // Determines whether to thrust forward or not while spinning out; 0 = move forwards, 1 = stay still, 2 = stay still & no flashing tics + k_spinouttype, // Determines the mode of spinout/wipeout, see kartspinoutflags_t k_drift, // Drifting Left or Right, plus a bigger counter = sharper turn k_driftend, // Drift has ended, used to adjust character angle after drift diff --git a/src/dehacked.c b/src/dehacked.c index 613d262ac..72a195299 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8524,7 +8524,7 @@ static const char *const MAPTHINGFLAG_LIST[4] = { static const char *const PLAYERFLAG_LIST[] = { // Flip camera angle with gravity flip prefrence. - "FLIPCAM", + "FAULT", // Cheats "GODMODE", @@ -8580,7 +8580,8 @@ static const char *const PLAYERFLAG_LIST[] = { // Spill rings after falling "NIGHTSFALL", "DRILLING", - "SKIDDOWN", + + "\x01", // free: 1<<26 (name un-matchable) /*** TAG STUFF ***/ "TAGGED", // Player has been tagged and awaits the next round in hide and seek. @@ -9438,6 +9439,19 @@ struct { {"KSHIELD_FLAME",KSHIELD_FLAME}, {"NUMKARTSHIELDS",NUMKARTSHIELDS}, + // kartspinoutflags_t + {"KSPIN_THRUST",KSPIN_THRUST}, + {"KSPIN_IFRAMES",KSPIN_IFRAMES}, + {"KSPIN_AIRTIMER",KSPIN_AIRTIMER}, + + {"KSPIN_TYPEBIT",KSPIN_TYPEBIT}, + {"KSPIN_TYPEMASK",KSPIN_TYPEMASK}, + + {"KSPIN_SPINOUT",KSPIN_SPINOUT}, + {"KSPIN_WIPEOUT",KSPIN_WIPEOUT}, + {"KSPIN_STUNG",KSPIN_STUNG}, + {"KSPIN_EXPLOSION",KSPIN_EXPLOSION}, + // translation colormaps {"TC_DEFAULT",TC_DEFAULT}, {"TC_BOSS",TC_BOSS}, diff --git a/src/doomdef.h b/src/doomdef.h index 0e9b377cb..a3f7cacd2 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -636,9 +636,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// SRB2Kart: Camera always has noclip. #define NOCLIPCAM -/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define -#define NO_MIDI - /// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up /// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down) /// on the bright side it fixes some weird issues with translucent walls @@ -649,6 +646,11 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Hardware renderer: OpenGL #define GL_SHADERS +/// Divide volume of music and sounds by this much (loudest sounds on earth) +#define VOLUME_DIVIDER 4 +#define USER_VOLUME_SCALE 2 +#define MAX_VOLUME ( 100 * VOLUME_DIVIDER / USER_VOLUME_SCALE ) + #if defined (HAVE_CURL) && ! defined (NONET) #define MASTERSERVER #else diff --git a/src/doomstat.h b/src/doomstat.h index e678886a8..bf4f64497 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -110,11 +110,6 @@ extern boolean forceresetplayers, deferencoremode; // Internal parameters for sound rendering. // ======================================== -#ifdef NO_MIDI -#define midi_disabled true -#else -extern boolean midi_disabled; -#endif extern boolean sound_disabled; extern boolean digital_disabled; diff --git a/src/g_game.c b/src/g_game.c index ec3e598c2..415b45374 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2610,7 +2610,7 @@ void G_PlayerReborn(INT32 player) jointime = players[player].jointime; splitscreenindex = players[player].splitscreenindex; spectator = players[player].spectator; - pflags = (players[player].pflags & (PF_TIMEOVER|PF_TAGIT|PF_TAGGED|PF_WANTSTOJOIN)); + pflags = (players[player].pflags & (PF_TIMEOVER|PF_TAGIT|PF_TAGGED|PF_WANTSTOJOIN|PF_FAULT)); // As long as we're not in multiplayer, carry over cheatcodes from map to map if (!(netgame || multiplayer)) @@ -2782,11 +2782,6 @@ void G_PlayerReborn(INT32 player) if (songcredit) S_ShowMusicCredit(); - if (leveltime > (starttime + (TICRATE/2)) && !p->spectator) - { - K_DoIngameRespawn(p); - } - if (gametype == GT_COOP) P_FindEmerald(); // scan for emeralds to hunt for @@ -2885,7 +2880,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) P_SpawnPlayer(playernum); - if (starpost) //Don't even bother with looking for a place to spawn. + if (starpost || ( players[playernum].pflags & PF_FAULT )) //Don't even bother with looking for a place to spawn. { P_MovePlayerToStarpost(playernum); #ifdef HAVE_BLUA @@ -4636,7 +4631,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool memset(&players[i].respawn, 0, sizeof (players[i].respawn)); // The latter two should clear by themselves, but just in case - players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); + players[i].pflags &= ~(PF_FAULT|PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); // Clear cheatcodes too, just in case. players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); diff --git a/src/i_sound.h b/src/i_sound.h index 93e3f6dd0..28cab0c54 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -24,7 +24,6 @@ typedef enum { MU_CMD, MU_WAV, MU_MOD, - MU_MID, MU_OGG, MU_MP3, MU_MP3_MAD_UNUSED, // use MU_MP3 instead @@ -118,7 +117,7 @@ void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch); \return void */ -void I_SetSfxVolume(UINT8 volume); +void I_SetSfxVolume(int volume); /// ------------------------ // MUSIC SYSTEM @@ -227,7 +226,7 @@ void I_ResumeSong(void); \return void */ -void I_SetMusicVolume(UINT8 volume); +void I_SetMusicVolume(int volume); boolean I_SetSongTrack(INT32 track); diff --git a/src/k_collide.c b/src/k_collide.c index 1921e3d38..641fc5bb6 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -148,7 +148,7 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2) else { // Player Damage - K_SpinPlayer(t2->player, t1->target, 0, t1, (t1->type == MT_BANANA || t1->type == MT_BANANA_SHIELD)); + K_SpinPlayer(t2->player, t1->target, KSPIN_SPINOUT, t1, (t1->type == MT_BANANA || t1->type == MT_BANANA_SHIELD)); } damageitem = true; @@ -332,7 +332,7 @@ boolean K_MineExplosionCollide(mobj_t *t1, mobj_t *t2) if (t1->state == &states[S_MINEEXPLOSION1]) K_ExplodePlayer(t2->player, t1->target, t1); else - K_SpinPlayer(t2->player, t1->target, 0, t1, false); + K_SpinPlayer(t2->player, t1->target, KSPIN_SPINOUT, t1, false); } else if (t2->flags & MF_SHOOTABLE) { diff --git a/src/k_kart.c b/src/k_kart.c index 7b25ee856..09c42f564 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1055,7 +1055,7 @@ static void K_DebtStingPlayer(player_t *player, INT32 length) player->kartstuff[k_driftcharge] = 0; player->kartstuff[k_pogospring] = 0; - player->kartstuff[k_spinouttype] = 2; + player->kartstuff[k_spinouttype] = KSPIN_STUNG; player->kartstuff[k_spinouttimer] = length; player->kartstuff[k_wipeoutslow] = min(length-1, wipeoutslowtime+1); @@ -2456,7 +2456,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto if (player->health <= 0) return; - if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2) + if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && ( player->kartstuff[k_spinouttype] & KSPIN_IFRAMES )) || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) { @@ -2528,7 +2528,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto player->kartstuff[k_spinouttype] = type; - if (player->kartstuff[k_spinouttype] <= 0) // type 0 is spinout, type 1 is wipeout, type 2 is no-invuln wipeout + if (( player->kartstuff[k_spinouttype] & KSPIN_THRUST )) { // At spinout, player speed is increased to 1/4 their regular speed, moving them forward if (player->speed < K_GetKartSpeed(player, true)/4) @@ -2759,7 +2759,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b player->kartstuff[k_pogospring] = 0; // This is the only part that SHOULDN'T combo :VVVVV - if (G_BattleGametype() && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2))) + if (G_BattleGametype() && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && ( player->kartstuff[k_spinouttype] & KSPIN_IFRAMES )))) { if (source && source->player && player != source->player) { @@ -2798,7 +2798,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b K_CheckBumpers(); } - player->kartstuff[k_spinouttype] = 1; + player->kartstuff[k_spinouttype] = KSPIN_EXPLOSION; player->kartstuff[k_spinouttimer] = (3*TICRATE/2)+2; player->powers[pw_flashing] = K_GetKartFlashing(player); @@ -2849,7 +2849,7 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force) if (player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0) return; - if (victim->powers[pw_flashing] > 0 || victim->kartstuff[k_squishedtimer] > 0 || (victim->kartstuff[k_spinouttimer] > 0 && victim->kartstuff[k_spinouttype] != 2) + if (victim->powers[pw_flashing] > 0 || victim->kartstuff[k_squishedtimer] > 0 || (victim->kartstuff[k_spinouttimer] > 0 && ( victim->kartstuff[k_spinouttype] & KSPIN_IFRAMES )) || victim->kartstuff[k_invincibilitytimer] > 0 || victim->kartstuff[k_growshrinktimer] > 0 || victim->kartstuff[k_hyudorotimer] > 0) { K_DoInstashield(victim); @@ -3883,7 +3883,7 @@ void K_DriftDustHandling(mobj_t *spawner) if (spawner->player) { - if (spawner->player->pflags & PF_SKIDDOWN) + if (spawner->player->pflags & PF_FAULT) { anglediff = abs((signed)(spawner->angle - spawner->player->frameangle)); if (leveltime % 6 == 0) @@ -5705,7 +5705,7 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_tauntvoices]) player->karthud[khud_tauntvoices]--; - if (!(player->pflags & PF_SKIDDOWN)) + if (!(player->pflags & PF_FAULT)) player->karthud[khud_fault] = 0; else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE) player->karthud[khud_fault]++; @@ -6096,7 +6096,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->karthud[khud_timeovercam] = 0; // Specific hack because it insists on setting flashing tics during this anyway... - if (player->kartstuff[k_spinouttype] == 2) + if (( player->kartstuff[k_spinouttype] & KSPIN_IFRAMES ) == 0) { player->powers[pw_flashing] = 0; } @@ -6115,7 +6115,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_spinouttimer]) { if ((P_IsObjectOnGround(player->mo) - || (player->kartstuff[k_spinouttype] != 0)) + || ( player->kartstuff[k_spinouttype] & KSPIN_AIRTIMER )) && (!player->kartstuff[k_sneakertimer])) { player->kartstuff[k_spinouttimer]--; @@ -6272,7 +6272,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->kartstuff[k_killfield]++; if (player->kartstuff[k_killfield] > 4*TICRATE) { - K_SpinPlayer(player, NULL, 0, NULL, false); + K_SpinPlayer(player, NULL, KSPIN_SPINOUT, NULL, false); //player->kartstuff[k_killfield] = 1; } } @@ -7384,7 +7384,7 @@ static void K_KartSpindash(player_t *player) } } else if (chargetime < -TICRATE) - K_SpinPlayer(player, NULL, 0, NULL, false); + K_SpinPlayer(player, NULL, KSPIN_SPINOUT, NULL, false); else { if (player->kartstuff[k_spindash] % 4 == 0) diff --git a/src/k_respawn.c b/src/k_respawn.c index be55e2389..a6543d425 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -97,7 +97,8 @@ void K_DoIngameRespawn(player_t *player) return; } - if (player->respawn.state != RESPAWNST_NONE) + if (player->respawn.state != RESPAWNST_NONE && + ( player->pflags & PF_FAULT ) == 0) { return; } @@ -110,7 +111,7 @@ void K_DoIngameRespawn(player_t *player) if (leveltime < starttime) // FAULT { player->powers[pw_nocontrol] = (starttime - leveltime) + 50; - player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse + player->pflags |= PF_FAULT; S_StartSound(player->mo, sfx_s3k83); player->karthud[khud_fault] = 1; } @@ -192,6 +193,8 @@ void K_DoIngameRespawn(player_t *player) player->respawn.pointx = beststart->x << FRACBITS; player->respawn.pointy = beststart->y << FRACBITS; + player->mo->angle = ( beststart->angle * ANG1 ); + s = R_PointInSubsector(beststart->x << FRACBITS, beststart->y << FRACBITS)->sector; player->respawn.flip = (beststart->options & MTF_OBJECTFLIP); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2c7b2a3a9..350a259b9 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1955,8 +1955,6 @@ static int lib_sMusicInfo(lua_State *L) static int lib_sMusicExists(lua_State *L) { - boolean checkMIDI = lua_opttrueboolean(L, 2); - boolean checkDigi = lua_opttrueboolean(L, 3); #ifdef MUSICSLOT_COMPATIBILITY const char *music_name; UINT32 music_num; @@ -1985,7 +1983,7 @@ static int lib_sMusicExists(lua_State *L) const char *music_name = luaL_checkstring(L, 1); #endif NOHUD - lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi)); + lua_pushboolean(L, S_MusicExists(music_name)); return 1; } diff --git a/src/m_menu.c b/src/m_menu.c index dcadc6d21..785200d83 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2379,6 +2379,11 @@ static void M_ChangeCvar(INT32 choice) ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_INVISSLIDER) ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_NOMOD)) { + if (cv == &cv_digmusicvolume || cv == &cv_soundvolume) + { + choice *= 5; + } + CV_SetValue(cv,cv->value+choice); } else if (cv->flags & CV_FLOAT) diff --git a/src/p_inter.c b/src/p_inter.c index 135067753..a10e5eddc 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -557,7 +557,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_RemoveMobj(special); } else - K_SpinPlayer(player, special->target, 0, special, false); + K_SpinPlayer(player, special->target, KSPIN_SPINOUT, special, false); return; /*case MT_EERIEFOG: special->frame &= ~FF_TRANS80; @@ -3234,14 +3234,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_numsneakers] = 0; - K_SpinPlayer(player, source, 1, inflictor, false); + K_SpinPlayer(player, source, KSPIN_WIPEOUT, inflictor, false); K_KartPainEnergyFling(player); if (P_IsDisplayPlayer(player)) P_StartQuake(32<player, thing, 0, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), false); + K_SpinPlayer(tmthing->player, thing, KSPIN_SPINOUT, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), false); S_StartSound(thing, sfx_s3k44); } else @@ -835,7 +835,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // Player Damage - K_SpinPlayer(thing->player, tmthing, 0, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), false); + K_SpinPlayer(thing->player, tmthing, KSPIN_SPINOUT, ((tmthing->type == MT_BUBBLESHIELD) ? tmthing->target : tmthing), false); S_StartSound(tmthing, sfx_s3k44); } else @@ -1429,7 +1429,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring]) { K_StealBumper(tmthing->player, thing->player, false); - K_SpinPlayer(thing->player, tmthing, 0, tmthing, false); + K_SpinPlayer(thing->player, tmthing, KSPIN_SPINOUT, tmthing, false); } } else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) @@ -1439,7 +1439,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (G_BattleGametype() && thing->player->kartstuff[k_pogospring]) { K_StealBumper(thing->player, tmthing->player, false); - K_SpinPlayer(tmthing->player, thing, 0, thing, false); + K_SpinPlayer(tmthing->player, thing, KSPIN_SPINOUT, thing, false); } } @@ -1448,12 +1448,12 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]) && !(thing->player->powers[pw_flashing])) // Don't steal bumpers while intangible { K_StealBumper(thing->player, tmthing->player, false); - K_SpinPlayer(tmthing->player, thing, 0, tmthing, false); + K_SpinPlayer(tmthing->player, thing, KSPIN_SPINOUT, tmthing, false); } else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer]) && !(tmthing->player->powers[pw_flashing])) { K_StealBumper(tmthing->player, thing->player, false); - K_SpinPlayer(thing->player, tmthing, 0, thing, false); + K_SpinPlayer(thing->player, tmthing, KSPIN_SPINOUT, thing, false); } } diff --git a/src/p_user.c b/src/p_user.c index 0f8dd1aae..c168e8575 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5785,7 +5785,7 @@ static void P_MovePlayer(player_t *player) else player->frameangle -= (ANGLE_11hh * speed); } - else if (player->powers[pw_nocontrol] && player->pflags & PF_SKIDDOWN) + else if (player->powers[pw_nocontrol] && player->pflags & PF_FAULT) { if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); @@ -6802,7 +6802,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) continue; if (mo->type == MT_PLAYER) // Players wipe out in Kart - K_SpinPlayer(mo->player, source, 0, inflictor, false); + K_SpinPlayer(mo->player, source, KSPIN_SPINOUT, inflictor, false); //} else P_DamageMobj(mo, inflictor, source, 1000); @@ -8957,7 +8957,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_nocontrol] & ((1<<15)-1) && player->powers[pw_nocontrol] < UINT16_MAX) { if (!(--player->powers[pw_nocontrol])) - player->pflags &= ~PF_SKIDDOWN; + player->pflags &= ~PF_FAULT; } else player->powers[pw_nocontrol] = 0; diff --git a/src/s_sound.c b/src/s_sound.c index 31eae4ed6..1bb554dfe 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -49,15 +49,12 @@ extern INT32 msg_id; static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo); #endif -CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}}; +CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {MAX_VOLUME, "MAX"}, {0, NULL}}; static void SetChannelsNum(void); static void Command_Tunes_f(void); static void Command_RestartAudio_f(void); // Sound system toggles -#ifndef NO_MIDI -static void GameMIDIMusic_OnChange(void); -#endif static void GameSounds_OnChange(void); static void GameDigiMusic_OnChange(void); @@ -95,11 +92,8 @@ consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, N static consvar_t precachesound = {"precachesound", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // actual general (maximum) sound & music volume, saved into the config -consvar_t cv_soundvolume = {"soundvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_digmusicvolume = {"digmusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifndef NO_MIDI -consvar_t cv_midimusicvolume = {"midimusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif +consvar_t cv_soundvolume = {"soundvolume", "50", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_digmusicvolume = {"musicvolume", "50", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // number of channels available #if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; @@ -112,9 +106,6 @@ consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, // Sound system toggles, saved into the config consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#ifndef NO_MIDI -consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMIDIMusic_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#endif consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, PlayMusicIfUnfocused_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -130,8 +121,6 @@ consvar_t cv_music_resync_threshold = {"music_resync_threshold", "100", CV_SAVE| consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagConditions, 0, NULL, NULL, 0, 0, NULL}; -#define S_MAX_VOLUME 127 - // when to clip out sounds // Does not fit the large outdoor areas. // added 2-2-98 in 8 bit volume control (before (1200*0x10000)) @@ -289,9 +278,6 @@ void S_RegisterSoundStuff(void) //CV_RegisterVar(&cv_resetmusic); CV_RegisterVar(&cv_gamesounds); CV_RegisterVar(&cv_gamedigimusic); -#ifndef NO_MIDI - CV_RegisterVar(&cv_gamemidimusic); -#endif CV_RegisterVar(&cv_playmusicifunfocused); CV_RegisterVar(&cv_playsoundifunfocused); @@ -907,9 +893,6 @@ void S_StopSound(void *origin) // static INT32 actualsfxvolume; // check for change through console static INT32 actualdigmusicvolume; -#ifndef NO_MIDI -static INT32 actualmidimusicvolume; -#endif void S_UpdateSounds(void) { @@ -936,10 +919,6 @@ void S_UpdateSounds(void) S_SetSfxVolume (cv_soundvolume.value); if (actualdigmusicvolume != cv_digmusicvolume.value) S_SetDigMusicVolume (cv_digmusicvolume.value); -#ifndef NO_MIDI - if (actualmidimusicvolume != cv_midimusicvolume.value) - S_SetMIDIMusicVolume (cv_midimusicvolume.value); -#endif // We're done now, if we're not in a level. if (gamestate != GS_LEVEL) @@ -1174,17 +1153,14 @@ void S_UpdateSounds(void) void S_SetSfxVolume(INT32 volume) { - if (volume < 0 || volume > 31) - CONS_Alert(CONS_WARNING, "sfxvolume should be between 0-31\n"); - - CV_SetValue(&cv_soundvolume, volume&0x1F); - actualsfxvolume = cv_soundvolume.value; // check for change of var + CV_SetValue(&cv_soundvolume, volume); + actualsfxvolume = cv_soundvolume.value * USER_VOLUME_SCALE; #ifdef HW3SOUND hws_mode == HWS_DEFAULT_MODE ? I_SetSfxVolume(volume&0x1F) : HW3S_SetSfxVolume(volume&0x1F); #else // now hardware volume - I_SetSfxVolume(volume&0x1F); + I_SetSfxVolume(volume); #endif } @@ -1580,6 +1556,7 @@ static UINT32 queue_fadeinms; musicdef_t *musicdefstart = NULL; // First music definition struct cursongcredit cursongcredit; // Currently displayed song credit info +int musicdef_volume; // // search for music definition in wad @@ -1688,6 +1665,8 @@ void S_LoadMusicDefs(UINT16 wadnum) } } + def->volume = DEFAULT_MUSICDEF_VOLUME; + skip_lump: stoken = strtok(NULL, "\r\n "); line++; @@ -1722,6 +1701,8 @@ skip_lump: for (value = def->source; *value; value++) if (*value == '_') *value = ' '; // turn _ into spaces. //CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source); + } else if (!stricmp(stoken, "volume")) { + def->volume = atoi(value); } else { CONS_Alert(CONS_WARNING, "MUSICDEF: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line); } @@ -1787,14 +1768,9 @@ boolean S_DigMusicDisabled(void) return digital_disabled; } -boolean S_MIDIMusicDisabled(void) -{ - return midi_disabled; // SRB2Kart: defined as "true" w/ NO_MIDI -} - boolean S_MusicDisabled(void) { - return (midi_disabled && digital_disabled); + return digital_disabled; } boolean S_MusicPlaying(void) @@ -1830,12 +1806,9 @@ boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping) return (boolean)mname[0]; } -boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi) +boolean S_MusicExists(const char *mname) { - return ( - (checkDigi ? W_CheckNumForName(va("O_%s", mname)) != LUMPERROR : false) - || (checkMIDI ? W_CheckNumForName(va("D_%s", mname)) != LUMPERROR : false) - ); + return W_CheckNumForName(va("O_%s", mname)) != LUMPERROR; } /// ------------------------ @@ -1890,22 +1863,11 @@ static boolean S_LoadMusic(const char *mname) if (!S_DigMusicDisabled() && S_DigExists(mname)) mlumpnum = W_GetNumForName(va("o_%s", mname)); - else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname)) - mlumpnum = W_GetNumForName(va("d_%s", mname)); else if (S_DigMusicDisabled() && S_DigExists(mname)) { CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n"); return false; } - else if (S_MIDIMusicDisabled() && S_MIDIExists(mname)) - { -#ifdef NO_MIDI - CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname); -#else - CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n"); -#endif - return false; - } else { CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname); @@ -2049,6 +2011,19 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 music_flags = mflags; music_looping = looping; + musicdef_volume = DEFAULT_MUSICDEF_VOLUME; + + { + musicdef_t *def; + for (def = musicdefstart; def; def = def->next) + { + if (strcasecmp(def->name, music_name) == 0) + { + musicdef_volume = def->volume; + } + } + } + if (!S_PlayMusic(looping, fadeinms)) { CONS_Alert(CONS_ERROR, "Music %.6s could not be played!\n", newmusic); @@ -2142,50 +2117,19 @@ void S_EnableSound(void) } } -void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) +void S_SetMusicVolume(INT32 digvolume) { if (digvolume < 0) digvolume = cv_digmusicvolume.value; -#ifdef NO_MIDI - (void)seqvolume; -#else - if (seqvolume < 0) - seqvolume = cv_midimusicvolume.value; -#endif - - if (digvolume < 0 || digvolume > 31) - CONS_Alert(CONS_WARNING, "digmusicvolume should be between 0-31\n"); - CV_SetValue(&cv_digmusicvolume, digvolume&31); - actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var - -#ifndef NO_MIDI - if (seqvolume < 0 || seqvolume > 31) - CONS_Alert(CONS_WARNING, "midimusicvolume should be between 0-31\n"); - CV_SetValue(&cv_midimusicvolume, seqvolume&31); - actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var -#endif + CV_SetValue(&cv_digmusicvolume, digvolume); + actualdigmusicvolume = cv_digmusicvolume.value * USER_VOLUME_SCALE; #ifdef DJGPPDOS digvolume = 31; -#ifndef NO_MIDI - seqvolume = 31; -#endif #endif - switch(I_SongType()) - { -#ifndef NO_MIDI - case MU_MID: - //case MU_MOD: - //case MU_GME: - I_SetMusicVolume(seqvolume&31); - break; -#endif - default: - I_SetMusicVolume(digvolume&31); - break; - } + I_SetMusicVolume(digvolume); } void @@ -2362,11 +2306,7 @@ static void Command_RestartAudio_f(void) // These must be called or no sound and music until manually set. I_SetSfxVolume(cv_soundvolume.value); -#ifdef NO_MIDI - S_SetMusicVolume(cv_digmusicvolume.value, -1); -#else - S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value); -#endif + S_SetMusicVolume(cv_digmusicvolume.value); S_StartSound(NULL, sfx_strpst); @@ -2410,71 +2350,10 @@ void GameDigiMusic_OnChange(void) else { digital_disabled = true; - if (S_MusicType() != MU_MID) - { - if (midi_disabled) - S_StopMusic(); - else - { - char mmusic[7]; - UINT16 mflags; - boolean looping; - - if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic)) - { - S_StopMusic(); - S_ChangeMusic(mmusic, mflags, looping); - } - else - S_StopMusic(); - } - } + S_StopMusic(); } } -#ifndef NO_MIDI -void GameMIDIMusic_OnChange(void) -{ - if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio")) - return; - else if (M_CheckParm("-nomidimusic")) - return; - - if (midi_disabled) - { - midi_disabled = false; - I_InitMusic(); - if (Playing()) - P_RestoreMusic(&players[consoleplayer]); - else - S_ChangeMusicInternal("titles", looptitle); - } - else - { - midi_disabled = true; - if (S_MusicType() == MU_MID) - { - if (digital_disabled) - S_StopMusic(); - else - { - char mmusic[7]; - UINT16 mflags; - boolean looping; - - if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic)) - { - S_StopMusic(); - S_ChangeMusic(mmusic, mflags, looping); - } - else - S_StopMusic(); - } - } - } -} -#endif - static void PlayMusicIfUnfocused_OnChange(void) { if (window_notinfocus) diff --git a/src/s_sound.h b/src/s_sound.h index c433aa974..d2ea6b4d4 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -23,15 +23,18 @@ // mask used to indicate sound origin is player item pickup #define PICKUP_SOUND 0x8000 +// +#define SOUND_VOLUME_RANGE 256 +#define MAX_SOUND_VOLUME 255 + +#define DEFAULT_MUSICDEF_VOLUME ( 100 / VOLUME_DIVIDER ) + extern consvar_t stereoreverse; extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume; extern consvar_t cv_numChannels; extern consvar_t surround; //extern consvar_t cv_resetmusic; extern consvar_t cv_gamedigimusic; -#ifndef NO_MIDI -extern consvar_t cv_gamemidimusic; -#endif extern consvar_t cv_gamesounds; extern consvar_t cv_playmusicifunfocused; extern consvar_t cv_playsoundifunfocused; @@ -115,16 +118,14 @@ void S_StopSound(void *origin); // boolean S_DigMusicDisabled(void); -boolean S_MIDIMusicDisabled(void); boolean S_MusicDisabled(void); boolean S_MusicPlaying(void); boolean S_MusicPaused(void); musictype_t S_MusicType(void); const char *S_MusicName(void); boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping); -boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi); -#define S_DigExists(a) S_MusicExists(a, false, true) -#define S_MIDIExists(a) S_MusicExists(a, true, false) +boolean S_MusicExists(const char *mname); +#define S_DigExists S_MusicExists // // Music Effects @@ -139,6 +140,7 @@ typedef struct musicdef_s char name[7]; //char usage[256]; char source[256]; + int volume; struct musicdef_s *next; } musicdef_t; @@ -151,6 +153,7 @@ extern struct cursongcredit } cursongcredit; extern musicdef_t *musicdefstart; +extern int musicdef_volume; void S_LoadMusicDefs(UINT16 wadnum); void S_InitMusicDefs(void); @@ -232,10 +235,9 @@ void S_UpdateSounds(void); FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2); void S_SetSfxVolume(INT32 volume); -void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume); -#define S_SetDigMusicVolume(a) S_SetMusicVolume(a,-1) -#define S_SetMIDIMusicVolume(a) S_SetMusicVolume(-1,a) -#define S_InitMusicVolume() S_SetMusicVolume(-1,-1) +void S_SetMusicVolume(INT32 digvolume); +#define S_SetDigMusicVolume S_SetMusicVolume +#define S_InitMusicVolume() S_SetMusicVolume(-1) INT32 S_OriginPlaying(void *origin); INT32 S_IdPlaying(sfxenum_t id); diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index f871851dc..e3e6809db 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -84,7 +84,9 @@ static UINT32 stutter_threshold_user; static UINT32 stutter_threshold; static Mix_Music *music; -static UINT8 music_volume, sfx_volume, internal_volume; +static int music_volume; +static int sfx_volume; +static int internal_volume; static float loop_point; static float song_length; // length in seconds static boolean songpaused; @@ -221,6 +223,15 @@ void I_UpdateSound(void) /// SFX /// ------------------------ +static int +get_real_sfx_volume (int vol) +{ + const int scale = SOUND_VOLUME_RANGE / MIX_MAX_VOLUME; + const int divider = VOLUME_DIVIDER * scale; + const int volume = ( vol + 1 ) / divider * sfx_volume / 100; + return volume; +} + // this is as fast as I can possibly make it. // sorry. more asm needed. static Mix_Chunk *ds2chunk(void *stream) @@ -476,7 +487,8 @@ void I_FreeSfx(sfxinfo_t *sfx) INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { - UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + //UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + UINT8 volume = get_real_sfx_volume(vol); INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); @@ -497,13 +509,14 @@ boolean I_SoundIsPlaying(INT32 handle) void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch) { - UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + //UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + UINT8 volume = get_real_sfx_volume(vol); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; } -void I_SetSfxVolume(UINT8 volume) +void I_SetSfxVolume(int volume) { sfx_volume = volume; } @@ -512,18 +525,17 @@ void I_SetSfxVolume(UINT8 volume) /// Music Utilities /// ------------------------ -static UINT32 get_real_volume(UINT8 volume) +static UINT32 get_real_volume(int volume) { -#ifdef _WIN32 - if (I_SongType() == MU_MID) - // HACK: Until we stop using native MIDI, - // disable volume changes - return ((UINT32)31*128/31); // volume = 31 - else -#endif + { // convert volume to mixer's 128 scale // then apply internal_volume as a percentage - return ((UINT32)volume*128/31) * (UINT32)internal_volume / 100; + //return ((UINT32)volume*128/31) * (UINT32)internal_volume / 100; + return MIX_MAX_VOLUME + * musicdef_volume / 100 + * internal_volume / 100 + * volume / 100; + } } static UINT32 get_adjusted_position(UINT32 position) @@ -583,7 +595,7 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata) (void)stream; (void)udata; - if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID) + if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD) return; music_bytes += len; @@ -686,8 +698,6 @@ musictype_t I_SongType(void) #endif if (!music) return MU_NONE; - else if (Mix_GetMusicType(music) == MUS_MID) - return MU_MID; else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG) return MU_MOD; else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD) @@ -770,7 +780,7 @@ UINT32 I_GetSongLength(void) } else #endif - if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID) + if (!music || I_SongType() == MU_MOD) return 0; else { @@ -785,7 +795,7 @@ UINT32 I_GetSongLength(void) boolean I_SetSongLoopPoint(UINT32 looppoint) { - if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID || !is_looping) + if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || !is_looping) return false; else { @@ -821,7 +831,7 @@ UINT32 I_GetSongLoopPoint(void) } else #endif - if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID) + if (!music || I_SongType() == MU_MOD) return 0; else return (UINT32)(loop_point * 1000); @@ -855,7 +865,7 @@ boolean I_SetSongPosition(UINT32 position) } else #endif - if (!music || I_SongType() == MU_MID) + if (!music) return false; else if (I_SongType() == MU_MOD) return Mix_SetMusicPosition(position); // Goes by channels @@ -914,7 +924,7 @@ UINT32 I_GetSongPosition(void) } else #endif - if (!music || I_SongType() == MU_MID) + if (!music) return 0; else return music_bytes/44100.0L*1000.0L/4; //assume 44.1khz @@ -1096,12 +1106,12 @@ boolean I_PlaySong(boolean looping) if (fpclassify(song_length) == FP_ZERO && (I_SongType() == MU_OGG || I_SongType() == MU_MP3 || I_SongType() == MU_FLAC)) CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n"); - if (I_SongType() != MU_MOD && I_SongType() != MU_MID && Mix_PlayMusic(music, 0) == -1) + if (I_SongType() != MU_MOD && Mix_PlayMusic(music, 0) == -1) { CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); return false; } - else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever + else if (I_SongType() == MU_MOD && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever { CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); return false; @@ -1111,10 +1121,10 @@ boolean I_PlaySong(boolean looping) I_SetMusicVolume(music_volume); - if (I_SongType() != MU_MOD && I_SongType() != MU_MID) + if (I_SongType() != MU_MOD) Mix_HookMusicFinished(music_loop); // don't bother counting if MOD - if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) + if(I_SongType() != MU_MOD && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError()); return true; @@ -1143,10 +1153,9 @@ void I_StopSong(void) void I_PauseSong(void) { - if(I_SongType() == MU_MID) // really, SDL Mixer? why can't you pause MIDI??? - return; + // really, SRB2? why do you support MIDI??? - if(I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID) + if(I_SongType() != MU_GME && I_SongType() != MU_MOD) Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes); Mix_PauseMusic(); @@ -1155,15 +1164,12 @@ void I_PauseSong(void) void I_ResumeSong(void) { - if (I_SongType() == MU_MID) - return; - - if (I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID) + if (I_SongType() != MU_GME && I_SongType() != MU_MOD) { while(Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { } // HACK: fixes issue of multiple effect callbacks being registered - if(music && I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) + if(music && I_SongType() != MU_MOD && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError()); } @@ -1171,19 +1177,12 @@ void I_ResumeSong(void) songpaused = false; } -void I_SetMusicVolume(UINT8 volume) +void I_SetMusicVolume(int volume) { if (!I_SongPlaying()) return; -#ifdef _WIN32 - if (I_SongType() == MU_MID) - // HACK: Until we stop using native MIDI, - // disable volume changes - music_volume = 31; - else -#endif - music_volume = volume; + music_volume = volume; Mix_VolumeMusic(get_real_volume(music_volume)); } diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 929ac79f5..517ef2161 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -195,7 +195,7 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call { if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); else if (sound_disabled) return; - else if (midi_disabled && digital_disabled + else if (digital_disabled #ifdef HW3SOUND && hws_mode == HWS_DEFAULT_MODE #endif @@ -209,7 +209,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio { if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); else if (sound_disabled) return; - else if (midi_disabled && digital_disabled + else if (digital_disabled #ifdef HW3SOUND && hws_mode == HWS_DEFAULT_MODE #endif @@ -1153,7 +1153,7 @@ void I_ShutdownSound(void) } #endif - if (midi_disabled && digital_disabled) + if (digital_disabled) SDL_CloseAudio(); CONS_Printf("%s", M_GetText("shut down\n")); sound_started = false; @@ -1173,9 +1173,6 @@ void I_StartupSound(void) const char *sdrv_name = NULL; #endif #ifndef HAVE_MIXER -#ifndef NO_MIDI - midi_disabled = -#endif digital_disabled = true; #endif diff --git a/src/w_wad.c b/src/w_wad.c index d4da027be..45ef93804 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1710,7 +1710,6 @@ int W_VerifyNMUSlumps(const char *filename) { lumpchecklist_t NMUSlist[] = { - {"D_", 2}, // MIDI music {"O_", 2}, // Digital music {"DS", 2}, // Sound effects