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
*/
50
BonePickerClass
TheBonePicker
;
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
*=============================================================================================*/
65
BOOL
BonePickerClass::Filter
(INode *node)
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
*=============================================================================================*/
94
BOOL
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
*=============================================================================================*/
115
BOOL
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
134
BOOL
BonePickerClass::filter
(INode * inode)
135
{
136
return
Filter
(inode);
137
}
138
139
void
BonePickerClass::proc
(INodeTab & nodetab)
140
{
141
assert(
User
!=
NULL
);
142
User
->User_Picked_Bones(nodetab);
143
User
=
NULL
;
144
BoneList
=
NULL
;
145
}
146
147
TCHAR *
BonePickerClass::dialogTitle
(
void
)
148
{
149
return
Get_String
(
IDS_PICK_BONE_DIALOG_TITLE
);
150
}
151
152
TCHAR *
BonePickerClass::buttonText
(
void
)
153
{
154
return
Get_String
(
IDS_PICK_BONE_BUTTON_TEXT
);
155
}
NULL
#define NULL
Definition
BaseType.h:92
TRUE
#define TRUE
Definition
BaseType.h:109
FALSE
#define FALSE
Definition
BaseType.h:113
resource.h
IDS_PICK_BONE_BUTTON_TEXT
#define IDS_PICK_BONE_BUTTON_TEXT
Definition
resource.h:400
IDS_PICK_BONE_DIALOG_TITLE
#define IDS_PICK_BONE_DIALOG_TITLE
Definition
resource.h:399
BOOL
#define BOOL
Definition
Wnd_File.h:57
TheBonePicker
BonePickerClass TheBonePicker
Definition
bpick.cpp:50
bpick.h
BonePickerClass
Definition
bpick.h:65
BonePickerClass::Pick
BOOL Pick(IObjParam *ip, ViewExp *vpt)
Definition
bpick.cpp:115
BonePickerClass::HitTest
BOOL HitTest(IObjParam *ip, HWND hWnd, ViewExp *vpt, IPoint2 m, int flags)
Definition
bpick.cpp:94
BonePickerClass::buttonText
virtual TCHAR * buttonText(void)
Definition
bpick.cpp:152
BonePickerClass::dialogTitle
virtual TCHAR * dialogTitle(void)
Definition
bpick.cpp:147
BonePickerClass::filter
virtual BOOL filter(INode *inode)
Definition
bpick.cpp:134
BonePickerClass::proc
virtual void proc(INodeTab &nodeTab)
Definition
bpick.cpp:139
BonePickerClass::Filter
BOOL Filter(INode *node)
Definition
bpick.cpp:65
BonePickerClass::GetFilter
PickNodeCallback * GetFilter()
Definition
bpick.h:91
BonePickerClass::User
BonePickerUserClass * User
Definition
bpick.h:112
BonePickerClass::BoneList
INodeTab * BoneList
Definition
bpick.h:118
Get_String
TCHAR * Get_String(int id)
Definition
dllmain.cpp:198
dllmain.h
Code
Tools
WW3D
max2w3d
bpick.cpp
Generated by
1.13.2