Beispiel #1
0
/*
 * Do the actual work of showing me with arrow in top-down view
 */
void
showMe(Loc x_loc, Loc y_loc, Direction dir)
{
	register BitCell	*bp;
	Rat		rp;

	bp = normalArrows;

	HackMazeBitmap(x_loc, y_loc, &bp[dir.value()]);


	rp = M->rat(MY_RAT_INDEX);

	rp.playing = TRUE;
	rp.x = x_loc;
	rp.y = y_loc;
	rp.dir = dir;
	M->ratIs(rp, MY_RAT_INDEX);
}
Beispiel #2
0
void
ShowView(Loc x, Loc y, Direction dir)
{
	register XYpair		*tp = viewTable;
	register int		tx = x.value();
	register int		ty = y.value();
	RatIndexType			ratIndex(0);
	RatLook			ratLook;
	bool			oldVisible;

	ClearView();
	prevEdge3 = prevEdge7 = FALSE;
	while (!M->maze_[tx][ty]) {
		tp = hidden(tx, ty, dir, tp);	/* draw a cell */
		switch (dir.value()) {
		case NORTH:	tx++; break;
		case SOUTH:	tx--; break;
		case EAST:	ty++; break;
		case WEST:	ty--; break;
		}
	}
	if (prevEdge3)
		(void) plotLine(edge3Lines, TRUE);
	if (prevEdge7)
		(void) plotLine(edge7Lines, TRUE);

	/* show the tokens */

	for (ratIndex = 0; ratIndex < MAX_RATS; ratIndex = RatIndexType(ratIndex.value() + 1)) {
		if (ratIndex == MY_RAT_INDEX)
			continue;
		ratLook = &Rats2Display[ratIndex.value()];
		oldVisible = ratLook->visible;
		TokenVisible(ratIndex);
		if (ratLook->visible == TRUE)
			XORToken(ratIndex);
		if (ratLook->visible != oldVisible)
			UpdateScoreCard(ratIndex);
	}
}
Beispiel #3
0
bool Actor::canWalkTo(Position pos, Direction dir)
{
  switch(dir.value()){
    case enums::NORTH: pos.y += -1; break;
    case enums::WEST:  pos.x += -1; break;
    case enums::EAST:  pos.x += 1; break;
    case enums::SOUTH: pos.y += 1; break;
    default:
      break;
  }

  if(isInSpawnRange(pos)){
    if(getWalkCache(pos) == 0){
      return false;
    }

    Tile* tile = g_game.getParentTile(pos.x, pos.y, pos.z);
    if(tile && tile->getTopVisibleCreature(this) == NULL && tile->__queryAdd(0, this, 1, FLAG_PATHFINDING) == RET_NOERROR){
      return true;
    }
  }

  return false;
}