22 #ifndef SWORD1_CONTROL_H 23 #define SWORD1_CONTROL_H 25 #include "common/scummsys.h" 26 #include "common/events.h" 27 #include "common/str-array.h" 28 #include "sword1/sworddefs.h" 32 class SaveFileManager;
33 class MemoryWriteStreamDynamic;
78 #define SAVEGAME_HEADER MKTAG('B','S','_','1') 79 #define SAVEGAME_VERSION 2 81 #define FIRSTFONTCHAR ' ' 82 #define LASTFONTCHAR (32 + 137) 88 #define CONTROL_NOTHING_DONE 0 89 #define CONTROL_GAME_RESTORED 1 90 #define CONTROL_RESTART_GAME 2 102 #define SAVEBUTTONS 14 103 #define MAXSAVEGAMES 1000 106 #define TEXTBUTTONID 7 108 #define PSX_CREDITS_SPACING (-3) 109 #define PSX_CREDITS_MIDDLE 450 110 #define PSX_CREDITS_OFFSET 150 111 #define PSX_NUM_CREDITS 14 124 void getPlayerOptions();
125 void askForCdMessage(uint32 needCD,
bool incorrectCDPhase);
127 bool savegamesExist();
128 void saveGameToFile(uint8 slot);
129 bool restoreGameFromFile(uint8 slot);
131 void checkForOldSaveGames();
133 const uint8 *getPauseString();
134 void psxEndCredits();
136 void setSaveDescription(
int slot,
const char *desc) {
137 Common::strcpy_s((
char *)_fileDescriptions[slot],
sizeof(_fileDescriptions[slot]), desc);
141 void saveRestoreScreen();
143 void renderSlab(int32 start, int32 i);
145 void renderText(
const uint8 *str, int32 x, int32 y,
bool useSpeechFont =
false);
146 void renderRedText(
const uint8 *str, int32 x, int32 y);
148 int32 getTextLength(
const uint8 *str,
bool useSpeechFont =
false);
150 void putButton(int32 x, int32 y, int32 index);
151 void putSpriteButton(
Sprite *spr, int32 x, int32 y, int32 index);
152 void putTextButton(int32 index);
153 int32 getCurrentButton(
const Button b[]);
155 void initialiseConfirmation(
const uint8 *title);
156 int32 implementConfirmation();
157 void removeConfirmation();
159 void volUp(int32 i, int32 j);
160 void volDown(int32 i, int32 j);
161 void renderVolumeLight(int32 i);
162 void renderVolumeDisc(int32 i, int32 j);
163 void initialiseVolume();
164 void implementVolume();
167 void renderScrolls();
168 void initialiseSpeed();
169 void implementSpeed();
172 int16 readFileDescriptions();
173 void setEditDescription(int32 line);
174 bool driveSpaceAvailable();
177 void editDescription();
178 void restoreSelected();
179 void uneditDescription();
180 void initialiseSave();
181 void implementSave();
184 void initialiseRestore();
185 void implementRestore();
186 void removeRestore();
188 void initialiseControlPanel();
189 void implementControlPanel();
190 void removeControlPanel();
192 void initialiseResources();
193 void releaseResources();
195 uint8 *decompressPsxGfx(uint8 *src,
FrameHeader *f);
196 void drawPsxComponent(
int componentType, uint8 *src, uint8 *dst,
FrameHeader *f);
198 bool convertSaveGame(uint8 slot,
char *desc);
200 void delay(uint32 msecs);
201 bool gameVersionIsAkella();
202 bool gameVersionIsMediaHouse();
203 bool loadCustomStrings(
const char *filename);
205 int displayMessage(
const char *altButton, MSVC_PRINTF
const char *message, ...)
GCC_PRINTF(3, 4);
208 int32 getCreditsFontHeight(uint8 *font);
209 int32 getCreditsStringLength(uint8 *str, uint8 *font);
210 void renderCreditsTextSprite(uint8 *data, uint8 *dst, int16 x, int16 y, int16 width, int16 height);
211 void createCreditsTextSprite(uint8 *data, int32 pitch, uint8 *str, uint8 *font);
214 static const uint8 _languageStrings[8 * 20][43];
215 static const uint8 _akellaLanguageStrings[20][43];
216 static const uint8 _mediaHouseLanguageStrings[20][43];
217 static const uint8 _polishTranslationLanguageStrings[20][43];
218 uint8 _customStrings[20][43];
219 const uint8(*_lStrings)[43];
220 const uint8 _psxPauseStrings[3][7] = {
"Paused",
"Pause",
"Pausa" };
237 int _oldSnrStatus = SNR_BLANK;
238 bool _newPal =
false;
239 Sprite *_slabs[SAVEBUTTONS - 6];
240 int32 _scrollIndex[2] = { 0, 0 };
241 int32 _speedFlag = 0;
243 int32 _currentButton = 0;
244 int32 _buttonPressed = 0;
245 int32 _buttonHold = 0;
246 int32 _slabSelected = 0;
247 int32 _firstDescription = 0;
248 byte _fileDescriptions[MAXSAVEGAMES][40];
249 int32 _editingDescription = 0;
250 int32 _gamesSaved = 0;
255 int32 _scrollCount = 0;
257 uint8 *_restoreBuf =
nullptr;
258 uint32 _selectedSavegame = 0;
259 uint8 _numButtons = 0;
260 uint8 _selectedButton = 0;
261 bool _panelShown =
false;
263 static const Button panelButtons[8];
266 static const Button deathButtons[8];
267 static const Button confirmButtons[2];
268 static const Button speedButtons[3];
269 static const Button saveButtons[SAVEBUTTONS];
270 static const Button restoreButtons[SAVEBUTTONS];
271 static const Button volumeButtons[25];
Definition: sworddefs.h:141
Definition: memstream.h:194
Definition: atari-screen.h:60
uint32 CustomEventType
Definition: events.h:193
Definition: animation.h:38
int FORCEINLINE GCC_PRINTF(2, 0) int vsprintf_s(T(&dst)[N]
Definition: algorithm.h:29
Definition: objectman.h:33
Definition: keyboard.h:294
Definition: control.h:120
Definition: savefile.h:142
void strcpy_s(char *dst, size_t size, const char *src)