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 NGI_INTERACTION_H 24 #define NGI_INTERACTION_H 25 26 #include "ngi/utils.h" 27 28 namespace NGI { 29 30 class GameObject; 31 class MessageQueue; 32 class StaticANIObject; 33 34 int handleObjectInteraction(StaticANIObject *subject, GameObject *object, int invId); 35 bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId); 36 37 38 class Interaction : public CObject { 39 public: 40 int16 _objectId1; 41 int16 _objectId2; 42 int16 _objectId3; 43 int16 _staticsId1; 44 int16 _staticsId2; 45 int _objectState1; 46 int _objectState2; 47 int _xOffs; 48 int _yOffs; 49 MessageQueue *_messageQueue; 50 int _sceneId; 51 int _field_28; 52 uint _flags; 53 Common::String _actionName; 54 55 public: 56 Interaction(); 57 ~Interaction() override; 58 59 bool load(MfcArchive &file) override; 60 bool canInteract(GameObject *obj1, GameObject *obj2, int invId); 61 bool isOverlapping(StaticANIObject *subj, GameObject *obj); 62 }; 63 64 class InteractionController : public CObject { 65 friend bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId); 66 67 public: 68 typedef ObList<Interaction> InteractionList; 69 bool _flag24; 70 71 private: 72 InteractionList _interactions; 73 static bool compareInteractions(const Interaction *i1, const Interaction *i2); 74 75 public: InteractionController()76 InteractionController() : _flag24(true) {} 77 ~InteractionController() override; 78 79 bool load(MfcArchive &file) override; 80 enableFlag24()81 void enableFlag24() { _flag24 = true; } disableFlag24()82 void disableFlag24() { _flag24 = false; } 83 84 void sortInteractions(int sceneId); 85 86 bool handleInteraction(StaticANIObject *subj, GameObject *obj, int invId); 87 88 Interaction *getInteractionByObjectIds(int obId, int obId2, int obId3); 89 }; 90 91 struct EntranceInfo { 92 int32 _sceneId; 93 int32 _field_4; 94 int32 _messageQueueId; 95 int32 _field_130; 96 97 bool load(MfcArchive &file); 98 }; 99 100 } // End of namespace NGI 101 102 #endif /* NGI_INTERACTION_H */ 103