Exemplo n.º 1
0
void FeatureInst::step(GameState* gs) {

	if (gs->object_visible_test(this)) {
		sprite_id spr = spriteid;
		if (feature == DOOR_CLOSED) {
			spr = get_sprite_by_name("closed door");
		} else if (feature == DOOR_OPEN) {
			spr = get_sprite_by_name("open door");
		}
		last_seen_spr = spr;
	}
	if (gs->object_radius_test(x, y, TILE_SIZE)) {
		if (feature == DOOR_CLOSED) {
			gs->tiles().set_solid(x / TILE_SIZE, y / TILE_SIZE, false);
			gs->tiles().set_seethrough(x / TILE_SIZE, y / TILE_SIZE, true);
			feature = DOOR_OPEN;
		}
	} else if (!gs->object_radius_test(x, y, TILE_SIZE)) {
		if (feature == DOOR_OPEN) {
			gs->tiles().set_solid(x / TILE_SIZE, y / TILE_SIZE, true);
			gs->tiles().set_seethrough(x / TILE_SIZE, y / TILE_SIZE, false);
			feature = DOOR_CLOSED;
		}
	}
}
Exemplo n.º 2
0
void ConfigContent::draw(GameState* gs) const {
	GameSettings& settings = gs->game_settings();
	gl_draw_rectangle_outline(bbox, COL_UNFILLED_OUTLINE);

	BBox entry_box(bbox.x1, bbox.y1, bbox.x2, bbox.y1 + TILE_SIZE);
	draw_option(gs, entry_box, settings.autouse_mana_potions,
			get_sprite_by_name("mana_potion"), "Auto-Use Mana Potions");
	entry_box = entry_box.translated(0, TILE_SIZE);
	draw_option(gs, entry_box, settings.autouse_health_potions,
			get_sprite_by_name("health_potion"), "Auto-Use Health Potions");
}
Exemplo n.º 3
0
void CombatGameInst::draw(GameState *gs) {
	GameView& view = gs->view();
	SpriteEntry& spr = game_sprite_data[sprite];
	Colour draw_colour = effects().effected_colour();

	if (cooldowns().is_hurting()) {
		float s = 1 - hurt_alpha_value(cooldowns().hurt_cooldown);
		draw_colour = draw_colour.multiply(Colour(255, 255 * s, 255 * s));
	}

	int sx = x - spr.width() / 2, sy = y - spr.height() / 2;
	gl_draw_sprite(view, sprite, sx, sy, vx, vy, gs->frame(), draw_colour);

	effects().draw_effect_sprites(gs, Pos(sx, sy));

	if (is_resting) {
		GLimage& restimg =
				game_sprite_data[get_sprite_by_name("resting")].img();
		gl_draw_image(view, restimg, x - spr.width() / 2, y - spr.height() / 2);
	}
	CoreStats& ecore = effective_stats().core;

	//Draw health bar
	int healthbar_offsety = 20;
	if (target_radius > 16)
		healthbar_offsety = target_radius + 8;
	if (ecore.hp < ecore.max_hp) {
		const BBox statbox(x - 10, y - healthbar_offsety, x + 10,
				y - healthbar_offsety + 5);
		gl_draw_statbar(view, statbox, ecore.hp, ecore.max_hp);
	}
}
Exemplo n.º 4
0
SidebarNavigator::SidebarNavigator(const BBox& sidebar_bounds,
		const BBox& main_content_bounds) :
		side_bar(sidebar_bounds), main_content(main_content_bounds), view(
				INVENTORY), content_overlay(NULL), inventory(
				get_sprite_by_name("inventory_icon"),
				new InventoryContent(main_content_bounds),
				icon_bounds(main_content_bounds, 0, NUM_ICONS_ROW_1)), equipment(
				get_sprite_by_name("equipment_icon"),
				new EquipmentContent(main_content_bounds),
				icon_bounds(main_content_bounds, 1, NUM_ICONS_ROW_1)), spells(
				get_sprite_by_name("spells_icon"),
				new SpellsContent(main_content_bounds),
				icon_bounds(main_content_bounds, 2, NUM_ICONS_ROW_1)), enemies(
				get_sprite_by_name("enemies_icon"),
				new EnemiesSeenContent(main_content_bounds),
				icon_bounds(main_content_bounds, 0, NUM_ICONS_ROW_2, 1)), config(
				get_sprite_by_name("config_icon"),
				new ConfigContent(main_content_bounds),
				icon_bounds(main_content_bounds, 1, NUM_ICONS_ROW_2, 1)) {
}
Exemplo n.º 5
0
NavigationSprites::NavigationSprites() :
		left_arrow(get_sprite_by_name("left_arrow")), right_arrow(
				get_sprite_by_name("right_arrow")) {
}