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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Data structures used for handling backgrounds 22 */ 23 24 #ifndef TINSEL_BACKGND_H // prevent multiple includes 25 #define TINSEL_BACKGND_H 26 27 #include "common/coroutines.h" 28 #include "common/frac.h" 29 #include "common/rect.h" 30 #include "tinsel/dw.h" // for SCNHANDLE 31 #include "tinsel/palette.h" // palette definitions 32 33 namespace Tinsel { 34 35 struct OBJECT; 36 37 38 /** Scrolling padding. Needed because scroll process does not normally run on every frame */ 39 enum { 40 SCROLLX_PAD = 64, 41 SCROLLY_PAD = 64 42 }; 43 44 /** When module BLK_INFO list is this long, switch from a binary to linear search */ 45 #define LINEAR_SEARCH 5 46 47 /** background playfield structure - a playfield is a container for modules */ 48 struct PLAYFIELD { 49 OBJECT *pDispList; ///< object display list for this playfield 50 frac_t fieldX; ///< current world x position of playfield 51 frac_t fieldY; ///< current world y position of playfield 52 frac_t fieldXvel; ///< current x velocity of playfield 53 frac_t fieldYvel; ///< current y velocity of playfield 54 Common::Rect rcClip; ///< clip rectangle for this playfield 55 bool bMoved; ///< set when playfield has moved 56 }; 57 58 /** multi-playfield background structure - a backgnd is a container of playfields */ 59 struct BACKGND { 60 COLORREF rgbSkyColor; ///< background sky color 61 Common::Point ptInitWorld; ///< initial world position 62 Common::Rect rcScrollLimits; ///< scroll limits 63 int refreshRate; ///< background update process refresh rate 64 frac_t *pXscrollTable; ///< pointer to x direction scroll table for this background 65 frac_t *pYscrollTable; ///< pointer to y direction scroll table for this background 66 int numPlayfields; ///< number of playfields for this background 67 PLAYFIELD *fieldArray; ///< pointer to array of all playfields for this background 68 bool bAutoErase; ///< when set - screen is cleared before anything is plotted (unused) 69 }; 70 71 72 /*----------------------------------------------------------------------*\ 73 |* Background Function Prototypes *| 74 \*----------------------------------------------------------------------*/ 75 76 void InitBackground( // called to initialize a background 77 const BACKGND *pBgnd); // pointer to data struct for current background 78 79 void StartupBackground(CORO_PARAM, SCNHANDLE hFilm); 80 81 void StopBgndScrolling(); // Stops all background playfields from scrolling 82 83 void PlayfieldSetPos( // Sets the xy position of the specified playfield in the current background 84 int which, // which playfield 85 int newXpos, // new x position 86 int newYpos); // new y position 87 88 void PlayfieldGetPos( // Returns the xy position of the specified playfield in the current background 89 int which, // which playfield 90 int *pXpos, // returns current x position 91 int *pYpos); // returns current y position 92 93 int PlayfieldGetCenterX( // Returns the xy position of the specified playfield in the current background 94 int which); // which playfield 95 96 OBJECT **GetPlayfieldList( // Returns the display list for the specified playfield 97 int which); // which playfield 98 99 void KillPlayfieldList( // Kills all the objects on the display list for the specified playfield 100 int which); // which playfield 101 102 void DrawBackgnd(); // Draws all playfields for the current background 103 104 void RedrawBackgnd(); // Completely redraws all the playfield object lists for the current background 105 106 OBJECT *GetBgObject(); 107 108 SCNHANDLE BgPal(); 109 110 int BgWidth(); 111 112 int BgHeight(); 113 114 } // End of namespace Tinsel 115 116 #endif // TINSEL_BACKGND_H 117