1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GOB_PREGOB_PREGOB_H
#define GOB_PREGOB_PREGOB_H
#include "common/str.h"
#include "common/array.h"
#include "gob/util.h"
#include "gob/aniobject.h"
#include "gob/pregob/txtfile.h"
namespace Gob {
class GobEngine;
class ANIFile;
class Surface;
class SoundDesc;
class GCTFile;
class PreGob {
public:
PreGob(GobEngine *vm);
virtual ~PreGob();
virtual void run() = 0;
struct AnimProperties {
uint16 animation;
uint16 frame;
ANIObject::Mode mode;
bool visible;
bool paused;
bool hasPosition;
int16 x;
int16 y;
};
protected:
typedef Common::Array<ANIObject *> ANIList;
static const char kLanguageSuffixShort[5];
static const char *kLanguageSuffixLong [5];
GobEngine *_vm;
// -- Graphics --
/** Initialize the game screen. */
void initScreen();
void fadeOut(); ///< Fade to black.
void fadeIn(); ///< Fade to the current palette.
void clearScreen();
/** Change the palette.
*
* @param palette The palette to change to.
* @param size Size of the palette in colors.
*/
void setPalette(const byte *palette, uint16 size); ///< Change the palette
/** Add a new cursor that can be manipulated to the stack. */
void addCursor();
/** Remove the top-most cursor from the stack. */
void removeCursor();
/** Set the current cursor. */
void setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY);
/** Set the current cursor. */
void setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom,
int16 hotspotX, int16 hotspotY);
/** Show the cursor. */
void showCursor();
/** Hide the cursor. */
void hideCursor();
/** Is the cursor currently visible? */
bool isCursorVisible() const;
/** Remove an animation from the screen. */
void clearAnim(ANIObject &anim);
/** Draw an animation to the screen, advancing it. */
void drawAnim(ANIObject &anim);
/** Clear and draw an animation to the screen, advancing it. */
void redrawAnim(ANIObject &anim);
/** Remove animations from the screen. */
void clearAnim(const ANIList &anims);
/** Draw animations to the screen, advancing them. */
void drawAnim(const ANIList &anims);
/** Clear and draw animations to the screen, advancing them. */
void redrawAnim(const ANIList &anims);
void loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const;
void freeAnims(ANIList &anims) const;
void setAnim(ANIObject &anim, const AnimProperties &props) const;
/** Wait for the frame to end, handling screen updates and optionally update input. */
void endFrame(bool doInput);
// -- Sound --
/** Load all sounds that can be played interactively in the game. */
void loadSounds(const char * const *sounds, uint soundCount);
/** Free all loaded sound. */
void freeSounds();
/** Play a loaded sound. */
void playSound(uint sound, int16 frequency = 0, int16 repCount = 0);
/** Stop all sound playback. */
void stopSound();
/** Play a sound until it ends or is interrupted by a keypress. */
void playSoundFile(const Common::String &file, int16 frequency = 0, int16 repCount = 0, bool interruptible = true);
/** Beep the PC speaker. */
void beep(int16 frequency, int32 length);
// -- Input --
/** Check mouse and keyboard input. */
int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
/** Wait for mouse or keyboard input. */
int16 waitInput (int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
/** Wait for mouse or keyboard input, but don't care about what was done with the mouse. */
int16 waitInput();
/** Did we have mouse or keyboard input? */
bool hasInput();
// -- TXT helpers --
/** Get the name of a localized file. */
Common::String getLocFile(const Common::String &file) const;
/** Open a TXT file. */
TXTFile *loadTXT(const Common::String &txtFile, TXTFile::Format format) const;
/** Called by loadTXT() to fix strings within the TXT file. */
virtual void fixTXTStrings(TXTFile &txt) const;
// -- GCT helpers --
GCTFile *loadGCT(const Common::String &gctFile) const;
private:
/** Did we fade out? */
bool _fadedOut;
/** All loaded sounds. */
Common::Array<SoundDesc> _sounds;
/** Load a sound file. */
bool loadSound(SoundDesc &sound, const Common::String &file) const;
};
} // End of namespace Gob
#endif // GOB_PREGOB_PREGOB_H
|