Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
vitaquake3
Commits
e7b5548b
Commit
e7b5548b
authored
Mar 14, 2019
by
Rinnegatamante
Browse files
Updated to
https://github.com/ioquake/ioq3/commit/d068e1dce174d2631d2d760d1d729a9d1d4151b8
parent
bb677f64
Changes
27
Show whitespace changes
Inline
Side-by-side
code/cgame/cg_ents.c
View file @
e7b5548b
...
...
@@ -664,6 +664,44 @@ static void CG_Portal( centity_t *cent ) {
}
/*
================
CG_CreateRotationMatrix
================
*/
void
CG_CreateRotationMatrix
(
vec3_t
angles
,
vec3_t
matrix
[
3
])
{
AngleVectors
(
angles
,
matrix
[
0
],
matrix
[
1
],
matrix
[
2
]);
VectorInverse
(
matrix
[
1
]);
}
/*
================
CG_TransposeMatrix
================
*/
void
CG_TransposeMatrix
(
vec3_t
matrix
[
3
],
vec3_t
transpose
[
3
])
{
int
i
,
j
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
{
transpose
[
i
][
j
]
=
matrix
[
j
][
i
];
}
}
}
/*
================
CG_RotatePoint
================
*/
void
CG_RotatePoint
(
vec3_t
point
,
vec3_t
matrix
[
3
])
{
vec3_t
tvec
;
VectorCopy
(
point
,
tvec
);
point
[
0
]
=
DotProduct
(
matrix
[
0
],
tvec
);
point
[
1
]
=
DotProduct
(
matrix
[
1
],
tvec
);
point
[
2
]
=
DotProduct
(
matrix
[
2
],
tvec
);
}
/*
=========================
CG_AdjustPositionForMover
...
...
@@ -675,6 +713,8 @@ void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int
centity_t
*
cent
;
vec3_t
oldOrigin
,
origin
,
deltaOrigin
;
vec3_t
oldAngles
,
angles
,
deltaAngles
;
vec3_t
matrix
[
3
],
transpose
[
3
];
vec3_t
org
,
org2
,
move2
;
if
(
moverNum
<=
0
||
moverNum
>=
ENTITYNUM_MAX_NORMAL
)
{
VectorCopy
(
in
,
out
);
...
...
@@ -698,9 +738,17 @@ void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int
VectorSubtract
(
origin
,
oldOrigin
,
deltaOrigin
);
VectorSubtract
(
angles
,
oldAngles
,
deltaAngles
);
// origin change when on a rotating object
CG_CreateRotationMatrix
(
deltaAngles
,
transpose
);
CG_TransposeMatrix
(
transpose
,
matrix
);
VectorSubtract
(
in
,
oldOrigin
,
org
);
VectorCopy
(
org
,
org2
);
CG_RotatePoint
(
org2
,
matrix
);
VectorSubtract
(
org2
,
org
,
move2
);
VectorAdd
(
deltaOrigin
,
move2
,
deltaOrigin
);
VectorAdd
(
in
,
deltaOrigin
,
out
);
VectorAdd
(
angles_in
,
deltaAngles
,
angles_out
);
// FIXME: origin change when on a rotating object
}
...
...
@@ -1045,4 +1093,3 @@ void CG_AddPacketEntities( void ) {
CG_AddCEntity
(
cent
);
}
}
code/cgame/cg_view.c
View file @
e7b5548b
...
...
@@ -71,6 +71,7 @@ can then be moved around
void
CG_TestModel_f
(
void
)
{
vec3_t
angles
;
cg
.
testGun
=
qfalse
;
memset
(
&
cg
.
testModelEntity
,
0
,
sizeof
(
cg
.
testModelEntity
)
);
if
(
trap_Argc
()
<
2
)
{
return
;
...
...
@@ -96,7 +97,6 @@ void CG_TestModel_f (void) {
angles
[
ROLL
]
=
0
;
AnglesToAxis
(
angles
,
cg
.
testModelEntity
.
axis
);
cg
.
testGun
=
qfalse
;
}
/*
...
...
@@ -108,6 +108,9 @@ Replaces the current view weapon with the given model
*/
void
CG_TestGun_f
(
void
)
{
CG_TestModel_f
();
if
(
!
cg
.
testModelEntity
.
hModel
)
{
return
;
}
cg
.
testGun
=
qtrue
;
cg
.
testModelEntity
.
renderfx
=
RF_MINLIGHT
|
RF_DEPTHHACK
|
RF_FIRST_PERSON
;
}
...
...
code/cgame/q_shared.c
View file @
e7b5548b
...
...
@@ -23,6 +23,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.c -- stateless support routines that are included in each code dll
#include "q_shared.h"
// ^[0-9a-zA-Z]
qboolean
Q_IsColorString
(
const
char
*
p
)
{
if
(
!
p
)
return
qfalse
;
if
(
p
[
0
]
!=
Q_COLOR_ESCAPE
)
return
qfalse
;
if
(
p
[
1
]
==
0
)
return
qfalse
;
// isalnum expects a signed integer in the range -1 (EOF) to 255, or it might assert on undefined behaviour
// a dereferenced char pointer has the range -128 to 127, so we just need to rangecheck the negative part
if
(
p
[
1
]
<
0
)
return
qfalse
;
if
(
isalnum
(
p
[
1
])
==
0
)
return
qfalse
;
return
qtrue
;
}
float
Com_Clamp
(
float
min
,
float
max
,
float
value
)
{
if
(
value
<
min
)
{
return
min
;
...
...
code/cgame2/cg_ents.c
View file @
e7b5548b
...
...
@@ -664,6 +664,44 @@ static void CG_Portal( centity_t *cent ) {
}
/*
================
CG_CreateRotationMatrix
================
*/
void
CG_CreateRotationMatrix
(
vec3_t
angles
,
vec3_t
matrix
[
3
])
{
AngleVectors
(
angles
,
matrix
[
0
],
matrix
[
1
],
matrix
[
2
]);
VectorInverse
(
matrix
[
1
]);
}
/*
================
CG_TransposeMatrix
================
*/
void
CG_TransposeMatrix
(
vec3_t
matrix
[
3
],
vec3_t
transpose
[
3
])
{
int
i
,
j
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
{
transpose
[
i
][
j
]
=
matrix
[
j
][
i
];
}
}
}
/*
================
CG_RotatePoint
================
*/
void
CG_RotatePoint
(
vec3_t
point
,
vec3_t
matrix
[
3
])
{
vec3_t
tvec
;
VectorCopy
(
point
,
tvec
);
point
[
0
]
=
DotProduct
(
matrix
[
0
],
tvec
);
point
[
1
]
=
DotProduct
(
matrix
[
1
],
tvec
);
point
[
2
]
=
DotProduct
(
matrix
[
2
],
tvec
);
}
/*
=========================
CG_AdjustPositionForMover
...
...
@@ -675,6 +713,8 @@ void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int
centity_t
*
cent
;
vec3_t
oldOrigin
,
origin
,
deltaOrigin
;
vec3_t
oldAngles
,
angles
,
deltaAngles
;
vec3_t
matrix
[
3
],
transpose
[
3
];
vec3_t
org
,
org2
,
move2
;
if
(
moverNum
<=
0
||
moverNum
>=
ENTITYNUM_MAX_NORMAL
)
{
VectorCopy
(
in
,
out
);
...
...
@@ -698,9 +738,17 @@ void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int
VectorSubtract
(
origin
,
oldOrigin
,
deltaOrigin
);
VectorSubtract
(
angles
,
oldAngles
,
deltaAngles
);
// origin change when on a rotating object
CG_CreateRotationMatrix
(
deltaAngles
,
transpose
);
CG_TransposeMatrix
(
transpose
,
matrix
);
VectorSubtract
(
in
,
oldOrigin
,
org
);
VectorCopy
(
org
,
org2
);
CG_RotatePoint
(
org2
,
matrix
);
VectorSubtract
(
org2
,
org
,
move2
);
VectorAdd
(
deltaOrigin
,
move2
,
deltaOrigin
);
VectorAdd
(
in
,
deltaOrigin
,
out
);
VectorAdd
(
angles_in
,
deltaAngles
,
angles_out
);
// FIXME: origin change when on a rotating object
}
...
...
@@ -1045,4 +1093,3 @@ void CG_AddPacketEntities( void ) {
CG_AddCEntity
(
cent
);
}
}
code/cgame2/cg_newdraw.c
View file @
e7b5548b
...
...
@@ -150,7 +150,7 @@ void CG_SelectNextPlayer( void ) {
void
CG_SelectPrevPlayer
(
void
)
{
CG_CheckOrderPending
();
if
(
cg_currentSelectedPlayer
.
integer
>
0
&&
cg_currentSelectedPlayer
.
integer
<
numSortedTeamPlayers
)
{
if
(
cg_currentSelectedPlayer
.
integer
>
0
&&
cg_currentSelectedPlayer
.
integer
<
=
numSortedTeamPlayers
)
{
cg_currentSelectedPlayer
.
integer
--
;
}
else
{
cg_currentSelectedPlayer
.
integer
=
numSortedTeamPlayers
;
...
...
@@ -1832,4 +1832,3 @@ void CG_GetTeamColor(vec4_t *color) {
(
*
color
)[
3
]
=
0
.
25
f
;
}
}
code/cgame2/cg_view.c
View file @
e7b5548b
...
...
@@ -71,6 +71,7 @@ can then be moved around
void
CG_TestModel_f
(
void
)
{
vec3_t
angles
;
cg
.
testGun
=
qfalse
;
memset
(
&
cg
.
testModelEntity
,
0
,
sizeof
(
cg
.
testModelEntity
)
);
if
(
trap_Argc
()
<
2
)
{
return
;
...
...
@@ -96,7 +97,6 @@ void CG_TestModel_f (void) {
angles
[
ROLL
]
=
0
;
AnglesToAxis
(
angles
,
cg
.
testModelEntity
.
axis
);
cg
.
testGun
=
qfalse
;
}
/*
...
...
@@ -108,6 +108,9 @@ Replaces the current view weapon with the given model
*/
void
CG_TestGun_f
(
void
)
{
CG_TestModel_f
();
if
(
!
cg
.
testModelEntity
.
hModel
)
{
return
;
}
cg
.
testGun
=
qtrue
;
cg
.
testModelEntity
.
renderfx
=
RF_MINLIGHT
|
RF_DEPTHHACK
|
RF_FIRST_PERSON
;
}
...
...
code/cgame2/q_shared.c
View file @
e7b5548b
...
...
@@ -23,6 +23,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.c -- stateless support routines that are included in each code dll
#include "q_shared.h"
// ^[0-9a-zA-Z]
qboolean
Q_IsColorString
(
const
char
*
p
)
{
if
(
!
p
)
return
qfalse
;
if
(
p
[
0
]
!=
Q_COLOR_ESCAPE
)
return
qfalse
;
if
(
p
[
1
]
==
0
)
return
qfalse
;
// isalnum expects a signed integer in the range -1 (EOF) to 255, or it might assert on undefined behaviour
// a dereferenced char pointer has the range -128 to 127, so we just need to rangecheck the negative part
if
(
p
[
1
]
<
0
)
return
qfalse
;
if
(
isalnum
(
p
[
1
])
==
0
)
return
qfalse
;
return
qtrue
;
}
float
Com_Clamp
(
float
min
,
float
max
,
float
value
)
{
if
(
value
<
min
)
{
return
min
;
...
...
code/client/cl_keys.c
View file @
e7b5548b
...
...
@@ -825,6 +825,7 @@ to be configured even if they don't have defined names.
*/
int
Key_StringToKeynum
(
char
*
str
)
{
keyname_t
*
kn
;
int
n
;
if
(
!
str
||
!
str
[
0
]
)
{
return
-
1
;
...
...
@@ -834,13 +835,10 @@ int Key_StringToKeynum( char *str ) {
}
// check for hex code
if
(
strlen
(
str
)
==
4
)
{
int
n
=
Com_HexStrToInt
(
str
);
if
(
n
>=
0
)
{
n
=
Com_HexStrToInt
(
str
);
if
(
n
>=
0
&&
n
<
MAX_KEYS
)
{
return
n
;
}
}
// scan for a text match
for
(
kn
=
keynames
;
kn
->
name
;
kn
++
)
{
...
...
code/client/snd_dma.c
View file @
e7b5548b
...
...
@@ -98,9 +98,9 @@ void S_Base_SoundInfo(void) {
if
(
!
s_soundStarted
)
{
Com_Printf
(
"sound system not started
\n
"
);
}
else
{
Com_Printf
(
"%5d
stereo
\n
"
,
dma
.
channels
-
1
);
Com_Printf
(
"%5d
channels
\n
"
,
dma
.
channels
);
Com_Printf
(
"%5d samples
\n
"
,
dma
.
samples
);
Com_Printf
(
"%5d samplebits
\n
"
,
dma
.
samplebits
);
Com_Printf
(
"%5d samplebits
(%s)
\n
"
,
dma
.
samplebits
,
dma
.
isfloat
?
"float"
:
"int"
);
Com_Printf
(
"%5d submission_chunk
\n
"
,
dma
.
submission_chunk
);
Com_Printf
(
"%5d speed
\n
"
,
dma
.
speed
);
Com_Printf
(
"%p dma buffer
\n
"
,
dma
.
buffer
);
...
...
@@ -119,32 +119,31 @@ void S_Base_SoundInfo(void) {
static
void
S_Base_StartCapture
(
void
)
{
// !!! FIXME: write me.
SNDDMA_StartCapture
();
}
static
int
S_Base_AvailableCaptureSamples
(
void
)
{
// !!! FIXME: write me.
return
0
;
return
SNDDMA_AvailableCaptureSamples
();
}
static
void
S_Base_Capture
(
int
samples
,
byte
*
data
)
{
// !!! FIXME: write me.
SNDDMA_Capture
(
samples
,
data
);
}
static
void
S_Base_StopCapture
(
void
)
{
// !!! FIXME: write me.
SNDDMA_StopCapture
();
}
static
void
S_Base_MasterGain
(
float
val
)
{
// !!! FIXME: write me.
SNDDMA_MasterGain
(
val
);
}
#endif
...
...
@@ -1243,9 +1242,6 @@ void S_GetSoundtime(void)
int
samplepos
;
static
int
buffers
;
static
int
oldsamplepos
;
int
fullsamples
;
fullsamples
=
dma
.
samples
/
dma
.
channels
;
if
(
CL_VideoRecording
(
)
)
{
...
...
@@ -1269,13 +1265,13 @@ void S_GetSoundtime(void)
if
(
s_paintedtime
>
0x40000000
)
{
// time to chop things off to avoid 32 bit limits
buffers
=
0
;
s_paintedtime
=
fullsamples
;
s_paintedtime
=
dma
.
fullsamples
;
S_Base_StopAllSounds
();
}
}
oldsamplepos
=
samplepos
;
s_soundtime
=
buffers
*
fullsamples
+
samplepos
/
dma
.
channels
;
s_soundtime
=
buffers
*
dma
.
fullsamples
+
samplepos
/
dma
.
channels
;
#if 0
// check to make sure that we haven't overshot
...
...
@@ -1296,7 +1292,6 @@ void S_GetSoundtime(void)
void
S_Update_
(
void
)
{
unsigned
endtime
;
int
samps
;
static
float
lastTime
=
0
.
0
f
;
float
ma
,
op
;
float
thisTime
,
sane
;
...
...
@@ -1340,9 +1335,8 @@ void S_Update_(void) {
&
~
(
dma
.
submission_chunk
-
1
);
// never mix more than the complete buffer
samps
=
dma
.
samples
>>
(
dma
.
channels
-
1
);
if
(
endtime
-
s_soundtime
>
samps
)
endtime
=
s_soundtime
+
samps
;
if
(
endtime
-
s_soundtime
>
dma
.
fullsamples
)
endtime
=
s_soundtime
+
dma
.
fullsamples
;
...
...
code/client/snd_local.h
View file @
e7b5548b
...
...
@@ -65,8 +65,10 @@ typedef struct sfx_s {
typedef
struct
{
int
channels
;
int
samples
;
// mono samples in buffer
int
fullsamples
;
// samples with all channels in buffer (samples divided by channels)
int
submission_chunk
;
// don't mix less than this #
int
samplebits
;
int
isfloat
;
int
speed
;
byte
*
buffer
;
}
dma_t
;
...
...
@@ -175,6 +177,15 @@ void SNDDMA_BeginPainting (void);
void
SNDDMA_Submit
(
void
);
#ifdef USE_VOIP
void
SNDDMA_StartCapture
(
void
);
int
SNDDMA_AvailableCaptureSamples
(
void
);
void
SNDDMA_Capture
(
int
samples
,
byte
*
data
);
void
SNDDMA_StopCapture
(
void
);
void
SNDDMA_MasterGain
(
float
val
);
#endif
//====================================================================
#define MAX_CHANNELS 96
...
...
@@ -254,3 +265,7 @@ typedef enum
typedef
int
srcHandle_t
;
qboolean
S_AL_Init
(
soundInterface_t
*
si
);
#ifdef idppc_altivec
void
S_PaintChannelFrom16_altivec
(
portable_samplepair_t
paintbuffer
[
PAINTBUFFER_SIZE
],
int
snd_vol
,
channel_t
*
ch
,
const
sfx_t
*
sc
,
int
count
,
int
sampleOffset
,
int
bufferOffset
);
#endif
code/client/snd_mix.c
View file @
e7b5548b
...
...
@@ -23,9 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h"
#include "snd_local.h"
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif
static
portable_samplepair_t
paintbuffer
[
PAINTBUFFER_SIZE
];
static
int
snd_vol
;
...
...
@@ -122,24 +119,24 @@ void S_TransferStereo16 (unsigned long *pbuf, int endtime)
while
(
ls_paintedtime
<
endtime
)
{
// handle recirculating buffer issues
lpos
=
ls_paintedtime
&
((
dma
.
samples
>>
1
)
-
1
)
;
lpos
=
ls_paintedtime
%
dma
.
fullsamples
;
snd_out
=
(
short
*
)
pbuf
+
(
lpos
<<
1
);
snd_out
=
(
short
*
)
pbuf
+
(
lpos
<<
1
);
// lpos * dma.channels
snd_linear_count
=
(
dma
.
samples
>>
1
)
-
lpos
;
snd_linear_count
=
dma
.
full
samples
-
lpos
;
if
(
ls_paintedtime
+
snd_linear_count
>
endtime
)
snd_linear_count
=
endtime
-
ls_paintedtime
;
snd_linear_count
<<=
1
;
snd_linear_count
<<=
1
;
// snd_linear_count *= dma.channels
// write a linear blast of samples
S_WriteLinearBlastStereo16
();
snd_p
+=
snd_linear_count
;
ls_paintedtime
+=
(
snd_linear_count
>>
1
);
ls_paintedtime
+=
(
snd_linear_count
>>
1
);
// snd_linear_count / dma.channels
if
(
CL_VideoRecording
(
)
)
CL_WriteAVIAudioFrame
(
(
byte
*
)
snd_out
,
snd_linear_count
<<
1
);
CL_WriteAVIAudioFrame
(
(
byte
*
)
snd_out
,
snd_linear_count
<<
1
);
// snd_linear_count * (dma.samplebits/8)
}
}
...
...
@@ -153,18 +150,16 @@ void S_TransferPaintBuffer(int endtime)
{
int
out_idx
;
int
count
;
int
out_mask
;
int
*
p
;
int
step
;
int
val
;
int
i
;
unsigned
long
*
pbuf
;
pbuf
=
(
unsigned
long
*
)
dma
.
buffer
;
if
(
s_testsound
->
integer
)
{
int
i
;
// write a fixed sine wave
count
=
(
endtime
-
s_paintedtime
);
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -180,38 +175,73 @@ void S_TransferPaintBuffer(int endtime)
{
// general case
p
=
(
int
*
)
paintbuffer
;
count
=
(
endtime
-
s_paintedtime
)
*
dma
.
channels
;
out_mask
=
dma
.
samples
-
1
;
out_idx
=
s_paintedtime
*
dma
.
channels
&
out_mask
;
step
=
3
-
dma
.
channels
;
out_idx
=
(
s_paintedtime
*
dma
.
channels
)
%
dma
.
samples
;
step
=
3
-
MIN
(
dma
.
channels
,
2
);
if
(
dma
.
samplebits
==
16
)
if
((
dma
.
isfloat
)
&&
(
dma
.
samplebits
==
32
))
{
float
*
out
=
(
float
*
)
pbuf
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
((
i
%
dma
.
channels
)
>=
2
)
{
val
=
0
;
}
else
{
val
=
*
p
>>
8
;
p
+=
step
;
}
if
(
val
>
0x7fff
)
val
=
0x7fff
;
else
if
(
val
<
-
32767
)
/* clamp to one less than max to make division max out at -1.0f. */
val
=
-
32767
;
out
[
out_idx
]
=
((
float
)
val
)
/
32767
.
0
f
;
out_idx
=
(
out_idx
+
1
)
%
dma
.
samples
;
}
}
else
if
(
dma
.
samplebits
==
16
)
{
short
*
out
=
(
short
*
)
pbuf
;
while
(
count
--
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
((
i
%
dma
.
channels
)
>=
2
)
{
val
=
0
;
}
else
{
val
=
*
p
>>
8
;
p
+=
step
;
}
if
(
val
>
0x7fff
)
val
=
0x7fff
;
else
if
(
val
<
-
32768
)
val
=
-
32768
;
out
[
out_idx
]
=
val
;
out_idx
=
(
out_idx
+
1
)
&
out_mask
;
out_idx
=
(
out_idx
+
1
)
%
dma
.
samples
;
}
}
else
if
(
dma
.
samplebits
==
8
)
{
unsigned
char
*
out
=
(
unsigned
char
*
)
pbuf
;
while
(
count
--
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
((
i
%
dma
.
channels
)
>=
2
)
{
val
=
0
;
}
else
{
val
=
*
p
>>
8
;
p
+=
step
;
}
if
(
val
>
0x7fff
)
val
=
0x7fff
;
else
if
(
val
<
-
32768
)
val
=
-
32768
;
out
[
out_idx
]
=
(
val
>>
8
)
+
128
;
out_idx
=
(
out_idx
+
1
)
&
out_mask
;
out_idx
=
(
out_idx
+
1
)
%
dma
.
samples
;
}
}
}
...
...
@@ -226,197 +256,6 @@ CHANNEL MIXING
===============================================================================
*/
#if idppc_altivec
static
void
S_PaintChannelFrom16_altivec
(
channel_t
*
ch
,
const
sfx_t
*
sc
,
int
count
,
int
sampleOffset
,
int
bufferOffset
)
{
int
data
,
aoff
,
boff
;
int
leftvol
,
rightvol
;
int
i
,
j
;
portable_samplepair_t
*
samp
;
sndBuffer
*
chunk
;
short
*
samples
;
float
ooff
,
fdata
[
2
],
fdiv
,
fleftvol
,
frightvol
;
if
(
sc
->
soundChannels
<=
0
)
{
return
;
}
samp
=
&
paintbuffer
[
bufferOffset
];
if
(
ch
->
doppler
)
{
sampleOffset
=
sampleOffset
*
ch
->
oldDopplerScale
;
}
if
(
sc
->
soundChannels
==
2
)
{
sampleOffset
*=
sc
->
soundChannels
;
if
(
sampleOffset
&
1
)
{
sampleOffset
&=
~
1
;
}
}
chunk
=
sc
->
soundData
;
while
(
sampleOffset
>=
SND_CHUNK_SIZE
)
{
chunk
=
chunk
->
next
;
sampleOffset
-=
SND_CHUNK_SIZE
;
if
(
!
chunk
)
{
chunk
=
sc
->
soundData
;
}
}
if
(
!
ch
->
doppler
||
ch
->
dopplerScale
==
1
.
0
f
)
{
vector
signed
short
volume_vec
;
vector
unsigned
int
volume_shift
;
int
vectorCount
,
samplesLeft
,
chunkSamplesLeft
;
leftvol
=
ch
->
leftvol
*
snd_vol
;
rightvol
=
ch
->
rightvol
*
snd_vol
;
samples
=
chunk
->
sndChunk
;
((
short
*
)
&
volume_vec
)[
0
]
=
leftvol
;
((
short
*
)
&
volume_vec
)[
1
]
=
leftvol
;
((
short
*
)
&
volume_vec
)[
4
]
=
leftvol
;
((
short
*
)
&
volume_vec
)[
5
]
=
leftvol
;