From c42450df0ac6ff7b6db97bf0df12b9c73055c727 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 30 Aug 2003 14:24:28 +0200 Subject: [PATCH] rnd-20030830-2-src --- src/conf_fnt.c | 4 +++ src/conf_gfx.c | 5 +++ src/conf_gfx.h | 89 +++++++++++++++++++++++++------------------------- src/conftime.h | 2 +- src/game.c | 73 +++++++++++++++++++++++++++++++++++++++++ src/main.c | 1 + src/main.h | 17 +++++----- src/tools.c | 37 +++++++++++++++++---- src/tools.h | 1 + 9 files changed, 170 insertions(+), 59 deletions(-) diff --git a/src/conf_fnt.c b/src/conf_fnt.c index 0a191dda..ef44d538 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -75,6 +75,10 @@ font_to_graphic[] = FONT_TEXT_1, GFX_SPECIAL_ARG_PREVIEW, IMG_FONT_TEXT_1_PREVIEW }, + { + FONT_TEXT_1, GFX_SPECIAL_ARG_PLAYING, + IMG_FONT_TEXT_1_PLAYING + }, { FONT_TEXT_1, GFX_SPECIAL_ARG_SCORES, IMG_FONT_TEXT_1_SCORES diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 258b7fde..3bd3223f 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3263,6 +3263,11 @@ struct ConfigInfo image_config[] = { "font.text_1.PREVIEW.y", "160" }, { "font.text_1.PREVIEW.width", "16" }, { "font.text_1.PREVIEW.height", "16" }, + { "font.text_1.PLAYING", "RocksFontEM.pcx" }, + { "font.text_1.PLAYING.x", "0" }, + { "font.text_1.PLAYING.y", "160" }, + { "font.text_1.PLAYING.width", "16" }, + { "font.text_1.PLAYING.height", "16" }, { "font.text_1.SCORES", "RocksFontMedium.pcx" }, { "font.text_1.SCORES.x", "0" }, { "font.text_1.SCORES.y", "480" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 41fe2b22..71edd97e 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1248,50 +1248,51 @@ #define IMG_FONT_TEXT_1 1227 #define IMG_FONT_TEXT_1_LEVELS 1228 #define IMG_FONT_TEXT_1_PREVIEW 1229 -#define IMG_FONT_TEXT_1_SCORES 1230 -#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1231 -#define IMG_FONT_TEXT_2 1232 -#define IMG_FONT_TEXT_2_LEVELS 1233 -#define IMG_FONT_TEXT_2_PREVIEW 1234 -#define IMG_FONT_TEXT_2_SCORES 1235 -#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1236 -#define IMG_FONT_TEXT_3 1237 -#define IMG_FONT_TEXT_3_LEVELS 1238 -#define IMG_FONT_TEXT_3_PREVIEW 1239 -#define IMG_FONT_TEXT_3_SCORES 1240 -#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1241 -#define IMG_FONT_TEXT_4 1242 -#define IMG_FONT_TEXT_4_LEVELS 1243 -#define IMG_FONT_TEXT_4_SCORES 1244 -#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1245 -#define IMG_FONT_INPUT_1 1246 -#define IMG_FONT_INPUT_1_MAIN 1247 -#define IMG_FONT_INPUT_1_ACTIVE 1248 -#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1249 -#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1250 -#define IMG_FONT_INPUT_2 1251 -#define IMG_FONT_INPUT_2_ACTIVE 1252 -#define IMG_FONT_OPTION_OFF 1253 -#define IMG_FONT_OPTION_ON 1254 -#define IMG_FONT_VALUE_1 1255 -#define IMG_FONT_VALUE_2 1256 -#define IMG_FONT_VALUE_OLD 1257 -#define IMG_FONT_LEVEL_NUMBER 1258 -#define IMG_FONT_TAPE_RECORDER 1259 -#define IMG_FONT_GAME_INFO 1260 -#define IMG_GLOBAL_BORDER 1261 -#define IMG_GLOBAL_DOOR 1262 -#define IMG_EDITOR_ELEMENT_BORDER 1263 -#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1264 -#define IMG_BACKGROUND 1265 -#define IMG_BACKGROUND_MAIN 1266 -#define IMG_BACKGROUND_LEVELS 1267 -#define IMG_BACKGROUND_SCORES 1268 -#define IMG_BACKGROUND_EDITOR 1269 -#define IMG_BACKGROUND_INFO 1270 -#define IMG_BACKGROUND_SETUP 1271 -#define IMG_BACKGROUND_DOOR 1272 +#define IMG_FONT_TEXT_1_PLAYING 1230 +#define IMG_FONT_TEXT_1_SCORES 1231 +#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1232 +#define IMG_FONT_TEXT_2 1233 +#define IMG_FONT_TEXT_2_LEVELS 1234 +#define IMG_FONT_TEXT_2_PREVIEW 1235 +#define IMG_FONT_TEXT_2_SCORES 1236 +#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1237 +#define IMG_FONT_TEXT_3 1238 +#define IMG_FONT_TEXT_3_LEVELS 1239 +#define IMG_FONT_TEXT_3_PREVIEW 1240 +#define IMG_FONT_TEXT_3_SCORES 1241 +#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1242 +#define IMG_FONT_TEXT_4 1243 +#define IMG_FONT_TEXT_4_LEVELS 1244 +#define IMG_FONT_TEXT_4_SCORES 1245 +#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1246 +#define IMG_FONT_INPUT_1 1247 +#define IMG_FONT_INPUT_1_MAIN 1248 +#define IMG_FONT_INPUT_1_ACTIVE 1249 +#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1250 +#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1251 +#define IMG_FONT_INPUT_2 1252 +#define IMG_FONT_INPUT_2_ACTIVE 1253 +#define IMG_FONT_OPTION_OFF 1254 +#define IMG_FONT_OPTION_ON 1255 +#define IMG_FONT_VALUE_1 1256 +#define IMG_FONT_VALUE_2 1257 +#define IMG_FONT_VALUE_OLD 1258 +#define IMG_FONT_LEVEL_NUMBER 1259 +#define IMG_FONT_TAPE_RECORDER 1260 +#define IMG_FONT_GAME_INFO 1261 +#define IMG_GLOBAL_BORDER 1262 +#define IMG_GLOBAL_DOOR 1263 +#define IMG_EDITOR_ELEMENT_BORDER 1264 +#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1265 +#define IMG_BACKGROUND 1266 +#define IMG_BACKGROUND_MAIN 1267 +#define IMG_BACKGROUND_LEVELS 1268 +#define IMG_BACKGROUND_SCORES 1269 +#define IMG_BACKGROUND_EDITOR 1270 +#define IMG_BACKGROUND_INFO 1271 +#define IMG_BACKGROUND_SETUP 1272 +#define IMG_BACKGROUND_DOOR 1273 -#define NUM_IMAGE_FILES 1273 +#define NUM_IMAGE_FILES 1274 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 728e804b..b3ed1b20 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-08-30 03:37]" +#define COMPILE_DATE_STRING "[2003-08-30 14:20]" diff --git a/src/game.c b/src/game.c index 184a258f..91c8841a 100644 --- a/src/game.c +++ b/src/game.c @@ -1989,6 +1989,75 @@ void CheckDynamite(int x, int y) Bang(x, y); } +void ShowEnvelope() +{ + int i, x, y; + + /* open envelope window horizontally */ + for (i=2; i <= level.envelope_xsize + 2; i += 2) + { + int startx = (SXSIZE / MINI_TILEX - i) / 2; + int starty = (SYSIZE / MINI_TILEY) / 2 - 1; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < 2; y++) for (x=0; x < i; x++) + { + int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == 1 ? +1 : 0); + + DrawEnvelopeBorder(startx + x, starty + y, ex, ey); + } + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(GAME_FRAME_DELAY); + } + + /* open envelope window vertically */ + for (i=2; i <= level.envelope_ysize + 2; i += 2) + { + int xsize = level.envelope_xsize + 2; + int startx = (SXSIZE / MINI_TILEX - (xsize - 1)) / 2; + int starty = (SYSIZE / MINI_TILEY - i) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + + for (y=0; y < i; y++) for (x=0; x < xsize; x++) + { + int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == i - 1 ? +1 : 0); + + DrawEnvelopeBorder(startx + x, starty + y, ex, ey); + } + + DrawTextToTextArea(SX + (startx + 1) * MINI_TILEX, + SY + (starty + 1) * MINI_TILEY, level.envelope, + FONT_TEXT_1, level.envelope_xsize, i - 2); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(GAME_FRAME_DELAY); + } + + Delay(3000); + + SetDrawtoField(DRAW_BUFFERED); + + redraw_mask |= REDRAW_FIELD; + BackToFront(); +} + void RelocatePlayer(int x, int y, int element) { struct PlayerInfo *player = &stored_player[element - EL_PLAYER_1]; @@ -7511,6 +7580,10 @@ int DigField(struct PlayerInfo *player, el2edimg(EL_KEY_1 + key_nr)); redraw_mask |= REDRAW_DOOR_1; } + else if (element == EL_ENVELOPE) + { + ShowEnvelope(); + } else if (IS_DROPPABLE(element)) /* can be collected and dropped */ { int i; diff --git a/src/main.c b/src/main.c index 479e0122..380af747 100644 --- a/src/main.c +++ b/src/main.c @@ -3687,6 +3687,7 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] = { ".EDITOR", GAME_MODE_EDITOR, }, { ".INFO", GAME_MODE_INFO, }, { ".SETUP", GAME_MODE_SETUP, }, + { ".PLAYING", GAME_MODE_PLAYING, }, { ".DOOR", GAME_MODE_PSEUDO_DOOR, }, { ".PREVIEW", GAME_MODE_PSEUDO_PREVIEW, }, { ".CRUMBLED", GAME_MODE_PSEUDO_CRUMBLED, }, diff --git a/src/main.h b/src/main.h index 8a0fca2c..68ad89ca 100644 --- a/src/main.h +++ b/src/main.h @@ -895,11 +895,12 @@ #define GFX_SPECIAL_ARG_EDITOR 3 #define GFX_SPECIAL_ARG_INFO 4 #define GFX_SPECIAL_ARG_SETUP 5 -#define GFX_SPECIAL_ARG_DOOR 6 -#define GFX_SPECIAL_ARG_PREVIEW 7 -#define GFX_SPECIAL_ARG_CRUMBLED 8 +#define GFX_SPECIAL_ARG_PLAYING 6 +#define GFX_SPECIAL_ARG_DOOR 7 +#define GFX_SPECIAL_ARG_PREVIEW 8 +#define GFX_SPECIAL_ARG_CRUMBLED 9 -#define NUM_SPECIAL_GFX_ARGS 9 +#define NUM_SPECIAL_GFX_ARGS 10 /* values for image configuration suffixes */ @@ -979,12 +980,12 @@ #define GAME_MODE_EDITOR 3 #define GAME_MODE_INFO 4 #define GAME_MODE_SETUP 5 -#define GAME_MODE_PSEUDO_DOOR 6 -#define GAME_MODE_PSEUDO_PREVIEW 7 -#define GAME_MODE_PSEUDO_CRUMBLED 8 +#define GAME_MODE_PLAYING 6 +#define GAME_MODE_PSEUDO_DOOR 7 +#define GAME_MODE_PSEUDO_PREVIEW 8 +#define GAME_MODE_PSEUDO_CRUMBLED 9 /* there are no special config file suffixes for these modes */ -#define GAME_MODE_PLAYING 9 #define GAME_MODE_PSEUDO_TYPENAME 10 #define GAME_MODE_QUIT 11 diff --git a/src/tools.c b/src/tools.c index 9d48e4b3..28c64bdf 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1371,12 +1371,12 @@ static int getBorderElement(int x, int y) { EL_STEELWALL, EL_INVISIBLE_STEELWALL } }; int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); - int steel_position = (x == -1 && y == -1 ? 0 : - x == lev_fieldx && y == -1 ? 1 : - x == -1 && y == lev_fieldy ? 2 : - x == lev_fieldx && y == lev_fieldy ? 3 : - x == -1 || x == lev_fieldx ? 4 : - y == -1 || y == lev_fieldy ? 5 : 6); + int steel_position = (x == -1 && y == -1 ? 0 : + x == lev_fieldx && y == -1 ? 1 : + x == -1 && y == lev_fieldy ? 2 : + x == lev_fieldx && y == lev_fieldy ? 3 : + x == -1 || x == lev_fieldx ? 4 : + y == -1 || y == lev_fieldy ? 5 : 6); return border[steel_position][steel_type]; } @@ -1525,6 +1525,31 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y))); } +void DrawEnvelopeBorder(int sx, int sy, int ex, int ey) +{ + int border[8][2] = + { + { EL_STEELWALL_TOPLEFT, EL_INVISIBLE_STEELWALL_TOPLEFT }, + { EL_STEELWALL_TOPRIGHT, EL_INVISIBLE_STEELWALL_TOPRIGHT }, + { EL_STEELWALL_BOTTOMLEFT, EL_INVISIBLE_STEELWALL_BOTTOMLEFT }, + { EL_STEELWALL_BOTTOMRIGHT, EL_INVISIBLE_STEELWALL_BOTTOMRIGHT }, + { EL_STEELWALL_VERTICAL, EL_INVISIBLE_STEELWALL_VERTICAL }, + { EL_STEELWALL_HORIZONTAL, EL_INVISIBLE_STEELWALL_HORIZONTAL }, + { EL_STEELWALL, EL_INVISIBLE_STEELWALL }, + { EL_EMPTY, EL_EMPTY } + }; + int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); + int steel_position = (ex == -1 && ey == -1 ? 0 : + ex == +1 && ey == -1 ? 1 : + ex == -1 && ey == +1 ? 2 : + ex == +1 && ey == +1 ? 3 : + ex == -1 || ex == +1 ? 4 : + ey == -1 || ey == +1 ? 5 : 7); + int element = border[steel_position][steel_type]; + + DrawMiniGraphic(sx, sy, el2edimg(element)); +} + void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { Bitmap *src_bitmap = graphic_info[graphic].bitmap; diff --git a/src/tools.h b/src/tools.h index e7a65872..05f6ed30 100644 --- a/src/tools.h +++ b/src/tools.h @@ -112,6 +112,7 @@ void DrawLevelField(int, int); void DrawMiniElement(int, int, int); void DrawMiniElementOrWall(int, int, int, int); +void DrawEnvelopeBorder(int, int, int, int); void getMicroGraphicSource(int, Bitmap **, int *, int *); void DrawMicroElement(int, int, int); -- 2.34.1