-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmb1levelgenerator.h
29 lines (26 loc) · 1.41 KB
/
smb1levelgenerator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef SMB1LEVELGENERATOR_H
#define SMB1LEVELGENERATOR_H
#include <fstream>
#include <vector>
class SMB1LevelGenerator
{
public:
SMB1LevelGenerator();
bool RandomizeAllLevels(std::fstream &file, bool randomizeObjects, bool randomizeEnemies);
bool isROMValid(std::fstream &file);
private:
bool RandomizeLevel(std::fstream &file, int objectOffset, int EnemyOffset, bool randomizeObjects, bool randomizeEnemies);
void GenerateBasicLevel(std::vector<unsigned char> &header, std::vector<unsigned char> &objects, std::vector<unsigned char> &enemies);
void GenerateTreeLevel(std::vector<unsigned char> &header, std::vector<unsigned char> &objects, std::vector<unsigned char> &enemies);
int AddItemsToBlockRow(int &objectsLeft, std::vector<unsigned char> &objects, int blockRow);
bool isBannedObject(std::vector<unsigned char> &hex);
bool isBannedEnemy(std::vector<unsigned char> &hex);
void RandomizeObjects(std::vector<unsigned char> &objects);
void RandomizeEnemies(std::vector<unsigned char> &enemies);
std::vector<unsigned char> ReadLevelHeader(std::fstream &file, int offset);
std::vector<unsigned char> ReadLevelObjects(std::fstream &file, int offset);
std::vector<unsigned char> ReadLevelEnemies(std::fstream &file, int offset);
int LowballRandomValue(int min, int max);
std::vector<unsigned char> NESHeader = { 0x4E, 0x45, 0x53, 0x1A };
};
#endif // SMB1LEVELGENERATOR_H