Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
agg_def.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WW3D *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/agg_def.h $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 4/05/01 9:52a $*
30 * *
31 * $Revision:: 2 $*
32 * *
33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
34
35
36#if defined(_MSC_VER)
37#pragma once
38#endif
39
40#ifndef AGGREGATE_DEF_H
41#define AGGREGATE_DEF_H
42
43#include "proto.h"
44#include "rendobj.h"
45#include "w3d_file.h"
46#include "w3derr.h"
47#include "vector.h"
48#include "bittype.h"
49#include <string.h>
50
51#ifdef _UNIX
52#include "osdep.h"
53#endif
54
55
56// Forward declarations
57class ChunkLoadClass;
58class ChunkSaveClass;
59class IndirectTextureClass;
60
61
63//
64// Macros
65//
66#ifndef SAFE_FREE
67#define SAFE_FREE(pointer) \
68{ \
69 if (pointer) { \
70 ::free (pointer); \
71 pointer = 0; \
72 } \
73}
74
75#endif //SAFE_FREE
76
77
79//
80// AggregateDefClass
81//
82// Description of an aggregate object. Used by the asset manager
83// to construct aggregates. An 'aggregate' is simply a 'shell' that
84// contains references to a hierarchy model and subobjects to attach to its bones.
85//
87{
88 public:
89
91 //
92 // Public constructors/destructors
93 //
94 AggregateDefClass (void);
97 virtual ~AggregateDefClass (void);
98
99
101 //
102 // Public operators
103 //
105
107 //
108 // Public methods
109 //
110 virtual WW3DErrorType Load_W3D (ChunkLoadClass &chunk_load);
111 virtual WW3DErrorType Save_W3D (ChunkSaveClass &chunk_save);
112 const char * Get_Name (void) const { return m_pName; }
113 void Set_Name (const char *pname) { SAFE_FREE (m_pName); m_pName = ::_strdup (pname); }
114 RenderObjClass * Create (void);
115 AggregateDefClass * Clone (void) const { return W3DNEW AggregateDefClass (*this); }
116
117 //
118 // Public accessors
119 //
120 ULONG Class_ID (void) const { return m_MiscInfo.OriginalClassID; }
121
122 //
123 // Initialization
124 //
125 void Initialize (RenderObjClass &base_model);
126
127 protected:
128
130 //
131 // Protected data types
132 //
133 typedef struct _TEXTURE_INFO
134 {
136 IndirectTextureClass * pnew_texture;
137
138 bool operator == (_TEXTURE_INFO &src) { return false; }
139 bool operator != (_TEXTURE_INFO &src) { return true; }
141
142
144 //
145 // Protected methods
146 //
147
148 //
149 // Loading methods
150 //
151 virtual WW3DErrorType Read_Header (ChunkLoadClass &chunk_load);
152 virtual WW3DErrorType Read_Info (ChunkLoadClass &chunk_load);
153 virtual WW3DErrorType Read_Subobject (ChunkLoadClass &chunk_load);
154 virtual WW3DErrorType Read_Class_Info (ChunkLoadClass &chunk_load);
155
156 //
157 // Saving methods
158 //
159 virtual WW3DErrorType Save_Header (ChunkSaveClass &chunk_save);
160 virtual WW3DErrorType Save_Info (ChunkSaveClass &chunk_save);
162 virtual WW3DErrorType Save_Class_Info (ChunkSaveClass &chunk_save);
163
164 //
165 // Creation methods
166 //
167 virtual void Attach_Subobjects (RenderObjClass &base_model);
168
169 //
170 // Search methods
171 //
172 virtual RenderObjClass * Find_Subobject (RenderObjClass &model, const char mesh_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN], const char bone_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN]);
173
174 //
175 // Misc. methods
176 //
177 virtual void Free_Subobject_List (void);
178 virtual void Add_Subobject (const W3dAggregateSubobjectStruct &subobj_info);
179 virtual bool Load_Assets (const char *asset_name);
180 virtual RenderObjClass *Create_Render_Object (const char *passet_name);
181 virtual bool Is_Object_In_List (const char *passet_name, DynamicVectorClass <RenderObjClass *> &node_list);
182
183 virtual void Build_Subobject_List (RenderObjClass &original_model, RenderObjClass &model);
184
185
186 private:
187
189 //
190 // Private member data
191 //
192 DWORD m_Version;
195 W3dAggregateMiscInfo m_MiscInfo;
196 char * m_pName;
197};
198
199
201//
202// AggregatePrototypeClass
203//
205{
207 public:
208
210 //
211 // Public constructors/destructors
212 //
213 AggregatePrototypeClass (AggregateDefClass *pdef) { m_pDefinition = pdef; }
214
216 //
217 // Public methods
218 //
219 virtual const char * Get_Name(void) const { return m_pDefinition->Get_Name (); }
220 virtual int Get_Class_ID(void) const { return m_pDefinition->Class_ID (); }
221 virtual RenderObjClass * Create (void) { return m_pDefinition->Create (); }
222 virtual void DeleteSelf() { delete this; }
223 virtual AggregateDefClass * Get_Definition (void) const { return m_pDefinition; }
224 virtual void Set_Definition (AggregateDefClass *pdef) { m_pDefinition = pdef; }
225
226 protected:
227 virtual ~AggregatePrototypeClass (void) { delete m_pDefinition; }
228
229 private:
230
232 //
233 // Private member data
234 //
235 AggregateDefClass * m_pDefinition;
236};
237
238
240//
241// AggregateLoaderClass
242//
244{
245 public:
246
247 virtual int Chunk_Type (void) { return W3D_CHUNK_AGGREGATE; }
248 virtual PrototypeClass * Load_W3D (ChunkLoadClass &chunk_load);
249};
250
251
253//
254// Global variables
255//
257
258
259#endif //__AGGREGATE_DEF_H
const int MESH_PATH_ENTRIES
Definition w3d_file.h:1963
const int MESH_PATH_ENTRY_LEN
Definition w3d_file.h:1964
@ W3D_CHUNK_AGGREGATE
Definition w3d_file.h:459
#define W3DMPO_GLUE(ARGCLASS)
Definition always.h:120
#define W3DNEW
Definition always.h:109
unsigned long DWORD
Definition bittype.h:57
unsigned long ULONG
Definition bittype.h:64
AggregateLoaderClass _AggregateLoader
Definition agg_def.cpp:60
#define SAFE_FREE(pointer)
Definition agg_def.h:67
ULONG Class_ID(void) const
Definition agg_def.h:120
const AggregateDefClass & operator=(const AggregateDefClass &src)
Definition agg_def.cpp:137
virtual WW3DErrorType Read_Header(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:586
struct AggregateDefClass::_TEXTURE_INFO TEXTURE_INFO
virtual WW3DErrorType Save_Class_Info(ChunkSaveClass &chunk_save)
Definition agg_def.cpp:840
virtual RenderObjClass * Create_Render_Object(const char *passet_name)
Definition agg_def.cpp:316
virtual WW3DErrorType Save_Subobject(ChunkSaveClass &chunk_save, W3dAggregateSubobjectStruct *psubobject)
Definition agg_def.cpp:815
const char * Get_Name(void) const
Definition agg_def.h:112
virtual void Attach_Subobjects(RenderObjClass &base_model)
Definition agg_def.cpp:283
virtual void Free_Subobject_List(void)
Definition agg_def.cpp:180
virtual bool Load_Assets(const char *asset_name)
Definition agg_def.cpp:343
virtual void Add_Subobject(const W3dAggregateSubobjectStruct &subobj_info)
Definition agg_def.cpp:671
virtual void Build_Subobject_List(RenderObjClass &original_model, RenderObjClass &model)
Definition agg_def.cpp:421
virtual WW3DErrorType Read_Class_Info(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:689
virtual WW3DErrorType Save_Header(ChunkSaveClass &chunk_save)
Definition agg_def.cpp:743
AggregateDefClass(void)
Definition agg_def.cpp:67
void Set_Name(const char *pname)
Definition agg_def.h:113
AggregateDefClass * Clone(void) const
Definition agg_def.h:115
void Initialize(RenderObjClass &base_model)
Definition agg_def.cpp:380
virtual RenderObjClass * Find_Subobject(RenderObjClass &model, const char mesh_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN], const char bone_path[MESH_PATH_ENTRIES][MESH_PATH_ENTRY_LEN])
Definition agg_def.cpp:230
virtual WW3DErrorType Load_W3D(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:537
virtual ~AggregateDefClass(void)
Definition agg_def.cpp:117
virtual WW3DErrorType Save_Info(ChunkSaveClass &chunk_save)
Definition agg_def.cpp:777
virtual bool Is_Object_In_List(const char *passet_name, DynamicVectorClass< RenderObjClass * > &node_list)
Definition agg_def.cpp:507
virtual WW3DErrorType Save_W3D(ChunkSaveClass &chunk_save)
Definition agg_def.cpp:712
RenderObjClass * Create(void)
Definition agg_def.cpp:201
virtual WW3DErrorType Read_Info(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:613
virtual WW3DErrorType Read_Subobject(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:645
virtual PrototypeClass * Load_W3D(ChunkLoadClass &chunk_load)
Definition agg_def.cpp:869
virtual int Chunk_Type(void)
Definition agg_def.h:247
virtual AggregateDefClass * Get_Definition(void) const
Definition agg_def.h:223
virtual const char * Get_Name(void) const
Definition agg_def.h:219
virtual void DeleteSelf()
Definition agg_def.h:222
virtual ~AggregatePrototypeClass(void)
Definition agg_def.h:227
virtual RenderObjClass * Create(void)
Definition agg_def.h:221
virtual void Set_Definition(AggregateDefClass *pdef)
Definition agg_def.h:224
virtual int Get_Class_ID(void) const
Definition agg_def.h:220
AggregatePrototypeClass(AggregateDefClass *pdef)
Definition agg_def.h:213
PrototypeClass(void)
Definition proto.h:90
PrototypeLoaderClass(void)
Definition proto.h:139
IndirectTextureClass * pnew_texture
Definition agg_def.h:136
W3dTextureReplacerStruct names
Definition agg_def.h:135
bool operator==(_TEXTURE_INFO &src)
Definition agg_def.h:138
bool operator!=(_TEXTURE_INFO &src)
Definition agg_def.h:139
WW3DErrorType
Definition w3derr.h:51