ScummVM API documentation
screen.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 SKY_SCREEN_H
23 #define SKY_SCREEN_H
24 
25 
26 #include "common/scummsys.h"
27 #include "sky/skydefs.h"
28 
29 class OSystem;
30 
31 namespace Common {
32 struct Rect;
33 }
34 
35 namespace Sky {
36 
37 class Disk;
38 class SkyEngine;
39 class SkyCompact;
40 struct Compact;
41 struct DataFileHeader;
42 
43 #define SCROLL_JUMP 16
44 #define VGA_COLORS 256
45 #define GAME_COLORS 240
46 
47 #define FORE 1
48 #define BACK 0
49 
50 typedef struct {
51  uint16 yCood;
52  Compact *compact;
53  DataFileHeader *sprite;
54 } StSortList;
55 
56 class Screen {
57 public:
58  Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact);
59  ~Screen();
60  void setPalette(uint8 *pal);
61  void setPaletteEndian(uint8 *pal);
62  void setPalette(uint16 fileNum);
63  void paletteFadeUp(uint8 *pal);
64  void paletteFadeUp(uint16 fileNr);
65 
66  void showScreen(uint16 fileNum, bool fullscreen = false);
67  void showScreen(uint8 *pScreen, bool fullscreen = false);
68 
69  void handleTimer();
70  void startSequence(uint16 fileNum);
71  void startSequenceItem(uint16 itemNum);
72  void stopSequence();
73  bool sequenceRunning() { return _seqInfo.running; }
74  void processSequence();
75  void waitForSequence();
76  uint32 seqFramesLeft() { return _seqInfo.framesLeft; }
77  uint8 *giveCurrent() { return _currentScreen; }
78  void halvePalette();
79 
80  //- regular screen.asm routines
81  void forceRefresh() { memset(_gameGrid, 0x80, GRID_X * GRID_Y); }
82  void fnFadeUp(uint32 palNum, uint32 scroll);
83  void fnFadeDown(uint32 scroll);
84  void fnDrawScreen(uint32 palette, uint32 scroll);
85  void clearScreen(bool fullscreen = false);
86  void setFocusRectangle(const Common::Rect& rect);
87 
88  void recreate();
89  void flip(bool doUpdate = true);
90 
91  void spriteEngine();
92 
93  void paintBox(uint16 x, uint16 y);
94  void showGrid(uint8 *gridBuf);
95 
96 private:
97  OSystem *_system;
98  Disk *_skyDisk;
99  SkyCompact *_skyCompact;
100  static uint8 _top16Colors[16 * 3];
101  uint8 _palette[VGA_COLORS * 3];
102  uint32 _currentPalette;
103  uint8 _seqGrid[20 * 12];
104 
105  void waitForTick();
106 
107  uint8 *_gameGrid;
108  uint8 *_currentScreen;
109  uint8 *_scrollScreen;
110  struct {
111  uint32 nextFrame;
112  uint32 framesLeft;
113  uint8 *seqData;
114  uint8 *seqDataPos;
115  volatile bool running;
116  bool runningItem; // when playing an item, don't free it afterwards.
117  } _seqInfo;
118 
119  //- more regular screen.asm + layer.asm routines
120  void convertPalette(uint8 *inPal, uint8* outPal);
121  void palette_fadedown_helper(uint8 *pal, uint num);
122 
123  //- sprite.asm routines
124  // fixme: get rid of these globals
125  uint32 _sprWidth, _sprHeight, _sprX, _sprY, _maskX1, _maskX2;
126  void doSprites(uint8 layer);
127  void sortSprites();
128  void drawSprite(uint8 *spriteData, Compact *sprCompact);
129  void verticalMask();
130  void vertMaskSub(uint16 *grid, uint32 gridOfs, uint8 *screenPtr, uint32 layerId);
131  void vectorToGame(uint8 gridVal);
132 };
133 
134 } // End of namespace Sky
135 
136 #endif //SKYSCREEN_H
Definition: struc.h:78
Definition: screen.h:50
Definition: rect.h:144
Definition: disk.h:37
Definition: struc.h:35
Definition: algorithm.h:29
Definition: screen.h:56
Definition: system.h:161
Definition: compact.h:58
Definition: autoroute.h:28