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