1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Add asserts for missing images and sound effects

I don't want to add too many asserts, because sometimes it's okay if a
file is missing (mmmmmm.vvv). But currently, the game basically expects
all images and sound effects to be present. That might change in the
future, but for now, these asserts are okay.
This commit is contained in:
Misa 2021-04-18 10:58:28 -07:00 committed by Ethan Lee
parent 9f11438dcc
commit 3102cac9d9
2 changed files with 6 additions and 0 deletions

View file

@ -37,6 +37,11 @@ static SDL_Surface* LoadImage(const char *filename, bool noBlend = true, bool no
unsigned char *fileIn;
size_t length;
FILESYSTEM_loadAssetToMemory(filename, &fileIn, &length, false);
if (fileIn == NULL)
{
SDL_assert(0 && "Image file missing!");
return NULL;
}
if (noAlpha)
{
lodepng_decode24(&data, &width, &height, fileIn, length);

View file

@ -38,6 +38,7 @@ SoundTrack::SoundTrack(const char* fileName)
if (mem == NULL)
{
fprintf(stderr, "Unable to load WAV file %s\n", fileName);
SDL_assert(0 && "WAV file missing!");
return;
}
SDL_RWops *fileIn = SDL_RWFromConstMem(mem, length);