forked from johndrinkwater/blake-stone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3D_INTER.C
357 lines (277 loc) · 6.66 KB
/
3D_INTER.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
// 3D_INTER.C
#include "3D_DEF.H"
#pragma hdrstop
//==========================================================================
//
// LOCAL CONSTANTS
//
//==========================================================================
//==========================================================================
//
// LOCAL VARABLES
//
//==========================================================================
#ifndef ID_CACHE_BRIEFS
char BreifingText[13] = {"BRIEF_Wx.TXT"};
#endif
//==========================================================================
/*
==================
=
= CLearSplitVWB
=
==================
*/
void ClearSplitVWB (void)
{
memset (update,0,sizeof(update));
WindowX = 0;
WindowY = 0;
WindowW = 320;
WindowH = 152;
}
//==========================================================================
/*
==================
=
= Breifing
=
==================
*/
boolean Breifing(breifing_type BreifingType,unsigned episode)
{
#ifndef ID_CACHE_BRIEFS
char chars[3] = {'L','W','I'};
BreifingText[6] = chars[BreifingType];
BreifingText[7] = '1'+episode;
HelpPresenter(BreifingText,true,0,false);
#else
HelpPresenter(NULL,true,BRIEF_W1+(episode*2)+BreifingType-1,false);
#endif
return(EscPressed);
}
//==========================================================================
/*
=================
=
= PreloadGraphics
=
= Fill the cache up
=
=================
*/
void ShPrint(char far *text, char shadow_color, boolean single_char)
{
unsigned old_color=fontcolor,old_x=px,old_y=py;
char far *str,buf[2]={0,0};
if (single_char)
{
str = buf;
buf[0]=*text;
}
else
str = text;
fontcolor = shadow_color;
py++;
px++;
USL_DrawString(str); // JTR - This marks blocks!
fontcolor = old_color;
py = old_y;
px = old_x;
USL_DrawString(str); // JTR - This marks blocks!
}
void PreloadUpdate(unsigned current, unsigned total)
{
unsigned w=WindowW-10;
if (current > total)
current=total;
w = ((long)w * current) / total;
if (w)
VWB_Bar(WindowX,WindowY,w-1,1,BORDER_TEXT_COLOR);
VW_UpdateScreen();
}
char far prep_msg[]="^ST1^CEGet Ready, Blake!\r^XX";
void DisplayPrepingMsg(char far *text)
{
#if GAME_VERSION != SHAREWARE_VERSION
// Bomb out if FILE_ID.DIZ is bad!!
//
if (((gamestate.mapon != 1) || (gamestate.episode != 0)) &&
(gamestate.flags & GS_BAD_DIZ_FILE))
Quit(NULL);
#endif
// Cache-in font
//
fontnumber=1;
CA_CacheGrChunk(STARTFONT+1);
BMAmsg(text);
UNCACHEGRCHUNK(STARTFONT+1);
// Set thermometer boundaries
//
WindowX = 36;
WindowY = 188;
WindowW = 260;
WindowH = 32;
// Init MAP and GFX thermometer areas
//
VWB_Bar(WindowX,WindowY-7,WindowW-10,2,BORDER_LO_COLOR);
VWB_Bar(WindowX,WindowY-7,WindowW-11,1,BORDER_TEXT_COLOR-15);
VWB_Bar(WindowX,WindowY,WindowW-10,2,BORDER_LO_COLOR);
VWB_Bar(WindowX,WindowY,WindowW-11,1,BORDER_TEXT_COLOR-15);
// Update screen and fade in
//
VW_UpdateScreen();
if (screenfaded)
VW_FadeIn();
}
void PreloadGraphics(void)
{
WindowY=188;
if (!(gamestate.flags & GS_QUICKRUN))
VW_FadeIn ();
PM_Preload(PreloadUpdate);
IN_UserInput(70);
if (playstate != ex_transported)
VW_FadeOut ();
DrawPlayBorder ();
VW_UpdateScreen ();
}
//==========================================================================
/*
==================
=
= DrawHighScores
=
==================
*/
#define SCORE_Y_SPACING 7 //
void DrawHighScores(void)
{
char buffer[16],*str;
word i,
w,h;
HighScore *s;
ClearMScreen();
CA_CacheScreen (BACKGROUND_SCREENPIC);
DrawMenuTitle("HIGH SCORES");
if (playstate != ex_title)
DrawInstructions(IT_HIGHSCORES);
fontnumber=2;
SETFONTCOLOR(ENABLED_TEXT_COLOR,TERM_BACK_COLOR);
ShadowPrint("NAME",86,60);
// ShadowPrint("MISSION",150,60);
ShadowPrint("SCORE",175,60);
ShadowPrint("MISSION",247,53);
ShadowPrint("RATIO",254,60);
for (i = 0,s = Scores;i < MaxScores;i++,s++)
{
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR-1,TERM_BACK_COLOR);
//
// name
//
if (*s->name)
ShadowPrint(s->name,45,68 + (SCORE_Y_SPACING * i));
#if 0
//
// mission
//
ltoa(s->episode+1,buffer,10);
ShadowPrint(buffer,165,68 + (SCORE_Y_SPACING * i));
#endif
//
// score
//
if (s->score > 9999999)
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR+1,TERM_BACK_COLOR);
ltoa(s->score,buffer,10);
USL_MeasureString(buffer,&w,&h);
ShadowPrint(buffer,205 - w,68 + (SCORE_Y_SPACING * i)); // 235
//
// mission ratio
//
ltoa(s->ratio,buffer,10);
USL_MeasureString(buffer,&w,&h);
ShadowPrint(buffer,272-w,68 + (SCORE_Y_SPACING * i));
}
VW_UpdateScreen ();
}
//===========================================================================
/*
=======================
=
= CheckHighScore
=
=======================
*/
void CheckHighScore (long score,word other)
{
word i,j;
int n;
HighScore myscore;
US_CursorStruct TermCursor = {'@',0,HIGHLIGHT_TEXT_COLOR,2};
// Check for cheaters
if (DebugOk)
{
SD_PlaySound(NOWAYSND);
return;
}
strcpy(myscore.name,"");
myscore.score = score;
myscore.episode = gamestate.episode;
myscore.completed = other;
myscore.ratio = ShowStats(0,0,ss_justcalc,&gamestuff.level[gamestate.mapon].stats);
for (i = 0,n = -1;i < MaxScores;i++)
{
if ((myscore.score > Scores[i].score) || ((myscore.score == Scores[i].score)
&& (myscore.completed > Scores[i].completed)))
{
for (j = MaxScores;--j > i;)
Scores[j] = Scores[j - 1];
Scores[i] = myscore;
n = i;
break;
}
}
StartCPMusic (ROSTER_MUS);
DrawHighScores ();
VW_FadeIn ();
if (n != -1)
{
//
// got a high score
//
DrawInstructions(IT_ENTER_HIGHSCORE);
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR,TERM_BACK_COLOR);
PrintY = 68+(SCORE_Y_SPACING * n);
PrintX = 45;
use_custom_cursor = true;
allcaps = true;
US_CustomCursor = TermCursor;
US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);
}
else
{
IN_ClearKeysDown ();
IN_UserInput(500);
}
StopMusic();
use_custom_cursor = false;
}
//===========================================================================
//--------------------------------------------------------------------------
// Random()
//--------------------------------------------------------------------------
unsigned Random(unsigned Max)
{
unsigned returnval;
if (Max)
{
if (Max > 255)
returnval = (US_RndT()<<8) + US_RndT();
else
returnval = US_RndT();
return(returnval % Max);
}
else
return(0);
}