Project

General

Profile

Revision 340

more changes in ent.h, ent.c

View differences:

proj_func.c
251 251
    }
252 252
}
253 253

  
254
void (get_random_spawn)(const map_t *map, gunner_t *p, list_t *l) {
255
    uint16_t w = map_get_width(map), h = map_get_height(map);
256
    double x, y;
257

  
258
    while(true){
259
        x = rand() % w;
260
        y = rand() % h;
261
        gunner_set_pos(p, x, y);
262
        if(map_collides_gunner(map, p)) continue;
263
        int collides = false;
264
        list_node_t *it = list_begin(l);
265
        while(it != list_end(l)){
266
            if(gunner_collides_gunner(p, *list_node_val(it))){
267
                collides = true;
268
                break;
269
            }
270
            it = list_node_next(it);
271
        }
272
        if(!collides) return;
273
    }
274
}
275

  
276 254
void update_scale(void) {
277 255
    static uint8_t last_plus = 0, last_minus = 0;
278 256
    if (key_presses.ctrl_pressed) {

Also available in: Unified diff