ScummVM API documentation
entrance.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 // Based on Phantasma code by Thomas Harte (2013),
23 // available at https://github.com/TomHarte/Phantasma/ (MIT)
24 
25 #ifndef FREESCAPE_ENTRANCE_H
26 #define FREESCAPE_ENTRANCE_H
27 
28 #include "freescape/objects/object.h"
29 
30 namespace Freescape {
31 
32 extern FCLInstructionVector *duplicateCondition(FCLInstructionVector *condition);
33 
34 class Entrance : public Object {
35 public:
36  Entrance(
37  uint16 objectID_,
38  const Math::Vector3d &origin_,
39  const Math::Vector3d &rotation_,
40  FCLInstructionVector conditionInstructions_,
41  Common::String conditionSource_) {
42  _objectID = objectID_;
43  _origin = origin_;
44  _rotation = rotation_;
45 
46  _condition = conditionInstructions_;
47  _conditionSource = conditionSource_;
48  _flags = 0;
49  }
50  virtual ~Entrance() {}
51 
52  bool isDrawable() override { return false; }
53  bool isPlanar() override { return true; }
54  void scale(int factor) override { _origin = _origin / factor; };
55  Object *duplicate() override {
56  FCLInstructionVector *conditionCopy = duplicateCondition(&_condition);
57  assert(conditionCopy);
58  Entrance *entrance = new Entrance(_objectID, _origin, _rotation, *conditionCopy, _conditionSource);
59  delete conditionCopy;
60  return entrance;
61  };
62 
63  ObjectType getType() override { return ObjectType::kEntranceType; };
64  Math::Vector3d getRotation() { return _rotation; }
65 
66  Common::String _conditionSource;
67  FCLInstructionVector _condition;
68 
69  void draw(Freescape::Renderer *gfx, float offset = 0.0) override { error("cannot render Entrance"); };
70 };
71 
72 } // End of namespace Freescape
73 
74 #endif // FREESCAPE_ENTRANCE_H
Definition: str.h:59
Definition: area.h:36
Definition: gfx.h:60
Definition: entrance.h:34
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: object.h:56