From: Holger Schemel Date: Wed, 6 Jan 1999 23:28:36 +0000 (+0100) Subject: rnd-19990107-1 X-Git-Tag: 1.3.0^2~35 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1e196be4c0a2f1edf823b3a0e5a14a146317686e;p=rocksndiamonds.git rnd-19990107-1 --- diff --git a/src/events.c b/src/events.c index e3ebe5f9..d29cfcfc 100644 --- a/src/events.c +++ b/src/events.c @@ -337,7 +337,12 @@ void HandleButton(int mx, int my, int button) 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]); diff --git a/src/files.c b/src/files.c index 069e61a9..be07f720 100644 --- a/src/files.c +++ b/src/files.c @@ -253,8 +253,8 @@ static void setLevelInfoToDefaults() lev_fieldx = level.fieldx = STD_LEV_FIELDX; lev_fieldy = level.fieldy = STD_LEV_FIELDY; - for(x=0; xjx >= 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 ? @@ -544,6 +591,7 @@ void InitGame() scroll_y = (local_player->jy <= lev_fieldy-MIDPOSY ? local_player->jy - MIDPOSY : lev_fieldy - SCR_FIELDY + 1); +#endif CloseDoor(DOOR_CLOSE_1); @@ -1051,7 +1099,7 @@ void Explode(int ex, int ey, int phase, int mode) 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) && @@ -1214,7 +1262,7 @@ void DynaExplode(int ex, int ey) 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]; @@ -3875,9 +3923,15 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) (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); @@ -3893,9 +3947,15 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) (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); diff --git a/src/init.c b/src/init.c index dcc3e100..0711f651 100644 --- a/src/init.c +++ b/src/init.c @@ -889,7 +889,7 @@ void InitElementProperties() }; static int ep_solid_num = sizeof(ep_solid)/sizeof(int); - static int ep_massiv[] = + static int ep_massive[] = { EL_BETON, EL_SALZSAEURE, @@ -918,7 +918,7 @@ void InitElementProperties() 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[] = { @@ -1430,7 +1430,7 @@ void InitElementProperties() EP_BIT_SCHLUESSEL, EP_BIT_PFORTE, EP_BIT_SOLID, - EP_BIT_MASSIV, + EP_BIT_MASSIVE, EP_BIT_SLIPPERY, EP_BIT_ENEMY, EP_BIT_MAUER, @@ -1461,7 +1461,7 @@ void InitElementProperties() ep_schluessel, ep_pforte, ep_solid, - ep_massiv, + ep_massive, ep_slippery, ep_enemy, ep_mauer, @@ -1492,7 +1492,7 @@ void InitElementProperties() &ep_schluessel_num, &ep_pforte_num, &ep_solid_num, - &ep_massiv_num, + &ep_massive_num, &ep_slippery_num, &ep_enemy_num, &ep_mauer_num, diff --git a/src/main.c b/src/main.c index 142dd653..f117a856 100644 --- a/src/main.c +++ b/src/main.c @@ -89,10 +89,13 @@ int lev_fieldx,lev_fieldy, scroll_x,scroll_y; 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; diff --git a/src/main.h b/src/main.h index 4da25419..f1d50048 100644 --- a/src/main.h +++ b/src/main.h @@ -66,8 +66,13 @@ typedef unsigned char byte; #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 @@ -101,7 +106,7 @@ typedef unsigned char byte; #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) @@ -131,7 +136,7 @@ typedef unsigned char byte; #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) @@ -434,10 +439,13 @@ extern int lev_fieldx,lev_fieldy, scroll_x,scroll_y; 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; diff --git a/src/tools.c b/src/tools.c index 1c27d8ca..424a3272 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1205,7 +1205,12 @@ void DrawScreenField(int x, int y) 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; } @@ -1394,7 +1399,7 @@ void DrawMicroLevel(int xpos, int ypos) 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);