OpenClonk
C4ToolsDlg Class Reference

#include <C4ToolsDlg.h>

Classes

class  State
 

Public Member Functions

 C4ToolsDlg ()
 
 ~C4ToolsDlg ()
 
void Default ()
 
void Clear ()
 
bool PopTextures ()
 
bool PopMaterial ()
 
bool ChangeGrade (int32_t iChange)
 
void NeedPreviewUpdate ()
 
bool Open ()
 
bool SetGrade (int32_t iGrade)
 
bool SetTool (int32_t iTool, bool fTemp)
 
bool ToggleTool ()
 
bool SetLandscapeMode (LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false)
 
bool SetIFT (bool fIFT)
 
bool ToggleIFT ()
 
bool SelectTexture (const char *szTexture, bool by_console_gui=false)
 
bool SelectMaterial (const char *szMaterial, bool by_console_gui=false)
 
bool SelectBackTexture (const char *szTexture, bool by_console_gui=false)
 
bool SelectBackMaterial (const char *szMaterial, bool by_console_gui=false)
 
void SetAlternateTool ()
 
void ResetAlternateTool ()
 
bool IsGradedTool () const
 
void UpdateLandscapeModeCtrls ()
 
void SetTexture (const char *szTexture)
 
void SetMaterial (const char *szMaterial)
 
void SetBackTexture (const char *szTexture)
 
void SetBackMaterial (const char *szMaterial)
 

Public Attributes

bool Active
 
int32_t Tool
 
int32_t SelectedTool
 
int32_t Grade
 
bool ModeIFT
 
char Material [C4M_MaxName+1]
 
char Texture [C4M_MaxName+1]
 
bool ModeBack
 
char BackMaterial [C4M_MaxName+1]
 
char BackTexture [C4M_MaxName+1]
 

Protected Member Functions

void AssertValidTexture ()
 
void AssertValidBackTexture ()
 
void LoadBitmaps ()
 
void EnableControls ()
 
void UpdateIFTControls ()
 
void InitGradeCtrl ()
 
void InitMaterialCtrls ()
 
void UpdateToolCtrls ()
 
void UpdateTextures ()
 
void SetColorPattern (const char *szMaterial, const char *szTexture)
 

Friends

class C4ConsoleGUI
 

Detailed Description

Definition at line 42 of file C4ToolsDlg.h.

Constructor & Destructor Documentation

◆ C4ToolsDlg()

C4ToolsDlg::C4ToolsDlg ( )

◆ ~C4ToolsDlg()

C4ToolsDlg::~C4ToolsDlg ( )

Member Function Documentation

◆ AssertValidBackTexture()

void C4ToolsDlg::AssertValidBackTexture ( )
protected

Definition at line 236 of file C4ToolsDlg.cpp.

237 {
238  // Static map mode only
239  if (::Landscape.GetMode() != LandscapeMode::Static) return;
240  // Ignore if not enabled
241  if (!ModeBack) return;
242  // Ignore if sky
243  if (SEqual(BackMaterial,C4TLS_MatSky)) return;
244  // Current material-texture valid
245  if (::TextureMap.GetIndex(BackMaterial,BackTexture,false)) return;
246  // Find valid material-texture
247  const char *szTexture;
248  for (int32_t iTexture=0; (szTexture=::TextureMap.GetTexture(iTexture)); iTexture++)
249  {
250  if (::TextureMap.GetIndex(BackMaterial,szTexture,false))
251  { SelectBackTexture(szTexture); return; }
252  }
253  // No valid texture found
254 }
C4Landscape Landscape
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
#define C4TLS_MatSky
Definition: C4ToolsDlg.h:39
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
LandscapeMode GetMode() const
int32_t GetIndex(const char *szMaterial, const char *szTexture, bool fAddIfNotExist=true, const char *szErrorIfFailed=nullptr)
Definition: C4Texture.cpp:414
const char * GetTexture(int32_t iIndex)
Definition: C4Texture.cpp:494
bool ModeBack
Definition: C4ToolsDlg.h:58
bool SelectBackTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:270
char BackTexture[C4M_MaxName+1]
Definition: C4ToolsDlg.h:60
char BackMaterial[C4M_MaxName+1]
Definition: C4ToolsDlg.h:59

