ScummVM API documentation
preagi.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGI_PREAGI_PREAGI_H
23 #define AGI_PREAGI_PREAGI_H
24 
25 #include "agi/agi.h"
26 
27 namespace Audio {
28 class PCSpeaker;
29 }
30 
31 namespace Agi {
32 
33 // default attributes
34 #define IDA_DEFAULT 0x0F
35 #define IDA_DEFAULT_REV 0xF0
36 
37 #define IDI_SND_OSCILLATOR_FREQUENCY 1193180
38 #define IDI_SND_TIMER_RESOLUTION 0.0182
39 
40 #define kColorDefault 0x1337
41 
42 #define IDI_MAX_ROW_PIC 20
43 
44 enum SelectionTypes {
45  kSelYesNo,
46  kSelNumber,
47  kSelSpace,
48  kSelAnyKey,
49  kSelBackspace
50 };
51 
52 // Options for controlling behavior during waits and sound playback
53 enum WaitOptions {
54  kWaitBlock = 0x00, // no event processing, cannot be interrupted
55  kWaitProcessEvents = 0x01, // process events, stops on quit
56  kWaitAllowInterrupt = 0x03 // process events, stops on input or quit
57 };
58 
59 class PreAgiEngine : public AgiBase {
60  int _gameId;
61 
62 protected:
63  void initialize() override;
64 
65  int getKeypress() override { return 0; }
66  bool isKeypress() override { return false; }
67  void clearKeyQueue() override {}
68 
69  PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
70  ~PreAgiEngine() override;
71  int getGameId() const { return _gameId; }
72 
73  void clearImageStack() override {}
74  void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
75  int16 p4, int16 p5, int16 p6, int16 p7) override {}
76  void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
77  int16 p4, int16 p5, int16 p6, int16 p7) override {}
78  void releaseImageStack() override {}
79  int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; }
80  int loadGame(const Common::String &fileName, bool checkId = true) { return -1; }
81 
82  // Game
83  Common::String getTargetName() const { return _targetName; }
84 
85  // Screen
86  void clearScreen(int attr, bool overrideDefault = true);
87  void clearGfxScreen(int attr);
88  void setDefaultTextColor(int attr) { _defaultColor = attr; }
89  byte getWhite() const;
90 
91  // Keyboard
92  int getSelection(SelectionTypes type);
93 
94  // Random number between 1 and max. Example: rnd(2) returns 1 or 2.
95  int rnd(int max);
96 
97  // Text
98  void drawStr(int row, int col, int attr, const char *buffer);
99  void clearTextArea();
100  void clearRow(int row);
101  static void XOR80(char *buffer);
102  void printStr(const char *szMsg);
103  void printStrXOR(char *szMsg);
104 
105  // Saved Games
106  Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
107 
108  bool playSpeakerNote(int16 frequency, int32 length, WaitOptions options);
109  bool wait(uint32 delay, WaitOptions options = kWaitProcessEvents);
110 
111 private:
112  int _defaultColor;
113 
114  Audio::PCSpeaker *_speaker;
115 };
116 
117 } // End of namespace Agi
118 
119 
120 #endif
Definition: str.h:59
Definition: agi.h:574
Definition: preagi.h:59
Definition: savefile.h:142
Definition: system.h:163
Definition: detection.h:29
Definition: agi.h:64
Definition: pcspk.h:34
Definition: system.h:38