Fix some errors and prevent some GCC warnings
This commit is contained in:
parent
bedae97796
commit
ee88e805b3
19 changed files with 34 additions and 50 deletions
|
@ -51,6 +51,7 @@ void ActBoss01_34()
|
|||
{
|
||||
case 0:
|
||||
gBoss[i].act_no = 1;
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (i == 3)
|
||||
gBoss[i].x = gBoss[0].x - 0x2000;
|
||||
|
@ -150,6 +151,7 @@ void ActBossChar_Omega()
|
|||
gBoss[0].act_no = 30;
|
||||
gBoss[0].act_wait = 0;
|
||||
gBoss[0].ani_no = 0;
|
||||
// Fallthrough
|
||||
case 30:
|
||||
SetQuake(2);
|
||||
gBoss[0].y -= 0x200;
|
||||
|
|
|
@ -915,7 +915,7 @@ void ActBullet_Bom(BULLET *bul, int level)
|
|||
}
|
||||
|
||||
PlaySoundObject(44, 1);
|
||||
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (level == 1)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ void InitCaret()
|
|||
|
||||
void ActCaret00(CARET *crt)
|
||||
{
|
||||
;
|
||||
(void)crt;
|
||||
}
|
||||
|
||||
void ActCaret01(CARET *crt)
|
||||
|
|
|
@ -145,9 +145,9 @@ static void FlushSurface(int surf_no)
|
|||
unsigned char (*src_pixels)[surf[surf_no].surface->pitch / 4][4] = (unsigned char (*)[surf[surf_no].surface->pitch/ 4][4])surf[surf_no].surface->pixels;
|
||||
unsigned char (*dst_pixels)[pitch / 4][4] = (unsigned char (*)[pitch/ 4][4])raw_pixels;
|
||||
|
||||
for (unsigned int h = 0; h < surf[surf_no].surface->h; ++h)
|
||||
for (int h = 0; h < surf[surf_no].surface->h; ++h)
|
||||
{
|
||||
for (unsigned int w = 0; w < surf[surf_no].surface->w; ++w)
|
||||
for (int w = 0; w < surf[surf_no].surface->w; ++w)
|
||||
{
|
||||
dst_pixels[h][w][0] = src_pixels[h][w][0];
|
||||
dst_pixels[h][w][1] = src_pixels[h][w][1];
|
||||
|
|
|
@ -58,7 +58,7 @@ static unsigned long UTF8ToCode(const unsigned char *string, unsigned int *bytes
|
|||
case 3:
|
||||
case 4:
|
||||
length = zero_bit;
|
||||
charcode = string[0] & (1 << (8 - zero_bit)) - 1;
|
||||
charcode = (string[0] & (1 << (8 - zero_bit))) - 1;
|
||||
|
||||
for (unsigned int i = 1; i < zero_bit; ++i)
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ void DrawText(FontObject *font_object, SDL_Surface *surface, int x, int y, unsig
|
|||
const int letter_x = x + pen_x + face->glyph->bitmap_left;
|
||||
const int letter_y = y + ((FT_MulFix(face->ascender, face->size->metrics.y_scale) - face->glyph->metrics.horiBearingY + (64 / 2)) / 64);
|
||||
|
||||
for (int iy = MAX(-letter_y, 0); letter_y + iy < MIN(letter_y + converted.rows, surface->h); ++iy)
|
||||
for (int iy = MAX(-letter_y, 0); letter_y + iy < MIN(letter_y + converted.rows, (unsigned int)surface->h); ++iy)
|
||||
{
|
||||
if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "NpChar.h"
|
||||
#include "Game.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Boss.h"
|
||||
|
||||
FRAME gFrame;
|
||||
|
||||
|
@ -127,8 +128,8 @@ void SetFrameTargetNpChar(int event, int wait)
|
|||
|
||||
void SetFrameTargetBoss(int no, int wait)
|
||||
{
|
||||
//gFrame.tgt_x = &gBoss[no].x;
|
||||
//gFrame.tgt_y = &gBoss[no].y;
|
||||
gFrame.tgt_x = &gBoss[no].x;
|
||||
gFrame.tgt_y = &gBoss[no].y;
|
||||
gFrame.wait = wait;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void PutNumber4(int x, int y, int value, bool bZero)
|
|||
}
|
||||
|
||||
//Draw digit
|
||||
if ( bZero && offset == 2 || sw != 0 || offset == 3 )
|
||||
if ((bZero && offset == 2) || sw != 0 || offset == 3 )
|
||||
PutBitmap3(&rcClient, x + 8 * offset, y, &rect[a], SURFACE_ID_TEXT_BOX);
|
||||
|
||||
//Go to next digit
|
||||
|
@ -119,7 +119,7 @@ int ModeOpening()
|
|||
|
||||
CutNoise();
|
||||
|
||||
int wait = 0;
|
||||
unsigned int wait = 0;
|
||||
while (wait < 500)
|
||||
{
|
||||
//Increase timer
|
||||
|
@ -295,7 +295,7 @@ int ModeTitle()
|
|||
gMC.equip |= 0x100;
|
||||
|
||||
//Start loop
|
||||
int wait = 0;
|
||||
unsigned int wait = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
@ -414,7 +414,7 @@ void ActNpc005(NPCHAR *npc)
|
|||
case 0: //Init
|
||||
npc->y += 0x600;
|
||||
npc->act_no = 1;
|
||||
|
||||
// Fallthrough
|
||||
case 1: //Waiting
|
||||
//Look at player
|
||||
if (npc->x <= gMC.x)
|
||||
|
|
|
@ -52,7 +52,7 @@ void ActNpc021(NPCHAR *npc)
|
|||
break;
|
||||
}
|
||||
|
||||
RECT rect[0];
|
||||
RECT rect[1];
|
||||
|
||||
rect[0] = {224, 40, 240, 48};
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ void ActNpc040(NPCHAR *npc)
|
|||
npc->act_no = 1;
|
||||
npc->ani_no = 0;
|
||||
npc->ani_wait = 0;
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (Random(0, 120) == 10)
|
||||
{
|
||||
|
@ -65,6 +66,7 @@ void ActNpc040(NPCHAR *npc)
|
|||
npc->act_no = 4;
|
||||
npc->ani_no = 2;
|
||||
npc->ani_wait = 0;
|
||||
// Fallthrough
|
||||
case 4:
|
||||
if (++npc->ani_wait > 4)
|
||||
{
|
||||
|
|
|
@ -639,7 +639,7 @@ void ActNpc064(NPCHAR *npc)
|
|||
case 0: //Init
|
||||
npc->y += 0x600;
|
||||
npc->act_no = 1;
|
||||
|
||||
// Fallthrough
|
||||
case 1: //Waiting
|
||||
//Look at player
|
||||
if (npc->x <= gMC.x)
|
||||
|
|
|
@ -793,6 +793,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
for (int i = 0; i < 4; i++)
|
||||
SetNpChar(4, npc->x, npc->y, Random(-0x155, 0x155), Random(-0x600, 0), 0, 0, 0x100);
|
||||
PlaySoundObject(71, 1);
|
||||
// Fallthrough
|
||||
case 11:
|
||||
npc->ani_no = 2;
|
||||
break;
|
||||
|
@ -800,6 +801,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->act_no = 21;
|
||||
npc->act_wait = 64;
|
||||
PlaySoundObject(29, 1);
|
||||
// Fallthrough
|
||||
case 21:
|
||||
if (!--npc->act_wait)
|
||||
npc->cond = 0;
|
||||
|
@ -808,6 +810,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->act_no = 51;
|
||||
npc->ani_no = 3;
|
||||
npc->ani_wait = 0;
|
||||
// Fallthrough
|
||||
case 51:
|
||||
if (++npc->ani_wait > 4)
|
||||
{
|
||||
|
@ -827,6 +830,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->ani_no = 7;
|
||||
npc->tgt_x = npc->x;
|
||||
npc->tgt_y = npc->y;
|
||||
// Fallthrough
|
||||
case 61:
|
||||
npc->tgt_y += 0x100;
|
||||
npc->x = npc->tgt_x + (Random(-1, 1) << 9);
|
||||
|
@ -837,6 +841,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->act_wait = 0;
|
||||
npc->ani_no = 3;
|
||||
npc->ani_wait = 0;
|
||||
// Fallthrough
|
||||
case 0x47:
|
||||
if ( npc->direct )
|
||||
npc->x -= 0x100;
|
||||
|
@ -859,6 +864,7 @@ void ActNpc150(NPCHAR *npc)
|
|||
npc->act_no = 101;
|
||||
npc->ani_no = 3;
|
||||
npc->ani_wait = 0;
|
||||
// Fallthrough
|
||||
case 101:
|
||||
npc->ym += 0x40;
|
||||
if (npc->ym > 0x5FF)
|
||||
|
|
|
@ -34,5 +34,5 @@ void ActNpc219(NPCHAR *npc)
|
|||
else if (Random(0, 40) == 1)
|
||||
SetNpChar(4, npc->x + (Random(-20, 20) * 0x200), npc->y, 0, -0x200, 0, 0, 0x100);
|
||||
|
||||
npc->rect = rc[1];
|
||||
npc->rect = rc[0];
|
||||
}
|
|
@ -13,6 +13,8 @@
|
|||
//Quake
|
||||
void ActNpc292(NPCHAR *npc)
|
||||
{
|
||||
(void)npc;
|
||||
|
||||
SetQuake(10);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ bool LoadNpcTable(const char *path)
|
|||
|
||||
const size_t tblSize = SDL_RWsize(fp);
|
||||
|
||||
const int npcCount = tblSize / 0x18;
|
||||
const size_t npcCount = tblSize / 0x18;
|
||||
gNpcTable = (NPC_TABLE*)malloc(npcCount * sizeof(NPC_TABLE));
|
||||
|
||||
for (size_t i = 0; i < npcCount; i++) //bits
|
||||
|
|
|
@ -123,7 +123,7 @@ bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi)
|
|||
uint8_t *wp_sub = wp;
|
||||
size_t wav_tp = 0;
|
||||
|
||||
for (int i = 0; i < data_size; i++)
|
||||
for (size_t i = 0; i < data_size; i++)
|
||||
{
|
||||
uint8_t work = *(wavep+wav_tp);
|
||||
work += 0x80;
|
||||
|
|
|
@ -76,18 +76,12 @@ SOUNDBUFFER::~SOUNDBUFFER()
|
|||
|
||||
void SOUNDBUFFER::Release()
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
//TODO: find a better and more stable(?) way to handle this function
|
||||
delete this;
|
||||
}
|
||||
|
||||
void SOUNDBUFFER::Lock(uint8_t **outBuffer, size_t *outSize)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
|
||||
if (outBuffer != nullptr)
|
||||
|
@ -99,17 +93,11 @@ void SOUNDBUFFER::Lock(uint8_t **outBuffer, size_t *outSize)
|
|||
|
||||
void SOUNDBUFFER::Unlock()
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
}
|
||||
|
||||
void SOUNDBUFFER::SetCurrentPosition(uint32_t dwNewPosition)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
samplePosition = dwNewPosition;
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
|
@ -117,9 +105,6 @@ void SOUNDBUFFER::SetCurrentPosition(uint32_t dwNewPosition)
|
|||
|
||||
void SOUNDBUFFER::SetFrequency(uint32_t dwFrequency)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
frequency = (double)dwFrequency;
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
|
@ -134,9 +119,6 @@ float MillibelToVolume(int32_t lVolume)
|
|||
|
||||
void SOUNDBUFFER::SetVolume(int32_t lVolume)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
volume = MillibelToVolume(lVolume);
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
|
@ -144,9 +126,6 @@ void SOUNDBUFFER::SetVolume(int32_t lVolume)
|
|||
|
||||
void SOUNDBUFFER::SetPan(int32_t lPan)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
volume_l = MillibelToVolume(-lPan);
|
||||
volume_r = MillibelToVolume(lPan);
|
||||
|
@ -155,9 +134,6 @@ void SOUNDBUFFER::SetPan(int32_t lPan)
|
|||
|
||||
void SOUNDBUFFER::Play(bool bLooping)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
playing = true;
|
||||
looping = bLooping;
|
||||
|
@ -166,9 +142,6 @@ void SOUNDBUFFER::Play(bool bLooping)
|
|||
|
||||
void SOUNDBUFFER::Stop()
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
SDL_LockAudioDevice(audioDevice);
|
||||
playing = false;
|
||||
SDL_UnlockAudioDevice(audioDevice);
|
||||
|
@ -176,9 +149,6 @@ void SOUNDBUFFER::Stop()
|
|||
|
||||
void SOUNDBUFFER::Mix(float (*buffer)[2], size_t samples)
|
||||
{
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
if (!playing) //This sound buffer isn't playing
|
||||
return;
|
||||
|
||||
|
@ -225,6 +195,8 @@ void SOUNDBUFFER::Mix(float (*buffer)[2], size_t samples)
|
|||
//Sound mixer
|
||||
void AudioCallback(void *userdata, uint8_t *stream, int len)
|
||||
{
|
||||
(void)userdata;
|
||||
|
||||
float (*buffer)[2] = (float(*)[2])stream;
|
||||
const size_t samples = len / (sizeof(float) * 2);
|
||||
|
||||
|
|
|
@ -521,7 +521,6 @@ int TextScriptProc()
|
|||
else if (gTS.flags & 0x10)
|
||||
{
|
||||
//SAT/CAT/TUR printing
|
||||
x;
|
||||
for (x = gTS.p_read; ; x++)
|
||||
{
|
||||
//Break if reaches command, or new-line
|
||||
|
|
|
@ -21,7 +21,7 @@ void SetValueView(int *px, int *py, int value)
|
|||
int i;
|
||||
|
||||
//TODO: Boi I'm reaaaally boutta getcho pickle chin aah boi, egg head like collard greens head ass boi, ol' hell dat bell dirt aaah boi stank ah boi afro head ass, lip gloss chin ah boi ugly ahhh boi *snort* uglaaaa
|
||||
for (i = 0; i < VALUEVIEW_MAX && (!gVV[i].flag || gVV[i].px != px || (gVV[i].value >= 0 || value >= 0) && (gVV[i].value <= 0 || value <= 0)); i++);
|
||||
for (i = 0; i < VALUEVIEW_MAX && (!gVV[i].flag || gVV[i].px != px || ((gVV[i].value >= 0 || value >= 0) && (gVV[i].value <= 0 || value <= 0))); i++);
|
||||
|
||||
int index;
|
||||
if (i == VALUEVIEW_MAX)
|
||||
|
|
Loading…
Add table
Reference in a new issue