References BackMaterial, BackTexture, C4TLS_MatSky, C4TextureMap::GetIndex(), C4Landscape::GetMode(), C4TextureMap::GetTexture(), Landscape, ModeBack, SelectBackTexture(), SEqual(), Static, and TextureMap.

Referenced by SetBackMaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AssertValidTexture()

void C4ToolsDlg::AssertValidTexture ( )
protected

Definition at line 216 of file C4ToolsDlg.cpp.

217 {
218 #ifndef WITH_QT_EDITOR // Qt Editor textures are always valid, because MatTex entries are selected directly
219  // Static map mode only
220  if (::Landscape.GetMode() != LandscapeMode::Static) return;
221  // Ignore if sky
222  if (SEqual(Material,C4TLS_MatSky)) return;
223  // Current material-texture valid
224  if (::TextureMap.GetIndex(Material,Texture,false)) return;
225  // Find valid material-texture
226  const char *szTexture;
227  for (int32_t iTexture=0; (szTexture=::TextureMap.GetTexture(iTexture)); iTexture++)
228  {
229  if (::TextureMap.GetIndex(Material,szTexture,false))
230  { SelectTexture(szTexture); return; }
231  }
232  // No valid texture found
233 #endif
234 }
bool SelectTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:256
char Texture[C4M_MaxName+1]
Definition: C4ToolsDlg.h:57
char Material[C4M_MaxName+1]
Definition: C4ToolsDlg.h:56

References C4TLS_MatSky, C4TextureMap::GetIndex(), C4Landscape::GetMode(), C4TextureMap::GetTexture(), Landscape, Material, SelectTexture(), SEqual(), Static, Texture, and TextureMap.

Referenced by SetMaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChangeGrade()

bool C4ToolsDlg::ChangeGrade ( int32_t  iChange)

Definition at line 173 of file C4ToolsDlg.cpp.

174 {
177  InitGradeCtrl();
178  return true;
179 }
const int32_t C4TLS_GradeMin
Definition: C4ToolsDlg.h:36
const int32_t C4TLS_GradeMax
Definition: C4ToolsDlg.h:35
T Clamp(T bval, T lbound, T rbound)
Definition: Standard.h:44
void InitGradeCtrl()
Definition: C4Console.cpp:701
int32_t Grade
Definition: C4ToolsDlg.h:54
void NeedPreviewUpdate()
Definition: C4Console.cpp:702

References C4TLS_GradeMax, C4TLS_GradeMin, Clamp(), Grade, InitGradeCtrl(), and NeedPreviewUpdate().

Referenced by C4Game::InitKeyboard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clear()

void C4ToolsDlg::Clear ( )

Definition at line 41 of file C4ConsoleGUICommon.h.

42 {
43  state->Clear();
45  Active = false;
46 }
C4Console Console
Definition: C4Globals.cpp:45
void ToolsDlgClose()
Definition: C4Console.cpp:666
bool Active
Definition: C4ToolsDlg.h:52

References Clear(), Console, and C4ConsoleGUI::ToolsDlgClose().

Referenced by Clear(), and C4Console::Clear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Default()

void C4ToolsDlg::Default ( )

Definition at line 48 of file C4ConsoleGUICommon.h.

49 {
50  Active = false;
53  ModeIFT = true;
54  SCopy("Earth",Material);
55  SCopy("earth",Texture);
56  ModeBack = false;
57  SCopy("Tunnel", BackMaterial);
58  SCopy("tunnel", BackTexture);
59  state->Default();
60 }
const int32_t C4TLS_Brush
Definition: C4ToolsDlg.h:28
const int32_t C4TLS_GradeDefault
Definition: C4ToolsDlg.h:37
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
int32_t Tool
Definition: C4ToolsDlg.h:53
bool ModeIFT
Definition: C4ToolsDlg.h:55
int32_t SelectedTool
Definition: C4ToolsDlg.h:53

