From: Holger Schemel Date: Tue, 21 Jul 2009 22:36:12 +0000 (+0200) Subject: rnd-20090722-1-src X-Git-Tag: 3.3.0.0^2~88 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1533b136c6f8d0656cc45ca4c204104ef3d75249;p=rocksndiamonds.git rnd-20090722-1-src --- diff --git a/src/conftime.h b/src/conftime.h index a921959d..720ed637 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-07-21 12:41" +#define COMPILE_DATE_STRING "2009-07-22 00:34" diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 7bacd72a..83601282 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -141,10 +141,11 @@ void DDScrollBuffer_Blt() if (NoDisplayFlag) return; - +#if 0 // --- On Error GoTo BltEH DirectX.GetWindowRect(mhWnd, DR); // --- On Error GoTo 0 +#endif { tX = (DR.right - DR.left) / Stretch; @@ -172,6 +173,20 @@ void DDScrollBuffer_Blt() // DR.top = DR.top - Stretch * (mScrollY + mDestYOff) // End If } + +#if 1 +#if 0 + printf("::: DDScrollBuffer.c: DDScrollBuffer_Blt(): blit from %d, %d [%ld, %ld] [%ld, %ld]\n", + SR.left, SR.top, mScrollX, mScrollY, mDestXOff, mDestYOff); +#endif + + BlitBitmap(screenBitmap, window, + SR.left, SR.top, + SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY); + + return; +#endif + // DDraw.WaitForVerticalBlank DDWAITVB_BLOCKBEGIN, 0 if (IS_NOTHING(&Buffer, sizeof(Buffer))) return; @@ -294,6 +309,11 @@ void DDScrollBuffer_ScrollTo(int X, int Y) mScrollY = Y; ScrollX = mScrollX; ScrollY = mScrollY; + +#if 1 + printf("::: DDScrollBuffer.c: DDScrollBuffer_ScrollTo(): mScroll: %ld, %ld [%d, %d]\n", + mScrollX, mScrollY, X, Y); +#endif } void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) @@ -320,6 +340,11 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) mScrollY = mScrollY + dY * r; ScrollX = mScrollX; ScrollY = mScrollY; + +#if 1 + printf("::: DDScrollBuffer.c: DDScrollBuffer_ScrollTowards(): mScroll: %ld, %ld\n", + mScrollX, mScrollY); +#endif } void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) @@ -333,10 +358,6 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) long oldX, oldY, maxD; static boolean AlreadyRunning = False; -#if 1 - printf("::: 1: DDScrollBuffer.c: DDScrollBuffer_SoftScrollTo: X,Y == %d, %d [%f]\n", X, Y, Stretch); -#endif - if (NoDisplayFlag) return; @@ -358,12 +379,6 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) if (StepCount == 0) StepCount = 1; -#if 1 - printf("::: 2: DDScrollBuffer.c: DDScrollBuffer_SoftScrollTo: %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; @@ -403,4 +418,9 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) SoftScrollEH: AlreadyRunning = False; + +#if 1 + printf("::: DDScrollBuffer.c: DDScrollBuffer_SoftScrollTo(): mScroll: %ld, %ld\n", + mScrollX, mScrollY); +#endif } diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index 3fee7248..ca54d8bc 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -177,6 +177,10 @@ static void Blt(int pX, int pY, int SpriteX, int SpriteY) long Tmp; #endif +#if 0 + printf("::: DDSpriteBuffer.c: Blt(): %d, %d\n", pX, pY); +#endif + if (NoDisplayFlag) return; @@ -193,6 +197,10 @@ static void Blt(int pX, int pY, int SpriteX, int SpriteY) SR.bottom = SR.top + mSpriteHeight; } +#if 0 + printf("::: DDSpriteBuffer.c: Blt(): %d, %d\n", DR.left, DR.top); +#endif + #if 1 BlitBitmap(sp_objects, screenBitmap, SR.left, SR.top, diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index d75db7b9..92cdcd99 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -106,6 +106,10 @@ void ScrollTo(int X, int Y) { long oldX, oldY; +#if 1 + printf("::: Display.c: ScrollTo(): %d, %d\n", X, Y); +#endif + if (NoDisplayFlag) return; @@ -148,14 +152,6 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) { long oldX, oldY; -#if 1 - 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) return; @@ -170,9 +166,5 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) // ScrollX = X // ScrollY = Y -#if 1 - printf("::: 2: Display.c: SoftScrollTo: X,Y == %d, %d\n", X, Y); -#endif - Stage.SoftScrollTo(X, Y, TimeMS, FPS); } diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index 6a846570..baa31b5e 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -10,6 +10,7 @@ static void DrawFrame(int Delta); static void ReStretch(float NewStretch); static void picPane_Paint(); static void picViewPort_Resize(); +static void menBorder_Click(); #else @@ -1007,7 +1008,7 @@ void DisplayLevel() int X, Y; #if 1 - printf("::: MainForm.c: DisplayLevel: %d, %d, %d\n", + printf("::: MainForm.c: DisplayLevel(): %d, %d, %d\n", Loaded, LevelLoaded, bPlaying); #endif @@ -1031,8 +1032,9 @@ void DisplayLevel() if (bPlaying) { #if 1 - printf("::: MainForm.c: DisplayLevel: [%ld, %ld, %ld, %ld]...\n", - DisplayMinY, DisplayMaxY, DisplayMinX, DisplayMaxX); + printf("::: MainForm.c: DisplayLevel(): [%ld, %ld, %ld, %ld] [%d, %d]...\n", + DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY, + FieldWidth, FieldHeight); #endif for (Y = DisplayMinY; Y <= DisplayMaxY; Y++) @@ -1335,6 +1337,7 @@ void Form_Load() EditFlag = False; EditMode = edMove; // FMark = New MarkerObject; // (handle this later, if needed) + InitGlobals(); #if 0 @@ -1366,18 +1369,12 @@ void Form_Load() PauseMode = 0; // BaseWidth = 16 -#if 0 menBorder_Click(); -#endif Loaded = True; -#if 1 - ReStretch(Stretch); -#endif - #if 0 LoadKeyIndicators(); @@ -1755,6 +1752,8 @@ static void menAutoScroll_Click() } } +#endif + static void menBorder_Click() { if (menBorder.Checked) @@ -1766,6 +1765,7 @@ static void menBorder_Click() DisplayMinY = 1; DisplayMaxY = FieldHeight - 2; DisplayHeight = FieldHeight; + if (Loaded && LevelLoaded) DrawFrame(1); @@ -1779,6 +1779,7 @@ static void menBorder_Click() DisplayMinY = 0; DisplayMaxY = FieldHeight - 1; DisplayHeight = FieldHeight + 2; + if (Loaded && LevelLoaded) RestoreFrame(); } @@ -1787,15 +1788,9 @@ static void menBorder_Click() // DisplayLevel True } -#endif - void SetDisplayRegion() { -#if 1 - if (0) -#else if (! menBorder.Checked) -#endif { DisplayMinX = 1; DisplayMaxX = FieldWidth - 2; @@ -2450,31 +2445,34 @@ void menPlay_Click() #endif LastFrame = 0; + #if 0 LastTick = T.TickNow(); #endif #if 0 - fpsTim.Enabled = True; - #endif // DimPrimary 100 bPlaying = True; #if 0 - UpdateDeltaT(); +#endif +#if 1 + printf("::: MainForm.c: menPlay_Click(): subFetchAndInitLevelB(): ...\n"); #endif subFetchAndInitLevelB(); #if 1 - ReStretch(Stretch); + printf("::: MainForm.c: menPlay_Click(): subFetchAndInitLevelB(): done\n"); #endif + ReStretch(Stretch); + // Trace "MainForm", "CountDown 1" CountDown(2, (0 == DemoFlag)); // Trace "MainForm", "Call GoPlay" @@ -2967,7 +2965,7 @@ static void ReStretch(float NewStretch) #endif #if 1 - printf("::: MainForm.c: ReStretch: %d, %d\n", Loaded, LevelLoaded); + printf("::: MainForm.c: ReStretch(): %d, %d\n", Loaded, LevelLoaded); #endif if (! Loaded) @@ -3029,14 +3027,25 @@ static void ReStretch(float NewStretch) if (Loaded && LevelLoaded) { +#if 1 + printf("::: MainForm.c: ReStretch(): ...\n"); +#endif + SetDisplayRegion(); picViewPort_Resize(); DisplayLevel(); } subCalculateScreenScrollPos(); + +#if 1 + printf("::: MainForm.c: ReStretch(): %d, %d\n", ScreenScrollXPos, ScreenScrollYPos); +#endif + ScrollTo(ScreenScrollXPos, ScreenScrollYPos); + Stage.Blt(); + picPane_Paint(); } @@ -3048,7 +3057,7 @@ static void ReStretch(float NewStretch) static void SetScrollEdges() { #if 1 - printf("::: SetScrollEdges ... [%ld, %ld, %ld, %ld] [%f, %d] [%d, %d, %d, %d]\n", + printf("::: MainForm.c: SetScrollEdges() ... [%ld, %ld, %ld, %ld] [%f, %d] [%d, %d, %d, %d]\n", DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY, Stretch, BaseWidth, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY); @@ -3065,7 +3074,7 @@ static void SetScrollEdges() #endif #if 1 - printf("::: SetScrollEdges done [%d, %d, %d, %d]\n", + printf("::: MainForm.c: SetScrollEdges() done [%d, %d, %d, %d]\n", ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY); #endif } @@ -3154,6 +3163,11 @@ void DrawFieldNoAnimated(int X, int Y) Tmp = DisPlayField[tsi]; } +#if 0 + printf("::: MainForm.c: DrawFieldNoAnimated(): %d, %d [%d]\n", + X, Y, StretchWidth); +#endif + StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, Tmp); break; } @@ -3218,7 +3232,13 @@ static void picViewPort_Resize() #endif SetScrollEdges(); + +#if 1 + printf("::: MainForm.c: picViewPort_Resize(): %d, %d\n", ScrollX, ScrollY); +#endif + ScrollTo(ScrollX, ScrollY); + // SizeTim.Interval = 1 } diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index 6bc494ff..b4a91d00 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -248,9 +248,16 @@ int subCalculateScreenScrollPos() ax = MainForm.picPane.Width / 2; Ay = MainForm.picPane.Height / 2; } + ScreenScrollXPos = Stretch * (MurphyScreenXPos + 8) - ax; ScreenScrollYPos = Stretch * (MurphyScreenYPos + 8) - Ay; +#if 0 + printf("::: MainGameLoop.c: subCalculateScreenScrollPos(): %d, %d [%d, %d] -> %d, %d\n", + MainForm.picPane.Width, MainForm.picPane.Height, + MurphyScreenXPos, MurphyScreenYPos, + ScreenScrollXPos, ScreenScrollYPos); +#endif + return subCalculateScreenScrollPos; } - diff --git a/src/game_sp/init.c b/src/game_sp/init.c index c1fbcc7b..1324d8e3 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -7,15 +7,20 @@ Bitmap *sp_objects; Bitmap *screenBitmap; - +#if 0 static void BlitScreenToBitmap_SP__Stage_Blt() { BlitScreenToBitmap_SP(window); } +#endif static void init_struct_functions() { +#if 1 + Stage.Blt = &DDScrollBuffer_Blt; +#else Stage.Blt = &BlitScreenToBitmap_SP__Stage_Blt; +#endif Stage.ScrollTo = &DDScrollBuffer_ScrollTo; Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards; @@ -24,16 +29,32 @@ static void init_struct_functions() StretchedSprites.BltEx = &DDSpriteBuffer_BltEx; } +static void init_global_values() +{ + menBorder.Checked = True * 0; + menPanel.Checked = True; + menAutoScroll.Checked = True; + + MainForm.picPane.Width = picPane.Width = 1935; + MainForm.picPane.Height = picPane.Height = 1635; +} + void sp_open_all() { init_struct_functions(); + init_global_values(); Form_Load(); SetBitmaps_SP(&sp_objects); +#if 1 + screenBitmap = CreateBitmap(60 * TILEX, 24 * TILEY, + DEFAULT_DEPTH); +#else screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, DEFAULT_DEPTH); +#endif DDSpriteBuffer_CreateFromFile("[NONE]", 16, 16); } diff --git a/src/game_sp/main.c b/src/game_sp/main.c index 306273d1..235d4334 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -10,7 +10,7 @@ void InitGameEngine_SP() void BlitScreenToBitmap_SP(Bitmap *target_bitmap) { - BlitBitmap(screenBitmap, target_bitmap, 0, 0, + BlitBitmap(screenBitmap, target_bitmap, 15 * 32, 7 * 32, SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY); } diff --git a/src/game_sp/vb_types.h b/src/game_sp/vb_types.h index 081568c2..f2fb53ce 100644 --- a/src/game_sp/vb_types.h +++ b/src/game_sp/vb_types.h @@ -287,4 +287,14 @@ typedef struct boolean Checked; } menBorderObject; +typedef struct +{ + boolean Checked; +} menPanelObject; + +typedef struct +{ + boolean Checked; +} menAutoScrollObject; + #endif /* VB_TYPES_H */ diff --git a/src/game_sp/vb_vars.c b/src/game_sp/vb_vars.c index a6c17a8c..437ba023 100644 --- a/src/game_sp/vb_vars.c +++ b/src/game_sp/vb_vars.c @@ -13,3 +13,8 @@ MainFormObject MainForm; lblFrameCountObject lblFrameCount; cmbFileObject cmbFile; shpProgressObject shpProgress; +menBorderObject menBorder; +menPanelObject menPanel; +menAutoScrollObject menAutoScroll; + +MainForm_picPane picPane; diff --git a/src/game_sp/vb_vars.h b/src/game_sp/vb_vars.h index daf359ee..95690680 100644 --- a/src/game_sp/vb_vars.h +++ b/src/game_sp/vb_vars.h @@ -17,6 +17,10 @@ extern cmbFileObject cmbFile; extern shpProgressObject shpProgress; extern lblFrameCountObject lblFrameCount; extern menBorderObject menBorder; +extern menPanelObject menPanel; +extern menAutoScrollObject menAutoScroll; + +extern MainForm_picPane picPane; extern int hWnd;