Example #1
0
static void
draw_minimap_buildings(minimap_t *minimap, frame_t *frame)
{
	const int building_remap[] = {
		BUILDING_CASTLE,
		BUILDING_STOCK, BUILDING_TOWER, BUILDING_HUT,
		BUILDING_FORTRESS, BUILDING_TOOLMAKER, BUILDING_SAWMILL,
		BUILDING_WEAPONSMITH, BUILDING_STONECUTTER, BUILDING_BOATBUILDER,
		BUILDING_FORESTER, BUILDING_LUMBERJACK, BUILDING_PIGFARM,
		BUILDING_FARM, BUILDING_FISHER, BUILDING_MILL, BUILDING_BUTCHER,
		BUILDING_BAKER, BUILDING_STONEMINE, BUILDING_COALMINE,
		BUILDING_IRONMINE, BUILDING_GOLDMINE, BUILDING_STEELSMELTER,
		BUILDING_GOLDSMELTER
	};

	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			int pos = MAP_POS(col, row);
			int obj = MAP_OBJ(pos);
			if (obj > MAP_OBJ_FLAG && obj <= MAP_OBJ_CASTLE) {
				int color = game.player[MAP_OWNER(pos)]->color;
				if (minimap->advanced > 0) {
					building_t *bld = game_get_building(MAP_OBJ_INDEX(pos));
					if (BUILDING_TYPE(bld) == building_remap[minimap->advanced]) {
						draw_minimap_point(minimap, col, row, color,
								   minimap->scale, frame);
					}
				} else {
					draw_minimap_point(minimap, col, row, color,
							   minimap->scale, frame);
				}
			}
		}
	}
}
Example #2
0
static void
draw_minimap_grid(minimap_t *minimap, frame_t *frame)
{
	for (int y = 0; y < game.map.rows * minimap->scale; y += 2) {
		draw_minimap_point(minimap, 0, y, 47, 1, frame);
		draw_minimap_point(minimap, 0, y+1, 1, 1, frame);
	}

	for (int x = 0; x < game.map.cols * minimap->scale; x += 2) {
		draw_minimap_point(minimap, x, 0, 47, 1, frame);
		draw_minimap_point(minimap, x+1, 0, 1, 1, frame);
	}
}
Example #3
0
static void
draw_minimap_map(minimap_t *minimap, frame_t *frame)
{
	uint8_t *color_data = game.minimap;
	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			uint8_t color = *(color_data++);
			draw_minimap_point(minimap, col, row, color,
					   minimap->scale, frame);
		}
	}
}
Example #4
0
static void
draw_minimap_roads(minimap_t *minimap, frame_t *frame)
{
	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			int pos = MAP_POS(col, row);
			if (MAP_PATHS(pos)) {
				draw_minimap_point(minimap, col, row, 1,
						   minimap->scale, frame);
			}
		}
	}
}
Example #5
0
static void
draw_minimap_ownership(minimap_t *minimap, int density, frame_t *frame)
{
	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			map_pos_t pos = MAP_POS(col, row);
			if (MAP_HAS_OWNER(pos)) {
				int color = game.player[MAP_OWNER(pos)]->color;
				draw_minimap_point(minimap, col, row, color,
						   density, frame);
			}
		}
	}
}
Example #6
0
static void
draw_minimap_traffic(minimap_t *minimap, frame_t *frame)
{
	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			int pos = MAP_POS(col, row);
			if (MAP_IDLE_SERF(pos)) {
				int color = game.player[MAP_OWNER(pos)]->color;
				draw_minimap_point(minimap, col, row, color,
						   minimap->scale, frame);
			}
		}
	}
}
Example #7
0
static void
draw_minimap_ownership(minimap_t *minimap, int density, frame_t *frame)
{
	const int player_colors[] = {
		64, 72, 68, 76
	};

	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			map_pos_t pos = MAP_POS(col, row);
			if (MAP_HAS_OWNER(pos)) {
				int color = player_colors[MAP_OWNER(pos)];
				draw_minimap_point(minimap, col, row, color,
						   density, frame);
			}
		}
	}
}
Example #8
0
static void
draw_minimap_traffic(minimap_t *minimap, frame_t *frame)
{
	const int player_colors[] = {
		64, 72, 68, 76
	};

	for (int row = 0; row < game.map.rows; row++) {
		for (int col = 0; col < game.map.cols; col++) {
			int pos = MAP_POS(col, row);
			if (MAP_IDLE_SERF(pos)) {
				int color = player_colors[MAP_OWNER(pos)];
				draw_minimap_point(minimap, col, row, color,
						   minimap->scale, frame);
			}
		}
	}
}