Fix some of my breakages.

fix hexen2 blind monsters.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4949 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-07-27 08:21:34 +00:00
parent d7745478b5
commit 8cfbc1ad26
30 changed files with 307 additions and 214 deletions

View file

@ -917,7 +917,7 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
break; break;
case CG_S_STARTSOUND:// ( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx ) case CG_S_STARTSOUND:// ( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx )
S_StartSound(VM_LONG(arg[1])+1, VM_LONG(arg[2]), S_PrecacheSound(VM_FROMSTRCACHE(arg[3])), VM_POINTER(arg[0]), 1, 1, 0, 0); S_StartSound(VM_LONG(arg[1])+1, VM_LONG(arg[2]), S_PrecacheSound(VM_FROMSTRCACHE(arg[3])), VM_POINTER(arg[0]), 1, 1, 0, 0, 0);
break; break;
case CG_S_ADDLOOPINGSOUND: case CG_S_ADDLOOPINGSOUND:

View file

@ -1105,6 +1105,7 @@ void CL_Connect_f (void)
CL_BeginServerConnect(server, 0, false); CL_BeginServerConnect(server, 0, false);
} }
#if defined(CL_MASTER)
static void CL_ConnectBestRoute_f (void) static void CL_ConnectBestRoute_f (void)
{ {
char server[1024]; char server[1024];
@ -1139,6 +1140,7 @@ static void CL_ConnectBestRoute_f (void)
CL_Disconnect_f (); CL_Disconnect_f ();
CL_BeginServerConnect(server, 0, true); CL_BeginServerConnect(server, 0, true);
} }
#endif
static void CL_Join_f (void) static void CL_Join_f (void)
{ {
@ -3874,8 +3876,9 @@ void CL_Init (void)
Cmd_AddCommand ("cl_status", CL_Status_f); Cmd_AddCommand ("cl_status", CL_Status_f);
Cmd_AddCommandD ("quit", CL_Quit_f, "Use this command when you get angry. Does not save any cvars. Use cfg_save to save settings, or use the menu for a prompt."); Cmd_AddCommandD ("quit", CL_Quit_f, "Use this command when you get angry. Does not save any cvars. Use cfg_save to save settings, or use the menu for a prompt.");
#if defined(CL_MASTER)
Cmd_AddCommandD ("connectbr", CL_ConnectBestRoute_f, "connect address:port\nConnect to a qw server using the best route we can detect."); Cmd_AddCommandD ("connectbr", CL_ConnectBestRoute_f, "connect address:port\nConnect to a qw server using the best route we can detect.");
#endif
Cmd_AddCommandD ("connect", CL_Connect_f, "connect scheme://address:port\nConnect to a server. " Cmd_AddCommandD ("connect", CL_Connect_f, "connect scheme://address:port\nConnect to a server. "
#if defined(FTE_TARGET_WEB) #if defined(FTE_TARGET_WEB)
"Use a scheme of ws:// or wss:// to connect via using websockets." "Use a scheme of ws:// or wss:// to connect via using websockets."

View file

@ -4252,13 +4252,13 @@ void CLQW_ParseStartSoundPacket(void)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent); Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
#ifdef PEXT_CSQC #ifdef PEXT_CSQC
if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, 100, 0)) if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, 100, 0, 0))
#endif #endif
{ {
if (!sound_num) if (!sound_num)
S_StopSound(ent, channel); S_StopSound(ent, channel);
else else
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation, 0, 0); S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation, 0, 0, 0);
} }
@ -4346,7 +4346,7 @@ void CLQ2_ParseStartSoundPacket(void)
if (sfx->loadstate == SLS_FAILED) if (sfx->loadstate == SLS_FAILED)
sfx = S_PrecacheSound(va("players/male/%s", cl.sound_precache[sound_num]->name+1)); sfx = S_PrecacheSound(va("players/male/%s", cl.sound_precache[sound_num]->name+1));
} }
S_StartSound (ent, channel, sfx, pos, volume, attenuation, ofs, 0); S_StartSound (ent, channel, sfx, pos, volume, attenuation, ofs, 0, 0);
} }
#endif #endif
@ -4362,6 +4362,7 @@ void CLNQ_ParseStartSoundPacket(void)
int i; int i;
int pitchadj; int pitchadj;
float timeofs; float timeofs;
unsigned int flags;
field_mask = MSG_ReadByte(); field_mask = MSG_ReadByte();
@ -4385,6 +4386,11 @@ void CLNQ_ParseStartSoundPacket(void)
else else
timeofs = 0; timeofs = 0;
// if (field_mask & FTESND_FLAGS)
// flags = MSG_ReadByte();
// else
flags = 0;
if (field_mask & DPSND_LARGEENTITY) if (field_mask & DPSND_LARGEENTITY)
{ {
ent = MSGCL_ReadEntity(); ent = MSGCL_ReadEntity();
@ -4412,13 +4418,13 @@ void CLNQ_ParseStartSoundPacket(void)
pos[i] = MSG_ReadCoord (); pos[i] = MSG_ReadCoord ();
#ifdef PEXT_CSQC #ifdef PEXT_CSQC
if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, pitchadj, timeofs)) if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, pitchadj, timeofs, flags))
#endif #endif
{ {
if (!sound_num) if (!sound_num)
S_StopSound(ent, channel); S_StopSound(ent, channel);
else else
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation, timeofs, pitchadj); S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation, timeofs, pitchadj, flags);
} }
if (ent == cl.playerview[0].playernum+1) if (ent == cl.playerview[0].playernum+1)

View file

@ -737,7 +737,7 @@ void SCR_DrawCursor(void)
key_customcursor[cmod].dirty = false; key_customcursor[cmod].dirty = false;
oldcurs = key_customcursor[cmod].handle; oldcurs = key_customcursor[cmod].handle;
if (rf->VID_CreateCursor) if (rf->VID_CreateCursor && strcmp(key_customcursor[cmod].name, "none"))
{ {
key_customcursor[cmod].handle = rf->VID_CreateCursor(key_customcursor[cmod].name, key_customcursor[cmod].hotspot[0], key_customcursor[cmod].hotspot[1], key_customcursor[cmod].scale); key_customcursor[cmod].handle = rf->VID_CreateCursor(key_customcursor[cmod].name, key_customcursor[cmod].hotspot[0], key_customcursor[cmod].hotspot[1], key_customcursor[cmod].scale);
if (!key_customcursor[cmod].handle) if (!key_customcursor[cmod].handle)
@ -763,7 +763,7 @@ void SCR_DrawCursor(void)
return; return;
//system doesn't support a hardware cursor, so try to draw a software one. //system doesn't support a hardware cursor, so try to draw a software one.
if (!*key_customcursor[cmod].name) if (!strcmp(key_customcursor[cmod].name, "none"))
return; return;
p = R2D_SafeCachePic(key_customcursor[cmod].name); p = R2D_SafeCachePic(key_customcursor[cmod].name);

View file

@ -1122,7 +1122,7 @@ void CL_ParseTEnt (void)
if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike)) if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike))
P_RunParticleEffect (pos, vec3_origin, 20, 30); P_RunParticleEffect (pos, vec3_origin, 20, 30);
S_StartSound (-2, 0, cl_sfx_wizhit, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_wizhit, pos, 1, 1, 0, 0, 0);
break; break;
case TE_KNIGHTSPIKE: // spike hitting wall case TE_KNIGHTSPIKE: // spike hitting wall
@ -1135,7 +1135,7 @@ void CL_ParseTEnt (void)
if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike)) if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike))
P_RunParticleEffect (pos, vec3_origin, 226, 20); P_RunParticleEffect (pos, vec3_origin, 226, 20);
S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0, 0);
break; break;
case TEDP_SPIKEQUAD: case TEDP_SPIKEQUAD:
@ -1151,16 +1151,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 10); P_RunParticleEffect (pos, vec3_origin, 0, 10);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
case TE_SPIKE: // spike hitting wall case TE_SPIKE: // spike hitting wall
@ -1175,16 +1175,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 10); P_RunParticleEffect (pos, vec3_origin, 0, 10);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
case TEDP_SUPERSPIKEQUAD: // super spike hitting wall case TEDP_SUPERSPIKEQUAD: // super spike hitting wall
@ -1201,16 +1201,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 20); P_RunParticleEffect (pos, vec3_origin, 0, 20);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
case TE_SUPERSPIKE: // super spike hitting wall case TE_SUPERSPIKE: // super spike hitting wall
@ -1226,16 +1226,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 20); P_RunParticleEffect (pos, vec3_origin, 0, 20);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
@ -1254,16 +1254,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 10); P_RunParticleEffect (pos, vec3_origin, 0, 10);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
case TE_SUPERBULLET: case TE_SUPERBULLET:
@ -1279,16 +1279,16 @@ void CL_ParseTEnt (void)
P_RunParticleEffect (pos, vec3_origin, 0, 20); P_RunParticleEffect (pos, vec3_origin, 0, 20);
if ( rand() % 5 ) if ( rand() % 5 )
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_tink1, pos, 1, 1, 0, 0, 0);
else else
{ {
rnd = rand() & 3; rnd = rand() & 3;
if (rnd == 1) if (rnd == 1)
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric1, pos, 1, 1, 0, 0, 0);
else if (rnd == 2) else if (rnd == 2)
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric2, pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_ric3, pos, 1, 1, 0, 0, 0);
} }
break; break;
#endif #endif
@ -1323,7 +1323,7 @@ void CL_ParseTEnt (void)
// sound // sound
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
// sprite // sprite
if (cl_expsprite.ival) // temp hopefully if (cl_expsprite.ival) // temp hopefully
@ -1364,7 +1364,7 @@ void CL_ParseTEnt (void)
// sound // sound
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
// sprite // sprite
if (type == TE_EXPLOSION && cl_expsprite.ival) // temp hopefully if (type == TE_EXPLOSION && cl_expsprite.ival) // temp hopefully
@ -1394,7 +1394,7 @@ void CL_ParseTEnt (void)
dl->die = cl.time + 0.5; dl->die = cl.time + 0.5;
dl->decay = 300; dl->decay = 300;
} }
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
} }
break; break;
@ -1425,7 +1425,7 @@ void CL_ParseTEnt (void)
dl->channelfade[2] = 0; dl->channelfade[2] = 0;
} }
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
break; break;
case TEDP_TEI_BIGEXPLOSION: case TEDP_TEI_BIGEXPLOSION:
@ -1456,7 +1456,7 @@ void CL_ParseTEnt (void)
dl->channelfade[2] = 0; dl->channelfade[2] = 0;
} }
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
break; break;
case TE_TAREXPLOSION: // tarbaby explosion case TE_TAREXPLOSION: // tarbaby explosion
@ -1465,7 +1465,7 @@ void CL_ParseTEnt (void)
pos[2] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord ();
P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion); P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion);
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
break; break;
case TE_LIGHTNING1: // lightning bolts case TE_LIGHTNING1: // lightning bolts
@ -2436,7 +2436,7 @@ static struct{
#define ATTN_STATIC 1 #define ATTN_STATIC 1
void Q2S_StartSound(vec3_t origin, int entnum, int entchannel, sfx_t *sfx, float fvol, float attenuation, float delay) void Q2S_StartSound(vec3_t origin, int entnum, int entchannel, sfx_t *sfx, float fvol, float attenuation, float delay)
{ {
S_StartSound(entnum, entchannel, sfx, origin, fvol, attenuation, -delay, 0); S_StartSound(entnum, entchannel, sfx, origin, fvol, attenuation, -delay, 0, 0);
} }
void CLQ2_ParseTEnt (void) void CLQ2_ParseTEnt (void)
{ {
@ -2629,7 +2629,7 @@ fixme:
else else
P_RunParticleEffect (pos, dir, 0xb0, 40); P_RunParticleEffect (pos, dir, 0xb0, 40);
//FIXME : replace or remove this sound //FIXME : replace or remove this sound
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0, 0);
break; break;
case Q2TE_SHOTGUN: // bullet hitting wall case Q2TE_SHOTGUN: // bullet hitting wall
@ -2705,7 +2705,7 @@ fixme:
ex->angles[1] = 0; ex->angles[1] = 0;
ex->angles[0]*=-1; ex->angles[0]*=-1;
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0, 0);
// light // light
if (r_explosionlight.value) if (r_explosionlight.value)
@ -2763,9 +2763,9 @@ fixme:
// sound // sound
if (type == Q2TE_GRENADE_EXPLOSION_WATER) if (type == Q2TE_GRENADE_EXPLOSION_WATER)
S_StartSound (-2, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, S_PrecacheSound ("weapons/grenlx1a.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/grenlx1a.wav"), pos, 1, 1, 0, 0, 0);
// sprite // sprite
@ -2858,9 +2858,9 @@ fixme:
// sound // sound
if (type == Q2TE_ROCKET_EXPLOSION_WATER) if (type == Q2TE_ROCKET_EXPLOSION_WATER)
S_StartSound (-2, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0, 0, 0);
else else
S_StartSound (-2, 0, S_PrecacheSound ("weapons/rocklx1a.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/rocklx1a.wav"), pos, 1, 1, 0, 0, 0);
// sprite // sprite
// if (!R_ParticleExplosionHeart(pos)) // if (!R_ParticleExplosionHeart(pos))
@ -3032,7 +3032,7 @@ fixme:
ex->angles[1] = 0; ex->angles[1] = 0;
ex->angles[0]*=-1; ex->angles[0]*=-1;
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0, 0);
// light // light
if (r_explosionlight.value) if (r_explosionlight.value)
@ -3081,7 +3081,7 @@ fixme:
ex->angles[1] = 0; ex->angles[1] = 0;
ex->angles[0]*=-1; ex->angles[0]*=-1;
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0); S_StartSound (0, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0, 0, 0);
// light // light
if (r_explosionlight.value) if (r_explosionlight.value)

