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 PETKA_Q_SYSTEM_H
24 #define PETKA_Q_SYSTEM_H
25 
26 #include "common/ptr.h"
27 #include "common/events.h"
28 #include "common/stream.h"
29 #include "common/list.h"
30 #include "common/hashmap.h"
31 #include "common/hash-str.h"
32 
33 #include "petka/objects/object_bg.h"
34 
35 namespace Petka {
36 
37 class PetkaEngine;
38 class QObjectCase;
39 class QObjectCursor;
40 class QObjectStar;
41 class QObjectPetka;
42 class QObjectChapayev;
43 class InterfaceSaveLoad;
44 class InterfaceSequence;
45 class InterfaceMain;
46 class InterfaceStartup;
47 class InterfacePanel;
48 class InterfaceMap;
49 class Interface;
50 
51 class QSystem {
52 public:
53 	QSystem(PetkaEngine &vm);
54 	~QSystem();
55 
56 	bool init();
57 	void load(Common::ReadStream *s);
58 	void save(Common::WriteStream *s);
59 
60 	void update();
61 
62 	void addMessage(const QMessage &msg);
63 	void addMessage(uint16 objId, uint16 opcode, int16 arg1 = 0, int16 arg2 = 0, int16 arg3 = 0, int32 unk = 0, QMessageObject *sender = nullptr);
64 	void addMessageForAllObjects(uint16 opcode, int16 arg1 = 0, int16 arg2 = 0, int16 arg3 = 0, int32 unk = 0, QMessageObject *sender = nullptr);
65 
66 	QMessageObject *findObject(int16 id);
67 	QMessageObject *findObject(const Common::String &name);
68 
69 	QObjectPetka *getPetka() const;
70 	QObjectChapayev *getChapay() const;
71 	QObjectCursor *getCursor() const;
72 	QObjectCase *getCase() const;
73 	QObjectStar *getStar() const;
74 
75 	void startSaveLoad(int id);
76 
77 	void togglePanelInterface();
78 	void toggleMapInterface();
79 	void toggleCase();
80 
81 	void goPrevInterface();
82 
83 	void setCursorAction(int action);
84 
85 	void onEvent(const Common::Event &event);
86 
87 public:
88 	PetkaEngine &_vm;
89 
90 	Common::Array<QMessageObject *> _allObjects;
91 	Common::List<QMessage> _messages;
92 	Common::ScopedPtr<InterfaceMain> _mainInterface;
93 	Common::ScopedPtr<InterfaceSaveLoad> _saveLoadInterface;
94 	Common::ScopedPtr<InterfaceSequence> _sequenceInterface;
95 	Common::ScopedPtr<InterfaceStartup> _startupInterface;
96 	Common::ScopedPtr<InterfacePanel> _panelInterface;
97 	Common::ScopedPtr<InterfaceMap> _mapInterface;
98 	Interface *_currInterface;
99 	Interface *_prevInterface;
100 
101 	bool _totalInit;
102 	int _fxId;
103 	int _musicId;
104 
105 	int _sceneWidth;
106 	int _xOffset;
107 	int _reqOffset;
108 
109 	QObjectBG *_room;
110 };
111 
112 } // End of namespace Petka
113 
114 #endif
115