Compare commits

..

No commits in common. "769f99f590569d4984c87468fa30a54a50dbcec8" and "89886e6c520e22ff3e2c1e0207bb891ad8ee69d8" have entirely different histories.

15 changed files with 161 additions and 141 deletions

View File

@ -117,7 +117,6 @@ SET(VVV_SRC
src/XMLUtils.cpp
src/main.cpp
src/Network.c
src/ThirdPartyDeps.c
)
IF(NOT CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED")
LIST(APPEND VVV_SRC src/editor.cpp)
@ -233,8 +232,6 @@ ADD_LIBRARY(tinyxml2-static STATIC ${XML2_SRC})
ADD_LIBRARY(physfs-static STATIC ${PFS_SRC} ${PFSP_SRC})
ADD_LIBRARY(lodepng-static STATIC ${PNG_SRC})
TARGET_COMPILE_DEFINITIONS(lodepng-static PRIVATE -DLODEPNG_NO_COMPILE_ALLOCATORS)
# Static Dependencies
TARGET_LINK_LIBRARIES(VVVVVV physfs-static tinyxml2-static lodepng-static)

View File

@ -235,7 +235,7 @@ void FILESYSTEM_loadFileToMemory(
size_t *len,
bool addnull
) {
if (SDL_strcmp(name, "levels/special/stdin.vvvvvv") == 0)
if (strcmp(name, "levels/special/stdin.vvvvvv") == 0)
{
// this isn't *technically* necessary when piping directly from a file, but checking for that is annoying
static std::vector<char> STDIN_BUFFER;
@ -255,7 +255,7 @@ void FILESYSTEM_loadFileToMemory(
}
++length;
*mem = static_cast<unsigned char*>(SDL_malloc(length)); // STDIN_BUFFER.data() causes double-free
*mem = static_cast<unsigned char*>(malloc(length)); // STDIN_BUFFER.data() causes double-free
std::copy(STDIN_BUFFER.begin(), STDIN_BUFFER.end(), reinterpret_cast<char*>(*mem));
return;
}
@ -272,12 +272,12 @@ void FILESYSTEM_loadFileToMemory(
}
if (addnull)
{
*mem = (unsigned char *) SDL_malloc(length + 1);
*mem = (unsigned char *) malloc(length + 1);
(*mem)[length] = 0;
}
else
{
*mem = (unsigned char*) SDL_malloc(length);
*mem = (unsigned char*) malloc(length);
}
int success = PHYSFS_readBytes(handle, *mem, length);
if (success == -1)
@ -289,7 +289,7 @@ void FILESYSTEM_loadFileToMemory(
void FILESYSTEM_freeMemory(unsigned char **mem)
{
SDL_free(*mem);
free(*mem);
*mem = NULL;
}
@ -331,7 +331,7 @@ std::vector<std::string> FILESYSTEM_getLevelDirFileNames()
for (i = fileList; *i != NULL; i++)
{
if (SDL_strcmp(*i, "data") == 0)
if (strcmp(*i, "data") == 0)
{
continue; /* FIXME: lolwut -flibit */
}
@ -369,19 +369,18 @@ static void PLATFORM_migrateSaveData(char* output)
DIR *subDir = NULL;
struct dirent *subDe = NULL;
char subDirLocation[MAX_PATH];
const char *homeDir = SDL_getenv("HOME");
const char *homeDir = getenv("HOME");
if (homeDir == NULL)
{
/* Uhh, I don't want to get near this. -flibit */
return;
}
const char oldPath[] =
strcpy(oldDirectory, homeDir);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
"/.vvvvvv/";
strcat(oldDirectory, "/.vvvvvv/");
#elif defined(__APPLE__)
"/Documents/VVVVVV/";
strcat(oldDirectory, "/Documents/VVVVVV/");
#endif
SDL_snprintf(oldDirectory, sizeof(oldDirectory), "%s%s", homeDir, oldPath);
dir = opendir(oldDirectory);
if (!dir)
{
@ -392,37 +391,47 @@ static void PLATFORM_migrateSaveData(char* output)
printf("Migrating old savedata to new location...\n");
for (de = readdir(dir); de != NULL; de = readdir(dir))
{
if ( SDL_strcmp(de->d_name, "..") == 0 ||
SDL_strcmp(de->d_name, ".") == 0 )
if ( strcmp(de->d_name, "..") == 0 ||
strcmp(de->d_name, ".") == 0 )
{
continue;
}
#define COPY_SAVEFILE(name) \
else if (SDL_strcmp(de->d_name, name) == 0) \
else if (strcmp(de->d_name, name) == 0) \
{ \
SDL_snprintf(oldLocation, sizeof(oldLocation), "%s%s", oldDirectory, name); \
SDL_snprintf(newLocation, sizeof(newLocation), "%ssaves/%s", output, name); \
strcpy(oldLocation, oldDirectory); \
strcat(oldLocation, name); \
strcpy(newLocation, output); \
strcat(newLocation, "saves/"); \
strcat(newLocation, name); \
PLATFORM_copyFile(oldLocation, newLocation); \
}
COPY_SAVEFILE("unlock.vvv")
COPY_SAVEFILE("tsave.vvv")
COPY_SAVEFILE("qsave.vvv")
#undef COPY_SAVEFILE
else if (SDL_strstr(de->d_name, ".vvvvvv.vvv") != NULL)
else if (strstr(de->d_name, ".vvvvvv.vvv") != NULL)
{
SDL_snprintf(oldLocation, sizeof(oldLocation), "%s%s", oldDirectory, de->d_name);
SDL_snprintf(newLocation, sizeof(newLocation), "%ssaves/%s", output, de->d_name);
strcpy(oldLocation, oldDirectory);
strcat(oldLocation, de->d_name);
strcpy(newLocation, output);
strcat(newLocation, "saves/");
strcat(newLocation, de->d_name);
PLATFORM_copyFile(oldLocation, newLocation);
}
else if (SDL_strstr(de->d_name, ".vvvvvv") != NULL)
else if (strstr(de->d_name, ".vvvvvv") != NULL)
{
SDL_snprintf(oldLocation, sizeof(oldLocation), "%s%s", oldDirectory, de->d_name);
SDL_snprintf(newLocation, sizeof(newLocation), "%slevels/%s", output, de->d_name);
strcpy(oldLocation, oldDirectory);
strcat(oldLocation, de->d_name);
strcpy(newLocation, output);
strcat(newLocation, "levels/");
strcat(newLocation, de->d_name);
PLATFORM_copyFile(oldLocation, newLocation);
}
else if (SDL_strcmp(de->d_name, "Saves") == 0)
else if (strcmp(de->d_name, "Saves") == 0)
{
SDL_snprintf(subDirLocation, sizeof(subDirLocation), "%sSaves/", oldDirectory);
strcpy(subDirLocation, oldDirectory);
strcat(subDirLocation, "Saves/");
subDir = opendir(subDirLocation);
if (!subDir)
{
@ -435,10 +444,13 @@ static void PLATFORM_migrateSaveData(char* output)
subDe = readdir(subDir)
) {
#define COPY_SAVEFILE(name) \
(SDL_strcmp(subDe->d_name, name) == 0) \
(strcmp(subDe->d_name, name) == 0) \
{ \
SDL_snprintf(oldLocation, sizeof(oldLocation), "%s%s", subDirLocation, name); \
SDL_snprintf(newLocation, sizeof(newLocation), "%ssaves/%s", output, name); \
strcpy(oldLocation, subDirLocation); \
strcat(oldLocation, name); \
strcpy(newLocation, output); \
strcat(newLocation, "saves/"); \
strcat(newLocation, name); \
PLATFORM_copyFile(oldLocation, newLocation); \
}
if COPY_SAVEFILE("unlock.vvv")
@ -454,9 +466,39 @@ static void PLATFORM_migrateSaveData(char* output)
char fileSearch[MAX_PATH];
/* Same place, different layout. */
SDL_strlcpy(oldDirectory, output, sizeof(oldDirectory));
strcpy(oldDirectory, output);
SDL_snprintf(fileSearch, sizeof(fileSearch), "%s\\*.vvvvvv", oldDirectory);
/* In theory we don't need to worry about this, thanks case insensitivity!
sprintf(fileSearch, "%s\\Saves\\*.vvv", oldDirectory);
hFind = FindFirstFile(fileSearch, &findHandle);
if (hFind == INVALID_HANDLE_VALUE)
{
printf("Could not find directory %s\\Saves\\\n", oldDirectory);
}
else do
{
if ((findHandle.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
#define COPY_SAVEFILE(name) \
(strcmp(findHandle.cFileName, name) == 0) \
{ \
strcpy(oldLocation, oldDirectory); \
strcat(oldLocation, "Saves\\"); \
strcat(oldLocation, name); \
strcpy(newLocation, output); \
strcat(newLocation, "saves\\"); \
strcat(newLocation, name); \
PLATFORM_copyFile(oldLocation, newLocation); \
}
if COPY_SAVEFILE("unlock.vvv")
else if COPY_SAVEFILE("tsave.vvv")
else if COPY_SAVEFILE("qsave.vvv")
#undef COPY_SAVEFILE
}
} while (FindNextFile(hFind, &findHandle));
*/
sprintf(fileSearch, "%s\\*.vvvvvv", oldDirectory);
hFind = FindFirstFile(fileSearch, &findHandle);
if (hFind == INVALID_HANDLE_VALUE)
{
@ -466,8 +508,11 @@ static void PLATFORM_migrateSaveData(char* output)
{
if ((findHandle.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
SDL_snprintf(oldLocation, sizeof(oldLocation), "%s%s", oldDirectory, findHandle.cFileName);
SDL_snprintf(newLocation, sizeof(newLocation), "%slevels\\%s", output, findHandle.cFileName);
strcpy(oldLocation, oldDirectory);
strcat(oldLocation, findHandle.cFileName);
strcpy(newLocation, output);
strcat(newLocation, "levels\\");
strcat(newLocation, findHandle.cFileName);
PLATFORM_copyFile(oldLocation, newLocation);
}
} while (FindNextFile(hFind, &findHandle));
@ -491,13 +536,13 @@ static void PLATFORM_copyFile(const char *oldLocation, const char *newLocation)
fseek(file, 0, SEEK_END);
length = ftell(file);
fseek(file, 0, SEEK_SET);
data = (char*) SDL_malloc(length);
data = (char*) malloc(length);
bytes_read = fread(data, 1, length, file);
fclose(file);
if (bytes_read != length)
{
printf("An error occurred when reading from %s\n", oldLocation);
SDL_free(data);
free(data);
return;
}
@ -506,12 +551,12 @@ static void PLATFORM_copyFile(const char *oldLocation, const char *newLocation)
if (!file)
{
printf("Could not write to %s\n", newLocation);
SDL_free(data);
free(data);
return;
}
bytes_written = fwrite(data, 1, length, file);
fclose(file);
SDL_free(data);
free(data);
/* WTF did we just do */
printf("Copied:\n\tOld: %s\n\tNew: %s\n", oldLocation, newLocation);

View File

@ -21,6 +21,11 @@
#include "UtilityClass.h"
#include "XMLUtils.h"
// lol, Win32 -flibit
#ifdef _WIN32
#define strcasecmp stricmp
#endif
static bool GetButtonFromString(const char *pText, SDL_GameControllerButton *button)
{
if (*pText == '0' ||
@ -30,7 +35,7 @@ static bool GetButtonFromString(const char *pText, SDL_GameControllerButton *but
*button = SDL_CONTROLLER_BUTTON_A;
return true;
}
if (SDL_strcmp(pText, "1") == 0 ||
if (strcmp(pText, "1") == 0 ||
*pText == 'b' ||
*pText == 'B')
{
@ -52,43 +57,43 @@ static bool GetButtonFromString(const char *pText, SDL_GameControllerButton *but
return true;
}
if (*pText == '4' ||
SDL_strcasecmp(pText, "BACK") == 0)
strcasecmp(pText, "BACK") == 0)
{
*button = SDL_CONTROLLER_BUTTON_BACK;
return true;
}
if (*pText == '5' ||
SDL_strcasecmp(pText, "GUIDE") == 0)
strcasecmp(pText, "GUIDE") == 0)
{
*button = SDL_CONTROLLER_BUTTON_GUIDE;
return true;
}
if (*pText == '6' ||
SDL_strcasecmp(pText, "START") == 0)
strcasecmp(pText, "START") == 0)
{
*button = SDL_CONTROLLER_BUTTON_START;
return true;
}
if (*pText == '7' ||
SDL_strcasecmp(pText, "LS") == 0)
strcasecmp(pText, "LS") == 0)
{
*button = SDL_CONTROLLER_BUTTON_LEFTSTICK;
return true;
}
if (*pText == '8' ||
SDL_strcasecmp(pText, "RS") == 0)
strcasecmp(pText, "RS") == 0)
{
*button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
return true;
}
if (*pText == '9' ||
SDL_strcasecmp(pText, "LB") == 0)
strcasecmp(pText, "LB") == 0)
{
*button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
return true;
}
if (SDL_strcmp(pText, "10") == 0 ||
SDL_strcasecmp(pText, "RB") == 0)
if (strcmp(pText, "10") == 0 ||
strcasecmp(pText, "RB") == 0)
{
*button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
return true;
@ -545,7 +550,7 @@ void Game::loadcustomlevelstats()
}
// If the two arrays happen to differ in length, just go with the smallest one
for (int i = 0; i < VVV_min(customlevelnames.size(), customlevelscores.size()); i++)
for (size_t i = 0; i < std::min(customlevelnames.size(), customlevelscores.size()); i++)
{
CustomLevelStat stat = {customlevelnames[i], customlevelscores[i]};
customlevelstats.push_back(stat);
@ -4452,7 +4457,7 @@ void Game::unlocknum( int t )
if (TextString.length()) \
{ \
std::vector<std::string> values = split(TextString, ','); \
for (int i = 0; i < VVV_min(SDL_arraysize(DEST), values.size()); i++) \
for (size_t i = 0; i < SDL_min(SDL_arraysize(DEST), values.size()); i++) \
{ \
DEST[i] = help.Int(values[i].c_str()); \
} \

View File

@ -412,7 +412,7 @@ void Graphics::bigprint( int _x, int _y, std::string _s, int r, int g, int b, b
if (cen)
{
_x = VVV_max(160 - (int((len(_s)/ 2.0)*sc)), 0 );
_x = std::max(160 - (int((len(_s)/ 2.0)*sc)), 0 );
}
int bfontpos = 0;
@ -978,13 +978,13 @@ void Graphics::cutscenebarstimer()
if (showcutscenebars)
{
cutscenebarspos += 25;
cutscenebarspos = VVV_min(cutscenebarspos, 361);
cutscenebarspos = std::min(cutscenebarspos, 361);
}
else if (cutscenebarspos > 0)
{
//disappearing
cutscenebarspos -= 25;
cutscenebarspos = VVV_max(cutscenebarspos, 0);
cutscenebarspos = std::max(cutscenebarspos, 0);
}
}
@ -1381,10 +1381,10 @@ bool Graphics::Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, po
if(intersection)
{
int r3_left = VVV_max(r1_left, r2_left);
int r3_top = VVV_min(r1_top, r2_top);
int r3_right = VVV_min(r1_right, r2_right);
int r3_bottom= VVV_max(r1_bottom, r2_bottom);
int r3_left = SDL_max(r1_left, r2_left);
int r3_top = SDL_min(r1_top, r2_top);
int r3_right = SDL_min(r1_right, r2_right);
int r3_bottom= SDL_max(r1_bottom, r2_bottom);
//for every pixel inside rectangle
for(int x = r3_left; x < r3_right; x++)
@ -2971,7 +2971,7 @@ void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool
if (cen)
{
x = VVV_max(160 - (int((len(t)/ 2.0)*sc)), 0 );
x = std::max(160 - (int((len(t)/ 2.0)*sc)), 0 );
}
else
{

View File

@ -67,7 +67,7 @@ static SDL_Surface* LoadImage(const char *filename, bool noBlend = true, bool no
0
);
SDL_FreeSurface( loadedImage );
SDL_free(data);
free(data);
if (noBlend)
{
SDL_SetSurfaceBlendMode(optimizedImage, SDL_BLENDMODE_BLEND);

View File

@ -336,20 +336,20 @@ SDL_Surface* ApplyFilter( SDL_Surface* _src )
Uint8 green = (pixel & _src->format->Gmask) >> 8;
Uint8 blue = (pixel & _src->format->Bmask) >> 0;
Uint32 pixelOffset = ReadPixel(_src, VVV_min(x+redOffset, 319), sampley) ;
Uint32 pixelOffset = ReadPixel(_src, std::min(x+redOffset, 319), sampley) ;
Uint8 red = (pixelOffset & _src->format->Rmask) >> 16 ;
if(isscrolling && sampley > 220 && ((rand() %10) < 4))
{
red = VVV_min(int(red+(fRandom() * 0.6) * 254) , 255);
green = VVV_min(int(green+(fRandom() * 0.6) * 254) , 255);
blue = VVV_min(int(blue+(fRandom() * 0.6) * 254) , 255);
red = std::min(int(red+(fRandom() * 0.6) * 254) , 255);
green = std::min(int(green+(fRandom() * 0.6) * 254) , 255);
blue = std::min(int(blue+(fRandom() * 0.6) * 254) , 255);
}
else
{
red = VVV_min(int(red+(fRandom() * 0.2) * 254) , 255);
green = VVV_min(int(green+(fRandom() * 0.2) * 254) , 255);
blue = VVV_min(int(blue+(fRandom() * 0.2) * 254) , 255);
red = std::min(int(red+(fRandom() * 0.2) * 254) , 255);
green = std::min(int(green+(fRandom() * 0.2) * 254) , 255);
blue = std::min(int(blue+(fRandom() * 0.2) * 254) , 255);
}
@ -363,9 +363,9 @@ SDL_Surface* ApplyFilter( SDL_Surface* _src )
int distX = static_cast<int>((SDL_abs (160.0f -x ) / 160.0f) *16);
int distY = static_cast<int>((SDL_abs (120.0f -y ) / 120.0f)*32);
red = VVV_max(red - ( distX +distY), 0);
green = VVV_max(green - ( distX +distY), 0);
blue = VVV_max(blue - ( distX +distY), 0);
red = std::max(red - ( distX +distY), 0);
green = std::max(green - ( distX +distY), 0);
blue = std::max(blue - ( distX +distY), 0);
Uint32 finalPixel = ((red<<16) + (green<<8) + (blue<<0)) | (pixel &_src->format->Amask);
DrawPixel(_ret,x,y, finalPixel);

View File

@ -45,13 +45,13 @@ KeyPoll::KeyPoll()
pressedbackspace=false;
useFullscreenSpaces = false;
if (SDL_strcmp(SDL_GetPlatform(), "Mac OS X") == 0)
if (strcmp(SDL_GetPlatform(), "Mac OS X") == 0)
{
useFullscreenSpaces = true;
const char *hint = SDL_GetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES);
if (hint != NULL)
{
useFullscreenSpaces = (SDL_strcmp(hint, "1") == 0);
useFullscreenSpaces = (strcmp(hint, "1") == 0);
}
}

View File

@ -472,7 +472,8 @@ int mapclass::finalat(int x, int y)
//Special case: animated tiles
if (final_mapcol == 1)
{
return 737 + (int(fRandom() * 11) * 40);
// Windows hits fRandom() == 1 frequently! For fuck sake! -flibit
return 737 + (std::min(int(fRandom() * 12), 11) * 40);
}
else
{
@ -712,6 +713,7 @@ int mapclass::area(int _rx, int _ry)
else
{
int lookup = (_rx - 100) + ((_ry - 100) * 20);
//lookup = std::max(0,lookup);
if(_rx-100>=0 && _rx-100<20 && _ry-100>=0 && _ry-100<20){
return areamap[lookup];
}

View File

@ -25,28 +25,4 @@ struct point
int y;
};
inline int VVV_min(const int a, const int b)
{
if (a < b)
{
return a;
}
else
{
return b;
}
}
inline int VVV_max(const int a, const int b)
{
if (a > b)
{
return a;
}
else
{
return b;
}
}
#endif /* MATHGAME_H */

View File

@ -315,7 +315,7 @@ static void menurender()
graphics.Print( 40, 30, "the following patrons", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = VVV_min(startidx + 9, (int)SDL_arraysize(Credits::superpatrons));
int endidx = std::min(startidx + 9, (int)SDL_arraysize(Credits::superpatrons));
int xofs = 80 - 16;
int yofs = 40 + 20;
@ -333,7 +333,7 @@ static void menurender()
graphics.Print( -1, 20, "and also by", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = VVV_min(startidx + 14, (int)SDL_arraysize(Credits::patrons));
int endidx = std::min(startidx + 14, (int)SDL_arraysize(Credits::patrons));
int maxheight = 10 * 14;
int totalheight = (endidx - startidx) * 10;
@ -354,7 +354,7 @@ static void menurender()
graphics.Print( 40, 30, "GitHub from", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = VVV_min(startidx + 9, (int)SDL_arraysize(Credits::githubfriends));
int endidx = std::min(startidx + 9, (int)SDL_arraysize(Credits::githubfriends));
int maxheight = 14 * 9;
int totalheight = (endidx - startidx) * 14;

View File

@ -130,7 +130,7 @@ void Screen::LoadIcon()
);
SDL_SetWindowIcon(m_window, icon);
SDL_FreeSurface(icon);
SDL_free(data);
free(data);
}
void Screen::ResizeScreen(int x, int y)

View File

@ -1,18 +0,0 @@
#include <SDL_stdinc.h>
// Handle third-party dependencies' needs here
void* lodepng_malloc(size_t size)
{
return SDL_malloc(size);
}
void* lodepng_realloc(void* ptr, size_t new_size)
{
return SDL_realloc(ptr, new_size);
}
void lodepng_free(void* ptr)
{
SDL_free(ptr);
}

View File

@ -228,20 +228,13 @@ bool is_number(const char* str)
return true;
}
static bool VVV_isxdigit(const unsigned char digit)
{
return (digit >= 'a' && digit <= 'z')
|| (digit >= 'A' && digit <= 'Z')
|| SDL_isdigit(digit);
}
bool is_positive_num(const std::string& str, bool hex)
{
for (size_t i = 0; i < str.length(); i++)
{
if (hex)
{
if (!VVV_isxdigit(static_cast<unsigned char>(str[i])))
if (!isxdigit(static_cast<unsigned char>(str[i])))
{
return false;
}

View File

@ -159,11 +159,11 @@ std::string find_tag(const std::string& buf, const std::string& start, const std
uint32_t character = 0;
if (hex)
{
SDL_sscanf(number.c_str(), "%" SCNx32, &character);
sscanf(number.c_str(), "%" SCNx32, &character);
}
else
{
SDL_sscanf(number.c_str(), "%" SCNu32, &character);
sscanf(number.c_str(), "%" SCNu32, &character);
}
uint32_t utf32[] = {character, 0};
std::string utf8;
@ -1630,7 +1630,7 @@ bool editorclass::load(std::string& _path)
reset();
static const char *levelDir = "levels/";
if (_path.compare(0, SDL_strlen(levelDir), levelDir) != 0)
if (_path.compare(0, strlen(levelDir), levelDir) != 0)
{
_path = levelDir + _path;
}
@ -3287,15 +3287,22 @@ void editorrender()
tx+=tg;
FillRect(graphics.backBuffer, tx+2,ty+8,12,1,graphics.getRGB(255,255,255));
for (int i = 0; i < 10; i++)
for(int i=0; i<9; i++)
{
fillboxabs(4+(i*tg), 209,20,20,graphics.getRGB(96,96,96));
const int col = i == ed.drawmode ? 255 : 164;
const std::string glyph = i == 9 ? "0" : help.String(i + 1);
graphics.Print(22 + i*tg - 4, 225 - 4, glyph, col, col, col, false);
graphics.Print(22+(i*tg)-4, 225-4,help.String(i+1),164,164,164,false);
}
if(ed.drawmode==9)graphics.Print(22+(ed.drawmode*tg)-4, 225-4,"0",255,255,255,false);
fillboxabs(4+(9*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(9*tg)-4, 225-4, "0",164,164,164,false);
fillboxabs(4+(ed.drawmode*tg), 209,20,20,graphics.getRGB(200,200,200));
if(ed.drawmode<9)
{
graphics.Print(22+(ed.drawmode*tg)-4, 225-4,help.String(ed.drawmode+1),255,255,255,false);
}
graphics.Print(4, 232, "1/2", 196, 196, 255 - help.glow, false);
}
@ -3330,15 +3337,28 @@ void editorrender()
tx+=tg;
graphics.drawsprite(tx,ty,184,graphics.col_crewcyan);
for (int i = 0; i < 7; i++)
{
fillboxabs(4 + i*tg, 209, 20, 20, graphics.getRGB(96, 96, 96));
const int col = i + 10 == ed.drawmode ? 255 : 164;
static const char glyphs[] = "RTYUIOP";
graphics.Print(22 + i*tg - 4, 225 - 4, std::string(1, glyphs[i]), col, col, col, false);
}
if(ed.drawmode==10)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"R",255,255,255,false);
if(ed.drawmode==11)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"T",255,255,255,false);
if(ed.drawmode==12)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"Y",255,255,255,false);
if(ed.drawmode==13)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"U",255,255,255,false);
if(ed.drawmode==14)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"I",255,255,255,false);
if(ed.drawmode==15)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"O",255,255,255,false);
if(ed.drawmode==16)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"P",255,255,255,false);
fillboxabs(4 + (ed.drawmode - 10) * tg, 209, 20, 20, graphics.getRGB(200, 200, 200));
fillboxabs(4+(0*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(0*tg)-4, 225-4, "R",164,164,164,false);
fillboxabs(4+(1*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(1*tg)-4, 225-4, "T",164,164,164,false);
fillboxabs(4+(2*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(2*tg)-4, 225-4, "Y",164,164,164,false);
fillboxabs(4+(3*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(3*tg)-4, 225-4, "U",164,164,164,false);
fillboxabs(4+(4*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(4*tg)-4, 225-4, "I",164,164,164,false);
fillboxabs(4+(5*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(5*tg)-4, 225-4, "O",164,164,164,false);
fillboxabs(4+(6*tg), 209,20,20,graphics.getRGB(96,96,96));
graphics.Print(22+(6*tg)-4, 225-4, "P",164,164,164,false);
graphics.Print(4, 232, "2/2", 196, 196, 255 - help.glow, false);
}

View File

@ -83,7 +83,7 @@ int main(int argc, char *argv[])
for (int i = 1; i < argc; ++i)
{
#define ARG(name) (SDL_strcmp(argv[i], name) == 0)
#define ARG(name) (strcmp(argv[i], name) == 0)
#define ARG_INNER(code) \
if (i + 1 < argc) \
{ \