void warpAnimation() { if (vBlankCount % 5) { incrementSeason(); } vBlankCount--; }
DisplayBox::DisplayBox (PlanetHandler* p, PlanetWidget* w) : QGroupBox(QString("Display")), planetHandler(p), planetWidget(w) { layout = new QGridLayout(); mapButton = new QPushButton("Map"); mapButton->setCheckable(true); mapButton->setEnabled(false); QObject::connect(mapButton, SIGNAL(clicked()), this, SLOT(mapButtonClicked())); layout->addWidget(mapButton, 0, 0, 1, 2); globeButton = new QPushButton("Globe"); globeButton->setCheckable(true); globeButton->setEnabled(false); QObject::connect(globeButton, SIGNAL(clicked()), this, SLOT(globeButtonClicked())); layout->addWidget(globeButton, 0, 2, 1, 2); layout->addWidget(new QLabel("Colour"), 1, 0, 1, 1, Qt::AlignRight); colourBox = new QComboBox(); colourBox->insertItem(0, "Topography"); colourBox->setEnabled(false); QObject::connect(colourBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colourChanged())); layout->addWidget(colourBox, 1, 1, 1, 3); layout->addWidget(new QLabel("Season"), 2, 0, 1, 1, Qt::AlignRight); seasonEdit = new QLineEdit(); seasonEdit->setReadOnly(true); layout->addWidget(seasonEdit, 2, 1, 1, 1); QGridLayout* seasonButtonLayout = new QGridLayout(); decrementSeasonButton = new QPushButton("<"); decrementSeasonButton->setEnabled(false); QObject::connect(decrementSeasonButton, SIGNAL(clicked()), this, SLOT(decrementSeason())); seasonButtonLayout->addWidget(decrementSeasonButton, 0, 0, 1, 1); incrementSeasonButton = new QPushButton(">"); incrementSeasonButton->setEnabled(false); QObject::connect(incrementSeasonButton, SIGNAL(clicked()), this, SLOT(incrementSeason())); seasonButtonLayout->addWidget(incrementSeasonButton, 0, 1, 1, 1); layout->addLayout(seasonButtonLayout, 2, 2, 1, 1); setLayout(layout); terrainEnabled = false; climateEnabled = false; QObject::connect(planetHandler, SIGNAL(terrainCreated()), this, SLOT(enableTerrain())); QObject::connect(planetHandler, SIGNAL(climateCreated()), this, SLOT(enableClimate())); QObject::connect(planetHandler, SIGNAL(climateDestroyed()), this, SLOT(disableClimate())); }
void seasonChange() { season = prevSeason; incrementSeason(); // Turn snow and falling leaves off if (season < FALL) { REG_DISPCTL &= ~(BG1_ENABLE); } switch (season) { case NEUTRAL: switch (currentLevel) { case 1: loadPalette(bg_00_neutralscrnPal); DMANow(3, bg_00_neutralscrnMap, &SCREENBLOCKBASE[28], bg_00_neutralscrnMapLen / 2); DMANow(3, bg_00_neutralscrnTiles, &CHARBLOCKBASE[2], bg_00_neutralscrnTilesLen / 2); break; case 2: loadPalette(bg_02_neutralscrnPal); DMANow(3, bg_02_neutralscrnMap, &SCREENBLOCKBASE[28], bg_02_neutralscrnMapLen / 2); DMANow(3, bg_02_neutralscrnTiles, &CHARBLOCKBASE[2], bg_02_neutralscrnTilesLen / 2); break; case 3: loadPalette(bg_03_neutralscrnPal); DMANow(3, bg_03_neutralscrnMap, &SCREENBLOCKBASE[28], bg_03_neutralscrnMapLen / 2); DMANow(3, bg_03_neutralscrnTiles, &CHARBLOCKBASE[2], bg_03_neutralscrnTilesLen / 2); break; case 4: loadPalette(bg_04_springscrnPal); DMANow(3, bg_04_neutralscrnMap, &SCREENBLOCKBASE[28], bg_04_neutralscrnMapLen / 2); DMANow(3, bg_04_neutralscrnTiles, &CHARBLOCKBASE[2], bg_04_neutralscrnTilesLen / 2); break; case 5: loadPalette(bg_05_neutralscrnPal); DMANow(3, bg_05_neutralscrnMap, &SCREENBLOCKBASE[28], bg_05_neutralscrnMapLen / 2); DMANow(3, bg_05_neutralscrnTiles, &CHARBLOCKBASE[2], bg_05_neutralscrnTilesLen / 2); break; case 6: loadPalette(bg_06_neutralscrnPal); DMANow(3, bg_06_neutralscrnMap, &SCREENBLOCKBASE[28], bg_06_neutralscrnMapLen / 2); DMANow(3, bg_06_neutralscrnTiles, &CHARBLOCKBASE[2], bg_06_neutralscrnTilesLen / 2); break; case 7: loadPalette(bg_07_neutralscrnPal); DMANow(3, bg_07_neutralscrnMap, &SCREENBLOCKBASE[28], bg_07_neutralscrnMapLen / 2); DMANow(3, bg_07_neutralscrnTiles, &CHARBLOCKBASE[2], bg_07_neutralscrnTilesLen / 2); break; case 8: loadPalette(bg_08_neutralscrnPal); DMANow(3, bg_08_neutralscrnMap, &SCREENBLOCKBASE[28], bg_08_neutralscrnMapLen / 2); DMANow(3, bg_08_neutralscrnTiles, &CHARBLOCKBASE[2], bg_08_neutralscrnTilesLen / 2); break; case 9: loadPalette(bg_09_neutralscrnPal); DMANow(3, bg_09_neutralscrnMap, &SCREENBLOCKBASE[28], bg_09_neutralscrnMapLen / 2); DMANow(3, bg_09_neutralscrnTiles, &CHARBLOCKBASE[2], bg_09_neutralscrnTilesLen / 2); break; case 10: loadPalette(bg_10_neutralscrnPal); DMANow(3, bg_10_neutralscrnMap, &SCREENBLOCKBASE[28], bg_10_neutralscrnMapLen / 2); DMANow(3, bg_10_neutralscrnTiles, &CHARBLOCKBASE[2], bg_10_neutralscrnTilesLen / 2); break; case 11: loadPalette(bg_final_neutralscrnPal); DMANow(3, bg_final_neutralscrnMap, &SCREENBLOCKBASE[28], bg_final_neutralscrnMapLen / 2); DMANow(3, bg_final_neutralscrnTiles, &CHARBLOCKBASE[2], bg_final_neutralscrnTilesLen / 2); break; } break; case SPRING: switch (currentLevel) { case 1: loadPalette(bg_00_springscrnPal); DMANow(3, bg_00_springscrnMap, &SCREENBLOCKBASE[28], bg_00_springscrnMapLen / 2); DMANow(3, bg_00_springscrnTiles, &CHARBLOCKBASE[2], bg_00_springscrnTilesLen / 2); break; case 2: loadPalette(bg_02_springscrnPal); DMANow(3, bg_02_springscrnMap, &SCREENBLOCKBASE[28], bg_02_springscrnMapLen / 2); DMANow(3, bg_02_springscrnTiles, &CHARBLOCKBASE[2], bg_02_springscrnTilesLen / 2); break; case 3: loadPalette(bg_03_springscrnPal); DMANow(3, bg_03_springscrnMap, &SCREENBLOCKBASE[28], bg_03_springscrnMapLen / 2); DMANow(3, bg_03_springscrnTiles, &CHARBLOCKBASE[2], bg_03_springscrnTilesLen / 2); break; case 4: loadPalette(bg_04_springscrnPal); DMANow(3, bg_04_springscrnMap, &SCREENBLOCKBASE[28], bg_04_springscrnMapLen / 2); DMANow(3, bg_04_springscrnTiles, &CHARBLOCKBASE[2], bg_04_springscrnTilesLen / 2); break; case 5: loadPalette(bg_05_springscrnPal); DMANow(3, bg_05_springscrnMap, &SCREENBLOCKBASE[28], bg_05_springscrnMapLen / 2); DMANow(3, bg_05_springscrnTiles, &CHARBLOCKBASE[2], bg_05_springscrnTilesLen / 2); break; case 6: loadPalette(bg_06_springscrnPal); DMANow(3, bg_06_springscrnMap, &SCREENBLOCKBASE[28], bg_06_springscrnMapLen / 2); DMANow(3, bg_06_springscrnTiles, &CHARBLOCKBASE[2], bg_06_springscrnTilesLen / 2); break; case 7: loadPalette(bg_07_springscrnPal); DMANow(3, bg_07_springscrnMap, &SCREENBLOCKBASE[28], bg_07_springscrnMapLen / 2); DMANow(3, bg_07_springscrnTiles, &CHARBLOCKBASE[2], bg_07_springscrnTilesLen / 2); break; case 8: loadPalette(bg_08_springscrnPal); DMANow(3, bg_08_springscrnMap, &SCREENBLOCKBASE[28], bg_08_springscrnMapLen / 2); DMANow(3, bg_08_springscrnTiles, &CHARBLOCKBASE[2], bg_08_springscrnTilesLen / 2); break; case 9: loadPalette(bg_09_springscrnPal); DMANow(3, bg_09_springscrnMap, &SCREENBLOCKBASE[28], bg_09_springscrnMapLen / 2); DMANow(3, bg_09_springscrnTiles, &CHARBLOCKBASE[2], bg_09_springscrnTilesLen / 2); break; case 10: loadPalette(bg_10_springscrnPal); DMANow(3, bg_10_springscrnMap, &SCREENBLOCKBASE[28], bg_10_springscrnMapLen / 2); DMANow(3, bg_10_springscrnTiles, &CHARBLOCKBASE[2], bg_10_springscrnTilesLen / 2); break; case 11: loadPalette(bg_final_springscrnPal); DMANow(3, bg_final_springscrnMap, &SCREENBLOCKBASE[28], bg_final_springscrnMapLen / 2); DMANow(3, bg_final_springscrnTiles, &CHARBLOCKBASE[2], bg_final_springscrnTilesLen / 2); break; } break; case SUMMER: switch (currentLevel) { case 1: loadPalette(bg_00_summerscrnPal); DMANow(3, bg_00_summerscrnMap, &SCREENBLOCKBASE[28], bg_00_summerscrnMapLen / 2); DMANow(3, bg_00_summerscrnTiles, &CHARBLOCKBASE[2], bg_00_summerscrnTilesLen / 2); break; case 2: loadPalette(bg_02_summerscrnPal); DMANow(3, bg_02_summerscrnMap, &SCREENBLOCKBASE[28], bg_02_summerscrnMapLen / 2); DMANow(3, bg_02_summerscrnTiles, &CHARBLOCKBASE[2], bg_02_summerscrnTilesLen / 2); break; case 3: loadPalette(bg_03_summerscrnPal); DMANow(3, bg_03_summerscrnMap, &SCREENBLOCKBASE[28], bg_03_summerscrnMapLen / 2); DMANow(3, bg_03_summerscrnTiles, &CHARBLOCKBASE[2], bg_03_summerscrnTilesLen / 2); break; case 4: loadPalette(bg_04_summerscrnPal); DMANow(3, bg_04_summerscrnMap, &SCREENBLOCKBASE[28], bg_04_summerscrnMapLen / 2); DMANow(3, bg_04_summerscrnTiles, &CHARBLOCKBASE[2], bg_04_summerscrnTilesLen / 2); break; case 5: loadPalette(bg_05_summerscrnPal); DMANow(3, bg_05_summerscrnMap, &SCREENBLOCKBASE[28], bg_05_summerscrnMapLen / 2); DMANow(3, bg_05_summerscrnTiles, &CHARBLOCKBASE[2], bg_05_summerscrnTilesLen / 2); break; case 6: loadPalette(bg_06_summerscrnPal); DMANow(3, bg_06_summerscrnMap, &SCREENBLOCKBASE[28], bg_06_summerscrnMapLen / 2); DMANow(3, bg_06_summerscrnTiles, &CHARBLOCKBASE[2], bg_06_summerscrnTilesLen / 2); break; case 7: loadPalette(bg_07_summerscrnPal); DMANow(3, bg_07_summerscrnMap, &SCREENBLOCKBASE[28], bg_07_summerscrnMapLen / 2); DMANow(3, bg_07_summerscrnTiles, &CHARBLOCKBASE[2], bg_07_summerscrnTilesLen / 2); break; case 8: loadPalette(bg_08_summerscrnPal); DMANow(3, bg_08_summerscrnMap, &SCREENBLOCKBASE[28], bg_08_summerscrnMapLen / 2); DMANow(3, bg_08_summerscrnTiles, &CHARBLOCKBASE[2], bg_08_summerscrnTilesLen / 2); break; case 9: loadPalette(bg_09_summerscrnPal); DMANow(3, bg_09_summerscrnMap, &SCREENBLOCKBASE[28], bg_09_summerscrnMapLen / 2); DMANow(3, bg_09_summerscrnTiles, &CHARBLOCKBASE[2], bg_09_summerscrnTilesLen / 2); break; case 10: loadPalette(bg_10_summerscrnPal); DMANow(3, bg_10_summerscrnMap, &SCREENBLOCKBASE[28], bg_10_summerscrnMapLen / 2); DMANow(3, bg_10_summerscrnTiles, &CHARBLOCKBASE[2], bg_10_summerscrnTilesLen / 2); break; case 11: loadPalette(bg_final_summerscrnPal); DMANow(3, bg_final_summerscrnMap, &SCREENBLOCKBASE[28], bg_final_summerscrnMapLen / 2); DMANow(3, bg_final_summerscrnTiles, &CHARBLOCKBASE[2], bg_final_summerscrnTilesLen / 2); break; } break; case FALL: // Turn on falling leaves REG_DISPCTL |= BG1_ENABLE; loadPalette(bg_fallPal); DMANow(3, bg_fallMap, &SCREENBLOCKBASE[27], bg_fallMapLen / 2); DMANow(3, bg_fallTiles, &CHARBLOCKBASE[1], bg_fallTilesLen / 2); switch (currentLevel) { case 1: loadPalette(bg_00_fallscrnPal); DMANow(3, bg_00_fallscrnMap, &SCREENBLOCKBASE[28], bg_00_fallscrnMapLen / 2); DMANow(3, bg_00_fallscrnTiles, &CHARBLOCKBASE[2], bg_00_fallscrnTilesLen / 2); break; case 2: loadPalette(bg_02_fallscrnPal); DMANow(3, bg_02_fallscrnMap, &SCREENBLOCKBASE[28], bg_02_fallscrnMapLen / 2); DMANow(3, bg_02_fallscrnTiles, &CHARBLOCKBASE[2], bg_02_fallscrnTilesLen / 2); break; case 3: loadPalette(bg_03_fallscrnPal); DMANow(3, bg_03_fallscrnMap, &SCREENBLOCKBASE[28], bg_03_fallscrnMapLen / 2); DMANow(3, bg_03_fallscrnTiles, &CHARBLOCKBASE[2], bg_03_fallscrnTilesLen / 2); break; case 4: loadPalette(bg_04_fallscrnPal); DMANow(3, bg_04_fallscrnMap, &SCREENBLOCKBASE[28], bg_04_fallscrnMapLen / 2); DMANow(3, bg_04_fallscrnTiles, &CHARBLOCKBASE[2], bg_04_fallscrnTilesLen / 2); break; case 5: loadPalette(bg_05_fallscrnPal); DMANow(3, bg_05_fallscrnMap, &SCREENBLOCKBASE[28], bg_05_fallscrnMapLen / 2); DMANow(3, bg_05_fallscrnTiles, &CHARBLOCKBASE[2], bg_05_fallscrnTilesLen / 2); break; case 6: loadPalette(bg_06_fallscrnPal); DMANow(3, bg_06_fallscrnMap, &SCREENBLOCKBASE[28], bg_06_fallscrnMapLen / 2); DMANow(3, bg_06_fallscrnTiles, &CHARBLOCKBASE[2], bg_06_fallscrnTilesLen / 2); break; case 7: loadPalette(bg_07_fallscrnPal); DMANow(3, bg_07_fallscrnMap, &SCREENBLOCKBASE[28], bg_07_fallscrnMapLen / 2); DMANow(3, bg_07_fallscrnTiles, &CHARBLOCKBASE[2], bg_07_fallscrnTilesLen / 2); break; case 8: loadPalette(bg_08_fallscrnPal); DMANow(3, bg_08_fallscrnMap, &SCREENBLOCKBASE[28], bg_08_fallscrnMapLen / 2); DMANow(3, bg_08_fallscrnTiles, &CHARBLOCKBASE[2], bg_08_fallscrnTilesLen / 2); break; case 9: loadPalette(bg_09_fallscrnPal); DMANow(3, bg_09_fallscrnMap, &SCREENBLOCKBASE[28], bg_09_fallscrnMapLen / 2); DMANow(3, bg_09_fallscrnTiles, &CHARBLOCKBASE[2], bg_09_fallscrnTilesLen / 2); break; case 10: loadPalette(bg_10_fallscrnPal); DMANow(3, bg_10_fallscrnMap, &SCREENBLOCKBASE[28], bg_10_fallscrnMapLen / 2); DMANow(3, bg_10_fallscrnTiles, &CHARBLOCKBASE[2], bg_10_fallscrnTilesLen / 2); break; case 11: loadPalette(bg_final_fallscrnPal); DMANow(3, bg_final_fallscrnMap, &SCREENBLOCKBASE[28], bg_final_fallscrnMapLen / 2); DMANow(3, bg_final_fallscrnTiles, &CHARBLOCKBASE[2], bg_final_fallscrnTilesLen / 2); break; } break; case WINTER: // Turn on snow REG_DISPCTL |= BG1_ENABLE; loadPalette(bg_snowPal); DMANow(3, bg_snowMap, &SCREENBLOCKBASE[27], bg_snowMapLen / 2); DMANow(3, bg_snowTiles, &CHARBLOCKBASE[1], bg_snowTilesLen / 2); switch (currentLevel) { case 1: loadPalette(bg_00_winterscrnPal); DMANow(3, bg_00_winterscrnMap, &SCREENBLOCKBASE[28], bg_00_winterscrnMapLen / 2); DMANow(3, bg_00_winterscrnTiles, &CHARBLOCKBASE[2], bg_00_winterscrnTilesLen / 2); break; case 2: loadPalette(bg_02_winterscrnPal); DMANow(3, bg_02_winterscrnMap, &SCREENBLOCKBASE[28], bg_02_winterscrnMapLen / 2); DMANow(3, bg_02_winterscrnTiles, &CHARBLOCKBASE[2], bg_02_winterscrnTilesLen / 2); break; case 3: loadPalette(bg_03_winterscrnPal); DMANow(3, bg_03_winterscrnMap, &SCREENBLOCKBASE[28], bg_03_winterscrnMapLen / 2); DMANow(3, bg_03_winterscrnTiles, &CHARBLOCKBASE[2], bg_03_winterscrnTilesLen / 2); break; case 4: loadPalette(bg_04_winterscrnPal); DMANow(3, bg_04_winterscrnMap, &SCREENBLOCKBASE[28], bg_04_winterscrnMapLen / 2); DMANow(3, bg_04_winterscrnTiles, &CHARBLOCKBASE[2], bg_04_winterscrnTilesLen / 2); break; case 5: loadPalette(bg_05_winterscrnPal); DMANow(3, bg_05_winterscrnMap, &SCREENBLOCKBASE[28], bg_05_winterscrnMapLen / 2); DMANow(3, bg_05_winterscrnTiles, &CHARBLOCKBASE[2], bg_05_winterscrnTilesLen / 2); break; case 6: loadPalette(bg_06_winterscrnPal); DMANow(3, bg_06_winterscrnMap, &SCREENBLOCKBASE[28], bg_06_winterscrnMapLen / 2); DMANow(3, bg_06_winterscrnTiles, &CHARBLOCKBASE[2], bg_06_winterscrnTilesLen / 2); break; case 7: loadPalette(bg_07_winterscrnPal); DMANow(3, bg_07_winterscrnMap, &SCREENBLOCKBASE[28], bg_07_winterscrnMapLen / 2); DMANow(3, bg_07_winterscrnTiles, &CHARBLOCKBASE[2], bg_07_winterscrnTilesLen / 2); break; case 8: loadPalette(bg_08_winterscrnPal); DMANow(3, bg_08_winterscrnMap, &SCREENBLOCKBASE[28], bg_08_winterscrnMapLen / 2); DMANow(3, bg_08_winterscrnTiles, &CHARBLOCKBASE[2], bg_08_winterscrnTilesLen / 2); break; case 9: loadPalette(bg_09_winterscrnPal); DMANow(3, bg_09_winterscrnMap, &SCREENBLOCKBASE[28], bg_09_winterscrnMapLen / 2); DMANow(3, bg_09_winterscrnTiles, &CHARBLOCKBASE[2], bg_09_winterscrnTilesLen / 2); break; case 10: loadPalette(bg_10_winterscrnPal); DMANow(3, bg_10_winterscrnMap, &SCREENBLOCKBASE[28], bg_10_winterscrnMapLen / 2); DMANow(3, bg_10_winterscrnTiles, &CHARBLOCKBASE[2], bg_10_winterscrnTilesLen / 2); break; case 11: loadPalette(bg_final_winterscrnPal); DMANow(3, bg_final_winterscrnMap, &SCREENBLOCKBASE[28], bg_final_winterscrnMapLen / 2); DMANow(3, bg_final_winterscrnTiles, &CHARBLOCKBASE[2], bg_final_winterscrnTilesLen / 2); break; } break; } }