ScummVM API documentation
redraw.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 TWINE_RENDERER_REDRAW_H
23#define TWINE_RENDERER_REDRAW_H
24
25#include "common/scummsys.h"
26#include "common/rect.h"
27#include "common/str.h"
28#include "twine/shared.h"
29
30namespace TwinE {
31
32// MAX_INCRUST_DISP
33#define OVERLAY_MAX_ENTRIES 10
34
35enum class OverlayType {
36 koSprite = 0, // INCRUST_SPRITE
37 koNumber = 1, // INCRUST_NUM
38 koNumberRange = 2, // INCRUST_CMPT
39 koInventoryItem = 3, // INCRUST_OBJ
40 koText = 4, // INCRUST_TEXT
41 koInventory = 5, // lba2 (INCRUST_INVENTORY)
42 koSysText = 6, // lba2 (INCRUST_SYS_TEXT)
43 koFlash = 7, // lba2 (INCRUST_ECLAIR)
44 koRain = 8, // lba2 (INCRUST_PLUIE)
45 koMax
46};
47
48// lba2
49#define INCRUST_YCLIP (1 << 8)
50
51enum class OverlayPosType {
52 koNormal = 0,
53 koFollowActor = 1
54};
55
58 int16 num = 0; // sprite/3d model entry | number | number range
59 int16 x = 0;
60 int16 y = 0;
61 OverlayType type = OverlayType::koSprite;
62 int16 info = 0; // text = actor | total coins
63 OverlayPosType move = OverlayPosType::koNormal;
64 int16 timerEnd = 0; // life time in ticks - see toSeconds()
65};
66
68 int16 z = 0; // depth sorting value
69 uint32 type = 0;
70 // NumObj was also used with mask of type and numObj - we are
71 // not masking the value in numObj, but store the type in type
72 uint16 numObj = 0;
73
74 int16 xw = 0;
75 int16 yw = 0;
76 int16 zw = 0;
77 uint16 num = 0;
78
79 inline bool operator==(const DrawListStruct& other) const {
80 return z == other.z;
81 }
82
83 inline bool operator<(const DrawListStruct& other) const {
84 return z < other.z;
85 }
86};
87
88#define TYPE_OBJ_SHIFT (10)
89#define TYPE_OBJ_FIRST (1 << TYPE_OBJ_SHIFT) // 1024
90#define NUM_OBJ_MASK (TYPE_OBJ_FIRST - 1)
91
92class TwinEEngine;
93class Redraw {
94private:
95 TwinEEngine *_engine;
96 enum DrawListType {
97 DrawObject3D = (0 << TYPE_OBJ_SHIFT), // TYPE_OBJ_3D
98 DrawFlagRed = (1 << TYPE_OBJ_SHIFT),
99 DrawFlagYellow = (2 << TYPE_OBJ_SHIFT),
100 DrawShadows = (3 << TYPE_OBJ_SHIFT), // TYPE_SHADOW
101 DrawActorSprites = (4 << TYPE_OBJ_SHIFT), // TYPE_OBJ_SPRITE
102 DrawZoneDec = (5 << TYPE_OBJ_SHIFT),
103 DrawExtras = (6 << TYPE_OBJ_SHIFT), // TYPE_EXTRA
104 DrawPrimitive = (7 << TYPE_OBJ_SHIFT)
105 };
106
107 Common::Rect _currentRedrawList[300];
108 Common::Rect _nextRedrawList[300];
109
110 int16 _overlayRotation = 0;
111
113 int32 _bubbleActor = -1;
114 int32 _bubbleSpriteIndex;
115
116 // big font shadow text in the lower left corner
117 Common::String _text;
118 int32 _textDisappearTime = -1;
119
124 void addRedrawCurrentArea(const Common::Rect &redrawArea);
129 void moveNextAreas();
130 void updateOverlayTypePosition(int16 x1, int16 y1, int16 x2, int16 y2);
131
132 void processDrawListShadows(const DrawListStruct& drawCmd);
133 void processDrawListActors(const DrawListStruct& drawCmd, bool bgRedraw);
134 void processDrawListActorSprites(const DrawListStruct& drawCmd, bool bgRedraw);
135 void processDrawListExtras(const DrawListStruct& drawCmd);
136
137 int32 fillActorDrawingList(DrawListStruct *drawList, bool bgRedraw);
138 int32 fillExtraDrawingList(DrawListStruct *drawList, int32 drawListPos);
139 void correctZLevels(DrawListStruct *drawList, int32 drawListPos);
140 void processDrawList(DrawListStruct *drawList, int32 drawListPos, bool bgRedraw);
141 void renderOverlays();
142 void renderText();
143
144 void fillBackground(uint8 color);
145
146public:
147 Redraw(TwinEEngine *engine);
148
149 bool _flagMCGA = false;
150
152 bool _firstTime = false;
153
154 IVec3 _projPosScreen; // XpOrgw, YpOrgw
155
157 int32 _nbPhysBox = 0; // fullRedrawVar8
159 int32 _nbOptPhysBox = 0;
160
161 int _sceneryViewX = 0; // xmin
162 int _sceneryViewY = 0; // ymin
163
164 OverlayListStruct overlayList[OVERLAY_MAX_ENTRIES];
165
166 void setRenderText(const Common::String &text);
167
168 // InitIncrustDisp
169 int32 addOverlay(OverlayType type, int16 info0, int16 x, int16 y, int16 info1, OverlayPosType posType, int16 lifeTime);
170 void posObjIncrust(OverlayListStruct *ptrdisp, int32 num); // lba2
171
179 void addRedrawArea(int32 left, int32 top, int32 right, int32 bottom); // AddPhysBox
180 void addPhysBox(const Common::Rect &rect); // AddPhysBox
181
186 void flipBoxes();
187
189 void clsBoxes();
190
195 void drawScene(bool bgRedraw);
196
198 void drawBubble(int32 actorIdx);
199
205 void sortDrawingList(DrawListStruct *list, int32 listSize) const;
206};
207
208} // namespace TwinE
209
210#endif
Definition: str.h:59
Definition: redraw.h:93
void flipBoxes()
int32 _nbOptPhysBox
Definition: redraw.h:159
int32 _nbPhysBox
Definition: redraw.h:157
void drawBubble(int32 actorIdx)
bool _firstTime
Definition: redraw.h:152
void addRedrawArea(int32 left, int32 top, int32 right, int32 bottom)
void sortDrawingList(DrawListStruct *list, int32 listSize) const
void drawScene(bool bgRedraw)
Definition: twine.h:207
Definition: rect.h:536
Definition: redraw.h:67
Definition: shared.h:127
Definition: redraw.h:57