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 "cJSON.h" 23 #include "opentyr.h" 24 25 #include <stdio.h> 26 #include "SDL.h" 27 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 typedef SDLKey JE_KeySettingType[8]; /* [1..8] */ 41 typedef JE_byte JE_PItemsType[12]; /* [1..12] */ 42 43 typedef JE_byte JE_EditorItemAvailType[100]; /* [1..100] */ 44 45 typedef struct 46 { 47 JE_word encode; 48 JE_word level; 49 JE_PItemsType items; 50 JE_longint score; 51 JE_longint score2; 52 char levelName[11]; /* string [9]; */ /* SYN: Added one more byte to match lastLevelName below */ 53 JE_char name[15]; /* [1..14] */ /* SYN: Added extra byte for null */ 54 JE_byte cubes; 55 JE_byte power[2]; /* [1..2] */ 56 JE_byte episode; 57 JE_PItemsType lastItems; 58 JE_byte difficulty; 59 JE_byte secretHint; 60 JE_byte input1; 61 JE_byte input2; 62 JE_boolean gameHasRepeated; /*See if you went from one episode to another*/ 63 JE_byte initialDifficulty; 64 65 /* High Scores - Each episode has both sets of 1&2 player selections - with 3 in each */ 66 JE_longint highScore1, 67 highScore2; 68 char highScoreName[30]; /* string [29] */ 69 JE_byte highScoreDiff; 70 } JE_SaveFileType; 71 72 typedef JE_SaveFileType JE_SaveFilesType[SAVE_FILES_NUM]; /* [1..savefilesnum] */ 73 typedef JE_byte JE_SaveGameTemp[SAVE_FILES_SIZE + 4 + 100]; /* [1..sizeof(savefilestype) + 4 + 100] */ 74 75 extern const JE_byte cryptKey[10]; 76 extern const JE_KeySettingType defaultKeySettings; 77 extern const char defaultHighScoreNames[34][23]; 78 extern const char defaultTeamNames[22][25]; 79 extern const JE_EditorItemAvailType initialItemAvail; 80 extern JE_boolean smoothies[9]; 81 extern JE_byte starShowVGASpecialCode; 82 extern JE_word lastCubeMax, cubeMax; 83 extern JE_word cubeList[4]; 84 extern JE_boolean gameHasRepeated; 85 extern JE_shortint difficultyLevel, oldDifficultyLevel, initialDifficulty; 86 extern uint power, lastPower, powerAdd; 87 extern JE_byte shieldWait, shieldT; 88 89 enum 90 { 91 SHOT_FRONT, 92 SHOT_REAR, 93 SHOT_LEFT_SIDEKICK, 94 SHOT_RIGHT_SIDEKICK, 95 SHOT_MISC, 96 SHOT_P2_CHARGE, 97 SHOT_P1_SUPERBOMB, 98 SHOT_P2_SUPERBOMB, 99 SHOT_SPECIAL, 100 SHOT_NORTSPARKS, 101 SHOT_SPECIAL2 102 }; 103 104 extern JE_byte shotRepeat[11], shotMultiPos[11]; 105 extern JE_boolean portConfigChange, portConfigDone; 106 extern char lastLevelName[11], levelName[11]; 107 extern JE_byte mainLevel, nextLevel, saveLevel; 108 extern JE_KeySettingType keySettings; 109 extern JE_shortint levelFilter, levelFilterNew, levelBrightness, levelBrightnessChg; 110 extern JE_boolean filtrationAvail, filterActive, filterFade, filterFadeStart; 111 extern JE_boolean gameJustLoaded; 112 extern JE_boolean galagaMode; 113 extern JE_boolean extraGame; 114 extern JE_boolean twoPlayerMode, twoPlayerLinked, onePlayerAction, superTyrian, trentWin; 115 extern JE_byte superArcadeMode; 116 extern JE_byte superArcadePowerUp; 117 extern JE_real linkGunDirec; 118 extern JE_byte inputDevice[2]; 119 extern JE_byte secretHint; 120 extern JE_byte background3over; 121 extern JE_byte background2over; 122 extern JE_byte gammaCorrection; 123 extern JE_boolean superPause, explosionTransparent, youAreCheating, displayScore, background2, smoothScroll, wild, superWild, starActive, topEnemyOver, skyEnemyOverAll, background2notTransparent; 124 extern JE_byte versionNum; 125 extern JE_byte fastPlay; 126 extern JE_boolean pentiumMode; 127 extern JE_byte gameSpeed; 128 extern JE_byte processorType; 129 extern JE_SaveFilesType saveFiles; 130 extern JE_SaveGameTemp saveTemp; 131 extern JE_word editorLevel; 132 133 void JE_initProcessorType( void ); 134 void JE_setNewGameSpeed( void ); 135 const char *get_user_directory( void ); 136 void JE_loadConfiguration( void ); 137 void JE_saveConfiguration( void ); 138 139 void JE_saveGame( JE_byte slot, const char *name ); 140 void JE_loadGame( JE_byte slot ); 141 142 void JE_encryptSaveTemp( void ); 143 void JE_decryptSaveTemp( void ); 144 145 cJSON *load_json( const char *filename ); 146 void save_json( cJSON *root, const char *filename ); 147 148 #endif /* CONFIG_H */ 149 150