forked from electronicarts/CnC_Tiberian_Dawn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDESCDLG.CPP
184 lines (160 loc) · 6.63 KB
/
DESCDLG.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
** Command & Conquer(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Header: F:\projects\c&c\vcs\code\descdlg.cpv 2.17 16 Oct 1995 16:49:44 JOE_BOSTIC $ */
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Command & Conquer *
* *
* File Name : DESCDLG.CPP *
* *
* Programmer : Maria del Mar McCready Legg *
* Joe L. Bostic *
* *
* Start Date : Jan 26, 1995 *
* *
* Last Update : Jan 26, 1995 [MML] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* DescriptionClass::Process -- Handles all the options graphic interface. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "function.h"
#include "descdlg.h"
/***********************************************************************************************
* DescriptionClass::Process -- Handles all the options graphic interface. *
* *
* This dialog uses an edit box to "fill-out" a description. *
* *
* INPUT: char *string - return answer here. *
* OUTPUT: none *
* WARNINGS: none *
* HISTORY: 12/31/1994 MML : Created. *
*=============================================================================================*/
void DescriptionClass::Process(char *string)
{
/*
-----------------------------------------------------------------
Set up the window. Window x-coords are in bytes not pixels.
-----------------------------------------------------------------
*/
Set_Window(WINDOW_EDITOR, OPTION_X, OPTION_Y, OPTION_WIDTH, OPTION_HEIGHT);
Set_Logic_Page(SeenBuff);
/*
-----------------------------------------------------------------------
Create Buttons. Button coords are in pixels, but are window-relative.
-----------------------------------------------------------------------
*/
TextButtonClass optionsbtn(
BUTTON_OPTIONS,
TXT_OK,
TPF_6PT_GRAD,
0,
BUTTON_Y);
TextButtonClass cancelbtn(
BUTTON_CANCEL,
TXT_CANCEL,
TPF_6PT_GRAD,
0,
BUTTON_Y);
cancelbtn.X = OPTION_X + ((OPTION_WIDTH - optionsbtn.Width)/3)*2;
optionsbtn.X = OPTION_X + ((OPTION_WIDTH - optionsbtn.Width)/3);
optionsbtn.Add_Tail(cancelbtn);
EditClass edit(
BUTTON_EDIT,
string,
31,
TPF_6PT_GRAD,
0,
EDIT_Y
,EDIT_W);
edit.Set_Focus();
edit.X = OPTION_X + (OPTION_WIDTH - edit.Width)/2,
optionsbtn.Add_Tail(edit);
/*
** This causes left mouse button clicking within the confines of the dialog to
** be ignored if it wasn't recognized by any other button or slider.
*/
GadgetClass dialog(OPTION_X, OPTION_Y, OPTION_WIDTH, OPTION_HEIGHT, GadgetClass::LEFTPRESS);
optionsbtn.Add_Tail(dialog);
/*
** This causes a right click anywhere or a left click outside the dialog region
** to be equivalent to clicking on the return to options dialog.
*/
ControlClass background(BUTTON_OPTIONS, 0, 0, SeenBuff.Get_Width(), SeenBuff.Get_Height(), GadgetClass::LEFTPRESS|GadgetClass::RIGHTPRESS);
optionsbtn.Add_Tail(background);
/*
------------------- Main Processing Loop --------------------
*/
bool display = true;
bool process = true;
while (process) {
/*
** If we have just received input focus again after running in the background then
** we need to redraw.
*/
if (AllSurfaces.SurfacesRestored){
AllSurfaces.SurfacesRestored=FALSE;
display=TRUE;
}
/*
-------------- Invoke game callback -------------
*/
Call_Back();
/*
-------------- Refresh display if needed --------------
*/
if (display) {
Window_Hide_Mouse(WINDOW_EDITOR);
/*
--------- Draw the background -----------
*/
Window_Box (WINDOW_EDITOR, BOXSTYLE_GREEN_BORDER); // has border, raised up
Draw_Caption(TXT_MISSION_DESCRIPTION, OPTION_X, OPTION_Y, OPTION_WIDTH);
/*
--------- Draw the titles -----------
*/
optionsbtn.Draw_All();
Window_Show_Mouse();
display = false;
}
/*
-------------- Get user input ---------------
*/
KeyNumType input = optionsbtn.Input();
/*
-------------- Process Input ----------------
*/
switch (input) {
case KN_RETURN:
case BUTTON_OPTIONS|KN_BUTTON:
strtrim(string);
process = false;
break;
case KN_ESC:
case BUTTON_CANCEL|KN_BUTTON:
string[0]= NULL;
strtrim(string);
process = false;
break;
case BUTTON_EDIT|KN_BUTTON:
break;
}
}
}