diff --git a/CMakeLists.txt b/CMakeLists.txt index c15743c7b..3baca51d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ find_package(SDL_image REQUIRED) find_package(SDL_mixer REQUIRED) find_package(SDL_ttf REQUIRED) find_package(ZLIB REQUIRED) +find_package(OpenGL REQUIRED) if (ENABLE_EDITOR) # Widgets finds its own dependencies (QtGui and QtCore). diff --git a/client/AdventureMapClasses.cpp b/client/AdventureMapClasses.cpp index 89558ee86..a301b3400 100644 --- a/client/AdventureMapClasses.cpp +++ b/client/AdventureMapClasses.cpp @@ -580,14 +580,14 @@ void CMinimap::showAll() int3 mapSizes = LOCPLINT->cb->getMapSize(); //draw radar - SDL_Rect oldClip; - SDL_Rect radar = + // SDL_Rect oldClip; + /*SDL_Rect radar = { si16(adventureInt->position.x * pos.w / mapSizes.x + pos.x), si16(adventureInt->position.y * pos.h / mapSizes.y + pos.y), ui16(adventureInt->terrain.tilesw * pos.w / mapSizes.x), ui16(adventureInt->terrain.tilesh * pos.h / mapSizes.y) - }; + };*/ //* SDL_GetClipRect(to, &oldClip); //* SDL_SetClipRect(to, &pos); diff --git a/client/BattleInterface/CCreatureAnimation.cpp b/client/BattleInterface/CCreatureAnimation.cpp index 99eaab95d..d35b07dfb 100644 --- a/client/BattleInterface/CCreatureAnimation.cpp +++ b/client/BattleInterface/CCreatureAnimation.cpp @@ -228,7 +228,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack const int remainder = ftcp % FullWidth; int xB = (attacker ? remainder : FullWidth - remainder - 1) + x; - const ui8 aCountMod = (animCount & 0x20) ? ((animCount & 0x1e) >> 1) << 4 : (0x0f - ((animCount & 0x1e) >> 1)) << 4; + //const ui8 aCountMod = (animCount & 0x20) ? ((animCount & 0x1e) >> 1) << 4 : (0x0f - ((animCount & 0x1e) >> 1)) << 4; for (int k = 0; k <= SegmentLength; k++) { @@ -236,7 +236,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack { if(!destRect || (destRect->x <= xB && destRect->x + destRect->w > xB && destRect->y <= yB && destRect->y + destRect->h > yB)) { - const ui8 colorNr = SegmentType == 0xff ? FDef[BaseOffset+k] : SegmentType; + //const ui8 colorNr = SegmentType == 0xff ? FDef[BaseOffset+k] : SegmentType; //putPixel(dest, xB, yB, palette[colorNr], colorNr, yellowBorder, blueBorder, aCountMod); } } @@ -299,7 +299,7 @@ inline void CCreatureAnimation::putPixel( SDL_Surface * dest, const int & ftcpX, const int & ftcpY, - const BMPPalette & color, + const SDL_Color & color, const ui8 & palc, const bool & yellowBorder, const bool & blueBorder, @@ -311,7 +311,7 @@ inline void CCreatureAnimation::putPixel( Uint8 * p = (Uint8*)dest->pixels + ftcpX*dest->format->BytesPerPixel + ftcpY*dest->pitch; if(palc > 7) //normal color { - ColorPutter::PutColor(p, color.R, color.G, color.B); + ColorPutter::PutColor(p, color.r, color.g, color.b); } else if((yellowBorder || blueBorder) && (palc == 6 || palc == 7)) //selection highlight { @@ -323,9 +323,9 @@ inline void CCreatureAnimation::putPixel( else if (palc == 5) //selection highlight or transparent { if(blueBorder) - ColorPutter::PutColor(p, color.B, color.G - 0xf0 + animCount, color.R - 0xf0 + animCount); //shouldn't it be reversed? its bgr instead of rgb + ColorPutter::PutColor(p, color.b, color.g - 0xf0 + animCount, color.r - 0xf0 + animCount); //shouldn't it be reversed? its bgr instead of rgb else if (yellowBorder) - ColorPutter::PutColor(p, color.R - 0xf0 + animCount, color.G - 0xf0 + animCount, color.B); + ColorPutter::PutColor(p, color.r - 0xf0 + animCount, color.g - 0xf0 + animCount, color.b); } else //shadow { diff --git a/client/BattleInterface/CCreatureAnimation.h b/client/BattleInterface/CCreatureAnimation.h index 8367ccd1e..92dd8e875 100644 --- a/client/BattleInterface/CCreatureAnimation.h +++ b/client/BattleInterface/CCreatureAnimation.h @@ -15,7 +15,7 @@ * */ -struct BMPPalette; +struct SDL_Color; class CIntObject; /// Class which manages animations of creatures/units inside battles @@ -36,7 +36,7 @@ private: SDL_Surface * dest, const int & ftcpX, const int & ftcpY, - const BMPPalette & color, + const SDL_Color & color, const ui8 & palc, const bool & yellowBorder, const bool & blueBorder, diff --git a/client/CCreatureWindow.cpp b/client/CCreatureWindow.cpp index 6d2735a3c..a879e8049 100644 --- a/client/CCreatureWindow.cpp +++ b/client/CCreatureWindow.cpp @@ -555,7 +555,7 @@ void CCreatureWindow::showAll() if (upgradeOptions.size() && (type == COMMANDER_LEVEL_UP && upgradeOptions[selectedOption] >= 100)) //add frame to selected skill { - int index = selectedOption - selectableSkills.size(); //this is screwed +// int index = selectedOption - selectableSkills.size(); //this is screwed //* CSDL_Ext::drawBorder(to, Rect::around(selectableBonuses[index]->pos), int3(Colors::METALLIC_GOLD.r, Colors::METALLIC_GOLD.g, Colors::METALLIC_GOLD.b)); } } diff --git a/client/CMT.cpp b/client/CMT.cpp index b1016aeb3..eb096b896 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -77,7 +77,7 @@ static bool gOnlyAI = false; static bool ermInteractiveMode = false; //structurize when time is right void processCommand(const std::string &message); -static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo=true); +//static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo=true); void dispose(); void playIntro(); static void listenForEvents(); @@ -252,7 +252,7 @@ int main(int argc, char* argv[]) } //Set environment vars to make window centered. Sometimes work, sometimes not. :/ - putenv("SDL_VIDEO_CENTERED=center"); + putenv((char*)"SDL_VIDEO_CENTERED=center"); //putenv("SDL_VIDEO_WINDOW_POS"); // Have effect on X11 system only (Linux). @@ -308,14 +308,16 @@ int main(int argc, char* argv[]) tlog0 <<"\tInitializing screen: "<videoh = new CEmptyVideoPlayer; -#else - if (!vm.count("disable-video")) - CCS->videoh = new CVideoPlayer; - else + +//TODO: video support for OpenGL +//#if DISABLE_VIDEO +// CCS->videoh = new CEmptyVideoPlayer; +//#else +// if (!vm.count("disable-video")) +// CCS->videoh = new CVideoPlayer; +// else CCS->videoh = new CEmptyVideoPlayer; -#endif +//#endif tlog0<<"\tInitializing video: "<bg->format->palette) //* background->convertToScreenBPP(); - background->scaleTo(Point(screen->w, screen->h)); +//* background->scaleTo(Point(screen->w, screen->h)); } pos = background->center(); @@ -2031,7 +2031,7 @@ void InfoCard::showAll() //difficulty assert(SEL->current->mapHeader->difficulty <= 4); - std::string &diff = CGI->generaltexth->arraytxt[142 + SEL->current->mapHeader->difficulty]; +// std::string &diff = CGI->generaltexth->arraytxt[142 + SEL->current->mapHeader->difficulty]; //* printAtMiddleLoc(diff, 62, 472, FONT_SMALL, Colors::WHITE, to); //selecting size icon @@ -3330,7 +3330,7 @@ void CBonusSelection::show() mapDesc->showAll(); //showAll because CTextBox has no show() //map size icon - int temp; +/* int temp; switch (ourHeader->width) { case 36: @@ -3348,7 +3348,7 @@ void CBonusSelection::show() default: temp=4; break; - } + }*/ //* blitAtLoc(sizes->ourImages[temp].bitmap, 735, 26, to); //flags diff --git a/client/CSpellWindow.cpp b/client/CSpellWindow.cpp index 8bce154c1..41c7c6d6a 100644 --- a/client/CSpellWindow.cpp +++ b/client/CSpellWindow.cpp @@ -828,7 +828,7 @@ void CSpellWindow::SpellArea::showAll() if(mySpell < 0) return; - const CSpell * spell = mySpell.toSpell(); +// const CSpell * spell = mySpell.toSpell(); //* blitAt(owner->spells->ourImages[mySpell].bitmap, pos.x, pos.y, to); //* blitAt(owner->schoolBorders[owner->selectedTab >= 4 ? whichSchool : owner->selectedTab]->ourImages[schoolLevel].bitmap, pos.x, pos.y, to); //printing border (indicates level of magic school) diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 7e84be4a9..a4675edb7 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -5260,8 +5260,8 @@ CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio): void CPuzzleWindow::showAll() { - int3 moveInt = int3(8, 9, 0); - Rect mapRect = genRect(544, 591, pos.x + 8, pos.y + 7); +// int3 moveInt = int3(8, 9, 0); +// Rect mapRect = genRect(544, 591, pos.x + 8, pos.y + 7); /* CGI->mh->terrainRect (grailPos - moveInt, adventureInt->anim, diff --git a/client/Gfx/Animations.h b/client/Gfx/Animations.h index 62e038e59..a3875a89f 100644 --- a/client/Gfx/Animations.h +++ b/client/Gfx/Animations.h @@ -43,7 +43,10 @@ public: }; -#pragma warning(disable : 4200) +#ifdef _MSC_VER + #pragma warning(disable : 4200) + #pragma warning(disable : 4291) +#endif class CPalettedAnimation : CAnimation { @@ -54,17 +57,18 @@ class CPalettedAnimation : CAnimation protected: CPalettedAnimation(const SH3DefFile& def, size_t fileSize); -#pragma warning(disable : 4291) inline void* operator new(size_t size, ui32 frCount) { return ::operator new(size + frCount * sizeof(void*)); } -#pragma warning(default : 4291) public: virtual ~CPalettedAnimation(); virtual CImage* getFrame(ui32 fnr); }; -#pragma warning(default : 4200) +#ifdef _MSC_VER + #pragma warning(default : 4200) + #pragma warning(default : 4291) +#endif } diff --git a/client/Gfx/FilesHeaders.h b/client/Gfx/FilesHeaders.h index f3d4e407d..1efc1abdb 100644 --- a/client/Gfx/FilesHeaders.h +++ b/client/Gfx/FilesHeaders.h @@ -12,8 +12,10 @@ namespace Gfx #define SELF_ADDR reinterpret_cast(this) +#ifdef _MSC_VER #pragma pack(1) #pragma warning(disable : 4200) +#endif struct SH3PcxFile { @@ -50,7 +52,7 @@ struct SH3DefBlock { ui32 unknown2; char names[][13]; // [entriesCount][13] - array of frames names - inline const ua_ui32_ptr offsets() const { + inline ua_ui32_ptr offsets() const { return (ua_ui32_ptr)(names + SDL_SwapLE32(entriesCount)); } // array of offsets of frames }; @@ -74,8 +76,10 @@ struct SH3DefFile { } }; +#ifdef _MSC_VER #pragma warning(default : 4200) #pragma pack() +#endif #undef SELF_ADDR } diff --git a/client/UIFramework/CIntObjectClasses.cpp b/client/UIFramework/CIntObjectClasses.cpp index 7bb3b53b6..850b9bc5c 100644 --- a/client/UIFramework/CIntObjectClasses.cpp +++ b/client/UIFramework/CIntObjectClasses.cpp @@ -1277,7 +1277,7 @@ void CBoundedLabel::showAll() int lineHeight = f->getLineHeight(); int lineCapacity = pos.h / lineHeight; - int dy = f->getLineHeight(); //line height +// int dy = f->getLineHeight(); //line height int base_y = pos.y; if(alignment == CENTER) base_y += std::max((pos.h - maxH)/2,0); @@ -1365,8 +1365,8 @@ void CTextBox::showAll() { CIntObject::showAll(); - const IFont * f = graphics->fonts[font]; - int dy = f->getLineHeight(); //line height +// const IFont * f = graphics->fonts[font]; +// int dy = f->getLineHeight(); //line height int base_y = pos.y; if (alignment == CENTER) @@ -1380,8 +1380,8 @@ void CTextBox::showAll() const std::string &line = lines[i + firstLineToPrint]; if(!line.size()) continue; - int width = pos.w + (slider ? (slider->pos.w) : 0); - int x = pos.x + int(alignment) * width / 2; +// int width = pos.w + (slider ? (slider->pos.w) : 0); +// int x = pos.x + int(alignment) * width / 2; //* blitLine(to, Point(x, base_y + i * dy), line); } @@ -1519,7 +1519,7 @@ CTextInput::CTextInput(const Rect &Pos, SDL_Surface *srf) captureAllKeys = true; OBJ_CONSTRUCTION; bg = new CPicture(Pos, 0, true); - Rect hlp = Pos; +// Rect hlp = Pos; /* if(srf) CSDL_Ext::blitSurface(srf, &hlp, *bg, NULL); else diff --git a/client/UIFramework/GL2D.cpp b/client/UIFramework/GL2D.cpp index 0e8b3f67b..436aadbfa 100644 --- a/client/UIFramework/GL2D.cpp +++ b/client/UIFramework/GL2D.cpp @@ -197,7 +197,7 @@ void attachToCurrentThread() HDC hdc = GetDC(wmInfo.window); wglMakeCurrent(hdc, wmInfo.hglrc); #elif _GLX - if (!glXMakeCurrent(wmInfo.info.x11.display, info.info.x11.window, glxCtx)) + if (!glXMakeCurrent(wmInfo.info.x11.display, wmInfo.info.x11.window, glxCtx)) { throw std::runtime_error("attachToCurrentThread: glXMakeCurrent failed\n"); } diff --git a/client/mapHandler.cpp b/client/mapHandler.cpp index 78f165a69..3d9af236e 100644 --- a/client/mapHandler.cpp +++ b/client/mapHandler.cpp @@ -464,7 +464,7 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std:: for (size_t bx = 0; bx < dx; bx++, srx+=32) { // Skip column if not in map - if (top_tile.x+bx < 0 || top_tile.x+bx >= sizes.x) + if (top_tile.x+si32(bx) < 0 || top_tile.x+bx >= sizes.x) continue; sry = sry_init;