rnd-20090721-2-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   Stage.ScrollTo(X, Y);
124 }
125
126 void ScrollTowards(int X, int Y)
127 {
128   long oldX, oldY;
129
130   if (NoDisplayFlag)
131     return;
132
133   oldX = ScrollX;
134   oldY = ScrollY;
135   X = ScrollDelta * (X / ScrollDelta);
136   X = Max(X, ScrollMinX);
137   X = Min(X, ScrollMaxX);
138   Y = ScrollDelta * (Y / ScrollDelta);
139   Y = Max(Y, ScrollMinY);
140   Y = Min(Y, ScrollMaxY);
141   //  ScrollX = X
142   //  ScrollY = Y
143
144   Stage.ScrollTowards(X, Y, 2 * Stretch);
145 }
146
147 void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
148 {
149   long oldX, oldY;
150
151 #if 1
152   printf("::: 1: Display.c: SoftScrollTo: X,Y == %d, %d\n", X, Y);
153   printf("::: %d, %d, %d, %d [%ld]\n",
154          ScrollMinX, ScrollMaxX,
155          ScrollMinY, ScrollMaxY,
156          ScrollDelta);
157 #endif
158
159   if (NoDisplayFlag)
160     return;
161
162   oldX = ScrollX;
163   oldY = ScrollY;
164   X = ScrollDelta * (X / ScrollDelta);
165   X = Max(X, ScrollMinX);
166   X = Min(X, ScrollMaxX);
167   Y = ScrollDelta * (Y / ScrollDelta);
168   Y = Max(Y, ScrollMinY);
169   Y = Min(Y, ScrollMaxY);
170   //  ScrollX = X
171   //  ScrollY = Y
172
173 #if 1
174   printf("::: 2: Display.c: SoftScrollTo: X,Y == %d, %d\n", X, Y);
175 #endif
176
177   Stage.SoftScrollTo(X, Y, TimeMS, FPS);
178 }