mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Only re-color one-ways if assets are not mounted
Some levels (like Unshackled) have decided to manually re-color the one-way tiles on their own, and us overriding their re-color is not something they would want. This does mean custom levels with custom assets don't get to take advantage of the re-color, but it's the exact same behavior as before, so it shouldn't really matter that much. I would've liked to specifically detect if a custom tiles.png or tiles2.png was in play, rather than simply disabling it if any asset was mounted, but it seems that detecting if a specific file was mounted from a specific zip isn't really PHYSFS's strong suit.
This commit is contained in:
parent
d610e2dae3
commit
2d21bab4ea
3 changed files with 12 additions and 4 deletions
|
@ -165,6 +165,8 @@ void FILESYSTEM_mount(const char *fname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FILESYSTEM_assetsmounted = false;
|
||||||
|
|
||||||
void FILESYSTEM_mountassets(const char* path)
|
void FILESYSTEM_mountassets(const char* path)
|
||||||
{
|
{
|
||||||
const std::string _path(path);
|
const std::string _path(path);
|
||||||
|
@ -182,6 +184,7 @@ void FILESYSTEM_mountassets(const char* path)
|
||||||
printf("Custom asset directory exists at %s\n", zippath.c_str());
|
printf("Custom asset directory exists at %s\n", zippath.c_str());
|
||||||
FILESYSTEM_mount(zippath.c_str());
|
FILESYSTEM_mount(zippath.c_str());
|
||||||
graphics.reloadresources();
|
graphics.reloadresources();
|
||||||
|
FILESYSTEM_assetsmounted = true;
|
||||||
} else if (zip_path != "data.zip" && !endsWith(zip_path, "/data.zip") && endsWith(zip_path, ".zip")) {
|
} else if (zip_path != "data.zip" && !endsWith(zip_path, "/data.zip") && endsWith(zip_path, ".zip")) {
|
||||||
printf("Custom asset directory is .zip at %s\n", zip_path.c_str());
|
printf("Custom asset directory is .zip at %s\n", zip_path.c_str());
|
||||||
PHYSFS_File* zip = PHYSFS_openRead(zip_path.c_str());
|
PHYSFS_File* zip = PHYSFS_openRead(zip_path.c_str());
|
||||||
|
@ -193,13 +196,16 @@ void FILESYSTEM_mountassets(const char* path)
|
||||||
} else {
|
} else {
|
||||||
graphics.assetdir = zip_path;
|
graphics.assetdir = zip_path;
|
||||||
}
|
}
|
||||||
|
FILESYSTEM_assetsmounted = true;
|
||||||
graphics.reloadresources();
|
graphics.reloadresources();
|
||||||
} else if (FILESYSTEM_directoryExists(dirpath.c_str())) {
|
} else if (FILESYSTEM_directoryExists(dirpath.c_str())) {
|
||||||
printf("Custom asset directory exists at %s\n",dirpath.c_str());
|
printf("Custom asset directory exists at %s\n",dirpath.c_str());
|
||||||
FILESYSTEM_mount(dirpath.c_str());
|
FILESYSTEM_mount(dirpath.c_str());
|
||||||
graphics.reloadresources();
|
graphics.reloadresources();
|
||||||
|
FILESYSTEM_assetsmounted = true;
|
||||||
} else {
|
} else {
|
||||||
printf("Custom asset directory does not exist\n");
|
printf("Custom asset directory does not exist\n");
|
||||||
|
FILESYSTEM_assetsmounted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +222,7 @@ void FILESYSTEM_unmountassets()
|
||||||
{
|
{
|
||||||
printf("Cannot unmount when no asset directory is mounted\n");
|
printf("Cannot unmount when no asset directory is mounted\n");
|
||||||
}
|
}
|
||||||
|
FILESYSTEM_assetsmounted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FILESYSTEM_loadFileToMemory(
|
void FILESYSTEM_loadFileToMemory(
|
||||||
|
|
|
@ -15,6 +15,7 @@ char *FILESYSTEM_getUserLevelDirectory();
|
||||||
|
|
||||||
bool FILESYSTEM_directoryExists(const char *fname);
|
bool FILESYSTEM_directoryExists(const char *fname);
|
||||||
void FILESYSTEM_mount(const char *fname);
|
void FILESYSTEM_mount(const char *fname);
|
||||||
|
extern bool FILESYSTEM_assetsmounted;
|
||||||
void FILESYSTEM_mountassets(const char *path);
|
void FILESYSTEM_mountassets(const char *path);
|
||||||
void FILESYSTEM_unmountassets();
|
void FILESYSTEM_unmountassets();
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ void Graphics::drawtile( int x, int y, int t )
|
||||||
SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h };
|
SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h };
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if (t >= 14 && t <= 17)
|
if (t >= 14 && t <= 17 && !FILESYSTEM_assetsmounted)
|
||||||
{
|
{
|
||||||
colourTransform thect = {ed.getonewaycol()};
|
colourTransform thect = {ed.getonewaycol()};
|
||||||
BlitSurfaceTinted(tiles[t], NULL, backBuffer, &rect, thect);
|
BlitSurfaceTinted(tiles[t], NULL, backBuffer, &rect, thect);
|
||||||
|
@ -663,7 +663,7 @@ void Graphics::drawtile2( int x, int y, int t )
|
||||||
SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h };
|
SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h };
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if (t >= 14 && t <= 17)
|
if (t >= 14 && t <= 17 && !FILESYSTEM_assetsmounted)
|
||||||
{
|
{
|
||||||
colourTransform thect = {ed.getonewaycol()};
|
colourTransform thect = {ed.getonewaycol()};
|
||||||
BlitSurfaceTinted(tiles2[t], NULL, backBuffer, &rect, thect);
|
BlitSurfaceTinted(tiles2[t], NULL, backBuffer, &rect, thect);
|
||||||
|
@ -3119,7 +3119,7 @@ void Graphics::drawforetile(int x, int y, int t)
|
||||||
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
|
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if (t >= 14 && t <= 17)
|
if (t >= 14 && t <= 17 && !FILESYSTEM_assetsmounted)
|
||||||
{
|
{
|
||||||
colourTransform thect = {ed.getonewaycol()};
|
colourTransform thect = {ed.getonewaycol()};
|
||||||
BlitSurfaceTinted(tiles[t], NULL, foregroundBuffer, &rect, thect);
|
BlitSurfaceTinted(tiles[t], NULL, foregroundBuffer, &rect, thect);
|
||||||
|
@ -3142,7 +3142,7 @@ void Graphics::drawforetile2(int x, int y, int t)
|
||||||
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
|
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if (t >= 14 && t <= 17)
|
if (t >= 14 && t <= 17 && !FILESYSTEM_assetsmounted)
|
||||||
{
|
{
|
||||||
colourTransform thect = {ed.getonewaycol()};
|
colourTransform thect = {ed.getonewaycol()};
|
||||||
BlitSurfaceTinted(tiles2[t], NULL, foregroundBuffer, &rect, thect);
|
BlitSurfaceTinted(tiles2[t], NULL, foregroundBuffer, &rect, thect);
|
||||||
|
|
Loading…
Reference in a new issue