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  * Data structures used for handling backgrounds
21  */
22 
23 #ifndef TINSEL_BACKGND_H // prevent multiple includes
24 #define TINSEL_BACKGND_H
25 
26 #include "common/array.h"
27 #include "common/coroutines.h"
28 #include "common/frac.h"
29 #include "common/rect.h"
30 #include "tinsel/anim.h" // for ANIM
31 #include "tinsel/dw.h" // for SCNHANDLE
32 #include "tinsel/object.h" // for OBJECT *
33 #include "tinsel/palette.h" // palette definitions
34 
35 namespace Tinsel {
36 
37 struct OBJECT;
38 
39 
41 enum {
42  SCROLLX_PAD = 64,
43  SCROLLY_PAD = 64
44 };
45 
47 #define LINEAR_SEARCH 5
48 
50 struct PLAYFIELD {
57  bool bMoved;
58 };
59 
61 struct BACKGND {
62  COLORREF rgbSkyColor;
69  bool bAutoErase;
70 };
71 
72 
73 /*----------------------------------------------------------------------*\
74 |* Background Function Prototypes *|
75 \*----------------------------------------------------------------------*/
76 
77 #define MAX_BG 10
78 
79 class Font;
80 
81 class Background {
82 public:
83  Background(Font* font);
84 
85  void InitBackground();
86 
87  void DrawBackgnd(); // Draws all playfields for the current background
88 
92  void DropBackground();
93 
94  void ResetBackground() {
95  _pCurBgnd->fieldArray.clear();
96  delete _pCurBgnd;
97  _pCurBgnd = nullptr;
98  }
99 
100  void StartupBackground(CORO_PARAM, SCNHANDLE hFilm);
101 
102  void PlayfieldSetPos( // Sets the xy position of the specified playfield in the current background
103  unsigned int which, // which playfield
104  int newXpos, // new x position
105  int newYpos); // new y position
106 
107  void PlayfieldGetPos( // Returns the xy position of the specified playfield in the current background
108  unsigned int which, // which playfield
109  int* pXpos, // returns current x position
110  int* pYpos); // returns current y position
111 
112  int PlayfieldGetCenterX( // Returns the xy position of the specified playfield in the current background
113  unsigned int which); // which playfield
114 
115  OBJECT** GetPlayfieldList( // Returns the display list for the specified playfield
116  unsigned int which); // which playfield
117 
118  OBJECT* GetBgObject() { return _pBG[0]; }
119 
120  void ChangePalette(SCNHANDLE hPal);
121 
122  SCNHANDLE BgPal() { return _hBgPal; }
123 
124  void SetDoFadeIn(bool tf) { _bDoFadeIn = tf; }
125 
126  bool GetDoFadeIn() { return _bDoFadeIn; }
127 
131  SCNHANDLE GetBgroundHandle() { return _hBackground; }
132 
136  int BgWidth();
137 
141  int BgHeight();
142 
143  void SetBackPal(SCNHANDLE hPal);
144 
145  int getBgSpeed() { return _BGspeed; }
146 
147  void WaitForBG(CORO_PARAM);
148 
149 private:
150  Font *_font;
151 
152  // current background
153  BACKGND *_pCurBgnd;
154 
155  SCNHANDLE _hBgPal; // Background's palette
156  int _BGspeed;
157  SCNHANDLE _hBackground; // Current scene handle - stored in case of Save_Scene()
158  bool _bDoFadeIn;
159 
160 public:
161  int _bgReels;
162  OBJECT *_pBG[MAX_BG];
163  ANIM _thisAnim[MAX_BG]; // used by BGmainProcess()
164 };
165 
166 } // End of namespace Tinsel
167 
168 #endif // TINSEL_BACKGND_H
frac_t * pYscrollTable
pointer to y direction scroll table for this background
Definition: background.h:67
SCNHANDLE GetBgroundHandle()
Definition: background.h:131
int refreshRate
background update process refresh rate
Definition: background.h:65
uint32 SCNHANDLE
Definition: dw.h:31
Definition: array.h:52
frac_t fieldXvel
current x velocity of playfield
Definition: background.h:54
frac_t fieldYvel
current y velocity of playfield
Definition: background.h:55
Definition: anim.h:33
frac_t fieldY
current world y position of playfield
Definition: background.h:53
Definition: rect.h:144
Definition: background.h:81
Definition: background.h:50
OBJECT * pDispList
object display list for this playfield
Definition: background.h:51
bool bMoved
set when playfield has moved
Definition: background.h:57
Definition: object.h:73
#define CORO_PARAM
Definition: coroutines.h:107
frac_t * pXscrollTable
pointer to x direction scroll table for this background
Definition: background.h:66
Definition: background.h:61
Definition: font.h:33
Definition: actors.h:36
Definition: rect.h:45
Common::Point ptInitWorld
initial world position
Definition: background.h:63
Common::Rect rcScrollLimits
scroll limits
Definition: background.h:64
frac_t fieldX
current world x position of playfield
Definition: background.h:52
bool bAutoErase
when set - screen is cleared before anything is plotted (unused)
Definition: background.h:69
COLORREF rgbSkyColor
background sky color
Definition: background.h:62
Common::Array< PLAYFIELD > fieldArray
list of all playfields for this background
Definition: background.h:68
int32 frac_t
Definition: frac.h:52
Common::Rect rcClip
clip rectangle for this playfield
Definition: background.h:56