projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20020907-2-src
[rocksndiamonds.git]
/
src
/
init.c
diff --git
a/src/init.c
b/src/init.c
index 53066410638a70567b0d43e9615353c4291bd3ef..f2d07f4152a482bd8971e168bc9704e63383c7ef 100644
(file)
--- a/
src/init.c
+++ b/
src/init.c
@@
-46,7
+46,7
@@
static void InitLevelInfo(void);
static void InitArtworkInfo(void);
static void InitLevelArtworkInfo(void);
static void InitNetworkServer(void);
static void InitArtworkInfo(void);
static void InitLevelArtworkInfo(void);
static void InitNetworkServer(void);
-static void InitImage
Config(
);
+static void InitImage
s(void
);
static void InitMixer(void);
static void InitSound(void);
static void InitGfx(void);
static void InitMixer(void);
static void InitSound(void);
static void InitGfx(void);
@@
-55,6
+55,7
@@
static void InitGadgets(void);
static void InitElementProperties(void);
static void InitElementInfo(void);
static void InitGraphicInfo(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)
static void Execute_Debug_Command(char *);
void OpenAll(void)
@@
-87,7
+88,6
@@
void OpenAll(void)
InitArtworkInfo(); /* needed before loading gfx, sound & music */
InitCounter();
InitArtworkInfo(); /* needed before loading gfx, sound & music */
InitCounter();
- InitImageConfig();
InitMixer();
InitJoysticks();
InitRND(NEW_RANDOMIZE);
InitMixer();
InitJoysticks();
InitRND(NEW_RANDOMIZE);
@@
-101,11
+101,11
@@
void OpenAll(void)
InitGfx();
InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
InitElementInfo();
InitGfx();
InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
InitElementInfo();
- InitGraphicInfo();
InitLevelInfo();
InitLevelArtworkInfo();
InitGadgets(); /* needs to know number of level series */
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();
InitSound(); /* needs to know current level directory */
InitGfxBackground();
@@
-174,15
+174,21
@@
void InitNetworkServer()
#endif
}
#endif
}
-static void InitImage
Config
()
+static void InitImage
s
()
{
{
- InitImageList(image_config, NUM_IMAGE_CONFIG_ENTRIES);
+ InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
+
+ /* load custom images */
+ ReloadCustomImages();
+
+ InitGraphicInfo();
}
static void InitMixer()
{
OpenAudio();
}
static void InitMixer()
{
OpenAudio();
- InitSoundList(sound_config, NUM_SOUND_CONFIG_ENTRIES);
+
+ InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
StartMixer();
}
StartMixer();
}
@@
-193,8
+199,7
@@
static void InitSound()
InitReloadSounds(artwork.snd_current->identifier);
InitReloadMusic(artwork.mus_current->identifier);
InitReloadSounds(artwork.snd_current->identifier);
InitReloadMusic(artwork.mus_current->identifier);
- /* initialize sound effect lookup table for element actions */
- InitGameSound();
+ InitSoundInfo();
}
static void InitTileClipmasks()
}
static void InitTileClipmasks()
@@
-274,8
+279,8
@@
static void InitTileClipmasks()
clip_gc_values.graphics_exposures = False;
clip_gc_valuemask = GCGraphicsExposures;
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++)
{
for(i=0; i<NUM_BITMAPS; i++)
{
@@
-294,9
+299,8
@@
static void InitTileClipmasks()
/* create graphic context structures needed for clipping */
clip_gc_values.graphics_exposures = False;
clip_gc_valuemask = GCGraphicsExposures;
/* 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++)
/* create only those clipping Pixmaps we really need */
for(i=0; tile_needs_clipping[i].start>=0; i++)
@@
-308,11
+312,11
@@
static void InitTileClipmasks()
int tile = tile_needs_clipping[i].start + j;
int graphic = tile;
int src_x, src_y;
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;
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);
tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
TILEX, TILEY, 1);
@@
-494,6
+498,9
@@
void ReloadCustomArtwork()
ReloadCustomImage(pix[i], image_filename[i]);
}
ReloadCustomImage(pix[i], image_filename[i]);
}
+ ReloadCustomImages();
+ InitGraphicInfo();
+
FreeTileClipmasks();
InitTileClipmasks();
InitGfxBackground();
FreeTileClipmasks();
InitTileClipmasks();
InitGfxBackground();
@@
-844,32
+851,37
@@
void InitElementInfo()
}
}
}
}
-void InitGraphicInfo()
+
static
void InitGraphicInfo()
{
int i;
{
int i;
- /* always start with reliable default values */
+ image_files = getCurrentImageList();
+
+ printf("--> %d\n", image_files[0].parameter[2]);
+
for(i=0; i<MAX_GRAPHICS; i++)
{
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. */
+ /* always start with reliable default values */
+ graphic_info[i].bitmap = NULL;
+ graphic_info[i].src_x = 0;
+ graphic_info[i].src_y = 0;
graphic_info[i].anim_frames = 1;
graphic_info[i].anim_delay = 0;
graphic_info[i].anim_mode = ANIM_NORMAL;
graphic_info[i].anim_frames = 1;
graphic_info[i].anim_delay = 0;
graphic_info[i].anim_mode = ANIM_NORMAL;
- }
- for(i=0; i<MAX_GRAPHICS; i++)
- {
- int bitmap_nr;
-
- getGraphicSource(i, &bitmap_nr,
+ getGraphicSource(i, &graphic_info[i].bitmap,
&graphic_info[i].src_x, &graphic_info[i].src_y);
&graphic_info[i].src_x, &graphic_info[i].src_y);
-
- graphic_info[i].bitmap = pix[bitmap_nr];
}
}
}
}
+static void InitSoundInfo()
+{
+ sound_files = getCurrentSoundList();
+
+ /* initialize sound effect lookup table for element actions */
+ InitGameSound();
+}
+
void InitElementProperties()
{
int i, j;
void InitElementProperties()
{
int i, j;
@@
-2061,17
+2073,26
@@
void Execute_Debug_Command(char *command)
{
if (strcmp(command, "create graphicsinfo.conf") == 0)
{
{
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");
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;
}
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("# (The sounds below are default and therefore commented out.)\n");
printf("\n");
printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
@@
-2079,10
+2100,10
@@
void Execute_Debug_Command(char *command)
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
printf("\n");
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
printf("\n");
- for (i=0;
i<NUM_SOUND_CONFIG_ENTRIES
; i++)
+ for (i=0;
sound_config[i].token != NULL
; i++)
printf("# %s\n",
getFormattedSetupEntry(sound_config[i].token,
printf("# %s\n",
getFormattedSetupEntry(sound_config[i].token,
- sound_config[i].
default_filenam
e));
+ sound_config[i].
valu
e));
}
else if (strcmp(command, "create musicinfo.conf") == 0)
{
}
else if (strcmp(command, "create musicinfo.conf") == 0)
{
@@
-2092,6
+2113,13
@@
void Execute_Debug_Command(char *command)
printf("\n");
printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
}
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)
}
void CloseAllAndExit(int exit_value)
@@
-2103,6
+2131,8
@@
void CloseAllAndExit(int exit_value)
FreeAllMusic();
CloseAudio(); /* called after freeing sounds (needed for SDL) */
FreeAllMusic();
CloseAudio(); /* called after freeing sounds (needed for SDL) */
+ FreeAllImages();
+
FreeTileClipmasks();
for(i=0; i<NUM_BITMAPS; i++)
FreeBitmap(pix[i]);
FreeTileClipmasks();
for(i=0; i<NUM_BITMAPS; i++)
FreeBitmap(pix[i]);