| 1 | /* |
| 2 | * OpenTyrian: A modern cross-platform port of Tyrian |
| 3 | * Copyright (C) 2007-2009 The OpenTyrian Development Team |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | #ifndef CONFIG_H |
| 20 | #define CONFIG_H |
| 21 | |
| 22 | #include "opentyr.h" |
| 23 | #include "config_file.h" |
| 24 | |
| 25 | #include "SDL.h" |
| 26 | |
| 27 | #include <stdio.h> |
| 28 | |
| 29 | #define SAVE_FILES_NUM (11 * 2) |
| 30 | |
| 31 | /* These are necessary because the size of the structure has changed from the original, but we |
| 32 | need to know the original sizes in order to find things in TYRIAN.SAV */ |
| 33 | #define SAVE_FILES_SIZE 2398 |
| 34 | #define SIZEOF_SAVEGAMETEMP SAVE_FILES_SIZE + 4 + 100 |
| 35 | #define SAVE_FILE_SIZE (SIZEOF_SAVEGAMETEMP - 4) |
| 36 | |
| 37 | /*#define SAVE_FILES_SIZE (2502 - 4) |
| 38 | #define SAVE_FILE_SIZE (SAVE_FILES_SIZE)*/ |
| 39 | |
| 40 | enum |
| 41 | { |
| 42 | DIFFICULTY_WIMP = 0, |
| 43 | DIFFICULTY_EASY, |
| 44 | DIFFICULTY_NORMAL, |
| 45 | DIFFICULTY_HARD, |
| 46 | DIFFICULTY_IMPOSSIBLE, |
| 47 | DIFFICULTY_INSANITY, |
| 48 | DIFFICULTY_SUICIDE, |
| 49 | DIFFICULTY_MANIACAL, |
| 50 | DIFFICULTY_ZINGLON, // aka Lord of the Game |
| 51 | DIFFICULTY_NORTANEOUS, |
| 52 | DIFFICULTY_10, |
| 53 | }; |
| 54 | |
| 55 | // NOTE: Do not reorder. This ordering corresponds to the keyboard |
| 56 | // configuration menu and to the bits stored in demo files. |
| 57 | enum |
| 58 | { |
| 59 | KEY_SETTING_UP, |
| 60 | KEY_SETTING_DOWN, |
| 61 | KEY_SETTING_LEFT, |
| 62 | KEY_SETTING_RIGHT, |
| 63 | KEY_SETTING_FIRE, |
| 64 | KEY_SETTING_CHANGE_FIRE, |
| 65 | KEY_SETTING_LEFT_SIDEKICK, |
| 66 | KEY_SETTING_RIGHT_SIDEKICK, |
| 67 | }; |
| 68 | |
| 69 | typedef JE_byte DosKeySettings[8]; // fka KeySettingType |
| 70 | |
| 71 | typedef SDL_Scancode KeySettings[8]; |
| 72 | |
| 73 | typedef JE_byte JE_PItemsType[12]; /* [1..12] */ |
| 74 | |
| 75 | typedef JE_byte JE_EditorItemAvailType[100]; /* [1..100] */ |
| 76 | |
| 77 | typedef struct |
| 78 | { |
| 79 | JE_word encode; |
| 80 | JE_word level; |
| 81 | JE_PItemsType items; |
| 82 | JE_longint score; |
| 83 | JE_longint score2; |
| 84 | char levelName[11]; /* string [9]; */ /* SYN: Added one more byte to match lastLevelName below */ |
| 85 | JE_char name[15]; /* [1..14] */ /* SYN: Added extra byte for null */ |
| 86 | JE_byte cubes; |
| 87 | JE_byte power[2]; /* [1..2] */ |
| 88 | JE_byte episode; |
| 89 | JE_PItemsType lastItems; |
| 90 | JE_byte difficulty; |
| 91 | JE_byte secretHint; |
| 92 | JE_byte input1; |
| 93 | JE_byte input2; |
| 94 | JE_boolean gameHasRepeated; /*See if you went from one episode to another*/ |
| 95 | JE_byte initialDifficulty; |
| 96 | |
| 97 | /* High Scores - Each episode has both sets of 1&2 player selections - with 3 in each */ |
| 98 | JE_longint highScore1; |
| 99 | JE_longint highScore2; // unused |
| 100 | char highScoreName[30]; /* string [29] */ |
| 101 | JE_byte highScoreDiff; |
| 102 | } JE_SaveFileType; |
| 103 | |
| 104 | typedef JE_SaveFileType JE_SaveFilesType[SAVE_FILES_NUM]; /* [1..savefilesnum] */ |
| 105 | typedef JE_byte JE_SaveGameTemp[SAVE_FILES_SIZE + 4 + 100]; /* [1..sizeof(savefilestype) + 4 + 100] */ |
| 106 | |
| 107 | extern const JE_byte cryptKey[10]; |
| 108 | extern const DosKeySettings defaultDosKeySettings; // fka defaultKeySettings |
| 109 | extern const KeySettings defaultKeySettings; |
| 110 | extern const char defaultHighScoreNames[34][23]; |
| 111 | extern const char defaultTeamNames[22][25]; |
| 112 | extern const JE_EditorItemAvailType initialItemAvail; |
| 113 | extern JE_boolean smoothies[9]; |
| 114 | extern JE_byte starShowVGASpecialCode; |
| 115 | extern JE_word lastCubeMax, cubeMax; |
| 116 | extern JE_word cubeList[4]; |
| 117 | extern JE_boolean gameHasRepeated; |
| 118 | extern JE_shortint difficultyLevel, oldDifficultyLevel, initialDifficulty; |
| 119 | extern uint power, lastPower, powerAdd; |
| 120 | extern JE_byte shieldWait, shieldT; |
| 121 | |
| 122 | enum |
| 123 | { |
| 124 | SHOT_FRONT, |
| 125 | SHOT_REAR, |
| 126 | SHOT_LEFT_SIDEKICK, |
| 127 | SHOT_RIGHT_SIDEKICK, |
| 128 | SHOT_MISC, |
| 129 | SHOT_P2_CHARGE, |
| 130 | SHOT_P1_SUPERBOMB, |
| 131 | SHOT_P2_SUPERBOMB, |
| 132 | SHOT_SPECIAL, |
| 133 | SHOT_NORTSPARKS, |
| 134 | SHOT_SPECIAL2 |
| 135 | }; |
| 136 | |
| 137 | extern JE_byte shotRepeat[11], shotMultiPos[11]; |
| 138 | extern JE_boolean portConfigChange, portConfigDone; |
| 139 | extern char lastLevelName[11], levelName[11]; |
| 140 | extern JE_byte mainLevel, nextLevel, saveLevel; |
| 141 | extern DosKeySettings dosKeySettings; // fka keySettings |
| 142 | extern KeySettings keySettings; |
| 143 | extern JE_shortint levelFilter, levelFilterNew, levelBrightness, levelBrightnessChg; |
| 144 | extern JE_boolean filtrationAvail, filterActive, filterFade, filterFadeStart; |
| 145 | extern JE_boolean gameJustLoaded; |
| 146 | extern JE_boolean galagaMode; |
| 147 | extern JE_boolean extraGame; |
| 148 | extern JE_boolean twoPlayerMode, twoPlayerLinked, onePlayerAction, superTyrian, trentWin; |
| 149 | extern JE_byte superArcadeMode; |
| 150 | extern JE_byte superArcadePowerUp; |
| 151 | extern JE_real linkGunDirec; |
| 152 | extern JE_byte inputDevice[2]; |
| 153 | extern JE_byte secretHint; |
| 154 | extern JE_byte background3over; |
| 155 | extern JE_byte background2over; |
| 156 | extern JE_byte gammaCorrection; |
| 157 | extern JE_boolean superPause, explosionTransparent, youAreCheating, displayScore, background2, smoothScroll, wild, superWild, starActive, topEnemyOver, skyEnemyOverAll, background2notTransparent; |
| 158 | extern JE_byte versionNum; |
| 159 | extern JE_byte fastPlay; |
| 160 | extern JE_boolean pentiumMode; |
| 161 | extern JE_byte gameSpeed; |
| 162 | extern JE_byte processorType; |
| 163 | extern JE_SaveFilesType saveFiles; |
| 164 | extern JE_SaveGameTemp saveTemp; |
| 165 | extern JE_word editorLevel; |
| 166 | |
| 167 | extern Config opentyrian_config; |
| 168 | |
| 169 | void JE_initProcessorType(void); |
| 170 | void JE_setNewGameSpeed(void); |
| 171 | const char *get_user_directory(void); |
| 172 | void JE_loadConfiguration(void); |
| 173 | void JE_saveConfiguration(void); |
| 174 | |
| 175 | void JE_saveGame(JE_byte slot, const char *name); |
| 176 | void JE_loadGame(JE_byte slot); |
| 177 | |
| 178 | void JE_encryptSaveTemp(void); |
| 179 | void JE_decryptSaveTemp(void); |
| 180 | |
| 181 | #endif /* CONFIG_H */ |