void SidePanel::Create() { //InterfaceWindow::Create(); //CreateExpandButton(); int x = 26; int y = 50; m_fontsize = 48 / 1.2f / 4.0f; UnitPlacementButton *radar = new UnitPlacementButton(WorldObject::TypeRadarStation); radar->SetProperties( "Radar", x, y, 48, 48, "", "tooltip_place_radar", false, true ); RegisterButton( radar ); UnitPlacementButton *silo = new UnitPlacementButton(WorldObject::TypeSilo); silo->SetProperties( "Silo", x, y+75, 48, 48, "", "tooltip_place_silo", false, true ); RegisterButton( silo ); UnitPlacementButton *airbase = new UnitPlacementButton(WorldObject::TypeAirBase); airbase->SetProperties( "AirBase", x, y+150, 48, 48, "", "tooltip_place_airbase", false, true ); RegisterButton( airbase ); PanelModeButton *fmb = new PanelModeButton( ModeFleetPlacement, true ); fmb->SetProperties( "FleetMode", x, y+220, 48, 48, "dialog_fleets", "tooltip_fleet_button", true, true ); strcpy( fmb->bmpImageFilename, "graphics/fleet.bmp" ); RegisterButton( fmb ); }
void VotingWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 20, 80, m_w-40, 100, " ", " ", false, false ); RegisterButton( box ); VoteButton *voteYes = new VoteButton(); voteYes->SetProperties( "yes", 40, 90, 30, 20, " ", "tooltip_vote_yes", false, true ); voteYes->m_vote = Vote::VoteYes; voteYes->m_voteId = m_voteId; RegisterButton( voteYes ); VoteButton *voteNo = new VoteButton(); voteNo->SetProperties( "no", 40, 120, 30, 20, " ", "tooltip_vote_no", false, true ); voteNo->m_vote = Vote::VoteNo; voteNo->m_voteId = m_voteId; RegisterButton( voteNo ); VoteButton *voteAbstain = new VoteButton(); voteAbstain->SetProperties( "abstain", 40, 150, 30, 20, " ", "tooltip_vote_abstain", false, true ); voteAbstain->m_vote = Vote::VoteAbstain; voteAbstain->m_voteId = m_voteId; RegisterButton( voteAbstain ); CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w/2 - 50, m_h - 25, 100, 20, "dialog_close", " ", true, false ); RegisterButton( close ); }
void BuildingsCreateWindow::Create() { DarwiniaWindow::Create(); int y = 25; int ySpacing = 18; DropDownMenu *menu = new DropDownMenu(true); menu->SetShortProperties( LANGUAGEPHRASE("editor_buildingtype"), 10, 25, m_w - 20 ); menu->RegisterInt( &m_buildingType ); RegisterButton( menu ); for (int i = Building::TypeInvalid + 1; i < Building::NumBuildingTypes; ++i) { menu->AddOption( Building::GetTypeNameTranslated(i), i ); } NewBuildingButton *b = new NewBuildingButton(); b->SetShortProperties( LANGUAGEPHRASE("editor_createbuilding"), 10, 45, m_w - 20 ); RegisterButton( b ); // for (int i = Building::TypeInvalid + 1; i < Building::NumBuildingTypes; ++i) // { // NewBuildingButton *n = new NewBuildingButton(i); // char *name = Building::GetTypeName( i ); // n->SetShortProperties( name, 10, y, m_w - 20 ); // RegisterButton( n ); // y += ySpacing; // } }
void BadKeyWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 30, m_w-20, m_h-70, " ", " ", false, false ); RegisterButton( box ); #if !defined(RETAIL_DEMO) if( m_offerDemo ) { PlayDemoButton *demo = new PlayDemoButton(); demo->SetProperties( "Play Demo", m_w - 330, m_h - 30, 100, 20, "dialog_play_demo", " ", true, false ); demo->m_forceVisible = true; RegisterButton( demo ); } #endif #if !defined(RETAIL) // BuyNowButton *buyNow = new BuyNowButton(); // buyNow->SetProperties( "Buy Now", m_w - 220, m_h - 30, 100, 20, "dialog_buy_now", " ", true, false ); // buyNow->m_closeOnClick = false; // RegisterButton( buyNow ); #endif CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w - 110, m_h - 30, 100, 20, "dialog_close", " ", true, false ); RegisterButton( close ); }
void CeaseFireWindow::Create() { ConfirmCeaseFireButton *yes = new ConfirmCeaseFireButton(); yes->SetProperties( "CeaseFireYes", 20, m_h-30, 80, 20, "dialog_yes", "", true, false ); RegisterButton( yes ); CloseButton *no = new CloseButton(); no->SetProperties( "CeaseFireNo", m_w-100, m_h-30, 80, 20, "dialog_no", "", true, false ); RegisterButton( no ); }
void ShareRadarWindow::Create() { ConfirmShareRadarButton *yes = new ConfirmShareRadarButton(); yes->SetProperties( "ShareRadarWindowYes", 20, m_h-30, 80, 20, "dialog_yes", "", true, false ); RegisterButton( yes ); CloseButton *no = new CloseButton(); no->SetProperties( "ShareRadarWindowNo", m_w-100, m_h-30, 80, 20, "dialog_no", "", true, false ); RegisterButton( no ); }
void ConnectingWindow::Create() { InterfaceWindow::Create(); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 30, m_w-20, m_h-70, " ", " ", false, false ); RegisterButton( box ); AbortButton *abort = new AbortButton(); abort->SetProperties( "Abort", m_w/2-50, m_h-30, 100, 20, "dialog_abort", "dialog_abort_current_connection", true, true ); RegisterButton( abort ); }
void LandscapeGuideGridWindow::Create() { m_tileDef = g_app->m_location->m_levelFile->m_landscape.m_tiles.GetData(m_tileId); m_guideGridPower = m_tileDef->GuideGridGetPower(); int gridW = m_w - 80; int gridH = m_h - 80; int biggerSize = min( gridW, gridH ); if( m_guideGridPower > 0 ) { m_pixelSizePerSample = biggerSize / m_tileDef->m_guideGrid->GetNumColumns(); } else { m_pixelSizePerSample = 0; } GuideGridButton *generate = new GuideGridButton(); generate->SetShortProperties( LANGUAGEPHRASE("editor_generate"), 10, 25, 75 ); RegisterButton( generate ); CreateValueControl( LANGUAGEPHRASE("editor_resolution"), InputField::TypeInt, &m_guideGridPower, 25, 1, 0, 5, generate, 100, 150 ); CreateValueControl( LANGUAGEPHRASE("editor_toolsize"), InputField::TypeFloat, &m_toolSize, 45, 1, 1.0f, 40.0f, NULL, 100, 150 ); // // Create guide grid and paint controls GuideGrid *guideGrid = new GuideGrid(); guideGrid->SetProperties( LANGUAGEPHRASE("editor_guidegrid"), 10, 70, gridW, gridH ); RegisterButton( guideGrid ); int controlsX = gridW + 15; int controlsY = 70; int controlsW = 60; int controlsH = 17; GuideGridTool *freehand = new GuideGridTool( GuideGridToolFreehand ); freehand->SetShortProperties( LANGUAGEPHRASE("editor_freehand"), controlsX, controlsY, controlsW ); RegisterButton( freehand ); GuideGridTool *flatten = new GuideGridTool( GuideGridToolFlatten ); flatten->SetShortProperties( LANGUAGEPHRASE("editor_flatten"), controlsX, controlsY += controlsH, controlsW ); RegisterButton( flatten ); GuideGridTool *binary = new GuideGridTool( GuideGridToolBinary ); binary->SetShortProperties( LANGUAGEPHRASE("editor_binary"), controlsX, controlsY += controlsH, controlsW ); RegisterButton( binary ); DarwiniaWindow::Create(); }
void LandscapeTileEditWindow::Create() { DarwiniaWindow::Create(); m_tileDef = g_app->m_location->m_levelFile->m_landscape.m_tiles.GetData(m_tileId); Landscape *land = &g_app->m_location->m_landscape; int height = 5; int pitch = 17; int buttonWidth = m_w - 50; LandscapeTileButton *gen = new LandscapeTileButton(m_tileDef); gen->SetShortProperties(LANGUAGEPHRASE("editor_generate"), 10, height += pitch, m_w - 20 ); RegisterButton(gen); LandscapeTileButton *randomise = new LandscapeTileButton(m_tileDef); randomise->SetShortProperties(LANGUAGEPHRASE("editor_randomise"), 10, height += pitch, m_w - 20 ); RegisterButton(randomise); LandscapeTileButton *deleteTile = new LandscapeTileButton(m_tileDef); deleteTile->SetShortProperties(LANGUAGEPHRASE("editor_delete"), 10, height += pitch, m_w - 20 ); RegisterButton(deleteTile); LandscapeTileButton *clone = new LandscapeTileButton(m_tileDef); clone->SetShortProperties(LANGUAGEPHRASE("editor_clone"), 10, height += pitch, m_w - 20 ); RegisterButton(clone); LandscapeTileButton *guideGrid = new LandscapeTileButton(m_tileDef); guideGrid->SetShortProperties(LANGUAGEPHRASE("editor_guidegrid"), 10, height += pitch, m_w - 20 ); RegisterButton(guideGrid); height += 6; #define FLOAT InputField::TypeFloat #define INTGR InputField::TypeInt #define Y height += pitch int celSz = floorf(land->m_heightMap->m_cellSizeX); CreateValueControl( LANGUAGEPHRASE("editor_noiseperiod"), FLOAT, &m_tileDef->m_fractalDimension, Y, 0.01f, 0.0f, 10.0f, gen ); CreateValueControl( LANGUAGEPHRASE("editor_noisescale"), FLOAT, &m_tileDef->m_heightScale, Y, 0.02f, 0.0f, 10.0f, gen ); CreateValueControl( LANGUAGEPHRASE("editor_height"), FLOAT, &m_tileDef->m_desiredHeight, Y, 5.0f, 0.0f, 1000.0f,gen ); CreateValueControl( LANGUAGEPHRASE("editor_method"), INTGR, &m_tileDef->m_generationMethod, Y, 1, 0, 2, gen ); CreateValueControl( LANGUAGEPHRASE("editor_lowlandsmooth"), FLOAT, &m_tileDef->m_lowlandSmoothingFactor,Y, 0.02f, 0.0f, 3.0f, gen ); CreateValueControl( LANGUAGEPHRASE("editor_posX"), INTGR, &m_tileDef->m_posX, Y, celSz, -10000, 10000, gen ); CreateValueControl( LANGUAGEPHRASE("editor_posY"), FLOAT, &m_tileDef->m_posY, Y, 0.5f, -1000, 1000, gen ); CreateValueControl( LANGUAGEPHRASE("editor_posZ"), INTGR, &m_tileDef->m_posZ, Y, celSz, -10000, 10000, gen ); CreateValueControl( LANGUAGEPHRASE("editor_size"), INTGR, &m_tileDef->m_size, Y, 10, 0, 10000, gen ); CreateValueControl( LANGUAGEPHRASE("editor_seed"), INTGR, &m_tileDef->m_randomSeed, Y, 1, 0, 1e10, gen ); #undef FLOAT #undef INTGR #undef Y }
void LandscapeEditWindow::Create() { DarwiniaWindow::Create(); int height = 5; int pitch = 17; int buttonWidth = m_w - 20; LandscapeTileButton *gen = new LandscapeTileButton(NULL); gen->SetShortProperties(LANGUAGEPHRASE("editor_generate"), 10, height += pitch, m_w - 20); RegisterButton(gen); NewTileButton *newTile = new NewTileButton(); newTile->SetShortProperties(LANGUAGEPHRASE("editor_newtile"), 10, height += pitch, m_w - 20); RegisterButton(newTile); NewFlattenAreaButton *newFlat = new NewFlattenAreaButton(); newFlat->SetShortProperties(LANGUAGEPHRASE("editor_newflattenarea"), 10, height += pitch, m_w - 20); RegisterButton(newFlat); height += 8; ScaleLandscapeButton *scaleDown = new ScaleLandscapeButton(); scaleDown->SetShortProperties( LANGUAGEPHRASE("editor_scaledown"), 10, height += pitch, m_w - 20 ); scaleDown->m_scaleFactor = 0.95f; RegisterButton( scaleDown ); ScaleLandscapeButton *scaleUp = new ScaleLandscapeButton(); scaleUp->SetShortProperties( LANGUAGEPHRASE("editor_scaleup"), 10, height += pitch, m_w - 20 ); scaleUp->m_scaleFactor = 1.05f; RegisterButton( scaleUp ); height += 8; #define FLOAT InputField::TypeFloat #define INTGR InputField::TypeInt #define Y height += pitch LandscapeDef *landDef = &g_app->m_location->m_levelFile->m_landscape; CreateValueControl( LANGUAGEPHRASE("editor_outsideheight"), FLOAT, &landDef->m_outsideHeight, Y, 1.0f, -100, 100, gen ); CreateValueControl( LANGUAGEPHRASE("editor_cellsize"), FLOAT, &landDef->m_cellSize, Y, 1, 1.0f, 100.0f, gen ); CreateValueControl( LANGUAGEPHRASE("editor_worldsizex"), INTGR, &landDef->m_worldSizeX, Y, 10, 1, 1e6, gen ); CreateValueControl( LANGUAGEPHRASE("editor_worldsizez"), INTGR, &landDef->m_worldSizeZ, Y, 10, 1, 1e6, gen ); #undef FLOAT #undef INTGR #undef Y CreateValueControl( LANGUAGEPHRASE("editor_movebuildings"), InputField::TypeInt, &g_app->m_locationEditor->m_moveBuildingsWithLandscape, height+=pitch, 1, 0, 1 ); }
void SoundProfileWindow::Create() { DarwiniaWindow::Create(); ResetHistoryButton *mainResetButton = new ResetHistoryButton( g_app->m_soundSystem->m_mainProfiler); mainResetButton->SetShortProperties("Reset", 10, 27); strcpy(mainResetButton->m_name, "Main Reset"); RegisterButton(mainResetButton); ResetHistoryButton *eventResetButton = new ResetHistoryButton( g_app->m_soundSystem->m_eventProfiler); eventResetButton->SetShortProperties("Reset", 10, 283); strcpy(eventResetButton->m_name, "Event Reset"); RegisterButton(eventResetButton); }
void InterfaceWindow::CreateValueControl( char *name, int x, int y, int w, int h, int dataType, void *value, float change, float _lowBound, float _highBound, InterfaceButton *callback, char *tooltip, bool tooltipIsLanguagePhrase ) { InputField *input = new InputField(); if( dataType == InputField::TypeString ) { input->SetProperties( name, x, y, w, h, name, tooltip, false, tooltipIsLanguagePhrase ); } else { input->SetProperties( name, x+h+2, y, w-h*2-4, h, name, tooltip, false, tooltipIsLanguagePhrase ); } input->m_lowBound = _lowBound; input->m_highBound = _highBound; input->SetCallback( callback ); switch( dataType ) { case InputField::TypeChar: input->RegisterChar ( (unsigned char *) value ); break; case InputField::TypeInt: input->RegisterInt ( (int *) value ); break; case InputField::TypeFloat: input->RegisterFloat ( (float *) value ); break; case InputField::TypeString: input->RegisterString ( (char *) value ); break; } RegisterButton( input ); if( dataType != InputField::TypeString ) { char nameLeft[64]; sprintf( nameLeft, "%s left", name ); InputScroller *left = new InputScroller(); left->SetProperties( nameLeft, input->m_x - h-2, y, h, h, " ", "dialog_decrease", false, true ); left->m_inputField = input; left->m_change = -change; RegisterButton( left ); char nameRight[64]; sprintf( nameRight, "%s right", name ); InputScroller *right = new InputScroller(); right->SetProperties( nameRight, input->m_x + input->m_w+2, y, h, h, " ", "dialog_increase", false, true ); right->m_inputField = input; right->m_change = change; RegisterButton( right ); } }
void GameMenuWindow::SetupMainPage() { int x, y, gap; GetDefaultPositions( &x, &y, &gap ); int h = 60; int w = 300; //DarwiniaModeButton *dmb = new DarwiniaModeButton( "icons/menu_darwinia.bmp" ); DarwiniaModeButton *dmb = new DarwiniaModeButton( "Darwinia" ); dmb->SetShortProperties("darwinia", x, y, w, h ); RegisterButton( dmb ); m_buttonOrder.PutData( dmb ); QuitButton *quit = new QuitButton(); quit->SetShortProperties( "quit", x, y+=gap, w, h ); RegisterButton( quit ); m_buttonOrder.PutData( quit ); }
void ReallyQuitWindow::Create() { DarwiniaWindow::Create(); int y = 0, h = 30; DarwiniaButton *exit = new GameExitButton(); exit->SetShortProperties( "Leave Darwinia", 10, y+=h, m_w-20, 20 ); exit->m_fontSize = 13; exit->m_centered = true; RegisterButton( exit ); DarwiniaButton *close = new CloseButton(); close->SetShortProperties( "No. Play On!", 10, y+=h, m_w-20, 20 ); close->m_fontSize = 13; close->m_centered = true; RegisterButton( close ); }
void BuyNowWindow::Create() { DarwiniaWindow::Create(); int y = m_h; int h = 30; DarwiniaButton *close = new CloseButton(); close->SetShortProperties( "Later", 10, y-=h, m_w-20, 20, "", "" ); close->m_fontSize = 13; close->m_centered = true; RegisterButton( close ); DarwiniaButton *buy = new BuyNowButton(); buy->SetShortProperties( "Register Now", 10, y-=h, m_w-20, 20, "", "" ); buy->m_fontSize = 13; buy->m_centered = true; RegisterButton( buy ); }
void MessageDialog::Create() { int const buttonWidth = GetMenuSize(40); int const buttonHeight = GetMenuSize(18); OKButton *button = new OKButton(this); char *caption = "Close"; if( g_app->m_langTable ) caption = LANGUAGEPHRASE("dialog_close"); button->SetShortProperties( caption, (m_w - buttonWidth)/2, m_h - GetMenuSize(30), buttonWidth, buttonHeight ); button->m_fontSize = GetMenuSize(11); RegisterButton( button ); }
void LandscapeFlattenAreaEditWindow::Create() { DarwiniaWindow::Create(); m_areaDef = g_app->m_location->m_levelFile->m_landscape.m_flattenAreas.GetData(m_areaId); int height = 5; int pitch = 17; int buttonWidth = m_w - 20; LandscapeTileButton *gen = new LandscapeTileButton(NULL); gen->SetShortProperties(LANGUAGEPHRASE("editor_generate"), 10, height += pitch, m_w - 20); RegisterButton(gen); CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &m_areaDef->m_size, height += pitch, 1, 0, 1000, gen ); CreateValueControl( LANGUAGEPHRASE("editor_height"), InputField::TypeFloat, &m_areaDef->m_centre.y, height += pitch, 1, -1000, 1000, gen ); LandscapeFlattenAreaDeleteButton *del = new LandscapeFlattenAreaDeleteButton(m_areaId); del->SetShortProperties(LANGUAGEPHRASE("editor_delete"), 10, height += pitch, buttonWidth); RegisterButton(del); }
void GameMenuWindow::SetupDarwiniaPage() { int x, y, gap; GetDefaultPositions( &x, &y, &gap ); int h = 60; int w = 300; // PrologueButton *pb = new PrologueButton( "icons/menu_prologue.bmp" ); PrologueButton *pb = new PrologueButton( "Prologue" ); pb->SetShortProperties("prologue", x, y, w, h ); RegisterButton( pb ); m_buttonOrder.PutData( pb ); // CampaignButton *cb = new CampaignButton( "icons/menu_campaign.bmp" ); CampaignButton *cb = new CampaignButton( "Campaign" ); cb->SetShortProperties( "campaign", x, y+=gap, w, h ); RegisterButton( cb ); m_buttonOrder.PutData( cb); QuitButton *quit = new QuitButton(); quit->SetShortProperties( "quit", x, y+=gap, w, h ); RegisterButton( quit ); m_buttonOrder.PutData( quit ); }
void NetworkWindow::Create() { InterfaceWindow::Create(); if( g_app->GetServer() ) { int maxClients = g_app->GetGame()->GetOptionValue("MaxTeams") + g_app->GetGame()->GetOptionValue("MaxSpectators"); int boxH = maxClients * 20 + 15; SetSize( m_w, 170 + boxH ); InvertedBox *box = new InvertedBox(); box->SetProperties( "invert", 10, 110, m_w-20, boxH, " ", " ", false, false ); RegisterButton( box ); } }
void AuthKeyWindow::Create() { InterfaceWindow::Create(); InvertedBox *invert = new InvertedBox(); invert->SetProperties( "invert", 10, 30, m_w-20, m_h - 70, " ", " ", false, false ); RegisterButton( invert ); AuthInputField *input = new AuthInputField(); input->SetProperties( "Key", 40, 50, 620, 30, " ", " ", false, false ); input->RegisterString( m_key ); RegisterButton( input ); // Only show the paste button on platforms with a paste implementation #if defined(TARGET_MSVC) || defined(TARGET_OS_MACOSX) PasteKeyButton *paste = new PasteKeyButton(); paste->SetProperties( "Paste", 10, m_h-30, 100, 20, "dialog_paste", "dialog_paste_tooltip", true, true ); RegisterButton( paste ); #endif ApplyKeyButton *apply = new ApplyKeyButton(); apply->SetProperties( "Apply", m_w-220, m_h-30, 100, 20, "dialog_apply", " ", true, false ); RegisterButton( apply ); PlayDemoButton *demo = new PlayDemoButton(); demo->SetProperties( "Play Demo", m_w/2-50, m_h-30, 100, 20, "dialog_play_demo", " ", true, false ); demo->m_forceVisible = false; RegisterButton( demo ); CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w-110, m_h-30, 100, 20, "dialog_close", " ", true, false ); RegisterButton(close); // // Auto-select the chat box if the key is empty char authKey[256]; Authentication_GetKey( authKey ); if( stricmp(authKey, "authkey not found") == 0 || strlen(authKey) < 3 ) { input->MouseUp(); } }
void MainEditWindow::Create() { int y = 3; int buttonYPitch = 18; MainEditWindowButton *button; button = new MainEditWindowButton(LocationEditor::ModeLandTile); button->SetShortProperties(LANGUAGEPHRASE("editor_editlandtiles"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); button = new MainEditWindowButton(LocationEditor::ModeLandFlat); button->SetShortProperties(LANGUAGEPHRASE("editor_editflattenareas"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); button = new MainEditWindowButton(LocationEditor::ModeLight); button->SetShortProperties(LANGUAGEPHRASE("editor_editlights"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); button = new MainEditWindowButton(LocationEditor::ModeBuilding); button->SetShortProperties(LANGUAGEPHRASE("editor_editbuildings"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); button = new MainEditWindowButton(LocationEditor::ModeInstantUnit); button->SetShortProperties(LANGUAGEPHRASE("editor_editinstantunits"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); button = new MainEditWindowButton(LocationEditor::ModeCameraMount); button->SetShortProperties(LANGUAGEPHRASE("editor_editcameramounts"), 7, y += buttonYPitch, m_w - 15 ); RegisterButton(button); y += 6; button = new MainEditWindowButton(MainEditWindowButton::TypeSave); button->SetShortProperties(LANGUAGEPHRASE("editor_save"), 7, y += buttonYPitch, m_w - 15); RegisterButton(button); }
void AlliancesWindow::Create() { InterfaceWindow::Create(); float xPos = 20; float yPos = 60; float width = m_w - 270; float height = 30; float gap = 7; int permitDefection = g_app->GetGame()->GetOptionValue( "PermitDefection" ); int sharingRadar = g_app->GetGame()->GetOptionValue("RadarSharing"); // // Invert box InvertedBox *box = new InvertedBox(); box->SetProperties( "box", xPos-10, yPos-10, width+20, (height+gap) * g_app->GetWorld()->m_teams.Size() + 15, " ", " ", false, false ); RegisterButton( box ); // // Buttons for each team for( int i = 0; i < g_app->GetWorld()->m_teams.Size(); ++i ) { char name[256]; sprintf( name, "Team %d", i ); AllianceTeamButton *team = new AllianceTeamButton(); team->SetProperties( name, xPos, yPos, width, height, " ", " ", false, false ); team->m_teamIndex = i; RegisterButton( team ); if( permitDefection ) { sprintf( name, "ceasfire %d", i ); RequestCeasefireButton *ceasefire = new RequestCeasefireButton(); ceasefire->SetProperties( name, xPos + 295, yPos+5, 18, 18, " ", " ", false, false ); ceasefire->m_teamIndex = i; RegisterButton( ceasefire ); } if( sharingRadar == 2 ) { sprintf( name, "shareradar %d", i ); RequestShareRadarButton *shareRadar = new RequestShareRadarButton(); shareRadar->SetProperties( name, xPos + 235, yPos+5, 18, 18, " ", " ", false, false ); shareRadar->m_teamIndex = i; RegisterButton( shareRadar ); } yPos += height; yPos += gap; } yPos += gap * 2; // // Join / Leave / Kick button if( permitDefection ) { JoinLeaveButton *joinLeave = new JoinLeaveButton(); joinLeave->SetProperties( "JoinLeave", xPos+width/2 - 120, yPos, 240, 23, " ", " ", false, false ); RegisterButton( joinLeave ); } yPos += 25; yPos += gap; height = 40; // // Close button CloseButton *close = new CloseButton(); close->SetProperties( "Close", m_w - 110, m_y - 25, 100, 18, "dialog_close", " ", true, false ); RegisterButton( close ); // // Once button for each vote for( int i = 0; i < MAX_TEAMS; ++i ) { char name[256]; sprintf( name, "Vote %d", i ); AllianceVoteButton *vote = new AllianceVoteButton(); vote->SetProperties( name, xPos, yPos, width, height, " ", " ", false, false ); vote->m_voteIndex = i; RegisterButton( vote ); yPos += height; yPos += gap; } }
void InterfaceWindow::Create() { CloseButton *cb = new CloseButton(); cb->SetProperties( "Close", m_w - 17, 4, 13, 13, " ", "tooltip_close_window", false, true ); RegisterButton( cb ); }
void SoundParameterEditor::Create() { DarwiniaWindow::Create(); // // Parameter type DropDownMenu *paramType = new DropDownMenu(false); paramType->SetShortProperties( "ParameterType", 10, 30, 150, -1, UnicodeString("ParameterType") ); for( int i = 0; i < SoundParameter::NumParameterTypes; ++i ) { paramType->AddOption( SoundParameter::GetParameterTypeName(i) ); } paramType->RegisterInt( &m_parameter->m_type ); RegisterButton( paramType ); // // Link type LinkTypeMenu *linkType = new LinkTypeMenu(); linkType->SetShortProperties( "LinkType", 10, 50, 150, -1, UnicodeString("LinkType") ); for( int i = 0; i < SoundParameter::NumLinkTypes; ++i ) { linkType->AddOption( SoundParameter::GetLinkName(i) ); } linkType->RegisterInt( &m_parameter->m_link ); RegisterButton( linkType ); // // Smoothing factor CreateValueControl( "SmoothFactor", &m_parameter->m_smooth, 30, 0.05, 0.0, 0.99, NULL, 170, m_w - 180 ); // // Update type UpdateTypeMenu *updateType = new UpdateTypeMenu(); updateType->SetShortProperties( "UpdateType", 170, 50, m_w - 180, -1, UnicodeString("UpdateType") ); for( int i = 0; i < SoundParameter::NumUpdateTypes; ++i ) { updateType->AddOption( SoundParameter::GetUpdateTypeName(i) ); } updateType->RegisterInt( &m_parameter->m_updateType ); RegisterButton( updateType ); // // Graph SoundParameterGraph *graph = new SoundParameterGraph(); graph->SetShortProperties( "graph", 10, 70, m_w - 20, m_h - 80, UnicodeString(" ") ); //strcpy(graph->m_name, "graph"); graph->SetParameter( m_parameter, m_minOutput, m_maxOutput ); RegisterButton( graph ); // SoundParameterGraphScaleToggle *scaleToggle = new SoundParameterGraphScaleToggle(); // scaleToggle->SetShortProperties("Toggle Scale", 10, 50, 150); // RegisterButton(scaleToggle); }
void BuildingEditWindow::Create() { DarwiniaWindow::Create(); Building *building = g_app->m_location->GetBuilding(g_app->m_locationEditor->m_selectionId); DarwiniaDebugAssert(building); int buttonPitch = 18; int y = 6; ToolButton *mb = new ToolButton(LocationEditor::ToolMove); mb->SetShortProperties(LANGUAGEPHRASE("editor_move"), 10, y += buttonPitch, m_w-20); RegisterButton(mb); ToolButton *rb = new ToolButton(LocationEditor::ToolRotate); rb->SetShortProperties(LANGUAGEPHRASE("editor_rotate"), 10, y += buttonPitch, m_w-20); RegisterButton(rb); CloneBuildingButton *clone = new CloneBuildingButton(); clone->SetShortProperties(LANGUAGEPHRASE("editor_clone"), 10, y+=buttonPitch, m_w-20); RegisterButton(clone); DeleteBuildingButton *db = new DeleteBuildingButton(); db->SetShortProperties(LANGUAGEPHRASE("editor_delete"), 10, y += buttonPitch, m_w-20); RegisterButton(db); ToolButton *lb = new ToolButton(LocationEditor::ToolLink); lb->SetShortProperties(LANGUAGEPHRASE("editor_link"), 10, y += buttonPitch, m_w-20); RegisterButton(lb); y += buttonPitch; for( int i = -1; i < 3; ++i ) { char name[256]; int w = m_w/4 - 5; sprintf( name, "T%d",i); TeamButton *tb = new TeamButton(i); tb->SetShortProperties(name, 61 + (float)i*((float)w + 1.0f), y, w - 2); RegisterButton(tb); } CreateValueControl(LANGUAGEPHRASE("editor_dynamic"), InputField::TypeChar, &building->m_dynamic, y += buttonPitch, 1.0f, 0, 1); CreateValueControl(LANGUAGEPHRASE("editor_isglobal"), InputField::TypeChar, &building->m_isGlobal, y += buttonPitch, 1.0f, 0, 1); if (building->m_type == Building::TypeFactory) { InputField *intExtra = new InputField(); intExtra->SetShortProperties(LANGUAGEPHRASE("editor_spirits"), 10, y += buttonPitch, m_w-20); Factory *factory = (Factory*)building; intExtra->RegisterInt(&factory->m_initialCapacity); RegisterButton(intExtra); } else if (building->m_type == Building::TypeTrunkPort) { InputField *inExtra = new InputField(); inExtra->SetShortProperties(LANGUAGEPHRASE("editor_targetlocation"), 10, y += buttonPitch, m_w-20); TrunkPort *port = (TrunkPort *) building; inExtra->RegisterInt( &port->m_targetLocationId ); RegisterButton(inExtra); } else if (building->m_type == Building::TypeLaserFence) { LaserFence *fence = (LaserFence *) building; CreateValueControl( LANGUAGEPHRASE("editor_scale"), InputField::TypeFloat, &fence->m_scale, y+=buttonPitch, 0.01f, 0.0f, 100.0f ); DropDownMenu *menu = new DropDownMenu(true); menu->SetShortProperties( LANGUAGEPHRASE("editor_mode"), 10, y+=buttonPitch, m_w-20 ); menu->AddOption( LANGUAGEPHRASE("editor_disabled") ); menu->AddOption( LANGUAGEPHRASE("editor_enabling") ); menu->AddOption( LANGUAGEPHRASE("editor_enabled") ); menu->AddOption( LANGUAGEPHRASE("editor_disabling") ); menu->AddOption( LANGUAGEPHRASE("editor_neveron") ); menu->RegisterInt( &fence->m_mode ); RegisterButton( menu ); } else if(building->m_type == Building::TypeAntHill) { AntHill *antHill = (AntHill *) building; CreateValueControl( LANGUAGEPHRASE("editor_numants"), InputField::TypeInt, &antHill->m_numAntsInside, y+=buttonPitch, 1, 0, 1000 ); } else if(building->m_type == Building::TypeSafeArea) { SafeArea *safeArea = (SafeArea *) building; CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &safeArea->m_size, y+=buttonPitch, 1.0f, 0.0f, 1000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_capacity"), InputField::TypeInt, &safeArea->m_entitiesRequired, y+=buttonPitch, 1, 0, 10000 ); DropDownMenu *menu = new DropDownMenu(true); menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 ); for( int i = 0; i < Entity::NumEntityTypes; ++i) { menu->AddOption( Entity::GetTypeNameTranslated(i), i ); } menu->RegisterInt( &safeArea->m_entityTypeRequired ); RegisterButton( menu ); } else if(building->m_type == Building::TypeTrackStart) { TrackStart *trackStart = (TrackStart *) building; CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &trackStart->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f ); } else if(building->m_type == Building::TypeTrackEnd) { TrackEnd *trackEnd = (TrackEnd *) building; CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &trackEnd->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f ); } else if(building->m_type == Building::TypePylonStart) { PylonStart *pylonStart = (PylonStart *) building; CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &pylonStart->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f ); } else if(building->m_type == Building::TypeResearchItem ) { DropDownMenu *menu = new DropDownMenu(true); menu->SetShortProperties( LANGUAGEPHRASE("editor_research"), 10, y+=buttonPitch, m_w-20 ); for( int i = 0; i < GlobalResearch::NumResearchItems; ++i ) { menu->AddOption( GlobalResearch::GetTypeNameTranslated( i ), i ); } menu->RegisterInt( &((ResearchItem *)building)->m_researchType ); RegisterButton( menu ); CreateValueControl( LANGUAGEPHRASE("editor_level"), InputField::TypeInt, &((ResearchItem *)building)->m_level, y+=buttonPitch, 1, 0, 4 ); } else if( building->m_type == Building::TypeTriffid ) { Triffid *triffid = (Triffid *) building; CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &triffid->m_size, y+=buttonPitch, 0.1f, 0.0f, 50.0f ); CreateValueControl( LANGUAGEPHRASE("editor_pitch"), InputField::TypeFloat, &triffid->m_pitch, y+=buttonPitch, 0.1f, -M_PI, M_PI ); CreateValueControl( LANGUAGEPHRASE("editor_force"), InputField::TypeFloat, &triffid->m_force, y+=buttonPitch, 1.0f, 0.0f, 1000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_variance"), InputField::TypeFloat, &triffid->m_variance, y+=buttonPitch, 0.01f, 0.0f, M_PI ); CreateValueControl( LANGUAGEPHRASE("editor_reload"), InputField::TypeFloat, &triffid->m_reloadTime, y+=buttonPitch, 1.0f, 0.0f, 1000.0f ); for( int i = 0; i < Triffid::NumSpawnTypes; ++i ) { CreateValueControl( Triffid::GetSpawnNameTranslated(i), InputField::TypeChar, &triffid->m_spawn[i], y+=buttonPitch, 1.0f, 0.0f, 1.0f ); } CreateValueControl( LANGUAGEPHRASE("editor_usetrigger"), InputField::TypeChar, &triffid->m_useTrigger, y+=buttonPitch, 1, 0, 1 ); CreateValueControl( LANGUAGEPHRASE("editor_triggerX"), InputField::TypeFloat, &triffid->m_triggerLocation.x, y+=buttonPitch, 1.0f, -10000.0f, 10000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_triggerZ"), InputField::TypeFloat, &triffid->m_triggerLocation.z, y+=buttonPitch, 1.0f, -10000.0f, 10000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_triggerrad"), InputField::TypeFloat, &triffid->m_triggerRadius, y+=buttonPitch, 1.0f, 0.0f, 1000.0f ); } else if( building->m_type == Building::TypeBlueprintRelay ) { BlueprintRelay *relay = (BlueprintRelay *) building; CreateValueControl( LANGUAGEPHRASE("editor_altitude"), InputField::TypeFloat, &relay->m_altitude, y+=buttonPitch, 1.0f, 0.0f, 1000.0f ); } else if( building->m_type == Building::TypeBlueprintConsole ) { BlueprintConsole *console = (BlueprintConsole *) building; CreateValueControl( LANGUAGEPHRASE("editor_segment"), InputField::TypeInt, &console->m_segment, y+=buttonPitch, 1, 0, 3 ); } else if( building->m_type == Building::TypeAISpawnPoint ) { AISpawnPoint *spawn = (AISpawnPoint *) building; DropDownMenu *menu = new DropDownMenu(); menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 ); for( int i = 0; i < Entity::NumEntityTypes; ++i ) { menu->AddOption( Entity::GetTypeNameTranslated(i), i ); } menu->RegisterInt( &spawn->m_entityType ); RegisterButton(menu); CreateValueControl( LANGUAGEPHRASE("editor_count"), InputField::TypeInt, &spawn->m_count, y+=buttonPitch, 1, 0, 1000 ); CreateValueControl( LANGUAGEPHRASE("editor_period"), InputField::TypeInt, &spawn->m_period, y+=buttonPitch, 1, 0, 1000 ); CreateValueControl( LANGUAGEPHRASE("editor_spawnlimit"), InputField::TypeInt, &spawn->m_spawnLimit, y+=buttonPitch, 1, 0, 1000 ); } else if( building->m_type == Building::TypeSpawnPopulationLock ) { SpawnPopulationLock *lock = (SpawnPopulationLock *) building; CreateValueControl( LANGUAGEPHRASE("editor_searchradius"), InputField::TypeFloat, &lock->m_searchRadius, y+=buttonPitch, 1.0f, 0.0f, 10000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_maxpopulation"), InputField::TypeInt, &lock->m_maxPopulation, y+=buttonPitch, 1, 0, 10000 ); } else if( building->m_type == Building::TypeSpawnLink || building->m_type == Building::TypeSpawnPointMaster || building->m_type == Building::TypeSpawnPoint ) { class ClearLinksButton: public DarwiniaButton { public: int m_buildingId; void MouseUp() { SpawnBuilding *building = (SpawnBuilding *) g_app->m_location->GetBuilding( m_buildingId ); building->ClearLinks(); } }; ClearLinksButton *button = new ClearLinksButton(); button->SetShortProperties( LANGUAGEPHRASE("editor_clearlinks"), 10, y+=buttonPitch, m_w-20 ); button->m_buildingId = building->m_id.GetUniqueId(); RegisterButton( button ); } else if( building->m_type == Building::TypeScriptTrigger ) { ScriptTrigger *trigger = (ScriptTrigger *) building; CreateValueControl( LANGUAGEPHRASE("editor_range"), InputField::TypeFloat, &trigger->m_range, y+=buttonPitch, 0.5f, 0.0f, 1000.0f ); CreateValueControl( LANGUAGEPHRASE("editor_script"), InputField::TypeString, trigger->m_scriptFilename, y+=buttonPitch, 0,0,0 ); DropDownMenu *menu = new DropDownMenu(true); menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 ); menu->AddOption( LANGUAGEPHRASE("editor_always"), SCRIPTRIGGER_RUNALWAYS ); menu->AddOption( LANGUAGEPHRASE("editor_never"), SCRIPTRIGGER_RUNNEVER ); menu->AddOption( LANGUAGEPHRASE("editor_cameraenter"), SCRIPTRIGGER_RUNCAMENTER ); menu->AddOption( LANGUAGEPHRASE("editor_cameraview"), SCRIPTRIGGER_RUNCAMVIEW ); for( int i = 0; i < Entity::NumEntityTypes; ++i) { menu->AddOption( Entity::GetTypeNameTranslated(i), i ); } menu->RegisterInt( &trigger->m_entityType); RegisterButton( menu ); } else if( building->m_type == Building::TypeStaticShape ) { StaticShape *staticShape = (StaticShape *) building; CreateValueControl( LANGUAGEPHRASE("editor_scale"), InputField::TypeFloat, &staticShape->m_scale, y+=buttonPitch, 0.1f, 0.0f, 100.0f ); CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &staticShape->m_shapeName, y+=buttonPitch, 0,0,0 ); } else if( building->m_type == Building::TypeIncubator ) { CreateValueControl( LANGUAGEPHRASE("editor_spirits"), InputField::TypeInt, &((Incubator *) building)->m_numStartingSpirits, y+=buttonPitch, 1, 0, 1000 ); } else if( building->m_type == Building::TypeEscapeRocket ) { EscapeRocket *rocket = (EscapeRocket *) building; CreateValueControl( LANGUAGEPHRASE("editor_fuel"), InputField::TypeFloat, &rocket->m_fuel, y+=buttonPitch, 0.1f, 0.0f, 100.0f ); CreateValueControl( LANGUAGEPHRASE("editor_passengers"), InputField::TypeInt, &rocket->m_passengers, y+=buttonPitch, 1, 0, 100 ); CreateValueControl( LANGUAGEPHRASE("editor_spawnport"), InputField::TypeInt, &rocket->m_spawnBuildingId, y+=buttonPitch, 1, 0, 9999 ); } else if( building->m_type == Building::TypeDynamicHub ) { DynamicHub *hub = (DynamicHub *)building; CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &hub->m_shapeName, y+=buttonPitch, 0,0,0 ); CreateValueControl( LANGUAGEPHRASE("editor_requiredscore"), InputField::TypeInt, &hub->m_requiredScore, y+=buttonPitch, 1, 0, 100000 ); CreateValueControl( LANGUAGEPHRASE("editor_minlinks"), InputField::TypeInt, &hub->m_minActiveLinks, y+=buttonPitch, 1, 0, 100 ); } else if( building->m_type == Building::TypeDynamicNode ) { DynamicNode *node = (DynamicNode *)building; CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &node->m_shapeName, y+=buttonPitch, 0,0,0 ); CreateValueControl( LANGUAGEPHRASE("editor_pointspersec"), InputField::TypeInt, &node->m_scoreValue, y+=buttonPitch, 1, 0, 1000 ); } else if( building->m_type == Building::TypeFenceSwitch ) { FenceSwitch *fs = (FenceSwitch *)building; CreateValueControl( LANGUAGEPHRASE("editor_switchonce"), InputField::TypeInt, &fs->m_lockable, y+=buttonPitch, 0, 1, 0 ); CreateValueControl( LANGUAGEPHRASE("editor_script"), InputField::TypeString, &fs->m_script, y+=buttonPitch, 0, 0, 0 ); } }
void CheatWindow::Create() { DarwiniaWindow::Create(); int y = 25; bool show = true; if( show ) { KillAllEnemiesButton *killAllEnemies = new KillAllEnemiesButton(); killAllEnemies->SetShortProperties( "Kill All Enemies", 10, y, m_w - 20, -1, UnicodeString("Kill All Enemies") ); RegisterButton( killAllEnemies ); m_buttonOrder.PutData( killAllEnemies ); SpawnDarwiniansButton *spawnDarwiniansGreen = new SpawnDarwiniansButton(); spawnDarwiniansGreen->SetShortProperties( "Spawn Green", 10, y += 20, (m_w - 25)/2, -1, UnicodeString("Spawn Green") ); spawnDarwiniansGreen->m_teamId = 0; RegisterButton( spawnDarwiniansGreen ); m_buttonOrder.PutData( spawnDarwiniansGreen ); SpawnDarwiniansButton *spawnDarwiniansRed = new SpawnDarwiniansButton(); spawnDarwiniansRed->SetShortProperties( "Spawn Red", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2, -1, UnicodeString("Spawn Red") ); if( g_app->m_location ) { spawnDarwiniansRed->m_teamId = 1; } RegisterButton( spawnDarwiniansRed ); m_buttonOrder.PutData( spawnDarwiniansRed ); SpawnDarwiniansButton *spawnDarwiniansYellow = new SpawnDarwiniansButton(); spawnDarwiniansYellow->SetShortProperties( "Spawn Yellow", 10, y += 20, (m_w - 25)/2, -1, UnicodeString("Spawn Yellow") ); spawnDarwiniansYellow->m_teamId = 2; RegisterButton( spawnDarwiniansYellow ); m_buttonOrder.PutData( spawnDarwiniansYellow ); SpawnDarwiniansButton *spawnDarwiniansblue = new SpawnDarwiniansButton(); spawnDarwiniansblue->SetShortProperties( "Spawn Blue", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2, -1, UnicodeString("Spawn Blue") ); spawnDarwiniansblue->m_teamId = 3; RegisterButton( spawnDarwiniansblue ); m_buttonOrder.PutData( spawnDarwiniansblue ); SpawnDarwiniansButton *spawnDarwiniansmonster = new SpawnDarwiniansButton(); spawnDarwiniansmonster->SetShortProperties( "Spawn Virus", 10, y += 20, (m_w - 25)/2, -1, UnicodeString("Spawn Virus") ); if( g_app->m_location ) { spawnDarwiniansmonster->m_teamId = g_app->m_location->GetMonsterTeamId(); } RegisterButton( spawnDarwiniansmonster ); m_buttonOrder.PutData( spawnDarwiniansmonster ); SpawnDarwiniansButton *spawnDarwiniansfuture = new SpawnDarwiniansButton(); spawnDarwiniansfuture->SetShortProperties( "Spawn Future", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2, -1, UnicodeString("Spawn Future") ); if( g_app->m_location ) { spawnDarwiniansfuture->m_teamId = g_app->m_location->GetFuturewinianTeamId(); } RegisterButton( spawnDarwiniansfuture ); m_buttonOrder.PutData( spawnDarwiniansfuture ); SpawnTankButton *spawnTankButton = new SpawnTankButton(); spawnTankButton->SetShortProperties( "Spawn Armour", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Armour") ); RegisterButton( spawnTankButton ); m_buttonOrder.PutData( spawnTankButton ); SpawnViriiButton *spawnVirii = new SpawnViriiButton(); spawnVirii->SetShortProperties( "Spawn Virii", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Virii") ); RegisterButton( spawnVirii ); m_buttonOrder.PutData( spawnVirii ); SpawnSpiritButton *spawnSpirits = new SpawnSpiritButton(); spawnSpirits->SetShortProperties( "Spawn Spirits", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Spirits") ); RegisterButton( spawnSpirits ); m_buttonOrder.PutData( spawnSpirits ); AllowArbitraryPlacementButton *allowPlacement = new AllowArbitraryPlacementButton(); allowPlacement->SetShortProperties( "Allow Arbitrary Placement", 10, y += 20, m_w - 20, -1, UnicodeString("Allow Arbitrary Placement") ); RegisterButton( allowPlacement ); m_buttonOrder.PutData( allowPlacement ); EnableGeneratorAndMineButton *enable = new EnableGeneratorAndMineButton(); enable->SetShortProperties( "Enable Generator and Mine", 10, y += 20, m_w - 20, -1, UnicodeString("Enable Generator and Mine") ); RegisterButton( enable ); m_buttonOrder.PutData( enable ); EnableReceiverAndBufferButton *receiver = new EnableReceiverAndBufferButton(); receiver->SetShortProperties( "Enable Receiver and Buffer", 10, y += 20, m_w - 20, -1, UnicodeString("Enable Receiver and Buffer") ); RegisterButton( receiver ); m_buttonOrder.PutData( receiver ); OpenAllLocationsButton *openAllLocations = new OpenAllLocationsButton(); openAllLocations->SetShortProperties( "Open All Locations", 10, y += 20, m_w - 20, -1, UnicodeString("Open All Locations") ); RegisterButton( openAllLocations ); m_buttonOrder.PutData( openAllLocations ); GiveAllResearchButton *allResearch = new GiveAllResearchButton(); allResearch->SetShortProperties( "Give all research", 10, y += 20, m_w - 20, -1, UnicodeString("Give all research") ); RegisterButton( allResearch ); m_buttonOrder.PutData( allResearch ); ClearResourcesButton *clearResources = new ClearResourcesButton(); clearResources->SetShortProperties( "Clear Resources", 10, y += 20, m_w - 20, -1, UnicodeString("Clear Resources") ); RegisterButton( clearResources ); m_buttonOrder.PutData( clearResources ); SpawnPortsButton *spawnPorts = new SpawnPortsButton(); spawnPorts->SetShortProperties( "Spawn Ports", 10, y+=20, m_w - 20, -1, UnicodeString("Spawn Ports") ); RegisterButton( spawnPorts ); m_buttonOrder.PutData( spawnPorts ); if( g_app->Multiplayer() ) { CrateCreateButton *ccb = new CrateCreateButton(); ccb->m_good = true; ccb->SetShortProperties( "GoodCrate", 10, y+=20, (m_w / 2) - 20, -1, UnicodeString("GoodCrate") ); RegisterButton( ccb ); m_buttonOrder.PutData( ccb ); DropDownMenu *crates = new DropDownMenu(); crates->SetShortProperties( "Crates", m_w / 2, y, (m_w/2) - 10, -1, UnicodeString("Crates")); for( int p = 0; p < Crate::NumCrateRewards; ++p ) { crates->AddOption( Crate::GetName(p), p ); } RegisterButton( crates ); m_buttonOrder.PutData( crates ); crates->RegisterInt( &ccb->m_reward ); } y+=20; } ProfilerCreateButton *profiler = new ProfilerCreateButton(); profiler->SetShortProperties( "Profiler", 10, y+=20, m_w-20, -1, UnicodeString("Profiler")); RegisterButton( profiler ); m_buttonOrder.PutData( profiler ); #ifdef SOUND_EDITOR SoundEditorCreateButton *soundEditor = new SoundEditorCreateButton(); soundEditor->SetShortProperties( "Sound Editor", 10, y+=20, m_w-20, -1, UnicodeString("Sound Editor")); RegisterButton( soundEditor ); m_buttonOrder.PutData( soundEditor ); SoundStatsCreateButton *soundStats = new SoundStatsCreateButton(); soundStats->SetShortProperties( "Sound Stats", 10, y+=20, m_w-20, -1, UnicodeString("Sound Stats") ); RegisterButton( soundStats ); m_buttonOrder.PutData( soundStats ); #endif // SOUND_EDITOR NetworkStatsCreateButton *networkStats = new NetworkStatsCreateButton(); networkStats->SetShortProperties( "Network Stats", 10, y+=20, m_w-20, -1, UnicodeString("Network Stats") ); RegisterButton( networkStats ); m_buttonOrder.PutData( networkStats ); ShowDrSepulvedaFaceButton *faceButton = new ShowDrSepulvedaFaceButton(); faceButton->SetShortProperties( "Network Stats", 10, y+=20, m_w-20, -1, UnicodeString("Show Dr S Face") ); RegisterButton( faceButton ); m_buttonOrder.PutData( faceButton ); }
void SidePanel::ChangeMode( int mode ) { m_mode = mode; int x = 26; int y = 50; m_w = 100; InterfaceWindow::Remove(); // CreateExpandButton(); if( m_mode == ModeUnitPlacement ) { UnitPlacementButton *radar = new UnitPlacementButton(WorldObject::TypeRadarStation); radar->SetProperties( "Radar", x, y, 48, 48, "", "tooltip_place_radar", false, true ); RegisterButton( radar ); UnitPlacementButton *silo = new UnitPlacementButton(WorldObject::TypeSilo); silo->SetProperties( "Silo", x, y+75, 48, 48, "", "tooltip_place_silo", false, true ); RegisterButton( silo ); UnitPlacementButton *airbase = new UnitPlacementButton(WorldObject::TypeAirBase); airbase->SetProperties( "AirBase", x, y+150, 48, 48, "", "tooltip_place_airbase", false, true ); RegisterButton( airbase ); Team *myTeam = g_app->GetWorld()->GetTeam( g_app->GetWorld()->m_myTeamId ); int shipsRemaining = 0; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeBattleShip]; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeCarrier]; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeSub]; PanelModeButton *fmb = new PanelModeButton( ModeFleetPlacement, true ); fmb->SetProperties( "FleetMode", x, y+220, 48, 48, "dialog_fleets", "tooltip_fleet_button", true, true ); strcpy( fmb->bmpImageFilename, "graphics/fleet.bmp" ); if( shipsRemaining == 0 ) { fmb->m_disabled = true; } RegisterButton( fmb ); } else if( m_mode == ModeFleetPlacement ) { m_w = 160; AddToFleetButton *battleship = new AddToFleetButton(WorldObject::TypeBattleShip); battleship->SetProperties( "BattleShip", x, y, 48, 48, "", "tooltip_place_battleship", false, true ); RegisterButton( battleship ); AddToFleetButton *sub = new AddToFleetButton(WorldObject::TypeSub); sub->SetProperties( "Sub", x, y+75, 48, 48, "", "tooltip_place_sub", false, true ); RegisterButton( sub ); AddToFleetButton *carrier = new AddToFleetButton(WorldObject::TypeCarrier); carrier->SetProperties( "Carrier", x, y+150, 48, 48, "", "tooltip_place_carrier", false, true ); RegisterButton( carrier ); PanelModeButton *umb = new PanelModeButton( ModeUnitPlacement, true ); umb->SetProperties( "UnitMode", x, y+220, 48, 48, "dialog_units", "", true, false ); strcpy( umb->bmpImageFilename, "graphics/units.bmp" ); RegisterButton( umb ); x = 120; y = 20; for( int i = 0; i < 6; ++i ) { char name[128]; sprintf( name, "Remove Unit %d", i ); RemoveUnitButton *rb = new RemoveUnitButton(); rb->SetProperties( name, x, y, 40, 40, "", "tooltip_fleet_remove", false, true ); rb->m_memberId = i; RegisterButton( rb ); y += 50; } FleetPlacementButton *fpb = new FleetPlacementButton(); fpb->SetProperties( "PlaceFleet", x, y, 40, 40, "dialog_place_fleet", "tooltip_fleet_place", true, true ); RegisterButton( fpb ); Team *myTeam = g_app->GetWorld()->GetTeam( g_app->GetWorld()->m_myTeamId ); if( m_currentFleetId == -1 || myTeam->m_fleets[myTeam->m_fleets.Size()-1]->m_active == true ) { int shipsRemaining = 0; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeBattleShip]; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeCarrier]; shipsRemaining += myTeam->m_unitsAvailable[WorldObject::TypeSub]; if( shipsRemaining > 0 ) { m_currentFleetId = myTeam->m_fleets.Size(); g_app->GetClientToServer()->RequestFleet( myTeam->m_teamId ); } } } }