This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGLOBAL.PAS
executable file
·180 lines (146 loc) · 4.79 KB
/
GLOBAL.PAS
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
(*
** Global.PAS
**
** unit for ASCSCRAM.PAS
**
** updated: 13-Dec-94
** created: 8-Sep-94
**
*)
unit Global;
(**********************************************************)
(**) (**)
(**) INTERFACE (**)
(**) (**)
(**********************************************************)
uses Crt;
const
MaxFuel = 500; (* fuel constants *)
FuelDiv = MaxFuel div 10;
ShootNormal = 1; (* shoot levels *)
ShootDouble = 2;
ShootWing = 3;
UpdScore = 1; (* values for UpdateInfo *)
UpdFuel = 2;
UpdExtra = 4;
UpdLife = 8;
UpdLevel = 16;
UpdAll = UpdScore or UpdFuel or UpdExtra or UpdLife or UpdLevel;
DelayTime = 30; (* time to wait after every move [ms] *)
ESC = #27;
SPC = #32;
CR = #13;
RocketYard = 1; (* level IDs *)
RocketCave = 2;
CometField = 3;
UfoHangar = 4;
RobotCity = 5;
SceneNum = 5; LevelNum = 4;
LevelName: array[1..LevelNum] of string =
( 'EASY ', 'NORMAL', 'TRICKY', 'HARD' );
SceneName: array[1..SceneNum] of string =
( 'ROCKET BASE', 'ROCKET CAVE', 'COMET FIELD',
'UFO HANGAR ', 'ROBOT CITY ' );
(* scroll speed *)
ScrollSpeed: array[1..LevelNum] of byte = ( 8,6,4,4 );
var
UserBreak : boolean;
AbortGame : boolean;
GamePaused : boolean;
GameOver : boolean;
ShipCrashed : boolean;
TopY, HillY : byte;
MinHillY, MaxHillY, (* hill/top limits *)
MinTopY, MaxTopY: byte;
BombCounter: byte;
SceneMoveNum : LongInt;
SceneLength : word;
GameLevel : word; (* GameLevel, e.g. "HARD#3" *)
GameScene : byte; (* GameScene e.g. "COMETS" *)
Difficulty : word; (* same as GameLevel, max. LevelNum *)
Score : LongInt; (* points scored *)
Fuel : word; (* ship fuel *)
oldFuel : word; (* used by UpdateInfo *)
ShipsLeft : byte; (* lifes *)
LifeScore : LongInt; (* score that must be reached to get *)
(* an extra life *)
AutoExtra : boolean; (* flag: automatic extra activation *)
ExtraCounter : byte; (* extra activation bar counter *)
ExtraRatio : byte; (* enenmies to shoot until extra *)
ExtraRatioCtr : byte; (* counter to check if enough *)
(* enemies have been shot *)
ShipSpeedIdx : byte; (* extras: ship speed *)
ShootDelayIdx : byte; (* shoot delay *)
SmartBombs : byte; (* smart bombs *)
ShootLevel : byte; (* normal/twice/wing *)
Shield : word; (* shield duration *)
ShootDelayCtr : byte;
ScrollStatus : boolean; (* flag: true = scroll screen *)
(*$IFDEF TEST*)
oldMaxAvail: LongInt; (* remember memory free at start *)
(*$ENDIF*)
LastUfoOrComet: byte; (* to avoid too narrow objetcs *)
scrollTimerFlag: boolean;
procedure FlushKeyboard;
procedure EnableScrolling;
procedure DisableScrolling;
procedure RestoreTimerHandler;
(**********************************************************)
(**) (**)
(**) IMPLEMENTATION (**)
(**) (**)
(**********************************************************)
uses Dos;
var
oldTimerHandler: pointer;
(*
** FlushKeyboard
*)
procedure FlushKeyboard;
var
key: char;
begin
while KeyPressed do
key := ReadKey;
end;
(*
** Enable/DiableScrolling
*)
procedure EnableScrolling;
begin
ScrollStatus := true;
end;
procedure DisableScrolling;
begin
ScrollStatus := false;
end;
(*
** ScrollTimerHandler
*)
(*$F+*)
procedure ScrollTimerHandler; interrupt;
begin
ScrollTimerFlag := true;
end;
(*$F-*)
(*
** RestoreTimerHandler
*)
procedure RestoreTimerHandler;
begin
SetIntVec( $1C, oldTimerHandler );
end;
(*
** Initialisation
*)
begin
GameLevel := 2; (* set default game level *)
Difficulty := GameLevel;
AutoExtra := false; (* disable autom. extra activation *)
(* install scrollTimer-handler *)
GetIntVec( $1C, oldTimerHandler );
SetIntVec( $1C, Addr(ScrollTimerHandler) );
(*$IFDEF TEST*)
oldMaxAvail := MaxAvail;
(*$ENDIF*)
end.