bool is_frame_visible_at_room (struct frame *f, int room) { struct frame nf; nf = *f; frame2room (&nf, room, &nf.c); struct coord tl, tr, bl, br; _tl (&nf, &tl); _tr (&nf, &tr); _bl (&nf, &bl); _br (&nf, &br); if (nf.c.room == room && ((tl.x >= 0 && tl.x <= ORIGINAL_WIDTH && tl.y >=0 && tl.y <= ORIGINAL_HEIGHT) || (tr.x >= 0 && tr.x <= ORIGINAL_WIDTH && tr.y >=0 && tr.y <= ORIGINAL_HEIGHT) || (bl.x >= 0 && bl.x <= ORIGINAL_WIDTH && bl.y >=0 && bl.y <= ORIGINAL_HEIGHT) || (br.x >= 0 && br.x <= ORIGINAL_WIDTH && br.y >=0 && br.y <= ORIGINAL_HEIGHT))) return true; else return false; }
struct coord * place_at_pos (struct frame *f, coord_f cf, struct pos *p, struct coord *c) { struct coord _c; cf (f, &_c); struct coord tl; _tl (f, &tl); int dx = _c.x - tl.x; int dy = _c.y - tl.y; c->l = p->l; c->room = p->room; c->x = PLACE_WIDTH * p->place + 30 - dx; c->y = PLACE_HEIGHT * p->floor + 34 - dy; return c; }
struct coord * place_at_distance (struct frame *f0, coord_f cf0, struct frame *f1, coord_f cf1, int d, enum dir dir, struct coord *c) { struct coord c0; cf0 (f0, &c0); struct coord c1; cf1 (f1, &c1); struct coord tl; _tl (f1, &tl); *c = c1; coord2room (&c0, c1.room, &c0); c->x = (c0.x - c1.x) + ((dir == RIGHT) ? d : -d) + tl.x; return c; }