Enable global structs for mine saving functions
[btb/d2x.git] / main / mission.h
1 /* $Id: mission.h,v 1.24 2004-12-17 14:28:41 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Header for mission.h
18  *
19  */
20
21 #ifndef _MISSION_H
22 #define _MISSION_H
23
24 #include "pstypes.h"
25
26 #define MAX_MISSIONS                    300
27 #define MAX_LEVELS_PER_MISSION          30
28 #define MAX_SECRET_LEVELS_PER_MISSION   6
29 #define MISSION_NAME_LEN                25
30
31 #define D1_MISSION_FILENAME             "descent"
32 #define D1_MISSION_NAME                 "Descent: First Strike"
33 #define D1_MISSION_HOGSIZE              6856701 // v1.4 - 1.5
34 #define D1_10_MISSION_HOGSIZE           7261423 // v1.0
35 #define D1_MAC_MISSION_HOGSIZE          7456179
36 #define D1_OEM_MISSION_NAME             "Destination Saturn"
37 #define D1_OEM_MISSION_HOGSIZE          4492107 // v1.4a
38 #define D1_OEM_10_MISSION_HOGSIZE       4494862 // v1.0
39 #define D1_SHAREWARE_MISSION_NAME       "Descent Demo"
40 #define D1_SHAREWARE_MISSION_HOGSIZE    2339773 // v1.4
41 #define D1_SHAREWARE_10_MISSION_HOGSIZE 2365676 // v1.0 - 1.2
42 #define D1_MAC_SHARE_MISSION_HOGSIZE    3370339
43
44 #define SHAREWARE_MISSION_FILENAME  "d2demo"
45 #define SHAREWARE_MISSION_NAME      "Descent 2 Demo"
46 #define SHAREWARE_MISSION_HOGSIZE   2292566 // v1.0 (d2demo.hog)
47 #define MAC_SHARE_MISSION_HOGSIZE   4292746
48
49 #define OEM_MISSION_FILENAME        "d2"
50 #define OEM_MISSION_NAME            "D2 Destination:Quartzon"
51 #define OEM_MISSION_HOGSIZE         6132957 // v1.1
52
53 #define FULL_MISSION_FILENAME       "d2"
54 #define FULL_MISSION_HOGSIZE        7595079 // v1.1 - 1.2
55 #define FULL_10_MISSION_HOGSIZE     7107354 // v1.0
56 #define MAC_FULL_MISSION_HOGSIZE    7110007 // v1.1 - 1.2
57
58 //where the missions go
59 #if 1 // ndef EDITOR
60 #define MISSION_DIR "missions/"
61 #else
62 #define MISSION_DIR "./"
63 #endif
64
65 typedef struct {
66         char    *filename;          // filename
67         int     builtin_hogsize;    // the size of the hogfile for a builtin mission, and 0 for an add-on mission
68         char    mission_name[MISSION_NAME_LEN+1];
69         ubyte   descent_version;        // descent 1 or descent 2?
70         ubyte   anarchy_only_flag;  // if true, mission is only for anarchy
71         ubyte   enhanced;       // 0: mission has "name", 1:"xname", 2:"zname"
72         char    briefing_text_filename[FILENAME_LEN]; // name of briefing file
73         char    ending_text_filename[FILENAME_LEN]; // name of ending file
74         ubyte   last_level;
75         sbyte   last_secret_level;
76         ubyte   n_secret_levels;
77         ubyte   secret_level_table[MAX_SECRET_LEVELS_PER_MISSION]; // originating level no for each secret level 
78         // arrays of names of the level files
79         char    level_names[MAX_LEVELS_PER_MISSION][FILENAME_LEN];
80         char    secret_level_names[MAX_SECRET_LEVELS_PER_MISSION][FILENAME_LEN];
81 #if 0 //def EDITOR      Support for multiple levels, briefings etc open at once
82         Window  window;
83         Window  attributes;// Window for changing them
84         void    *briefing;
85         void    *ending;
86         Level   *level[MAX_LEVELS_PER_MISSION];
87         Level   *secLevel[MAX_SECRET_LEVELS_PER_MISSION];
88         void    *others[MAX_HOGFILES];
89         char    Other_file_names[MAX_HOGFILES][FILENAME_LEN];
90 #endif
91 } Mission;
92
93 extern Mission *Current_mission; // current mission
94
95 #define Current_mission_longname        Current_mission->mission_name
96 #define Current_mission_filename        Current_mission->filename
97 #define Briefing_text_filename          Current_mission->briefing_text_filename
98 #define Ending_text_filename            Current_mission->ending_text_filename
99 #define Last_level                      Current_mission->last_level
100 #define Last_secret_level               Current_mission->last_secret_level
101 #define N_secret_levels                 Current_mission->n_secret_levels
102 #define Secret_level_table              Current_mission->secret_level_table
103 #define Level_names                     Current_mission->level_names
104 #define Secret_level_names              Current_mission->secret_level_names
105
106 #define is_SHAREWARE (Current_mission->builtin_hogsize == SHAREWARE_MISSION_HOGSIZE)
107 #define is_MAC_SHARE (Current_mission->builtin_hogsize == MAC_SHARE_MISSION_HOGSIZE)
108 #define is_D2_OEM (Current_mission->builtin_hogsize == OEM_MISSION_HOGSIZE)
109
110 #define PLAYING_BUILTIN_MISSION (Current_mission->builtin_hogsize != 0)
111 #define EMULATING_D1            (Current_mission->descent_version == 1)
112 #define ANARCHY_ONLY_MISSION    (Current_mission->anarchy_only_flag == 1)
113
114 //loads the named mission if it exists.
115 //Returns true if mission loaded ok, else false.
116 int load_mission_by_name (char *mission_name);
117
118 //Handles creating and selecting from the mission list.
119 //Returns 1 if a mission was loaded.
120 int select_mission (int anarchy_mode, char *message);
121
122 #endif