References Active, BackMaterial, BackTexture, C4TLS_Brush, C4TLS_GradeDefault, C4ToolsDlg::State::Default(), Grade, Material, ModeBack, ModeIFT, SCopy(), SelectedTool, Texture, and Tool.

Referenced by C4Console::Default().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableControls()

void C4ToolsDlg::EnableControls ( )
protected

Definition at line 700 of file C4Console.cpp.

700 {}

Referenced by Open(), SetBackMaterial(), SetLandscapeMode(), and SetMaterial().

Here is the caller graph for this function:

◆ InitGradeCtrl()

void C4ToolsDlg::InitGradeCtrl ( )
protected

Definition at line 701 of file C4Console.cpp.

701 {}

Referenced by ChangeGrade(), and Open().

Here is the caller graph for this function:

◆ InitMaterialCtrls()

void C4ToolsDlg::InitMaterialCtrls ( )
protected

Definition at line 52 of file C4ToolsDlg.cpp.

53 {
54  // Materials
56  // Textures
58 }
void ToolsDlgInitMaterialCtrls(class C4ToolsDlg *dlg)
Definition: C4Console.cpp:693
void UpdateTextures()
Definition: C4Console.cpp:707

References Console, C4ConsoleGUI::ToolsDlgInitMaterialCtrls(), and UpdateTextures().

Referenced by Open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsGradedTool()

bool C4ToolsDlg::IsGradedTool ( ) const
inline

Definition at line 81 of file C4ToolsDlg.h.

81 { return Tool == C4TLS_Brush || Tool == C4TLS_Line || Tool == C4TLS_Fill; } // return whether Grade measure affects selected tool
const int32_t C4TLS_Line
Definition: C4ToolsDlg.h:29
const int32_t C4TLS_Fill
Definition: C4ToolsDlg.h:31

References C4TLS_Brush, C4TLS_Fill, C4TLS_Line, and Tool.

Referenced by C4EditCursor::Draw().

Here is the caller graph for this function:

◆ LoadBitmaps()

void C4ToolsDlg::LoadBitmaps ( )
protected

◆ NeedPreviewUpdate()

void C4ToolsDlg::NeedPreviewUpdate ( )

Definition at line 702 of file C4Console.cpp.

702 {}

Referenced by ChangeGrade(), SetGrade(), SetIFT(), SetMaterial(), SetTexture(), and SetTool().

Here is the caller graph for this function:

◆ Open()

bool C4ToolsDlg::Open ( )

Definition at line 28 of file C4ToolsDlg.cpp.

29 {
30  // Create dialog window
31  Console.ToolsDlgOpen(this);
32  Active = true;
33  // Update contols
34  InitGradeCtrl();
40  return true;
41 }
bool ToolsDlgOpen(class C4ToolsDlg *dlg)
Definition: C4Console.cpp:694
void UpdateIFTControls()
Definition: C4Console.cpp:705
void UpdateLandscapeModeCtrls()
Definition: C4Console.cpp:706
void UpdateToolCtrls()
Definition: C4Console.cpp:708
void InitMaterialCtrls()
Definition: C4ToolsDlg.cpp:52
void EnableControls()
Definition: C4Console.cpp:700

References Active, Console, EnableControls(), InitGradeCtrl(), InitMaterialCtrls(), C4ConsoleGUI::ToolsDlgOpen(), UpdateIFTControls(), UpdateLandscapeModeCtrls(), and UpdateToolCtrls().

Referenced by C4EditCursor::OpenPropTools().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopMaterial()

bool C4ToolsDlg::PopMaterial ( )

Definition at line 703 of file C4Console.cpp.

703 {return false;}

Referenced by C4Game::InitKeyboard().

Here is the caller graph for this function:

◆ PopTextures()

bool C4ToolsDlg::PopTextures ( )

Definition at line 704 of file C4Console.cpp.

704 {return false;}

Referenced by C4Game::InitKeyboard().

Here is the caller graph for this function:

◆ ResetAlternateTool()