View file

@ -1294,7 +1294,7 @@ qboolean CSQC_MouseMove(float xdelta, float ydelta, int devid);
qboolean CSQC_MousePosition(float xabs, float yabs, int devid); qboolean CSQC_MousePosition(float xabs, float yabs, int devid);
qboolean CSQC_JoystickAxis(int axis, float value, int devid); qboolean CSQC_JoystickAxis(int axis, float value, int devid);
qboolean CSQC_Accelerometer(float x, float y, float z); qboolean CSQC_Accelerometer(float x, float y, float z);
int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation, float pitchmod, float timeofs); int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation, float pitchmod, float timeofs, unsigned int flags);
void CSQC_ParseEntities(void); void CSQC_ParseEntities(void);
void CSQC_ResetTrails(void); void CSQC_ResetTrails(void);

View file

@ -1862,13 +1862,15 @@ void Key_Bind_f (void)
} }
if (bindmap) if (bindmap)
{ {
if (bindmap < 0 || bindmap > KEY_MODIFIER_ALTBINDMAP) if (bindmap <= 0 || bindmap > KEY_MODIFIER_ALTBINDMAP)
{ {
if (cl_warncmd.ival)
Con_Printf ("unsupported bindmap %i\n", bindmap); Con_Printf ("unsupported bindmap %i\n", bindmap);
return; return;
} }
if (modifier != ~0) if (modifier != ~0)
{ {
if (cl_warncmd.ival)
Con_Printf ("modifiers cannot be combined with bindmaps\n"); Con_Printf ("modifiers cannot be combined with bindmaps\n");
return; return;
} }
@ -1997,10 +1999,10 @@ void Key_WriteBindings (vfsfile_t *f)
{ {
s = Key_KeynumToString(i, m); s = Key_KeynumToString(i, m);
//quote it as required //quote it as required
if (i == ';' || i <= ' ' || i == '\"') if (i == ';' || i <= ' ' || strchr(s, ' ') || strchr(s, '+') || strchr(s, '\"'))
s = COM_QuotedString(s, keybuf, sizeof(keybuf), false); s = COM_QuotedString(s, keybuf, sizeof(keybuf), false);
if (bindcmdlevel[i][m] != bindcmdlevel[i][0]) if (bindcmdlevel[i][m] != RESTRICT_LOCAL)
s = va("bindlevel %s %i %s\n", s, bindcmdlevel[i][m], COM_QuotedString(binding, commandbuf, sizeof(commandbuf), false)); s = va("bindlevel %s %i %s\n", s, bindcmdlevel[i][m], COM_QuotedString(binding, commandbuf, sizeof(commandbuf), false));
else else
s = va("bind %s %s\n", s, COM_QuotedString(binding, commandbuf, sizeof(commandbuf), false)); s = va("bind %s %s\n", s, COM_QuotedString(binding, commandbuf, sizeof(commandbuf), false));
@ -2043,7 +2045,7 @@ void Key_Init (void)
key_linepos = 1; key_linepos = 1;
key_dest_mask = kdm_game; key_dest_mask = kdm_game;
key_dest_absolutemouse = kdm_console | kdm_editor | kdm_cwindows; key_dest_absolutemouse = kdm_console | kdm_editor | kdm_cwindows | kdm_emenu;
// //
// init ascii characters in console mode // init ascii characters in console mode

View file

@ -748,7 +748,17 @@ void M_Media_Draw (menu_t *menu)
{ {
float time, duration; float time, duration;
if (S_GetMusicInfo(0, &time, &duration)) if (S_GetMusicInfo(0, &time, &duration))
MP_Hightlight (12, y, va("<< %i:%02i / %i:%02i - %i%% >>", (int)time/60, (int)time%60, (int)duration/60, (int)duration%60, (int)(100*time/duration)), op == selectedoption); {
int itime = time;
int iduration = duration;
if (iduration)
{
int pct = (int)((100*time)/duration);
MP_Hightlight (12, y, va("<< %i:%02i / %i:%02i - %i%% >>", itime/60, itime%60, iduration/60, iduration%60, pct), op == selectedoption);
}
else
MP_Hightlight (12, y, va("<< %i:%02i >>", itime/60, itime%60), op == selectedoption);
}
else else
MP_Hightlight (12, y, "<< skip >>", op == selectedoption); MP_Hightlight (12, y, "<< skip >>", op == selectedoption);
} }

View file

@ -355,7 +355,7 @@ void M_Audio_StartSound (struct menu_s *menu)
org[0] = mat[0][0] + 2*(mat[1][0]*(info->testsoundsource->common.posx-320/2) + mat[1][0]*(info->testsoundsource->common.posy-200/2)); org[0] = mat[0][0] + 2*(mat[1][0]*(info->testsoundsource->common.posx-320/2) + mat[1][0]*(info->testsoundsource->common.posy-200/2));
org[1] = mat[0][1] + 2*(mat[1][1]*(info->testsoundsource->common.posx-320/2) + mat[1][1]*(info->testsoundsource->common.posy-200/2)); org[1] = mat[0][1] + 2*(mat[1][1]*(info->testsoundsource->common.posx-320/2) + mat[1][1]*(info->testsoundsource->common.posy-200/2));
org[2] = mat[0][2] + 2*(mat[1][2]*(info->testsoundsource->common.posx-320/2) + mat[1][2]*(info->testsoundsource->common.posy-200/2)); org[2] = mat[0][2] + 2*(mat[1][2]*(info->testsoundsource->common.posx-320/2) + mat[1][2]*(info->testsoundsource->common.posy-200/2));
S_StartSound(-2, 0, S_PrecacheSound("player/pain3.wav"), org, 1, 4, 0, 0); S_StartSound(-2, 0, S_PrecacheSound("player/pain3.wav"), org, 1, 4, 0, 0, 0);
} }
} }

View file

