mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Some minor fixes to the Map system and Map Editor.
This commit is contained in:
@@ -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<cTileLayer *> ( mLayer );
|
||||
|
||||
if ( TLayer->GetGameObject( CurPos ) == this ) {
|
||||
TLayer->RemoveGameObject( CurPos );
|
||||
TLayer->AddGameObject( this, TilePos() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cGameObject::AssignTilePos() {
|
||||
cTileLayer * TLayer = static_cast<cTileLayer *> ( mLayer );
|
||||
|
||||
TilePos( TLayer->GetTilePosFromPos( Pos() ) );
|
||||
}
|
||||
|
||||
eeFloat cGameObject::GetAngle() {
|
||||
return IsRotated() ? 90 : 0;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -14,6 +14,9 @@ cGameObjectShapeEx::cGameObjectShapeEx( const Uint32& Flags, cLayer * Layer, cSh
|
||||
mVertexColors( NULL )
|
||||
{
|
||||
mRender = RenderTypeFromFlags();
|
||||
|
||||
if ( 0 == mAngle )
|
||||
mAngle = GetAngle();
|
||||
}
|
||||
|
||||
cGameObjectShapeEx::~cGameObjectShapeEx()
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -87,11 +87,13 @@ void cMapEditor::CreateWinMenu() {
|
||||
WinMenu->AddMenuButton( "File", PU1 );
|
||||
|
||||
cUIPopUpMenu * PU3 = mTheme->CreatePopUpMenu();
|
||||
PU3->AddCheckBox( "Show Grid" );
|
||||
mChkShowGrid = reinterpret_cast<cUIMenuCheckBox*>( PU3->GetItem( PU3->AddCheckBox( "Show Grid" ) ) );
|
||||
|
||||
reinterpret_cast<cUIMenuCheckBox*> ( PU3->GetItem( "Show Grid" ) )->Active( true );
|
||||
mChkShowGrid->Active( true );
|
||||
|
||||
PU3->AddCheckBox( "Mark Tile Over" );
|
||||
mChkMarkTileOver = reinterpret_cast<cUIMenuCheckBox*>( PU3->GetItem( PU3->AddCheckBox( "Mark Tile Over" ) ) );
|
||||
|
||||
mChkShowBlocked = reinterpret_cast<cUIMenuCheckBox*>( 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<String> 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<String> 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<cUIMenuCheckBox*> ( Event->Ctrl() )->Active() );
|
||||
} else if ( "Mark Tile Over" == txt ) {
|
||||
mUIMap->Map()->DrawTileOver( reinterpret_cast<cUIMenuCheckBox*> ( Event->Ctrl() )->Active() );
|
||||
} else if ( "Show Blocked" == txt ) {
|
||||
mUIMap->Map()->ShowBlocked( reinterpret_cast<cUIMenuCheckBox*> ( 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 );
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 (...) {
|
||||
|
||||
@@ -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 ) */
|
||||
|
||||
@@ -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 ';':
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user