43 (*game)->fade_value = 20;
47 (*game)->nb_min_particles = 0;
48 (*game)->loop_time = 0;
49 (*game)->draw_time = 0;
50 (*game)->logic_time = 0;
51 (*game)->wait_for_slowing_down_cpu = 0;
52 (*game)->GFX_UPDATE_RATE = 20000;
53 (*game)->LOGIC_RATE = 10000;
54 (*game)->real_framerate = 0;
61 (*game)->left_attack = 0;
62 (*game)->right_attack = 0;
63 (*game)->left_attack_pos = 0;
64 (*game)->right_attack_pos = 0;
67 (*game)->display = NULL;
68 (*game)->scrbuf = NULL;
69 (*game)->event_queue = NULL;
70 (*game)->logic_timer = NULL;
71 (*game)->draw_timer = NULL;
84 if ((*game)->draw_timer)
85 al_destroy_timer((*game)->draw_timer);
86 if ((*game)->logic_timer)
87 al_destroy_timer((*game)->logic_timer);
88 if ((*game)->event_queue)
89 al_destroy_event_queue((*game)->event_queue);
91 al_destroy_bitmap((*game)->scrbuf);
93 al_destroy_display((*game)->display);
107 char strbuf[1024] =
"";
110 config = fopen(config_name,
"rt");
113 n_log(
LOG_ERR,
"Error %s opening %s !", strerror(errno), config_name);
120 n_log(
LOG_ERR,
"Error allocating a new game object for %s !", config_name);
124 if (fgets(strbuf, 1024, config) == NULL)
126 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 1 ) in config.txt file !");
130 if (fgets(strbuf, 1024, config) == NULL) {
131 n_log(
LOG_ERR,
"FATAL ERROR: Can not read GFX_CONFIG_MODE in config.txt file !");
135 while (it < 1024 && strbuf[it] !=
'\0') {
136 if (strbuf[it] ==
'\n')
141 if (strcmp(strbuf,
"GFX_FULLSCREEN") == 0)
143 else if (strcmp(strbuf,
"GFX_FULLSCREEN_WINDOW") == 0)
145 else if (strcmp(strbuf,
"GFX_WINDOWED") == 0)
148 n_log(
LOG_NOTICE,
"WARNING: NO USABLE GFX_MODE LOADED FROM CONFIG FILE ! USING DEFAULT GFX_WINDOWED! tmpstr:\"%s\"", strbuf);
152 if (fgets(strbuf, 1024, config) == NULL)
154 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 3 ) in config.txt file !");
158 if (fgets(strbuf, 1024, config) == NULL) {
159 n_log(
LOG_ERR,
"FATAL ERROR: Can not read CPU_MODE in config.txt file !");
163 if (strncmp(strbuf,
"CPU_USE_FULL", 12) == 0)
165 else if (strncmp(strbuf,
"CPU_USE_NICE", 12) == 0)
167 else if (strncmp(strbuf,
"CPU_USE_LESS", 12) == 0)
170 n_log(
LOG_NOTICE,
"WARNING: NO USABLE CPU_MODE LOADED FROM CONFIG FILE ! USING DEFAULT CPU_FULL_USE !");
172 if (fgets(strbuf, 1024, config) == NULL)
174 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 7 ) in config.txt file !");
178 if (fgets(strbuf, 1024, config) == NULL) {
179 n_log(
LOG_ERR,
"FATAL ERROR: Can not read nb_min_particles in config.txt file !");
186 if (fgets(strbuf, 1024, config) == NULL)
188 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 9 ) in config.txt file !");
192 if (fgets(strbuf, 1024, config) == NULL) {
193 n_log(
LOG_ERR,
"FATAL ERROR: Can not read DRAWING_UPDATE_RATE in config.txt file !");
200 n_log(
LOG_NOTICE,
"WARNING: You can not have a negative or zero GFX_UPDATE_RATE\nDefault value ( 20000 ) will be used");
203 n_log(
LOG_NOTICE,
"WARNING: You would not want to have a 1 second GFX_UPDATE_RATE, no ?\nDefault value ( 20000 ) will be used");
207 if (fgets(strbuf, 1024, config) == NULL)
209 n_log(
LOG_ERR,
"FATAL ERROR: Can not read comment ( line 11 ) in config.txt file !");
213 if (fgets(strbuf, 1024, config) == NULL) {
214 n_log(
LOG_ERR,
"FATAL ERROR: Can not read LOGIC_RATE in config.txt file !");
221 n_log(
LOG_NOTICE,
"WARNING: You can not have a negative or zero LOGIC_RATE\nDefault value ( 10000 ) will be used");
225 n_log(
LOG_NOTICE,
"WARNING: You would not want to have a 1 second LOGIC_RATE, no ?\nDefault value ( 10000 ) will be used");