Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
util.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/* $Header: /Commando/Code/Tools/max2w3d/util.h 25 10/27/00 4:11p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/util.h $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 10/27/00 10:24a $*
31 * *
32 * $Revision:: 25 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38
39#ifndef UTIL_H
40#define UTIL_H
41
42#ifndef ALWAYS_H
43#include "always.h"
44#endif
45
46#include <Max.h>
47
48#include "skin.h"
49#include "nodelist.h"
50
51
52/*
53** Gets rid of very small numbers in the matrix
54** (sets them to zero).
55*/
57
58/*
59** Naming utility functions
60*/
61void Set_W3D_Name(char * set_name,const char * src);
62void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * set_exten_index);
63bool Append_Lod_Character(char *meshname, int lod_level, INodeListClass *origin_list);
64
65/*
66** File path utility functions
67*/
68void Create_Full_Path(char *full_path, const char *cwd, const char *rel_path);
69void Create_Relative_Path(char *rel_path, const char *cwd, const char *full_path);
70bool Is_Full_Path(char * path);
71
72/*
73** Check if this is some kind of triangle mesh inside of MAX. We will assume
74** different default export behavior depending on whether the object is a
75** triangle mesh or not.
76*/
77bool Is_Max_Tri_Mesh(INode * node);
78
79
80/*
81** Origin support.
82*/
83bool Is_Origin(INode *node);
84bool Is_Base_Origin(INode *node);
85INode *Find_Origin(INode *node);
86
87bool Is_Damage_Root(INode *node);
88
89/*
90** Lod-Level and Damage State settings for an INode
91*/
92int Get_Lod_Level(INode *node);
93int Get_Damage_State(INode *node);
94
95/*
96** Utility function to find a named node in a hierarchy.
97*/
98INode *Find_Named_Node (char *nodename, INode *root);
99
100
101/*
102** Macros
103*/
104#define SAFE_DELETE(pobject) \
105 if (pobject) { \
106 delete pobject; \
107 pobject = NULL; \
108 } \
109
110#define SAFE_DELETE_ARRAY(pobject) \
111 if (pobject) { \
112 delete [] pobject; \
113 pobject = NULL; \
114 } \
115
116
117#endif
bool Is_Base_Origin(INode *node)
Definition util.cpp:535
int Get_Lod_Level(INode *node)
Definition util.cpp:563
void Split_Node_Name(const char *name, char *set_base, char *set_exten, int *set_exten_index)
Definition util.cpp:142
Matrix3 Cleanup_Orthogonal_Matrix(Matrix3 &mat)
Definition util.cpp:79
void Create_Relative_Path(char *rel_path, const char *cwd, const char *full_path)
Definition util.cpp:285
void Set_W3D_Name(char *set_name, const char *src)
Definition util.cpp:112
bool Is_Full_Path(char *path)
Definition util.cpp:410
INode * Find_Named_Node(char *nodename, INode *root)
Definition util.cpp:584
bool Is_Damage_Root(INode *node)
Definition util.cpp:453
bool Is_Origin(INode *node)
Definition util.cpp:495
bool Is_Max_Tri_Mesh(INode *node)
Definition util.cpp:441
void Create_Full_Path(char *full_path, const char *cwd, const char *rel_path)
Definition util.cpp:251
bool Append_Lod_Character(char *meshname, int lod_level, INodeListClass *origin_list)
Definition util.cpp:188
int Get_Damage_State(INode *node)
Definition util.cpp:574
INode * Find_Origin(INode *node)