./Scripts/make_enginetest.sh leveltest
backup:
- ./Scripts/make_backup.sh src
+ ./Scripts/make_backup.sh src 1
+
+backup2:
+ ./Scripts/make_backup.sh src 2
+
+backup3:
+ ./Scripts/make_backup.sh src 3
backup_lev:
./Scripts/make_backup.sh lev
-#define COMPILE_DATE_STRING "[2006-02-17 10:31]"
+#define COMPILE_DATE_STRING "[2006-02-19 21:10]"
extern void UpdateEngineValues(int, int);
extern void DrawAllGameValues(int, int, int, int, int);
extern int getGameFrameDelay_EM(int);
+extern int getCenteredPlayer_EM();
extern void PlayLevelSound_EM(int, int, int, int);
extern void InitGraphicInfo_EM(void);
void HandleKey(Key key, int key_status)
{
- int joy = 0;
boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive();
static struct SetupKeyboardInfo custom_key;
static struct
{ &custom_key.snap, DEFAULT_KEY_SNAP, JOY_BUTTON_1 },
{ &custom_key.drop, DEFAULT_KEY_DROP, JOY_BUTTON_2 }
};
+ int joy = 0;
+ int i;
if (game_status == GAME_MODE_PLAYING)
{
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
{
- int i;
byte key_action = 0;
if (setup.input[pnr].use_joystick)
}
else
{
- int i;
-
for (i = 0; i < 6; i++)
if (key == key_info[i].key_default)
joy |= key_info[i].action;
TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
+ if (game_status == GAME_MODE_PLAYING)
+ {
+ for (i = 0; i < MAX_PLAYERS; i++)
+ if (key == KSYM_1 + i)
+ game.centered_to_player_next = i;
+ }
+
HandleKeysSpecial(key);
if (HandleGadgetsKeyInput(key))
#ifdef DEBUG
case KSYM_0:
+#if 0
case KSYM_1:
case KSYM_2:
case KSYM_3:
case KSYM_7:
case KSYM_8:
case KSYM_9:
+#endif
if (key == KSYM_0)
{
if (GameFrameDelay == 500)
#define SETUP_TOKEN_TIME_LIMIT 14
#define SETUP_TOKEN_FULLSCREEN 15
#define SETUP_TOKEN_ASK_ON_ESCAPE 16
-#define SETUP_TOKEN_GRAPHICS_SET 17
-#define SETUP_TOKEN_SOUNDS_SET 18
-#define SETUP_TOKEN_MUSIC_SET 19
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 20
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 21
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 22
+#define SETUP_TOKEN_QUICK_SWITCH 17
+#define SETUP_TOKEN_GRAPHICS_SET 18
+#define SETUP_TOKEN_SOUNDS_SET 19
+#define SETUP_TOKEN_MUSIC_SET 20
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 21
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 22
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 23
-#define NUM_GLOBAL_SETUP_TOKENS 23
+#define NUM_GLOBAL_SETUP_TOKENS 24
/* editor setup */
#define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0
{ TYPE_SWITCH, &si.time_limit, "time_limit" },
{ TYPE_SWITCH, &si.fullscreen, "fullscreen" },
{ TYPE_SWITCH, &si.ask_on_escape, "ask_on_escape" },
+ { TYPE_SWITCH, &si.quick_switch, "quick_player_switch" },
{ TYPE_STRING, &si.graphics_set, "graphics_set" },
{ TYPE_STRING, &si.sounds_set, "sounds_set" },
{ TYPE_STRING, &si.music_set, "music_set" },
si->time_limit = TRUE;
si->fullscreen = FALSE;
si->ask_on_escape = TRUE;
+ si->quick_switch = FALSE;
si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR);
si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR);
game.envelope_active = FALSE;
+ game.centered_to_player = game.centered_to_player_next = 0; /* player_1 */
+
for (i = 0; i < NUM_BELTS; i++)
{
game.belt_dir[i] = MV_NONE;
Bang(x, y);
}
-void DrawRelocatePlayer(struct PlayerInfo *player)
+void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation)
{
boolean ffwd_delay = (tape.playing && tape.fast_forward);
boolean no_delay = (tape.warp_forward);
int jx = player->jx;
int jy = player->jy;
- if (level.instant_relocation)
+ if (quick_relocation)
{
int offset = (setup.scroll_delay ? 3 : 0);
if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
{
- scroll_x = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left :
- local_player->jx > SBX_Right + MIDPOSX ? SBX_Right :
- local_player->jx - MIDPOSX);
+ scroll_x = (player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ player->jx - MIDPOSX);
- scroll_y = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
- local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
- local_player->jy - MIDPOSY);
+ scroll_y = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ player->jy - MIDPOSY);
}
else
{
int dx = 0, dy = 0;
int fx = FX, fy = FY;
- scroll_xx = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left :
- local_player->jx > SBX_Right + MIDPOSX ? SBX_Right :
- local_player->jx - MIDPOSX);
+ scroll_xx = (player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ player->jx - MIDPOSX);
- scroll_yy = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
- local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
- local_player->jy - MIDPOSY);
+ scroll_yy = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ player->jy - MIDPOSY);
dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0);
dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0);
}
if (player == local_player) /* only visually relocate local player */
- DrawRelocatePlayer(player);
+ DrawRelocatePlayer(player, level.instant_relocation);
TestIfPlayerTouchesBadThing(jx, jy);
TestIfPlayerTouchesCustomElement(jx, jy);
InitPlayfieldScanModeVars();
+ if (ScreenMovPos == 0) /* screen currently aligned at tile position */
+ {
+ if (game.centered_to_player != game.centered_to_player_next)
+ {
+ struct PlayerInfo *player = &stored_player[game.centered_to_player_next];
+
+ DrawRelocatePlayer(player, setup.quick_switch);
+
+ game.centered_to_player = game.centered_to_player_next;
+ }
+ }
+
#if USE_ONE_MORE_CHANGE_PER_FRAME
if (game.engine_version >= VERSION_IDENT(3,2,0,7))
{
#endif
}
+#if 0
if (!options.network && !AllPlayersInSight(player, new_jx, new_jy))
return MP_NO_ACTION;
+#endif
#if !USE_FIXED_DONT_RUN_INTO
element = MovingOrBlocked2ElementIfNotLeaving(new_jx, new_jy);
jx = player->jx;
jy = player->jy;
+#if 1
+ if (moved & MP_MOVING && !ScreenMovPos &&
+ player->index_nr == game.centered_to_player)
+#else
if (moved & MP_MOVING && !ScreenMovPos &&
(player == local_player || !options.network))
+#endif
{
int old_scroll_x = scroll_x, old_scroll_y = scroll_y;
int offset = (setup.scroll_delay ? 3 : 0);
if (scroll_x != old_scroll_x || scroll_y != old_scroll_y)
{
+#if 0
if (!options.network && !AllPlayersInVisibleScreen())
{
scroll_x = old_scroll_x;
scroll_y = old_scroll_y;
}
else
+#endif
{
ScrollScreen(player, SCROLL_INIT);
ScrollLevel(old_scroll_x - scroll_x, old_scroll_y - scroll_y);
extern boolean LoadNativeLevel_EM(char *);
extern void BlitScreenToBitmap_EM(Bitmap *);
-extern void RedrawPlayfield_EM();
+extern void RedrawPlayfield_EM(boolean);
extern void DrawGameDoorValues_EM();
#endif /* GAME_EM_H */
static boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
+static int centered_to_player;
/* copy the entire screen to the window at the scroll position
*
boolean scrolling = (screen_x % TILEX != 0 || screen_y % TILEY != 0);
int x, y;
+#if 0
SyncDisplay();
+#endif
if (redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last)
{
int width = g->width;
int height = g->height;
+#if 1
+ int left = screen_x / TILEX;
+ int top = screen_y / TILEY;
+
+ if (x < left || x >= left + MAX_BUF_XSIZE ||
+ y < top || y >= top + MAX_BUF_YSIZE)
+ return;
+#endif
+
if (draw_masked)
{
if (width > 0 && height > 0)
struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
int i;
+#if 1
+ int left = screen_x / TILEX;
+ int top = screen_y / TILEY;
+
+ if (x < left || x >= left + MAX_BUF_XSIZE ||
+ y < top || y >= top + MAX_BUF_YSIZE)
+ return;
+#endif
+
if (crm == 0) /* no crumbled edges for this tile */
return;
int src_x = g->src_x, src_y = g->src_y;
int dst_x, dst_y;
+#if 1
+ if (x1 < screen_x - TILEX || x1 >= screen_x + MAX_BUF_XSIZE * TILEX ||
+ y1 < screen_y - TILEY || y1 >= screen_y + MAX_BUF_YSIZE * TILEY)
+ return;
+
+ x1 %= MAX_BUF_XSIZE * TILEX;
+ y1 %= MAX_BUF_YSIZE * TILEY;
+#endif
+
if (draw_masked)
{
/* draw the player to current location */
/* only diggable elements can be crumbled in the classic EM engine */
boolean player_is_digging = (new_crm != 0);
+#if 0
x1 %= MAX_BUF_XSIZE * TILEX;
y1 %= MAX_BUF_YSIZE * TILEY;
x2 %= MAX_BUF_XSIZE * TILEX;
y2 %= MAX_BUF_YSIZE * TILEY;
+#endif
if (player_is_digging)
{
int x,y;
int dynamite_state = ply[0].dynamite; /* !!! ONLY PLAYER 1 !!! */
int all_keys_state = ply[0].keys | ply[1].keys | ply[2].keys | ply[3].keys;
+#if 1
+ int player_nr = getCenteredPlayer_EM();
+#else
int player_nr = 0; /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */
+#endif
+
+ centered_to_player = player_nr;
frame = 6;
#if 1
#endif
}
-void RedrawPlayfield_EM()
+#if 0
+void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation)
{
+ boolean ffwd_delay = (tape.playing && tape.fast_forward);
+ boolean no_delay = (tape.warp_forward);
+ int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
+ int wait_delay_value = (no_delay ? 0 : frame_delay_value);
+ int jx = player->jx;
+ int jy = player->jy;
+
+ if (quick_relocation)
+ {
+ int offset = (setup.scroll_delay ? 3 : 0);
+
+ if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
+ {
+ scroll_x = (player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ player->jx - MIDPOSX);
+
+ scroll_y = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ player->jy - MIDPOSY);
+ }
+ else
+ {
+ if ((player->MovDir == MV_LEFT && scroll_x > jx - MIDPOSX + offset) ||
+ (player->MovDir == MV_RIGHT && scroll_x < jx - MIDPOSX - offset))
+ scroll_x = jx - MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset);
+
+ if ((player->MovDir == MV_UP && scroll_y > jy - MIDPOSY + offset) ||
+ (player->MovDir == MV_DOWN && scroll_y < jy - MIDPOSY - offset))
+ scroll_y = jy - MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset);
+
+ /* don't scroll over playfield boundaries */
+ if (scroll_x < SBX_Left || scroll_x > SBX_Right)
+ scroll_x = (scroll_x < SBX_Left ? SBX_Left : SBX_Right);
+
+ /* don't scroll over playfield boundaries */
+ if (scroll_y < SBY_Upper || scroll_y > SBY_Lower)
+ scroll_y = (scroll_y < SBY_Upper ? SBY_Upper : SBY_Lower);
+ }
+
+ RedrawPlayfield(TRUE, 0,0,0,0);
+ }
+ else
+ {
+ int scroll_xx = -999, scroll_yy = -999;
+
+ ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */
+
+ while (scroll_xx != scroll_x || scroll_yy != scroll_y)
+ {
+ int dx = 0, dy = 0;
+ int fx = FX, fy = FY;
+
+ scroll_xx = (player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ player->jx - MIDPOSX);
+
+ scroll_yy = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ player->jy - MIDPOSY);
+
+ dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0);
+ dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0);
+
+ if (dx == 0 && dy == 0) /* no scrolling needed at all */
+ break;
+
+ scroll_x -= dx;
+ scroll_y -= dy;
+
+ fx += dx * TILEX / 2;
+ fy += dy * TILEY / 2;
+
+ ScrollLevel(dx, dy);
+ DrawAllPlayers();
+
+ /* scroll in two steps of half tile size to make things smoother */
+ BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ FlushDisplay();
+ Delay(wait_delay_value);
+
+ /* scroll second step to align at full tile size */
+ BackToFront();
+ Delay(wait_delay_value);
+ }
+
+ DrawPlayer(player);
+ BackToFront();
+ Delay(wait_delay_value);
+ }
+}
+#endif
+
+void RedrawPlayfield_EM(boolean force_redraw)
+{
+#if 1
+ int player_nr = getCenteredPlayer_EM();
+ boolean draw_new_player_location = FALSE;
+ boolean quick_relocation = setup.quick_switch;
+#else
int player_nr = 0; /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */
+#endif
int sx = PLAYER_SCREEN_X(player_nr);
int sy = PLAYER_SCREEN_Y(player_nr);
- int i;
+ int i, x, y;
+
+#if 1
+ boolean scrolling = (screen_x % TILEX != 0 || screen_y % TILEY != 0);
+
+ if (!scrolling) /* screen currently aligned at tile position */
+ {
+ if (player_nr != centered_to_player)
+ {
+ centered_to_player = player_nr;
+
+ draw_new_player_location = TRUE;
+ force_redraw = TRUE;
+ }
+ }
+#endif
+
+ if (draw_new_player_location && !quick_relocation)
+ {
+#if 1
+ unsigned long game_frame_delay_value = getGameFrameDelay_EM(20);
+#else
+ unsigned long game_frame_delay_value = getGameFrameDelay_EM(25);
+#endif
+ int wait_delay_value = game_frame_delay_value;
+ int screen_xx = -999, screen_yy = -999;
+
+ while (screen_xx != screen_x || screen_yy != screen_y)
+ {
+ int screen_xx = VALID_SCREEN_X(PLAYER_SCREEN_X(player_nr));
+ int screen_yy = VALID_SCREEN_Y(PLAYER_SCREEN_Y(player_nr));
+ int dx = (screen_xx < screen_x ? +1 : screen_xx > screen_x ? -1 : 0);
+ int dy = (screen_yy < screen_y ? +1 : screen_yy > screen_y ? -1 : 0);
+ int dxx = 0, dyy = 0;
+
+ if (dx == 0 && dy == 0) /* no scrolling needed at all */
+ break;
+
+ screen_x -= dx * TILEX;
+ screen_y -= dy * TILEY;
+
+ dxx += dx * TILEX / 2;
+ dyy += dy * TILEY / 2;
+
+ /* scroll in two steps of half tile size to make things smoother */
+ screen_x += dxx;
+ screen_y += dyy;
+
+ animscreen();
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ blitplayer(&ply[i]);
+
+ blitscreen();
+ FlushDisplay();
+ Delay(wait_delay_value);
+
+ /* scroll second step to align at full tile size */
+ screen_x -= dxx;
+ screen_y -= dyy;
+
+ SyncDisplay();
+
+ animscreen();
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ blitplayer(&ply[i]);
+
+ blitscreen();
+ FlushDisplay();
+ Delay(wait_delay_value);
+ }
+ }
+
+#if 1
+ if (force_redraw)
+ {
+ for (y = 0; y < MAX_BUF_YSIZE; y++)
+ {
+ for (x = 0; x < MAX_BUF_XSIZE; x++)
+ {
+ screentiles[y][x] = -1;
+ crumbled_state[y][x] = 0;
+ }
+ }
+ }
+#endif
#if 1
for (i = 0; i < MAX_PLAYERS; i++)
blitplayer(&ply[i]);
+ SyncDisplay();
+
blitscreen();
FlushDisplay();
void game_animscreen(void)
{
- RedrawPlayfield_EM();
+ RedrawPlayfield_EM(FALSE);
}
void DrawGameDoorValues_EM()
boolean time_limit;
boolean fullscreen;
boolean ask_on_escape;
+ boolean quick_switch;
char *graphics_set;
char *sounds_set;
/* values for special game initialization control */
boolean restart_level;
+
+ /* values for special game control */
+ int centered_to_player;
+ int centered_to_player_next;
};
struct GlobalInfo
{ TYPE_SWITCH, &setup.skip_levels, "Skip Levels:" },
{ TYPE_SWITCH, &setup.time_limit, "Timelimit:" },
{ TYPE_SWITCH, &setup.autorecord, "Auto-Record:" },
+ { TYPE_SWITCH, &setup.quick_switch, "Quick Switch:" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
if (game_status == GAME_MODE_PLAYING &&
level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
+#if 1
+ RedrawPlayfield_EM(force_redraw);
+#else
BlitScreenToBitmap_EM(backbuffer);
+#endif
}
else if (game_status == GAME_MODE_PLAYING && !game.envelope_active)
{
int last_player_frame = player->Frame;
int frame = 0;
+#if 1
+ /* GfxElement[][] is set to the element the player is digging or collecting;
+ remove also for off-screen player if the player is not moving anymore */
+ if (IN_LEV_FIELD(jx, jy) && !player_is_moving)
+ GfxElement[jx][jy] = EL_UNDEFINED;
+#endif
+
if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
return;
return game_frame_delay_value;
}
+int getCenteredPlayer_EM()
+{
+ if (game.centered_to_player != game.centered_to_player_next)
+ game.centered_to_player = game.centered_to_player_next;
+
+ return game.centered_to_player;
+}
+
unsigned int InitRND(long seed)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)