Ejemplo n.º 1
0
void Map::draw() {
     for (int x = 0; x < MAP_WIDTH; x++) {
         for (int y = 0; y < MAP_HEIGHT; y++) {
             Tile *t = getMapTile(x,y);
             int drawX = cam.getMapDrawX(x);
             int drawY = cam.getMapDrawY(y);
             
             if (!t->drawMe()) {              
              continue;      
             }
             
             if (!t->isVisible()) {
                 if (t->alpha > 128) t->alpha -= FOG_FADE_SPEED;
                // if (t->alpha < 128) continue;                     
             }
             
            if (!inFOV(x, y, zFocus)) continue;

            // if (z != zFocus) continue;
             
             //if (z < zFocus) continue;
             
             if (t->isVisible())  t->alpha += FOG_FADE_SPEED;
           
               
//               if (t->alpha < 255) {
//                    boxRGBA(screen, drawX, drawY, 32, 32, 0, 0, 0, 255);
//               }
               boxRGBA(screen, drawX, drawY, drawX+31, drawY+31, 0, 0, 0, 255); 
               drawtile(0, t->getGridX(), t->getGridY(), drawX, drawY, 0, false, t->alpha);                      
         }    
     }
}
Ejemplo n.º 2
0
/**
 * Toggle flag off for a tile.
 */
bool Game::flagoff(CoordinateSet pos) {
	Tile *tile = this->getTile(pos);
	bool alreadyflag = FLAG_ON(tile->getFlag());
	tile->setFlag(false);
	if (alreadyflag) --this->flagcount;
	drawtile(pos);
	return alreadyflag;
}
Ejemplo n.º 3
0
/**
 * Toggle flag on for a tile. Used to mark that the player believes the tile
 * contains a bomb.
 */
bool Game::flagon(CoordinateSet pos) {
	Tile *tile = this->getTile(pos);
	bool alreadyflag = FLAG_ON(tile->getFlag());
	tile->setFlag(true);
	if (!tile->amIDeadNow()) {
		std::cout << "Whoops, setting flag on a safe tile" << std::endl;
	}
	if (!alreadyflag) ++this->flagcount;
	drawtile(pos);
	return !alreadyflag;
}
Ejemplo n.º 4
0
/**
 * Output the whole thing
 */
void Game::output() {
	TIMERON;
	immedok(window, false);
	werase(window);
	for (CoordinateSetList::const_iterator i = coordbegin(); i != coordend(); ++i) {
		drawtile(*i);
	}
	drawborders();
	immedok(window, true);
	wrefresh(window);
	TIMEROFF;
}
Ejemplo n.º 5
0
/**
 * Called by amIDeadNow: Press a tile. If !norecursivespread and the tile is
 * not a bomb and doesn't have any bomb neighbours, press all tiles in its
 * neighbourhood.
 */
void Game::press(CoordinateSet pos, bool norecursivespread) {
	Tile *tile = this->getTile(pos);
	tile->press();
	++this->pressedcount;
	drawtile(pos);
	if (!tile->amIDeadNow() && (tile->getSurroundings() == 0)) {
		CoordinateSetList neighbours = this->neighbourhoodpositions(pos);
		CoordinateSetListIt i;
		for (i = neighbours.begin(); i != neighbours.end(); ++i) {
			if (norecursivespread && this->getTile(*i)->getSurroundings() == 0) continue;
			this->amIDeadNow(*i);
		}
	}
}
Ejemplo n.º 6
0
/**
 * Display all tiles as a map
 */
void drawworld()
{
	GX_SetZMode(GX_DISABLE,GX_ALWAYS,GX_FALSE);
	
	int i_zoom, i;
	
	for(i = 0; i < 4; i++)
	{
		if(zoom1_tiles[i] != NULL) {
			drawtile(zoom1_tiles[i]);
		}
	}
	
	for(i_zoom = 0; i_zoom <= MAX_ZOOM; i_zoom++)
	{
		for(i = 0; i < NUM_TILES; i++)
		{
			if(tiles[i] != NULL && tiles[i]->zoom == i_zoom && tiles[i]->source == current_tilesource)
				drawtile(tiles[i]);
				
		}
	}
	
}