Fixed some warning MSVC2003 was giving in /W3 mode

This commit is contained in:
Clownacy 2019-02-23 21:45:57 +00:00
parent d55f72aeaf
commit 01ddc5e923
18 changed files with 43 additions and 43 deletions

View file

@ -140,7 +140,7 @@ void PutBack(int fx, int fy)
for (int y = 0; y < WINDOW_HEIGHT - 240 + 88; y += 88)
{
fillNext = ((fillNext) * 214013 + 2531011);
for (int x = -(fillNext % 149); x < WINDOW_WIDTH; x += 149)
for (int x = -(int)(fillNext % 149); x < WINDOW_WIDTH; x += 149)
{
PutBitmap4(&grcGame, x, y, &rcSkyFiller, SURFACE_ID_LEVEL_BACKGROUND);
}

View file

@ -187,7 +187,7 @@ void ActBossChar_Frog(void)
PlaySoundObject(25, 1);
if (gBoss->direct == 0)
gBoss->xm = -0x200u;
gBoss->xm = -0x200;
else
gBoss->xm = 0x200;

View file

@ -164,7 +164,7 @@ void ActBossChar_Ironhead(void)
gBoss[0].y = gBoss[0].tgt_y + (Random(-1, 1) * 0x200);
if (++gBoss[0].act_wait % 4 == 0)
SetNpChar(4, gBoss[0].x + (Random(-0x80u, 0x80) * 0x200), gBoss[0].y + (Random(-0x40u, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
SetNpChar(4, gBoss[0].x + (Random(-0x80, 0x80) * 0x200), gBoss[0].y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100);
break;
}

View file

@ -286,7 +286,7 @@ void ActBullet_Frontia2(BULLET *bul, int level)
if (bul->xm < 0)
bul->xm = 0x400;
else
bul->xm = -0x400u;
bul->xm = -0x400;
}
break;

View file

@ -237,7 +237,7 @@ void DrawText(FontObject *font_object, SDL_Surface *surface, int x, int y, unsig
for (unsigned int j = 0; j < 3; ++j)
{
const double alpha = pow((font_pixel[j] / 255.0), 1.0 / 1.8); // Gamma correction
surface_pixel[j] = (colours[j] * alpha) + (surface_pixel[j] * (1.0 - alpha)); // Alpha blending
surface_pixel[j] = (unsigned char)((colours[j] * alpha) + (surface_pixel[j] * (1.0 - alpha))); // Alpha blending
}
surface_pixel[3] = 0xFF;
@ -257,7 +257,7 @@ void DrawText(FontObject *font_object, SDL_Surface *surface, int x, int y, unsig
if (alpha)
{
for (unsigned int j = 0; j < 3; ++j)
surface_pixel[j] = (colours[j] * alpha) + (surface_pixel[j] * (1.0 - alpha)); // Alpha blending
surface_pixel[j] = (unsigned char)((colours[j] * alpha) + (surface_pixel[j] * (1.0 - alpha))); // Alpha blending
surface_pixel[3] = 0xFF;
}

View file

@ -666,21 +666,21 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
else
v1 = (long double)(npc->x - gMC.x);
float fx1 = v1;
float fx1 = (float)v1;
if (npc->y <= gMC.y)
v2 = (long double)(gMC.y - npc->y);
else
v2 = (long double)(npc->y - gMC.y);
float fx2 = (long double)npc->hit.back;
float fx2 = (float)npc->hit.back;
if (0.0 == fx1)
fx1 = 1.0;
if (0.0 == fx2)
fx2 = 1.0;
float fy1 = v2;
float fy2 = (long double)npc->hit.top;
float fy1 = (float)v2;
float fy2 = (float)npc->hit.top;
if (fy1 / fx1 <= fy2 / fx2)
{

View file

@ -1522,7 +1522,7 @@ void ActNpc056(NPCHAR *npc)
npc->xm -= 0x10;
if (npc->xm < -0x400)
npc->xm = -0x400u;
npc->xm = -0x400;
if (npc->shock)
npc->x += npc->xm / 2;
@ -1805,7 +1805,7 @@ void ActNpc058(NPCHAR *npc)
if (npc->direct == 0)
{
npc->x = gMC.x + 0x20000;
npc->xm = -0x2FFu;
npc->xm = -0x2FF;
}
else
{

View file

@ -1207,7 +1207,7 @@ void ActNpc068(NPCHAR *npc)
gMC.x += 0x800;
gMC.y -= 0x1000;
gMC.xm = 0x5FF;
gMC.ym = -0x200u;
gMC.ym = -0x200;
gMC.direct = 2;
npc->direct = 2;
}
@ -1215,8 +1215,8 @@ void ActNpc068(NPCHAR *npc)
{
gMC.x -= 0x800;
gMC.y -= 0x1000;
gMC.xm = -0x5FFu;
gMC.ym = -0x200u;
gMC.xm = -0x5FF;
gMC.ym = -0x200;
gMC.direct = 0;
npc->direct = 0;
}
@ -1371,7 +1371,7 @@ void ActNpc069(NPCHAR *npc)
}
if (npc->direct == 0)
npc->xm = -0x100u;
npc->xm = -0x100;
else
npc->xm = 0x100;

View file

@ -730,7 +730,7 @@ void ActNpc110(NPCHAR *npc)
PlaySoundObject(6, 1);
if (npc->direct == 0)
npc->xm = -0x100u;
npc->xm = -0x100;
else
npc->xm = 0x100;
}
@ -1187,7 +1187,7 @@ void ActNpc115(NPCHAR *npc)
npc->direct = 2;
if (npc->direct == 0)
npc->xm = -0x200u;
npc->xm = -0x200;
else
npc->xm = 0x200;
@ -1196,7 +1196,7 @@ void ActNpc115(NPCHAR *npc)
npc->count1 = 0;
npc->ani_no = 4;
npc->act_no = 21;
npc->ym = -0x400u;
npc->ym = -0x400;
npc->xm *= 2;
npc->damage = 5;
PlaySoundObject(102, 1);
@ -1204,7 +1204,7 @@ void ActNpc115(NPCHAR *npc)
else
{
npc->act_no = 21;
npc->ym = -0x400u;
npc->ym = -0x400;
PlaySoundObject(30, 1);
}
}

View file

@ -145,7 +145,7 @@ void ActNpc140(NPCHAR *npc)
npc->ym = -0x5FF;
if (npc->direct == 0)
npc->xm = -0x200u;
npc->xm = -0x200;
else
npc->xm = 0x200;
}
@ -247,7 +247,7 @@ void ActNpc140(NPCHAR *npc)
npc->damage = 0;
for (int i = 0; i < 8; ++i)
SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600u, 0), 0, 0, 0x100);
SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
break;

