1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This file is based on WME Lite.
* http://dead-code.org/redir.php?target=wmelite
* Copyright (c) 2011 Jan Nedoma
*/
#ifndef WINTERMUTE_ADSCENE_H
#define WINTERMUTE_ADSCENE_H
#include "engines/wintermute/Base/BFader.h"
namespace WinterMute {
class CUIWindow;
class CAdObject;
class CAdRegion;
class CBViewport;
class CAdLayer;
class CBPoint;
class CAdWaypointGroup;
class CAdPath;
class CAdScaleLevel;
class CAdRotLevel;
class CAdPathPoint;
class CAdScene : public CBObject {
public:
CBObject *getNextAccessObject(CBObject *CurrObject);
CBObject *getPrevAccessObject(CBObject *CurrObject);
bool getSceneObjects(CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
bool getRegionObjects(CAdRegion *Region, CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
bool afterLoad();
bool getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions);
bool handleItemAssociations(const char *ItemName, bool Show);
CUIWindow *_shieldWindow;
float getRotationAt(int X, int Y);
bool loadState();
bool saveState();
bool _persistentState;
bool _persistentStateSprites;
CBObject *getNodeByName(const char *name);
void setOffset(int OffsetLeft, int OffsetTop);
bool pointInViewport(int X, int Y);
int getOffsetTop();
int getOffsetLeft();
bool getViewportSize(int *Width = NULL, int *Height = NULL);
bool getViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL);
CBViewport *_viewport;
CBFader *_fader;
int _pfPointsNum;
void pfPointsAdd(int X, int Y, int Distance);
void pfPointsStart();
bool _initialized;
bool correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
bool correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, CBObject *Requester);
DECLARE_PERSISTENT(CAdScene, CBObject)
bool displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false);
bool displayRegionContentOld(CAdRegion *Region = NULL);
static int compareObjs(const void *Obj1, const void *Obj2);
bool updateFreeObjects();
bool traverseNodes(bool Update = false);
float getScaleAt(int Y);
bool sortScaleLevels();
bool sortRotLevels();
virtual bool saveAsText(CBDynBuffer *buffer, int indent);
uint32 getAlphaAt(int X, int Y, bool ColorCheck = false);
bool _paralaxScrolling;
void skipTo(int OffsetX, int OffsetY);
void setDefaults();
void cleanup();
void skipToObject(CBObject *Object);
void scrollToObject(CBObject *Object);
void scrollTo(int OffsetX, int OffsetY);
virtual bool update();
bool _autoScroll;
int _targetOffsetTop;
int _targetOffsetLeft;
int _scrollPixelsV;
uint32 _scrollTimeV;
uint32 _lastTimeV;
int _scrollPixelsH;
uint32 _scrollTimeH;
uint32 _lastTimeH;
virtual bool display();
uint32 _pfMaxTime;
bool initLoop();
void pathFinderStep();
bool isBlockedAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
bool isWalkableAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
CAdLayer *_mainLayer;
float getZoomAt(int X, int Y);
bool getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject *requester = NULL);
CAdScene(CBGame *inGame);
virtual ~CAdScene();
CBArray<CAdLayer *, CAdLayer *> _layers;
CBArray<CAdObject *, CAdObject *> _objects;
CBArray<CAdWaypointGroup *, CAdWaypointGroup *> _waypointGroups;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
int _width;
int _height;
bool addObject(CAdObject *Object);
bool removeObject(CAdObject *Object);
int _editorMarginH;
int _editorMarginV;
uint32 _editorColFrame;
uint32 _editorColEntity;
uint32 _editorColRegion;
uint32 _editorColBlocked;
uint32 _editorColWaypoints;
uint32 _editorColEntitySel;
uint32 _editorColRegionSel;
uint32 _editorColBlockedSel;
uint32 _editorColWaypointsSel;
uint32 _editorColScale;
uint32 _editorColDecor;
uint32 _editorColDecorSel;
bool _editorShowRegions;
bool _editorShowBlocked;
bool _editorShowDecor;
bool _editorShowEntities;
bool _editorShowScale;
CBArray<CAdScaleLevel *, CAdScaleLevel *> _scaleLevels;
CBArray<CAdRotLevel *, CAdRotLevel *> _rotLevels;
virtual bool restoreDeviceObjects();
int getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester = NULL);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
virtual bool scSetProperty(const char *name, CScValue *value);
virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
private:
bool persistState(bool Saving = true);
void pfAddWaypointGroup(CAdWaypointGroup *Wpt, CBObject *Requester = NULL);
bool _pfReady;
CBPoint *_pfTarget;
CAdPath *_pfTargetPath;
CBObject *_pfRequester;
CBArray<CAdPathPoint *, CAdPathPoint *> _pfPath;
int _offsetTop;
int _offsetLeft;
};
} // end of namespace WinterMute
#endif
|