/*---------------------------------------------------------------------------*/
#include <SDL.h>
-#include <SDL_image.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "game.h"
#include "gui.h"
#include "set.h"
+#include "text.h"
#include "st_conf.h"
#include "st_title.h"
}
}
-static void toggle_fullscreen(void)
-{
- int x, y;
-
- SDL_GetMouseState(&x, &y);
- config_mode(!config_get_d(CONFIG_FULLSCREEN), config_get_d(CONFIG_WIDTH),
- config_get_d(CONFIG_HEIGHT));
- SDL_WarpMouse(x, y);
-}
-
/*---------------------------------------------------------------------------*/
static int loop(void)
else switch (c)
{
- case SDLK_F11: toggle_fullscreen(); break;
case SDLK_F10: shot(); break;
case SDLK_F9: config_tgl_d(CONFIG_FPS); break;
case SDLK_F8: config_tgl_d(CONFIG_NICE); break;
static unsigned int display_info = 0;
static unsigned int replay_demo = 0;
+#define usage \
+ L_( \
+ "Usage: %s [options ...]\n" \
+ "Options:\n" \
+ " -h, --help show this usage message.\n" \
+ " -v, --version show version.\n" \
+ " -d, --data <dir> use 'dir' as game data directory.\n" \
+ " -r, --replay <file> play the replay 'file'.\n" \
+ " -i, --info display info about a replay.\n" \
+ )
+
#define argument_error(option) { \
- fprintf(stderr, _("Option '%s' requires an argument.\n"), option); \
+ fprintf(stderr, L_("Option '%s' requires an argument.\n"), option); \
}
static void parse_args(int argc, char **argv)
{
int i;
- const char *usage = _(
- "Usage: %s [options ...]\n"
- "Options:\n"
- " -h, --help show this usage message.\n"
- " -v, --version show version.\n"
- " -d, --data <dir> use 'dir' as game data directory.\n"
- " -r, --replay <file> play the replay 'file'.\n"
- " -i, --info display info about a replay.\n"
- );
-
/* Scan argument list. */
for (i = 1; i < argc; i++)
if (display_info)
{
/* FIXME, I'm a required option. */
- fputs(_("Option '--info' requires '--replay'.\n"), stderr);
+ fputs(L_("Option '--info' requires '--replay'.\n"), stderr);
exit(EXIT_FAILURE);
}
}
+#undef usage
#undef argument_error
/*---------------------------------------------------------------------------*/
lang_init("neverball", CONFIG_LOCALE);
+ text_init();
+
parse_args(argc, argv);
if (!config_data_path(data_path, SET_FILE))
{
- fprintf(stderr, _("Failure to establish game data directory\n"));
+ fputs(L_("Failure to establish game data directory\n"), stderr);
return 1;
}
if (!config_user_path(NULL))
{
- fprintf(stderr, _("Failure to establish config directory\n"));
+ fputs(L_("Failure to establish config directory\n"), stderr);
return 1;
}
{
if (!level_replay(demo_path))
{
- fprintf(stderr, _("Replay file '%s': %s\n"), demo_path,
- errno ? strerror(errno) : _("Not a replay file"));
+ fprintf(stderr, L_("Replay file '%s': %s\n"), demo_path,
+ errno ? strerror(errno) : L_("Not a replay file"));
return 1;
}
demo_replay_dump_info();
/* Initialize the audio. */
- audio_bind(AUD_MENU, 3, "snd/menu.wav");
- audio_bind(AUD_START, 1, _("snd/select.ogg"));
- audio_bind(AUD_READY, 1, _("snd/ready.ogg"));
- audio_bind(AUD_SET, 1, _("snd/set.ogg"));
- audio_bind(AUD_GO, 1, _("snd/go.ogg"));
- audio_bind(AUD_BALL, 2, "snd/ball.ogg");
- audio_bind(AUD_BUMPS, 3, "snd/bumplil.ogg");
- audio_bind(AUD_BUMPM, 3, "snd/bump.ogg");
- audio_bind(AUD_BUMPL, 3, "snd/bumpbig.ogg");
- audio_bind(AUD_COIN, 2, "snd/coin.wav");
- audio_bind(AUD_TICK, 4, "snd/tick.ogg");
- audio_bind(AUD_TOCK, 4, "snd/tock.ogg");
- audio_bind(AUD_SWITCH, 5, "snd/switch.wav");
- audio_bind(AUD_JUMP, 5, "snd/jump.ogg");
- audio_bind(AUD_GOAL, 5, "snd/goal.wav");
- audio_bind(AUD_SCORE, 1, _("snd/record.ogg"));
- audio_bind(AUD_FALL, 1, _("snd/fall.ogg"));
- audio_bind(AUD_TIME, 1, _("snd/time.ogg"));
- audio_bind(AUD_OVER, 1, _("snd/over.ogg"));
- audio_bind(AUD_GROW, 5, "snd/grow.ogg");
- audio_bind(AUD_SHRINK, 5, "snd/shrink.ogg");
-
audio_init();
/* Require 16-bit double buffer with 16-bit depth buffer. */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifndef __APPLE__
- /* Set the WM icon */
-
- icon = IMG_Load(config_data("icon/neverball.png"));
-
- if (icon)
+ if ((icon = load_surface("icon/neverball.png")))
{
SDL_WM_SetIcon(icon, NULL);
+ free(icon->pixels);
SDL_FreeSurface(icon);
}
#endif /* __APPLE__ */
config_save();
+ text_quit();
+
return 0;
}