SOFTP3.INC 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. { Softporn Adventure, include file # 3 }
  2. procedure newlines( lines : integer );
  3. (*==================================*)
  4. var i : integer;
  5. begin
  6. for i:=1 to lines do writeln;
  7. end;
  8. procedure I_cant_go_that_way;
  9. (*=========================*)
  10. begin
  11. write_message( 'I can''t go that way!' );
  12. end;
  13. procedure cant_do_that;
  14. (*===================*)
  15. var messg : integer;
  16. begin
  17. messg := random(8) + 1;
  18. case messg of
  19. 1: writeln('Huh?');
  20. 2: writeln('Ummm......huh?');
  21. 3: writeln('You''re nuts!');
  22. 4: writeln('You can''t be serious!!');
  23. 5: writeln('Not bloody likely!!');
  24. 6: writeln('I don''t know how to.');
  25. 7: writeln('An interesting idea....');
  26. 8: writeln('I can''t do that.');
  27. end;
  28. end;
  29. procedure huh;
  30. (*==========*)
  31. begin
  32. write_message('Huh?');
  33. end;
  34. procedure I_cant_do_that;
  35. (*=====================*)
  36. begin
  37. writeln;
  38. cant_do_that;
  39. end;
  40. procedure I_dont_know_that_word;
  41. (*============================*)
  42. begin
  43. write_message( 'I don''t know that word!' );
  44. end;
  45. procedure find_me_one;
  46. (*==================*)
  47. var messg : integer;
  48. begin
  49. messg := random(4) + 1;
  50. writeln;
  51. case messg of
  52. 1: writeln('Find me one!!');
  53. 2: writeln('I don''t see it here!');
  54. 3: writeln('I can''t find it here!');
  55. 4: writeln('You have to find it first!');
  56. end;
  57. end;
  58. procedure I_dont_have_it;
  59. (*=====================*)
  60. begin
  61. write_message('I don''t have it!!');
  62. end;
  63. procedure I_already_have_it;
  64. (*========================*)
  65. begin
  66. with game_position do
  67. write_message( 'I already have it!!');
  68. end;
  69. procedure I_see_nothing_special;
  70. (*============================*)
  71. begin
  72. write_message('I see nothing special');
  73. end;
  74. procedure I_see_something( object : objects; messg : str25 );
  75. (*=========================================================*)
  76. begin
  77. with game_position do
  78. begin
  79. if object_place[object]=nowhere then
  80. begin
  81. write_message('I see something!!!');
  82. object_place[object] := your_place;
  83. end
  84. else if messg='' then
  85. I_see_nothing_special
  86. else
  87. write_message( messg )
  88. end;
  89. end;
  90. procedure not_yet_but_maybe_later;
  91. (*==============================*)
  92. begin
  93. write_message('Not yet but maybe later!');
  94. end;
  95. procedure sorry_no_money;
  96. (*=====================*)
  97. begin
  98. write_message('Sorry -- no money!!');
  99. end;
  100. function is_here ( obj : objects ) : boolean;
  101. (*=========================================*)
  102. begin
  103. with game_position do
  104. is_here := object_place[obj] = your_place;
  105. end;
  106. function is_carried ( obj : objects ) : boolean;
  107. (*============================================*)
  108. begin
  109. with game_position do
  110. is_carried := object_place[obj] = youhavit;
  111. end;
  112. function you_are_in ( place : places ) : boolean;
  113. (*=============================================*)
  114. begin
  115. with game_position do
  116. you_are_in := your_place = place;
  117. end;
  118. function save_file_name( objnam : word_name_string ) : str25;
  119. (*=========================================================*)
  120. var i : integer;
  121. file_name : str25;
  122. begin
  123. file_name := 'SOFTP' + copy(objnam,1,3);
  124. repeat
  125. i := pos( ' ', file_name );
  126. if i>0 then
  127. delete( file_name, i, 1 );
  128. until i=0;
  129. if file_name='SOFTP' then
  130. file_name := 'SOFTPORN';
  131. save_file_name := file_name + '.SAV';
  132. end;
  133. procedure init_new_game;
  134. (*====================*)
  135. var yesno : char;
  136. place : places;
  137. direction : directions;
  138. i : integer;
  139. begin
  140. clrscr;
  141. cursor_to_bottom;
  142. writeln ('Welcome to SOFTPORN ADVENTURE!!'); newlines(2);
  143. write ( 'Do you need instructions? (y/n) '); read_key( yesno, ['Y','N'] );
  144. if yesno='Y' then
  145. give_help
  146. else
  147. newlines(2);
  148. with game_position do
  149. begin
  150. line_from_kbd := '';
  151. object_place := orig_object_place;
  152. path := orig_path;
  153. for place:=first_place to last_place do
  154. place_visited[place] := false;
  155. your_place := b_bar;
  156. objects_carried := 0;
  157. TV_channel := 0;
  158. money := 10; { $1000 }
  159. score := 0;
  160. rope_in_use := false;
  161. window_broken := false;
  162. toilet_flushed := false;
  163. called_555_0987 := false;
  164. called_555_6969 := false;
  165. called_555_0439 := false;
  166. rubber_worn := false;
  167. hooker_fucked := false;
  168. door_W_open := false;
  169. radio_listened := false;
  170. wine_ordered := false;
  171. telephone_ringing := false;
  172. telephone_answered := false;
  173. hole_peeped := false;
  174. girl_2_fucked := false;
  175. tied_to_bed := false;
  176. drawer_open := false;
  177. closet_open := false;
  178. cabinet_open := false;
  179. doll_inflated := false;
  180. stool_climbed := false;
  181. water_on := false;
  182. pitcher_full := false;
  183. seeds_planted := false;
  184. seeds_watered := false;
  185. apple_given := false;
  186. candy_given := false;
  187. flowers_given := false;
  188. ring_given := false;
  189. married_to_girl := false;
  190. end;
  191. end; { Init new game }
  192. procedure look_around;
  193. (*==================*)
  194. var objcount : integer;
  195. obj : objects;
  196. exits,
  197. exitcount : integer;
  198. exit : directions;
  199. anyexit : boolean;
  200. i,j,
  201. hpos,
  202. namelen : integer;
  203. begin
  204. with game_position do
  205. begin
  206. if not place_visited[your_place] then
  207. write_long_message( integer(your_place)+1 );
  208. if (your_place=p_pntpch) and called_555_0439 then
  209. begin
  210. if not telephone_answered and (random(4)=2) then
  211. telephone_ringing := true;
  212. if telephone_ringing then
  213. write_message('The telephone rings');
  214. end;
  215. place_visited[your_place] := true;
  216. newlines(2);
  217. gotoXY(1,1);
  218. clreol;
  219. writeln( place_name[your_place] );
  220. clreol;
  221. write( 'Items in sight are: ' );
  222. hpos := 23;
  223. objcount := 0;
  224. for obj := first_object to last_object do
  225. begin
  226. if is_here(obj) then
  227. begin
  228. if objcount>0 then
  229. begin
  230. write(', ');
  231. hpos := hpos + 2;
  232. end;
  233. objcount := objcount + 1;
  234. namelen := length(object_name[obj]);
  235. if ( hpos + 3 + namelen ) > 80 then
  236. begin
  237. writeln;
  238. clreol;
  239. write( ' ' );
  240. hpos := 23;
  241. end;
  242. write(object_name[obj]);
  243. hpos := hpos + namelen;
  244. end;
  245. end;
  246. if objcount=0 then
  247. writeln( 'Nothing interesting.')
  248. else
  249. writeln;
  250. clreol;
  251. write( 'Other areas are: ');
  252. exitcount := 0;
  253. for exit := first_direction to last_direction do
  254. if path[your_place,exit] <> nowhere then
  255. exitcount := exitcount + 1;
  256. exits := exitcount;
  257. if exits=0 then
  258. write('By magic!')
  259. else
  260. for exit := first_direction to last_direction do
  261. if path[your_place,exit] <> nowhere then
  262. begin
  263. if exitcount<exits then
  264. begin
  265. if exitcount>1 then
  266. write(', ')
  267. else if exits>1 then
  268. write(' and ');
  269. end;
  270. exitcount := exitcount - 1;
  271. write( direction_name[exit]);
  272. end;
  273. writeln;
  274. clreol;
  275. for i:=1 to 79 do
  276. write('=');
  277. writeln;
  278. clreol;
  279. cursor_next_to_bottom;
  280. end; { with }
  281. end; { look_around }
  282. procedure take_inventory;
  283. (*=====================*)
  284. var objcount : integer;
  285. obj : objects;
  286. begin
  287. with game_position do
  288. begin
  289. writeln;
  290. writeln( 'I''m carrying: ');
  291. objcount := 0;
  292. for obj := first_object to last_object do
  293. begin
  294. if is_carried(obj) then
  295. begin
  296. objcount := objcount + 1;
  297. writeln(object_name[obj]);
  298. end;
  299. end;
  300. if objcount=0 then writeln('Nothing') else writeln;
  301. end;
  302. end; { take_inventory }
  303. procedure replace( object, replacement : str10; target : str120 );
  304. (*==============================================================*)
  305. var i : integer;
  306. begin
  307. if object<>replacement then
  308. repeat
  309. i := pos( object, target );
  310. if i>0 then
  311. begin
  312. delete( target, i, length(object) );
  313. insert( replacement, target, i );
  314. end;
  315. until i=0;
  316. end; { replace }
  317. procedure replace_with_space( object : str10; target : str120 );
  318. (*============================================================*)
  319. begin
  320. replace( object, ' ', target );
  321. end; { replace_with_space }
  322. procedure remove_leading_spaces( var str : str120 );
  323. (*================================================*)
  324. var i : integer;
  325. leading_space : boolean;
  326. begin
  327. repeat
  328. i := length(str);
  329. leading_space := (i>0) and (str[1]=' ');
  330. if leading_space then
  331. delete( str,1,1);
  332. until not leading_space;
  333. end; { remove_leading_spaces }
  334. procedure remove_leading_spaces_and_periods( var str : str120 );
  335. (*============================================================*)
  336. var i : integer;
  337. leading_space_period : boolean;
  338. begin
  339. repeat
  340. i := length(str);
  341. leading_space_period := (i>0) and ( (str[1]=' ') or (str[1]='.') );
  342. if leading_space_period then
  343. delete( str,1,1);
  344. until not leading_space_period;
  345. end; { remove_leading_spaces_and_periods }
  346. procedure remove_trailing_spaces( var str : str120 );
  347. (*=================================================*)
  348. var i : integer;
  349. trailing_space : boolean;
  350. begin
  351. repeat
  352. i := length(str);
  353. trailing_space := (i>0) and (str[1]=' ');
  354. if trailing_space then
  355. delete( str,i,1);
  356. until not trailing_space;
  357. end; { remove_trailing_spaces }
  358. procedure remove_multiple_spaces( var str : str120 );
  359. (*=================================================*)
  360. var i : integer;
  361. begin
  362. repeat
  363. i := pos( ' ', str );
  364. if i>0 then
  365. delete( str, i, 1 );
  366. until i=0;
  367. end; { remove_multiple_spaces }
  368. procedure expand_abbreviations( var str : str120 );
  369. (*===============================================*)
  370. var ch1 : char;
  371. str4 : string[4];
  372. i : integer;
  373. begin
  374. str4 := copy( str+' ', 1, 4 );
  375. for i:=1 to length(str4) do
  376. str4[i] := upcase(str4[i]);
  377. if str4 = 'INVE' then
  378. str := 'I';
  379. if length(str)=1 then
  380. begin
  381. ch1 := upcase(str[1]);
  382. if ch1='I' then str := 'TAKE INVE'
  383. else if ch1='N' then str := 'GO NORT'
  384. else if ch1='S' then str := 'GO SOUT'
  385. else if ch1='E' then str := 'GO EAST'
  386. else if ch1='W' then str := 'GO WEST'
  387. else if ch1='U' then str := 'GO UP'
  388. else if ch1='D' then str := 'GO DOWN'
  389. else if ch1='L' then str := 'LOOK';
  390. end;
  391. end; { expand abbreviations }
  392. procedure add_definite_article_to( var full_noun : str25 );
  393. (*=======================================================*)
  394. begin
  395. if full_noun[1] in vowels then
  396. full_noun := ' an ' + full_noun
  397. else
  398. full_noun := ' a ' + full_noun;
  399. end;
  400. procedure split_up_in_verb_and_noun( command : str120;
  401. var verb, noun : word_name_string;
  402. var full_verb, full_noun : str25 );
  403. (*==================================================*)
  404. const spaces = ' ';
  405. var i, p, k : integer;
  406. glue_word : boolean;
  407. word : word_name_string;
  408. full_word : str25;
  409. begin
  410. verb := spaces;
  411. noun := spaces;
  412. full_verb := '';
  413. full_noun := '';
  414. remove_leading_spaces(command);
  415. for i:=1 to 2 do
  416. begin
  417. repeat
  418. p := pos( ' ', command );
  419. if p=0 then
  420. begin
  421. full_word := command;
  422. command := '';
  423. end
  424. else
  425. begin
  426. full_word := copy ( command, 1, p-1 );
  427. delete( command, 1, p );
  428. remove_leading_spaces(command);
  429. end;
  430. word := full_word + spaces;
  431. for k:=1 to length(word) do
  432. word[k] := upcase(word[k]);
  433. glue_word := false;
  434. for k:=1 to gl_words do
  435. if word=glue_words[k] then
  436. glue_word := true;
  437. until not glue_word;
  438. if i=1 then
  439. begin
  440. verb := word;
  441. full_verb := full_word;
  442. end
  443. else
  444. begin
  445. noun := word;
  446. full_noun := full_word;
  447. end;
  448. end; { for i:=1 to 2 do }
  449. for i:=1 to syn_verbs do
  450. if verb=syn_verb[i].orig then
  451. verb := syn_verb[i].repl;
  452. for i:=1 to syn_nouns do
  453. if noun=syn_noun[i].orig then
  454. noun := syn_noun[i].repl;
  455. end; { split up in verb and noun }
  456. procedure read_and_parse_command( var verb, noun : word_name_string;
  457. var full_verb, full_noun : str25 );
  458. (*=================================================================*)
  459. var i, sppos : integer;
  460. command : str120;
  461. command_ok : boolean;
  462. begin
  463. repeat
  464. if line_from_kbd='' then
  465. begin
  466. repeat
  467. look_around;
  468. repeat
  469. writeln;
  470. write( 'What shall I do? ' );
  471. readln( line_from_kbd );
  472. if line_from_kbd='' then
  473. write_message('Beg pardon?');
  474. until line_from_kbd<>'';
  475. repeat
  476. i := pos( '-', line_from_kbd );
  477. if i>0 then
  478. delete( line_from_kbd, i, 1 );
  479. until i=0;
  480. for i := 1 to length(line_from_kbd) do
  481. begin
  482. if line_from_kbd[i] in [ '!', '?', ',' ] then
  483. line_from_kbd[i] := '.'
  484. else if line_from_kbd[i] in [ '!'..'-', '/', ':'..'?' ] then
  485. line_from_kbd[i] := ' ';
  486. end;
  487. remove_leading_spaces_and_periods(line_from_kbd);
  488. remove_trailing_spaces(line_from_kbd);
  489. remove_multiple_spaces(line_from_kbd);
  490. if line_from_kbd=' ' then
  491. line_from_kbd := '';
  492. if line_from_kbd='' then
  493. I_cant_do_that;
  494. until line_from_kbd<>'';
  495. end;
  496. i := pos( '.', line_from_kbd );
  497. if i>0 then
  498. begin
  499. command := copy( line_from_kbd, 1, i-1 );
  500. delete( line_from_kbd, 1, i );
  501. remove_leading_spaces_and_periods( line_from_kbd );
  502. remove_trailing_spaces( command );
  503. end
  504. else
  505. begin
  506. command := line_from_kbd;
  507. line_from_kbd := '';
  508. end;
  509. expand_abbreviations(command);
  510. repeat
  511. i := pos( '555', command );
  512. if i>0 then
  513. delete( command, i, 3 );
  514. until i=0;
  515. split_up_in_verb_and_noun( command, verb, noun, full_verb, full_noun );
  516. command_ok := verb <> ' ';
  517. if noun='LADY' then
  518. begin
  519. write_message('That''s no Lady!!! That''s my sister!!!!');
  520. command_ok := false;
  521. end
  522. else if verb='SAY ' then
  523. begin
  524. write_message('OK');
  525. writeln( copy( command, 5, 120 ) );
  526. command_ok := false;
  527. end
  528. else if (verb='TKAE') or (verb='TAEK') then
  529. begin
  530. write_message('Learn to spell, idiot!!!');
  531. command_ok := false;
  532. end;
  533. until command_ok;
  534. end; { read_and_parse_command }
  535.