forked from Warzone2100/warzone2100
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevels.h
111 lines (82 loc) · 3.91 KB
/
levels.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2012 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** @file
* Control the data loading for game levels
*/
#ifndef __INCLUDED_SRC_LEVELS_H__
#define __INCLUDED_SRC_LEVELS_H__
#include "lib/framework/crc.h"
#include "init.h"
#include "game.h"
// maximum number of WRF/WDG files
#define LEVEL_MAXFILES 9
// types of level datasets
enum LEVEL_TYPE
{
LDS_COMPLETE, // all data required for a stand alone level
LDS_CAMPAIGN, // the data set for a campaign (no map data)
LDS_CAMSTART, // mapdata for the start of a campaign
LDS_CAMCHANGE, // data for changing between levels
LDS_EXPAND, // extra data for expanding a campaign map
LDS_BETWEEN, // pause between missions
LDS_MKEEP, // off map mission (extra map data)
LDS_MCLEAR, // off map mission (extra map data)
LDS_EXPAND_LIMBO, // expand campaign map using droids held in apsLimboDroids
LDS_MKEEP_LIMBO, // off map saving any droids (selectedPlayer) at end into apsLimboDroids
LDS_NONE, //flags when not got a mission to go back to or when
//already on one - ****LEAVE AS LAST ONE****
LDS_MULTI_TYPE_START, ///< Start number for custom type numbers (as used by a `type` instruction)
};
// the WRF/WDG files needed for a particular level
// the WRF/WDG files needed for a particular level
struct LEVEL_DATASET
{
SWORD type; // type of map
SWORD players; // number of players for the map
SWORD game; // index of WRF/WDG that loads the scenario file
char *pName; // title for the level
searchPathMode dataDir; // title for the level
char *apDataFiles[LEVEL_MAXFILES]; // the WRF/WDG files for the level
// in load order
LEVEL_DATASET *psBaseData; // LEVEL_DATASET that must be loaded for this level to load
LEVEL_DATASET *psChange; // LEVEL_DATASET used when changing to this level from another
LEVEL_DATASET *psNext;
char * realFileName; ///< Filename of the file containing the level, or NULL if the level is built in.
Sha256 realFileHash; ///< Use levGetFileHash() to read this value. SHA-256 hash of the file containing the level, or 0x00×32 if the level is built in or not yet calculated.
};
// the current level descriptions
extern LEVEL_DATASET *psLevels;
// parse a level description data file
bool levParse(const char* buffer, size_t size, searchPathMode datadir, bool ignoreWrf, char const *realFileName);
// shutdown the level system
extern void levShutDown(void);
extern bool levInitialise(void);
// load up the data for a level
bool levLoadData(char const *name, Sha256 const *hash, char *pSaveName, GAME_TYPE saveType);
// find the level dataset
LEVEL_DATASET *levFindDataSet(char const *name, Sha256 const *hash = NULL);
Sha256 levGetFileHash(LEVEL_DATASET *level);
Sha256 levGetMapNameHash(char const *name);
// free the currently loaded dataset
extern bool levReleaseAll(void);
// free the data for the current mission
extern bool levReleaseMissionData(void);
//get the type of level currently being loaded of GTYPE type
extern SDWORD getLevelLoadType(void);
extern char *getLevelName( void );
extern void levTest(void);
#endif // __INCLUDED_SRC_LEVELS_H__