void Buildings::Upg(Upgrade &a_upgd) { if (a_upgd.GetOp() == '+') b_baseCps += a_upgd.GetMod(); else if (a_upgd.GetOp() == '*') b_baseCps *= a_upgd.GetMod(); }
void UpgradeManager::loadGame(const XmlNode *rootNode,Faction *faction) { const XmlNode *upgrademanagerNode = rootNode->getChild("UpgradeManager"); //description = upgrademanagerNode->getAttribute("description")->getValue(); vector<XmlNode *> upgradeNodeList = upgrademanagerNode->getChildList("Upgrade"); for(unsigned int i = 0; i < upgradeNodeList.size(); ++i) { XmlNode *node = upgradeNodeList[i]; Upgrade *newUpgrade = Upgrade::loadGame(node,faction); upgrades.push_back(newUpgrade); upgradesLookup[newUpgrade->getType()] = (int)upgrades.size()-1; } }
void GobStation::upgrade_menu(GobStation *station, GobPlayer *gs) { STACKTRACE; int i; upgrade_list_for = gs; clear_to_color(screen, palette_color[8]); while (true) { sprintf(dialog_string[0], "%03d Starbucks %03d Buckazoids", gs->starbucks, gs->buckazoids); int j = 0; for (i = 0; gs->upgrade_list[i]; i += 1) { if (gs->upgrade_list[i]->update(gs->ship, station, gs)) { upgrade_index[j] = i; j += 1; } } num_upgrade_indexes = j; int m = 0; if (game->is_local(gs->channel)) m = tw_do_dialog(game->window, upgrade_dialog, UPGRADE_DIALOG_EXIT); game->log_int(gs->channel, m); if (m == UPGRADE_DIALOG_EXIT) return; if (m == UPGRADE_DIALOG_LIST) { int i = 0; if (game->is_local(gs->channel)) i = upgrade_dialog[UPGRADE_DIALOG_LIST].d1; game->log_int(gs->channel, i); i = upgrade_index[i]; Upgrade *u = gs->upgrade_list[i]; if (gs->charge(u->name, u->starbucks, u->buckazoids)) { u->execute(gs->ship, station, gs); u->charge(gs); } } } return; }
void GameClass::DrawGameIntro () const { ALLEGRO_COLOR fontColor = cWhite; if (introScreen == 0) { for (size_t i = 0; i < cGameIntroLines; i++) { al_draw_text(normalFont, fontColor, cWindowWidth/2, 70 + i*45, ALLEGRO_ALIGN_CENTRE, cGameIntroText[language][i].c_str()); } al_draw_text(normalFont, fontColor, cWindowWidth - 20, cWindowHeight - 30, ALLEGRO_ALIGN_RIGHT, cPressAnyKey[language].c_str()); } else { for (size_t i = 0; i < cInstructionsLines; i++) { al_draw_text(normalFont, fontColor, 200, 200 + i*45, ALLEGRO_ALIGN_LEFT, cInstructionsText[language][i].c_str()); } Upgrade jump (jumpUpgrade, 200, 180 + 5*45), speed (speedUpgrade, 200, 180 + 6*45), life (lifeUpgrade, 200, 180 + 7*45), doubleJump(doubleJumpUpgrade, 200, 180 + 8*45), wallJump (wallJumpUpgrade, 200, 180 + 9*45); jump.Draw(); speed.Draw(); life.Draw(); doubleJump.Draw(); wallJump.Draw(); al_draw_text(bigFont, fontColor, cWindowWidth/2, 40, ALLEGRO_ALIGN_CENTRE, cInstructions[language].c_str()); al_draw_text(normalFont, fontColor, cWindowWidth - 20, cWindowHeight - 30, ALLEGRO_ALIGN_RIGHT, cPressAnyKey[language].c_str()); } }
void Buildings::MouseCursorUpg(Upgrade &a_upgd, Mouse &a_mouse) { if (a_upgd.GetOp() == '+') { b_baseCps += a_upgd.GetMod(); a_mouse.m_power += a_upgd.GetMouseMod(); } else if (a_upgd.GetOp() == '*') { b_baseCps *= a_upgd.GetMod(); a_mouse.m_power *= a_upgd.GetMouseMod(); } }
int main() { Upgrade obj; obj.execute(); return 0; }