This commit is contained in:
cuckydev 2019-02-09 23:07:23 -05:00
parent 767c2972ae
commit 1e748f9406
5 changed files with 34 additions and 18 deletions

View file

@ -50,7 +50,7 @@ bool bContinue;
int Random(int min, int max)
{
return min + rand() % (max - min + 1);
return min + rep_rand() % (max - min + 1);
}
void PutNumber4(int x, int y, int value, bool bZero)

View file

@ -47,13 +47,13 @@ const char *lpWindowName = "Cave Story Engine 2 ~ Doukutsu Monogatari Enjin 2";
//A replication of MSVC's rand algorithm
static unsigned long int next = 1;
int _rand()
int rep_rand()
{
next = ((next) * 214013 + 2531011);
return ((next) >> 16) & 0x7FFF;
}
void _srand(unsigned int seed)
void rep_srand(unsigned int seed)
{
next = seed;
}

View file

@ -46,9 +46,9 @@ void MakeWaveTables()
gWaveModelTable[4][i] = -0x40;
/* White noise wave */
srand(0);
rep_srand(0);
for (int i = 0; i < 0x100; i++)
gWaveModelTable[5][i] = (int8_t)rand() / 2;
gWaveModelTable[5][i] = (int8_t)rep_rand() / 2;
}
//Loading .pxt files

View file

@ -43,7 +43,7 @@ void SetValueView(int *px, int *py, int value)
//Get if negative or not
bool minus;
if ( value >= 0 )
if (value >= 0)
{
minus = false;
}
@ -85,6 +85,28 @@ void SetValueView(int *px, int *py, int value)
gVV[index].rect.right = 40;
gVV[index].rect.bottom = 8 * (index + 1);
RECT rect[20];
rect[0] = {0, 56, 8, 64};
rect[1] = {8, 56, 16, 64};
rect[2] = {16, 56, 24, 64};
rect[3] = {24, 56, 32, 64};
rect[4] = {32, 56, 40, 64};
rect[5] = {40, 56, 48, 64};
rect[6] = {48, 56, 56, 64};
rect[7] = {56, 56, 64, 64};
rect[8] = {64, 56, 72, 64};
rect[9] = {72, 56, 80, 64};
rect[10] = {0, 64, 8, 72};
rect[11] = {8, 64, 16, 72};
rect[12] = {16, 64, 24, 72};
rect[13] = {24, 64, 32, 72};
rect[14] = {32, 64, 40, 72};
rect[15] = {40, 64, 48, 72};
rect[16] = {48, 64, 56, 72};
rect[17] = {56, 64, 64, 72};
rect[18] = {64, 64, 72, 72};
rect[19] = {72, 64, 80, 72};
//Get digits
int dig[4];
dig[0] = 1;
@ -103,7 +125,7 @@ void SetValueView(int *px, int *py, int value)
}
}
int sw = 0;
bool sw = false;
RECT rcPlus = {32, 48, 40, 56};
RECT rcMinus = {40, 48, 48, 56};
@ -120,15 +142,12 @@ void SetValueView(int *px, int *py, int value)
{
if (sw || !i || fig[i])
{
sw = 1;
sw = true;
RECT rect;
if (minus)
rect = {fig[i] << 3, 64, (fig[i] + 1) << 3, 72};
else
rect = {fig[i] << 3, 56, (fig[i] + 1) << 3, 64};
fig[i] += 10;
Surface2Surface(8 * (4 - i), gVV[index].rect.top, &rect, 29, 26);
Surface2Surface(8 * (4 - i), gVV[index].rect.top, &rect[fig[i]], 29, 26);
}
}
}

View file

@ -1,9 +1,6 @@
#pragma once
#define rand _rand
#define srand _srand
int _rand();
void _srand(unsigned int seed);
int rep_rand();
void rep_srand(unsigned int seed);
typedef int BOOL;