};
static void InitPlayerInfo(void);
+static void InitSetup(void);
static void InitLevelInfo(void);
static void InitNetworkServer(void);
static void InitSound(void);
MSDOS_POINTER_FILENAME,
COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
+ InitSetup();
InitPlayerInfo();
InitCounter();
InitNetworkServer();
}
+void InitSetup()
+{
+ LoadSetup(); /* global setup info */
+}
+
void InitPlayerInfo()
{
int i;
stored_player[i].connected = FALSE;
local_player->connected = TRUE;
-
- LoadSetup(); /* global setup info */
}
void InitLevelInfo()
void InitGfx()
{
- char *filename;
int i;
/* initialize some global variables */
pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
- filename = getImageFilename(image_filename[PIX_SMALLFONT]);
- if ((pix_default[PIX_SMALLFONT] = LoadImage(filename)) == NULL)
- Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
- pix_custom[PIX_SMALLFONT] = NULL;
- pix[PIX_SMALLFONT] = pix_default[PIX_SMALLFONT];
+ pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]);
InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
{
DrawInitText(image_filename[i], 150, FC_YELLOW);
- filename = getImageFilename(image_filename[i]);
- if ((pix_default[i] = LoadImage(filename)) == NULL)
- Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
- pix_custom[i] = NULL;
- pix[i] = pix_default[i];
+ pix[i] = LoadCustomImage(image_filename[i]);
}
}
CloseAudio();
for(i=0; i<NUM_BITMAPS; i++)
- {
- FreeBitmap(pix_default[i]);
- FreeBitmap(pix_custom[i]);
- }
+ FreeBitmap(pix[i]);
CloseVideoDisplay();
ClosePlatformDependantStuff();
return filename;
}
+char *getCustomImageFilename(char *basename)
+{
+#if 0
+ if (strcmp(basename, "RocksFont.pcx") == 0)
+ {
+ char *dir = options.graphics_directory;
+
+ printf("checking directory '%s' ...\n", dir);
+
+ /*
+ dir = getPath2(options.graphics_directory);
+ */
+ }
+#endif
+
+ return getImageFilename(basename);
+}
+
void InitTapeDirectory(char *level_subdir)
{
createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
XFreeGC(display, bitmap->stored_clip_gc);
#endif
+ if (bitmap->source_filename)
+ free(bitmap->source_filename);
+
free(bitmap);
}
return new_bitmap;
}
+Bitmap *LoadCustomImage(char *basename)
+{
+ char *filename = getStringCopy(getCustomImageFilename(basename));
+ Bitmap *new_bitmap;
+
+ if ((new_bitmap = LoadImage(filename)) == NULL)
+ Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
+
+ new_bitmap->source_filename = filename;
+
+ return new_bitmap;
+}
+
/* ========================================================================= */
/* audio functions */