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 **********************************************************************************/
19 class MapTileGraveBase : MapTile;
21 array!name contentNames;
24 void generateContents () {
25 if (level.isObjectAtPoint(ix+8, iy+8, &level.cbIsObjectTreasure)) return;
26 if (global.randRoom(1, 2) == 1) contentNames[$] = 'oGoldNugget';
27 else if (global.randRoom(1, 4) == 1) contentNames[$] = 'oSapphireBig';
28 else if (global.randRoom(1, 6) == 1) contentNames[$] = 'oEmeraldBig';
29 else if (global.randRoom(1, 8) == 1) contentNames[$] = 'oRubyBig';
33 override void setupTile () {
34 switch (global.randRoom(1, 5)) {
35 case 1: spriteName = 'sGrave2'; break;
36 case 2: spriteName = 'sGrave3'; break;
37 case 3: spriteName = 'sGrave4'; break;
38 case 4: spriteName = 'sGrave5'; break;
39 case 5: spriteName = 'sGrave6'; break;
45 override bool smashMe () {
46 if (invincible) return false;
52 if (smashed) scrSprayRubble(ix, iy, 3);
53 scrDropRubble(ix, iy, 3);
55 foreach (name cname; contentNames) {
56 if (cname) level.MakeMapObject(ix+8, iy+8, cname);
58 contentNames.length = 0;
64 override void thinkFrame () {
65 if (!level.isSolidAtPoint(ix, iy+16)) { instanceRemove(); return; }
67 if (!isCollisionBottom(1)) {
68 yVel = fmin(yVel+myGrav, 0.6);
81 desc2 = "This tombstone marks the site of someone's burial.";
82 spriteName = 'sGrave';
90 // ////////////////////////////////////////////////////////////////////////// //
91 class MapTileGrave['oGrave'] : MapTileGraveBase;
97 // ////////////////////////////////////////////////////////////////////////// //
98 class MapTileAshGrave['oAshGrave'] : MapTileGraveBase;
101 override void generateContents () {
102 contentNames[$] = 'oAshShotgun';
106 override void setupTile () {
107 spriteName = 'sGraveAsh';
109 writeln("*** ASH Grave generated at (", ix/16, ",", iy/16, ")");