diff --git a/Makefile b/Makefile index 3d75c3091..83eb9f7d6 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,12 @@ endif ifeq ($(BACKEND_SDL), yes) ifeq ($(SDLVERSION), 1.3.0) + ifeq ($(OS), darwin) + SDL_BACKEND_LINK = -framework Cocoa -lSDL -lSDLmain + else SDL_BACKEND_LINK = libs/$(OS)/libSDL.a + endif + SDL_BACKEND_SRC = $(wildcard ./src/window/backend/SDL13/*.cpp) else ifeq ($(OS), darwin) diff --git a/src/gaming/clightmanager.cpp b/src/gaming/clightmanager.cpp index c5b5ba708..3f079bf3f 100644 --- a/src/gaming/clightmanager.cpp +++ b/src/gaming/clightmanager.cpp @@ -64,10 +64,19 @@ void cLightManager::UpdateByVertex() { eeAABB TileAABB( Pos.x, Pos.y, Pos.x + TileSize.x, Pos.y + TileSize.y ); if ( Intersect( TileAABB, Light->GetAABB() ) ) { - mTileColors[x][y][0]->Assign( Light->ProcessVertex( Pos.x, Pos.y, *(mTileColors[x][y][0]), *(mTileColors[x][y][0]) ) ); + if ( y > 0 ) + mTileColors[x][y][0]->Assign( *mTileColors[x][y - 1][1] ); + else + mTileColors[x][y][0]->Assign( Light->ProcessVertex( Pos.x, Pos.y, *(mTileColors[x][y][0]), *(mTileColors[x][y][0]) ) ); + mTileColors[x][y][1]->Assign( Light->ProcessVertex( Pos.x, Pos.y + TileSize.Height(), *(mTileColors[x][y][1]), *(mTileColors[x][y][1]) ) ); + mTileColors[x][y][2]->Assign( Light->ProcessVertex( Pos.x + TileSize.Width(), Pos.y + TileSize.Height(), *(mTileColors[x][y][2]), *(mTileColors[x][y][2]) ) ); - mTileColors[x][y][3]->Assign( Light->ProcessVertex( Pos.x + TileSize.Width(), Pos.y, *(mTileColors[x][y][3]), *(mTileColors[x][y][3]) ) ); + + if ( y > 0 ) + mTileColors[x][y][3]->Assign( *mTileColors[x][y - 1][2] ); + else + mTileColors[x][y][3]->Assign( Light->ProcessVertex( Pos.x + TileSize.Width(), Pos.y, *(mTileColors[x][y][3]), *(mTileColors[x][y][3]) ) ); } } } diff --git a/src/gaming/cmap.cpp b/src/gaming/cmap.cpp index 347ff308c..3220f01a5 100644 --- a/src/gaming/cmap.cpp +++ b/src/gaming/cmap.cpp @@ -261,7 +261,27 @@ void cMap::GridDraw() { ty = y * mTileSize.y; - mTileTex->Draw( tx, ty, 0, 1, TileTexCol ); + if ( LightsEnabled() ) { + eeVector2i TPos( x, y ); + + if ( mLightManager->IsByVertex() ) { + eeColorA TileTexCol0( *mLightManager->GetTileColor( TPos, 0 ) ); + eeColorA TileTexCol1( *mLightManager->GetTileColor( TPos, 1 ) ); + eeColorA TileTexCol2( *mLightManager->GetTileColor( TPos, 2 ) ); + eeColorA TileTexCol3( *mLightManager->GetTileColor( TPos, 3 ) ); + + TileTexCol0.Alpha = TileTexCol1.Alpha = TileTexCol2.Alpha = TileTexCol3.Alpha = mBackAlpha; + + mTileTex->DrawEx( tx, ty, 0, 0, 0, 1, TileTexCol0, TileTexCol1, TileTexCol2, TileTexCol3 ); + } else { + TileTexCol = *mLightManager->GetTileColor( TPos ); + TileTexCol.Alpha = mBackAlpha; + + mTileTex->Draw( tx, ty, 0, 1, TileTexCol ); + } + } else { + mTileTex->Draw( tx, ty, 0, 1, TileTexCol ); + } } } diff --git a/src/gaming/mapeditor/cmapeditor.cpp b/src/gaming/mapeditor/cmapeditor.cpp index 5beb4bfd3..1675727ad 100644 --- a/src/gaming/mapeditor/cmapeditor.cpp +++ b/src/gaming/mapeditor/cmapeditor.cpp @@ -86,7 +86,7 @@ void cMapEditor::CreateWinMenu() { PU1->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cMapEditor::FileMenuClick ) ); WinMenu->AddMenuButton( "File", PU1 ); - cUIPopUpMenu * PU3 = mTheme->CreatePopUpMenu(); + cUIPopUpMenu * PU3 = mTheme->CreatePopUpMenu( mUIContainer ); mChkShowGrid = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Grid" ) ) ); mChkShowGrid->Active( true ); @@ -95,6 +95,13 @@ void cMapEditor::CreateWinMenu() { mChkShowBlocked = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Blocked" ) ) ); + PU3->AddSeparator(); + mUIWindow->AddShortcut( KEY_KP_PLUS , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom In", mTheme->GetIconByName( "zoom-in" ) ) ) ) ); + mUIWindow->AddShortcut( KEY_KP_MINUS, KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom Out", mTheme->GetIconByName( "zoom-out" ) ) ) ) ); + mUIWindow->AddShortcut( KEY_KP0 , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Normal Size", mTheme->GetIconByName( "zoom-original" ) ) ) ) ); + PU3->AddSeparator(); + + PU3->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cMapEditor::ViewMenuClick ) ); WinMenu->AddMenuButton( "View", PU3 ); @@ -803,6 +810,66 @@ void cMapEditor::ViewMenuClick( const cUIEvent * Event ) { mUIMap->Map()->DrawTileOver( reinterpret_cast ( Event->Ctrl() )->Active() ); } else if ( "Show Blocked" == txt ) { mUIMap->Map()->ShowBlocked( reinterpret_cast ( Event->Ctrl() )->Active() ); + } else if ( "Zoom In" == txt ) { + ZoomIn(); + } else if ( "Zoom Out" == txt ) { + ZoomOut(); + } else if ( "Normal Size" == txt ) { + mUIMap->Map()->Scale( 1 ); + } +} + +void cMapEditor::ZoomIn() { + cMap * Map = mUIMap->Map(); + eeFloat S = mUIMap->Map()->Scale(); + + if ( S < 4 ) { + if ( 0.0625f == S ) { + Map->Scale( 0.125f ); + } else if ( 0.125f == S ) { + Map->Scale( 0.25f ); + } else if ( 0.25f == S ) { + Map->Scale( 0.5f ); + } else if ( 0.5f == S ) { + Map->Scale( 0.75f ); + } else if ( 0.75f == S ) { + Map->Scale( 1.0f ); + } else if ( 1.0f == S ) { + Map->Scale( 1.5f ); + } else if ( 1.5f == S ) { + Map->Scale( 2.0f ); + } else if ( 2.0f == S ) { + Map->Scale( 3.0f ); + } else if ( 3.0f == S ) { + Map->Scale( 4.0f ); + } + } +} + +void cMapEditor::ZoomOut() { + cMap * Map = mUIMap->Map(); + eeFloat S = mUIMap->Map()->Scale(); + + if ( S > 0.0625f ) { + if ( 0.125f == S ) { + Map->Scale( 0.0625f ); + } else if ( 0.25f == S ) { + Map->Scale( 0.125f ); + } else if ( 0.5f == S ) { + Map->Scale( 0.25f ); + } else if ( 0.75f == S ) { + Map->Scale( 0.5f ); + } else if ( 1.0f == S ) { + Map->Scale( 0.75f ); + } else if ( 1.5f == S ) { + Map->Scale( 1.0f ); + } else if ( 2.0f == S ) { + Map->Scale( 1.5f ); + } else if ( 3.0f == S ) { + Map->Scale( 2.0f ); + } else if ( 4.0f == S ) { + Map->Scale( 3.0f ); + } } } diff --git a/src/gaming/mapeditor/cmapeditor.hpp b/src/gaming/mapeditor/cmapeditor.hpp index a79c901c2..826192a61 100644 --- a/src/gaming/mapeditor/cmapeditor.hpp +++ b/src/gaming/mapeditor/cmapeditor.hpp @@ -196,6 +196,10 @@ class EE_API cMapEditor { void SetViewOptions(); cGameObject * GetCurrentGOOver(); + + void ZoomIn(); + + void ZoomOut(); }; }}} diff --git a/src/gaming/mapeditor/cuimap.cpp b/src/gaming/mapeditor/cuimap.cpp index 5e512a9a6..b7c330839 100644 --- a/src/gaming/mapeditor/cuimap.cpp +++ b/src/gaming/mapeditor/cuimap.cpp @@ -158,16 +158,14 @@ void cUIMap::EditingLights( const bool& editing ) { void cUIMap::MapDraw() { if ( mEditingLights && NULL != mSelLight ) { - if ( Intersect( mMap->GetViewAreaAABB(), mSelLight->GetAABB() ) ) { - cPrimitives P; - P.SetColor( eeColorA( 255, 0, 0, (Uint8)mAlpha ) ); + cPrimitives P; + P.SetColor( eeColorA( 255, 0, 0, (Uint8)mAlpha ) ); - eeVector2f Pos( mSelLight->GetAABB().Left, mSelLight->GetAABB().Top ); - eeAABB AB( mSelLight->GetAABB() ); - eeSizef Size( AB.Size() ); + eeVector2f Pos( mSelLight->GetAABB().Left, mSelLight->GetAABB().Top ); + eeAABB AB( mSelLight->GetAABB() ); + eeSizef Size( AB.Size() ); - P.DrawRectangle( Pos.x, Pos.y, Size.Width(), Size.Height(), 0, 1, EE_DRAW_LINE ); - } + P.DrawRectangle( Pos.x, Pos.y, Size.Width(), Size.Height(), 0, 1, EE_DRAW_LINE ); } } diff --git a/src/graphics/renderer/cgl.cpp b/src/graphics/renderer/cgl.cpp index b123c492d..27d3559fa 100644 --- a/src/graphics/renderer/cgl.cpp +++ b/src/graphics/renderer/cgl.cpp @@ -365,11 +365,11 @@ eeVector3f cGL::ProjectCurrent( const eeVector3f& point ) { GLint viewPort[4]; GetViewport( viewPort ); - eeVector3f tv3; + Vector3 tv3; - Project( point.x, point.y, point.z, projMat, modelMat, viewPort, &tv3.x, &tv3.y, &tv3.z ); + Project( (GLfloat)point.x, (GLfloat)point.y, (GLfloat)point.z, projMat, modelMat, viewPort, &tv3.x, &tv3.y, &tv3.z ); - return tv3; + return eeVector3f( tv3.x, tv3.y, tv3.z ); } eeVector3f cGL::UnProjectCurrent( const eeVector3f& point ) { @@ -382,11 +382,11 @@ eeVector3f cGL::UnProjectCurrent( const eeVector3f& point ) { GLint viewPort[4]; GetViewport( viewPort ); - eeVector3f tv3; + Vector3 tv3; - UnProject( point.x, point.y, point.z, projMat, modelMat, viewPort, &tv3.x, &tv3.y, &tv3.z ); + UnProject( (GLfloat)point.x, (GLfloat)point.y, (GLfloat)point.z, projMat, modelMat, viewPort, &tv3.x, &tv3.y, &tv3.z ); - return tv3; + return eeVector3f( tv3.x, tv3.y, tv3.z ); } }} diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index ee0a4593a..6e6f388d6 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -1792,15 +1792,6 @@ void cEETest::End() { cEngine::DestroySingleton(); } -#if EE_PLATFORM == EE_PLATFORM_MACOSX -#ifdef EE_BACKEND_SDL_ACTIVE -#include -#endif -#ifdef EE_BACKEND_ALLEGRO_ACTIVE -#include -#endif -#endif - int main (int argc, char * argv []) { cEETest * Test = eeNew( cEETest, () ); diff --git a/src/ui/cuimenu.cpp b/src/ui/cuimenu.cpp index 0a763d24e..d698b69b5 100644 --- a/src/ui/cuimenu.cpp +++ b/src/ui/cuimenu.cpp @@ -329,7 +329,7 @@ Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) { switch ( Msg->Msg() ) { case cUIMessage::MsgMouseUp: { - if ( Msg->Sender()->Parent() == this && Msg->Sender()->Parent()->Visible() && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { + if ( Msg->Sender()->Parent() == this && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked ); SendEvent( &ItemEvent ); } diff --git a/src/ui/cuipopupmenu.cpp b/src/ui/cuipopupmenu.cpp index 0e9f353ee..a3e7bd17f 100644 --- a/src/ui/cuipopupmenu.cpp +++ b/src/ui/cuipopupmenu.cpp @@ -83,7 +83,8 @@ Uint32 cUIPopUpMenu::OnMessage( const cUIMessage * Msg ) { if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { SendCommonEvent( cUIEvent::EventOnHideByClick ); - cUIManager::instance()->MainControl()->SetFocus(); + if ( Visible() ) + cUIManager::instance()->MainControl()->SetFocus(); Hide(); } diff --git a/src/ui/cuiwindow.cpp b/src/ui/cuiwindow.cpp index f5c5e4210..60431d84d 100644 --- a/src/ui/cuiwindow.cpp +++ b/src/ui/cuiwindow.cpp @@ -760,6 +760,7 @@ void cUIWindow::CheckShortcuts( const Uint32& KeyCode, const Uint32& Mod ) { KeyboardShortcut kb = (*it); if ( KeyCode == kb.KeyCode && ( Mod & kb.Mod ) ) { + cUIManager::instance()->SendMouseUp( kb.Button, eeVector2i(0,0), EE_BUTTON_LMASK ); cUIManager::instance()->SendMouseClick( kb.Button, eeVector2i(0,0), EE_BUTTON_LMASK ); } } diff --git a/src/window/backend/SDL13/cwindowsdl.cpp b/src/window/backend/SDL13/cwindowsdl.cpp index 5091d8e1a..f55d3b024 100644 --- a/src/window/backend/SDL13/cwindowsdl.cpp +++ b/src/window/backend/SDL13/cwindowsdl.cpp @@ -310,9 +310,9 @@ std::vector< std::pair > cWindowSDL::GetPossibleReso } void cWindowSDL::SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue ) { - eeclamp( &Red , 0.1f, 10.0f ); - eeclamp( &Green , 0.1f, 10.0f ); - eeclamp( &Blue , 0.1f, 10.0f ); + eeclamp( &Red , (eeFloat)0.1f, (eeFloat)10.0f ); + eeclamp( &Green , (eeFloat)0.1f, (eeFloat)10.0f ); + eeclamp( &Blue , (eeFloat)0.1f, (eeFloat)10.0f ); Uint16 red_ramp[256]; Uint16 green_ramp[256];