@ -340,7 +340,7 @@ void M_ToggleMenu_f (void)
} }
#endif #endif
#ifdef MENU_DAT #ifdef MENU_DAT
if (MP_Toggle()) if (MP_Toggle(1))
{ {
Key_Dest_Remove(kdm_console|kdm_cwindows); Key_Dest_Remove(kdm_console|kdm_cwindows);
return; return;

View file

@ -463,7 +463,7 @@ int M_FindKeysForBind (int bindmap, const char *command, int *keylist, int *keym
void MP_CvarChanged(cvar_t *var); void MP_CvarChanged(cvar_t *var);
qboolean MP_Init (void); qboolean MP_Init (void);
void MP_Shutdown (void); void MP_Shutdown (void);
qboolean MP_Toggle(void); qboolean MP_Toggle(int mode);
void MP_Draw(void); void MP_Draw(void);
void MP_RegisterCvarsAndCmds(void); void MP_RegisterCvarsAndCmds(void);
void MP_Keydown(int key, int unicode); void MP_Keydown(int key, int unicode);

View file

@ -3684,7 +3684,7 @@ static void PScript_EffectSpawned(part_type_t *ptype, vec3_t org, vec3_t axis[3]
if (w <= tw) if (w <= tw)
{ {
if (*ptype->sounds[i].name && ptype->sounds[i].vol > 0) if (*ptype->sounds[i].name && ptype->sounds[i].vol > 0)
S_StartSound(0, 0, S_PrecacheSound(ptype->sounds[i].name), org, ptype->sounds[i].vol, ptype->sounds[i].atten, -ptype->sounds[i].delay, ptype->sounds[i].pitch); S_StartSound(0, 0, S_PrecacheSound(ptype->sounds[i].name), org, ptype->sounds[i].vol, ptype->sounds[i].atten, -ptype->sounds[i].delay, ptype->sounds[i].pitch, 0);
break; break;
} }
} }

View file

@ -3259,12 +3259,12 @@ void QCBUILTIN PF_soundupdate (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
float volume = G_FLOAT(OFS_PARM3); float volume = G_FLOAT(OFS_PARM3);
float attenuation = G_FLOAT(OFS_PARM4); float attenuation = G_FLOAT(OFS_PARM4);
float pitchpct = (prinst->callargc >= 6)?G_FLOAT(OFS_PARM5):0; float pitchpct = (prinst->callargc >= 6)?G_FLOAT(OFS_PARM5):0;
// unsigned int flags = (prinst->callargc>=7)?G_FLOAT(OFS_PARM6):0; unsigned int flags = (prinst->callargc>=7)?G_FLOAT(OFS_PARM6):0;
float startoffset = (prinst->callargc>=8)?G_FLOAT(OFS_PARM7):0; float startoffset = (prinst->callargc>=8)?G_FLOAT(OFS_PARM7):0;
sfx_t *sfx = S_PrecacheSound(sample); sfx_t *sfx = S_PrecacheSound(sample);
G_FLOAT(OFS_RETURN) = S_UpdateSound(-entity->entnum, channel, sfx, entity->v->origin, volume, attenuation, startoffset, pitchpct); G_FLOAT(OFS_RETURN) = S_UpdateSound(-entity->entnum, channel, sfx, entity->v->origin, volume, attenuation, startoffset, pitchpct, flags);
} }
void QCBUILTIN PF_stopsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) void QCBUILTIN PF_stopsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
@ -3288,7 +3288,7 @@ static void QCBUILTIN PF_cs_sound(pubprogfuncs_t *prinst, struct globalvars_s *p
float volume; float volume;
float attenuation; float attenuation;
float pitchpct; float pitchpct;
// unsigned int flags; unsigned int flags;
float startoffset; float startoffset;
sfx_t *sfx; sfx_t *sfx;
@ -3299,12 +3299,12 @@ static void QCBUILTIN PF_cs_sound(pubprogfuncs_t *prinst, struct globalvars_s *p
volume = G_FLOAT(OFS_PARM3); volume = G_FLOAT(OFS_PARM3);
attenuation = G_FLOAT(OFS_PARM4); attenuation = G_FLOAT(OFS_PARM4);
pitchpct = (prinst->callargc>=6)?G_FLOAT(OFS_PARM5):0; pitchpct = (prinst->callargc>=6)?G_FLOAT(OFS_PARM5):0;
// flags = (prinst->callargc>=7)?G_FLOAT(OFS_PARM6):0; flags = (prinst->callargc>=7)?G_FLOAT(OFS_PARM6):0;
startoffset = (prinst->callargc>=8)?G_FLOAT(OFS_PARM7):0; startoffset = (prinst->callargc>=8)?G_FLOAT(OFS_PARM7):0;
sfx = S_PrecacheSound(sample); sfx = S_PrecacheSound(sample);
if (sfx) if (sfx)
S_StartSound(-entity->entnum, channel, sfx, entity->v->origin, volume, attenuation, startoffset, pitchpct); S_StartSound(-entity->entnum, channel, sfx, entity->v->origin, volume, attenuation, startoffset, pitchpct, flags);
}; };
static void QCBUILTIN PF_cs_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cs_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -3328,7 +3328,7 @@ static void QCBUILTIN PF_cs_pointsound(pubprogfuncs_t *prinst, struct globalvars
sfx = S_PrecacheSound(sample); sfx = S_PrecacheSound(sample);
if (sfx) if (sfx)
S_StartSound(0, 0, sfx, origin, volume, attenuation, 0, pitchpct); S_StartSound(0, 0, sfx, origin, volume, attenuation, 0, pitchpct, 0);
} }
static void QCBUILTIN PF_cs_particle(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cs_particle(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -3610,14 +3610,14 @@ static void QCBUILTIN PF_cl_te_explosion (pubprogfuncs_t *prinst, struct globalv
Surf_AddStain(pos, -1, -1, -1, 100); Surf_AddStain(pos, -1, -1, -1, 100);
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
} }
static void QCBUILTIN PF_cl_te_tarexplosion (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cl_te_tarexplosion (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
float *pos = G_VECTOR(OFS_PARM0); float *pos = G_VECTOR(OFS_PARM0);
P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion); P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion);
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
} }
static void QCBUILTIN PF_cl_te_wizspike (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cl_te_wizspike (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
@ -3625,7 +3625,7 @@ static void QCBUILTIN PF_cl_te_wizspike (pubprogfuncs_t *prinst, struct globalva
if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike)) if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike))
P_RunParticleEffect (pos, vec3_origin, 20, 30); P_RunParticleEffect (pos, vec3_origin, 20, 30);
S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0, 0);
} }
static void QCBUILTIN PF_cl_te_knightspike (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cl_te_knightspike (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
@ -3633,7 +3633,7 @@ static void QCBUILTIN PF_cl_te_knightspike (pubprogfuncs_t *prinst, struct globa
if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike)) if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike))
P_RunParticleEffect (pos, vec3_origin, 226, 20); P_RunParticleEffect (pos, vec3_origin, 226, 20);
S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_knighthit, pos, 1, 1, 0, 0, 0);
} }
static void QCBUILTIN PF_cl_te_lavasplash (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cl_te_lavasplash (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
@ -3696,7 +3696,7 @@ static void QCBUILTIN PF_cl_te_explosionquad (pubprogfuncs_t *prinst, struct glo
dl->channelfade[2] = 0.12; dl->channelfade[2] = 0.12;
} }
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0, 0);
} }
//void(vector org, float radius, float lifetime, vector color) te_customflash //void(vector org, float radius, float lifetime, vector color) te_customflash
@ -3807,7 +3807,7 @@ static void QCBUILTIN PF_cl_te_explosionrgb (pubprogfuncs_t *prinst, struct glob
dl->channelfade[2] = 0; dl->channelfade[2] = 0;
} }
S_StartSound (-2, 0, cl_sfx_r_exp3, org, 1, 1, 0, 0); S_StartSound (0, 0, cl_sfx_r_exp3, org, 1, 1, 0, 0, 0);
} }
static void QCBUILTIN PF_cl_te_particlerain (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_cl_te_particlerain (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
@ -5709,7 +5709,7 @@ void CSQC_Event_Sound (float *origin, wedict_t *wentity, int channel, const char
origin = wentity->v->origin; origin = wentity->v->origin;
} }
S_StartSound(NUM_FOR_EDICT(csqcprogs, (edict_t*)wentity), channel, S_PrecacheSound(sample), origin, volume, attenuation, timeoffset, pitchadj); S_StartSound(NUM_FOR_EDICT(csqcprogs, (edict_t*)wentity), channel, S_PrecacheSound(sample), origin, volume, attenuation, timeoffset, pitchadj, 0);
} }
qboolean CSQC_Event_ContentsTransition(world_t *w, wedict_t *ent, int oldwatertype, int newwatertype) qboolean CSQC_Event_ContentsTransition(world_t *w, wedict_t *ent, int oldwatertype, int newwatertype)
@ -7048,7 +7048,7 @@ static void CSQC_EntityCheck(unsigned int entnum)
} }
} }
int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation, float pitchmod, float timeofs) int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation, float pitchmod, float timeofs, unsigned int flags)
{ {
void *pr_globals; void *pr_globals;
csqcedict_t *ent; csqcedict_t *ent;
@ -7073,7 +7073,7 @@ int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float
G_FLOAT(OFS_PARM4) = attenuation; G_FLOAT(OFS_PARM4) = attenuation;
VectorCopy(pos, G_VECTOR(OFS_PARM5)); VectorCopy(pos, G_VECTOR(OFS_PARM5));
G_FLOAT(OFS_PARM6) = pitchmod; G_FLOAT(OFS_PARM6) = pitchmod;
G_FLOAT(OFS_PARM7) = 0/*flags*/; G_FLOAT(OFS_PARM7) = flags;
// G_FLOAT(OFS_PARM8) = timeofs; // G_FLOAT(OFS_PARM8) = timeofs;
PR_ExecuteProgram(csqcprogs, csqcg.event_sound); PR_ExecuteProgram(csqcprogs, csqcg.event_sound);
@ -7095,7 +7095,7 @@ int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float
VectorCopy(pos, G_VECTOR(OFS_PARM2)); VectorCopy(pos, G_VECTOR(OFS_PARM2));
G_FLOAT(OFS_PARM3) = vol; G_FLOAT(OFS_PARM3) = vol;
G_FLOAT(OFS_PARM4) = attenuation; G_FLOAT(OFS_PARM4) = attenuation;
G_FLOAT(OFS_PARM5) = 0/*flags*/; G_FLOAT(OFS_PARM5) = flags;
G_FLOAT(OFS_PARM6) = timeofs; G_FLOAT(OFS_PARM6) = timeofs;
PR_ExecuteProgram(csqcprogs, csqcg.serversound); PR_ExecuteProgram(csqcprogs, csqcg.serversound);

View file

@ -2322,6 +2322,8 @@ pbool PDECL Menu_CheckHeaderCrc(pubprogfuncs_t *inst, progsnum_t idx, int crc)
double menutime; double menutime;
qboolean MP_Init (void) qboolean MP_Init (void)
{ {
struct key_cursor_s *m = &key_customcursor[kc_menu];
if (qrenderer == QR_NONE) if (qrenderer == QR_NONE)
{ {
return false; return false;
@ -2375,8 +2377,13 @@ qboolean MP_Init (void)
menuprogparms.user = &menu_world; menuprogparms.user = &menu_world;
menu_world.keydestmask = kdm_gmenu; menu_world.keydestmask = kdm_gmenu;
//default to free mouse, to match dp's default setting, and because its generally the right thing for a menu. //default to free mouse+hidden cursor, to match dp's default setting, and because its generally the right thing for a menu.
key_dest_absolutemouse |= kdm_gmenu; key_dest_absolutemouse |= kdm_gmenu;
Q_strncpyz(m->name, "none", sizeof(m->name));
m->hotspot[0] = 0;
m->hotspot[1] = 0;
m->scale = 1;
m->dirty = true;
menutime = Sys_DoubleTime(); menutime = Sys_DoubleTime();
if (!menu_world.progs) if (!menu_world.progs)
@ -2624,7 +2631,7 @@ void MP_Keyup(int key, int unicode)
inmenuprogs--; inmenuprogs--;
} }
qboolean MP_Toggle(void) qboolean MP_Toggle(int mode)
{ {
if (!menu_world.progs) if (!menu_world.progs)
return false; return false;
@ -2633,6 +2640,9 @@ qboolean MP_Toggle(void)
return false; return false;
#endif #endif
if (!mode && !Key_Dest_Has(kdm_gmenu))
return false;
if (setjmp(mp_abort)) if (setjmp(mp_abort))
return false; return false;
@ -2644,7 +2654,7 @@ qboolean MP_Toggle(void)
if (mp_toggle_function) if (mp_toggle_function)
{ {
void *pr_globals = PR_globals(menu_world.progs, PR_CURRENT); void *pr_globals = PR_globals(menu_world.progs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = 1; G_FLOAT(OFS_PARM0) = mode;
PR_ExecuteProgram(menu_world.progs, mp_toggle_function); PR_ExecuteProgram(menu_world.progs, mp_toggle_function);
} }
inmenuprogs--; inmenuprogs--;

View file

@ -2260,20 +2260,18 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
vec_t scale; vec_t scale;
vec3_t world_vec; vec3_t world_vec;
int i, v; int i, v;
float volscale;
// anything coming from the view entity will always be full volume //sounds with absvolume ignore all volume etc cvars+settings
if (ch->flags & CF_ABSVOLUME) if (ch->flags & CF_ABSVOLUME)
volscale = 1;
else
volscale = volume.value * voicevolumemod;
// anything coming from the view entity will always be full volume
if (ch->entnum == listener[sc->seat].entnum)
{ {
v = ch->master_vol; v = ch->master_vol * (ruleset_allow_localvolume.value ? snd_playersoundvolume.value : 1) * volscale;
for (i = 0; i < sc->sn.numchannels; i++)
{
ch->vol[i] = v;
}
return;
}
if (ch->entnum == -1 || ch->entnum == cl.playerview[0].playernum+1)
{
v = ch->master_vol * (ruleset_allow_localvolume.value ? snd_playersoundvolume.value : 1) * volume.value * voicevolumemod;
v = bound(0, v, 255); v = bound(0, v, 255);
for (i = 0; i < sc->sn.numchannels; i++) for (i = 0; i < sc->sn.numchannels; i++)
{ {
@ -2287,6 +2285,16 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
dist = VectorNormalize(world_vec) * ch->dist_mult; dist = VectorNormalize(world_vec) * ch->dist_mult;
if (ch->flags & CF_NOSPACIALISE)
{
scale = 1;
scale = (1.0 - dist) * scale;
v = ch->master_vol * scale * volscale;
for (i = 0; i < sc->sn.numchannels; i++)
ch->vol[i] = bound(0, v, 255);
return;
}
//rotate the world_vec into listener space, so that the audio direction stored in the speakerdir array can be used directly. //rotate the world_vec into listener space, so that the audio direction stored in the speakerdir array can be used directly.
listener_vec[0] = DotProduct(listener[sc->seat].forward, world_vec); listener_vec[0] = DotProduct(listener[sc->seat].forward, world_vec);
listener_vec[1] = DotProduct(listener[sc->seat].right, world_vec); listener_vec[1] = DotProduct(listener[sc->seat].right, world_vec);
@ -2299,7 +2307,7 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
{ {
scale = 1 + DotProduct(listener_vec, sc->speakerdir[i]); scale = 1 + DotProduct(listener_vec, sc->speakerdir[i]);
scale = (1.0 - dist) * scale * sc->dist[i]; scale = (1.0 - dist) * scale * sc->dist[i];
v = ch->master_vol * scale * volume.value * voicevolumemod; v = ch->master_vol * scale * volscale;
ch->vol[i] = bound(0, v, 255); ch->vol[i] = bound(0, v, 255);
} }
} }
@ -2307,14 +2315,12 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
// ======================================================================= // =======================================================================
// Start a sound effect // Start a sound effect
// ======================================================================= // =======================================================================
static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_t *target_chan, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeoffset, float pitchadj) static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_t *target_chan, int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeoffset, float pitchadj, unsigned int flags)
{ {
channel_t *check; channel_t *check;
int vol; int vol;
int ch_idx; int ch_idx;
int skip; int skip;
int entnum = target_chan->entnum;
int entchannel = target_chan->entchannel;
int absstartpos = updateonly?target_chan->pos:0; int absstartpos = updateonly?target_chan->pos:0;
if (fvol < 0) if (fvol < 0)
@ -2343,7 +2349,7 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_
{ {
VectorCopy(origin, target_chan->origin); VectorCopy(origin, target_chan->origin);
} }
target_chan->flags = 0; target_chan->flags = flags;
target_chan->dist_mult = attenuation / sound_nominal_clip_dist; target_chan->dist_mult = attenuation / sound_nominal_clip_dist;
target_chan->master_vol = vol; target_chan->master_vol = vol;
target_chan->entnum = entnum; target_chan->entnum = entnum;
@ -2394,7 +2400,7 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_
sc->ChannelUpdate(sc, target_chan, true); sc->ChannelUpdate(sc, target_chan, true);
} }
float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj) float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj, unsigned int flags)
{ {
int i; int i;
int result = 0; int result = 0;
@ -2411,7 +2417,7 @@ float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float
{ {
if (sc->channel[i].entnum == entnum && sc->channel[i].entchannel == entchannel && sc->channel[i].sfx) if (sc->channel[i].entnum == entnum && sc->channel[i].entchannel == entchannel && sc->channel[i].sfx)
{ {
S_UpdateSoundCard(sc, true, &sc->channel[i], sfx, origin, fvol, attenuation, timeofs, pitchadj); S_UpdateSoundCard(sc, true, &sc->channel[i], entnum, entchannel, sfx, origin, fvol, attenuation, timeofs, pitchadj, flags);
result++; result++;
break; break;
} }
@ -2423,7 +2429,7 @@ float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float
return result / (float)cards; return result / (float)cards;
} }
void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj) void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj, unsigned int flags)
{ {
soundcardinfo_t *sc; soundcardinfo_t *sc;
channel_t *target_chan; channel_t *target_chan;
@ -2448,7 +2454,7 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
if (!target_chan) if (!target_chan)
return; return;
S_UpdateSoundCard(sc, false, target_chan, sfx, origin, fvol, attenuation, timeofs, pitchadj); S_UpdateSoundCard(sc, false, target_chan, entnum, entchannel, sfx, origin, fvol, attenuation, timeofs, pitchadj, flags);
} }
S_UnlockMixer(); S_UnlockMixer();
} }
@ -2457,7 +2463,6 @@ qboolean S_GetMusicInfo(int musicchannel, float *time, float *duration)
{ {
qboolean result = false; qboolean result = false;
soundcardinfo_t *sc; soundcardinfo_t *sc;
sfxcache_t scachebuf, *c;
sfx_t *sfx; sfx_t *sfx;
*time = 0; *time = 0;
*duration = 0; *duration = 0;
@ -2470,26 +2475,20 @@ qboolean S_GetMusicInfo(int musicchannel, float *time, float *duration)
sfx = sc->channel[musicchannel].sfx; sfx = sc->channel[musicchannel].sfx;
if (sfx) if (sfx)
{ {
if (sfx->loadstate != SLS_LOADED) if (sfx->loadstate == SLS_LOADED && sfx->decoder.querydata)
c = NULL; *duration = sfx->decoder.querydata(sfx, NULL);
else if (sfx->decoder.decodedata) else if (sfx->decoder.buf)
{ {
if (sfx->decoder.querydata) sfxcache_t *c = sfx->decoder.buf;
c = sfx->decoder.querydata(sfx, &scachebuf); *duration = (float)c->length / c->speed;
else
c = NULL; //don't bother trying to actually decode anything here.
} }
else else
c = sfx->decoder.buf; *duration = 0;
if (c)
{
*duration = c->length / c->speed;
*time = (sc->channel[musicchannel].pos>>PITCHSHIFT) / (float)snd_speed; //the time into the sound, ignoring play rate. *time = (sc->channel[musicchannel].pos>>PITCHSHIFT) / (float)snd_speed; //the time into the sound, ignoring play rate.
result = true; result = true;
} }
} }
}
S_UnlockMixer(); S_UnlockMixer();
return result; return result;
@ -2667,7 +2666,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
ss = &scard->channel[scard->total_chans]; ss = &scard->channel[scard->total_chans];
scard->total_chans++; scard->total_chans++;
ss->entnum = -2; ss->entnum = 0;
ss->sfx = sfx; ss->sfx = sfx;
ss->rate = 1<<PITCHSHIFT; ss->rate = 1<<PITCHSHIFT;
VectorCopy (origin, ss->origin); VectorCopy (origin, ss->origin);
@ -2844,7 +2843,7 @@ void S_UpdateAmbientSounds (soundcardinfo_t *sc)
chan = &sc->channel[AMBIENT_FIRST+ambient_channel]; chan = &sc->channel[AMBIENT_FIRST+ambient_channel];
chan->sfx = ambient_sfx[AMBIENT_FIRST+ambient_channel]; chan->sfx = ambient_sfx[AMBIENT_FIRST+ambient_channel];
chan->entnum = -1; chan->entnum = -1;
chan->flags = CF_FORCELOOP; chan->flags = CF_FORCELOOP | CF_NOSPACIALISE;
chan->rate = 1<<PITCHSHIFT; chan->rate = 1<<PITCHSHIFT;
VectorCopy(listener[sc->seat].origin, chan->origin); VectorCopy(listener[sc->seat].origin, chan->origin);
@ -3185,7 +3184,7 @@ void S_Play(void)
else else
Q_strncpyz(name, Cmd_Argv(i), sizeof(name)); Q_strncpyz(name, Cmd_Argv(i), sizeof(name));
sfx = S_PrecacheSound(name); sfx = S_PrecacheSound(name);
S_StartSound(cl.playerview[0].playernum+1, -1, sfx, vec3_origin, 1.0, 0.0, 0, 0); S_StartSound(listener[0].entnum, -1, sfx, vec3_origin, 1.0, 0.0, 0, 0, CF_NOSPACIALISE);
i++; i++;
} }
} }
@ -3209,7 +3208,7 @@ void S_PlayVol(void)
Q_strncpy(name, Cmd_Argv(i), sizeof(name)); Q_strncpy(name, Cmd_Argv(i), sizeof(name));
sfx = S_PrecacheSound(name); sfx = S_PrecacheSound(name);
vol = Q_atof(Cmd_Argv(i+1)); vol = Q_atof(Cmd_Argv(i+1));
S_StartSound(cl.playerview[0].playernum+1, -1, sfx, vec3_origin, vol, 0.0, 0, 0); S_StartSound(listener[0].entnum, -1, sfx, vec3_origin, vol, 0.0, 0, 0, CF_NOSPACIALISE);
i+=2; i+=2;
} }
} }
@ -3234,7 +3233,7 @@ void S_SoundList_f(void)
else if (sfx->decoder.decodedata) else if (sfx->decoder.decodedata)
{ {
if (sfx->decoder.querydata) if (sfx->decoder.querydata)
sc = sfx->decoder.querydata(sfx, &scachebuf); sc = (sfx->decoder.querydata(sfx, &scachebuf) < 0)?NULL:&scachebuf;
else else
sc = NULL; //don't bother trying to actually decode anything here. sc = NULL; //don't bother trying to actually decode anything here.
if (!sc) if (!sc)
@ -3280,7 +3279,7 @@ void S_LocalSound (const char *sound)
Con_Printf ("S_LocalSound: can't cache %s\n", sound); Con_Printf ("S_LocalSound: can't cache %s\n", sound);
return; return;
} }
S_StartSound (-1, -1, sfx, vec3_origin, 1, 1, 0, 0); S_StartSound (0, -1, sfx, vec3_origin, 1, 1, 0, 0, CF_NOSPACIALISE);
} }
@ -3487,7 +3486,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
channel_t *c = SND_PickChannel(si, -1, 0); channel_t *c = SND_PickChannel(si, -1, 0);
if (c) if (c)
{ {
c->flags = CF_ABSVOLUME; c->flags = CF_ABSVOLUME|CF_NOSPACIALISE;
c->entnum = -1; c->entnum = -1;
c->entchannel = 0; c->entchannel = 0;
c->dist_mult = 0; c->dist_mult = 0;

View file

@ -20,6 +20,7 @@
#define p_ov_info ov_info #define p_ov_info ov_info
#define p_ov_comment ov_comment #define p_ov_comment ov_comment
#define p_ov_pcm_total ov_pcm_total #define p_ov_pcm_total ov_pcm_total
#define p_ov_time_total ov_time_total
#define p_ov_read ov_read #define p_ov_read ov_read
#define p_ov_pcm_seek ov_pcm_seek #define p_ov_pcm_seek ov_pcm_seek
#else #else
@ -38,6 +39,7 @@
#define p_ov_info ov_info #define p_ov_info ov_info
#define p_ov_comment ov_comment #define p_ov_comment ov_comment
#define p_ov_pcm_total ov_pcm_total #define p_ov_pcm_total ov_pcm_total
#define p_ov_time_total ov_time_total
#define p_ov_read ov_read #define p_ov_read ov_read
#define p_ov_pcm_seek ov_pcm_seek #define p_ov_pcm_seek ov_pcm_seek
#else #else
@ -46,8 +48,8 @@
vorbis_info *(VARGS *p_ov_info)(OggVorbis_File *vf,int link); vorbis_info *(VARGS *p_ov_info)(OggVorbis_File *vf,int link);
vorbis_comment *(VARGS *p_ov_comment) (OggVorbis_File *vf,int link); vorbis_comment *(VARGS *p_ov_comment) (OggVorbis_File *vf,int link);
ogg_int64_t (VARGS *p_ov_pcm_total)(OggVorbis_File *vf,int i); ogg_int64_t (VARGS *p_ov_pcm_total)(OggVorbis_File *vf,int i);
long (VARGS *p_ov_read)(OggVorbis_File *vf,char *buffer,int length, double (VARGS *p_ov_time_total)(OggVorbis_File *vf,int i);
int bigendianp,int word,int sgned,int *bitstream); long (VARGS *p_ov_read)(OggVorbis_File *vf,char *buffer,int length,int bigendianp,int word,int sgned,int *bitstream);
int (VARGS *p_ov_pcm_seek)(OggVorbis_File *vf,ogg_int64_t pos); int (VARGS *p_ov_pcm_seek)(OggVorbis_File *vf,ogg_int64_t pos);
#endif #endif
#endif #endif
@ -75,7 +77,7 @@ typedef struct {
sfx_t *s; sfx_t *s;
} ovdecoderbuffer_t; } ovdecoderbuffer_t;
static sfxcache_t *OV_Query(struct sfx_s *sfx, struct sfxcache_s *buf); float OV_Query(struct sfx_s *sfx, struct sfxcache_s *buf);
static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length); static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length);
static void OV_CancelDecoder(sfx_t *s); static void OV_CancelDecoder(sfx_t *s);
static qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer); static qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer);
@ -119,11 +121,11 @@ qboolean S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
return true; return true;
} }
static sfxcache_t *OV_Query(struct sfx_s *sfx, struct sfxcache_s *buf) float OV_Query(struct sfx_s *sfx, struct sfxcache_s *buf)
{ {
ovdecoderbuffer_t *dec = sfx->decoder.buf; ovdecoderbuffer_t *dec = sfx->decoder.buf;
if (!dec) if (!dec)
buf = NULL; return -1;
if (buf) if (buf)
{ {
buf->data = NULL; //you're not meant to actually be using the data here buf->data = NULL; //you're not meant to actually be using the data here
@ -134,7 +136,7 @@ static sfxcache_t *OV_Query(struct sfx_s *sfx, struct sfxcache_s *buf)
buf->speed = dec->srcspeed; buf->speed = dec->srcspeed;
buf->width = 2; buf->width = 2;
} }
return buf; return p_ov_time_total(&dec->vf, -1);
} }
static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length) static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length)
@ -162,16 +164,16 @@ static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssam
//check pos //check pos
//fixme: seeking might not be supported //fixme: seeking might not be supported
p_ov_pcm_seek(&dec->vf, dec->decodedbytestart); p_ov_pcm_seek(&dec->vf, (dec->decodedbytestart * dec->srcspeed) / outspeed);
} }
/* if (start > dec->decodedbytestart + dec->decodedbytecount) /* if (start > dec->decodedbytestart + dec->decodedbytecount)
{ {
dec->decodedbytestart = start; dec->decodedbytestart = start;
p_ov_pcm_seek(&dec->vf, dec->decodedbytestart); p_ov_pcm_seek(&dec->vf, (dec->decodedbytestart * dec->srcspeed) / outspeed);
} }
*/ */
if (dec->decodedbytecount > snd_speed*8) if (dec->decodedbytecount > outspeed*8)
{ {
/*everything is okay, but our buffer is getting needlessly large. /*everything is okay, but our buffer is getting needlessly large.
keep anything after the 'new' position, but discard all before that keep anything after the 'new' position, but discard all before that
@ -205,7 +207,7 @@ static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssam
if (dec->decodedbufferbytes < start+length - dec->decodedbytestart + 128) //expand if needed. if (dec->decodedbufferbytes < start+length - dec->decodedbytestart + 128) //expand if needed.
{ {
// Con_Printf("Expand buffer\n"); // Con_Printf("Expand buffer\n");
dec->decodedbufferbytes = (start+length - dec->decodedbytestart) + snd_speed; dec->decodedbufferbytes = (start+length - dec->decodedbytestart) + outspeed;
dec->decodedbuffer = BZ_Realloc(dec->decodedbuffer, dec->decodedbufferbytes); dec->decodedbuffer = BZ_Realloc(dec->decodedbuffer, dec->decodedbufferbytes);
} }
@ -371,6 +373,7 @@ static qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdec
{(void*)&p_ov_open_callbacks, "ov_open_callbacks"}, {(void*)&p_ov_open_callbacks, "ov_open_callbacks"},
{(void*)&p_ov_comment, "ov_comment"}, {(void*)&p_ov_comment, "ov_comment"},
{(void*)&p_ov_pcm_total, "ov_pcm_total"}, {(void*)&p_ov_pcm_total, "ov_pcm_total"},
{(void*)&p_ov_time_total, "ov_time_total"},
{(void*)&p_ov_clear, "ov_clear"}, {(void*)&p_ov_clear, "ov_clear"},
{(void*)&p_ov_info, "ov_info"}, {(void*)&p_ov_info, "ov_info"},
{(void*)&p_ov_read, "ov_read"}, {(void*)&p_ov_read, "ov_read"},

View file

@ -37,7 +37,7 @@ typedef struct
typedef struct { typedef struct {
struct sfxcache_s *(*decodedata) (struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length); //return true when done. struct sfxcache_s *(*decodedata) (struct sfx_s *sfx, struct sfxcache_s *buf, ssamplepos_t start, int length); //return true when done.
struct sfxcache_s *(*querydata) (struct sfx_s *sfx, struct sfxcache_s *buf); //reports length + format info without actually decoding anything. float (*querydata) (struct sfx_s *sfx, struct sfxcache_s *buf); //reports length + original format info without actually decoding anything.
void (*ended) (struct sfx_s *sfx); //sound stopped playing and is now silent (allow rewinding or something). void (*ended) (struct sfx_s *sfx); //sound stopped playing and is now silent (allow rewinding or something).
void (*purge) (struct sfx_s *sfx); //sound is being purged from memory. destroy everything. void (*purge) (struct sfx_s *sfx); //sound is being purged from memory. destroy everything.
void *buf; void *buf;
@ -89,8 +89,12 @@ typedef struct
unsigned char *buffer; // pointer to mixed pcm buffer (not directly used by mixer) unsigned char *buffer; // pointer to mixed pcm buffer (not directly used by mixer)
} dma_t; } dma_t;
#define CF_ABSVOLUME 1 // ignores volume cvar. #define CF_RELIABLE 1 // serverside only. yeah, evil. screw you.
#define CF_FORCELOOP 2 // forces looping. set on static sounds. #define CF_FORCELOOP 2 // forces looping. set on static sounds.
#define CF_NOSPACIALISE 4 // these sounds are played at a fixed volume
//#define CF_PAUSED 8 // rate = 0. or something.
#define CF_ABSVOLUME 16 // ignores volume cvar.
typedef struct typedef struct
{ {
sfx_t *sfx; // sfx number sfx_t *sfx; // sfx number
@ -122,8 +126,8 @@ void S_Init (void);
void S_Startup (void); void S_Startup (void);
void S_Shutdown (qboolean final); void S_Shutdown (qboolean final);
float S_GetSoundTime(int entnum, int entchannel); float S_GetSoundTime(int entnum, int entchannel);
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj); void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj, unsigned int flags);
float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj); float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj, unsigned int flags);
void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
void S_StopSound (int entnum, int entchannel); void S_StopSound (int entnum, int entchannel);
void S_StopAllSounds(qboolean clear); void S_StopAllSounds(qboolean clear);

View file

@ -808,9 +808,11 @@ enum clcq2_ops_e
#define NQSND_VOLUME (1<<0) // a qbyte #define NQSND_VOLUME (1<<0) // a qbyte
#define NQSND_ATTENUATION (1<<1) // a qbyte #define NQSND_ATTENUATION (1<<1) // a qbyte
#define DPSND_LOOPING (1<<2) // a long, supposedly //#define DPSND_LOOPING (1<<2) // a long, supposedly
#define FTESND_FLAGS (1<<2) //
#define DPSND_LARGEENTITY (1<<3) #define DPSND_LARGEENTITY (1<<3)
#define DPSND_LARGESOUND (1<<4) #define DPSND_LARGESOUND (1<<4)
//#define DPSND_SPEEDUSHORT4000 (1<<5) // ushort speed*4000 (speed is usually 1.0, a value of 0.0 is the same as 1.0)
#define FTESND_TIMEOFS (1<<6) //signed short, in milliseconds. #define FTESND_TIMEOFS (1<<6) //signed short, in milliseconds.
#define FTESND_PITCHADJ (1<<7) //a byte (speed percent (0=100%)) #define FTESND_PITCHADJ (1<<7) //a byte (speed percent (0=100%))

View file

@ -171,7 +171,7 @@ struct world_s
{ {
void (*Event_Touch)(struct world_s *w, wedict_t *s, wedict_t *o); void (*Event_Touch)(struct world_s *w, wedict_t *s, wedict_t *o);
void (*Event_Think)(struct world_s *w, wedict_t *s); void (*Event_Think)(struct world_s *w, wedict_t *s);
void (*Event_Sound) (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeoffset); void (*Event_Sound) (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeoffset, unsigned int flags);
qboolean (*Event_ContentsTransition) (struct world_s *w, wedict_t *ent, int oldwatertype, int newwatertype); qboolean (*Event_ContentsTransition) (struct world_s *w, wedict_t *ent, int oldwatertype, int newwatertype);
model_t *(*Get_CModel)(struct world_s *w, int modelindex); model_t *(*Get_CModel)(struct world_s *w, int modelindex);
void (*Get_FrameState)(struct world_s *w, wedict_t *s, framestate_t *fstate); void (*Get_FrameState)(struct world_s *w, wedict_t *s, framestate_t *fstate);

View file

@ -5398,6 +5398,12 @@ static void Shader_ReadShader(shader_t *s, char *shadersource, int parsemode)
memset(&parsestate, 0, sizeof(parsestate)); memset(&parsestate, 0, sizeof(parsestate));
parsestate.mode = parsemode; parsestate.mode = parsemode;
if (!s->defaulttextures)
{
s->defaulttextures = Z_Malloc(sizeof(*s->defaulttextures));
s->numdefaulttextures = 0;
}
// set defaults // set defaults
s->flags = SHADER_CULL_FRONT; s->flags = SHADER_CULL_FRONT;
s->uses = 1; s->uses = 1;

View file

@ -1579,13 +1579,13 @@ static const char *glsl_hdrs[] =
"#endif\n" "#endif\n"
"}\n" "}\n"
"float ShadowmapFilter(sampler2DShadow samp)\n" "float ShadowmapFilter(sampler2DShadow smap)\n"
"{\n" "{\n"
"vec3 shadowcoord = ShadowmapCoord();\n" "vec3 shadowcoord = ShadowmapCoord();\n"
"#if 0\n"//def GL_ARB_texture_gather "#if 0\n"//def GL_ARB_texture_gather
"vec2 ipart, fpart;\n" "vec2 ipart, fpart;\n"
"#define dosamp(x,y) textureGatherOffset(s_t4, ipart.xy, vec2(x,y)))\n" "#define dosamp(x,y) textureGatherOffset(smap, ipart.xy, vec2(x,y)))\n"
"vec4 tl = step(shadowcoord.z, dosamp(-1.0, -1.0));\n" "vec4 tl = step(shadowcoord.z, dosamp(-1.0, -1.0));\n"
"vec4 bl = step(shadowcoord.z, dosamp(-1.0, 1.0));\n" "vec4 bl = step(shadowcoord.z, dosamp(-1.0, 1.0));\n"
"vec4 tr = step(shadowcoord.z, dosamp(1.0, -1.0));\n" "vec4 tr = step(shadowcoord.z, dosamp(1.0, -1.0));\n"
@ -1597,7 +1597,7 @@ static const char *glsl_hdrs[] =
"mix(vec4(tl.rg, tr.rg), vec4(bl.ba, br.ba), fpart.y);\n" //top+bottom rows "mix(vec4(tl.rg, tr.rg), vec4(bl.ba, br.ba), fpart.y);\n" //top+bottom rows
"return dot(mix(col.rgb, col.agb, fpart.x), vec3(1.0/9.0));\n" //blend r+a, gb are mixed because its pretty much free and gives a nicer dot instruction instead of lots of adds. "return dot(mix(col.rgb, col.agb, fpart.x), vec3(1.0/9.0));\n" //blend r+a, gb are mixed because its pretty much free and gives a nicer dot instruction instead of lots of adds.
"#else\n" "#else\n"
"#define dosamp(x,y) shadow2D(samp, shadowcoord.xyz + (vec3(x,y,0.0)*l_shadowmapscale.xyx)).r\n" "#define dosamp(x,y) shadow2D(smap, shadowcoord.xyz + (vec3(x,y,0.0)*l_shadowmapscale.xyx)).r\n"
"float s = 0.0;\n" "float s = 0.0;\n"
"#if r_glsl_pcf >= 1 && r_glsl_pcf < 5\n" "#if r_glsl_pcf >= 1 && r_glsl_pcf < 5\n"
"s += dosamp(0.0, 0.0);\n" "s += dosamp(0.0, 0.0);\n"

View file

@ -169,6 +169,9 @@ void INS_ReInit(void)
void INS_Shutdown(void) void INS_Shutdown(void)
{ {
} }
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
{
}
/* /*
//nacl supposedly has no way to implement this (other than us writing a listfile in each directory) //nacl supposedly has no way to implement this (other than us writing a listfile in each directory)

View file

@ -3032,7 +3032,7 @@ static void QCBUILTIN PF_sound (pubprogfuncs_t *prinst, struct globalvars_s *pr_
int volume; int volume;
float attenuation; float attenuation;
int pitchadj; int pitchadj;
int flags; unsigned int flags;
float timeofs; float timeofs;
entity = G_EDICT(prinst, OFS_PARM0); entity = G_EDICT(prinst, OFS_PARM0);
@ -3053,9 +3053,9 @@ static void QCBUILTIN PF_sound (pubprogfuncs_t *prinst, struct globalvars_s *pr_
else else
{ {
//QW uses channel&8 to mean reliable. //QW uses channel&8 to mean reliable.
flags = (channel & 8)?1:0; flags = (channel & 8)?CF_RELIABLE:0;
//demangle it so the upper bits are still useful. //demangle it so the upper bits are still useful.
channel = (channel & 7) | ((channel & 0x1f0) >> 1); channel = (channel & 7) | ((channel & ~15) >> 1);
} }
timeofs = (svprogfuncs->callargc>7)?G_FLOAT(OFS_PARM7):0; timeofs = (svprogfuncs->callargc>7)?G_FLOAT(OFS_PARM7):0;
@ -3065,11 +3065,7 @@ static void QCBUILTIN PF_sound (pubprogfuncs_t *prinst, struct globalvars_s *pr_
if (volume > 255) if (volume > 255)
volume = 255; volume = 255;
//should probably be an argument instead, but whatever. SVQ1_StartSound (NULL, (wedict_t*)entity, channel, sample, volume, attenuation, pitchadj, timeofs, flags);
if (flags & 1)
channel |= 256;
SVQ1_StartSound (NULL, (wedict_t*)entity, channel, sample, volume, attenuation, pitchadj, timeofs);
} }
static void QCBUILTIN PF_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -3089,7 +3085,7 @@ static void QCBUILTIN PF_pointsound(pubprogfuncs_t *prinst, struct globalvars_s
else else
pitchpct = 0; pitchpct = 0;
SVQ1_StartSound (origin, sv.world.edicts, 0, sample, volume, attenuation, pitchpct, 0); SVQ1_StartSound (origin, sv.world.edicts, 0, sample, volume, attenuation, pitchpct, 0, 0);
} }
//an evil one from telejano. //an evil one from telejano.
@ -3105,7 +3101,7 @@ static void QCBUILTIN PF_LocalSound(pubprogfuncs_t *prinst, struct globalvars_s
if (!isDedicated) if (!isDedicated)
{ {
if ((sfx = S_PrecacheSound(s))) if ((sfx = S_PrecacheSound(s)))
S_StartSound(cl.playerview[0].playernum, chan, sfx, cl.playerview[0].simorg, vol, 0.0, 0, 0); S_StartSound(cl.playerview[0].playernum, chan, sfx, cl.playerview[0].simorg, vol, 0.0, 0, 0, CF_NOSPACIALISE);
} }
#endif #endif
}; };
@ -7570,7 +7566,7 @@ static void QCBUILTIN PF_h2StopSound(pubprogfuncs_t *prinst, struct globalvars_s
entity = G_EDICT(prinst, OFS_PARM0); entity = G_EDICT(prinst, OFS_PARM0);
channel = G_FLOAT(OFS_PARM1); channel = G_FLOAT(OFS_PARM1);
SVQ1_StartSound (NULL, (wedict_t*)entity, channel, "", 1, 0, 0, 0); SVQ1_StartSound (NULL, (wedict_t*)entity, channel, "", 1, 0, 0, 0, 0);
} }
static void QCBUILTIN PF_h2updatesoundpos(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) static void QCBUILTIN PF_h2updatesoundpos(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -10734,7 +10730,7 @@ void PR_DumpPlatform_f(void)
{"m_draw", "void()", MENU}, {"m_draw", "void()", MENU},
{"m_keydown", "void(float scan, float chr)", MENU}, {"m_keydown", "void(float scan, float chr)", MENU},
{"m_keyup", "void(float scan, float chr)", MENU}, {"m_keyup", "void(float scan, float chr)", MENU},
{"m_toggle", "void(float mode)", MENU}, {"m_toggle", "void(float wantmode)", MENU},
{"parm17, parm18, parm19, parm20, parm21, parm22, parm23, parm24, parm25, parm26, parm27, parm28, parm29, parm30, parm31, parm32", "float", QW|NQ}, {"parm17, parm18, parm19, parm20, parm21, parm22, parm23, parm24, parm25, parm26, parm27, parm28, parm29, parm30, parm31, parm32", "float", QW|NQ},
{"parm33, parm34, parm35, parm36, parm37, parm38, parm39, parm40, parm41, parm42, parm43, parm44, parm45, parm46, parm47, parm48", "float", QW|NQ}, {"parm33, parm34, parm35, parm36, parm37, parm38, parm39, parm40, parm41, parm42, parm43, parm44, parm45, parm46, parm47, parm48", "float", QW|NQ},
@ -10839,8 +10835,10 @@ void PR_DumpPlatform_f(void)
{"CHAN_BODY", "const float", QW|NQ|CS, NULL, CHAN_BODY}, {"CHAN_BODY", "const float", QW|NQ|CS, NULL, CHAN_BODY},
{"CHANF_RELIABLE", "const float", QW, NULL, 8}, {"CHANF_RELIABLE", "const float", QW, NULL, 8},
{"SOUNDFLAG_RELIABLE", "const float", QW|NQ, NULL, 1}, {"SOUNDFLAG_RELIABLE", "const float", QW|NQ, NULL, CF_RELIABLE},
// {"SOUNDFLAG_ABSOLUTEVOL", "const float", CS, NULL, 256}, {"SOUNDFLAG_ABSVOLUME", "const float", /*QW|NQ|*/CS,NULL, CF_ABSVOLUME},
{"SOUNDFLAG_FORCELOOP", "const float", /*QW|NQ|*/CS,NULL, CF_FORCELOOP},
{"SOUNDFLAG_NOSPACIALISE", "const float", /*QW|NQ|*/CS,NULL, CF_NOSPACIALISE},
{"ATTN_NONE", "const float", QW|NQ|CS, "Sounds with this attenuation can be heard throughout the map", ATTN_NONE}, {"ATTN_NONE", "const float", QW|NQ|CS, "Sounds with this attenuation can be heard throughout the map", ATTN_NONE},
{"ATTN_NORM", "const float", QW|NQ|CS, "Standard attenuation", ATTN_NORM}, {"ATTN_NORM", "const float", QW|NQ|CS, "Standard attenuation", ATTN_NORM},

View file

@ -685,7 +685,14 @@ static qintptr_t QVM_AmbientSound (void *offset, quintptr_t mask, const qintptr_
static qintptr_t QVM_Sound (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_Sound (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
// ( int edn, int channel, char *samp, float vol, float att ) // ( int edn, int channel, char *samp, float vol, float att )
SVQ1_StartSound (NULL, (wedict_t*)Q1QVMPF_EdictNum(svprogfuncs, VM_LONG(arg[0])), VM_LONG(arg[1]), VM_POINTER(arg[2]), VM_FLOAT(arg[3])*255, VM_FLOAT(arg[4]), 0, 0); int channel = VM_LONG(arg[1]);
int flags = 0;
if (channel & 8)
{ //based on quakeworld, remember
channel = (channel & 7) | ((channel&~15)>>1);
flags |= CF_RELIABLE;
}
SVQ1_StartSound (NULL, (wedict_t*)Q1QVMPF_EdictNum(svprogfuncs, VM_LONG(arg[0])), channel, VM_POINTER(arg[2]), VM_FLOAT(arg[3])*255, VM_FLOAT(arg[4]), 0, 0, flags);
return 0; return 0;
} }
static qintptr_t QVM_TraceLine (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_TraceLine (void *offset, quintptr_t mask, const qintptr_t *arg)
@ -952,45 +959,73 @@ static qintptr_t QVM_strncpy (void *offset, quintptr_t mask, const qintptr_t *ar
} }
static qintptr_t QVM_sin (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_sin (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
qintptr_t fn; union
VM_FLOAT(fn)=(float)sin(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = sin(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_cos (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_cos (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
qintptr_t fn; union
VM_FLOAT(fn)=(float)cos(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = cos(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_atan2 (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_atan2 (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
int fn; union
VM_FLOAT(fn)=(float)atan2(VM_FLOAT(arg[0]), VM_FLOAT(arg[1])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = atan2(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]));
return u.r;
} }
static qintptr_t QVM_sqrt (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_sqrt (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
int fn; union
VM_FLOAT(fn)=(float)sqrt(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = sqrt(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_floor (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_floor (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
int fn; union
VM_FLOAT(fn)=(float)floor(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = floor(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_ceil (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_ceil (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
int fn; union
VM_FLOAT(fn)=(float)ceil(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = ceil(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_acos (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_acos (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
int fn; union
VM_FLOAT(fn)=(float)acos(VM_FLOAT(arg[0])); {
return fn; qintptr_t r;
float f;
} u = {0};
u.f = acos(VM_FLOAT(arg[0]));
return u.r;
} }
static qintptr_t QVM_Cmd_ArgC (void *offset, quintptr_t mask, const qintptr_t *arg) static qintptr_t QVM_Cmd_ArgC (void *offset, quintptr_t mask, const qintptr_t *arg)
{ {
@ -1614,7 +1649,14 @@ static qintptr_t QVM_Map_Extension (void *offset, quintptr_t mask, const qintptr
//============== general Quake services ================== //============== general Quake services ==================
#if FTE_WORDSIZE == 64 #if FTE_WORDSIZE == 32 && !defined(NACL)
static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg)
{
if (fn >= countof(traps))
return QVM_NotYetImplemented(offset, mask, arg);
return traps[fn](offset, mask, arg);
}
#else
static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg) static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg)
{ {
qintptr_t args[13]; qintptr_t args[13];
@ -1625,13 +1667,6 @@ static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg)
return QVM_NotYetImplemented(offset, mask, args); return QVM_NotYetImplemented(offset, mask, args);
return traps[fn](offset, mask, args); return traps[fn](offset, mask, args);
} }
#else
static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg)
{
if (fn >= countof(traps))
return QVM_NotYetImplemented(offset, mask, arg);
return traps[fn](offset, mask, arg);
}
#endif #endif
static qintptr_t EXPORT_FN syscallnative (qintptr_t arg, ...) static qintptr_t EXPORT_FN syscallnative (qintptr_t arg, ...)

View file

@ -1306,6 +1306,10 @@ void SV_Loadgame_f (void)
return; return;
} }
#ifdef MENU_DAT
MP_Toggle(0);
#endif
VFS_GETS(f, str, sizeof(str)-1); VFS_GETS(f, str, sizeof(str)-1);
version = atoi(str); version = atoi(str);
if (version < FTESAVEGAME_VERSION || version >= FTESAVEGAME_VERSION+GT_MAX) if (version < FTESAVEGAME_VERSION || version >= FTESAVEGAME_VERSION+GT_MAX)

View file

@ -1138,8 +1138,8 @@ void VARGS SV_Multicast (vec3_t origin, multicast_t to);
#define FULLDIMENSIONMASK 0xffffffff #define FULLDIMENSIONMASK 0xffffffff
void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int with, int without); void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int with, int without);
void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs); void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs, unsigned int flags);
void SVQ1_StartSound (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs); void SVQ1_StartSound (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs, unsigned int flags);
void SV_PrintToClient(client_t *cl, int level, const char *string); void SV_PrintToClient(client_t *cl, int level, const char *string);
void SV_TPrintToClient(client_t *cl, int level, const char *string); void SV_TPrintToClient(client_t *cl, int level, const char *string);
void SV_StuffcmdToClient(client_t *cl, const char *string); void SV_StuffcmdToClient(client_t *cl, const char *string);

View file

@ -610,6 +610,10 @@ void SV_Map_f (void)
} }
#endif #endif
#ifdef MENU_DAT
MP_Toggle(0);
#endif
for (i=0 ; i<svs.allocated_client_slots ; i++) //we need to drop all q2 clients. We don't mix q1w with q2. for (i=0 ; i<svs.allocated_client_slots ; i++) //we need to drop all q2 clients. We don't mix q1w with q2.
{ {
if (svs.clients[i].state>cs_connected) //so that we don't send a datagram if (svs.clients[i].state>cs_connected) //so that we don't send a datagram

View file

@ -1254,7 +1254,7 @@ static void WPhys_CheckWaterTransition (world_t *w, wedict_t *ent)
{ {
if (ent->v->watertype == Q1CONTENTS_EMPTY && *sv_sound_watersplash.string) if (ent->v->watertype == Q1CONTENTS_EMPTY && *sv_sound_watersplash.string)
{ // just crossed into water { // just crossed into water
w->Event_Sound(NULL, ent, 0, sv_sound_watersplash.string, 255, 1, 0, 0); w->Event_Sound(NULL, ent, 0, sv_sound_watersplash.string, 255, 1, 0, 0, 0);
} }
ent->v->watertype = cont; ent->v->watertype = cont;
ent->v->waterlevel = 1; ent->v->waterlevel = 1;
@ -1263,7 +1263,7 @@ static void WPhys_CheckWaterTransition (world_t *w, wedict_t *ent)
{ {
if (ent->v->watertype != Q1CONTENTS_EMPTY && *sv_sound_watersplash.string) if (ent->v->watertype != Q1CONTENTS_EMPTY && *sv_sound_watersplash.string)
{ // just crossed into open { // just crossed into open
w->Event_Sound(NULL, ent, 0, sv_sound_watersplash.string, 255, 1, 0, 0); w->Event_Sound(NULL, ent, 0, sv_sound_watersplash.string, 255, 1, 0, 0, 0);
} }
ent->v->watertype = Q1CONTENTS_EMPTY; ent->v->watertype = Q1CONTENTS_EMPTY;
ent->v->waterlevel = cont; ent->v->waterlevel = cont;
@ -1449,7 +1449,7 @@ static void WPhys_Physics_Step (world_t *w, wedict_t *ent)
{ {
if (hitsound && *sv_sound_land.string) if (hitsound && *sv_sound_land.string)
{ {
w->Event_Sound(NULL, ent, 0, sv_sound_land.string, 255, 1, 0, 0); w->Event_Sound(NULL, ent, 0, sv_sound_land.string, 255, 1, 0, 0, 0);
} }
} }
} }

View file

@ -979,24 +979,16 @@ Larger attenuations will drop off. (max 4 attenuation)
================== ==================
*/ */
void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs) void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs, unsigned int flags)
{ {
int sound_num; int sound_num;
int extfield_mask; int extfield_mask;
int qwflags; int qwflags;
int i; int i;
qboolean use_phs; qboolean use_phs;
qboolean reliable; qboolean reliable = flags & 1;
int requiredextensions = 0; int requiredextensions = 0;
if (channel & 256)
{
channel &= ~256;
reliable = true;
}
else
reliable = false;
if (volume < 0 || volume > 255) if (volume < 0 || volume > 255)
{ {
Con_Printf ("SV_StartSound: volume = %i", volume); Con_Printf ("SV_StartSound: volume = %i", volume);
@ -1078,7 +1070,7 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const cha
extfield_mask |= FTESND_TIMEOFS; extfield_mask |= FTESND_TIMEOFS;
#ifdef PEXT_SOUNDDBL #ifdef PEXT_SOUNDDBL
if (channel >= 8 || ent >= 2048 || sound_num > 0xff || (pitchadj && pitchadj != 100)) if (channel >= 8 || ent >= 2048 || sound_num > 0xff || (pitchadj && pitchadj != 100) || timeofs)
{ {
//if any of the above conditions evaluates to true, then we can't use standard qw protocols //if any of the above conditions evaluates to true, then we can't use standard qw protocols
MSG_WriteByte (&sv.multicast, svcfte_soundextended); MSG_WriteByte (&sv.multicast, svcfte_soundextended);
@ -1168,7 +1160,7 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, const cha
SV_MulticastProtExt(origin, reliable ? MULTICAST_ALL_R : MULTICAST_ALL, seenmask, requiredextensions, 0); SV_MulticastProtExt(origin, reliable ? MULTICAST_ALL_R : MULTICAST_ALL, seenmask, requiredextensions, 0);
} }
void SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs) void SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const char *sample, int volume, float attenuation, int pitchadj, float timeofs, unsigned int flags)
{ {
edict_t *entity = (edict_t*)wentity; edict_t *entity = (edict_t*)wentity;
int i; int i;
@ -1186,7 +1178,7 @@ void SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const char
//making them all reliable avoids packetloss and phs issues. //making them all reliable avoids packetloss and phs issues.
//this applies only to pushers. you won't get extra latency on player actions because of this. //this applies only to pushers. you won't get extra latency on player actions because of this.
//be warned that it does mean you might be able to hear people triggering stuff on the other side of the map however. //be warned that it does mean you might be able to hear people triggering stuff on the other side of the map however.
channel |= 256; flags |= CF_RELIABLE;
} }
else if (progstype == PROG_QW) else if (progstype == PROG_QW)
{ //quakeworld puts the sound ONLY at the entity's actual origin. this is annoying and stupid. I'm not really sure what to do here. it seems wrong. { //quakeworld puts the sound ONLY at the entity's actual origin. this is annoying and stupid. I'm not really sure what to do here. it seems wrong.
@ -1199,7 +1191,7 @@ void SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const char
} }
} }
SV_StartSound(NUM_FOR_EDICT(svprogfuncs, entity), origin, entity->xv->dimension_seen, channel, sample, volume, attenuation, pitchadj, timeofs); SV_StartSound(NUM_FOR_EDICT(svprogfuncs, entity), origin, entity->xv->dimension_seen, channel, sample, volume, attenuation, pitchadj, timeofs, flags);
} }
/* /*

View file

@ -6157,6 +6157,8 @@ void SV_RunCmdCleanup(void)
playertouchmax = 0; playertouchmax = 0;
} }
void Sh_CalcPointLight(vec3_t point, vec3_t light);
/* /*
=========== ===========
SV_RunCmd SV_RunCmd
@ -6330,8 +6332,18 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
if (sv.world.worldmodel && sv.world.worldmodel->funcs.LightPointValues) if (sv.world.worldmodel && sv.world.worldmodel->funcs.LightPointValues)
{ {
vec3_t diffuse, ambient, dir; vec3_t diffuse, ambient, dir;
sv.world.worldmodel->funcs.LightPointValues(sv.world.worldmodel, sv_player->v->origin, diffuse, ambient, dir); float lev = 0;
sv_player->xv->light_level = (ambient[0]+ambient[1]+ambient[2])/3.0+(diffuse[0]+diffuse[1]+diffuse[2])/6.0; #ifdef RTLIGHTS
Sh_CalcPointLight(sv_player->v->origin, ambient);
lev += VectorLength(ambient);
if (!r_shadow_realtime_world.ival || r_shadow_realtime_world_lightmaps.value)
#endif
{
cl.worldmodel->funcs.LightPointValues(cl.worldmodel, sv_player->v->origin, ambient, diffuse, dir);
lev += (VectorLength(ambient) + VectorLength(diffuse)/2.0)/256;
}
sv_player->xv->light_level = lev * 255;
} }
else else
sv_player->xv->light_level = 128; //don't know, some dummy value. sv_player->xv->light_level = 128; //don't know, some dummy value.