{//-------------------------------------------------------------------------}\r
{/* }\r
+{Copyright (C) 2014 Jason Self <j@jxself.org> }\r
+{ }\r
+{This file is free software: you may copy, redistribute and/or modify it }\r
+{under the terms of the GNU Affero General Public License as published by }\r
+{the Free Software Foundation, either version 3 of the License, or (at your }\r
+{option) any later version. }\r
+{ }\r
+{This file is distributed in the hope that it will be useful, but WITHOUT }\r
+{ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or }\r
+{FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License}\r
+{for more details. }\r
+{ }\r
+{You should have received a copy of the GNU Affero General Public License }\r
+{along with this program; if not, see https://gnu.org/licenses or write to: }\r
+{ Free Software Foundation, Inc. }\r
+{ 51 Franklin Street, Fifth Floor }\r
+{ Boston, MA 02110-1301 }\r
+{ USA }\r
+{ }\r
+{This file incorporates work covered by the following copyright and }\r
+{permission notice: }\r
+{ }\r
{Copyright (C) 1990, 2009 - Apogee Software, Ltd. }\r
{ }\r
{This file is part of Supernova. Supernova is free software; you can }\r
{See the GNU General Public License for more details. }\r
{ }\r
{You should have received a copy of the GNU General Public License }\r
-{along with this program; if not, write to the Free Software }\r
-{Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.}\r
+{along with this program; if not, see https://gnu.org/licenses or write to: }\r
+{ Free Software Foundation, Inc. }\r
+{ 51 Franklin Street, Fifth Floor }\r
+{ Boston, MA 02110-1301 }\r
+{ USA }\r
{ }\r
{Original Source: 1990 Scott Miller }\r
{Prepared for public release: 03/19/09 - Joe Siegler, Apogee Software, Ltd. }\r
(* Copyright 1985 Scott Miller *)\r
(****************************************************************************)\r
\r
-{$C-,R-,V-,K-}\r
+{$C-,R-,V-,S-}\r
+{$IFDEF UNIX}\r
+uses ncurses,ocrt,sysutils,SDL;\r
+{$ELSE}\r
+uses crt,sysutils,SDL;\r
+{$ENDIF}\r
\r
const\r
VMax = 95; { Verbs }\r
MMax = 29; { Mov's }\r
Null = 0;\r
Legal = 255;\r
+ audio_FREQ = 22050; { SDL Audio parameters }\r
+ audio_SAMPLES = 512;\r
+ audio_STEP = 16;\r
+ audio_VOLUME = 24;\r
+ audio_MAXENTRIES = 50000;\r
\r
type\r
Str1 = string[1];\r
Str130 = string[131];\r
Str234 = string[234];\r
Str255 = string[255];\r
- Entr = record AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags:integer;end;\r
+ {Entr = record AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags:integer;end;}\r
+{$IFNDEF UNIX}\r
+ TWindow = record x,y,x1,y1:integer;end;\r
+ PWin = ^TWindow;\r
+{$ENDIF}\r
LSet = set of 1..NMax;\r
SaveSet = record\r
aInv : set of 1..MMax;\r
end;\r
\r
var\r
+ buflen : byte;\r
+ sound_i,\r
+ sound_play : integer;\r
+ sound_Freqs : array [0..audio_MAXENTRIES] of Integer;\r
+ sound_supported,\r
+ speaker_on : boolean;\r
+ lasttime, \r
+ sound_ticks : UInt32;\r
+ lastfreq,\r
+ current_freq : Real;\r
+ win1,win2,\r
+ stdscr : pwin;\r
+ UTF8Scr : boolean;\r
+{$IFNDEF UNIX}\r
+ win_arr : array [1..3] of TWindow;\r
+{$ENDIF}\r
SetSave : SaveSet;\r
Sets : file of SaveSet;\r
Objects : file of LSet;\r
Old, { for Block Reader }\r
Old2,\r
x,y,o : byte;\r
+ xi,yi : integer;\r
Code, { dials, etc }\r
Tic,\r
StoreR, { Knows if the previous Room that was read is the same as the }\r
R1,R2,S1: file of Str234;\r
L1 : file of Str78;\r
C1 : file of Str77;\r
- T1,T2 : text[2500];\r
+ T1,T2 : Text;\r
Identity,\r
VStr,\r
NStr,\r
PStr,\r
LastNoun,\r
Word : Str29;\r
- Result : Entr;\r
+ {Result : Entr;}\r
Drive,\r
Log,\r
CFlag : char;\r
SFlag : boolean; { If TRUE then a Special action took place. }\r
{----------}\r
\r
-{$Ia:ADPAR.pas <<<<<------ LOADS IN MANY PARSER COMMANDS ***************}\r
+{$I ADPAR.pas <<<<<------ LOADS IN MANY PARSER COMMANDS ***************}\r
\r
procedure Describe(Room:byte);\r
begin\r
end;\r
end; { Describe }\r
\r
-procedure Move{New:byte};\r
+procedure Move(New:byte);\r
begin SF;\r
if en(7) then RL(22) else\r
if en(8) then RL(23) else\r
end; { Move }\r
\r
\r
-{$Ia:VOCAB.pas <<<<<------- Loads in VOCABULARY LIST **********}\r
+{$I VOCAB.pas <<<<<------- Loads in VOCABULARY LIST **********}\r
\r
\r
{****************************** ROOM ROUTINES *******************************}\r
-overlay procedure Room1; { The Player's Ship }\r
+procedure Room1; { The Player's Ship }\r
begin\r
case Prm of\r
1:case Vb of { Bridge }\r
end; {main case}\r
end; { Room1 }\r
{----------}\r
-overlay procedure Room2; { The Player's Ship }\r
+procedure Room2; { The Player's Ship }\r
begin\r
case Prm of\r
2:case Vb of { Forward Corridor }\r
if en(22) then\r
begin RL(96);Add(23);\r
if(not en(44))and(Region=2)then\r
- begin Add(44);RL(327);for i:=1 to 400 do sound(random(3500)+999);\r
- for i:=7500 downto 500 do begin sound(random(i)+i);\r
- sound(random(3500)+2000)end;\r
- for i:=1 to 300 do sound(random(3500)+2500);nosound;\r
+ begin Add(44);RL(327);for i:=1 to 400 do sounddelayed(random(3500)+999);\r
+ for i:=7500 downto 500 do begin sounddelayed(random(i)+i);\r
+ sounddelayed(random(3500)+2000)end;\r
+ for i:=1 to 300 do sounddelayed(random(3500)+2500);nosound;\r
end\r
end\r
else RL(97)\r
end; {main case}\r
end; { Room2 }\r
{----------}\r
-overlay procedure Room3; { The Player's Ship }\r
+procedure Room3; { The Player's Ship }\r
begin\r
case Prm of\r
\r
end; {main case}\r
end; { Room3 }\r
{----------}\r
-overlay procedure Room4; { The Tavern }\r
+procedure Room4; { The Tavern }\r
begin\r
case Prm of\r
8:case Vb of { Tavern }\r
end; {main case}\r
end; { Room4 }\r
{----------}\r
-overlay procedure Room5; { Barre-An Planet }\r
+procedure Room5; { Barre-An Planet }\r
procedure Zap; begin for x:=1 to 29 do if R[x]=Prm then Van(x) end;\r
begin\r
case Prm of\r
end {main case}\r
end; { Room5 }\r
{----------}\r
-overlay procedure Room6; { Jungle Planet }\r
+procedure Room6; { Jungle Planet }\r
begin\r
case Prm of\r
23:case Vb of { Deep Pit }\r
25:case Vb of { Sandy Clearing }\r
4,9,51:if N1 in[Null,62,71] then begin RL(234);move(24)end;\r
1:begin move(26);Score(5,75)end;\r
- 1..8:RL(200);\r
+ 2,3,5..8:RL(200);\r
end; {Vb}\r
\r
26:case Vb of { Winding Path 1 }\r
59:if N1=66 then\r
if VStr='jump in' then begin RL(288);DEAD;end\r
else begin RS(66);move(27);Score(25,76)end;\r
- 1..8:RL(200);\r
+ 1,3,4,6..8:RL(200);\r
9,51:if N1=112 then RL(204);\r
28:if N1=66 then RS(85);\r
35,62:if N1=66 then begin RL(288);DEAD;end;\r
27:case Vb of { Winding Path 2 }\r
6:move(28);\r
8,11:begin RS(65);DEAD;end;\r
- 1..8:RL(200);\r
+ 1..5,7:RL(200);\r
9,51:if N1=112 then RL(204);\r
59:if N1=66 then\r
if VStr='jump in' then begin RL(288);DEAD;end\r
7:move(27);\r
6:move(29);\r
8:begin RS(67);DEAD;end;\r
- 1..8:RL(200);\r
+ 1..5:RL(200);\r
9,51:if N1=112 then RL(204);\r
28:if N1=112 then RS(86);\r
24:if N1=112 then RL(553);\r
9,51:if N1 in[Null,112] then begin RL(201);move(30)end;\r
6:begin RS(69);Prm:=31;T[11]:=4;end;\r
8:if en(35)or en(130)then begin RC:=1;move(59);Score(20,77)end;\r
- 1..8:RL(200);\r
+ 1..4:RL(200);\r
28:case N1 of 112:RL(238);120:RL(544);\r
113:if Md=1 then begin RL(314);Add(130)end end;\r
59:if N1=120 then begin RL(541);Prm:=31;T[11]:=4;end;\r
end {main case}\r
end; { Room6 }\r
{----------}\r
-overlay procedure Room7; { Jungle Planet }\r
+procedure Room7; { Jungle Planet }\r
begin\r
case Prm of\r
30:case Vb of { Top of Tree }\r
32:case Vb of { Winding Path 5 }\r
1:move(33);\r
8:begin move(29);if en(35) and not en(40) then begin RL(314);Add(40)end end;\r
- 1..8:RL(200);\r
+ 2..7:RL(200);\r
9,51:if N1=112 then RL(204);\r
end;\r
\r
33:case Vb of { Winding Path 6 }\r
2:move(32);\r
6:if not en(28)then begin RS(68);Add(28);move(34)end else move(34);\r
- 1..8:RL(200);\r
+ 1,3,4,5,7,8:RL(200);\r
9,51:if N1=112 then RL(204);\r
end;\r
\r
39:if(PyraCon in NounSet)or((30 in Nounset)and(PyraCon=9))then\r
begin RL(225);Min(30);SFlag:=false;end else\r
if HingeCon in NounSet then begin RL(228);SFlag:=false;end;\r
- 1..8:RL(200);\r
+ 2..6,8:RL(200);\r
9,51:if N1=112 then RL(204);\r
92:if N1 in[Null,49,122] then begin RL(216);move(23) end;\r
31:if N1 in[81,89,119] then begin RB(8,7);Pause;end;\r
end {main case}\r
end; { Room7 }\r
{----------}\r
-overlay procedure Room8; { Inside Pyramid (Top Level) }\r
+procedure Room8; { Inside Pyramid (Top Level) }\r
begin\r
case Prm of\r
35:case Vb of { Vestibule }\r
end {main case}\r
end; { Room8 }\r
{----------}\r
-overlay procedure Room9; { Inside Pyramid (Top Level) }\r
+procedure Room9; { Inside Pyramid (Top Level) }\r
begin\r
case Prm of\r
39:case Vb of { Holey Hall }\r
begin n[68]:='podium\alter\column\';WRITE('');move(41)end;\r
3,13:if(18 in Inv)or(4 in Inv)then begin Brief:=Brief-[39];move(39);\r
T[15]:=3;T[16]:=9;col(10,7);RS(93);\r
- for i:=500 to 5500 do sound(random(i)+random(i));\r
- for j:=1 to 7000 do sound(random(i)+random(i));\r
- for j:=i downto 500 do sound(random(j)+random(j));nosound;\r
+ for i:=500 to 5500 do sounddelayed(random(i)+random(i));\r
+ for j:=1 to 7000 do sounddelayed(random(i)+random(i));\r
+ for j:=i downto 500 do sounddelayed(random(j)+random(j));nosound;\r
end\r
else move(39);\r
42,44,51,75,84,94:\r
end {main case}\r
end; { Room9 }\r
{----------}\r
-overlay procedure Room10; { Pyramid Maze }\r
+procedure Room10; { Pyramid Maze }\r
begin\r
case Prm of\r
42:case Vb of { Ladder Room }\r
end {main case}\r
end; { Room10 }\r
{----------}\r
-overlay procedure Room11; { Inside Pyramid (Bottom Level) }\r
+procedure Room11; { Inside Pyramid (Bottom Level) }\r
begin\r
case Prm of\r
51:case Vb of { Lower Stairway }\r
end {main case}\r
end; { Room11 }\r
{----------}\r
-overlay procedure Room12; { Inside Pyramid (Bottom Level) }\r
+procedure Room12; { Inside Pyramid (Bottom Level) }\r
begin\r
case Prm of\r
56:case Vb of { The Erusaert }\r
end {main case}\r
end; { Room12 }\r
{----------}\r
-overlay procedure Room13; { Inside Pyramid (Bottom Level) }\r
+procedure Room13; { Inside Pyramid (Bottom Level) }\r
begin\r
case Prm of\r
57:case Vb of { Solar Chamber }\r
59:case Vb of { Overgrown Path }\r
5:begin RC:=RC-1;if RC<1 then begin RL(309);move(29)end else RL(310)end;\r
8:begin RC:=RC+1;if RC>7 then begin RL(309);move(60)end else RL(310)end;\r
- 1..8:RL(200);\r
+ 1..4,6,7:RL(200);\r
9,51:if N1=112 then RL(204);\r
end;\r
\r
4,11:begin Door(61,25);\r
if not en(43)then begin RS(137);Score(10,43)end end;\r
5:move(59);\r
- 1..8:RL(200);\r
+ 1..3,6,7,8:RL(200);\r
28:case N1 of 96:RL(323);115:RL(324)end;\r
41..44,54,75,88:if N1=56 then RL(315);\r
9,51:if N1=112 then RL(204)else RL(316);\r
case N1 of\r
37,38:RL(318);\r
44:begin RS(138);\r
- for y:=60 downto 1 do for x:=800 downto 1 do sound(x*y);\r
+ for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);\r
nosound;TFlag:=3;Brief:=Brief-[70];Score(10,89);\r
for x:=1 to MMax do if R[x]=62 then R[x]:=70;move(70)\r
end\r
42,44,75:case N1 of\r
37,38:RL(318);\r
44:begin RS(138);\r
- for y:=60 downto 1 do for x:=800 downto 1 do sound(x*y);\r
+ for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);\r
nosound;TFlag:=3;Brief:=Brief-[70];\r
for x:=1 to MMax do if R[x]=63 then R[x]:=70;move(70)\r
end\r
end {main case}\r
end; { Room13 }\r
{----------}\r
-overlay procedure Room14; { Inner Planet }\r
+procedure Room14; { Inner Planet }\r
begin\r
case Prm of\r
64:case Vb of { Lobby }\r
end {main case}\r
end; { Room14 }\r
{----------}\r
-overlay procedure Room15; { Inner Planet }\r
+procedure Room15; { Inner Planet }\r
begin\r
case Prm of\r
68:case Vb of { Decontamination }\r
42,44,75:\r
if N1 in[40..43]then\r
begin Brief:=Brief-[62,63,78];RS(138);Min(45);\r
- for y:=60 downto 1 do for x:=800 downto 1 do sound(x*y);nosound;\r
+ for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);nosound;\r
case N1 of\r
40:begin for x:=1 to MMax do if R[x]=70 then R[x]:=78;\r
TFlag:=4;move(78);Score(15,97)end;\r
end {main case}\r
end; { Room15 }\r
{----------}\r
-overlay procedure Room16; { Inner Planet }\r
+procedure Room16; { Inner Planet }\r
begin\r
case Prm of\r
73:case Vb of { Communications }\r
end {main case}\r
end; { Room16 }\r
{----------}\r
-overlay procedure Room17; { Planetship }\r
+procedure Room17; { Planetship }\r
begin\r
case Prm of\r
78:case Vb of { Icy Platform }\r
end {main case}\r
end; { Room17 }\r
{----------}\r
-overlay procedure Room18; { Planetship }\r
+procedure Room18; { Planetship }\r
begin\r
case Prm of\r
81:case Vb of { Circular Corridor }\r
end {main case}\r
end; { Room18 }\r
{----------}\r
-overlay procedure Room19; { Planetship }\r
+procedure Room19; { Planetship }\r
begin\r
case Prm of\r
84:case Vb of { Circular Corridor }\r
begin i:=random(7000)+999;play(i,i,50);delay(random(15)+5)end\r
end else\r
if N1 in[38,128]then RL(403);\r
- 42,75:if N1 in[38,128]then RL(403);\r
+ 42:if N1 in[38,128]then RL(403);\r
end;\r
\r
end {main case}\r
end; { Room19 }\r
{----------}\r
-overlay procedure Room20; { Planetship }\r
+procedure Room20; { Planetship }\r
begin\r
case Prm of\r
90:case Vb of { Reactors East }\r
end {main case}\r
end; { Room20 }\r
{----------}\r
-overlay procedure Room21; { Planetship }\r
+procedure Room21; { Planetship }\r
begin\r
case Prm of\r
94:case Vb of { Maintenance }\r
end {main case}\r
end; { Room21 }\r
{----------}\r
-overlay procedure Room22; { Planetship (Lower Level) }\r
+procedure Room22; { Planetship (Lower Level) }\r
begin\r
case Prm of\r
101:case Vb of { Security Tunnel #3 }\r
end {main case}\r
end; { Room22 }\r
{----------}\r
-overlay procedure Room23; { Planetship (Lower Level) }\r
+procedure Room23; { Planetship (Lower Level) }\r
label JUMP;\r
begin\r
case Prm of\r
{**************************** END OF ROOM ROUTINES **************************}\r
\r
\r
-{$Ia:DEFAULT.pas <<<<<------ LOADS IN DEFAULT ROUTINES *******************}\r
+{$I DEFAULT.pas <<<<<------ LOADS IN DEFAULT ROUTINES *******************}\r
\r
\r
BEGIN { Main Program }\r
Assign1;Assign2;Assign3;Assign4;Assign5;\r
Names1;Names2;Names3;\r
+InitScrKbd;\r
Title;\r
Init1;Init2;Init3;\r
Place1;Place2;\r