void C4ToolsDlg::ResetAlternateTool ( )

Definition at line 290 of file C4ToolsDlg.cpp.

291 {
292  // reset tool to selected tool in case alternate tool was set
293  SetTool(SelectedTool, true);
294 }
bool SetTool(int32_t iTool, bool fTemp)
Definition: C4ToolsDlg.cpp:43

References SelectedTool, and SetTool().

Referenced by C4EditCursor::AltUp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectBackMaterial()

bool C4ToolsDlg::SelectBackMaterial ( const char *  szMaterial,
bool  by_console_gui = false 
)

Definition at line 277 of file C4ToolsDlg.cpp.

278 {
279  if (!by_console_gui) Console.ToolsDlgSelectBackMaterial(this, szMaterial);
280  SetBackMaterial(szMaterial);
281  return true;
282 }
void ToolsDlgSelectBackMaterial(C4ToolsDlg *dlg, const char *material)
Definition: C4Console.cpp:697
void SetBackMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:106

References Console, SetBackMaterial(), and C4ConsoleGUI::ToolsDlgSelectBackMaterial().

Referenced by C4EditCursor::ApplyToolPicker(), SetMaterial(), and SetTexture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectBackTexture()

bool C4ToolsDlg::SelectBackTexture ( const char *  szTexture,
bool  by_console_gui = false 
)

Definition at line 270 of file C4ToolsDlg.cpp.

271 {
272  if (!by_console_gui) Console.ToolsDlgSelectBackTexture(this, szTexture);
273  SetBackTexture(szTexture);
274  return true;
275 }
void ToolsDlgSelectBackTexture(C4ToolsDlg *dlg, const char *texture)
Definition: C4Console.cpp:698
void SetBackTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:116

References Console, SetBackTexture(), and C4ConsoleGUI::ToolsDlgSelectBackTexture().

Referenced by C4EditCursor::ApplyToolPicker(), AssertValidBackTexture(), and SetTexture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectMaterial()

bool C4ToolsDlg::SelectMaterial ( const char *  szMaterial,
bool  by_console_gui = false 
)

Definition at line 263 of file C4ToolsDlg.cpp.

264 {
265  if (!by_console_gui) Console.ToolsDlgSelectMaterial(this, szMaterial);
266  SetMaterial(szMaterial);
267  return true;
268 }
void ToolsDlgSelectMaterial(C4ToolsDlg *dlg, const char *material)
Definition: C4Console.cpp:695
void SetMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:60

References Console, SetMaterial(), and C4ConsoleGUI::ToolsDlgSelectMaterial().

Referenced by C4EditCursor::ApplyToolPicker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectTexture()

bool C4ToolsDlg::SelectTexture ( const char *  szTexture,
bool  by_console_gui = false 
)

Definition at line 256 of file C4ToolsDlg.cpp.

257 {
258  if (!by_console_gui) Console.ToolsDlgSelectTexture(this, szTexture);
259  SetTexture(szTexture);
260  return true;
261 }
void ToolsDlgSelectTexture(C4ToolsDlg *dlg, const char *texture)
Definition: C4Console.cpp:696
void SetTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:71

References Console, SetTexture(), and C4ConsoleGUI::ToolsDlgSelectTexture().

Referenced by C4EditCursor::ApplyToolPicker(), and AssertValidTexture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAlternateTool()

void C4ToolsDlg::SetAlternateTool ( )

Definition at line 284 of file C4ToolsDlg.cpp.

285 {
286  // alternate tool is the picker in any mode
287  SetTool(C4TLS_Picker, true);
288 }
const int32_t C4TLS_Picker
Definition: C4ToolsDlg.h:32

References C4TLS_Picker, and SetTool().

Referenced by C4EditCursor::AltDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBackMaterial()

void C4ToolsDlg::SetBackMaterial ( const char *  szMaterial)

Definition at line 106 of file C4ToolsDlg.cpp.

107 {
108  ModeBack = true;
109 
110  SCopy(szMaterial,BackMaterial,C4M_MaxName);
112  EnableControls();
114 }
const int C4M_MaxName
Definition: C4Constants.h:49
void AssertValidBackTexture()
Definition: C4ToolsDlg.cpp:236

