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  */
22 
23 #ifndef BLADERUNNER_SCRIPT_POLICE_MAZE_H
24 #define BLADERUNNER_SCRIPT_POLICE_MAZE_H
25 
26 #include "bladerunner/script/script.h"
27 #include "bladerunner/vector.h"
28 
29 namespace BladeRunner {
30 
31 enum {
32 	kNumMazeTracks = 64,
33 	kNumTrackPoints = 100
34 };
35 
36 class BladeRunnerEngine;
37 class SaveFileReadStream;
38 class SaveFileWriteStream;
39 
40 class PoliceMazeTargetTrack : ScriptBase {
41 	friend class PoliceMaze;
42 	uint32     _time;
43 	bool       _isPresent;
44 	int        _itemId;
45 	int        _pointCount;
46 	Vector3    _points[kNumTrackPoints];
47 	const int *_data;
48 	int        _dataIndex;
49 	int32      _timeLeftUpdate;
50 	int32      _timeLeftWait;
51 	bool       _isWaiting;
52 	int        _isMoving;
53 	int        _pointIndex;
54 	int        _pointTarget;
55 	bool       _isRotating;
56 	int        _angleTarget;
57 	int        _angleDelta;
58 	bool       _isPaused;
59 
60 public:
61 	PoliceMazeTargetTrack(BladeRunnerEngine *vm);
62 	~PoliceMazeTargetTrack();
63 
64 	void reset();
65 	void clear(bool isLoadingGame);
66 	void add(int trackId, float startX, float startY, float startZ, float endX, float endY, float endZ, int steps, const int *instructions, bool isActive);
67 
68 	bool tick();
isPresent()69 	bool isPresent() const { return _isPresent; }
setPaused()70 	void setPaused() { _isPaused = true; }
resetPaused()71 	void resetPaused() { _isPaused = false; }
isPaused()72 	bool isPaused() const { return _isPaused; }
setTime(uint32 t)73 	void setTime(uint32 t) { _time = t; }
74 
75 	void readdObject(int itemId);
76 
77 	void save(SaveFileWriteStream &f);
78 	void load(SaveFileReadStream &f);
79 };
80 
81 class PoliceMaze : ScriptBase {
82 	bool _isPaused;
83 	bool _isActive;
84 	bool _isEnding;
85 	int  _pm_var1;
86 	int  _pm_var2;
87 
88 public:
89 	PoliceMazeTargetTrack *_tracks[kNumMazeTracks];
90 
91 public:
92 	PoliceMaze(BladeRunnerEngine *vm);
93 	~PoliceMaze();
94 
95 	void tick();
96 	void clear(bool isLoadingGame);
97 	void setPauseState(bool state);
98 	void activate();
99 
100 	void save(SaveFileWriteStream &f);
101 	void load(SaveFileReadStream &f);
102 };
103 
104 } // End of namespace BladeRunner
105 
106 #endif
107