void MysteryDungeonMaker::CreateDungeon() { ResetMap(); std::vector<Component> section_components; const size_t sectionRowNum = dungeonSize->DungeonRowNum(); const size_t sectionColumnNum = dungeonSize->DungeonColumnNum(); for (size_t i = 0; i < sectionRowNum; i++) { for (size_t j = 0; j < sectionColumnNum; j++) { section_components.push_back(Component(i, j)); this->sections[i][j].SetComponent(i, j); } } std::random_device rd; shuffle(section_components.begin(), section_components.end(), std::mt19937_64(rd())); for (int i = 0; i < roomNum; i++) { int i_section = section_components[i].i; int j_section = section_components[i].j; int width = GetRandInRange(minRoomWidth, sectionColumnNum - 4); int height = GetRandInRange(minRoomHeight, sectionRowNum - 4); MakeRoom(Component(i_section, j_section), width, height); } MakePath(); }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); Relocate(x, y, z); for(PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) { Player* pPlayer = *itr; ++itr; if(pPlayer->isDead() && !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) pPlayer->ResurrectPlayer(1.0f); pPlayer->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); } //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... //player far teleport would try to create same instance, but we need it NOW for transport... RemoveFromWorld(); ResetMap(); Map * newMap = sMapMgr->CreateMap(newMapid, this, 0); SetMap(newMap); ASSERT(GetMap()); AddToWorld(); if(oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } for(CreatureSet::iterator itr = m_NPCPassengerSet.begin(); itr != m_NPCPassengerSet.end(); ++itr) (*itr)->FarTeleportTo(newMap, x, y, z, (*itr)->GetOrientation()); }
Map::Map(Settings *settings, ALLEGRO_DISPLAY *display, ImageLoader *imageLoader) { imageLoader_ = imageLoader; settings_ = settings; display_ = display; font30_ = al_load_font("arial.ttf", 20, 0); ResetMap(); }
void MainMenu::KeyDown(unsigned char key) { switch(key) { case 'd': { test = true; //Going Horozontal if ( 0 < MenuStrip -> positionX < 866 ) { menuSpeed = -10; } //Menu Strip Speed. Player->setCurrentAnimation(3); Player->nextFrame(); //Option: calculated based on PositionX of Strip. option=int((MenuStrip -> positionX/200)*-1)+1; MenuStrip->setCurrentAnimation(option-1); break; } case 'a': { test = true; //Going Horozontal if ( 0 < MenuStrip -> positionX < 866 ) { menuSpeed = +10; } //Menu Strip Speed. Player->setCurrentAnimation(4); Player->nextFrame(); //Option: calculated based on PositionX of Strip. option=int((MenuStrip -> positionX/200)*-1)+1; MenuStrip->setCurrentAnimation(option-1); break; } case 'w':{ //since int will down to option; option=int((MenuStrip -> positionX/200)*-1)+1; MenuControl(option); break;} case 13: { //since int will down to option; option=int((MenuStrip -> positionX/200)*-1)+1; MenuControl(option); break;} case 8: { ResetMap(); break;} case 's':{ ResetMap(); break;} } }
void CreateGameScreen::Show() { GUIManager::Instance()->SetCurrentGUI("CreateGameScreen"); ResetMap(); _mapList->Show(); _mapPreview->Show(); RefPtr<Configuration> mainConfig = ConfigurationManager::Instance()->GetConfiguration("Main"); _mapList->ChangeCurrentDirectory(mainConfig->FindOptionValue("Maps", "Directories")); _playersSettings->Show(); }
BOOL PosterizeImage(LPIMAGE lpImage, LPPOSTERIZE_PARMS lpParms) /************************************************************************/ { LPMAPS lpMaps; RECT rUpdate; UPDATE_TYPE UpdateType; FRMDATATYPE type; ImgGetInfo(lpImage, NULL, NULL, NULL, &type); if (type == FDT_LINEART) return(FALSE); else if (type == FDT_PALETTECOLOR && ImgGetMask(lpImage)) return(FALSE); if (!(lpMaps = (LPMAPS)Alloc((long)sizeof(MAPS)))) { lpParms->Common.StatusCode = SC_MEMERROR; Message(IDS_EMEMALLOC); return(FALSE); } ProgressBegin(1, lpParms->Common.idDirty-IDS_UNDOFIRST+IDS_PROGFIRST); ResetMap( &lpMaps->MasterMap, MAXPOINTS, NO ); ResetMap( &lpMaps->RedMap, MAXPOINTS, NO ); ResetMap( &lpMaps->GreenMap, MAXPOINTS, NO ); ResetMap( &lpMaps->BlueMap, MAXPOINTS, NO ); ResetMap( &lpMaps->BlackMap, MAXPOINTS, NO ); ResetMap( &lpMaps->HueMap, MAXPOINTS, NO ); ResetMap( &lpMaps->SatMap, MAXPOINTS, NO ); lpMaps->MasterMap.Levels = lpParms->MasterInfo.Levels; lpMaps->MasterMap.Threshold = lpParms->MasterInfo.Threshold; lpMaps->RedMap.Levels = lpParms->RedInfo.Levels; lpMaps->RedMap.Threshold = lpParms->RedInfo.Threshold; lpMaps->GreenMap.Levels = lpParms->GreenInfo.Levels; lpMaps->GreenMap.Threshold = lpParms->GreenInfo.Threshold; lpMaps->BlueMap.Levels = lpParms->BlueInfo.Levels; lpMaps->BlueMap.Threshold = lpParms->BlueInfo.Threshold; lpMaps->BlackMap.Levels = lpParms->BlackInfo.Levels; lpMaps->BlackMap.Threshold = lpParms->BlackInfo.Threshold; MakeMap(&lpMaps->MasterMap); MakeMap(&lpMaps->RedMap); MakeMap(&lpMaps->GreenMap); MakeMap(&lpMaps->BlueMap); MakeMap(&lpMaps->BlackMap); lpParms->Common.StatusCode = ApplyMaps(lpImage, lpMaps, lpParms->Common.idDirty, &rUpdate, &UpdateType); if (UpdateType) { lpParms->Common.UpdateType = UpdateType; lpParms->Common.rUpdateArea = rUpdate; } FreeUp(lpMaps); ProgressEnd(); return(lpParms->Common.StatusCode == SC_SUCCESS); }
void EditorScreen::LoadMap() { HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (SUCCEEDED(hr)) { IFileOpenDialog *pFileOpen = NULL; HRESULT hr = CoCreateInstance(__uuidof(FileOpenDialog), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFileOpen)); if (SUCCEEDED(hr)) { hr = pFileOpen->SetDefaultExtension(L"xml"); hr = pFileOpen->SetFileTypes(ARRAYSIZE(c_rgSaveTypes), c_rgSaveTypes); hr = pFileOpen->Show(NULL); if (SUCCEEDED(hr)) { IShellItem *pItem; hr = pFileOpen->GetResult(&pItem); if (SUCCEEDED(hr)) { PWSTR pszFilePath; hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath); // Display the file name to the user. if (SUCCEEDED(hr)) { // Reset current Map information ResetMap(); std::string filePath = utf8_encode(pszFilePath); map->LoadMap(filePath); CoTaskMemFree(pszFilePath); } pItem->Release(); } } pFileOpen->Release(); } CoUninitialize(); } }
BOOL HueImage(LPIMAGE lpImage, LPHUE_PARMS lpParms) /************************************************************************/ { LPMAPS lpMaps; RECT rUpdate; UPDATE_TYPE UpdateType; FRMDATATYPE type; ImgGetInfo(lpImage, NULL, NULL, NULL, &type); if (type == FDT_LINEART || type == FDT_GRAYSCALE) return(FALSE); else if (type == FDT_PALETTECOLOR && ImgGetMask(lpImage)) return(FALSE); if (!(lpMaps = (LPMAPS)Alloc((long)sizeof(MAPS)))) { lpParms->Common.StatusCode = SC_MEMERROR; Message(IDS_EMEMALLOC); return(FALSE); } ProgressBegin(1, lpParms->Common.idDirty-IDS_UNDOFIRST+IDS_PROGFIRST); ResetMap( &lpMaps->MasterMap, MAXPOINTS, NO ); ResetMap( &lpMaps->RedMap, MAXPOINTS, NO ); ResetMap( &lpMaps->GreenMap, MAXPOINTS, NO ); ResetMap( &lpMaps->BlueMap, MAXPOINTS, NO ); ResetMap( &lpMaps->BlackMap, MAXPOINTS, NO ); ResetMap( &lpMaps->HueMap, MAXPOINTS, NO ); ResetMap( &lpMaps->SatMap, MAXPOINTS, NO ); lpMaps->HueMap.Points = lpParms->HueInfo.Points; copy((LPTR)&lpParms->HueInfo.Pnt, (LPTR)&lpMaps->HueMap.Pnt, sizeof(lpMaps->HueMap.Pnt)); lpMaps->SatMap.Brightness[0] = lpParms->Saturation; lpMaps->MasterMap.Brightness[0] = lpParms->Brightness; MakeMap(&lpMaps->HueMap); MakeMap(&lpMaps->SatMap); MakeMap(&lpMaps->MasterMap); lpParms->Common.StatusCode = ApplyMaps(lpImage, lpMaps, lpParms->Common.idDirty, &rUpdate, &UpdateType); if (UpdateType) { lpParms->Common.UpdateType = UpdateType; lpParms->Common.rUpdateArea = rUpdate; } FreeUp(lpMaps); ProgressEnd(); return(lpParms->Common.StatusCode == SC_SUCCESS); }
// Sets the given channel with the default vales. VOID CToneBalanceDlg::reset_channel(WORD wChannel) { LPMAP lpMap; // get the map & set its invert flags lpMap = tone_activate_channel(wChannel ); // setup the map ResetMap( lpMap, 3, NO ); lpMap->Pnt[0].x = 0; lpMap->Pnt[0].y = 0; lpMap->Pnt[1].x = 127; lpMap->Pnt[1].y = 127; lpMap->Pnt[2].x = 255; lpMap->Pnt[2].y = 255; }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); Relocate(x, y, z); for (PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) { PlayerSet::iterator it2 = itr; ++itr; Player *plr = *it2; if (!plr) { m_passengers.erase(it2); continue; } if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { plr->ResurrectPlayer(1.0); } plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); //WorldPacket data(SMSG_811, 4); //data << uint32(0); //plr->GetSession()->SendPacket(&data); } //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... //player far teleport would try to create same instance, but we need it NOW for transport... ResetMap(); Map * newMap = sMapMgr->CreateMap(newMapid, this, 0); SetMap(newMap); ASSERT(GetMap()); if (oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); Relocate(x, y, z); // we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... // player far teleport would try to create same instance, but we need it NOW for transport... RemoveFromWorld(); ResetMap(); Map* newMap = sMapMgr->CreateBaseMap(newMapid); SetMap(newMap); ASSERT(GetMap()); AddToWorld(); for (UnitSet::iterator itr = _passengers.begin(); itr != _passengers.end();) { Unit* passenger = *itr; ++itr; switch (passenger->GetTypeId()) { case TYPEID_UNIT: passenger->ToCreature()->FarTeleportTo(newMap, x, y, z, passenger->GetOrientation()); break; case TYPEID_PLAYER: if (passenger->isDead() && !passenger->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) passenger->ToPlayer()->ResurrectPlayer(1.0f); passenger->ToPlayer()->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); break; } } if (oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } MoveToNextWayPoint(); }
BOOL ContBritImage(LPIMAGE lpImage, LPCONTBRIT_PARMS lpParms) /************************************************************************/ { LPMAPS lpMaps; int i; RECT rUpdate; UPDATE_TYPE UpdateType; FRMDATATYPE type; ImgGetInfo(lpImage, NULL, NULL, NULL, &type); if (type == FDT_LINEART) return(FALSE); else if (type == FDT_PALETTECOLOR && ImgGetMask(lpImage)) return(FALSE); if (!(lpMaps = (LPMAPS)Alloc((long)sizeof(MAPS)))) { lpParms->Common.StatusCode = SC_MEMERROR; Message(IDS_EMEMALLOC); return(FALSE); } ProgressBegin(1, lpParms->Common.idDirty-IDS_UNDOFIRST+IDS_PROGFIRST); ResetMapEx( &lpMaps->MasterMap, MAPPOINTS, NO, YES); ResetMap( &lpMaps->RedMap, MAPPOINTS, NO ); // sometimes Cyan ResetMap( &lpMaps->GreenMap, MAPPOINTS, NO ); // sometimes Magenta ResetMap( &lpMaps->BlueMap, MAPPOINTS, NO ); // sometimes Yellow ResetMap( &lpMaps->BlackMap, MAPPOINTS, NO ); ResetMap( &lpMaps->HueMap, MAXPOINTS, NO ); ResetMap( &lpMaps->SatMap, MAPPOINTS, NO ); lpMaps->MasterMap.Contrast = lpParms->Contrast; for (i = 0; i < NUM_BANDS; ++i) lpMaps->MasterMap.Brightness[i] = lpParms->Brightness[i]; MakeMap(&lpMaps->MasterMap); lpParms->Common.StatusCode = ApplyMaps(lpImage, lpMaps, lpParms->Common.idDirty, &rUpdate, &UpdateType); if (UpdateType) { lpParms->Common.UpdateType = UpdateType; lpParms->Common.rUpdateArea = rUpdate; } FreeUp(lpMaps); ProgressEnd(); return(lpParms->Common.StatusCode == SC_SUCCESS); }
// Uses Mapping.Quarter_HSacrifice & Mapping.Quarter_SSacrifice // to set the highlights midtones and shaddows. void CToneBalanceDlg::set_sacrifice(LPQUARTERSTRUCT lpData, WORD wChannel) { LPMAP lpMap; LPDWORD lpHisto; BOOL bInv; LONG lSum, lSearch, lTotal; int hi, lo, i; // get the map & set its invert flags lpMap = tone_activate_channel( wChannel ); lpHisto = get_histo(lpData->lpHistos, wChannel, &bInv); // determine initail values hi = 170; lo = 85; if (lpHisto) { // Find the total of all entries to scale lTotal = 0; for ( i=0; i<256; i++ ) lTotal += lpHisto[i]; // find the sacrafice lSearch = bInv ? m_nHSacrifice:m_nSSacrifice; lSearch = FMUL( lTotal, FGET( lSearch, 100 ) ); lSum = -1; for ( i=0; i<255; i++ ) { lSum += lpHisto[i]; if ( lSum >= lSearch ) break; } lo = i; // find the sacrafice lSearch = bInv ? m_nSSacrifice:m_nHSacrifice; lSearch = FMUL( lTotal, FGET( lSearch, 100 ) ); lSum = -1; for ( i=255; i>0; i-- ) { lSum += lpHisto[i]; if ( lSum >= lSearch ) break; } hi = i; } if (bInv) { hi = 255-hi; lo = 255-lo; } i = lo; lo = min(lo,hi); hi = max(i,hi); // setup the map if (wChannel == IDC_DO_ALL) ResetMapEx( lpMap, 3, NO, YES); else ResetMap( lpMap, 3, NO ); lpMap->Pnt[0].x = lo; lpMap->Pnt[1].x = lo + (hi-lo)/2; lpMap->Pnt[2].x = hi; }
void CApp::OnLoop() { // process input if (InputHappened) { NeedsRedraw = true; // quit game if (inputs.Quit) { Running = false; return; } // reset color modulation (easier on the eyes) if (inputs.Confirm) { SDL_SetTextureColorMod(Texture, 255, 255, 255); } // reset/change level if (inputs.Reset) { ResetMap(CurrentMap); } else if (inputs.NextLevel) { if (highestLevel > CurrentMap && CurrentMap < maps.size() - 1) ResetMap(CurrentMap+1); } else if (inputs.PrevLevel) { if (CurrentMap > 0) ResetMap(CurrentMap-1); } else { // movement CBlock* pushed = NULL; if (inputs.Left) { int result = ActionJackson.CanPlayerMoveLeft(&pushed); if (result != NO) { ActionJackson.OnMove(-1, 0, result == BLOCK); if (result == BLOCK) pushed->OnMove(-1, 0); } } else if (inputs.Right) { int result = ActionJackson.CanPlayerMoveRight(&pushed); if (result != NO) { ActionJackson.OnMove(1, 0, result == BLOCK); if (result == BLOCK) pushed->OnMove(1, 0); } } else if (inputs.Up) { int result = ActionJackson.CanPlayerMoveUp(&pushed); if (result != NO) { ActionJackson.OnMove(0, -1, result == BLOCK); if (result == BLOCK) pushed->OnMove(0, -1); } } else if (inputs.Down) { int result = ActionJackson.CanPlayerMoveDown(&pushed); if (result != NO) { ActionJackson.OnMove(0, 1, result == BLOCK); if (result == BLOCK) pushed->OnMove(0, 1); } } else if (inputs.Cancel) { ActionJackson.UndoLastMove(); } } // ~movement //if (PROCESS_ONCE) InputHappened = false; } // add other logic here FOR_EACH_ENTITY(this) if (entity->OnLoop()) { NeedsRedraw = true; } FOR_EACH_END // checking if all blocks are home bool blocksAreHome = true; FOR_EACH_BLOCK(&blocksAreHome) if (!block->CheckForHome()) blocksAreHome = false; FOR_EACH_END if (blocksAreHome) { if (CurrentMap == (maps.size() - 1)) Running = false; else { ResetMap(CurrentMap + 1); } } }
void ProgFinder::updateInfo(void) { if (m_help1Text) m_help1Text->Reset(); if (m_help2Text) m_help2Text->Reset(); if (GetFocusWidget() == m_alphabetList) { QString title; QString description; if (m_showList->GetCount() == 0) { if (m_help1Text) m_help1Text->SetText(tr("No Programs")); if (m_help2Text) m_help2Text->SetText(tr("There are no available programs under this search. " "Please select another search.")); } else { if (m_help1Text) m_help1Text->SetText(tr("Select a letter...")); if (m_help2Text) m_help2Text->SetText(tr("Pick the first letter of the program name, " "then press SELECT or the right arrow.")); } ResetMap(m_infoMap); } else if (GetFocusWidget() == m_showList) { if (m_help1Text) m_help1Text->SetText(tr("Select a program...")); if (m_help2Text) m_help2Text->SetText(tr("Select the title of the program you wish to find. " "When finished return with the left arrow key. " "Press SELECT to schedule a recording.")); ResetMap(m_infoMap); } else if (GetFocusWidget() == m_timesList) { if (m_showData.size() == 0) { ResetMap(m_infoMap); if (m_help1Text) m_help1Text->SetText(tr("No Programs")); if (m_help2Text) m_help2Text->SetText(tr("There are no available programs under " "this search. Please select another " "search.")); } else { InfoMap infoMap; m_showData[m_timesList->GetCurrentPos()]->ToMap(infoMap); SetTextFromMap(infoMap); m_infoMap = infoMap; } } }
//************************************************************************ LOCAL STATUS_CODE ApplyCalibration( LPIMAGE lpImage, ITEMID dirty, LPSTR lpScanMap, LPSTR lpPrintMap, LPRECT lpUpdateRect, LPUPDATE_TYPE lpUpdateType) //************************************************************************ { FNAME szFileName; ENGINE Engine; LPCALMAPS lpMaps; BOOL fScanMap, fPrintMap; FRMTYPEINFO TypeInfo; LPCOLORMAP lpColorMap; STATUS_CODE StatusCode; int i; ASSERT(lpImage); AstralSetRectEmpty(lpUpdateRect); *lpUpdateType = UT_NONE; ImgGetTypeInfo(lpImage, &TypeInfo); lpMaps = (LPCALMAPS)Alloc(sizeof(CALMAPS)); if (!lpMaps) { Message(IDS_EMEMALLOC); return(SC_MEMERROR); } for (i = 0; i < CALSCAN_MAPS; ++i) ResetMap( &lpMaps->ScanMap[i], CALPOINTS, NO ); if (fScanMap = (lstrlen(lpScanMap) != 0)) { if ( LookupExtFileN( lpScanMap, szFileName, IDN_SCANMAP, NO ) ) { // Remember that the maps load in XRGB order if (!LoadMap( &lpMaps->ScanMap[CALSCAN_GRAY], &lpMaps->ScanMap[CALSCAN_RED], &lpMaps->ScanMap[CALSCAN_GREEN], &lpMaps->ScanMap[CALSCAN_BLUE], szFileName )) { FreeUp(lpMaps); return(SC_READERROR); } if (TypeInfo.DataType == FDT_CMYKCOLOR) { // make maps work on cmyk for (i = 0; i < CALSCAN_MAPS; ++i) ReverseMap(&lpMaps->ScanMap[i], FALSE); } } else { fScanMap = NO; } } for (i = 0; i < CAL_MAPS; ++i) ResetMap( &lpMaps->PrintMap[i], CALPOINTS, NO ); if (fPrintMap = (lstrlen(lpPrintMap) != 0)) { if ( LookupExtFileN( lpPrintMap, szFileName, IDN_CALMAP, NO ) ) { // Remember that the maps load in MCMYK order if (!LoadCalMap( &lpMaps->PrintMap[CAL_MASTER], &lpMaps->PrintMap[CAL_CYAN], &lpMaps->PrintMap[CAL_MAGENTA], &lpMaps->PrintMap[CAL_YELLOW], &lpMaps->PrintMap[CAL_BLACK], szFileName )) { FreeUp(lpMaps); return(SC_READERROR); } if (TypeInfo.DataType != FDT_CMYKCOLOR) { // make maps work on rgb for (i = 0; i < CAL_MAPS; ++i) ReverseMap(&lpMaps->PrintMap[i], FALSE); } } else { fPrintMap = NO; lpPrintMap = NULL; } } if (!fScanMap && !fPrintMap) { FreeUp(lpMaps); return(SC_SUCCESS); // user selected no maps??? } switch (TypeInfo.DataType) { case FDT_LINEART: case FDT_GRAYSCALE: MakeFloatMap(&lpMaps->ScanMap[CALSCAN_GRAY], lpMaps->CalPnts); MakeFloatMap(&lpMaps->PrintMap[CAL_BLACK], lpMaps->TmpPnts); MapCombine(lpMaps->CalPnts, lpMaps->TmpPnts); MapCreateLut(lpMaps->CalPnts, lpMaps->Lut[0]); break; case FDT_CMYKCOLOR: for (i = 0; i < 4; ++i) { if (i == 3) // black MakeFloatMap(&lpMaps->ScanMap[CALSCAN_GRAY], lpMaps->CalPnts); else MakeFloatMap(&lpMaps->ScanMap[CALSCAN_RED+i], lpMaps->CalPnts); MakeFloatMap(&lpMaps->PrintMap[CAL_MASTER], lpMaps->TmpPnts); MapCombine(lpMaps->CalPnts, lpMaps->TmpPnts); MakeFloatMap(&lpMaps->PrintMap[CAL_CYAN+i], lpMaps->TmpPnts); MapCombine(lpMaps->CalPnts, lpMaps->TmpPnts); MapCreateLut(lpMaps->CalPnts, lpMaps->Lut[i]); } break; default: case FDT_RGBCOLOR: case FDT_PALETTECOLOR: for (i = 0; i < 3; ++i) { MakeFloatMap(&lpMaps->ScanMap[CALSCAN_RED+i], lpMaps->CalPnts); MakeFloatMap(&lpMaps->PrintMap[CAL_MASTER], lpMaps->TmpPnts); MapCombine(lpMaps->CalPnts, lpMaps->TmpPnts); MakeFloatMap(&lpMaps->PrintMap[CAL_CYAN+i], lpMaps->TmpPnts); MapCombine(lpMaps->CalPnts, lpMaps->TmpPnts); MapCreateLut(lpMaps->CalPnts, lpMaps->Lut[i]); } break; } ImgGetTypeInfo(lpImage, &TypeInfo); if (TypeInfo.DataType == FDT_PALETTECOLOR) { lpColorMap = FrameCopyColorMap(TypeInfo.ColorMap); if (!lpColorMap) { Message(IDS_EMEMALLOC); return(SC_MEMERROR); } LineCalMapProc(0, 0, lpColorMap->NumEntries-1, (LPTR)lpColorMap->RGBData, (LPTR)lpColorMap->RGBData, 3, lpMaps); StatusCode = ApplyColorMap(lpImage, lpColorMap, FALSE, DT_NONE, dirty); FrameDestroyColorMap(lpColorMap); if (StatusCode == SC_SUCCESS) *lpUpdateType = UT_DATATYPE; } else { SetEngineDef(&Engine); Engine.lpDataProc = (LPDATAPROC)LineCalMapProc; Engine.lpParam = lpMaps; StatusCode = LineEngineSelObj(lpImage, &Engine, dirty); if (!AstralIsRectEmpty(&Engine.rUpdate)) { *lpUpdateRect = Engine.rUpdate; *lpUpdateType = UT_AREA; } } FreeUp(lpMaps); return(StatusCode); }
bool CApp::OnInit() { if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { return false; } if (IMG_Init(IMG_INIT_PNG) == 0) { return false; } SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); SDL_LogGetOutputFunction(&logfunc, NULL); SDL_LogSetOutputFunction(myLog, NULL); SDL_CreateWindowAndRenderer(SCREEN_W, SCREEN_H, 0, &Window, &Renderer); if (!Window || !Renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CreateWindowAndRenderer: %s", SDL_GetError()); return false; } SDL_SetWindowTitle(Window, TITLE); Surf_Display = SDL_CreateRGBSurface(0, SCREEN_W, SCREEN_H, BPP, RMASK, GMASK, BMASK, AMASK); if (!Surf_Display) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CreateRGBSurface: %s", SDL_GetError()); return false; } SDL_FillRect(Surf_Display, NULL, 0); Texture = SDL_CreateTexture(Renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, SCREEN_W, SCREEN_H); if (!Texture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CreateTexture: %s", SDL_GetError()); return false; } CEventFilter::SetDefaults(); // or use your own filters CEventFilter::TurnFilterOn(&InputHappened); // PROGRAM SPECIFIC CODE HERE bg = SDL_CreateRGBSurface(0, SCREEN_W, SCREEN_H, BPP, RMASK, GMASK, BMASK, AMASK); if (!bg) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CSurface::OnLoad: %s", SDL_GetError()); return false; } SDL_FillRect(bg, NULL, 0xfff0f0f0); VerticalSpriteSheet* dude = new VerticalSpriteSheet("gfx/char.png", 1, Surf_Display->format); ActionJackson.SetSpriteSheet(dude); ActionJackson.AnimState = 0; CEntity::EntityList.push_back(&ActionJackson); SDL_SetWindowIcon(Window, dude->sheet); tiles = new TiledSpriteSheet("gfx/tiles.png", 2, 2, Surf_Display->format); block = new VerticalSpriteSheet("gfx/block.png", 1, Surf_Display->format); if (!LoadMaps("maps/sokoban.map", tiles)) return false; std::ifstream fin("save"); if (fin) { fin >> CurrentMap; fin.ignore(1, '\n'); fin >> highestLevel; } fin.close(); ResetMap(CurrentMap); return true; }
void EditorScreen::DrawToolBar(sf::RenderWindow &Window) { sf::RectangleShape segmentShape; segmentShape.setPosition(0, 0); sf::Vector2<float> segmentSize(1280, 40); segmentShape.setSize(segmentSize); segmentShape.setFillColor(sf::Color(0,0,0,180)); Window.draw(segmentShape); sf::Sprite toolbarSpacer; toolbarSpacer.setTexture(toolbarIconsTex); toolbarSpacer.setTextureRect(sf::Rect<int>(0, 2, 2, 30)); int x = 5; if (DrawButton(Window, x, 5 , 0)) // New Map ResetMap(); x = x + 35; if (DrawButton(Window, x, 5 , 2)) // Save Map SaveMap(); x = x + 35; if (DrawButton(Window, x, 5 , 1)) // Load Map LoadMap(); x = x + 35; if (DrawButton(Window, x, 5 , 3)) // Layer change { layerPane->minimized = !layerPane->minimized; } /*x = x + 35; if (DrawButton(Window, x, 5 , 4)) // Zoom out { map->zoomScale -= 0.05f; if (map->zoomScale < 0.1f) map->zoomScale = 0.1f; } x = x + 35; if (DrawButton(Window, x, 5 , 5)) // Zoom in { map->zoomScale += 0.05; if (map->zoomScale > 2.0f) map->zoomScale = 2.0f; }*/ x = x + 40; toolbarSpacer.setPosition(x, 5); Window.draw(toolbarSpacer, sf::RenderStates::Default); x = x + 10; if (DrawButton(Window, x, 5 , 6)) // Segment drawing mode { drawingMode = (drawingMode_t)SEGMENT_SELECTION; ledgePane->minimized = true; } x = x + 35; if (DrawButton(Window, x, 5 , 7)) // Ledge drawing mode { drawingMode = (drawingMode_t)LEDGES; segmentPane->minimized = true; ledgePane->minimized = false; } x = x + 35; if (DrawButton(Window, x, 5 , 8)) // Collision drawing mode { } x = x + 40; toolbarSpacer.setPosition(x, 5); Window.draw(toolbarSpacer, sf::RenderStates::Default); x = x + 10; if (DrawButton(Window, x, 5 , 9)) // Test map { PlayTestScreen *screen = new PlayTestScreen; screen->SetMapData(map); ScreenManager::GetInstance().AddScreen(screen); } }