void new_config_clicked(GtkWidget *w, gpointer data)
{
	col_config_t ccfg;
	ccfg.name = entry_box("Enter Configuration Name");

	if (ccfg.name == "")
		return;

	ccfg.add("background", col_background);
	ccfg.add("hilight", col_hilight);
	ccfg.add("selection", col_selection);
	ccfg.add("moving", col_moving);
	ccfg.add("tagged", col_tagged);
	ccfg.add("vertex", col_vertex);
	ccfg.add("line_solid", col_line_solid);
	ccfg.add("line_2s", col_line_2s);
	ccfg.add("line_monster", col_line_monster);
	ccfg.add("line_special", col_line_special);
	ccfg.add("linedraw", col_linedraw);
	ccfg.add("selbox", col_selbox);
	ccfg.add("selbox_line", col_selbox_line);
	ccfg.add("grid", col_grid);
	ccfg.add("64grid", col_64grid);
	ccfg.add("3d_crosshair", col_3d_crosshair);
	ccfg.add("3d_hilight", col_3d_hilight);
	ccfg.add("3d_hilight_line", col_3d_hilight_line);

	ccfg.path = parse_string("config/colours/%s.cfg", ccfg.name.c_str());
	colour_configs.push_back(ccfg);
	current = &colour_configs.back();
	col_config = ccfg.name;

	populate_config_combo(ccfg_combo);
}
Пример #2
0
static void draw_spells_known(GameState* gs, const BBox& bbox,
		SpellsKnown& spells, int ind_low, int ind_high) {
	const int spell_n = spells.amount();
	int mx = gs->mouse_x(), my = gs->mouse_y();
	int spellidx = ind_low;
	int selected_spell = gs->local_player()->spell_selected();

	gl_draw_rectangle_outline(bbox, COL_UNFILLED_OUTLINE);

	int x = bbox.x1, ex = bbox.x2;
	for (int y = bbox.y1; y < bbox.y2; y += TILE_SIZE) {
		if (spellidx >= spell_n)
			break;

		spell_id spell = spells.get(spellidx);
		SpellEntry& spl_entry = game_spell_data.at(spell);
		draw_spell_icon_and_name(gs, spl_entry, Colour(), x, y);

		BBox entry_box(x, y, ex, y + TILE_SIZE);
		Colour bbox_col = COL_FILLED_OUTLINE;
		if (spellidx == selected_spell) {
			bbox_col = COL_WHITE;
		}
		if (entry_box.contains(mx, my)) {
			bbox_col = COL_GOLD;
			draw_console_spell_description(gs, spl_entry);
		}
		gl_draw_rectangle_outline(entry_box, bbox_col);
		spellidx++;
	}
}
Пример #3
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");
}
Пример #4
0
bool ConfigContent::handle_io(GameState* gs, ActionQueue& queued_actions) {
	GameSettings& settings = gs->game_settings();
	bool leftclick = gs->mouse_left_click();
	Pos mpos = gs->mouse_pos();

	BBox entry_box(bbox.x1, bbox.y1, bbox.x2, bbox.y1 + TILE_SIZE);
	if (leftclick && entry_box.contains(mpos)) {
		settings.autouse_mana_potions = !settings.autouse_mana_potions;
	}
	entry_box = entry_box.translated(0, TILE_SIZE);
	if (leftclick && entry_box.contains(mpos)) {
		settings.autouse_health_potions = !settings.autouse_health_potions;
	}

	return false;
}
Пример #5
0
static bool handle_io_spells_known(GameState* gs, ActionQueue& queued_actions,
		const BBox& bbox, SpellsKnown& spells, int ind_low, int ind_high) {
	const int spell_n = spells.amount();
	int mx = gs->mouse_x(), my = gs->mouse_y();
	int spellidx = ind_low;

	int x = bbox.x1, ex = bbox.x2;
	for (int y = bbox.y1; y < bbox.y2; y += TILE_SIZE) {
		if (spellidx >= spell_n)
			break;

		BBox entry_box(x, y, ex - 2, y + TILE_SIZE);
		if (entry_box.contains(mx, my) && gs->mouse_left_click()) {
			queued_actions.push_back(
					game_action(gs, gs->local_player(), GameAction::CHOSE_SPELL,
							spellidx));
			return true;
		}
		spellidx++;
	}
	return false;
}
// menu_action: Called when a menu/toolbar item is selected
// ----------------------------------------------------- >>
static void menu_action(GtkAction *action)
{
	string act = gtk_action_get_name(action);

	if (act == "WadManager")
		open_main_window();
	else if (act == "Exit")
		gtk_main_quit();
	else if (act == "Close")
		file_close();
	else if (act == "ModeVerts")
		change_edit_mode(0);
	else if (act == "ModeLines")
		change_edit_mode(1);
	else if (act == "ModeSectors")
		change_edit_mode(2);
	else if (act == "ModeThings")
		change_edit_mode(3);
	else if (act == "Mode3d")
	{
		if (map.opened)
			start_3d_mode();
	}
	else if (act == "ShowConsole")
		popup_console();
	else if (act == "ShowScriptEditor")
		open_script_edit();
	else if (act == "Preferences")
		open_prefs_dialog();
	else if (act == "About")
	{
		gtk_show_about_dialog(GTK_WINDOW(editor_window),
								"name", "SLADE",
								"comments", "by Simon 'SlayeR' Judd, 2005",
								"version", __SLADEVERS,
								"website", "http://slade.mancubus.net",
								NULL);
	}
	else if (act == "Save")
	{
		if (edit_wad)
			file_save();
		else
			file_saveas();
	}
	else if (act == "SaveAs")
		file_saveas();
	else if (act == "MergeSectors")
		sector_merge(false);
	else if (act == "JoinSectors")
		sector_merge(true);
	else if (act == "CreateDoor")
		sector_create_door(open_texture_browser(true, false, false, "-"));
	else if (act == "CreateStairs")
		edit_create_stairs();
	else if (act == "CheckMapStats")
		check_map_stats();
	else if (act == "CheckTags")
		message_box(parse_string("%d Tags Cleaned", clean_tags()), GTK_MESSAGE_INFO);
	else if (act == "CheckVerts")
		message_box(parse_string("%d Vertices Removed", remove_free_verts()), GTK_MESSAGE_INFO);
	else if (act == "CheckLines")
		message_box(parse_string("%d 0-Length Lines Removed", remove_zerolength_lines()), GTK_MESSAGE_INFO);
	else if (act == "CheckSectors")
		message_box(parse_string("%d Sectors Removed", remove_unused_sectors()), GTK_MESSAGE_INFO);
	else if (act == "CheckTextures")
		check_textures();
	else if (act == "AlignX")
		line_align_x();
	else if (act == "CorrectRefs")
		line_correct_references();
	else if (act == "SplitLine")
	{
		int splits = 2;
		string ret = entry_box("Enter Number Of Splits:");

		if (ret != "")
			splits = atoi(ret.c_str());

		line_split(splits);
	}
	else
		message_box("Menu action not implemented", GTK_MESSAGE_INFO);

	force_map_redraw(true, true);
}