-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
237 lines (176 loc) · 6.23 KB
/
Main.cpp
File metadata and controls
237 lines (176 loc) · 6.23 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
#include "Function.h"
//PROGRAM THE A VARIABLE SETTER FOR ALL CLASSES
int main( int argc, char* args[] )
{
/************************************************
// DECLARATION OF EVERYTHING //
************************************************/
//Quit flag
bool Quit = false;
//Initialize
if( Init() == false )
{
return 1;
}
//Load the files
if( Load_Files() == false )
{
return 1;
}
//Clip all art to be used
Clip_Test();
Cyron_Tanryoku_Clip();
Chrome_Crystal_Master_Gray_Clip();
Floor_Object_Clip();
Float_Object_Clip();
Shadow_Float_Object_Clip();
Exit_Object_Clip();
Screen_Effects_Clip();
On_Screen_Clip();
Enemy_Object_Clip();
// Configuring the game
External_Configuration Config;
//Similar to config
Internal_Config IN_Config;
// Graphic handling
Rendering Graphic;
Physics Physic; //SOON TO BE OF GREAT IMPORTANTS
//Enemies
//Enemy_Object *Foe [MAX_ENEMY_OBJECTS];
//Bullet_Object *Bullet[MAX_BULLET_OBJECTS ];
//The soul of the game
Soul *Spirits[MAX_GAME_OBJECTS];
//Environment_Objects *E_Ground_Object[ MAX_GROUND_OBJECTS ];
//The frame rate regulator
Timer Delta;
//GameStart
/************************************************
// GAME STARTING VARIABLES DEFINED //
************************************************/
if (Config.Configurate_Level_Name()== false)
{
return 1;
}
if (Config.Configurate_Character_Coord() == false)
{
return 1;
}
if (Config.Configurate_Level_Width_Lenght()== false )
{
return 1;
}
/*************************************************************
// USING THE VARIABLES TO GET EVERYTHING STARTED //
*************************************************************/
// Placing the player when the game starts. Only called here.
//Player.Variable_Definer_Game_Start(Config);
Graphic.Variable_Update_Inactive(Config);
/*if (Set_Level_Loader_Objects(Level_Loader_Object, Config)==false)
{
return 1;
}*/
if (Set_Objects(Spirits, Config) == false)
{
return 0;
}
Game_Start_Soul(Spirits, Config);
/*if (Set_Grounded_Objects( E_Ground_Object, Config) == false)
{
return 1;
}*/
/*if (Set_Enemy_Objects(Foe,Config) == false)
{
return 1;
}*/
//Set_Bullet_Objects( Bullet);
Graphic.Shader_Setter();
//Title_Screen();
// These functions are called to skip the title screen. Erase as nessary.
SDL_SetAlpha( ScreenEffects, SDL_SRCALPHA, 0 );
Game_Mode = GAMEPLAY_MODE;
Graphic.Optimization_Variable_Definer( Spirits );
IN_Config.Optimization_Variable_Definer( Spirits );
IN_Config.Optimization_Chain_Link_Definer( Spirits );
//While the user hasn't quit
while( Quit == false )
{
//While there's events to handle
while( SDL_PollEvent( &event ) )
{
Button_Command();
//If the user has Xed out the window
if( event.type == SDL_QUIT )
{
//Quit the program
Quit = true;
}
}
switch (Selected_Character)
{
case CYRON_TANRYOKU:Selected_Spirit = XCYRON_TANRYOKUX; break;
case THE_YS_GUY: Selected_Spirit = XTHE_YS_GUYX; break;
case CXX120: Selected_Spirit = XCXX120X; break;
case GHOST: Selected_Spirit = XGHOSTX; break;
}
//Has the power to change levels. Extremely powerful
IN_Config.Level_Gate_Collision(Spirits, Config);
Final_Warp_Process(IN_Config, Graphic, Spirits );
IN_Config.Misc_Object_Collision(Spirits, Config);
IN_Config.On_Screen_Misc_Object_Collision(Spirits,Config);
IN_Config.Default_Object_Render(Spirits);
/************************************************
// ALL ACTIVE VARIABLE DEFINE IN THIS ARE //
************************************************/
// ####################################
// Player.Character_Stats_Controller(Bullet,Delta.get_ticks());
Physic.Game_Physics_Object_Update(Spirits,Delta.get_ticks());
Graphic.Variable_Update_Active( Spirits );
//Player.Variable_Definer_Active( Physic,Config,Spirits, Delta.get_ticks());
// AI_Handling_Variable_Refresh(Foe, Physic, Config, /*E_Object*/Spirits, E_Ground_Object, Delta.get_ticks());
// Projectile_Active(Bullet,Delta.get_ticks());
// J_Data.Character_variable_definer(Player);
// J_Data.King_Character_variable_giving(K_Data);
// Graphic.Variable_Definer_Active(Player);
Physic.Game_Physics(Spirits,Delta.get_ticks());
/************************************************
// ALL ACTION PERFORMED HERE //
************************************************/
Graphic.Frame_Definer(Delta.get_ticks());
//Player.Movement_Active(Delta.get_ticks());
//Player.Game_Object_Interaction(Spirits);
// Player.Movement();
//Player.Movement_ZXC(Bullet);
// AI_Handling_Movement_Active(Foe, Delta.get_ticks());
// AI_Handling_Behavior_Controller(Foe, Player, Delta.get_ticks());
// AI_Handling_Basic_Actions(Foe, Player);
// Actions that happen in Menu Mode
//Menu_GUI.Recticle_Functionality(Player);
//Restart delta timer
Delta.start();
/************************************************
// GRAPHIC AREA. ALL ART RELATED FUNCTION //
************************************************/
//Set the camera
Graphic.Set_Camera();
//Render everything
Graphic.Layering(Spirits);
//Graphic.Layering_Menu(Menu_GUI );
// Find and free unneeded slaves
Graphic.Free_Slave(Spirits);
if (Left_Key == true){Apply_Surface( 0, 0, Character1, Screen, &Character_Test_Clips[1] ) ;}
if (Right_Key == true) {Apply_Surface( 90, 0, Character1, Screen, &Character_Test_Clips[1] ) ;}
if (Up_Key == true) {Apply_Surface( 30, 0, Character1, Screen, &Character_Test_Clips[1] ) ;}
if (Down_Key == true) {Apply_Surface( 120, 0, Character1, Screen, &Character_Test_Clips[1] ) ;}
if (Space_Key == true) {Apply_Surface( 60, 0, Character1, Screen, &Character_Test_Clips[1] ) ;}
//Update the screen
if( SDL_Flip( Screen ) == -1 )
{
return 1;
}
}
//Clean up
Clean_Up( Spirits );
//Quit SDL
SDL_Quit();
return 0;
}