lightp.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* LIGHTP- LIGHT PROCESSOR */
  2. /*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
  3. /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
  4. /* WRITTEN BY R. M. SUPNIK */
  5. #include "funcs.h"
  6. #include "vars.h"
  7. logical lightp_(obj)
  8. integer obj;
  9. {
  10. /* System generated locals */
  11. logical ret_val;
  12. /* Local variables */
  13. integer flobts;
  14. integer i;
  15. ret_val = TRUE_;
  16. /* !ASSUME WINS */
  17. flobts = FLAMBT + LITEBT + ONBT;
  18. if (obj != oindex_1.candl) {
  19. goto L20000;
  20. }
  21. /* !CANDLE? */
  22. if (findex_1.orcand != 0) {
  23. goto L19100;
  24. }
  25. /* !FIRST REF? */
  26. findex_1.orcand = 1;
  27. /* !YES, CANDLES ARE */
  28. cevent_1.ctick[cindex_1.cevcnd - 1] = 50;
  29. /* !BURNING WHEN SEEN. */
  30. L19100:
  31. if (prsvec_1.prsi == oindex_1.candl) {
  32. goto L10;
  33. }
  34. /* !IGNORE IND REFS. */
  35. if (prsvec_1.prsa != vindex_1.trnofw) {
  36. goto L19200;
  37. }
  38. /* !TURN OFF? */
  39. i = 513;
  40. /* !ASSUME OFF. */
  41. if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
  42. i = 514;
  43. }
  44. /* !IF ON, DIFFERENT. */
  45. cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
  46. /* !DISABLE COUNTDOWN. */
  47. objcts_1.oflag1[oindex_1.candl - 1] &= ~ ONBT;
  48. rspeak_(i);
  49. return ret_val;
  50. L19200:
  51. if (prsvec_1.prsa != vindex_1.burnw && prsvec_1.prsa != vindex_1.trnonw) {
  52. goto L10;
  53. }
  54. if ((objcts_1.oflag1[oindex_1.candl - 1] & LITEBT) != 0) {
  55. goto L19300;
  56. }
  57. rspeak_(515);
  58. /* !CANDLES TOO SHORT. */
  59. return ret_val;
  60. L19300:
  61. if (prsvec_1.prsi != 0) {
  62. goto L19400;
  63. }
  64. /* !ANY FLAME? */
  65. rspeak_(516);
  66. /* !NO, LOSE. */
  67. prsvec_1.prswon = FALSE_;
  68. return ret_val;
  69. L19400:
  70. if (prsvec_1.prsi != oindex_1.match || ! ((objcts_1.oflag1[oindex_1.match
  71. - 1] & ONBT) != 0)) {
  72. goto L19500;
  73. }
  74. i = 517;
  75. /* !ASSUME OFF. */
  76. if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
  77. i = 518;
  78. }
  79. /* !IF ON, JOKE. */
  80. objcts_1.oflag1[oindex_1.candl - 1] |= ONBT;
  81. cevent_1.cflag[cindex_1.cevcnd - 1] = TRUE_;
  82. /* !RESUME COUNTDOWN. */
  83. rspeak_(i);
  84. return ret_val;
  85. L19500:
  86. if (prsvec_1.prsi != oindex_1.torch || ! ((objcts_1.oflag1[oindex_1.torch
  87. - 1] & ONBT) != 0)) {
  88. goto L19600;
  89. }
  90. if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
  91. goto L19700;
  92. }
  93. /* !ALREADY ON? */
  94. newsta_(oindex_1.candl, 521, 0, 0, 0);
  95. /* !NO, VAPORIZE. */
  96. return ret_val;
  97. L19600:
  98. rspeak_(519);
  99. /* !CANT LIGHT WITH THAT. */
  100. return ret_val;
  101. L19700:
  102. rspeak_(520);
  103. /* !ALREADY ON. */
  104. return ret_val;
  105. L20000:
  106. if (obj != oindex_1.match) {
  107. bug_(6, obj);
  108. }
  109. if (prsvec_1.prsa != vindex_1.trnonw || prsvec_1.prso != oindex_1.match) {
  110. goto L20500;
  111. }
  112. if (findex_1.ormtch != 0) {
  113. goto L20100;
  114. }
  115. /* !ANY MATCHES LEFT? */
  116. rspeak_(183);
  117. /* !NO, LOSE. */
  118. return ret_val;
  119. L20100:
  120. --findex_1.ormtch;
  121. /* !DECREMENT NO MATCHES. */
  122. objcts_1.oflag1[oindex_1.match - 1] |= flobts;
  123. cevent_1.ctick[cindex_1.cevmat - 1] = 2;
  124. /* !COUNTDOWN. */
  125. rspeak_(184);
  126. return ret_val;
  127. L20500:
  128. if (prsvec_1.prsa != vindex_1.trnofw || (objcts_1.oflag1[oindex_1.match -
  129. 1] & ONBT) == 0) {
  130. goto L10;
  131. }
  132. objcts_1.oflag1[oindex_1.match - 1] &= ~ flobts;
  133. cevent_1.ctick[cindex_1.cevmat - 1] = 0;
  134. rspeak_(185);
  135. return ret_val;
  136. /* HERE FOR FALSE RETURN */
  137. L10:
  138. ret_val = FALSE_;
  139. return ret_val;
  140. } /* lightp_ */