void Island::constructBorders() { makeBorder(Volcano, Forest); makeBorder(Volcano, Beach); makeBorder(Garden, Forest); makeBorder(Garden, Beach); }
void Earth::constructBorders() { // Australia Border makeBorder(EasternAustralia, NewGuinea); makeBorder(EasternAustralia, WesternAustralia); makeBorder(WesternAustralia, NewGuinea); makeBorder(WesternAustralia, Indonesia); makeBorder(Indonesia, NewGuinea); // North America makeBorder(Alaska, NorthwestTerritory); makeBorder(Alaska, Alberta); makeBorder(Alaska, Kamchatka); makeBorder(Alberta, NorthwestTerritory); makeBorder(Alberta, Ontario); makeBorder(Alberta, WesternUnitedStates); makeBorder(WesternUnitedStates, Ontario); makeBorder(WesternUnitedStates, EasternUnitedStates); makeBorder(WesternUnitedStates, CentralAmerica); makeBorder(EasternUnitedStates, Ontario); makeBorder(EasternUnitedStates, Quebec); makeBorder(EasternUnitedStates, CentralAmerica); makeBorder(CentralAmerica, Venezuela); makeBorder(Greenland, Quebec); makeBorder(Greenland, Ontario); makeBorder(Greenland, NorthwestTerritory); makeBorder(Greenland, Iceland); // South America makeBorder(Argentina, Brazil); makeBorder(Argentina, Peru); makeBorder(Brazil, Peru); makeBorder(Brazil, Venezuela); makeBorder(Brazil, NorthAfrica); makeBorder(Peru, Venezuela); // Europe makeBorder(Iceland, GreatBritain); makeBorder(Iceland, Scandinavia); makeBorder(GreatBritain, Scandinavia); makeBorder(GreatBritain, NorthernEurope); makeBorder(GreatBritain, WesternEurope); makeBorder(WesternEurope, NorthAfrica); makeBorder(WesternEurope, NorthernEurope); makeBorder(WesternEurope, SouthernEurope); makeBorder(NorthernEurope, SouthernEurope); makeBorder(NorthernEurope, Scandinavia); makeBorder(NorthernEurope, Ukraine); makeBorder(Scandinavia, Ukraine); makeBorder(Ukraine, MiddleEast); makeBorder(Ukraine, Afghanistan); makeBorder(Ukraine, Ural); makeBorder(SouthernEurope, Egypt); makeBorder(SouthernEurope, NorthAfrica); makeBorder(SouthernEurope, MiddleEast); // Asia makeBorder(Ural, Siberia); makeBorder(Ural, China); makeBorder(Ural, Afghanistan); makeBorder(Afghanistan, MiddleEast); makeBorder(Afghanistan, India); makeBorder(Afghanistan, China); makeBorder(MiddleEast, EastAfrica); makeBorder(MiddleEast, India); makeBorder(India, China); makeBorder(India, Siam); makeBorder(China, Siam); makeBorder(China, Mongolia); makeBorder(China, Siberia); makeBorder(Siam, Indonesia); makeBorder(Mongolia, Japan); makeBorder(Mongolia, Irkutsk); makeBorder(Mongolia, Siberia); makeBorder(Mongolia, Kamchatka); makeBorder(Kamchatka, Japan); makeBorder(Kamchatka, Irkutsk); makeBorder(Kamchatka, Yakutsk); makeBorder(Irkutsk, Siberia); makeBorder(Irkutsk, Yakutsk); // Africa makeBorder(Congo, EastAfrica); makeBorder(Congo, NorthAfrica); makeBorder(Congo, SouthAfrica); makeBorder(SouthAfrica, Madagascar); makeBorder(SouthAfrica, EastAfrica); makeBorder(EastAfrica, Madagascar); makeBorder(EastAfrica, NorthAfrica); makeBorder(EastAfrica, Egypt); makeBorder(Egypt, MiddleEast); makeBorder(Egypt, NorthAfrica); }
void KGrCanvas::initView() { changeColours (& colourScheme [0]); // Set "KGoldrunner" landscape. // Set up the pixmaps for the editable objects. freebg = 0; // Free space. nuggetbg = 1; // Nugget. polebg = 2; // Pole or bar. ladderbg = 3; // Ladder. hladderbg = 4; // Hidden ladder (for editing). edherobg = 5; // Static hero (for editing). edenemybg = 6; // Static enemy (for editing). betonbg = 7; // Concrete. // The bricks have 10 pixmaps (showing various stages of digging). brickbg = 8; // Solid brick - 1st pixmap. fbrickbg = 15; // False brick - 8th pixmap (for editing). QPixmap pixmap; QImage image; pixmap = QPixmap (hgbrick_xpm); bgw = pixmap.width(); // Save dimensions for "getPixmap". bgh = pixmap.height(); bgd = pixmap.depth(); // Assemble the background and editing pixmaps into a strip (18 pixmaps). bgPix = QPixmap ((brickbg + 10) * bgw, bgh, bgd); makeTiles(); // Fill the strip with 18 tiles. // Define the canvas as an array of tiles. Default tile is 0 (free space). int frame = frameWidth()*2; field = new QCanvas ((FIELDWIDTH+border) * bgw, (FIELDHEIGHT+border) * bgh); field->setTiles (bgPix, (FIELDWIDTH+border), (FIELDHEIGHT+border), bgw, bgh); // Embed the canvas in the view and make it occupy the whole of the view. setCanvas (field); setVScrollBarMode (QScrollView::AlwaysOff); setHScrollBarMode (QScrollView::AlwaysOff); setFixedSize (field->width() + frame, field->height() + frame); ////////////////////////////////////////////////////////////////////////// // The pixmaps for hero and enemies are arranged in strips of 20: walk // // right (4), walk left (4), climb right along bar (4), climb left (4), // // climb up ladder (2) and fall (2) --- total 20. // ////////////////////////////////////////////////////////////////////////// // Convert the pixmap strip for hero animation into a QCanvasPixmapArray. pixmap = QPixmap (hero_xpm); image = pixmap.convertToImage (); #ifdef QT3 QPixmap pm; QValueList<QPixmap> pmList; for (int i = 0; i < 20; i++) { pm.convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); } heroArray = new QCanvasPixmapArray (pmList); // Hot spots all (0,0). #else QPixmap * pm; QPoint * pt; QList<QPixmap> pmList; QList<QPoint> ptList; pt = new QPoint (0, 0); // "Hot spot" not used in KGoldrunner. for (int i = 0; i < 20; i++) { pm = new QPixmap (); pm->convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); ptList.append (pt); } heroArray = new QCanvasPixmapArray (pmList, ptList); #endif // Convert pixmap strips for enemy animations into a QCanvasPixmapArray. // First convert the pixmaps for enemies with no gold ... pixmap = QPixmap (enemy1_xpm); image = pixmap.convertToImage (); pmList.clear(); #ifdef QT3 for (int i = 0; i < 20; i++) { pm.convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); } #else ptList.clear(); for (int i = 0; i < 20; i++) { pm = new QPixmap (); pm->convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); ptList.append (pt); } #endif // ... then convert the gold-carrying enemies. pixmap = QPixmap (enemy2_xpm); image = pixmap.convertToImage (); #ifdef QT3 for (int i = 0; i < 20; i++) { pm.convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); } enemyArray = new QCanvasPixmapArray (pmList); // Hot spots all (0,0). #else for (int i = 0; i < 20; i++) { pm = new QPixmap (); pm->convertFromImage (image.copy (i * 16, 0, 16, 16)); pmList.append (pm); ptList.append (pt); } enemyArray = new QCanvasPixmapArray (pmList, ptList); #endif goldEnemy = 20; // Offset of gold-carrying frames. // Draw the border around the playing area (z = 0). makeBorder(); // Create a title item, in off-white colour, on top of the border. title = 0; makeTitle(); // Create an empty list of enemy sprites. #ifdef QT3 enemySprites = new QPtrList<QCanvasSprite> (); #else enemySprites = new QList<QCanvasSprite> (); #endif enemySprites->setAutoDelete(TRUE); }