From: Holger Schemel Date: Tue, 21 Jul 2009 10:42:26 +0000 (+0200) Subject: rnd-20090721-2-src X-Git-Tag: 3.3.0.0^2~89 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6aaf28a58767bcc79a55cb3afbc8828fd4a16a6b;p=rocksndiamonds.git rnd-20090721-2-src --- diff --git a/src/conftime.h b/src/conftime.h index d3857196..a921959d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-07-20 23:25" +#define COMPILE_DATE_STRING "2009-07-21 12:41" diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 86a6aad0..7bacd72a 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -334,7 +334,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) static boolean AlreadyRunning = False; #if 1 - printf("::: 3: X,Y == %d, %d [%f]\n", X, Y, Stretch); + printf("::: 1: DDScrollBuffer.c: DDScrollBuffer_SoftScrollTo: X,Y == %d, %d [%f]\n", X, Y, Stretch); #endif if (NoDisplayFlag) @@ -359,7 +359,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) StepCount = 1; #if 1 - printf("::: MARK 1: %f, %d, %ld, %ld [%d, %d, %ld, %ld]\n", + printf("::: 2: DDScrollBuffer.c: DDScrollBuffer_SoftScrollTo: %f, %d, %ld, %ld [%d, %d, %ld, %ld]\n", tStep, FPS, TimeMS, maxD, X, Y, mScrollX, mScrollY); #endif @@ -388,10 +388,6 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) // Blt(); } -#if 1 - printf("::: MARK 2\n"); -#endif - if (UserDragFlag) goto SoftScrollEH; diff --git a/src/game_sp/DirectDrawGlobals.c b/src/game_sp/DirectDrawGlobals.c index 7c028b75..9ea35bcd 100644 --- a/src/game_sp/DirectDrawGlobals.c +++ b/src/game_sp/DirectDrawGlobals.c @@ -8,6 +8,8 @@ // --- Option Explicit +#if 0 + DirectX7 DirectX; DirectDraw7 DirectDraw; DirectDrawSurface7 PrimarySurface; @@ -46,3 +48,5 @@ void ClipToWindow(long hWnd) PrimarySurface.SetClipper(Clipper); SET_TO_NOTHING(&Clipper, sizeof(Clipper)); } + +#endif diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index ea36612f..d75db7b9 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -120,11 +120,7 @@ void ScrollTo(int X, int Y) // ScrollX = X // ScrollY = Y -#if 1 - DDScrollBuffer_ScrollTo(X, Y); -#else Stage.ScrollTo(X, Y); -#endif } void ScrollTowards(int X, int Y) @@ -145,11 +141,7 @@ void ScrollTowards(int X, int Y) // 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) @@ -157,7 +149,11 @@ 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); + printf("::: 1: Display.c: SoftScrollTo: X,Y == %d, %d\n", X, Y); + printf("::: %d, %d, %d, %d [%ld]\n", + ScrollMinX, ScrollMaxX, + ScrollMinY, ScrollMaxY, + ScrollDelta); #endif if (NoDisplayFlag) @@ -175,12 +171,8 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) // ScrollY = Y #if 1 - printf("::: 2: X,Y == %d, %d\n", X, Y); + printf("::: 2: Display.c: SoftScrollTo: 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.c b/src/game_sp/Globals.c index 82d46356..4da9c45b 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -397,10 +397,6 @@ void ReadLevel() for (i = 0; i <= FieldMax; i++) { -#if 0 - printf("::: %d: %d\n", i, PlayField8[i]); -#endif - PlayField16[i] = PlayField8[i]; DisPlayField[i] = PlayField8[i]; PlayField8[i] = 0; diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index e12e9836..c23f9d38 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -103,9 +103,6 @@ int InitMurphyPosB(int si) 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/MainForm.c b/src/game_sp/MainForm.c index 5105a789..6a846570 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -7,6 +7,9 @@ #if 1 static void DrawFrame(int Delta); +static void ReStretch(float NewStretch); +static void picPane_Paint(); +static void picViewPort_Resize(); #else @@ -1004,7 +1007,8 @@ void DisplayLevel() int X, Y; #if 1 - printf("::: DisplayLevel (%d, %d, %d)\n", Loaded, LevelLoaded, bPlaying); + printf("::: MainForm.c: DisplayLevel: %d, %d, %d\n", + Loaded, LevelLoaded, bPlaying); #endif if (! Loaded) @@ -1027,7 +1031,7 @@ void DisplayLevel() if (bPlaying) { #if 1 - printf("::: DisplayLevel [%ld, %ld, %ld, %ld]...\n", + printf("::: MainForm.c: DisplayLevel: [%ld, %ld, %ld, %ld]...\n", DisplayMinY, DisplayMaxY, DisplayMinX, DisplayMaxX); #endif @@ -1035,9 +1039,6 @@ void DisplayLevel() { for (X = DisplayMinX; X <= DisplayMaxX; X++) { -#if 0 - printf("::: DrawFieldNoAnimated(%d, %d)\n", X, Y); -#endif DrawFieldNoAnimated(X, Y); } } @@ -1046,9 +1047,6 @@ void DisplayLevel() { for (X = DisplayMinX; X <= DisplayMaxX; X++) { -#if 0 - printf("::: DrawFieldAnimated(%d, %d)\n", X, Y); -#endif DrawFieldAnimated(X, Y); } } @@ -1060,9 +1058,6 @@ void DisplayLevel() { for (X = DisplayMinX; X <= DisplayMaxX; X++) { -#if 0 - printf("::: DrawField(%d, %d)\n", X, Y); -#endif DrawField(X, Y); } } @@ -1377,9 +1372,14 @@ void Form_Load() Loaded = True; -#if 0 +#if 1 ReStretch(Stretch); + +#endif + +#if 0 + LoadKeyIndicators(); Show(); @@ -2471,6 +2471,10 @@ void menPlay_Click() subFetchAndInitLevelB(); +#if 1 + ReStretch(Stretch); +#endif + // Trace "MainForm", "CountDown 1" CountDown(2, (0 == DemoFlag)); // Trace "MainForm", "Call GoPlay" @@ -2942,6 +2946,8 @@ static void picPane_MouseUp(int Button, int Shift, float X, float Y) } } +#endif + static void picPane_Paint() { boolean Oldflag; @@ -2954,31 +2960,48 @@ static void picPane_Paint() static void ReStretch(float NewStretch) { +#if 1 + long BW2, LW, LH; +#else long BW2, LW, LH, i; +#endif + +#if 1 + printf("::: MainForm.c: ReStretch: %d, %d\n", Loaded, LevelLoaded); +#endif if (! Loaded) { #if 1 - printf("::: NewStretch == %d\n", NewStretch); + printf("::: NewStretch == %f\n", NewStretch); #endif Stretch = NewStretch; return; } +#if 0 MousePointer = 11; SET_TO_NOTHING(&Stage, sizeof(Stage)); SET_TO_NOTHING(&StretchedSprites, sizeof(StretchedSprites)); menStretch(Stretch / 0.25).Checked = False; +#endif + Stretch = NewStretch; + +#if 0 menStretch(Stretch / 0.25).Checked = True; // StretchWidth = BaseWidth ' * NewStretch // StretchWidth2 = StretchWidth \ 2 // TwoPixels = 2 '* Stretch // StretchLoad Sprites, imgMpx.Picture, 16, 16 +#endif + BW2 = StretchWidth / 2; LW = (FieldWidth + 2) * BaseWidth; // StretchWidth LH = (FieldHeight + 2) * BaseWidth; // StretchWidth + +#if 0 // i = bmpStage.CreateAtSize(LW, LH) // Stage = New DDScrollBuffer; // (handle this later, if needed) i = Stage.CreateAtSize(LW, LH, picPane.hWnd); @@ -2992,13 +3015,18 @@ static void ReStretch(float NewStretch) } else +#endif { StretchedSprites.DestXOff = 1 * BaseWidth; // StretchWidth StretchedSprites.DestYOff = 1 * BaseWidth; // StretchWidth Stage.DestXOff = 1 * StretchWidth; Stage.DestYOff = 1 * StretchWidth; StretchedSprites.DestinationSurface = Stage.Surface; - Stage.Cls; + +#if 0 + Stage.Cls(); +#endif + if (Loaded && LevelLoaded) { SetDisplayRegion(); @@ -3012,18 +3040,35 @@ static void ReStretch(float NewStretch) picPane_Paint(); } +#if 0 MousePointer = 0; +#endif } static void SetScrollEdges() { - ScrollMinX = (DisplayMinX - 0.5) * Stretch * BaseWidth; - ScrollMinY = (DisplayMinY - 0.5) * Stretch * BaseWidth; - ScrollMaxX = (DisplayMaxX + 1.5) * Stretch * BaseWidth - picPane.Width; - ScrollMaxY = (DisplayMaxY + 1.5) * Stretch * BaseWidth - picPane.Height; -} +#if 1 + printf("::: SetScrollEdges ... [%ld, %ld, %ld, %ld] [%f, %d] [%d, %d, %d, %d]\n", + DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY, + Stretch, BaseWidth, + ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY); +#endif + + ScrollMinX = (int)(DisplayMinX - 0.5) * Stretch * BaseWidth; + ScrollMinY = (int)(DisplayMinY - 0.5) * Stretch * BaseWidth; +#if 1 + ScrollMaxX = (int)(DisplayMaxX + 1.5) * Stretch * BaseWidth; + ScrollMaxY = (int)(DisplayMaxY + 1.5) * Stretch * BaseWidth; +#else + ScrollMaxX = (int)(DisplayMaxX + 1.5) * Stretch * BaseWidth - picPane.Width; + ScrollMaxY = (int)(DisplayMaxY + 1.5) * Stretch * BaseWidth - picPane.Height; +#endif +#if 1 + printf("::: SetScrollEdges done [%d, %d, %d, %d]\n", + ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY); #endif +} void DrawField(int X, int Y) { @@ -3142,8 +3187,11 @@ static void picViewPort_Paint() // Debug.Print "picViewPort_Paint()" } +#endif + static void picViewPort_Resize() { +#if 0 long bdX, bdY, PanelVisibility; long X, Y, dx, dY; SettingsObject s; @@ -3167,11 +3215,15 @@ static void picViewPort_Resize() Y = Max((picViewPort.ScaleHeight - dY) / 2, 0); picPane.Move X, Y, dx, dY; picFrame.Move X - bdX / 2, Y - bdY / 2, dx + bdX, dY + bdY; +#endif + SetScrollEdges(); ScrollTo(ScrollX, ScrollY); // SizeTim.Interval = 1 } +#if 0 + // // Private Sub SizeTim_Timer() // Dim wdX&, wdY& diff --git a/src/game_sp/init.c b/src/game_sp/init.c index 5a234b3c..c1fbcc7b 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -13,11 +13,20 @@ static void BlitScreenToBitmap_SP__Stage_Blt() BlitScreenToBitmap_SP(window); } +static void init_struct_functions() +{ + Stage.Blt = &BlitScreenToBitmap_SP__Stage_Blt; + + Stage.ScrollTo = &DDScrollBuffer_ScrollTo; + Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards; + Stage.SoftScrollTo = &DDScrollBuffer_SoftScrollTo; + + StretchedSprites.BltEx = &DDSpriteBuffer_BltEx; +} + void sp_open_all() { -#if 1 - printf("::: sp_open_all ...\n"); -#endif + init_struct_functions(); Form_Load(); @@ -26,15 +35,7 @@ void sp_open_all() screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, DEFAULT_DEPTH); - StretchedSprites.BltEx = &DDSpriteBuffer_BltEx; - 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/vb_types.h b/src/game_sp/vb_types.h index 39b23d0e..081568c2 100644 --- a/src/game_sp/vb_types.h +++ b/src/game_sp/vb_types.h @@ -214,7 +214,9 @@ typedef struct { int DestXOff; int DestYOff; + void *Surface; + void (*Cls)(); void (*Blt)(); void (*ScrollTo)(int, int); void (*ScrollTowards)(int, int, double); @@ -224,6 +226,12 @@ typedef struct typedef struct { + int DestXOff; + int DestYOff; + void *DestinationSurface; + void *Surface; + + void (*Cls)(); void (*BltEx)(int, int, int); } DDSpriteBuffer;