Replace literal g_sounds[].m bits with enum constants. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4055 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-09-08 20:18:56 +00:00
parent 28d99e9658
commit 14467dec24
10 changed files with 82 additions and 38 deletions

View file

@ -18,6 +18,7 @@ duke3d_h=\
$(INC)/function.h \
$(INC)/config.h \
$(INC)/sounds.h \
$(INC)/sounds_common.h \
$(INC)/soundsdyn.h \
$(INC)/rts.h \
$(INC)/_rts.h \
@ -86,6 +87,7 @@ $(OBJ)/astub.$o: $(SRC)/astub.c \
$(m32_script_hs)
$(OBJ)/sounds_mapster32.$o: $(SRC)/sounds_mapster32.c \
$(SRC)/sounds_mapster32.h \
$(SRC)/sounds_common.h \
$(EINC)/compat.h \
$(EINC)/baselayer.h \
$(EINC)/cache1d.h \
@ -96,8 +98,8 @@ $(OBJ)/sounds_mapster32.$o: $(SRC)/sounds_mapster32.c \
$(JAUDIOLIBDIR)/include/fx_man.h \
$(SRC)/jmact/mathutil.h
$(OBJ)/m32def.$o: $(SRC)/m32def.c $(m32_script_hs) $(EINC)/cache1d.h $(SRC)/sounds_mapster32.h $(SRC)/keys.h
$(OBJ)/m32exec.$o: $(SRC)/m32exec.c $(m32_script_hs) $(SRC)/sounds_mapster32.h $(EINC)/osd.h $(SRC)/keys.h $(JAUDIOLIBDIR)/include/fx_man.h
$(OBJ)/m32def.$o: $(SRC)/m32def.c $(m32_script_hs) $(EINC)/cache1d.h $(SRC)/sounds_mapster32.h $(SRC)/sounds_common.h $(SRC)/keys.h
$(OBJ)/m32exec.$o: $(SRC)/m32exec.c $(m32_script_hs) $(SRC)/sounds_mapster32.h $(SRC)/sounds_common.h $(EINC)/osd.h $(SRC)/keys.h $(JAUDIOLIBDIR)/include/fx_man.h
$(OBJ)/m32structures.$o: $(SRC)/m32structures.c $(m32_script_hs) $(EINC)/compat.h $(EINC)/prlights.h
$(OBJ)/m32vars.$o: $(SRC)/m32vars.c $(SRC)/m32structures.c $(m32_script_hs) $(EINC)/osd.h $(SRC)/keys.h $(EINC)/polymer.h

View file

@ -1366,7 +1366,7 @@ ACTOR_STATIC void G_MoveFX(void)
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && // ST_9_SLIDING_ST_DOOR
ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
{
if (g_sounds[s->lotag].m&2)
if (g_sounds[s->lotag].m & SF_MSFX)
{
int32_t x = dist(&sprite[peekps->i],s);
@ -1398,7 +1398,7 @@ ACTOR_STATIC void G_MoveFX(void)
goto BOLT;
}
g_sounds[s->lotag].m |= 1;
g_sounds[s->lotag].m |= SF_LOOP;
A_PlaySound(s->lotag,i);
g_sounds[s->lotag].m = om;
T1 = 1;
@ -1414,7 +1414,7 @@ ACTOR_STATIC void G_MoveFX(void)
}
}
if (g_sounds[s->lotag].m&16)
if (g_sounds[s->lotag].m & SF_GLOBAL)
{
// Randomly playing global sounds (flyby of planes, screams, ...)

View file

@ -2534,7 +2534,7 @@ static void M32_MoveFX(void)
if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 &&
AmbienceToggle && sector[s->sectnum].floorz != sector[s->sectnum].ceilingz)
{
if ((g_sounds[s->lotag].m&2))
if ((g_sounds[s->lotag].m & SF_MSFX))
{
x = dist((spritetype *)&pos,s);
if (x < ht && (T1&1) == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1))
@ -2554,7 +2554,7 @@ static void M32_MoveFX(void)
}
if (j == -1) continue;
}
g_sounds[s->lotag].m |= 1;
g_sounds[s->lotag].m |= SF_LOOP;
A_PlaySound(s->lotag,i);
g_sounds[s->lotag].m = om;
T1 |= 1;

View file

@ -5902,9 +5902,9 @@ repeatcase:
g_sounds[k].pr = *(g_scriptPtr-1);
C_GetNextValue(LABEL_DEFINE);
g_sounds[k].m = *(g_scriptPtr-1) & ~32;
g_sounds[k].m = *(g_scriptPtr-1) & ~SF_ONEINST_INTERNAL;
if (*(g_scriptPtr-1) & 1)
g_sounds[k].m |= 32;
g_sounds[k].m |= SF_ONEINST_INTERNAL;
C_GetNextValue(LABEL_DEFINE);
g_sounds[k].vo = *(g_scriptPtr-1);

