X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FMurphy.c;h=b00aef58f70eb9bb4b41ee1d5f36525146b368fc;hb=61ca162f9268de1fa4fe0df3f561189b1a71770d;hp=7ff39ab33722c9f41a113c6fa51ce1b313df4719;hpb=0d95c7df5f708c3f30e10cab3894082019f8cd6c;p=rocksndiamonds.git diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 7ff39ab3..b00aef58 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -34,7 +34,12 @@ int subAnimateMurphy(int *si) // int ax, al, ah, bx, bl, i, X, Y; // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp; +#if 1 + int ax, al, bl, i, X, Y; + int time1, time2; +#else int ax, al, bx, bl, i, X, Y; +#endif int tDeltaX, tDeltaY, tPos, Tmp; // Variables that hold information about the animation sequence @@ -54,6 +59,11 @@ int subAnimateMurphy(int *si) *si, *si % 60, *si / 60, ax, al, (al == fiMurphy)); #endif +#if 0 + printf("::: Murphy.c: subAnimateMurphy(): %d [%d] [%d]\n", + YawnSleepCounter, FrameCounter, TimerVar); +#endif + if (al != fiMurphy) { MurphyMoveCounter = 0; // We have no Murphy! Exit! @@ -88,8 +98,8 @@ int subAnimateMurphy(int *si) if (bl != 0) // a key was pressed! goto locKeyPressed5FCF; -#if 1 - printf("::: !!! %d [%d]\n", DemoKeyCode, GravityFlag); +#if 0 + printf("::: Murphy.c: !!! %d [%d]\n", DemoKeyCode, GravityFlag); #endif RedDiskReleaseFlag = 1; @@ -99,6 +109,96 @@ int subAnimateMurphy(int *si) goto loc_g_6364; } +#if 1 + +#if 0 + ax = (TimerVar & 3); + if (ax != 0) + return subAnimateMurphy; +#endif + + // ------------------------------------------------------------------ + // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter: + + YawnSleepCounter = YawnSleepCounter + 1; + + if (YawnSleepCounter < 16) + return subAnimateMurphy; + + if (YawnSleepCounter < 2000) + { + // normal grin + // (default: single graphic, no animation) + subCopyImageToScreen(*si, aniMurphy, YawnSleepCounter - 16); + + return subAnimateMurphy; + } + + if (YawnSleepCounter < 4000) + { + // yawn! and look depressed afterwards... + // (default: 12 animation frames with delay of 8) + subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 2000); + + return subAnimateMurphy; + } + + if (YawnSleepCounter < 6400) + { + // yawn again! + // (default: 12 animation frames with delay of 8) + subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 4000); + + return subAnimateMurphy; + } + + // time1 = 6400 + 12 * 8; // (default: 6496 == 6400 + 12 * 8) + time1 = 6400 + 12 * 10; + + if (YawnSleepCounter < time1) + { + // yawn again! - third time + // (default: 12 animation frames with delay of 8) + subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 6400); + + return subAnimateMurphy; + } + + // time2 = 6496 + 3 * 64; // (default: 6688 == 6496 + 3 * 64) + time2 = 6496 + 3 * 100; + + if (YawnSleepCounter > time2) // Murphy already went to sleep + return subAnimateMurphy; + + if (PlayField16[*si - 1] == 0) + { + if (PlayField16[*si + 1] == 0) + { + // no sleep -- go back to "wait and start yawning" phase + YawnSleepCounter = 144; + + return subAnimateMurphy; + } + else + { + // go to sleep (right side) + // (default: 3 animation frames with delay of 64) + subCopyImageToScreen(*si, aniMurphySleepRight, YawnSleepCounter - time1); + + return subAnimateMurphy; + } + } + + // go to sleep (left side) + // (default: 3 animation frames with delay of 64) + subCopyImageToScreen(*si, aniMurphySleepLeft, YawnSleepCounter - time1); + + return subAnimateMurphy; + + // end of YAWN-SLEEP-Sequence + +#else + ax = (TimerVar & 3); if (ax != 0) return subAnimateMurphy; @@ -163,9 +263,13 @@ int subAnimateMurphy(int *si) bx = (YawnSleepCounter - 1622) / 16; subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep + return subAnimateMurphy; // end of YAWN-SLEEP-Sequence + +#endif + // ------------------------------------------------------------------ // ========================================================================== // (Direct Jump) a key was pressed @@ -585,7 +689,7 @@ loc_g_62E2: // ========================================================================== loc_g_6312: - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si - FieldWidth] = 0x103; PlayField16[*si] = 0x300; *si = *si - FieldWidth; @@ -607,7 +711,7 @@ loc_g_6341: // ========================================================================== loc_g_6364: - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si + FieldWidth] = 0x303; PlayField16[*si] = 0x300; *si = *si + FieldWidth; @@ -642,7 +746,7 @@ loc_g_63C2: loc_g_63D3: subSoundFXBase(); - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si - FieldWidth] = 0x503; PlayField16[*si] = 0x300; *si = *si - FieldWidth; @@ -690,7 +794,7 @@ loc_g_6448: loc_g_6459: subSoundFXBase(); - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si + FieldWidth] = 0x703; PlayField16[*si] = 0x300; *si = *si + FieldWidth; @@ -822,7 +926,7 @@ loc_g_6599: loc_g_65C6: subSoundFXInfotron(); - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si - FieldWidth] = 0x903; PlayField16[*si] = 0x300; *si = *si - FieldWidth; @@ -849,7 +953,7 @@ loc_g_65FE: loc_g_662A: subSoundFXInfotron(); - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si + FieldWidth] = 0xB03; PlayField16[*si] = 0x300; *si = *si + FieldWidth; @@ -931,6 +1035,15 @@ loc_g_6756: if (LowByte(InfotronsNeeded) != 0) return subAnimateMurphy; +#if 1 + if (!game_sp_info.LevelSolved) + printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber); +#endif + +#if 1 + game_sp_info.LevelSolved = TRUE; +#endif + subSoundFXExit(); data_h_DemoDone = 1; // EP set level success bytes LevelStatus = 1; // set Level Status DONE @@ -1001,7 +1114,7 @@ loc_g_6817: subCopyFieldToScreen(*si, aniMurphyTouchUp); if (YellowDisksExploded != 0) { - YawnSleepCounter = 10; // stay hypnotized + YawnSleepCounter = 40; // stay hypnotized return subAnimateMurphy; } // loc_g_6838: @@ -1017,7 +1130,7 @@ loc_g_684E: subCopyFieldToScreen(*si, aniMurphyTouchLeft); if (YellowDisksExploded != 0) { - YawnSleepCounter = 10; // stay hypnotized + YawnSleepCounter = 40; // stay hypnotized return subAnimateMurphy; } // loc_g_6838: @@ -1033,7 +1146,7 @@ loc_g_6884: subCopyFieldToScreen(*si, aniMurphyTouchDown); if (YellowDisksExploded != 0) { - YawnSleepCounter = 10; // stay hypnotized + YawnSleepCounter = 40; // stay hypnotized return subAnimateMurphy; } // loc_g_6838: @@ -1049,7 +1162,7 @@ loc_g_68BA: subCopyFieldToScreen(*si, aniMurphyTouchRight); if (YellowDisksExploded != 0) { - YawnSleepCounter = 10; // stay hypnotized + YawnSleepCounter = 40; // stay hypnotized return subAnimateMurphy; } // loc_g_6838: @@ -1135,7 +1248,7 @@ loc_StopSplit: // ========================================================================== loc_g_69A6: - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si] = 0x1C03; PlayField16[*si - FieldWidth] = 0x300; goto loc_StopNoSplit; @@ -1156,7 +1269,7 @@ loc_g_69CE: // ========================================================================== loc_g_69F7: - dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpRight); + dx = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si] = 0x1E03; PlayField16[*si + FieldWidth] = 0x300; goto loc_StopNoSplit; @@ -1417,8 +1530,39 @@ loc_g_6C8F: MurphyScreenXPos = MurphyScreenXPos + MurphyDX; MurphyScreenYPos = MurphyScreenYPos + MurphyDY; #endif + + +#if 0 + printf("::: %04d [%03ld, %02d] ----------> %s [%d] [%d, %d] [%d, %d] [%d]\n", + TimerVar, + DemoOffset - DemoPointer, DemoKeyRepeatCounter, + (DemoKeyCode == keyNone ? "(none)" : + DemoKeyCode == keyLeft ? "left" : + DemoKeyCode == keyRight ? "right" : + DemoKeyCode == keyUp ? "up" : + DemoKeyCode == keyDown ? "down" : + DemoKeyCode == keySpace ? "space" : + DemoKeyCode == keySpaceLeft ? "space + left" : + DemoKeyCode == keySpaceRight ? "space + right" : + DemoKeyCode == keySpaceUp ? "space + up" : + DemoKeyCode == keySpaceDown ? "space + down" : "(unknown)"), + DemoKeyCode, + MurphyScreenXPos, MurphyScreenYPos, + MurphyPosIndex % 60, MurphyPosIndex / 60, + ClearPos); +#endif + +#if 0 + Delay(500); +#endif + +#if 1 + if (!(ClearPos < 0)) // clear field that murphy is leaving + subCopyFieldToScreen(ClearPos, 0); +#else if (! ClearPos < 0) // clear field that murphy is leaving subCopyFieldToScreen(ClearPos, 0); +#endif #if 0 printf("::: ---------------> %d, %d [%d, %d]\n", @@ -1438,9 +1582,14 @@ loc_g_6C8F: X = GetStretchX(dxPos) + tDeltaX; Y = GetStretchY(dxPos) + tDeltaY; - Tmp = (SeqPos < 0 ? 0 : 0); // 9StepBugFix!(red disk move right) + Tmp = (SeqPos < 0 ? 0 : SeqPos); // 9StepBugFix!(red disk move right) StretchedSprites.BltEx(X, Y, dx[Tmp]); + +#if 1 + if (!(dx2 < 0)) +#else if (! dx2 < 0) +#endif { tPos = dxPos + dx2Step; X = GetStretchX(tPos); @@ -1775,6 +1924,11 @@ loc_g_6F3B: loc_g_6F77: ExitToMenuFlag = 1; + +#if 1 + PlayField16[*si] = fiSpace; // remove Murphy from playfield after exiting +#endif + return subAnimateMurphy; // ========================================================================== @@ -2288,6 +2442,34 @@ int subSpPortTest(int si) int i, cx, bx; +#if 1 + cx = LInfo.SpecialPortCount; // number of special ports + + for (i = 0; i < cx; i++) + { +#if 1 + /* this assumes that PortLocation is stored as big endian */ + bx = LInfo.SpecialPort[i].PortLocation; +#else + /* this assumes that PortLocation is stored as little endian */ + bx = HighByte(LInfo.SpecialPort[i].PortLocation); + MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation)); +#endif + + if (bx / 2 == si) + { + GravityFlag = LInfo.SpecialPort[i].Gravity; + FreezeZonks = LInfo.SpecialPort[i].FreezeZonks; + SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies; + + // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no! + + break; + } + } + +#else + cx = LInfo.SpecialPortCount; // number of special ports for (i = 1; i <= cx; i++) { @@ -2302,9 +2484,9 @@ int subSpPortTest(int si) // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no! i = cx + 1; } - } } +#endif return subSpPortTest; } // subSpPortTest @@ -2320,6 +2502,17 @@ void subCopyFieldToScreen(int si, int fi) // +++++++++++++++++++++++++++++++++++++++++ } +void subCopyImageToScreen(int si, int graphic, int sync_frame) +{ + int X, Y; + + // +++++++++++++++++++++++++++++++++++++++++ + X = GetStretchX(si); + Y = GetStretchY(si); + StretchedSprites.BltImg(X, Y, graphic, sync_frame); + // +++++++++++++++++++++++++++++++++++++++++ +} + static void subEatRedDisk(int si) { if (AllowRedDiskCheat == 0)