View file

@ -942,7 +942,7 @@ void ActNpc235(NPCHAR *npc)
npc->direct = 0;
if (npc->direct == 0)
npc->xm = -0x400u;
npc->xm = -0x400;
else
npc->xm = 0x400;

View file

@ -85,7 +85,7 @@ void ActNpc240(NPCHAR *npc)
npc->direct = 0;
if (npc->direct == 0)
npc->xm = -0x200u;
npc->xm = -0x200;
else
npc->xm = 0x200;

View file

@ -806,7 +806,7 @@ void ActNpc267(NPCHAR *npc)
if (npc->act_wait > 20 && npc->act_wait % 3 == 1)
{
const int ym = Random(-0x200u, 0x200);
const int ym = Random(-0x200, 0x200);
const int xm = 4 * Random(0x100, 0x200);
if (npc->direct == 0)

View file

@ -285,7 +285,7 @@ void ActNpc340(NPCHAR *npc)
for (int i = 0; i < 8; ++i)
{
const int x = npc->x + (Random(-0x10u, 0x10) * 0x200);
const int x = npc->x + (Random(-0x10, 0x10) * 0x200);
SetNpChar(4, x, npc->y + 0x1400, 0, 0, 0, 0, 0x100);
}
@ -1122,7 +1122,7 @@ void ActNpc347(NPCHAR *npc)
case 12:
if (gMC.y < npc->y)
npc->ym = -0xAAu;
npc->ym = -0xAA;
else
npc->ym = 0xAA;

View file

@ -163,7 +163,7 @@ void ChangeOrganFrequency(uint8_t key, uint8_t track, int32_t a)
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 2; i++) {
int64_t tmpDouble = ((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000);
uint32_t tmpDouble = ((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000);
lpORGANBUFFER[track][j][i]->SetFrequency(tmpDouble);
}
}

View file

@ -15,7 +15,7 @@ void MakeWaveTables(void)
// Sine wave
for (i = 0; i < 256; ++i)
{
gWaveModelTable[0][i] = (sin(i * 6.283184 / 256.0) * 64.0);
gWaveModelTable[0][i] = (signed char)(sin(i * 6.283184 / 256.0) * 64.0);
a = gWaveModelTable[0][i];
}
@ -64,7 +64,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
// The Linux port added a cute optimisation here, where MakeWaveTables is only called once during the game's execution
MakeWaveTables();
char envelopeTable[0x100];
signed char envelopeTable[0x100];
memset(envelopeTable, 0, 0x100);
int i = 0;
@ -73,7 +73,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
dEnvelope = ptp->initial;
while (i < ptp->pointAx)
{
envelopeTable[i] = dEnvelope;
envelopeTable[i] = (signed char)dEnvelope;
dEnvelope = ((double)ptp->pointAy - ptp->initial) / ptp->pointAx + dEnvelope;
++i;
}
@ -81,7 +81,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
dEnvelope = ptp->pointAy;
while (i < ptp->pointBx)
{
envelopeTable[i] = dEnvelope;
envelopeTable[i] = (signed char)dEnvelope;
dEnvelope = ((double)ptp->pointBy - ptp->pointAy) / (double)(ptp->pointBx - ptp->pointAx) + dEnvelope;
++i;
}
@ -89,7 +89,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
dEnvelope = ptp->pointBy;
while (i < ptp->pointCx)
{
envelopeTable[i] = dEnvelope;
envelopeTable[i] = (signed char)dEnvelope;
dEnvelope = ((double)ptp->pointCy - ptp->pointBy) / (double)(ptp->pointCx - ptp->pointBx) + dEnvelope;
++i;
}
@ -97,7 +97,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
dEnvelope = ptp->pointCy;
while (i < 256)
{
envelopeTable[i] = dEnvelope;
envelopeTable[i] = (signed char)dEnvelope;
dEnvelope = (double)dEnvelope - ptp->pointCy / (double)(256 - ptp->pointCx);
++i;
}
@ -130,7 +130,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
const int a = (int)dMain % 256;
const int b = (int)dPitch % 256;
const int c = (int)dVolume % 256;
const int d = (double)(i * 0x100) / ptp->size;
const int d = (int)((double)(i * 0x100) / ptp->size);
pData[i] = gWaveModelTable[ptp->oMain.model][a]
* ptp->oMain.top
/ 64

View file

@ -115,7 +115,7 @@ float MillibelToVolume(int32_t lVolume)
{
//Volume is in hundredths of decibels, from 0 to -10000
lVolume = clamp(lVolume, (int32_t)-10000, (int32_t)0);
return pow(10.0, lVolume / 2000.0);
return (float)pow(10.0, lVolume / 2000.0);
}
void SOUNDBUFFER::SetVolume(int32_t lVolume)
@ -158,19 +158,19 @@ void SOUNDBUFFER::Mix(float (*buffer)[2], size_t samples)
const double freqPosition = frequency / FREQUENCY; //This is added to position at the end
//Get the in-between sample this is (linear interpolation)
const float sample1 = ((looped || ((size_t)samplePosition) >= 1) ? data[(size_t)samplePosition] : 0x80);
const float sample2 = ((looping || (((size_t)samplePosition) + 1) < size) ? data[(((size_t)samplePosition) + 1) % size] : 0x80);
const float sample1 = ((looped || ((size_t)samplePosition) >= 1) ? data[(size_t)samplePosition] : 128.0f);
const float sample2 = ((looping || (((size_t)samplePosition) + 1) < size) ? data[(((size_t)samplePosition) + 1) % size] : 128.0f);
//Interpolate sample
const float subPos = std::fmod(samplePosition, 1.0);
const float subPos = (float)std::fmod(samplePosition, 1.0);
const float sampleA = sample1 + (sample2 - sample1) * subPos;
//Convert sample to float32
const float sampleConvert = (sampleA - 128.0f) / 128.0f;
//Mix
buffer[sample][0] += sampleConvert * volume * volume_l;
buffer[sample][1] += sampleConvert * volume * volume_r;
buffer[sample][0] += (float)(sampleConvert * volume * volume_l);
buffer[sample][1] += (float)(sampleConvert * volume * volume_r);
//Increment position
samplePosition += freqPosition;
@ -305,7 +305,7 @@ void ChangeSoundPan(int no, int32_t pan)
size_t MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no)
{
size_t sample_count = 0;
int sample_count = 0;
for (int i = 0; i < ptp_num; ++i)
{
if (ptp[i].size > sample_count)

View file

@ -19,7 +19,7 @@ void InitTriangleTable()
//Tangent
for (i = 0; i < 0x21; ++i)
{
float a = i * 6.2831855 / 256.0;
float a = (float)(i * 6.2831855 / 256.0);
float b = sinf(a) / cosf(a);
gTan[i] = (int16_t)(b * 8192.0);
}