X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FMurphy.c;h=39826cbc83c81dda90b87693570fca5b4923b1b4;hb=8bf628c4f976b617d840a64a6e7c2edb5f1d7719;hp=85e6e1121425779bc4025d534384e79ff6d80215;hpb=35b995abd3183999201d9581f7674de1475dc169;p=rocksndiamonds.git diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 85e6e112..39826cbc 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -8,17 +8,34 @@ static void subEatRedDisk(int si); static boolean subMoveKillsMurphy(int si, int ax, int bl); -#if 1 - #define LocalStretch (2) #define MurphyZoomFactor (ZoomFactor) -#else -#define LocalStretch (1) -#define MurphyZoomFactor (1) +// Variables that hold information about the animation sequence +static int dx1 = 0; // image/animation token +static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed +static int MurphyDX = 0, MurphyDY = 0; // murphys move steps +static int SeqPos = 0; // index into dx() +static int ClearPos = 0; // Position to clear before blitting sprites, none=-1 +static int dxPos = 0; // field-position to draw dx(SeqPos) +static int dx2Step = 0; // position of dx2 relative to dx-position +static int dx1SequenceLength = 0; + + +void SaveEngineSnapshotValues_SP_Murphy(ListNode **buffers) +{ + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx1)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx2)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(MurphyDX)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(MurphyDY)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(SeqPos)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(ClearPos)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dxPos)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx2Step)); + SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx1SequenceLength)); +} -#endif // ========================================================================== // SUBROUTINE @@ -31,16 +48,6 @@ void subAnimateMurphy(int *si) int time1, time2; int tDeltaX, tDeltaY, tPos, Tmp; - // Variables that hold information about the animation sequence - static int dx1 = 0; // image/animation token - static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed - static int MurphyDX = 0, MurphyDY = 0; // murphys move steps - static int SeqPos = 0; // index into dx() - static int ClearPos = 0; // Position to clear before blitting sprites, none=-1 - static int dxPos = 0; // field-position to draw dx(SeqPos) - static int dx2Step = 0; // position of dx2 relative to dx-position - static int dx1SequenceLength = 0; - ax = PlayField16[*si]; al = LowByte(ax); @@ -92,14 +99,6 @@ void subAnimateMurphy(int *si) goto loc_g_6364; } -#if 1 - -#if 0 - ax = (TimerVar & 3); - if (ax != 0) - return; -#endif - // ------------------------------------------------------------------ // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter: @@ -180,79 +179,6 @@ void subAnimateMurphy(int *si) // end of YAWN-SLEEP-Sequence -#else - - ax = (TimerVar & 3); - if (ax != 0) - return; - - // ------------------------------------------------------------------ - // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter: - YawnSleepCounter = YawnSleepCounter + 1; - if (YawnSleepCounter == 4) - { - subCopyFieldToScreen(*si, fiMurphy); // normal grin - return; - } // loc_g_5ECE: - - if (YawnSleepCounter <= 500) // loc_g_5ED7: - return; - - if (YawnSleepCounter <= 522) - { - bx = (YawnSleepCounter - 500) / 2; - subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn! and look depressed afterwards... - return; - } // loc_g_5F00: - - if (YawnSleepCounter <= 1000) - return; - - if (YawnSleepCounter <= 1022) - { - bx = (YawnSleepCounter - 1000) / 2; - subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again! - return; - } // loc_g_5F32: - - if (YawnSleepCounter <= 1600) // loc_g_5F3B: - return; - - if (YawnSleepCounter <= 1622) - { - bx = (YawnSleepCounter - 1600) / 2; - subCopyFieldToScreen(*si, aniMurphyYawn + bx); // yawn again! - third time - return; - } // loc_g_5F64: - - if (YawnSleepCounter > 1654) - return; - - if (PlayField16[*si - 1] == 0) - { - if (PlayField16[*si + 1] == 0) - { - YawnSleepCounter = 36; - return; - - } - else - { - bx = (YawnSleepCounter - 1622) / 16; - subCopyFieldToScreen(*si, aniMurphySleepRight + bx); // go to sleep - return; - } - } // loc_g_5F81: - - bx = (YawnSleepCounter - 1622) / 16; - subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep - - return; - - // end of YAWN-SLEEP-Sequence - -#endif - // ------------------------------------------------------------------ // ========================================================================== // (Direct Jump) a key was pressed @@ -940,11 +866,6 @@ loc_g_65FE: subSoundFX(*si, fiInfotron, actCollecting); dx1 = aniEatInfotronLeft; -#if 0 - dx2 = fiInfotron; - dx2Step = -1; - ClearPos = -1; -#endif PlayField16[*si - 1] = 0xA03; PlayField16[*si] = 0x300; *si = *si - 1; @@ -971,11 +892,6 @@ loc_g_6662: subSoundFX(*si, fiInfotron, actCollecting); dx1 = aniEatInfotronRight; -#if 0 - dx2 = fiInfotron; - dx2Step = 1; - ClearPos = -1; -#endif PlayField16[*si + 1] = 0xC03; PlayField16[*si] = 0x300; *si = *si + 1; @@ -1046,14 +962,7 @@ loc_g_6756: if (LowByte(InfotronsNeeded) != 0) return; -#if 1 - if (!game_sp.LevelSolved) - printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n", level_nr); -#endif - -#if 1 - game_sp.LevelSolved = TRUE; -#endif + game_sp.level_solved = TRUE; subSoundFX(*si, fiExit, actPassing); @@ -1115,16 +1024,8 @@ loc_g_6817: return; } // loc_g_6838: -#if 1 // draw new terminal type -#if 1 GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive; -#else - subCopyImageToScreen(*si - FieldWidth, aniTerminalActive); -#endif -#else - subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type -#endif TerminalState[*si - FieldWidth] = 8; goto loc_g_68F0; @@ -1141,16 +1042,8 @@ loc_g_684E: return; } // loc_g_6838: -#if 1 // draw new terminal type -#if 1 GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive; -#else - subCopyImageToScreen(*si - 1, aniTerminalActive); -#endif -#else - subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type -#endif TerminalState[*si - 1] = 8; goto loc_g_68F0; @@ -1167,16 +1060,8 @@ loc_g_6884: return; } // loc_g_6838: -#if 1 // draw new terminal type -#if 1 GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive; -#else - subCopyImageToScreen(*si + FieldWidth, aniTerminalActive); -#endif -#else - subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type -#endif TerminalState[*si + FieldWidth] = 8; goto loc_g_68F0; @@ -1193,16 +1078,8 @@ loc_g_68BA: return; } // loc_g_6838: -#if 1 // draw new terminal type -#if 1 GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive; -#else - subCopyImageToScreen(*si + 1, aniTerminalActive); -#endif -#else - subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type -#endif TerminalState[*si + 1] = 8; // ========================================================================== // common TERMINAL stuff moving/touching from all directions @@ -1575,10 +1452,8 @@ locProceedMovingMurphy: // proceed moving murphy loc_g_6C8F: -#if 1 if (SeqPos <= 0) dx1SequenceLength = getSequenceLength(dx1); -#endif if (SplitMoveFlag == 0) { @@ -1590,55 +1465,28 @@ loc_g_6C8F: if (!(ClearPos < 0)) // clear field that murphy is leaving subCopyImageToScreen(ClearPos, aniSpace); -#if 0 - // !!! special two-tile animation currently not used !!! - if (dx2 == fiInfotron) // special case of infotron moving left or right - { - tDeltaX = 0; - tDeltaY = 0; - } - else -#endif - { - tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1); - tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1); - } + tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1); + tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1); X = GetStretchX(dxPos) + tDeltaX; Y = GetStretchY(dxPos) + tDeltaY; Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right) -#if 1 if (isSnappingSequence(dx1) && SeqPos == dx1SequenceLength - 1) dx1 = aniSpace; -#endif -#if 1 DDSpriteBuffer_BltImg(X, Y, dx1, Tmp); GfxGraphic[GetX(*si)][GetY(*si)] = -1; // (Murphy's position) GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1; // (snapping position) - // printf("::: Tmp: %d\n", Tmp); -#else - StretchedSprites.BltEx(X, Y, dx[Tmp]); -#endif if (!(dx2 < 0)) { tPos = dxPos + dx2Step; X = GetStretchX(tPos); Y = GetStretchY(tPos); -#if 0 - // !!! special two-tile animation currently not used !!! - if (dx2 == fiInfotron) // special case of infotron moving left or right - { - StretchedSprites.BltEx(X, Y, dx[SeqPos] + dx2Step); - } - else // pushing something -#endif - { - // (SeqPos iterates from 0 to 7 while pushing) - DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos); - } + + // (SeqPos iterates from 0 to 7 while pushing) + DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos); } // End of normal movement @@ -1667,13 +1515,8 @@ loc_g_6C8F: } // loc_g_6D1E:'loc_g_6D28: SeqPos = SeqPos + 1; -#if 1 if (SeqPos < dx1SequenceLength) return; -#else - if (dx[SeqPos] > -1) - return; -#endif // Follow-up after movement completed 'loc_g_6D35: MurphyXPos = MurphyXPos + MurphyDX; @@ -1962,9 +1805,7 @@ loc_g_6F3B: loc_g_6F77: ExitToMenuFlag = 1; -#if 1 PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting -#endif return;