ScummVM API documentation
object.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 #ifndef LASTEXPRESS_OBJECT_H
23 #define LASTEXPRESS_OBJECT_H
24 
25 #include "lastexpress/shared.h"
26 
27 #include "common/serializer.h"
28 #include "common/system.h"
29 
30 namespace LastExpress {
31 
32 class LastExpressEngine;
33 
35 public:
36 
37  struct Object : Common::Serializable { // All fields should be saved as bytes
38  EntityIndex entity;
39  ObjectLocation status;
40  CursorStyle windowCursor;
41  CursorStyle handleCursor;
42  ObjectModel model;
43 
44  Object() {
45  entity = kEntityPlayer;
46  status = kObjectLocationNone;
47  windowCursor = kCursorHandKnock;
48  handleCursor = kCursorHandKnock;
49  model = kObjectModelNone;
50  }
51 
52  Common::String toString();
53 
54  // Serializable
55  void saveLoadWithSerializer(Common::Serializer &s) override {
56  s.syncAsByte(entity);
57  s.syncAsByte(status);
58  s.syncAsByte(windowCursor);
59  s.syncAsByte(handleCursor);
60  s.syncAsByte(model);
61  }
62  };
63 
64  Objects(LastExpressEngine *engine);
65 
66  const Object get(ObjectIndex index) const;
67  void update(ObjectIndex index, EntityIndex entity, ObjectLocation status, CursorStyle cursor, CursorStyle cursor2);
68  void updateModel(ObjectIndex index, ObjectModel model);
69 
70  // Serializable
71  void saveLoadWithSerializer(Common::Serializer &s) override;
72 
78  Common::String toString();
79 
80 private:
81  LastExpressEngine *_engine;
82 
83  Object _objects[kObjectMax];
84 };
85 
86 } // End of namespace LastExpress
87 
88 #endif // LASTEXPRESS_OBJECT_H
Definition: str.h:59
Definition: lastexpress.h:69
Definition: animation.h:45
Definition: serializer.h:79
Definition: object.h:37
Definition: serializer.h:308
Definition: object.h:34