|
| 1 | +// Common Start-up Window |
| 2 | +// for the Build Engine |
| 3 | + |
| 4 | +// This file has been modified from Ken Silverman's original release |
| 5 | +// by Jonathon Fowler ([email protected]) |
| 6 | + |
| 7 | +#ifndef __startwin_h__ |
| 8 | +#define __startwin_h__ |
| 9 | + |
| 10 | +struct startwin_settings { |
| 11 | + struct { |
| 12 | + // Enable 3D mode options. |
| 13 | + unsigned video:1; |
| 14 | + |
| 15 | + // Enable 2D mode options. |
| 16 | + unsigned editor:1; |
| 17 | + |
| 18 | + // Enable sound quality options. |
| 19 | + unsigned audio:1; |
| 20 | + |
| 21 | + // Enable mouse and controller options. |
| 22 | + unsigned input:1; |
| 23 | + |
| 24 | + // Enable multiplayer options. |
| 25 | + unsigned network:1; |
| 26 | + |
| 27 | + // Enable game data management. |
| 28 | + unsigned game:1; |
| 29 | + } features; |
| 30 | + |
| 31 | + struct { |
| 32 | + int fullscreen; |
| 33 | + int display; |
| 34 | + int xdim; |
| 35 | + int ydim; |
| 36 | + int bpp; |
| 37 | + } video; |
| 38 | + |
| 39 | + struct { |
| 40 | + int xdim; |
| 41 | + int ydim; |
| 42 | + } editor; |
| 43 | + |
| 44 | + struct { |
| 45 | + int samplerate; |
| 46 | + int channels; |
| 47 | + int bitspersample; |
| 48 | + } audio; |
| 49 | + |
| 50 | + struct { |
| 51 | + int mouse; |
| 52 | + int controller; |
| 53 | + } input; |
| 54 | + |
| 55 | + struct { |
| 56 | + int numplayers; |
| 57 | + char *joinhost; |
| 58 | + int netoverride; |
| 59 | + } network; |
| 60 | + |
| 61 | + struct { |
| 62 | + // Dataset identifier of the selected game dataset. |
| 63 | + int gamedataid; |
| 64 | + |
| 65 | + // A null-pointer-terminated list of wildcards encompassing all the filespec files. |
| 66 | + const char **gamedatafilepatterns; |
| 67 | + |
| 68 | + // Specifications of game data sets. |
| 69 | + const struct startwin_dataset *gamedata; |
| 70 | + |
| 71 | + // URL where freely-distributable game data files can be downloaded, or NULL. |
| 72 | + const char *demourl; |
| 73 | + |
| 74 | + // Advisory text indicating where full-version data can be obtained. |
| 75 | + const char *moreinfobrief; |
| 76 | + const char *moreinfodetail; |
| 77 | + } game; |
| 78 | + |
| 79 | + int alwaysshow; |
| 80 | +}; |
| 81 | + |
| 82 | +enum { |
| 83 | + STARTWIN_CANCEL = 0, |
| 84 | + STARTWIN_RUN = 1, |
| 85 | +}; |
| 86 | + |
| 87 | +enum { |
| 88 | + STARTWIN_DATASET_UNIDENTIFIED = 0, |
| 89 | + STARTWIN_DATASET_EXTRA0 = 0x10000, // The first ID of extra GRP files being returned as extra datasets. |
| 90 | +}; |
| 91 | + |
| 92 | +enum { |
| 93 | + STARTWIN_PRESENCE_OPTIONAL = 0, // The file is optional. |
| 94 | + STARTWIN_PRESENCE_REQUIRED = 1, // The file is required for a dataset to be complete. |
| 95 | + STARTWIN_PRESENCE_GROUP = 2, // The file is a required GRP file for passing to cache1d. |
| 96 | + STARTWIN_PRESENCE_EXCEPT = 3, // The file cannot exist for a dataset to be complete. |
| 97 | +}; |
| 98 | + |
| 99 | +// Dataset specification ------------------------ |
| 100 | +struct startwin_dataset { |
| 101 | + const char *name; // Human name. |
| 102 | + int id; // Dataset identifier. |
| 103 | + int type; // Dataset type, meaning defined by the game, or STARTWIN_DATASET_UNIDENTIFIED. |
| 104 | + const struct startwin_datasetfilespec *filespec; // Terminate with a NULL 'file'. |
| 105 | +}; |
| 106 | + |
| 107 | +struct startwin_datasetfilespec { |
| 108 | + const char *name; // If presence is OPTIONAL or EXCEPT, can be a wildcard. Otherwise the size and crc members are necessary. |
| 109 | + const char *storename; // An alternative unique filename for importing into where 'name' would conflict with other datasets. |
| 110 | + size_t size; |
| 111 | + unsigned crc; |
| 112 | + unsigned presence:2; // See STARTWIN_PRESENCE_xxx values. Must be OPTIONAL if 'alternate' is 1. |
| 113 | + unsigned alternate:1; // If 1 this entry is an alternate version of a non-alternate entry following it (with a 0 here). |
| 114 | +}; |
| 115 | + |
| 116 | +extern struct startwin_settings startwin_settings; // Declared in the game and populated according to needs. |
| 117 | + |
| 118 | +// Dataset discovery ---------------------------- |
| 119 | +struct startwin_datasetfoundfile { |
| 120 | + const struct startwin_datasetfilespec *filespec; // The dataset filespec the file matches to. |
| 121 | + const char *name; // The filename as it exists on-disk. |
| 122 | +}; |
| 123 | +struct startwin_datasetfound { |
| 124 | + struct startwin_datasetfound *next; |
| 125 | + const struct startwin_dataset *dataset; |
| 126 | + unsigned complete:1; |
| 127 | + int numfiles; // Count of items in the files member. |
| 128 | + struct startwin_datasetfoundfile files[]; // All the presence-required files that were matched. |
| 129 | +}; |
| 130 | + |
| 131 | +int startwin_run(void); |
| 132 | + |
| 133 | +const struct startwin_datasetfound * startwin_scan_gamedata(void); |
| 134 | +void startwin_free_gamedata(void); |
| 135 | + |
| 136 | +const struct startwin_datasetfound * startwin_find_id(int id); |
| 137 | +const struct startwin_datasetfound * startwin_find_type(int type); |
| 138 | +const struct startwin_datasetfound * startwin_find_filename(const char *filename); |
| 139 | +const struct startwin_datasetfoundfile * startwin_find_id_group(int id); |
| 140 | +const struct startwin_datasetfoundfile * startwin_find_type_group(int type); |
| 141 | +const struct startwin_datasetfoundfile * startwin_find_dataset_group(const struct startwin_datasetfound *dataset); |
| 142 | + |
| 143 | +#endif // __startwin_h__ |
0 commit comments