Exemple #1
0
/* ItemSelection::selectThingsWithin
 * Selects all things in [map] that are within [rect]
 *******************************************************************/
void ItemSelection::selectThingsWithin(const SLADEMap& map, const frect_t& rect)
{
	// Start new change set
	last_change_.clear();

	// Select vertices within bounds
	for (unsigned a = 0; a < map.nThings(); a++)
		if (rect.contains(map.getThing(a)->point()))
			selectItem({ (int)a, ItemType::Thing });
}
Exemple #2
0
/* ItemSelection::selectSectorsWithin
 * Selects all sectors in [map] that are within [rect]
 *******************************************************************/
void ItemSelection::selectSectorsWithin(const SLADEMap& map, const frect_t& rect)
{
	// Start new change set
	last_change_.clear();

	// Select sectors within bounds
	for (unsigned a = 0; a < map.nSectors(); a++)
		if (map.getSector(a)->boundingBox().is_within(rect.tl, rect.br))
			selectItem({ (int)a, ItemType::Sector });
}
Exemple #3
0
/* ItemSelection::selectLinesWithin
 * Selects all lines in [map] that are within [rect]
 *******************************************************************/
void ItemSelection::selectLinesWithin(const SLADEMap& map, const frect_t& rect)
{
	// Start new change set
	last_change_.clear();

	// Select lines within bounds
	for (unsigned a = 0; a < map.nLines(); a++)
		if (rect.contains(map.getLine(a)->v1()->point()) &&
			rect.contains(map.getLine(a)->v2()->point()))
			selectItem({ (int)a, ItemType::Line });
}
/* ScriptEditorPanel::saveScripts
 * Saves the current content of the text editor to the scripts entry
 *******************************************************************/
void ScriptEditorPanel::saveScripts()
{
	// Write text to entry
	wxCharBuffer buf = text_editor->GetText().mb_str();
	entry_script->importMem(buf, buf.length());

	// Process ACS open scripts
	string lang = theGameConfiguration->scriptLanguage();
	if (entry_script->getSize() > 0 && (lang == "acs_hexen" || lang == "acs_zdoom"))
	{
		SLADEMap* map = &(theMapEditor->mapEditor().getMap());
		map->mapSpecials()->processACSScripts(entry_script);
		map->mapSpecials()->updateTaggedSectors(map);
	}
}
Exemple #5
0
/* ScriptEditorPanel::saveScripts
 * Saves the current content of the text editor to the scripts entry
 *******************************************************************/
void ScriptEditorPanel::saveScripts()
{
	// Trim whitespace
	if (txed_trim_whitespace)
		text_editor->trimWhitespace();

	// Write text to entry
	wxCharBuffer buf = text_editor->GetText().mb_str();
	entry_script->importMem(buf, buf.length());

	// Process ACS open scripts
	string lang = Game::configuration().scriptLanguage();
	if (entry_script->getSize() > 0 && (lang == "acs_hexen" || lang == "acs_zdoom"))
	{
		SLADEMap* map = &(MapEditor::editContext().map());
		map->mapSpecials()->processACSScripts(entry_script);
		map->mapSpecials()->updateTaggedSectors(map);
	}
}
Exemple #6
0
/* MapSpecials::processZDoomLineSpecial
 * Process ZDoom line special
 *******************************************************************/
void MapSpecials::processZDoomLineSpecial(MapLine* line)
{
	// Get special
	int special = line->getSpecial();
	if (special == 0)
		return;

	// Get parent map
	SLADEMap* map = line->getParentMap();

	// Get args
	int args[5];
	for (unsigned arg = 0; arg < 5; arg++)
		args[arg] = line->intProperty(S_FMT("arg%d", arg));

	// --- TranslucentLine ---
	if (special == 208)
	{
		// Get tagged lines
		vector<MapLine*> tagged;
		if (args[0] > 0)
			map->getLinesById(args[0], tagged);
		else
			tagged.push_back(line);

		// Get args
		double alpha = (double)args[1] / 255.0;
		string type = (args[2] == 0) ? "translucent" : "add";

		// Set transparency
		for (unsigned l = 0; l < tagged.size(); l++)
		{
			tagged[l]->setFloatProperty("alpha", alpha);
			tagged[l]->setStringProperty("renderstyle", type);

			LOG_MESSAGE(3, S_FMT("Line %d translucent: (%d) %1.2f, %s", tagged[l]->getIndex(), args[1], alpha, CHR(type)));
		}
	}
}
/* ScriptEditorPanel::openScripts
 * Opens script text from entry [scripts], and compiled script data
 * from [compiled]
 *******************************************************************/
bool ScriptEditorPanel::openScripts(ArchiveEntry* script, ArchiveEntry* compiled)
{
	// Clear current script data
	entry_script->clearData();
	entry_compiled->clearData();

	// Import script data
	if (script) entry_script->importEntry(script);
	if (compiled) entry_compiled->importEntry(compiled);

	// Process ACS open scripts
	string lang = theGameConfiguration->scriptLanguage();
	if (entry_script->getSize() > 0 && (lang == "acs_hexen" || lang == "acs_zdoom"))
	{
		SLADEMap* map = &(theMapEditor->mapEditor().getMap());
		map->mapSpecials()->processACSScripts(entry_script);
		map->mapSpecials()->updateTaggedSectors(map);
	}

	// Load script text
	return text_editor->loadEntry(entry_script);
}