MetaRoom::MetaRoom(int _x, int _y, int _width, int _height, const std::string &back, shared_ptr<creaturesImage> spr, bool wrap) { xloc = _x; yloc = _y; wid = _width; hei = _height; wraps = wrap; // if we were provided with a background, add it if (!back.empty()) { if (spr) { addBackground(back, spr); } else { addBackground(back); } } }
OptionsKeyboardConfigurationMenu::OptionsKeyboardConfigurationMenu(::Engines::Console *console) : GUI(console) { load("optkeymapping"); addBackground(kBackgroundTypeMenu); }
bool Gameboard::init() { if (!score_) { return false; } board_ = Board::create(*PiecesManager::getInstance()); addBackground(); refill(); while (check()) { std::set<IPiece*> removal; uint16_t count = 0; for (auto vec : checkResults_) { std::stringstream ss; for (IPiece* piece : vec) { board_->remove(piece->getCoords()); Sprite* sprite = piece->sprite(); sprite->removeFromParentAndCleanup(true); count++; } removal.insert(vec.begin(), vec.end()); } for (auto it = removal.begin(); it != removal.end(); ++it) { delete *it; } refill(); } animate_ = true; return true; }
bool CIStartScene::init() { if (!Layer::init()) { return false; } _visibleSize = Director::getInstance()->getVisibleSize(); _visibleOrigin = Director::getInstance()->getVisibleOrigin(); addBackground(); if (CIGameManager::getDialogState() < 5) { addDialogs(); addNextBtn(); addBackBtn(); } else if (CIGameManager::getDialogState() == 5) { addStartBtn(); addAnswers(); } return true; }
cTrackingMenu() { setType( 0xFE12ACDE ); startPage( 0 ); addBackground( 0x13BE, 440, 135 ); addResizeGump( 10, 10, 0xA3C, 420, 75 ); addResizeGump( 10, 85, 0xBB8, 420, 25 ); // Animals (0x2101) addTilePic( 20, 20, 0x2101 ); addButton( 20, 110, 0xFA5, 0xFA7, 1 ); addXmfHtmlGump( 20, 90, 100, 20, 0xF88E7 ); // Monster (0x210a) addTilePic( 120, 20, 0x210a ); addButton( 120, 110, 0xFA5, 0xFA7, 2 ); addXmfHtmlGump( 120, 90, 100, 20, 0xF88E8 ); // Humans (0x2106) addTilePic( 220, 20, 0x2106 ); addButton( 220, 110, 0xFA5, 0xFA7, 3 ); addXmfHtmlGump( 220, 90, 100, 20, 0xF88E9 ); // Player (0x2107) addTilePic( 320, 20, 0x2107 ); addButton( 320, 110, 0xFA5, 0xFA7, 4 ); addXmfHtmlGump( 320, 90, 100, 20, 0xF88EA ); }
void menuSelect() { setvbuf(stdout, NULL, _IONBF, 0); while (1) { printf("> "); char command[32]; fgets(command, 32*sizeof(char), stdin); command[strcspn(command, "\n")] = 0; if (command[0] == 'q') { printf("Goodbye.\n"); break; } else if (command[0] == '?') { printf("Commands:\n"); printf("\t?: Print this command list\n"); printf("\tq: Quit\n"); printf("\tBackground: Add another background picture\n"); printf("\tTarget: Add another target image\n"); printf("\tGenerate: Create a puzzle\n"); } else if (strcmp(command, "Background") == 0) { addBackground(); } else if (strcmp(command, "Target") == 0) { addTarget(); } else if (strcmp(command, "Generate") == 0) { generatePuzzle(); } } }
SaveLoadMenu::SaveLoadMenu(Module &module, ::Engines::Console *console, uint8 type, bool frontBackground) : GUI(console), _module(&module), _type(type) { load("saveload"); addBackground(kBackgroundTypeMenu, frontBackground); WidgetListBox *lbGames = getListBox("LB_GAMES"); lbGames->setPermanentHighlightEnabled(true); const std::vector<KotORWidget *> &itemWidgets = lbGames->createItemWidgets(); for (std::vector<KotORWidget *>::const_iterator it = itemWidgets.begin(); it != itemWidgets.end(); ++it) { addWidget(*it); } if (_type == kSaveLoadMenuTypeLoad) { getLabel("LBL_PANELNAME")->setText(TalkMan.getString(1585)); // Load Game getLabel("LBL_PLANETNAME")->setText(""); getLabel("LBL_AREANAME")->setText(""); getButton("BTN_SAVELOAD")->setText(TalkMan.getString(1589)); // Load } else lbGames->addItem(TalkMan.getString(1590)); addSavedGameItems(lbGames); lbGames->refreshItemWidgets(); }
PartySelectionGUI::PartySelectionGUI(bool k2) : _kotor2(k2), _numSelectedSlots(0), _activeSlot(-1) { addBackground(kBackgroundTypeMenu, true); load("partyselection"); }
int FWScript::o2_addBackground() { byte param1 = getNextByte(); const char *param2 = getNextString(); debugC(5, kCineDebugScript, "Line: %d: addBackground(%s,%d)", _line, param2, param1); addBackground(param2, param1); return 0; }
MainMenu::MainMenu(Module &module, bool isXbox) : _module(&module), _isXbox(isXbox) { load(isXbox ? "mainmenu" : "mainmenu16x12"); addBackground("back"); _movies = 0; _options = 0; }
MainMenu::MainMenu(Module &module, bool isXbox, ::Engines::Console *console) : GUI(console), _module(&module), _isXbox(isXbox) { load(isXbox ? "mainmenu" : "mainmenu16x12"); addBackground(kBackgroundTypeMenu); startMainMusic(); }
CharacterGenerationPortraitMenu::CharacterGenerationPortraitMenu(KotORBase::CharacterGenerationInfo &info, Console *console) : CharacterGenerationBaseMenu(info, console) { load("portcust"); addBackground(KotORBase::kBackgroundTypeMenu); getLabel("LBL_PORTRAIT")->setFill(_info.getPortrait()); }
bool BackgroundLayer::init() { if(!Layer::init()) { return false; } addBackground(); this->schedule(schedule_selector(BackgroundLayer::updateSelf),NULL); return true; }
MainMenu::MainMenu(Module &module, bool isXbox, ::Engines::Console *console) : GUI(console), _module(&module), _isXbox(isXbox) { load(isXbox ? "mainmenu" : "mainmenu16x12"); addBackground("back"); _movies = 0; _options = 0; }
bool BackgroundLayer::init() { if (!Node::init()) { return false; } visibleSize = Director::getInstance()->getVisibleSize(); origin = Director::getInstance()->getVisibleOrigin(); addBackground(); return true; }
void wyToast::setBackground(wyNode* bg) { // remove old bg from scene removeBackground(); // save new bg m_bg = bg; addBackground(); // set flag m_dirty = true; m_useDefaultBg = false; }
bool BackgroundLayer::init() { if (!Layer::init()) { return false; } number = 0; //Ìí¼Ó±³¾°Í¼Æ¬ addBackground(); //»Øµ÷º¯Êý£¬Ã¿Ö¡»Øµ÷ this->scheduleUpdate(); return true; }
OptionsGraphicsMenu::OptionsGraphicsMenu(::Engines::Console *console) : KotORBase::GUI(console) { load("optgraphics"); addBackground(KotORBase::kBackgroundTypeMenu); _advanced.reset(new OptionsGraphicsAdvancedMenu(_console)); _resolution.reset(new OptionsResolutionMenu(_console)); // Hardcoded, the gui file returns incorrect values getCheckBox("CB_SHADOWS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_GRASS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); readConfig(); }
//------------------------------------------------------------------ // // MainGameLayer3 // //------------------------------------------------------------------ bool MainGameLayer3::init() { iMaxFeet = MAX_DIVE_FEET_AT_ONE_SCENE; iTagForMarinelife = kTagLayerSquid; // Add background sprite addBackground(); // Touch Director* director = Director::getInstance(); director->getTouchDispatcher()->addTargetedDelegate(this, 0, true); return true; }
bool Home::init() { if (!CCLayer::init()) { return false; } addBackground(this); LabelBuilder::label(Formatter::toString("Rank: %s", Rank::getText()), SANS_SEMIBOLD_FONT)->size(42)->position( ccp(VisibleRect::rightTop().x - 20, VisibleRect::rightTop().y - 20))->anchorPoint( ccp(1.0f, 1.0f))->addTo( this); auto logoBackground = sprite("LogoBackground", VisibleRect::top()); addChild(logoBackground); auto moveToPosition = CCEaseBackOut::create( CCMoveTo::create(1.2f, ccp(VisibleRect::center().x - 40, VisibleRect::center().y + 110))); auto fadeIn = CCFadeIn::create(1.0f); logoBackground->runAction(moveToPosition); logoBackground->runAction(fadeIn); logoBackground->runAction( CCRepeatForever::create( CCSequence::create( CCMoveBy ::create(2.0f, ccp(0, 15)), CCMoveBy::create(2.0f, ccp(0, -15)), NULL))); logoBackground->runAction( CCRepeatForever::create( CCSequence::create(CCDelayTime::create(1.4f), CCRotateBy::create(30.0f, 360), NULL))); auto logoTextIQ = sprite("LogoIQText", ccp(VisibleRect::center().x - 120, VisibleRect::center().y + 75)); logoTextIQ->setOpacity(0.0f); logoTextIQ->runAction(CCFadeIn::create(1.6f)); fadeInAfterDelay(logoTextIQ); addChild(logoTextIQ); auto logoText = sprite("LogoText", ccp(VisibleRect::center().x - 15, VisibleRect::center().y + 160)); fadeInAfterDelay(logoText); addChild(logoText); addMenu(); return true; }
bool Inventory::init() { // 1. super init first if (!Layer::init()) { return false; } visibleSize = Director::getInstance()->getVisibleSize(); origin = Director::getInstance()->getVisibleOrigin(); addBackground(); // 添加背景 addMenu(); // 添加菜单 addUI(); // 添加UI // 每分钟更新一次时间 this->schedule(schedule_selector(Inventory::updateTime), 60.0f, kRepeatForever, 0); return true; }
//------------------------------------------------------------------ // // MainGameLayer2 // //------------------------------------------------------------------ bool MainGameLayer2::init() { iMaxFeet = MAX_DIVE_FEET_AT_ONE_SCENE; iTagForMarinelife = kTagLayerTurtle; // Add background sprite addBackground(); // Touch Director* director = Director::getInstance(); director->getTouchDispatcher()->addTargetedDelegate(this, 0, true); // ADMOB JNI AdmobJNI::setAdmobVisible(true, true); return true; }
//------------------------------------------------------------------ // // MainGameLayer // //------------------------------------------------------------------ bool MainGameLayer::init() { if ( !Layer::init() ) { return false; } isRunningEffect = false; //touch Director* director = Director::getInstance(); director->getTouchDispatcher()->addTargetedDelegate(this, 0, true); addBackground(); return true; }
OptionsGameplayMenu::OptionsGameplayMenu(::Engines::Console *console) : GUI(console) { load("optgameplay"); addBackground(kBackgroundTypeMenu); _mousesettings.reset(new OptionsMouseSettingsMenu(_console)); _keyboardconfiguration.reset(new OptionsKeyboardConfigurationMenu(_console)); //Hardcoded, the gui file returns 1.0, 1.0, 1.0, 1.0 getButton("BTN_DIFFLEFT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_DIFFLEFT", true)->setStaticHighlight(); getButton("BTN_DIFFRIGHT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_DIFFRIGHT", true)->setStaticHighlight(); getCheckBox("CB_LEVELUP", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_INVERTCAM", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_AUTOSAVE", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_REVERSE", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_DISABLEMOVE", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); }
// on "init" you need to initialize your instance bool PizzaSpeedLevel::init() { // 1. super init first if ( !Layer::init() ) return false; createStarsBackground("Pictures/bigStar.png",20); createStarsBackground("Pictures/smallStar.png",50); showInstructions(); createMenu(); addRemainingTimeLabel(); addBackground("Pictures/PizzaSpeedBack.png"); addSpaceShip("Pictures/PizzaSpeedShip.png"); addTimeSlider(); schedule( schedule_selector( PizzaSpeedLevel::update) ); schedule( schedule_selector(PizzaSpeedLevel::updateRemainingTime)); return true; }
// on "init" you need to initialize your instance bool Mainpage::init() { ////////////////////////////// // 1. super init first if (!Layer::init()) { return false; } //visibleSize = Director::getInstance()->getVisibleSize(); visibleSize = Global::getVisibleSize(); origin = Director::getInstance()->getVisibleOrigin(); preloadBGM(); // 预载入BGM addBackground(); // 添加背景 addMenu(); // 添加菜单 addUI(); // 添加UI // 播放bgm playBGM(); // 每分钟更新一次时间 this->schedule(schedule_selector(Mainpage::updateTime), 60.0f, kRepeatForever, 0); return true; }
MainMenu::MainMenu(Module &module, ::Engines::Console *console) : ::Engines::KotOR::GUI(console), _module(&module), _background(0) { load("maingame"); /* * The list box is initially empty, so we need to create the buttons * for the main menu */ getListBox("ListBoxButtons")->setFill(""); addWidget(getListBox("ListBoxButtons")->createItem("NEW_GAME"), true); addWidget(getListBox("ListBoxButtons")->createItem("LOAD_GAME"), true); addWidget(getListBox("ListBoxButtons")->createItem("MINIGAMES"), true); addWidget(getListBox("ListBoxButtons")->createItem("OPTIONS"), true); addWidget(getListBox("ListBoxButtons")->createItem("CREDITS"), true); addWidget(getListBox("ListBoxButtons")->createItem("EXIT"), true); getButton("NEW_GAME")->setText(TalkMan.getString(111)); getButton("LOAD_GAME")->setText(TalkMan.getString(112)); getButton("MINIGAMES")->setText(TalkMan.getString(114)); getButton("OPTIONS")->setText(TalkMan.getString(116)); getButton("CREDITS")->setText(TalkMan.getString(15709)); getButton("EXIT")->setText(TalkMan.getString(112745)); /* * The Jade Empire Logo is placed in the middle of the screen * and needs to be moved above the menu buttons */ getLabel("TitleLabel")->setWidth(256); getLabel("TitleLabel")->setHeight(65); float tX, tY, tZ; getLabel("TitleLabel")->getPosition(tX, tY, tZ); getLabel("TitleLabel")->setPosition(tX-80, tY+52, tZ); addBackground(); }
OptionsGraphicsAdvancedMenu::OptionsGraphicsAdvancedMenu(::Engines::Console *console) : GUI(console) { load("optgraphicsadv"); addBackground(kBackgroundTypeMenu); //Hardcoded, the gui file returns incorrect values getButton("BTN_TEXQUALLEFT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_TEXQUALLEFT", true)->setStaticHighlight(); getButton("BTN_TEXQUALRIGHT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_TEXQUALRIGHT", true)->setStaticHighlight(); getButton("BTN_ANTIALIASLEFT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_ANTIALIASLEFT", true)->setStaticHighlight(); getButton("BTN_ANTIALIASRIGHT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_ANTIALIASRIGHT", true)->setStaticHighlight(); getButton("BTN_ANISOTROPYLEFT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_ANISOTROPYLEFT", true)->setStaticHighlight(); getButton("BTN_ANISOTROPYRIGHT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getButton("BTN_ANISOTROPYRIGHT", true)->setStaticHighlight(); getCheckBox("CB_FRAMEBUFF", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_VSYNC", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); getCheckBox("CB_SOFTSHADOWS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f); }
void Scene::setBackground(uint32 fileHash) { _background = addBackground(new Background(_vm, fileHash, 0, 0)); _backgroundFileHash = fileHash; }
bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { char musicName[13]; char bgNames[8][13]; // First check the temporary Operation Stealth savegame format header. ChunkHeader hdr; loadChunkHeader(in, hdr); if (hdr.id != TEMP_OS_FORMAT_ID) { warning("loadTempSaveOS: File has incorrect identifier. Not loading savegame"); return false; } else if (hdr.version > CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected newer format version. Not loading savegame"); return false; } else if ((int)hdr.version < (int)CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected older format version. Trying to load nonetheless. Things may break"); } else { // hdr.id == TEMP_OS_FORMAT_ID && hdr.version == CURRENT_OS_SAVE_VER debug(3, "loadTempSaveOS: Found correct header (Both the identifier and version number match)."); } // There shouldn't be any data in the header's chunk currently so it's an error if there is. if (hdr.size > 0) { warning("loadTempSaveOS: Format header's chunk seems to contain data so format is incorrect. Not loading savegame"); return false; } // Ok, so we've got a correct header for a temporary Operation Stealth savegame. // Let's start loading the plain savegame data then. currentDisk = in.readUint16BE(); in.read(currentPartName, 13); in.read(currentPrcName, 13); in.read(currentRelName, 13); in.read(currentMsgName, 13); // Load the 8 background names. for (uint i = 0; i < 8; i++) { in.read(bgNames[i], 13); } in.read(currentCtName, 13); // Moved the loading of current procedure, relation, // backgrounds and Ct here because if they were at the // end of this function then the global scripts loading // made an array out of bounds access. In the original // game's disassembly these aren't here but at the end. // The difference is probably in how we handle loading // the global scripts and some other things (i.e. the // loading routines aren't exactly the same and subtle // semantic differences result in having to do things // in a different order). { // Not sure if this is needed with Operation Stealth... checkDataDisk(currentDisk); if (strlen(currentPrcName)) { loadPrc(currentPrcName); } if (strlen(currentRelName)) { loadRel(currentRelName); } // Load first background (Uses loadBg) if (strlen(bgNames[0])) { loadBg(bgNames[0]); } // Add backgrounds 1-7 (Uses addBackground) for (int i = 1; i < 8; i++) { if (strlen(bgNames[i])) { addBackground(bgNames[i], i); } } if (strlen(currentCtName)) { loadCtOS(currentCtName); } } loadObjectTable(in); renderer->restorePalette(in, hdr.version); g_cine->_globalVars.load(in, NUM_MAX_VAR); loadZoneData(in); loadCommandVariables(in); char tempCommandBuffer[kMaxCommandBufferSize]; in.read(tempCommandBuffer, kMaxCommandBufferSize); g_cine->_commandBuffer = tempCommandBuffer; renderer->setCommand(g_cine->_commandBuffer); loadZoneQuery(in); // TODO: Use the loaded string (Current music name (String, 13 bytes)). in.read(musicName, 13); // TODO: Use the loaded value (Is music loaded? (Uint16BE, Boolean)). in.readUint16BE(); // TODO: Use the loaded value (Is music playing? (Uint16BE, Boolean)). in.readUint16BE(); renderer->_cmdY = in.readUint16BE(); in.readUint16BE(); // Some unknown variable that seems to always be zero allowPlayerInput = in.readUint16BE(); playerCommand = in.readUint16BE(); commandVar1 = in.readUint16BE(); isDrawCommandEnabled = in.readUint16BE(); var5 = in.readUint16BE(); var4 = in.readUint16BE(); var3 = in.readUint16BE(); var2 = in.readUint16BE(); commandVar2 = in.readUint16BE(); renderer->_messageBg = in.readUint16BE(); // TODO: Use the loaded value (adBgVar1 (Uint16BE)). in.readUint16BE(); currentAdditionalBgIdx = in.readSint16BE(); currentAdditionalBgIdx2 = in.readSint16BE(); // TODO: Check whether the scroll value really gets used correctly after this. // Note that the backgrounds are loaded only later than this value is set. renderer->setScroll(in.readUint16BE()); // TODO: Use the loaded value (adBgVar0 (Uint16BE). Maybe this means bgVar0?). in.readUint16BE(); disableSystemMenu = in.readUint16BE(); // TODO: adBgVar1 = 1 here // Load the animDataTable entries in.readUint16BE(); // Entry count (255 in the PC version of Operation Stealth). in.readUint16BE(); // Entry size (36 in the PC version of Operation Stealth). loadResourcesFromSave(in, ANIMSIZE_30_PTRS_INTACT); loadScreenParams(in); loadGlobalScripts(in); loadObjectScripts(in); loadSeqList(in); loadOverlayList(in); loadBgIncrustFromSave(in); // Left this here instead of moving it earlier in this function with // the other current value loadings (e.g. loading of current procedure, // current backgrounds etc). Mostly emulating the way we've handled // Future Wars savegames and hoping that things work out. if (strlen(currentMsgName)) { loadMsg(currentMsgName); } // TODO: Add current music loading and playing here // TODO: Palette handling? if (in.pos() == in.size()) { debug(3, "loadTempSaveOS: Loaded the whole savefile."); } else { warning("loadTempSaveOS: Loaded the savefile but didn't exhaust it completely. Something was left over"); } return !(in.eos() || in.err()); }