Change enums to all-caps

This commit is contained in:
twinaphex 2016-03-24 00:34:13 +01:00
parent c0b931efcd
commit e5a2d16447
6 changed files with 150 additions and 134 deletions

18
id_ca.c
View File

@ -713,12 +713,12 @@ void CA_Shutdown (void)
switch(oldsoundmode)
{
case sdm_Off:
case SDM_OFF:
return;
case sdm_PC:
case SDM_PC:
start = STARTPCSOUNDS;
break;
case sdm_AdLib:
case SDM_ADLIB:
start = STARTADLIBSOUNDS;
break;
}
@ -814,12 +814,12 @@ void CA_LoadAllSounds (void)
switch (oldsoundmode)
{
case sdm_Off:
case SDM_OFF:
goto cachein;
case sdm_PC:
case SDM_PC:
start = STARTPCSOUNDS;
break;
case sdm_AdLib:
case SDM_ADLIB:
start = STARTADLIBSOUNDS;
break;
}
@ -833,13 +833,13 @@ cachein:
switch (SoundMode)
{
case sdm_Off:
case SDM_OFF:
start = STARTADLIBSOUNDS; /* needed for priorities... */
break;
case sdm_PC:
case SDM_PC:
start = STARTPCSOUNDS;
break;
case sdm_AdLib:
case SDM_ADLIB:
start = STARTADLIBSOUNDS;
break;
}

97
id_sd.c
View File

