ScummVM API documentation
walk.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/*
23 * This code is based on original Soltys source code
24 * Copyright (c) 1994-1995 Janusz B. Wisniewski and L.K. Avalon
25 */
26
27#ifndef CGE_WALK_H
28#define CGE_WALK_H
29
30#include "common/rect.h"
31#include "cge/vga13h.h"
32#include "cge/events.h"
33
34namespace CGE {
35
36#define kMapArrSize (kMapZCnt * kMapXCnt)
37#define kMapHig 80
38#define kMapGridX (kScrWidth / kMapXCnt)
39#define kMapGridZ (kMapHig / kMapZCnt)
40#define kMaxFindLevel 3
41
42enum Dir { kDirNone = -1, kDirNorth, kDirEast, kDirSouth, kDirWest };
43
44class Cluster {
45public:
46 CGEEngine *_vm;
47 Common::Point _pt;
48public:
49 uint8 &cell();
50 Cluster(CGEEngine *vm, int16 a, int16 b);
51 Cluster(CGEEngine *vm);
52 bool chkBar() const;
53 bool isValid() const;
54};
55
56class Walk : public Sprite {
57private:
58 CGEEngine *_vm;
59public:
60 Cluster _here;
61 int _tracePtr;
62 int _level;
63 int _findLevel;
64 Common::Point _target;
66
67 Dir _dir;
68 Walk(CGEEngine *vm, BitmapPtr *shpl);
69 ~Walk() override;
70 void tick() override;
71 void findWay(Cluster c);
72 void findWay(Sprite *spr);
73 int distance(Sprite *spr);
74 void turn(Dir d);
75 void park();
76 bool lower(Sprite *spr);
77 void reach(Sprite *spr, int mode = -1);
78
79 void noWay();
80 bool find1Way(Cluster c);
81};
82
83} // End of namespace CGE
84
85#endif
Definition: bitmap.h:55
Definition: cge.h:150
Definition: walk.h:44
Definition: vga13h.h:83
Definition: walk.h:56
Definition: array.h:52
Definition: rect.h:144