References AssertValidBackTexture(), BackMaterial, C4M_MaxName, EnableControls(), C4Landscape::GetMode(), Landscape, ModeBack, SCopy(), Static, and UpdateTextures().

Referenced by SelectBackMaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBackTexture()

void C4ToolsDlg::SetBackTexture ( const char *  szTexture)

Definition at line 116 of file C4ToolsDlg.cpp.

117 {
118  ModeBack = true;
119 
120  // assert valid (for separator selection)
121  if (!::TextureMap.GetTexture(szTexture))
122  {
123  // ensure correct texture is in dlg
124  Console.ToolsDlgSelectBackTexture(this, szTexture);
125  return;
126  }
127 
128  SCopy(szTexture,BackTexture,C4M_MaxName);
129 }

References BackTexture, C4M_MaxName, Console, C4TextureMap::GetTexture(), ModeBack, SCopy(), TextureMap, and C4ConsoleGUI::ToolsDlgSelectBackTexture().

Referenced by SelectBackTexture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetColorPattern()

void C4ToolsDlg::SetColorPattern ( const char *  szMaterial,
const char *  szTexture 
)
protected

Definition at line 162 of file C4ToolsDlg.cpp.

163 {
164 }

◆ SetGrade()

bool C4ToolsDlg::SetGrade ( int32_t  iGrade)

Definition at line 166 of file C4ToolsDlg.cpp.

167 {
170  return true;
171 }

References C4TLS_GradeMax, C4TLS_GradeMin, Clamp(), Grade, and NeedPreviewUpdate().

Here is the call graph for this function:

◆ SetIFT()

bool C4ToolsDlg::SetIFT ( bool  fIFT)

Definition at line 131 of file C4ToolsDlg.cpp.

132 {
133  ModeBack = false;
134  if (fIFT) ModeIFT = true; else ModeIFT=false;
135 
136  // Keep sensible default values in BackMaterial / BackTexture
137  if (ModeIFT == 0)
138  {
140  }
141  else
142  {
144  int32_t index = ::TextureMap.GetIndexMatTex(Material);
145  if (index != -1)
146  {
147  BYTE bg_index = ::TextureMap.DefaultBkgMatTex(index);
148  const C4TexMapEntry* entry = ::TextureMap.GetEntry(bg_index);
149  if (entry != nullptr)
150  {
153  }
154  }
155  }
156 
159  return true;
160 }
uint8_t BYTE
Definition: C4Texture.h:49
const char * GetTextureName() const
Definition: C4Texture.h:61
const char * GetMaterialName() const
Definition: C4Texture.h:60
int32_t GetIndexMatTex(const char *szMaterialTexture, const char *szDefaultTexture=nullptr, bool fAddIfNotExist=true, const char *szErrorIfFailed=nullptr)
Definition: C4Texture.cpp:441
BYTE DefaultBkgMatTex(BYTE fg) const
Definition: C4Texture.cpp:504
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85

References BackMaterial, BackTexture, C4M_MaxName, C4TLS_MatSky, C4TextureMap::DefaultBkgMatTex(), C4TextureMap::GetEntry(), C4TextureMap::GetIndexMatTex(), C4TexMapEntry::GetMaterialName(), C4TexMapEntry::GetTextureName(), Material, ModeBack, ModeIFT, NeedPreviewUpdate(), SCopy(), TextureMap, and UpdateIFTControls().

Referenced by C4EditCursor::ApplyToolPicker(), and ToggleIFT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLandscapeMode()

bool C4ToolsDlg::SetLandscapeMode ( LandscapeMode  iMode,
bool  flat_chunk_shapes,
bool  fThroughControl = false 
)

Definition at line 181 of file C4ToolsDlg.cpp.

