gi->event.off_borders = FALSE;
/* initialize delay counter */
- pressed_delay = 0;
- DelayReached(&pressed_delay, GADGET_FRAME_DELAY);
+ DelayReached(&pressed_delay, 0);
if (gi->event_mask & GD_EVENT_PRESSED)
gi->callback_action(gi);
if (!DelayReached(&anim_delay, anim_delay_value))
{
- if (game_status==HELPSCREEN && !restart)
- DrawAnim(anim_pixmap,anim_clip_gc,
- src_x+cut_x,src_y+cut_y, width,height,
- REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y);
+ if ((game_status == HELPSCREEN ||
+ (game_status == MAINMENU && redraw_mask & REDRAW_MICROLEVEL))
+ && !restart)
+ DrawAnim(anim_pixmap, anim_clip_gc,
+ src_x + cut_x, src_y + cut_y, width, height,
+ REAL_SX + dest_x, REAL_SY + dest_y, pad_x, pad_y);
return(FALSE);
}
EL_SP_HARD_BASE5,
EL_SP_HARD_BASE6,
EL_SP_TERMINAL,
- EL_SP_EXIT
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL
};
static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
EL_SP_HARD_BASE4,
EL_SP_HARD_BASE5,
EL_SP_HARD_BASE6,
+ EL_INVISIBLE_STEEL
};
static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
EL_SP_HARD_BASE5,
EL_SP_HARD_BASE6,
EL_SP_TERMINAL,
- EL_SP_EXIT
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL
};
static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
EL_SOKOBAN_OBJEKT,
EL_SOKOBAN_FELD_LEER,
EL_SOKOBAN_FELD_VOLL,
- EL_SPIELFIGUR
+ EL_SPIELFIGUR,
+ EL_INVISIBLE_STEEL
};
static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
EL_SP_HARD_BASE4,
EL_SP_HARD_BASE5,
EL_SP_HARD_BASE6,
- EL_SP_EXIT
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL
};
static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
#define FRAMES_PER_SECOND (1000 / GAME_FRAME_DELAY)
#define GADGET_FRAME_DELAY 150 /* delay between gadget actions */
+#define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */
struct HiScore
{
#define EYSIZE (VXSIZE + 44)
#define FULL_SXSIZE (2+SXSIZE+2)
#define FULL_SYSIZE (2+SYSIZE+2)
-#define MICROLEV_XPOS (SX+4*32+16)
-#define MICROLEV_YPOS (SX+12*32)
-#define MICROLEV_XSIZE (STD_LEV_FIELDX*MICRO_TILEX)
-#define MICROLEV_YSIZE (STD_LEV_FIELDY*MICRO_TILEY)
+#define MICROLEV_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
+#define MICROLEV_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
+#define MICROLEV_XPOS (SX + (SXSIZE - MICROLEV_XSIZE) / 2)
+#define MICROLEV_YPOS (SX + 12 * TILEY - MICRO_TILEY)
#define MICROLABEL_YPOS (MICROLEV_YPOS+MICROLEV_YSIZE+12)
#define FONT1_XSIZE 32
#define FONT1_YSIZE 32
#define EL_ERZ_EDEL_GELB 59
#define EL_MAMPFER2 60
#define EL_SIEB2_INAKTIV 61
-
-#define EL_UNUSED_62 62
-
+#define EL_INVISIBLE_STEEL 62
#define EL_DYNABOMB 63
#define EL_DYNABOMB_NR 64
#define EL_DYNABOMB_SZ 65
#define GFX_FIREFLY_L 206
#define GFX_FIREFLY_U 207
+#define GFX_INVISIBLE_STEEL GFX_UNSICHTBAR
+
#define GFX_SCHLUESSEL GFX_SCHLUESSEL1
#define GFX_SPIELFIGUR GFX_SPIELER1
#define REDRAW_VIDEO_1 (1L << 4)
#define REDRAW_VIDEO_2 (1L << 5)
#define REDRAW_VIDEO_3 (1L << 6)
-#define REDRAW_MICROLEV (1L << 7)
-#define REDRAW_FROM_BACKBUFFER (1L << 8)
-#define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | REDRAW_VIDEO_2 | REDRAW_VIDEO_3)
-#define REDRAW_DOOR_3 (1L << 9)
-#define REDRAW_DOORS (REDRAW_DOOR_1 | REDRAW_DOOR_2 | REDRAW_DOOR_3)
-#define REDRAW_MAIN (REDRAW_FIELD | REDRAW_TILES | REDRAW_MICROLEV)
-#define REDRAWTILES_THRESHOLD SCR_FIELDX*SCR_FIELDY/2
+#define REDRAW_MICROLEVEL (1L << 7)
+#define REDRAW_MICROLEVEL_LABEL (1L << 8)
+#define REDRAW_FROM_BACKBUFFER (1L << 9)
+#define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | \
+ REDRAW_VIDEO_2 | \
+ REDRAW_VIDEO_3)
+#define REDRAW_DOOR_3 (1L << 10)
+#define REDRAW_DOORS (REDRAW_DOOR_1 | \
+ REDRAW_DOOR_2 | \
+ REDRAW_DOOR_3)
+#define REDRAW_MAIN (REDRAW_FIELD | \
+ REDRAW_TILES | \
+ REDRAW_MICROLEVEL | \
+ REDRAW_MICROLEVEL_LABEL)
+#define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
/* areas in pixmap PIX_DOOR */
/* meaning in PIX_DB_DOOR: (3 PAGEs)
DrawText(SX + 32, SY + 8*32, "Setup", FS_BIG, FC_GREEN);
DrawText(SX + 32, SY + 9*32, "Quit", FS_BIG, FC_GREEN);
- DrawMicroLevel(MICROLEV_XPOS,MICROLEV_YPOS);
+ DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE);
DrawTextF(7*32 + 6, 3*32 + 9, FC_RED, "%d-%d",
leveldir[leveldir_nr].first_level,
int2str(level_nr, 3), FS_BIG, font_color);
LoadLevel(level_nr);
- DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS);
+ DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE);
TapeErase();
LoadTape(level_nr);
}
else if (y == 6)
{
- if (leveldir[leveldir_nr].readonly)
+ if (leveldir[leveldir_nr].readonly &&
+ strcmp(setup.player_name, "Artsoft") != 0)
Request("This level is read only !", REQ_CONFIRM);
game_status = LEVELED;
DrawLevelEd();
out:
if (game_status == MAINMENU)
+ {
+ DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE);
DoAnimation();
+ }
}
#define MAX_HELPSCREEN_ELS 10
redraw_mask &= ~REDRAW_DOORS;
}
- if (redraw_mask & REDRAW_MICROLEV)
+ if (redraw_mask & REDRAW_MICROLEVEL)
{
XCopyArea(display,backbuffer,window,gc,
- MICROLEV_XPOS,MICROLEV_YPOS, MICROLEV_XSIZE,MICROLEV_YSIZE,
- MICROLEV_XPOS,MICROLEV_YPOS);
+ MICROLEV_XPOS, MICROLEV_YPOS, MICROLEV_XSIZE, MICROLEV_YSIZE,
+ MICROLEV_XPOS, MICROLEV_YPOS);
+ redraw_mask &= ~REDRAW_MICROLEVEL;
+ }
+
+ if (redraw_mask & REDRAW_MICROLEVEL_LABEL)
+ {
XCopyArea(display,backbuffer,window,gc,
- SX,MICROLABEL_YPOS, SXSIZE,FONT4_YSIZE,
- SX,MICROLABEL_YPOS);
- redraw_mask &= ~REDRAW_MICROLEV;
+ SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE,
+ SX, MICROLABEL_YPOS);
+ redraw_mask &= ~REDRAW_MICROLEVEL_LABEL;
}
if (redraw_mask & REDRAW_TILES)
redraw_mask |= REDRAW_FIELD;
}
-void DrawMicroLevel(int xpos, int ypos)
+static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
{
- int x,y;
+ int x, y;
/* determine border element for this level */
SetBorderElement();
XFillRectangle(display, drawto, gc,
- xpos - MICRO_TILEX, ypos - MICRO_TILEY,
- MICRO_TILEX * (STD_LEV_FIELDX + 2),
- MICRO_TILEY * (STD_LEV_FIELDY + 2));
+ xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
+
if (lev_fieldx < STD_LEV_FIELDX)
- xpos += (STD_LEV_FIELDX - lev_fieldx)/2 * MICRO_TILEX;
+ xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
if (lev_fieldy < STD_LEV_FIELDY)
- ypos += (STD_LEV_FIELDY - lev_fieldy)/2 * MICRO_TILEY;
+ ypos += (STD_LEV_FIELDY - lev_fieldy) / 2 * MICRO_TILEY;
+
+ xpos += MICRO_TILEX;
+ ypos += MICRO_TILEY;
for(x=-1; x<=STD_LEV_FIELDX; x++)
+ {
for(y=-1; y<=STD_LEV_FIELDY; y++)
- if (x >= 0 && x < lev_fieldx && y >= 0 && y < lev_fieldy)
+ {
+ int lx = from_x + x, ly = from_y + y;
+
+ if (lx >= 0 && lx < lev_fieldx && ly >= 0 && ly < lev_fieldy)
DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
- Ur[x][y]);
- else if (x >= -1 && x < lev_fieldx+1 && y >= -1 && y < lev_fieldy+1)
+ Ur[lx][ly]);
+ else if (lx >= -1 && lx < lev_fieldx+1 && ly >= -1 && ly < lev_fieldy+1)
DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
BorderElement);
+ }
+ }
- XFillRectangle(display, drawto,gc, SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);
+ redraw_mask |= REDRAW_MICROLEVEL;
+}
+
+void DrawMicroLevel(int xpos, int ypos, boolean restart)
+{
+ static unsigned long scroll_delay = 0;
+ static int from_x, from_y, scroll_direction;
- if (level.name)
+ if (restart)
{
- int len = strlen(level.name);
- int lxpos = SX + (SXSIZE - len * FONT4_XSIZE) / 2;
- int lypos = MICROLABEL_YPOS;
+ from_x = from_y = 0;
+ scroll_direction = MV_RIGHT;
+
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+
+ XFillRectangle(display, drawto,gc,
+ SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);
+
+ if (level.name && restart)
+ {
+ int len = strlen(level.name);
+ int lxpos = SX + (SXSIZE - len * FONT4_XSIZE) / 2;
+ int lypos = MICROLABEL_YPOS;
+
+ DrawText(lxpos, lypos, level.name, FS_SMALL, FC_SPECIAL2);
+ }
+
+ /* initialize delay counter */
+ DelayReached(&scroll_delay, 0);
- DrawText(lxpos, lypos, level.name, FS_SMALL, FC_SPECIAL2);
+ redraw_mask |= REDRAW_MICROLEVEL_LABEL;
}
+ else
+ {
+ if ((lev_fieldx <= STD_LEV_FIELDX && lev_fieldy <= STD_LEV_FIELDY) ||
+ !DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY))
+ return;
+
+ switch (scroll_direction)
+ {
+ case MV_LEFT:
+ if (from_x > 0)
+ from_x--;
+ else
+ scroll_direction = MV_UP;
+ break;
+
+ case MV_RIGHT:
+ if (from_x < lev_fieldx - STD_LEV_FIELDX)
+ from_x++;
+ else
+ scroll_direction = MV_DOWN;
+ break;
- redraw_mask |= REDRAW_MICROLEV;
+ case MV_UP:
+ if (from_y > 0)
+ from_y--;
+ else
+ scroll_direction = MV_RIGHT;
+ break;
+
+ case MV_DOWN:
+ if (from_y < lev_fieldy - STD_LEV_FIELDY)
+ from_y++;
+ else
+ scroll_direction = MV_LEFT;
+ break;
+
+ default:
+ break;
+ }
+
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+ }
}
int REQ_in_range(int x, int y)
case EL_SPEED_PILL: return GFX_SPEED_PILL;
case EL_SP_TERMINAL_ACTIVE: return GFX_SP_TERMINAL;
case EL_SP_BUG_ACTIVE: return GFX_SP_BUG_ACTIVE;
+ case EL_INVISIBLE_STEEL: return GFX_INVISIBLE_STEEL;
default:
{
void DrawMicroElement(int, int, int);
void DrawLevel(void);
void DrawMiniLevel(int, int);
-void DrawMicroLevel(int, int);
+void DrawMicroLevel(int, int, boolean);
boolean Request(char *, unsigned int);
unsigned int OpenDoor(unsigned int);
unsigned int CloseDoor(unsigned int);