music = NULL;
quickSound = NULL;
- strcpy(levelMusicName, "");
+ levelMusicName[0] = 0;
}
void Audio::setSoundVolume(int soundVolume)
{
char tempPath[PATH_MAX];
- sprintf(tempPath, "%smusic.mod", engine->userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%smusic.mod", engine->userHomeDirectory);
if (!engine->useAudio)
{
return false;
}
- strcpy(levelMusicName, filename);
+ strncpy(levelMusicName, filename, sizeof levelMusicName);
return true;
}
{
char tempPath[PATH_MAX];
- sprintf(tempPath, "%smusic.mod", engine->userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%smusic.mod", engine->userHomeDirectory);
if (!engine->useAudio)
{
bool Config::loadJoystickConfig()\r
{\r
char filename[PATH_MAX];\r
- sprintf(filename, "%sjoystick.cfg", engine->userHomeDirectory);\r
+ snprintf(filename, sizeof filename, "%sjoystick.cfg", engine->userHomeDirectory);\r
\r
debug(("Loading joystick config from %s\n", filename));\r
\r
bool Config::saveJoystickConfig()\r
{\r
char filename[PATH_MAX];\r
- sprintf(filename, "%sjoystick.cfg", engine->userHomeDirectory);\r
+ snprintf(filename, sizeof filename, "%sjoystick.cfg", engine->userHomeDirectory);\r
\r
debug(("Saving joystick config to %s\n", filename));\r
\r
bool Config::loadKeyConfig()\r
{\r
char filename[PATH_MAX];\r
- sprintf(filename, "%skeyboard.cfg", engine->userHomeDirectory);\r
+ snprintf(filename, sizeof filename, "%skeyboard.cfg", engine->userHomeDirectory);\r
\r
debug(("Loading keyboard config from %s\n", filename));\r
\r
bool Config::saveKeyConfig()\r
{\r
char filename[PATH_MAX];\r
- sprintf(filename, "%skeyboard.cfg", engine->userHomeDirectory);\r
+ snprintf(filename, sizeof filename, "%skeyboard.cfg", engine->userHomeDirectory);\r
\r
debug(("Saving keyboard config to %s\n", filename));\r
\r
Cutscene::Cutscene()
{
- strcpy(sprite, "");
- strcpy(text, "");
+ sprite[0] = 0;
+ text[0] = 0;
waitTime = 0;
}
void Cutscene::appendText(const char *line)
{
- sprintf(text, "%s %s", text, line);
+ snprintf(text, sizeof text, "%s %s", text, line);
}
Data::Data()
{
- strcpy(key, "");
- strcpy(value, "");
+ key[0] = 0;
+ value[0] = 0;
current = 0;
target = 1;
}
return;
}
- strcpy(this->key, key);
- strcpy(this->value, value);
+ strncpy(this->key, key, sizeof this->key);
+ strncpy(this->value, value, sizeof this->value);
this->current = current;
this->target = target;
}
allowJoypad = true;
- strcpy(lastKeyPressed, "");
+ lastKeyPressed[0] = 0;
fullScreen = 0;
highlightedWidget = NULL;
- strcpy(message, "");
+ message[0] = 0;
messageTime = -1;
// Development Stuff
}
keyState[event.key.keysym.sym] = 1;
- strcpy(lastKeyPressed, SDL_GetKeyName(event.key.keysym.sym));
+ strncpy(lastKeyPressed, SDL_GetKeyName(event.key.keysym.sym), sizeof lastKeyPressed);
addKeyEvent();
break;
void Engine::setUserHome(const char *path)
{
- strcpy(userHomeDirectory, path);
+ strncpy(userHomeDirectory, path, sizeof userHomeDirectory);
debug(("User Home = %s\n", path));
}
if (fileType == PAK_MUSIC)
{
- sprintf(tempPath, "%smusic.mod", userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%smusic.mod", userHomeDirectory);
fp = fopen(tempPath, "wb");
}
if (fileType == PAK_FONT)
{
- sprintf(tempPath, "%sfont.ttf", userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%sfont.ttf", userHomeDirectory);
fp = fopen(tempPath, "wb");
}
{
if (priority >= messagePriority)
{
- strcpy(this->message, message);
+ strncpy(this->message, message, sizeof this->message);
messageTime = 180;
messagePriority = priority;
messageType = type;
char line[1024];
bool found;
int value;
- strcpy(line, realLine);
+ strncpy(line, realLine, sizeof line);
int flags = 0;
Entity::Entity()
{
- strcpy(name, "");
+ name[0] = 0;
x = y = dx = dy = tx = ty = width = height = 0;
id = 0;
health = 0;
void Entity::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
}
void Entity::setSprites(Sprite *sprite1, Sprite *sprite2, Sprite *sprite3)
FileData::FileData()
{
- strcpy(filename, "");
+ filename[0] = 0;
fSize = 0;
cSize = 0;
location = 0;
return;
}
- strcpy(this->filename, filename);
+ strncpy(this->filename, filename, sizeof this->filename);
this->fSize = fSize;
this->cSize = cSize;
bulletsHit[i] = bulletsFired[i] = 0;
}
- strcpy(mapName, "data/grasslands1");
- strcpy(stageName, "Grasslands");
+ strncpy(mapName, "data/grasslands1", sizeof mapName);
+ strncpy(stageName, "Grasslands", sizeof stageName);
continuesUsed = 0;
levelsStarted = 0;
void Game::setStageName(const char *name)
{
- strcpy(stageName, name);
+ strncpy(stageName, name, sizeof stageName);
}
void Game::setMapName(const char *name)
{
- strcpy(mapName, name);
+ strncpy(mapName, name, sizeof mapName);
}
void Game::setMissionOver(int reason)
Data *data = (Data*)dataList.getHead();
char newKey[100];
- sprintf(newKey, "%s MIAs", key);
+ snprintf(newKey, sizeof newKey, "%s MIAs", key);
while (data->next != NULL)
{
data = (Data*)data->next;
if (strcmp(newKey, data->key) == 0)
{
- strcpy(data->value, "MIAs");
+ strncpy(data->value, "MIAs", sizeof data->value);
data->current = rescues;
data->target = total;
return;
Data *data = (Data*)dataList.getHead();
char newName[100];
- sprintf(newName, "MIA_%s", name);
+ snprintf(newName, sizeof newName, "MIA_%s", name);
while (data->next != NULL)
{
{
if ((Math::prand() % 500) == 0)
{
- sprintf(screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
+ snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
SDL_SaveBMP(screen, screenshot);
screenShotNumber++;
}
if (engine->keyState[SDLK_F12])
{
- sprintf(screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
+ snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
SDL_SaveBMP(screen, screenshot);
screenShotNumber++;
{
bool found, autoAlpha;
char filename[255];
- strcpy(filename, "");
+ filename[0] = 0;
autoAlpha = false;
{
found = true;
- sprintf(filename, "%s/%d.png", baseDir, i);
+ snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
#if USEPAK
char tempPath[PATH_MAX];
- sprintf(tempPath, "%sfont.ttf", engine->userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
bool found = false;
int size = 0;
Sprite *Graphics::addSprite(const char *name)
{
Sprite *sprite = new Sprite;
- strcpy(sprite->name, name);
+ strncpy(sprite->name, name, sizeof sprite->name);
spriteList.add(sprite);
void Graphics::clearChatString()
{
- strcpy(chatString, "");
+ chatString[0] = 0;
}
void Graphics::createChatString(const char *in)
{
- sprintf(chatString, "%s %s", chatString, in);
+ snprintf(chatString, sizeof chatString, "%s %s", chatString, in);
}
void Graphics::drawChatString(SDL_Surface *surface, int y)
continue;
}
- sprintf(wordWithSpace, "%s ", word);
+ snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
wordSurface = getString(wordWithSpace, false);
medalType = type - 1; // for indexing on the image
if (type != -1)
{
- sprintf(message, " Medal Earned - %s ", in);
+ snprintf(message, sizeof message, " Medal Earned - %s ", in);
medalMessage = getString(message, true);
}
else
{
- sprintf(message, " %s ", in);
+ snprintf(message, sizeof message, " %s ", in);
medalMessage = getString(message, true);
}
medalMessageTimer = (5 * 60);
}
char message[256];
- sprintf(message, error, param);
+ snprintf(message, sizeof message, error, param);
setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
drawString("An unforseen error has occurred", 320, 50, true, screen);
HubLevel::HubLevel()
{
- strcpy(stageName, "");
- strcpy(filename, "");
+ stageName[0] = 0;
+ filename[0] = 0;
x = y = 0;
levelNameImage = NULL;
void HubLevel::set(const char *stageName, const char *filename, int x, int y)
{
- strcpy(this->stageName, stageName);
- strcpy(this->filename, filename);
+ strncpy(this->stageName, stageName, sizeof this->stageName);
+ strncpy(this->filename, filename, sizeof this->filename);
this->x = x;
this->y = y;
}
const char *Keyboard::translateKey(int key)
{
static char keyName[50];
- strcpy(keyName, "");
+ keyName[0] = 0;
keyName[0] = '\0';
if (key <= 0)
return "...";
}
- strcpy(keyName, _(SDL_GetKeyName((SDLKey)key)));
+ strncpy(keyName, _(SDL_GetKeyName((SDLKey)key)), sizeof keyName);
/*
This is not really neccessary, but it just makes
{
x = y = 0;
width = height = 0;
- strcpy(name, "");
- strcpy(linkName, "");
- strcpy(activateMessage, "");
+ name[0] = 0;
+ linkName[0] = 0;
+ activateMessage[0] = 0;
activated = false;
next = NULL;
}
void LineDef::set(const char *name, const char *linkName, const char *activateMessage, int x, int y, int width, int height)
{
- strcpy(this->name, name);
- strcpy(this->linkName, linkName);
- strcpy(this->activateMessage, activateMessage);
+ strncpy(this->name, name, sizeof this->name);
+ strncpy(this->linkName, linkName, sizeof this->linkName);
+ strncpy(this->activateMessage, activateMessage, sizeof this->activateMessage);
this->x = x;
this->y = y;
this->width = width;
limitRight = ((MAPWIDTH - 40) * BRICKSIZE);
limitDown = ((MAPHEIGHT - 30) * BRICKSIZE);
- strcpy(name, "");
+ name[0] = 0;
for (int x = 0 ; x < MAPWIDTH ; x++)
for (int y = 0 ; y < MAPHEIGHT ; y++)
if (strcmp(p->stageName, name) == 0)
{
- strcpy(p->stageName, "@none@");
+ strncpy(p->stageName, "@none@", sizeof p->stageName);
p->clear();
return;
}
void Map::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
if (strstr(name, "BioMech"))
{
{
static char time[1024];
- strcpy(time, "");
+ time[0] = 0;
int hours = t / 3600;
int minutes = (t % 3600) / 60;
int seconds = (t % 60);
- sprintf(time, "%dh %dm %ds", hours, minutes, seconds);
+ snprintf(time, sizeof time, "%dh %dm %ds", hours, minutes, seconds);
return time;
}
connected = false;
gotRuby = false;
- strcpy(message, "");
- strcpy(rubyMessage, "");
+ message[0] = 0;
+ rubyMessage[0] = 0;
}
MedalServer::~MedalServer()
debug(("Connected %s to %s:%d\n", privateKey, MEDAL_SERVER_HOST, MEDAL_SERVER_PORT));
- strcpy(this->privateKey, privateKey);
+ strncpy(this->privateKey, privateKey, sizeof this->privateKey);
connected = true;
return true;
char *store;
char medal[128];
- strcpy(medal, str);
+ strncpy(medal, str, sizeof medal);
for (unsigned int i = 0 ; i < strlen(medal) ; i++)
{
char *in = new char[1024];
char out[1024];
- sprintf(out, "GET /addMedal/%s/MBS_%s HTTP/1.1\nHost: %s\nUser-Agent:BWMBS%.2f-%d\n\n", privateKey, medal, MEDAL_SERVER_HOST, VERSION, RELEASE);
+ snprintf(out, sizeof out, "GET /addMedal/%s/MBS_%s HTTP/1.1\nHost: %s\nUser-Agent:BWMBS%.2f-%d\n\n", privateKey, medal, MEDAL_SERVER_HOST, VERSION, RELEASE);
//printf("%s\n", out);
if (response == 4)
{
- strcpy(rubyMessage, message);
+ strncpy(rubyMessage, message, sizeof rubyMessage);
gotRuby = true;
}
else
Objective::Objective()
{
- strcpy(this->description, "");
- strcpy(this->target, "");
+ this->description[0] = 0;
+ this->target[0] = 0;
this->currentValue = 0;
this->targetValue = 0;
this->required = false;
Objective::Objective(const char *description, const char *target, int targetValue, bool required)
{
- strcpy(this->description, description);
- strcpy(this->target, target);
+ strncpy(this->description, description, sizeof this->description);
+ strncpy(this->target, target, sizeof this->target);
this->targetValue = targetValue;
this->required = required;
listPos = 0;
currentFile = NULL;
- strcpy(pakFilename, "");
- strcpy(filename, "");
+ pakFilename[0] = 0;
+ filename[0] = 0;
}
Pak::~Pak()
void Pak::setPakFile(const char *pakFilename)
{
#if USEPAK
- strcpy(this->pakFilename, pakFilename);
+ strncpy(this->pakFilename, pakFilename, sizeof this->pakFilename);
debug(("Pak : Filename set to %s\n", pakFilename));
PersistData::PersistData()
{
- strcpy(data, "");
+ data[0] = 0;
}
PersistData::~PersistData()
return false;
}
- strcpy(this->data, data);
+ strncpy(this->data, data, sizeof this->data);
return true;
}
Persistant::Persistant()
{
- strcpy(stageName, "");
+ stageName[0] = 0;
numberOfLines = 0;
}
void Persistant::setName(const char *name)
{
- strcpy(this->stageName, name);
+ strncpy(this->stageName, name, sizeof this->stageName);
}
void Persistant::clear()
header.version = VERSION;
header.release = RELEASE;
- strcpy(filename, "");
+ filename[0] = 0;
}
ReplayData::~ReplayData()
SpawnPoint::SpawnPoint()
{
- strcpy(name, "");
+ name[0] = 0;
active = false;
x = y = 0;
void SpawnPoint::create(const char *name, int x, int y, int spawnType, int spawnSubType, int minInterval, int maxInterval, bool active)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
this->x = x;
this->y = y;
this->spawnType = spawnType;
this->text = new char[size + 1];
- strcpy(this->text, text);
+ strncpy(this->text, text, sizeof this->text);
this->length = size;
}
c++; // LOL!!! :)
}
- strcpy(tempText, c);
+ strncpy(tempText, c, sizeof tempText);
int len = strlen(tempText);
this->text = new char[size + 1];
- strcpy(this->text, text);
+ strncpy(this->text, text, sizeof this->text);
this->length = size;
}
void String::setText(char *text, ...)
{
- strcpy(tmpString, "");
+ tmpString[0] = 0;
va_list argp;
va_start(argp, text);
- vsprintf(tmpString, text, argp);
+ vsnprintf(tmpString, sizeof tmpString, text, argp);
va_end(argp);
int size = strlen(tmpString);
this->text = new char[size + 1];
- strcpy(this->text, tmpString);
+ strncpy(this->text, tmpString, sizeof this->text);
}
char *String::getText()
Switch::Switch()
{
- strcpy(this->name, "");
- strcpy(this->linkName, "");
- strcpy(this->requiredObjectName, "");
- strcpy(this->activateMessage, "");
+ this->name[0] = 0;
+ this->linkName[0] = 0;
+ this->requiredObjectName[0] = 0;
+ this->activateMessage[0] = 0;
type = 0;
x = y = 0;
void Switch::set(const char *name, const char *linkName, const char *requiredObjectName, const char *activateMessage, int type, int x, int y, bool activated)
{
- strcpy(this->name, name);
- strcpy(this->linkName, linkName);
- strcpy(this->requiredObjectName, requiredObjectName);
- strcpy(this->activateMessage, activateMessage);
+ strncpy(this->name, name, sizeof this->name);
+ strncpy(this->linkName, linkName, sizeof this->linkName);
+ strncpy(this->requiredObjectName, requiredObjectName, sizeof this->requiredObjectName);
+ strncpy(this->activateMessage, activateMessage, sizeof this->activateMessage);
this->type = type;
this->x = x;
this->y = y;
void Teleporter::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
}
void Teleporter::set(int x, int y, int destX, int destY)
void Train::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
}
void Train::set(int startX, int startY, int endX, int endY, int pause, bool fromStart)
void Trap::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
}
void Trap::setTrapType(int type)
Weapon::Weapon()
{
- strcpy(name, "");
+ name[0] = 0;
id = 0;
damage = 0;
reload = 0;
void Weapon::setName(const char *name)
{
- strcpy(this->name, name);
+ strncpy(this->name, name, sizeof this->name);
}
int Weapon::getSpeed(int face)
Widget::Widget()
{
- strcpy(name, "");
- strcpy(groupName, "");
- strcpy(label, "");
- strcpy(options, "");
+ name[0] = 0;
+ groupName[0] = 0;
+ label[0] = 0;
+ options[0] = 0;
x = y = type = min = max = 0;
enabled = visible = true;
changed = false;
exit(1);
}
- strcpy(this->name, name);
- strcpy(this->groupName, groupName);
- strcpy(this->label, label);
- strcpy(this->options, options);
+ strncpy(this->name, name, sizeof this->name);
+ strncpy(this->groupName, groupName, sizeof this->groupName);
+ strncpy(this->label, label, sizeof this->label);
+ strncpy(this->options, options, sizeof this->options);
this->x = x;
this->y = y;
this->min = min;
debug(("aquaBossMainInit\n"));
map.boss[0] = new Boss();
- strcpy(map.boss[0]->name, "BioMech Aqua Blob");
+ strncpy(map.boss[0]->name, "BioMech Aqua Blob", sizeof map.boss[0]->name);
map.boss[0]->health = 45 * game.skill;
map.boss[0]->maxHealth = 45 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("AquaBossRight", true), graphics.getSprite("AquaBossLeft", true), graphics.getSprite("AquaBossLeft", true));
line = strtok(NULL, "\n");
if (strcmp(line, "@none@") != 0)
{
- strcpy(scene->sprite, line);
+ strncpy(scene->sprite, line, sizeof scene->sprite);
debug(("Loading cutscene image %s\n", scene->sprite));
graphics.quickSprite(scene->sprite, graphics.loadImage(scene->sprite));
}
audio.loadMusic("music/daisyChain2.mod");
char sceneName[1024];
- sprintf(sceneName, "%s Start", game.stageName);
+ snprintf(sceneName, sizeof sceneName, "%s Start", game.stageName);
if (setupScene(sceneName))
{
}
char sceneName[1024];
- sprintf(sceneName, "%s End", game.stageName);
+ snprintf(sceneName, sizeof sceneName, "%s End", game.stageName);
debug(("%s\n", sceneName));
debug(("droidBossInit\n"));
map.boss[0] = new Boss();
- strcpy(map.boss[0]->name, "BioMech Jetpack Blob");
+ strncpy(map.boss[0]->name, "BioMech Jetpack Blob", sizeof map.boss[0]->name);
map.boss[0]->health = 30 * game.skill;
map.boss[0]->maxHealth = 30 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("JetpackBlobRight1", true), graphics.getSprite("JetpackBlobLeft1", true), graphics.getSprite("JetpackBlobLeft1", true));
for (int i = 1 ; i < 6 ; i++)
{
map.boss[i] = new Boss();
- strcpy(map.boss[i]->name, "Orb Bomb");
+ strncpy(map.boss[i]->name, "Orb Bomb", sizeof map.boss[i]->name);
map.boss[i]->setSprites(graphics.getSprite("DroidOrb", true), graphics.getSprite("DroidOrb", true), graphics.getSprite("DroidOrb", true));
map.boss[i]->active = false;
map.boss[i]->face = 1;
if ((bullet->owner == &player) || (bullet->owner == &engine.world) || (bullet->flags & ENT_BOSS))
{
- sprintf(comboString, "Combo-%s", bullet->name);
+ snprintf(comboString, sizeof comboString, "Combo-%s", bullet->name);
if (Collision::collision(enemy, bullet))
{
if (game.currentComboHits >= 3)
{
char message[50];
- sprintf(message, _("%d Hit Combo!"), game.currentComboHits);
+ snprintf(message, sizeof message, _("%d Hit Combo!"), game.currentComboHits);
engine.setInfoMessage(message, 0, INFO_NORMAL);
}
{
for (int i = 0 ; i < MAX_ENEMIES ; i++)
{
- strcpy(defEnemy[i].name, "");
+ defEnemy[i].name[0] = 0;
}
int enemy = 0;
map.boss[i] = new Boss();
}
debug(("BlackDroid %d init\n", i));
- strcpy(map.boss[i]->name, "BlackDrod");
+ strncpy(map.boss[i]->name, "BlackDrod", sizeof map.boss[i]->name);
map.boss[i]->health = -90;
map.boss[i]->maxHealth = -90;
map.boss[i]->setSprites(graphics.getSprite("BlackDroidRight", true), graphics.getSprite("BlackDroidLeft", true), graphics.getSprite("BlackDroidDie", true));
if (map.boss[i] == NULL)
{
map.boss[i] = new Boss();
- strcpy(map.boss[i]->name, "MiniGaldov");
+ strncpy(map.boss[i]->name, "MiniGaldov", sizeof map.boss[i]->name);
map.boss[i]->health = 10 * game.skill;
map.boss[i]->maxHealth = 10 * game.skill;
}
debug(("galdovFinalInit\n"));
map.boss[0] = new Boss();
- strcpy(map.boss[0]->name, "Galdov");
+ strncpy(map.boss[0]->name, "Galdov", sizeof map.boss[0]->name);
map.boss[0]->health = 45 * game.skill;
map.boss[0]->maxHealth = 45 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("GaldovRight", true), graphics.getSprite("GaldovLeft", true), graphics.getSprite("GaldovDie", true));
delete map.boss[i];
}
map.boss[i] = new Boss();
- strcpy(map.boss[i]->name, "OrbBomb");
+ strncpy(map.boss[i]->name, "OrbBomb", sizeof map.boss[i]->name);
map.boss[i]->setSprites(graphics.getSprite("DroidOrb", true), graphics.getSprite("DroidOrb", true), graphics.getSprite("DroidOrb", true));
map.boss[i]->health = 999999;
map.boss[i]->maxHealth = 99999;
debug(("galdovInit\n"));
map.boss[0] = new Boss();
- strcpy(map.boss[0]->name, "Galdov");
+ strncpy(map.boss[0]->name, "Galdov", sizeof map.boss[0]->name);
map.boss[0]->health = 45 * game.skill;
map.boss[0]->maxHealth = 45 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("GaldovRight", true), graphics.getSprite("GaldovLeft", true), graphics.getSprite("GaldovLeft", true));
for (int i = 1 ; i < 10 ; i++)
{
map.boss[i] = new Boss();
- strcpy(map.boss[i]->name, "Fake");
+ strncpy(map.boss[i]->name, "Fake", sizeof map.boss[i]->name);
map.boss[i]->setSprites(graphics.getSprite("GaldovRight", true), graphics.getSprite("GaldovLeft", true), graphics.getSprite("GaldovLeft", true));
map.boss[i]->x = 9999;
map.boss[i]->y = 9999;
if (game.canContinue > 1)
{
Widget *widget = engine.getWidgetByName("gameOverNo");
- sprintf(widget->label, "%s (%d)", widget->label, game.canContinue);
+ snprintf(widget->label, sizeof widget->label, "%s (%d)", widget->label, game.canContinue);
}
while (true)
if (map.totalMIAs > 0)
{
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- sprintf(message, _("Rescue %d MIAs"), map.requiredMIAs);
+ snprintf(message, sizeof message, _("Rescue %d MIAs"), map.requiredMIAs);
graphics.drawString(message, col1, y, TXT_LEFT, panel);
if (map.foundMIAs < map.requiredMIAs)
{
graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
- sprintf(message, "%d / %d", map.foundMIAs, map.requiredMIAs);
+ snprintf(message, sizeof message, "%d / %d", map.foundMIAs, map.requiredMIAs);
graphics.drawString(message, col2, y, TXT_RIGHT, panel);
}
else
}
else
{
- sprintf(message, "%d / %d", objective->currentValue, objective->targetValue);
+ snprintf(message, sizeof message, "%d / %d", objective->currentValue, objective->targetValue);
graphics.drawString(message, col2, y, TXT_RIGHT, panel);
}
}
if (game.skill == 3)
{
graphics.setFontColor(0xff, 0xff, 0x00, 0x00, 0x00, 0x00);
- sprintf(message, _("Time Limit - %d:%.2d Minutes"), map.remainingMinutes, map.remainingSeconds);
+ snprintf(message, sizeof message, _("Time Limit - %d:%.2d Minutes"), map.remainingMinutes, map.remainingSeconds);
graphics.drawString(message, 200, 260, TXT_CENTERED, panel);
}
#if !USEPAK
Uint32 now;
char fps[10];
- strcpy(fps, "fps");
+ strncpy(fps, "fps", sizeof fps);
#endif
engine.messageTime = -1;
if (SDL_GetTicks() > frameCounter + 500)
{
now = SDL_GetTicks();
- sprintf(fps, "%2.2f fps", ((double)frames*1000)/(now - then));
+ snprintf(fps, sizeof fps, "%2.2f fps", ((double)frames*1000)/(now - then));
then = frameCounter = SDL_GetTicks();
frames = 0;
}
{
case 0:
graphics.drawString(_("Skill Level:"), x1, y += 20, false, image);
- sprintf(string, "%s", _(skill[game.skill]));
+ snprintf(string, sizeof string, "%s", _(skill[game.skill]));
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Score:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.score);
+ snprintf(string, sizeof string, "%d", game.score);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("MIAs Saved:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.totalMIAsRescued);
+ snprintf(string, sizeof string, "%d", game.totalMIAsRescued);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Objectives Completed:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.totalObjectivesCompleted);
+ snprintf(string, sizeof string, "%d", game.totalObjectivesCompleted);
graphics.drawString(string, x2, y, false, image);
// Don't do this on Extreme or it will always say 100%
if (game.skill < 3)
{
graphics.drawString(_("Percentage Complete:"), x1, y += 20, false, image);
- sprintf(string, "%d%%", gameData.getPercentageComplete());
+ snprintf(string, sizeof string, "%d%%", gameData.getPercentageComplete());
graphics.drawString(string, x2, y, false, image);
}
- sprintf(string, "%s", _("Total Game Time"));
- sprintf(string, "%s - %.2d:%.2d:%.2d", string, game.totalHours, game.totalMinutes, game.totalSeconds);
+ snprintf(string, sizeof string, "%s", _("Total Game Time"));
+ snprintf(string, sizeof string, "%s - %.2d:%.2d:%.2d", string, game.totalHours, game.totalMinutes, game.totalSeconds);
graphics.drawString(string, 200, y += 110, true, image);
break;
case 1:
graphics.drawString(_("Enemies Defeated:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.totalEnemiesDefeated);
+ snprintf(string, sizeof string, "%d", game.totalEnemiesDefeated);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Items Collected:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.totalItemsCollected);
+ snprintf(string, sizeof string, "%d", game.totalItemsCollected);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Bonuses Picked Up:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.totalBonusesCollected);
+ snprintf(string, sizeof string, "%d", game.totalBonusesCollected);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Best Combo:"), x1, y += 20, false, image);
- sprintf(string, _("%d Hits"), game.maxComboHits);
+ snprintf(string, sizeof string, _("%d Hits"), game.maxComboHits);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Missions Started:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.levelsStarted);
+ snprintf(string, sizeof string, "%d", game.levelsStarted);
graphics.drawString(string, x2, y, false, image);
graphics.drawString(_("Continues Used:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.continuesUsed);
+ snprintf(string, sizeof string, "%d", game.continuesUsed);
graphics.drawString(string, x2, y, false, image);
if ((game.continuesUsed > 0) && (game.levelsStarted > 0))
{
graphics.drawString(_("Average Continue Usage:"), x1, y += 20, false, image);
- sprintf(string, "%d", (game.continuesUsed / game.levelsStarted));
+ snprintf(string, sizeof string, "%d", (game.continuesUsed / game.levelsStarted));
graphics.drawString(string, x2, y, false, image);
}
graphics.drawString(_("Escapes Used:"), x1, y += 20, false, image);
- sprintf(string, "%d", game.escapes);
+ snprintf(string, sizeof string, "%d", game.escapes);
graphics.drawString(string, x2, y, false, image);
break;
graphics.drawString(_("Accuracy"), x3, y, false, image);
graphics.drawString(_("Pistol"), x1, y += 30, false, image);
- sprintf(string, "%d", game.bulletsFired[WP_PISTOL]);
+ snprintf(string, sizeof string, "%d", game.bulletsFired[WP_PISTOL]);
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getWeaponAccuracy(WP_PISTOL));
+ snprintf(string, sizeof string, "%d%%", game.getWeaponAccuracy(WP_PISTOL));
graphics.drawString(string, x3, y, false, image);
graphics.drawString(_("Machine Gun"), x1, y += 20, false, image);
- sprintf(string, "%d", game.bulletsFired[WP_MACHINEGUN]);
+ snprintf(string, sizeof string, "%d", game.bulletsFired[WP_MACHINEGUN]);
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getWeaponAccuracy(WP_MACHINEGUN));
+ snprintf(string, sizeof string, "%d%%", game.getWeaponAccuracy(WP_MACHINEGUN));
graphics.drawString(string, x3, y, false, image);
graphics.drawString(_("Laser Cannon"), x1, y += 20, false, image);
- sprintf(string, "%d", game.bulletsFired[WP_LASER]);
+ snprintf(string, sizeof string, "%d", game.bulletsFired[WP_LASER]);
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getWeaponAccuracy(WP_LASER));
+ snprintf(string, sizeof string, "%d%%", game.getWeaponAccuracy(WP_LASER));
graphics.drawString(string, x3, y, false, image);
graphics.drawString(_("Grenades"), x1, y += 20, false, image);
- sprintf(string, "%d", game.bulletsFired[WP_GRENADES]);
+ snprintf(string, sizeof string, "%d", game.bulletsFired[WP_GRENADES]);
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getWeaponAccuracy(WP_GRENADES));
+ snprintf(string, sizeof string, "%d%%", game.getWeaponAccuracy(WP_GRENADES));
graphics.drawString(string, x3, y, false, image);
graphics.drawString(_("Spread Gun"), x1, y += 20, false, image);
- sprintf(string, "%d", game.bulletsFired[WP_SPREAD]);
+ snprintf(string, sizeof string, "%d", game.bulletsFired[WP_SPREAD]);
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getWeaponAccuracy(WP_SPREAD));
+ snprintf(string, sizeof string, "%d%%", game.getWeaponAccuracy(WP_SPREAD));
graphics.drawString(string, x3, y, false, image);
graphics.drawString(_("Total"), x1, y += 30, false, image);
- sprintf(string, "%d", game.getTotalBulletsFired());
+ snprintf(string, sizeof string, "%d", game.getTotalBulletsFired());
graphics.drawString(string, x2, y, false, image);
- sprintf(string, "%d%%", game.getTotalAccuracy());
+ snprintf(string, sizeof string, "%d%%", game.getTotalAccuracy());
graphics.drawString(string, x3, y, false, image);
- sprintf(string, "%s - %s", _("Most Used Weapon"), _(weapon[game.getMostUsedWeapon()].name));
+ snprintf(string, sizeof string, "%s - %s", _("Most Used Weapon"), _(weapon[game.getMostUsedWeapon()].name));
graphics.drawString(string, 200, y += 50, true, image);
break;
int x2 = 260;
int y = 15;
- sprintf(levelMIAKey, "%s MIAs", levelName);
+ snprintf(levelMIAKey, sizeof levelMIAKey, "%s MIAs", levelName);
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- sprintf(string, _("Information for %s"), _(levelName));
+ snprintf(string, sizeof string, _("Information for %s"), _(levelName));
graphics.drawString(string, 200, y, true, image);
y += 10;
if (strcmp(data->value, "0 / 0"))
{
graphics.drawString(_("MIAs Rescued"), x1, y += 20, false, image);
- sprintf(string, "%d / %d", data->current, data->target);
+ snprintf(string, sizeof string, "%d / %d", data->current, data->target);
(data->isComplete()) ? graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00) : graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
graphics.drawString(string, x2, y, false, image);
}
}
else
{
- strcpy(string, _(data->value));
+ strncpy(string, _(data->value), sizeof string);
if (strlen(string) >= 25)
{
if (data->target == 1)
{
- sprintf(string, "%s", (data->isComplete()) ? _("Completed") : _("Incomplete"));
+ snprintf(string, sizeof string, "%s", (data->isComplete()) ? _("Completed") : _("Incomplete"));
}
else
{
- sprintf(string, "%d / %d", data->current, data->target);
+ snprintf(string, sizeof string, "%d / %d", data->current, data->target);
}
(data->isComplete()) ? graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00) : graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
continue;
}
- sprintf(name, "%s", data->value);
+ snprintf(name, sizeof name, "%s", data->value);
strtok(name, "_");
- sprintf(string, "%s", strtok(NULL, "_"));
+ snprintf(string, sizeof string, "%s", strtok(NULL, "_"));
graphics.drawString(string, x1, y += 20, false, image);
graphics.drawString(_(data->key), x2, y, false, image);
if (data->isComplete())
{
- sprintf(string, "%s", _("Found"));
+ snprintf(string, sizeof string, "%s", _("Found"));
graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
}
else
{
- sprintf(string, "%s", _("Missing"));
+ snprintf(string, sizeof string, "%s", _("Missing"));
graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
}
Sprite *cursor = graphics.addSprite("Cursor");
for (int i = 0 ; i < 6 ; i++)
{
- sprintf(string, "gfx/main/cursor%d.png", i + 1);
+ snprintf(string, sizeof string, "gfx/main/cursor%d.png", i + 1);
cursor->setFrame(i, graphics.loadImage(string), 10);
}
for (int i = 0 ; i < 5 ; i++)
{
- sprintf(string, "gfx/sprites/miaSignal%d.png", i + 1);
+ snprintf(string, sizeof string, "gfx/sprites/miaSignal%d.png", i + 1);
newTarget->setFrame(i, graphics.loadImage(string, -60, 0, 0), 15);
visitedTarget->setFrame(i, graphics.loadImage(string, 0, 0, 0), 15);
Sprite *hubIcons = graphics.addSprite("HubIcons");
for (int i = 0 ; i < 6 ; i++)
{
- sprintf(string, "gfx/main/hubIcon%d.png", i + 1);
+ snprintf(string, sizeof string, "gfx/main/hubIcon%d.png", i + 1);
hubIcons->setFrame(i, graphics.loadImage(string), 60);
}
int rtn = -1;
- strcpy(level, "@none@");
- strcpy(game.stageName, "@none@");
+ strncpy(level, "@none@", sizeof level);
+ strncpy(game.stageName, "@none@", sizeof game.stageName);
bool showData = false;
bool showStats = false;
if ((numberOfHubs == 0) && (gameData.completedWorld))
{
game.setMapName("data/spaceStation");
- strcpy(game.stageName, "Space Station");
+ strncpy(game.stageName, "Space Station", sizeof game.stageName);
createObjectivesPanel("Space Station");
showData = true;
showStats = showMIAs = false;
if (validStage)
{
graphics.drawRect(10, 400, 620, 20, graphics.black, graphics.white, graphics.screen);
- sprintf(string, "%s", _("Selected Destination"));
- sprintf(string, "%s : %s", string, _(game.stageName));
+ snprintf(string, sizeof string, "%s", _("Selected Destination"));
+ snprintf(string, sizeof string, "%s : %s", string, _(game.stageName));
graphics.drawString(string, 320, 409, true, graphics.screen);
}
graphics.drawRect(10, 430, 620, 40, graphics.black, graphics.white, graphics.screen);
#if !USEPAK
- sprintf(pos, "%.3d:%.3d", engine.getMouseX(), engine.getMouseY());
+ snprintf(pos, sizeof pos, "%.3d:%.3d", engine.getMouseX(), engine.getMouseY());
graphics.drawString(pos, 320, 15, true, graphics.screen);
#endif
if (engine.messageTime == -1)
{
engine.messagePriority = -1;
- strcpy(engine.message, "");
+ engine.message[0] = 0;
}
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
}
}
- sprintf(string, "%s %s", _("Weapon:"), _(player.currentWeapon->name));
+ snprintf(string, sizeof string, "%s %s", _("Weapon:"), _(player.currentWeapon->name));
graphics.drawString(string, 630, 5, TXT_RIGHT, graphics.screen);
if (game.skill == 3)
{
- sprintf(string, _("Time Remaining: %.2d:%.2d"), map.remainingMinutes, map.remainingSeconds);
+ snprintf(string, sizeof string, _("Time Remaining: %.2d:%.2d"), map.remainingMinutes, map.remainingSeconds);
graphics.blit(graphics.infoBar, 0, 25, graphics.screen, false);
if ((map.remainingMinutes > 0) || (map.remainingSeconds > 0))
graphics.fade(130);
char string[1024];
- strcpy(string, "");
+ string[0] = 0;
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
//#if !USEPAK
- sprintf(string, _("Position = %d:%d"), (int)player.x, (int)player.y);
+ snprintf(string, sizeof string, _("Position = %d:%d"), (int)player.x, (int)player.y);
graphics.drawString(string, 5, 25, false, graphics.screen);
//#endif
graphics.drawString(_("*** PAUSED ***"), 320, y, TXT_CENTERED, graphics.screen);
graphics.drawString(_("MIAs in Area"), col1, y += 30, TXT_RIGHT, graphics.screen);
- sprintf(string, "%d", map.totalMIAs - map.foundMIAs);
+ snprintf(string, sizeof string, "%d", map.totalMIAs - map.foundMIAs);
graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
graphics.drawString(_("Enemies Defeated"), col1, y += 20, TXT_RIGHT, graphics.screen);
- sprintf(string, "%d", game.currentMissionEnemiesDefeated);
+ snprintf(string, sizeof string, "%d", game.currentMissionEnemiesDefeated);
graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
graphics.drawString(_("Items Collected"), col1, y += 20, TXT_RIGHT, graphics.screen);
- sprintf(string, "%d / %d", map.foundItems, map.totalItems);
+ snprintf(string, sizeof string, "%d / %d", map.foundItems, map.totalItems);
graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
graphics.drawString(_("Best Combo"), col1, y += 20, TXT_RIGHT, graphics.screen);
- sprintf(string, _("%d Hits"), game.maxComboHits);
+ snprintf(string, sizeof string, _("%d Hits"), game.maxComboHits);
graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
graphics.drawString(_("++ Inventory ++"), 320, y += 40, TXT_CENTERED, graphics.screen);
if (map.totalMIAs > 0)
{
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- sprintf(message, _("Rescue %d MIAs"), map.requiredMIAs);
+ snprintf(message, sizeof message, _("Rescue %d MIAs"), map.requiredMIAs);
graphics.drawString(message, col1, y, TXT_RIGHT, graphics.screen);
if (map.foundMIAs < map.requiredMIAs)
{
graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
- sprintf(message, "%d / %d", map.foundMIAs, map.requiredMIAs);
+ snprintf(message, sizeof message, "%d / %d", map.foundMIAs, map.requiredMIAs);
graphics.drawString(message, col2, y, TXT_LEFT, graphics.screen);
}
else
}
else
{
- sprintf(message, "%d / %d", objective->currentValue, objective->targetValue);
+ snprintf(message, sizeof message, "%d / %d", objective->currentValue, objective->targetValue);
graphics.drawString(message, col2, y, TXT_LEFT, graphics.screen);
}
y += 10;
- sprintf(string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
+ snprintf(string, sizeof string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
graphics.drawString(string, 320, 430, TXT_CENTERED, graphics.screen);
}
debug(("User Home = %s\n", userHome));
char dir[PATH_MAX];
- strcpy(dir, "");
+ dir[0] = 0;
- sprintf(dir, "%s/.parallelrealities", userHome);
+ snprintf(dir, sizeof dir, "%s/.parallelrealities", userHome);
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
{
printf("Couldn't create required directory '%s'", dir);
exit(1);
}
- sprintf(dir, "%s/.parallelrealities/blobwars", userHome);
+ snprintf(dir, sizeof dir, "%s/.parallelrealities/blobwars", userHome);
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
{
printf("Couldn't create required directory '%s'", dir);
}
char gameSavePath[PATH_MAX];
- sprintf(gameSavePath, "%s/.parallelrealities/blobwars/", userHome);
+ snprintf(gameSavePath, sizeof gameSavePath, "%s/.parallelrealities/blobwars/", userHome);
engine.setUserHome(gameSavePath);
}
#endif
char configPath[PATH_MAX];
- sprintf(configPath, "%sconfig", engine.userHomeDirectory);
+ snprintf(configPath, sizeof configPath, "%sconfig", engine.userHomeDirectory);
debug(("Loading Config from %s\n", configPath));
{
char configPath[PATH_MAX];
- sprintf(configPath, "%sconfig", engine.userHomeDirectory);
+ snprintf(configPath, sizeof configPath, "%sconfig", engine.userHomeDirectory);
FILE *fp = fopen(configPath, "wb");
SDL_mutexP(medalServer.lock);
char connectMessage[1024];
- sprintf(connectMessage, "Contacting Medal Server - %s:%d", MEDAL_SERVER_HOST, MEDAL_SERVER_PORT);
+ snprintf(connectMessage, sizeof connectMessage, "Contacting Medal Server - %s:%d", MEDAL_SERVER_HOST, MEDAL_SERVER_PORT);
graphics.showMedalMessage(-1, connectMessage);
char keyPath[PATH_MAX];
char privateKey[20];
- sprintf(keyPath, "%smedalKey", engine.userHomeDirectory);
+ snprintf(keyPath, sizeof keyPath, "%smedalKey", engine.userHomeDirectory);
debug(("Loading private key from %s\n", keyPath));
#if USEPAK
char tempPath[PATH_MAX];
- sprintf(tempPath, "%sfont.ttf", engine.userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine.userHomeDirectory);
remove(tempPath);
SDL_Delay(1000); // wait one second, just to be sure!
audio.destroy();
debug(("Removing Music...\n"));
- sprintf(tempPath, "%smusic.mod", engine.userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%smusic.mod", engine.userHomeDirectory);
remove(tempPath);
debug(("Freeing Game Info...\n"));
}
debug(("Removing Font File...\n"));
- sprintf(tempPath, "%sfont.ttf", engine.userHomeDirectory);
+ snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine.userHomeDirectory);
remove(tempPath);
if (SDL_NumJoysticks() > 0)
case 'o':
case 'U':
case 'u':
- sprintf(string, _("Picked up an %s"), item->name);
+ snprintf(string, sizeof string, _("Picked up an %s"), item->name);
break;
default:
- sprintf(string, _("Picked up a %s"), item->name);
+ snprintf(string, sizeof string, _("Picked up a %s"), item->name);
break;
}
//READ SAVE GAME DATA
for (int i = 0 ; i < 5 ; i++)
{
- sprintf(filename, "%ssave%d.dat", engine.userHomeDirectory, i);
+ snprintf(filename, sizeof filename, "%ssave%d.dat", engine.userHomeDirectory, i);
fp = fopen(filename, "rb");
if (!fp)
{
- strcpy(string, "%.2d - %s");
- sprintf(engine.saveSlot[i], string, (i + 1), _("Empty"));
+ strncpy(string, "%.2d - %s", sizeof string);
+ snprintf(engine.saveSlot[i], sizeof engine.saveSlot[i], string, (i + 1), _("Empty"));
}
else
{
if (fread(&tempGame, sizeof(Game), 1, fp) != 1)
{
- strcpy(string, "%.2d - %s");
- sprintf(engine.saveSlot[i], string, (i + 1), _("Corrupt Save Data"));
+ strncpy(string, "%.2d - %s", sizeof string);
+ snprintf(engine.saveSlot[i], sizeof engine.saveSlot[i], string, (i + 1), _("Corrupt Save Data"));
}
else
{
- sprintf(engine.saveSlot[i], "%.2d - %s (%.2d:%.2d:%.2d)", (i + 1), _(tempGame.stageName), tempGame.totalHours, tempGame.totalMinutes, tempGame.totalSeconds);
+ snprintf(engine.saveSlot[i], sizeof engine.saveSlot[i], "%.2d - %s (%.2d:%.2d:%.2d)", (i + 1), _(tempGame.stageName), tempGame.totalHours, tempGame.totalMinutes, tempGame.totalSeconds);
}
if (stat(filename, &fileInfo) != -1)
int sanity = 0;
- sprintf(filename, "%ssave%d.dat", engine.userHomeDirectory, slot);
+ snprintf(filename, sizeof filename, "%ssave%d.dat", engine.userHomeDirectory, slot);
fp = fopen(filename, "rb");
fclose(fp);
- sprintf(filename, "%spersistant%d.dat", engine.userHomeDirectory, slot);
+ snprintf(filename, sizeof filename, "%spersistant%d.dat", engine.userHomeDirectory, slot);
fp = fopen(filename, "rb");
fgets(line, 1024, fp);
sscanf(line, "%[^\n\r]", string[0]);
- strcpy(stageName, string[0]);
+ strncpy(stageName, string[0], sizeof stageName);
if (strcmp(stageName, "@EOF@") == 0)
{
fgets(line, 1024, fp);
- strcpy(persistData->data, line);
+ strncpy(persistData->data, line, sizeof persistData->data);
//debug(("Read %d: %s", i, persistData->data));
engine.setWidgetVariable("contno", &quitNo);
char widgetName[10];
- strcpy(widgetName, "");
+ widgetName[0] = 0;
for (int i = 0 ; i < 5 ; i++)
{
- sprintf(widgetName, "slot%d", i + 1);
- strcpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i]);
+ snprintf(widgetName, sizeof widgetName, "slot%d", i + 1);
+ strncpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i], sizeof engine.getWidgetByName(widgetName)->label);
}
engine.highlightWidget("slot1");
graphics.setFontSize(1);
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- sprintf(message, _("Saving Game to Save Slot #%d. Please Wait..."), slot + 1);
+ snprintf(message, sizeof message, _("Saving Game to Save Slot #%d. Please Wait..."), slot + 1);
graphics.drawString(message, 320, 220, true, graphics.screen);
graphics.updateScreen();
FILE *fp;
- sprintf(filename, "%ssave%d.dat", engine.userHomeDirectory, slot);
+ snprintf(filename, sizeof filename, "%ssave%d.dat", engine.userHomeDirectory, slot);
fp = fopen(filename, "wb");
fclose(fp);
- sprintf(filename, "%spersistant%d.dat", engine.userHomeDirectory, slot);
+ snprintf(filename, sizeof filename, "%spersistant%d.dat", engine.userHomeDirectory, slot);
fp = fopen(filename, "wt");
else if (strcmp(argv[i], "-mono") == 0) engine.useAudio = 1;
else if (strcmp(argv[i], "-version") == 0) showVersion();
else if (strcmp(argv[i], "--help") == 0) showHelp();
- else if (strcmp(argv[i], "-record") == 0) {recordMode = REPLAY_MODE::RECORD; strcpy(replayData.filename, argv[++i]);}
- else if (strcmp(argv[i], "-playback") == 0) {recordMode = REPLAY_MODE::PLAYBACK; strcpy(replayData.filename, argv[++i]);}
+ else if (strcmp(argv[i], "-record") == 0) {recordMode = REPLAY_MODE::RECORD; strncpy(replayData.filename, argv[++i], sizeof replayData.filename);}
+ else if (strcmp(argv[i], "-playback") == 0) {recordMode = REPLAY_MODE::PLAYBACK; strncpy(replayData.filename, argv[++i], sizeof replayData.filename);}
else if (strcmp(argv[i], "-map") == 0) {game.setMapName(argv[++i]); requiredSection = SECTION_GAME;}
else if (strcmp(argv[i], "-listmaps") == 0) listMaps();
case REPLAY_MODE::RECORD:
requiredSection = SECTION_GAME;
- strcpy(replayData.header.map, game.mapName);
+ strncpy(replayData.header.map, game.mapName, sizeof replayData.header.map);
replayData.header.skill = game.skill = 3;
replayData.setMode(REPLAY_MODE::RECORD);
break;
graphics.drawString(_("Enemies"), 430, 410, TXT_LEFT, graphics.screen);
graphics.setFontSize(1);
- sprintf(string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
+ snprintf(string, sizeof string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
graphics.drawString(string, 320, 60, TXT_CENTERED, graphics.screen);
graphics.drawString(_("Press Button to Continue..."), 320, 450, TXT_CENTERED, graphics.screen);
}
char line[1024];
- strcpy(line, "");
+ line[0] = 0;
char skill;
break;
}
- sprintf(line, "%c START %d %d\n", skill, (int)game.checkPointX, (int)game.checkPointY);
+ snprintf(line, sizeof line, "%c START %d %d\n", skill, (int)game.checkPointX, (int)game.checkPointY);
persistant->addLine(line);
Entity *ent;
while (ent->next != NULL)
{
ent = (Entity*)ent->next;
- sprintf(line, "%c ENEMY \"%s\" %d %d\n", skill, ent->name, (int)ent->x, (int)ent->y);
+ snprintf(line, sizeof line, "%c ENEMY \"%s\" %d %d\n", skill, ent->name, (int)ent->x, (int)ent->y);
persistant->addLine(line);
}
continue;
}
- sprintf(line, "%c ITEM %d \"%s\" %d %d %s\n", skill, ent->id, ent->name, (int)ent->x, (int)ent->y, ent->sprite[0]->name);
+ snprintf(line, sizeof line, "%c ITEM %d \"%s\" %d %d %s\n", skill, ent->id, ent->name, (int)ent->x, (int)ent->y, ent->sprite[0]->name);
persistant->addLine(line);
}
while (ent->next != NULL)
{
ent = (Entity*)ent->next;
- sprintf(line, "%c OBSTACLE \"%s\" %d %d %s\n", skill, ent->name, (int)ent->x, (int)ent->y, ent->sprite[0]->name);
+ snprintf(line, sizeof line, "%c OBSTACLE \"%s\" %d %d %s\n", skill, ent->name, (int)ent->x, (int)ent->y, ent->sprite[0]->name);
persistant->addLine(line);
}
define[0] = engine.getDefineOfValue("SWT_", swt->type);
define[1] = (char*)getActiveState(swt->activated);
- sprintf(line, "%c SWITCH \"%s\" %s \"%s\" \"%s\" %s %d %d %s\n", skill, swt->name, swt->linkName, swt->requiredObjectName, swt->activateMessage, define[0], (int)swt->x, (int)swt->y, define[1]);
+ snprintf(line, sizeof line, "%c SWITCH \"%s\" %s \"%s\" \"%s\" %s %d %d %s\n", skill, swt->name, swt->linkName, swt->requiredObjectName, swt->activateMessage, define[0], (int)swt->x, (int)swt->y, define[1]);
persistant->addLine(line);
}
}
define[1] = (char*)getActiveState(train->active);
- sprintf(line, "%c DOOR %s %s %d %d %d %d %s\n", skill, train->name, define[0], train->startX, train->startY, train->endX, train->endY, define[1]);
+ snprintf(line, sizeof line, "%c DOOR %s %s %d %d %d %d %s\n", skill, train->name, define[0], train->startX, train->startY, train->endX, train->endY, define[1]);
}
else
{
define[0] = engine.getDefineOfValue("TR_A", train->waitAtStart);
define[1] = (char*)getActiveState(train->active);
- sprintf(line, "%c TRAIN %s %d %d %d %d %d %s %s\n", skill, train->name, train->startX, train->startY, train->endX, train->endY, train->getPause(), define[0], define[1]);
+ snprintf(line, sizeof line, "%c TRAIN %s %d %d %d %d %d %s %s\n", skill, train->name, train->startX, train->startY, train->endX, train->endY, train->getPause(), define[0], define[1]);
}
persistant->addLine(line);
trap = (Trap*)trap->next;
define[0] = engine.getDefineOfValue("TRAP_TYPE", trap->type);
define[1] = (char*)getActiveState(trap->active);
- sprintf(line, "%c TRAP %s %s %d %d %d %d %d %d %d %d %s %s\n", skill, trap->name, define[0], (int)trap->damage, (int)trap->speed, (int)trap->startX, (int)trap->startY, (int)trap->endX, (int)trap->endY, (int)trap->waitTime[0], (int)trap->waitTime[1], trap->sprite->name, define[1]);
+ snprintf(line, sizeof line, "%c TRAP %s %s %d %d %d %d %d %d %d %d %s %s\n", skill, trap->name, define[0], (int)trap->damage, (int)trap->speed, (int)trap->startX, (int)trap->startY, (int)trap->endX, (int)trap->endY, (int)trap->waitTime[0], (int)trap->waitTime[1], trap->sprite->name, define[1]);
persistant->addLine(line);
}
{
teleporter = (Teleporter*)teleporter->next;
define[0] = (char*)getActiveState(teleporter->active);
- sprintf(line, "%c TELEPORTER %s %d %d %d %d %s\n", skill, teleporter->name, (int)teleporter->x, (int)teleporter->y, (int)teleporter->destX, (int)teleporter->destY, define[0]);
+ snprintf(line, sizeof line, "%c TELEPORTER %s %d %d %d %d %s\n", skill, teleporter->name, (int)teleporter->x, (int)teleporter->y, (int)teleporter->destX, (int)teleporter->destY, define[0]);
persistant->addLine(line);
}
{
lineDef = (LineDef*)lineDef->next;
define[0] = (char*)getActiveState(lineDef->activated);
- sprintf(line, "%c LINEDEF \"%s\" %s \"%s\" %d %d %d %d %s\n", skill, lineDef->name, lineDef->linkName, lineDef->activateMessage, (int)lineDef->x, (int)lineDef->y, (int)lineDef->width, (int)lineDef->height, define[0]);
+ snprintf(line, sizeof line, "%c LINEDEF \"%s\" %s \"%s\" %d %d %d %d %s\n", skill, lineDef->name, lineDef->linkName, lineDef->activateMessage, (int)lineDef->x, (int)lineDef->y, (int)lineDef->width, (int)lineDef->height, define[0]);
persistant->addLine(line);
}
}
define[2] = (char*)getActiveState(spawnPoint->active);
- sprintf(line, "%c SPAWNPOINT %s %d %d %s %s %d %d %s\n", skill, spawnPoint->name, (int)spawnPoint->x, (int)spawnPoint->y, define[0], define[1], (int)(spawnPoint->minInterval / 60), (int)(spawnPoint->maxInterval / 60), define[2]);
+ snprintf(line, sizeof line, "%c SPAWNPOINT %s %d %d %s %s %d %d %s\n", skill, spawnPoint->name, (int)spawnPoint->x, (int)spawnPoint->y, define[0], define[1], (int)(spawnPoint->minInterval / 60), (int)(spawnPoint->maxInterval / 60), define[2]);
persistant->addLine(line);
}
{
if (map.getSpawnableEnemy(i) != NULL)
{
- sprintf(line, "%c SPAWNABLE_ENEMY \"%s\"\n", skill, map.getSpawnableEnemy(i));
+ snprintf(line, sizeof line, "%c SPAWNABLE_ENEMY \"%s\"\n", skill, map.getSpawnableEnemy(i));
persistant->addLine(line);
}
}
if (map.waterLevel != -1)
{
- sprintf(line, "%c WATERLEVEL %d\n", skill, (int)map.waterLevel);
+ snprintf(line, sizeof line, "%c WATERLEVEL %d\n", skill, (int)map.waterLevel);
persistant->addLine(line);
}
if (!strstr(string, " ENEMY \""))
{
str = new String;
- strcpy(str->string, string);
+ strncpy(str->string, string, sizeof str->string);
stringTail->next = str;
stringTail = str;
}
if (mapY > MAPHEIGHT - 30) mapY = MAPHEIGHT - 30;
if (editing == 0)
- sprintf(string, "Index : %d:%d ; Screen %d:%d ; Tile %d", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, currentBlock);
+ snprintf(string, sizeof string, "Index : %d:%d ; Screen %d:%d ; Tile %d", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, currentBlock);
else if (editing == 1)
- sprintf(string, "Index : %d:%d ; Screen %d:%d ; %s", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, defEnemy[currentMonster].name);
+ snprintf(string, sizeof string, "Index : %d:%d ; Screen %d:%d ; %s", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, defEnemy[currentMonster].name);
else if (editing == 2)
- sprintf(string, "Index : %d:%d ; Screen %d:%d ; %s", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, defItem[currentItem].name);
+ snprintf(string, sizeof string, "Index : %d:%d ; Screen %d:%d ; %s", mapX + x, mapY + y, (mapX + x) * BRICKSIZE, (mapY + y) * BRICKSIZE, defItem[currentItem].name);
r.x = 0;
r.w = 640;
void initMIAPhrases()
{
- strcpy(mia_scared[0], "help me...");
- strcpy(mia_scared[1], "i don't wanna die...");
- strcpy(mia_scared[2], "please... someone help...");
- strcpy(mia_scared[3], "i... i'm scared...");
- strcpy(mia_scared[4], "i wanna go home...");
- strcpy(mia_scared[5], "what was that?!");
- strcpy(mia_scared[6], "i don't like it here...");
+ strncpy(mia_scared[0], "help me...", sizeof mia_scared[0]);
+ strncpy(mia_scared[1], "i don't wanna die...", sizeof mia_scared[1]);
+ strncpy(mia_scared[2], "please... someone help...", sizeof mia_scared[2]);
+ strncpy(mia_scared[3], "i... i'm scared...", sizeof mia_scared[3]);
+ strncpy(mia_scared[4], "i wanna go home...", sizeof mia_scared[4]);
+ strncpy(mia_scared[5], "what was that?!", sizeof mia_scared[5]);
+ strncpy(mia_scared[6], "i don't like it here...", sizeof mia_scared[6]);
}
void addMIA(const char *name, int x, int y, int type)
{
Entity *mia = new Entity();
- strcpy(mia->name, name);
+ strncpy(mia->name, name, sizeof mia->name);
mia->id = type;
mia->baseThink = 60;
mia->health = 180;
if ((map.foundMIAs == (map.requiredMIAs / 2)) || (game.skill == 0))
{
- sprintf(message, _("Rescued %s - Checkpoint Reached!"), mia->name);
+ snprintf(message, sizeof message, _("Rescued %s - Checkpoint Reached!"), mia->name);
game.setObjectiveCheckPoint();
}
else
{
- sprintf(message, _("Rescued %s!"), mia->name);
+ snprintf(message, sizeof message, _("Rescued %s!"), mia->name);
}
if (map.foundMIAs == map.requiredMIAs)
{
- sprintf(message, _("Rescue %d MIAs - Objective Complete - Checkpoint Reached!"), map.requiredMIAs);
+ snprintf(message, sizeof message, _("Rescue %d MIAs - Objective Complete - Checkpoint Reached!"), map.requiredMIAs);
game.setObjectiveCheckPoint();
}
if (mia->health > 0)
miaFound = false;
- sprintf(string, "MIA_%s", mia->name);
+ snprintf(string, sizeof string, "MIA_%s", mia->name);
if (miaFound)
{
{
char levelMIAKey[100];
- sprintf(levelMIAKey, "%s MIAs", game.stageName);
+ snprintf(levelMIAKey, sizeof levelMIAKey, "%s MIAs", game.stageName);
Data *data = (Data*)gameData.dataList.getHead();
Data *previous = data;
if (map.totalMIAs > 0)
{
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- sprintf(message, _("Rescue %d MIAs"), map.requiredMIAs);
+ snprintf(message, sizeof message, _("Rescue %d MIAs"), map.requiredMIAs);
graphics.drawString(message, col1, y, TXT_RIGHT, graphics.background);
if (map.foundMIAs < map.requiredMIAs)
{
graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
- sprintf(message, "%d / %d", map.foundMIAs, map.requiredMIAs);
+ snprintf(message, sizeof message, "%d / %d", map.foundMIAs, map.requiredMIAs);
graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
}
else
else
{
graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
- sprintf(message, "%d / %d", objective->currentValue, objective->targetValue);
+ snprintf(message, sizeof message, "%d / %d", objective->currentValue, objective->targetValue);
graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
}
}
}
}
- sprintf(message, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
+ snprintf(message, sizeof message, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
graphics.drawString(message, 320, 420, true, graphics.screen);
engine.delay(frameLimit);
{
if (!map.isBossMission)
{
- sprintf(message, _("%s - Objective Completed - Check Point Reached!"), _(objective->description));
+ snprintf(message, sizeof message, _("%s - Objective Completed - Check Point Reached!"), _(objective->description));
game.setObjectiveCheckPoint();
}
else
{
- sprintf(message, _("%s - Objective Completed"), _(objective->description));
+ snprintf(message, sizeof message, _("%s - Objective Completed"), _(objective->description));
}
if (strcmp(objective->description, "Get the Aqua Lung") == 0)
{
- sprintf(message, "Got the Aqua Lung! You can now swim forever!");
+ snprintf(message, sizeof message, "Got the Aqua Lung! You can now swim forever!");
game.hasAquaLung = true;
presentPlayerMedal("Aqua_Lung");
}
if (strcmp(objective->description, "Get the Jetpack") == 0)
{
- sprintf(message, "Got the Jetpack! Press SPACE to Activate!");
+ snprintf(message, sizeof message, "Got the Jetpack! Press SPACE to Activate!");
game.hasJetPack = true;
presentPlayerMedal("Jetpack");
}
switch (Math::prand() % 3)
{
case 0:
- sprintf(message, _("%s - %d more to go..."), _(objective->description), requiredValue);
+ snprintf(message, sizeof message, _("%s - %d more to go..."), _(objective->description), requiredValue);
break;
case 1:
- sprintf(message, _("%s - need %d more"), _(objective->description), requiredValue);
+ snprintf(message, sizeof message, _("%s - need %d more"), _(objective->description), requiredValue);
break;
case 2:
- sprintf(message, _("%s - %d of %d"), _(objective->description), objective->currentValue, objective->targetValue);
+ snprintf(message, sizeof message, _("%s - %d of %d"), _(objective->description), objective->currentValue, objective->targetValue);
break;
}
continue;
}
- sprintf(filename, "%s/%s", dirName, dfile->d_name);
+ snprintf(filename, sizeof filename, "%s/%s", dirName, dfile->d_name);
if (strlen(filename) > PAK_MAX_FILENAME - 1)
{
continue;
}
- sprintf(filename, "%s/%s", dirName, dfile->d_name);
+ snprintf(filename, sizeof filename, "%s/%s", dirName, dfile->d_name);
dirp2 = opendir(filename);
// Copy the input, so that threading
// doesn't trip us up!
char *data = new char[128];
- strcpy(data, tname);
+ strncpy(data, tname, sizeof data);
SDL_Thread *thread = SDL_CreateThread(medalWorker, (void*)data);
if (swt->type == SWT_PRESSURE)
{
- strcpy(swt->requiredObjectName, "@none@");
+ strncpy(swt->requiredObjectName, "@none@", sizeof swt->requiredObjectName);
}
checkObjectives(swt->name, true);
- strcpy(swt->name, "Switch");
+ strncpy(swt->name, "Switch", sizeof swt->name);
}
else
{
- sprintf(message, "%s required", swt->requiredObjectName);
+ snprintf(message, sizeof message, "%s required", swt->requiredObjectName);
engine.setInfoMessage(message, 1, INFO_HINT);
}
}
debug(("tankBossMGInit\n"));
map.boss[0] = new Boss();
- strcpy(map.boss[0]->name, "BioMech Tank V1.1");
+ strncpy(map.boss[0]->name, "BioMech Tank V1.1", sizeof map.boss[0]->name);
map.boss[0]->health = 65 * game.skill;
map.boss[0]->maxHealth = 65 * game.skill;
map.boss[0]->setSprites(graphics.getSprite("BlobTankCannonRight", true), graphics.getSprite("BlobTankCannonLeft", true), graphics.getSprite("BlobTankCannonLeft", true));
debug(("tankBossGLInit\n"));
map.boss[1] = new Boss();
- strcpy(map.boss[1]->name, "BioMech Tank V2.6");
+ strncpy(map.boss[1]->name, "BioMech Tank V2.6", sizeof map.boss[1]->name);
map.boss[1]->health = 65 * game.skill;
map.boss[1]->maxHealth = 65 * game.skill;
map.boss[1]->setSprites(graphics.getSprite("BlobTankGrenadeRight", true), graphics.getSprite("BlobTankGrenadeLeft", true), graphics.getSprite("BlobTankGrenadeLeft", true));
void setupSaveWidgets()
{
char widgetName[10];
- strcpy(widgetName, "");
+ widgetName[0] = 0;
for (int i = 0 ; i < 5 ; i++)
{
- sprintf(widgetName, "save%d", i + 1);
- strcpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i]);
+ snprintf(widgetName, sizeof widgetName, "save%d", i + 1);
+ strncpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i], sizeof engine.getWidgetByName(widgetName)->label);
if ((strstr(engine.saveSlot[i], _("Empty"))) || (strstr(engine.saveSlot[i], _("Corrupt"))))
{
engine.enableWidget(widgetName, false);
}
- sprintf(widgetName, "slot%d", i + 1);
- strcpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i]);
+ snprintf(widgetName, sizeof widgetName, "slot%d", i + 1);
+ strncpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i], sizeof engine.getWidgetByName(widgetName)->label);
}
}
setupSaveWidgets();
Widget *widget = engine.getWidgetByName("labelManual");
- strcpy(widget->label, GAMEPLAYMANUAL);
+ strncpy(widget->label, GAMEPLAYMANUAL, sizeof widget->label);
showTitleWidgets();
}
char v[50];
#define STRINGIFY_VALUE(x) STRINGIFY(x)
#define STRINGIFY(x) #x
- sprintf(v, _("Version %s"), STRINGIFY_VALUE(VERSION));
+ snprintf(v, sizeof v, _("Version %s"), STRINGIFY_VALUE(VERSION));
SDL_Surface *version = graphics.quickSprite("Version", graphics.getString(v, true));
SDL_SetAlpha(title, SDL_SRCALPHA|SDL_RLEACCEL, 0);
int x = 300;
char text[25];
- strcpy(text, "");
+ text[0] = 0;
// joysticks have a button 0 so we can't
// do the same thing as the keyboard(!)
if (*widget->value <= -1000)
{
- sprintf(text, "...");
+ snprintf(text, sizeof text, "...");
}
else if (*widget->value == -2)
{
- sprintf(text, "N/A");
+ snprintf(text, sizeof text, "N/A");
}
else
{
- sprintf(text, "Button #%d", *widget->value);
+ snprintf(text, sizeof text, "Button #%d", *widget->value);
}
graphics.drawString(text, x, widget->y, TXT_LEFT, graphics.screen);