182 {
183  auto last_mode = ::Landscape.GetMode();
184  auto last_flat_chunk_shapes = ::Game.C4S.Landscape.FlatChunkShapes;
185  // Exact to static: confirm data loss warning
186  if (last_mode == LandscapeMode::Exact)
187  if (mode == LandscapeMode::Static)
188  if (!fThroughControl)
189  if (!Console.Message(LoadResStr("IDS_CNS_EXACTTOSTATIC"), true))
190  return false;
191  // send as control
192  if (!fThroughControl)
193  {
194  ::Control.DoInput(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_SetMode, mode, flat_chunk_shapes ? 1 : 0), CDT_Decide);
195  return true;
196  }
197  // Set landscape mode
198  ::Game.C4S.Landscape.FlatChunkShapes = flat_chunk_shapes;
199  ::Landscape.SetMode(mode);
200  // Exact to static: redraw landscape from map
201  if (last_mode == LandscapeMode::Exact || (last_flat_chunk_shapes != flat_chunk_shapes))
202  if (mode == LandscapeMode::Static)
204  // Assert valid tool
205  if (mode != LandscapeMode::Exact)
206  if (SelectedTool == C4TLS_Fill)
207  SetTool(C4TLS_Brush, false);
208  // Update controls
210  EnableControls();
211  UpdateTextures();
212  // Success
213  return true;
214 }
@ EMDT_SetMode
Definition: C4Control.h:477
C4GameControl Control
@ CDT_Decide
Definition: C4GameControl.h:39
C4Game Game
Definition: C4Globals.cpp:52
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
@ CID_EMDrawTool
Definition: C4PacketBase.h:170
bool Message(const char *szMessage, bool fQuery=false)
Definition: C4Console.cpp:292
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
C4Scenario C4S
Definition: C4Game.h:74
bool MapToLandscape()
void SetMode(LandscapeMode iMode)
bool FlatChunkShapes
Definition: C4Scenario.h:188
C4SLandscape Landscape
Definition: C4Scenario.h:236

References C4Game::C4S, C4TLS_Brush, C4TLS_Fill, CDT_Decide, CID_EMDrawTool, Console, Control, C4GameControl::DoInput(), EMDT_SetMode, EnableControls(), Exact, C4SLandscape::FlatChunkShapes, Game, C4Landscape::GetMode(), Landscape, C4Scenario::Landscape, LoadResStr(), C4Landscape::MapToLandscape(), C4Console::Message(), SelectedTool, C4Landscape::SetMode(), SetTool(), Static, UpdateLandscapeModeCtrls(), and UpdateTextures().

Here is the call graph for this function:

◆ SetMaterial()

void C4ToolsDlg::SetMaterial ( const char *  szMaterial)

Definition at line 60 of file C4ToolsDlg.cpp.

