aboutsummaryrefslogtreecommitdiff
path: root/sword1/control.h
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-20 09:18:43 +0000
committerRobert Göffringmann2003-12-20 09:18:43 +0000
commitda3eed35b5817303170e42c21132b29f20183d71 (patch)
tree0f63de7ec5119465c856dfd9751bba5d8508048c /sword1/control.h
parent59654b17191b99c23486f6a41076b9ed05a1c38f (diff)
downloadscummvm-rg350-da3eed35b5817303170e42c21132b29f20183d71.tar.gz
scummvm-rg350-da3eed35b5817303170e42c21132b29f20183d71.tar.bz2
scummvm-rg350-da3eed35b5817303170e42c21132b29f20183d71.zip
forgot these. :)
svn-id: r11776
Diffstat (limited to 'sword1/control.h')
-rw-r--r--sword1/control.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/sword1/control.h b/sword1/control.h
new file mode 100644
index 0000000000..4b0a1699b7
--- /dev/null
+++ b/sword1/control.h
@@ -0,0 +1,125 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef BSCONTROL_H
+#define BSCONTROL_H
+
+#include "scummsys.h"
+#include "sworddefs.h"
+
+class ObjectMan;
+class ResMan;
+class OSystem;
+class SwordMouse;
+class SwordEngine;
+
+#define MAX_BUTTONS 16
+
+#define CONTROL_NOTHING_DONE 0
+#define CONTROL_GAME_RESTORED 1
+#define CONTROL_RESTART_GAME 2
+
+class ControlButton {
+public:
+ ControlButton(uint16 x, uint16 y, uint32 resId, uint8 id, ResMan *pResMan, uint8 *screenBuf, OSystem *system);
+ ~ControlButton(void);
+ void draw(void);
+ bool wasClicked(uint16 mouseX, uint16 mouseY);
+ void setSelected(uint8 selected);
+ bool isSaveslot(void);
+ uint8 _id;
+private:
+ int _frameIdx;
+ uint16 _x, _y;
+ uint16 _width, _height;
+ uint32 _resId;
+ ResMan *_resMan;
+ uint8 *_dstBuf;
+ OSystem *_system;
+};
+
+struct ButtonInfo {
+ uint16 x, y;
+ uint32 resId, id;
+};
+
+class SwordControl {
+public:
+ SwordControl(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, SwordMouse *pMouse, const char *savePath);
+ ~SwordControl(void);
+ uint8 runPanel(void);
+ void doRestore(void);
+private:
+ void initData(void);
+ void closeData(void);
+
+ void saveGameToFile(uint8 slot);
+ void restoreGameFromFile(uint8 slot);
+ void readSavegameDescriptions(void);
+ void writeSavegameDescriptions(void);
+ void showSavegameNames(void);
+ void deselectSaveslots(void);
+ uint8 *_restoreBuf;
+ uint8 _saveFiles;
+ uint8 _saveScrollPos;
+ uint8 _selectedSavegame;
+ char _saveNames[64][32];
+ char _oldName[32];
+
+ uint8 getClicks(uint8 mode, uint8 *retVal);
+ uint8 handleButtonClick(uint8 id, uint8 mode, uint8 *retVal);
+
+ void setupMainPanel(void);
+ void setupSaveRestorePanel(bool saving);
+ void saveNameScroll(uint8 scroll, bool saving);
+ void saveNameSelect(uint8 id, bool saving);
+ bool saveToFile(void);
+ bool restoreFromFile(void);
+ bool keyAccepted(uint8 key);
+ void handleSaveKey(uint8 key);
+
+ uint16 getTextWidth(const char *str);
+ void renderText(const char *str, int16 x, uint16 y);
+ uint8 _numButtons;
+ uint8 _selectedButton;
+ void createButtons(const ButtonInfo *buttons, uint8 num);
+ void destroyButtons(void);
+ ControlButton *_buttons[MAX_BUTTONS];
+ static const ButtonInfo _deathButtons[3], _panelButtons[8], _saveButtons[16];
+ static const char _languageStrings[8 * 20][43];
+ const char (*_lStrings)[43];
+ ObjectMan *_objMan;
+ ResMan *_resMan;
+ OSystem *_system;
+ SwordMouse *_mouse;
+ SwordEngine *_engine;
+ char _savePath[256];
+ uint8 *_font;
+ uint32 _fontId;
+ uint8 *_screenBuf;
+ uint8 _keyPressed;
+ void delay(uint32 msecs);
+ uint16 _mouseX, _mouseY, _mouseState;
+};
+
+
+#endif //BSCONTROL_H
+