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 SoundHandle;
29 class PCSpeaker;
30 }
31 
32 namespace Agi {
33 
34 // default attributes
35 #define IDA_DEFAULT 0x0F
36 #define IDA_DEFAULT_REV 0xF0
37 
38 #define IDI_SND_OSCILLATOR_FREQUENCY 1193180
39 #define IDI_SND_TIMER_RESOLUTION 0.0182
40 
41 #define kColorDefault 0x1337
42 
43 #define IDI_MAX_ROW_PIC 20
44 
45 enum SelectionTypes {
46  kSelYesNo,
47  kSelNumber,
48  kSelSpace,
49  kSelAnyKey,
50  kSelBackspace
51 };
52 
53 // Options for controlling behavior during waits and sound playback
54 enum WaitOptions {
55  kWaitBlock = 0x00, // no event processing, cannot be interrupted
56  kWaitProcessEvents = 0x01, // process events, stops on quit
57  kWaitAllowInterrupt = 0x03 // process events, stops on input or quit
58 };
59 
60 class PreAgiEngine : public AgiBase {
61  int _gameId;
62 
63 protected:
64  void initialize() override;
65 
66  int getKeypress() override { return 0; }
67  bool isKeypress() override { return false; }
68  void clearKeyQueue() override {}
69 
70  PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
71  ~PreAgiEngine() override;
72  int getGameId() const { return _gameId; }
73 
74  PictureMgr *_picture;
75 
76  void clearImageStack() override {}
77  void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
78  int16 p4, int16 p5, int16 p6, int16 p7) override {}
79  void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
80  int16 p4, int16 p5, int16 p6, int16 p7) override {}
81  void releaseImageStack() override {}
82  int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; }
83  int loadGame(const Common::String &fileName, bool checkId = true) { return -1; }
84 
85  // Game
86  Common::String getTargetName() const { return _targetName; }
87 
88  // Screen
89  void clearScreen(int attr, bool overrideDefault = true);
90  void clearGfxScreen(int attr);
91  void setDefaultTextColor(int attr) { _defaultColor = attr; }
92  byte getWhite() const;
93 
94  // Keyboard
95  int getSelection(SelectionTypes type);
96 
97  // Random number between 1 and max. Example: rnd(2) returns 1 or 2.
98  int rnd(int max);
99 
100  // Text
101  void drawStr(int row, int col, int attr, const char *buffer);
102  void clearTextArea();
103  void clearRow(int row);
104  static void XOR80(char *buffer);
105  void printStr(const char *szMsg);
106  void printStrXOR(char *szMsg);
107 
108  // Saved Games
109  Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
110 
111  bool playSpeakerNote(int16 frequency, int32 length, WaitOptions options);
112  bool wait(uint32 delay, WaitOptions options = kWaitProcessEvents);
113 
114 private:
115  int _defaultColor;
116 
117  Audio::PCSpeaker *_speakerStream;
118  Audio::SoundHandle *_speakerHandle;
119 };
120 
121 } // End of namespace Agi
122 
123 
124 #endif
Definition: str.h:59
Definition: agi.h:713
Definition: picture.h:62
Definition: mixer.h:49
Definition: preagi.h:60
Definition: savefile.h:142
Definition: system.h:161
Definition: detection.h:29
Definition: agi.h:63
Definition: pcspk.h:31
Definition: system.h:38