View file

@ -52,7 +52,7 @@ int32_t A_CallSound(int32_t sn,int32_t whatsprite)
if (T1 == 0)
{
if ((g_sounds[SLT].m&16) == 0)
if ((g_sounds[SLT].m & SF_GLOBAL) == 0)
{
if (SLT)
{
@ -69,7 +69,7 @@ int32_t A_CallSound(int32_t sn,int32_t whatsprite)
else if (SHT < MAXSOUNDS)
{
if (SHT) A_PlaySound(SHT,whatsprite);
if ((g_sounds[SLT].m&1) || (SHT && SHT != SLT))
if ((g_sounds[SLT].m & SF_LOOP) || (SHT && SHT != SLT))
S_StopEnvSound(SLT,T6);
T6 = whatsprite;
T1 = 0;
@ -1572,7 +1572,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite)
}
else if (hitag != 0)
{
if (switchissprite == 1 && (g_sounds[hitag].m&4) == 0)
if (switchissprite == 1 && (g_sounds[hitag].m & SF_TALK) == 0)
S_PlaySound3D(hitag,w,&davector);
else A_PlaySound(hitag,g_player[snum].ps->i);
}

View file

@ -511,7 +511,7 @@ static int32_t S_CalcDistAndAng(int32_t i, int32_t num, int32_t camsect, int32_t
}
}
if ((g_sounds[num].m&16) == 0 && S_IsAmbientSFX(i) && (sector[SECT].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR
if ((g_sounds[num].m & SF_GLOBAL) == 0 && S_IsAmbientSFX(i) && (sector[SECT].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR
sndist = divscale14(sndist, SHT+1);
sound_further_processing:
@ -534,7 +534,7 @@ sound_further_processing:
break;
}
if ((g_sounds[num].m&16) || sndist < ((255-LOUDESTVOLUME)<<6))
if ((g_sounds[num].m & SF_GLOBAL) || sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
*sndistptr = sndist;
@ -557,7 +557,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
if ((unsigned)num > (unsigned)g_maxSoundPos ||
ud.config.FXDevice < 0 ||
((g_sounds[num].m&8) && ud.lockout) ||
((g_sounds[num].m & SF_ADULT) && ud.lockout) ||
ud.config.SoundToggle == 0 ||
// g_sounds[num].num >= MAXSOUNDINSTANCES ||
(unsigned)i >= MAXSPRITES ||
@ -566,7 +566,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
(myps->gm&MODE_MENU))
return -1;
if (g_sounds[num].m&128) // Duke-Tag sound
if (g_sounds[num].m & SF_DTAG) // Duke-Tag sound
{
if ((voice = S_PlaySound(num)) <= FX_Ok)
return -1;
@ -586,7 +586,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
}
// Duke talk
if (g_sounds[num].m&4)
if (g_sounds[num].m & SF_TALK)
{
if ((g_netServer || ud.multimode > 1) && PN == APLAYER && sprite[i].yvel != screenpeek) // other player sound
{
@ -598,7 +598,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
// don't play if any Duke talk sounds are already playing
for (j=g_maxSoundPos; j>=0; j--)
if ((g_sounds[j].m&4) && g_sounds[j].num > 0)
if ((g_sounds[j].m & SF_TALK) && g_sounds[j].num > 0)
return -1;
}
@ -624,10 +624,11 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
}
else
{
if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & 3) == 0)
if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & (SF_LOOP|SF_MSFX)) == 0)
return -1;
if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER && (g_sounds[num].m&4) == 0)
if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER
&& (g_sounds[num].m & SF_TALK) == 0)
pitch = -768;
}
@ -655,10 +656,10 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
}
{
const int32_t repeatp = (g_sounds[num].m&1);
const int32_t repeatp = (g_sounds[num].m & SF_LOOP);
const int32_t ambsfxp = S_IsAmbientSFX(i);
if (repeatp && (g_sounds[num].m&32) && g_sounds[num].num > 0)
if (repeatp && (g_sounds[num].m & SF_ONEINST_INTERNAL) && g_sounds[num].num > 0)
{
g_soundlocks[num]--;
return -1;
@ -712,8 +713,8 @@ int32_t S_PlaySound(int32_t num)
return -1;
}
if (!(ud.config.VoiceToggle&1) && (g_sounds[num].m&4)) return -1;
if ((g_sounds[num].m&8) && ud.lockout) return -1;
if (!(ud.config.VoiceToggle&1) && (g_sounds[num].m & SF_TALK)) return -1;
if ((g_sounds[num].m & SF_ADULT) && ud.lockout) return -1;
if (FX_VoiceAvailable(g_sounds[num].pr) == 0) return -1;
pitch = S_GetPitch(num);
@ -738,7 +739,7 @@ int32_t S_PlaySound(int32_t num)
return -1;
}
if (g_sounds[num].m&1)
if (g_sounds[num].m & SF_LOOP)
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
pitch,FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME),
g_sounds[num].soundsiz, (num * MAXSOUNDINSTANCES) + j);

