-#define COMPILE_DATE_STRING "[2002-12-19 00:19]"
+#define COMPILE_DATE_STRING "[2002-12-23 00:34]"
break;
}
}
+
+ level.no_level_file = FALSE;
}
static int checkLevelElement(int element)
if (!(file = fopen(filename, MODE_READ)))
{
+ level.no_level_file = TRUE;
+
Error(ERR_WARN, "cannot read level '%s' - creating new level", filename);
return;
}
#define NUM_GAME_BUTTONS 6
/* forward declaration for internal use */
+static void InitBeltMovement(void);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
static void KillHeroUnlessProtected(int, int);
for (j=0; j<4; j++)
if (stored_player[i].key[j])
DrawMiniGraphicExt(drawto, DX_KEYS + j * MINI_TILEX, DY_KEYS,
- GFX_SCHLUESSEL1 + j);
+ IMG_KEY1 + j);
DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW);
}
}
+ InitBeltMovement();
+
game.emulation = (emulate_bd ? EMU_BOULDERDASH :
emulate_sb ? EMU_SOKOBAN :
emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
if (local_player->MovPos)
return;
+ if (tape.playing && tape.auto_play)
+ tape.auto_play_level_solved = TRUE;
+
local_player->LevelSolved = FALSE;
PlaySoundStereo(SND_GAME_WINNING, SOUND_MAX_RIGHT);
}
}
+static void InitBeltMovement()
+{
+ static int belt_base_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT,
+ EL_CONVEYOR_BELT2_LEFT,
+ EL_CONVEYOR_BELT3_LEFT,
+ EL_CONVEYOR_BELT4_LEFT
+ };
+ static int belt_base_active_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT2_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT3_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT4_LEFT_ACTIVE
+ };
+
+ int x, y, i, j;
+
+ /* set frame order for belt animation graphic according to belt direction */
+ for (i=0; i<4; i++)
+ {
+ int belt_nr = i;
+
+ for (j=0; j<3; j++)
+ {
+ int element = belt_base_active_element[belt_nr] + j;
+ int graphic = el2img(element);
+
+ if (game.belt_dir[i] == MV_LEFT)
+ new_graphic_info[graphic].anim_mode &= ~ANIM_REVERSE;
+ else
+ new_graphic_info[graphic].anim_mode |= ANIM_REVERSE;
+ }
+ }
+
+ for(y=0; y<lev_fieldy; y++)
+ {
+ for(x=0; x<lev_fieldx; x++)
+ {
+ int element = Feld[x][y];
+
+ for (i=0; i<4; i++)
+ {
+ if (IS_BELT(element) && game.belt_dir[i] != MV_NO_MOVING)
+ {
+ int e_belt_nr = getBeltNrFromBeltElement(element);
+ int belt_nr = i;
+
+ if (e_belt_nr == belt_nr)
+ {
+ int belt_part = Feld[x][y] - belt_base_element[belt_nr];
+
+ Feld[x][y] = belt_base_active_element[belt_nr] + belt_part;
+ }
+ }
+ }
+ }
+ }
+}
+
static void ToggleBeltSwitch(int x, int y)
{
static int belt_base_element[4] =
player->key[key_nr] = TRUE;
RaiseScoreElement(element);
DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- GFX_SCHLUESSEL1 + key_nr);
+ IMG_KEY1 + key_nr);
DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- GFX_SCHLUESSEL1 + key_nr);
+ IMG_KEY1 + key_nr);
PlaySoundLevel(x, y, SND_KEY_COLLECTING);
break;
}
player->key[key_nr] = TRUE;
RaiseScoreElement(element);
DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- GFX_SCHLUESSEL1 + key_nr);
+ IMG_KEY1 + key_nr);
DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- GFX_SCHLUESSEL1 + key_nr);
+ IMG_KEY1 + key_nr);
PlaySoundLevel(x, y, SND_KEY_COLLECTING);
break;
}
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.autoplay_leveldir = NULL;
options.serveronly = FALSE;
options.network = FALSE;
options.verbose = FALSE;
" -g, --graphics <directory> alternative graphics directory\n"
" -s, --sounds <directory> alternative sounds directory\n"
" -m, --music <directory> alternative music directory\n"
+ " -a, --autoplay <level series> automatically play level tapes\n"
" -n, --network network multiplayer game\n"
" --serveronly only start network server\n"
" -v, --verbose verbose mode\n"
if (option_arg == next_option)
options_left++;
}
+ else if (strncmp(option, "-autoplay", option_len) == 0)
+ {
+ if (option_arg == NULL)
+ Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str);
+
+ options.autoplay_leveldir = option_arg;
+ if (option_arg == next_option)
+ options_left++;
+ }
else if (strncmp(option, "-network", option_len) == 0)
{
options.network = TRUE;
{
int i;
- if (artwork_info->artwork_list == NULL)
+ if (artwork_info == NULL || artwork_info->artwork_list == NULL)
return;
#if 0
char *display_name;
char *server_host;
int server_port;
+
char *ro_base_directory;
char *rw_base_directory;
char *level_directory;
char *graphics_directory;
char *sounds_directory;
char *music_directory;
+ char *autoplay_leveldir;
+
boolean serveronly;
boolean network;
boolean verbose;
boolean debug;
+
char *debug_command;
};
boolean double_speed;
boolean gravity;
boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */
+
+ boolean no_level_file;
};
struct TapeInfo
boolean recording, playing, pausing;
boolean fast_forward;
boolean index_search;
+ boolean auto_play;
+ boolean auto_play_level_solved;
boolean quick_resume;
boolean single_step;
boolean changed;
OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
+ if (options.autoplay_leveldir)
+ AutoPlayTape();
+
#if 0
ClearEventQueue();
#endif
#include "libgame/libgame.h"
#include "tape.h"
+#include "init.h"
#include "game.h"
#include "tools.h"
#include "files.h"
tape.playing = FALSE;
tape.fast_forward = FALSE;
tape.index_search = FALSE;
+ tape.auto_play = (options.autoplay_leveldir != NULL);
+ tape.auto_play_level_solved = FALSE;
tape.quick_resume = FALSE;
tape.single_step = FALSE;
if (tape.counter >= tape.length) /* end of tape reached */
{
- if (tape.index_search)
+ if (tape.index_search && !tape.auto_play)
TapeTogglePause(TAPE_TOGGLE_MANUAL);
else
TapeStop();
DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date);
DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds);
}
+
+ if (tape.auto_play)
+ AutoPlayTape(); /* continue automatically playing next tape */
}
unsigned int GetTapeLength()
}
+/* ------------------------------------------------------------------------- *
+ * tape autoplay functions
+ * ------------------------------------------------------------------------- */
+
+void AutoPlayTape()
+{
+ static LevelDirTree *autoplay_leveldir = NULL;
+ static boolean autoplay_initialized = FALSE;
+ static int autoplay_level_nr = -1;
+
+ if (autoplay_initialized)
+ {
+ /* just finished auto-playing tape */
+ printf("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED");
+ }
+ else
+ {
+ autoplay_leveldir = getTreeInfoFromIdentifier(leveldir_first,
+ options.autoplay_leveldir);
+
+ if (autoplay_leveldir == NULL)
+ Error(ERR_EXIT, "no such level identifier: '%s'",
+ options.autoplay_leveldir);
+
+ leveldir_current = autoplay_leveldir;
+
+ autoplay_level_nr = autoplay_leveldir->first_level;
+
+ printf("Playing tapes of level series '%s'.\n", options.autoplay_leveldir);
+
+ autoplay_initialized = TRUE;
+ }
+
+ while (autoplay_level_nr <= autoplay_leveldir->last_level)
+ {
+ level_nr = autoplay_level_nr++;
+
+ TapeErase();
+
+ printf("Level %03d: ", level_nr);
+
+ LoadLevel(level_nr);
+ if (level.no_level_file)
+ {
+ printf("(no level file)\n");
+ continue;
+ }
+
+ LoadTape(level_nr);
+ if (TAPE_IS_EMPTY(tape))
+ {
+ printf("(no tape file)\n");
+ continue;
+ }
+
+ break;
+ }
+
+ if (autoplay_level_nr >= autoplay_leveldir->last_level)
+ CloseAllAndExit(0);
+
+ printf("playing tape ... ");
+
+ TapeStartGamePlaying();
+ TapeStartIndexSearch();
+}
+
+
/* ---------- new tape button stuff ---------------------------------------- */
/* graphic position values for tape buttons */
void TapeQuickSave(void);
void TapeQuickLoad(void);
+void AutoPlayTape(void);
+
void CreateTapeButtons();
void MapTapeEjectButton();
void MapTapeIndexButton();