mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
some minor tidy/speed up
This commit is contained in:
parent
1c26723864
commit
73f9c3aaa5
2 changed files with 18 additions and 29 deletions
|
@ -323,7 +323,7 @@ SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
void
|
void
|
||||||
SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
{
|
{
|
||||||
int data, left, right, leftvol, rightvol;
|
int leftvol, rightvol;
|
||||||
unsigned int left_phase, right_phase; // Never allowed < 0 anyway
|
unsigned int left_phase, right_phase; // Never allowed < 0 anyway
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
signed short *sfx;
|
signed short *sfx;
|
||||||
|
@ -373,9 +373,8 @@ SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
c = min (count, max (count_right, count_left));
|
c = min (count, max (count_right, count_left));
|
||||||
count -= c;
|
count -= c;
|
||||||
while (c) {
|
while (c) {
|
||||||
int data = sfx[i];
|
int left = (sfx[i] * leftvol) >> 8;
|
||||||
int left = (data * leftvol) >> 8;
|
int right = (sfx[i] * rightvol) >> 8;
|
||||||
int right = (data * rightvol) >> 8;
|
|
||||||
|
|
||||||
if (new_phase_left < old_phase_left) {
|
if (new_phase_left < old_phase_left) {
|
||||||
if (!(count_left & 1)) {
|
if (!(count_left & 1)) {
|
||||||
|
@ -383,11 +382,11 @@ SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
old_phase_left--;
|
old_phase_left--;
|
||||||
}
|
}
|
||||||
count_left--;
|
count_left--;
|
||||||
} else if (new_phase_left > old_phase_left) {
|
|
||||||
paintbuffer[i + old_phase_left].left += left;
|
|
||||||
old_phase_left++;
|
|
||||||
paintbuffer[i + old_phase_left].left += left;
|
|
||||||
} else {
|
} else {
|
||||||
|
if (new_phase_left > old_phase_left) {
|
||||||
|
paintbuffer[i + old_phase_left].left += left;
|
||||||
|
old_phase_left++;
|
||||||
|
}
|
||||||
paintbuffer[i + old_phase_left].left += left;
|
paintbuffer[i + old_phase_left].left += left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,11 +396,11 @@ SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
old_phase_right--;
|
old_phase_right--;
|
||||||
}
|
}
|
||||||
count_right--;
|
count_right--;
|
||||||
} else if (new_phase_right > old_phase_right) {
|
|
||||||
paintbuffer[i + old_phase_right].right += right;
|
|
||||||
old_phase_right++;
|
|
||||||
paintbuffer[i + old_phase_right].right += right;
|
|
||||||
} else {
|
} else {
|
||||||
|
if (new_phase_right > old_phase_right) {
|
||||||
|
paintbuffer[i + old_phase_right].right += right;
|
||||||
|
old_phase_right++;
|
||||||
|
}
|
||||||
paintbuffer[i + old_phase_right].right += right;
|
paintbuffer[i + old_phase_right].right += right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,10 +410,7 @@ SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
data = sfx[i];
|
paintbuffer[i + left_phase].left += (sfx[i] * leftvol) >> 8;
|
||||||
left = (data * leftvol) >> 8;
|
paintbuffer[i + right_phase].right += (sfx[i] * rightvol) >> 8;
|
||||||
right = (data * rightvol) >> 8;
|
|
||||||
paintbuffer[i + left_phase].left += left;
|
|
||||||
paintbuffer[i + right_phase].right += right;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,21 +195,14 @@ EmitWaterPolys (msurface_t *fa)
|
||||||
for (p = fa->polys; p; p = p->next) {
|
for (p = fa->polys; p; p = p->next) {
|
||||||
qfglBegin (GL_POLYGON);
|
qfglBegin (GL_POLYGON);
|
||||||
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) {
|
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) {
|
||||||
os = v[3];
|
os = turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255];
|
||||||
ot = v[4];
|
ot = turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255];
|
||||||
s = (os + turbsin[(int) ((ot * 0.125 + r_realtime) *
|
s = (v[3] + ot) * (1.0 / 64.0);
|
||||||
TURBSCALE) & 255]) * (1.0 / 64.0);
|
t = (v[4] + os) * (1.0 / 64.0);
|
||||||
|
|
||||||
t = (ot + turbsin[(int) ((os * 0.125 + r_realtime) *
|
|
||||||
TURBSCALE) & 255]) * (1.0 / 64.0);
|
|
||||||
qfglTexCoord2f (s, t);
|
qfglTexCoord2f (s, t);
|
||||||
|
|
||||||
VectorCopy (v, nv);
|
VectorCopy (v, nv);
|
||||||
nv[2] += r_waterripple->value *
|
nv[2] += r_waterripple->value * os * ot * (1.0 / 64.0);
|
||||||
turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) &
|
|
||||||
255] *
|
|
||||||
turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) &
|
|
||||||
255] * (1.0 / 64.0);
|
|
||||||
qfglVertex3fv (nv);
|
qfglVertex3fv (nv);
|
||||||
}
|
}
|
||||||
qfglEnd ();
|
qfglEnd ();
|
||||||
|
|
Loading…
Reference in a new issue