View file

@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _sounds_public_
#define _sounds_public_
#include "sounds_common.h"
// KEEPINSYNC lunatic/con_lang.lua
#define MAXSOUNDS 4096
#define MAXSOUNDINSTANCES 8

View file

@ -0,0 +1,38 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2013 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//-------------------------------------------------------------------------
#ifndef EDUKE32_SOUNDS_COMMON_H
#define EDUKE32_SOUNDS_COMMON_H
// Sound flags
enum {
SF_LOOP = 1,
SF_MSFX = 2,
SF_TALK = 4,
SF_ADULT = 8,
SF_GLOBAL = 16,
SF_ONEINST_INTERNAL = 32,
SF_DTAG = 128,
};
#endif

View file

@ -164,23 +164,23 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
if (num >= MAXSOUNDS ||
!SM32_havesound ||
// ((g_sounds[num].m&8) && ud.lockout) ||
// ((g_sounds[num].m & SF_ADULT) && ud.lockout) ||
SoundToggle == 0 ||
g_sounds[num].num > 3 ||
FX_VoiceAvailable(g_sounds[num].pr) == 0)
return -1;
if (g_sounds[num].m&128)
if (g_sounds[num].m & SF_DTAG)
{
S_PlaySound(num);
return 0;
}
if (g_sounds[num].m&4)
if (g_sounds[num].m & SF_TALK)
{
for (j=0; j<MAXSOUNDS; j++)
// for (k=0; k<g_sounds[j].num; k++)
if ((g_sounds[j].num > 0) && (g_sounds[j].m&4))
if ((g_sounds[j].num > 0) && (g_sounds[j].m & SF_TALK))
return -1;
}
@ -192,7 +192,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
sndist = FindDistance3D((cx-pos->x),(cy-pos->y),(cz-pos->z)>>4);
if (i >= 0 && (g_sounds[num].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
if (i >= 0 && (g_sounds[num].m & SF_GLOBAL) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
sndist = divscale14(sndist,(SHT+1));
pitchs = g_sounds[num].ps;
@ -224,7 +224,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
break;
default:
*/
if (cursectnum > -1 && sector[cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0)
if (cursectnum > -1 && sector[cursectnum].lotag == 2 && (g_sounds[num].m & SF_TALK) == 0)
pitch = -768;
if (sndist > 31444 && PN != MUSICANDSFX)
return -1;
@ -252,12 +252,12 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
else g_sounds[num].lock++;
}
if (g_sounds[num].m&16) sndist = 0;
if (g_sounds[num].m & SF_GLOBAL) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
if (g_sounds[num].m&1)
if (g_sounds[num].m & SF_LOOP)
{
if (g_sounds[num].num > 0)
return -1;
@ -293,7 +293,7 @@ void S_PlaySound(int32_t num)
OSD_Printf("WARNING: invalid sound #%d\n",num);
return;
}
// if ((g_sounds[num].m&8) && ud.lockout) return;
// if ((g_sounds[num].m & SF_ADULT) && ud.lockout) return;
if (FX_VoiceAvailable(g_sounds[num].pr) == 0) return;
pitchs = g_sounds[num].ps;
@ -319,7 +319,7 @@ void S_PlaySound(int32_t num)
else g_sounds[num].lock++;
}
if (g_sounds[num].m&1)
if (g_sounds[num].m & SF_LOOP)
{
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz,num);
@ -404,7 +404,7 @@ void S_Update(void)
sndang = 2048 + ca - getangle(cx-sx,cy-sy);
sndang &= 2047;
sndist = FindDistance3D((cx-sx),(cy-sy),(cz-sz)>>4);
if (i >= 0 && (g_sounds[j].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
if (i >= 0 && (g_sounds[j].m & SF_GLOBAL) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
sndist = divscale14(sndist,(SHT+1));
sndist += g_sounds[j].vo;
@ -433,7 +433,7 @@ void S_Update(void)
// }
if (g_sounds[j].ptr == 0 && S_LoadSound(j) == 0) continue;
if (g_sounds[j].m&16) sndist = 0;
if (g_sounds[j].m & SF_GLOBAL) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
@ -450,7 +450,7 @@ void S_Callback(uint32_t num)
if (k > 0)
{
if ((g_sounds[num].m&16) == 0)
if ((g_sounds[num].m & SF_GLOBAL) == 0)
for (j=0; j<k; j++)
{
i = g_sounds[num].SoundOwner[j].ow;

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __sounds_mapster32_h__
#include "build.h"
#include "sounds_common.h"
#pragma pack(push,1)