From: Holger Schemel Date: Sat, 6 Sep 2003 23:19:05 +0000 (+0200) Subject: rnd-20030907-1-src X-Git-Tag: 3.0.3^2~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1ed02c282e3b4bd73c5d26244e4df30d731cc6c8;p=rocksndiamonds.git rnd-20030907-1-src --- diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..72a85505 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,321 @@ +2003-08-24 src/game.c + * fixed problem with player animation when snapping and moving + +2003-08-23 src/screens.c, src/cartoons.c, src/libgame/toons.c + * fixed problem with flickering when drawing toon animations + +2003-08-23 src/libgame/sdl.c + * fixed problem with setting mouse cursor in SDL version in fullscreen + +2003-08-23 src/game.c + * fixed bug (missing array boundary check) which could crash the game + +2003-08-23 + * Version number set to 3.0.3. + +2003-08-22 + * Version 3.0.2 released. + +2003-08-21 src/game.c + * fixed bug with creating inaccessible elements at player position + +2003-08-20 src/init.c + * fixed bug with not finding current level artwork directory + +2003-08-20 src/files.c + * fixed bug with choosing wrong engine version when playing tapes + * fixed bug with messing up custom element properties in 3.0.0 levels + +2003-08-18 + * Version number set to 3.0.2. + +2003-08-18 + * Version 3.0.1 released. + +2003-08-17 (no source files affected) + * changed all "classic" PCX image files with 16 colors or less to + 256 color (8 bit) storage format, because the Allegro game library + cannot handle PCX files with less than 256 colors (contributed + graphics are not affected and might look wrong in the DOS version) + +2003-08-16 src/init.c + * fixed bug which (for example) crashed the level editor when defining + "dynamite.EDITOR: [NONE]", because graphics may not be undefined + (only set to default) -- invalid graphics now set to default graphic + +2003-08-16 src/init.c + * fixed graphical bug of player digging/collecting/snapping element + when no corresponding graphic/animation is defined for this action, + resulting in player being drawn as EL_EMPTY (which should only be + done to elements being collected, but not to the player) + +2003-08-16 src/game.c + * fixed small graphical bug of player not totally moving into exit + +2003-08-16 src/libgame/setup.c + * fixed bug with wrong MS-DOS 8.3 filename conversion + +2003-08-16 src/tools.c + * fixed bug with invisible mouse cursor when pressing ESC while playing + +2003-08-16 (various source files) + * added another 128 custom elements (disabled in editor by default) + +2003-08-16 src/editor.c + * fixed NULL string bug causing Solaris to crash in sprintf() + +2003-08-16 src/screen.c + * fixed drawing over scrollbar on level selection with custom fonts + +2003-08-15 src/game.c + * cleanup of simple sounds / loop sounds / music settings + +2003-08-08 (various source files) + * added custom element property for dropping collected elements + +2003-08-08 src/conf_gfx.c + * fixed bug with missing graphic for active red disk bomb + +2003-08-07 src/files.c, src/editor.c src/game.c, src/main.h + * Extended variable "level.gravity" to "level.initial_gravity" and + "game.current_gravity" to prevent level setting from being changed + by playing the level (keeping the runtime value after playing). + + * Fixed graphics bug when digging element that has 'crumbled' graphic + definition, but not 'diggable' graphic definition. + +2003-08-06 + * Version number set to 3.0.1. + +2003-08-05 + * Version 3.0.0 released. + +2003-08-05 + * various bug fixes; among others: + - fixed bug with pushing spring over empty space + - fixed bug with leaving tube while placing dynamite + - fixed bug with explosion of smashed penguins + - allow Murphy player graphic in levels with non-Supaplex elements + +2003-04-07 + * Various changes. + * I have forgotten to document changes for some time. + +2002-12-31 + * Pre-Release Version 2.2.0rc1 released. + +2002-08-25 + * Version number set to 2.1.2. + +2002-08-13 + * Version 2.1.1 released. + +2002-08-10 + * Version number set to 2.1.1. + +2002-08-05 + * Version 2.1.0 released. + +2002-05-19 + * Version number set to 2.1.0. + +2002-04-03 to 2002-05-19 (various source files) + * graphics, sounds and music now fully configurable + * bug fixed that prevented walking through tubes when gravity on + +2002-04-02 src/events.c, src/editor.c + * Make Escape key less aggressive when playing or when editing level. + This can be configured as an option in the setup menu. (Default is + "less aggressive" which means "ask user if something can be lost" + when pressing the Escape key.) + +2002-04-02 src/screen.c + * Added "graphics setup" screen. + +2002-04-01 src/screen.c + * Changed "choose level" setup screen stuff to be more generic (to + make it easier to add more "choose from generic tree" setup screens). + +2002-04-01 src/config.c, src/timestamp.h + * Added source files "src/config.[ch]" and "src/timestamp.h" (which + automatically gets created by "src/Makefile" and contains an actual + compile-time timestamp to identify development versions of the game). + +2002-03-31 src/tape.c, src/events.c + * Added quick game/tape save/load functions to tape stuff which can be + invoked by a keyboard shortcut. Default: "F1" saves game/tape, "F2" + loads previously recorded tape and directly goes into recording mode + from the end of the tape (therefore appending to the tape). + +2002-03-31 src/tape.c + * Added "index mark" function to tape recorder. When playing or + recording, "eject" button changes to "index" button. Setting index + mark is not yet implemented, but pressing index button when playing + allows very quick advancing to end of tape (when normal playing), + very fast forward mode (when playing with normal fast forward) or + very fast reaching of "pause before end of tape" (when playing with + "pause before end" playing mode). + +2002-03-30 src/cartoons.c + * Moved some stuff from cartoons.c to the new "src/libgame/toons.c". + +2002-03-29 src/screen.c + * Changed setup screen stuff to be more generic (to make it easier + to add more setup screens). + +2002-03-23 src/main.c, src/main.h + * Various changes due to the introduction of the new libgame files + "setup.c" and "joystick.c". + +2002-03-23 src/files.c + * Generic parts of "src/files.c" (mainly setup and level directory + stuff) moved to new libgame file "src/libgame/setup.c". + +2002-03-23 src/joystick.c + * File "src/joystick.c" moved to libgame source tree, with + correspondig changes. + +2002-03-22 src/screens.c + * "HandleChooseLevel()": Another bug in level series navigation fixed. + (Wrong level series information displayed when entering main group.) + +2002-03-22 src/editor.c + * Slight change to support new gadget event "GD_EVENT_INFO_LEAVING". + +2002-03-22 src/editor.c + * Changed behaviour of "Escape" key in level editor to be more + intuitive: When in "Element Properties" or "Level Info" mode, + return to "Drawing Mode" instead of leaving the level editor. + +2002-03-21 src/game.c, src/editor.c, src/files.c + * 2.0.1 introduced the corrected "Emerald Mine" style behaviour of + gems (emeralds, diamonds, ...) slipping down from normal wall, + steel wall and growing wall (as in E.M.C. style levels). Although + the behaviour of contributed and private levels wasn't changed (due + to the use of "level.game_version"; see previous entry), editing + those levels will (of course) change the behaviour accordingly. + + This change seems a bit too hard after thinking about it, because + the EM style behaviour is not the "expected" behaviour (gems would + normally only slip down from "rounded" walls). Therefore this was + now changed to an element property for gem style elements, with the + default setting "off" (which means: no special EM style behaviour). + To fix older converted levels, this flag is set to "on" for pre-2.0 + levels that are neither contributed nor private levels. + +2002-03-20 src/files.h + * Corrected settings for "level.game_version" depending of level type. + (Contributed and private levels always get played with game engine + version they were created with, while converted levels always get + played with the most recent version of the game engine, to let new + corrections of the emulation behaviour take effect.) + +2002-03-20 src/main.h + * Added "#include ". This seems to be needed by "tape.c" for + compiling the SDL version on some systems. + Thanks to the several people who pointed this out. + +2002-03-19 + * Version number set to 2.0.2. + +2002-03-19 + * Version 2.0.1 released. + +2002-03-18 src/screens.c + * "HandleChooseLevel()": Small bug in level series navigation fixed. + +2002-03-18 src/files.c [src/libgame/misc.c] + * Moved some common functions from src/files.c to src/libgame/misc.c. + +2002-03-18 src/files.c [src/libgame/misc.c] + * Changed permissions for new directories and saved files (especially + score files) according to suggestions of Debian users and mantainers. + Thanks to Drew Parsons for the patch. + +2002-03-17 src/files.c + * Changed "{Load|Save}{Level|Tape}()" to IFF style file format: + Replaced "cookie" header string ("ROCKSNDIAMONDS_...\n") with + real IFF style header "RND1....XXXX" (where "XXXX" is "CAVE" + for levels and "TAPE" for tapes). Old "cookie" style format is + still supported for reading. New level and tape files are written + in new format. + + * New IFF chunk "VERS" contains version numbers for file and game + (where "game version" is the version of the program that wrote the + file, and "file version" is a version number to distinguish files + with different format, for example after adding new features). + +2002-03-15 src/screen.c + * "DrawHallOfFame()": "FadeSounds()" when entering the hall of fame. + (Before, you heard a mixture of the in-game music and the + hall-of-fame music.) + +2002-03-14 src/events.c + * Function "DumpTape()" (files.c) now available by pressing 't' from + main menu (when in DEBUG mode). + +2002-03-14 src/game.c + * "GameWon()": When game was won playing a tape, now there is no delay + raising the score and no corresponding sound is played. + +2002-03-14 src/files.c + * Changed "LoadTape()" for real chunk support and also adjusted + "SaveTape()" accordingly. + +2002-03-14 src/game.c, src/tape.c, src/files.c + * Important changes to tape format: The old tape format stored all + actions with a real effect with a corresponding delay between the + stored actions. This had some major disadvantages (for example, + push delays had to be ignored, pressing a button for some seconds + mutated to several single button presses because of the non-action + delays between two action frames etc.). The new tape format just + stupidly records all device actions and replays them later. I really + don't know why I haven't solved it that way before?! Old-style tapes + (with tape file version less than 2.0) get converted to the new + format on-the-fly when loading and can therefore still be played; + only some minor parts of the old-style tape handling code was needed. + (A perfect conversion is not possible, because there is information + missing about the device actions between two action frames.) + +2002-03-14 src/files.c + * New function "DumpTape()" to dump the contents of the current tape + in a human readable format. + +2002-03-14 src/game.c + * Small tape bug fixed: When automatically advancing to next level + after a game was won, the tape from the previous level still was + loaded as a tape for the new level. + +2002-03-14 src/tape.c + * Small graphical bug fixed: When pressing ""Record" or "Play" on + tape, cartoons did not get completely removed because + StopAnimation() was not called. + +2002-03-13 src/files.c + * Changed "LoadLevel()" and "SaveLevel()" to add new chunk "CNT2". + Fixed bug of "CONT" and "BODY" (chunk size was set to 8-bit element + size even when using 16-bit elements). Added new chunk "CNT2" for + 16-bit amoeba content (previously written in 8-bit field in "HEAD" + chunk even when content was 16-bit element). "CNT2" should now be + able to store content for arbitrary elements (up to eight blocks of + 3 x 3 element arrays). All "CNT2" elements will always be stored as + 16-bit elements. "CONT" (with 8/16-bit elements) now obsolete. + +2002-03-13 src/files.c + * Changed "LoadLevel()" for real chunk support. + +2002-03-12 src/game.c + * Fixed problem (introduced after 2.0.0 release) with penguins + not getting killed by enemies + +2002-02-24 src/game.c, src/main.h + * Added "player->is_moving"; now "player->last_move_dir" does + not contain any information if the player is just moving at + the moment or not. + Before, "player->last_move_dir" was misused for this purpose + for the robot stuff (robots don't kill players when they are + moving). But setting "player->last_move_dir" to MV_NO_MOVING + broke tapes when walking through pipes! + ("IS_MOVING()" uses "MovPos[][]", but this fails when it is 0 + in a continuous movement. This fact is ignored for friends and + enemies, though.) diff --git a/src/conf_chr.c b/src/conf_chr.c index 00fe6994..506c8b27 100644 --- a/src/conf_chr.c +++ b/src/conf_chr.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_chr.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_chr.h b/src/conf_chr.h index 373ef0de..8cee2724 100644 --- a/src/conf_chr.h +++ b/src/conf_chr.h @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_chr.h * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_cus.c b/src/conf_cus.c index fdf2c343..dd54ef34 100644 --- a/src/conf_cus.c +++ b/src/conf_cus.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_cus.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_cus.h b/src/conf_cus.h index 9078594e..867cd125 100644 --- a/src/conf_cus.h +++ b/src/conf_cus.h @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_cus.h * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_e2g.c b/src/conf_e2g.c index 88c254b6..8e88f2b0 100644 --- a/src/conf_e2g.c +++ b/src/conf_e2g.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_e2g.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_e2s.c b/src/conf_e2s.c index f17b1b3e..6e229df2 100644 --- a/src/conf_e2s.c +++ b/src/conf_e2s.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_e2s.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_esg.c b/src/conf_esg.c index 177d0dc0..233ea9e9 100644 --- a/src/conf_esg.c +++ b/src/conf_esg.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_esg.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_fnt.c b/src/conf_fnt.c index 3ea90ce9..ef44d538 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_fnt.c * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_gfx.c b/src/conf_gfx.c index fc55f2d6..55c6f387 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3443,8 +3443,8 @@ struct ConfigInfo image_config[] = { "editor.element_border_input.ypos", "0" }, { "game.envelope_background", "RocksScreen.pcx" }, - { "game.envelope_background.xpos", "0" }, - { "game.envelope_background.ypos", "0" }, + { "game.envelope_background.x", "0" }, + { "game.envelope_background.y", "0" }, { "game.envelope_background.width", "560" }, { "game.envelope_background.height", "560" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 59857703..9033fc69 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_gfx.h * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conf_snd.h b/src/conf_snd.h index bfb6db88..94366024 100644 --- a/src/conf_snd.h +++ b/src/conf_snd.h @@ -1,3 +1,15 @@ +/*********************************************************** +* Rocks'n'Diamonds -- McDuffin Strikes Back! * +*----------------------------------------------------------* +* (c) 1995-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* conf_snd.h * +***********************************************************/ /* ----- this file was automatically generated -- do not edit by hand ----- */ diff --git a/src/conftime.h b/src/conftime.h index b425e6a4..f75d70a6 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-09-05 19:38]" +#define COMPILE_DATE_STRING "[2003-09-06 22:18]" diff --git a/src/files.c b/src/files.c index efbe71aa..0b85e1eb 100644 --- a/src/files.c +++ b/src/files.c @@ -927,7 +927,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) int i, j; /* map custom element change events that have changed in newer versions - (these following values have accidentally changed in version 3.0.1) */ + (these following values were accidentally changed in version 3.0.1) */ if (level->game_version <= VERSION_IDENT(3,0,0)) { for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) diff --git a/src/game.c b/src/game.c index ff6d5568..91694d2d 100644 --- a/src/game.c +++ b/src/game.c @@ -753,11 +753,11 @@ static void InitGameEngine() InitElementPropertiesEngine(game.engine_version); #if 0 - printf("level %d: level version == %06d\n", level_nr, level.game_version); - printf(" tape version == %06d [%s] [file: %06d]\n", - tape.engine_version, (tape.playing ? "PLAYING" : "RECORDING"), - tape.file_version); - printf(" => game.engine_version == %06d\n", game.engine_version); + printf("level %d: level version == %06d\n", level_nr, level.game_version); + printf(" tape version == %06d [%s] [file: %06d]\n", + tape.engine_version, (tape.playing ? "PLAYING" : "RECORDING"), + tape.file_version); + printf(" => game.engine_version == %06d\n", game.engine_version); #endif /* ---------- initialize player's initial move delay --------------------- */ @@ -1581,8 +1581,13 @@ void GameWon() if (local_player->MovPos) return; +#if 1 + if (tape.auto_play) /* tape might already be stopped here */ + tape.auto_play_level_solved = TRUE; +#else if (tape.playing && tape.auto_play) tape.auto_play_level_solved = TRUE; +#endif local_player->LevelSolved = FALSE; @@ -1989,165 +1994,6 @@ void CheckDynamite(int x, int y) Bang(x, y); } -void ShowEnvelope() -{ - int graphic = IMG_GAME_ENVELOPE_BACKGROUND; - boolean draw_masked = graphic_info[graphic].draw_masked; - int mask_mode = (draw_masked ? BLIT_MASKED : BLIT_ON_BACKGROUND); - int font_nr = FONT_TEXT_1; - int font_width = getFontWidth(font_nr); - int font_height = getFontHeight(font_nr); - int i, x, y; - - /* open envelope window horizontally */ - for (i = 2; i <= level.envelope_xsize + 2; i += 2) - { - int startx = (SXSIZE / font_width - i) / 2; - int starty = (SYSIZE / font_height) / 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 sx = SX + (startx + x) * font_width; - int sy = SY + (starty + y) * font_height; - int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == 1 ? +1 : 0); - - DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); - } - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - - /* special case: envelope has odd width */ - if (level.envelope_xsize % 2 && i == 2) - i--; - } - - /* open envelope window vertically */ - for (i = 2; i <= level.envelope_ysize + 2; i += 2) - { - int xsize = level.envelope_xsize + 2; - int startx = (SXSIZE / font_width - (xsize - 1)) / 2; - int starty = (SYSIZE / font_height - 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 sx = SX + (startx + x) * font_width; - int sy = SY + (starty + y) * font_height; - int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == i - 1 ? +1 : 0); - - DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); - } - - DrawTextToTextArea(SX + (startx + 1) * font_width, - SY + (starty + 1) * font_height, level.envelope, - FONT_TEXT_1, level.envelope_xsize, i - 2, mask_mode); - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - - /* special case: envelope has odd height */ - if (level.envelope_ysize % 2 && i == 2) - i--; - } - - if (tape.playing) - Delay(1000); - else - WaitForEventToContinue(); - - /* close envelope window vertically */ - for (i = level.envelope_ysize + 2; i >= 2; i -= 2) - { - int xsize = level.envelope_xsize + 2; - int startx = (SXSIZE / font_width - (xsize - 1)) / 2; - int starty = (SYSIZE / font_height - 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 sx = SX + (startx + x) * font_width; - int sy = SY + (starty + y) * font_height; - int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == i - 1 ? +1 : 0); - - DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); - } - - DrawTextToTextArea(SX + (startx + 1) * font_width, - SY + (starty + 1) * font_height, level.envelope, - FONT_TEXT_1, level.envelope_xsize, i - 2, mask_mode); - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - - /* special case: envelope has odd height */ - if (level.envelope_ysize % 2 && i == level.envelope_ysize + 2) - i++; - } - - /* close envelope window horizontally */ - for (i = level.envelope_xsize + 2; i >= 2; i -= 2) - { - int startx = (SXSIZE / font_width - i) / 2; - int starty = (SYSIZE / font_height) / 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 sx = SX + (startx + x) * font_width; - int sy = SY + (starty + y) * font_height; - int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0); - int ey = (y == 0 ? -1 : y == 1 ? +1 : 0); - - DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); - } - - redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; - BackToFront(); - - Delay(GAME_FRAME_DELAY); - - /* special case: envelope has odd width */ - if (level.envelope_xsize % 2 && i == level.envelope_xsize + 2) - i++; - } - - 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]; diff --git a/src/screens.c b/src/screens.c index 0d3b008a..0965eb9e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -331,7 +331,7 @@ static void gotoTopLevelDir() void HandleMainMenu(int mx, int my, int dx, int dy, int button) { - static int choice = 0; + static int choice = 5; int x = 0; int y = choice; diff --git a/src/tools.c b/src/tools.c index 3da2b060..1f0856dc 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1529,18 +1529,59 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y))); } +#if 1 +void DrawEnvelopeBackground(int startx, int starty, int x, int y, + int xsize, int ysize, int font_nr) +{ + int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + int graphic = IMG_GAME_ENVELOPE_BACKGROUND; + Bitmap *src_bitmap; + int src_x, src_y; + int dst_x = SX + startx + x * font_width; + int dst_y = SY + starty + y * font_height; + int width = graphic_info[graphic].width; + int height = graphic_info[graphic].height; + int inner_width = MAX(width - 2 * font_width, font_width); + int inner_height = MAX(height - 2 * font_height, font_height); + int inner_sx = (width >= 3 * font_width ? font_width : 0); + int inner_sy = (height >= 3 * font_height ? font_height : 0); + boolean draw_masked = graphic_info[graphic].draw_masked; + + getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y); + + if (src_bitmap == NULL || width < font_width || height < font_height) + { + ClearRectangle(drawto, dst_x, dst_y, font_width, font_height); + return; + } + + src_x += (x == 0 ? 0 : x == xsize - 1 ? width - font_width : + inner_sx + (x - 1) * font_width % inner_width); + src_y += (y == 0 ? 0 : y == ysize - 1 ? height - font_height : + inner_sy + (y - 1) * font_height % inner_height); + + if (draw_masked) + { + SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc, + dst_x - src_x, dst_y - src_y); + BlitBitmapMasked(src_bitmap, drawto, src_x, src_y, font_width, font_height, + dst_x, dst_y); + } + else + BlitBitmap(src_bitmap, drawto, src_x, src_y, font_width, font_height, + dst_x, dst_y); +} + +#else + void DrawEnvelopeBackground(int dst_x, int dst_y, int ex, int ey, int font_nr) { -#if 1 int font_width = getFontWidth(font_nr); int font_height = getFontHeight(font_nr); int graphic = IMG_GAME_ENVELOPE_BACKGROUND; Bitmap *src_bitmap; int src_x, src_y; -#if 0 - int dst_x = SX + sx * font_width; - int dst_y = SY + sy * font_height; -#endif int width = graphic_info[graphic].width; int height = graphic_info[graphic].height; boolean draw_masked = graphic_info[graphic].draw_masked; @@ -1566,29 +1607,179 @@ void DrawEnvelopeBackground(int dst_x, int dst_y, int ex, int ey, int font_nr) else BlitBitmap(src_bitmap, drawto, src_x, src_y, font_width, font_height, dst_x, dst_y); +} +#endif + +void ShowEnvelope() +{ + int graphic = IMG_GAME_ENVELOPE_BACKGROUND; + boolean draw_masked = graphic_info[graphic].draw_masked; + int mask_mode = (draw_masked ? BLIT_MASKED : BLIT_ON_BACKGROUND); + int font_nr = FONT_TEXT_1; + int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + boolean ffwd_delay = (tape.playing && tape.fast_forward); + int anim_delay = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); + int wait_delay = (ffwd_delay ? 500 : 1000); + int i, x, y; + + /* open envelope window horizontally */ + for (i = 0; i <= level.envelope_xsize; i++) + { + int xsize = i + 2; + int ysize = 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + +#if 1 + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(startx, starty, x, y, xsize, ysize, font_nr); #else - int border[8][2] = + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + { + int sx = SX + startx + x * font_width; + int sy = SY + starty + y * font_height; + int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == ysize - 1 ? +1 : 0); + + DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); + } +#endif + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(anim_delay); + } + + /* open envelope window vertically */ + for (i = 0; i <= level.envelope_ysize; i++) { - { 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)); + int xsize = level.envelope_xsize + 2; + int ysize = i + 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + +#if 1 + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(startx, starty, x, y, xsize, ysize, font_nr); +#else + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + { + int sx = SX + startx + x * font_width; + int sy = SY + starty + y * font_height; + int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == ysize - 1 ? +1 : 0); + + DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); + } #endif + + DrawTextToTextArea(SX + startx + font_width, + SY + starty + font_height, level.envelope, + FONT_TEXT_1, level.envelope_xsize, i, mask_mode); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(anim_delay); + } + + if (tape.playing) + Delay(wait_delay); + else + WaitForEventToContinue(); + + /* close envelope window vertically */ + for (i = level.envelope_ysize; i >= 0; i--) + { + int xsize = level.envelope_xsize + 2; + int ysize = i + 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + +#if 1 + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(startx, starty, x, y, xsize, ysize, font_nr); +#else + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + { + int sx = SX + startx + x * font_width; + int sy = SY + starty + y * font_height; + int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == ysize - 1 ? +1 : 0); + + DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); + } +#endif + + DrawTextToTextArea(SX + startx + font_width, + SY + starty + font_height, level.envelope, + FONT_TEXT_1, level.envelope_xsize, i, mask_mode); + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(anim_delay); + } + + /* close envelope window horizontally */ + for (i = level.envelope_xsize; i >= 0; i--) + { + int xsize = i + 2; + int ysize = 2; + int startx = (SXSIZE - xsize * font_width) / 2; + int starty = (SYSIZE - ysize * font_height) / 2; + + SetDrawtoField(DRAW_BUFFERED); + + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); + + SetDrawtoField(DRAW_BACKBUFFER); + +#if 1 + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + DrawEnvelopeBackground(startx, starty, x, y, xsize, ysize, font_nr); +#else + for (y=0; y < ysize; y++) for (x=0; x < xsize; x++) + { + int sx = SX + startx + x * font_width; + int sy = SY + starty + y * font_height; + int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0); + int ey = (y == 0 ? -1 : y == ysize - 1 ? +1 : 0); + + DrawEnvelopeBackground(sx, sy, ex, ey, font_nr); + } +#endif + + redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; + BackToFront(); + + Delay(anim_delay); + } + + SetDrawtoField(DRAW_BUFFERED); + + redraw_mask |= REDRAW_FIELD; + BackToFront(); } void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) diff --git a/src/tools.h b/src/tools.h index 0a5cb84b..f226a9cf 100644 --- a/src/tools.h +++ b/src/tools.h @@ -112,7 +112,8 @@ void DrawLevelField(int, int); void DrawMiniElement(int, int, int); void DrawMiniElementOrWall(int, int, int, int); -void DrawEnvelopeBackground(int, int, int, int, int); + +void ShowEnvelope(); void getMicroGraphicSource(int, Bitmap **, int *, int *); void DrawMicroElement(int, int, int);