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 ULTIMA8_KERNEL_OBJECT_H 24 #define ULTIMA8_KERNEL_OBJECT_H 25 26 #include "ultima/ultima8/misc/classtype.h" 27 #include "ultima/ultima8/misc/pent_include.h" 28 29 namespace Ultima { 30 namespace Ultima8 { 31 32 class Usecode; 33 34 class Object { 35 public: Object()36 Object() : _objId(0xFFFF) {} 37 virtual ~Object(); 38 ENABLE_RUNTIME_CLASSTYPE_BASE()39 ENABLE_RUNTIME_CLASSTYPE_BASE() 40 41 //! get this Object's objID 42 inline ObjId getObjId() const { 43 return _objId; 44 } 45 46 //! Assign self and contents (if any) an objID 47 //! \return the assiged ID 48 virtual ObjId assignObjId(); 49 50 //! Clear objID of self and contents (if any) 51 virtual void clearObjId(); 52 53 //! dump some info about this object to pout 54 virtual void dumpInfo() const; 55 56 //! Spawn a usecode function on this object 57 //! \param classid The usecode class to run 58 //! \param offset The offset in that class to run 59 //! \param u The Usecode object containing the class 60 //! \param args Optional arguments to the spawned process 61 //! \param argsize The size (in bytes) of the optional arguments 62 //! \return the PID of the spawned process 63 ProcId callUsecode(uint16 classid, uint16 offset, 64 const uint8 *args = 0, int argsize = 0); 65 66 bool loadData(Common::ReadStream *rs, uint32 version); 67 virtual void saveData(Common::WriteStream *ws); 68 69 protected: 70 ObjId _objId; 71 }; 72 73 } // End of namespace Ultima8 74 } // End of namespace Ultima 75 76 #endif 77