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