Revision 324
corrected some more things
ent.c | ||
---|---|---|
301 | 301 |
return map_collides_gunner_pos(p, gunner_get_x(shooter), gunner_get_y(shooter), radius); |
302 | 302 |
} |
303 | 303 |
int (map_make_dijkstra)(map_t *p, double x_, double y_){ |
304 |
int16_t x = x_, y = y_;
|
|
304 |
int16_t x = (int16_t)x_, y = (int16_t)y_;
|
|
305 | 305 |
|
306 | 306 |
const uint16_t W = basic_sprite_get_w(p->bsp_background), |
307 | 307 |
H = basic_sprite_get_h(p->bsp_background); |
... | ... | |
322 | 322 |
|
323 | 323 |
while(!queue_empty(q)){ |
324 | 324 |
c = *(int*)queue_top(q); free(queue_top(q)); queue_pop(q); |
325 |
x = c%W, y = c/W;
|
|
325 |
x = (int16_t)(c%W), y = (int16_t)(c/W);
|
|
326 | 326 |
if(p->visited[c]) continue; |
327 | 327 |
p->visited[c] = true; |
328 | 328 |
if(p->collide_gunner[c]) continue; |
... | ... | |
338 | 338 |
} |
339 | 339 |
int (map_where_to_follow)(const map_t *p, double x, double y, double *theta){ |
340 | 340 |
const uint16_t W = basic_sprite_get_w(p->bsp_background); |
341 |
int x_ = x, y_ = y; |
|
342 |
int pos = y_*W+x_; |
|
343 |
//printf("Is in %d,%d\n", x_, y_); |
|
344 |
int newx = p->prev[pos]%W, newy = p->prev[pos]/W; |
|
345 |
//printf("from %d,%d to %d,%d\n", x_, y_, newx, newy); |
|
341 |
int16_t x_ = (int16_t)x, y_ = (int16_t)y; |
|
342 |
int32_t pos = y_*W+x_; |
|
343 |
int16_t newx = (int16_t)(p->prev[pos]%W), newy = (int16_t)(p->prev[pos]/W); |
|
346 | 344 |
*theta = atan2(-(newy-y_), newx-x_); |
347 | 345 |
return SUCCESS; |
348 | 346 |
} |
Also available in: Unified diff