rnd-20090721-1-src
[rocksndiamonds.git] / src / game_sp / Display.c
1 // ----------------------------------------------------------------------------
2 // Display.c
3 // ----------------------------------------------------------------------------
4
5 #include "Display.h"
6
7 // static char *VB_Name = "modDisplay";
8
9 // --- Option Explicit
10
11 int ScreenScrollXPos, ScreenScrollYPos;
12 int ScreenPosition, data_h_Xtmp, data_h_Ytmp;
13
14 int ShowRedDiskCounter, ShowPanel;
15 int ExplosionShake;
16 boolean NoDisplayFlag;
17
18 long DisplayMinX, DisplayMaxX, DisplayWidth;
19 long DisplayMinY, DisplayMaxY, DisplayHeight;
20
21
22 int subDisplayInfotronsNeeded()
23 {
24   int subDisplayInfotronsNeeded;
25
26   if (NoDisplayFlag)
27     return subDisplayInfotronsNeeded;
28
29   {
30 #if 0
31     MainForm.lblInfoCount.Caption = InfotronsNeeded;
32     MainForm.lblInfoCount.Refresh;
33 #endif
34   }
35
36   return subDisplayInfotronsNeeded;
37 }
38
39 int subDisplayPlayingTime()
40 {
41   int subDisplayPlayingTime;
42
43
44   return subDisplayPlayingTime;
45 }
46
47 int subDisplayLevel()
48 {
49   int subDisplayLevel;
50
51   if (NoDisplayFlag || ! LevelLoaded)
52     return subDisplayLevel;
53
54 #if 1
55   DisplayLevel();
56 #else
57   MainForm.DisplayLevel();
58 #endif
59
60   return subDisplayLevel;
61 }
62
63 void subDisplayPanel()
64 {
65 }
66
67 int subCheckRestoreRedDiskCountDisplay()
68 {
69   int subCheckRestoreRedDiskCountDisplay;
70
71   if (NoDisplayFlag)
72     return subCheckRestoreRedDiskCountDisplay;
73
74   if (ShowRedDiskCounter == 0)
75     return subCheckRestoreRedDiskCountDisplay;
76
77   ShowRedDiskCounter = ShowRedDiskCounter - 1;
78   if (ShowRedDiskCounter == 0)
79   {
80     {
81 #if 0
82       MainForm.lblRedDiskCount.Caption = 0;
83       MainForm.lblRedDiskCount.Refresh;
84 #endif
85     }
86   }
87
88   return subCheckRestoreRedDiskCountDisplay;
89 }
90
91 void subDisplayRedDiskCount()
92 {
93   if (NoDisplayFlag)
94     return;
95
96   {
97 #if 0
98     MainForm.lblRedDiskCount.Caption = RedDiskCount;
99     MainForm.lblRedDiskCount.Refresh;
100 #endif
101   }
102   ShowRedDiskCounter = 0x46;
103 }
104
105 void ScrollTo(int X, int Y)
106 {
107   long oldX, oldY;
108
109   if (NoDisplayFlag)
110     return;
111
112   oldX = ScrollX;
113   oldY = ScrollY;
114   X = ScrollDelta * (X / ScrollDelta);
115   X = Max(X, ScrollMinX);
116   X = Min(X, ScrollMaxX);
117   Y = ScrollDelta * (Y / ScrollDelta);
118   Y = Max(Y, ScrollMinY);
119   Y = Min(Y, ScrollMaxY);
120   //  ScrollX = X
121   //  ScrollY = Y
122
123 #if 1
124   DDScrollBuffer_ScrollTo(X, Y);
125 #else
126   Stage.ScrollTo(X, Y);
127 #endif
128 }
129
130 void ScrollTowards(int X, int Y)
131 {
132   long oldX, oldY;
133
134   if (NoDisplayFlag)
135     return;
136
137   oldX = ScrollX;
138   oldY = ScrollY;
139   X = ScrollDelta * (X / ScrollDelta);
140   X = Max(X, ScrollMinX);
141   X = Min(X, ScrollMaxX);
142   Y = ScrollDelta * (Y / ScrollDelta);
143   Y = Max(Y, ScrollMinY);
144   Y = Min(Y, ScrollMaxY);
145   //  ScrollX = X
146   //  ScrollY = Y
147
148 #if 1
149   DDScrollBuffer_ScrollTowards(X, Y, 2 * Stretch);
150 #else
151   Stage.ScrollTowards(X, Y, 2 * Stretch);
152 #endif
153 }
154
155 void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
156 {
157   long oldX, oldY;
158
159 #if 1
160   printf("::: 1: X,Y ==  %d, %d (1)\n", X, Y);
161 #endif
162
163   if (NoDisplayFlag)
164     return;
165
166   oldX = ScrollX;
167   oldY = ScrollY;
168   X = ScrollDelta * (X / ScrollDelta);
169   X = Max(X, ScrollMinX);
170   X = Min(X, ScrollMaxX);
171   Y = ScrollDelta * (Y / ScrollDelta);
172   Y = Max(Y, ScrollMinY);
173   Y = Min(Y, ScrollMaxY);
174   //  ScrollX = X
175   //  ScrollY = Y
176
177 #if 1
178   printf("::: 2: X,Y ==  %d, %d\n", X, Y);
179 #endif
180
181 #if 1
182   DDScrollBuffer_SoftScrollTo(X, Y, TimeMS, FPS);
183 #else
184   Stage.SoftScrollTo(X, Y, TimeMS, FPS);
185 #endif
186 }