@ -125,14 +125,14 @@ void SD_StopDigitized(void)
DigiNumber = (soundnames) 0;
DigiPriority = 0;
SoundPositioned = false;
if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))
if ((DigiMode == SDS_PC) && (SoundMode == SDM_PC))
SD_SoundFinished();
switch (DigiMode)
{
case sds_PC:
case SDS_PC:
break;
case sds_SoundBlaster:
case SDS_SOUNDBLASTER:
Mix_HaltChannel(-1);
break;
}
@ -281,7 +281,7 @@ void SD_SetDigiDevice(SDSMode mode)
devicenotpresent = false;
switch (mode)
{
case sds_SoundBlaster:
case SDS_SOUNDBLASTER:
if (!SoundBlasterPresent)
devicenotpresent = true;
break;
@ -480,16 +480,16 @@ static void SD_ShutDevice(void)
{
switch (SoundMode)
{
case sdm_PC:
case SDM_PC:
#if 0
SD_ShutPC();
#endif
break;
case sdm_AdLib:
case SDM_ADLIB:
SD_ShutAL();
break;
}
SoundMode = sdm_Off;
SoundMode = SDM_OFF;
}
///////////////////////////////////////////////////////////////////////////
@ -499,7 +499,7 @@ static void SD_ShutDevice(void)
///////////////////////////////////////////////////////////////////////////
static void SD_CleanDevice(void)
{
if ((SoundMode == sdm_AdLib) || (MusicMode == smm_AdLib))
if ((SoundMode == SDM_ADLIB) || (MusicMode == SMM_ADLIB))
SD_CleanAL();
}
@ -512,7 +512,7 @@ static void SD_StartDevice(void)
{
switch (SoundMode)
{
case sdm_AdLib:
case SDM_ADLIB:
SD_StartAL();
break;
}
@ -534,20 +534,20 @@ boolean SD_SetSoundMode(SDMode mode)
SD_StopSound();
if ((mode == sdm_AdLib) && !AdLibPresent)
mode = sdm_PC;
if ((mode == SDM_ADLIB) && !AdLibPresent)
mode = SDM_PC;
switch (mode)
{
case sdm_Off:
case SDM_OFF:
tableoffset = STARTADLIBSOUNDS;
result = true;
break;
case sdm_PC:
case SDM_PC:
tableoffset = STARTPCSOUNDS;
result = true;
break;
case sdm_AdLib:
case SDM_ADLIB:
tableoffset = STARTADLIBSOUNDS;
if (AdLibPresent)
result = true;
@ -583,10 +583,10 @@ boolean SD_SetMusicMode(SMMode mode)
switch (mode)
{
case smm_Off:
case SMM_OFF:
result = true;
break;
case smm_AdLib:
case SMM_ADLIB:
if (AdLibPresent)
result = true;
break;
@ -718,8 +718,8 @@ void SD_Startup(void)
alTimeCount = 0;
SD_SetSoundMode(sdm_Off);
SD_SetMusicMode(smm_Off);
SD_SetSoundMode(SDM_OFF);
SD_SetMusicMode(SMM_OFF);
SD_SetupDigi();
@ -782,17 +782,17 @@ boolean SD_PlaySound(soundnames sound)
boolean ispos = nextsoundpos;
nextsoundpos = false;
if (sound == -1 || (DigiMode == sds_Off && SoundMode == sdm_Off))
if (sound == -1 || (DigiMode == SDS_OFF && SoundMode == SDM_OFF))
return 0;
s = (SoundCommon *) SoundTable[sound];
if ((SoundMode != sdm_Off) && !s)
if ((SoundMode != SDM_OFF) && !s)
Quit("SD_PlaySound() - Uncached sound");
if ((DigiMode != sds_Off) && (DigiMap[sound] != -1))
if ((DigiMode != SDS_OFF) && (DigiMap[sound] != -1))
{
if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))
if ((DigiMode == SDS_PC) && (SoundMode == SDM_PC))
{
return 0;
}
@ -809,7 +809,7 @@ boolean SD_PlaySound(soundnames sound)
return(true);
}
if (SoundMode == sdm_Off)
if (SoundMode == SDM_OFF)
return 0;
if (!s->length)
@ -819,12 +819,12 @@ boolean SD_PlaySound(soundnames sound)
switch (SoundMode)
{
case sdm_PC:
case SDM_PC:
#if 0
SD_PCPlaySound((PCSound *)s);
#endif
break;
case sdm_AdLib:
case SDM_ADLIB:
SD_ALPlaySound((AdLibSound *)s);
break;
}
@ -847,10 +847,10 @@ word SD_SoundPlaying(void)
switch (SoundMode)
{
case sdm_PC:
case SDM_PC:
result = pcSound? true : false;
break;
case sdm_AdLib:
case SDM_ADLIB:
result = alSound? true : false;
break;
}
@ -873,12 +873,12 @@ SD_StopSound(void)
switch (SoundMode)
{
case sdm_PC:
case SDM_PC:
#if 0
SD_PCStopSound();
#endif
break;
case sdm_AdLib:
case SDM_ADLIB:
SD_ALStopSound();
break;
}
@ -921,13 +921,16 @@ int SD_MusicOff(void)
word i;
sqActive = false;
switch (MusicMode)
{
case smm_AdLib:
case SMM_ADLIB:
YM3812Write(0, alEffects, 0);
for (i = 0;i < sqMaxTracks;i++)
YM3812Write(0, alFreqH + i + 1, 0);
break;
default:
break;
}
return (int) (sqHackPtr-sqHack);
@ -942,18 +945,24 @@ void SD_StartMusic(int chunk)
{
SD_MusicOff();
if (MusicMode == smm_AdLib)
switch (MusicMode)
{
int32_t chunkLen = CA_CacheAudioChunk(chunk);
sqHack = (word *)(void *) audiosegs[chunk]; /* alignment is correct */
if ( (word)Retro_SwapLES16(*sqHack) == 0)
sqHackLen = sqHackSeqLen = chunkLen;
else
sqHackLen = sqHackSeqLen = (word)Retro_SwapLES16(*sqHack++);
sqHackPtr = sqHack;
sqHackTime = 0;
alTimeCount = 0;
SD_MusicOn();
case SMM_ADLIB:
{
int32_t chunkLen = CA_CacheAudioChunk(chunk);
sqHack = (word *)(void *) audiosegs[chunk]; /* alignment is correct */
if ( (word)Retro_SwapLES16(*sqHack) == 0)
sqHackLen = sqHackSeqLen = chunkLen;
else
sqHackLen = sqHackSeqLen = (word)Retro_SwapLES16(*sqHack++);
sqHackPtr = sqHack;
sqHackTime = 0;
alTimeCount = 0;
SD_MusicOn();
}
break;
default:
break;
}
}
@ -961,7 +970,7 @@ void SD_ContinueMusic(int chunk, int startoffs)
{
SD_MusicOff();
if (MusicMode == smm_AdLib)
if (MusicMode == SMM_ADLIB)
{
unsigned i;
int32_t chunkLen = CA_CacheAudioChunk(chunk);
@ -1008,7 +1017,7 @@ void SD_FadeOutMusic(void)
{
switch (MusicMode)
{
case smm_AdLib:
case SMM_ADLIB:
/* DEBUG - quick hack to turn the music off */
SD_MusicOff();
break;
@ -1027,7 +1036,7 @@ boolean SD_MusicPlaying(void)
switch (MusicMode)
{
case smm_AdLib:
case SMM_ADLIB:
result = sqActive;
break;
default:

79
id_sd.h
View File

@ -14,24 +14,28 @@
typedef enum
{
sdm_Off,
sdm_PC,sdm_AdLib,
SDM_OFF = 0,
SDM_PC,
SDM_ADLIB,
} SDMode;
typedef enum
{
smm_Off,smm_AdLib
SMM_OFF = 0,
SMM_ADLIB
} SMMode;
typedef enum
{
sds_Off,sds_PC,sds_SoundBlaster
SDS_OFF = 0,
SDS_PC,
SDS_SOUNDBLASTER
} SDSMode;
typedef struct
{
longword length;
word priority;
longword length;
word priority;
} SoundCommon;
#define ORIG_SOUNDCOMMON_SIZE 6
@ -45,8 +49,8 @@ typedef struct
typedef struct
{
SoundCommon common;
byte data[1];
SoundCommon common;
byte data[1];
} PCSound;
// Register addresses
@ -65,54 +69,56 @@ typedef struct
typedef struct
{
byte mChar,cChar,
mScale,cScale,
mAttack,cAttack,
mSus,cSus,
mWave,cWave,
nConn,
// These are only for Muse - these bytes are really unused
voice,
mode;
byte unused[3];
byte mChar;
byte cChar;
byte mScale;
byte cScale;
byte mAttack;
byte cAttack;
byte mSus;
byte cSus;
byte mWave;
byte cWave;
byte nConn;
// These are only for Muse - these bytes are really unused
byte voice;
byte mode;
byte unused[3];
} Instrument;
#define ORIG_INSTRUMENT_SIZE 16
typedef struct
{
SoundCommon common;
Instrument inst;
byte block;
byte data[1];
SoundCommon common;
Instrument inst;
byte block;
byte data[1];
} AdLibSound;
#define ORIG_ADLIBSOUND_SIZE (ORIG_SOUNDCOMMON_SIZE + ORIG_INSTRUMENT_SIZE + 2)
//
// Sequencing stuff
//
// Sequencing stuff
#define sqMaxTracks 10
typedef struct
{
word length;
word values[1];
word length;
word values[1];
} MusicGroup;
typedef struct
{
int valid;
fixed globalsoundx, globalsoundy;
int valid;
fixed globalsoundx, globalsoundy;
} globalsoundpos;
extern globalsoundpos channelSoundPos[];
// Global variables
extern boolean AdLibPresent,
SoundBlasterPresent,
SoundPositioned;
SoundBlasterPresent,
SoundPositioned;
extern SDMode SoundMode;
extern SDSMode DigiMode;
extern SMMode MusicMode;
@ -123,24 +129,25 @@ extern int DigiChannel[];
static inline void Delay(int wolfticks)
{
if(wolfticks>0) rarch_sleep(wolfticks * 100 / 7);
if(wolfticks>0)
rarch_sleep(wolfticks * 100 / 7);
}
// Function prototypes
extern void SD_Startup(void),
SD_Shutdown(void);
SD_Shutdown(void);
extern int SD_GetChannelForDigi(int which);
extern void SD_PositionSound(int leftvol,int rightvol);
extern boolean SD_PlaySound(soundnames sound);
extern void SD_SetPosition(int channel, int leftvol,int rightvol);
extern void SD_StopSound(void),
SD_WaitSoundDone(void);
SD_WaitSoundDone(void);
extern void SD_StartMusic(int chunk);
extern void SD_ContinueMusic(int chunk, int startoffs);
extern void SD_MusicOn(void),
SD_FadeOutMusic(void);
SD_FadeOutMusic(void);
extern int SD_MusicOff(void);
extern boolean SD_MusicPlaying(void);

View File

@ -1257,7 +1257,7 @@ statetype s_transshoot8 = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transc
void SpawnTrans (int tilex, int tiley)
{
if (SoundBlasterPresent && DigiMode != sds_Off)
if (SoundBlasterPresent && DigiMode != SDS_OFF)
s_transdie01.tictime = 105;
SpawnNewObj (tilex,tiley,&s_transstand);
@ -1336,7 +1336,7 @@ statetype s_ubershoot7 = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_ubercha
void SpawnUber (int tilex, int tiley)
{
if (SoundBlasterPresent && DigiMode != sds_Off)
if (SoundBlasterPresent && DigiMode != SDS_OFF)
s_uberdie01.tictime = 70;
SpawnNewObj (tilex,tiley,&s_uberstand);
@ -1431,7 +1431,7 @@ statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,(statefunc)T_Sh
void SpawnWill (int tilex, int tiley)
{
if (SoundBlasterPresent && DigiMode != sds_Off)
if (SoundBlasterPresent && DigiMode != SDS_OFF)
s_willdie2.tictime = 70;
SpawnNewObj (tilex,tiley,&s_willstand);
@ -1597,7 +1597,7 @@ statetype s_deathshoot5 = {false,SPR_DEATH_SHOOT4,10,NULL,(statefunc)T_S
void SpawnDeath (int tilex, int tiley)
{
if (SoundBlasterPresent && DigiMode != sds_Off)
if (SoundBlasterPresent && DigiMode != SDS_OFF)
s_deathdie2.tictime = 105;
SpawnNewObj (tilex,tiley,&s_deathstand);
@ -1783,7 +1783,7 @@ void A_Breathing (objtype *)
void SpawnAngel (int tilex, int tiley)
{
if (SoundBlasterPresent && DigiMode != sds_Off)
if (SoundBlasterPresent && DigiMode != SDS_OFF)
s_angeldie11.tictime = 105;
SpawnNewObj (tilex,tiley,&s_angelstand);
@ -2197,7 +2197,7 @@ statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Sho
void SpawnSchabbs (int tilex, int tiley)
{
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
s_schabbdie2.tictime = 140;
else
s_schabbdie2.tictime = 5;
@ -2224,7 +2224,7 @@ void SpawnSchabbs (int tilex, int tiley)
void SpawnGift (int tilex, int tiley)
{
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
s_giftdie2.tictime = 140;
else
s_giftdie2.tictime = 5;
@ -2251,7 +2251,7 @@ void SpawnGift (int tilex, int tiley)
void SpawnFat (int tilex, int tiley)
{
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
s_fatdie2.tictime = 140;
else
s_fatdie2.tictime = 5;
@ -2783,7 +2783,7 @@ statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_
void SpawnFakeHitler (int tilex, int tiley)
{
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
s_hitlerdie2.tictime = 140;
else
s_hitlerdie2.tictime = 5;
@ -2809,7 +2809,7 @@ void SpawnFakeHitler (int tilex, int tiley)
void SpawnHitler (int tilex, int tiley)
{
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
s_hitlerdie2.tictime = 140;
else
s_hitlerdie2.tictime = 5;

View File

@ -154,15 +154,15 @@ static void ReadConfig(void)
close(file);
if ((sd == sdm_AdLib || sm == smm_AdLib) && !AdLibPresent
if ((sd == SDM_ADLIB || sm == SMM_ADLIB) && !AdLibPresent
&& !SoundBlasterPresent)
{
sd = sdm_PC;
sm = smm_Off;
sd = SDM_PC;
sm = SMM_OFF;
}
if ((sds == sds_SoundBlaster && !SoundBlasterPresent))
sds = sds_Off;
if ((sds == SDS_SOUNDBLASTER && !SoundBlasterPresent))
sds = SDS_OFF;
/* make sure values are correct */
@ -189,19 +189,19 @@ static void ReadConfig(void)
noconfig:
if (SoundBlasterPresent || AdLibPresent)
{
sd = sdm_AdLib;
sm = smm_AdLib;
sd = SDM_ADLIB;
sm = SMM_ADLIB;
}
else
{
sd = sdm_PC;
sm = smm_Off;
sd = SDM_PC;
sm = SMM_OFF;
}
if (SoundBlasterPresent)
sds = sds_SoundBlaster;
sds = SDS_SOUNDBLASTER;
else
sds = sds_Off;
sds = SDS_OFF;
if (MousePresent)
mouseenabled = true;

View File

@ -1142,28 +1142,28 @@ CP_Sound (int unused)
// SOUND EFFECTS
//
case 0:
if (SoundMode != sdm_Off)
if (SoundMode != SDM_OFF)
{
SD_WaitSoundDone ();
SD_SetSoundMode (sdm_Off);
SD_SetSoundMode (SDM_OFF);
DrawSoundMenu ();
}
break;
case 1:
if (SoundMode != sdm_PC)
if (SoundMode != SDM_PC)
{
SD_WaitSoundDone ();
SD_SetSoundMode (sdm_PC);
SD_SetSoundMode (SDM_PC);
CA_LoadAllSounds ();
DrawSoundMenu ();
ShootSnd ();
}
break;
case 2:
if (SoundMode != sdm_AdLib)
if (SoundMode != SDM_ADLIB)
{
SD_WaitSoundDone ();
SD_SetSoundMode (sdm_AdLib);
SD_SetSoundMode (SDM_ADLIB);
CA_LoadAllSounds ();
DrawSoundMenu ();
ShootSnd ();
@ -1174,24 +1174,24 @@ CP_Sound (int unused)
// DIGITIZED SOUND
//
case 5:
if (DigiMode != sds_Off)
if (DigiMode != SDS_OFF)
{
SD_SetDigiDevice (sds_Off);
SD_SetDigiDevice (SDS_OFF);
DrawSoundMenu ();
}
break;
case 6:
/* if (DigiMode != sds_SoundSource)
/* if (DigiMode != SDS_SOUNDSOURCE)
{
SD_SetDigiDevice (sds_SoundSource);
SD_SetDigiDevice (SDS_SOUNDSOURCE);
DrawSoundMenu ();
ShootSnd ();
}*/
break;
case 7:
if (DigiMode != sds_SoundBlaster)
if (DigiMode != SDS_SOUNDBLASTER)
{
SD_SetDigiDevice (sds_SoundBlaster);
SD_SetDigiDevice (SDS_SOUNDBLASTER);
DrawSoundMenu ();
ShootSnd ();
}
@ -1201,17 +1201,17 @@ CP_Sound (int unused)
// MUSIC
//
case 10:
if (MusicMode != smm_Off)
if (MusicMode != SMM_OFF)
{
SD_SetMusicMode (smm_Off);
SD_SetMusicMode (SMM_OFF);
DrawSoundMenu ();
ShootSnd ();
}
break;
case 11:
if (MusicMode != smm_AdLib)
if (MusicMode != SMM_ADLIB)
{
SD_SetMusicMode (smm_AdLib);
SD_SetMusicMode (SMM_ADLIB);
DrawSoundMenu ();
ShootSnd ();
StartCPMusic (MENUSONG);
@ -1293,15 +1293,15 @@ DrawSoundMenu (void)
// SOUND EFFECTS
//
case 0:
if (SoundMode == sdm_Off)
if (SoundMode == SDM_OFF)
on = 1;
break;
case 1:
if (SoundMode == sdm_PC)
if (SoundMode == SDM_PC)
on = 1;
break;
case 2:
if (SoundMode == sdm_AdLib)
if (SoundMode == SDM_ADLIB)
on = 1;
break;
@ -1309,15 +1309,15 @@ DrawSoundMenu (void)
// DIGITIZED SOUND
//
case 5:
if (DigiMode == sds_Off)
if (DigiMode == SDS_OFF)
on = 1;
break;
case 6:
// if (DigiMode == sds_SoundSource)
// if (DigiMode == SDS_SOUNDSOURCE)
// on = 1;
break;
case 7:
if (DigiMode == sds_SoundBlaster)
if (DigiMode == SDS_SOUNDBLASTER)
on = 1;
break;
@ -1325,11 +1325,11 @@ DrawSoundMenu (void)
// MUSIC
//
case 10:
if (MusicMode == smm_Off)
if (MusicMode == SMM_OFF)
on = 1;
break;
case 11:
if (MusicMode == smm_AdLib)
if (MusicMode == SMM_ADLIB)
on = 1;
break;
}