Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
rcmenu.cpp
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/rcmenu.cpp 6 4/19/00 12:24p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - W3D export *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/rcmenu.cpp $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 4/18/00 8:26p $*
31 * *
32 * $Revision:: 6 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * RCMenuClass::Init -- initialize the "right-click" menu *
37 * RCMenuClass::Selected -- menu selection callback *
38 * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
39 * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
40 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41
42
43#include "rcmenu.h"
44#include "w3dutil.h"
45#include "util.h"
46
47
49
50/***********************************************************************************************
51 * RCMenuClass::Init -- initialize the "right-click" menu *
52 * *
53 * INPUT: *
54 * *
55 * OUTPUT: *
56 * *
57 * WARNINGS: *
58 * *
59 * HISTORY: *
60 * 10/26/1997 GH : Created. *
61 *=============================================================================================*/
62void RCMenuClass::Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m)
63{
65
66 SelNode = InterfacePtr->PickNode(hWnd,m);
67
68 if (SelNode) {
69
70 UINT menuflags;
72
73 /*
74 ** Add the menu separator
75 */
76 manager->AddMenu(this, MF_SEPARATOR, MENU_SEPARATOR, NULL);
77
78 /*
79 ** Add the Name of the object
80 */
81 char string[64];
82 sprintf(string,"%s:",SelNode->GetName());
83 manager->AddMenu(this, MF_STRING | MF_DISABLED, MENU_NODE_NAME, string);
84
85 /*
86 ** Add the pointer
87 */
88// sprintf(string,"0x%X",(unsigned long)SelNode);
89// manager->AddMenu(this, MF_STRING | MF_GRAYED, MENU_NODE_POINTER, string);
90
91 /*
92 ** Add the hierarchy menu option
93 */
94 if (wdata->Is_Bone()) {
95 menuflags = MF_STRING | MF_CHECKED;
96 } else {
97 menuflags = MF_STRING;
98 }
99 manager->AddMenu(this, menuflags, MENU_TOGGLE_HIERARCHY, "W3D: Export Hierarchy");
100
101 /*
102 ** Add the geometry menu option
103 */
104 if (wdata->Is_Geometry()) {
105 menuflags = MF_STRING | MF_CHECKED;
106 } else {
107 menuflags = MF_STRING;
108 }
109 manager->AddMenu(this, menuflags, MENU_TOGGLE_GEOMETRY, "W3D: Export Geometry");
110
111 }
112}
113
114/***********************************************************************************************
115 * RCMenuClass::Selected -- menu selection callback *
116 * *
117 * INPUT: *
118 * *
119 * OUTPUT: *
120 * *
121 * WARNINGS: *
122 * *
123 * HISTORY: *
124 * 10/26/1997 GH : Created. *
125 *=============================================================================================*/
127{
128 switch (id) {
129
130 case MENU_TOGGLE_HIERARCHY:
131 Toggle_Hierarchy(SelNode);
132 break;
133 case MENU_TOGGLE_GEOMETRY:
134 Toggle_Geometry(SelNode);
135 break;
136
137 }
138}
139
140/***********************************************************************************************
141 * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
142 * *
143 * INPUT: *
144 * *
145 * OUTPUT: *
146 * *
147 * WARNINGS: *
148 * *
149 * HISTORY: *
150 * 10/26/1997 GH : Created. *
151 *=============================================================================================*/
153{
154
156 assert(wdata);
157
158 if (wdata->Is_Bone()) {
159 wdata->Enable_Export_Transform(false);
160 } else {
161 wdata->Enable_Export_Transform(true);
162 }
163}
164
165/***********************************************************************************************
166 * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
167 * *
168 * INPUT: *
169 * *
170 * OUTPUT: *
171 * *
172 * WARNINGS: *
173 * *
174 * HISTORY: *
175 * 10/26/1997 GH : Created. *
176 *=============================================================================================*/
178{
180 assert(wdata);
181
182 if (wdata->Is_Geometry()) {
183 wdata->Enable_Export_Geometry(false);
184 } else {
185 wdata->Enable_Export_Geometry(true);
186 }
187}
188
189
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
unsigned int UINT
Definition bittype.h:63
BOOL Installed
Definition rcmenu.h:70
void Toggle_Hierarchy(INode *node)
Definition rcmenu.cpp:152
void Init(RightClickMenuManager *manager, HWND hWnd, IPoint2 m)
Definition rcmenu.cpp:62
void Toggle_Geometry(INode *node)
Definition rcmenu.cpp:177
void Selected(UINT id)
Definition rcmenu.cpp:126
RCMenuClass TheRCMenu
Definition rcmenu.cpp:48
void Enable_Export_Transform(bool onoff)
Definition w3dappdata.h:307
void Enable_Export_Geometry(bool onoff)
Definition w3dappdata.h:308
bool Is_Bone(void) const
Definition w3dappdata.h:278
bool Is_Geometry(void) const
Definition w3dappdata.h:279
static W3DAppData2Struct * Get_App_Data(INode *node, bool create_if_missing=true)