61 {
62  SCopy(szMaterial,Material,C4M_MaxName);
67  if (ModeBack && SEqual(szMaterial, C4TLS_MatSky))
69 }
void AssertValidTexture()
Definition: C4ToolsDlg.cpp:216
bool SelectBackMaterial(const char *szMaterial, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:277

References AssertValidTexture(), C4M_MaxName, C4TLS_MatSky, EnableControls(), C4Landscape::GetMode(), Landscape, Material, ModeBack, NeedPreviewUpdate(), SCopy(), SelectBackMaterial(), SEqual(), Static, and UpdateTextures().

Referenced by SelectMaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTexture()

void C4ToolsDlg::SetTexture ( const char *  szTexture)

Definition at line 71 of file C4ToolsDlg.cpp.

72 {
73  // assert valid (for separator selection)
74  if (!::TextureMap.GetTexture(szTexture))
75  {
76  // ensure correct texture is in dlg
77  Console.ToolsDlgSelectTexture(this, szTexture);
78  return;
79  }
80 
81  SCopy(szTexture,Texture,C4M_MaxName);
83 
84  // If the front texture changes, reset the background texture
85  // to something sensible.
86  int32_t mat = MaterialMap.Get(Material);
87  if (mat != MNone)
88  {
89  const C4Material* material = &MaterialMap.Map[mat];
90  if(DensitySemiSolid(material->Density))
91  {
93  {
94  SelectBackMaterial("Tunnel");
95  SelectBackTexture("tunnel");
96  }
97  }
98  else
99  {
102  }
103  }
104 }
const int32_t MNone
Definition: C4Constants.h:177
bool DensitySemiSolid(int32_t dens)
Definition: C4Landscape.h:201
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
int32_t Density
Definition: C4Material.h:92
C4Material * Map
Definition: C4Material.h:169
int32_t Get(const char *szMaterial)
Definition: C4Material.cpp:365

References BackMaterial, C4M_MaxName, C4TLS_MatSky, Console, C4MaterialCore::Density, DensitySemiSolid(), C4MaterialMap::Get(), C4TextureMap::GetTexture(), C4MaterialMap::Map, Material, MaterialMap, MNone, NeedPreviewUpdate(), SCopy(), SelectBackMaterial(), SelectBackTexture(), SEqual(), Texture, TextureMap, and C4ConsoleGUI::ToolsDlgSelectTexture().

Referenced by SelectTexture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTool()

bool C4ToolsDlg::SetTool ( int32_t  iTool,
bool  fTemp 
)

Definition at line 43 of file C4ToolsDlg.cpp.

44 {
45  Tool=iTool;
46  if (!fTemp) SelectedTool = Tool;
49  return true;
50 }

References NeedPreviewUpdate(), SelectedTool, Tool, and UpdateToolCtrls().

Referenced by ResetAlternateTool(), SetAlternateTool(), SetLandscapeMode(), and ToggleTool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToggleIFT()

bool C4ToolsDlg::ToggleIFT ( )
inline

Definition at line 74 of file C4ToolsDlg.h.

74 { return !!SetIFT(!ModeIFT); }
bool SetIFT(bool fIFT)
Definition: C4ToolsDlg.cpp:131

References ModeIFT, and SetIFT().

Referenced by C4Game::InitKeyboard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToggleTool()

bool C4ToolsDlg::ToggleTool ( )
inline

Definition at line 71 of file C4ToolsDlg.h.

71 { return !!SetTool((Tool+1)%4, false); }

References SetTool(), and Tool.

Referenced by C4Game::InitKeyboard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateIFTControls()

void C4ToolsDlg::UpdateIFTControls ( )
protected

Definition at line 705 of file C4Console.cpp.

705 {}

Referenced by Open(), and SetIFT().

Here is the caller graph for this function:

◆ UpdateLandscapeModeCtrls()

void C4ToolsDlg::UpdateLandscapeModeCtrls ( )

Definition at line 706 of file C4Console.cpp.

706 {}

Referenced by Open(), and SetLandscapeMode().

Here is the caller graph for this function:

◆ UpdateTextures()

void C4ToolsDlg::UpdateTextures ( )
protected

Definition at line 707 of file C4Console.cpp.

707 {}

Referenced by InitMaterialCtrls(), SetBackMaterial(), SetLandscapeMode(), and SetMaterial().

Here is the caller graph for this function:

◆ UpdateToolCtrls()

void C4ToolsDlg::UpdateToolCtrls ( )
protected

Definition at line 708 of file C4Console.cpp.

708 {}

Referenced by Open(), and SetTool().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ C4ConsoleGUI

friend class C4ConsoleGUI
friend

Definition at line 44 of file C4ToolsDlg.h.

Member Data Documentation

◆ Active

bool C4ToolsDlg::Active

Definition at line 52 of file C4ToolsDlg.h.

Referenced by Default(), and Open().

◆ BackMaterial

◆ BackTexture

◆ Grade

◆ Material

◆ ModeBack

◆ ModeIFT

bool C4ToolsDlg::ModeIFT

Definition at line 55 of file C4ToolsDlg.h.

Referenced by Default(), SetIFT(), and ToggleIFT().

◆ SelectedTool

int32_t C4ToolsDlg::SelectedTool

Definition at line 53 of file C4ToolsDlg.h.

Referenced by Default(), ResetAlternateTool(), SetLandscapeMode(), and SetTool().

◆ Texture

◆ Tool


The documentation for this class was generated from the following files: