Made PixTone.cpp ASM-accurate
I DID IT, SQUIDWARD But really, that was annoying to figure out. Even though I already know the way the stack frame is sorted has something to do with alphabetical order, it's still affected by the order of declaration too.
This commit is contained in:
parent
ddaf7fc8bb
commit
f3a2c96ce6
1 changed files with 23 additions and 15 deletions
|
@ -61,14 +61,26 @@ void MakeWaveTables(void)
|
||||||
|
|
||||||
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
double dEnvelope;
|
||||||
|
double dPitch;
|
||||||
|
double dMain;
|
||||||
|
double dVolume;
|
||||||
|
double d1;
|
||||||
|
double d2;
|
||||||
|
double d3;
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
int c;
|
||||||
|
int d;
|
||||||
|
signed char envelopeTable[0x100];
|
||||||
|
|
||||||
// The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution
|
// The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution
|
||||||
MakeWaveTables();
|
MakeWaveTables();
|
||||||
|
|
||||||
signed char envelopeTable[0x100];
|
memset(envelopeTable, 0, sizeof(envelopeTable));
|
||||||
memset(envelopeTable, 0, 0x100);
|
|
||||||
|
|
||||||
int i = 0;
|
i = 0;
|
||||||
double dEnvelope;
|
|
||||||
|
|
||||||
dEnvelope = ptp->initial;
|
dEnvelope = ptp->initial;
|
||||||
while (i < ptp->pointAx)
|
while (i < ptp->pointAx)
|
||||||
|
@ -102,13 +114,9 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
double dPitch = ptp->oPitch.offset;
|
dPitch = ptp->oPitch.offset;
|
||||||
double dMain = ptp->oMain.offset;
|
dMain = ptp->oMain.offset;
|
||||||
double dVolume = ptp->oVolume.offset;
|
dVolume = ptp->oVolume.offset;
|
||||||
|
|
||||||
double d1;
|
|
||||||
double d2;
|
|
||||||
double d3;
|
|
||||||
|
|
||||||
if (ptp->oMain.num == 0.0)
|
if (ptp->oMain.num == 0.0)
|
||||||
d1 = 0.0;
|
d1 = 0.0;
|
||||||
|
@ -127,10 +135,10 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
||||||
|
|
||||||
for (i = 0; i < ptp->size; ++i)
|
for (i = 0; i < ptp->size; ++i)
|
||||||
{
|
{
|
||||||
const int a = (int)dMain % 256;
|
a = (int)dMain % 256;
|
||||||
const int b = (int)dPitch % 256;
|
b = (int)dPitch % 256;
|
||||||
const int c = (int)dVolume % 256;
|
c = (int)dVolume % 256;
|
||||||
const int d = (int)((double)(i * 0x100) / ptp->size);
|
d = (int)((double)(i * 0x100) / ptp->size);
|
||||||
pData[i] = gWaveModelTable[ptp->oMain.model][a]
|
pData[i] = gWaveModelTable[ptp->oMain.model][a]
|
||||||
* ptp->oMain.top
|
* ptp->oMain.top
|
||||||
/ 64
|
/ 64
|
||||||
|
|
Loading…
Add table
Reference in a new issue