void Scene50::process(Event &event) { SceneExt::process(event); Common::Point pt(event.mousePos.x + _sceneBounds.left, event.mousePos.y + _sceneBounds.top); bool mouseDown = false; _field382 = 0; if ((event.mousePos.x > 270 && (_sceneBounds.right < (SCREEN_WIDTH * 2)))) loadBackground(4, 0); else if ((event.mousePos.x < 50) && (_sceneBounds.left > 0)) loadBackground(-4, 0); else mouseDown = event.eventType == EVENT_BUTTON_DOWN; if (BF_GLOBALS._player._uiEnabled) { Tooltip *tooltipList[9] = { &_location1, &_location2, &_location3, &_location4, &_location5, &_location6, &_location7, &_location8, &_location9 }; for (int idx = 0; idx < 9; ++idx) { if (tooltipList[idx]->_bounds.contains(pt)) { // Found a tooltip to highlight tooltipList[idx]->highlight(mouseDown); return; } } // No hotspot selected, so remove any current tooltip display _text.remove(); } }
void loadGame(SDL_Renderer *renderer, Gamestate* game) { SDL_Surface* surface = NULL; // set game values game->GRAVITY = 0.3f; game->FRICTION = 0.3f; game->PLAYER_MAX_SPEED = 5; game->NUM_BOMBS = 50; game->NUM_LEDGES = 50; game->frame = 0; game->status = 0; // WELCOME_SCREEN game->scrollX = 0; game->victory = false; // load elements of the game loadFont(renderer, game); loadBackground(renderer, game, surface); loadLedges(renderer, game, surface); loadBombs(renderer, game, surface); loadPlayer(renderer, game, surface); loadBalloon(renderer, game, surface); } // void initGamestate()
void Scene::loadSceneData(int sceneNum) { _activeScreenNumber = sceneNum; // Get the basic scene size byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999); _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2)); _globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds); DEALLOCATE(data); // Set up a surface for storing the scene background SceneManager::setBackSurface(); // Load the data lists for the scene _globals->_walkRegions.load(sceneNum); // Load the item regions of the scene _globals->_sceneRegions.load(sceneNum); // Load the priority regions _priorities.load(sceneNum); // Initialize the section enabled list Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff); _globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160; _globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100; _globals->_paneRefreshFlag[0] = 1; _globals->_paneRefreshFlag[1] = 1; _globals->_sceneManager._loadMode = 1; _globals->_sceneManager._sceneLoadCount = 0; _globals->_sceneManager._sceneBgOffset = Common::Point(0, 0); // Load the background for the scene loadBackground(0, 0); }
int16 Op_LoadBackground() { int result = 0; char bgName[36] = ""; char *ptr; int bgIdx; ptr = (char *) popPtr(); Common::strlcpy(bgName, ptr, sizeof(bgName)); bgIdx = popVar(); if (bgIdx >= 0 || bgIdx < NBSCREENS) { strToUpper(bgName); gfxModuleData_gfxWaitVSync(); gfxModuleData_gfxWaitVSync(); result = loadBackground(bgName, bgIdx); gfxModuleData_addDirtyRect(Common::Rect(0, 0, 320, 200)); } changeCursor(CURSOR_NORMAL); return result; }
void DosDisk_ns::loadScenery(BackgroundInfo& info, const char *name, const char *mask, const char* path) { char filename[PATH_LEN]; sprintf(filename, "%s.dyn", name); // load bitmap loadBackground(info, filename); if (mask == 0) { return; } // load external mask and path if present (overwriting the ones loaded by loadBackground) char maskPath[PATH_LEN]; sprintf(maskPath, "%s.msk", mask); Common::SeekableReadStream *stream = openFile(maskPath); assert(stream); parseDepths(info, *stream); createMaskAndPathBuffers(info); stream->read(info._path->data, info._path->size); stream->read(info._mask->data, info._mask->size); delete stream; }
/***** init a new flap *****/ void initFlap(Main *main, Wind *wind, Extf *extf, int *flap, int *max) { *max += 1; *flap = *max - 1; extf->newFlap = 0; loadBackground(&main[*max - 1], &*wind, &*flap); initVariables(&main[*max - 1]); loadTimeText(&main[*max - 1], &*wind); loadSounds(&main[*max - 1], &*flap); initTextString(&main[*max - 1]); initBoxes(&main[*max - 1]); initMiniTimer(&main[*max - 1], &*wind, &*flap); loadShade(&main[*max - 1], &*wind, &*flap); loadChooseSound(&main[*max - 1], &*wind, &*flap); loadBoxPics(&main[*max - 1], &*wind, &*flap); loadShadePics(&main[*max - 1], &*wind, &*flap); initMiniTimerS(&main[*max - 1], &*wind, &*flap); }
/*------------------------------------------------------------------------------------------------------------------ -- FUNCTION: POptMenu (Constructor) -- -- DATE: April 15th, 2009 -- -- REVISIONS: None yet -- -- DESIGNER: Alin Albu -- -- PROGRAMMER: Alin Albu -- -- INTERFACE: POptMenu::POptMenu(std::string modelNames[], std::string fileNames[], std::string mfilename, std::string smfilename, SDL_Surface* screen) -- -- RETURNS: POptMenu -- -- NOTES: -- Intializes the player options menu. ----------------------------------------------------------------------------------------------------------------------*/ POptMenu::POptMenu(std::string modelNames[], std::string fileNames[], std::string mfilename, std::string smfilename, SDL_Surface* screen) { printf("Creating Option Menu!\n"); int i; loaded_ = 0; modelLoaded_ = 0; pNameColourRed_ = 0; pNameColourGreen_ = 0; pNameColourBlue_ = 0; this->screen_ = screen; for (i = 0; i < num_options_; i++) { this->fileNames_[i] = fileNames[i]; if (!loadBackground(fileNames_[i], i)) { printf("File %s did not load.\n", fileNames_[i].c_str()); exit(1); } } for (i = 0; i < num_models_; i++) { this->modelNames_[i] = modelNames[i]; if (!loadModel(modelNames_[i], i)) { printf("File %s did not load.\n", modelNames_[i].c_str()); exit(1); } } this->setMusic(Mix_LoadMUS(mfilename.c_str())); this->setNexMusic(Mix_LoadWAV(smfilename.c_str())); this->name_exists = false; printf("Option Menu Created!\n"); }
void MainWindow::load() { // Prompt a video to load QString folder = QFileDialog::getExistingDirectory(this, "Load Video",QString()); if(!folder.isNull()) { _sound = new QSound(folder+"\\Sound.wav"); loadBackground((folder+"\\background.png").toStdString()); loadBackgroundF((folder+"\\backgroundF.png").toStdString()); //loadIntervals(folder.toStdString()); loadBoards((folder+"\\_LocalBoards.txt").toStdString()); //loadPBBox((folder+"\\_BBox.txt").toStdString()); loadHomographies((folder+"\\_LocalHoms.txt").toStdString()); _decoder.load(folder.toStdString(), _numFrames); ui->widget->setFrame(&_frame); ui->widget->setBackground(&_background, &_backgroundF); ui->widget->setCurrentFrame(&_currentFrame); ui->widget->setBoards(&_boards); ui->widget->setIntervals(&_intervals); ui->widget->setPBBox(&_pbbox); ui->widget->setHomographies(&_homographies); ui->widget->setImages(); _currentFrame = -1; next(); } }
MissionMenu::MissionMenu(sf::RenderWindow & win): Menu(win), game(0), missions() { missions.load(); offset = option.size(); makeMenu(); loadBackground(); }
//初始化各项数据 void Over::initData() { //加载背景 loadBackground(); //显示得分 showScore(); //加载菜单 loadMenu(); }
Button::Button( const char* bgTexPath, const char* imgPath /*= NULL*/, int tag /*= 0*/ ) :Sprite() { m_onClick = NULL; m_btnImg = NULL; m_bDown = false; m_bSelect = false; m_bShow = true; m_tag = tag; loadBackground(bgTexPath); if (imgPath){ loadImage(imgPath); } }
// run the game void MissionMenu::startMission() { if(optionClicked == -1) return; game = new Game(window); if(!game) return; int idMission = optionClicked-offset; // attend to create the mission if its unlocked Mission* m = 0; m = missions.createMission(idMission,game); // if no mission => cancel everything if(m==0){ std::cout<<"Mission"<<(idMission+1)<<std::endl; std::cout<<" non accessible"<<std::endl; delete game; game = 0; end = false; return; } // else => the mission starts //end = true; // uncomment if, after a game, we return to the main menu bg.clear(); if(game->run()){ if(idMission < MissionManager::NB_MISSION){ if(missions.getMissionState(idMission+1) == false){ missions.unlock(idMission+1); missions.save(); } }else{ // endscreen std::cout<<"Congratulations !"<<std::endl; } } loadBackground(); // after the end of the mission => we clean the memory delete game; game = 0; optionClicked = -1; }
//初始化操作 bool MyPlayLayer::init() { scheduleUpdate(); this->setTouchEnabled(true); sprite=Mysprite::create(); CCMoveTo* move=CCMoveTo::create(1.2f,ccp(winsize.width*0.20,winsize.height/6)); CCEaseBounceOut* out=CCEaseBounceOut::create(move); sprite->runAction(out); this->addChild(sprite,2); loadBackground(); label = CCLabelBMFont::create("Score:0","fonts/futura-48.fnt"); label->setScale(.7f); label->setOpacity(150); addChild(label,1); label->setColor(ccc3(255,230,0)); label->setPosition(ccp(winsize.width/2,winsize.height*0.85f)); return true; }
/* Displays the opengl scene */ void display(void) { if (save) { saveFile(); save = false; } if (fileOpen) { loadFile(); fileOpen = false; } if (saveXML) { Model::getInstance()->saveXML(fName); saveXML = false; } if (setBackground) { loadBackground(); setBackground = false; } if (setStereoBackground) { printf("Trying to load stereo"); loadStereoBackground(); setStereoBackground = false; } if(Settings::stereoMode==STEREOMODE) { displayStereo(); } else if (Settings::stereoMode==MONOMODE) { displayNonStereo(); View::getInstance()->drawScene(Model::getInstance()->getData()); drawMouse(Controller::xMouse, Controller::yMouse, Controller::z); if (background) { drawBackground(); } } else if (Settings::stereoMode==ANAGLYPHMODE) { displayAnaglyph(); } glutSwapBuffers(); }
void init(int argc, char *argv[]) { OSG::osgInit(argc, argv); g = new GlobalVars; int glutWinId = setupGLUT(&argc, argv); g->win = OSG::GLUTWindow::create(); g->win->setGlutId(glutWinId); g->win->init(); g->mgr = OSG::SimpleSceneManager::create(); g->mgr->setWindow(g->win); g->rootN = OSG::makeCoredNode<OSG::Group>(); g->mgr->setRoot(g->rootN); g->mgr->getHeadlight()->setDiffuse (0.7f, 0.7f, 0.5f, 1.f); g->mgr->getHeadlight()->setAmbient (0.3f, 0.3f, 0.3f, 1.f); g->mgr->getHeadlight()->setSpecular(0.3f, 0.3f, 0.3f, 1.f); g->charState = CharIdle; g->prevCharState = CharIdle; g->angle = 0.f; g->angleVel = idleAngleVel; g->renderMode = OSG::SkinnedGeometry::RMSkinnedCPU; loadCharacter (); loadTextures (); initAnimations(); loadBackground(); initFloor (); initShader (); g->mgr->showAll(); }
int main(int argc, char* argv[]) { bgPoint* backgroundData; long numberOfWindows; long maxRadius; bgPoint* background; FILE* windowsFile; char chrom[16]; long chromStart; long chromEnd; double percentId; long number; double backgroundPercentId; long backgroundNumber; double score; long AA; long AC; long AG; long AT; long CA; long CC; long CG; long CT; long GA; long GC; long GG; long GT; long TA; long TC; long TG; long TT; long globalNumber; double globalPercentId; long numWindowsScored = 0; long numWindowsDefaulted = 0; /* make sure that there are the correct number of arguments */ if(argc < 5 || argc > 6) { usage(argv[0]); exit(10); } /* load the data and get the number of windows */ backgroundData = loadBackground(argv[1], &numberOfWindows); maxRadius = 200 * getMaxRadius(backgroundData, numberOfWindows); qsort(backgroundData, numberOfWindows, sizeof(bgPoint), bgPointCompar); globalNumber = atol(argv[3]); // 100516125; globalPercentId = atof(argv[4]); // 0.668947295769709; /*fprintf(stderr, "maxRadius: %ld\n", maxRadius);*/ fprintf(stderr, "loaded %ld background window\n", numberOfWindows - 2); windowsFile = mustOpen(argv[2], "r"); /* see if the first character is a # */ *chrom = fgetc(windowsFile); if(*chrom == '#') { /* read the rest of the line */ while(fgetc(windowsFile) != '\n') ; } else ungetc(*chrom, windowsFile); while(!feof(windowsFile)) { if(fscanf(windowsFile, "%15s\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t" "%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld", chrom, &chromStart, &chromEnd, &number, &AA, &AC, &AG, &AT, &CA, &CC, &CG, &CT, &GA, &GC, &GG, >, &TA, &TC, &TG, &TT) != 20) continue; percentId = (((double)AA) + CC + GG +TT) / (((double)AA) + AC + AG + AT + CA + CC + CG + CT + GA + GC + GG + GT + TA + TC + TG + TT); background = getNearestEnclosing( (chromStart + chromEnd) / 2, backgroundData, numberOfWindows, maxRadius); /* if we didn't find an enclosing window */ if(background == 0 || background->number == -1) { /* used the genome-wide background numbers */ backgroundPercentId = globalPercentId; backgroundNumber = globalNumber; numWindowsDefaulted++; } else { backgroundPercentId = background->score; backgroundNumber = background->number; } /* adjust for the percent identity for the current window */ backgroundPercentId = (backgroundPercentId * backgroundNumber - number * percentId) / (backgroundNumber - number); if(argc == 5) score = number * (percentId - backgroundPercentId) / sqrt(number * backgroundPercentId * (1.0 - backgroundPercentId)); else score = number * (percentId - backgroundPercentId) / sqrt(number); printf("%s\t%ld\t%ld\t%lf\t%ld\n", chrom, chromStart, chromEnd, score, number); numWindowsScored++; } fprintf(stderr, "%ld windows of the %ld total windows scored used the default background\n", numWindowsDefaulted, numWindowsScored); return 0; }
void DosDisk_ns::loadSlide(BackgroundInfo& info, const char *filename) { char path[PATH_LEN]; sprintf(path, "%s.slide", filename); loadBackground(info, path); }
// Game entry int main(int argc, char* argv[]){ // Init the Engine //Engine* myEngine = new Engine(); Engine::InitSDL(); loadBackground(); setUpPlayer(); // Loop while running while(gameRunning) { while( (SDL_PollEvent( &event )) ){ switch( event.type ){ case SDL_QUIT: gameRunning = 0; printf("Quiting.../n"); break; // /* Look for a keypress */ case SDL_KEYDOWN: /* Check the SDLKey values and move change the coords */ switch( event.key.keysym.sym ){ case SDLK_LEFT: velocX = -1; break; case SDLK_RIGHT: velocX = 1; break; case SDLK_UP: velocY = -1; break; case SDLK_DOWN: velocY = 1; break; default: break; } break; /* We must also use the SDL_KEYUP events to zero the x */ /* and y velocity variables. But we must also be */ /* careful not to zero the velocities when we shouldn't*/ case SDL_KEYUP: switch( event.key.keysym.sym ){ case SDLK_LEFT: /* We check to make sure the alien is moving */ /* to the left. If it is then we zero the */ /* velocity. If the alien is moving to the */ /* right then the right key is still press */ /* so we don't tocuh the velocity */ if( velocX < 0 ) velocX = 0; break; case SDLK_RIGHT: if( velocX > 0 ) velocX = 0; break; case SDLK_UP: if( velocY < 0 ) velocY = 0; break; case SDLK_DOWN: if( velocY > 0 ) velocY = 0; break; default: break; } // } } Engine::player.moveObject(velocX, velocY); Engine::player.onUpdate(0.0f); // Needs to be delta - also needs to be an object that holds all entities that has update Engine::RenderScreen(); } return 0; }
void Animation::load(MSurface &backSurface, DepthSurface &depthSurface, const Common::String &resName, int flags, Common::Array<PaletteCycle> *palCycles, SceneInfo *sceneInfo) { Common::String resourceName = resName; if (!resourceName.contains(".")) resourceName += ".AA"; File f(resourceName); MadsPack madsPack(&f); Common::SeekableReadStream *stream = madsPack.getItemStream(0); _header.load(stream); delete stream; if (_header._bgType == ANIMBG_INTERFACE) flags |= PALFLAG_RESERVED; _flags = flags; if (flags & ANIMFLAG_LOAD_BACKGROUND) { loadBackground(backSurface, depthSurface, _header, flags, palCycles, sceneInfo); } if (flags & ANIMFLAG_LOAD_BACKGROUND_ONLY) { // No data _header._messagesCount = 0; _header._frameEntriesCount = 0; _header._miscEntriesCount = 0; } // Initialize the reference list _spriteListIndexes.clear(); for (int i = 0; i < _header._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); int streamIndex = 1; _messages.clear(); if (_header._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation Common::SeekableReadStream *msgStream = madsPack.getItemStream(streamIndex++); for (int i = 0; i < _header._messagesCount; ++i) { AnimMessage rec; rec.load(msgStream); _messages.push_back(rec); } delete msgStream; } _frameEntries.clear(); if (_header._frameEntriesCount > 0) { // Chunk 3: animation frame info Common::SeekableReadStream *frameStream = madsPack.getItemStream(streamIndex++); for (int i = 0; i < _header._frameEntriesCount; i++) { AnimFrameEntry rec; rec.load(frameStream, _header._bgType == ANIMBG_INTERFACE); _frameEntries.push_back(rec); } delete frameStream; } _miscEntries.clear(); _uiEntries.clear(); if (_header._miscEntriesCount > 0) { // Chunk 4: Misc Data Common::SeekableReadStream *miscStream = madsPack.getItemStream(streamIndex++); if (_header._bgType == ANIMBG_INTERFACE) { for (int i = 0; i < _header._miscEntriesCount; ++i) { AnimUIEntry rec; rec.load(miscStream); _uiEntries.push_back(rec); } } else { for (int i = 0; i < _header._miscEntriesCount; ++i) { AnimMiscEntry rec; rec.load(miscStream); _miscEntries.push_back(rec); } } delete miscStream; } // If the animation specifies a font, then load it for access delete _font; if (_header._loadFlags & ANIMFLAG_CUSTOM_FONT) { Common::String fontName = "*" + _header._fontResource; _font = _vm->_font->getFont(fontName.c_str()); } else { _font = nullptr; } // Load all the sprite sets for the animation for (uint i = 0; i < _spriteSets.size(); ++i) delete _spriteSets[i]; _spriteSets.clear(); _spriteSets.resize(_header._spriteSetsCount); for (int i = 0; i < _header._spriteSetsCount; ++i) { if (_header._manualFlag && (i == _header._spritesIndex)) { // Skip over field, since it's manually loaded _spriteSets[i] = nullptr; } else { _spriteSets[i] = new SpriteAsset(_vm, _header._spriteSetNames[i], flags); _spriteListIndexes[i] = _vm->_game->_scene._sprites.add(_spriteSets[i]); } } if (_header._manualFlag) { Common::String assetResName = "*" + _header._spriteSetNames[_header._spritesIndex]; SpriteAsset *sprites = new SpriteAsset(_vm, assetResName, flags); _spriteSets[_header._spritesIndex] = sprites; _spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites); } Common::Array<int> usageList; for (int idx = 0; idx < _header._spriteSetsCount; ++idx) usageList.push_back(_spriteSets[idx]->_usageIndex); if (usageList.size() > 0) { int spritesUsageIndex = _spriteSets[0]->_usageIndex; _vm->_palette->_paletteUsage.updateUsage(usageList, spritesUsageIndex); } // Remaps the sprite list indexes for frames to the loaded sprite list indexes for (uint i = 0; i < _frameEntries.size(); ++i) { int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; } f.close(); }
void initBackground(std::string backgroundFileName) { loadBackground(backgroundFileName,bPositions,bColors,bNormals,bTextures, backgroundSize,bTexFileNames,bTexFileSize); int bNumVertices = bPositions.size(), k=0; glm::vec4 bPositions1[bNumVertices]; glm::vec4 bColors1[bNumVertices]; glm::vec4 bNormals1[bNumVertices]; glm::vec2 bTextures1[bNumVertices]; for(int i=0;i<bNumVertices;i++) { bPositions1[k]=bPositions[i]; bColors1[k]=bColors[i]; std::cout<<bPositions1[i][0]<<std::endl; bNormals1[k]=bNormals[i]; bTextures1[k]=bTextures[i]; std::cout<<bTextures1[i][0]<<std::endl; k++; } int index=0; for(int i=0; i<backgroundSize.size();i++) { GLuint newTex=LoadTexture(bTexFileNames[i].c_str(),bTexFileSize[i][0],bTexFileSize[i][1]); backTex.push_back(newTex); GLuint vaoTemp,vboTemp; glGenVertexArrays (1, &vaoTemp); glBindVertexArray (vaoTemp); glGenBuffers (1, &vboTemp); glBindBuffer (GL_ARRAY_BUFFER, vboTemp); //Copy the points into the current buffer (16 multplied to give size in bytes for integers) glBufferData (GL_ARRAY_BUFFER,56*(backgroundSize[i]), NULL, GL_STATIC_DRAW); glBufferSubData( GL_ARRAY_BUFFER, 0, 16*(backgroundSize[i]), &bPositions1[index]); glBufferSubData( GL_ARRAY_BUFFER, 16*(backgroundSize[i]), 16*(backgroundSize[i]), &bColors1[index]); glBufferSubData( GL_ARRAY_BUFFER, 16*2*(backgroundSize[i]), 16*(backgroundSize[i]), &bNormals1[index]); glBufferSubData( GL_ARRAY_BUFFER, 16*3*(backgroundSize[i]), 8*(backgroundSize[i]), &bTextures1[index]); index=index+backgroundSize[i]; // set up vertex arrays // GLuint vPos = glGetAttribLocation( shaderProgram, "vPosition" ); glEnableVertexAttribArray( vPosition ); glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); // GLuint vCol = glGetAttribLocation( shaderProgram, "vColor" ); glEnableVertexAttribArray( vColor ); glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET((size_t)(16*backgroundSize[i]))); // GLuint vNor = glGetAttribLocation( shaderProgram, "vNormal" ); glEnableVertexAttribArray( vNormal ); glVertexAttribPointer( vNormal, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET((size_t)(32*backgroundSize[i]))); // GLuint vTex = glGetAttribLocation( shaderProgram, "vTexture" ); glEnableVertexAttribArray( vTexture ); glVertexAttribPointer( vTexture, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET((size_t)(48*backgroundSize[i]))); vao.push_back(vaoTemp); vbo.push_back(vboTemp); } }
D2Data::D2Data() : itemTypes(DictionaryMap::alNum) , baseItems(DictionaryMap::alNum) , images(DictionaryMap::pathName) , fonts(DictionaryMap::pathName) { WideString path = cfg.getwstr("d2path"); if (path.empty()) path = getAppPath(); int loaded = !!loader.loadArchive(WideString::buildFullName(path, L"resources.mpq")); loaded += !!loader.loadArchive(WideString::buildFullName(path, L"d2data.mpq")); loaded += !!loader.loadArchive(WideString::buildFullName(path, L"d2exp.mpq")); loaded += !!loader.loadArchive(WideString::buildFullName(path, L"patch_d2.mpq")); if (!loaded) { path = getAppPath(); loaded = !!loader.loadArchive(WideString::buildFullName(path, L"resources.mpq")); } if (!loaded) return; cfg.setwstr("d2path", path); for (int f = 0; f < 10; f++) for (int t = 0; t < 21; t++) for (int i = 0; i < 256; i++) tints[f][t][i] = i; TempFile(loader.load("data\\global\\items\\Palette\\grey.dat"))->read(tints[1], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\grey2.dat"))->read(tints[2], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\gold.dat"))->read(tints[3], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\brown.dat"))->read(tints[4], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\greybrown.dat"))->read(tints[5], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\invgrey.dat"))->read(tints[6], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\invgrey2.dat"))->read(tints[7], 256 * 21); TempFile(loader.load("data\\global\\items\\Palette\\invgreybrown.dat"))->read(tints[8], 256 * 21); LocalPtr<File> pal = loader.load("data\\global\\palette\\ACT1\\pal.dat"); for (int i = 0; i < 256; i++) { int b = pal->getc(), g = pal->getc(), r = pal->getc();//, a = pal->getc(); palette[i] = Image::clr(r, g, b); } memset(textColor, 0xFF, sizeof textColor); { LocalPtr<File> pl2 = loader.load("data\\global\\palette\\ACT1\\Pal.PL2"); pl2->seek(1024 + 49 * 256, SEEK_SET); pl2->read(blendTable, sizeof blendTable); pl2->seek(1024 + 1714 * 256, SEEK_SET); for (int i = 0; i < 13; i++) { int r = pl2->getc(), g = pl2->getc(), b = pl2->getc(); textColor[i] = Image::clr(r, g, b); } pl2->seek(256, SEEK_CUR); for (int i = 1; i < 13; i++) pl2->read(tints[9][i], 256); } strings.load(TempFile(loader.load("data\\local\\lng\\eng\\string.tbl")), 0); strings.load(TempFile(loader.load("data\\local\\lng\\eng\\expansionstring.tbl")), 20000); strings.load(TempFile(loader.load("data\\local\\lng\\eng\\patchstring.tbl")), 10000); rootType.name = "All Items"; loadTypes(TempFile(loader.load("data\\global\\excel\\ItemTypes.txt"))); loadBase(TempFile(loader.load("data\\global\\excel\\weapons.txt"))); loadBase(TempFile(loader.load("data\\global\\excel\\armor.txt"))); loadBase(TempFile(loader.load("data\\global\\excel\\misc.txt"))); baseMatch.build(); itemTypes.get("h2h2").bases = 0; itemTypes.get("mcha").name = strings.byIndex(20436); itemTypes.get("lcha").name = strings.byIndex(20437); itemTypes.get("ques").setType(D2Item::tMisc, 0, 0); itemTypes.get("key").setType(D2Item::tMisc, 0, 0); itemTypes.get("weap").setType(D2Item::tAuto, 0); itemTypes.get("armo").setType(D2Item::tAuto, 1); itemTypes.get("ring").setType(D2Item::tAuto, 2); itemTypes.get("amul").setType(D2Item::tAuto, 2); itemTypes.get("char").setType(D2Item::tCharm, 0); itemTypes.get("gem").setType(D2Item::tSocket, 0, 0); itemTypes.get("rune").setType(D2Item::tSocket, 1, 0); itemTypes.get("jewl").setType(D2Item::tSocket, 2); for (uint32 cur = baseItems.enumStart(); cur; cur = baseItems.enumNext(cur)) { D2BaseItem* base = &baseItems.enumGetValue(cur); while (base->type && base->type->bases == 0) base->type = base->type->parent; } mergeType(&rootType); { D2Excel table(TempFile(loader.load("data\\global\\excel\\PlayerClass.txt"))); int id = 0; for (int i = 0; i < table.rows(); i++) { if (!*table.value(i, 1)) continue; charClass.set(table.value(i, 1), id); classNames[id] = strings.byName(table.value(i, 0)); id++; } } statData = new D2StatData(this); loadUnique(); loadGems(); loadBackground(); LocalPtr<mpq::ListFile> list = loader.buildListFile(); list->sort(); for (uint32 cur = baseItems.enumStart(); cur; cur = baseItems.enumNext(cur)) unpack(&loader, list, baseItems.enumGetValue(cur).invfile); for (uint32 cur = itemTypes.enumStart(); cur; cur = itemTypes.enumNext(cur)) { D2ItemType& type = itemTypes.enumGetValue(cur); for (int i = 0; i < type.invgfx.length(); i++) unpack(&loader, list, type.invgfx[i]); } for (int i = 0; i < uniqueItems.length(); i++) unpack(&loader, list, uniqueItems[i]->invfile); }
int main(int argc, char* args[]) { srand(time(NULL)); PLAYER* player = createPlayer(); BACKGROUND* background = createBackground(); LTexture lt; BANANA* bananaArray[MAX_NUM_OF_BANANA]; BARRIER* barrierArray[MAX_NUM_OF_BARRIER]; int i; for(i = 0; i < MAX_NUM_OF_BANANA; i++) { bananaArray[i] = createBanana(); } for(i = 0; i < MAX_NUM_OF_BARRIER; i++) { barrierArray[i] = createBarrier(); } if( !init() ) { printf( "Failed to initialize!\n" ); } else { if( !loadBackground("./media/background.png", &background->background_tex, gRenderer) || !loadPlayer("./media/minion.png", &player->player_tex, gRenderer, gSpriteClips)) { printf( "Failed to load media!\n" ); } else { for(i = 0; i < MAX_NUM_OF_BANANA; i++) { loadBanana("./media/banana.png", &bananaArray[i]->banana_tex, gRenderer); setPosRectBanana(bananaArray[i]); } for(i = 0; i < MAX_NUM_OF_BARRIER; i++) { loadBarrier("./media/barrier.png", &barrierArray[i]->barrier_tex, gRenderer); setPosRectBarrier(barrierArray[i]); } bool quit = false; SDL_Event e; player->frame = 0; background->scrollingOffset = 0; while( !quit ) { while( SDL_PollEvent( &e ) != 0 ) { if( e.type == SDL_QUIT ) { quit = true; } if(e.key.type == SDL_KEYDOWN) { switch( e.key.keysym.sym ) { case SDLK_UP: if(canMoveUp(player)) { moveUp(player); } break; case SDLK_DOWN: if(canMoveDown(player)) { moveDown(player); } break; } } } --(background->scrollingOffset); if( background->scrollingOffset < -background->background_tex.mWidth ) { background->scrollingOffset = 0; } SDL_Rect* currentClip; SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF ); SDL_RenderClear( gRenderer ); renderBackground(background, background->scrollingOffset, gRenderer); currentClip = &gSpriteClips[ player->frame / 16 ]; renderPlayer(player, currentClip, gRenderer); setPosRectPlayer(player); for (i = 0; i < MAX_NUM_OF_BANANA; i++) { if( checkCollision(player->mPlayer, bananaArray[i]->mBanana, background->scrollingOffset)) { increaseTotalScore(); eraseBanana(bananaArray[i]); } renderBanana(bananaArray[i], background->scrollingOffset + bananaArray[i]->posX, gRenderer); } for (i = 0; i < MAX_NUM_OF_BARRIER; i++) { if( checkCollisionEnd(player->mPlayer, barrierArray[i]->mBarrier, background->scrollingOffset)) { closeWin(player, background, bananaArray, barrierArray); return 0; } renderBarrier(barrierArray[i], background->scrollingOffset + barrierArray[i]->posX, gRenderer); } ++player->frame; if( player->frame / 4 >= WALKING_ANIMATION_FRAMES ) { player->frame = 0; } SDL_RenderPresent(gRenderer); } closeWin(player, background, bananaArray, barrierArray); } } return 0; }
Common::Error loadSavegameData(int saveGameIdx) { int lowMemorySave; Common::String saveName; cellStruct *currentcellHead; Common::SaveFileManager *saveMan = g_system->getSavefileManager(); Common::InSaveFile *f = saveMan->openForLoading(_vm->getSavegameFile(saveGameIdx)); if (f == NULL) { printInfoBlackBox("Savegame not found..."); waitForPlayerInput(); return Common::kNoGameDataFoundError; } printInfoBlackBox("Loading in progress..."); initVars(); _vm->sound().stopMusic(); // Skip over the savegame header CruiseSavegameHeader header; readSavegameHeader(f, header); delete header.thumbnail; // Synchronise the remaining data of the savegame Common::Serializer s(f, NULL); DoSync(s); delete f; // Post processing for (int j = 0; j < 64; j++) preloadData[j].ptr = NULL; for (int j = 1; j < numOfLoadedOverlay; j++) { if (overlayTable[j].alreadyLoaded) { overlayTable[j].alreadyLoaded = 0; loadOverlay(overlayTable[j].overlayName); if (overlayTable[j].alreadyLoaded) { ovlDataStruct *ovlData = overlayTable[j].ovlData; // overlay BSS if (ovlRestoreData[j]._sBssSize) { if (ovlData->data4Ptr) { MemFree(ovlData->data4Ptr); } ovlData->data4Ptr = ovlRestoreData[j]._pBss; ovlData->sizeOfData4 = ovlRestoreData[j]._sBssSize; } // overlay object data if (ovlRestoreData[j]._sNumObj) { if (ovlData->arrayObjVar) { MemFree(ovlData->arrayObjVar); } ovlData->arrayObjVar = ovlRestoreData[j]._pObj; ovlData->size9 = ovlRestoreData[j]._sNumObj; } } } } updateAllScriptsImports(); lastAni[0] = 0; lowMemorySave = lowMemory; for (int i = 0; i < NUM_FILE_ENTRIES; i++) { if (filesDatabase[i].subData.ptr) { int j; int k; for (j = i + 1; j < NUM_FILE_ENTRIES && filesDatabase[j].subData.ptr && !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) && (filesDatabase[j].subData.index == (j - i)); j++) ; for (k = i; k < j; k++) { if (filesDatabase[k].subData.ptrMask) lowMemory = 0; filesDatabase[k].subData.ptr = NULL; filesDatabase[k].subData.ptrMask = NULL; } /*if (j < 2) { error("Unsupported mono file load"); //loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4); } else */ if (strlen(filesDatabase[i].subData.name) > 0) { loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i); } else { filesDatabase[i].subData.ptr = NULL; filesDatabase[i].subData.ptrMask = NULL; } i = j - 1; lowMemory = lowMemorySave; } } lastAni[0] = 0; currentcellHead = cellHead.next; while (currentcellHead) { if (currentcellHead->type == 5) { uint8 *ptr = mainProc14(currentcellHead->overlay, currentcellHead->idx); ASSERT(0); if (ptr) { ASSERT(0); //*(int16 *)(currentcellHead->datas+0x2E) = getSprite(ptr,*(int16 *)(currentcellHead->datas+0xE)); } else { ASSERT(0); //*(int16 *)(currentcellHead->datas+0x2E) = 0; } } currentcellHead = currentcellHead->next; } if (strlen(currentCtpName)) { loadCtFromSave = 1; initCt(currentCtpName); loadCtFromSave = 0; } //prepareFadeOut(); //gfxModuleData.gfxFunction8(); for (int j = 0; j < 8; j++) { if (strlen((char *)backgroundTable[j].name)) { loadBackground(backgroundTable[j].name, j); } } regenerateBackgroundIncrust(&backgroundIncrustHead); // to finish changeCursor(CURSOR_NORMAL); mainDraw(1); flipScreen(); return Common::kNoError; }
void Scene::loadSceneData(int sceneNum) { _activeScreenNumber = sceneNum; if (g_vm->getGameID() == GType_Ringworld2) { // Most scenes in Ringworld 2 don't have a scene size resource, but rather just have // a standard 320x200 size. Only read the scene size data for the specific few scenes switch (sceneNum) { case 700: case 1020: case 1100: case 1700: case 2600: case 2950: case 3100: case 3101: case 3275: case 3600: { // Get the basic scene size from the resource byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999); _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2)); DEALLOCATE(data); break; } default: // For all other scenes, use a standard screen size _backgroundBounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); break; } } else { // Get the basic scene size byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999); _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2)); DEALLOCATE(data); } g_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds); // Set up a surface for storing the scene background SceneManager::setBackSurface(); // Load the data lists for the scene g_globals->_walkRegions.load(sceneNum); // Load the item regions of the scene g_globals->_sceneRegions.load(sceneNum); // Load the priority regions _priorities.load(sceneNum); // Initialize the section enabled list Common::fill(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff); g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160; g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100; g_globals->_paneRefreshFlag[0] = 1; g_globals->_paneRefreshFlag[1] = 1; g_globals->_sceneManager._loadMode = 1; g_globals->_sceneManager._sceneLoadCount = 0; g_globals->_sceneManager._sceneBgOffset = Common::Point(0, 0); // Load the background for the scene loadBackground(0, 0); }
/* ------- begin ----------------------------- Escape ------------------- */ void Escape(Atom *atom) { /* Calculates radiative rates using the escape probability approximation Notes: Escape is inserted in an atom loop. Whatever takes place here should be at atom-only level. Why? Because different atoms can have different starting solutions. Calling Opacity directly is probably overkill, as it does its own loops, and works per wavelength, not per atom. The line opacity has to be per transition, and thus averaged in wavelength. For bound-bound the procedure is the following: 1. Loop over wavelength to calculate opacity at all wavelengths. Keep an array for each transition, accumulate there the opacity * wla for each transition. (this opacity is depth-dependent as well) 2. Loop over transitions (and not wavelength!), calculate tau by integrating over depth for each transition 3. Once we have tau for each transition, add to the gamma of each transition (in the same loop) the nrb recipe. For bound-free the procedure is the following: 1. Calculate intensity only for the relevant wavelenths. 2. Using intensity, calculate proper radiative rates and add them to rate matrix. Notes for continuum: * To see how rates are added, look at fillgamma.addtoRates or fillgamma.addtoGamma * For a simplified version of how to calculate intensity and update rates, look at formal.c:233 (the angle-independent case). They could be calculated by a single call of Formal, but there is too much rubbish in the main routine, and it could call opacity and readbackground more than once -- duplicating many tasks. */ const char routineName[] = "Escape"; register int n, k, kr, i, ij, ji, nspect; int la, j, nt, mu, nact; double **opa, *chi, *I, *S, *Psi, *Jdag, *J, tau, wlambda, hc_4PI, twohc, twohnu3_c2, wmu, wlamu, Ieff; bool_t initialize, to_obs; ActiveSet *as; AtomicLine *line; AtomicContinuum *continuum; /* --- Some useful constants -- -------------- */ hc_4PI = HPLANCK * CLIGHT / (4.0 * PI); twohc = 2.0*HPLANCK*CLIGHT / CUBE(NM_TO_M); opa = matrix_double(atom->Nline, atmos.Nspace); Jdag = (double *) malloc(atmos.Nspace * sizeof(double)); Psi = (double *) malloc(atmos.Nspace * sizeof(double)); chi = (double *) malloc(atmos.Nspace * sizeof(double)); I = (double *) malloc(atmos.Nspace * sizeof(double)); S = (double *) malloc(atmos.Nspace * sizeof(double)); nact = atom->activeindex; /* Calculate opacities */ for (nspect = 0; nspect < spectrum.Nspect; nspect++) { as = spectrum.as + nspect; alloc_as(nspect, FALSE); nt = nspect % input.Nthreads; /* Get line and background opacity */ Opacity(nspect, 0, to_obs=TRUE, initialize=TRUE); if (input.backgr_in_mem) { loadBackground(nspect, 0, to_obs=TRUE); } else { readBackground(nspect, 0, to_obs=TRUE); } /* --- For bound-bound: store opacity in array, per transition -- */ for (kr = 0; kr < atom->Nline; kr++) { line = atom->line + kr; la = nspect - line->Nblue; if (la == 0) wlambda = getwlambda_line(line, la); if ((la >= 0) && (la < line->Nlambda)) { /* increment opacities with each wavelength, multiplying by the integration weights */ for (k = 0 ; k < atmos.Nspace; k++) opa[kr][k] += (as->chi[k] + as->chi_c[k]) * (wlambda * line->wphi[k] / hc_4PI); } } /* --- For bound-free: calculate intensity and update rates ----- */ for (n = 0; n < as->Nactiveatomrt[nact]; n++) { if (as->art[nact][n].type == ATOMIC_CONTINUUM) { continuum = as->art[nact][n].ptype.continuum; la = nspect - continuum->Nblue; i = continuum->i; j = continuum->j; ij = i*atom->Nlevel + j; ji = j*atom->Nlevel + i; twohnu3_c2 = twohc / CUBE(spectrum.lambda[nspect]); /* Use old J and zero new array */ if (input.limit_memory) { J = (double *) malloc(atmos.Nspace *sizeof(double)); //readJlambda_single(nspect, Jdag); } else { J = spectrum.J[nspect]; for (k = 0; k < atmos.Nspace; k++) Jdag[k] = J[k]; } for (k = 0; k < atmos.Nspace; k++) J[k] = 0.0; for (mu = 0; mu < atmos.Nrays; mu++) { wmu = 0.5 * geometry.wmu[mu]; for (k = 0; k < atmos.Nspace; k++) { chi[k] = as->chi[k] + as->chi_c[k]; S[k] = (as->eta[k] + as->eta_c[k] + as->sca_c[k]*Jdag[k]) / chi[k]; } /* Get intensity */ Piecewise_1D(nspect, mu, to_obs=TRUE, chi, S, I, Psi); /* Update rates */ for (k = 0; k < atmos.Nspace; k++) { Ieff = I[k] - Psi[k] * atom->rhth[nt].eta[k]; wlamu = atom->rhth[nt].Vij[n][k] * atom->rhth[nt].wla[n][k] * wmu; atom->Gamma[ji][k] += Ieff * wlamu; atom->Gamma[ij][k] += (twohnu3_c2 + Ieff) * atom->rhth[nt].gij[n][k] * wlamu; /* Accumulate mean intensity */ J[k] += wmu * I[k]; } } if (input.limit_memory) free(J); } } free_as(nspect, FALSE); } /* Bound-bound: calculate optical depth and add approximation to rates */ for (kr = 0; kr < atom->Nline; kr++) { line = atom->line + kr; i = line->i; j = line->j; ij = i*atom->Nlevel + j; tau = 0.0; for (k = 0; k < atmos.Nspace ; k++) { if (k > 0) { tau += 0.5*(opa[kr][k-1] + opa[kr][k]) * (geometry.height[k-1] - geometry.height[k]); } /* add escape probability approximation to the rates matrix */ atom->Gamma[ij][k] += line->Aji * Pesc(tau); } } freeMatrix((void **) opa); free(Jdag); free(chi); free(Psi); free(I); free(S); }
void Logo::nextFrame() { Screen &screen = *_vm->_screen; if (_waitFrames) { uint32 currFrame = _frameCounter; if (currFrame - _waitStartFrame < _waitFrames) { return; } _waitStartFrame = 0; _waitFrames = 0; } if (_animateFrames) { uint32 currFrame = _frameCounter; if (currFrame > _animateStartFrame + _animateFrameDelay) { AnimationFrame animationFrame = _animateFrames[_animateFrame]; if (animationFrame.frame) { _objects[_animateObject]._frame = animationFrame.frame; _objects[_animateObject]._position = Common::Point(animationFrame.x, animationFrame.y); _animateStartFrame += _animateFrameDelay; _animateFrame++; } else { _animateObject = 0; _animateFrameDelay = 0; _animateFrames = NULL; _animateStartFrame = 0; _animateFrame = 0; } } if (_animateFrames) return; } switch (_counter++) { case 0: // Load the background and fade it in loadBackground(); fade(_palette1); break; case 1: // First half of square, circle, and triangle arranging themselves _objects[0].setVisage(16, 1); _objects[0]._frame = 1; _objects[0]._position = Common::Point(169, 107); _objects[0]._numFrames = 7; _objects[0].setAnimMode(true); break; case 2: // Keep waiting until first animation ends if (!_objects[0].isAnimEnded()) { --_counter; } else { // Start second half of the shapes animation _objects[0].setVisage(16, 2); _objects[0]._frame = 1; _objects[0]._numFrames = 11; _objects[0].setAnimMode(true); } break; case 3: // Keep waiting until second animation of shapes ordering themselves ends if (!_objects[0].isAnimEnded()) { --_counter; } else { // Fade out the background but keep the shapes visible fade(_palette2); screen._backBuffer1.clear(); } waitFrames(10); break; case 4: // Load the new palette byte palette[PALETTE_SIZE]; Common::copy(&_palette2[0], &_palette2[PALETTE_SIZE], &palette[0]); _lib.getPalette(palette, 12); screen.clear(); screen.setPalette(palette); // Morph into the EA logo _objects[0].setVisage(12, 1); _objects[0]._frame = 1; _objects[0]._numFrames = 7; _objects[0].setAnimMode(true); _objects[0]._position = Common::Point(170, 142); _objects[0].setDestination(Common::Point(158, 71)); break; case 5: // Wait until the logo has expanded upwards to form EA logo if (_objects[0].isMoving()) --_counter; break; case 6: fade(_palette3, 40); break; case 7: // Show the 'Electronic Arts' company name _objects[1].setVisage(14, 1); _objects[1]._frame = 1; _objects[1]._position = Common::Point(152, 98); waitFrames(120); break; case 8: // Start sequence of positioning and size hand cursor in an arc _objects[2].setVisage(18, 1); startAnimation(2, 5, &handFrames[0]); break; case 9: // Show a highlighting of the company name _objects[1].remove(); _objects[2].erase(); _objects[2].remove(); _objects[3].setVisage(19, 1); startAnimation(3, 8, &companyFrames[0]); break; case 10: waitFrames(180); break; case 11: _finished = true; break; default: break; } }
void Scene50::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); BF_GLOBALS._interfaceY = 200; BF_GLOBALS._player.postInit(); BF_GLOBALS._player.setVisage(830); BF_GLOBALS._player.setStrip(3); BF_GLOBALS._player.setPosition(Common::Point(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); BF_GLOBALS._player.hide(); BF_GLOBALS._player.enableControl(); BF_GLOBALS._player._uiEnabled = false; BF_GLOBALS._scrollFollower = NULL; _text._color1 = 19; _text._color2 = 9; _text._color3 = 9; _text._width = 75; _text._fontNumber = 4; _text._textMode = ALIGN_LEFT; _text.fixPriority(256); // Set all the hotspots _location3.set(Rect(10, 92, 24, 105), 180, GRANDMA_FRANNIE, 4); _location2.set(Rect(443, 149, 508, 178), 330, MARINA, 2); _location1.set(Rect(573, 103, 604, 130), 190, POLICE_DEPARTMENT, 1); _location4.set(Rect(313, 21, 325, 33), 114, TONYS_BAR, 8); _location8.set(Rect(69, 79, 82, 88), 580, CHILD_PROTECTIVE_SERVICES, 256); _location6.set(Rect(242, 131, 264, 144), 440, ALLEY_CAT, 64); _location5.set(Rect(383, 57, 402, 70), 380, CITY_HALL_JAIL, 32); _location7.set(Rect(128, 32, 143, 42), 800, JAMISON_RYAN, 128); _location9.set(Rect(349, 125, 359, 132), (BF_GLOBALS._bikiniHutState == 13) || (BF_GLOBALS._bikiniHutState == 14) ? 551 : 550, BIKINI_HUT, 16); _item.setBounds(Rect(0, 0, SCREEN_WIDTH * 2, SCREEN_HEIGHT)); BF_GLOBALS._sceneItems.push_back(&_item); // Find the location to start at int selectedTooltip = BF_GLOBALS._mapLocationId; Tooltip *tooltip = NULL; int xp = 0; switch (selectedTooltip) { case 1: tooltip = &_location1; xp = 588; break; case 2: tooltip = &_location2; xp = 475; break; case 4: tooltip = &_location3; xp = 17; break; case 8: tooltip = &_location4; xp = 319; break; case 32: tooltip = &_location5; xp = 392; break; case 64: tooltip = &_location6; xp = 253; break; case 128: tooltip = &_location7; xp = 135; break; case 16: tooltip = &_location9; xp = 354; break; case 256: tooltip = &_location8; xp = 75; break; } _timer.set(240, this); _sceneBounds.center(xp, SCREEN_HEIGHT / 2); loadScene(55); _sceneMode = 2; loadBackground(xp - 160, 0); tooltip->update(); }