equal
deleted
inserted
replaced
102 flib_cfg_meta *metaconf = flib_cfg_meta_from_ini("basicsettings.ini", "gamemods.ini"); |
102 flib_cfg_meta *metaconf = flib_cfg_meta_from_ini("basicsettings.ini", "gamemods.ini"); |
103 assert(metaconf); |
103 assert(metaconf); |
104 flib_gamesetup setup; |
104 flib_gamesetup setup; |
105 setup.gamescheme = flib_cfg_from_ini(metaconf, "scheme_shoppa.ini"); |
105 setup.gamescheme = flib_cfg_from_ini(metaconf, "scheme_shoppa.ini"); |
106 setup.map = flib_map_create_maze("Jungle", MAZE_SIZE_MEDIUM_TUNNELS); |
106 setup.map = flib_map_create_maze("Jungle", MAZE_SIZE_MEDIUM_TUNNELS); |
107 setup.seed = "apsfooasdgnds"; |
107 setup.seed = "asparagus"; |
108 setup.script = NULL; |
108 setup.script = NULL; |
109 setup.teamcount = 2; |
109 setup.teamcount = 2; |
110 setup.teams = calloc(2, sizeof(flib_team*)); |
110 setup.teams = calloc(2, sizeof(flib_team*)); |
111 setup.teams[0] = calloc(1, sizeof(flib_team)); |
111 setup.teams[0] = calloc(1, sizeof(flib_team)); |
112 setup.teams[0]->color = 0xffff0000; |
112 setup.teams[0]->color = 0xffff0000; |
164 while(gameconn) { |
164 while(gameconn) { |
165 flib_gameconn_tick(gameconn); |
165 flib_gameconn_tick(gameconn); |
166 } |
166 } |
167 } |
167 } |
168 |
168 |
|
169 void testSave() { |
|
170 FILE *demofile = fopen("testsave.42.hws", "rb"); |
|
171 assert(demofile); |
|
172 flib_vector *vec = flib_vector_create(); |
|
173 uint8_t demobuf[512]; |
|
174 int len; |
|
175 while((len=fread(demobuf, 1, 512, demofile))>0) { |
|
176 flib_vector_append(vec, demobuf, len); |
|
177 } |
|
178 fclose(demofile); |
|
179 flib_constbuffer constbuf = flib_vector_as_constbuffer(vec); |
|
180 flib_gameconn *gameconn = flib_gameconn_create_loadgame("Medo42", constbuf.data, constbuf.size); |
|
181 flib_vector_destroy(vec); |
|
182 assert(gameconn); |
|
183 flib_gameconn_onDisconnect(gameconn, &onDisconnect, &gameconn); |
|
184 flib_gameconn_onGameRecorded(gameconn, &onGameRecorded, &gameconn); |
|
185 startEngineGame(flib_gameconn_getport(gameconn)); |
|
186 |
|
187 while(gameconn) { |
|
188 flib_gameconn_tick(gameconn); |
|
189 } |
|
190 } |
|
191 |
169 int main(int argc, char *argv[]) { |
192 int main(int argc, char *argv[]) { |
170 flib_init(0); |
193 flib_init(0); |
171 flib_log_setLevel(FLIB_LOGLEVEL_ALL); |
194 flib_log_setLevel(FLIB_LOGLEVEL_ALL); |
172 |
195 |
173 //testMapPreview(); |
196 //testMapPreview(); |
174 testDemo(); |
197 //testDemo(); |
|
198 //testSave(); |
|
199 testGame(); |
175 |
200 |
176 flib_quit(); |
201 flib_quit(); |
177 return 0; |
202 return 0; |
178 } |
203 } |