mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 03:12:00 -04:00
context related sound pitch shifting (#1647)
* disable pitch shifting for moving floors and explosions Fixes #1646 * get rid of unused sfxinfo_s.pitch and sfxinfo_s.volume elements * implement context-related sound pitch shifting * cosmetics * shorten some symbol names * shortcut for non-pitch shifted menu sounds * indentation
This commit is contained in:
parent
ba6ac2a8de
commit
4b2456c96c
@ -2375,10 +2375,10 @@ void deh_procSounds(DEHFILE *fpin, FILE* fpout, char *line)
|
||||
; // ignored
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[4])) // Zero 2
|
||||
S_sfx[indexnum].pitch = value;
|
||||
; // ignored
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[5])) // Zero 3
|
||||
S_sfx[indexnum].volume = value;
|
||||
; // ignored
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[6])) // Zero 4
|
||||
; // ignored
|
||||
|
@ -284,8 +284,6 @@ void dsdh_EnsureSFXCapacity(int limit)
|
||||
for (int i = old_num_sfx; i < num_sfx; ++i)
|
||||
{
|
||||
S_sfx[i].priority = 127;
|
||||
S_sfx[i].pitch = -1;
|
||||
S_sfx[i].volume = -1;
|
||||
S_sfx[i].lumpnum = -1;
|
||||
}
|
||||
}
|
||||
|
@ -1599,8 +1599,8 @@ void HU_Ticker(void)
|
||||
message_nottobefuckedwith = true;
|
||||
message_on = true;
|
||||
message_counter = chat_count; // killough 11/98
|
||||
S_StartSound(0, gamemode == commercial ?
|
||||
sfx_radio : sfx_tink);
|
||||
S_StartSoundPitch(0, gamemode == commercial ?
|
||||
sfx_radio : sfx_tink, PITCH_NONE);
|
||||
}
|
||||
HUlib_clear_line(&w_inputbuffer[i]);
|
||||
}
|
||||
|
@ -462,8 +462,6 @@ void I_InitSound(void)
|
||||
if (from->lumpnum == -1)
|
||||
{
|
||||
from->link = to;
|
||||
from->pitch = NORM_PITCH;
|
||||
from->volume = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1241,11 +1241,11 @@ static void M_QuitResponse(int ch)
|
||||
{
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
S_StartSound(NULL, quitsounds2[(gametic >> 2) & 7]);
|
||||
M_StartSound(quitsounds2[(gametic >> 2) & 7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, quitsounds[(gametic >> 2) & 7]);
|
||||
M_StartSound(quitsounds[(gametic >> 2) & 7]);
|
||||
}
|
||||
I_WaitVBL(105);
|
||||
}
|
||||
@ -1416,7 +1416,7 @@ static void M_QuickSaveResponse(int ch)
|
||||
SetDefaultSaveName(quickSaveSlot);
|
||||
}
|
||||
M_DoSave(quickSaveSlot);
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1424,7 +1424,7 @@ static void M_QuickSave(void)
|
||||
{
|
||||
if (!usergame && (!demoplayback || netgame)) // killough 10/98
|
||||
{
|
||||
S_StartSound(NULL, sfx_oof);
|
||||
M_StartSound(sfx_oof);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1454,7 +1454,7 @@ static void M_QuickLoadResponse(int ch)
|
||||
if (ch == 'y')
|
||||
{
|
||||
M_LoadSelect(quickSaveSlot);
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1920,7 +1920,7 @@ void MN_Back(void)
|
||||
|
||||
currentMenu = currentMenu->prevMenu;
|
||||
itemOn = currentMenu->lastOn;
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2129,14 +2129,14 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
currentMenu = &HelpDef; // killough 10/98: new help screen
|
||||
|
||||
itemOn = 0;
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (M_InputActivated(input_savegame)) // Save Game
|
||||
{
|
||||
MN_StartControlPanel();
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_SaveGame(0);
|
||||
return true;
|
||||
}
|
||||
@ -2144,7 +2144,7 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
if (M_InputActivated(input_loadgame)) // Load Game
|
||||
{
|
||||
MN_StartControlPanel();
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_LoadGame(0);
|
||||
return true;
|
||||
}
|
||||
@ -2154,20 +2154,20 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
MN_StartControlPanel();
|
||||
currentMenu = &SoundDef;
|
||||
itemOn = sfx_vol;
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (M_InputActivated(input_quicksave)) // Quicksave
|
||||
{
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_QuickSave();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (M_InputActivated(input_endgame)) // End game
|
||||
{
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_EndGame(0);
|
||||
return true;
|
||||
}
|
||||
@ -2175,20 +2175,20 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
if (M_InputActivated(input_messages)) // Toggle messages
|
||||
{
|
||||
M_ChangeMessages(0);
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (M_InputActivated(input_quickload)) // Quickload
|
||||
{
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_QuickLoad();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (M_InputActivated(input_quit)) // Quit DOOM
|
||||
{
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_QuitDOOM(0);
|
||||
return true;
|
||||
}
|
||||
@ -2212,7 +2212,7 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
return false;
|
||||
}
|
||||
MN_SizeDisplay(0);
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2223,7 +2223,7 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
return false;
|
||||
}
|
||||
MN_SizeDisplay(1);
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2285,7 +2285,7 @@ static boolean ShortcutResponder(const event_t *ev)
|
||||
if (M_InputActivated(input_setup))
|
||||
{
|
||||
MN_StartControlPanel();
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
SetNextMenu(&SetupDef);
|
||||
return true;
|
||||
}
|
||||
@ -2369,7 +2369,7 @@ static void CursorPosition(void)
|
||||
if (itemOn != cursor)
|
||||
{
|
||||
itemOn = cursor;
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2389,12 +2389,12 @@ static boolean SaveLoadResponder(menu_action_t action, int ch)
|
||||
if (M_ToUpper(ch) == 'Y')
|
||||
{
|
||||
M_DeleteGame(itemOn);
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
delete_verify = false;
|
||||
}
|
||||
else if (M_ToUpper(ch) == 'N')
|
||||
{
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
delete_verify = false;
|
||||
}
|
||||
return true;
|
||||
@ -2409,7 +2409,7 @@ static boolean SaveLoadResponder(menu_action_t action, int ch)
|
||||
savepage--;
|
||||
quickSaveSlot = -1;
|
||||
M_ReadSaveStrings();
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2420,7 +2420,7 @@ static boolean SaveLoadResponder(menu_action_t action, int ch)
|
||||
savepage++;
|
||||
quickSaveSlot = -1;
|
||||
M_ReadSaveStrings();
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2498,7 +2498,7 @@ static boolean MouseResponder(void)
|
||||
if (current_item->routine)
|
||||
{
|
||||
current_item->routine(value);
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2530,7 +2530,7 @@ boolean M_Responder(event_t *ev)
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
M_QuitDOOM(0);
|
||||
}
|
||||
return true;
|
||||
@ -2721,7 +2721,7 @@ boolean M_Responder(event_t *ev)
|
||||
}
|
||||
|
||||
menuactive = false;
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2752,7 +2752,7 @@ boolean M_Responder(event_t *ev)
|
||||
|| action == MENU_ESCAPE) // phares
|
||||
{
|
||||
MN_StartControlPanel();
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -2784,7 +2784,7 @@ boolean M_Responder(event_t *ev)
|
||||
{
|
||||
itemOn++;
|
||||
}
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
} while (currentMenu->menuitems[itemOn].status == -1);
|
||||
return true;
|
||||
}
|
||||
@ -2802,7 +2802,7 @@ boolean M_Responder(event_t *ev)
|
||||
{
|
||||
itemOn--;
|
||||
}
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
} while (currentMenu->menuitems[itemOn].status == -1);
|
||||
return true;
|
||||
}
|
||||
@ -2812,7 +2812,7 @@ boolean M_Responder(event_t *ev)
|
||||
if (currentMenu->menuitems[itemOn].routine
|
||||
&& currentMenu->menuitems[itemOn].status == 2)
|
||||
{
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
currentMenu->menuitems[itemOn].routine(CHOICE_LEFT);
|
||||
}
|
||||
return true;
|
||||
@ -2823,7 +2823,7 @@ boolean M_Responder(event_t *ev)
|
||||
if (currentMenu->menuitems[itemOn].routine
|
||||
&& currentMenu->menuitems[itemOn].status == 2)
|
||||
{
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
currentMenu->menuitems[itemOn].routine(CHOICE_RIGHT);
|
||||
}
|
||||
return true;
|
||||
@ -2839,17 +2839,17 @@ boolean M_Responder(event_t *ev)
|
||||
if (currentMenu->menuitems[itemOn].status == 2)
|
||||
{
|
||||
currentMenu->menuitems[itemOn].routine(CHOICE_RIGHT);
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMenu->menuitems[itemOn].routine(itemOn);
|
||||
S_StartSound(NULL, sfx_pistol);
|
||||
M_StartSound(sfx_pistol);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, sfx_oof); // [FG] disabled menu item
|
||||
M_StartSound(sfx_oof); // [FG] disabled menu item
|
||||
}
|
||||
// jff 3/24/98 remember last skill selected
|
||||
// killough 10/98 moved to skill-specific functions
|
||||
@ -2863,7 +2863,7 @@ boolean M_Responder(event_t *ev)
|
||||
currentMenu->lastOn = itemOn;
|
||||
}
|
||||
MN_ClearMenus();
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2897,12 +2897,12 @@ boolean M_Responder(event_t *ev)
|
||||
currentMenu = currentMenu->prevMenu;
|
||||
}
|
||||
itemOn = currentMenu->lastOn;
|
||||
S_StartSound(NULL, sfx_swtchn);
|
||||
M_StartSound(sfx_swtchn);
|
||||
}
|
||||
else
|
||||
{
|
||||
MN_ClearMenus();
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2915,14 +2915,14 @@ boolean M_Responder(event_t *ev)
|
||||
{
|
||||
if (LoadMenu[itemOn].status)
|
||||
{
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
currentMenu->lastOn = itemOn;
|
||||
delete_verify = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, sfx_oof);
|
||||
M_StartSound(sfx_oof);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2936,7 +2936,7 @@ boolean M_Responder(event_t *ev)
|
||||
if (currentMenu->menuitems[i].alphaKey == ch)
|
||||
{
|
||||
itemOn = i;
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2946,7 +2946,7 @@ boolean M_Responder(event_t *ev)
|
||||
if (currentMenu->menuitems[i].alphaKey == ch)
|
||||
{
|
||||
itemOn = i;
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3279,6 +3279,11 @@ static void WriteText(int x, int y, const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
void M_StartSound(int sound_id)
|
||||
{
|
||||
S_StartSoundPitch(NULL, sound_id, PITCH_NONE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: m_menu.c,v $
|
||||
|
@ -90,6 +90,8 @@ extern boolean inhelpscreens;
|
||||
int MN_GetPixelWidth(const char *ch);
|
||||
void MN_DrawString(int cx, int cy, int color, const char *ch);
|
||||
|
||||
void M_StartSound(int sound_id);
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -1651,7 +1651,7 @@ static void BarkSound(void)
|
||||
{
|
||||
if (default_dogs)
|
||||
{
|
||||
S_StartSound(NULL, sfx_dgact);
|
||||
M_StartSound(sfx_dgact);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2431,7 +2431,7 @@ static void SelectDone(setup_menu_t *ptr)
|
||||
{
|
||||
ptr->m_flags &= ~S_SELECT;
|
||||
ptr->m_flags |= S_HILITE;
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
setup_select = false;
|
||||
if (print_warning_about_changes) // killough 8/15/98
|
||||
{
|
||||
@ -2906,7 +2906,7 @@ boolean MN_SetupCursorPostion(int x, int y)
|
||||
if (set_tab_on != i)
|
||||
{
|
||||
set_tab_on = i;
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2932,7 +2932,7 @@ boolean MN_SetupCursorPostion(int x, int y)
|
||||
{
|
||||
print_warning_about_changes = false;
|
||||
set_item_on = i;
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2990,7 +2990,7 @@ static void Choice(menu_action_t action)
|
||||
|
||||
if (def->location->i != value)
|
||||
{
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
def->location->i = value;
|
||||
|
||||
@ -3021,7 +3021,7 @@ static void Choice(menu_action_t action)
|
||||
|
||||
if (def->location->i != value)
|
||||
{
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
def->location->i = value;
|
||||
|
||||
@ -3271,7 +3271,7 @@ static boolean NextPage(int inc)
|
||||
;
|
||||
current_menu[--set_item_on].m_flags |= S_HILITE;
|
||||
|
||||
S_StartSound(NULL, sfx_pstop); // killough 10/98
|
||||
M_StartSound(sfx_pstop); // killough 10/98
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3433,7 +3433,7 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
|
||||
|
||||
if (ItemDisabled(flags))
|
||||
{
|
||||
S_StartSound(NULL, sfx_oof);
|
||||
M_StartSound(sfx_oof);
|
||||
return true;
|
||||
}
|
||||
else if (flags & S_NUM)
|
||||
@ -3449,7 +3449,7 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
|
||||
|
||||
current_item->m_flags |= S_SELECT;
|
||||
setup_select = true;
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3474,7 +3474,7 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
|
||||
default_verify = false; // phares 4/19/98
|
||||
print_warning_about_changes = false; // [FG] reset
|
||||
HU_Start(); // catch any message changes // phares 4/19/98
|
||||
S_StartSound(NULL, sfx_swtchx);
|
||||
M_StartSound(sfx_swtchx);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3519,7 +3519,7 @@ static boolean SetupTab(void)
|
||||
;
|
||||
set_item_on--;
|
||||
|
||||
S_StartSound(NULL, sfx_pstop);
|
||||
M_StartSound(sfx_pstop);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3621,7 +3621,7 @@ boolean MN_SetupMouseResponder(int x, int y)
|
||||
{
|
||||
active_thermo->action();
|
||||
}
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -3634,7 +3634,7 @@ boolean MN_SetupMouseResponder(int x, int y)
|
||||
if (flags & S_ONOFF) // yes or no setting?
|
||||
{
|
||||
OnOff();
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
M_StartSound(sfx_itemup);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3655,7 +3655,7 @@ boolean MN_SetupMouseResponder(int x, int y)
|
||||
|
||||
if (def->location->i != value)
|
||||
{
|
||||
S_StartSound(NULL, sfx_stnmov);
|
||||
M_StartSound(sfx_stnmov);
|
||||
}
|
||||
def->location->i = value;
|
||||
|
||||
|
@ -81,7 +81,7 @@ void T_MoveCeiling (ceiling_t* ceiling)
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov, PITCH_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ void T_MoveCeiling (ceiling_t* ceiling)
|
||||
case genSilentCrusher:
|
||||
break;
|
||||
default:
|
||||
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov, PITCH_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ void T_MoveFloor(floormove_t* floor)
|
||||
);
|
||||
|
||||
if (!(leveltime&7)) // make the floormove sound
|
||||
S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&floor->sector->soundorg, sfx_stnmov, PITCH_NONE);
|
||||
|
||||
if (res == pastdest) // if destination height is reached
|
||||
{
|
||||
@ -413,7 +413,7 @@ void T_MoveElevator(elevator_t* elevator)
|
||||
|
||||
// make floor move sound
|
||||
if (!(leveltime&7))
|
||||
S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&elevator->sector->soundorg, sfx_stnmov, PITCH_NONE);
|
||||
|
||||
if (res == pastdest) // if destination height acheived
|
||||
{
|
||||
|
@ -652,7 +652,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher)
|
||||
P_RemoveMobj (special);
|
||||
player->bonuscount += BONUSADD;
|
||||
|
||||
S_StartSound(player->mo, sound); // killough 4/25/98, 12/98
|
||||
S_StartSoundPitch(player->mo, sound, // killough 4/25/98, 12/98
|
||||
sound == sfx_itemup ? PITCH_NONE : PITCH_FULL);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -131,6 +131,9 @@ boolean P_SetMobjState(mobj_t* mobj,statenum_t state)
|
||||
|
||||
void P_ExplodeMissile (mobj_t* mo)
|
||||
{
|
||||
const int state = mo->state - states;
|
||||
const boolean brainexplode = (state >= S_BRAINEXPLODE1 && state <= S_BRAINEXPLODE3);
|
||||
|
||||
mo->momx = mo->momy = mo->momz = 0;
|
||||
|
||||
P_SetMobjState(mo, mobjinfo[mo->type].deathstate);
|
||||
@ -143,7 +146,8 @@ void P_ExplodeMissile (mobj_t* mo)
|
||||
mo->flags &= ~MF_MISSILE;
|
||||
|
||||
if (mo->info->deathsound)
|
||||
S_StartSound (mo, mo->info->deathsound);
|
||||
S_StartSoundPitch(mo, mo->info->deathsound,
|
||||
brainexplode ? PITCH_NONE : PITCH_FULL);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -59,7 +59,7 @@ void T_PlatRaise(plat_t* plat)
|
||||
|| plat->type == raiseToNearestAndChange)
|
||||
{
|
||||
if (!(leveltime&7))
|
||||
S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&plat->sector->soundorg, sfx_stnmov, PITCH_NONE);
|
||||
}
|
||||
|
||||
// if encountered an obstacle, and not a crush type, reverse direction
|
||||
@ -237,7 +237,7 @@ int EV_DoPlat
|
||||
//jff 3/14/98 clear old field as well
|
||||
sec->oldspecial = 0;
|
||||
|
||||
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&sec->soundorg,sfx_stnmov, PITCH_NONE);
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
@ -247,7 +247,7 @@ int EV_DoPlat
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
|
||||
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
|
||||
S_StartSoundPitch((mobj_t *)&sec->soundorg,sfx_stnmov, PITCH_NONE);
|
||||
break;
|
||||
|
||||
case downWaitUpStay:
|
||||
|
@ -156,7 +156,7 @@ static void P_BringUpWeapon(player_t *player)
|
||||
player->pendingweapon = player->readyweapon;
|
||||
|
||||
if (player->pendingweapon == wp_chainsaw)
|
||||
S_StartSound(player->mo, sfx_sawup);
|
||||
S_StartSoundPitch(player->mo, sfx_sawup, PITCH_HALF);
|
||||
|
||||
if (player->pendingweapon >= NUMWEAPONS)
|
||||
{
|
||||
@ -485,7 +485,7 @@ void A_WeaponReady(player_t *player, pspdef_t *psp)
|
||||
P_SetMobjState(player->mo, S_PLAY);
|
||||
|
||||
if (player->readyweapon == wp_chainsaw && psp->state == &states[S_SAW])
|
||||
S_StartSound(player->mo, sfx_sawidl);
|
||||
S_StartSoundPitch(player->mo, sfx_sawidl, PITCH_HALF);
|
||||
|
||||
// check for change
|
||||
// if player is dead, put the weapon away
|
||||
@ -720,11 +720,11 @@ void A_Saw(player_t *player, pspdef_t *psp)
|
||||
|
||||
if (!linetarget)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_sawful);
|
||||
S_StartSoundPitch(player->mo, sfx_sawful, PITCH_HALF);
|
||||
return;
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, sfx_sawhit);
|
||||
S_StartSoundPitch(player->mo, sfx_sawhit, PITCH_HALF);
|
||||
|
||||
// turn to face target
|
||||
angle = R_PointToAngle2(player->mo->x, player->mo->y,
|
||||
|
@ -44,7 +44,6 @@ typedef struct channel_s
|
||||
sfxinfo_t *sfxinfo; // sound information (if null, channel avail.)
|
||||
const mobj_t *origin; // origin of sound
|
||||
int volume; // volume scale value for effect -- haleyjd 05/29/06
|
||||
int pitch; // pitch modifier -- haleyjd 06/03/06
|
||||
int handle; // handle of the sound being played
|
||||
int o_priority; // haleyjd 09/27/06: stored priority value
|
||||
int priority; // current priority value
|
||||
@ -117,8 +116,7 @@ static void S_StopChannel(int cnum)
|
||||
// haleyjd: added priority scaling
|
||||
//
|
||||
static int S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
|
||||
int chanvol, int *vol, int *sep, int *pitch,
|
||||
int *pri)
|
||||
int chanvol, int *vol, int *sep, int *pri)
|
||||
{
|
||||
return I_AdjustSoundParams(listener, source, chanvol, vol, sep, pri);
|
||||
}
|
||||
@ -199,7 +197,7 @@ static int S_getChannel(const mobj_t *origin, sfxinfo_t *sfxinfo, int priority,
|
||||
return cnum;
|
||||
}
|
||||
|
||||
void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
void S_StartSoundPitch(const mobj_t *origin, int sfx_id, const pitchrange_t pitch_range)
|
||||
{
|
||||
int sep, pitch, o_priority, priority, singularity, cnum, handle;
|
||||
int volumeScale = 127;
|
||||
@ -229,25 +227,7 @@ void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
sfx = &S_sfx[sfx_id];
|
||||
|
||||
// Initialize sound parameters
|
||||
if (sfx->link)
|
||||
{
|
||||
pitch = sfx->pitch;
|
||||
volumeScale += sfx->volume;
|
||||
}
|
||||
else
|
||||
{
|
||||
pitch = NORM_PITCH;
|
||||
}
|
||||
|
||||
// haleyjd 09/29/06: rangecheck volumeScale now!
|
||||
if (volumeScale < 0)
|
||||
{
|
||||
volumeScale = 0;
|
||||
}
|
||||
else if (volumeScale > 127)
|
||||
{
|
||||
volumeScale = 127;
|
||||
}
|
||||
pitch = NORM_PITCH;
|
||||
|
||||
// haleyjd: modified so that priority value is always used
|
||||
// haleyjd: also modified to get and store proper singularity value
|
||||
@ -258,7 +238,7 @@ void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
// killough 3/7/98, 4/25/98: code rearranged slightly
|
||||
|
||||
if (!S_AdjustSoundParams(players[displayplayer].mo, origin, volumeScale,
|
||||
&volume, &sep, &pitch, &priority))
|
||||
&volume, &sep, &priority))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -266,11 +246,11 @@ void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
if (pitched_sounds)
|
||||
{
|
||||
// hacks to vary the sfx pitches
|
||||
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
|
||||
if (pitch_range == PITCH_HALF)
|
||||
{
|
||||
pitch += 8 - (M_Random() & 15);
|
||||
}
|
||||
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
|
||||
else if (pitch_range == PITCH_FULL)
|
||||
{
|
||||
pitch += 16 - (M_Random() & 31);
|
||||
}
|
||||
@ -316,10 +296,8 @@ void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
channels[cnum].handle = handle;
|
||||
|
||||
// haleyjd 05/29/06: record volume scale value
|
||||
// haleyjd 06/03/06: record pitch too (wtf is going on here??)
|
||||
// haleyjd 09/27/06: store priority and singularity values (!!!)
|
||||
channels[cnum].volume = volumeScale;
|
||||
channels[cnum].pitch = pitch;
|
||||
channels[cnum].o_priority = o_priority; // original priority
|
||||
channels[cnum].priority = priority; // scaled priority
|
||||
channels[cnum].singularity = singularity;
|
||||
@ -331,6 +309,11 @@ void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
}
|
||||
}
|
||||
|
||||
void S_StartSound(const mobj_t *origin, int sfx_id)
|
||||
{
|
||||
S_StartSoundPitch(origin, sfx_id, PITCH_FULL);
|
||||
}
|
||||
|
||||
//
|
||||
// S_StopSound
|
||||
//
|
||||
@ -454,7 +437,6 @@ void S_UpdateSounds(const mobj_t *listener)
|
||||
{
|
||||
// initialize parameters
|
||||
int volume = snd_SfxVolume;
|
||||
int pitch = c->pitch; // haleyjd 06/03/06: use channel's pitch!
|
||||
int sep = NORM_SEP;
|
||||
int pri = c->o_priority; // haleyjd 09/27/06: priority
|
||||
|
||||
@ -464,7 +446,7 @@ void S_UpdateSounds(const mobj_t *listener)
|
||||
if (c->origin && listener != c->origin) // killough 3/20/98
|
||||
{
|
||||
if (!S_AdjustSoundParams(listener, c->origin, c->volume,
|
||||
&volume, &sep, &pitch, &pri))
|
||||
&volume, &sep, &pri))
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
}
|
||||
|
@ -22,6 +22,12 @@
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
typedef enum {
|
||||
PITCH_FULL,
|
||||
PITCH_HALF,
|
||||
PITCH_NONE
|
||||
} pitchrange_t;
|
||||
|
||||
struct mobj_s;
|
||||
|
||||
//
|
||||
@ -43,6 +49,7 @@ void S_Start(void);
|
||||
// using <sound_id> from sounds.h
|
||||
//
|
||||
void S_StartSound(const struct mobj_s *origin, int sound_id);
|
||||
void S_StartSoundPitch(const struct mobj_s *origin, int sound_id, const pitchrange_t pitch_range);
|
||||
|
||||
// Stop sound for thing at <origin>
|
||||
void S_StopSound(const struct mobj_s *origin);
|
||||
|
@ -116,19 +116,17 @@ musicinfo_t original_S_music[] = {
|
||||
// killough 12/98:
|
||||
// Reimplemented 'singularity' flag, adjusting many sounds below
|
||||
|
||||
#define SOUND_LINK(n, s, p, l, i) \
|
||||
#define SOUND_LINK(n, s, p, l) \
|
||||
{.name = n, \
|
||||
.singularity = s, \
|
||||
.priority = p, \
|
||||
.link = l ? &original_S_sfx[l] : NULL, \
|
||||
.pitch = i, \
|
||||
.volume = -1, \
|
||||
.buffer = 0, \
|
||||
.lumpnum = -1, \
|
||||
.cached = false}
|
||||
|
||||
#define SOUND(n, s, p) \
|
||||
SOUND_LINK(n, s, p, 0, -1)
|
||||
SOUND_LINK(n, s, p, 0)
|
||||
|
||||
sfxinfo_t original_S_sfx[NUMSFX] = {
|
||||
SOUND("none", sg_none, 0), // S_sfx[0] needs to be a dummy for odd reasons.
|
||||
@ -218,7 +216,7 @@ sfxinfo_t original_S_sfx[NUMSFX] = {
|
||||
SOUND("punch", sg_none, 64),
|
||||
SOUND("hoof", sg_none, 70),
|
||||
SOUND("metal", sg_none, 70),
|
||||
SOUND_LINK("chgun", sg_none, 64, sfx_pistol, 150),
|
||||
SOUND_LINK("chgun", sg_none, 64, sfx_pistol),
|
||||
SOUND("tink", sg_none, 60),
|
||||
SOUND("bdopn", sg_none, 100),
|
||||
SOUND("bdcls", sg_none, 100),
|
||||
|
@ -50,12 +50,6 @@ typedef struct sfxinfo_s
|
||||
// referenced sound if a link
|
||||
struct sfxinfo_s *link;
|
||||
|
||||
// pitch if a link
|
||||
int pitch;
|
||||
|
||||
// volume if a link
|
||||
int volume;
|
||||
|
||||
// OpenAL buffer id
|
||||
unsigned int buffer;
|
||||
|
||||
|
@ -782,7 +782,7 @@ void ST_updateWidgets(void)
|
||||
else
|
||||
{
|
||||
if (!(plyr->keyblinktics & (2*KEYBLINKMASK - 1)))
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
S_StartSoundPitch(NULL, sfx_itemup, PITCH_NONE);
|
||||
|
||||
plyr->keyblinktics--;
|
||||
|
||||
|
@ -1331,13 +1331,13 @@ void V_ScreenShot(void)
|
||||
// players[consoleplayer].message = "screen shot"
|
||||
|
||||
// killough 10/98: print error message and change sound effect if error
|
||||
S_StartSound(NULL,
|
||||
S_StartSoundPitch(NULL,
|
||||
!success
|
||||
? displaymsg("%s", errno ? strerror(errno)
|
||||
: "Could not take screenshot"),
|
||||
sfx_oof
|
||||
: gamemode == commercial ? sfx_radio
|
||||
: sfx_tink);
|
||||
: sfx_tink, PITCH_NONE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user