diff options
| author | oy <Tom_Adams@web.de> | 2011-02-18 11:41:27 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-18 11:41:27 +0100 |
| commit | 4f91026a01436d95cb20b3a994e96dce5072544e (patch) | |
| tree | 5faaec04c1404bc473f0f6b5c57b9c243730ec00 | |
| parent | 169efb129f947209b6d3cdfdc632d3804dcd549d (diff) | |
| download | zcatch-4f91026a01436d95cb20b3a994e96dce5072544e.tar.gz zcatch-4f91026a01436d95cb20b3a994e96dce5072544e.zip | |
added an editor function to show tile informations (index, flip/rotate status)
| -rw-r--r-- | data/languages/bosnian.txt | 6 | ||||
| -rw-r--r-- | data/languages/czech.txt | 6 | ||||
| -rw-r--r-- | data/languages/dutch.txt | 6 | ||||
| -rw-r--r-- | data/languages/finnish.txt | 6 | ||||
| -rw-r--r-- | data/languages/french.txt | 6 | ||||
| -rw-r--r-- | data/languages/german.txt | 6 | ||||
| -rw-r--r-- | data/languages/italian.txt | 6 | ||||
| -rw-r--r-- | data/languages/polish.txt | 6 | ||||
| -rw-r--r-- | data/languages/portuguese.txt | 6 | ||||
| -rw-r--r-- | data/languages/romanian.txt | 6 | ||||
| -rw-r--r-- | data/languages/russian.txt | 6 | ||||
| -rw-r--r-- | data/languages/serbian.txt | 6 | ||||
| -rw-r--r-- | data/languages/spanish.txt | 6 | ||||
| -rw-r--r-- | data/languages/swedish.txt | 6 | ||||
| -rw-r--r-- | data/languages/ukrainian.txt | 6 | ||||
| -rw-r--r-- | src/engine/client.h | 2 | ||||
| -rw-r--r-- | src/engine/client/client.h | 2 | ||||
| -rw-r--r-- | src/game/editor/ed_editor.cpp | 19 | ||||
| -rw-r--r-- | src/game/editor/ed_editor.h | 3 | ||||
| -rw-r--r-- | src/game/editor/ed_layer_tiles.cpp | 32 |
20 files changed, 147 insertions, 1 deletions
diff --git a/data/languages/bosnian.txt b/data/languages/bosnian.txt index d3bbf5e7..8348e093 100644 --- a/data/languages/bosnian.txt +++ b/data/languages/bosnian.txt @@ -540,6 +540,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/czech.txt b/data/languages/czech.txt index 829a0059..f102e039 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -480,6 +480,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index ce649d21..df4b4139 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -960,6 +960,9 @@ no limit ##### needs translation ##### +Adds border tiles +== + Clean-up game tiles == @@ -984,5 +987,8 @@ Removes game tiles that aren't based on a layer Unhookable == +[ctrl+i] Show tile informations +== + ##### old translations ##### diff --git a/data/languages/finnish.txt b/data/languages/finnish.txt index 0b76d6ed..82601e83 100644 --- a/data/languages/finnish.txt +++ b/data/languages/finnish.txt @@ -504,6 +504,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/french.txt b/data/languages/french.txt index 278efb26..a563c184 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -825,6 +825,9 @@ Add tile layer Adds a new quad == +Adds border tiles +== + Aspect ratio == @@ -978,6 +981,9 @@ Y-axis of the envelope [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/german.txt b/data/languages/german.txt index 43c96f41..e8977b7c 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -960,6 +960,9 @@ no limit ##### needs translation ##### +Adds border tiles +== + Clean-up game tiles == @@ -984,5 +987,8 @@ Removes game tiles that aren't based on a layer Unhookable == +[ctrl+i] Show tile informations +== + ##### old translations ##### diff --git a/data/languages/italian.txt b/data/languages/italian.txt index 85b4e345..d57bb71e 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -930,6 +930,9 @@ no limit ##### needs translation ##### +Adds border tiles +== + Clean-up game tiles == @@ -984,5 +987,8 @@ Unhookable Warmup == +[ctrl+i] Show tile informations +== + ##### old translations ##### diff --git a/data/languages/polish.txt b/data/languages/polish.txt index d1b9c368..f9681852 100644 --- a/data/languages/polish.txt +++ b/data/languages/polish.txt @@ -783,6 +783,9 @@ ZO %i seconds left == +Adds border tiles +== + Alpha value of the envelope == @@ -981,6 +984,9 @@ Y-axis of the envelope [HOME] Restore map focus == +[ctrl+i] Show tile informations +== + no limit == diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index 81a5f37a..d8272a96 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -501,6 +501,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/romanian.txt b/data/languages/romanian.txt index 5c967699..9277738f 100644 --- a/data/languages/romanian.txt +++ b/data/languages/romanian.txt @@ -960,6 +960,9 @@ no limit ##### needs translation ##### +Adds border tiles +== + Clean-up game tiles == @@ -984,5 +987,8 @@ Removes game tiles that aren't based on a layer Unhookable == +[ctrl+i] Show tile informations +== + ##### old translations ##### diff --git a/data/languages/russian.txt b/data/languages/russian.txt index bdf12a9b..d559f5c8 100644 --- a/data/languages/russian.txt +++ b/data/languages/russian.txt @@ -795,6 +795,9 @@ ZO %i seconds left == +Adds border tiles +== + Alpha value of the envelope == @@ -981,6 +984,9 @@ Y-axis of the envelope [HOME] Restore map focus == +[ctrl+i] Show tile informations +== + no limit == diff --git a/data/languages/serbian.txt b/data/languages/serbian.txt index 8bbe71e7..88a65000 100644 --- a/data/languages/serbian.txt +++ b/data/languages/serbian.txt @@ -504,6 +504,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/spanish.txt b/data/languages/spanish.txt index 807ccfc9..79954dc4 100644 --- a/data/languages/spanish.txt +++ b/data/languages/spanish.txt @@ -960,6 +960,9 @@ no limit ##### needs translation ##### +Adds border tiles +== + Clean-up game tiles == @@ -984,5 +987,8 @@ Removes game tiles that aren't based on a layer Unhookable == +[ctrl+i] Show tile informations +== + ##### old translations ##### diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index bc39692f..7edca5c2 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -474,6 +474,9 @@ Adds a new group Adds a new quad == +Adds border tiles +== + Alpha value of the envelope == @@ -975,6 +978,9 @@ ZO [ctrl+h] Toggle High Detail == +[ctrl+i] Show tile informations +== + [ctrl+m] Toggle animation == diff --git a/data/languages/ukrainian.txt b/data/languages/ukrainian.txt index ac5b002f..0ce746d6 100644 --- a/data/languages/ukrainian.txt +++ b/data/languages/ukrainian.txt @@ -849,6 +849,9 @@ ZO %i seconds left == +Adds border tiles +== + Alpha value of the envelope == @@ -981,6 +984,9 @@ Y-axis of the envelope [HOME] Restore map focus == +[ctrl+i] Show tile informations +== + no limit == diff --git a/src/engine/client.h b/src/engine/client.h index e6bc0f2e..539bed44 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -132,6 +132,8 @@ public: virtual bool ConnectionProblems() = 0; virtual bool SoundInitFailed() = 0; + + virtual int GetDebugFont() = 0; }; class IGameClient : public IInterface diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 35cbad3b..c073139a 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -238,6 +238,8 @@ public: virtual bool SoundInitFailed() { return m_SoundInitFailed; } + virtual int GetDebugFont() { return m_DebugFont; } + void DirectInput(int *pInput, int Size); void SendInput(); diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index bbe321cf..a4ec3556 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -666,6 +666,17 @@ void CEditor::DoToolbar(CUIRect ToolBar) m_ProofBorders = !m_ProofBorders; } + TB_Top.VSplitLeft(5.0f, 0, &TB_Top); + + // tile info button + TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); + static int s_TileInfoButton = 0; + if(DoButton_Editor(&s_TileInfoButton, Localize("Info"), m_ShowTileInfo, &Button, 0, Localize("[ctrl+i] Show tile informations")) || + (Input()->KeyDown('i') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + { + m_ShowTileInfo = !m_ShowTileInfo; + } + TB_Top.VSplitLeft(15.0f, 0, &TB_Top); // zoom group @@ -812,7 +823,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) static int s_BorderBut = 0; CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES); - if(DoButton_Editor(&s_BorderBut, Localize("Border"), pT?0:-1, &Button, 0, Localize("Border"))) + if(DoButton_Editor(&s_BorderBut, Localize("Border"), pT?0:-1, &Button, 0, Localize("Adds border tiles"))) { if(pT) DoMapBorder(); @@ -1147,6 +1158,10 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) m_Map.m_pGameGroup->MapScreen(); m_Map.m_pGameLayer->Render(); } + + CLayerTiles *pT = static_cast<CLayerTiles *>(GetSelectedLayerType(0, LAYERTYPE_TILES)); + if(m_ShowTileInfo && pT && pT->m_Visible && m_ZoomLevel <= 300) + pT->ShowInfo(); } static void *s_pEditorID = (void *)&s_pEditorID; @@ -1191,6 +1206,8 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) m_TilesetPicker.m_Image = t->m_Image; m_TilesetPicker.m_TexID = t->m_TexID; m_TilesetPicker.Render(); + if(m_ShowTileInfo) + m_TilesetPicker.ShowInfo(); } } diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 648a5829..61af9249 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -380,6 +380,7 @@ public: virtual void BrushFlipY(); virtual void BrushRotate(float Amount); + virtual void ShowInfo(); virtual int RenderProperties(CUIRect *pToolbox); virtual void ModifyImageIndex(INDEX_MODIFY_FUNC pfnFunc); @@ -500,6 +501,7 @@ public: m_GuiActive = true; m_ProofBorders = false; + m_ShowTileInfo = false; m_ShowDetail = true; m_Animate = false; m_AnimateStart = 0; @@ -598,6 +600,7 @@ public: float m_MouseDeltaWx; float m_MouseDeltaWy; + bool m_ShowTileInfo; bool m_ShowDetail; bool m_Animate; int64 m_AnimateStart; diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp index 57b77e36..e26d98bd 100644 --- a/src/game/editor/ed_layer_tiles.cpp +++ b/src/game/editor/ed_layer_tiles.cpp @@ -2,6 +2,7 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include <base/math.h> +#include <engine/client.h> #include <engine/graphics.h> #include <engine/textrender.h> @@ -321,6 +322,37 @@ void CLayerTiles::Shift(int Direction) } } +void CLayerTiles::ShowInfo() +{ + float ScreenX0, ScreenY0, ScreenX1, ScreenY1; + Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1); + Graphics()->TextureSet(m_pEditor->Client()->GetDebugFont()); + + int StartY = max(0, (int)(ScreenY0/32.0f)-1); + int StartX = max(0, (int)(ScreenX0/32.0f)-1); + int EndY = min((int)(ScreenY1/32.0f)+1, m_Height); + int EndX = min((int)(ScreenX1/32.0f)+1, m_Width); + + for(int y = StartY; y < EndY; y++) + for(int x = StartX; x < EndX; x++) + { + int c = x + y*m_Width; + if(m_pTiles[c].m_Index) + { + char aBuf[64]; + str_format(aBuf, sizeof(aBuf), "%i", m_pTiles[c].m_Index); + m_pEditor->Graphics()->QuadsText(x*32, y*32, 16.0f, 1,1,1,1, aBuf); + + char aFlags[4] = { m_pTiles[c].m_Flags&TILEFLAG_VFLIP ? 'V' : ' ', + m_pTiles[c].m_Flags&TILEFLAG_HFLIP ? 'H' : ' ', + m_pTiles[c].m_Flags&TILEFLAG_ROTATE? 'R' : ' ', + 0}; + m_pEditor->Graphics()->QuadsText(x*32, y*32+16, 16.0f, 1,1,1,1, aFlags); + } + x += m_pTiles[c].m_Skip; + } +} + int CLayerTiles::RenderProperties(CUIRect *pToolBox) { CUIRect Button; |