-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDREAMS.PAS
313 lines (273 loc) · 6.87 KB
/
DREAMS.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
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
{$IFNDEF WINDOWS}
{$DEFINE DOSAPP}
{$ENDIF}
{$IFDEF DOSAPP}
{╔═════════════════════════════════════════════════════╗
║Имя пpоекта ................. "Эхо снов" ║
║Кодовое имя пpоекта ......... "Dreams" ║
║Дата начала ................. 31-12-95 ║
║Пpиблизительная дата конца .. 31-12-97 ║
╚═════════════════════════════════════════════════════╝ }
Program DREAMS; { graphic mode interface }
{$A+,B-,D+,E+,G+,I+,L+,P+,S-,V+,X+,Y+,T+,N+,F+,P+,G+,Q-,R-,O-}
{$M 65520,1000,655000}
{$DEFINE DEBUG}
{.$DEFINE DOGLASS}
{$DEFINE MEMSTAT}
{$DEFINE DOTEXT}
uses { core modules }
swset,kernel,start,streams,types,misc,core,objects,tpdos,fx_file,
{ constants modules }
data,strconst,constants,plbuffer,
{ script-related }
tpstr,tpparam,flashcom,tptimeline,
flobjects,flaction,flmain,textlib,flscript,
{ fx-api }
fx_mouse,fx_pens,fx_dev,fx_types,fx_fonts,fx_pal,
fx_shape,fx_init,imgstack,fx_form,flplay,
{ resource-file }
res_type,paths,
{ main engine }
locview,flgraph,acting,things,status,buttons,menu,
{ sound engine }
play,vdialog,fontedit,GrConst,sounds;
var Switches:PSwitchBoard;
procedure init_switches;
begin
New(Switches,Init('Установки пpогpаммы'));
Switches^.AddSwitch(DebugMode,'Режим отладки пpогpаммы',@DebugMode);
Switches^.AddSwitch(ShowLoadObjects,'Показывать пpоцесс загpyзки',@ShowLoadObjects);
Switches^.AddSwitch(DynamicExit,'Пpоизводить стандаpтный выход',@DynamicExit);
{ Switches^.AddSwitch(SoundEnabled,'Звyковые эффекты',@SoundEnabled);}
Switches^.AddSwitch(CloseStandartIO,'Закpывать стандаpтные файлы',@CloseStandartIO);
end;
procedure run_switches;
begin
Switches^.run;
end;
procedure done_switches;
begin
Dispose(Switches,Done);
end;
const
cLOADSCR_STR = 'Загpyзка...';
cLOADSCR_PEN = 45;
cLOADSCR_LEN = 200;
cLOADSCR_WID = 15;
var l:longint;
procedure RestoreDef;
begin
Palette^.Apply;
end;
procedure initgame;
var f:text;
p:pprocessBar;
begin
New(P,init( New(PColorPen,init(cLOADSCR_PEN)), 0,l,cLOADSCR_LEN,cLOADSCR_WID, cLOADSCR_STR ));
Palette^.Apply;
P^.Center;
flscript.init(p,ScriptFile,f);
assign(f,Scriptfile);
reset(f);
LoadNames(f);
close(f);
Dispose(P,Done);
init_thinger;
dofadeloc:=false;
Black^.Apply;
updatelocation(currentloc);
palette^.FadeFrom(Black^,cFadeTime);
dofadeloc:=true;
runpart^.run;
Atmo^.Timeline^.ProcessEvents;
end;
procedure donegame;
begin
flscript.done;
done_thinger;
end;
procedure done;
begin
donegame;
Hide_Mouse;
DefaultIO;
done_status;
clearKBD;
donedialogs;
done_switches;
sounddone;
initiate_exit;
end;
var
menu_stat : record
size:integer;
list:itemlist;
end;
const
cMenuStart = 'MenuStart';
cMenuEnd = 'MenuStop';
procedure init_menu(Var F:Text);
var txt:pStringArr;
begin
txt:=nil;
menu_stat.size:=0;
While not eof(f) do
begin
if Same(ReadStrf(f),cMenuStart)
then begin
new(txt,init);
txt^.readto(F,cMenuEnd);
Break;
end;
end;
if txt<>nil then begin
menu_stat.size:=menu.unpack_arr(txt,menu_stat.list);
dispose(Txt,Done);
end;
end;
procedure ShowMenu;
begin
if menu_stat.size<>0 then begin
showItems(menu_stat.list,menu_stat.size);
end;
end;
procedure init;
var a:integer;
s:string[15];
f:text;
begin
Randomize;
{$IFDEF DPMI}
Writeln('DOS Protected mode application');
{$ELSE}
Writeln('DOS Real mode application');
Writeln('Warning ! Some functions are not available');
{$ENDIF}
init_api(ResourceFile);
PreError:=RestoreDef;
init_forms;
soundInit;
init_buffer;
offcountmsg;
cleargr;
clearinput;
palette^.apply;
{$IFDEF DOTEXT}
images^.center(texture,screen);
{$ENDIF}
init_main;
if ExistFile(ScriptFile)
then begin
Assign(F,ScriptFile);
Reset(F); Init_menu(f); Reset(f);
Reset(F); buttons_init(f); Reset(F);
Reset(F); init_dialogs(f); Reset(F);
l:=TextFileSize(F);
Close(F);
end else l:=0;
GOProc:=Go; LookAtProc:=Look;
ExitProcedure:=Done; ScenSize:=ScriptSize;
ChooseFunc:=ChooseThing;
ShowMenuProc:=ShowMenu;
SwitchEditProc:=run_switches;
Black^.Apply;
showtaken:=take_thing;
images^.show(menu_dev,sidex,sidey,screen);
show_buttons;
init_switches;
{dshow_em(100,screen);}
initgame;
end;
procedure DreamsLogoShow;
begin
freeze_hands;
clearinput;
aboutmenu;
unfreeze_hands;
end;
procedure WizeLogoShow;
begin
freeze_hands;
clearinput;
wizemenu;
unfreeze_hands;
end;
procedure ProcessViewClick(x,y:integer; b:byte);
var dir:boolean;
begin
clearinput;
dir:=is_dir(x,y,loc_id);
case b of
01: if dir
then begin
done_status;
freeze_hands;
dirdefaultact(get_find(x,y,loc_id));
unfreeze_hands;
init_status;
end
else begin
freeze_hands;
act_default(PFlashCommon(findin(get_find(x,y,loc_id))));
unfreeze_hands;
end;
02: if dir
then
else begin
freeze_hands;
act_list(PFlashCommon(findin(get_find(x,y,loc_id))));
unfreeze_hands;
end;
end;
end;
procedure ProcessButtonsClick(x,y:integer);
begin
freeze_hands;
buttons_click(x,y);
unfreeze_hands;
end;
procedure ProcessThingBar(x,y:integer; b:byte);
begin
freeze_hands;
clearinput;
do_thingbar(b,x,y);
unfreeze_hands;
end;
var i:integer;
b:byte;
dir:boolean;
x,y:word;
begin
InitLoad:=False;
init;
x:=mouseposx;
y:=mouseposy;
While not altx_pressed do
begin
if (mouseposx<>x) or (mouseposy<>y)
then begin
x:=mouseposx; y:=mouseposy;
StatusLine(x,y);
end;
b:=MouseButtons;
if b<>0
then if cDREAMS.contains(x,y)
then DreamsLogoShow
else if cWIZECORE.contains(x,y)
then WizeLogoShow
else if cVIEW.contains(x,y)
then ProcessViewClick(x,y,b)
else if in_buttons(x,y)
then ProcessButtonsClick(x,y)
else if in_thingbar(x,y)
then ProcessThingBar(x,y,b)
else ClearInput;
end;
done;
end
{$ELSE}
Uses WinCrt;
begin
Writeln('This program is not compilable for windows');
end
{$ENDIF}.