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