Esempio n. 1
0
void Console::cmdGotoArea(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	Module *module = _engine->getModule();
	if (!module)
		return;

	int32 areaID = -1;
	try {
		Common::parseString(cl.args, areaID);
	} catch (...) {
		printCommandHelp(cl.cmd);
		return;
	}

	std::set<int32>::const_iterator area = _areas.find(areaID);
	if (area == _areas.end()) {
		printf("No such area %d", areaID);
		return;
	}

	module->movePC(areaID);
}
Esempio n. 2
0
void Console::cmdPlaySound(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	playSound(cl.args, Sound::kSoundTypeSFX);
}
Esempio n. 3
0
void Console::cmdPlayVideo(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	playVideo(cl.args);
}
Esempio n. 4
0
void Console::cmdHelp(const CommandLine &cli) {
	if (cli.args.empty()) {
		printFullHelp();
		return;
	}

	printCommandHelp(cli.args);
}
Esempio n. 5
0
void Console::cmdDump2DA(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	if (dump2DA(cl.args))
		printf("Dumped 2DA \"%s\"", cl.args.c_str());
	else
		printf("Failed dumping 2DA \"%s\"", cl.args.c_str());
}
Esempio n. 6
0
void Console::cmdDumpResList(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	if (dumpResList(cl.args))
		printf("Dumped list of resources to file \"%s\"", cl.args.c_str());
	else
		printf("Failed dumping list of resources to file \"%s\"", cl.args.c_str());
}
Esempio n. 7
0
void Console::cmdLoadModule(const CommandLine &cl) {
	if (!_module)
		return;

	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	_module->replaceModule(cl.args);
}
Esempio n. 8
0
	bool ConsoleCmd_Help::execute( Console & console , const std::vector< LocalizedString >& parameterList )
	{
		LocalizedStringStream helpText;

		if( parameterList.empty() )
		{
			// print all the command's help texts

			for( Console::CommandIndex::iterator it = console.m_commandIndex.begin(); it != console.m_commandIndex.end(); ++it )
			{
				const ConsoleCommandPtr command = it->second;
				GC_ASSERT_NOT_NULL( command.get() );

				printCommandHelp( helpText, console.commandCallPrefix(), command );
			}

		}
		else
		{
			// take the first parameter as the command name we want to print the help text of
			const ConsoleCommandPtr command = console.command( parameterList[0] );

			if( command )
			{
				// command found!
				printCommandHelp( helpText, console.commandCallPrefix(), command );
			}
			else
			{
				// command not found!
				helpText << L"Command not found : " <<  parameterList[0];
			}
		}

		console.printText( helpText.str() );

		return false;
	}
Esempio n. 9
0
void Console::cmdLoadModule(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	for (std::vector<Common::UString>::iterator m = _modules.begin(); m != _modules.end(); ++m) {
		if (m->equalsIgnoreCase(cl.args)) {
			hide();
			_engine->getGame().getModule().load(cl.args);
			return;
		}
	}

	printf("No such module \"%s\"", cl.args.c_str());
}
Esempio n. 10
0
void Console::cmdGotoArea(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	const std::vector<Common::UString> &areas = _engine->getGame().getModule().getIFO().getAreas();
	for (std::vector<Common::UString>::const_iterator a = areas.begin(); a != areas.end(); ++a)
		if (a->equalsIgnoreCase(cl.args)) {
			hide();
			_engine->getGame().getModule().movePC(*a);
			return;
		}

	printf("Area \"%s\" does not exist", cl.args.c_str());
}
Esempio n. 11
0
void Console::cmdMove(const CommandLine &cl) {
	std::vector<Common::UString> args;
	splitArguments(cl.args, args);

	float x, z, y;
	if ((args.size() < 3) ||
	    (std::sscanf(args[0].c_str(), "%f", &x) != 1) ||
	    (std::sscanf(args[1].c_str(), "%f", &y) != 1) ||
	    (std::sscanf(args[2].c_str(), "%f", &z) != 1)) {

		printCommandHelp(cl.cmd);
		return;
	}

	_engine->getGame().getModule().movePC(x, y, z);
}
Esempio n. 12
0
void Console::cmdLoadCampaign(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	updateCampaigns();
	for (std::vector<Common::UString>::const_iterator c = _campaigns.begin(); c != _campaigns.end(); ++c) {
		if (c->equalsIgnoreCase(cl.args)) {
			hide();
			_engine->getGame().getCampaign().load(*c);
			return;
		}
	}

	printf("No such campaign \"%s\"", cl.args.c_str());
}
Esempio n. 13
0
void Console::cmdGotoArea(const CommandLine &cl) {
	if (!_module)
		return;

	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	const std::vector<Common::UString> &areas = _module->_ifo.getAreas();
	for (std::vector<Common::UString>::const_iterator a = areas.begin(); a != areas.end(); ++a)
		if (a->equalsIgnoreCase(cl.args)) {
			_module->_newArea = *a;
			return;
		}

	printf("Area \"%s\" does not exist", cl.args.c_str());
}
Esempio n. 14
0
void Console::cmdLoadModule(const CommandLine &cl) {
	if (!_module)
		return;

	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	for (std::list<Common::UString>::iterator m = _modules.begin(); m != _modules.end(); ++m) {
		if (m->equalsIgnoreCase(cl.args)) {
			_module->changeModule(cl.args + ".mod");
			return;
		}
	}

	printf("No such module \"%s\"", cl.args.c_str());
}
Esempio n. 15
0
void Console::cmdLoadCampaign(const CommandLine &cl) {
	if (!_module)
		return;

	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	CampaignMap::const_iterator c = _campaignModules.find(cl.args);
	if (c == _campaignModules.end()) {
		printf("No such campaign module \"%s\"", cl.args.c_str());
		return;
	}

	Common::UString module = Common::UString(kCampaignModules[c->second]) + ".nwm";
	_module->changeModule(module);
}