From 2d62255a9cc1edc3692c2597cf338ce50744da96 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 1 Aug 2009 00:05:38 +0200 Subject: [PATCH] rnd-20090801-1-src * first classic Supaplex level running and solved by solution/demo tape --- ChangeLog | 3 +++ src/conftime.h | 2 +- src/game_sp/DDScrollBuffer.c | 2 +- src/game_sp/DemoBufferObject.c | 2 +- src/game_sp/InitGameConditions.c | 2 +- src/game_sp/MainForm.c | 24 +++++++++--------- src/game_sp/Marker.c | 4 +-- src/game_sp/Murphy.c | 43 +++++++++++++++++++++++++------- src/game_sp/PathTools.c | 2 +- 9 files changed, 56 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 094e442b..de1e04b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2009-08-01 + * first classic Supaplex level running and solved by solution/demo tape + 2009-06-20 * started with integration of native Supaplex engine, using source code of Megaplex from Frank Schindler, based on original Supaplex engine diff --git a/src/conftime.h b/src/conftime.h index c9a9715a..4639ce8e 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-07-31 18:31" +#define COMPILE_DATE_STRING "2009-08-01 00:01" diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index b1a88ed5..09d03793 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -383,7 +383,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) Y = Y / Stretch; dx = X - mScrollX; dY = Y - mScrollY; - maxD = (Abs(dx) < Abs(dY) ? Abs(dY) : Abs(dY)); + maxD = (Abs(dx) < Abs(dY) ? Abs(dY) : Abs(dx)); StepCount = FPS * (TimeMS / (double)1000); if (StepCount > maxD) StepCount = maxD; diff --git a/src/game_sp/DemoBufferObject.c b/src/game_sp/DemoBufferObject.c index f3dbcc30..3a074126 100644 --- a/src/game_sp/DemoBufferObject.c +++ b/src/game_sp/DemoBufferObject.c @@ -80,7 +80,7 @@ long DemoBufferObject_Get_Size() { long Size; - Size = (nSize < 1 ? 0 : 0); + Size = (nSize < 1 ? 0 : nSize); if (! IS_NOTHING(&SubBuffer, sizeof(SubBuffer))) Size = Size + SubBuffer.Size; diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index c23f9d38..78ecefe1 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -289,7 +289,7 @@ int subFetchAndInitLevelB() MovLowByte(&data_SPtorunavail, 0); // no SP file data_scr_demo = 0; - UpdatePlayTime = (0 == demo_stopped ? True : True); + UpdatePlayTime = (0 == demo_stopped ? True : False); demo_stopped = 0; subFetchAndInitLevelA(UpdatePlayTime); diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index 0e31ae3e..c3d7476e 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -1604,7 +1604,7 @@ static void Form_Resize() // NW = ScaleWidth - 2 * Space: If NW < 0 Then NW = 0 // NH = ScaleHeight - 3 * Space - cmbLevel.Height: If NH < 0 Then NH = 0 // picViewPort.Move Space, Space, NW, NH - Tmp = (ShowPanel != 0 ? ScaleHeight - Panel.Height : ScaleHeight - Panel.Height); + Tmp = (ShowPanel != 0 ? ScaleHeight - Panel.Height : ScaleHeight); if (Tmp < 0) Tmp = 0; @@ -2022,7 +2022,7 @@ static void UpdateDeltaT() if (! bPlaying) return; - DeltaT = (DemoFlag != 0 ? DeltaTDemo : DeltaTDemo); + DeltaT = (DemoFlag != 0 ? DeltaTDemo : DeltaTPlay); if (DeltaT < 0) { Stage.Blt(); @@ -2087,7 +2087,7 @@ static void menOpen_Click() */ LFilt = LastOpenFilter; - cmDlg.FilterIndex = (0 < LFilt & LFilt < 5 ? LFilt : LFilt); + cmDlg.FilterIndex = (0 < LFilt & LFilt < 5 ? LFilt : 1); if (FileExists(CurPath)) cmDlg.InitDir = WithSlash(StripDir(CurPath)); @@ -2164,7 +2164,7 @@ static void menPause_Click() static StdPicture OldPic; static char *OldText = 0; - PauseMode = (PauseMode != 0 ? 0 : 0); + PauseMode = (PauseMode != 0 ? 0 : 1); if (PauseMode != 0) { if (IS_NOTHING(&OldPic, sizeof(OldPic))) @@ -2391,7 +2391,7 @@ static void menSoundFX_Click() { { menSoundFX.Checked = ! menSoundFX.Checked; - FXOnFlag = (menSoundFX.Checked ? -1 : -1); + FXOnFlag = (menSoundFX.Checked ? -1 : 0); } } @@ -2725,7 +2725,7 @@ static void PanelTim_Timer() Tmp = Panel.Height; if (PanelSeq < Panel.Height && -1 < PanelSeq) { - PanelSeq = (ShowPanel != 0 ? PanelSeq + 2 : PanelSeq + 2); + PanelSeq = (ShowPanel != 0 ? PanelSeq + 2 : PanelSeq - 2); Tmp = ScaleHeight - Tmp + PanelSeq; Panel.top = Tmp; picViewPort.Height = Tmp; @@ -2733,8 +2733,8 @@ static void PanelTim_Timer() else { PanelTim.Enabled = False; - PanelSeq = (PanelSeq < 0 ? 0 : 0); - ShowPanel = (ShowPanel == 0 ? 1 : 1); + PanelSeq = (PanelSeq < 0 ? 0 : PanelSeq - ); + ShowPanel = (ShowPanel == 0 ? 1 : 0); menPanel.Checked = (ShowPanel != 0); } } @@ -3314,8 +3314,8 @@ void ShowKey(int KeyVar) Tmp = State[i]; if (Tmp ^ LastState[i]) { - Col = (i == 5 ? vbRed : vbRed); - shpKey(i).FillColor = (Tmp ? Col : Col); + Col = (i == 5 ? vbRed : vbGreen); + shpKey(i).FillColor = (Tmp ? Col : vbButtonFace); shpKey(i).Refresh; LastState[i] = Tmp; } @@ -3378,7 +3378,7 @@ static void GetSettings() } Flag = CBool(s.Read("SoundFX", True)); - FXOnFlag = (Flag ? -1 : -1); + FXOnFlag = (Flag ? -1 : 0); menSoundFX.Checked = Flag; SignatureDelay = CLng(s.Read("SignatureDelay", 3000)); AllowRedDiskCheat = CInt(s.Read("AllowRedDiskCheat", 1)); @@ -3406,7 +3406,7 @@ static void SaveSettings() int i; { - s.Save "LastPath", (ModifiedFlag ? OrigPath : OrigPath); + s.Save "LastPath", (ModifiedFlag ? OrigPath : CurPath); if (WindowState != vbMinimized) { s.Save "Width", Width; diff --git a/src/game_sp/Marker.c b/src/game_sp/Marker.c index d83bc671..7053fb1d 100644 --- a/src/game_sp/Marker.c +++ b/src/game_sp/Marker.c @@ -109,8 +109,8 @@ static void SortData() { // int Tmp; - XMin = (X2 < X1 ? X2 : X2); - YMin = (Y2 < Y1 ? Y2 : Y2); + XMin = (X2 < X1 ? X2 : X1); + YMin = (Y2 < Y1 ? Y2 : Y1); } #if 0 diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 9ce921b3..a646978b 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -585,7 +585,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 +607,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 +642,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 +690,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 +822,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 +849,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; @@ -1139,7 +1139,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; @@ -1160,7 +1160,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; @@ -1422,6 +1422,31 @@ loc_g_6C8F: 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); @@ -1448,7 +1473,7 @@ 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 diff --git a/src/game_sp/PathTools.c b/src/game_sp/PathTools.c index a3875ae9..e66dfb86 100644 --- a/src/game_sp/PathTools.c +++ b/src/game_sp/PathTools.c @@ -171,7 +171,7 @@ char *StripExtensionlessFileName(char *Path) T = StripFileName(Path); T2 = StripExtension(Path); - StripExtensionlessFileName = Left(T, strlen(T) - strlen(T2) - (0 < strlen(T2) ? 1 : 1)); + StripExtensionlessFileName = Left(T, strlen(T) - strlen(T2) - (0 < strlen(T2) ? 1 : 0)); return StripExtensionlessFileName; } -- 2.34.1