From: Holger Schemel Date: Wed, 23 Jun 2010 08:29:50 +0000 (+0200) Subject: rnd-20100623-2-src X-Git-Tag: 3.3.1.0^2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fe43dcf8ac7fb16e80d60a0c187bcbd65f40b5f2;p=rocksndiamonds.git rnd-20100623-2-src * fixed bug with accidentally removing preceding buffer in SP engine --- diff --git a/ChangeLog b/ChangeLog index 98b0c92b..21e04223 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-06-23 * added graphics performance optimization to native Supaplex game engine + * fixed bug with accidentally removing preceding buffer in SP engine 2010-06-18 * added separately configurable game panel background to graphics config diff --git a/src/conftime.h b/src/conftime.h index 68918680..467b820b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-06-23 02:10" +#define COMPILE_DATE_STRING "2010-06-23 10:23" diff --git a/src/game_sp/Globals.c b/src/game_sp/Globals.c index e34d1962..91c71517 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -17,7 +17,8 @@ int FieldMax, LevelMax; long FileMax; #if 1 -int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; +int *PlayField16; +// int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; #else @@ -164,6 +165,8 @@ boolean isSnappingSequence(int sequence) void InitGlobals() { + InitPrecedingPlayfieldMemory(); + AutoScrollFlag = True; FreezeZonks = 0; LevelLoaded = False; @@ -175,6 +178,11 @@ void InitGlobals() bPlaying = False; menBorder = False; + PlayField16 = checked_calloc((game_sp.preceding_buffer_size + + SP_MAX_PLAYFIELD_SIZE + + SP_HEADER_SIZE) * sizeof(int)); + PlayField16 = &PlayField16[game_sp.preceding_buffer_size]; + #if 0 /* these defaults will be changed after reading a Supaplex level file */ PlayField8 = REDIM_1D(sizeof(byte), 0, FieldMax); diff --git a/src/game_sp/Globals.h b/src/game_sp/Globals.h index 05d4cd7c..4c8798d7 100644 --- a/src/game_sp/Globals.h +++ b/src/game_sp/Globals.h @@ -295,7 +295,8 @@ extern boolean DemoAvailable; extern boolean menBorder; #if 1 -extern int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; +extern int *PlayField16; +// extern int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; extern byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; extern byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; #else diff --git a/src/game_sp/export.h b/src/game_sp/export.h index eb4074a1..2dbd0ae0 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -110,6 +110,7 @@ struct GameInfo_SP int score; /* needed for engine snapshots */ + char **preceding_buffer; int preceding_buffer_size; int scroll_xoffset, scroll_yoffset; @@ -186,6 +187,7 @@ extern struct EngineSnapshotInfo_SP engine_snapshot_sp; extern void sp_open_all(); extern void sp_close_all(); +extern void InitPrecedingPlayfieldMemory(); extern void InitGfxBuffers_SP(); extern void InitGameEngine_SP(); diff --git a/src/game_sp/file.c b/src/game_sp/file.c index f841cf20..cb5413b0 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -60,64 +60,9 @@ void setLevelInfoToDefaults_SP() void copyInternalEngineVars_SP() { - char *preceding_playfield_memory[] = - { - "95 89 95 89 95 89 3b 8a 3b 8a 3b 8a 3b 8a 3b 8a", // |......;.;.;.;.;.| - "3b 8a 3b 8a 3b 8a e8 8a e8 8a e8 8a e8 8a e8 8a", // |;.;.;.è.è.è.è.è.| - "e8 8a e8 8a e8 8a b1 8b b1 8b b1 8b b1 8b b1 8b", // |è.è.è.±.±.±.±.±.| - "b1 8b b1 8b b1 8b 85 8c 85 8c 85 8c 85 8c 85 8c", // |±.±.±...........| - "85 8c 85 8c 85 8c 5b 8d 5b 8d 5b 8d 5b 8d 5b 8d", // |......[.[.[.[.[.| - "5b 8d 5b 8d 5b 8d 06 8e 06 8e 06 8e 06 8e 06 8e", // |[.[.[...........| - "06 8e 06 8e 06 8e ac 8e ac 8e ac 8e ac 8e ac 8e", // |......¬.¬.¬.¬.¬.| - "ac 8e ac 8e ac 8e 59 8f 59 8f 59 8f 59 8f 59 8f", // |¬.¬.¬.Y.Y.Y.Y.Y.| - "59 8f 59 8f 59 8f 00 00 70 13 00 00 00 00 e8 17", // |Y.Y.Y...p.....è.| - "00 00 00 00 00 00 69 38 00 00 00 00 00 00 00 00", // |......i8........| - "00 00 00 00 00 00 00 00 d0 86 00 00 b2 34 00 00", // |........Ð...²4..| - "00 00 00 00 00 00 8f 8b 1d 34 00 00 00 00 00 00", // |.........4......| - "00 00 00 00 23 39 09 09 00 0c 00 08 00 58 00 00", // |....#9.......X..| - "00 00 00 25 77 06 7f 00 00 00 01 00 00 00 00 00", // |...%w...........| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 ec 06 26 05 00 00 00", // |.........ì.&....| - "00 00 00 01 00 00 00 00 31 32 33 34 35 36 37 38", // |........12345678| - "39 30 2d 00 08 00 51 57 45 52 54 59 55 49 4f 50", // |90-...QWERTYUIOP| - "00 00 0a 00 41 53 44 46 47 48 4a 4b 4c 00 00 00", // |....ASDFGHJKL...| - "00 00 5a 58 43 56 42 4e 4d 00 00 00 00 00 00 20", // |..ZXCVBNM...... | - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 2e 00 1e 00 31 00 14 00 39 00", // |..........1...9.| - "1f 00 14 00 18 00 ff ff 01 00 01 4c 45 56 45 4c", // |......ÿÿ...LEVEL| - "53 2e 44 41 54 00 00 00 00 00 00 00 00 00 00 00", // |S.DAT...........| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| - - NULL - }; - int preceding_buffer_size = 0; int count; int i, x, y; - for (i = 0; preceding_playfield_memory[i] != NULL; i++) - preceding_buffer_size += 8; /* eight 16-bit integer values */ - - /* needed for engine snapshots */ - game_sp.preceding_buffer_size = preceding_buffer_size; - LInfo = native_sp_level.header; FieldWidth = native_sp_level.width; @@ -133,13 +78,13 @@ void copyInternalEngineVars_SP() #if 0 PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax); DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax); - PlayField16 = REDIM_1D(sizeof(int), -preceding_buffer_size, FieldMax); + PlayField16 = REDIM_1D(sizeof(int), -game_sp.preceding_buffer_size, FieldMax); #endif count = 0; - for (i = 0; preceding_playfield_memory[i] != NULL; i++) + for (i = 0; game_sp.preceding_buffer[i] != NULL; i++) { - char *s = preceding_playfield_memory[i]; + char *s = game_sp.preceding_buffer[i]; boolean hi_byte = FALSE; /* little endian data => start with low byte */ while (s[0] != '\0' && s[1] != '\0') @@ -151,7 +96,7 @@ void copyInternalEngineVars_SP() if (hi_byte) byte <<= 8; - PlayField16[-preceding_buffer_size + count] |= byte; + PlayField16[-game_sp.preceding_buffer_size + count] |= byte; if (hi_byte) count++; diff --git a/src/game_sp/init.c b/src/game_sp/init.c index d8e4597d..8c77d306 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -3,6 +3,56 @@ #include "global.h" +char *preceding_playfield_memory[] = +{ + "95 89 95 89 95 89 3b 8a 3b 8a 3b 8a 3b 8a 3b 8a", // |......;.;.;.;.;.| + "3b 8a 3b 8a 3b 8a e8 8a e8 8a e8 8a e8 8a e8 8a", // |;.;.;.è.è.è.è.è.| + "e8 8a e8 8a e8 8a b1 8b b1 8b b1 8b b1 8b b1 8b", // |è.è.è.±.±.±.±.±.| + "b1 8b b1 8b b1 8b 85 8c 85 8c 85 8c 85 8c 85 8c", // |±.±.±...........| + "85 8c 85 8c 85 8c 5b 8d 5b 8d 5b 8d 5b 8d 5b 8d", // |......[.[.[.[.[.| + "5b 8d 5b 8d 5b 8d 06 8e 06 8e 06 8e 06 8e 06 8e", // |[.[.[...........| + "06 8e 06 8e 06 8e ac 8e ac 8e ac 8e ac 8e ac 8e", // |......¬.¬.¬.¬.¬.| + "ac 8e ac 8e ac 8e 59 8f 59 8f 59 8f 59 8f 59 8f", // |¬.¬.¬.Y.Y.Y.Y.Y.| + "59 8f 59 8f 59 8f 00 00 70 13 00 00 00 00 e8 17", // |Y.Y.Y...p.....è.| + "00 00 00 00 00 00 69 38 00 00 00 00 00 00 00 00", // |......i8........| + "00 00 00 00 00 00 00 00 d0 86 00 00 b2 34 00 00", // |........Ð...²4..| + "00 00 00 00 00 00 8f 8b 1d 34 00 00 00 00 00 00", // |.........4......| + "00 00 00 00 23 39 09 09 00 0c 00 08 00 58 00 00", // |....#9.......X..| + "00 00 00 25 77 06 7f 00 00 00 01 00 00 00 00 00", // |...%w...........| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 ec 06 26 05 00 00 00", // |.........ì.&....| + "00 00 00 01 00 00 00 00 31 32 33 34 35 36 37 38", // |........12345678| + "39 30 2d 00 08 00 51 57 45 52 54 59 55 49 4f 50", // |90-...QWERTYUIOP| + "00 00 0a 00 41 53 44 46 47 48 4a 4b 4c 00 00 00", // |....ASDFGHJKL...| + "00 00 5a 58 43 56 42 4e 4d 00 00 00 00 00 00 20", // |..ZXCVBNM...... | + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 2e 00 1e 00 31 00 14 00 39 00", // |..........1...9.| + "1f 00 14 00 18 00 ff ff 01 00 01 4c 45 56 45 4c", // |......ÿÿ...LEVEL| + "53 2e 44 41 54 00 00 00 00 00 00 00 00 00 00 00", // |S.DAT...........| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................| + + NULL +}; + + Bitmap *bitmap_db_field_sp; struct EngineSnapshotInfo_SP engine_snapshot_sp; @@ -16,6 +66,18 @@ void sp_close_all() { } +void InitPrecedingPlayfieldMemory() +{ + int preceding_buffer_size = 0; + int i; + + for (i = 0; preceding_playfield_memory[i] != NULL; i++) + preceding_buffer_size += 8; /* eight 16-bit integer values */ + + game_sp.preceding_buffer = preceding_playfield_memory; + game_sp.preceding_buffer_size = preceding_buffer_size; +} + void InitGfxBuffers_SP() { ReCreateBitmap(&bitmap_db_field_sp, FXSIZE, FYSIZE, DEFAULT_DEPTH);