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 moonRoomTimer1 = 30*3;
21 int moonRoomTimer9 = 100; // music
22 int moonRoomTimer10 = -1; // music
23 int moonRoomTimer11 = -1;
24 int moonRoomTimer66 = -1;
27 void thinkFrameGameMoon () {
29 if (moonRoomTimer1 >= -11) {
30 if (--moonRoomTimer1 == -10) {
31 MakeMapObject(160, -16, 'oBatTarget');
32 MakeMapObject(208, -64, 'oBatTarget');
33 MakeMapObject(256, -128, 'oBatTarget');
35 if (moonRoomTimer1 == 0) moonRoomTimer11 = 30;
39 if (moonRoomTimer9 > 0) {
40 if (--moonRoomTimer9 == 0) {
42 lg.musicName = 'musCave';
43 if (lg.musicName) global.playMusic(lg.musicName); else global.stopMusic();
48 if (moonRoomTimer66 > 0) {
49 if (--moonRoomTimer66 == 0) global.stopMusic();
53 if (moonRoomTimer11 > 0) {
54 if (--moonRoomTimer11 == 0) {
55 if (--moonTimer == 0) {
56 stats.mini2 = min(99, moonScore);
57 //!global.mini2 = oMoonRoom.baskets;
58 //!if (global.mini2 > 99) global.mini2 = 99;
59 //!scrUpdateHighscores(2);
62 auto obj = forEachObject(delegate bool (MapObject o) { return (o isa ObjBatTarget && o.isInstanceAlive); });
64 auto poof = MakeMapObject(obj.ix+8, obj.iy, 'oPoof');
67 poof = MakeMapObject(obj.ix+8, obj.iy, 'oPoof');
72 foreach (MapTile t; allEnters) {
73 if (t) MakeMapTile(t.ix/16, t.iy/16, 'oXScores');
75 foreach (MapTile t; allEnters) if (t) t.instanceRemove();
85 void createMoonRoom () {
86 global.darkLevel = false;
87 levBGImgName = 'bgCave';
91 moonRoomTimer1 = 30*3;
93 moonRoomTimer10 = -1; // music
98 setRoomBounds(0, 0, 304, 240-16);
99 //MakeMapTile(1, 0, 'oGame');
100 //MakeMapTile(1, 1, 'oMoonRoom');
101 //MakeMapTileAtPix(40, 88, 'oPlayer1');
102 //MakeMapTile(0, 1, 'oBricks');
104 MakeMapTile(0, 0, 'oHardBlock');
105 MakeMapTile(1, 0, 'oBrick');
106 MakeMapTile(2, 0, 'oBrick');
107 MakeMapTile(3, 0, 'oBrick');
108 MakeMapTile(4, 0, 'oBrick');
109 MakeMapTile(5, 0, 'oBrick');
110 MakeMapTile(6, 0, 'oBrick');
111 MakeMapTile(7, 0, 'oBrick');
112 MakeMapTile(8, 0, 'oBrick');
113 MakeMapTile(9, 0, 'oBrick');
114 MakeMapTile(11, 0, 'oBrick');
115 MakeMapTile(12, 0, 'oBrick');
116 MakeMapTile(14, 0, 'oBrick');
117 MakeMapTile(15, 0, 'oBrick');
118 MakeMapTile(17, 0, 'oBrick');
119 MakeMapTile(18, 0, 'oBrick');
120 MakeMapTile(19, 0, 'oHardBlock');
121 MakeMapTile(0, 1, 'oBrick');
122 MakeMapTile(1, 1, 'oBrick');
123 MakeMapTile(2, 1, 'oBrick');
124 MakeMapTile(3, 1, 'oBrick');
125 MakeMapTile(4, 1, 'oBrick');
126 MakeMapTile(5, 1, 'oBrick');
127 MakeMapTile(6, 1, 'oBrick');
128 MakeMapTile(7, 1, 'oBrick');
129 MakeMapTile(8, 1, 'oBrick');
130 MakeMapTile(9, 1, 'oBrick');
131 MakeMapTile(11, 1, 'oBrick');
132 MakeMapTile(12, 1, 'oBrick');
133 MakeMapTile(14, 1, 'oBrick');
134 MakeMapTile(15, 1, 'oBrick');
135 MakeMapTile(17, 1, 'oBrick');
136 MakeMapTile(18, 1, 'oBrick');
137 MakeMapTile(19, 1, 'oHardBlock');
138 MakeMapTile(0, 2, 'oBrick');
139 MakeMapTile(1, 2, 'oBrick');
140 MakeMapTile(18, 2, 'oBrick');
141 MakeMapTile(19, 2, 'oHardBlock');
142 MakeMapTile(0, 3, 'oHardBlock');
143 MakeMapTile(1, 3, 'oBrick');
144 MakeMapTile(18, 3, 'oBrick');
145 MakeMapTile(19, 3, 'oHardBlock');
146 MakeMapTile(0, 4, 'oHardBlock');
147 MakeMapTile(1, 4, 'oBrick');
148 MakeMapTile(18, 4, 'oBrick');
149 MakeMapTile(19, 4, 'oHardBlock');
150 MakeMapTile(0, 5, 'oHardBlock');
151 MakeMapTile(1, 5, 'oBrick');
152 MakeMapTile(2, 5, 'oEntrance');
153 MakeMapTile(18, 5, 'oBrick');
154 MakeMapTile(19, 5, 'oHardBlock');
155 MakeMapTile(0, 6, 'oHardBlock');
156 MakeMapTile(1, 6, 'oBrick');
157 MakeMapTile(2, 6, 'oBrickSmooth');
158 MakeMapTile(18, 6, 'oBrick');
159 MakeMapTile(19, 6, 'oHardBlock');
160 MakeMapObject(56, 104, 'oBow');
161 MakeMapTile(0, 7, 'oHardBlock');
162 MakeMapTile(1, 7, 'oBrick');
163 MakeMapTile(2, 7, 'oBrick');
164 MakeMapTile(3, 7, 'oBrickSmooth');
165 MakeMapObject(4*16, 7*16, 'oSpringTrap');
166 MakeMapTile(18, 7, 'oBrick');
167 MakeMapTile(19, 7, 'oHardBlock');
168 MakeMapTile(0, 8, 'oHardBlock');
169 MakeMapTile(1, 8, 'oBrick');
170 MakeMapTile(2, 8, 'oBrick');
171 MakeMapTile(3, 8, 'oBrick');
172 MakeMapTile(4, 8, 'oBrickSmooth');
173 MakeMapTile(18, 8, 'oBrick');
174 MakeMapTile(19, 8, 'oHardBlock');
175 MakeMapTile(0, 9, 'oHardBlock');
176 MakeMapTile(1, 9, 'oBrick');
177 MakeMapTile(2, 9, 'oBrick');
178 MakeMapTile(3, 9, 'oBrick');
179 MakeMapTile(4, 9, 'oBrick');
180 MakeMapTile(18, 9, 'oBrick');
181 MakeMapTile(19, 9, 'oHardBlock');
182 MakeMapTile(0, 10, 'oHardBlock');
183 MakeMapTile(1, 10, 'oBrick');
184 MakeMapTile(2, 10, 'oBrick');
185 MakeMapTile(3, 10, 'oBrick');
186 MakeMapTile(4, 10, 'oBrick');
187 MakeMapTile(18, 10, 'oBrick');
188 MakeMapTile(19, 10, 'oHardBlock');
189 MakeMapTile(0, 11, 'oHardBlock');
190 MakeMapTile(1, 11, 'oBrick');
191 MakeMapTile(2, 11, 'oBrick');
192 MakeMapTile(3, 11, 'oBrick');
193 MakeMapTile(4, 11, 'oBrick');
194 MakeMapTile(18, 11, 'oBrick');
195 MakeMapTile(19, 11, 'oHardBlock');
196 MakeMapTile(0, 12, 'oHardBlock');
197 MakeMapTile(1, 12, 'oBrick');
198 MakeMapTile(2, 12, 'oBrick');
199 MakeMapTile(3, 12, 'oBrick');
200 MakeMapTile(4, 12, 'oBrick');
201 MakeMapTile(5, 12, 'oSpikes');
202 MakeMapTile(6, 12, 'oSpikes');
203 MakeMapTile(7, 12, 'oSpikes');
204 MakeMapTile(8, 12, 'oSpikes');
205 MakeMapTile(9, 12, 'oSpikes');
206 MakeMapTile(10, 12, 'oSpikes');
207 MakeMapTile(11, 12, 'oSpikes');
208 MakeMapTile(12, 12, 'oSpikes');
209 MakeMapTile(13, 12, 'oSpikes');
210 MakeMapTile(14, 12, 'oSpikes');
211 MakeMapTile(15, 12, 'oSpikes');
212 MakeMapTile(16, 12, 'oSpikes');
213 MakeMapTile(17, 12, 'oSpikes');
214 MakeMapTile(18, 12, 'oBrick');
215 MakeMapTile(19, 12, 'oHardBlock');
216 MakeMapTile(0, 13, 'oBrick');
217 MakeMapTile(1, 13, 'oBrick');
218 MakeMapTile(2, 13, 'oBrick');
219 MakeMapTile(3, 13, 'oBrick');
220 MakeMapTile(4, 13, 'oBrick');
221 MakeMapTile(5, 13, 'oBrick');
222 MakeMapTile(6, 13, 'oBrick');
223 MakeMapTile(7, 13, 'oBrick');
224 MakeMapTile(8, 13, 'oBrick');
225 MakeMapTile(9, 13, 'oBrick');
226 MakeMapTile(10, 13, 'oBrick');
227 MakeMapTile(11, 13, 'oBrick');
228 MakeMapTile(12, 13, 'oBrick');
229 MakeMapTile(13, 13, 'oBrick');
230 MakeMapTile(14, 13, 'oBrick');
231 MakeMapTile(15, 13, 'oBrick');
232 MakeMapTile(16, 13, 'oBrick');
233 MakeMapTile(17, 13, 'oBrick');
234 MakeMapTile(18, 13, 'oBrick');
235 MakeMapTile(19, 13, 'oBrick');
236 MakeMapTile(0, 14, 'oBrick');
237 MakeMapTile(1, 14, 'oBrick');
238 MakeMapTile(2, 14, 'oBrick');
239 MakeMapTile(3, 14, 'oBrick');
240 MakeMapTile(4, 14, 'oBrick');
241 MakeMapTile(5, 14, 'oBrick');
242 MakeMapTile(6, 14, 'oBrick');
243 MakeMapTile(7, 14, 'oBrick');
244 MakeMapTile(8, 14, 'oBrick');
245 MakeMapTile(9, 14, 'oBrick');
246 MakeMapTile(10, 14, 'oBrick');
247 MakeMapTile(11, 14, 'oBrick');
248 MakeMapTile(12, 14, 'oBrick');
249 MakeMapTile(13, 14, 'oBrick');
250 MakeMapTile(14, 14, 'oBrick');
251 MakeMapTile(15, 14, 'oBrick');
252 MakeMapTile(16, 14, 'oBrick');
253 MakeMapTile(17, 14, 'oBrick');
254 MakeMapTile(18, 14, 'oBrick');
255 MakeMapTile(19, 14, 'oBrick');
256 MakeMapTile(0, 15, 'oBrick');
257 MakeMapTile(1, 15, 'oBrick');
258 MakeMapTile(2, 15, 'oBrick');
259 MakeMapTile(3, 15, 'oBrick');
260 MakeMapTile(4, 15, 'oBrick');
261 MakeMapTile(5, 15, 'oBrick');
262 MakeMapTile(6, 15, 'oBrick');
263 MakeMapTile(7, 15, 'oBrick');
264 MakeMapTile(8, 15, 'oBrick');
265 MakeMapTile(9, 15, 'oBrick');
266 MakeMapTile(10, 15, 'oBrick');
267 MakeMapTile(11, 15, 'oBrick');
268 MakeMapTile(12, 15, 'oBrick');
269 MakeMapTile(13, 15, 'oBrick');
270 MakeMapTile(14, 15, 'oBrick');
271 MakeMapTile(15, 15, 'oBrick');
272 MakeMapTile(16, 15, 'oBrick');
273 MakeMapTile(17, 15, 'oBrick');
274 MakeMapTile(18, 15, 'oBrick');
275 MakeMapTile(19, 15, 'oBrick');
277 // to prevent the Tunnel Man from tearing up the whole level
278 forEachTile(delegate bool (MapTile t) {
279 if (t.objType == 'oBrick') {
280 if (t.ix <= 16 || t.ix >= 288 || t.iy <= 16 || t.iy >= 208) t.invincible = true;
282 if (t.spikes) t.invincible = true;
286 spawnPlayerAt(2*16+8, 5*16+8);
287 player.dir = MapEntity::Dir.Right;