2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
2011-04-19 08:34:51 +00:00
# ifndef GAME_EDITOR_EDITOR_H
# define GAME_EDITOR_EDITOR_H
2010-05-29 07:25:38 +00:00
2011-07-08 23:09:06 +00:00
# include <base/system.h>
2020-09-26 19:41:58 +00:00
# include <game/client/render.h>
2011-07-08 23:09:06 +00:00
# include <game/client/ui.h>
2010-05-29 07:25:38 +00:00
# include <game/mapitems.h>
2022-08-10 01:51:03 +00:00
# include <game/mapitems_ex.h>
2010-05-29 07:25:38 +00:00
# include <engine/editor.h>
# include <engine/graphics.h>
2011-07-08 23:09:06 +00:00
# include "auto_map.h"
2010-05-29 07:25:38 +00:00
2022-05-18 16:00:05 +00:00
# include <chrono>
2022-11-05 13:16:00 +00:00
# include <set>
# include <string>
# include <vector>
2022-05-18 16:00:05 +00:00
using namespace std : : chrono_literals ;
2010-05-29 07:25:38 +00:00
typedef void ( * INDEX_MODIFY_FUNC ) ( int * pIndex ) ;
//CRenderTools m_RenderTools;
// CEditor SPECIFIC
enum
{
2020-09-26 19:41:58 +00:00
MODE_LAYERS = 0 ,
2010-05-29 07:25:38 +00:00
MODE_IMAGES ,
2014-10-08 12:50:25 +00:00
MODE_SOUNDS ,
2011-04-13 18:37:12 +00:00
2020-09-26 19:41:58 +00:00
DIALOG_NONE = 0 ,
2010-05-29 07:25:38 +00:00
DIALOG_FILE ,
} ;
class CEnvelope
{
public :
int m_Channels ;
2022-06-11 19:38:18 +00:00
std : : vector < CEnvPoint > m_vPoints ;
2010-05-29 07:25:38 +00:00
char m_aName [ 32 ] ;
float m_Bottom , m_Top ;
2011-12-04 13:34:27 +00:00
bool m_Synchronized ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CEnvelope ( int Chan )
{
m_Channels = Chan ;
m_aName [ 0 ] = 0 ;
m_Bottom = 0 ;
m_Top = 0 ;
2016-05-13 22:42:40 +00:00
m_Synchronized = false ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void Resort ( )
{
2022-06-11 19:38:18 +00:00
std : : sort ( m_vPoints . begin ( ) , m_vPoints . end ( ) ) ;
2010-05-29 07:25:38 +00:00
FindTopBottom ( 0xf ) ;
}
void FindTopBottom ( int ChannelMask )
{
m_Top = - 1000000000.0f ;
m_Bottom = 1000000000.0f ;
2022-06-11 19:38:18 +00:00
for ( auto & Point : m_vPoints )
2010-05-29 07:25:38 +00:00
{
for ( int c = 0 ; c < m_Channels ; c + + )
{
2020-09-26 19:41:58 +00:00
if ( ChannelMask & ( 1 < < c ) )
2010-05-29 07:25:38 +00:00
{
2022-05-24 09:24:33 +00:00
float v = fx2f ( Point . m_aValues [ c ] ) ;
2020-09-26 19:41:58 +00:00
if ( v > m_Top )
m_Top = v ;
if ( v < m_Bottom )
m_Bottom = v ;
2010-05-29 07:25:38 +00:00
}
}
}
}
2011-04-13 18:37:12 +00:00
2022-07-01 04:42:36 +00:00
int Eval ( float Time , ColorRGBA & Color )
2010-05-29 07:25:38 +00:00
{
2022-07-01 04:42:36 +00:00
CRenderTools : : RenderEvalEnvelope ( & m_vPoints [ 0 ] , m_vPoints . size ( ) , m_Channels , std : : chrono : : nanoseconds ( ( int64_t ) ( ( double ) Time * ( double ) std : : chrono : : nanoseconds ( 1 s ) . count ( ) ) ) , Color ) ;
2010-05-29 07:25:38 +00:00
return m_Channels ;
}
2011-04-13 18:37:12 +00:00
2020-09-26 19:41:58 +00:00
void AddPoint ( int Time , int v0 , int v1 = 0 , int v2 = 0 , int v3 = 0 )
2010-05-29 07:25:38 +00:00
{
CEnvPoint p ;
p . m_Time = Time ;
p . m_aValues [ 0 ] = v0 ;
p . m_aValues [ 1 ] = v1 ;
p . m_aValues [ 2 ] = v2 ;
p . m_aValues [ 3 ] = v3 ;
p . m_Curvetype = CURVETYPE_LINEAR ;
2022-06-11 19:38:18 +00:00
m_vPoints . push_back ( p ) ;
2010-05-29 07:25:38 +00:00
Resort ( ) ;
}
2011-04-13 18:37:12 +00:00
2021-02-08 21:26:26 +00:00
float EndTime ( ) const
2010-05-29 07:25:38 +00:00
{
2022-06-11 19:38:18 +00:00
if ( ! m_vPoints . empty ( ) )
return m_vPoints [ m_vPoints . size ( ) - 1 ] . m_Time * ( 1.0f / 1000.0f ) ;
2010-05-29 07:25:38 +00:00
return 0 ;
}
} ;
class CLayerGroup ;
class CLayer
{
public :
class CEditor * m_pEditor ;
class IGraphics * Graphics ( ) ;
class ITextRender * TextRender ( ) ;
CLayer ( )
{
m_Type = LAYERTYPE_INVALID ;
2011-07-12 01:14:46 +00:00
str_copy ( m_aName , " (invalid) " , sizeof ( m_aName ) ) ;
2010-05-29 07:25:38 +00:00
m_Visible = true ;
m_Readonly = false ;
m_Flags = 0 ;
2022-06-13 16:28:13 +00:00
m_pEditor = nullptr ;
2018-10-02 01:52:01 +00:00
m_BrushRefCount = 0 ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2022-08-17 23:07:16 +00:00
CLayer ( const CLayer & Other )
{
str_copy ( m_aName , Other . m_aName , sizeof ( m_aName ) ) ;
m_Flags = Other . m_Flags ;
m_pEditor = Other . m_pEditor ;
m_Type = Other . m_Type ;
m_BrushRefCount = 0 ;
m_Visible = true ;
m_Readonly = false ;
}
2010-05-29 07:25:38 +00:00
virtual ~ CLayer ( )
{
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
virtual void BrushSelecting ( CUIRect Rect ) { }
virtual int BrushGrab ( CLayerGroup * pBrush , CUIRect Rect ) { return 0 ; }
virtual void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) { }
virtual void BrushDraw ( CLayer * pBrush , float x , float y ) { }
virtual void BrushPlace ( CLayer * pBrush , float x , float y ) { }
virtual void BrushFlipX ( ) { }
virtual void BrushFlipY ( ) { }
virtual void BrushRotate ( float Amount ) { }
2011-04-13 18:37:12 +00:00
2018-08-19 17:05:42 +00:00
virtual void Render ( bool Tileset = false ) { }
2010-05-29 07:25:38 +00:00
virtual int RenderProperties ( CUIRect * pToolbox ) { return 0 ; }
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
virtual void ModifyImageIndex ( INDEX_MODIFY_FUNC pfnFunc ) { }
virtual void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC pfnFunc ) { }
2014-10-11 11:38:45 +00:00
virtual void ModifySoundIndex ( INDEX_MODIFY_FUNC pfnFunc ) { }
2011-04-13 18:37:12 +00:00
2022-08-17 23:07:16 +00:00
virtual CLayer * Duplicate ( ) const = 0 ;
2022-06-30 22:36:32 +00:00
virtual void GetSize ( float * pWidth , float * pHeight )
2020-09-26 19:41:58 +00:00
{
2022-06-30 22:36:32 +00:00
* pWidth = 0 ;
* pHeight = 0 ;
2020-09-26 19:41:58 +00:00
}
2011-04-13 18:37:12 +00:00
2011-07-12 01:14:46 +00:00
char m_aName [ 12 ] ;
2010-05-29 07:25:38 +00:00
int m_Type ;
int m_Flags ;
bool m_Readonly ;
bool m_Visible ;
2018-10-02 01:52:01 +00:00
int m_BrushRefCount ;
2010-05-29 07:25:38 +00:00
} ;
class CLayerGroup
{
public :
class CEditorMap * m_pMap ;
2011-04-13 18:37:12 +00:00
2022-06-11 19:38:18 +00:00
std : : vector < CLayer * > m_vpLayers ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int m_OffsetX ;
int m_OffsetY ;
int m_ParallaxX ;
int m_ParallaxY ;
2022-08-06 00:31:42 +00:00
int m_CustomParallaxZoom ;
2022-08-04 23:16:44 +00:00
int m_ParallaxZoom ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int m_UseClipping ;
int m_ClipX ;
int m_ClipY ;
int m_ClipW ;
int m_ClipH ;
2011-04-13 18:37:12 +00:00
2011-07-12 01:14:46 +00:00
char m_aName [ 12 ] ;
2010-05-29 07:25:38 +00:00
bool m_GameGroup ;
bool m_Visible ;
2011-07-12 15:54:59 +00:00
bool m_Collapse ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CLayerGroup ( ) ;
~ CLayerGroup ( ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void Convert ( CUIRect * pRect ) ;
void Render ( ) ;
void MapScreen ( ) ;
void Mapping ( float * pPoints ) ;
2022-06-30 22:36:32 +00:00
void GetSize ( float * pWidth , float * pHeight ) const ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void DeleteLayer ( int Index ) ;
2022-08-17 23:07:16 +00:00
void DuplicateLayer ( int Index ) ;
2010-05-29 07:25:38 +00:00
int SwapLayers ( int Index0 , int Index1 ) ;
2011-04-13 18:37:12 +00:00
bool IsEmpty ( ) const
2010-05-29 07:25:38 +00:00
{
2022-06-11 19:38:18 +00:00
return m_vpLayers . size ( ) = = 0 ; // stupid function, since its bad for Fillselection: TODO add a function for Fillselection that returns whether a specific tile is used in the given layer
2010-05-29 07:25:38 +00:00
}
2015-07-09 00:08:14 +00:00
2018-02-04 15:00:47 +00:00
/*bool IsUsedInThisLayer(int Layer, int Index) // <--------- this is what i meant but cause i don't know which Indexes belongs to which layers i can't finish yet
2014-03-12 22:27:03 +00:00
{
switch Layer
{
case LAYERTYPE_GAME : // security
return true ;
case LAYERTYPE_FRONT :
return true ;
case LAYERTYPE_TELE :
{
if ( Index = = ) // you could add an 2D array into mapitems.h which defines which Indexes belong to which layer(s)
}
case LAYERTYPE_SPEEDUP :
{
if ( Index = = TILE_BOOST )
return true ;
else
return false ;
}
case LAYERTYPE_SWITCH :
{
2015-07-09 00:08:14 +00:00
2014-03-12 22:27:03 +00:00
}
case LAYERTYPE_TUNE :
{
2020-09-13 20:00:49 +00:00
if ( Index = = TILE_TUNE )
2014-03-12 22:27:03 +00:00
return true ;
else
return false ;
}
default :
return false ;
}
} */
2011-04-13 18:37:12 +00:00
2022-08-06 00:31:42 +00:00
void OnEdited ( )
{
if ( ! m_CustomParallaxZoom )
2022-08-10 01:51:03 +00:00
m_ParallaxZoom = GetParallaxZoomDefault ( m_ParallaxX , m_ParallaxY ) ;
2022-08-06 00:31:42 +00:00
}
2011-04-13 18:37:12 +00:00
void Clear ( )
{
2022-06-11 19:38:18 +00:00
m_vpLayers . clear ( ) ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2022-06-30 22:36:32 +00:00
void AddLayer ( CLayer * pLayer ) ;
2010-05-29 07:25:38 +00:00
void ModifyImageIndex ( INDEX_MODIFY_FUNC Func )
{
2022-06-11 19:38:18 +00:00
for ( auto & pLayer : m_vpLayers )
2022-05-24 09:24:33 +00:00
pLayer - > ModifyImageIndex ( Func ) ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC Func )
{
2022-06-11 19:38:18 +00:00
for ( auto & pLayer : m_vpLayers )
2022-05-24 09:24:33 +00:00
pLayer - > ModifyEnvelopeIndex ( Func ) ;
2010-05-29 07:25:38 +00:00
}
2014-10-11 11:38:45 +00:00
void ModifySoundIndex ( INDEX_MODIFY_FUNC Func )
{
2022-06-11 19:38:18 +00:00
for ( auto & pLayer : m_vpLayers )
2022-05-24 09:24:33 +00:00
pLayer - > ModifySoundIndex ( Func ) ;
2014-10-11 11:38:45 +00:00
}
2010-05-29 07:25:38 +00:00
} ;
class CEditorImage : public CImageInfo
{
public :
CEditor * m_pEditor ;
2011-04-13 18:37:12 +00:00
2020-09-26 19:41:58 +00:00
CEditorImage ( CEditor * pEditor ) :
m_AutoMapper ( pEditor )
2010-05-29 07:25:38 +00:00
{
m_pEditor = pEditor ;
m_aName [ 0 ] = 0 ;
m_External = 0 ;
m_Width = 0 ;
m_Height = 0 ;
2022-06-13 16:28:13 +00:00
m_pData = nullptr ;
2010-05-29 07:25:38 +00:00
m_Format = 0 ;
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
~ CEditorImage ( ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void AnalyseTileFlags ( ) ;
2011-04-13 18:37:12 +00:00
2012-08-12 10:41:50 +00:00
IGraphics : : CTextureHandle m_Texture ;
2010-05-29 07:25:38 +00:00
int m_External ;
char m_aName [ 128 ] ;
unsigned char m_aTileFlags [ 256 ] ;
2011-07-08 23:09:06 +00:00
class CAutoMapper m_AutoMapper ;
2010-05-29 07:25:38 +00:00
} ;
2014-10-08 12:50:25 +00:00
class CEditorSound
{
public :
2014-10-11 11:38:45 +00:00
CEditor * m_pEditor ;
2015-07-09 00:08:14 +00:00
2014-10-11 11:38:45 +00:00
CEditorSound ( CEditor * pEditor )
2014-10-08 12:50:25 +00:00
{
2014-10-11 11:38:45 +00:00
m_pEditor = pEditor ;
2014-10-08 12:50:25 +00:00
m_aName [ 0 ] = 0 ;
2014-10-08 14:53:25 +00:00
m_SoundID = 0 ;
2014-10-11 12:50:16 +00:00
2022-06-13 16:28:13 +00:00
m_pData = nullptr ;
2014-10-11 12:50:16 +00:00
m_DataSize = 0 ;
2014-10-08 12:50:25 +00:00
}
2014-10-11 11:38:45 +00:00
~ CEditorSound ( ) ;
2014-10-08 14:53:25 +00:00
int m_SoundID ;
2014-10-08 12:50:25 +00:00
char m_aName [ 128 ] ;
2014-10-11 12:50:16 +00:00
void * m_pData ;
unsigned m_DataSize ;
2014-10-08 12:50:25 +00:00
} ;
2010-05-29 07:25:38 +00:00
class CEditorMap
{
void MakeGameGroup ( CLayerGroup * pGroup ) ;
void MakeGameLayer ( CLayer * pLayer ) ;
2020-09-26 19:41:58 +00:00
2010-05-29 07:25:38 +00:00
public :
CEditor * m_pEditor ;
2011-03-21 23:31:42 +00:00
bool m_Modified ;
2010-05-29 07:25:38 +00:00
CEditorMap ( )
{
Clean ( ) ;
}
2017-07-21 18:02:46 +00:00
~ CEditorMap ( )
{
Clean ( ) ;
}
2022-06-11 19:38:18 +00:00
std : : vector < CLayerGroup * > m_vpGroups ;
std : : vector < CEditorImage * > m_vpImages ;
std : : vector < CEnvelope * > m_vpEnvelopes ;
std : : vector < CEditorSound * > m_vpSounds ;
2011-04-13 18:37:12 +00:00
2011-07-12 21:31:39 +00:00
class CMapInfo
{
public :
char m_aAuthorTmp [ 32 ] ;
char m_aVersionTmp [ 16 ] ;
char m_aCreditsTmp [ 128 ] ;
char m_aLicenseTmp [ 32 ] ;
char m_aAuthor [ 32 ] ;
char m_aVersion [ 16 ] ;
char m_aCredits [ 128 ] ;
char m_aLicense [ 32 ] ;
void Reset ( )
{
m_aAuthorTmp [ 0 ] = 0 ;
m_aVersionTmp [ 0 ] = 0 ;
m_aCreditsTmp [ 0 ] = 0 ;
m_aLicenseTmp [ 0 ] = 0 ;
m_aAuthor [ 0 ] = 0 ;
m_aVersion [ 0 ] = 0 ;
m_aCredits [ 0 ] = 0 ;
m_aLicense [ 0 ] = 0 ;
}
} ;
CMapInfo m_MapInfo ;
2011-07-13 20:38:32 +00:00
struct CSetting
{
2018-04-27 19:36:29 +00:00
char m_aCommand [ 256 ] ;
2011-07-13 20:38:32 +00:00
} ;
2022-06-11 19:38:18 +00:00
std : : vector < CSetting > m_vSettings ;
2011-07-13 20:38:32 +00:00
2010-05-29 07:25:38 +00:00
class CLayerGame * m_pGameLayer ;
CLayerGroup * m_pGameGroup ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CEnvelope * NewEnvelope ( int Channels )
{
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-30 22:36:32 +00:00
CEnvelope * pEnv = new CEnvelope ( Channels ) ;
m_vpEnvelopes . push_back ( pEnv ) ;
return pEnv ;
2010-05-29 07:25:38 +00:00
}
2010-08-06 18:18:53 +00:00
void DeleteEnvelope ( int Index ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CLayerGroup * NewGroup ( )
{
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-30 22:36:32 +00:00
CLayerGroup * pGroup = new CLayerGroup ;
pGroup - > m_pMap = this ;
m_vpGroups . push_back ( pGroup ) ;
return pGroup ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int SwapGroups ( int Index0 , int Index1 )
{
2022-06-11 19:38:18 +00:00
if ( Index0 < 0 | | Index0 > = ( int ) m_vpGroups . size ( ) )
2020-09-26 19:41:58 +00:00
return Index0 ;
2022-06-11 19:38:18 +00:00
if ( Index1 < 0 | | Index1 > = ( int ) m_vpGroups . size ( ) )
2020-09-26 19:41:58 +00:00
return Index0 ;
if ( Index0 = = Index1 )
return Index0 ;
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-11 19:38:18 +00:00
std : : swap ( m_vpGroups [ Index0 ] , m_vpGroups [ Index1 ] ) ;
2010-05-29 07:25:38 +00:00
return Index1 ;
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void DeleteGroup ( int Index )
{
2022-06-11 19:38:18 +00:00
if ( Index < 0 | | Index > = ( int ) m_vpGroups . size ( ) )
2020-09-26 19:41:58 +00:00
return ;
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-11 19:38:18 +00:00
delete m_vpGroups [ Index ] ;
m_vpGroups . erase ( m_vpGroups . begin ( ) + Index ) ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void ModifyImageIndex ( INDEX_MODIFY_FUNC pfnFunc )
{
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-11 19:38:18 +00:00
for ( auto & pGroup : m_vpGroups )
2022-05-24 09:24:33 +00:00
pGroup - > ModifyImageIndex ( pfnFunc ) ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC pfnFunc )
{
2011-03-21 23:31:42 +00:00
m_Modified = true ;
2022-06-11 19:38:18 +00:00
for ( auto & pGroup : m_vpGroups )
2022-05-24 09:24:33 +00:00
pGroup - > ModifyEnvelopeIndex ( pfnFunc ) ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2014-10-11 11:38:45 +00:00
void ModifySoundIndex ( INDEX_MODIFY_FUNC pfnFunc )
{
m_Modified = true ;
2022-06-11 19:38:18 +00:00
for ( auto & pGroup : m_vpGroups )
2022-05-24 09:24:33 +00:00
pGroup - > ModifySoundIndex ( pfnFunc ) ;
2014-10-11 11:38:45 +00:00
}
2010-05-29 07:25:38 +00:00
void Clean ( ) ;
2012-08-12 10:41:50 +00:00
void CreateDefault ( IGraphics : : CTextureHandle EntitiesTexture ) ;
2010-05-29 07:25:38 +00:00
2011-04-13 18:37:12 +00:00
// io
2022-11-03 19:17:06 +00:00
bool Save ( class IStorage * pStorage , const char * pFilename ) ;
bool Load ( class IStorage * pStorage , const char * pFilename , int StorageType ) ;
2011-04-09 06:41:31 +00:00
// DDRace
class CLayerTele * m_pTeleLayer ;
class CLayerSpeedup * m_pSpeedupLayer ;
class CLayerFront * m_pFrontLayer ;
class CLayerSwitch * m_pSwitchLayer ;
2014-03-12 22:27:03 +00:00
class CLayerTune * m_pTuneLayer ;
2010-09-30 21:31:19 +00:00
void MakeTeleLayer ( CLayer * pLayer ) ;
void MakeSpeedupLayer ( CLayer * pLayer ) ;
void MakeFrontLayer ( CLayer * pLayer ) ;
void MakeSwitchLayer ( CLayer * pLayer ) ;
2014-03-12 22:27:03 +00:00
void MakeTuneLayer ( CLayer * pLayer ) ;
2010-05-29 07:25:38 +00:00
} ;
struct CProperty
{
const char * m_pName ;
int m_Value ;
int m_Type ;
int m_Min ;
int m_Max ;
} ;
enum
{
2020-09-26 19:41:58 +00:00
PROPTYPE_NULL = 0 ,
2010-05-29 07:25:38 +00:00
PROPTYPE_BOOL ,
PROPTYPE_INT_STEP ,
PROPTYPE_INT_SCROLL ,
2015-07-08 11:55:02 +00:00
PROPTYPE_ANGLE_SCROLL ,
2010-05-29 07:25:38 +00:00
PROPTYPE_COLOR ,
PROPTYPE_IMAGE ,
PROPTYPE_ENVELOPE ,
2010-10-09 16:38:23 +00:00
PROPTYPE_SHIFT ,
2014-10-08 15:33:06 +00:00
PROPTYPE_SOUND ,
2018-10-03 16:16:58 +00:00
PROPTYPE_AUTOMAPPER ,
2010-05-29 07:25:38 +00:00
} ;
2022-03-21 04:53:36 +00:00
enum
{
DIRECTION_LEFT = 1 ,
DIRECTION_RIGHT = 2 ,
DIRECTION_UP = 4 ,
DIRECTION_DOWN = 8 ,
} ;
2022-06-25 18:22:26 +00:00
struct RECTi
2010-05-29 07:25:38 +00:00
{
int x , y ;
int w , h ;
2022-06-25 18:22:26 +00:00
} ;
2010-05-29 07:25:38 +00:00
class CLayerTiles : public CLayer
{
2022-06-05 20:03:16 +00:00
protected :
template < typename T >
void ShiftImpl ( T * pTiles , int Direction , int ShiftBy )
{
switch ( Direction )
{
case DIRECTION_LEFT :
for ( int y = 0 ; y < m_Height ; + + y )
{
mem_move ( & pTiles [ y * m_Width ] , & pTiles [ y * m_Width + ShiftBy ] , ( m_Width - ShiftBy ) * sizeof ( T ) ) ;
mem_zero ( & pTiles [ y * m_Width + ( m_Width - ShiftBy ) ] , ShiftBy * sizeof ( T ) ) ;
}
break ;
case DIRECTION_RIGHT :
for ( int y = 0 ; y < m_Height ; + + y )
{
mem_move ( & pTiles [ y * m_Width + ShiftBy ] , & pTiles [ y * m_Width ] , ( m_Width - ShiftBy ) * sizeof ( T ) ) ;
mem_zero ( & pTiles [ y * m_Width ] , ShiftBy * sizeof ( T ) ) ;
}
break ;
case DIRECTION_UP :
for ( int y = 0 ; y < m_Height - ShiftBy ; + + y )
{
mem_copy ( & pTiles [ y * m_Width ] , & pTiles [ ( y + ShiftBy ) * m_Width ] , m_Width * sizeof ( T ) ) ;
mem_zero ( & pTiles [ ( y + ShiftBy ) * m_Width ] , m_Width * sizeof ( T ) ) ;
}
break ;
case DIRECTION_DOWN :
for ( int y = m_Height - 1 ; y > = ShiftBy ; - - y )
{
mem_copy ( & pTiles [ y * m_Width ] , & pTiles [ ( y - ShiftBy ) * m_Width ] , m_Width * sizeof ( T ) ) ;
mem_zero ( & pTiles [ ( y - ShiftBy ) * m_Width ] , m_Width * sizeof ( T ) ) ;
}
}
}
2022-06-05 20:21:24 +00:00
template < typename T >
void BrushFlipXImpl ( T * pTiles )
{
for ( int y = 0 ; y < m_Height ; y + + )
for ( int x = 0 ; x < m_Width / 2 ; x + + )
std : : swap ( pTiles [ y * m_Width + x ] , pTiles [ ( y + 1 ) * m_Width - 1 - x ] ) ;
}
template < typename T >
void BrushFlipYImpl ( T * pTiles )
{
for ( int y = 0 ; y < m_Height / 2 ; y + + )
for ( int x = 0 ; x < m_Width ; x + + )
std : : swap ( pTiles [ y * m_Width + x ] , pTiles [ ( m_Height - 1 - y ) * m_Width + x ] ) ;
}
2022-06-05 20:03:16 +00:00
2010-05-29 07:25:38 +00:00
public :
CLayerTiles ( int w , int h ) ;
2022-08-17 23:07:16 +00:00
CLayerTiles ( const CLayerTiles & Other ) ;
2010-05-29 07:25:38 +00:00
~ CLayerTiles ( ) ;
2016-04-30 23:47:29 +00:00
virtual CTile GetTile ( int x , int y ) ;
virtual void SetTile ( int x , int y , CTile tile ) ;
2015-11-14 23:00:43 +00:00
2010-09-30 21:31:19 +00:00
virtual void Resize ( int NewW , int NewH ) ;
2010-10-20 13:56:29 +00:00
virtual void Shift ( int Direction ) ;
2010-05-29 07:25:38 +00:00
void MakePalette ( ) ;
2022-05-17 20:13:44 +00:00
void Render ( bool Tileset = false ) override ;
2015-07-09 00:08:14 +00:00
2010-05-29 07:25:38 +00:00
int ConvertX ( float x ) const ;
int ConvertY ( float y ) const ;
void Convert ( CUIRect Rect , RECTi * pOut ) ;
void Snap ( CUIRect * pRect ) ;
void Clamp ( RECTi * pRect ) ;
2019-03-26 18:15:24 +00:00
virtual bool IsEmpty ( CLayerTiles * pLayer ) ;
2022-05-17 20:13:44 +00:00
void BrushSelecting ( CUIRect Rect ) override ;
int BrushGrab ( CLayerGroup * pBrush , CUIRect Rect ) override ;
void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) override ;
void BrushDraw ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
2011-04-13 18:37:12 +00:00
2022-08-17 23:07:16 +00:00
CLayer * Duplicate ( ) const override ;
2011-02-18 10:41:27 +00:00
virtual void ShowInfo ( ) ;
2022-05-17 20:13:44 +00:00
int RenderProperties ( CUIRect * pToolbox ) override ;
2010-05-29 07:25:38 +00:00
2020-09-26 19:41:58 +00:00
struct SCommonPropState
{
2022-06-27 21:18:58 +00:00
enum
{
MODIFIED_SIZE = 1 < < 0 ,
MODIFIED_COLOR = 1 < < 1 ,
} ;
int m_Modified = 0 ;
2022-06-27 21:09:31 +00:00
int m_Width = - 1 ;
int m_Height = - 1 ;
int m_Color = 0 ;
2020-02-28 15:25:27 +00:00
} ;
2022-06-11 19:38:18 +00:00
static int RenderCommonProperties ( SCommonPropState & State , CEditor * pEditor , CUIRect * pToolbox , std : : vector < CLayerTiles * > & vpLayers ) ;
2020-02-27 13:53:12 +00:00
2022-05-17 20:13:44 +00:00
void ModifyImageIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void PrepareForSave ( ) ;
2022-06-30 22:36:32 +00:00
void GetSize ( float * pWidth , float * pHeight ) override
2020-09-26 19:41:58 +00:00
{
2022-06-30 22:36:32 +00:00
* pWidth = m_Width * 32.0f ;
* pHeight = m_Height * 32.0f ;
2020-09-26 19:41:58 +00:00
}
2019-02-08 02:10:12 +00:00
2018-10-04 13:26:41 +00:00
void FlagModified ( int x , int y , int w , int h ) ;
2011-04-13 18:37:12 +00:00
2012-08-12 10:41:50 +00:00
IGraphics : : CTextureHandle m_Texture ;
2010-05-29 07:25:38 +00:00
int m_Game ;
int m_Image ;
int m_Width ;
int m_Height ;
2011-01-04 10:38:14 +00:00
CColor m_Color ;
2011-07-18 10:05:12 +00:00
int m_ColorEnv ;
int m_ColorEnvOffset ;
2010-05-29 07:25:38 +00:00
CTile * m_pTiles ;
2011-04-09 06:41:31 +00:00
// DDRace
2018-10-03 16:16:58 +00:00
int m_AutoMapperConfig ;
int m_Seed ;
bool m_AutoAutoMap ;
2011-04-09 06:41:31 +00:00
int m_Tele ;
int m_Speedup ;
int m_Front ;
int m_Switch ;
2014-03-12 22:27:03 +00:00
int m_Tune ;
2021-09-13 08:06:34 +00:00
char m_aFileName [ IO_MAX_PATH_LENGTH ] ;
2010-05-29 07:25:38 +00:00
} ;
class CLayerQuads : public CLayer
{
public :
CLayerQuads ( ) ;
2022-08-17 23:07:16 +00:00
CLayerQuads ( const CLayerQuads & Other ) ;
2010-05-29 07:25:38 +00:00
~ CLayerQuads ( ) ;
2022-05-17 20:13:44 +00:00
void Render ( bool QuadPicker = false ) override ;
2019-03-28 12:41:07 +00:00
CQuad * NewQuad ( int x , int y , int Width , int Height ) ;
2022-09-10 13:07:32 +00:00
int SwapQuads ( int Index0 , int Index1 ) ;
2010-09-27 19:41:41 +00:00
2022-05-17 20:13:44 +00:00
void BrushSelecting ( CUIRect Rect ) override ;
int BrushGrab ( CLayerGroup * pBrush , CUIRect Rect ) override ;
void BrushPlace ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
2011-04-13 18:37:12 +00:00
2022-05-17 20:13:44 +00:00
int RenderProperties ( CUIRect * pToolbox ) override ;
2010-05-29 07:25:38 +00:00
2022-05-17 20:13:44 +00:00
void ModifyImageIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
2011-04-13 18:37:12 +00:00
2022-06-30 22:36:32 +00:00
void GetSize ( float * pWidth , float * pHeight ) override ;
2022-08-17 23:07:16 +00:00
CLayer * Duplicate ( ) const override ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int m_Image ;
2022-06-11 19:38:18 +00:00
std : : vector < CQuad > m_vQuads ;
2010-05-29 07:25:38 +00:00
} ;
class CLayerGame : public CLayerTiles
{
public :
CLayerGame ( int w , int h ) ;
~ CLayerGame ( ) ;
2022-05-17 20:13:44 +00:00
CTile GetTile ( int x , int y ) override ;
void SetTile ( int x , int y , CTile tile ) override ;
2015-11-14 23:00:43 +00:00
2022-05-17 20:13:44 +00:00
int RenderProperties ( CUIRect * pToolbox ) override ;
2010-05-29 07:25:38 +00:00
} ;
class CEditor : public IEditor
{
class IInput * m_pInput ;
class IClient * m_pClient ;
2021-01-10 12:47:07 +00:00
class CConfig * m_pConfig ;
2010-08-17 22:06:00 +00:00
class IConsole * m_pConsole ;
2010-05-29 07:25:38 +00:00
class IGraphics * m_pGraphics ;
class ITextRender * m_pTextRender ;
2014-10-08 14:53:25 +00:00
class ISound * m_pSound ;
2010-09-12 11:15:59 +00:00
class IStorage * m_pStorage ;
2010-05-29 07:25:38 +00:00
CRenderTools m_RenderTools ;
CUI m_UI ;
2020-09-26 19:41:58 +00:00
2022-02-11 10:10:03 +00:00
bool m_EditorWasUsedBefore = false ;
IGraphics : : CTextureHandle m_EntitiesTexture ;
IGraphics : : CTextureHandle m_FrontTexture ;
IGraphics : : CTextureHandle m_TeleTexture ;
IGraphics : : CTextureHandle m_SpeedupTexture ;
IGraphics : : CTextureHandle m_SwitchTexture ;
IGraphics : : CTextureHandle m_TuneTexture ;
int GetTextureUsageFlag ( ) ;
2010-05-29 07:25:38 +00:00
public :
2022-03-08 19:01:26 +00:00
class IInput * Input ( ) { return m_pInput ; }
class IClient * Client ( ) { return m_pClient ; }
2021-01-10 12:47:07 +00:00
class CConfig * Config ( ) { return m_pConfig ; }
2022-03-08 19:01:26 +00:00
class IConsole * Console ( ) { return m_pConsole ; }
class IGraphics * Graphics ( ) { return m_pGraphics ; }
2014-10-08 14:53:25 +00:00
class ISound * Sound ( ) { return m_pSound ; }
2022-03-08 19:01:26 +00:00
class ITextRender * TextRender ( ) { return m_pTextRender ; }
class IStorage * Storage ( ) { return m_pStorage ; }
2010-05-29 07:25:38 +00:00
CUI * UI ( ) { return & m_UI ; }
CRenderTools * RenderTools ( ) { return & m_RenderTools ; }
2020-09-26 19:41:58 +00:00
CEditor ( ) :
m_TilesetPicker ( 16 , 16 )
2010-05-29 07:25:38 +00:00
{
2022-06-13 16:28:13 +00:00
m_pInput = nullptr ;
m_pClient = nullptr ;
m_pGraphics = nullptr ;
m_pTextRender = nullptr ;
m_pSound = nullptr ;
2010-05-29 07:25:38 +00:00
m_Mode = MODE_LAYERS ;
m_Dialog = 0 ;
2012-01-08 12:36:47 +00:00
m_EditBoxActive = 0 ;
2022-06-13 16:28:13 +00:00
m_pTooltip = nullptr ;
2010-05-29 07:25:38 +00:00
2011-07-10 20:16:16 +00:00
m_GridActive = false ;
m_GridFactor = 1 ;
2018-09-11 08:35:02 +00:00
m_BrushColorEnabled = true ;
2010-05-29 07:25:38 +00:00
m_aFileName [ 0 ] = 0 ;
2011-03-21 23:31:42 +00:00
m_aFileSaveName [ 0 ] = 0 ;
2010-10-08 20:06:12 +00:00
m_ValidSaveFilename = false ;
2011-03-21 23:31:42 +00:00
m_PopupEventActivated = false ;
2011-08-13 17:22:01 +00:00
m_PopupEventWasActivated = false ;
2020-09-24 16:52:31 +00:00
m_MouseInsidePopup = false ;
2011-04-13 18:37:12 +00:00
2010-10-06 21:07:35 +00:00
m_FileDialogStorageType = 0 ;
2022-06-13 16:28:13 +00:00
m_pFileDialogTitle = nullptr ;
m_pFileDialogButtonText = nullptr ;
m_pFileDialogUser = nullptr ;
2010-09-12 11:15:59 +00:00
m_aFileDialogFileName [ 0 ] = 0 ;
2010-10-07 21:51:07 +00:00
m_aFileDialogCurrentFolder [ 0 ] = 0 ;
m_aFileDialogCurrentLink [ 0 ] = 0 ;
m_pFileDialogPath = m_aFileDialogCurrentFolder ;
2020-09-01 07:47:17 +00:00
m_FileDialogActivate = false ;
2020-09-01 07:48:51 +00:00
m_FileDialogOpening = false ;
2010-10-07 21:51:07 +00:00
m_FileDialogScrollValue = 0.0f ;
m_FilesSelectedIndex = - 1 ;
2010-09-12 11:15:59 +00:00
m_FilesStartAt = 0 ;
m_FilesCur = 0 ;
m_FilesStopAt = 999 ;
2010-05-29 07:25:38 +00:00
2018-10-02 21:39:22 +00:00
m_SelectEntitiesImage = " DDNet " ;
2010-05-29 07:25:38 +00:00
m_WorldOffsetX = 0 ;
m_WorldOffsetY = 0 ;
m_EditorOffsetX = 0.0f ;
m_EditorOffsetY = 0.0f ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
m_WorldZoom = 1.0f ;
m_ZoomLevel = 200 ;
m_LockMouse = false ;
m_ShowMousePointer = true ;
m_MouseDeltaX = 0 ;
m_MouseDeltaY = 0 ;
m_MouseDeltaWx = 0 ;
m_MouseDeltaWy = 0 ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
m_GuiActive = true ;
m_ProofBorders = false ;
2022-08-06 01:30:37 +00:00
m_PreviewZoom = false ;
2011-04-13 18:37:12 +00:00
2011-02-18 10:41:27 +00:00
m_ShowTileInfo = false ;
2010-05-29 07:25:38 +00:00
m_ShowDetail = true ;
m_Animate = false ;
m_AnimateStart = 0 ;
m_AnimateTime = 0 ;
m_AnimateSpeed = 1 ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
m_ShowEnvelopeEditor = 0 ;
2011-07-13 20:38:32 +00:00
m_ShowServerSettingsEditor = false ;
2011-04-13 18:37:12 +00:00
2022-09-22 16:02:07 +00:00
m_ShowEnvelopePreview = SHOWENV_NONE ;
2011-08-15 18:12:31 +00:00
m_SelectedQuadEnvelope = - 1 ;
m_SelectedEnvelopePoint = - 1 ;
2011-08-14 14:31:48 +00:00
2022-02-26 17:49:06 +00:00
m_QuadKnifeActive = false ;
m_QuadKnifeCount = 0 ;
2011-07-13 20:38:32 +00:00
m_CommandBox = 0.0f ;
m_aSettingsCommand [ 0 ] = 0 ;
2022-06-13 16:28:13 +00:00
ms_pUiGotContext = nullptr ;
2011-04-09 06:41:31 +00:00
2011-04-17 15:59:02 +00:00
// DDRace
2010-12-07 15:51:59 +00:00
m_TeleNumber = 1 ;
2010-09-30 21:31:19 +00:00
m_SwitchNum = 1 ;
2014-03-12 22:27:03 +00:00
m_TuningNum = 1 ;
2010-11-22 20:43:22 +00:00
m_SwitchDelay = 0 ;
2010-09-30 21:31:19 +00:00
m_SpeedupForce = 50 ;
m_SpeedupMaxSpeed = 0 ;
m_SpeedupAngle = 0 ;
2016-04-27 15:49:14 +00:00
m_LargeLayerWasWarned = false ;
2016-05-01 16:08:07 +00:00
m_PreventUnusedTilesWasWarned = false ;
2019-02-08 02:10:12 +00:00
m_AllowPlaceUnusedTiles = 0 ;
2019-03-26 18:15:24 +00:00
m_BrushDrawDestructive = true ;
2022-10-11 22:23:11 +00:00
m_ShowTileHexInfo = false ;
2022-08-20 18:47:46 +00:00
m_GotoX = 0 ;
m_GotoY = 0 ;
2019-04-05 23:15:02 +00:00
m_Mentions = 0 ;
2010-05-29 07:25:38 +00:00
}
2011-04-13 18:37:12 +00:00
2022-05-17 20:13:44 +00:00
void Init ( ) override ;
2022-06-15 15:37:22 +00:00
void OnUpdate ( ) override ;
void OnRender ( ) override ;
2022-05-17 20:13:44 +00:00
bool HasUnsavedData ( ) const override { return m_Map . m_Modified ; }
void UpdateMentions ( ) override { m_Mentions + + ; }
void ResetMentions ( ) override { m_Mentions = 0 ; }
2011-04-13 18:37:12 +00:00
2018-10-02 01:52:01 +00:00
CLayerGroup * m_apSavedBrushes [ 10 ] ;
2010-10-07 21:51:07 +00:00
void FilelistPopulate ( int StorageType ) ;
void InvokeFileDialog ( int StorageType , int FileType , const char * pTitle , const char * pButtonText ,
2010-05-29 07:25:38 +00:00
const char * pBasepath , const char * pDefaultName ,
2010-10-07 21:51:07 +00:00
void ( * pfnFunc ) ( const char * pFilename , int StorageType , void * pUser ) , void * pUser ) ;
2011-04-13 18:37:12 +00:00
2020-09-26 19:41:58 +00:00
void Reset ( bool CreateDefault = true ) ;
2022-11-03 19:17:06 +00:00
bool Save ( const char * pFilename ) override ;
bool Load ( const char * pFilename , int StorageType ) override ;
bool Append ( const char * pFilename , int StorageType ) ;
2016-08-23 01:08:36 +00:00
void LoadCurrentMap ( ) ;
2010-05-29 07:25:38 +00:00
void Render ( ) ;
2018-10-02 01:52:01 +00:00
2022-05-24 09:24:33 +00:00
std : : vector < CQuad * > GetSelectedQuads ( ) ;
2021-02-08 21:26:26 +00:00
CLayer * GetSelectedLayerType ( int Index , int Type ) const ;
CLayer * GetSelectedLayer ( int Index ) const ;
CLayerGroup * GetSelectedGroup ( ) const ;
2014-10-10 17:11:21 +00:00
CSoundSource * GetSelectedSource ( ) ;
2020-09-02 15:11:24 +00:00
void SelectLayer ( int LayerIndex , int GroupIndex = - 1 ) ;
2022-02-26 17:49:06 +00:00
void AddSelectedLayer ( int LayerIndex ) ;
2018-08-13 09:11:56 +00:00
void SelectQuad ( int Index ) ;
void DeleteSelectedQuads ( ) ;
2021-02-08 21:26:26 +00:00
bool IsQuadSelected ( int Index ) const ;
int FindSelectedQuadIndex ( int Index ) const ;
2022-08-17 23:07:16 +00:00
bool IsSpecialLayer ( const CLayer * pLayer ) const ;
2018-08-13 09:11:56 +00:00
2020-11-07 23:02:34 +00:00
float ScaleFontSize ( char * pText , int TextSize , float FontSize , int Width ) ;
2020-09-26 19:41:58 +00:00
int DoProperties ( CUIRect * pToolbox , CProperty * pProps , int * pIDs , int * pNewVal , ColorRGBA Color = ColorRGBA ( 1 , 1 , 1 , 0.5f ) ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int m_Mode ;
int m_Dialog ;
2012-01-08 12:36:47 +00:00
int m_EditBoxActive ;
2010-05-29 07:25:38 +00:00
const char * m_pTooltip ;
2011-07-10 20:16:16 +00:00
bool m_GridActive ;
int m_GridFactor ;
2018-09-11 08:35:02 +00:00
bool m_BrushColorEnabled ;
2021-09-13 08:06:34 +00:00
char m_aFileName [ IO_MAX_PATH_LENGTH ] ;
char m_aFileSaveName [ IO_MAX_PATH_LENGTH ] ;
2010-10-08 20:06:12 +00:00
bool m_ValidSaveFilename ;
2010-10-07 21:51:07 +00:00
2011-03-21 23:31:42 +00:00
enum
{
2020-09-19 18:52:28 +00:00
POPEVENT_EXIT = 0 ,
2011-03-21 23:31:42 +00:00
POPEVENT_LOAD ,
2016-08-23 01:08:36 +00:00
POPEVENT_LOADCURRENT ,
2011-03-21 23:31:42 +00:00
POPEVENT_NEW ,
POPEVENT_SAVE ,
2016-04-27 15:49:14 +00:00
POPEVENT_LARGELAYER ,
2020-06-20 23:14:36 +00:00
POPEVENT_PREVENTUNUSEDTILES ,
2020-09-19 18:52:28 +00:00
POPEVENT_IMAGEDIV16 ,
POPEVENT_IMAGE_MAX ,
2020-09-20 00:24:17 +00:00
POPEVENT_PLACE_BORDER_TILES
2011-03-21 23:31:42 +00:00
} ;
int m_PopupEventType ;
int m_PopupEventActivated ;
2011-08-13 17:22:01 +00:00
int m_PopupEventWasActivated ;
2020-09-24 16:52:31 +00:00
bool m_MouseInsidePopup ;
2016-04-27 15:49:14 +00:00
bool m_LargeLayerWasWarned ;
2016-05-01 16:08:07 +00:00
bool m_PreventUnusedTilesWasWarned ;
2019-02-08 02:10:12 +00:00
int m_AllowPlaceUnusedTiles ;
2019-03-26 18:15:24 +00:00
bool m_BrushDrawDestructive ;
2022-10-11 22:23:11 +00:00
bool m_ShowTileHexInfo ;
2011-03-21 23:31:42 +00:00
2019-04-05 23:15:02 +00:00
int m_Mentions ;
2010-10-07 21:51:07 +00:00
enum
{
FILETYPE_MAP ,
FILETYPE_IMG ,
2014-10-08 12:50:25 +00:00
FILETYPE_SOUND ,
2010-10-07 21:51:07 +00:00
} ;
2011-04-13 18:37:12 +00:00
2010-10-06 21:07:35 +00:00
int m_FileDialogStorageType ;
2010-09-12 11:15:59 +00:00
const char * m_pFileDialogTitle ;
const char * m_pFileDialogButtonText ;
2010-10-07 21:51:07 +00:00
void ( * m_pfnFileDialogFunc ) ( const char * pFileName , int StorageType , void * pUser ) ;
2010-09-12 11:15:59 +00:00
void * m_pFileDialogUser ;
2021-09-13 08:06:34 +00:00
char m_aFileDialogFileName [ IO_MAX_PATH_LENGTH ] ;
char m_aFileDialogCurrentFolder [ IO_MAX_PATH_LENGTH ] ;
char m_aFileDialogCurrentLink [ IO_MAX_PATH_LENGTH ] ;
2016-08-20 23:47:39 +00:00
char m_aFileDialogSearchText [ 64 ] ;
2018-10-08 15:38:22 +00:00
char m_aFileDialogPrevSearchText [ 64 ] ;
2010-10-07 21:51:07 +00:00
char * m_pFileDialogPath ;
2020-09-01 07:47:17 +00:00
bool m_FileDialogActivate ;
2010-10-07 21:51:07 +00:00
int m_FileDialogFileType ;
float m_FileDialogScrollValue ;
int m_FilesSelectedIndex ;
2021-12-03 17:01:37 +00:00
char m_aFileDialogNewFolderName [ 64 ] ;
2022-06-30 22:36:32 +00:00
char m_aFileDialogErrString [ 64 ] ;
2012-08-12 10:41:50 +00:00
IGraphics : : CTextureHandle m_FilePreviewImage ;
bool m_PreviewImageIsLoaded ;
2014-03-28 21:47:57 +00:00
CImageInfo m_FilePreviewImageInfo ;
2020-09-01 07:48:51 +00:00
bool m_FileDialogOpening ;
2014-03-28 21:47:57 +00:00
2010-10-06 21:07:35 +00:00
struct CFilelistItem
{
2021-09-13 08:06:34 +00:00
char m_aFilename [ IO_MAX_PATH_LENGTH ] ;
2010-10-06 21:07:35 +00:00
char m_aName [ 128 ] ;
bool m_IsDir ;
2010-10-07 21:51:07 +00:00
bool m_IsLink ;
2010-10-06 21:07:35 +00:00
int m_StorageType ;
2018-10-08 16:07:25 +00:00
bool m_IsVisible ;
2011-04-13 18:37:12 +00:00
2022-09-28 21:53:17 +00:00
bool operator < ( const CFilelistItem & Other ) const { return ! str_comp ( m_aFilename , " .. " ) ? true : ! str_comp ( Other . m_aFilename , " .. " ) ? false : m_IsDir & & ! Other . m_IsDir ? true : ! m_IsDir & & Other . m_IsDir ? false : str_comp_filenames ( m_aFilename , Other . m_aFilename ) < 0 ; }
2010-10-06 21:07:35 +00:00
} ;
2022-06-11 19:38:18 +00:00
std : : vector < CFilelistItem > m_vFileList ;
2010-09-12 11:15:59 +00:00
int m_FilesStartAt ;
int m_FilesCur ;
int m_FilesStopAt ;
2010-05-29 07:25:38 +00:00
2022-06-11 19:38:18 +00:00
std : : vector < std : : string > m_vSelectEntitiesFiles ;
2018-10-02 21:39:22 +00:00
std : : string m_SelectEntitiesImage ;
2018-10-02 21:08:17 +00:00
2010-05-29 07:25:38 +00:00
float m_WorldOffsetX ;
float m_WorldOffsetY ;
float m_EditorOffsetX ;
float m_EditorOffsetY ;
float m_WorldZoom ;
int m_ZoomLevel ;
bool m_LockMouse ;
bool m_ShowMousePointer ;
bool m_GuiActive ;
bool m_ProofBorders ;
2022-08-06 01:30:37 +00:00
bool m_PreviewZoom ;
2022-08-06 15:33:58 +00:00
float m_MouseWScale = 1.0f ; // Mouse (i.e. UI) scale relative to the World (selected Group)
2022-06-15 15:37:22 +00:00
float m_MouseX = 0.0f ;
float m_MouseY = 0.0f ;
float m_MouseWorldX = 0.0f ;
float m_MouseWorldY = 0.0f ;
2010-05-29 07:25:38 +00:00
float m_MouseDeltaX ;
float m_MouseDeltaY ;
float m_MouseDeltaWx ;
float m_MouseDeltaWy ;
2011-04-13 18:37:12 +00:00
2011-02-18 10:41:27 +00:00
bool m_ShowTileInfo ;
2010-05-29 07:25:38 +00:00
bool m_ShowDetail ;
bool m_Animate ;
2021-06-23 05:05:49 +00:00
int64_t m_AnimateStart ;
2010-05-29 07:25:38 +00:00
float m_AnimateTime ;
float m_AnimateSpeed ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int m_ShowEnvelopeEditor ;
2022-09-22 16:02:07 +00:00
enum EShowEnvelope
{
SHOWENV_NONE = 0 ,
SHOWENV_SELECTED ,
SHOWENV_ALL
} ;
EShowEnvelope m_ShowEnvelopePreview ;
2011-07-13 20:38:32 +00:00
bool m_ShowServerSettingsEditor ;
2011-05-04 23:50:23 +00:00
bool m_ShowPicker ;
2011-04-13 18:37:12 +00:00
2022-06-11 19:38:18 +00:00
std : : vector < int > m_vSelectedLayers ;
std : : vector < int > m_vSelectedQuads ;
2018-08-13 09:11:56 +00:00
int m_SelectedQuadPoint ;
int m_SelectedQuadIndex ;
2010-05-29 07:25:38 +00:00
int m_SelectedGroup ;
int m_SelectedPoints ;
int m_SelectedEnvelope ;
2011-08-15 18:12:31 +00:00
int m_SelectedEnvelopePoint ;
2014-08-20 22:56:35 +00:00
int m_SelectedQuadEnvelope ;
2010-05-29 07:25:38 +00:00
int m_SelectedImage ;
2014-10-08 12:50:25 +00:00
int m_SelectedSound ;
2014-10-10 17:11:21 +00:00
int m_SelectedSource ;
2011-04-13 18:37:12 +00:00
2022-02-26 17:49:06 +00:00
bool m_QuadKnifeActive ;
int m_QuadKnifeCount ;
vec2 m_aQuadKnifePoints [ 4 ] ;
2012-08-12 10:41:50 +00:00
IGraphics : : CTextureHandle m_CheckerTexture ;
IGraphics : : CTextureHandle m_BackgroundTexture ;
IGraphics : : CTextureHandle m_CursorTexture ;
2022-02-11 10:10:03 +00:00
IGraphics : : CTextureHandle GetEntitiesTexture ( ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CLayerGroup m_Brush ;
CLayerTiles m_TilesetPicker ;
2014-08-20 22:56:35 +00:00
CLayerQuads m_QuadsetPicker ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
static const void * ms_pUiGotContext ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
CEditorMap m_Map ;
2014-05-31 23:32:54 +00:00
int m_ShiftBy ;
2011-04-13 18:37:12 +00:00
2022-07-01 04:42:36 +00:00
static void EnvelopeEval ( int TimeOffsetMillis , int Env , ColorRGBA & Channels , void * pUser ) ;
2011-07-18 10:05:12 +00:00
2011-07-13 20:38:32 +00:00
float m_CommandBox ;
2018-04-27 19:36:29 +00:00
char m_aSettingsCommand [ 256 ] ;
2011-07-13 20:38:32 +00:00
2020-09-20 00:24:17 +00:00
void PlaceBorderTiles ( ) ;
2010-05-29 07:25:38 +00:00
int DoButton_Editor_Common ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
2020-10-06 10:25:10 +00:00
int DoButton_Editor ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip , int AlignVert = 1 ) ;
2019-04-26 22:11:15 +00:00
int DoButton_Env ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , const char * pToolTip , ColorRGBA Color ) ;
2010-05-29 07:25:38 +00:00
int DoButton_Tab ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
2020-10-06 10:25:10 +00:00
int DoButton_Ex ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip , int Corners , float FontSize = 10.0f , int AlignVert = 1 ) ;
2022-11-12 01:16:07 +00:00
int DoButton_FontIcon ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip , int Corners , float FontSize = 10.0f , int AlignVert = 1 ) ;
2010-05-29 07:25:38 +00:00
int DoButton_ButtonDec ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
int DoButton_ButtonInc ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
int DoButton_File ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
int DoButton_Menu ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags , const char * pToolTip ) ;
2022-06-13 16:28:13 +00:00
int DoButton_MenuItem ( const void * pID , const char * pText , int Checked , const CUIRect * pRect , int Flags = 0 , const char * pToolTip = nullptr ) ;
2011-04-13 18:37:12 +00:00
2022-06-13 16:28:13 +00:00
int DoButton_ColorPicker ( const void * pID , const CUIRect * pRect , ColorRGBA * pColor , const char * pToolTip = nullptr ) ;
2015-08-17 12:10:08 +00:00
2022-07-26 19:17:29 +00:00
bool DoEditBox ( void * pID , const CUIRect * pRect , char * pStr , unsigned StrSize , float FontSize , float * pOffset , bool Hidden = false , int Corners = IGraphics : : CORNER_ALL ) ;
2021-12-03 18:46:31 +00:00
bool DoClearableEditBox ( void * pID , void * pClearID , const CUIRect * pRect , char * pStr , unsigned StrSize , float FontSize , float * pOffset , bool Hidden , int Corners ) ;
2010-05-29 07:25:38 +00:00
2012-08-12 10:41:50 +00:00
void RenderBackground ( CUIRect View , IGraphics : : CTextureHandle Texture , float Size , float Brightness ) ;
2010-05-29 07:25:38 +00:00
2011-07-10 20:16:16 +00:00
void RenderGrid ( CLayerGroup * pGroup ) ;
2022-06-13 16:28:13 +00:00
void UiInvokePopupMenu ( void * pID , int Flags , float X , float Y , float W , float H , int ( * pfnFunc ) ( CEditor * pEditor , CUIRect Rect , void * pContext ) , void * pContext = nullptr ) ;
2010-05-29 07:25:38 +00:00
void UiDoPopupMenu ( ) ;
2020-05-15 19:53:26 +00:00
bool UiPopupExists ( void * pID ) ;
2020-09-15 19:57:09 +00:00
bool UiPopupOpen ( ) ;
2011-04-13 18:37:12 +00:00
2022-07-26 19:17:29 +00:00
int UiDoValueSelector ( void * pID , CUIRect * pRect , const char * pLabel , int Current , int Min , int Max , int Step , float Scale , const char * pToolTip , bool IsDegree = false , bool IsHex = false , int corners = IGraphics : : CORNER_ALL , ColorRGBA * pColor = nullptr ) ;
2010-05-29 07:25:38 +00:00
2020-02-28 15:25:27 +00:00
static int PopupGroup ( CEditor * pEditor , CUIRect View , void * pContext ) ;
struct CLayerPopupContext
{
2022-06-11 19:38:18 +00:00
std : : vector < CLayerTiles * > m_vpLayers ;
2020-02-28 15:25:27 +00:00
CLayerTiles : : SCommonPropState m_CommonPropState ;
} ;
static int PopupLayer ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupQuad ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupPoint ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupNewFolder ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupMapInfo ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupEvent ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSelectImage ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSelectSound ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSelectGametileOp ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupImage ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupMenuFile ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSelectConfigAutoMap ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSound ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSource ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupColorPicker ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupEntities ( CEditor * pEditor , CUIRect View , void * pContext ) ;
2010-05-29 07:25:38 +00:00
2022-11-04 22:36:31 +00:00
struct SMessagePopupContext
{
static constexpr float POPUP_MAX_WIDTH = 200.0f ;
static constexpr float POPUP_FONT_SIZE = 10.0f ;
char m_aMessage [ 256 ] ;
ColorRGBA m_TextColor ;
void DefaultColor ( class ITextRender * pTextRender ) ;
void ErrorColor ( ) ;
} ;
static int PopupMessage ( CEditor * pEditor , CUIRect View , void * pContext ) ;
void ShowPopupMessage ( float X , float Y , SMessagePopupContext * pContext ) ;
2022-11-05 13:16:00 +00:00
struct SSelectionPopupContext
{
static constexpr float POPUP_MAX_WIDTH = 300.0f ;
static constexpr float POPUP_FONT_SIZE = 10.0f ;
static constexpr float POPUP_ENTRY_HEIGHT = 12.0f ;
static constexpr float POPUP_ENTRY_SPACING = 5.0f ;
char m_aMessage [ 256 ] ;
std : : set < std : : string > m_Entries ;
const std : : string * m_pSelection ;
SSelectionPopupContext ( ) ;
} ;
static int PopupSelection ( CEditor * pEditor , CUIRect View , void * pContext ) ;
void ShowPopupSelection ( float X , float Y , SSelectionPopupContext * pContext ) ;
2011-03-21 23:31:42 +00:00
static void CallbackOpenMap ( const char * pFileName , int StorageType , void * pUser ) ;
static void CallbackAppendMap ( const char * pFileName , int StorageType , void * pUser ) ;
static void CallbackSaveMap ( const char * pFileName , int StorageType , void * pUser ) ;
2015-07-26 10:05:14 +00:00
static void CallbackSaveCopyMap ( const char * pFileName , int StorageType , void * pUser ) ;
2010-05-29 07:25:38 +00:00
void PopupSelectImageInvoke ( int Current , float x , float y ) ;
int PopupSelectImageResult ( ) ;
2011-02-12 18:10:45 +00:00
void PopupSelectGametileOpInvoke ( float x , float y ) ;
int PopupSelectGameTileOpResult ( ) ;
2011-08-11 08:59:14 +00:00
2018-10-03 16:16:58 +00:00
void PopupSelectConfigAutoMapInvoke ( int Current , float x , float y ) ;
2011-07-08 23:09:06 +00:00
int PopupSelectConfigAutoMapResult ( ) ;
2011-04-13 18:37:12 +00:00
2014-10-08 15:33:06 +00:00
void PopupSelectSoundInvoke ( int Current , float x , float y ) ;
2015-07-09 00:08:14 +00:00
int PopupSelectSoundResult ( ) ;
2014-10-08 15:33:06 +00:00
2022-06-11 20:03:23 +00:00
void DoQuadEnvelopes ( const std : : vector < CQuad > & vQuads , IGraphics : : CTextureHandle Texture = IGraphics : : CTextureHandle ( ) ) ;
2012-10-21 12:49:26 +00:00
void DoQuadEnvPoint ( const CQuad * pQuad , int QIndex , int pIndex ) ;
2010-05-29 07:25:38 +00:00
void DoQuadPoint ( CQuad * pQuad , int QuadIndex , int v ) ;
2011-08-14 14:31:48 +00:00
2022-02-26 17:49:06 +00:00
float TriangleArea ( vec2 A , vec2 B , vec2 C ) ;
bool IsInTriangle ( vec2 Point , vec2 A , vec2 B , vec2 C ) ;
void DoQuadKnife ( int QuadIndex ) ;
2014-10-10 17:11:21 +00:00
void DoSoundSource ( CSoundSource * pSource , int Index ) ;
2018-04-04 19:41:14 +00:00
void DoMapEditor ( CUIRect View ) ;
2010-05-29 07:25:38 +00:00
void DoToolbar ( CUIRect Toolbar ) ;
void DoQuad ( CQuad * pQuad , int Index ) ;
2019-04-26 21:47:34 +00:00
ColorRGBA GetButtonColor ( const void * pID , int Checked ) ;
2011-04-13 18:37:12 +00:00
2010-10-07 21:51:07 +00:00
static void ReplaceImage ( const char * pFilename , int StorageType , void * pUser ) ;
2014-11-09 13:58:28 +00:00
static void ReplaceSound ( const char * pFileName , int StorageType , void * pUser ) ;
2010-10-07 21:51:07 +00:00
static void AddImage ( const char * pFilename , int StorageType , void * pUser ) ;
2014-10-08 12:50:25 +00:00
static void AddSound ( const char * pFileName , int StorageType , void * pUser ) ;
2011-04-13 18:37:12 +00:00
2021-02-08 21:26:26 +00:00
bool IsEnvelopeUsed ( int EnvelopeIndex ) const ;
2018-10-14 13:53:14 +00:00
2022-08-13 17:36:53 +00:00
void RenderLayers ( CUIRect LayersBox ) ;
2022-08-13 19:30:43 +00:00
void RenderImagesList ( CUIRect Toolbox ) ;
void RenderSelectedImage ( CUIRect View ) ;
2022-08-13 19:47:52 +00:00
void RenderSounds ( CUIRect Toolbox ) ;
2010-05-29 07:25:38 +00:00
void RenderModebar ( CUIRect View ) ;
void RenderStatusbar ( CUIRect View ) ;
void RenderEnvelopeEditor ( CUIRect View ) ;
2020-10-06 10:58:37 +00:00
void RenderServerSettingsEditor ( CUIRect View , bool ShowServerSettingsEditorLast ) ;
2011-04-13 18:37:12 +00:00
2010-05-29 07:25:38 +00:00
void RenderMenubar ( CUIRect Menubar ) ;
void RenderFileDialog ( ) ;
2010-06-01 20:49:35 +00:00
2010-10-07 21:51:07 +00:00
void AddFileDialogEntry ( int Index , CUIRect * pView ) ;
2020-09-21 17:36:26 +00:00
void SelectGameLayer ( ) ;
2010-06-02 16:12:32 +00:00
void SortImages ( ) ;
2022-08-13 17:36:53 +00:00
bool SelectLayerByTile ( ) ;
2021-08-27 18:28:11 +00:00
2021-08-27 14:06:27 +00:00
//Tile Numbers For Explanations - TODO: Add/Improve tiles and explanations
enum
{
2021-08-28 17:51:38 +00:00
TILE_PUB_AIR ,
TILE_PUB_HOOKABLE ,
TILE_PUB_DEATH ,
TILE_PUB_UNHOOKABLE ,
TILE_PUB_CREDITS1 = 140 ,
TILE_PUB_CREDITS2 ,
TILE_PUB_CREDITS3 ,
TILE_PUB_CREDITS4 ,
TILE_PUB_CREDITS5 = 156 ,
TILE_PUB_CREDITS6 ,
TILE_PUB_CREDITS7 ,
TILE_PUB_CREDITS8 ,
TILE_PUB_ENTITIES_OFF1 = 190 ,
TILE_PUB_ENTITIES_OFF2 ,
} ;
2021-08-27 14:06:27 +00:00
2021-08-28 17:51:38 +00:00
enum
{
2021-08-27 14:06:27 +00:00
TILE_FNG_SPIKE_GOLD = 7 ,
TILE_FNG_SPIKE_NORMAL ,
TILE_FNG_SPIKE_RED ,
TILE_FNG_SPIKE_BLUE ,
2021-08-28 17:51:38 +00:00
TILE_FNG_SCORE_RED ,
TILE_FNG_SCORE_BLUE ,
2021-08-27 14:06:27 +00:00
TILE_FNG_SPIKE_GREEN = 14 ,
2021-08-27 21:20:39 +00:00
TILE_FNG_SPIKE_PURPLE ,
TILE_FNG_SPAWN = 192 ,
TILE_FNG_SPAWN_RED ,
TILE_FNG_SPAWN_BLUE ,
TILE_FNG_FLAG_RED ,
TILE_FNG_FLAG_BLUE ,
TILE_FNG_SHIELD ,
TILE_FNG_HEART ,
TILE_FNG_SHOTGUN ,
TILE_FNG_GRENADE ,
TILE_FNG_NINJA ,
TILE_FNG_LASER ,
TILE_FNG_SPIKE_OLD1 = 208 ,
TILE_FNG_SPIKE_OLD2 ,
TILE_FNG_SPIKE_OLD3
2021-08-27 14:06:27 +00:00
} ;
2021-08-28 17:51:38 +00:00
enum
{
TILE_VANILLA_SPAWN = 192 ,
TILE_VANILLA_SPAWN_RED ,
TILE_VANILLA_SPAWN_BLUE ,
TILE_VANILLA_FLAG_RED ,
TILE_VANILLA_FLAG_BLUE ,
TILE_VANILLA_SHIELD ,
TILE_VANILLA_HEART ,
TILE_VANILLA_SHOTGUN ,
TILE_VANILLA_GRENADE ,
TILE_VANILLA_NINJA ,
TILE_VANILLA_LASER ,
} ;
2021-08-27 14:06:27 +00:00
//Explanations
enum
{
EXPLANATION_DDNET ,
EXPLANATION_FNG ,
EXPLANATION_RACE ,
EXPLANATION_VANILLA ,
EXPLANATION_BLOCKWORLDS
} ;
static const char * Explain ( int ExplanationID , int Tile , int Layer ) ;
2011-04-09 06:41:31 +00:00
2021-02-08 21:26:26 +00:00
int GetLineDistance ( ) const ;
2014-10-07 18:07:46 +00:00
void ZoomMouseTarget ( float ZoomFactor ) ;
2011-08-13 00:11:06 +00:00
2019-04-26 12:06:32 +00:00
static ColorHSVA ms_PickerColor ;
2015-08-17 12:10:08 +00:00
static int ms_SVPicker ;
static int ms_HuePicker ;
2011-04-09 06:41:31 +00:00
// DDRace
2022-02-11 10:10:03 +00:00
IGraphics : : CTextureHandle GetFrontTexture ( ) ;
IGraphics : : CTextureHandle GetTeleTexture ( ) ;
IGraphics : : CTextureHandle GetSpeedupTexture ( ) ;
IGraphics : : CTextureHandle GetSwitchTexture ( ) ;
IGraphics : : CTextureHandle GetTuneTexture ( ) ;
2020-02-28 15:25:27 +00:00
static int PopupTele ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSpeedup ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupSwitch ( CEditor * pEditor , CUIRect View , void * pContext ) ;
static int PopupTune ( CEditor * pEditor , CUIRect View , void * pContext ) ;
2022-08-20 18:47:46 +00:00
static int PopupGoto ( CEditor * pEditor , CUIRect View , void * pContext ) ;
void Goto ( float X , float Y ) ;
2010-12-07 15:51:59 +00:00
unsigned char m_TeleNumber ;
2015-07-09 00:08:14 +00:00
2014-03-12 22:27:03 +00:00
unsigned char m_TuningNum ;
2011-04-09 06:41:31 +00:00
2010-09-30 21:31:19 +00:00
unsigned char m_SpeedupForce ;
unsigned char m_SpeedupMaxSpeed ;
short m_SpeedupAngle ;
unsigned char m_SwitchNum ;
2010-11-22 20:43:22 +00:00
unsigned char m_SwitchDelay ;
2022-08-20 18:47:46 +00:00
2022-08-20 20:05:23 +00:00
int m_GotoX ;
int m_GotoY ;
2010-05-29 07:25:38 +00:00
} ;
// make sure to inline this function
inline class IGraphics * CLayer : : Graphics ( ) { return m_pEditor - > Graphics ( ) ; }
inline class ITextRender * CLayer : : TextRender ( ) { return m_pEditor - > TextRender ( ) ; }
2011-04-09 06:41:31 +00:00
// DDRace
class CLayerTele : public CLayerTiles
{
public :
CLayerTele ( int w , int h ) ;
~ CLayerTele ( ) ;
CTeleTile * m_pTeleTile ;
unsigned char m_TeleNum ;
2022-05-17 20:13:44 +00:00
void Resize ( int NewW , int NewH ) override ;
void Shift ( int Direction ) override ;
bool IsEmpty ( CLayerTiles * pLayer ) override ;
void BrushDraw ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) override ;
2020-05-15 22:42:11 +00:00
virtual bool ContainsElementWithId ( int Id ) ;
2011-04-09 06:41:31 +00:00
} ;
class CLayerSpeedup : public CLayerTiles
{
public :
CLayerSpeedup ( int w , int h ) ;
~ CLayerSpeedup ( ) ;
CSpeedupTile * m_pSpeedupTile ;
2019-09-20 18:52:28 +00:00
int m_SpeedupForce ;
int m_SpeedupMaxSpeed ;
int m_SpeedupAngle ;
2011-04-09 06:41:31 +00:00
2022-05-17 20:13:44 +00:00
void Resize ( int NewW , int NewH ) override ;
void Shift ( int Direction ) override ;
bool IsEmpty ( CLayerTiles * pLayer ) override ;
void BrushDraw ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) override ;
2011-04-09 06:41:31 +00:00
} ;
class CLayerFront : public CLayerTiles
{
public :
CLayerFront ( int w , int h ) ;
2022-05-17 20:13:44 +00:00
void Resize ( int NewW , int NewH ) override ;
void SetTile ( int x , int y , CTile tile ) override ;
2011-04-09 06:41:31 +00:00
} ;
class CLayerSwitch : public CLayerTiles
{
public :
CLayerSwitch ( int w , int h ) ;
~ CLayerSwitch ( ) ;
CSwitchTile * m_pSwitchTile ;
unsigned char m_SwitchNumber ;
unsigned char m_SwitchDelay ;
2022-05-17 20:13:44 +00:00
void Resize ( int NewW , int NewH ) override ;
void Shift ( int Direction ) override ;
bool IsEmpty ( CLayerTiles * pLayer ) override ;
void BrushDraw ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) override ;
2020-05-17 00:56:35 +00:00
virtual bool ContainsElementWithId ( int Id ) ;
2011-04-09 06:41:31 +00:00
} ;
2014-03-12 22:27:03 +00:00
class CLayerTune : public CLayerTiles
{
public :
CLayerTune ( int w , int h ) ;
~ CLayerTune ( ) ;
CTuneTile * m_pTuneTile ;
unsigned char m_TuningNumber ;
2022-05-17 20:13:44 +00:00
void Resize ( int NewW , int NewH ) override ;
void Shift ( int Direction ) override ;
bool IsEmpty ( CLayerTiles * pLayer ) override ;
void BrushDraw ( CLayer * pBrush , float wx , float wy ) override ;
void BrushFlipX ( ) override ;
void BrushFlipY ( ) override ;
void BrushRotate ( float Amount ) override ;
void FillSelection ( bool Empty , CLayer * pBrush , CUIRect Rect ) override ;
2014-03-12 22:27:03 +00:00
} ;
2014-10-08 15:33:06 +00:00
class CLayerSounds : public CLayer
{
public :
CLayerSounds ( ) ;
2022-08-17 23:07:16 +00:00
CLayerSounds ( const CLayerSounds & Other ) ;
2014-10-08 15:33:06 +00:00
~ CLayerSounds ( ) ;
2022-05-17 20:13:44 +00:00
void Render ( bool Tileset = false ) override ;
2019-03-28 12:41:07 +00:00
CSoundSource * NewSource ( int x , int y ) ;
2014-10-08 15:33:06 +00:00
2022-05-17 20:13:44 +00:00
void BrushSelecting ( CUIRect Rect ) override ;
int BrushGrab ( CLayerGroup * pBrush , CUIRect Rect ) override ;
void BrushPlace ( CLayer * pBrush , float wx , float wy ) override ;
2014-10-08 15:33:06 +00:00
2022-05-17 20:13:44 +00:00
int RenderProperties ( CUIRect * pToolbox ) override ;
2014-10-08 15:33:06 +00:00
2022-05-17 20:13:44 +00:00
void ModifyEnvelopeIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
void ModifySoundIndex ( INDEX_MODIFY_FUNC pfnFunc ) override ;
2014-10-08 15:33:06 +00:00
2022-08-17 23:07:16 +00:00
CLayer * Duplicate ( ) const override ;
2014-10-08 15:33:06 +00:00
int m_Sound ;
2022-06-11 19:38:18 +00:00
std : : vector < CSoundSource > m_vSources ;
2014-10-08 15:33:06 +00:00
} ;
2010-05-29 07:25:38 +00:00
# endif