queue to insert selected stuff into the Windows clipboard, which gets
confused with the "Insert" key for jumping to the last editor cascade
block in the element list)
+ * added Rocks'n'Diamonds icon for use as window icon to SDL version
2006-08-01
* added selection of preferred fullscreen mode to setup / graphics menu
-#define COMPILE_DATE_STRING "[2006-08-04 19:20]"
+#define COMPILE_DATE_STRING "[2006-08-05 00:42]"
{
char *filename_font_initial = NULL;
Bitmap *bitmap_font_initial = NULL;
+ int font_height;
int i, j;
/* determine settings for initial font (for displaying startup messages) */
InitFontGraphicInfo();
+ font_height = getFontHeight(FC_RED);
+
DrawInitText(getProgramInitString(), 20, FC_YELLOW);
DrawInitText(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
+ DrawInitText(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, FC_RED);
DrawInitText("Loading graphics:", 120, FC_GREEN);
}
#include "sound.h"
#include "joystick.h"
#include "misc.h"
+#include "setup.h"
#if defined(TARGET_SDL)
}
}
+static void SDLSetWindowIcon(char *basename)
+{
+ char *filename = getCustomImageFilename(basename);
+ SDL_Surface *surface;
+
+ if (filename == NULL)
+ {
+ Error(ERR_WARN, "SDLSetWindowIcon(): cannot find file '%s'", basename);
+
+ return;
+ }
+
+ if ((surface = IMG_Load(filename)) == NULL)
+ {
+ Error(ERR_WARN, "IMG_Load() failed: %s", SDL_GetError());
+
+ return;
+ }
+
+ /* set transparent color */
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY,
+ SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
+
+ SDL_WM_SetIcon(surface, NULL);
+}
+
void SDLInitVideoDisplay(void)
{
putenv("SDL_VIDEO_CENTERED=1");
}
}
+ /* set window icon */
+ SDLSetWindowIcon(program.sdl_icon_filename);
+
/* open SDL video output device (window or fullscreen mode) */
if (!SDLSetVideoMode(backbuffer, fullscreen))
Error(ERR_EXIT, "setting video mode failed");
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
{
SetError("IMG_Load(): %s", SDL_GetError());
+
return NULL;
}
if ((new_bitmap->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
{
SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
return NULL;
}
if ((new_bitmap->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
{
SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
return NULL;
}
char *userdata_subdir, char *userdata_subdir_unix,
char *program_title, char *window_title, char *icon_title,
char *x11_icon_filename, char *x11_iconmask_filename,
- char *msdos_cursor_filename,
+ char *sdl_icon_filename, char *msdos_cursor_filename,
char *cookie_prefix, char *filename_prefix,
int program_version)
{
program.x11_icon_filename = x11_icon_filename;
program.x11_iconmask_filename = x11_iconmask_filename;
+ program.sdl_icon_filename = sdl_icon_filename;
program.msdos_cursor_filename = msdos_cursor_filename;
program.cookie_prefix = cookie_prefix;
char *x11_icon_filename;
char *x11_iconmask_filename;
+ char *sdl_icon_filename;
char *msdos_cursor_filename;
char *cookie_prefix;
/* function definitions */
void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
- char *, char *, char *, char *, int);
+ char *, char *, char *, char *, char *, int);
void InitExitFunction(void (*exit_function)(int));
void InitPlatformDependentStuff(void);
int main(int argc, char *argv[])
{
+ char * window_title_string = getWindowTitleString();
+
InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
- PROGRAM_TITLE_STRING, getWindowTitleString(),
- ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
+ PROGRAM_TITLE_STRING, window_title_string, ICON_TITLE_STRING,
+ X11_ICON_FILENAME, X11_ICONMASK_FILENAME, SDL_ICON_FILENAME,
MSDOS_POINTER_FILENAME,
COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
#define MICROLEVEL_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
#define MICROLEVEL_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
#define MICROLEVEL_XPOS (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
-#define MICROLEVEL_YPOS (SX + 12 * TILEY - MICRO_TILEY)
+#define MICROLEVEL_YPOS (SY + 12 * TILEY - MICRO_TILEY)
#define MICROLABEL1_YPOS (MICROLEVEL_YPOS - 36)
#define MICROLABEL2_YPOS (MICROLEVEL_YPOS + MICROLEVEL_YSIZE + 7)
#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
#define PROGRAM_AUTHOR_STRING "Holger Schemel"
-#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2006 by Holger Schemel"
+#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2006 by Holger Schemel"
+#define PROGRAM_EMAIL_STRING "info@artsoft.org"
+#define PROGRAM_WEBSITE_STRING "http://www.artsoft.org/"
#define ICON_TITLE_STRING PROGRAM_TITLE_STRING
#define COOKIE_PREFIX "ROCKSNDIAMONDS"
#define X11_ICON_FILENAME "rocks_icon.xbm"
#define X11_ICONMASK_FILENAME "rocks_iconmask.xbm"
+#define SDL_ICON_FILENAME "rocks_icon_32x32.pcx"
#define MSDOS_POINTER_FILENAME "mouse.pcx"
/* file version numbers for resource files (levels, tapes, score, setup, etc.)
DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_2,
"If you like it, send e-mail to:");
DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_3,
- "info@artsoft.org");
+ PROGRAM_EMAIL_STRING);
DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_2,
"or SnailMail to:");
DrawTextSCentered(ystart + 4 * ystep + 0, FONT_TEXT_3,
"33604 Bielefeld");
DrawTextSCentered(ystart + 4 * ystep + 60, FONT_TEXT_3,
"Germany");
-
DrawTextSCentered(ystart + 7 * ystep, FONT_TEXT_2,
+ "More information and levels:");
+ DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_3,
+ PROGRAM_WEBSITE_STRING);
+ DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
"If you have created new levels,");
- DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_2,
+ DrawTextSCentered(ystart + 10 * ystep, FONT_TEXT_2,
"send them to me to include them!");
- DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
+ DrawTextSCentered(ystart + 11 * ystep, FONT_TEXT_2,
":-)");
DrawTextSCentered(ybottom, FONT_TEXT_4,
static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
static int request_gadget_id = -1;
-static int preview_tilesize = TILEX / 8;
+static int preview_tilesize = TILEX / 4;
static char *print_if_not_empty(int element)
{
redraw_mask |= REDRAW_FIELD;
}
-static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y,
- int preview_size_x, int preview_size_y)
+static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
{
+ boolean show_level_border = (BorderElement != EL_EMPTY);
+ int level_size_x = lev_fieldx + (show_level_border ? 2 : 0);
+ int level_size_y = lev_fieldy + (show_level_border ? 2 : 0);
+ int preview_size_x = MICROLEVEL_XSIZE / preview_tilesize;
+ int preview_size_y = MICROLEVEL_YSIZE / preview_tilesize;
+ int real_preview_size_x = MIN(level_size_x, preview_size_x);
+ int real_preview_size_y = MIN(level_size_y, preview_size_y);
int x, y;
DrawBackground(xpos, ypos, MICROLEVEL_XSIZE, MICROLEVEL_YSIZE);
- if (lev_fieldx < preview_size_x)
- xpos += (preview_size_x - lev_fieldx) / 2 * preview_tilesize;
- if (lev_fieldy < preview_size_y)
- ypos += (preview_size_y - lev_fieldy) / 2 * preview_tilesize;
+ xpos += (MICROLEVEL_XSIZE - real_preview_size_x * preview_tilesize) / 2;
+ ypos += (MICROLEVEL_YSIZE - real_preview_size_y * preview_tilesize) / 2;
-#if 1
- xpos += MICRO_TILEX;
- ypos += MICRO_TILEY;
-#else
- xpos += preview_tilesize;
- ypos += preview_tilesize;
-#endif
-
- for (x = -1; x <= preview_size_x; x++)
+ for (x = 0; x < real_preview_size_x; x++)
{
- for (y = -1; y <= preview_size_y; y++)
+ for (y = 0; y < real_preview_size_y; y++)
{
- int lx = from_x + x, ly = from_y + y;
-
- if (lx >= 0 && lx < lev_fieldx &&
- ly >= 0 && ly < lev_fieldy)
- DrawPreviewElement(xpos + x * preview_tilesize,
- ypos + y * preview_tilesize,
- level.field[lx][ly], preview_tilesize);
- else if (lx >= -1 && lx < lev_fieldx+1 &&
- ly >= -1 && ly < lev_fieldy+1 && BorderElement != EL_EMPTY)
- DrawPreviewElement(xpos + x * preview_tilesize,
- ypos + y * preview_tilesize,
- getBorderElement(lx, ly), preview_tilesize);
+ int lx = from_x + x + (show_level_border ? -1 : 0);
+ int ly = from_y + y + (show_level_border ? -1 : 0);
+ int element = (IN_LEV_FIELD(lx, ly) ? level.field[lx][ly] :
+ getBorderElement(lx, ly));
+
+ DrawPreviewElement(xpos + x * preview_tilesize,
+ ypos + y * preview_tilesize,
+ element, preview_tilesize);
}
}
static unsigned long label_delay = 0;
static int from_x, from_y, scroll_direction;
static int label_state, label_counter;
- int preview_size_x = STD_LEV_FIELDX * MICRO_TILESIZE / preview_tilesize;
- int preview_size_y = STD_LEV_FIELDY * MICRO_TILESIZE / preview_tilesize;
+ int delay_factor = preview_tilesize / MICRO_TILESIZE;
+ unsigned long scroll_delay_value = MICROLEVEL_SCROLL_DELAY * delay_factor;
+ boolean show_level_border = (BorderElement != EL_EMPTY);
+ int level_size_x = lev_fieldx + (show_level_border ? 2 : 0);
+ int level_size_y = lev_fieldy + (show_level_border ? 2 : 0);
+ int preview_size_x = MICROLEVEL_XSIZE / preview_tilesize;
+ int preview_size_y = MICROLEVEL_YSIZE / preview_tilesize;
int last_game_status = game_status; /* save current game status */
/* force PREVIEW font on preview level */
label_state = 1;
label_counter = 0;
- DrawMicroLevelExt(xpos, ypos, from_x, from_y,
- preview_size_x, preview_size_y);
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y);
DrawMicroLevelLabelExt(label_state);
/* initialize delay counters */
}
/* scroll micro level, if needed */
- if ((lev_fieldx > preview_size_x || lev_fieldy > preview_size_y) &&
- DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY))
+ if ((level_size_x > preview_size_x || level_size_y > preview_size_y) &&
+ DelayReached(&scroll_delay, scroll_delay_value))
{
switch (scroll_direction)
{
break;
case MV_RIGHT:
- if (from_x < lev_fieldx - preview_size_x)
+ if (from_x < level_size_x - preview_size_x)
from_x++;
else
scroll_direction = MV_DOWN;
break;
case MV_DOWN:
- if (from_y < lev_fieldy - preview_size_y)
+ if (from_y < level_size_y - preview_size_y)
from_y++;
else
scroll_direction = MV_LEFT;
break;
}
- DrawMicroLevelExt(xpos, ypos, from_x, from_y,
- preview_size_x, preview_size_y);
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y);
}
/* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */