-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOn_Screen_Config_Object.cpp
More file actions
292 lines (230 loc) · 6.85 KB
/
On_Screen_Config_Object.cpp
File metadata and controls
292 lines (230 loc) · 6.85 KB
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#include "Function.h"
On_Screen_Config_Object::On_Screen_Config_Object(int x, int y, int type)
{
//Decide
Alive_Key = true;
Render_Key = false;
Child_Num = 0;
Object_Type = ON_SCREEN_CONFIG;
Type = type;
Link.Master_Address = -1; // When master has no address
Target_X = x;
Target_Y = y;
Variable_Setter();
Screen_Object.x = Target_X;
Screen_Object.y = Target_Y;
Screen_Object.w = Width;
Screen_Object.h = Lenght;
Friction = 0;
Degree = 0;
Magnitude = 0;
X_Vel = 0;
Y_Vel = 0;
Button = 0;
}
void On_Screen_Config_Object::Variable_Setter()
{
switch (Type)
{
case RETURN_MENU_BUTTON: Game_Stat = SAVE_MENU;
Gravity_Physics = STATIC_G;
Alive_Key = true;
Lenght = 72;
Width = 165;
Text = "Return";
//TEXT PLACEMENT IS ALWAYS CHILD ZERO
Screen_Object_Children[0].x = Target_X + 35 ;
Screen_Object_Children[0].y = Target_Y + 7;
Screen_Object_Children[0].w = 126;
Screen_Object_Children[0].h = 58;
//Link definign
Link.Master_Type = Object_Type;
Link.Master_Sub_Type = Type;
Link.Master_Text = Text;
Link.Master_X_Child[0] = Screen_Object_Children[0].x;
Link.Master_Y_Child[0] = Screen_Object_Children[0].y;
Link.Active_Link = false;
Link.Performing = false;
break;
case SWITCH_MENU_BUTTON: Game_Stat = SAVE_MENU;
Gravity_Physics = STATIC_G;
Alive_Key = true;
Lenght = 72;
Width = 165;
Text = "Switch";
Slave_Order = 1;
//TEXT PLACEMENT IS ALWAYS CHILD ZERO
Screen_Object_Children[0].x = Target_X + 45 ;
Screen_Object_Children[0].y = Target_Y + 7;
Screen_Object_Children[0].w = 126;
Screen_Object_Children[0].h = 58;
//Link definign
Link.Master_Type = Object_Type;
Link.Master_Sub_Type = Type;
Link.Master_Text = Text;
Link.Master_X_Child[0] = Screen_Object_Children[0].x;
Link.Master_Y_Child[0] = Screen_Object_Children[0].y;
Link.Active_Link = false;
Link.Performing = false;
break;
case SWITCH_MENU_BUTTON_EXPAND1: Game_Stat = SAVE_MENU;
Gravity_Physics = STATIC_G;
Alive_Key = false;
Child_Num = MAX_OBJECT_CHILDREN;
Lenght = 209;
Width = 165;
Screen_Object_Children[0].x = Target_X + 30 ;
Screen_Object_Children[0].y = Target_Y + 7;
Screen_Object_Children[0].w = 126;
Screen_Object_Children[0].h = 58;
Screen_Object_Children[1].x = Target_X + 30;
Screen_Object_Children[1].y = Screen_Object_Children[0].y + Screen_Object_Children[0].h;
Screen_Object_Children[1].w = 126;
Screen_Object_Children[1].h = 58;
Screen_Object_Children[2].x = Target_X + 30 ;
Screen_Object_Children[2].y = Screen_Object_Children[1].y + Screen_Object_Children[1].h;
Screen_Object_Children[2].w = 126;
Screen_Object_Children[2].h = 58;
break;
case SAVE_MENU_BUTTON: Game_Stat = SAVE_MENU;
Gravity_Physics = STATIC_G;
Alive_Key = true;
Lenght = 72;
Width = 165;
Text = "Save";
Slave_Order = 1;
//TEXT PLACEMENT IS ALWAYS CHILD ZERO
Screen_Object_Children[0].x = Target_X + 55 ;
Screen_Object_Children[0].y = Target_Y + 7;
Screen_Object_Children[0].w = 126;
Screen_Object_Children[0].h = 58;
//Link definign
Link.Master_Type = Object_Type;
Link.Master_Sub_Type = Type;
Link.Master_Text = Text;
Link.Master_X_Child[0] = Screen_Object_Children[0].x;
Link.Master_Y_Child[0] = Screen_Object_Children[0].y;
Link.Active_Link = false;
Link.Performing = false;
break;
}
}
void On_Screen_Config_Object::Variable_Setter_Bool_Conditional(int condition, bool condition2 )
{
switch (condition)
{
case 0: Render_Key = condition2; break;
case 1: Alive_Key = condition2; break;
}
}
void On_Screen_Config_Object::Variable_Setter_Special_Conditional(int condition, int condition2, bool conditionBool, int conditionInt)
{
switch (condition)
{
case 0: switch (condition2)
{
case 0: Link.Active_Link = conditionBool;
break;
case 1: Link.Master_Address = conditionInt;
break;
case 2: Link.Slave_Address = conditionInt;
break;
case 3: Link.Performing = conditionBool;
break;
case 4: Link.Perform = conditionInt;
break;
}
break;
}
}
void On_Screen_Config_Object::Soul_Input()
{
if (Game_Mode == SAVE_MENU)
{
}
}
void On_Screen_Config_Object::Variable_Update(Uint32 deltaTicks)
{
Button = Button_Command();
Target_X += X_Vel *( deltaTicks / 1000.f );
Target_Y += Y_Vel *( deltaTicks / 1000.f );
Link.Master_x = Target_X;
Link.Master_y = Target_Y;
if ((Target_X < 0)||(Target_X > SCREEN_WIDTH))
{Target_X -= X_Vel *( deltaTicks / 1000.f );}
if ((Target_Y < 0)||( Target_Y > SCREEN_HEIGHT))
{Target_Y -= Y_Vel *( deltaTicks / 1000.f );}
}
void On_Screen_Config_Object::Command_Slave_Calculation()
{
// Figure out the game mode
switch (Game_Mode)
{
case YOU_DUN_GOOFED: break;
case START_MENU: //Figure out the type of the master break;
case GAMEPLAY_MODE: break;
case SAVE_MENU: break;
}
}
int On_Screen_Config_Object::Get_X()
{
return Target_X;
}
int On_Screen_Config_Object::Get_Y()
{
return Target_Y;
}
int On_Screen_Config_Object::Get_Type()
{
return Type;
}
int On_Screen_Config_Object::Get_Object_Type()
{
return Object_Type;
}
int On_Screen_Config_Object::Get_Gate_Type()
{
return Game_Stat;
}
bool On_Screen_Config_Object::Get_Render_Key()
{
return Render_Key;
}
bool On_Screen_Config_Object::Get_Alive_Key()
{
return Alive_Key;
}
std::string On_Screen_Config_Object::Get_Text()
{
return Text;
}
Chain_Link On_Screen_Config_Object::Get_Chain_Link()
{
return Link;
}
int On_Screen_Config_Object::Get_Gravity_Physics()
{
return Gravity_Physics;
}
int On_Screen_Config_Object::Get_Child_Num()
{
return Child_Num;
}
Square On_Screen_Config_Object::Get_Objects()
{
return Screen_Object;
}
Square On_Screen_Config_Object::Get_Objects_Children(int condition)
{
return Screen_Object_Children[condition];
}
void On_Screen_Config_Object::Show(int condition)
{
Apply_Surface( Target_X, Target_Y, OnScreen, Screen, &On_Screen_Clips[condition] ) ;
}
void On_Screen_Config_Object::Show_Children(int condition, int condition2)
{
Target_X_Child = Screen_Object_Children[condition].x;
Target_Y_Child = Screen_Object_Children[condition].y;
Apply_Surface( Target_X_Child, Target_Y_Child, OnScreen, Screen, &On_Screen_Clips[condition2] ) ;
}