From: Holger Schemel Date: Tue, 21 Jul 2009 08:02:09 +0000 (+0200) Subject: rnd-20090721-1-src X-Git-Tag: 3.3.0.0^2~90 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fe656a41b406b06d9dc5b93d01191d52b1da3b4d;p=rocksndiamonds.git rnd-20090721-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 8e9f2fa5..d3857196 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-07-19 23:53" +#define COMPILE_DATE_STRING "2009-07-20 23:25" diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 66b12072..86a6aad0 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -184,6 +184,7 @@ void DDScrollBuffer_Blt() { switch (L) { +#if 0 case DDERR_GENERIC: Debug.Assert(False); break; @@ -243,6 +244,7 @@ void DDScrollBuffer_Blt() case DDERR_SURFACEBUSY: Debug.Assert(False); break; +#endif case DDERR_SURFACELOST: DDraw.RestoreAllSurfaces(); @@ -256,6 +258,7 @@ void DDScrollBuffer_Blt() // ClipToWindow 0 break; +#if 0 case DDERR_UNSUPPORTED: Debug.Assert(False); break; @@ -267,6 +270,7 @@ void DDScrollBuffer_Blt() default: Debug.Assert(False); break; +#endif } } @@ -321,11 +325,17 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) { double dx, dY; +#if 0 TickCountObject Tick; +#endif long dT, StepCount; double T, tStep; long oldX, oldY, maxD; - boolean AlreadyRunning; + static boolean AlreadyRunning = False; + +#if 1 + printf("::: 3: X,Y == %d, %d [%f]\n", X, Y, Stretch); +#endif if (NoDisplayFlag) return; @@ -348,6 +358,12 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) if (StepCount == 0) StepCount = 1; +#if 1 + printf("::: MARK 1: %f, %d, %ld, %ld [%d, %d, %ld, %ld]\n", + tStep, FPS, TimeMS, maxD, + X, Y, mScrollX, mScrollY); +#endif + dT = 1000 / FPS; tStep = (double)1 / StepCount; oldX = mScrollX; @@ -360,7 +376,11 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) goto SoftScrollEH; // If Claim Then Exit For + +#if 0 Tick.DelayMS(dT, False); +#endif + mScrollX = oldX + T * dx; mScrollY = oldY + T * dY; ScrollX = mScrollX; @@ -368,10 +388,17 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) // Blt(); } +#if 1 + printf("::: MARK 2\n"); +#endif + if (UserDragFlag) goto SoftScrollEH; +#if 0 Tick.DelayMS(dT, False); +#endif + mScrollX = X; mScrollY = Y; ScrollX = mScrollX; diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index f8da42e7..ea36612f 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -51,7 +51,9 @@ int subDisplayLevel() if (NoDisplayFlag || ! LevelLoaded) return subDisplayLevel; -#if 0 +#if 1 + DisplayLevel(); +#else MainForm.DisplayLevel(); #endif @@ -117,7 +119,12 @@ void ScrollTo(int X, int Y) Y = Min(Y, ScrollMaxY); // ScrollX = X // ScrollY = Y + +#if 1 + DDScrollBuffer_ScrollTo(X, Y); +#else Stage.ScrollTo(X, Y); +#endif } void ScrollTowards(int X, int Y) @@ -137,13 +144,22 @@ void ScrollTowards(int X, int Y) Y = Min(Y, ScrollMaxY); // ScrollX = X // ScrollY = Y + +#if 1 + DDScrollBuffer_ScrollTowards(X, Y, 2 * Stretch); +#else Stage.ScrollTowards(X, Y, 2 * Stretch); +#endif } void SoftScrollTo(int X, int Y, long TimeMS, int FPS) { long oldX, oldY; +#if 1 + printf("::: 1: X,Y == %d, %d (1)\n", X, Y); +#endif + if (NoDisplayFlag) return; @@ -157,5 +173,14 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) Y = Min(Y, ScrollMaxY); // ScrollX = X // ScrollY = Y + +#if 1 + printf("::: 2: X,Y == %d, %d\n", X, Y); +#endif + +#if 1 + DDScrollBuffer_SoftScrollTo(X, Y, TimeMS, FPS); +#else Stage.SoftScrollTo(X, Y, TimeMS, FPS); +#endif } diff --git a/src/game_sp/Globals.h b/src/game_sp/Globals.h index 641d979c..f705fd53 100644 --- a/src/game_sp/Globals.h +++ b/src/game_sp/Globals.h @@ -12,29 +12,44 @@ #include "global.h" +#if 1 + +#define ZoomFactor (2) + +#define BaseWidth (ZoomFactor * 16) +#define StretchWidth (ZoomFactor * 16) +#define StretchWidth2 (StretchWidth / 2) +#define TwoPixels (ZoomFactor * 2) + +#else + #define BaseWidth (16) #define StretchWidth (16) #define StretchWidth2 (StretchWidth / 2) #define TwoPixels (2) -#define aniExplosionInfo (111) -#define aniMurphySleepLeft (71) -#define aniMurphySleepRight (68) -#define aniMurphyTouchDown (47) -#define aniMurphyTouchLeft (95) -#define aniMurphyTouchRight (94) -#define aniMurphyTouchUp (46) + +#endif + +#define aniExplosionInfo (111) +#define aniMurphySleepLeft (71) +#define aniMurphySleepRight (68) +#define aniMurphyTouchDown (47) +#define aniMurphyTouchLeft (95) +#define aniMurphyTouchRight (94) +#define aniMurphyTouchUp (46) #define aniMurphyYawn (56) #define aniPushLeft (45) #define aniPushRight (44) #define aniPushUpDown (79) -#define aniSnikSnakDown (167) -#define aniSnikSnakLeft (239) -#define aniSnikSnakRight (247) +#define aniSnikSnakDown (167) +#define aniSnikSnakLeft (239) +#define aniSnikSnakRight (247) #define aniSnikSnakUp (159) -#define fiBase (2) -#define fiBug (25) + +#define fiBase (2) +#define fiBug (25) #define fiElectron (24) -#define fiExit (7) +#define fiExit (7) #define fiExplosion (0x1F) #define fiHWFirst (28) #define fiHWLast (37) @@ -45,14 +60,14 @@ #define fiInfotron (4) #define fiMurphy (3) #define fiOrangeDisk (8) -#define fiPortAllDirections (23) +#define fiPortAllDirections (23) #define fiPortDown (10) #define fiPortLeft (11) -#define fiPortLeftAndRight (22) +#define fiPortLeftAndRight (22) #define fiPortRight (9) #define fiPortUp (12) -#define fiPortUpAndDown (21) -#define fiRAM (5) +#define fiPortUpAndDown (21) +#define fiRAM (5) #define fiRAMBottom (39) #define fiRAMLeft (26) #define fiRAMRight (27) @@ -67,7 +82,8 @@ #define fiTerminal (19) #define fiWallSpace (40) #define fiYellowDisk (18) -#define fiZonk (1) +#define fiZonk (1) + #define keyDown (3) #define keyLeft (2) #define keyNone (0) @@ -77,10 +93,11 @@ #define keySpaceLeft (6) #define keySpaceRight (8) #define keySpaceUp (5) -#define keyUp (1) +#define keyUp (1) + #define posFrameCorner (55) -#define posFrameHorizontal (111) -#define posFrameVertical (110) +#define posFrameHorizontal (111) +#define posFrameVertical (110) extern int GetSI(int X, int Y); extern int GetStretchX(int si); diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index d5818d25..e12e9836 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -102,6 +102,10 @@ int InitMurphyPosB(int si) MurphyScreenYPos = MurphyScreenYPos / Stretch; subCalculateScreenScrollPos(); // calculate screen start addrs + + printf("::: InitGameConditions.c: ScreenScroll{X,Y}Pos %d, %d\n", + ScreenScrollXPos, ScreenScrollYPos); + if (AutoScrollFlag) { if (bPlaying) diff --git a/src/game_sp/Input.c b/src/game_sp/Input.c index a7ac7798..2b8f7bed 100644 --- a/src/game_sp/Input.c +++ b/src/game_sp/Input.c @@ -41,7 +41,7 @@ int subProcessKeyboardInput() { int subProcessKeyboardInput; - int LastKey; + static int LastKey = 0; // On Error GoTo NoKeyboardAccessEH // Call DKeyboard.Acquire diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index 8022080a..5105a789 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -1003,13 +1003,17 @@ void DisplayLevel() { int X, Y; +#if 1 + printf("::: DisplayLevel (%d, %d, %d)\n", Loaded, LevelLoaded, bPlaying); +#endif + if (! Loaded) return; if (! LevelLoaded) return; -#if 0 +#if 1 SetDisplayRegion(); #endif @@ -1022,10 +1026,18 @@ void DisplayLevel() if (bPlaying) { +#if 1 + printf("::: DisplayLevel [%ld, %ld, %ld, %ld]...\n", + DisplayMinY, DisplayMaxY, DisplayMinX, DisplayMaxX); +#endif + for (Y = DisplayMinY; Y <= DisplayMaxY; Y++) { for (X = DisplayMinX; X <= DisplayMaxX; X++) { +#if 0 + printf("::: DrawFieldNoAnimated(%d, %d)\n", X, Y); +#endif DrawFieldNoAnimated(X, Y); } } @@ -1034,6 +1046,9 @@ void DisplayLevel() { for (X = DisplayMinX; X <= DisplayMaxX; X++) { +#if 0 + printf("::: DrawFieldAnimated(%d, %d)\n", X, Y); +#endif DrawFieldAnimated(X, Y); } } @@ -1045,6 +1060,9 @@ void DisplayLevel() { for (X = DisplayMinX; X <= DisplayMaxX; X++) { +#if 0 + printf("::: DrawField(%d, %d)\n", X, Y); +#endif DrawField(X, Y); } } @@ -1100,8 +1118,8 @@ static void cmbLevel_Click() long InfoCount; boolean Oldflag; int Msg; - long LastIndex; - boolean bBlock; + static long LastIndex = 0; + static boolean bBlock = False; if (bBlock) return; @@ -1305,7 +1323,9 @@ static void Form_KeyUp(int KeyCode, int Shift) picPane_KeyUp(KeyCode, Shift); } -static void Form_Load() +#endif + +void Form_Load() { #if 0 @@ -1346,14 +1366,23 @@ static void Form_Load() picViewPort.ScaleMode = vbPixels; +#endif + PauseMode = 0; // BaseWidth = 16 + +#if 0 menBorder_Click(); +#endif + Loaded = True; + +#if 0 + ReStretch(Stretch); LoadKeyIndicators(); - Show; + Show(); FillFileList(CurPath); if (s.Read("ShowSplash", True)) @@ -1365,6 +1394,8 @@ static void Form_Load() #endif } +#if 0 + static void FillLevelList(char *Path, int LevelIndex) { long FNum, LevLen, i, iMax; @@ -1620,8 +1651,6 @@ static void DrawFrame(int Delta) } } -#if 0 - static void RestoreFrame() { int i, LX, tY, RX, BY; @@ -1643,6 +1672,8 @@ static void RestoreFrame() } } +#if 0 + static void Form_Unload(int Cancel) { EndFlag = True; @@ -1695,7 +1726,7 @@ static void Form_Unload(int Cancel) static void fpsTim_Timer() { currency TickDiff; - int count5; + static int count5 = 0; count5 = count5 + 1; if (4 < count5) @@ -1756,9 +1787,15 @@ static void menBorder_Click() // DisplayLevel True } +#endif + void SetDisplayRegion() { +#if 1 + if (0) +#else if (! menBorder.Checked) +#endif { DisplayMinX = 1; DisplayMaxX = FieldWidth - 2; @@ -1766,6 +1803,7 @@ void SetDisplayRegion() DisplayMinY = 1; DisplayMaxY = FieldHeight - 2; DisplayHeight = FieldHeight; + if (LevelLoaded) DrawFrame(1); @@ -1778,11 +1816,14 @@ void SetDisplayRegion() DisplayMinY = 0; DisplayMaxY = FieldHeight - 1; DisplayHeight = FieldHeight + 2; + if (LevelLoaded) RestoreFrame(); } } +#if 0 + static void menCopy_Click() { FMark.Copy; @@ -2089,7 +2130,7 @@ static void menPanel_Click() void Let_PanelVisible(boolean NewVal) { - boolean HidePanel; + static boolean HidePanel = False; if (HidePanel != NewVal) return; @@ -2125,8 +2166,8 @@ static void menPaste_Click() static void menPause_Click() { - StdPicture OldPic; - char *OldText; + static StdPicture OldPic; + static char *OldText = 0; PauseMode = (PauseMode != 0 ? 0 : 0); if (PauseMode != 0) @@ -2151,7 +2192,7 @@ static void menPlayAll_Click() int FNum; char *LogPath, *OutStr, *ReRecPath, *SPPath; boolean bEqual; - boolean QuitFlag; + static boolean QuitFlag = False; if (cmdPlayAll.STRING_IS_LIKE(Caption, "Play) All Demos") { @@ -2364,7 +2405,6 @@ static void menSoundFX_Click() // static void menPlay_Click() void menPlay_Click() { - #if 0 boolean OldEditFlag; @@ -2918,6 +2958,10 @@ static void ReStretch(float NewStretch) if (! Loaded) { +#if 1 + printf("::: NewStretch == %d\n", NewStretch); +#endif + Stretch = NewStretch; return; } @@ -3168,7 +3212,7 @@ void ShowKey(int KeyVar) int i; boolean Tmp; long Col; - boolean LastState[5 + 1]; + static boolean LastState[5 + 1]; // For i = 1 To 5 // State(i) = False diff --git a/src/game_sp/MainForm.h b/src/game_sp/MainForm.h index 20f71d6e..ae913f8e 100644 --- a/src/game_sp/MainForm.h +++ b/src/game_sp/MainForm.h @@ -28,5 +28,6 @@ extern void menEdit_Click(); extern void menPlaySpeed_Click(int Index); extern void menStop_Click(); extern void menPlay_Click(); +extern void Form_Load(); #endif /* MAINFORM_H */ diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index b4c16780..55b43e00 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -28,13 +28,13 @@ int subAnimateMurphy(int si) int tDeltaX, tDeltaY, tPos, Tmp; // Variables that hold information about the animation sequence - int *dx; // an array of image positions in moving.mpx, finalized with -1 - int dx2; // an additional image position of a second sprite, for instance: yellow disk if pushed - int MurphyDX, MurphyDY; // murphys move steps - int SeqPos; // index into dx() - int ClearPos; // Position to clear before blitting sprites, none=-1 - int dxPos; // field-position to draw dx(SeqPos) - int dx2Step; // position of dx2 relative to dx-position + static int *dx = 0; // an array of image positions in moving.mpx, finalized with -1 + 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 ax = PlayField16[si]; al = LowByte(ax); diff --git a/src/game_sp/init.c b/src/game_sp/init.c index 0f380e58..5a234b3c 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -15,6 +15,12 @@ static void BlitScreenToBitmap_SP__Stage_Blt() void sp_open_all() { +#if 1 + printf("::: sp_open_all ...\n"); +#endif + + Form_Load(); + SetBitmaps_SP(&sp_objects); screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, @@ -25,6 +31,10 @@ void sp_open_all() DDSpriteBuffer_CreateFromFile("[NONE]", 16, 16); Stage.Blt = &BlitScreenToBitmap_SP__Stage_Blt; + +#if 1 + printf("::: sp_open_all done\n"); +#endif } void sp_close_all() diff --git a/src/game_sp/modAnimations.c b/src/game_sp/modAnimations.c index 31d4a671..4b42b65a 100644 --- a/src/game_sp/modAnimations.c +++ b/src/game_sp/modAnimations.c @@ -48,7 +48,11 @@ DDScrollBuffer Stage; byte LData[59 + 1][23 + 1]; LevelInfoType LInfo; +#if 1 +float Stretch = 1; // , StretchWidth%, TwoPixels! +#else float Stretch; // , StretchWidth%, TwoPixels! +#endif int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY; int ScrollX, ScrollY;