#include "gameDefines.h" extern Meteos*game; Board::Board() :colorHandler({}){} Board::Board(vi2d boardSize,float gravity,float maxGravity,float launchSpd,float spawnRate,std::array colorRates,Renderable&tileset) :boardSize(boardSize),gravity(gravity),maxGravity(maxGravity),launchSpd(launchSpd),spawnRate(spawnRate),colorHandler(colorRates),tileset(tileset.Decal()){ drawOffset={(float)game->ScreenWidth()/2-boardSize.x/2*12,(float)game->ScreenHeight()/2-boardSize.y/2*12}; yBottom=(boardSize.y-1)*12; for (int i=0;i()); } } void Board::spawnBlock(int col){ BlockClump c=BlockClump(); c.y-=128; c.addBlock(col,0,colorHandler.getRandomColor()); clumps.push_back(c); } void Board::addClump(BlockClump&c){ clumps.push_back(c); } std::vector&Board::getBlocks(int col){ return cols[col]; } std::vector&Board::getBlockClumps(){ return clumps; } void Board::removeClump(int ind){ clumps.erase(clumps.begin()+ind); } void Board::convertClump(int ind){ BlockClump&c=clumps[ind]; for (Block&b:c.getBlocks()){ if (b.markedForDeletion) continue; bool emptyAirBelow=true; for (int i=0;i=b2.pos.y&&c.getBlockPosition(b).y<=b2.pos.y+12) { emptyAirBelow=false; break; } } if (c.getBlockPosition(b).y>=yBottom) { emptyAirBelow=false; } if (emptyAirBelow) { BlockClump c2; for (int i=0;igen); for (int i=0;i<10;i++) { if (rangeTable[i].first!=-1&& rangeTable[i].first<=val&& rangeTable[i].second>val) { return (BlockColor)i; } } return BlockColor::WHITE; } void Board::removeBlock(int col,int ind){ cols[col].erase(cols[col].begin()+ind); }