Editor Improvements

Added possibility to write separate explanations for different entities and fixed a bug.
This commit is contained in:
HamidReza 2021-08-27 18:36:27 +04:30
parent a8c36540e5
commit 8dbefa734f
3 changed files with 539 additions and 459 deletions

View file

@ -2392,7 +2392,12 @@ void CEditor::DoMapEditor(CUIRect View)
Layer = LAYER_TUNE;
}
if(m_ShowPicker && Layer != NUM_LAYERS)
m_pTooltip = Explain((int)wx / 32 + (int)wy / 32 * 16, Layer);
{
if(m_SelectEntitiesImage == "DDNet")
m_pTooltip = Explain(EXPLANATION_DDNET, (int)wx / 32 + (int)wy / 32 * 16, Layer);
else if(m_SelectEntitiesImage == "FNG")
m_pTooltip = Explain(EXPLANATION_FNG, (int)wx / 32 + (int)wy / 32 * 16, Layer);
}
else if(m_Brush.IsEmpty())
m_pTooltip = "Use left mouse button to drag and create a brush. Hold shift to select multiple quads.";
else

View file

@ -1060,7 +1060,34 @@ public:
void AddFileDialogEntry(int Index, CUIRect *pView);
void SelectGameLayer();
void SortImages();
static const char *Explain(int Tile, int Layer);
//Tile Numbers For Explanations - TODO: Add/Improve tiles and explanations
enum
{
TILE_FNG_AIR,
TILE_FNG_HOOKABLE,
TILE_FNG_DEATH,
TILE_FNG_UNHOOKABLE,
TILE_FNG_SPIKE_GOLD = 7,
TILE_FNG_SPIKE_NORMAL,
TILE_FNG_SPIKE_RED,
TILE_FNG_SPIKE_BLUE,
TILE_FNG_SPIKE_GREEN = 14,
TILE_FNG_SPIKE_PURPLE
};
//Explanations
enum
{
EXPLANATION_DDNET,
EXPLANATION_FNG,
EXPLANATION_RACE,
EXPLANATION_VANILLA,
EXPLANATION_BLOCKWORLDS
};
static const char *Explain(int ExplanationID, int Tile, int Layer);
int GetLineDistance() const;
void ZoomMouseTarget(float ZoomFactor);

View file

@ -1,7 +1,9 @@
#include "editor.h"
// Explanations by Lady Saavik
const char *CEditor::Explain(int Tile, int Layer)
// DDNet entity explanations by Lady Saavik
const char *CEditor::Explain(int ExplanationID, int Tile, int Layer) //TODO: Add other entities' tiles' explanations and improve new ones
{
if(ExplanationID == EXPLANATION_DDNET)
{
switch(Tile)
{
@ -461,3 +463,49 @@ const char *CEditor::Explain(int Tile, int Layer)
return "TIME CHECKPOINT: Compares your current race time with your record to show you whether you are running faster or slower.";
return "";
}
else if(ExplanationID == EXPLANATION_FNG)
{
switch(Tile)
{
case TILE_FNG_AIR:
return "EMPTY: Can be used as an eraser.";
case TILE_FNG_HOOKABLE:
if(Layer == LAYER_GAME)
return "HOOKABLE: It's possible to hook and collide with it.";
break;
case TILE_FNG_DEATH:
if(Layer == LAYER_GAME)
return "DEATH: Kills the tee.";
break;
case TILE_FNG_UNHOOKABLE:
if(Layer == LAYER_GAME)
return "UNHOOKABLE: It's not possible to hook it, but can collide with it.";
break;
case TILE_FNG_SPIKE_GOLD:
if(Layer == LAYER_GAME)
return "GOLDEN SPIKE: Kills the tee and gives points to the killer. (Amount of points given is set inside the server)";
break;
case TILE_FNG_SPIKE_NORMAL:
if(Layer == LAYER_GAME)
return "NORMAL SPIKE: Kills the tee and gives points to the killer. (Amount of points given is set inside the server)";
break;
case TILE_FNG_SPIKE_RED:
if(Layer == LAYER_GAME)
return "RED SPIKE: Red team spikes. Gives negative points when killer is in blue team (Amount of points given is set inside the server)";
break;
case TILE_FNG_SPIKE_BLUE:
if(Layer == LAYER_GAME)
return "BLUE SPIKE: Blue team spikes. Gives negative points when killer is in red team (Amount of points given is set inside the server)";
break;
case TILE_FNG_SPIKE_GREEN:
if(Layer == LAYER_GAME)
return "GREEN SPIKE: Kills the tee and gives points to the killer. (Amount of points given is set inside the server)";
break;
case TILE_FNG_SPIKE_PURPLE:
if(Layer == LAYER_GAME)
return "PURPLE SPIKE: Kills the tee and gives points to the killer. (Amount of points given is set inside the server)";
break;
}
return "";
}
}