ScummVM API documentation
background.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 /*
23  * This code is based on the original source code of Lord Avalot d'Argent version 1.3.
24  * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
25  */
26 
27 /* Original name: CELER The unit for updating the screen pics. */
28 
29 #ifndef AVALANCHE_BACKGROUND_H
30 #define AVALANCHE_BACKGROUND_H
31 
32 #include "common/str.h"
33 
34 namespace Avalanche {
35 class AvalancheEngine;
36 
37 enum PictureType {kEga, kBgi, kNaturalImage};
38 
39 struct SpriteType {
40  PictureType _type;
41  int16 _x, _y;
42  int16 _width, _height;
43  int32 _size;
44  Graphics::Surface _picture;
45 };
46 
47 class Background {
48 public:
50  ~Background();
51 
52  void update();
53  void loadSprites(byte number);
54  void release();
55 
56  // Setting the destination to negative coordinates means the picture should be drawn to it's original position.
57  // If you give it positive values, the picture will be plotted to the desired coordinates on the screen.
58  // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication.
59  void draw(int16 destX, int16 destY, byte sprId);
60  void resetVariables();
61  void synchronize(Common::Serializer &sz);
62 
63 private:
64  AvalancheEngine *_vm;
65 
66  byte _nextBell; // For the ringing.
67  int32 _offsets[40];
68  byte _spriteNum;
69  SpriteType _sprites[40];
70  Common::Path _filename;
71  static const int16 kOnDisk; // Value of _sprites[fv]._x when it's not in memory.
72 
73  void drawSprite(int16 x, int16 y, SpriteType &sprite);
74 };
75 
76 } // End of namespace Avalanche.
77 
78 #endif // AVALANCHE_BACKGROUND_H
Definition: surface.h:67
Definition: animation.h:32
Definition: path.h:52
Definition: avalanche.h:74
Definition: serializer.h:79
Definition: background.h:39
Definition: background.h:47