- changed default slipping behaviour of gems back to 2.0.0 style;
this is now an element property for gems in the level editor,
although existing converted levels use the new EM gems behaviour
+ - behaviour of "Escape" key in level editor now more intuitive
Release Version 2.0.1 [19 MAR 2002]
-----------------------------------
DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
else if (key == KSYM_Return)
DrawLevelText(0, 0, 0, TEXT_NEWLINE);
+ else if (key == KSYM_Escape)
+ DrawLevelText(0, 0, 0, TEXT_END);
}
else if (button_status == MB_RELEASED)
{
- int i, id;
+ int i, id = GADGET_ID_NONE;
switch (key)
{
button = MB_RIGHTBUTTON;
break;
+ case KSYM_Escape:
+ if (edit_mode == ED_MODE_DRAWING)
+ {
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
+ else
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+ break;
+
default:
- id = GADGET_ID_NONE;
break;
}
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* misuse this function to delete brush cursor, if needed */
if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
DeleteBrushFromCursor();
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* make sure to stay inside drawing area boundaries */
sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);
}
/* allow quick escape to the main menu with the Escape key */
- if (key == KSYM_Escape && game_status != MAINMENU)
+ if (key == KSYM_Escape &&
+ game_status != MAINMENU && game_status != LEVELED)
{
- CloseDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
game_status = MAINMENU;
DrawMainMenu();
return;
break;
case LEVELED:
- if (!anyTextGadgetActiveOrJustFinished)
+ if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape)
HandleLevelEditorKeyInput(key);
break;
static void default_callback_info(void *ptr)
{
-#if 0
- if (game_status == LEVELED)
- HandleEditorGadgetInfoText(ptr);
-#endif
-
return;
}
if (last_info_gi != new_gi ||
(new_gi && new_gi->type == GD_TYPE_DRAWING_AREA && changed_position))
{
- last_info_gi = new_gi;
-
if (new_gi != NULL && (button == 0 || new_gi == last_gi))
{
- new_gi->event.type = 0;
+ new_gi->event.type = GD_EVENT_INFO_ENTERING;
new_gi->callback_info(new_gi);
}
- else
+ else if (last_info_gi != NULL)
+ {
+ last_info_gi->event.type = GD_EVENT_INFO_LEAVING;
+ last_info_gi->callback_info(last_info_gi);
+
+#if 0
default_callback_info(NULL);
+
+ printf("It seems that we are leaving gadget [%s]!\n",
+ (last_info_gi != NULL &&
+ last_info_gi->info_text != NULL ?
+ last_info_gi->info_text : ""));
+#endif
+ }
+
+ last_info_gi = new_gi;
}
if (gadget_pressed)
#define GD_EVENT_OFF_BORDERS (1 << 4)
#define GD_EVENT_TEXT_RETURN (1 << 5)
#define GD_EVENT_TEXT_LEAVING (1 << 6)
+#define GD_EVENT_INFO_ENTERING (1 << 7)
+#define GD_EVENT_INFO_LEAVING (1 << 8)
/* gadget button states */
#define GD_BUTTON_UNPRESSED 0
options.rw_base_directory = RW_BASE_PATH;
options.level_directory = RO_BASE_PATH "/" LEVELS_DIRECTORY;
options.graphics_directory = RO_BASE_PATH "/" GRAPHICS_DIRECTORY;
+ options.sounds_directory = RO_BASE_PATH "/" SOUNDS_DIRECTORY;
+ options.music_directory = RO_BASE_PATH "/" MUSIC_DIRECTORY;
options.serveronly = FALSE;
options.network = FALSE;
options.verbose = FALSE;
{
printf("Usage: %s [options] [server.name [port]]\n"
"Options:\n"
- " -d, --display machine:0 X server display\n"
- " -b, --basepath directory alternative base directory\n"
- " -l, --level directory alternative level directory\n"
- " -g, --graphics directory alternative graphics directory\n"
+ " -d, --display <host>[:<scr>] X server display\n"
+ " -b, --basepath <directory> alternative base directory\n"
+ " -l, --level <directory> alternative level directory\n"
+ " -g, --graphics <directory> alternative graphics directory\n"
+ " -s, --sounds <directory> alternative graphics directory\n"
+ " -m, --music <directory> alternative graphics directory\n"
" -n, --network network multiplayer game\n"
- " -s, --serveronly only start network server\n"
+ " --serveronly only start network server\n"
" -v, --verbose verbose mode\n"
" --debug display debugging information\n",
program.command_basename);
if (option_arg == next_option)
options_left++;
}
+ else if (strncmp(option, "-sounds", option_len) == 0)
+ {
+ if (option_arg == NULL)
+ Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str);
+
+ options.sounds_directory = option_arg;
+ if (option_arg == next_option)
+ options_left++;
+ }
+ else if (strncmp(option, "-music", option_len) == 0)
+ {
+ if (option_arg == NULL)
+ Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str);
+
+ options.music_directory = option_arg;
+ if (option_arg == next_option)
+ options_left++;
+ }
else if (strncmp(option, "-network", option_len) == 0)
{
options.network = TRUE;
static boolean LoadSoundExt(char *sound_name, boolean is_music)
{
struct SampleInfo *snd_info;
- char filename[256];
+ char *filename;
#if !defined(TARGET_SDL) && !defined(PLATFORM_MSDOS)
byte sound_header_buffer[WAV_HEADER_SIZE];
char chunk[CHUNK_ID_LEN + 1];
snd_info = &Sound[num_sounds - 1];
snd_info->name = sound_name;
- sprintf(filename, "%s/%s/%s", options.ro_base_directory,
- (is_music ? MUSIC_DIRECTORY : SOUNDS_DIRECTORY), snd_info->name);
+ filename = getPath2((is_music ? options.music_directory :
+ options.sounds_directory), snd_info->name);
#if defined(TARGET_SDL)
if ((snd_info->mix_chunk = Mix_LoadWAV(filename)) == NULL)
{
Error(ERR_WARN, "cannot read sound file '%s' -- no sounds", filename);
+ free(filename);
return FALSE;
}
if ((file = fopen(filename, MODE_READ)) == NULL)
{
Error(ERR_WARN, "cannot open sound file '%s' -- no sounds", filename);
+ free(filename);
return FALSE;
}
{
Error(ERR_WARN, "missing 'RIFF' chunk of sound file '%s'", filename);
fclose(file);
+ free(filename);
return FALSE;
}
{
Error(ERR_WARN, "missing 'WAVE' chunk of sound file '%s'", filename);
fclose(file);
+ free(filename);
return FALSE;
}
{
Error(ERR_WARN, "missing 'data' chunk of sound file '%s'", filename);
fclose(file);
+ free(filename);
return FALSE;
}
{
Error(ERR_WARN, "cannot read sound file '%s' -- no sounds", filename);
fclose(file);
+ free(filename);
return FALSE;
}
#endif
+ free(filename);
+
return TRUE;
}
{
#if defined(TARGET_SDL)
struct SampleInfo *mod_info;
- char filename[256];
+ char *filename;
num_mods++;
Mod = checked_realloc(Mod, num_mods * sizeof(struct SampleInfo));
mod_info = &Mod[num_mods - 1];
mod_info->name = mod_name;
- sprintf(filename, "%s/%s/%s", options.ro_base_directory,
- MUSIC_DIRECTORY, mod_info->name);
+ filename = getPath2(options.music_directory, mod_info->name);
if ((mod_info->mix_music = Mix_LoadMUS(filename)) == NULL)
{
Error(ERR_WARN, "cannot read music file '%s' -- no music", filename);
+ free(filename);
return FALSE;
}
+ free(filename);
+
return TRUE;
#else
return FALSE;
{
DIR *dir;
struct dirent *dir_entry;
- char *music_directory = getPath2(options.ro_base_directory, MUSIC_DIRECTORY);
int num_wav_music = 0;
int num_mod_music = 0;
if (!audio.sound_available)
return 0;
- if ((dir = opendir(music_directory)) == NULL)
+ if ((dir = opendir(options.music_directory)) == NULL)
{
- Error(ERR_WARN, "cannot read music directory '%s'", music_directory);
+ Error(ERR_WARN, "cannot read music directory '%s'",
+ options.music_directory);
audio.music_available = FALSE;
- free(music_directory);
return 0;
}
if (num_wav_music == 0 && num_mod_music == 0)
Error(ERR_WARN, "cannot find any valid music files in directory '%s'",
- music_directory);
-
- free(music_directory);
+ options.music_directory);
num_music = (num_mod_music > 0 ? num_mod_music : num_wav_music);
char *rw_base_directory;
char *level_directory;
char *graphics_directory;
+ char *sounds_directory;
+ char *music_directory;
boolean serveronly;
boolean network;
boolean verbose;
}
};
-#if 0
-static void DoNotDisplayInfoText(void *ptr)
-{
- return;
-}
-#endif
-
void CreateToolButtons()
{
int i;
GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
GDI_DECORATION_SHIFTING, 1, 1,
GDI_EVENT_MASK, event_mask,
-
-#if 0
- GDI_CALLBACK_INFO, DoNotDisplayInfoText,
-#endif
-
GDI_CALLBACK_ACTION, HandleToolButtons,
GDI_END);