44 (*game)->fade_value = 20;
48 (*game)->nb_min_particles = 0;
49 (*game)->loop_time = 0;
50 (*game)->draw_time = 0;
51 (*game)->logic_time = 0;
52 (*game)->wait_for_slowing_down_cpu = 0;
53 (*game)->GFX_UPDATE_RATE = 20000;
54 (*game)->LOGIC_RATE = 10000;
55 (*game)->real_framerate = 0;
62 (*game)->left_attack = 0;
63 (*game)->right_attack = 0;
64 (*game)->left_attack_pos = 0;
65 (*game)->right_attack_pos = 0;
68 (*game)->display = NULL;
69 (*game)->scrbuf = NULL;
70 (*game)->event_queue = NULL;
71 (*game)->logic_timer = NULL;
72 (*game)->draw_timer = NULL;
85 if ((*game)->draw_timer)
86 al_destroy_timer((*game)->draw_timer);
87 if ((*game)->logic_timer)
88 al_destroy_timer((*game)->logic_timer);
89 if ((*game)->event_queue)
90 al_destroy_event_queue((*game)->event_queue);
92 al_destroy_bitmap((*game)->scrbuf);
94 al_destroy_display((*game)->display);
108 char strbuf[1024] =
"";
111 config = fopen(config_name,
"rt");
114 n_log(
LOG_ERR,
"Error %s opening %s !", strerror(errno), config_name);
121 n_log(
LOG_ERR,
"Error allocating a new game object for %s !", config_name);
125 if (fgets(strbuf, 1024, config) == NULL)
127 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 1 ) in config.txt file !");
131 if (fgets(strbuf, 1024, config) == NULL) {
132 n_log(
LOG_ERR,
"FATAL ERROR: Can not read GFX_CONFIG_MODE in config.txt file !");
136 while (it < 1024 && strbuf[it] !=
'\0') {
137 if (strbuf[it] ==
'\n')
142 if (strcmp(strbuf,
"GFX_FULLSCREEN") == 0)
144 else if (strcmp(strbuf,
"GFX_FULLSCREEN_WINDOW") == 0)
146 else if (strcmp(strbuf,
"GFX_WINDOWED") == 0)
149 n_log(
LOG_NOTICE,
"WARNING: NO USABLE GFX_MODE LOADED FROM CONFIG FILE ! USING DEFAULT GFX_WINDOWED! tmpstr:\"%s\"", strbuf);
153 if (fgets(strbuf, 1024, config) == NULL)
155 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 3 ) in config.txt file !");
159 if (fgets(strbuf, 1024, config) == NULL) {
160 n_log(
LOG_ERR,
"FATAL ERROR: Can not read CPU_MODE in config.txt file !");
164 if (strncmp(strbuf,
"CPU_USE_FULL", 12) == 0)
166 else if (strncmp(strbuf,
"CPU_USE_NICE", 12) == 0)
168 else if (strncmp(strbuf,
"CPU_USE_LESS", 12) == 0)
171 n_log(
LOG_NOTICE,
"WARNING: NO USABLE CPU_MODE LOADED FROM CONFIG FILE ! USING DEFAULT CPU_FULL_USE !");
173 if (fgets(strbuf, 1024, config) == NULL)
175 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 7 ) in config.txt file !");
179 if (fgets(strbuf, 1024, config) == NULL) {
180 n_log(
LOG_ERR,
"FATAL ERROR: Can not read nb_min_particles in config.txt file !");
187 if (fgets(strbuf, 1024, config) == NULL)
189 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 9 ) in config.txt file !");
193 if (fgets(strbuf, 1024, config) == NULL) {
194 n_log(
LOG_ERR,
"FATAL ERROR: Can not read DRAWING_UPDATE_RATE in config.txt file !");
201 n_log(
LOG_NOTICE,
"WARNING: You can not have a negative or zero GFX_UPDATE_RATE\nDefault value ( 20000 ) will be used");
204 n_log(
LOG_NOTICE,
"WARNING: You would not want to have a 1 second GFX_UPDATE_RATE, no ?\nDefault value ( 20000 ) will be used");
208 if (fgets(strbuf, 1024, config) == NULL)
210 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 11 ) in config.txt file !");
214 if (fgets(strbuf, 1024, config) == NULL) {
215 n_log(
LOG_ERR,
"FATAL ERROR: Can not read LOGIC_RATE in config.txt file !");
222 n_log(
LOG_NOTICE,
"WARNING: You can not have a negative or zero LOGIC_RATE\nDefault value ( 10000 ) will be used");
226 n_log(
LOG_NOTICE,
"WARNING: You would not want to have a 1 second LOGIC_RATE, no ?\nDefault value ( 10000 ) will be used");