This commit is contained in:
SonicDcer
2025-05-25 22:25:19 -03:00
parent 9c87f7092f
commit adc650af4b
8 changed files with 241 additions and 215 deletions
+183 -161
View File
@@ -9,7 +9,7 @@
#include "mixer.h"
#ifndef __clang__
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("unroll-loops")
#endif
#if defined(__SSE2__) || defined(__aarch64__)
@@ -73,10 +73,10 @@ static __m128i m256i_clamp_to_m128i(m256i a) {
#define ROUND_DOWN_16(v) ((v) & ~0xf)
#define DMEM_BUF_SIZE (0x1B90) // 7056 B
#define BUF_U8(a) (rspa.buf + ((a)-0x450))
#define BUF_U8(a) (rspa.buf + ((a) -0x450))
#define BUF_S16(a) (int16_t*) BUF_U8(a)
#define SAMPLE_RATE 32000 // Adjusted to match the actual sample rate of 32 kHz
#define SAMPLE_RATE 32000 // Adjusted to match the actual sample rate of 32 kHz
static struct {
uint16_t in;
@@ -88,7 +88,7 @@ static struct {
uint16_t vol_wet;
uint16_t rate_wet;
ADPCM_STATE *adpcm_loop_state;
ADPCM_STATE* adpcm_loop_state;
int16_t adpcm_table[8][2][8];
@@ -99,38 +99,28 @@ static struct {
} rspa;
static int16_t resample_table[64][4] = {
{0x0c39, 0x66ad, 0x0d46, 0xffdf}, {0x0b39, 0x6696, 0x0e5f, 0xffd8},
{0x0a44, 0x6669, 0x0f83, 0xffd0}, {0x095a, 0x6626, 0x10b4, 0xffc8},
{0x087d, 0x65cd, 0x11f0, 0xffbf}, {0x07ab, 0x655e, 0x1338, 0xffb6},
{0x06e4, 0x64d9, 0x148c, 0xffac}, {0x0628, 0x643f, 0x15eb, 0xffa1},
{0x0577, 0x638f, 0x1756, 0xff96}, {0x04d1, 0x62cb, 0x18cb, 0xff8a},
{0x0435, 0x61f3, 0x1a4c, 0xff7e}, {0x03a4, 0x6106, 0x1bd7, 0xff71},
{0x031c, 0x6007, 0x1d6c, 0xff64}, {0x029f, 0x5ef5, 0x1f0b, 0xff56},
{0x022a, 0x5dd0, 0x20b3, 0xff48}, {0x01be, 0x5c9a, 0x2264, 0xff3a},
{0x015b, 0x5b53, 0x241e, 0xff2c}, {0x0101, 0x59fc, 0x25e0, 0xff1e},
{0x00ae, 0x5896, 0x27a9, 0xff10}, {0x0063, 0x5720, 0x297a, 0xff02},
{0x001f, 0x559d, 0x2b50, 0xfef4}, {0xffe2, 0x540d, 0x2d2c, 0xfee8},
{0xffac, 0x5270, 0x2f0d, 0xfedb}, {0xff7c, 0x50c7, 0x30f3, 0xfed0},
{0xff53, 0x4f14, 0x32dc, 0xfec6}, {0xff2e, 0x4d57, 0x34c8, 0xfebd},
{0xff0f, 0x4b91, 0x36b6, 0xfeb6}, {0xfef5, 0x49c2, 0x38a5, 0xfeb0},
{0xfedf, 0x47ed, 0x3a95, 0xfeac}, {0xfece, 0x4611, 0x3c85, 0xfeab},
{0xfec0, 0x4430, 0x3e74, 0xfeac}, {0xfeb6, 0x424a, 0x4060, 0xfeaf},
{0xfeaf, 0x4060, 0x424a, 0xfeb6}, {0xfeac, 0x3e74, 0x4430, 0xfec0},
{0xfeab, 0x3c85, 0x4611, 0xfece}, {0xfeac, 0x3a95, 0x47ed, 0xfedf},
{0xfeb0, 0x38a5, 0x49c2, 0xfef5}, {0xfeb6, 0x36b6, 0x4b91, 0xff0f},
{0xfebd, 0x34c8, 0x4d57, 0xff2e}, {0xfec6, 0x32dc, 0x4f14, 0xff53},
{0xfed0, 0x30f3, 0x50c7, 0xff7c}, {0xfedb, 0x2f0d, 0x5270, 0xffac},
{0xfee8, 0x2d2c, 0x540d, 0xffe2}, {0xfef4, 0x2b50, 0x559d, 0x001f},
{0xff02, 0x297a, 0x5720, 0x0063}, {0xff10, 0x27a9, 0x5896, 0x00ae},
{0xff1e, 0x25e0, 0x59fc, 0x0101}, {0xff2c, 0x241e, 0x5b53, 0x015b},
{0xff3a, 0x2264, 0x5c9a, 0x01be}, {0xff48, 0x20b3, 0x5dd0, 0x022a},
{0xff56, 0x1f0b, 0x5ef5, 0x029f}, {0xff64, 0x1d6c, 0x6007, 0x031c},
{0xff71, 0x1bd7, 0x6106, 0x03a4}, {0xff7e, 0x1a4c, 0x61f3, 0x0435},
{0xff8a, 0x18cb, 0x62cb, 0x04d1}, {0xff96, 0x1756, 0x638f, 0x0577},
{0xffa1, 0x15eb, 0x643f, 0x0628}, {0xffac, 0x148c, 0x64d9, 0x06e4},
{0xffb6, 0x1338, 0x655e, 0x07ab}, {0xffbf, 0x11f0, 0x65cd, 0x087d},
{0xffc8, 0x10b4, 0x6626, 0x095a}, {0xffd0, 0x0f83, 0x6669, 0x0a44},
{0xffd8, 0x0e5f, 0x6696, 0x0b39}, {0xffdf, 0x0d46, 0x66ad, 0x0c39}
{ 0x0c39, 0x66ad, 0x0d46, 0xffdf }, { 0x0b39, 0x6696, 0x0e5f, 0xffd8 }, { 0x0a44, 0x6669, 0x0f83, 0xffd0 },
{ 0x095a, 0x6626, 0x10b4, 0xffc8 }, { 0x087d, 0x65cd, 0x11f0, 0xffbf }, { 0x07ab, 0x655e, 0x1338, 0xffb6 },
{ 0x06e4, 0x64d9, 0x148c, 0xffac }, { 0x0628, 0x643f, 0x15eb, 0xffa1 }, { 0x0577, 0x638f, 0x1756, 0xff96 },
{ 0x04d1, 0x62cb, 0x18cb, 0xff8a }, { 0x0435, 0x61f3, 0x1a4c, 0xff7e }, { 0x03a4, 0x6106, 0x1bd7, 0xff71 },
{ 0x031c, 0x6007, 0x1d6c, 0xff64 }, { 0x029f, 0x5ef5, 0x1f0b, 0xff56 }, { 0x022a, 0x5dd0, 0x20b3, 0xff48 },
{ 0x01be, 0x5c9a, 0x2264, 0xff3a }, { 0x015b, 0x5b53, 0x241e, 0xff2c }, { 0x0101, 0x59fc, 0x25e0, 0xff1e },
{ 0x00ae, 0x5896, 0x27a9, 0xff10 }, { 0x0063, 0x5720, 0x297a, 0xff02 }, { 0x001f, 0x559d, 0x2b50, 0xfef4 },
{ 0xffe2, 0x540d, 0x2d2c, 0xfee8 }, { 0xffac, 0x5270, 0x2f0d, 0xfedb }, { 0xff7c, 0x50c7, 0x30f3, 0xfed0 },
{ 0xff53, 0x4f14, 0x32dc, 0xfec6 }, { 0xff2e, 0x4d57, 0x34c8, 0xfebd }, { 0xff0f, 0x4b91, 0x36b6, 0xfeb6 },
{ 0xfef5, 0x49c2, 0x38a5, 0xfeb0 }, { 0xfedf, 0x47ed, 0x3a95, 0xfeac }, { 0xfece, 0x4611, 0x3c85, 0xfeab },
{ 0xfec0, 0x4430, 0x3e74, 0xfeac }, { 0xfeb6, 0x424a, 0x4060, 0xfeaf }, { 0xfeaf, 0x4060, 0x424a, 0xfeb6 },
{ 0xfeac, 0x3e74, 0x4430, 0xfec0 }, { 0xfeab, 0x3c85, 0x4611, 0xfece }, { 0xfeac, 0x3a95, 0x47ed, 0xfedf },
{ 0xfeb0, 0x38a5, 0x49c2, 0xfef5 }, { 0xfeb6, 0x36b6, 0x4b91, 0xff0f }, { 0xfebd, 0x34c8, 0x4d57, 0xff2e },
{ 0xfec6, 0x32dc, 0x4f14, 0xff53 }, { 0xfed0, 0x30f3, 0x50c7, 0xff7c }, { 0xfedb, 0x2f0d, 0x5270, 0xffac },
{ 0xfee8, 0x2d2c, 0x540d, 0xffe2 }, { 0xfef4, 0x2b50, 0x559d, 0x001f }, { 0xff02, 0x297a, 0x5720, 0x0063 },
{ 0xff10, 0x27a9, 0x5896, 0x00ae }, { 0xff1e, 0x25e0, 0x59fc, 0x0101 }, { 0xff2c, 0x241e, 0x5b53, 0x015b },
{ 0xff3a, 0x2264, 0x5c9a, 0x01be }, { 0xff48, 0x20b3, 0x5dd0, 0x022a }, { 0xff56, 0x1f0b, 0x5ef5, 0x029f },
{ 0xff64, 0x1d6c, 0x6007, 0x031c }, { 0xff71, 0x1bd7, 0x6106, 0x03a4 }, { 0xff7e, 0x1a4c, 0x61f3, 0x0435 },
{ 0xff8a, 0x18cb, 0x62cb, 0x04d1 }, { 0xff96, 0x1756, 0x638f, 0x0577 }, { 0xffa1, 0x15eb, 0x643f, 0x0628 },
{ 0xffac, 0x148c, 0x64d9, 0x06e4 }, { 0xffb6, 0x1338, 0x655e, 0x07ab }, { 0xffbf, 0x11f0, 0x65cd, 0x087d },
{ 0xffc8, 0x10b4, 0x6626, 0x095a }, { 0xffd0, 0x0f83, 0x6669, 0x0a44 }, { 0xffd8, 0x0e5f, 0x6696, 0x0b39 },
{ 0xffdf, 0x0d46, 0x66ad, 0x0c39 }
};
static inline int16_t clamp16(int32_t v) {
@@ -139,7 +129,7 @@ static inline int16_t clamp16(int32_t v) {
} else if (v > 0x7fff) {
return 0x7fff;
}
return (int16_t)v;
return (int16_t) v;
}
static inline int32_t clamp32(int64_t v) {
@@ -148,7 +138,7 @@ static inline int32_t clamp32(int64_t v) {
} else if (v > 0x7fffffff) {
return 0x7fffffff;
}
return (int32_t)v;
return (int32_t) v;
}
void aClearBufferImpl(uint16_t addr, int nbytes) {
@@ -156,23 +146,23 @@ void aClearBufferImpl(uint16_t addr, int nbytes) {
memset(BUF_U8(addr), 0, nbytes);
}
void aLoadBufferImpl(const void *source_addr, uint16_t dest_addr, uint16_t nbytes) {
void aLoadBufferImpl(const void* source_addr, uint16_t dest_addr, uint16_t nbytes) {
#if __SANITIZE_ADDRESS__
for (size_t i = 0; i < ROUND_DOWN_16(nbytes); i++) {
BUF_U8(dest_addr)[i] = ((const unsigned char*)source_addr)[i];
BUF_U8(dest_addr)[i] = ((const unsigned char*) source_addr)[i];
}
#else
memcpy(BUF_U8(dest_addr), source_addr, ROUND_DOWN_16(nbytes));
#endif
}
void aSaveBufferImpl(uint16_t source_addr, int16_t *dest_addr, uint16_t nbytes) {
//printf("source_addr: %x\n dest_addr; %x\n nbytes: %d\n", source_addr, dest_addr, nbytes);
//if (nbytes > 704) {nbytes = 704;}
void aSaveBufferImpl(uint16_t source_addr, int16_t* dest_addr, uint16_t nbytes) {
// printf("source_addr: %x\n dest_addr; %x\n nbytes: %d\n", source_addr, dest_addr, nbytes);
// if (nbytes > 704) {nbytes = 704;}
memcpy(dest_addr, BUF_S16(source_addr), ROUND_DOWN_16(nbytes));
}
void aLoadADPCMImpl(int num_entries_times_16, const int16_t *book_source_addr) {
void aLoadADPCMImpl(int num_entries_times_16, const int16_t* book_source_addr) {
memcpy(rspa.adpcm_table, book_source_addr, num_entries_times_16);
}
@@ -182,16 +172,17 @@ void aSetBufferImpl(uint8_t flags, uint16_t in, uint16_t out, uint16_t nbytes) {
rspa.nbytes = nbytes;
}
void aInterleaveImpl(uint16_t left, uint16_t right, uint16_t center, uint16_t lfe, uint16_t surround_left, uint16_t surround_right, uint16_t num_channels) {
void aInterleaveImpl(uint16_t left, uint16_t right, uint16_t center, uint16_t lfe, uint16_t surround_left,
uint16_t surround_right, uint16_t num_channels) {
if (rspa.nbytes == 0) {
return;
}
int count = rspa.nbytes / (num_channels * sizeof(int16_t));
int16_t *l = BUF_S16(left);
int16_t *r = BUF_S16(right);
int16_t *d = BUF_S16(rspa.out);
int16_t* l = BUF_S16(left);
int16_t* r = BUF_S16(right);
int16_t* d = BUF_S16(rspa.out);
if (num_channels == 2) {
for (int i = 0; i < count; i++) {
@@ -199,10 +190,10 @@ void aInterleaveImpl(uint16_t left, uint16_t right, uint16_t center, uint16_t lf
*d++ = *r++;
}
} else {
int16_t *c = BUF_S16(center);
int16_t *lf = BUF_S16(lfe);
int16_t *sl = BUF_S16(surround_left);
int16_t *sr = BUF_S16(surround_right);
int16_t* c = BUF_S16(center);
int16_t* lf = BUF_S16(lfe);
int16_t* sl = BUF_S16(surround_left);
int16_t* sr = BUF_S16(surround_right);
for (int i = 0; i < count; i++) {
*d++ = *l++;
@@ -220,15 +211,15 @@ void aDMEMMoveImpl(uint16_t in_addr, uint16_t out_addr, int nbytes) {
memmove(BUF_U8(out_addr), BUF_U8(in_addr), nbytes);
}
void aSetLoopImpl(ADPCM_STATE *adpcm_loop_state) {
void aSetLoopImpl(ADPCM_STATE* adpcm_loop_state) {
rspa.adpcm_loop_state = adpcm_loop_state;
}
#ifndef SSE2_AVAILABLE
void aADPCMdecImpl(uint8_t flags, ADPCM_STATE state) {
uint8_t *in = BUF_U8(rspa.in);
int16_t *out = BUF_S16(rspa.out);
uint8_t* in = BUF_U8(rspa.in);
int16_t* out = BUF_S16(rspa.out);
int nbytes = ROUND_UP_32(rspa.nbytes);
if (flags & A_INIT) {
memset(out, 0, 16 * sizeof(int16_t));
@@ -240,9 +231,9 @@ void aADPCMdecImpl(uint8_t flags, ADPCM_STATE state) {
out += 16;
while (nbytes > 0) {
int shift = *in >> 4; // should be in 0..12 or 0..14
int shift = *in >> 4; // should be in 0..12 or 0..14
int table_index = *in++ & 0xf; // should be in 0..7
int16_t (*tbl)[8] = rspa.adpcm_table[table_index];
int16_t(*tbl)[8] = rspa.adpcm_table[table_index];
int i;
for (i = 0; i < 2; i++) {
@@ -336,7 +327,7 @@ void aADPCMdecImpl(uint8_t flags, ADPCM_STATE state) {
ins_vec = _mm_slli_epi16(ins_vec, 14);
ins_vec = _mm_srai_epi16(ins_vec, 14);
ins_vec = _mm_slli_epi16(ins_vec, shift);
in += 2;
} else {
ins_vec = _mm_loadu_si32((__m128i*) in);
@@ -406,13 +397,13 @@ void aADPCMdecImpl(uint8_t flags, ADPCM_STATE state) {
void aResampleImpl(uint8_t flags, uint16_t pitch, RESAMPLE_STATE state) {
int16_t tmp[16];
int16_t *in_initial = BUF_S16(rspa.in);
int16_t *in = in_initial;
int16_t *out = BUF_S16(rspa.out);
int16_t* in_initial = BUF_S16(rspa.in);
int16_t* in = in_initial;
int16_t* out = BUF_S16(rspa.out);
int nbytes = ROUND_UP_16(rspa.nbytes);
uint32_t pitch_accumulator;
int i;
int16_t *tbl;
int16_t* tbl;
int32_t sample;
if (flags & A_INIT) {
@@ -425,16 +416,14 @@ void aResampleImpl(uint8_t flags, uint16_t pitch, RESAMPLE_STATE state) {
in -= tmp[5] / sizeof(int16_t);
}
in -= 4;
pitch_accumulator = (uint16_t)tmp[4];
pitch_accumulator = (uint16_t) tmp[4];
memcpy(in, tmp, 4 * sizeof(int16_t));
do {
for (i = 0; i < 8; i++) {
tbl = resample_table[pitch_accumulator * 64 >> 16];
sample = ((in[0] * tbl[0] + 0x4000) >> 15) +
((in[1] * tbl[1] + 0x4000) >> 15) +
((in[2] * tbl[2] + 0x4000) >> 15) +
((in[3] * tbl[3] + 0x4000) >> 15);
sample = ((in[0] * tbl[0] + 0x4000) >> 15) + ((in[1] * tbl[1] + 0x4000) >> 15) +
((in[2] * tbl[2] + 0x4000) >> 15) + ((in[3] * tbl[3] + 0x4000) >> 15);
*out++ = clamp16(sample);
pitch_accumulator += (pitch << 1);
@@ -444,7 +433,7 @@ void aResampleImpl(uint8_t flags, uint16_t pitch, RESAMPLE_STATE state) {
nbytes -= 8 * sizeof(int16_t);
} while (nbytes > 0);
state[4] = (int16_t)pitch_accumulator;
state[4] = (int16_t) pitch_accumulator;
memcpy(state, in, 4 * sizeof(int16_t));
i = (in - in_initial + 4) & 7;
in -= i;
@@ -621,8 +610,8 @@ void aResampleImpl(uint8_t flags, uint16_t pitch, RESAMPLE_STATE state) {
#endif
void aEnvSetup1Impl(uint8_t initial_vol_wet, uint16_t rate_wet, uint16_t rate_left, uint16_t rate_right,
uint16_t rate_center, uint16_t rate_lfe, uint16_t rate_rear_left, uint16_t rate_rear_right) {
rspa.vol_wet = (uint16_t)(initial_vol_wet << 8);
uint16_t rate_center, uint16_t rate_lfe, uint16_t rate_rear_left, uint16_t rate_rear_right) {
rspa.vol_wet = (uint16_t) (initial_vol_wet << 8);
rspa.rate_wet = rate_wet;
rspa.rate[0] = rate_left;
rspa.rate[1] = rate_right;
@@ -633,7 +622,7 @@ void aEnvSetup1Impl(uint8_t initial_vol_wet, uint16_t rate_wet, uint16_t rate_le
}
void aEnvSetup2Impl(uint16_t initial_vol_left, uint16_t initial_vol_right, int16_t initial_vol_center,
int16_t initial_vol_lfe, int16_t initial_vol_rear_left, int16_t initial_vol_rear_right) {
int16_t initial_vol_lfe, int16_t initial_vol_rear_left, int16_t initial_vol_rear_right) {
rspa.vol[0] = initial_vol_left;
rspa.vol[1] = initial_vol_right;
rspa.vol[2] = initial_vol_center;
@@ -642,15 +631,12 @@ void aEnvSetup2Impl(uint16_t initial_vol_left, uint16_t initial_vol_right, int16
rspa.vol[5] = initial_vol_rear_right;
}
void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
bool neg_left, bool neg_right,
uint32_t wet_dry_addr, uint32_t haas_temp_addr, uint32_t num_channels,
uint32_t cutoff_freq_lfe)
{
void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb, bool neg_left, bool neg_right,
uint32_t wet_dry_addr, uint32_t haas_temp_addr, uint32_t num_channels, uint32_t cutoff_freq_lfe) {
// Note: max number of samples is 192 (192 * 2 = 384 bytes = 0x180)
int max_num_samples = 192;
int16_t *in = BUF_S16(in_addr);
int16_t* in = BUF_S16(in_addr);
int n = ROUND_UP_16(n_samples);
if (n > max_num_samples) {
printf("Warning: n_samples is too large: %d\n", n_samples);
@@ -662,16 +648,16 @@ void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
// All speakers
int dry_addr_start = wet_dry_addr & 0xFFFF;
int wet_addr_start = wet_dry_addr >> 16;
int16_t *dry[6];
int16_t *wet[6];
int16_t* dry[6];
int16_t* wet[6];
for (int i = 0; i < 6; i++) {
dry[i] = BUF_S16(dry_addr_start + max_num_samples * i * sizeof(int16_t));
wet[i] = BUF_S16(wet_addr_start + max_num_samples * i * sizeof(int16_t));
}
uint16_t vols[6] = {rspa.vol[0], rspa.vol[1], rspa.vol[2], rspa.vol[3], rspa.vol[4], rspa.vol[5]};
int swapped[2] = {swap_reverb ? 1 : 0, swap_reverb ? 0 : 1};
uint16_t vols[6] = { rspa.vol[0], rspa.vol[1], rspa.vol[2], rspa.vol[3], rspa.vol[4], rspa.vol[5] };
int swapped[2] = { swap_reverb ? 1 : 0, swap_reverb ? 0 : 1 };
if (num_channels == 6) {
// Calculate the filter coefficient
@@ -684,12 +670,12 @@ void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
for (int i = 0; i < n / 8; i++) {
for (int k = 0; k < 8; k++) {
int16_t samples[6] = {0};
int16_t samples[6] = { 0 };
samples[0] = *in;
samples[1] = *in;
samples[2] = *in;
samples[3] = *in; // LFE channel
samples[3] = *in; // LFE channel
samples[4] = *in;
samples[5] = *in;
in++;
@@ -703,7 +689,7 @@ void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
float lfe_sample = samples[3];
lfe_sample = alpha * lfe_sample + (1.0f - alpha) * prev_lfe_sample;
prev_lfe_sample = lfe_sample;
samples[3] = (int16_t)lfe_sample;
samples[3] = (int16_t) lfe_sample;
// Mix dry and wet signals
for (int j = 0; j < 6; j++) {
@@ -735,11 +721,11 @@ void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
dry[1] = BUF_S16(haas_addr_right);
}
int16_t negs[2] = {neg_left ? 0 : 0xFFFF, neg_right ? 0 : 0xFFFF};
int16_t negs[2] = { neg_left ? 0 : 0xFFFF, neg_right ? 0 : 0xFFFF };
for (int i = 0; i < n / 8; i++) {
for (int k = 0; k < 8; k++) {
int16_t samples[2] = {0};
int16_t samples[2] = { 0 };
samples[0] = *in;
samples[1] = *in;
@@ -773,8 +759,8 @@ void aEnvMixerImpl(uint16_t in_addr, uint16_t n_samples, bool swap_reverb,
void aMixImpl(uint16_t count, int16_t gain, uint16_t in_addr, uint16_t out_addr) {
int nbytes = ROUND_UP_32(ROUND_DOWN_16(count << 4));
int16_t *in = BUF_S16(in_addr);
int16_t *out = BUF_S16(out_addr);
int16_t* in = BUF_S16(in_addr);
int16_t* out = BUF_S16(out_addr);
int i;
int32_t sample;
@@ -864,8 +850,8 @@ void aMixImpl(uint16_t count, int16_t gain, uint16_t in_addr, uint16_t out_addr)
#endif
void aS8DecImpl(uint8_t flags, ADPCM_STATE state) {
uint8_t *in = BUF_U8(rspa.in);
int16_t *out = BUF_S16(rspa.out);
uint8_t* in = BUF_U8(rspa.in);
int16_t* out = BUF_S16(rspa.out);
int nbytes = ROUND_UP_32(rspa.nbytes);
if (flags & A_INIT) {
memset(out, 0, 16 * sizeof(int16_t));
@@ -877,22 +863,22 @@ void aS8DecImpl(uint8_t flags, ADPCM_STATE state) {
out += 16;
while (nbytes > 0) {
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t)(*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
*out++ = (int16_t) (*in++ << 8);
nbytes -= 16 * sizeof(int16_t);
}
@@ -901,27 +887,43 @@ void aS8DecImpl(uint8_t flags, ADPCM_STATE state) {
}
void aAddMixerImpl(uint16_t count, uint16_t in_addr, uint16_t out_addr) {
int16_t *in = BUF_S16(in_addr);
int16_t *out = BUF_S16(out_addr);
int16_t* in = BUF_S16(in_addr);
int16_t* out = BUF_S16(out_addr);
int nbytes = ROUND_UP_64(ROUND_DOWN_16(count));
do {
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++); out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
*out = clamp16(*out + *in++);
out++;
nbytes -= 16 * sizeof(int16_t);
} while (nbytes > 0);
@@ -929,7 +931,7 @@ void aAddMixerImpl(uint16_t count, uint16_t in_addr, uint16_t out_addr) {
void aDuplicateImpl(uint16_t count, uint16_t in_addr, uint16_t out_addr) {
uint8_t* in = BUF_U8(in_addr);
uint8_t *out = BUF_U8(out_addr);
uint8_t* out = BUF_U8(out_addr);
uint8_t tmp[128];
memcpy(tmp, in, 128);
@@ -940,8 +942,8 @@ void aDuplicateImpl(uint16_t count, uint16_t in_addr, uint16_t out_addr) {
}
void aDMEMMove2Impl(uint8_t t, uint16_t in_addr, uint16_t out_addr, uint16_t count) {
uint8_t *in = BUF_U8(in_addr);
uint8_t *out = BUF_U8(out_addr);
uint8_t* in = BUF_U8(in_addr);
uint8_t* out = BUF_U8(out_addr);
int nbytes = ROUND_UP_32(count);
do {
@@ -952,49 +954,61 @@ void aDMEMMove2Impl(uint8_t t, uint16_t in_addr, uint16_t out_addr, uint16_t cou
}
void aResampleZohImpl(uint16_t pitch, uint16_t start_fract) {
int16_t *in = BUF_S16(rspa.in);
int16_t *out = BUF_S16(rspa.out);
int16_t* in = BUF_S16(rspa.in);
int16_t* out = BUF_S16(rspa.out);
int nbytes = ROUND_UP_8(rspa.nbytes);
uint32_t pos = start_fract;
uint32_t pitch_add = pitch << 2;
do {
*out++ = in[pos >> 17]; pos += pitch_add;
*out++ = in[pos >> 17]; pos += pitch_add;
*out++ = in[pos >> 17]; pos += pitch_add;
*out++ = in[pos >> 17]; pos += pitch_add;
*out++ = in[pos >> 17];
pos += pitch_add;
*out++ = in[pos >> 17];
pos += pitch_add;
*out++ = in[pos >> 17];
pos += pitch_add;
*out++ = in[pos >> 17];
pos += pitch_add;
nbytes -= 4 * sizeof(int16_t);
} while (nbytes > 0);
}
void aInterlImpl(uint16_t in_addr, uint16_t out_addr, uint16_t n_samples) {
int16_t *in = BUF_S16(in_addr);
int16_t *out = BUF_S16(out_addr);
int16_t* in = BUF_S16(in_addr);
int16_t* out = BUF_S16(out_addr);
int n = ROUND_UP_8(n_samples);
do {
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
*out++ = *in++;
in++;
n -= 8;
} while (n > 0);
}
void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t *state_or_filter) {
void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t* state_or_filter) {
if (flags > A_INIT) {
rspa.filter_count = ROUND_UP_16(count_or_buf);
memcpy(rspa.filter, state_or_filter, sizeof(rspa.filter));
} else {
int16_t tmp[16], tmp2[8];
int count = rspa.filter_count;
int16_t *buf = BUF_S16(count_or_buf);
int16_t* buf = BUF_S16(count_or_buf);
if (flags == A_INIT) {
#ifndef __clang__
@@ -1022,7 +1036,7 @@ void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t *state_or_filter)
for (int j = 0; j < 8; j++) {
sample += tmp[i + j] * rspa.filter[7 - j];
}
buf[i] = clamp16((int32_t)(sample >> 15));
buf[i] = clamp16((int32_t) (sample >> 15));
}
memcpy(tmp, tmp + 8, 8 * sizeof(int16_t));
@@ -1036,18 +1050,26 @@ void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t *state_or_filter)
}
void aHiLoGainImpl(uint8_t g, uint16_t count, uint16_t addr) {
int16_t *samples = BUF_S16(addr);
int16_t* samples = BUF_S16(addr);
int nbytes = ROUND_UP_32(count);
do {
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4); samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
*samples = clamp16((*samples * g) >> 4);
samples++;
nbytes -= 8;
} while (nbytes > 0);
@@ -1058,8 +1080,8 @@ void aUnkCmd3Impl(uint16_t a, uint16_t b, uint16_t c) {
void aUnkCmd19Impl(uint8_t f, uint16_t count, uint16_t out_addr, uint16_t in_addr) {
int nbytes = ROUND_UP_64(count);
int16_t *in = BUF_S16(in_addr + f);
int16_t *out = BUF_S16(out_addr);
int16_t* in = BUF_S16(in_addr + f);
int16_t* out = BUF_S16(out_addr);
int16_t tbl[32];
memcpy(tbl, in, 32 * sizeof(int16_t));
@@ -1070,4 +1092,4 @@ void aUnkCmd19Impl(uint8_t f, uint16_t count, uint16_t out_addr, uint16_t in_add
out += 32;
nbytes -= 32 * sizeof(int16_t);
} while (nbytes > 0);
}
}
+5 -5
View File
@@ -654,9 +654,9 @@ bool PlayerShot_CheckPolyCollision(PlayerShot* shot, ObjectId objId, Object* obj
}
return false;
}
#ifdef AVOID_UB
return false;
#endif
#ifdef AVOID_UB
return false;
#endif
}
void PlayerShot_ApplyDamageToActor(PlayerShot* shot, Actor* actor, s32 hitIndex) {
@@ -1769,10 +1769,10 @@ void PlayerShot_SearchLockOnTarget(PlayerShot* shot) {
!(gControllerHold[shot->sourceId].button & A_BUTTON) || (shot->timer == 0)) {
Object_Kill(&shot->obj, shot->sfxSource);
}
} else {
} else {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
if ((shot->obj.pos.y < gGroundHeight) || PlayerShot_FindLockTarget(shot) ||
(!(gControllerHold[gMainController].button & A_BUTTON)^rapidFire) || (shot->timer == 0)) {
(!(gControllerHold[gMainController].button & A_BUTTON) ^ rapidFire) || (shot->timer == 0)) {
Object_Kill(&shot->obj, shot->sfxSource);
}
}
+24 -24
View File
@@ -951,11 +951,11 @@ void ItemMeteoWarp_Draw(ItemMeteoWarp* this) {
}
void Object_SetMatrix(Object* obj, s32 drawType) {
bool isBanned = (obj->id >= OBJ_SCENERY_CO_BUILDING_5 &&
obj->id <= OBJ_SCENERY_CO_BUILDING_8 || obj->id == OBJ_SCENERY_CO_BUILDING_10);
bool isBanned = (obj->id >= OBJ_SCENERY_CO_BUILDING_5 && obj->id <= OBJ_SCENERY_CO_BUILDING_8 ||
obj->id == OBJ_SCENERY_CO_BUILDING_10);
bool skipRot = false;
if(isBanned){
if (isBanned) {
f32 prevRot = obj->rot.y;
if (gPlayer[0].cam.eye.x < obj->pos.x) {
obj->rot.y = 271.0f;
@@ -973,7 +973,7 @@ void Object_SetMatrix(Object* obj, s32 drawType) {
Matrix_Mult(gGfxMatrix, gCalcMatrix, MTXF_APPLY);
Matrix_Copy(&D_edisplay_801615F0, gGfxMatrix);
Matrix_Pop(&gGfxMatrix);
if(isBanned && skipRot){
if (isBanned && skipRot) {
FrameInterpolation_ShouldInterpolateFrame(false);
}
Matrix_RotateY(gCalcMatrix, obj->rot.y * M_DTOR, MTXF_APPLY);
@@ -982,7 +982,7 @@ void Object_SetMatrix(Object* obj, s32 drawType) {
} else {
Matrix_Translate(gGfxMatrix, obj->pos.x, obj->pos.y, obj->pos.z + gPathProgress, MTXF_APPLY);
Matrix_Copy(&D_edisplay_801615F0, gGfxMatrix);
if(isBanned && skipRot){
if (isBanned && skipRot) {
FrameInterpolation_ShouldInterpolateFrame(false);
}
Matrix_RotateY(gGfxMatrix, obj->rot.y * M_DTOR, MTXF_APPLY);
@@ -991,7 +991,7 @@ void Object_SetMatrix(Object* obj, s32 drawType) {
Matrix_SetGfxMtx(&gMasterDisp);
}
if(isBanned && skipRot){
if (isBanned && skipRot) {
FrameInterpolation_ShouldInterpolateFrame(true);
}
}
@@ -1060,7 +1060,7 @@ void Scenery_Draw(Scenery* this, s32 cullDirection) {
Object_ApplyWaterDistortion();
}
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this) {
gSPDisplayList(gMasterDisp++, this->info.dList);
}
@@ -1079,7 +1079,7 @@ void Scenery_Draw(Scenery* this, s32 cullDirection) {
Object_ApplyWaterDistortion();
}
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this) {
gSPDisplayList(gMasterDisp++, this->info.dList);
}
@@ -1089,7 +1089,7 @@ void Scenery_Draw(Scenery* this, s32 cullDirection) {
}
} else if (this->info.draw != NULL) {
Object_SetCullDirection(cullDirection);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY, this) {
this->info.draw(&this->obj);
}
}
@@ -1102,7 +1102,7 @@ void Sprite_Draw(Sprite* this, s32 arg1) {
Object_SetMatrix(&this->obj, 0);
this->obj.pos.y -= gCameraShakeY;
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SPRITE, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SPRITE, this) {
if (this->info.drawType == 0) {
gSPDisplayList(gMasterDisp++, this->info.dList);
} else if (this->info.draw != NULL) {
@@ -1142,12 +1142,12 @@ void Actor_DrawOnRails(Actor* this) {
}
if (this->info.drawType == 0) {
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this) {
gSPDisplayList(gMasterDisp++, this->info.dList);
}
Object_UpdateSfxSource(this->sfxSource);
} else {
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this) {
this->info.draw(&this->obj);
}
Object_UpdateSfxSource(this->sfxSource);
@@ -1205,7 +1205,7 @@ void Actor_DrawAllRange(Actor* this) {
Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gCalcMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gCalcMatrix, this->obj.rot.z * M_DTOR, MTXF_APPLY);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this) {
this->info.draw(&this->obj);
}
sDrewActor = true;
@@ -1245,7 +1245,7 @@ void Actor_DrawAllRange(Actor* this) {
Matrix_RotateX(gGfxMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, this->obj.rot.z * M_DTOR, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR, this) {
this->info.draw(&this->obj);
}
sDrewActor = true;
@@ -1325,7 +1325,8 @@ void Boss_Draw(Boss* this, s32 arg1) {
sp3C = -1.0f;
// @port draw no matter what
if ((gCurrentLevel != LEVEL_KATINA) && (gCurrentLevel != LEVEL_SECTOR_Y)) { // Excepting Katina because of KaSaucerer's bug
if ((gCurrentLevel != LEVEL_KATINA) &&
(gCurrentLevel != LEVEL_SECTOR_Y)) { // Excepting Katina because of KaSaucerer's bug
goto render;
}
@@ -1344,7 +1345,7 @@ void Boss_Draw(Boss* this, s32 arg1) {
if (arg1 < 0) {
Object_ApplyWaterDistortion();
}
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_BOSS, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_BOSS, this) {
this->info.draw(&this->obj);
}
}
@@ -1357,7 +1358,7 @@ void Boss_Draw(Boss* this, s32 arg1) {
this->vwork[30] = D_edisplay_801615D0;
Display_SetSecondLight(&this->obj.pos);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_BOSS, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_BOSS, this) {
this->info.draw(&this->obj);
}
}
@@ -1380,7 +1381,7 @@ void Effect_DrawOnRails(Effect* this, s32 arg1) {
Object_SetMatrix(&this->obj, 0);
}
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_EFFECT, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_EFFECT, this) {
if (this->info.draw != NULL) {
this->info.draw(&this->obj);
}
@@ -1418,7 +1419,7 @@ void Effect_DrawAllRange(Effect* this) {
Matrix_RotateX(gGfxMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, this->obj.rot.z * M_DTOR, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_EFFECT, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_EFFECT, this) {
this->info.draw(&this->obj);
}
}
@@ -1455,7 +1456,7 @@ void Item_Draw(Item* this, s32 arg1) {
Matrix_RotateX(gGfxMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, this->obj.rot.z * M_DTOR, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ITEM, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ITEM, this) {
if (this->info.drawType == 0) {
gSPDisplayList(gMasterDisp++, this->info.dList);
} else {
@@ -1679,17 +1680,16 @@ check:
Matrix_RotateY(gGfxMatrix, M_PI / 2, MTXF_APPLY);
Matrix_Translate(gGfxMatrix, -551.0f, 0.0f, 0.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY360, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY360, this) {
gSPDisplayList(gMasterDisp++, D_VE2_6007650);
}
} else {
Matrix_RotateY(gGfxMatrix, this->obj.rot.y * M_DTOR, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY360, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_SCENERY360, this) {
gSPDisplayList(gMasterDisp++, this->info.dList);
}
}
}
}
}
@@ -1927,7 +1927,7 @@ void Object_DrawAll(s32 cullDirection) {
}
break;
}
FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordCloseChild();
}
}
+2 -1
View File
@@ -2814,7 +2814,8 @@ void Actor_Update(Actor* this) {
}
} else if (this->lockOnTimers[TEAM_ID_FOX] != 0) {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
if (!(gControllerHold[gMainController].button & A_BUTTON) || (rapidFire && (gControllerHold[gMainController].button & A_BUTTON))) {
if (!(gControllerHold[gMainController].button & A_BUTTON) ||
(rapidFire && (gControllerHold[gMainController].button & A_BUTTON))) {
this->lockOnTimers[TEAM_ID_FOX]--;
}
gChargeTimers[0] = 0;
+2 -2
View File
@@ -3933,7 +3933,7 @@ void ActorEvent_Draw(ActorEvent* this) {
gDPSetTextureFilter(gMasterDisp++, G_TF_POINT);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, (s32) this->fwork[15], (s32) this->fwork[16],
(s32) this->fwork[17], 255);
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR_EVENT, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR_EVENT, this) {
gSPDisplayList(gMasterDisp++, sEventActorInfo[this->eventType].dList);
}
gDPSetTextureFilter(gMasterDisp++, G_TF_BILERP);
@@ -3941,7 +3941,7 @@ void ActorEvent_Draw(ActorEvent* this) {
}
default: {
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR_EVENT, this){
CALL_CANCELLABLE_EVENT(ObjectDrawPostSetupEvent, OBJECT_TYPE_ACTOR_EVENT, this) {
if ((this->eventType < EVID_200) && (sEventActorInfo[this->eventType].dList != NULL)) {
gSPDisplayList(gMasterDisp++, sEventActorInfo[this->eventType].dList);
}
+8 -4
View File
@@ -1,13 +1,17 @@
#include "global.h"
void Wipe_Horizontal(s32 frame) {
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(frame), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(SCREEN_WIDTH - frame), 0, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(frame),
SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(SCREEN_WIDTH - frame), 0,
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
}
void Wipe_Vertical(s32 frame) {
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), frame, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), SCREEN_HEIGHT - frame, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0,
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), frame, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), SCREEN_HEIGHT - frame,
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
}
void Wipe_Circular(s32 frame) {
+5 -5
View File
@@ -569,11 +569,11 @@ void Game_Update(void) {
Radio_Draw();
if (gShowHud) {
HUD_Draw();
CALL_CANCELLABLE_EVENT(DrawEdgeArrowsHUDEvent){
CALL_CANCELLABLE_EVENT(DrawEdgeArrowsHUDEvent) {
HUD_EdgeArrows_Update();
}
}
CALL_CANCELLABLE_EVENT(DrawBossHealthHUDEvent){
CALL_CANCELLABLE_EVENT(DrawBossHealthHUDEvent) {
HUD_DrawBossHealth();
}
}
@@ -605,15 +605,15 @@ void Game_Update(void) {
if (!partialFill) {
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0,
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT,
gFillScreenRed, gFillScreenGreen, gFillScreenBlue, gFillScreenAlpha);
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT, gFillScreenRed,
gFillScreenGreen, gFillScreenBlue, gFillScreenAlpha);
}
Audio_dummy_80016A50();
// @port: @event: Call GamePostUpdateEvent
CALL_EVENT(GamePostUpdateEvent);
gLastPathTexScroll = gPathTexScroll;
gLastPathTexScroll = gPathTexScroll;
}
}
+12 -13
View File
@@ -1500,7 +1500,7 @@ void HUD_PauseScreen_Update(void) {
case 3:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0,
OTRGetDimensionFromRightEdge(SCREEN_WIDTH)+1, SCREEN_HEIGHT, 0, 0, 0, 255);
OTRGetDimensionFromRightEdge(SCREEN_WIDTH) + 1, SCREEN_HEIGHT, 0, 0, 0, 255);
gFillScreenAlphaTarget = 0;
@@ -1550,7 +1550,7 @@ void HUD_PauseScreen_Update(void) {
case 4:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0,
OTRGetDimensionFromRightEdge(SCREEN_WIDTH)+1, SCREEN_HEIGHT, 0, 0, 0, 255);
OTRGetDimensionFromRightEdge(SCREEN_WIDTH) + 1, SCREEN_HEIGHT, 0, 0, 0, 255);
if (sPauseScreenTimer[0] < 140) {
break;
}
@@ -1569,7 +1569,7 @@ void HUD_PauseScreen_Update(void) {
case 5:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0,
OTRGetDimensionFromRightEdge(SCREEN_WIDTH)+1, SCREEN_HEIGHT, 0, 0, 0, 255);
OTRGetDimensionFromRightEdge(SCREEN_WIDTH) + 1, SCREEN_HEIGHT, 0, 0, 0, 255);
for (i = 0; i < 6; i++) {
if (gPrevPlanetTeamShields[i] == -1) {
@@ -1791,7 +1791,7 @@ void HUD_RadarMark_Arwing_Draw(s32 colorIdx) {
RCP_SetupDL(&gMasterDisp, SETUPDL_62);
gDPSetPrimColor(gMasterDisp++, 0, 0, arwingMarkColor[colorIdx][0], arwingMarkColor[colorIdx][1],
arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3]);
arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3]);
Matrix_Scale(gGfxMatrix, var_fv1, var_fv2, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aRadarMarkArwingDL);
@@ -1802,7 +1802,7 @@ void HUD_RadarMark_StarWolf_Draw(void) {
gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255);
Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL);
gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL);
}
void HUD_RadarMark_Katt_Draw(void) {
@@ -1894,13 +1894,12 @@ void HUD_RadarMark_Draw(s32 type) {
case RADARMARK_WOLF:
case RADARMARK_LEON:
case RADARMARK_PIGMA:
case RADARMARK_ANDREW:
{ //This won't compile without braces, for some reason.
CALL_CANCELLABLE_EVENT(DrawRadarMarkWolfenEvent) {
HUD_RadarMark_StarWolf_Draw();
}
break;
case RADARMARK_ANDREW: { // This won't compile without braces, for some reason.
CALL_CANCELLABLE_EVENT(DrawRadarMarkWolfenEvent) {
HUD_RadarMark_StarWolf_Draw();
}
break;
}
case RADARMARK_KATT:
HUD_RadarMark_Katt_Draw();
break;
@@ -3618,7 +3617,7 @@ void HUD_VS_Radar(void) {
}
void HUD_SinglePlayer(void) {
CALL_CANCELLABLE_EVENT(DrawRadarHUDEvent){
CALL_CANCELLABLE_EVENT(DrawRadarHUDEvent) {
if (gPlayState != PLAY_PAUSE) {
HUD_Radar();
}
@@ -6260,7 +6259,7 @@ void Venom1_LevelStart2(Player* player) {
player->pos.x += player->vel.x;
player->pos.y += player->vel.y;
gLastPathTexScroll = gPathTexScroll;
gLastPathTexScroll = gPathTexScroll;
gPathTexScroll += player->vel.z;
player->bankAngle = player->rot.z + player->zRotBank + player->zRotBarrelRoll;