mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #2800
2800: Style-fixed version of #2784 r=def- a=heinrich5991 Thanks to @Jupeyy for the original pull request. Co-authored-by: Jupeyy <jupjopjap@gmail.com> Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
d720f74cfd
|
@ -555,6 +555,16 @@ int CGraphics_Threaded::LoadPNG(CImageInfo *pImg, const char *pFilename, int Sto
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGraphics_Threaded::CopyTextureBufferSub(uint8_t *pDestBuffer, uint8_t *pSourceBuffer, int FullWidth, int FullHeight, int ColorChannelCount, int SubOffsetX, int SubOffsetY, int SubCopyWidth, int SubCopyHeight)
|
||||||
|
{
|
||||||
|
for(int Y = 0; Y < SubCopyHeight; ++Y)
|
||||||
|
{
|
||||||
|
int ImgOffset = ((SubOffsetY + Y) * FullWidth * ColorChannelCount) + (SubOffsetX * ColorChannelCount);
|
||||||
|
int CopySize = SubCopyWidth * ColorChannelCount;
|
||||||
|
mem_copy(&pDestBuffer[ImgOffset], &pSourceBuffer[ImgOffset], CopySize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGraphics_Threaded::KickCommandBuffer()
|
void CGraphics_Threaded::KickCommandBuffer()
|
||||||
{
|
{
|
||||||
m_pBackend->RunBuffer(m_pCommandBuffer);
|
m_pBackend->RunBuffer(m_pCommandBuffer);
|
||||||
|
|
|
@ -724,142 +724,143 @@ class CGraphics_Threaded : public IEngineGraphics
|
||||||
public:
|
public:
|
||||||
CGraphics_Threaded();
|
CGraphics_Threaded();
|
||||||
|
|
||||||
virtual void ClipEnable(int x, int y, int w, int h);
|
void ClipEnable(int x, int y, int w, int h) override;
|
||||||
virtual void ClipDisable();
|
void ClipDisable() override;
|
||||||
|
|
||||||
virtual void BlendNone();
|
void BlendNone() override;
|
||||||
virtual void BlendNormal();
|
void BlendNormal() override;
|
||||||
virtual void BlendAdditive();
|
void BlendAdditive() override;
|
||||||
|
|
||||||
virtual void WrapNormal();
|
void WrapNormal() override;
|
||||||
virtual void WrapClamp();
|
void WrapClamp() override;
|
||||||
|
|
||||||
virtual int MemoryUsage() const;
|
int MemoryUsage() const override;
|
||||||
|
|
||||||
virtual void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY);
|
void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY) override;
|
||||||
virtual void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY);
|
void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY) override;
|
||||||
|
|
||||||
virtual void LinesBegin();
|
void LinesBegin() override;
|
||||||
virtual void LinesEnd();
|
void LinesEnd() override;
|
||||||
virtual void LinesDraw(const CLineItem *pArray, int Num);
|
void LinesDraw(const CLineItem *pArray, int Num) override;
|
||||||
|
|
||||||
virtual int UnloadTexture(IGraphics::CTextureHandle Index);
|
int UnloadTexture(IGraphics::CTextureHandle Index) override;
|
||||||
virtual IGraphics::CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL);
|
IGraphics::CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL) override;
|
||||||
virtual int LoadTextureRawSub(IGraphics::CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData);
|
int LoadTextureRawSub(IGraphics::CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData) override;
|
||||||
|
|
||||||
// simple uncompressed RGBA loaders
|
// simple uncompressed RGBA loaders
|
||||||
virtual IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags);
|
IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags) override;
|
||||||
virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType);
|
int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType) override;
|
||||||
|
|
||||||
|
void CopyTextureBufferSub(uint8_t *pDestBuffer, uint8_t *pSourceBuffer, int FullWidth, int FullHeight, int ColorChannelCount, int SubOffsetX, int SubOffsetY, int SubCopyWidth, int SubCopyHeight) override;
|
||||||
|
|
||||||
void ScreenshotDirect();
|
void ScreenshotDirect();
|
||||||
|
|
||||||
virtual void TextureSet(CTextureHandle TextureID);
|
void TextureSet(CTextureHandle TextureID) override;
|
||||||
|
|
||||||
virtual void Clear(float r, float g, float b);
|
void Clear(float r, float g, float b) override;
|
||||||
|
|
||||||
virtual void QuadsBegin();
|
void QuadsBegin() override;
|
||||||
virtual void QuadsEnd();
|
void QuadsEnd() override;
|
||||||
virtual void TextQuadsBegin();
|
void TextQuadsBegin() override;
|
||||||
virtual void TextQuadsEnd(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float* pOutlineTextColor);
|
void TextQuadsEnd(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float *pOutlineTextColor) override;
|
||||||
virtual void QuadsEndKeepVertices();
|
void QuadsEndKeepVertices() override;
|
||||||
virtual void QuadsDrawCurrentVertices(bool KeepVertices = true);
|
void QuadsDrawCurrentVertices(bool KeepVertices = true) override;
|
||||||
virtual void QuadsSetRotation(float Angle);
|
void QuadsSetRotation(float Angle) override;
|
||||||
|
|
||||||
virtual void SetColorVertex(const CColorVertex *pArray, int Num);
|
void SetColorVertex(const CColorVertex *pArray, int Num) override;
|
||||||
virtual void SetColor(float r, float g, float b, float a);
|
void SetColor(float r, float g, float b, float a) override;
|
||||||
virtual void SetColor(ColorRGBA rgb);
|
void SetColor(ColorRGBA rgb) override;
|
||||||
|
|
||||||
// go through all vertices and change their color (only works for quads)
|
// go through all vertices and change their color (only works for quads)
|
||||||
virtual void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a);
|
void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a) override;
|
||||||
virtual void ChangeColorOfQuadVertices(int QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
void ChangeColorOfQuadVertices(int QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
|
||||||
|
|
||||||
void SetColor(CCommandBuffer::SVertex *pVertex, int ColorIndex);
|
void SetColor(CCommandBuffer::SVertex *pVertex, int ColorIndex);
|
||||||
|
|
||||||
virtual void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV);
|
void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV) override;
|
||||||
virtual void QuadsSetSubsetFree(
|
void QuadsSetSubsetFree(
|
||||||
float x0, float y0, float x1, float y1,
|
float x0, float y0, float x1, float y1,
|
||||||
float x2, float y2, float x3, float y3);
|
float x2, float y2, float x3, float y3) override;
|
||||||
|
|
||||||
virtual void QuadsDraw(CQuadItem *pArray, int Num);
|
void QuadsDraw(CQuadItem *pArray, int Num) override;
|
||||||
virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
|
void QuadsDrawTL(const CQuadItem *pArray, int Num) override;
|
||||||
virtual void QuadsDrawFreeform(const CFreeformItem *pArray, int Num);
|
void QuadsDrawFreeform(const CFreeformItem *pArray, int Num) override;
|
||||||
virtual void QuadsText(float x, float y, float Size, const char *pText);
|
void QuadsText(float x, float y, float Size, const char *pText) override;
|
||||||
|
|
||||||
virtual int CreateQuadContainer();
|
int CreateQuadContainer() override;
|
||||||
virtual void QuadContainerUpload(int ContainerIndex);
|
void QuadContainerUpload(int ContainerIndex) override;
|
||||||
virtual void QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num);
|
void QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num) override;
|
||||||
virtual void QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num);
|
void QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num) override;
|
||||||
virtual void QuadContainerReset(int ContainerIndex);
|
void QuadContainerReset(int ContainerIndex) override;
|
||||||
virtual void DeleteQuadContainer(int ContainerIndex);
|
void DeleteQuadContainer(int ContainerIndex) override;
|
||||||
virtual void RenderQuadContainer(int ContainerIndex, int QuadDrawNum);
|
void RenderQuadContainer(int ContainerIndex, int QuadDrawNum) override;
|
||||||
virtual void RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum);
|
void RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum) override;
|
||||||
virtual void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f);
|
void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f) override;
|
||||||
virtual void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo);
|
void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo) override;
|
||||||
|
|
||||||
virtual void FlushVertices(bool KeepVertices = false);
|
void FlushVertices(bool KeepVertices = false) override;
|
||||||
virtual void FlushTextVertices(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float *pOutlineTextColor);
|
void FlushTextVertices(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float *pOutlineTextColor) override;
|
||||||
|
|
||||||
virtual void RenderTileLayer(int BufferContainerIndex, float *pColor, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffet);
|
void RenderTileLayer(int BufferContainerIndex, float *pColor, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffet) override;
|
||||||
virtual void RenderBorderTiles(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, int JumpIndex, unsigned int DrawNum);
|
void RenderBorderTiles(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, int JumpIndex, unsigned int DrawNum) override;
|
||||||
virtual void RenderBorderTileLines(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, unsigned int IndexDrawNum, unsigned int RedrawNum);
|
void RenderBorderTileLines(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, unsigned int IndexDrawNum, unsigned int RedrawNum) override;
|
||||||
virtual void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo* pQuadInfo, int QuadNum);
|
void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, int QuadNum) override;
|
||||||
virtual void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, float* pTextColor, float* pTextoutlineColor);
|
void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, float *pTextColor, float *pTextoutlineColor) override;
|
||||||
|
|
||||||
// opengl 3.3 functions
|
// opengl 3.3 functions
|
||||||
virtual int CreateBufferObject(size_t UploadDataSize, void* pUploadData);
|
int CreateBufferObject(size_t UploadDataSize, void *pUploadData) override;
|
||||||
virtual void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void* pUploadData);
|
void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData) override;
|
||||||
virtual void UpdateBufferObject(int BufferIndex, size_t UploadDataSize, void* pUploadData, void* pOffset);
|
void UpdateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData, void *pOffset) override;
|
||||||
virtual void CopyBufferObject(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize);
|
void CopyBufferObject(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize) override;
|
||||||
virtual void DeleteBufferObject(int BufferIndex);
|
void DeleteBufferObject(int BufferIndex) override;
|
||||||
|
|
||||||
virtual int CreateBufferContainer(SBufferContainerInfo *pContainerInfo);
|
int CreateBufferContainer(SBufferContainerInfo *pContainerInfo) override;
|
||||||
// destroying all buffer objects means, that all referenced VBOs are destroyed automatically, so the user does not need to save references to them
|
// destroying all buffer objects means, that all referenced VBOs are destroyed automatically, so the user does not need to save references to them
|
||||||
virtual void DeleteBufferContainer(int ContainerIndex, bool DestroyAllBO = true);
|
void DeleteBufferContainer(int ContainerIndex, bool DestroyAllBO = true) override;
|
||||||
virtual void UpdateBufferContainer(int ContainerIndex, SBufferContainerInfo *pContainerInfo);
|
void UpdateBufferContainer(int ContainerIndex, SBufferContainerInfo *pContainerInfo) override;
|
||||||
virtual void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount);
|
void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount) override;
|
||||||
|
|
||||||
|
int GetNumScreens() const override;
|
||||||
|
void Minimize() override;
|
||||||
|
void Maximize() override;
|
||||||
|
bool Fullscreen(bool State) override;
|
||||||
|
void SetWindowBordered(bool State) override;
|
||||||
|
bool SetWindowScreen(int Index) override;
|
||||||
|
void Resize(int w, int h) override;
|
||||||
|
void AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc, void *pUser) override;
|
||||||
|
int GetWindowScreen() override;
|
||||||
|
|
||||||
virtual int GetNumScreens() const;
|
int WindowActive() override;
|
||||||
virtual void Minimize();
|
int WindowOpen() override;
|
||||||
virtual void Maximize();
|
|
||||||
virtual bool Fullscreen(bool State);
|
|
||||||
virtual void SetWindowBordered(bool State);
|
|
||||||
virtual bool SetWindowScreen(int Index);
|
|
||||||
virtual void Resize(int w, int h);
|
|
||||||
virtual void AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc, void *pUser);
|
|
||||||
virtual int GetWindowScreen();
|
|
||||||
|
|
||||||
virtual int WindowActive();
|
void SetWindowGrab(bool Grab) override;
|
||||||
virtual int WindowOpen();
|
void NotifyWindow() override;
|
||||||
|
|
||||||
virtual void SetWindowGrab(bool Grab);
|
int Init() override;
|
||||||
virtual void NotifyWindow();
|
void Shutdown() override;
|
||||||
|
|
||||||
virtual int Init();
|
void TakeScreenshot(const char *pFilename) override;
|
||||||
virtual void Shutdown();
|
void TakeCustomScreenshot(const char *pFilename) override;
|
||||||
|
void Swap() override;
|
||||||
|
bool SetVSync(bool State) override;
|
||||||
|
|
||||||
virtual void TakeScreenshot(const char *pFilename);
|
int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) override;
|
||||||
virtual void TakeCustomScreenshot(const char *pFilename);
|
|
||||||
virtual void Swap();
|
|
||||||
virtual bool SetVSync(bool State);
|
|
||||||
|
|
||||||
virtual int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen);
|
|
||||||
|
|
||||||
virtual int GetDesktopScreenWidth() { return m_DesktopScreenWidth; }
|
virtual int GetDesktopScreenWidth() { return m_DesktopScreenWidth; }
|
||||||
virtual int GetDesktopScreenHeight() { return m_DesktopScreenHeight; }
|
virtual int GetDesktopScreenHeight() { return m_DesktopScreenHeight; }
|
||||||
|
|
||||||
// synchronization
|
// synchronization
|
||||||
virtual void InsertSignal(semaphore *pSemaphore);
|
void InsertSignal(semaphore *pSemaphore) override;
|
||||||
virtual bool IsIdle();
|
bool IsIdle() override;
|
||||||
virtual void WaitForIdle();
|
void WaitForIdle() override;
|
||||||
|
|
||||||
virtual SGraphicsWarning *GetCurWarning();
|
SGraphicsWarning *GetCurWarning() override;
|
||||||
|
|
||||||
virtual bool IsTileBufferingEnabled() { return m_OpenGLTileBufferingEnabled; }
|
bool IsTileBufferingEnabled() override { return m_OpenGLTileBufferingEnabled; }
|
||||||
virtual bool IsQuadBufferingEnabled() { return m_OpenGLQuadBufferingEnabled; }
|
bool IsQuadBufferingEnabled() override { return m_OpenGLQuadBufferingEnabled; }
|
||||||
virtual bool IsTextBufferingEnabled() { return m_OpenGLTextBufferingEnabled; }
|
bool IsTextBufferingEnabled() override { return m_OpenGLTextBufferingEnabled; }
|
||||||
virtual bool IsQuadContainerBufferingEnabled() { return m_OpenGLQuadContainerBufferingEnabled; }
|
bool IsQuadContainerBufferingEnabled() override { return m_OpenGLQuadContainerBufferingEnabled; }
|
||||||
virtual bool HasTextureArrays() { return m_OpenGLHasTextureArrays; }
|
bool HasTextureArrays() override { return m_OpenGLHasTextureArrays; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern IGraphicsBackend *CreateGraphicsBackend();
|
extern IGraphicsBackend *CreateGraphicsBackend();
|
||||||
|
|
|
@ -193,6 +193,9 @@ public:
|
||||||
|
|
||||||
virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType) = 0;
|
virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType) = 0;
|
||||||
|
|
||||||
|
// destination and source buffer require to have the same width and height
|
||||||
|
virtual void CopyTextureBufferSub(uint8_t *pDestBuffer, uint8_t *pSourceBuffer, int FullWidth, int FullHeight, int ColorChannelCount, int SubOffsetX, int SubOffsetY, int SubCopyWidth, int SubCopyHeight) = 0;
|
||||||
|
|
||||||
virtual int UnloadTexture(CTextureHandle Index) = 0;
|
virtual int UnloadTexture(CTextureHandle Index) = 0;
|
||||||
virtual CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL) = 0;
|
virtual CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL) = 0;
|
||||||
virtual int LoadTextureRawSub(CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData) = 0;
|
virtual int LoadTextureRawSub(CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData) = 0;
|
||||||
|
|
|
@ -18,7 +18,7 @@ CMapImages::CMapImages(int TextureSize)
|
||||||
{
|
{
|
||||||
m_Count = 0;
|
m_Count = 0;
|
||||||
m_TextureScale = TextureSize;
|
m_TextureScale = TextureSize;
|
||||||
m_EntitiesIsLoaded = false;
|
mem_zero(m_EntitiesIsLoaded, sizeof(m_EntitiesIsLoaded));
|
||||||
m_SpeedupArrowIsLoaded = false;
|
m_SpeedupArrowIsLoaded = false;
|
||||||
|
|
||||||
mem_zero(m_aTextureUsedByTileOrQuadLayerFlag, sizeof(m_aTextureUsedByTileOrQuadLayerFlag));
|
mem_zero(m_aTextureUsedByTileOrQuadLayerFlag, sizeof(m_aTextureUsedByTileOrQuadLayerFlag));
|
||||||
|
@ -59,7 +59,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
|
||||||
CMapItemLayerTilemap *pTLayer = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTLayer = (CMapItemLayerTilemap *)pLayer;
|
||||||
if(pTLayer->m_Image != -1 && pTLayer->m_Image < (int)(sizeof(m_aTextures) / sizeof(m_aTextures[0])))
|
if(pTLayer->m_Image != -1 && pTLayer->m_Image < (int)(sizeof(m_aTextures) / sizeof(m_aTextures[0])))
|
||||||
{
|
{
|
||||||
m_aTextureUsedByTileOrQuadLayerFlag[(size_t)pTLayer->m_Image] |= 1;
|
m_aTextureUsedByTileOrQuadLayerFlag[pTLayer->m_Image] |= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
||||||
|
@ -67,7 +67,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
|
||||||
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
||||||
if(pQLayer->m_Image != -1 && pQLayer->m_Image < (int)(sizeof(m_aTextures) / sizeof(m_aTextures[0])))
|
if(pQLayer->m_Image != -1 && pQLayer->m_Image < (int)(sizeof(m_aTextures) / sizeof(m_aTextures[0])))
|
||||||
{
|
{
|
||||||
m_aTextureUsedByTileOrQuadLayerFlag[(size_t)pQLayer->m_Image] |= 2;
|
m_aTextureUsedByTileOrQuadLayerFlag[pQLayer->m_Image] |= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,36 +111,201 @@ void CMapImages::LoadBackground(class CLayers *pLayers, class IMap *pMap)
|
||||||
OnMapLoadImpl(pLayers, pMap);
|
OnMapLoadImpl(pLayers, pMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphics::CTextureHandle CMapImages::GetEntities()
|
bool CMapImages::HasFrontLayer()
|
||||||
{
|
{
|
||||||
// DDNet default to prevent delay in seeing entities
|
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||||
const char *pEntities = "ddnet";
|
}
|
||||||
if(GameClient()->m_GameInfo.m_EntitiesDDNet)
|
|
||||||
pEntities = "ddnet";
|
|
||||||
else if(GameClient()->m_GameInfo.m_EntitiesDDRace)
|
|
||||||
pEntities = "ddrace";
|
|
||||||
else if(GameClient()->m_GameInfo.m_EntitiesRace)
|
|
||||||
pEntities = "race";
|
|
||||||
else if (GameClient()->m_GameInfo.m_EntitiesBW)
|
|
||||||
pEntities = "blockworlds";
|
|
||||||
else if(GameClient()->m_GameInfo.m_EntitiesFNG)
|
|
||||||
pEntities = "fng";
|
|
||||||
else if(GameClient()->m_GameInfo.m_EntitiesVanilla)
|
|
||||||
pEntities = "vanilla";
|
|
||||||
|
|
||||||
if(!m_EntitiesIsLoaded || m_pEntitiesGameType != pEntities)
|
bool CMapImages::HasSpeedupLayer()
|
||||||
|
{
|
||||||
|
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMapImages::HasSwitchLayer()
|
||||||
|
{
|
||||||
|
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMapImages::HasTeleLayer()
|
||||||
|
{
|
||||||
|
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMapImages::HasTuneLayer()
|
||||||
|
{
|
||||||
|
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||||
|
}
|
||||||
|
|
||||||
|
IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType EntityLayerType)
|
||||||
|
{
|
||||||
|
const char *pEntities = "ddnet";
|
||||||
|
EMapImageModType EntitiesModType = MAP_IMAGE_MOD_TYPE_UNKNOWN;
|
||||||
|
bool EntitesAreMasked = !GameClient()->m_GameInfo.m_DontMaskEntities;
|
||||||
|
|
||||||
|
if(GameClient()->m_GameInfo.m_EntitiesDDNet && EntitesAreMasked)
|
||||||
{
|
{
|
||||||
|
pEntities = "ddnet";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_DDNET;
|
||||||
|
}
|
||||||
|
else if(GameClient()->m_GameInfo.m_EntitiesDDRace && EntitesAreMasked)
|
||||||
|
{
|
||||||
|
pEntities = "ddrace";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||||
|
}
|
||||||
|
else if(GameClient()->m_GameInfo.m_EntitiesRace)
|
||||||
|
{
|
||||||
|
pEntities = "race";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_RACE;
|
||||||
|
}
|
||||||
|
else if(GameClient()->m_GameInfo.m_EntitiesBW)
|
||||||
|
{
|
||||||
|
pEntities = "blockworlds";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_BLOCKWORLDS;
|
||||||
|
}
|
||||||
|
else if(GameClient()->m_GameInfo.m_EntitiesFNG)
|
||||||
|
{
|
||||||
|
pEntities = "fng";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_FNG;
|
||||||
|
}
|
||||||
|
else if(GameClient()->m_GameInfo.m_EntitiesVanilla)
|
||||||
|
{
|
||||||
|
pEntities = "vanilla";
|
||||||
|
EntitiesModType = MAP_IMAGE_MOD_TYPE_VANILLA;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_EntitiesIsLoaded[EntitiesModType])
|
||||||
|
{
|
||||||
|
m_EntitiesIsLoaded[EntitiesModType] = true;
|
||||||
|
|
||||||
|
bool WasUnknwon = EntitiesModType == MAP_IMAGE_MOD_TYPE_UNKNOWN;
|
||||||
|
|
||||||
char aPath[64];
|
char aPath[64];
|
||||||
str_format(aPath, sizeof(aPath), "editor/entities_clear/%s.png", pEntities);
|
str_format(aPath, sizeof(aPath), "editor/entities_clear/%s.png", pEntities);
|
||||||
|
|
||||||
if(m_EntitiesTextures >= 0)
|
bool GameTypeHasFrontLayer = HasFrontLayer() || WasUnknwon;
|
||||||
Graphics()->UnloadTexture(m_EntitiesTextures);
|
bool GameTypeHasSpeedupLayer = HasSpeedupLayer() || WasUnknwon;
|
||||||
|
bool GameTypeHasSwitchLayer = HasSwitchLayer() || WasUnknwon;
|
||||||
|
bool GameTypeHasTeleLayer = HasTeleLayer() || WasUnknwon;
|
||||||
|
bool GameTypeHasTuneLayer = HasTuneLayer() || WasUnknwon;
|
||||||
|
|
||||||
int TextureLoadFlag = Graphics()->HasTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
|
int TextureLoadFlag = Graphics()->HasTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
|
||||||
m_EntitiesTextures = Graphics()->LoadTexture(aPath, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, TextureLoadFlag);
|
|
||||||
m_EntitiesIsLoaded = true;
|
CImageInfo ImgInfo;
|
||||||
m_pEntitiesGameType = pEntities;
|
if(Graphics()->LoadPNG(&ImgInfo, aPath, IStorage::TYPE_ALL) && ImgInfo.m_Width > 0 && ImgInfo.m_Height > 0)
|
||||||
|
{
|
||||||
|
int ColorChannelCount = 0;
|
||||||
|
if(ImgInfo.m_Format == CImageInfo::FORMAT_ALPHA)
|
||||||
|
ColorChannelCount = 1;
|
||||||
|
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGB)
|
||||||
|
ColorChannelCount = 3;
|
||||||
|
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGBA)
|
||||||
|
ColorChannelCount = 4;
|
||||||
|
|
||||||
|
int BuildImageSize = ColorChannelCount * ImgInfo.m_Width * ImgInfo.m_Height;
|
||||||
|
|
||||||
|
uint8_t *pTmpImgData = (uint8_t *)ImgInfo.m_pData;
|
||||||
|
uint8_t *pBuildImgData = (uint8_t *)malloc(BuildImageSize);
|
||||||
|
|
||||||
|
// build game layer
|
||||||
|
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
||||||
|
{
|
||||||
|
bool BuildThisLayer = true;
|
||||||
|
if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_FRONT && !GameTypeHasFrontLayer)
|
||||||
|
BuildThisLayer = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SPEEDUP && !GameTypeHasSpeedupLayer)
|
||||||
|
BuildThisLayer = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH && !GameTypeHasSwitchLayer)
|
||||||
|
BuildThisLayer = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_TELE && !GameTypeHasTeleLayer)
|
||||||
|
BuildThisLayer = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE && !GameTypeHasTuneLayer)
|
||||||
|
BuildThisLayer = false;
|
||||||
|
|
||||||
|
dbg_assert(m_EntitiesTextures[EntitiesModType][n] == -1, "entities texture already loaded when it should not be");
|
||||||
|
|
||||||
|
if(BuildThisLayer)
|
||||||
|
{
|
||||||
|
// set everything transparent
|
||||||
|
mem_zero(pBuildImgData, BuildImageSize);
|
||||||
|
|
||||||
|
for(int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
bool ValidTile = i != 0;
|
||||||
|
int TileIndex = i;
|
||||||
|
if(EntitiesModType == MAP_IMAGE_MOD_TYPE_DDNET || EntitiesModType == MAP_IMAGE_MOD_TYPE_DDRACE)
|
||||||
|
{
|
||||||
|
if(EntitiesModType == MAP_IMAGE_MOD_TYPE_DDNET || TileIndex != TILE_BOOST)
|
||||||
|
{
|
||||||
|
if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_GAME && !IsValidGameTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_FRONT && !IsValidFrontTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SPEEDUP && !IsValidSpeedupTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH)
|
||||||
|
{
|
||||||
|
if(!IsValidSwitchTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(TileIndex == TILE_SWITCHTIMEDOPEN)
|
||||||
|
TileIndex = 8;
|
||||||
}
|
}
|
||||||
return m_EntitiesTextures;
|
}
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_TELE && !IsValidTeleTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE && !IsValidTuneTile((int)TileIndex))
|
||||||
|
ValidTile = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if((EntitiesModType == MAP_IMAGE_MOD_TYPE_RACE) && IsCreditsTile((int)TileIndex))
|
||||||
|
{
|
||||||
|
ValidTile = false;
|
||||||
|
}
|
||||||
|
else if((EntitiesModType == MAP_IMAGE_MOD_TYPE_FNG) && IsCreditsTile((int)TileIndex))
|
||||||
|
{
|
||||||
|
ValidTile = false;
|
||||||
|
}
|
||||||
|
else if((EntitiesModType == MAP_IMAGE_MOD_TYPE_VANILLA) && IsCreditsTile((int)TileIndex))
|
||||||
|
{
|
||||||
|
ValidTile = false;
|
||||||
|
}
|
||||||
|
/*else if((EntitiesModType == MAP_IMAGE_MOD_TYPE_RACE_BLOCKWORLD) && ...)
|
||||||
|
{
|
||||||
|
ValidTile = false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
int X = TileIndex % 16;
|
||||||
|
int Y = TileIndex / 16;
|
||||||
|
|
||||||
|
int CopyWidth = ImgInfo.m_Width / 16;
|
||||||
|
int CopyHeight = ImgInfo.m_Height / 16;
|
||||||
|
if(ValidTile)
|
||||||
|
{
|
||||||
|
Graphics()->CopyTextureBufferSub(pBuildImgData, pTmpImgData, ImgInfo.m_Width, ImgInfo.m_Height, ColorChannelCount, X * CopyWidth, Y * CopyHeight, CopyWidth, CopyHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EntitiesTextures[EntitiesModType][n] = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, ImgInfo.m_Format, TextureLoadFlag, aPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_TransparentTexture == -1)
|
||||||
|
{
|
||||||
|
// set everything transparent
|
||||||
|
mem_zero(pBuildImgData, BuildImageSize);
|
||||||
|
|
||||||
|
m_TransparentTexture = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, ImgInfo.m_Format, TextureLoadFlag, aPath);
|
||||||
|
}
|
||||||
|
m_EntitiesTextures[EntitiesModType][n] = m_TransparentTexture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pBuildImgData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_EntitiesTextures[EntitiesModType][EntityLayerType];
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphics::CTextureHandle CMapImages::GetSpeedupArrow()
|
IGraphics::CTextureHandle CMapImages::GetSpeedupArrow()
|
||||||
|
|
|
@ -4,6 +4,31 @@
|
||||||
#define GAME_CLIENT_COMPONENTS_MAPIMAGES_H
|
#define GAME_CLIENT_COMPONENTS_MAPIMAGES_H
|
||||||
#include <game/client/component.h>
|
#include <game/client/component.h>
|
||||||
|
|
||||||
|
enum EMapImageEntityLayerType
|
||||||
|
{
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_GAME = 0,
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_FRONT,
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_SPEEDUP,
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH,
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_TELE,
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE,
|
||||||
|
|
||||||
|
MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EMapImageModType
|
||||||
|
{
|
||||||
|
MAP_IMAGE_MOD_TYPE_UNKNOWN = 0,
|
||||||
|
MAP_IMAGE_MOD_TYPE_DDNET,
|
||||||
|
MAP_IMAGE_MOD_TYPE_DDRACE,
|
||||||
|
MAP_IMAGE_MOD_TYPE_RACE,
|
||||||
|
MAP_IMAGE_MOD_TYPE_BLOCKWORLDS,
|
||||||
|
MAP_IMAGE_MOD_TYPE_FNG,
|
||||||
|
MAP_IMAGE_MOD_TYPE_VANILLA,
|
||||||
|
|
||||||
|
MAP_IMAGE_MOD_TYPE_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
class CMapImages : public CComponent
|
class CMapImages : public CComponent
|
||||||
{
|
{
|
||||||
friend class CBackground;
|
friend class CBackground;
|
||||||
|
@ -12,7 +37,12 @@ class CMapImages : public CComponent
|
||||||
int m_aTextureUsedByTileOrQuadLayerFlag[64]; // 0: nothing, 1(as flag): tile layer, 2(as flag): quad layer
|
int m_aTextureUsedByTileOrQuadLayerFlag[64]; // 0: nothing, 1(as flag): tile layer, 2(as flag): quad layer
|
||||||
int m_Count;
|
int m_Count;
|
||||||
|
|
||||||
const char *m_pEntitiesGameType;
|
bool HasFrontLayer();
|
||||||
|
bool HasSpeedupLayer();
|
||||||
|
bool HasSwitchLayer();
|
||||||
|
bool HasTeleLayer();
|
||||||
|
bool HasTuneLayer();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMapImages();
|
CMapImages();
|
||||||
CMapImages(int ImageSize);
|
CMapImages(int ImageSize);
|
||||||
|
@ -26,7 +56,7 @@ public:
|
||||||
void LoadBackground(class CLayers *pLayers, class IMap *pMap);
|
void LoadBackground(class CLayers *pLayers, class IMap *pMap);
|
||||||
|
|
||||||
// DDRace
|
// DDRace
|
||||||
IGraphics::CTextureHandle GetEntities();
|
IGraphics::CTextureHandle GetEntities(EMapImageEntityLayerType EntityLayerType);
|
||||||
IGraphics::CTextureHandle GetSpeedupArrow();
|
IGraphics::CTextureHandle GetSpeedupArrow();
|
||||||
|
|
||||||
IGraphics::CTextureHandle GetOverlayBottom();
|
IGraphics::CTextureHandle GetOverlayBottom();
|
||||||
|
@ -37,13 +67,14 @@ public:
|
||||||
int GetTextureScale();
|
int GetTextureScale();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_EntitiesIsLoaded;
|
bool m_EntitiesIsLoaded[MAP_IMAGE_MOD_TYPE_COUNT];
|
||||||
bool m_SpeedupArrowIsLoaded;
|
bool m_SpeedupArrowIsLoaded;
|
||||||
IGraphics::CTextureHandle m_EntitiesTextures;
|
IGraphics::CTextureHandle m_EntitiesTextures[MAP_IMAGE_MOD_TYPE_COUNT][MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT];
|
||||||
IGraphics::CTextureHandle m_SpeedupArrowTexture;
|
IGraphics::CTextureHandle m_SpeedupArrowTexture;
|
||||||
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
||||||
IGraphics::CTextureHandle m_OverlayTopTexture;
|
IGraphics::CTextureHandle m_OverlayTopTexture;
|
||||||
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
||||||
|
IGraphics::CTextureHandle m_TransparentTexture;
|
||||||
int m_TextureScale;
|
int m_TextureScale;
|
||||||
|
|
||||||
void InitOverlayTextures();
|
void InitOverlayTextures();
|
||||||
|
|
|
@ -587,25 +587,19 @@ void CMapLayers::OnMapLoad()
|
||||||
{
|
{
|
||||||
if(IsGameLayer)
|
if(IsGameLayer)
|
||||||
{
|
{
|
||||||
Index = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Index;
|
Index = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Index;
|
||||||
Flags = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
Flags = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Flags;
|
||||||
if(!GameClient()->m_GameInfo.m_DontMaskEntities && !IsValidGameTile(Index))
|
|
||||||
Index = 0;
|
|
||||||
}
|
}
|
||||||
if(IsFrontLayer)
|
if(IsFrontLayer)
|
||||||
{
|
{
|
||||||
Index = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Index;
|
Index = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Index;
|
||||||
Flags = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
Flags = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Flags;
|
||||||
if(!GameClient()->m_GameInfo.m_DontMaskEntities && !IsValidFrontTile(Index))
|
|
||||||
Index = 0;
|
|
||||||
}
|
}
|
||||||
if(IsSwitchLayer)
|
if(IsSwitchLayer)
|
||||||
{
|
{
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
Index = ((CSwitchTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
Index = ((CSwitchTile *)pTiles)[y * pTMap->m_Width + x].m_Type;
|
||||||
if(!IsValidSwitchTile(Index))
|
if(CurOverlay == 0)
|
||||||
Index = 0;
|
|
||||||
else if(CurOverlay == 0)
|
|
||||||
{
|
{
|
||||||
Flags = ((CSwitchTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
Flags = ((CSwitchTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
||||||
if(Index == TILE_SWITCHTIMEDOPEN) Index = 8;
|
if(Index == TILE_SWITCHTIMEDOPEN) Index = 8;
|
||||||
|
@ -619,9 +613,7 @@ void CMapLayers::OnMapLoad()
|
||||||
{
|
{
|
||||||
Index = ((CTeleTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
Index = ((CTeleTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
if(!IsValidTeleTile(Index))
|
if(CurOverlay == 1)
|
||||||
Index = 0;
|
|
||||||
else if(CurOverlay == 1)
|
|
||||||
{
|
{
|
||||||
if(Index != TILE_TELECHECKIN && Index != TILE_TELECHECKINEVIL)
|
if(Index != TILE_TELECHECKIN && Index != TILE_TELECHECKINEVIL)
|
||||||
Index = ((CTeleTile*)pTiles)[y*pTMap->m_Width+x].m_Number;
|
Index = ((CTeleTile*)pTiles)[y*pTMap->m_Width+x].m_Number;
|
||||||
|
@ -632,8 +624,8 @@ void CMapLayers::OnMapLoad()
|
||||||
{
|
{
|
||||||
Index = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
Index = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
AngleRotate = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width + x].m_Angle;
|
AngleRotate = ((CSpeedupTile *)pTiles)[y * pTMap->m_Width + x].m_Angle;
|
||||||
if(!IsValidSpeedupTile(Index) || ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Force == 0)
|
if(((CSpeedupTile *)pTiles)[y * pTMap->m_Width + x].m_Force == 0)
|
||||||
Index = 0;
|
Index = 0;
|
||||||
else if(CurOverlay == 1)
|
else if(CurOverlay == 1)
|
||||||
Index = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Force;
|
Index = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Force;
|
||||||
|
@ -642,9 +634,7 @@ void CMapLayers::OnMapLoad()
|
||||||
}
|
}
|
||||||
if(IsTuneLayer)
|
if(IsTuneLayer)
|
||||||
{
|
{
|
||||||
Index = ((CTuneTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
Index = ((CTuneTile *)pTiles)[y * pTMap->m_Width + x].m_Type;
|
||||||
if(!IsValidTuneTile(Index))
|
|
||||||
Index = 0;
|
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -1684,7 +1674,7 @@ void CMapLayers::OnRender()
|
||||||
if(!IsGameLayer)
|
if(!IsGameLayer)
|
||||||
Graphics()->TextureClear();
|
Graphics()->TextureClear();
|
||||||
else
|
else
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_GAME));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Graphics()->TextureSet(m_pImages->Get(pTMap->m_Image));
|
Graphics()->TextureSet(m_pImages->Get(pTMap->m_Image));
|
||||||
|
@ -1784,7 +1774,7 @@ void CMapLayers::OnRender()
|
||||||
else if(Render && g_Config.m_ClOverlayEntities && IsFrontLayer)
|
else if(Render && g_Config.m_ClOverlayEntities && IsFrontLayer)
|
||||||
{
|
{
|
||||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_FRONT));
|
||||||
|
|
||||||
CTile *pFrontTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Front);
|
CTile *pFrontTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Front);
|
||||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Front);
|
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Front);
|
||||||
|
@ -1811,7 +1801,7 @@ void CMapLayers::OnRender()
|
||||||
else if(Render && g_Config.m_ClOverlayEntities && IsSwitchLayer)
|
else if(Render && g_Config.m_ClOverlayEntities && IsSwitchLayer)
|
||||||
{
|
{
|
||||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH));
|
||||||
|
|
||||||
CSwitchTile *pSwitchTiles = (CSwitchTile *)m_pLayers->Map()->GetData(pTMap->m_Switch);
|
CSwitchTile *pSwitchTiles = (CSwitchTile *)m_pLayers->Map()->GetData(pTMap->m_Switch);
|
||||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Switch);
|
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Switch);
|
||||||
|
@ -1844,7 +1834,7 @@ void CMapLayers::OnRender()
|
||||||
else if(Render && g_Config.m_ClOverlayEntities && IsTeleLayer)
|
else if(Render && g_Config.m_ClOverlayEntities && IsTeleLayer)
|
||||||
{
|
{
|
||||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_TELE));
|
||||||
|
|
||||||
CTeleTile *pTeleTiles = (CTeleTile *)m_pLayers->Map()->GetData(pTMap->m_Tele);
|
CTeleTile *pTeleTiles = (CTeleTile *)m_pLayers->Map()->GetData(pTMap->m_Tele);
|
||||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Tele);
|
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Tele);
|
||||||
|
@ -1875,7 +1865,7 @@ void CMapLayers::OnRender()
|
||||||
else if(Render && g_Config.m_ClOverlayEntities && IsSpeedupLayer)
|
else if(Render && g_Config.m_ClOverlayEntities && IsSpeedupLayer)
|
||||||
{
|
{
|
||||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_SPEEDUP));
|
||||||
|
|
||||||
CSpeedupTile *pSpeedupTiles = (CSpeedupTile *)m_pLayers->Map()->GetData(pTMap->m_Speedup);
|
CSpeedupTile *pSpeedupTiles = (CSpeedupTile *)m_pLayers->Map()->GetData(pTMap->m_Speedup);
|
||||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Speedup);
|
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Speedup);
|
||||||
|
@ -1913,7 +1903,7 @@ void CMapLayers::OnRender()
|
||||||
else if(Render && g_Config.m_ClOverlayEntities && IsTuneLayer)
|
else if(Render && g_Config.m_ClOverlayEntities && IsTuneLayer)
|
||||||
{
|
{
|
||||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE));
|
||||||
|
|
||||||
CTuneTile *pTuneTiles = (CTuneTile *)m_pLayers->Map()->GetData(pTMap->m_Tune);
|
CTuneTile *pTuneTiles = (CTuneTile *)m_pLayers->Map()->GetData(pTMap->m_Tune);
|
||||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Tune);
|
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Tune);
|
||||||
|
|
|
@ -1548,18 +1548,20 @@ void CLayerSpeedup::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_Force = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Force = 0;
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_MaxSpeed = 0;
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_Angle = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Angle = 0;
|
||||||
m_pTiles[fy*m_Width+fx].m_Index = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Type = 0;
|
||||||
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_Force = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Force = 0;
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_MaxSpeed = 0;
|
||||||
m_pSpeedupTile[fy*m_Width+fx].m_Angle = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Angle = 0;
|
||||||
m_pTiles[fy*m_Width+fx].m_Index = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Type = 0;
|
||||||
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FlagModified(sx, sy, l->m_Width, l->m_Height);
|
FlagModified(sx, sy, l->m_Width, l->m_Height);
|
||||||
|
|
|
@ -111,3 +111,17 @@ bool IsRotatableTile(int Index)
|
||||||
|| Index - ENTITY_OFFSET == ENTITY_CRAZY_SHOTGUN
|
|| Index - ENTITY_OFFSET == ENTITY_CRAZY_SHOTGUN
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsCreditsTile(int TileIndex)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
(TILE_CREDITS_1 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_2 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_3 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_4 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_5 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_6 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_7 == TileIndex)
|
||||||
|
|| (TILE_CREDITS_8 == TileIndex)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -484,5 +484,6 @@ bool IsValidSwitchTile(int Index);
|
||||||
bool IsValidTuneTile(int Index);
|
bool IsValidTuneTile(int Index);
|
||||||
bool IsValidEntity(int Index);
|
bool IsValidEntity(int Index);
|
||||||
bool IsRotatableTile(int Index);
|
bool IsRotatableTile(int Index);
|
||||||
|
bool IsCreditsTile(int TileIndex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue