diff --git a/ee.creator.user b/ee.creator.user index 0d654d45b..98594f8f6 100644 --- a/ee.creator.user +++ b/ee.creator.user @@ -38,9 +38,9 @@ GenericProjectManager.GenericTarget - 0 + 11 0 - 0 + 6 /home/programming/projects/EE INVALID @@ -158,6 +158,84 @@ debug-test-gles2 GenericProjectManager.GenericBuildConfiguration + + /home/programming/projects/EE + INVALID + + + + -j4 bnb -e DEBUGBUILD=yes BACKENDS_ALL=yes + + Make + Clone of + GenericProjectManager.GenericMakeStep + + 1 + Build + Clone of Build + ProjectExplorer.BuildSteps.Build + + + + -e DEBUGBUILD=yes clean + /usr/bin/make + true + %{buildDir} + Custom Process Step + Clone of clean + ProjectExplorer.ProcessStep + + 1 + Clean + Clone of Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + debug-test + bnb-test + GenericProjectManager.GenericBuildConfiguration + + + /home/programming/projects/EE + INVALID + + + + -j4 bnb -e DEBUGBUILD=no BACKENDS_ALL=yes + + Make + Clone of + GenericProjectManager.GenericMakeStep + + 1 + Build + Clone of Build + ProjectExplorer.BuildSteps.Build + + + + -e DEBUGBUILD=no clean + /usr/bin/make + true + %{buildDir} + Custom Process Step + Clone of clean + ProjectExplorer.ProcessStep + + 1 + Clean + Clone of Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + release-test + bnb-release + GenericProjectManager.GenericBuildConfiguration + /home/programming/projects/EE INVALID @@ -470,7 +548,7 @@ release-fluid GenericProjectManager.GenericBuildConfiguration - 11 + 13 0 @@ -706,7 +784,81 @@ true false - 6 + + + true + 25 + + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + /home/programming/projects/EE/bnb-debug + false + + /home/programming/projects/EE/ + Run /home/programming/projects/EE/bnb-debug + bnb-debug + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + true + false + + + + true + 25 + + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + /home/programming/projects/EE/bnb-release + false + + /home/programming/projects/EE/ + Run /home/programming/projects/EE/bnb-release + bnb-release + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + true + false + + 8 diff --git a/ee.files b/ee.files index 78bf0e2a8..6c721c106 100644 --- a/ee.files +++ b/ee.files @@ -802,3 +802,7 @@ src/system/cpackmanager.hpp src/system/cpackmanager.cpp src/gaming/clightmanager.hpp src/gaming/clightmanager.cpp +src/bnb/bnb.hpp +src/bnb/bnb.cpp +src/bnb/cgame.hpp +src/bnb/cgame.cpp diff --git a/src/gaming/cgameobject.cpp b/src/gaming/cgameobject.cpp index b5c535845..0522098d6 100644 --- a/src/gaming/cgameobject.cpp +++ b/src/gaming/cgameobject.cpp @@ -1,4 +1,5 @@ #include "cgameobject.hpp" +#include "ctilelayer.hpp" namespace EE { namespace Gaming { @@ -48,6 +49,10 @@ Uint32 cGameObject::IsBlocked() const { return mFlags & GObjFlags::GAMEOBJECT_BLOCKED; } +Uint32 cGameObject::IsRotated() const { + return mFlags & GObjFlags::GAMEOBJECT_ROTATE_90DEG; +} + void cGameObject::Draw() { } @@ -59,6 +64,14 @@ eeVector2f cGameObject::Pos() const { } void cGameObject::Pos( eeVector2f pos ) { + AutoFixTilePos(); +} + +eeVector2i cGameObject::TilePos() const { + return eeVector2i(); +} + +void cGameObject::TilePos( eeVector2i pos ) { } eeSize cGameObject::Size() { @@ -94,4 +107,31 @@ cLayer * cGameObject::Layer() const { return mLayer; } +void cGameObject::AutoFixTilePos() { + if ( ( mFlags & GObjFlags::GAMEOBJECT_AUTO_FIX_TILE_POS ) && NULL != mLayer && mLayer->Type() == MAP_LAYER_TILED ) { + eeVector2i CurPos = TilePos(); + + AssignTilePos(); + + if ( CurPos != TilePos() ) { + cTileLayer * TLayer = static_cast ( mLayer ); + + if ( TLayer->GetGameObject( CurPos ) == this ) { + TLayer->RemoveGameObject( CurPos ); + TLayer->AddGameObject( this, TilePos() ); + } + } + } +} + +void cGameObject::AssignTilePos() { + cTileLayer * TLayer = static_cast ( mLayer ); + + TilePos( TLayer->GetTilePosFromPos( Pos() ) ); +} + +eeFloat cGameObject::GetAngle() { + return IsRotated() ? 90 : 0; +} + }} diff --git a/src/gaming/cgameobject.hpp b/src/gaming/cgameobject.hpp index e3d6251a1..5fd25d021 100644 --- a/src/gaming/cgameobject.hpp +++ b/src/gaming/cgameobject.hpp @@ -24,6 +24,10 @@ class EE_API cGameObject { virtual void Pos( eeVector2f pos ); + virtual eeVector2i TilePos() const; + + virtual void TilePos( eeVector2i pos ); + virtual eeSize Size(); virtual Uint32 Type() const; @@ -44,6 +48,8 @@ class EE_API cGameObject { Uint32 IsBlocked() const; + Uint32 IsRotated() const; + virtual Uint32 DataId(); virtual void DataId( Uint32 Id ); @@ -54,6 +60,12 @@ class EE_API cGameObject { cLayer * mLayer; virtual EE_RENDERTYPE RenderTypeFromFlags(); + + void AutoFixTilePos(); + + void AssignTilePos(); + + eeFloat GetAngle(); }; }} diff --git a/src/gaming/cgameobjectshape.cpp b/src/gaming/cgameobjectshape.cpp index b0b2c3901..c8290d8dc 100644 --- a/src/gaming/cgameobjectshape.cpp +++ b/src/gaming/cgameobjectshape.cpp @@ -11,6 +11,7 @@ cGameObjectShape::cGameObjectShape( const Uint32& Flags, cLayer * Layer, cShape mShape( Shape ), mPos( Pos ) { + AssignTilePos(); } cGameObjectShape::~cGameObjectShape() { @@ -32,7 +33,7 @@ void cGameObjectShape::Draw() { mShape->Draw( mPos.x, mPos.y, - 0.f, + GetAngle(), 1.f, *LM->GetTileColor( Tile, 0 ), *LM->GetTileColor( Tile, 1 ), @@ -42,14 +43,14 @@ void cGameObjectShape::Draw() { RenderTypeFromFlags() ); } else { - mShape->Draw( mPos.x, mPos.y, *LM->GetTileColor( Tile ), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, *LM->GetTileColor( Tile ), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } else { if ( LM->IsByVertex() ) { mShape->Draw( mPos.x, mPos.y, - 0.f, + GetAngle(), 1.f, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y + mShape->DestHeight() ) ), @@ -59,11 +60,11 @@ void cGameObjectShape::Draw() { RenderTypeFromFlags() ); } else { - mShape->Draw( mPos.x, mPos.y, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } } else { - mShape->Draw( mPos.x, mPos.y, eeColorA(), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, eeColorA(), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } } @@ -72,6 +73,19 @@ eeVector2f cGameObjectShape::Pos() const { return mPos; } +void cGameObjectShape::Pos( eeVector2f pos ) { + mPos = pos; + cGameObject::Pos( pos ); +} + +eeVector2i cGameObjectShape::TilePos() const { + return mTilePos; +} + +void cGameObjectShape::TilePos( eeVector2i pos ) { + mTilePos = pos; +} + eeSize cGameObjectShape::Size() { if ( NULL != mShape ) return mShape->RealSize(); @@ -79,10 +93,6 @@ eeSize cGameObjectShape::Size() { return eeSize(); } -void cGameObjectShape::Pos( eeVector2f pos ) { - mPos = pos; -} - cShape * cGameObjectShape::Shape() const { return mShape; } diff --git a/src/gaming/cgameobjectshape.hpp b/src/gaming/cgameobjectshape.hpp index 4700536e4..0e66521e4 100644 --- a/src/gaming/cgameobjectshape.hpp +++ b/src/gaming/cgameobjectshape.hpp @@ -19,10 +19,14 @@ class EE_API cGameObjectShape : public cGameObject { virtual eeVector2f Pos() const; - virtual eeSize Size(); - virtual void Pos( eeVector2f pos ); + virtual eeVector2i TilePos() const; + + virtual void TilePos( eeVector2i pos ); + + virtual eeSize Size(); + cShape * Shape() const; void Shape( cShape * shape ); @@ -35,6 +39,7 @@ class EE_API cGameObjectShape : public cGameObject { protected: cShape * mShape; eeVector2f mPos; + eeVector2i mTilePos; }; }} diff --git a/src/gaming/cgameobjectshapeex.cpp b/src/gaming/cgameobjectshapeex.cpp index 8457218b7..d938ba795 100644 --- a/src/gaming/cgameobjectshapeex.cpp +++ b/src/gaming/cgameobjectshapeex.cpp @@ -14,6 +14,9 @@ cGameObjectShapeEx::cGameObjectShapeEx( const Uint32& Flags, cLayer * Layer, cSh mVertexColors( NULL ) { mRender = RenderTypeFromFlags(); + + if ( 0 == mAngle ) + mAngle = GetAngle(); } cGameObjectShapeEx::~cGameObjectShapeEx() diff --git a/src/gaming/cgameobjectsprite.cpp b/src/gaming/cgameobjectsprite.cpp index 51f8fb293..37ce1856f 100644 --- a/src/gaming/cgameobjectsprite.cpp +++ b/src/gaming/cgameobjectsprite.cpp @@ -11,6 +11,8 @@ cGameObjectSprite::cGameObjectSprite( const Uint32& Flags, cLayer * Layer, cSpri { if ( NULL != mSprite ) mSprite->SetRenderType( RenderTypeFromFlags() ); + + AssignTilePos(); } cGameObjectSprite::~cGameObjectSprite() { @@ -23,6 +25,8 @@ Uint32 cGameObjectSprite::Type() const { void cGameObjectSprite::Draw() { if ( NULL != mSprite ) { + mSprite->Angle( GetAngle() ); + if ( mLayer->Map()->LightsEnabled() && mLayer->LightsEnabled() ) { cLightManager * LM = mLayer->Map()->GetLightManager(); @@ -67,8 +71,18 @@ eeVector2f cGameObjectSprite::Pos() const { } void cGameObjectSprite::Pos( eeVector2f pos ) { - if ( NULL != mSprite ) + if ( NULL != mSprite ) { mSprite->Position( pos ); + cGameObject::Pos( pos ); + } +} + +eeVector2i cGameObjectSprite::TilePos() const { + return mTilePos; +} + +void cGameObjectSprite::TilePos( eeVector2i pos ) { + mTilePos = pos; } eeSize cGameObjectSprite::Size() { diff --git a/src/gaming/cgameobjectsprite.hpp b/src/gaming/cgameobjectsprite.hpp index b769464e2..590c62cec 100644 --- a/src/gaming/cgameobjectsprite.hpp +++ b/src/gaming/cgameobjectsprite.hpp @@ -21,6 +21,10 @@ class EE_API cGameObjectSprite : public cGameObject { virtual void Pos( eeVector2f pos ); + virtual eeVector2i TilePos() const; + + virtual void TilePos( eeVector2i pos ); + virtual eeSize Size(); cSprite * Sprite() const; @@ -36,6 +40,7 @@ class EE_API cGameObjectSprite : public cGameObject { virtual void DataId( Uint32 Id ); private: cSprite * mSprite; + eeVector2i mTilePos; }; }} diff --git a/src/gaming/cgameobjectvirtual.cpp b/src/gaming/cgameobjectvirtual.cpp index 5265929e4..816c3af3f 100644 --- a/src/gaming/cgameobjectvirtual.cpp +++ b/src/gaming/cgameobjectvirtual.cpp @@ -23,7 +23,7 @@ cGameObjectVirtual::cGameObjectVirtual( cShape * Shape, cLayer * Layer, const Ui mType( Type ), mDataId( 0 ), mPos( Pos ), - mLayer( NULL ), + mLayer( Layer ), mShape( Shape ) { if ( NULL != Shape ) @@ -63,7 +63,7 @@ void cGameObjectVirtual::Draw() { mShape->Draw( mPos.x, mPos.y, - 0.f, + GetAngle(), 1.f, *LM->GetTileColor( Tile, 0 ), *LM->GetTileColor( Tile, 1 ), @@ -73,14 +73,14 @@ void cGameObjectVirtual::Draw() { RenderTypeFromFlags() ); } else { - mShape->Draw( mPos.x, mPos.y, *LM->GetTileColor( Tile ), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, *LM->GetTileColor( Tile ), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } else { if ( LM->IsByVertex() ) { mShape->Draw( mPos.x, mPos.y, - 0.f, + GetAngle(), 1.f, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y + mShape->DestHeight() ) ), @@ -90,11 +90,11 @@ void cGameObjectVirtual::Draw() { RenderTypeFromFlags() ); } else { - mShape->Draw( mPos.x, mPos.y, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, LM->GetColorFromPos( eeVector2f( mPos.x, mPos.y ) ), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } } else { - mShape->Draw( mPos.x, mPos.y, eeColorA(), 0.f, 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); + mShape->Draw( mPos.x, mPos.y, eeColorA(), GetAngle(), 1.f, ALPHA_NORMAL, RenderTypeFromFlags() ); } } else { cPrimitives P; diff --git a/src/gaming/cmap.cpp b/src/gaming/cmap.cpp index 58cc29e26..83b142e90 100644 --- a/src/gaming/cmap.cpp +++ b/src/gaming/cmap.cpp @@ -206,13 +206,10 @@ void cMap::Draw() { } void cMap::MouseOverDraw() { - if ( !DrawTileOver() ) + if ( !DrawTileOver() || NULL == mTileTex ) return; - cPrimitives P; - P.SetColor( eeColorA( 255, 0, 0, 255 ) ); - - P.DrawRectangle( mOffsetFixed.x + mMouseOverTileFinal.x * mTileSize.x, mOffsetFixed.y + mMouseOverTileFinal.y * mTileSize.y, mTileSize.x, mTileSize.y, 0.f, 1.f, EE_DRAW_LINE ); + mTileTex->Draw( mOffsetFixed.x + mMouseOverTileFinal.x * mTileSize.x, mOffsetFixed.y + mMouseOverTileFinal.y * mTileSize.y, 0, 1, eeColorA( 255, 0, 0, 200 ) ); } void cMap::GridDraw() { @@ -227,7 +224,7 @@ void cMap::GridDraw() { if ( !DrawGrid() ) return; - if ( 0 == mSize.x || 0 == mSize.y ) + if ( 0 == mSize.x || 0 == mSize.y || NULL == mTileTex ) return; cGlobalBatchRenderer::instance()->Draw(); @@ -440,6 +437,14 @@ void cMap::DrawBackground( const bool& draw ) { SetFlagValue( &mFlags, MAP_FLAG_DRAW_BACKGROUND, draw ? 1 : 0 ); } +void cMap::ShowBlocked( const bool& show ) { + SetFlagValue( &mFlags, MAP_FLAG_SHOW_BLOCKED, show ? 1 : 0 ); +} + +Uint32 cMap::ShowBlocked() const { + return mFlags & MAP_FLAG_SHOW_BLOCKED; +} + Uint32 cMap::DrawBackground() const { return mFlags & MAP_FLAG_DRAW_BACKGROUND; } @@ -1133,4 +1138,8 @@ void cMap::SetUpdateCallback( MapUpdateCb Cb ) { mUpdateCb = Cb; } +cTexture * cMap::GetBlankTileTexture() { + return mTileTex; +} + }} diff --git a/src/gaming/cmap.hpp b/src/gaming/cmap.hpp index 21497ead4..e3f10fa2e 100644 --- a/src/gaming/cmap.hpp +++ b/src/gaming/cmap.hpp @@ -97,6 +97,10 @@ class EE_API cMap { Uint32 DrawGrid() const; + void ShowBlocked( const bool& show ); + + Uint32 ShowBlocked() const; + void DrawBackground( const bool& draw ); Uint32 DrawBackground() const; @@ -165,6 +169,8 @@ class EE_API cMap { void SetDrawCallback( MapDrawCb Cb ); void SetUpdateCallback( MapUpdateCb Cb ); + + cTexture * GetBlankTileTexture(); protected: Window::cWindow * mWindow; cLayer** mLayers; diff --git a/src/gaming/cobjectlayer.cpp b/src/gaming/cobjectlayer.cpp index 0c0c55dc9..3f56a596e 100644 --- a/src/gaming/cobjectlayer.cpp +++ b/src/gaming/cobjectlayer.cpp @@ -29,14 +29,28 @@ void cObjectLayer::DeallocateLayer() { void cObjectLayer::Draw( const eeVector2f &Offset ) { cGlobalBatchRenderer::instance()->Draw(); + ObjList::iterator it; + GLi->LoadIdentity(); GLi->PushMatrix(); GLi->Translatef( mOffset.x + Offset.x, mOffset.y + Offset.y, 0.0f ); - for ( ObjList::iterator it = mObjects.begin(); it != mObjects.end(); it++ ) { + for ( it = mObjects.begin(); it != mObjects.end(); it++ ) { (*it)->Draw(); } + cTexture * Tex = mMap->GetBlankTileTexture(); + + if ( mMap->ShowBlocked() && NULL != Tex ) { + eeColorA Col( 255, 0, 0, 200 ); + + for ( it = mObjects.begin(); it != mObjects.end(); it++ ) { + cGameObject * Obj = (*it); + + Tex->DrawEx( Obj->Pos().x, Obj->Pos().y, Obj->Size().Width(), Obj->Size().Height(), 0, 1, Col, Col, Col, Col ); + } + } + cGlobalBatchRenderer::instance()->Draw(); GLi->PopMatrix(); diff --git a/src/gaming/ctilelayer.cpp b/src/gaming/ctilelayer.cpp index 970c5138e..562231ff6 100644 --- a/src/gaming/ctilelayer.cpp +++ b/src/gaming/ctilelayer.cpp @@ -39,6 +39,20 @@ void cTileLayer::cTileLayer::Draw( const eeVector2f &Offset ) { } } + cTexture * Tex = mMap->GetBlankTileTexture(); + + if ( mMap->ShowBlocked() && NULL != Tex ) { + for ( Int32 x = start.x; x < end.x; x++ ) { + for ( Int32 y = start.y; y < end.y; y++ ) { + if ( NULL != mTiles[x][y] ) { + if ( mTiles[x][y]->IsBlocked() ) { + Tex->Draw( x * mMap->TileSize().x, y * mMap->TileSize().y, 0 , 1, eeColorA( 255, 0, 0, 200 ) ); + } + } + } + } + } + cGlobalBatchRenderer::instance()->Draw(); GLi->PopMatrix(); @@ -120,4 +134,8 @@ const eeVector2i& cTileLayer::GetCurrentTile() const { return mCurTile; } +eeVector2i cTileLayer::GetTilePosFromPos( const eeVector2f& Pos ) { + return eeVector2i( ( (Int32)Pos.x + mOffset.x ) / mMap->TileSize().x, ( (Int32)Pos.y + mOffset.y ) / mMap->TileSize().y ); +} + }} diff --git a/src/gaming/ctilelayer.hpp b/src/gaming/ctilelayer.hpp index f169972f2..3f91354ed 100644 --- a/src/gaming/ctilelayer.hpp +++ b/src/gaming/ctilelayer.hpp @@ -23,6 +23,8 @@ class EE_API cTileLayer : public cLayer { virtual cGameObject * GetGameObject( const eeVector2i& TilePos ); const eeVector2i& GetCurrentTile() const; + + eeVector2i GetTilePosFromPos( const eeVector2f& Pos ); protected: friend class cMap; diff --git a/src/gaming/mapeditor/cmapeditor.cpp b/src/gaming/mapeditor/cmapeditor.cpp index 1495aaa59..b91fbc189 100644 --- a/src/gaming/mapeditor/cmapeditor.cpp +++ b/src/gaming/mapeditor/cmapeditor.cpp @@ -87,11 +87,13 @@ void cMapEditor::CreateWinMenu() { WinMenu->AddMenuButton( "File", PU1 ); cUIPopUpMenu * PU3 = mTheme->CreatePopUpMenu(); - PU3->AddCheckBox( "Show Grid" ); + mChkShowGrid = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Grid" ) ) ); - reinterpret_cast ( PU3->GetItem( "Show Grid" ) )->Active( true ); + mChkShowGrid->Active( true ); - PU3->AddCheckBox( "Mark Tile Over" ); + mChkMarkTileOver = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Mark Tile Over" ) ) ); + + mChkShowBlocked = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Blocked" ) ) ); PU3->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cMapEditor::ViewMenuClick ) ); WinMenu->AddMenuButton( "View", PU3 ); @@ -167,6 +169,16 @@ void cMapEditor::CreateETGMenu() { CreateShapeContainer( Width ); } +void cMapEditor::FillGotyList() { + std::vector items; + items.push_back( "Shape" ); + items.push_back( "ShapeEx" ); + items.push_back( "Sprite" ); + mGOTypeList->ListBox()->Clear(); + mGOTypeList->ListBox()->AddListBoxItems( items ); + mGOTypeList->ListBox()->SetSelected(0); +} + void cMapEditor::CreateShapeContainer( Int32 Width ) { cUITextBox * Txt; Uint32 TxtFlags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP | UI_DRAW_SHADOW; @@ -175,13 +187,8 @@ void cMapEditor::CreateShapeContainer( Int32 Width ) { Txt->Text( "Add Game Object as..." ); mGOTypeList = mTheme->CreateDropDownList( mShapeCont, eeSize( Width - 26, 21 ), eeVector2i( 0, Txt->Pos().y + Txt->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); - std::vector items; - items.push_back( "Shape" ); - items.push_back( "ShapeEx" ); - items.push_back( "Sprite" ); - mGOTypeList->ListBox()->AddListBoxItems( items ); mGOTypeList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &cMapEditor::OnTypeChange ) ); - mGOTypeList->ListBox()->SetSelected(0); + FillGotyList(); mBtnGOTypeAdd = mTheme->CreatePushButton( mShapeCont, eeSize( 24, 21 ), eeVector2i( mGOTypeList->Pos().x + mGOTypeList->Size().Width() + 2, mGOTypeList->Pos().y ), UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mTheme->GetIconByName( "add" ) ); mBtnGOTypeAdd->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cMapEditor::AddNewGOType ) ); @@ -216,7 +223,15 @@ void cMapEditor::CreateShapeContainer( Int32 Width ) { mChkAnim->Text( "Animated" ); mChkAnim->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cMapEditor::ChkClickAnimated ) ); - Txt = mTheme->CreateTextBox( mShapeCont, eeSize( Width, 16 ), eeVector2i( 0, mChkBlocked->Pos().y + mChkBlocked->Size().Height() + 8 ), TxtFlags ); + mChkRot90 = mTheme->CreateCheckBox( mShapeCont, eeSize(), eeVector2i( mChkBlocked->Pos().x, mChkBlocked->Pos().y + mChkBlocked->Size().Height() + 4 ), ChkFlags ); + mChkRot90->Text( String::FromUtf8( "Rotate 90ยบ" ) ); + mChkRot90->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cMapEditor::ChkClickRot90 ) ); + + mChkAutoFix = mTheme->CreateCheckBox( mShapeCont, eeSize(), eeVector2i( mChkAnim->Pos().x, mChkAnim->Pos().y + mChkAnim->Size().Height() + 4 ), ChkFlags ); + mChkAutoFix->Text( "AutoFix TilePos" ); + mChkAutoFix->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cMapEditor::ChkClickAutoFix ) ); + + Txt = mTheme->CreateTextBox( mShapeCont, eeSize( Width, 16 ), eeVector2i( 0, mChkRot90->Pos().y + mChkRot90->Size().Height() + 8 ), TxtFlags ); Txt->Text( "Game Object Data:" ); mChkDI = mTheme->CreateCheckBox( mShapeCont, eeSize(), eeVector2i( 0, Txt->Pos().y + Txt->Size().Height() + 4 ), ChkFlags ); @@ -470,6 +485,11 @@ void cMapEditor::UpdateGfx() { mGfxPreview->RenderType( RN_FLIP ); else mGfxPreview->RenderType( RN_NORMAL ); + + if ( mChkRot90->Active() ) + mGfxPreview->Angle( 90 ); + else + mGfxPreview->Angle( 0 ); } void cMapEditor::UpdateFlags() { @@ -486,6 +506,12 @@ void cMapEditor::UpdateFlags() { if ( mChkAnim->Active() ) mCurGOFlags |= GObjFlags::GAMEOBJECT_ANIMATED; + + if ( mChkRot90->Active() ) + mCurGOFlags |= GObjFlags::GAMEOBJECT_ROTATE_90DEG; + + if ( mChkAutoFix->Active() ) + mCurGOFlags |= GObjFlags::GAMEOBJECT_AUTO_FIX_TILE_POS; } void cMapEditor::OnTypeChange( const cUIEvent * Event ) { @@ -515,10 +541,19 @@ void cMapEditor::ChkClickFliped( const cUIEvent * Event ) { UpdateFlags(); } +void cMapEditor::ChkClickRot90( const cUIEvent * Event ) { + UpdateGfx(); + UpdateFlags(); +} + void cMapEditor::ChkClickBlocked( const cUIEvent * Event ) { UpdateFlags(); } +void cMapEditor::ChkClickAutoFix( const cUIEvent * Event ) { + UpdateFlags(); +} + void cMapEditor::ChkClickAnimated( const cUIEvent * Event ) { UpdateFlags(); @@ -620,7 +655,9 @@ void cMapEditor::CreateNewEmptyMap() { void cMapEditor::MapCreated() { mCurLayer = NULL; mLayerList->ListBox()->Clear(); + SetViewOptions(); FillSGCombo(); + FillGotyList(); mMapHScroll->Value( 0 ); mMapVScroll->Value( 0 ); @@ -691,6 +728,8 @@ void cMapEditor::MapOpen( const cUIEvent * Event ) { MapCreated(); RefreshLayersList(); + + RefreshGotyList(); } } @@ -761,8 +800,11 @@ void cMapEditor::ViewMenuClick( const cUIEvent * Event ) { mUIMap->Map()->DrawGrid( reinterpret_cast ( Event->Ctrl() )->Active() ); } else if ( "Mark Tile Over" == txt ) { mUIMap->Map()->DrawTileOver( reinterpret_cast ( Event->Ctrl() )->Active() ); + } else if ( "Show Blocked" == txt ) { + mUIMap->Map()->ShowBlocked( reinterpret_cast ( Event->Ctrl() )->Active() ); } } + void cMapEditor::MapMenuClick( const cUIEvent * Event ) { if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) ) return; @@ -842,6 +884,14 @@ void cMapEditor::RemoveLayer() { } } +void cMapEditor::RefreshGotyList() { + cMap::GOTypesList& GOList = mUIMap->Map()->GetVirtualObjectTypes(); + + for ( cMap::GOTypesList::iterator it = GOList.begin(); it != GOList.end(); it++ ) { + mGOTypeList->ListBox()->AddListBoxItem( (*it) ); + } +} + void cMapEditor::RefreshLayersList() { mLayerList->ListBox()->Clear(); @@ -1027,4 +1077,10 @@ void cMapEditor::OnMapMouseDown( const cUIEvent * Event ) { } } +void cMapEditor::SetViewOptions() { + mChkShowGrid->Active( mUIMap->Map()->DrawGrid() ? true : false ); + mChkMarkTileOver->Active( mUIMap->Map()->DrawTileOver() ? true : false ); + mChkShowBlocked->Active( mUIMap->Map()->ShowBlocked() ? true : false ); +} + }}} diff --git a/src/gaming/mapeditor/cmapeditor.hpp b/src/gaming/mapeditor/cmapeditor.hpp index ac42c493d..e1ee8ffcf 100644 --- a/src/gaming/mapeditor/cmapeditor.hpp +++ b/src/gaming/mapeditor/cmapeditor.hpp @@ -38,6 +38,8 @@ class EE_API cMapEditor { cUICheckBox * mChkFliped; cUICheckBox * mChkBlocked; cUICheckBox * mChkAnim; + cUICheckBox * mChkRot90; + cUICheckBox * mChkAutoFix; cLayer * mCurLayer; cUIPushButton * mBtnGOTypeAdd; Uint32 mCurGOType; @@ -52,6 +54,9 @@ class EE_API cMapEditor { cUIMenuCheckBox * mLayerChkLights; cUIPushButton * mShapeContBut; cUIPushButton * mLightContBut; + cUIMenuCheckBox * mChkShowGrid; + cUIMenuCheckBox * mChkMarkTileOver; + cUIMenuCheckBox * mChkShowBlocked; //! Light Color cUIComplexControl * mUIBaseColor; @@ -128,6 +133,10 @@ class EE_API cMapEditor { void ChkClickAnimated( const cUIEvent * Event ); + void ChkClickRot90( const cUIEvent * Event ); + + void ChkClickAutoFix( const cUIEvent * Event ); + void ChkClickDI( const cUIEvent * Event ); void OnMapMouseDown( const cUIEvent * Event ); @@ -179,6 +188,12 @@ class EE_API cMapEditor { void RefreshLayersList(); void CreateNewEmptyMap(); + + void FillGotyList(); + + void RefreshGotyList(); + + void SetViewOptions(); }; }}} diff --git a/src/gaming/maphelper.hpp b/src/gaming/maphelper.hpp index 8e795cc14..34e18bf55 100644 --- a/src/gaming/maphelper.hpp +++ b/src/gaming/maphelper.hpp @@ -71,11 +71,13 @@ typedef struct sMapLightHdrS { class GObjFlags { public: enum EE_GAMEOBJECT_FLAGS { - GAMEOBJECT_STATIC = ( 1 << 0 ), - GAMEOBJECT_ANIMATED = ( 1 << 1 ), - GAMEOBJECT_MIRRORED = ( 1 << 2 ), - GAMEOBJECT_FLIPED = ( 1 << 3 ), - GAMEOBJECT_BLOCKED = ( 1 << 4 ) + GAMEOBJECT_STATIC = ( 1 << 0 ), + GAMEOBJECT_ANIMATED = ( 1 << 1 ), + GAMEOBJECT_MIRRORED = ( 1 << 2 ), + GAMEOBJECT_FLIPED = ( 1 << 3 ), + GAMEOBJECT_BLOCKED = ( 1 << 4 ), + GAMEOBJECT_ROTATE_90DEG = ( 1 << 5 ), + GAMEOBJECT_AUTO_FIX_TILE_POS = ( 1 << 6 ) }; }; @@ -99,7 +101,8 @@ enum EE_MAP_FLAGS { MAP_FLAG_DRAW_TILE_OVER = ( 1 << 3 ), MAP_FLAG_DRAW_BACKGROUND = ( 1 << 4 ), MAP_FLAG_LIGHTS_ENABLED = ( 1 << 5 ), - MAP_FLAG_LIGHTS_BYVERTEX = ( 1 << 6 ) + MAP_FLAG_LIGHTS_BYVERTEX = ( 1 << 6 ), + MAP_FLAG_SHOW_BLOCKED = ( 1 << 7 ) }; #define MAP_EDITOR_DEFAULT_FLAGS ( MAP_FLAG_CLAMP_BORDERS | MAP_FLAG_CLIP_AREA | MAP_FLAG_DRAW_GRID | MAP_FLAG_DRAW_BACKGROUND ) diff --git a/src/graphics/cconsole.cpp b/src/graphics/cconsole.cpp index 88a999366..5bbc3fe55 100755 --- a/src/graphics/cconsole.cpp +++ b/src/graphics/cconsole.cpp @@ -425,7 +425,7 @@ void cConsole::CreateDefaultCommands() { AddCommand( "cmdlist", cb::Make1( this, &cConsole::CmdCmdList) ); AddCommand( "help", cb::Make1( this, &cConsole::CmdCmdList) ); AddCommand( "showcursor", cb::Make1( this, &cConsole::CmdShowCursor) ); - AddCommand( "setframelimit", cb::Make1( this, &cConsole::CmdFrameLimit) ); + AddCommand( "setfpslimit", cb::Make1( this, &cConsole::CmdFrameLimit) ); AddCommand( "getlog", cb::Make1( this, &cConsole::CmdGetLog) ); AddCommand( "setgamma", cb::Make1( this, &cConsole::CmdSetGamma) ); AddCommand( "setvolume", cb::Make1( this, &cConsole::CmdSetVolume) ); @@ -506,7 +506,7 @@ void cConsole::CmdFrameLimit ( const std::vector < String >& params ) { if ( Res && ( tInt >= 0 && tInt <= 10000 ) ) { mWindow->FrameRateLimit( tInt ); - PushText( "setframelimit " + toStr( tInt ) ); + PushText( "setfpslimit " + toStr( tInt ) ); } else PushText( "Valid parameters are between 0 and 10000 (0 = no limit)." ); } catch (...) { diff --git a/src/graphics/cconsole.hpp b/src/graphics/cconsole.hpp index 8364bd4e8..03aa70d4e 100755 --- a/src/graphics/cconsole.hpp +++ b/src/graphics/cconsole.hpp @@ -194,7 +194,7 @@ class EE_API cConsole{ /** Internal Callback for default command ( showcursor ) */ void CmdShowCursor ( const std::vector < String >& params ); - /** Internal Callback for default command ( setframelimit ) */ + /** Internal Callback for default command ( setfpslimit ) */ void CmdFrameLimit ( const std::vector < String >& params ); /** Internal Callback for default command ( getlog ) */ diff --git a/src/system/cinifile.cpp b/src/system/cinifile.cpp index 12c19b43a..0132f6321 100755 --- a/src/system/cinifile.cpp +++ b/src/system/cinifile.cpp @@ -88,7 +88,7 @@ bool cIniFile::ReadFile() { break; case '=': valuename = Trim( line.substr ( 0, pLeft ) ); // Remove the extra space between valuename and = . No spaced valuename permited. - value = line.substr ( pLeft + 1 ); + value = LTrim( line.substr ( pLeft + 1 ) ); SetValue ( keyname, valuename, value ); break; case ';': diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 31e425618..d11c63733 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -101,7 +101,7 @@ void cEETest::Init() { if ( Mus->OpenFromPack( PAK, "music.ogg" ) ) { Mus->Loop(true); - Mus->Volume( 100.f ); + Mus->Volume( 0.f ); Mus->Play(); } @@ -829,7 +829,7 @@ void cEETest::LoadTextures() { CL2.AddFrame(TN[0], 96, 96); CL2.Color( eeColorA( 255, 255, 255, 255 ) ); - mTGL = eeNew( cTextureGroupLoader, ( MyPath + "data/bnb/bnb.etg" ) ); + mTGL = eeNew( cTextureGroupLoader, ( MyPath + "data/bnb/gfx/bnb.etg" ) ); mBlindy.AddFramesByPattern( "rn" ); mBlindy.Position( 320.f, 0.f );