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