1 /**********************************************************************************
2 * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3 * Copyright (c) 2018, Ketmar Dark
5 * This file is part of Spelunky.
7 * You can redistribute and/or modify Spelunky, including its source code, under
8 * the terms of the Spelunky User License.
10 * Spelunky is distributed in the hope that it will be entertaining and useful,
11 * but WITHOUT WARRANTY. Please see the Spelunky User License for more details.
13 * The Spelunky User License should be available in "Game Information", which
14 * can be found in the Resource Explorer, or as an external file called COPYING.
15 * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
17 **********************************************************************************/
19 int sunRoomTimer0 = -1; //100;
20 int sunRoomTimer1 = 30*3;
21 int sunRoomTimer10 = 100; // music
22 int sunRoomTimer11 = 110;
25 void thinkFrameGameSun () {
27 if (sunRoomTimer1 > 0) {
32 if (sunRoomTimer10 > 0) {
33 if (--sunRoomTimer10 == 0) {
35 lg.musicName = 'musCave';
36 if (lg.musicName) global.playMusic(lg.musicName); else global.stopMusic();
42 if (sunRoomTimer11 > 0) {
43 if (--sunRoomTimer11 == 0) {
45 sunScore = min(99, sunScore+1);
51 if (sunRoomTimer0 > 0) {
52 if (--sunRoomTimer0 == 0) {
53 sunRoomTimer0 = global.randOther(100, 200);
55 int i = clamp(player.ix, 40, 280);
57 if (!isSolidAtPoint(i, j)) {
59 auto ghost = forEachObject(delegate bool (MapObject o) { return (o isa ObjGhost); });
60 if (!ghost) MakeMapObject((player.ix > 304/2 ? -32 : 320), 120-16, 'oGhost');
61 } else if (sunScore >= 50) {
62 auto obj = MakeMapObject(152, 32, 'oVampire');
63 obj.status = MapObject::FLY;
64 auto poof = MakeMapObject(obj.ix+8, obj.iy+8, 'oPoof');
67 poof = MakeMapObject(obj.ix+8, obj.iy+8, 'oPoof');
71 auto obj = ItemBomb(MakeMapObject(i, j, 'oBomb'));
73 //obj.imageSpeed = 0.2;
74 auto poof = MakeMapObject(obj.ix, obj.iy, 'oPoof');
77 poof = MakeMapObject(obj.ix, obj.iy, 'oPoof');
89 if (global.plife > 0 && !player.dead) {
90 auto dms = forEachObject(delegate bool (MapObject o) { return (o isa MonsterDamsel); });
91 if (!dms || dms.hp < 1) global.plife = 0;
96 void createSunRoom () {
97 global.darkLevel = false;
98 levBGImgName = 'bgCave';
106 sunRoomTimer0 = 100+global.randOther(100, 200);
108 sunRoomTimer10 = 100;
109 sunRoomTimer11 = 100;
111 setRoomBounds(0, 0, 304, 240-16);
112 //MakeMapTile(0, 0, 'oGame');
113 //MakeMapTile(0, 1, 'oBricks');
114 //MakeMapTile(1, 1, 'oSunRoom');
115 //MakeMapTileAtPix(56, 168, 'oPlayer1');
117 MakeMapTile(0, 0, 'oHardBlock');
118 MakeMapTile(1, 0, 'oHardBlock');
119 MakeMapTile(2, 0, 'oBrick');
120 MakeMapTile(3, 0, 'oHardBlock');
121 MakeMapTile(4, 0, 'oHardBlock');
122 MakeMapTile(5, 0, 'oHardBlock');
123 MakeMapTile(6, 0, 'oHardBlock');
124 MakeMapTile(7, 0, 'oHardBlock');
125 MakeMapTile(8, 0, 'oHardBlock');
126 MakeMapTile(9, 0, 'oHardBlock');
127 MakeMapTile(10, 0, 'oHardBlock');
128 MakeMapTile(11, 0, 'oHardBlock');
129 MakeMapTile(12, 0, 'oHardBlock');
130 MakeMapTile(13, 0, 'oHardBlock');
131 MakeMapTile(14, 0, 'oHardBlock');
132 MakeMapTile(15, 0, 'oHardBlock');
133 MakeMapTile(16, 0, 'oHardBlock');
134 MakeMapTile(17, 0, 'oHardBlock');
135 MakeMapTile(18, 0, 'oHardBlock');
136 MakeMapTile(19, 0, 'oHardBlock');
137 MakeMapTile(0, 1, 'oHardBlock');
138 MakeMapTile(1, 1, 'oBrick');
139 MakeMapTile(2, 1, 'oBrick');
140 MakeMapTile(3, 1, 'oBrick');
141 MakeMapTile(4, 1, 'oBrick');
142 MakeMapTile(5, 1, 'oBrick');
143 MakeMapTile(6, 1, 'oBrick');
144 MakeMapTile(7, 1, 'oBrick');
145 MakeMapTile(8, 1, 'oBrick');
146 MakeMapTile(9, 1, 'oBrick');
147 MakeMapTile(10, 1, 'oBrick');
148 MakeMapTile(11, 1, 'oBrick');
149 MakeMapTile(12, 1, 'oBrick');
150 MakeMapTile(13, 1, 'oBrick');
151 MakeMapTile(14, 1, 'oBrick');
152 MakeMapTile(15, 1, 'oBrick');
153 MakeMapTile(16, 1, 'oBrick');
154 MakeMapTile(17, 1, 'oBrick');
155 MakeMapTile(18, 1, 'oBrick');
156 MakeMapTile(19, 1, 'oHardBlock');
157 MakeMapTile(0, 2, 'oHardBlock');
158 MakeMapTile(1, 2, 'oArrowRepeaterR');
159 MakeMapTile(7, 2, 'oVine');
160 MakeMapTile(12, 2, 'oVine');
161 MakeMapTile(18, 2, 'oArrowRepeaterL');
162 MakeMapTile(19, 2, 'oHardBlock');
163 MakeMapTile(0, 3, 'oHardBlock');
164 MakeMapTile(1, 3, 'oBrick');
165 MakeMapTile(4, 3, 'oSmashTrap');
166 MakeMapTile(7, 3, 'oVine');
167 MakeMapTile(12, 3, 'oVine');
168 MakeMapTile(15, 3, 'oSmashTrap');
169 MakeMapTile(18, 3, 'oBrick');
170 MakeMapTile(19, 3, 'oHardBlock');
171 MakeMapTile(0, 4, 'oHardBlock');
172 MakeMapTile(1, 4, 'oBrick');
173 MakeMapTile(4, 4, 'oBrick');
174 MakeMapTile(5, 4, 'oBrick');
175 MakeMapTile(7, 4, 'oVine');
176 MakeMapTile(12, 4, 'oVine');
177 MakeMapTile(14, 4, 'oBrick');
178 MakeMapTile(15, 4, 'oBrick');
179 MakeMapTile(18, 4, 'oBrick');
180 MakeMapTile(19, 4, 'oHardBlock');
181 MakeMapTile(0, 5, 'oHardBlock');
182 MakeMapTile(1, 5, 'oBrick');
183 MakeMapTile(7, 5, 'oVine');
184 MakeMapTile(12, 5, 'oVine');
185 MakeMapTile(18, 5, 'oBrick');
186 MakeMapTile(19, 5, 'oHardBlock');
187 MakeMapTile(0, 6, 'oHardBlock');
188 MakeMapTile(1, 6, 'oArrowRepeaterR');
189 MakeMapTile(7, 6, 'oVine');
190 MakeMapTile(9, 6, 'oDarkFall');
191 MakeMapTile(10, 6, 'oDarkFall');
192 MakeMapTile(12, 6, 'oVine');
193 MakeMapTile(18, 6, 'oArrowRepeaterL');
194 MakeMapTile(19, 6, 'oHardBlock');
195 MakeMapTile(0, 7, 'oHardBlock');
196 MakeMapTile(1, 7, 'oBrick');
197 MakeMapTile(4, 7, 'oSmashTrap');
198 MakeMapTile(7, 7, 'oVine');
199 MakeMapTile(12, 7, 'oVine');
200 MakeMapTile(15, 7, 'oSmashTrap');
201 MakeMapTile(18, 7, 'oBrick');
202 MakeMapTile(19, 7, 'oHardBlock');
203 MakeMapTile(0, 8, 'oHardBlock');
204 MakeMapTile(1, 8, 'oBrick');
205 MakeMapTile(4, 8, 'oBrick');
206 MakeMapTile(5, 8, 'oBrick');
207 MakeMapObject(10*16, 8*16+8, 'oDamsel');
208 MakeMapTile(14, 8, 'oBrick');
209 MakeMapTile(15, 8, 'oBrick');
210 MakeMapTile(18, 8, 'oBrick');
211 MakeMapTile(19, 8, 'oHardBlock');
212 MakeMapTile(0, 9, 'oHardBlock');
213 MakeMapTile(1, 9, 'oBrick');
214 MakeMapTile(9, 9, 'oSpearTrapTop');
215 MakeMapTile(10, 9, 'oSpearTrapTop');
216 MakeMapTile(18, 9, 'oBrick');
217 MakeMapTile(19, 9, 'oHardBlock');
218 MakeMapTile(0, 10, 'oHardBlock');
219 MakeMapTile(1, 10, 'oBrick');
220 MakeMapObject(2*16, 10*16, 'oSpringTrap');
221 MakeMapTile(3, 10, 'oEntrance');
222 MakeMapObject(7*16, 10*16, 'oSpringTrap');
223 MakeMapTile(9, 10, 'oSpearTrapBottom');
224 MakeMapTile(10, 10, 'oSpearTrapBottom');
225 MakeMapObject(12*16, 10*16, 'oSpringTrap');
226 MakeMapObject(17*16, 10*16, 'oSpringTrap');
227 MakeMapTile(18, 10, 'oBrick');
228 MakeMapTile(19, 10, 'oHardBlock');
229 MakeMapTile(0, 11, 'oHardBlock');
230 MakeMapTile(1, 11, 'oBrick');
231 MakeMapTile(2, 11, 'oDark');
232 MakeMapTile(3, 11, 'oBrick');
233 MakeMapTile(4, 11, 'oBrick');
234 MakeMapTile(5, 11, 'oBrick');
235 MakeMapTile(6, 11, 'oBrick');
236 MakeMapTile(7, 11, 'oDark');
237 MakeMapTile(8, 11, 'oBrick');
238 MakeMapTile(9, 11, 'oBrick');
239 MakeMapTile(10, 11, 'oBrick');
240 MakeMapTile(11, 11, 'oBrick');
241 MakeMapTile(12, 11, 'oDark');
242 MakeMapTile(13, 11, 'oBrick');
243 MakeMapTile(14, 11, 'oBrick');
244 MakeMapTile(15, 11, 'oBrick');
245 MakeMapTile(16, 11, 'oBrick');
246 MakeMapTile(17, 11, 'oDark');
247 MakeMapTile(18, 11, 'oBrick');
248 MakeMapTile(19, 11, 'oHardBlock');
249 MakeMapTile(0, 12, 'oHardBlock');
250 MakeMapTile(1, 12, 'oBrick');
251 MakeMapTile(18, 12, 'oBrick');
252 MakeMapTile(19, 12, 'oHardBlock');
253 MakeMapTile(0, 13, 'oHardBlock');
254 MakeMapTile(1, 13, 'oHardBlock');
255 MakeMapTile(2, 13, 'oLava');
256 MakeMapTile(3, 13, 'oLava');
257 MakeMapTile(4, 13, 'oLava');
258 MakeMapTile(5, 13, 'oLava');
259 MakeMapTile(6, 13, 'oLava');
260 MakeMapTile(7, 13, 'oLava');
261 MakeMapTile(8, 13, 'oLava');
262 MakeMapTile(9, 13, 'oLava');
263 MakeMapTile(10, 13, 'oLava');
264 MakeMapTile(11, 13, 'oLava');
265 MakeMapTile(12, 13, 'oLava');
266 MakeMapTile(13, 13, 'oLava');
267 MakeMapTile(14, 13, 'oLava');
268 MakeMapTile(15, 13, 'oLava');
269 MakeMapTile(16, 13, 'oLava');
270 MakeMapTile(17, 13, 'oLava');
271 MakeMapTile(18, 13, 'oHardBlock');
272 MakeMapTile(19, 13, 'oHardBlock');
273 MakeMapTile(0, 14, 'oHardBlock');
274 MakeMapTile(1, 14, 'oHardBlock');
275 MakeMapTile(2, 14, 'oLava');
276 MakeMapTile(3, 14, 'oLava');
277 MakeMapTile(4, 14, 'oLava');
278 MakeMapTile(5, 14, 'oLava');
279 MakeMapTile(6, 14, 'oLava');
280 MakeMapTile(7, 14, 'oLava');
281 MakeMapTile(8, 14, 'oLava');
282 MakeMapTile(9, 14, 'oLava');
283 MakeMapTile(10, 14, 'oLava');
284 MakeMapTile(11, 14, 'oLava');
285 MakeMapTile(12, 14, 'oLava');
286 MakeMapTile(13, 14, 'oLava');
287 MakeMapTile(14, 14, 'oLava');
288 MakeMapTile(15, 14, 'oLava');
289 MakeMapTile(16, 14, 'oLava');
290 MakeMapTile(17, 14, 'oLava');
291 MakeMapTile(18, 14, 'oHardBlock');
292 MakeMapTile(19, 14, 'oHardBlock');
293 MakeMapTile(0, 15, 'oHardBlock');
294 MakeMapTile(1, 15, 'oHardBlock');
295 MakeMapTile(2, 15, 'oLavaSolid');
296 MakeMapTile(3, 15, 'oLavaSolid');
297 MakeMapTile(4, 15, 'oLavaSolid');
298 MakeMapTile(5, 15, 'oLavaSolid');
299 MakeMapTile(6, 15, 'oLavaSolid');
300 MakeMapTile(7, 15, 'oLavaSolid');
301 MakeMapTile(8, 15, 'oLavaSolid');
302 MakeMapTile(9, 15, 'oLavaSolid');
303 MakeMapTile(10, 15, 'oLavaSolid');
304 MakeMapTile(11, 15, 'oLavaSolid');
305 MakeMapTile(12, 15, 'oLavaSolid');
306 MakeMapTile(13, 15, 'oLavaSolid');
307 MakeMapTile(14, 15, 'oLavaSolid');
308 MakeMapTile(15, 15, 'oLavaSolid');
309 MakeMapTile(16, 15, 'oLavaSolid');
310 MakeMapTile(17, 15, 'oLavaSolid');
311 MakeMapTile(18, 15, 'oHardBlock');
312 MakeMapTile(19, 15, 'oHardBlock');
314 // to prevent the Tunnel Man from tearing up the whole level
315 forEachTile(delegate bool (MapTile t) {
316 if (t.objType == 'oBrick') {
317 if (t.ix <= 16 || t.ix >= 288 || t.iy <= 16 || t.iy >= 208) t.invincible = true;
322 spawnPlayerAt(3*16+8, 10*16+8);
323 player.dir = MapEntity::Dir.Right;