rnd-20100107-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 0
110   printf("::: Display.c: ScrollTo(): %d, %d\n", X, Y);
111 #endif
112
113   if (NoDisplayFlag)
114     return;
115
116   oldX = ScrollX;
117   oldY = ScrollY;
118   X = ScrollDelta * (X / ScrollDelta);
119   X = Max(X, ScrollMinX);
120   X = Min(X, ScrollMaxX);
121   Y = ScrollDelta * (Y / ScrollDelta);
122   Y = Max(Y, ScrollMinY);
123   Y = Min(Y, ScrollMaxY);
124   //  ScrollX = X
125   //  ScrollY = Y
126
127   Stage.ScrollTo(X, Y);
128 }
129
130 void ScrollTowards(int X, int Y)
131 {
132   long oldX, oldY;
133
134   if (NoDisplayFlag)
135     return;
136
137 #if 0
138   printf("::: 1 ---> %d, %d\n", X, Y);
139 #endif
140
141   oldX = ScrollX;
142   oldY = ScrollY;
143   X = ScrollDelta * (X / ScrollDelta);
144   X = Max(X, ScrollMinX);
145   X = Min(X, ScrollMaxX);
146   Y = ScrollDelta * (Y / ScrollDelta);
147   Y = Max(Y, ScrollMinY);
148   Y = Min(Y, ScrollMaxY);
149   //  ScrollX = X
150   //  ScrollY = Y
151
152 #if 0
153   printf("::: 2 ---> %d, %d\n", X, Y);
154 #endif
155
156 #if 1
157   Stage.ScrollTowards(X, Y, 2 * Stretch * ZoomFactor);
158 #else
159   Stage.ScrollTowards(X, Y, 2 * Stretch);
160 #endif
161 }
162
163 void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
164 {
165   long oldX, oldY;
166
167   if (NoDisplayFlag)
168     return;
169
170 #if 0
171   printf(":(: %d, %d [%d, %d - %d, %d] [%d]\n",
172          X, Y, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY,
173          ScrollDelta);
174 #endif
175
176   oldX = ScrollX;
177   oldY = ScrollY;
178   X = ScrollDelta * (X / ScrollDelta);
179   X = Max(X, ScrollMinX);
180   X = Min(X, ScrollMaxX);
181   Y = ScrollDelta * (Y / ScrollDelta);
182   Y = Max(Y, ScrollMinY);
183   Y = Min(Y, ScrollMaxY);
184   //  ScrollX = X
185   //  ScrollY = Y
186
187 #if 0
188   printf(":): %d, %d [%d, %d - %d, %d] [%d]\n",
189          X, Y, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY,
190          ScrollDelta);
191 #endif
192
193   Stage.SoftScrollTo(X, Y, TimeMS, FPS);
194 }