Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
gmtldlg.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/gmtldlg.cpp 18 5/27/98 8:34a Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando / G 3D engine *
25 * *
26 * File Name : GMTLDLG.CPP *
27 * *
28 * Programmer : Greg Hjelstrom *
29 * *
30 * Start Date : 06/26/97 *
31 * *
32 * Last Update : June 26, 1997 [GH] *
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * GameMtlDlg::GameMtlDlg -- constructor *
37 * GameMtlDlg::~GameMtlDlg -- destructor! *
38 * GameMtlDlg::ClassID -- Returns the ClassID of GameMtl *
39 * GameMtlDlg::Invalidate -- causes the dialog to be redrawn *
40 * GameMtlDlg::ReloadDialog -- Updates the values in all of the dialog's controls *
41 * GameMtlDlg::SetTime -- Sets the time value, updates the material and the dialog *
42 * GameMtlDlg::PanelProc -- Windows Message handler *
43 * PanelDlgProc -- Windows Proc which thunks into GameMtlDlg::PanelProc *
44 * GameMtlDlg::LoadDialog -- Sets the state of all of the dialog's controls *
45 * GameMtlDlg::UpdateMtlDisplay -- Informs MAX that the material parameters have changed *
46 * GameMtlDlg::ActivateDlg -- Activates and deactivates the dialog *
47 * GameMtlDlg::SetThing -- Sets the material to be edited *
48 * GameMtlDlg::BuildDialog -- Adds the dialog to the material editor *
49 * GameMtlDlg::UpdateTexmapDisplay -- Updates the texture map buttons *
50 * NotesDlgProc -- Dialog Proc which thunks to GameMtlDlg::NotesProc *
51 * GameMtlDlg::NotesProc -- Dialog Proc for the Notes panel *
52 * HintsDlgProc -- Dialog proc which thunks to GameMtlDlg::HintsProc *
53 * GameMtlDlg::HintsProc -- Dialog Proc for the hints panel *
54 * GameMtlDlg::PsxProc -- Dialog proc for the PSX options panel *
55 * PsxDlgProc -- Dialog proc which thunks into GameMtlDlg::PsxProc *
56 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
57
58#include <Max.h>
59#include <gport.h>
60#include <hsv.h>
61#include <bmmlib.h>
62
63#include "gmtldlg.h"
64#include "gamemtl.h"
65#include "gamemaps.h"
66#include "dllmain.h"
67#include "resource.h"
68#include "w3d_file.h"
69
70
71
72static inline float PcToFrac(int pc)
73{
74 return (float)pc/100.0f;
75}
76
77static inline int FracToPc(float f)
78{
79 if (f<0.0) return (int)(100.0f*f - .5f);
80 else return (int) (100.0f*f + .5f);
81}
82
83
84/***********************************************************************************************
85 * GameMtlDlg::GameMtlDlg -- constructor *
86 * *
87 * INPUT: *
88 * hwMtlEdit - windows handle of the MAX material editor *
89 * imp - Interface object for MAX materials and textures *
90 * m - pointer to a GameMtl to be edited *
91 * *
92 * OUTPUT: *
93 * *
94 * WARNINGS: *
95 * *
96 * HISTORY: *
97 * 06/26/1997 GH : Created. *
98 *=============================================================================================*/
99GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m)
100{
101 HwndEdit = hwMtlEdit;
102 HwndPanel = NULL;
103 HwndHints = NULL;
104 HwndPsx = NULL;
105 HwndNotes = NULL;
106 HpalOld = NULL;
107
108 TheMtl = m;
109 IParams = imp;
110 Valid = FALSE;
111 IsActive = 0;
112 InstCopy = FALSE;
113
114 DiffuseSwatch = NULL;
115 SpecularSwatch = NULL;
116
117 AmbientCoeffSwatch = NULL;
118 DiffuseCoeffSwatch = NULL;
119 SpecularCoeffSwatch = NULL;
120 EmissiveCoeffSwatch = NULL;
121
122 DCTFramesSpin = NULL;
123 DITFramesSpin = NULL;
124 SCTFramesSpin = NULL;
125 SITFramesSpin = NULL;
126
127 DCTRateSpin = NULL;
128 DITRateSpin = NULL;
129 SCTRateSpin = NULL;
130 SITRateSpin = NULL;
131
132 OpacitySpin = NULL;
133 TranslucencySpin = NULL;
134 ShininessSpin = NULL;
135 FogSpin = NULL;
136}
137
138/***********************************************************************************************
139 * GameMtlDlg::~GameMtlDlg -- destructor! *
140 * *
141 * INPUT: *
142 * *
143 * OUTPUT: *
144 * *
145 * WARNINGS: *
146 * *
147 * HISTORY: *
148 * 06/26/1997 GH : Created. *
149 *=============================================================================================*/
151{
152 if (DiffuseSwatch) {
153 ReleaseIColorSwatch(DiffuseSwatch);
154 DiffuseSwatch = NULL;
155 }
156
157 if (SpecularSwatch) {
158 ReleaseIColorSwatch(SpecularSwatch);
159 SpecularSwatch = NULL;
160 }
161
162 if (AmbientCoeffSwatch) {
163 ReleaseIColorSwatch(AmbientCoeffSwatch);
164 AmbientCoeffSwatch = NULL;
165 }
166
167 if (DiffuseCoeffSwatch) {
168 ReleaseIColorSwatch(DiffuseCoeffSwatch);
169 DiffuseCoeffSwatch = NULL;
170 }
171
172 if (SpecularCoeffSwatch) {
173 ReleaseIColorSwatch(SpecularCoeffSwatch);
174 SpecularCoeffSwatch = NULL;
175 }
176
177 if (EmissiveCoeffSwatch) {
178 ReleaseIColorSwatch(EmissiveCoeffSwatch);
179 EmissiveCoeffSwatch = NULL;
180 }
181
182 if (HwndPanel) {
183 HDC hdc = GetDC(HwndPanel);
184 GetGPort()->RestorePalette(hdc, HpalOld);
185 ReleaseDC(HwndPanel,hdc);
186 }
187
188 TheMtl->SetFlag(GAMEMTL_ROLLUP1_OPEN,IParams->IsRollupPanelOpen(HwndPanel));
189 TheMtl->SetFlag(GAMEMTL_ROLLUP2_OPEN,IParams->IsRollupPanelOpen(HwndPsx));
190 TheMtl->SetFlag(GAMEMTL_ROLLUP3_OPEN,IParams->IsRollupPanelOpen(HwndHints));
191 TheMtl->SetFlag(GAMEMTL_ROLLUP4_OPEN,IParams->IsRollupPanelOpen(HwndNotes));
192 TheMtl->RollScroll = IParams->GetRollupScrollPos();
193 TheMtl->SetParamDlg(NULL);
194
195 IParams->UnRegisterDlgWnd(HwndPanel);
196 IParams->DeleteRollupPage(HwndPanel);
197 HwndPanel = NULL;
198
199 IParams->UnRegisterDlgWnd(HwndPsx);
200 IParams->DeleteRollupPage(HwndPsx);
201 HwndPsx = NULL;
202
203 IParams->UnRegisterDlgWnd(HwndHints);
204 IParams->DeleteRollupPage(HwndHints);
205 HwndHints = NULL;
206
207 IParams->UnRegisterDlgWnd(HwndNotes);
208 IParams->DeleteRollupPage(HwndNotes);
209 HwndNotes = NULL;
210}
211
212
213/***********************************************************************************************
214 * GameMtlDlg::ClassID -- Returns the ClassID of GameMtl *
215 * *
216 * INPUT: *
217 * *
218 * OUTPUT: *
219 * *
220 * WARNINGS: *
221 * *
222 * HISTORY: *
223 * 06/26/1997 GH : Created. *
224 *=============================================================================================*/
225Class_ID GameMtlDlg::ClassID()
226{
227 return GameMaterialClassID;
228}
229
230/***********************************************************************************************
231 * GameMtlDlg::Invalidate -- causes the dialog to be redrawn *
232 * *
233 * INPUT: *
234 * *
235 * OUTPUT: *
236 * *
237 * WARNINGS: *
238 * *
239 * HISTORY: *
240 * 06/26/1997 GH : Created. *
241 *=============================================================================================*/
243{
244 Valid = FALSE;
245 InvalidateRect(HwndPanel,NULL,0);
246 InvalidateRect(HwndPsx,NULL,0);
247 InvalidateRect(HwndHints,NULL,0);
248 InvalidateRect(HwndNotes,NULL,0);
249}
250
251/***********************************************************************************************
252 * GameMtlDlg::ReloadDialog -- Updates the values in all of the dialog's controls *
253 * *
254 * INPUT: *
255 * *
256 * OUTPUT: *
257 * *
258 * WARNINGS: *
259 * *
260 * HISTORY: *
261 * 06/26/1997 GH : Created. *
262 *=============================================================================================*/
264{
265 Interval v;
266 TheMtl->Update(IParams->GetTime(),v);
267 LoadDialog(FALSE);
268}
269
270/***********************************************************************************************
271 * GameMtlDlg::SetTime -- Sets the time value, updates the material and the dialog *
272 * *
273 * INPUT: *
274 * *
275 * OUTPUT: *
276 * *
277 * WARNINGS: *
278 * *
279 * HISTORY: *
280 * 06/26/1997 GH : Created. *
281 *=============================================================================================*/
282void GameMtlDlg::SetTime(TimeValue t)
283{
284 if (t!=CurTime) {
285 CurTime = t;
286 Interval v;
287 TheMtl->Update(IParams->GetTime(),v);
288 LoadDialog(TRUE);
289 }
290}
291
292
293/***********************************************************************************************
294 * GameMtlDlg::PanelProc -- Windows Message handler *
295 * *
296 * INPUT: *
297 * *
298 * OUTPUT: *
299 * *
300 * WARNINGS: *
301 * *
302 * HISTORY: *
303 * 06/26/1997 GH : Created. *
304 *=============================================================================================*/
305BOOL GameMtlDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
306{
307 int id = LOWORD(wParam);
308 int code = HIWORD(wParam);
309 int mtype;
310
311 switch (msg) {
312
313 case WM_INITDIALOG:
314 {
315 HDC theHDC = GetDC(hwndDlg);
316 HpalOld = GetGPort()->PlugPalette(theHDC);
317 ReleaseDC(hwndDlg,theHDC);
318
319 DiffuseSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_DIFFUSE_COLOR),TheMtl->GetDiffuse(),Get_String(IDS_DIFFUSE_COLOR));
320 SpecularSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_SPECULAR_COLOR),TheMtl->GetSpecular(),Get_String(IDS_SPECULAR_COLOR));
321
322 AmbientCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_AMBIENT_COEFF),TheMtl->GetAmbientCoeff(),Get_String(IDS_AMBIENT_COEFF));
323 DiffuseCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_DIFFUSE_COEFF),TheMtl->GetDiffuseCoeff(),Get_String(IDS_DIFFUSE_COEFF));
324 SpecularCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_SPECULAR_COEFF),TheMtl->GetSpecularCoeff(),Get_String(IDS_SPECULAR_COEFF));
325 EmissiveCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_EMISSIVE_COEFF),TheMtl->GetEmissiveCoeff(),Get_String(IDS_EMISSIVE_COEFF));
326
327 DCTFramesSpin = SetupIntSpinner(hwndDlg,IDC_DCT_FRAMES_SPIN,IDC_DCT_FRAMES_EDIT,1,999,TheMtl->DCTFrames);
328 DITFramesSpin = SetupIntSpinner(hwndDlg,IDC_DIT_FRAMES_SPIN,IDC_DIT_FRAMES_EDIT,1,999,TheMtl->DITFrames);
329 SCTFramesSpin = SetupIntSpinner(hwndDlg,IDC_SCT_FRAMES_SPIN,IDC_SCT_FRAMES_EDIT,1,999,TheMtl->SCTFrames);
330 SITFramesSpin = SetupIntSpinner(hwndDlg,IDC_SIT_FRAMES_SPIN,IDC_SIT_FRAMES_EDIT,1,999,TheMtl->SITFrames);
331
332 DCTRateSpin = SetupFloatSpinner(hwndDlg,IDC_DCT_RATE_SPIN,IDC_DCT_RATE_EDIT,0.0f,60.0f,TheMtl->DCTFrameRate,5.0f);
333 DITRateSpin = SetupFloatSpinner(hwndDlg,IDC_DIT_RATE_SPIN,IDC_DIT_RATE_EDIT,0.0f,60.0f,TheMtl->DITFrameRate,5.0f);
334 SCTRateSpin = SetupFloatSpinner(hwndDlg,IDC_SCT_RATE_SPIN,IDC_SCT_RATE_EDIT,0.0f,60.0f,TheMtl->SCTFrameRate,5.0f);
335 SITRateSpin = SetupFloatSpinner(hwndDlg,IDC_SIT_RATE_SPIN,IDC_SIT_RATE_EDIT,0.0f,60.0f,TheMtl->SITFrameRate,5.0f);
336
337 OpacitySpin = SetupFloatSpinner(hwndDlg,IDC_OPACITY_SPIN,IDC_OPACITY_EDIT,0.0f,1.0f,TheMtl->GetOpacity(),0.01f);
338 TranslucencySpin = SetupFloatSpinner(hwndDlg,IDC_TRANSLUCENCY_SPIN,IDC_TRANSULCENCY_EDIT,0.0f,1.0f,TheMtl->GetTranslucency(),0.01f);
339 ShininessSpin = SetupFloatSpinner(hwndDlg,IDC_SHININESS_SPIN,IDC_SHININESS_EDIT,1.0f,1000.0f,TheMtl->GetShininess(),1.0f);
340 FogSpin = SetupFloatSpinner(hwndDlg,IDC_FOG_SPIN,IDC_FOG_EDIT,0.0f,1.0f,TheMtl->FogCoeff,0.01f);
341
342 SendDlgItemMessage( hwndDlg, IDC_DCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
343 SendDlgItemMessage( hwndDlg, IDC_DCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
344
345 SendDlgItemMessage( hwndDlg, IDC_DIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
346 SendDlgItemMessage( hwndDlg, IDC_DIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
347
348 SendDlgItemMessage( hwndDlg, IDC_SCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
349 SendDlgItemMessage( hwndDlg, IDC_SCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
350
351 SendDlgItemMessage( hwndDlg, IDC_SIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
352 SendDlgItemMessage( hwndDlg, IDC_SIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
353
354 /* Installing a windproc for texmap buttons which will handle drag-n-drop
355 HWND hw = GetDlgItem(hwndDlg, texMapID[i]);
356 WNDPROC oldp = (WNDPROC)GetWindowLong(hw, GWL_WNDPROC);
357 SetWindowLong( hw, GWL_WNDPROC, (LONG)TexSlotWndProc);
358 SetWindowLong( hw, GWL_USERDATA, (LONG)oldp);
359 */
360
361 return TRUE;
362 }
363 break;
364
365 case WM_COMMAND:
366 {
367 switch (id) {
368
369 case IDC_DCT_BUTTON:
370 {
371 BitmapInfo bmi;
372 BitmapTex * texture;
373
374 if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
375 texture = NewDefaultBitmapTex();
376 if (texture) {
377 texture->SetMapName((char *)bmi.Name());
378 TheMtl->SetSubTexmap(ID_DI,texture);
379 UpdateMtlDisplay();
380 TheMtl->NotifyChanged();
381 }
382 }
383 }
384 break;
385
386 case IDC_DIT_BUTTON:
387 {
388 BitmapInfo bmi;
389 BitmapTex * texture;
390
391 if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
392 texture = NewDefaultBitmapTex();
393 if (texture) {
394 texture->SetMapName((char *)bmi.Name());
395 TheMtl->SetSubTexmap(ID_SI,texture);
396 UpdateMtlDisplay();
397 TheMtl->NotifyChanged();
398 }
399 }
400 }
401 break;
402
403 case IDC_SCT_BUTTON:
404 {
405 BitmapInfo bmi;
406 BitmapTex * texture;
407
408 if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
409 texture = NewDefaultBitmapTex();
410 if (texture) {
411 texture->SetMapName((char *)bmi.Name());
412 TheMtl->SetSubTexmap(ID_SP,texture);
413 UpdateMtlDisplay();
414 TheMtl->NotifyChanged();
415 }
416 }
417 }
418 break;
419
420 case IDC_SIT_BUTTON:
421 {
422 BitmapInfo bmi;
423 BitmapTex * texture;
424
425 if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
426 texture = NewDefaultBitmapTex();
427 if (texture) {
428 texture->SetMapName((char *)bmi.Name());
429 TheMtl->SetSubTexmap(ID_RL,texture);
430 UpdateMtlDisplay();
431 TheMtl->NotifyChanged();
432 }
433 }
434 }
435 break;
436
437 case IDC_MAPON_DCT:
438 TheMtl->EnableMap(ID_DI,GetCheckBox(hwndDlg, id));
439 if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_DI,NULL);
440 UpdateTexmapDisplay(ID_DI);
441 UpdateMtlDisplay();
442 TheMtl->NotifyChanged();
443 break;
444 case IDC_MAPON_DIT:
445 TheMtl->EnableMap(ID_SI,GetCheckBox(hwndDlg, id));
446 if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SI,NULL);
447 UpdateTexmapDisplay(ID_SI);
448 UpdateMtlDisplay();
449 TheMtl->NotifyChanged();
450 break;
451 case IDC_MAPON_SCT:
452 TheMtl->EnableMap(ID_SP,GetCheckBox(hwndDlg, id));
453 if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SP,NULL);
454 UpdateTexmapDisplay(ID_SP);
455 UpdateMtlDisplay();
456 TheMtl->NotifyChanged();
457 break;
458 case IDC_MAPON_SIT:
459 TheMtl->EnableMap(ID_RL,GetCheckBox(hwndDlg, id));
460 if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_RL,NULL);
461 UpdateTexmapDisplay(ID_RL);
462 UpdateMtlDisplay();
463 TheMtl->NotifyChanged();
464 break;
466 TheMtl->SetAttribute(GAMEMTL_USE_ALPHA,GetCheckBox(hwndDlg,IDC_USE_ALPHA_CHECK));
467 UpdateMtlDisplay();
468 TheMtl->NotifyChanged();
469 break;
471 TheMtl->SetAttribute(GAMEMTL_USE_SORTING,GetCheckBox(hwndDlg,IDC_USE_SORTING_CHECK));
472 break;
474 mtype = SendDlgItemMessage(hwndDlg,IDC_DCT_MAPPING_COMBO,CB_GETCURSEL,0,0);
475 TheMtl->DCTMappingType = mtype;
476 break;
478 mtype = SendDlgItemMessage(hwndDlg,IDC_DIT_MAPPING_COMBO,CB_GETCURSEL,0,0);
479 TheMtl->DITMappingType = mtype;
480 break;
482 mtype = SendDlgItemMessage(hwndDlg,IDC_SCT_MAPPING_COMBO,CB_GETCURSEL,0,0);
483 TheMtl->SCTMappingType = mtype;
484 break;
486 mtype = SendDlgItemMessage(hwndDlg,IDC_SIT_MAPPING_COMBO,CB_GETCURSEL,0,0);
487 TheMtl->SITMappingType = mtype;
488 break;
490 TheMtl->Set_Viewport_Display_Status(GetCheckBox(hwndDlg,IDC_VIEWPORT_DISPLAY_CHECK));
491 TheMtl->NotifyChanged();
492 UpdateMtlDisplay();
493 break;
494 }
495 }
496 break;
497
498 case CC_COLOR_CHANGE:
499 {
500 // just update all of the colors
501 TheMtl->Diffuse = DiffuseSwatch->GetColor();
502 TheMtl->Specular = SpecularSwatch->GetColor();
503 TheMtl->AmbientCoeff = AmbientCoeffSwatch->GetColor();
504 TheMtl->DiffuseCoeff = DiffuseCoeffSwatch->GetColor();
505 TheMtl->SpecularCoeff = SpecularCoeffSwatch->GetColor();
506 TheMtl->EmissiveCoeff = EmissiveCoeffSwatch->GetColor();
507
508 TheMtl->NotifyChanged();
509 UpdateMtlDisplay();
510 }
511 break;
512
513 case WM_LBUTTONDOWN:
514 case WM_LBUTTONUP:
515 case WM_MOUSEMOVE:
516 {
517 IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
518 }
519 return FALSE;
520
521 case CC_SPINNER_CHANGE:
522 {
523 TheMtl->DCTFrames = DCTFramesSpin->GetIVal();
524 TheMtl->DITFrames = DITFramesSpin->GetIVal();
525 TheMtl->SCTFrames = SCTFramesSpin->GetIVal();
526 TheMtl->SITFrames = SITFramesSpin->GetIVal();
527
528 TheMtl->DCTFrameRate = DCTRateSpin->GetFVal();
529 TheMtl->DITFrameRate = DITRateSpin->GetFVal();
530 TheMtl->SCTFrameRate = SCTRateSpin->GetFVal();
531 TheMtl->SITFrameRate = SITRateSpin->GetFVal();
532
533 TheMtl->SetOpacity(OpacitySpin->GetFVal());
534 TheMtl->SetTranslucency(TranslucencySpin->GetFVal());
535 TheMtl->SetShininess(ShininessSpin->GetFVal());
536 TheMtl->FogCoeff = FogSpin->GetFVal();
537
538 TheMtl->NotifyChanged();
539 UpdateMtlDisplay();
540 }
541 break;
542
543 case CC_SPINNER_BUTTONUP:
544 {
545 #if 0
546 UpdateMtlDisplay();
547 #endif
548 }
549 break;
550
551 case WM_PAINT:
552 {
553 if (!Valid) {
554 Valid = TRUE;
555 ReloadDialog();
556 }
557 }
558 return FALSE;
559
560 case WM_CLOSE:
561 break;
562
563 case WM_DESTROY:
564
565 TheMtl->DCTFrames = DCTFramesSpin->GetIVal();
566 TheMtl->DITFrames = DITFramesSpin->GetIVal();
567 TheMtl->SCTFrames = SCTFramesSpin->GetIVal();
568 TheMtl->SITFrames = SITFramesSpin->GetIVal();
569
570 TheMtl->DCTFrameRate = DCTRateSpin->GetFVal();
571 TheMtl->DITFrameRate = DITRateSpin->GetFVal();
572 TheMtl->SCTFrameRate = SCTRateSpin->GetFVal();
573 TheMtl->SITFrameRate = SITRateSpin->GetFVal();
574
575 TheMtl->SetOpacity(OpacitySpin->GetFVal());
576 TheMtl->SetTranslucency(TranslucencySpin->GetFVal());
577 TheMtl->SetShininess(ShininessSpin->GetFVal());
578 TheMtl->FogCoeff = FogSpin->GetFVal();
579
580 ReleaseISpinner(DCTFramesSpin);
581 ReleaseISpinner(DITFramesSpin);
582 ReleaseISpinner(SCTFramesSpin);
583 ReleaseISpinner(SITFramesSpin);
584 ReleaseISpinner(DCTRateSpin);
585 ReleaseISpinner(DITRateSpin);
586 ReleaseISpinner(SCTRateSpin);
587 ReleaseISpinner(SITRateSpin);
588 ReleaseISpinner(OpacitySpin);
589 ReleaseISpinner(TranslucencySpin);
590 ReleaseISpinner(ShininessSpin);
591 ReleaseISpinner(FogSpin);
592
593 DCTFramesSpin = DITFramesSpin = SCTFramesSpin = SITFramesSpin = NULL;
594 DCTRateSpin = DITRateSpin = SCTRateSpin = SITRateSpin = NULL;
595 OpacitySpin = TranslucencySpin = ShininessSpin = FogSpin = NULL;
596
597 break;
598
599 }
600
601 return FALSE;
602}
603
604
605/***********************************************************************************************
606 * PanelDlgProc -- Windows Proc which thunks into GameMtlDlg::PanelProc *
607 * *
608 * INPUT: *
609 * *
610 * OUTPUT: *
611 * *
612 * WARNINGS: *
613 * *
614 * HISTORY: *
615 * 06/26/1997 GH : Created. *
616 *=============================================================================================*/
617static BOOL CALLBACK PanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
618{
619 GameMtlDlg *theDlg;
620
621 if (msg==WM_INITDIALOG) {
622 theDlg = (GameMtlDlg*)lParam;
623 theDlg->HwndPanel = hwndDlg;
624 SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
625 } else {
626 if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
627 return FALSE;
628 }
629 }
630
631 BOOL res;
632 theDlg->IsActive = 1;
633 res = theDlg->PanelProc(hwndDlg,msg,wParam,lParam);
634 theDlg->IsActive = 0;
635 return res;
636}
637
638/***********************************************************************************************
639 * GameMtlDlg::NotesProc -- Dialog Proc for the Notes panel *
640 * *
641 * INPUT: *
642 * *
643 * OUTPUT: *
644 * *
645 * WARNINGS: *
646 * *
647 * HISTORY: *
648 * 06/26/1997 GH : Created. *
649 *=============================================================================================*/
650BOOL GameMtlDlg::NotesProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
651{
652 int id = LOWORD(wParam);
653 int code = HIWORD(wParam);
654
655 switch (msg) {
656
657 case WM_LBUTTONDOWN:
658 case WM_LBUTTONUP:
659 case WM_MOUSEMOVE:
660 {
661 IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
662 return FALSE;
663 }
664
665 case WM_COMMAND:
666 {
667 int i = lParam;
668 }
669 break;
670
671 }
672 return FALSE;
673}
674
675
676/***********************************************************************************************
677 * NotesDlgProc -- Dialog Proc which thunks to GameMtlDlg::NotesProc *
678 * *
679 * INPUT: *
680 * *
681 * OUTPUT: *
682 * *
683 * WARNINGS: *
684 * *
685 * HISTORY: *
686 * 06/26/1997 GH : Created. *
687 *=============================================================================================*/
688static BOOL CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
689{
690 GameMtlDlg *theDlg;
691
692 if (msg==WM_INITDIALOG) {
693 theDlg = (GameMtlDlg*)lParam;
694 theDlg->HwndNotes = hwndDlg;
695 SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
696 } else {
697 if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
698 return FALSE;
699 }
700 }
701
702 BOOL res;
703 theDlg->IsActive = 1;
704 res = theDlg->NotesProc(hwndDlg,msg,wParam,lParam);
705 theDlg->IsActive = 0;
706 return res;
707}
708
709
710/***********************************************************************************************
711 * GameMtlDlg::HintsProc -- Dialog Proc for the hints panel *
712 * *
713 * INPUT: *
714 * *
715 * OUTPUT: *
716 * *
717 * WARNINGS: *
718 * *
719 * HISTORY: *
720 * 3/30/98 GTH : Created. *
721 *=============================================================================================*/
722BOOL GameMtlDlg::HintsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
723{
724 int id = LOWORD(wParam);
725 int code = HIWORD(wParam);
726
727 switch (msg) {
728
729
730 case WM_LBUTTONDOWN:
731 case WM_LBUTTONUP:
732 case WM_MOUSEMOVE:
733 {
734 IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
735 return FALSE;
736 }
737
738 case WM_COMMAND:
739 {
740 switch(id)
741 {
743 TheMtl->SetAttribute(GAMEMTL_DIT_OVER_DCT, GetCheckBox(hwndDlg, IDC_DIT_OVER_DCT_CHECK));
744 break;
745
747 TheMtl->SetAttribute(GAMEMTL_SIT_OVER_SCT, GetCheckBox(hwndDlg, IDC_SIT_OVER_SCT_CHECK));
748 break;
749
751 TheMtl->SetAttribute(GAMEMTL_DIT_OVER_DIG, GetCheckBox(hwndDlg, IDC_DIT_OVER_DIG_CHECK));
752 break;
753
755 TheMtl->SetAttribute(GAMEMTL_SIT_OVER_SIG, GetCheckBox(hwndDlg, IDC_SIT_OVER_SIG_CHECK));
756 break;
757
759 TheMtl->SetAttribute(GAMEMTL_FAST_SPECULAR_AFTER_ALPHA, GetCheckBox(hwndDlg, IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK));
760 break;
761 }
762 }
763 break;
764 }
765 return FALSE;
766}
767
768
769/***********************************************************************************************
770 * HintsDlgProc -- Dialog proc which thunks to GameMtlDlg::HintsProc *
771 * *
772 * INPUT: *
773 * *
774 * OUTPUT: *
775 * *
776 * WARNINGS: *
777 * *
778 * HISTORY: *
779 * 3/30/98 GTH : Created. *
780 *=============================================================================================*/
781static BOOL CALLBACK HintsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
782{
783 GameMtlDlg *theDlg;
784
785 if (msg==WM_INITDIALOG) {
786 theDlg = (GameMtlDlg*)lParam;
787 theDlg->HwndHints = hwndDlg;
788 SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
789 } else {
790 if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
791 return FALSE;
792 }
793 }
794
795 BOOL res;
796 theDlg->IsActive = 1;
797 res = theDlg->HintsProc(hwndDlg,msg,wParam,lParam);
798 theDlg->IsActive = 0;
799 return res;
800}
801
802
803/***********************************************************************************************
804 * GameMtlDlg::PsxProc -- Dialog proc for the PSX options panel *
805 * *
806 * INPUT: *
807 * *
808 * OUTPUT: *
809 * *
810 * WARNINGS: *
811 * *
812 * HISTORY: *
813 * 3/31/98 GTH : Created. *
814 *=============================================================================================*/
815BOOL GameMtlDlg::PsxProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
816{
817 int id = LOWORD(wParam);
818 int code = HIWORD(wParam);
819
820 switch (msg) {
821
822 case WM_LBUTTONDOWN:
823 case WM_LBUTTONUP:
824 case WM_MOUSEMOVE:
825 {
826 IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
827 return FALSE;
828 }
829
830 case WM_COMMAND:
831 {
832 switch(id)
833 {
834 case IDC_NO_TRANS:
835 TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,0);
836 break;
837
838 case IDC_100_TRANS:
839 TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_100_TRANS);
840 break;
841
842 case IDC_50_TRANS:
843 TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_50_TRANS);
844 break;
845
846 case IDC_25_TRANS:
847 TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_25_TRANS);
848 break;
849
851 TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_MINUS_100_TRANS);
852 break;
853
855 TheMtl->SetAttribute(GAMEMTL_PSX_NO_RT_LIGHTING, GetCheckBox(hwndDlg, IDC_NO_RT_LIGHTING));
856 break;
857 }
858 }
859 break;
860 }
861 return FALSE;
862}
863
864
865/***********************************************************************************************
866 * PsxDlgProc -- Dialog proc which thunks into GameMtlDlg::PsxProc *
867 * *
868 * INPUT: *
869 * *
870 * OUTPUT: *
871 * *
872 * WARNINGS: *
873 * *
874 * HISTORY: *
875 * 3/31/98 GTH : Created. *
876 *=============================================================================================*/
877static BOOL CALLBACK PsxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
878{
879 GameMtlDlg *theDlg;
880
881 if (msg==WM_INITDIALOG) {
882 theDlg = (GameMtlDlg*)lParam;
883 theDlg->HwndPsx = hwndDlg;
884 SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
885 } else {
886 if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
887 return FALSE;
888 }
889 }
890
891 BOOL res;
892 theDlg->IsActive = 1;
893 res = theDlg->PsxProc(hwndDlg,msg,wParam,lParam);
894 theDlg->IsActive = 0;
895 return res;
896}
897
898
899/***********************************************************************************************
900 * GameMtlDlg::LoadDialog -- Sets the state of all of the dialog's controls *
901 * *
902 * INPUT: *
903 * *
904 * OUTPUT: *
905 * *
906 * WARNINGS: *
907 * *
908 * HISTORY: *
909 * 06/26/1997 GH : Created. *
910 *=============================================================================================*/
911void GameMtlDlg::LoadDialog(BOOL draw)
912{
913
914 /*
915 ** Set the state of the entire panel based on the current material.
916 */
917 if (TheMtl && HwndPanel) {
918
919 /*
920 ** Init all of the color swatches
921 */
922 if (DiffuseSwatch) {
923 DiffuseSwatch->InitColor(TheMtl->GetDiffuse());
924 }
925 if (SpecularSwatch) {
926 SpecularSwatch->InitColor(TheMtl->GetSpecular());
927 }
928 if (AmbientCoeffSwatch) {
929 AmbientCoeffSwatch->InitColor(TheMtl->GetAmbientCoeff());
930 }
931 if (DiffuseCoeffSwatch) {
932 DiffuseCoeffSwatch->InitColor(TheMtl->GetDiffuseCoeff());
933 }
934 if (SpecularCoeffSwatch) {
935 SpecularCoeffSwatch->InitColor(TheMtl->GetSpecularCoeff());
936 }
937 if (EmissiveCoeffSwatch) {
938 EmissiveCoeffSwatch->InitColor(TheMtl->GetEmissiveCoeff());
939 }
940
941 /*
942 ** Checkboxes
943 */
944 SetCheckBox(HwndPanel,IDC_USE_ALPHA_CHECK, TheMtl->GetAttribute(GAMEMTL_USE_ALPHA));
945 SetCheckBox(HwndPanel,IDC_USE_SORTING_CHECK, TheMtl->GetAttribute(GAMEMTL_USE_SORTING));
946 SetCheckBox(HwndPanel,IDC_VIEWPORT_DISPLAY_CHECK,TheMtl->Get_Viewport_Display_Status());
947
948 /*
949 ** Texture maps enable checks.
950 */
951 SetCheckBox(HwndPanel,IDC_MAPON_DCT, TheMtl->SubTexmapOn(ID_DI));
952 SetCheckBox(HwndPanel,IDC_MAPON_DIT, TheMtl->SubTexmapOn(ID_SI));
953 SetCheckBox(HwndPanel,IDC_MAPON_SCT, TheMtl->SubTexmapOn(ID_SP));
954 SetCheckBox(HwndPanel,IDC_MAPON_SIT, TheMtl->SubTexmapOn(ID_RL));
955
956 /*
957 ** Mapping types
958 */
959 SendDlgItemMessage( HwndPanel, IDC_DCT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->DCTMappingType, 0 );
960 SendDlgItemMessage( HwndPanel, IDC_DIT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->DITMappingType, 0 );
961 SendDlgItemMessage( HwndPanel, IDC_SCT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->SCTMappingType, 0 );
962 SendDlgItemMessage( HwndPanel, IDC_SIT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->SITMappingType, 0 );
963
964 /*
965 ** Texture animation parameters
966 */
967 DCTFramesSpin->SetValue(TheMtl->DCTFrames,FALSE);
968 DITFramesSpin->SetValue(TheMtl->DITFrames,FALSE);
969 SCTFramesSpin->SetValue(TheMtl->SCTFrames,FALSE);
970 SITFramesSpin->SetValue(TheMtl->SITFrames,FALSE);
971
972 DCTRateSpin->SetValue(TheMtl->DCTFrameRate,FALSE);
973 DITRateSpin->SetValue(TheMtl->DITFrameRate,FALSE);
974 SCTRateSpin->SetValue(TheMtl->SCTFrameRate,FALSE);
975 SITRateSpin->SetValue(TheMtl->SITFrameRate,FALSE);
976
977 /*
978 ** Opacity, translucency, etc
979 */
980 OpacitySpin->SetValue(TheMtl->Opacity,FALSE);
981 TranslucencySpin->SetValue(TheMtl->Translucency,FALSE);
982 ShininessSpin->SetValue(TheMtl->Shininess,FALSE);
983 FogSpin->SetValue(TheMtl->FogCoeff,FALSE);
984
985 /*
986 ** Init the Psx flags state
987 */
988 SetCheckBox(HwndPsx,IDC_NO_RT_LIGHTING, TheMtl->GetAttribute(GAMEMTL_PSX_NO_RT_LIGHTING));
989
990 SetCheckBox(HwndPsx,IDC_NO_TRANS, false);
991 SetCheckBox(HwndPsx,IDC_100_TRANS, false);
992 SetCheckBox(HwndPsx,IDC_50_TRANS, false);
993 SetCheckBox(HwndPsx,IDC_25_TRANS, false);
994 SetCheckBox(HwndPsx,IDC_MINUS_100_TRANS, false);
995
996 switch (TheMtl->GetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK)) {
997 case 0:
998 SetCheckBox(HwndPsx,IDC_NO_TRANS,true);
999 break;
1000 case GAMEMTL_PSX_100_TRANS:
1001 SetCheckBox(HwndPsx,IDC_100_TRANS,true);
1002 break;
1003 case GAMEMTL_PSX_50_TRANS:
1004 SetCheckBox(HwndPsx,IDC_50_TRANS,true);
1005 break;
1006 case GAMEMTL_PSX_25_TRANS:
1007 SetCheckBox(HwndPsx,IDC_25_TRANS,true);
1008 break;
1009 case GAMEMTL_PSX_MINUS_100_TRANS:
1010 SetCheckBox(HwndPsx,IDC_MINUS_100_TRANS,true);
1011 break;
1012 }
1013
1014
1015 /*
1016 ** Init the Hints state
1017 */
1018 SetCheckBox(HwndHints,IDC_DIT_OVER_DCT_CHECK, TheMtl->GetAttribute(GAMEMTL_DIT_OVER_DCT));
1019 SetCheckBox(HwndHints,IDC_SIT_OVER_SCT_CHECK, TheMtl->GetAttribute(GAMEMTL_SIT_OVER_SCT));
1020 SetCheckBox(HwndHints,IDC_DIT_OVER_DIG_CHECK, TheMtl->GetAttribute(GAMEMTL_DIT_OVER_DIG));
1021 SetCheckBox(HwndHints,IDC_SIT_OVER_SIG_CHECK, TheMtl->GetAttribute(GAMEMTL_SIT_OVER_SIG));
1022 SetCheckBox(HwndHints,IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK, TheMtl->GetAttribute(GAMEMTL_FAST_SPECULAR_AFTER_ALPHA));
1023
1024 /*
1025 ** Init the texmaps state
1026 */
1027 for (int i=0; i<NTEXMAPS; i++) {
1028 UpdateTexmapDisplay(i);
1029 }
1030 }
1031}
1032
1033/***********************************************************************************************
1034 * GameMtlDlg::UpdateMtlDisplay -- Informs MAX that the material parameters have changed *
1035 * *
1036 * INPUT: *
1037 * *
1038 * OUTPUT: *
1039 * *
1040 * WARNINGS: *
1041 * *
1042 * HISTORY: *
1043 * 06/26/1997 GH : Created. *
1044 *=============================================================================================*/
1045void GameMtlDlg::UpdateMtlDisplay()
1046{
1047 IParams->MtlChanged();
1048}
1049
1050
1051/***********************************************************************************************
1052 * GameMtlDlg::ActivateDlg -- Activates and deactivates the dialog *
1053 * *
1054 * INPUT: *
1055 * *
1056 * OUTPUT: *
1057 * *
1058 * WARNINGS: *
1059 * *
1060 * HISTORY: *
1061 * 06/26/1997 GH : Created. *
1062 *=============================================================================================*/
1063void GameMtlDlg::ActivateDlg(BOOL onOff)
1064{
1065 if (DiffuseSwatch) {
1066 DiffuseSwatch->Activate(onOff);
1067 }
1068 if (SpecularSwatch) {
1069 SpecularSwatch->Activate(onOff);
1070 }
1071 if (AmbientCoeffSwatch) {
1072 AmbientCoeffSwatch->Activate(onOff);
1073 }
1074 if (DiffuseCoeffSwatch) {
1075 DiffuseCoeffSwatch->Activate(onOff);
1076 }
1077 if (SpecularCoeffSwatch) {
1078 SpecularCoeffSwatch->Activate(onOff);
1079 }
1080 if (EmissiveCoeffSwatch) {
1081 EmissiveCoeffSwatch->Activate(onOff);
1082 }
1083}
1084
1085/***********************************************************************************************
1086 * GameMtlDlg::SetThing -- Sets the material to be edited *
1087 * *
1088 * INPUT: *
1089 * *
1090 * OUTPUT: *
1091 * *
1092 * WARNINGS: *
1093 * *
1094 * HISTORY: *
1095 * 06/26/1997 GH : Created. *
1096 *=============================================================================================*/
1097void GameMtlDlg::SetThing(ReferenceTarget *m)
1098{
1099 assert (m->SuperClassID()==MATERIAL_CLASS_ID);
1100 assert (m->ClassID()==GameMaterialClassID);
1101
1102 if (TheMtl) {
1103 TheMtl->ParamPanel = NULL;
1104 }
1105
1106 TheMtl = (GameMtl *)m;
1107
1108 if (TheMtl) {
1109 TheMtl->ParamPanel = this;
1110 }
1111
1112 LoadDialog(TRUE);
1113
1114 if (HwndPanel && DiffuseSwatch) {
1115 DiffuseSwatch->InitColor(TheMtl->GetDiffuse());
1116 }
1117 if (HwndPanel && SpecularSwatch) {
1118 SpecularSwatch->InitColor(TheMtl->GetSpecular());
1119 }
1120 if (HwndPanel && AmbientCoeffSwatch) {
1121 AmbientCoeffSwatch->InitColor(TheMtl->GetAmbientCoeff());
1122 }
1123 if (HwndPanel && DiffuseCoeffSwatch) {
1124 DiffuseCoeffSwatch->InitColor(TheMtl->GetDiffuseCoeff());
1125 }
1126 if (HwndPanel && SpecularCoeffSwatch) {
1127 SpecularCoeffSwatch->InitColor(TheMtl->GetSpecularCoeff());
1128 }
1129 if (HwndPanel && EmissiveCoeffSwatch) {
1130 EmissiveCoeffSwatch->InitColor(TheMtl->GetEmissiveCoeff());
1131 }
1132}
1133
1134/***********************************************************************************************
1135 * GameMtlDlg::BuildDialog -- Adds the dialog to the material editor *
1136 * *
1137 * INPUT: *
1138 * *
1139 * OUTPUT: *
1140 * *
1141 * WARNINGS: *
1142 * *
1143 * HISTORY: *
1144 * 06/26/1997 GH : Created. *
1145 *=============================================================================================*/
1146void GameMtlDlg::BuildDialog()
1147{
1148 if ((TheMtl->Flags&(GAMEMTL_ROLLUP_FLAGS))==0) {
1149 TheMtl->SetFlag(GAMEMTL_ROLLUP1_OPEN,TRUE);
1150 }
1151
1152 HwndPanel = IParams->AddRollupPage(
1153 AppInstance,
1154 MAKEINTRESOURCE(IDD_GAMEMTL_PANEL),
1155 PanelDlgProc,
1157 (LPARAM)this,
1158 (TheMtl->GetFlag(GAMEMTL_ROLLUP1_OPEN) ? 0:APPENDROLL_CLOSED)
1159 );
1160
1161 HwndPsx = IParams->AddRollupPage(
1163 MAKEINTRESOURCE(IDD_GAMEMTL_PSX_PANEL),
1164 PsxDlgProc,
1166 (LPARAM)this,
1167 (TheMtl->GetFlag(GAMEMTL_ROLLUP2_OPEN) ? 0:APPENDROLL_CLOSED)
1168 );
1169
1170 HwndHints = IParams->AddRollupPage(
1172 MAKEINTRESOURCE(IDD_GAMEMTL_HINTS_PANEL),
1173 HintsDlgProc,
1175 (LPARAM)this,
1176 (TheMtl->GetFlag(GAMEMTL_ROLLUP3_OPEN) ? 0:APPENDROLL_CLOSED)
1177 );
1178
1179 HwndNotes = IParams->AddRollupPage(
1181 MAKEINTRESOURCE(IDD_MATERIAL_NOTES_PANEL),
1182 NotesDlgProc,
1184 (LPARAM)this,
1185 (TheMtl->GetFlag(GAMEMTL_ROLLUP4_OPEN) ? 0:APPENDROLL_CLOSED)
1186 );
1187
1188 IParams->SetRollupScrollPos(TheMtl->RollScroll);
1189}
1190
1191/***********************************************************************************************
1192 * GameMtlDlg::UpdateTexmapDisplay -- Updates the texture map buttons *
1193 * *
1194 * INPUT: *
1195 * *
1196 * OUTPUT: *
1197 * *
1198 * WARNINGS: *
1199 * *
1200 * HISTORY: *
1201 * 06/26/1997 GH : Created. *
1202 *=============================================================================================*/
1203void GameMtlDlg::UpdateTexmapDisplay(int i)
1204{
1205 TSTR nm = Get_String(IDS_NONE);
1206 Texmap *texmap = (*TheMtl->Maps)[i].Map;
1207 if (texmap) nm = texmap->GetFullName();
1208
1209 // Diffuse Map -> Surrender Diffuse Color Channel
1210 if (i == ID_DI) {
1211 SetCheckBox(HwndPanel, IDC_MAPON_DCT, TheMtl->IsMapEnabled(i));
1212 SetDlgItemText(HwndPanel, IDC_DCT_BUTTON, nm.data());
1213 }
1214
1215 // Self Illumination Map -> Surrender Diffuse Illumination Channel
1216 if (i == ID_SI) {
1217 SetCheckBox(HwndPanel, IDC_MAPON_DIT, TheMtl->IsMapEnabled(i));
1218 SetDlgItemText(HwndPanel, IDC_DIT_BUTTON, nm.data());
1219 }
1220
1221 // Specular Map -> Surrender Specular Color Channel
1222 if (i == ID_SP) {
1223 SetCheckBox(HwndPanel, IDC_MAPON_SCT, TheMtl->IsMapEnabled(i));
1224 SetDlgItemText(HwndPanel, IDC_SCT_BUTTON, nm.data());
1225 }
1226
1227 // Reflection Map -> Surrender Specular Illumination Channel
1228 if (i == ID_RL) {
1229 SetCheckBox(HwndPanel, IDC_MAPON_SIT, TheMtl->IsMapEnabled(i));
1230 SetDlgItemText(HwndPanel, IDC_SIT_BUTTON, nm.data());
1231 }
1232
1233}
1234
1235
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
unsigned int UINT
Definition bittype.h:63
#define IDC_DIT_RATE_EDIT
Definition resource.h:207
#define IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK
Definition resource.h:234
#define IDC_DIT_RATE_SPIN
Definition resource.h:209
#define IDC_SCT_MAPPING_COMBO
Definition resource.h:220
#define IDC_DIT_FRAMES_EDIT
Definition resource.h:202
#define IDC_DIFFUSE_COLOR
Definition resource.h:272
#define IDC_SIT_RATE_EDIT
Definition resource.h:225
#define IDC_SHININESS_SPIN
Definition resource.h:191
#define IDC_DCT_BUTTON
Definition resource.h:257
#define IDD_GAMEMTL_HINTS_PANEL
Definition resource.h:75
#define IDC_SPECULAR_COLOR
Definition resource.h:274
#define IDC_SCT_FRAMES_SPIN
Definition resource.h:166
#define IDC_NO_TRANS
Definition resource.h:231
#define IDC_EMISSIVE_COEFF
Definition resource.h:280
#define IDC_NO_RT_LIGHTING
Definition resource.h:238
#define IDC_FOG_EDIT
Definition resource.h:171
#define IDC_OPACITY_EDIT
Definition resource.h:157
#define IDC_DIT_FRAMES_SPIN
Definition resource.h:204
#define IDS_UV_MAPPING
Definition resource.h:408
#define IDC_DIT_OVER_DIG_CHECK
Definition resource.h:230
#define IDC_SIT_FRAMES_SPIN
Definition resource.h:187
#define IDC_SCT_RATE_SPIN
Definition resource.h:222
#define IDC_MAPON_SIT
Definition resource.h:128
#define IDC_SIT_FRAMES_EDIT
Definition resource.h:185
#define IDS_SPECULAR_COLOR
Definition resource.h:403
#define IDS_NOTES
Definition resource.h:65
#define IDC_SIT_BUTTON
Definition resource.h:264
#define IDC_DCT_RATE_EDIT
Definition resource.h:195
#define IDS_PSX_OPTIONS
Definition resource.h:407
#define IDC_MINUS_100_TRANS
Definition resource.h:237
#define IDC_DCT_FRAMES_SPIN
Definition resource.h:156
#define IDC_DIFFUSE_COEFF
Definition resource.h:278
#define IDC_DCT_FRAMES_EDIT
Definition resource.h:154
#define IDC_SIT_RATE_SPIN
Definition resource.h:226
#define IDS_MATERIAL_HINTS
Definition resource.h:406
#define IDC_SIT_OVER_SCT_CHECK
Definition resource.h:228
#define IDC_SCT_BUTTON
Definition resource.h:260
#define IDS_PARAMETERS
Definition resource.h:49
#define IDC_AMBIENT_COEFF
Definition resource.h:276
#define IDC_DIT_OVER_DCT_CHECK
Definition resource.h:227
#define IDC_MAPON_SCT
Definition resource.h:123
#define IDC_50_TRANS
Definition resource.h:235
#define IDC_TRANSLUCENCY_SPIN
Definition resource.h:182
#define IDC_25_TRANS
Definition resource.h:236
#define IDC_SPECULAR_COEFF
Definition resource.h:282
#define IDC_USE_ALPHA_CHECK
Definition resource.h:223
#define IDC_MAPON_DCT
Definition resource.h:119
#define IDD_GAMEMTL_PANEL
Definition resource.h:73
#define IDS_DIFFUSE_COLOR
Definition resource.h:48
#define IDS_ENVIRONMENT_MAPPING
Definition resource.h:409
#define IDC_DIT_MAPPING_COMBO
Definition resource.h:217
#define IDC_100_TRANS
Definition resource.h:233
#define IDC_DIT_BUTTON
Definition resource.h:262
#define IDC_DCT_MAPPING_COMBO
Definition resource.h:214
#define IDS_NONE
Definition resource.h:64
#define IDD_GAMEMTL_PSX_PANEL
Definition resource.h:76
#define IDC_MAPON_DIT
Definition resource.h:126
#define IDC_FOG_SPIN
Definition resource.h:175
#define IDC_USE_SORTING_CHECK
Definition resource.h:229
#define IDC_SIT_OVER_SIG_CHECK
Definition resource.h:232
#define IDC_SCT_RATE_EDIT
Definition resource.h:211
#define IDC_OPACITY_SPIN
Definition resource.h:159
#define IDC_SHININESS_EDIT
Definition resource.h:189
#define IDC_TRANSULCENCY_EDIT
Definition resource.h:178
#define IDC_DCT_RATE_SPIN
Definition resource.h:197
#define IDC_SIT_MAPPING_COMBO
Definition resource.h:224
#define IDC_SCT_FRAMES_EDIT
Definition resource.h:161
#define IDC_VIEWPORT_DISPLAY_CHECK
Definition resource.h:239
#define BOOL
Definition Wnd_File.h:57
void ReloadDialog(void)
IMtlParams * IParams
Definition GameMtlDlg.h:103
GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m)
void Invalidate(void)
void SetTime(TimeValue t)
void ActivateDlg(BOOL onOff)
void SetThing(ReferenceTarget *m)
TimeValue CurTime
Definition GameMtlDlg.h:109
Class_ID ClassID(void)
friend class GameMtl
Definition GameMtlDlg.h:115
HWND HwndEdit
Definition GameMtlDlg.h:92
HPALETTE HpalOld
Definition GameMtlDlg.h:96
GameMtl * TheMtl
Definition GameMtlDlg.h:104
HINSTANCE AppInstance
Definition dllmain.cpp:67
TCHAR * Get_String(int id)
Definition dllmain.cpp:198
#define GAMEMTL_ROLLUP_FLAGS
Definition gamemtl.h:58
Class_ID GameMaterialClassID
MSG msg
Definition patch.cpp:409