Example #1
0
/*
 * loads general pokemon data like names and species data
 */
s8 	loadData(Handle *sdHandle, FS_archive *sdArchive)
{
  u8	tmp[12000];
  u32 	bytesRead;
  Result ret;

  printf("Loading species data...");
  ret = loadFile("/3ds/PCHex/data/personal", tmp, sdArchive, sdHandle, 12000, &bytesRead); 
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  memcpy(pkData.pkmData, tmp, bytesRead);
  printf(" OK\n");

  printf("Loading species names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Species_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.species[0], 12, bytesRead);
  printf(" OK\n");

  printf("Loading move names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Moves_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.moves[0], 17, bytesRead);
  printf(" OK\n");

  printf("Loading ability names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Abilities_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.abilities[0], 15, bytesRead);
  printf(" OK\n");

  printf("Loading item names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Items_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.items[0], 17, bytesRead);
  printf(" OK\n");

  printf("Loading ball names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Balls_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.balls[0], 13, bytesRead);
  printf(" OK\n");

  printf("Loading nature names...");
  ret = loadFile("/3ds/PCHex/data/text/text_Natures_en.txt", tmp, sdArchive, sdHandle, 12000, &bytesRead);
  if (ret) { printf("loading failed : error code %ld\n", ret); return ret; }
  loadLines(tmp, pkData.natures[0], 8, bytesRead);
  printf(" OK\n");
  

  
  return 0;
}
Example #2
0
void initLines(TSafeVector *p)
{
	loadLines(p,"input3.txt");
}
Example #3
0
RobotScene::RobotScene(RobotControls* robotControls) : QGraphicsScene()
{
	this->robotControls = robotControls;

	connect(robotControls, SIGNAL(newPose(double, double, double)), this, SLOT(slotSetPose(double, double, double)));
	connect(this, SIGNAL(newPose(double, double, double)), robotControls, SLOT(slotSetPose(double, double, double)));

	// make sure the robot gets updated regularly.
	timer = new QTimer();
	connect(timer, SIGNAL(timeout()), this, SLOT(slotUpdateRobot()));

	// for the clearTrace-Button
	connect(robotControls->btnClearTrace, SIGNAL(clicked()), this, SLOT(slotClearTrace()));

	// when robotcontrols has new splines for us, process them
	connect(robotControls, SIGNAL(showSplineCubic(bool, QList<QPointF>)), this, SLOT(slotUpdateSplineCubic(bool, QList<QPointF>)));
	connect(robotControls, SIGNAL(showSplineHermite(bool, QList<QPointF>, float, float)), this, SLOT(slotUpdateSplineHermite(bool, QList<QPointF>, float, float)));

	config = Configuration::instance();

	// initialize the random number generator. Used for movement noise.
	struct timeval now;
	gettimeofday (&now, 0x0);
	srand(now.tv_usec);

	scaleFactor = 20.0;

	double wheelWidth = 0.04 * scaleFactor;
	double wheelHeight = 0.15 * scaleFactor;

	pose.setPose(QPointF(13.0, 13.0), 0.0);
	robotAngle = 0.0;

	splineCubic = 0;
	splineCubicPath = 0;
	splineCubicPathItem = 0;
	splineHermite = 0;
	splineHermitePath = 0;
	splineHermitePathItem = 0;

	iterations = 0;

	robotItem = new RobotItem(-0.35*scaleFactor, -0.35*scaleFactor, 0.7*scaleFactor, 0.7*scaleFactor);
	connect(robotItem, SIGNAL(newPose(double, double, double)), SLOT(slotSetPose(double, double, double)));

	robotPath = new QPainterPath();
	robotPathItem = new QGraphicsPathItem();
	robotPathItem->setPen(QPen(Qt::green));

	wheelL = new QGraphicsRectItem(-wheelHeight/2, -wheelWidth/2, wheelHeight, wheelWidth, robotItem);
	wheelR = new QGraphicsRectItem(-wheelHeight/2, -wheelWidth/2, wheelHeight, wheelWidth, robotItem);

	wheelL->setPos(0, -scaleFactor * config->getAxisLength() / 2.0);
	wheelR->setPos(0, +scaleFactor * config->getAxisLength() / 2.0);

	// the axis goes from left to right wheel.
	axis = new QGraphicsLineItem(
		wheelL->pos().x(),
		wheelL->pos().y(),
		wheelR->pos().x(),
		wheelR->pos().y(),
		robotItem
	);

	// fake items, used for grouping
	laserMarksParent = new QGraphicsRectItem(1000, 1000, 0, 0);
	tracerParent = new QGraphicsRectItem(1, 1, 0, 0);
	linesParent = new QGraphicsRectItem(2, 2, 0, 0);

	addItem(robotItem);
	addItem(robotPathItem);
	addItem(laserMarksParent);

// 	QGraphicsTextItem* labelL = new QGraphicsTextItem("l", wheelL);
// 	labelL->setFlags(QGraphicsItem::ItemIgnoresTransformations);
// 	labelL->setFont(QFont("Arial", 30));
// 	addItem(labelL);
//
// 	QGraphicsTextItem* labelR = new QGraphicsTextItem("r", wheelR);
// 	labelR->setFlags(QGraphicsItem::ItemIgnoresTransformations);
// 	labelR->setFont(QFont("Arial", 30));
// 	addItem(labelR);

	//1000/25
	timer->start(50);

	loadLaserMarks(config->getKnownLaserMarksFilename());
	loadLines(config->getLinesFilename());
}