mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
commit
39e128cb0f
@ -626,7 +626,7 @@ static inline bool AIPathAddDPathNode(ai_path_info *aip, int *slot, int *cur_nod
|
||||
AIDynamicPath[*slot].pos[*cur_node] = *pos;
|
||||
AIDynamicPath[*slot].roomnum[(*cur_node)++] = room;
|
||||
|
||||
if (aip->num_paths >= 0)
|
||||
if (aip->num_paths > 0)
|
||||
aip->path_end_node[aip->num_paths - 1] = *cur_node - 1;
|
||||
|
||||
return true;
|
||||
|
@ -50,7 +50,7 @@
|
||||
#ifndef GRDEFS_H
|
||||
#define GRDEFS_H
|
||||
|
||||
#include "pstypes.h"
|
||||
#include <cstdint>
|
||||
|
||||
// bit depth info
|
||||
#define BPP_TO_BYTESPP(x) (((x) + 7) >> 3)
|
||||
@ -82,9 +82,9 @@ static const ddgr_color GR_NULL = 0xffffffff, // don't do a thing with this.
|
||||
#define GR_COLOR_CHAR 1 // ASCII 1 and (r,g,b) changes current text color in string.
|
||||
|
||||
// MACROS
|
||||
static inline ddgr_color GR_RGB(int r, int g, int b) { return ((r << 16) + (g << 8) + b); }
|
||||
static inline ddgr_color GR_RGB(uint8_t r, uint8_t g, uint8_t b) { return ((r << 16) + (g << 8) + b); }
|
||||
|
||||
static inline uint16_t GR_RGB16(int r, int g, int b) { return (((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); }
|
||||
static inline uint16_t GR_RGB16(uint8_t r, uint8_t g, uint8_t b) { return (((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); }
|
||||
|
||||
static inline uint16_t GR_COLOR_TO_16(ddgr_color c) {
|
||||
int r, g, b;
|
||||
|
@ -323,12 +323,15 @@ void software_mixer::StreamMixer(char *ptr, int len) {
|
||||
} else
|
||||
sample = sample_16bit[samples_played];
|
||||
} else {
|
||||
// Can't left-shift negative values without UB,
|
||||
// so we'll use multiply to the same effect.
|
||||
if (samples_played & 0x0001) {
|
||||
// Notes: (<<7) is from a (<<8) - (>>1)
|
||||
// Notes: (-256) is from (-128) + (-128)
|
||||
sample = ((int)sample_8bit[samples_played ^ 0x0001] + (int)sample_8bit[samples_played + 1] - 256) << 7;
|
||||
sample = (sample_8bit[samples_played ^ 0x0001] - 128 +
|
||||
sample_8bit[samples_played + 1] - 128) * 0x80;
|
||||
} else
|
||||
sample = (((int)sample_8bit[samples_played]) - (int)128) << 8;
|
||||
sample = (sample_8bit[samples_played] - 128) * 0x100;
|
||||
}
|
||||
|
||||
samples_played++;
|
||||
@ -373,21 +376,21 @@ void software_mixer::StreamMixer(char *ptr, int len) {
|
||||
} else {
|
||||
switch (mod_pos) {
|
||||
case 0:
|
||||
sample = ((((int)sample_8bit[samples_played]) - 128) << 8);
|
||||
sample = (sample_8bit[samples_played] - 128) * 0x100;
|
||||
break;
|
||||
case 1:
|
||||
sample = (((((int)sample_8bit[samples_played - 1]) - 128) << 8) * 3 +
|
||||
((((int)sample_8bit[samples_played + 3]) - 128) << 8)) >>
|
||||
sample = ((sample_8bit[samples_played - 1] - 128) * 0x100 * 3 +
|
||||
(sample_8bit[samples_played + 3] - 128) * 0x100) >>
|
||||
2;
|
||||
break;
|
||||
case 2:
|
||||
sample = (((((int)sample_8bit[samples_played - 2]) - 128) << 8) +
|
||||
((((int)sample_8bit[samples_played + 2]) - 128) << 8)) >>
|
||||
sample = ((sample_8bit[samples_played - 2] - 128) * 0x100 +
|
||||
(sample_8bit[samples_played + 2] - 128) * 0x100) >>
|
||||
1;
|
||||
break;
|
||||
case 3:
|
||||
sample = (((((int)sample_8bit[samples_played - 3]) - 128) << 8) +
|
||||
((((int)sample_8bit[samples_played + 1]) - 128) << 8) * 3) >>
|
||||
sample = (((sample_8bit[samples_played - 3] - 128) * 0x100) +
|
||||
((sample_8bit[samples_played + 1] - 128) * 0x100) * 3) >>
|
||||
2;
|
||||
break;
|
||||
}
|
||||
@ -487,11 +490,9 @@ inline void opti_8m_mix(uint8_t *cur_sample_8bit, const int num_write, int &samp
|
||||
int16_t *mb = mixer_buffer16;
|
||||
|
||||
for (i = 0; i < (num_write << 1); i += 2) {
|
||||
int16_t sample;
|
||||
int l_sample;
|
||||
int r_sample;
|
||||
|
||||
sample = (((int16_t)(*cur_sample_8bit)) - (int16_t)128) << 8;
|
||||
int16_t sample = (*cur_sample_8bit - 128) * 0x100;
|
||||
cur_sample_8bit++;
|
||||
|
||||
l_sample = *mb + (sample * l_volume);
|
||||
|
Loading…
Reference in New Issue
Block a user