OpenClonk
C4MapScript.h File Reference
Include dependency graph for C4MapScript.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  C4MapScriptMatTexMask
 
class  C4MapScriptAlgo
 
class  C4MapScriptAlgoLayer
 
class  C4MapScriptAlgoRndChecker
 
class  C4MapScriptAlgoRect
 
class  C4MapScriptAlgoEllipse
 
class  C4MapScriptAlgoPolygon
 
class  C4MapScriptAlgoLines
 
class  C4MapScriptAlgoModifier
 
class  C4MapScriptAlgoAnd
 
class  C4MapScriptAlgoOr
 
class  C4MapScriptAlgoNot
 
class  C4MapScriptAlgoXor
 
class  C4MapScriptAlgoOffset
 
class  C4MapScriptAlgoScale
 
class  C4MapScriptAlgoRotate
 
class  C4MapScriptAlgoTurbulence
 
class  C4MapScriptAlgoBorder
 
class  C4MapScriptAlgoFilter
 
class  C4MapScriptAlgoSetMaterial
 
class  C4MapScriptLayer
 
class  C4MapScriptMap
 
class  C4MapScriptHost
 

Enumerations

enum  C4MapScriptAlgoType {
  MAPALGO_None = 0 , MAPALGO_Layer = 1 , MAPALGO_RndChecker = 10 , MAPALGO_Rect = 20 ,
  MAPALGO_Ellipsis = 21 , MAPALGO_Polygon = 22 , MAPALGO_Lines = 23 , MAPALGO_Ellipse = 24 ,
  MAPALGO_And = 30 , MAPALGO_Or = 31 , MAPALGO_Not = 32 , MAPALGO_Xor = 33 ,
  MAPALGO_Offset = 40 , MAPALGO_Scale = 41 , MAPALGO_Rotate = 42 , MAPALGO_Turbulence = 43 ,
  MAPALGO_Border = 50 , MAPALGO_Filter = 51
}
 

Functions

bool FnParTexCol (C4String *mattex, uint8_t &fg, uint8_t &bg)
 

Variables

C4MapScriptHost MapScript
 

Enumeration Type Documentation

◆ C4MapScriptAlgoType

Enumerator
MAPALGO_None 
MAPALGO_Layer 
MAPALGO_RndChecker 
MAPALGO_Rect 
MAPALGO_Ellipsis 
MAPALGO_Polygon 
MAPALGO_Lines 
MAPALGO_Ellipse 
MAPALGO_And 
MAPALGO_Or 
MAPALGO_Not 
MAPALGO_Xor 
MAPALGO_Offset 
MAPALGO_Scale 
MAPALGO_Rotate 
MAPALGO_Turbulence 
MAPALGO_Border 
MAPALGO_Filter 

Definition at line 66 of file C4MapScript.h.

67 {
68  MAPALGO_None = 0,
69 
70  MAPALGO_Layer = 1,
71 
72  MAPALGO_RndChecker = 10,
73 
74  MAPALGO_Rect = 20,
75  MAPALGO_Ellipsis = 21, // This is "MAPALGO_Ellipse", but misspelled. Use will result in a warning.
76  MAPALGO_Polygon = 22,
77  MAPALGO_Lines = 23,
78  MAPALGO_Ellipse = 24,
79 
80  MAPALGO_And = 30,
81  MAPALGO_Or = 31,
82  MAPALGO_Not = 32,
83  MAPALGO_Xor = 33,
84 
85  MAPALGO_Offset = 40,
86  MAPALGO_Scale = 41,
87  MAPALGO_Rotate = 42,
88  MAPALGO_Turbulence = 43,
89 
90  MAPALGO_Border = 50,
91  MAPALGO_Filter = 51,
92 };
@ MAPALGO_Layer
Definition: C4MapScript.h:70
@ MAPALGO_Border
Definition: C4MapScript.h:90
@ MAPALGO_Ellipsis
Definition: C4MapScript.h:75
@ MAPALGO_Rect
Definition: C4MapScript.h:74
@ MAPALGO_Rotate
Definition: C4MapScript.h:87
@ MAPALGO_None
Definition: C4MapScript.h:68
@ MAPALGO_Turbulence
Definition: C4MapScript.h:88
@ MAPALGO_Or
Definition: C4MapScript.h:81
@ MAPALGO_Filter
Definition: C4MapScript.h:91
@ MAPALGO_Lines
Definition: C4MapScript.h:77
@ MAPALGO_Not
Definition: C4MapScript.h:82
@ MAPALGO_RndChecker
Definition: C4MapScript.h:72
@ MAPALGO_And
Definition: C4MapScript.h:80
@ MAPALGO_Scale
Definition: C4MapScript.h:86
@ MAPALGO_Xor
Definition: C4MapScript.h:83
@ MAPALGO_Polygon
Definition: C4MapScript.h:76
@ MAPALGO_Ellipse
Definition: C4MapScript.h:78
@ MAPALGO_Offset
Definition: C4MapScript.h:85

Function Documentation

◆ FnParTexCol()

bool FnParTexCol ( C4String mattex,
uint8_t &  fg,
uint8_t &  bg 
)

Definition at line 48 of file C4MapScript.cpp.

49 {
50  // Return index of material-texture definition for a single color
51  // Defaults to underground (tunnel background) color. Prefix material with ^ to get overground (sky background) color,
52  // or specify as mattex1:mattex2 for foreground-background pair.
53  if (!mattex || !mattex->GetCStr()) return false;
54 
55  int sep_pos = SCharPos(':', mattex->GetCStr());
56  if (sep_pos == -1)
57  {
58  const char *cmattex = mattex->GetCStr();
59  bool ift = true;
60  if (*cmattex == '^') { ift=false; ++cmattex; }
61 
62  uint8_t col;
63  if (!TexColSingle(cmattex, col)) return false;
64 
65  fg = col;
66  if (ift)
68  else
69  bg = C4M_MaxTexIndex; // sky
70 
71  return true;
72  }
73  else
74  {
75  const char *cmattex = mattex->GetCStr();
76  std::string fg_mattex(cmattex, cmattex + sep_pos);
77  std::string bg_mattex(cmattex + sep_pos + 1);
78 
79  uint8_t fg_col, bg_col;
80  if (!TexColSingle(fg_mattex.c_str(), fg_col)) return false;
81  if (!TexColSingle(bg_mattex.c_str(), bg_col)) return false;
82 
83  fg = fg_col; bg = bg_col;
84  return true;
85  }
86 }
const int C4M_MaxTexIndex
Definition: C4Constants.h:51
C4MapScriptHost MapScript
bool TexColSingle(const char *mattex, uint8_t &col)
Definition: C4MapScript.cpp:37
int SCharPos(char cTarget, const char *szInStr, int iIndex)
Definition: Standard.cpp:239
C4TextureMap * pTexMap
Definition: C4MapScript.h:365
const char * GetCStr() const
Definition: C4StringTable.h:49
BYTE DefaultBkgMatTex(BYTE fg) const
Definition: C4Texture.cpp:504

References C4M_MaxTexIndex, C4TextureMap::DefaultBkgMatTex(), C4String::GetCStr(), MapScript, C4MapScriptHost::pTexMap, SCharPos(), and TexColSingle().

Here is the call graph for this function:

Variable Documentation

◆ MapScript