2 * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
4 * ShapeFusion is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * ShapeFusion is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with ShapeFusion; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __PHYSICSDOCUMENT_H__
20 #define __PHYSICSDOCUMENT_H__
22 #include "wx/docview.h"
23 #include "wx/cmdproc.h"
29 #include "PhysicsElements.h"
31 class PhysicsDocument : public wxDocument, public PhysicsElement
33 DECLARE_DYNAMIC_CLASS(PhysicsDocument)
36 std::vector<MonsterDefinition> mMonsterDefinitions;
37 std::vector<EffectDefinition> mEffectDefinitions;
38 std::vector<ProjectileDefinition> mProjectileDefinitions;
39 std::vector<PhysicsConstants> mConstants;
40 std::vector<WeaponDefinition> mWeaponDefinitions;
42 static const int MAXIMUM_WADFILE_NAME_LENGTH = 64;
43 unsigned char wadfile_name[MAXIMUM_WADFILE_NAME_LENGTH];
45 static const int kEntryHeaderSize = 16;
49 unsigned int MonsterCount() const { return mMonsterDefinitions.size(); }
50 unsigned int EffectCount() const { return mEffectDefinitions.size(); }
51 unsigned int ProjectileCount() const { return mProjectileDefinitions.size(); }
52 unsigned int PhysicsConstantsCount() const { return mConstants.size(); }
53 unsigned int WeaponCount() const { return mWeaponDefinitions.size(); }
56 PhysicsConstants* GetPhysicsConstants(unsigned int id) {
57 return &mConstants[id];
60 EffectDefinition* GetEffectDefinition(unsigned int id) {
61 return &mEffectDefinitions[id];
64 ProjectileDefinition* GetProjectileDefinition(unsigned int id) {
65 return &mProjectileDefinitions[id];
68 MonsterDefinition* GetMonsterDefinition(unsigned int id) {
69 return &mMonsterDefinitions[id];
72 WeaponDefinition* GetWeaponDefinition(unsigned int id) {
73 return &mWeaponDefinitions[id];
79 bool DoOpenDocument(const wxString& file);
81 #if wxUSE_STD_IOSTREAM
82 wxSTD ostream& SaveObject(wxSTD ostream& stream);
83 wxSTD istream& LoadObject(wxSTD istream& stream);
85 wxOutputStream& SaveObject(wxOutputStream& stream);
86 wxInputStream& LoadObject(wxInputStream& stream);
89 unsigned long SizeInFile();
90 template<class T> void WriteTag(BigEndianBuffer& buffer, long& offset, unsigned long tag, const std::vector<T>& data, bool last = false);