#include <C4Texture.h>
Public Member Functions | |
C4TextureMap () | |
~C4TextureMap () | |
const C4TexMapEntry * | GetEntry (int32_t iIndex) const |
void | RemoveEntry (int32_t iIndex) |
void | Clear () |
void | StoreMapPalette (CStdPalette *, C4MaterialMap &rMaterials) |
int32_t | LoadMap (C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures) |
int32_t | Init () |
bool | SaveMap (C4Group &hGroup, const char *szEntryName) |
int32_t | LoadTextures (C4Group &hGroup, C4Group *OverloadFile=nullptr) |
bool | HasTextures (C4Group &hGroup) |
const char * | GetTexture (int32_t iIndex) |
void | MoveIndex (BYTE byOldIndex, BYTE byNewIndex) |
int32_t | GetIndex (const char *szMaterial, const char *szTexture, bool fAddIfNotExist=true, const char *szErrorIfFailed=nullptr) |
int32_t | GetIndexMatTex (const char *szMaterialTexture, const char *szDefaultTexture=nullptr, bool fAddIfNotExist=true, const char *szErrorIfFailed=nullptr) |
C4Texture * | GetTexture (const char *szTexture) |
bool | CheckTexture (const char *szTexture) |
bool | AddEntry (BYTE byIndex, const char *szMaterial, const char *szTexture) |
bool | AddTexture (const char *szTexture, C4Surface *sfcSurface) |
int32_t | GetTextureIndex (const char *pTexName) |
BYTE | DefaultBkgMatTex (BYTE fg) const |
Static Public Member Functions | |
static bool | LoadFlags (C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures) |
Public Attributes | |
bool | fEntriesAdded {false} |
Protected Attributes | |
C4TexMapEntry | Entry [C4M_MaxTexIndex] |
std::vector< int32_t > | Order |
C4Texture * | FirstTexture {nullptr} |
bool | fOverloadMaterials {false} |
bool | fOverloadTextures {false} |
bool | fInitialized {false} |
Friends | |
class | C4Landscape |
Definition at line 70 of file C4Texture.h.
C4TextureMap::C4TextureMap | ( | ) |
C4TextureMap::~C4TextureMap | ( | ) |
Definition at line 98 of file C4Texture.cpp.
References Clear().
bool C4TextureMap::AddEntry | ( | BYTE | byIndex, |
const char * | szMaterial, | ||
const char * | szTexture | ||
) |
Definition at line 103 of file C4Texture.cpp.
References C4M_MaxTexIndex, C4TexMapEntry::Clear(), C4TexMapEntry::Create(), Entry, fInitialized, C4Landscape::HandleTexMapUpdate(), Init(), Landscape, and Order.
Referenced by GetIndex(), LoadMap(), and C4Landscape::SetTextureIndex().
bool C4TextureMap::AddTexture | ( | const char * | szTexture, |
C4Surface * | sfcSurface | ||
) |
Definition at line 126 of file C4Texture.cpp.
References StdStrBuf::Copy(), FirstTexture, C4Surface::GetPixDw(), C4Surface::Hgt, C4Surface::Lock(), C4Texture::Name, C4Texture::Next, C4Texture::SetAverageColor(), C4Texture::Surface32, C4Surface::Unlock(), and C4Surface::Wdt.
Referenced by LoadTextures().
bool C4TextureMap::CheckTexture | ( | const char * | szTexture | ) |
Definition at line 485 of file C4Texture.cpp.
References FirstTexture, StdStrBuf::getData(), C4Texture::Name, C4Texture::Next, and SEqualNoCase().
Referenced by C4MCOverlay::SetField().
void C4TextureMap::Clear | ( | ) |
Definition at line 168 of file C4Texture.cpp.
References C4M_MaxTexIndex, Entry, fEntriesAdded, fInitialized, FirstTexture, fOverloadMaterials, fOverloadTextures, C4Texture::Next, and Order.
Referenced by c4_texture_map_handle_new(), C4Game::Clear(), C4Game::InitMaterialTexture(), and ~C4TextureMap().
Definition at line 504 of file C4Texture.cpp.
References C4MaterialCore::Density, DensitySemiSolid(), GetEntry(), C4TexMapEntry::GetMaterial(), Mat2PixColDefault(), MTunnel, and PixCol2Tex().
Referenced by C4Landscape::P::DefaultBkgMat(), FnParTexCol(), and C4ToolsDlg::SetIFT().
|
inline |
Definition at line 85 of file C4Texture.h.
References C4M_MaxTexIndex, and Entry.
Referenced by C4EditCursor::ApplyToolPicker(), C4Landscape::P::ChunkOZoom(), C4MaterialMap::CrossMapMaterials(), DefaultBkgMatTex(), C4Landscape::P::DoScan(), GetTextureName(), C4Landscape::P::Mat2Pal(), PixCol2Mat(), C4ToolsDlg::SetIFT(), C4Landscape::SetTextureIndex(), and C4MapCreator::ValidateTextureIndices().
int32_t C4TextureMap::GetIndex | ( | const char * | szMaterial, |
const char * | szTexture, | ||
bool | fAddIfNotExist = true , |
||
const char * | szErrorIfFailed = nullptr |
||
) |
Definition at line 414 of file C4Texture.cpp.
References AddEntry(), C4M_MaxTexIndex, DebugLogF(), Entry, fEntriesAdded, GetTextureName(), and SEqualNoCase().
Referenced by C4ToolsDlg::AssertValidBackTexture(), C4ToolsDlg::AssertValidTexture(), C4MaterialMap::CrossMapMaterials(), GetIndexMatTex(), C4Landscape::P::GetMapColorIndex(), and C4Landscape::SetTextureIndex().
int32_t C4TextureMap::GetIndexMatTex | ( | const char * | szMaterialTexture, |
const char * | szDefaultTexture = nullptr , |
||
bool | fAddIfNotExist = true , |
||
const char * | szErrorIfFailed = nullptr |
||
) |
Definition at line 441 of file C4Texture.cpp.
References StdStrBuf::Copy(), StdStrBuf::CopyUntil(), DebugLogF(), C4Material::DefaultMatTex, C4MaterialMap::Get(), StdStrBuf::getData(), GetIndex(), C4MaterialMap::Map, MaterialMap, MatValid(), and SSearch().
Referenced by C4MapCreator::Create(), C4MaterialMap::CrossMapMaterials(), C4Landscape::DrawPolygon(), C4MCOverlay::Evaluate(), and C4ToolsDlg::SetIFT().
C4Texture * C4TextureMap::GetTexture | ( | const char * | szTexture | ) |
Definition at line 466 of file C4Texture.cpp.
References FirstTexture, StdStrBuf::getData(), C4Texture::Name, C4Texture::Next, and SEqualNoCase().
const char * C4TextureMap::GetTexture | ( | int32_t | iIndex | ) |
Definition at line 494 of file C4Texture.cpp.
References FirstTexture, StdStrBuf::getData(), C4Texture::Name, and C4Texture::Next.
Referenced by C4ToolsDlg::AssertValidBackTexture(), C4ToolsDlg::AssertValidTexture(), C4Landscape::P::ChunkOZoom(), C4MaterialMap::CrossMapMaterials(), C4Landscape::DrawBox(), C4Landscape::DrawBrush(), C4Landscape::DrawLine(), C4TexMapEntry::Init(), LoadTextures(), C4ToolsDlg::SetBackTexture(), C4ToolsDlg::SetTexture(), and StoreMapPalette().
int32_t C4TextureMap::GetTextureIndex | ( | const char * | pTexName | ) |
Definition at line 475 of file C4Texture.cpp.
References FirstTexture, StdStrBuf::getData(), C4Texture::Name, C4Texture::Next, and SEqualNoCase().
bool C4TextureMap::HasTextures | ( | C4Group & | hGroup | ) |
Definition at line 398 of file C4Texture.cpp.
References C4CFN_BitmapFiles, C4CFN_PNGFiles, and C4Group::EntryCount().
int32_t C4TextureMap::Init | ( | ) |
Definition at line 292 of file C4Texture.cpp.
References C4M_MaxTexIndex, C4TexMapEntry::Clear(), Entry, fInitialized, and LogF().
Referenced by AddEntry(), c4_texture_map_handle_new(), and C4Game::InitMaterialTexture().
|
static |
Definition at line 187 of file C4Texture.cpp.
References StdStrBuf::getData(), C4Group::LoadEntryString(), SEqual2(), and SSearch().
Referenced by C4Game::InitMaterialTexture().
int32_t C4TextureMap::LoadMap | ( | C4Group & | hGroup, |
const char * | szEntryName, | ||
bool * | pOverloadMaterials, | ||
bool * | pOverloadTextures | ||
) |
Definition at line 211 of file C4Texture.cpp.
References AddEntry(), C4M_MaxTexIndex, DebugLogF(), fEntriesAdded, fOverloadMaterials, fOverloadTextures, and C4Group::LoadEntry().
Referenced by C4Game::InitMaterialTexture().
Definition at line 340 of file C4Texture.cpp.
References C4Group::AccessNextEntry(), AddTexture(), C4CFN_MaterialShapeFiles, C4SF_MipMap, StdStrBuf::getData(), GetExtension(), GetFilenameOnly(), C4Group::GetFullName(), StdStrBuf::getLength(), GetTexture(), C4Surface::Hgt, LogF(), C4Surface::Read(), C4Group::ResetSearch(), StdStrBuf::SetLength(), C4Texture::SetMaterialShape(), SLen(), SReplaceChar(), C4Texture::Surface32, C4Surface::Wdt, and WildcardMatch().
Referenced by C4Game::InitMaterialTexture().
Definition at line 403 of file C4Texture.cpp.
References C4TexMapEntry::Clear(), Entry, fEntriesAdded, and Order.
Referenced by C4Landscape::SetTextureIndex().
void C4TextureMap::RemoveEntry | ( | int32_t | iIndex | ) |
Definition at line 525 of file C4Texture.cpp.
References C4M_MaxTexIndex, C4TexMapEntry::Clear(), Entry, and Order.
Referenced by C4Landscape::RemoveUnusedTexMapEntries().
bool C4TextureMap::SaveMap | ( | C4Group & | hGroup, |
const char * | szEntryName | ||
) |
Definition at line 309 of file C4Texture.cpp.
References C4Group::Add(), StdStrBuf::Append(), StdStrBuf::AppendFormat(), Entry, fOverloadMaterials, fOverloadTextures, StdStrBuf::getData(), StdStrBuf::getLength(), GetTextureName(), and Order.
Referenced by C4Landscape::SaveTextures().
void C4TextureMap::StoreMapPalette | ( | CStdPalette * | Palette, |
C4MaterialMap & | rMaterials | ||
) |
Definition at line 537 of file C4Texture.cpp.
References C4M_MaxTexIndex, C4RGB, CStdPalette::Colors, Entry, GetBlueValue, GetGreenValue, C4TexMapEntry::GetPattern(), GetRedValue, GetTexture(), GetTextureName(), C4Pattern::PatternClr(), UnsyncedRandom(), and ZeroMem().
Referenced by C4Landscape::SaveMap().
|
friend |
Definition at line 106 of file C4Texture.h.
|
protected |
Definition at line 76 of file C4Texture.h.
Referenced by AddEntry(), Clear(), GetEntry(), GetIndex(), Init(), MoveIndex(), RemoveEntry(), SaveMap(), and StoreMapPalette().
bool C4TextureMap::fEntriesAdded {false} |
Definition at line 83 of file C4Texture.h.
Referenced by Clear(), GetIndex(), LoadMap(), MoveIndex(), C4Landscape::RemoveUnusedTexMapEntries(), and C4Landscape::SaveTextures().
|
protected |
Definition at line 81 of file C4Texture.h.
Referenced by AddEntry(), Clear(), and Init().
|
protected |
Definition at line 78 of file C4Texture.h.
Referenced by AddTexture(), CheckTexture(), Clear(), GetTexture(), and GetTextureIndex().
|
protected |
Definition at line 79 of file C4Texture.h.
|
protected |
Definition at line 80 of file C4Texture.h.
|
protected |
Definition at line 77 of file C4Texture.h.
Referenced by AddEntry(), C4TextureMap(), Clear(), MoveIndex(), RemoveEntry(), SaveMap(), and C4Landscape::P::TexOZoom().