static char *image_filename[NUM_PICTURES] =
{
"RocksScreen.pcx",
+ "RocksElements.pcx",
"RocksDoor.pcx",
"RocksHeroes.pcx",
"RocksToons.pcx",
"RocksSP.pcx",
"RocksDC.pcx",
"RocksMore.pcx",
- "RocksFont.pcx",
- "RocksFont2.pcx",
- "RocksFont3.pcx"
+ "RocksFontBig.pcx",
+ "RocksFontSmall.pcx",
+ "RocksFontMedium.pcx",
+ "RocksFontEM.pcx"
};
static void InitSetup(void);
static void InitArtworkInfo(void);
static void InitLevelArtworkInfo(void);
static void InitNetworkServer(void);
+static void InitImages(void);
static void InitMixer(void);
static void InitSound(void);
static void InitGfx(void);
static void InitGfxBackground(void);
static void InitGadgets(void);
-static void InitElementInfo(void);
static void InitElementProperties(void);
+static void InitElementInfo(void);
+static void InitGraphicInfo(void);
+static void InitSoundInfo();
static void Execute_Debug_Command(char *);
void OpenAll(void)
InitEventFilter(FilterMouseMotionEvents);
InitGfx();
- InitElementInfo();
InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
+ InitElementInfo();
InitLevelInfo();
InitLevelArtworkInfo();
InitGadgets(); /* needs to know number of level series */
+ InitImages(); /* needs to know current level directory */
InitSound(); /* needs to know current level directory */
InitGfxBackground();
#endif
}
+static void InitImages()
+{
+ InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
+
+ /* load custom images */
+ ReloadCustomImages();
+
+ InitGraphicInfo();
+}
+
static void InitMixer()
{
OpenAudio();
- InitSoundList(sound_effects, NUM_SOUND_EFFECTS);
+
+ InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
StartMixer();
}
InitReloadSounds(artwork.snd_current->identifier);
InitReloadMusic(artwork.mus_current->identifier);
- /* initialize sound effect lookup table for element actions */
- InitGameSound();
+ InitSoundInfo();
}
static void InitTileClipmasks()
clip_gc_values.graphics_exposures = False;
clip_gc_valuemask = GCGraphicsExposures;
- tile_clip_gc =
- XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
+ tile_clip_gc = XCreateGC(display, window->drawable,
+ clip_gc_valuemask, &clip_gc_values);
for(i=0; i<NUM_BITMAPS; i++)
{
/* create graphic context structures needed for clipping */
clip_gc_values.graphics_exposures = False;
clip_gc_valuemask = GCGraphicsExposures;
- copy_clipmask_gc =
- XCreateGC(display, pix[PIX_BACK]->clip_mask,
- clip_gc_valuemask, &clip_gc_values);
+ copy_clipmask_gc = XCreateGC(display, pix[PIX_BACK]->clip_mask,
+ clip_gc_valuemask, &clip_gc_values);
/* create only those clipping Pixmaps we really need */
for(i=0; tile_needs_clipping[i].start>=0; i++)
int tile = tile_needs_clipping[i].start + j;
int graphic = tile;
int src_x, src_y;
- int pixmap_nr;
+ Bitmap *src_bitmap;
Pixmap src_pixmap;
- getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
- src_pixmap = pix[pixmap_nr]->clip_mask;
+ getGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
+ src_pixmap = src_bitmap->clip_mask;
tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
TILEX, TILEY, 1);
pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
- pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]);
+ pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
- InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
+ InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL);
DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
for(i=0; i<NUM_PICTURES; i++)
{
- if (i != PIX_SMALLFONT)
+ if (i != PIX_FONT_SMALL)
{
DrawInitText(image_filename[i], 150, FC_YELLOW);
}
}
- InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
+ InitFontInfo(pix[PIX_FONT_BIG], pix[PIX_FONT_MEDIUM], pix[PIX_FONT_SMALL],
+ pix[PIX_FONT_EM]);
InitTileClipmasks();
}
ReloadCustomImage(pix[i], image_filename[i]);
}
+ ReloadCustomImages();
+ InitGraphicInfo();
+
FreeTileClipmasks();
InitTileClipmasks();
InitGfxBackground();
{ -1, -1 }
};
+ static struct
+ {
+ int element;
+ int graphic_left;
+ int graphic_right;
+ int graphic_up;
+ int graphic_down;
+ }
+ element_to_direction_graphic[] =
+ {
+ {
+ EL_FLIEGER,
+ IMG_SPACESHIP_LEFT, IMG_SPACESHIP_RIGHT,
+ IMG_SPACESHIP_UP, IMG_SPACESHIP_DOWN
+ },
+ {
+ EL_KAEFER,
+ IMG_BUG_LEFT, IMG_BUG_RIGHT,
+ IMG_BUG_UP, IMG_BUG_DOWN
+ },
+ {
+ EL_PACMAN,
+ IMG_PACMAN_LEFT, IMG_PACMAN_RIGHT,
+ IMG_PACMAN_UP, IMG_PACMAN_DOWN
+ },
+ {
+ EL_SPIELER1,
+ IMG_PLAYER1_LEFT, IMG_PLAYER1_RIGHT,
+ IMG_PLAYER1_UP, IMG_PLAYER1_DOWN
+ },
+ {
+ EL_SPIELER2,
+ IMG_PLAYER2_LEFT, IMG_PLAYER2_RIGHT,
+ IMG_PLAYER2_UP, IMG_PLAYER2_DOWN
+ },
+ {
+ EL_SPIELER3,
+ IMG_PLAYER3_LEFT, IMG_PLAYER3_RIGHT,
+ IMG_PLAYER3_UP, IMG_PLAYER3_DOWN
+ },
+ {
+ EL_SPIELER4,
+ IMG_PLAYER4_LEFT, IMG_PLAYER4_RIGHT,
+ IMG_PLAYER4_UP, IMG_PLAYER4_DOWN
+ },
+ {
+ EL_SCHWEIN,
+ IMG_PIG_LEFT, IMG_PIG_RIGHT,
+ IMG_PIG_UP, IMG_PIG_DOWN
+ },
+ {
+ EL_DRACHE,
+ IMG_DRAGON_LEFT, IMG_DRAGON_RIGHT,
+ IMG_DRAGON_UP, IMG_DRAGON_DOWN
+ },
+ {
+ EL_MOLE,
+ IMG_MOLE_LEFT, IMG_MOLE_RIGHT,
+ IMG_MOLE_UP, IMG_MOLE_DOWN
+ },
+ {
+ EL_PINGUIN,
+ IMG_PENGUIN_LEFT, IMG_PENGUIN_RIGHT,
+ IMG_PENGUIN_UP, IMG_PENGUIN_DOWN
+ },
+ {
+ EL_SP_MURPHY,
+ IMG_SP_MURPHY_LEFT, IMG_SP_MURPHY_RIGHT,
+ IMG_SP_MURPHY_UP, IMG_SP_MURPHY_DOWN
+ },
+ {
+ EL_SP_SNIKSNAK,
+ IMG_SP_SNIKSNAK_LEFT, IMG_SP_SNIKSNAK_RIGHT,
+ IMG_SP_SNIKSNAK_UP, IMG_SP_SNIKSNAK_DOWN
+ },
+ {
+ -1,
+ -1, -1,
+ -1, -1
+ }
+ };
+
/* always start with reliable default values */
for(i=0; i<MAX_ELEMENTS; i++)
+ {
element_info[i].graphic = GFX_LEERRAUM;
+ element_info[i].has_direction_graphic = FALSE;
+ }
for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
element_info[i].graphic = GFX_CHAR_START + (i - EL_CHAR_START);
element_info[element].graphic = graphic;
i++;
}
+
+ /* this initializes special graphics for left/right/up/down directions */
+ i = 0;
+ while (element_to_direction_graphic[i].element > -1)
+ {
+ int element = element_to_direction_graphic[i].element;
+ int graphic_left = element_to_direction_graphic[i].graphic_left;
+ int graphic_right = element_to_direction_graphic[i].graphic_right;
+ int graphic_up = element_to_direction_graphic[i].graphic_up;
+ int graphic_down = element_to_direction_graphic[i].graphic_down;
+
+ element_info[element].direction_graphic[MV_BIT_LEFT] = graphic_left;
+ element_info[element].direction_graphic[MV_BIT_RIGHT] = graphic_right;
+ element_info[element].direction_graphic[MV_BIT_UP] = graphic_up;
+ element_info[element].direction_graphic[MV_BIT_DOWN] = graphic_down;
+
+ element_info[element].has_direction_graphic = TRUE;
+ i++;
+ }
}
-void InitGraphicInfo()
+static void InitGraphicInfo()
{
int i;
- /* always start with reliable default values */
- for(i=0; i<MAX_GRAPHICS; i++)
- {
- graphic_info[i].bitmap = pix[PIX_SP]; /* graphic that ... */
- graphic_info[i].src_x = 0; /* ... contains ... */
- graphic_info[i].src_y = 0; /* ... empty space. */
- graphic_info[i].anim_frames = 1;
- graphic_info[i].anim_delay = 0;
- graphic_info[i].anim_mode = ANIM_NORMAL;
- }
+ image_files = getCurrentImageList();
for(i=0; i<MAX_GRAPHICS; i++)
{
- int bitmap_nr;
+ /* always start with reliable default values */
+ graphic_info[i].bitmap = NULL;
+ graphic_info[i].src_x = 0;
+ graphic_info[i].src_y = 0;
- getGraphicSource(i, &bitmap_nr,
+ getGraphicSource(i, &graphic_info[i].bitmap,
&graphic_info[i].src_x, &graphic_info[i].src_y);
+ }
- graphic_info[i].bitmap = pix[bitmap_nr];
+ for(i=0; i<NUM_IMAGE_FILES; i++)
+ {
+ int *parameter = image_files[i].parameter;
+
+ /* always start with reliable default values */
+ new_graphic_info[i].bitmap = getBitmapFromImageID(i);
+ new_graphic_info[i].src_x = parameter[GFXARG_XPOS] * TILEX;
+ new_graphic_info[i].src_y = parameter[GFXARG_YPOS] * TILEY;
+ new_graphic_info[i].anim_frames = parameter[GFXARG_FRAMES];
+ new_graphic_info[i].anim_delay = parameter[GFXARG_DELAY];
+ new_graphic_info[i].anim_vertical = parameter[GFXARG_VERTICAL];
+ new_graphic_info[i].anim_mode =
+ (parameter[GFXARG_PINGPONG] ? ANIM_PINGPONG :
+ parameter[GFXARG_REVERSE] ? ANIM_REVERSE : ANIM_NORMAL);
+
+ if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */
+ new_graphic_info[i].anim_delay = 1;
}
+
+#if 0
+ printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFXARG_NUM_FRAMES]);
+ printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFXARG_NUM_FRAMES]);
+
+ graphic_info[GFX_ABLENK].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL);
+ graphic_info[GFX_ABLENK].src_x = 0;
+ graphic_info[GFX_ABLENK].src_y = 0;
+
+ graphic_info[GFX_ABLENK + 1].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL);
+ graphic_info[GFX_ABLENK + 2].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL);
+ graphic_info[GFX_ABLENK + 3].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL);
+ graphic_info[GFX_ABLENK + 1].src_x = 1 * TILEX;
+ graphic_info[GFX_ABLENK + 2].src_x = 2 * TILEX;
+ graphic_info[GFX_ABLENK + 3].src_x = 3 * TILEX;
+ graphic_info[GFX_ABLENK + 1].src_y = 0;
+ graphic_info[GFX_ABLENK + 2].src_y = 0;
+ graphic_info[GFX_ABLENK + 3].src_y = 0;
+#endif
+}
+
+static void InitSoundInfo()
+{
+ sound_files = getCurrentSoundList();
+
+ /* initialize sound effect lookup table for element actions */
+ InitGameSound();
}
void InitElementProperties()
{
if (strcmp(command, "create graphicsinfo.conf") == 0)
{
- printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
+ int i;
+
+ printf("# You can configure additional/alternative image files here.\n");
+ printf("# (The images below are default and therefore commented out.)\n");
printf("\n");
printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
printf("\n");
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
+ printf("\n");
+
+ for (i=0; image_config[i].token != NULL; i++)
+ printf("# %s\n",
+ getFormattedSetupEntry(image_config[i].token,
+ image_config[i].value));
}
else if (strcmp(command, "create soundsinfo.conf") == 0)
{
int i;
- printf("# You can configure additional/alternative sound effects here\n");
+ printf("# You can configure additional/alternative sound files here.\n");
printf("# (The sounds below are default and therefore commented out.)\n");
printf("\n");
printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
printf("\n");
- for (i=0; i<NUM_SOUND_EFFECTS; i++)
+ for (i=0; sound_config[i].token != NULL; i++)
printf("# %s\n",
- getFormattedSetupEntry(sound_effects[i].text,
- sound_effects[i].default_filename));
+ getFormattedSetupEntry(sound_config[i].token,
+ sound_config[i].value));
}
else if (strcmp(command, "create musicinfo.conf") == 0)
{
printf("\n");
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
}
+ else if (strcmp(command, "help") == 0)
+ {
+ printf("The following commands are recognized:\n");
+ printf(" \"create graphicsinfo.conf\"\n");
+ printf(" \"create soundsinfo.conf\"\n");
+ printf(" \"create musicinfo.conf\"\n");
+ }
}
void CloseAllAndExit(int exit_value)
FreeAllMusic();
CloseAudio(); /* called after freeing sounds (needed for SDL) */
+ FreeAllImages();
+
FreeTileClipmasks();
for(i=0; i<NUM_BITMAPS; i++)
FreeBitmap(pix[i]);