ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
map_spiff.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCUMM_HE_MOONBASE_MAP_SPIFF_H
23 #define SCUMM_HE_MOONBASE_MAP_SPIFF_H
24 
25 #ifdef ENABLE_HE
26 
27 #include "engines/scumm/he/moonbase/map_mif.h"
28 
29 #define MAXELEVVAL 4 // for array size
30 
31 // These were "HIGH", "MEDIUM", and "LOW", but
32 // was renamed to prevent potential clashing
33 // with different platforms.
34 #define kElevHigh 3 // elevations
35 #define kElevMedium 2
36 #define kElevLow 1
37 
38 #define WATER 0 // special types
39 #define HUB 1
40 #define SMALLPOOL 2
41 #define MEDIUMPOOL 3
42 #define LARGEPOOLTOP 4
43 #define LARGEPOOLBOTTOM 5 // placeholder for top half of a large pool
44 
45 #define UNASSIGNED -1
46 #define LOW_OR_WATER -2
47 
48 #define MAXSIZE 80
49 
50 #define NORMALMIRROR 0
51 #define XOFFSETMIRROR 1
52 #define YOFFSETMIRROR 2
53 #define MAXDISTMIRROR 3
54 
55 namespace Scumm {
56 
57 class SpiffGenerator {
58 public:
59  SpiffGenerator(int seed);
60  ~SpiffGenerator() = default;
61 
62  MapFile *generateMap(int water, int tileset, int mapSize, int energy, int terrain);
63 
64 private:
65  int _seed = 0;
66 
67  int _numPoolsG = 0; // per quadrant
68  int _energyAmountG = 0; // 2048 = min energy on small map, 51200 = max energy on max map, etc.
69  int _cliffAmountG = 0; // amount of cliffs, 10 is min, 70 is max
70  int _waterAmountG = 0; // 0 is min, 30 is max
71  int _totalMapSizeG = 0;
72 
73  int _terrainSeedFlagG = 0; // disables kElevHigh or kElevLow terrain for the initial elevation when appropriate
74  int _islandsFlagG = 0; // enables islands
75  int _advancedMirrorOK_G = 0; // low terrain roughness can leave too abrupt changes at the edge, so set false to disable some mirroring types
76  int _mirrorTypeG = 0; // what mirroring is used
77 
78  int _mapCornerMaxG = 0; // size of random section
79  int _mapMiddleMaxG = 0;
80  int _mapCorner[MAXSIZE+1][MAXSIZE+1] = { {}, {} };
81  int _mapMiddle[MAXSIZE][MAXSIZE] = { {}, {} };
82 
83  float getRandomFloat();
84  int spiffRand(int min, int max);
85  int pickFrom2(int a, int probA, int b, int probB);
86  int pickFrom3(int a, int probA, int b, int probB, int c, int probC);
87  int pickFrom4(int a, int probA, int b, int probB, int c, int probC, int d, int probD);
88 
89  void getSpecials();
90  void copyMap(int XOffset, int YOffset, int XDirection, int YDirection);
91  void mirrorMap();
92  void errorCorrection();
93  void generate();
94 };
95 
96 } // End of namespace Scumm
97 
98 #endif // ENABLE_HE
99 
100 #endif // SCUMM_HE_MOONBASE_MAP_SPIFF_H
Definition: actor.h:30