Ejemplo n.º 1
0
void
transform_setup(struct transformation *t, struct pcoord *c, int scale, int yaw)
{
	t->pro=c->pro;
	t->map_center.x=c->x;
	t->map_center.y=c->y;
	t->scale=scale/16.0;
	transform_set_yaw(t, yaw);
}
Ejemplo n.º 2
0
static void
cursor_draw_do(struct cursor *this_, int lazy)
{
	struct point p;
	int speed=this_->speed;
	int angle=this_->angle;

	if (!this_->attrs || !this_->gra)
		return;
	if (!this_->gra)
		return;
	transform_set_yaw(this_->trans, -this_->angle);
	graphics_draw_mode(this_->gra, draw_mode_begin);
	p.x=0;
	p.y=0;
	graphics_draw_rectangle(this_->gra, this_->bg, &p, this_->w, this_->h);
	for (;;) {
		struct attr **attr=this_->attrs;
		int sequence=this_->sequence;
		int match=0;
		while (*attr) {
			if ((*attr)->type == attr_itemgra) {
				struct itemgra *itm=(*attr)->u.itemgra;
				dbg(1,"speed %d-%d %d\n", itm->speed_range.min, itm->speed_range.max, speed);
				if (speed >= itm->speed_range.min && speed <= itm->speed_range.max &&  
				    angle >= itm->angle_range.min && angle <= itm->angle_range.max &&  
				    sequence >= itm->sequence_range.min && sequence <= itm->sequence_range.max) {
					graphics_draw_itemgra(this_->gra, itm, this_->trans);
					match=1;
				}
			}
			attr++;
		}
		if (match) {
			break;
		} else {
			if (this_->sequence) 
				this_->sequence=0;
			else
				break;
		}
	}
	graphics_draw_drag(this_->gra, &this_->cursor_pnt);
	graphics_draw_mode(this_->gra, lazy ? draw_mode_end_lazy : draw_mode_end);
}