SPRulesBox::SPRulesBox ( AUI_ERRCODE *retval, uint32 id, MBCHAR *ldlBlock ) : m_spGenocide(NULL), m_spTrade(NULL), m_spCombat(NULL), m_spPollution(NULL), m_RTOP(NULL), m_RHEADER(NULL), m_RBOT(NULL), m_RLEFT(NULL), m_RRIGHT(NULL) { m_spGenocide = spNew_c3_CheckBox(retval,ldlBlock,"GenocideButton",0,spnewgamescreen_genocidePress); m_spTrade = spNew_c3_CheckBox(retval,ldlBlock,"TradeButton",0,spnewgamescreen_tradePress); m_spCombat = spNew_c3_CheckBox(retval,ldlBlock,"CombatButton",0,spnewgamescreen_combatPress); m_spPollution = spNew_c3_CheckBox(retval,ldlBlock,"PollutionButton",0,spnewgamescreen_pollutionPress); m_spGenocide->SetState(g_theProfileDB->IsGenocideRule()); m_spTrade->SetState(g_theProfileDB->IsTradeRule()); m_spCombat->SetState(g_theProfileDB->IsSimpleCombatRule()); m_spPollution->SetState(g_theProfileDB->IsPollutionRule()); m_RTOP = spNew_c3_Static(retval,ldlBlock, "RTOP"); m_RHEADER = spNew_c3_Static(retval,ldlBlock, "RHEADER"); m_RBOT = spNew_c3_Static(retval,ldlBlock, "RBOT"); m_RLEFT = spNew_c3_Static(retval,ldlBlock, "RLEFT"); m_RRIGHT = spNew_c3_Static(retval,ldlBlock, "RRIGHT"); }
SPProfileBox::SPProfileBox ( AUI_ERRCODE *retval, uint32 id, MBCHAR *ldlBlock ) : m_spClan(NULL),m_spGender(NULL),m_spName(NULL), m_spPreferences(NULL),m_spCustom(NULL), m_PTOP(NULL), m_PHEADER(NULL), m_PBOT(NULL), m_PLEFT(NULL), m_PRIGHT(NULL) { { int i=0,numClans; numClans = g_theCivilisationDB->NumRecords(); m_spClan = spNew_c3_DropDown(retval,ldlBlock,"Clan",spnewgamescreen_clanSelect); while(i<numClans) { aui_Item *item = NULL; const MBCHAR *cName = g_theStringDB->GetNameStr(g_theCivilisationDB->Get(i)->GetPluralCivName()); item = (aui_Item*)new SPDropDownListItem(retval, "SPDropDownListItem", "Clan", cName); if (item) m_spClan->AddItem(item ); i++; } } { m_spGender = spNew_c3_DropDown(retval,ldlBlock,"Gender",spnewgamescreen_genderSelect); aui_StringTable * gender = spNewStringTable(retval,"SPGenderChoicesStringTable"); spFillDropDown(retval,m_spGender,gender,"SPDropDownListItem","Gender"); delete gender; } m_spName = spNewTextEntry(retval,ldlBlock,"Name"); m_spPreferences = spNew_ctp2_Button(retval,ldlBlock,"Preferences",spnewgamescreen_preferencePress); m_spCustom = spNew_ctp2_Button(retval,ldlBlock,"PCustom", spnewgamescreen_pCustomPress); m_PTOP = spNew_c3_Static(retval,ldlBlock, "PTOP"); m_PHEADER = spNew_c3_Static(retval,ldlBlock, "PHEADER"); m_PBOT = spNew_c3_Static(retval,ldlBlock, "PBOT"); m_PLEFT = spNew_c3_Static(retval,ldlBlock, "PLEFT"); m_PRIGHT = spNew_c3_Static(retval,ldlBlock, "PRIGHT"); }
SPDropDownListItem::SPDropDownListItem(AUI_ERRCODE *retval, MBCHAR *ldlBlock,MBCHAR *type,const MBCHAR *name) : aui_ImageBase(ldlBlock), aui_TextBase(ldlBlock, (MBCHAR *)NULL), c3_ListItem( retval, ldlBlock), m_myItem(NULL) { m_myItem = spNew_c3_Static(retval, ldlBlock, type); if(m_myItem) { m_myItem->SetText(name); AddChild(m_myItem); } }
InitPlayWindow::InitPlayWindow ( AUI_ERRCODE * retval, uint32 id, MBCHAR * ldlBlock, sint32 bpp, AUI_WINDOW_TYPE type, bool bevel ) : C3Window (retval, id, ldlBlock, bpp, type, bevel), m_spriteTest (spNew_ctp2_Button (retval, ldlBlock, "SpriteTestButton", "Sprite Test", spritetest_spPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), m_email (spNew_ctp2_Button (retval, ldlBlock, "EmailButton", "Email", initialplayscreen_emailPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), m_hotseat (spNew_ctp2_Button (retval, ldlBlock, "HotSeatButton", "Hotseat", initialplayscreen_hotseatPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), m_mp (spNew_ctp2_Button (retval, ldlBlock, "MPButton", "Multiplayer", initialplayscreen_mpPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), m_credits (spNew_ctp2_Button (retval, ldlBlock, "CreditsButton", "Credits", initialplayscreen_creditsPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), m_quit (spNew_ctp2_Button (retval, ldlBlock, "QuitButton", "Quit Out", initialplayscreen_quitPress, "CTP2_BUTTON_TEXT_RIGHT_LARGE" ) ), // New buttons moved from the SP screen (code taken from spwindow.cpp) m_tutorial (spNew_ctp2_Button (retval, ldlBlock, "TutorialButton", initialplayscreen_tutorialPress) ), m_newgame (spNew_ctp2_Button (retval, ldlBlock, "NewGameButton", initialplayscreen_newgamePress) ), m_loadgame (spNew_ctp2_Button (retval, ldlBlock, "LoadGameButton", initialplayscreen_loadgamePress) ), m_options (spNew_ctp2_Button (retval, ldlBlock, "OptionsButton", initialplayscreen_optionsPress) ), m_background (spNew_c3_Static(retval, ldlBlock, "Background")), m_testBox (new ctp2_Static (retval, aui_UniqueId(), "InitPlayWindow.TestTextBox") ) { #ifndef _DEBUG m_spriteTest->Hide(); #endif }
AUI_ERRCODE graphicsscreen_Initialize( void ) { s_gridToggled = FALSE; s_cityInfluenceToggled = FALSE; s_politicalBordersToggled = FALSE; if ( s_graphicsWindow ) return AUI_ERRCODE_OK; AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; strcpy(windowBlock, "GraphicsWindow"); s_graphicsWindow = new c3_PopupWindow( &errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_FLOATING, false ); Assert( AUI_NEWOK(s_graphicsWindow, errcode) ); if ( !AUI_NEWOK(s_graphicsWindow, errcode) ) return errcode; s_graphicsWindow->SetStronglyModal(TRUE); s_walk = spNew_aui_Switch(&errcode,windowBlock,"WalkButton",graphicsscreen_checkPress,&check[GS_WALK]); s_trade = spNew_aui_Switch(&errcode,windowBlock,"TradeButton",graphicsscreen_checkPress,&check[GS_TRADE]); s_wonder = spNew_aui_Switch(&errcode,windowBlock,"WonderButton",graphicsscreen_checkPress,&check[GS_WONDER]); s_politicalBorders = spNew_aui_Switch(&errcode,windowBlock,"PoliticalBordersButton",graphicsscreen_checkPress,&check[GS_POLITICALBORDERS]); s_tradeRoutes = spNew_aui_Switch(&errcode,windowBlock,"TradeRoutesButton",graphicsscreen_checkPress,&check[GS_TRADEROUTES]); s_cityInfluence = spNew_aui_Switch(&errcode,windowBlock,"CityInflenceButton",graphicsscreen_checkPress,&check[GS_CITYINFLUENCE]); s_grid = spNew_aui_Switch(&errcode,windowBlock,"GridButton",graphicsscreen_checkPress,&check[GS_GRID]); s_cityNames = spNew_aui_Switch(&errcode,windowBlock,"CityNamesButton", graphicsscreen_checkPress, &check[GS_CITYNAMES]); s_armyNames = spNew_aui_Switch(&errcode,windowBlock,"ArmyNamesButton", graphicsscreen_checkPress, &check[GS_ARMYNAMES]); s_civflags = spNew_aui_Switch(&errcode,windowBlock,"CivFlagButton", graphicsscreen_checkPress, &check[GS_CIVFLAGS]); s_resScreenButton = spNew_ctp2_Button( &errcode, windowBlock, "ResolutionButton", graphicsscreen_selectResolution ); s_smooth = spNew_aui_Switch(&errcode,windowBlock,"SmoothButton", graphicsscreen_checkPress, &check[GS_SMOOTH]); s_goodAnims = spNew_aui_Switch(&errcode,windowBlock,"GoodsButton",graphicsscreen_checkPress,&check[GS_GOODANIMS]); s_cityProd = spNew_aui_Switch(&errcode,windowBlock,"ShowCityProdButton",graphicsscreen_checkPress,&check[GS_CITYPROD]); s_unitSpeed = spNew_C3Slider(&errcode, windowBlock, "UnitSpeedSlider", graphicsscreen_unitSpeedSlide); s_unitSpeedN = spNew_c3_Static(&errcode, windowBlock, "UnitSpeedName"); if(g_theProfileDB) { s_unitSpeed->SetValue(g_theProfileDB->GetUnitSpeed(), 0); } else { s_unitSpeed->SetValue(0,0); } s_walk ->SetState(g_theProfileDB->IsUnitAnim()); s_trade ->SetState(g_theProfileDB->IsTradeAnim()); s_wonder ->SetState(g_theProfileDB->IsWonderMovies()); s_politicalBorders ->SetState(g_theProfileDB->GetShowPoliticalBorders()); s_tradeRoutes ->SetState(g_theProfileDB->GetShowTradeRoutes()); s_cityNames ->SetState(g_theProfileDB->GetShowCityNames()); s_armyNames ->SetState(g_theProfileDB->GetShowArmyNames()); s_civflags ->SetState(g_theProfileDB->IsCivFlags()); s_smooth ->SetState(g_theProfileDB->IsSmoothBorders()); s_goodAnims ->SetState(g_theProfileDB->IsGoodAnim()); s_cityInfluence ->SetState(g_theProfileDB->IsShowCityInfluence()); s_grid ->SetState(g_isGridOn); s_cityProd ->SetState(g_theProfileDB->IsShowCityProduction()); MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf( block, "%s.%s", windowBlock, "Name" ); s_graphicsWindow->AddTitle( block ); s_graphicsWindow->AddClose( graphicsscreen_exitPress ); errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); return AUI_ERRCODE_OK; }
SPWorldBox::SPWorldBox ( AUI_ERRCODE *retval, uint32 id, MBCHAR *ldlBlock ) : m_mapSize(NULL), m_worldType(NULL), m_worldShape(NULL), m_difficulty(NULL), m_riskLevel(NULL), m_opponent(NULL), m_spCustom(NULL), m_WTOP(NULL), m_WHEADER(NULL), m_WBOT(NULL), m_WLEFT(NULL), m_WRIGHT(NULL) { m_mapSize = spNew_c3_DropDown(retval,ldlBlock,"MapSize",spnewgamescreen_mapSizeSelect); { aui_StringTable * mysizes = spNewStringTable(retval,"SPMapSizeStringTable"); spFillDropDown(retval,m_mapSize,mysizes,"SPDropDownListItem","MapSize"); delete mysizes; } m_worldType = spNew_c3_DropDown(retval,ldlBlock,"WorldType",spnewgamescreen_worldTypeSelect); { aui_StringTable * mytypes = spNewStringTable(retval,"SPWorldTypeStringTable"); spFillDropDown(retval,m_worldType,mytypes,"SPDropDownListItem","WorldType"); delete mytypes; } m_worldShape = spNew_c3_DropDown(retval,ldlBlock,"WorldShape",spnewgamescreen_worldShapeSelect); { aui_StringTable * myshapes = spNewStringTable(retval,"SPWorldShapeStringTable"); spFillDropDown(retval,m_worldShape,myshapes,"SPDropDownListItem","WorldShape"); delete myshapes; } m_difficulty = spNew_c3_DropDown(retval,ldlBlock,"Difficulty",spnewgamescreen_difficultySelect); { aui_StringTable * mydiffs = spNewStringTable(retval,"SPDifficultyStringTable"); spFillDropDown(retval,m_difficulty,mydiffs,"SPDropDownListItem","Difficulty"); delete mydiffs; m_difficulty->SetSelectedItem(g_theProfileDB->GetDifficulty()); } m_riskLevel = spNew_c3_DropDown(retval,ldlBlock,"RiskLevel",spnewgamescreen_riskLevelSelect); { aui_StringTable * myrisks = spNewStringTable(retval,"SPRiskLevelStringTable"); spFillDropDown(retval,m_riskLevel,myrisks,"SPDropDownListItem","RiskLevel"); delete myrisks; m_riskLevel->SetSelectedItem(g_theProfileDB->GetRiskLevel()); } m_opponent = spNew_c3_DropDown(retval,ldlBlock,"Opponent",spnewgamescreen_opponentSelect); { for(uint32 i=3; i<=16; i++) { MBCHAR textBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf(textBlock, "%d",i); c3_ListItem *myitem = new SPDropDownListItem(retval,"SPDropDownListItem","Opponent", textBlock); if(myitem) m_opponent->AddItem(myitem); } uint32 numPlayers = g_theProfileDB->GetNPlayers(); Assert((numPlayers>2) && (numPlayers<17)); m_opponent->SetSelectedItem(numPlayers-3); } m_spCustom = spNew_ctp2_Button(retval,ldlBlock,"WCustom", spnewgamescreen_wCustomPress); m_WTOP = spNew_c3_Static(retval,ldlBlock, "WTOP"); m_WHEADER = spNew_c3_Static(retval,ldlBlock, "WHEADER"); m_WBOT = spNew_c3_Static(retval,ldlBlock, "WBOT"); m_WLEFT = spNew_c3_Static(retval,ldlBlock, "WLEFT"); m_WRIGHT = spNew_c3_Static(retval,ldlBlock, "WRIGHT"); }
SPNewGameWindow::SPNewGameWindow(AUI_ERRCODE *retval, uint32 id, MBCHAR *ldlBlock, sint32 bpp, AUI_WINDOW_TYPE type, bool bevel) : C3Window (retval, id, ldlBlock, bpp, type, bevel), m_spStart (NULL), m_spOk (NULL), m_spReturn (NULL), m_spTribe (NULL), m_spDifficulty (NULL), m_spMapSize (NULL), m_spPlayers (NULL), m_spMap (NULL), m_spRules (NULL), m_spEditor (NULL), m_spScenario (NULL), m_spGeneral (NULL), m_spWorld (NULL), m_spCustom (NULL), m_spName (NULL), m_mapTypeButton (NULL), m_mapTypeLabel (NULL), m_worldShapeButton (NULL), m_worldShapeLabel (NULL), m_useCustomMap (false), m_civilizationLabel (NULL), m_leaderNameLabel (NULL), m_difficultyLabel (NULL), m_worldSizeLabel (NULL), m_rulesLabel (NULL), m_playersLabel (NULL), m_worldTypeLabel (NULL), m_quitButton (NULL), m_spTitle (NULL), m_spBackground (NULL), m_string (NULL), m_scenarioName (NULL), m_scenarioStaticText (NULL) { Assert(AUI_SUCCESS(*retval)); m_spStart = spNew_ctp2_Button(retval,ldlBlock,"StartButton",spnewgamescreen_startPress); m_spReturn = spNew_ctp2_Button(retval,ldlBlock,"ReturnButton",spnewgamescreen_returnPress); m_scenarioName = spNew_c3_Static(retval, ldlBlock, "ScenarioName"); m_scenarioStaticText = spNew_c3_Static(retval, ldlBlock, "ScenarioStaticText"); m_spTribe = spNew_ctp2_Button( retval, ldlBlock, "TribeButton", spnewgamescreen_tribePress ); m_spDifficulty = spNew_ctp2_Button( retval, ldlBlock, "DifficultyButton", spnewgamescreen_difficultyPress ); m_spMapSize = spNew_ctp2_Button( retval, ldlBlock, "MapSizeButton", spnewgamescreen_mapSizePress ); m_spPlayers = spNew_ctp2_Button( retval, ldlBlock, "PlayersButton", spnewgamescreen_playersPress ); m_spMap = spNew_ctp2_Button( retval, ldlBlock, "MapButton", spnewgamescreen_mapPress ); m_spRules = spNew_ctp2_Button( retval, ldlBlock, "RulesButton", spnewgamescreen_rulesPress ); m_spEditor = spNew_ctp2_Button(retval, ldlBlock, "EditorButton", spnewgamescreen_editorPress); m_spScenario = spNew_ctp2_Button(retval, ldlBlock, "ScenarioButton", spnewgamescreen_scenarioPress); m_spName = spNewTextEntry(retval,ldlBlock,"Name"); m_worldShapeLabel = spNew_c3_Static( retval, ldlBlock, "WorldShapeLabel" ); m_worldShapeButton = spNew_ctp2_Button( retval, ldlBlock, "WorldShapeButton", spnewgamescreen_worldShapePress ); m_civilizationLabel = spNew_c3_Static( retval, ldlBlock, "CivilizationLabel" ); m_leaderNameLabel = spNew_c3_Static( retval, ldlBlock, "LeaderNameLabel" ); m_difficultyLabel = spNew_c3_Static( retval, ldlBlock, "DifficultyLabel" ); m_worldSizeLabel = spNew_c3_Static( retval, ldlBlock, "MapSizeLabel" ); m_rulesLabel = spNew_c3_Static( retval, ldlBlock, "RulesLabel" ); m_playersLabel = spNew_c3_Static( retval, ldlBlock, "PlayersLabel" ); m_worldTypeLabel = spNew_c3_Static( retval, ldlBlock, "MapButtonLabel" ); m_quitButton = spNew_ctp2_Button( retval, ldlBlock, "QuitButton", spnewgamescreen_quitPress ); m_spTitle = spNew_c3_Static(retval,ldlBlock,"Title"); m_spBackground = spNew_c3_Static(retval,ldlBlock,"Background"); m_string = spNewStringTable(retval,"SPNewGameStrings"); // Reset failsafe start/end ages here, so they're correct before agesscreen is initialized. g_theProfileDB->SetSPStartingAge(0); g_theProfileDB->SetSPEndingAge(g_theAgeDB->NumRecords() - 1); g_theProfileDB->Save(); Update(); }
AUI_ERRCODE spnewgamediffscreen_Initialize( aui_Control::ControlActionCallback *callback ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( s_spNewGameDiffScreen ) { if(callback) { s_spNewGameDiffScreen->Ok()->SetActionFuncAndCookie(callback, NULL); } return AUI_ERRCODE_OK; } strcpy(windowBlock, "SPNewGameDiffScreen"); { s_spNewGameDiffScreen = new c3_PopupWindow( &errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_FLOATING, false); Assert( AUI_NEWOK(s_spNewGameDiffScreen, errcode) ); if ( !AUI_NEWOK(s_spNewGameDiffScreen, errcode) ) errcode; s_spNewGameDiffScreen->Resize(s_spNewGameDiffScreen->Width(),s_spNewGameDiffScreen->Height()); s_spNewGameDiffScreen->GrabRegion()->Resize(s_spNewGameDiffScreen->Width(),s_spNewGameDiffScreen->Height()); s_spNewGameDiffScreen->SetStronglyModal(TRUE); } if ( !callback ) callback = spnewgamediffscreen_backPress; sprintf( controlBlock, "%s.%s", windowBlock, "Name" ); s_spNewGameDiffScreen->AddTitle( controlBlock ); s_spNewGameDiffScreen->AddClose( callback ); s_skillLevel = spNew_c3_Static(&errcode,windowBlock,"SkillLevel"); s_barbarianThreat = spNew_c3_Static(&errcode,windowBlock,"BarbarianThreat"); s_diffListBox = (ctp2_ListBox *)aui_Ldl::BuildHierarchyFromRoot("SPNewGameDiffScreen.DiffBox"); s_riskListBox = (ctp2_ListBox *)aui_Ldl::BuildHierarchyFromRoot("SPNewGameDiffScreen.RiskBox"); Assert(s_diffListBox); Assert(s_riskListBox); s_diffListBox->SetForceSelect(TRUE); s_riskListBox->SetForceSelect(TRUE); sint32 i; for(i = 0; i < g_theDifficultyDB->NumRecords(); ++i){ ctp2_ListItem *item = (ctp2_ListItem *)aui_Ldl::BuildHierarchyFromRoot("DiffRiskItem"); Assert(item); if(!item) break; item->SetUserData((void *)i); ctp2_Static *text = (ctp2_Static *)item->GetChildByIndex(0); Assert(text); if(!text) break; text->SetText(g_theDifficultyDB->Get(i)->GetNameText()); s_diffListBox->AddItem(item); } Assert( g_theProfileDB->GetDifficulty() >= 0 ); if(g_theProfileDB->GetDifficulty() < 0) g_theProfileDB->SetDifficulty(0); // In the case of a mod change and the mods have different number of difficulties: if(g_theProfileDB->GetDifficulty() >= g_theDifficultyDB->NumRecords()) g_theProfileDB->SetDifficulty(g_theDifficultyDB->NumRecords() - 1); s_diffListBox->SelectItem(g_theProfileDB->GetDifficulty()); for(i = 0; i < g_theRiskDB->NumRecords(); ++i){ ctp2_ListItem *item = (ctp2_ListItem *)aui_Ldl::BuildHierarchyFromRoot("DiffRiskItem"); Assert(item); if(!item) break; item->SetUserData((void *)i); ctp2_Static *text = (ctp2_Static *)item->GetChildByIndex(0); Assert(text); if(!text) break; text->SetText(g_theRiskDB->Get(i)->GetNameText()); s_riskListBox->AddItem(item); } Assert( g_theProfileDB->GetRiskLevel() >= 0 ); if(g_theProfileDB->GetRiskLevel() < 0) g_theProfileDB->SetRiskLevel(0); // In the case of a mod change and the mods have different number of difficulties: if(g_theProfileDB->GetRiskLevel() >= g_theRiskDB->NumRecords()) g_theProfileDB->SetRiskLevel(g_theRiskDB->NumRecords() - 1); s_riskListBox->SelectItem(g_theProfileDB->GetRiskLevel()); errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); return AUI_ERRCODE_OK; }