From c6d59064aa782b8ad71eddac2797fdc50e4858f9 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 19 Apr 2010 01:17:05 +0200 Subject: [PATCH] rnd-20100419-1-src --- src/conftime.h | 2 +- src/editor.c | 11 +++++++++ src/files.c | 3 ++- src/game.c | 4 ++++ src/game_sp/DDScrollBuffer.c | 10 +++++++++ src/game_sp/Display.c | 2 +- src/game_sp/Display.h | 2 +- src/game_sp/Explosions.c | 13 ++++++++--- src/game_sp/InitGameConditions.c | 1 + src/game_sp/MainForm.c | 22 +++++++++++------- src/game_sp/MainGameLoop.c | 5 +++++ src/game_sp/file.c | 5 +++-- src/game_sp/main.c | 7 ++++++ src/screens.c | 2 +- src/tape.c | 38 +++++++++++++++++++++++++++++++- src/tools.c | 10 +++++++++ 16 files changed, 118 insertions(+), 19 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 06f20856..e5f38b5c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-04-18 20:47" +#define COMPILE_DATE_STRING "2010-04-19 01:09" diff --git a/src/editor.c b/src/editor.c index 83df2e15..7f1ec19f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7409,6 +7409,11 @@ void DrawLevelEd() FadeOut(REDRAW_FIELD); #endif +#if 1 + /* needed if different viewport properties defined for editor */ + ChangeViewportPropertiesIfNeeded(); +#endif + OpenDoor(DOOR_OPEN_2 | DOOR_NO_DELAY); #if DEBUG @@ -7438,6 +7443,10 @@ void DrawLevelEd() BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); +#if 0 + printf("::: %d, %d / %d, %d\n", VX, VY, EX, EY); +#endif + /* draw bigger door */ DrawSpecialEditorDoor(); @@ -11505,7 +11514,9 @@ static void HandleControlButtons(struct GadgetInfo *gi) BackToFront(); /* force redraw of undrawn special door */ +#if 0 DrawCompleteVideoDisplay(); +#endif level_editor_test_game = TRUE; diff --git a/src/files.c b/src/files.c index a1017dd2..52589dff 100644 --- a/src/files.c +++ b/src/files.c @@ -9814,7 +9814,8 @@ static void InitMenuDesignSettings_SpecialPreProcessing() { viewport.playfield[i] = viewport.playfield[GFX_SPECIAL_ARG_DEFAULT]; viewport.door_1[i] = viewport.door_1[GFX_SPECIAL_ARG_DEFAULT]; - viewport.door_2[i] = viewport.door_2[GFX_SPECIAL_ARG_DEFAULT]; + if (i != GFX_SPECIAL_ARG_EDITOR) /* editor value already initialized */ + viewport.door_2[i] = viewport.door_2[GFX_SPECIAL_ARG_DEFAULT]; } } diff --git a/src/game.c b/src/game.c index e671dbe4..aeb40a51 100644 --- a/src/game.c +++ b/src/game.c @@ -3725,6 +3725,10 @@ void InitGame() ChangeViewportPropertiesIfNeeded(); #endif +#if 1 + DrawCompleteVideoDisplay(); +#endif + InitGameEngine(); InitGameControlValues(); diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 792648d4..eeecf2a7 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -250,6 +250,16 @@ void BlitScreenToBitmap_SP(Bitmap *target_bitmap) px += game_sp.scroll_xoffset; py += game_sp.scroll_yoffset; +#if 1 + if (ExplosionShakeMurphy != 0) + { + printf("::: ExplosionShakeMurphy\n"); + + px += TILEX / 2 - GetSimpleRandom(TILEX + 1); + py += TILEY / 2 - GetSimpleRandom(TILEX + 1); + } +#endif + BlitBitmap(bitmap_db_field_sp, target_bitmap, px, py, sxsize, sysize, sx, sy); } diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index 8cd55484..d3bf853e 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -7,7 +7,7 @@ int ScreenScrollXPos, ScreenScrollYPos; -int ExplosionShake; +int ExplosionShake, ExplosionShakeMurphy; boolean NoDisplayFlag; long DisplayMinX, DisplayMaxX; diff --git a/src/game_sp/Display.h b/src/game_sp/Display.h index 2fbc4a2a..bc0934f4 100644 --- a/src/game_sp/Display.h +++ b/src/game_sp/Display.h @@ -10,7 +10,7 @@ extern int ScreenScrollXPos, ScreenScrollYPos; -extern int ExplosionShake; +extern int ExplosionShake, ExplosionShakeMurphy; extern boolean NoDisplayFlag; extern long DisplayMinX, DisplayMaxX; diff --git a/src/game_sp/Explosions.c b/src/game_sp/Explosions.c index ccd75b8f..e45ce791 100644 --- a/src/game_sp/Explosions.c +++ b/src/game_sp/Explosions.c @@ -43,7 +43,8 @@ void subAnimateExplosion(int si) if (bl == 8) { PlayField16[si] = 0; - ExplosionShake = 0; // nothing explodes + ExplosionShake = 0; // nothing explodes + // ExplosionShakeMurphy = 0; // nothing explodes // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GfxGraphic[GetX(si)][GetY(si)] = aniSpace; @@ -57,7 +58,8 @@ loc_g_28D0: // explosion produces infotron if (bl == 0x89) { PlayField16[si] = fiInfotron; - MovLowByte(&ExplosionShake, 0); // nothing explodes + MovLowByte(&ExplosionShake, 0); // nothing explodes + // MovLowByte(&ExplosionShakeMurphy, 0); // nothing explodes // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GfxGraphic[GetX(si)][GetY(si)] = aniInfotron; @@ -88,7 +90,8 @@ void ExplodeFieldSP(int si) if (ax == fiHardWare) return; - ExplosionShake = 1; // something explodes + ExplosionShake = 1; // something explodes + if (ax == fiMurphy) { #if 1 @@ -96,6 +99,10 @@ void ExplodeFieldSP(int si) #endif KillMurphyFlag = 1; + +#if 1 + ExplosionShakeMurphy = 30; // Murphy explodes +#endif } if (ax == fiElectron) diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index dd210b1c..1313c49d 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -21,6 +21,7 @@ void subInitGameConditions() YawnSleepCounter = 0; // Wake up sleeping Murphy ExplosionShake = 0; // Force explosion flag off + ExplosionShakeMurphy = 0; // Force explosion flag off TerminalMaxCycles = 0x7F; YellowDisksExploded = 0; diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index d612a6c6..c54bf63d 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -78,21 +78,27 @@ static void DrawFrame(int Delta) RX = FieldWidth - Delta; BY = FieldHeight - Delta; - DrawImage(LX, tY, imgFrameCorner); - DrawImage(LX, BY, imgFrameCorner); - DrawImage(RX, tY, imgFrameCorner); - DrawImage(RX, BY, imgFrameCorner); + DrawImage(LX, tY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(LX, BY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(RX, tY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(RX, BY, (Delta > 0 ? imgFrameCorner : aniSpace)); for (i = LX + 1; i <= RX - 1; i++) { - DrawImage(i, tY, imgFrameHorizontal); - DrawImage(i, BY, imgFrameHorizontal); + DrawImage(i, tY, (Delta > 0 ? imgFrameHorizontal : aniSpace)); + DrawImage(i, BY, (Delta > 0 ? imgFrameHorizontal : aniSpace)); } for (i = tY + 1; i <= BY - 1; i++) { - DrawImage(LX, i, imgFrameVertical); - DrawImage(RX, i, imgFrameVertical); + DrawImage(LX, i, (Delta > 0 ? imgFrameVertical : aniSpace)); + DrawImage(RX, i, (Delta > 0 ? imgFrameVertical : aniSpace)); + } + + if (Delta > 0) + { + // ... + // ClearRectangle(bitmap_db_field_sp, } } diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index b7285292..65b88f2f 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -51,6 +51,11 @@ void subMainGameLoop_Main(byte action, boolean warp_mode) TimerVar = TimerVar + 1; +#if 1 + if (ExplosionShakeMurphy > 0) + ExplosionShakeMurphy--; +#endif + #if 1 if (ExitToMenuFlag == 1) { diff --git a/src/game_sp/file.c b/src/game_sp/file.c index 8497704b..2b8a1755 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -127,7 +127,8 @@ void copyInternalEngineVars_SP() FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1; LevelMax = (FieldWidth * FieldHeight) - 1; - FileMax = FieldMax + native_sp_level.demo.length; + /* (add one byte for the level number stored as first byte of demo data) */ + FileMax = FieldMax + native_sp_level.demo.length + 1; PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax); DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax); @@ -185,7 +186,7 @@ void copyInternalEngineVars_SP() PlayField8[FieldMax + 1] = native_sp_level.demo.level_nr; for (i = 0; i < native_sp_level.demo.length; i++) - PlayField8[FieldMax + i + 2] = native_sp_level.demo.data[i]; + PlayField8[FieldMax + 2 + i] = native_sp_level.demo.data[i]; } AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax - 2 * FieldWidth); diff --git a/src/game_sp/main.c b/src/game_sp/main.c index a29d6205..4da92cd3 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -31,6 +31,13 @@ void InitGameEngine_SP() game_sp.scroll_xoffset = (EVEN(SCR_FIELDX) ? TILEX / 2 : 0); game_sp.scroll_yoffset = (EVEN(SCR_FIELDY) ? TILEY / 2 : 0); +#if 1 + if (native_sp_level.width <= SCR_FIELDX) + game_sp.scroll_xoffset = TILEX / 2; + if (native_sp_level.height <= SCR_FIELDY) + game_sp.scroll_yoffset = TILEY / 2; +#endif + for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++) { for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++) diff --git a/src/screens.c b/src/screens.c index 94f0824e..4bee7dc2 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1781,7 +1781,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) FadeSetEnterScreen(); -#if 1 +#if 0 /* needed if different viewport properties defined for editor */ ChangeViewportPropertiesIfNeeded(); #endif diff --git a/src/tape.c b/src/tape.c index 9f2a61f3..5c90cb41 100644 --- a/src/tape.c +++ b/src/tape.c @@ -410,6 +410,12 @@ void DrawVideoDisplay(unsigned long state, unsigned long value) void DrawCompleteVideoDisplay() { +#if 0 + printf("::: %d, %d / %d, %d [%d] [%d, %d] [%d/%d]\n", + VX, VY, EX, EY, game_status, gfx.vx, gfx.vy, + tape.date, tape.length); +#endif + BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, DOOR_GFX_PAGEX3, DOOR_GFX_PAGEY2, gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy); @@ -420,11 +426,38 @@ void DrawCompleteVideoDisplay() gfx.vx + VIDEO_CONTROL_XPOS, gfx.vy + VIDEO_CONTROL_YPOS); DrawVideoDisplay(VIDEO_ALL_OFF, 0); + +#if 1 + if (tape.recording) + { + DrawVideoDisplay(VIDEO_STATE_REC_ON, 0); + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds); + + if (tape.pausing) + DrawVideoDisplay(VIDEO_STATE_PAUSE_ON, 0); + } + else if (tape.playing) + { + DrawVideoDisplay(VIDEO_STATE_PLAY_ON, 0); + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, 0); + + if (tape.pausing) + DrawVideoDisplay(VIDEO_STATE_PAUSE_ON, 0); + } + else if (tape.date && tape.length) + { + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds); + } +#else if (tape.date && tape.length) { DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds); } +#endif BlitBitmap(drawto, bitmap_db_door, gfx.vx, gfx.vy, gfx.vxsize, gfx.vysize, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2); @@ -469,8 +502,9 @@ void TapeErase() { int i; - tape.length = 0; tape.counter = 0; + tape.length = 0; + tape.length_seconds = 0; if (leveldir_current) setString(&tape.level_identifier, leveldir_current->identifier); @@ -534,6 +568,7 @@ void TapeStartRecording(long random_seed) DrawVideoDisplay(VIDEO_STATE_REC_ON, 0); DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); DrawVideoDisplay(VIDEO_STATE_TIME_ON, 0); + MapTapeWarpButton(); SetDrawDeactivationMask(REDRAW_NONE); @@ -707,6 +742,7 @@ void TapeStartPlaying() DrawVideoDisplay(VIDEO_STATE_PLAY_ON, 0); DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); DrawVideoDisplay(VIDEO_STATE_TIME_ON, 0); + MapTapeWarpButton(); SetDrawDeactivationMask(REDRAW_NONE); diff --git a/src/tools.c b/src/tools.c index cb23bae6..8461537a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -8104,6 +8104,12 @@ void ChangeViewportPropertiesIfNeeded() int new_scr_fieldx = (vp_playfield->width - 2 * border_size) / TILESIZE; int new_scr_fieldy = (vp_playfield->height - 2 * border_size) / TILESIZE; +#if 0 + /* !!! TEST ONLY !!! */ + // InitGfxBuffers(); + return; +#endif + if (viewport.window.width != WIN_XSIZE || viewport.window.height != WIN_YSIZE) { @@ -8152,4 +8158,8 @@ void ChangeViewportPropertiesIfNeeded() InitToons(); } } + +#if 0 + printf("::: %d, %d / %d, %d [%d]\n", VX, VY, EX, EY, game_status); +#endif } -- 2.34.1