int x = LEVELX(sx);
int y = LEVELY(sy);
- printf("INFO: Feld[%d][%d] == %d\n", x,y, Feld[x][y]);
+ printf("INFO: SCREEN(%d, %d), LEVEL(%d, %d)\n", sx, sy, x, y);
+
+ if (!IN_LEV_FIELD(x, y))
+ break;
+
+ printf(" Feld[%d][%d] == %d\n", x,y, Feld[x][y]);
printf(" Store[%d][%d] == %d\n", x,y, Store[x][y]);
printf(" Store2[%d][%d] == %d\n", x,y, Store2[x][y]);
printf(" StorePlayer[%d][%d] == %d\n", x,y, StorePlayer[x][y]);
lev_fieldx = level.fieldx = STD_LEV_FIELDX;
lev_fieldy = level.fieldy = STD_LEV_FIELDY;
- for(x=0; x<MAX_LEV_FIELDX; x++)
- for(y=0; y<MAX_LEV_FIELDY; y++)
+ for(x=0; x<MAX_LEV_FIELDX; x++)
+ for(y=0; y<MAX_LEV_FIELDY; y++)
Feld[x][y] = Ur[x][y] = EL_ERDREICH;
level.time = 100;
Feld[0][0] = Ur[0][0] = EL_SPIELFIGUR;
Feld[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] =
Ur[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = EL_AUSGANG_ZU;
+
+ BorderElement = EL_BETON;
}
void LoadLevel(int level_nr)
}
}
- for(y=0; y<lev_fieldy; y++)
- for(x=0; x<lev_fieldx; x++)
+ for(y=0; y<lev_fieldy; y++)
+ for(x=0; x<lev_fieldx; x++)
Feld[x][y] = Ur[x][y] = fgetc(file);
fclose(file);
Error(ERR_WARN, "using high speed movement for player");
level.high_speed = TRUE;
}
+
+ /* determine border element */
+ BorderElement = EL_LEERRAUM;
+ for(y=0; y<lev_fieldy && BorderElement == EL_LEERRAUM; y++)
+ {
+ for(x=0; x<lev_fieldx; x++)
+ {
+ if (!IS_MASSIVE(Feld[x][y]))
+ BorderElement = EL_BETON;
+
+ if (y != 0 && y != lev_fieldy - 1 && x != lev_fieldx - 1)
+ x = lev_fieldx - 2;
+ }
+ }
}
void SaveLevel(int level_nr)
emulate_sb ? EMU_SOKOBAN :
emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
+ if (BorderElement == EL_LEERRAUM)
+ {
+ SBX_Left = 0;
+ SBX_Right = lev_fieldx - SCR_FIELDX;
+ SBY_Upper = 0;
+ SBY_Lower = lev_fieldy - SCR_FIELDY;
+ }
+ else
+ {
+ SBX_Left = -1;
+ SBX_Right = lev_fieldx - SCR_FIELDX + 1;
+ SBY_Upper = -1;
+ SBY_Lower = lev_fieldy - SCR_FIELDY + 1;
+ }
+
+ if (lev_fieldx < SCR_FIELDX)
+ {
+ SBX_Left = SBX_Right = -1 * (SCR_FIELDX - lev_fieldx) / 2;
+
+ /*
+ SBX_Left -= (SCR_FIELDX - lev_fieldx) / 2;
+ SBX_Right -= (SCR_FIELDX - lev_fieldx) / 2;
+ */
+ }
+
+ if (lev_fieldy < SCR_FIELDY)
+ {
+ SBY_Upper = SBY_Lower = -1 * (SCR_FIELDY - lev_fieldy) / 2;
+
+ /*
+ SBY_Upper -= (SCR_FIELDY - lev_fieldy) / 2;
+ SBY_Lower -= (SCR_FIELDY - lev_fieldy) / 2;
+ */
+ }
+
+#if 1
+ scroll_x = SBX_Left;
+ scroll_y = SBY_Upper;
+ if (local_player->jx >= SBX_Left + MIDPOSX)
+ scroll_x = (local_player->jx <= SBX_Right + MIDPOSX ?
+ local_player->jx - MIDPOSX :
+ SBX_Right);
+ if (local_player->jy >= SBY_Upper + MIDPOSY)
+ scroll_y = (local_player->jy <= SBY_Lower + MIDPOSY ?
+ local_player->jy - MIDPOSY :
+ SBY_Lower);
+#else
scroll_x = scroll_y = -1;
if (local_player->jx >= MIDPOSX-1)
scroll_x = (local_player->jx <= lev_fieldx-MIDPOSX ?
scroll_y = (local_player->jy <= lev_fieldy-MIDPOSY ?
local_player->jy - MIDPOSY :
lev_fieldy - SCR_FIELDY + 1);
+#endif
CloseDoor(DOOR_CLOSE_1);
RemoveMovingField(x, y);
}
- if (!IN_LEV_FIELD(x, y) || IS_MASSIV(element) || element == EL_BURNING)
+ if (!IN_LEV_FIELD(x, y) || IS_MASSIVE(element) || element == EL_BURNING)
continue;
if ((mode!=EX_NORMAL || center_element == EL_AMOEBA2DIAM) &&
int y = ey+j*xy[i%4][1];
int element;
- if (!IN_LEV_FIELD(x, y) || IS_MASSIV(Feld[x][y]))
+ if (!IN_LEV_FIELD(x, y) || IS_MASSIVE(Feld[x][y]))
break;
element = Feld[x][y];
(player->MovDir == MV_RIGHT && scroll_x < jx-MIDPOSX-offset))
scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset);
+#if 1
+ /* 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);
+#else
/* don't scroll over playfield boundaries */
if (scroll_x < -1 || scroll_x > lev_fieldx - SCR_FIELDX + 1)
scroll_x = (scroll_x < -1 ? -1 : lev_fieldx - SCR_FIELDX + 1);
+#endif
/* don't scroll more than one field at a time */
scroll_x = old_scroll_x + SIGN(scroll_x - old_scroll_x);
(player->MovDir == MV_DOWN && scroll_y < jy-MIDPOSY-offset))
scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset);
+#if 1
+ /* 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);
+#else
/* don't scroll over playfield boundaries */
if (scroll_y < -1 || scroll_y > lev_fieldy - SCR_FIELDY + 1)
scroll_y = (scroll_y < -1 ? -1 : lev_fieldy - SCR_FIELDY + 1);
+#endif
/* don't scroll more than one field at a time */
scroll_y = old_scroll_y + SIGN(scroll_y - old_scroll_y);
};
static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
- static int ep_massiv[] =
+ static int ep_massive[] =
{
EL_BETON,
EL_SALZSAEURE,
EL_SP_HARD_BASE5,
EL_SP_HARD_BASE6,
};
- static int ep_massiv_num = sizeof(ep_massiv)/sizeof(int);
+ static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
static int ep_slippery[] =
{
EP_BIT_SCHLUESSEL,
EP_BIT_PFORTE,
EP_BIT_SOLID,
- EP_BIT_MASSIV,
+ EP_BIT_MASSIVE,
EP_BIT_SLIPPERY,
EP_BIT_ENEMY,
EP_BIT_MAUER,
ep_schluessel,
ep_pforte,
ep_solid,
- ep_massiv,
+ ep_massive,
ep_slippery,
ep_enemy,
ep_mauer,
&ep_schluessel_num,
&ep_pforte_num,
&ep_solid_num,
- &ep_massiv_num,
+ &ep_massive_num,
&ep_slippery_num,
&ep_enemy_num,
&ep_mauer_num,
int FX = SX, FY = SY, ScrollStepSize = TILEX/8;
int ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
int ScreenGfxPos = 0;
+int BorderElement = EL_BETON;
int GameFrameDelay = GAME_FRAME_DELAY;
int FfwdFrameDelay = FFWD_FRAME_DELAY;
int MoveSpeed = 8;
int BX1 = 0, BY1 = 0, BX2 = SCR_FIELDX-1, BY2 = SCR_FIELDY-1;
+int SBX_Left, SBX_Middle, SBX_Right;
+int SBY_Upper, SBY_Middle, SBY_Lower;
int ZX,ZY, ExitX,ExitY;
int AllPlayersGone;
int FrameCounter, TimeFrames, TimePlayed, TimeLeft;
#define MAX_BUF_XSIZE (SCR_FIELDX + 2)
#define MAX_BUF_YSIZE (SCR_FIELDY + 2)
+#if 0
#define MIN_LEV_FIELDX (SCR_FIELDX - 2)
#define MIN_LEV_FIELDY (SCR_FIELDY - 2)
+#else
+#define MIN_LEV_FIELDX 3
+#define MIN_LEV_FIELDY 3
+#endif
#define STD_LEV_FIELDX 64
#define STD_LEV_FIELDY 32
#define MAX_LEV_FIELDX 128
#define EP_BIT_SCHLUESSEL (1 << 2)
#define EP_BIT_PFORTE (1 << 3)
#define EP_BIT_SOLID (1 << 4)
-#define EP_BIT_MASSIV (1 << 5)
+#define EP_BIT_MASSIVE (1 << 5)
#define EP_BIT_SLIPPERY (1 << 6)
#define EP_BIT_ENEMY (1 << 7)
#define EP_BIT_MAUER (1 << 8)
#define IS_SCHLUESSEL(e) (Elementeigenschaften[e] & EP_BIT_SCHLUESSEL)
#define IS_PFORTE(e) (Elementeigenschaften[e] & EP_BIT_PFORTE)
#define IS_SOLID(e) (Elementeigenschaften[e] & EP_BIT_SOLID)
-#define IS_MASSIV(e) (Elementeigenschaften[e] & EP_BIT_MASSIV)
+#define IS_MASSIVE(e) (Elementeigenschaften[e] & EP_BIT_MASSIVE)
#define IS_SLIPPERY(e) (Elementeigenschaften[e] & EP_BIT_SLIPPERY)
#define IS_ENEMY(e) (Elementeigenschaften[e] & EP_BIT_ENEMY)
#define IS_MAUER(e) (Elementeigenschaften[e] & EP_BIT_MAUER)
extern int FX,FY, ScrollStepSize;
extern int ScreenMovDir, ScreenMovPos, ScreenGfxPos;
+extern int BorderElement;
extern int GameFrameDelay;
extern int FfwdFrameDelay;
extern int MoveSpeed;
extern int BX1,BY1, BX2,BY2;
+extern int SBX_Left, SBX_Middle, SBX_Right;
+extern int SBY_Upper, SBY_Middle, SBY_Lower;
extern int ZX,ZY, ExitX,ExitY;
extern int AllPlayersGone;
extern int FrameCounter, TimeFrames, TimePlayed, TimeLeft;
if (!IN_LEV_FIELD(ux, uy))
{
- DrawScreenElement(x, y, EL_BETON);
+ if (ux < -1 || ux > lev_fieldx || uy < -1 || uy > lev_fieldy)
+ element = EL_LEERRAUM;
+ else
+ element = BorderElement;
+
+ DrawScreenElement(x, y, element);
return;
}
Ur[x][y]);
else if (x >= -1 && x < lev_fieldx+1 && y >= -1 && y < lev_fieldy+1)
DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
- EL_BETON);
+ BorderElement);
XFillRectangle(display, drawto,gc, SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);