rnd-20090623-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 // --- Option Explicit
9
10 int ScreenScrollXPos, ScreenScrollYPos;
11 int ScreenPosition, data_h_Xtmp, data_h_Ytmp;
12
13 int ShowRedDiskCounter, ShowPanel;
14 int ExplosionShake;
15 boolean NoDisplayFlag;
16
17 long DisplayMinX, DisplayMaxX, DisplayWidth;
18 long DisplayMinY, DisplayMaxY, DisplayHeight;
19
20
21 int subDisplayInfotronsNeeded()
22 {
23   int subDisplayInfotronsNeeded;
24
25   if (NoDisplayFlag)
26     return subDisplayInfotronsNeeded;
27
28   {
29 #if 0
30     MainForm.lblInfoCount.Caption = InfotronsNeeded;
31     MainForm.lblInfoCount.Refresh;
32 #endif
33   }
34
35   return subDisplayInfotronsNeeded;
36 }
37
38 int subDisplayPlayingTime()
39 {
40   int subDisplayPlayingTime;
41
42
43   return subDisplayPlayingTime;
44 }
45
46 int subDisplayLevel()
47 {
48   int subDisplayLevel;
49
50   if (NoDisplayFlag || ! LevelLoaded)
51     return subDisplayLevel;
52
53 #if 0
54   MainForm.DisplayLevel();
55 #endif
56
57   return subDisplayLevel;
58 }
59
60 void subDisplayPanel()
61 {
62 }
63
64 int subCheckRestoreRedDiskCountDisplay()
65 {
66   int subCheckRestoreRedDiskCountDisplay;
67
68   if (NoDisplayFlag)
69     return subCheckRestoreRedDiskCountDisplay;
70
71   if (ShowRedDiskCounter == 0)
72     return subCheckRestoreRedDiskCountDisplay;
73
74   ShowRedDiskCounter = ShowRedDiskCounter - 1;
75   if (ShowRedDiskCounter == 0)
76   {
77     {
78 #if 0
79       MainForm.lblRedDiskCount.Caption = 0;
80       MainForm.lblRedDiskCount.Refresh;
81 #endif
82     }
83   }
84
85   return subCheckRestoreRedDiskCountDisplay;
86 }
87
88 void subDisplayRedDiskCount()
89 {
90   if (NoDisplayFlag)
91     return;
92
93   {
94 #if 0
95     MainForm.lblRedDiskCount.Caption = RedDiskCount;
96     MainForm.lblRedDiskCount.Refresh;
97 #endif
98   }
99   ShowRedDiskCounter = 0x46;
100 }
101
102 void ScrollTo(int X, int Y)
103 {
104   long oldX, oldY;
105
106   if (NoDisplayFlag)
107     return;
108
109   oldX = ScrollX;
110   oldY = ScrollY;
111   X = ScrollDelta * (X / ScrollDelta);
112   X = Max(X, ScrollMinX);
113   X = Min(X, ScrollMaxX);
114   Y = ScrollDelta * (Y / ScrollDelta);
115   Y = Max(Y, ScrollMinY);
116   Y = Min(Y, ScrollMaxY);
117   //  ScrollX = X
118   //  ScrollY = Y
119   Stage.ScrollTo(X, Y);
120 }
121
122 void ScrollTowards(int X, int Y)
123 {
124   long oldX, oldY;
125
126   if (NoDisplayFlag)
127     return;
128
129   oldX = ScrollX;
130   oldY = ScrollY;
131   X = ScrollDelta * (X / ScrollDelta);
132   X = Max(X, ScrollMinX);
133   X = Min(X, ScrollMaxX);
134   Y = ScrollDelta * (Y / ScrollDelta);
135   Y = Max(Y, ScrollMinY);
136   Y = Min(Y, ScrollMaxY);
137   //  ScrollX = X
138   //  ScrollY = Y
139   Stage.ScrollTowards(X, Y, 2 * Stretch);
140 }
141
142 void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
143 {
144   long oldX, oldY;
145
146   if (NoDisplayFlag)
147     return;
148
149   oldX = ScrollX;
150   oldY = ScrollY;
151   X = ScrollDelta * (X / ScrollDelta);
152   X = Max(X, ScrollMinX);
153   X = Min(X, ScrollMaxX);
154   Y = ScrollDelta * (Y / ScrollDelta);
155   Y = Max(Y, ScrollMinY);
156   Y = Min(Y, ScrollMaxY);
157   //  ScrollX = X
158   //  ScrollY = Y
159   Stage.SoftScrollTo(X, Y, TimeMS, FPS);
160 }