some fixes to video init/deinit
[k8vacspelynky.git] / rgentile.vc
blob5ecdb6aa2e895a98a90e4429d4271c537e710107
1 /**********************************************************************************
2  * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3  * Copyright (c) 2010, Moloch
4  * Copyright (c) 2018, Ketmar Dark
5  *
6  * This file is part of Spelunky.
7  *
8  * You can redistribute and/or modify Spelunky, including its source code, under
9  * the terms of the Spelunky User License.
10  *
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.
13  *
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/>
17  *
18  **********************************************************************************/
19 final void scrLevGenCreateChest (int mapx, int mapy) {
20   writeln("generating chest...");
21   auto obj = ItemChest(MakeMapObject(mapx, mapy, 'oChest'));
22   if (!obj) return;
26 final void scrLevGenCreateCrate (int mapx, int mapy) {
27   writeln("generating crate...");
28   auto obj = ItemCrate(MakeMapObject(mapx, mapy, 'oCrate'));
29   if (!obj) return;
33 final name scrGenSpikeType () {
34   if (global.config.woodSpikes) {
35     if (global.config.optSpikeVariations) {
36       if (global.randRoom(0, 100) >= 76) return 'oSpikes';
37     }
38     return 'oSpikesWood';
39   } else {
40     if (global.config.optSpikeVariations) {
41       if (global.randRoom(0, 100) >= 76) return 'oSpikesWood';
42     }
43     return 'oSpikes';
44   }
47 final name scrGenGetSnakeType () {
48   if (global.config.optEnemyVariations && global.currLevel > 1) {
49     int totdeath789 = stats.getDeathCountOnLevel(7)+stats.getDeathCountOnLevel(8)+stats.getDeathCountOnLevel(9);
50     if (totdeath789 < 12) {
51       if (global.randRoom(0, 100) >= 99-(global.currLevel-2)*8) return 'oCobra';
52       return 'oSnake';
53     }
54     if (totdeath789 < 22) {
55       if (global.randRoom(0, 100) >= 85-(global.currLevel-2)*8) return 'oCobra';
56       return 'oSnake';
57     }
58     if (totdeath789 < 32) {
59       if (global.randRoom(0, 100) >= 75-(global.currLevel-2)*8) return 'oCobra';
60       return 'oSnake';
61     }
62     if (totdeath789 < 42) {
63       if (global.randRoom(0, 100) >= 65-(global.currLevel-2)*8) return 'oCobra';
64       return 'oSnake';
65     }
66     if (totdeath789 < 52) {
67       if (global.randRoom(0, 100) >= 55-(global.currLevel-2)*8) return 'oCobra';
68       return 'oSnake';
69     }
70     if (global.randRoom(0, 100) >= 42-(global.currLevel-2)*8) return 'oCobra';
71   }
72   return 'oSnake';
76 final name scrGenGetSpiderType () {
77   if (global.config.optEnemyVariations && global.currLevel > 1) {
78     int totdeath789 = stats.getDeathCountOnLevel(7)+stats.getDeathCountOnLevel(8)+stats.getDeathCountOnLevel(9);
79     if (totdeath789 < 22) {
80       if (global.randRoom(0, 100) >= 99-(global.currLevel-2)*8) return 'oGreenSpiderHang';
81       return 'oSpiderHang';
82     }
83     if (totdeath789 < 32) {
84       if (global.randRoom(0, 100) >= 85-(global.currLevel-2)*8) return 'oGreenSpiderHang';
85       return 'oSpiderHang';
86     }
87     if (totdeath789 < 42) {
88       if (global.randRoom(0, 100) >= 75-(global.currLevel-2)*8) return 'oGreenSpiderHang';
89       return 'oSpiderHang';
90     }
91     if (totdeath789 < 52) {
92       if (global.randRoom(0, 100) >= 65-(global.currLevel-2)*8) return 'oGreenSpiderHang';
93       return 'oSpiderHang';
94     }
95     if (totdeath789 < 62) {
96       if (global.randRoom(0, 100) >= 55-(global.currLevel-2)*8) return 'oGreenSpiderHang';
97       return 'oSpiderHang';
98     }
99     if (global.randRoom(0, 100) >= 50-(global.currLevel-2)*8) return 'oGreenSpiderHang';
100   }
101   return 'oSpiderHang';