-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI_SNDEFF.PAS
More file actions
76 lines (58 loc) · 1.56 KB
/
Copy pathI_SNDEFF.PAS
File metadata and controls
76 lines (58 loc) · 1.56 KB
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
type string12= string[12];
type string3= string[3];
function fexist(n:word;c:char):string12;
var f:file of byte; s:string12;
begin
s:=ADVNAME+'.'+c+strnum(n);
assign(f,s);
{$I-} reset(f); {$I+}
if ioresult=0 then begin;close(f);fexist:=s;end
else fexist:='';
end;
function file_exists(s:string):string;
var dirinfo: searchrec;
begin
FindFirst(s, AnyFile, dirinfo);
if doserror=0 then file_exists:=dirinfo.name else file_exists:='';
end;
function custom_content_exists(n:word;ext:string3):string12;
var dirinfo: searchrec;
f:file of byte;
begin
assign(f,strnum(n)+'.'+ext);
{$I-} reset(f); {$I+}
if ioresult=0 then
begin
custom_content_exists:=strnum(n)+'.'+ext;
close(f);
end else
begin
FindFirst(strnum(n)+'-*.'+ext, AnyFile, dirinfo);
if doserror=0 then custom_content_exists:=dirinfo.name else
begin
custom_content_exists:='';
if n<100 then
if ext='BMP' then custom_content_exists:=fexist(n,'P');
end;
end;
end;
procedure soundeffect(snd:word; channel:byte);
var s:string;
function stock_sound_exists(n:word):string;
var dirinfo: searchrec;
begin
FindFirst(bgi_dir+'sounds\default\ack'+strnum(n)+'.RAW', AnyFile, dirinfo);
if doserror=0 then stock_sound_exists:=bgi_dir+'sounds\default\'+dirinfo.name else
stock_sound_exists:='';
end;
begin
if snd=65530 then
begin
stopsound(1);
end else
if snd<>0 then begin
s:=custom_content_exists(snd,'RAW');
if s='' then s:=stock_sound_exists(snd);
if s<>'' then playsound(s,channel);
end;
end;