Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
bpick.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/bpick.cpp 7 1/04/01 11:12a Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando Tools - WWSkin *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/bpick.cpp $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 1/04/01 11:12a $*
31 * *
32 * $Revision:: 7 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * BonePickerClass::Filter -- determine whether the passed node is suitable *
37 * BonePickerClass::HitTest -- MAX HitTest method *
38 * BonePickerClass::Pick -- MAX Pick method *
39 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
40
41
42#include "bpick.h"
43#include "dllmain.h"
44#include "resource.h"
45
46
47/*
48** Global instance of a bone picker :-)
49*/
51
52
53/***********************************************************************************************
54 * BonePickerClass::Filter -- determine whether the passed node is suitable *
55 * *
56 * INPUT: *
57 * *
58 * OUTPUT: *
59 * *
60 * WARNINGS: *
61 * *
62 * HISTORY: *
63 * 10/26/1997 GH : Created. *
64 *=============================================================================================*/
66{
67 if (BoneList == NULL) {
68 ObjectState os = node->EvalWorldState(0);
69 if (os.obj) {
70 return TRUE;
71 }
72
73 } else {
74 for (int i=0; i<BoneList->Count(); i++) {
75 if ((*BoneList)[i] == node) return TRUE;
76 }
77 }
78
79 return FALSE;
80}
81
82/***********************************************************************************************
83 * BonePickerClass::HitTest -- MAX HitTest method *
84 * *
85 * INPUT: *
86 * *
87 * OUTPUT: *
88 * *
89 * WARNINGS: *
90 * *
91 * HISTORY: *
92 * 10/26/1997 GH : Created. *
93 *=============================================================================================*/
94BOOL BonePickerClass::HitTest(IObjParam *ip,HWND hwnd,ViewExp *vpt,IPoint2 m,int flags)
95{
96 if (ip->PickNode(hwnd,m,GetFilter())) {
97 return TRUE;
98 } else {
99 return FALSE;
100 }
101}
102
103/***********************************************************************************************
104 * BonePickerClass::Pick -- MAX Pick method *
105 * *
106 * INPUT: *
107 * *
108 * OUTPUT: *
109 * *
110 * WARNINGS: *
111 * *
112 * HISTORY: *
113 * 10/26/1997 GH : Created. *
114 *=============================================================================================*/
115BOOL BonePickerClass::Pick(IObjParam *ip,ViewExp *vpt)
116{
117 INode *node = vpt->GetClosestHit();
118
119 if (node) {
120
121 /*
122 ** Tell the "owning" skin modifier about the
123 ** bone which was picked.
124 */
125 assert(User);
126 User->User_Picked_Bone(node);
127 User = NULL;
128 BoneList = NULL;
129 }
130
131 return TRUE;
132}
133
135{
136 return Filter(inode);
137}
138
139void BonePickerClass::proc(INodeTab & nodetab)
140{
141 assert(User != NULL);
142 User->User_Picked_Bones(nodetab);
143 User = NULL;
144 BoneList = NULL;
145}
146
151
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
#define IDS_PICK_BONE_BUTTON_TEXT
Definition resource.h:400
#define IDS_PICK_BONE_DIALOG_TITLE
Definition resource.h:399
#define BOOL
Definition Wnd_File.h:57
BonePickerClass TheBonePicker
Definition bpick.cpp:50
BOOL Pick(IObjParam *ip, ViewExp *vpt)
Definition bpick.cpp:115
BOOL HitTest(IObjParam *ip, HWND hWnd, ViewExp *vpt, IPoint2 m, int flags)
Definition bpick.cpp:94
virtual TCHAR * buttonText(void)
Definition bpick.cpp:152
virtual TCHAR * dialogTitle(void)
Definition bpick.cpp:147
virtual BOOL filter(INode *inode)
Definition bpick.cpp:134
virtual void proc(INodeTab &nodeTab)
Definition bpick.cpp:139
BOOL Filter(INode *node)
Definition bpick.cpp:65
PickNodeCallback * GetFilter()
Definition bpick.h:91
BonePickerUserClass * User
Definition bpick.h:112
INodeTab * BoneList
Definition bpick.h:118
TCHAR * Get_String(int id)
Definition dllmain.cpp:198