Debian Codegraph @

terps/scott/ai_uk/hulk.c

raw symbols SCIP
1 //
2 // hulk.c
3 // part of ScottFree, an interpreter for adventures in Scott Adams format
4 //
5 // Created by Petter Sjölund on 2022-01-18.
6 //
7
8 #include "hulk.h"
9 #include "apple2draw.h"
10 #include "saga.h"
11 #include "sagagraphics.h"
12 #include "scott.h"
13
14 void HulkShowImageOnExamineUS(int noun)
15 {
16 if (!Graphics)
17 return;
18 int image = -1;
19 switch (noun) {
20 case 55:
21 if (Items[11].Location == MyLoc)
22 // Dome
23 image = 0;
24 break;
25 case 124: // Bio-Gem
26 case 41:
27 if (Items[18].Location == MyLoc || Items[18].Location == CARRIED)
28 image = 1;
29 break;
30 case 108:
31 if (Items[17].Location == MyLoc || Items[17].Location == CARRIED)
32 // Natter energy egg
33 image = 2;
34 break;
35 case 72:
36 if (Items[20].Location == MyLoc || Items[20].Location == CARRIED)
37 // Alien army ants
38 image = 3;
39 break;
40 case 21: // Killer Bees
41 if (Items[24].Location == MyLoc)
42 image = 4;
43 break;
44 case 83: // Iron ring
45 if (Items[33].Location == MyLoc)
46 image = 5;
47 break;
48 case 121: // Cage
49 if (Items[47].Location == MyLoc)
50 image = 6;
51 break;
52 case 26: // BASE
53 case 66: // HOLE
54 if (MyLoc == 14)
55 image = 7;
56 break;
57 default:
58 break;
59 }
60
61 if (image >= 0) {
62 glk_window_clear(Graphics);
63 if (DrawUSRoom(90 + image)) {
64 showing_closeup = 1;
65 if (CurrentSys == SYS_APPLE2)
66 DrawApple2ImageFromVideoMem();
67 Output(sys[HIT_ENTER]);
68 HitEnter();
69 }
70 }
71 }
72
73 void HulkShowImageOnExamine(int noun)
74 {
75 if (CurrentGame == HULK_US) {
76 HulkShowImageOnExamineUS(noun);
77 return;
78 }
79 int image = 0;
80 switch (noun) {
81 case 55:
82 if (Items[11].Location == MyLoc)
83 // Dome
84 image = 28;
85 break;
86 case 108:
87 if (Items[17].Location == MyLoc || Items[17].Location == CARRIED)
88 // Natter energy egg
89 image = 30;
90 break;
91 case 124: // Bio-Gem
92 case 41:
93 if (Items[18].Location == MyLoc || Items[18].Location == CARRIED)
94 image = 29;
95 break;
96 case 21: // Killer Bees
97 if (Items[24].Location == MyLoc)
98 image = 31;
99 break;
100 case 83: // Iron ring
101 if (Items[33].Location == MyLoc)
102 image = 32;
103 break;
104 case 121: // Cage
105 if (Items[47].Location == MyLoc)
106 image = 33;
107 break;
108 default:
109 break;
110 }
111 if (image) {
112 DrawImage(image);
113 showing_closeup = 1;
114 Output(sys[HIT_ENTER]);
115 HitEnter();
116 }
117 }
118
119 void HulkLook(void)
120 {
121 DrawImage(Rooms[MyLoc].Image);
122 for (int ct = 0; ct <= GameHeader.NumItems; ct++) {
123 int image = Items[ct].Image;
124 if (Items[ct].Location == MyLoc && image != 255) {
125 /* Don't draw bio gem in fuzzy area */
126 if ((ct == 18 && MyLoc != 15) ||
127 /* Don't draw Dr. Strange until outlet is plugged */
128 (ct == 26 && Items[28].Location != MyLoc))
129 continue;
130 DrawImage(image);
131 }
132 }
133 }
134
135 void DrawHulkImage(int p)
136 {
137 if (CurrentGame == HULK_US) {
138 if (DrawUSRoom(p)) {
139 showing_closeup = 1;
140 if (CurrentSys == SYS_APPLE2)
141 DrawApple2ImageFromVideoMem();
142 Output(sys[HIT_ENTER]);
143 HitEnter();
144 }
145 return;
146 }
147 int image = 0;
148 switch (p) {
149 case 85:
150 image = 34;
151 break;
152 case 86:
153 image = 35;
154 break;
155 case 83:
156 image = 36;
157 break;
158 case 84:
159 image = 37;
160 break;
161 case 87:
162 image = 38;
163 break;
164 case 88:
165 image = 39;
166 break;
167 case 89:
168 image = 40;
169 break;
170 case 82:
171 image = 41;
172 break;
173 case 81:
174 image = 42;
175 break;
176 default:
177 fprintf(stderr, "Unhandled image number %d!\n", p);
178 break;
179 }
180
181 if (image != 0) {
182 DrawImage(image);
183 showing_closeup = 1;
184 Output(sys[HIT_ENTER]);
185 HitEnter();
186 }
187 }