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;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
m_pBackend->RunBuffer(m_pCommandBuffer);
|
||||
|
|
|
@ -724,142 +724,143 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
public:
|
||||
CGraphics_Threaded();
|
||||
|
||||
virtual void ClipEnable(int x, int y, int w, int h);
|
||||
virtual void ClipDisable();
|
||||
void ClipEnable(int x, int y, int w, int h) override;
|
||||
void ClipDisable() override;
|
||||
|
||||
virtual void BlendNone();
|
||||
virtual void BlendNormal();
|
||||
virtual void BlendAdditive();
|
||||
void BlendNone() override;
|
||||
void BlendNormal() override;
|
||||
void BlendAdditive() override;
|
||||
|
||||
virtual void WrapNormal();
|
||||
virtual void WrapClamp();
|
||||
void WrapNormal() override;
|
||||
void WrapClamp() override;
|
||||
|
||||
virtual int MemoryUsage() const;
|
||||
int MemoryUsage() const override;
|
||||
|
||||
virtual void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY);
|
||||
virtual void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY);
|
||||
void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY) override;
|
||||
void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY) override;
|
||||
|
||||
virtual void LinesBegin();
|
||||
virtual void LinesEnd();
|
||||
virtual void LinesDraw(const CLineItem *pArray, int Num);
|
||||
void LinesBegin() override;
|
||||
void LinesEnd() override;
|
||||
void LinesDraw(const CLineItem *pArray, int Num) override;
|
||||
|
||||
virtual int UnloadTexture(IGraphics::CTextureHandle Index);
|
||||
virtual IGraphics::CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL);
|
||||
virtual int LoadTextureRawSub(IGraphics::CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData);
|
||||
int UnloadTexture(IGraphics::CTextureHandle Index) override;
|
||||
IGraphics::CTextureHandle LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName = NULL) override;
|
||||
int LoadTextureRawSub(IGraphics::CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData) override;
|
||||
|
||||
// simple uncompressed RGBA loaders
|
||||
virtual IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags);
|
||||
virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType);
|
||||
IGraphics::CTextureHandle LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags) override;
|
||||
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();
|
||||
|
||||
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();
|
||||
virtual void QuadsEnd();
|
||||
virtual void TextQuadsBegin();
|
||||
virtual void TextQuadsEnd(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float* pOutlineTextColor);
|
||||
virtual void QuadsEndKeepVertices();
|
||||
virtual void QuadsDrawCurrentVertices(bool KeepVertices = true);
|
||||
virtual void QuadsSetRotation(float Angle);
|
||||
void QuadsBegin() override;
|
||||
void QuadsEnd() override;
|
||||
void TextQuadsBegin() override;
|
||||
void TextQuadsEnd(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float *pOutlineTextColor) override;
|
||||
void QuadsEndKeepVertices() override;
|
||||
void QuadsDrawCurrentVertices(bool KeepVertices = true) override;
|
||||
void QuadsSetRotation(float Angle) override;
|
||||
|
||||
virtual void SetColorVertex(const CColorVertex *pArray, int Num);
|
||||
virtual void SetColor(float r, float g, float b, float a);
|
||||
virtual void SetColor(ColorRGBA rgb);
|
||||
void SetColorVertex(const CColorVertex *pArray, int Num) override;
|
||||
void SetColor(float r, float g, float b, float a) override;
|
||||
void SetColor(ColorRGBA rgb) override;
|
||||
|
||||
// go through all vertices and change their color (only works for quads)
|
||||
virtual void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a);
|
||||
virtual void ChangeColorOfQuadVertices(int QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
void ChangeColorOfCurrentQuadVertices(float r, float g, float b, float a) override;
|
||||
void ChangeColorOfQuadVertices(int QuadOffset, unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
|
||||
|
||||
void SetColor(CCommandBuffer::SVertex *pVertex, int ColorIndex);
|
||||
|
||||
virtual void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV);
|
||||
virtual void QuadsSetSubsetFree(
|
||||
void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV) override;
|
||||
void QuadsSetSubsetFree(
|
||||
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);
|
||||
virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
|
||||
virtual void QuadsDrawFreeform(const CFreeformItem *pArray, int Num);
|
||||
virtual void QuadsText(float x, float y, float Size, const char *pText);
|
||||
void QuadsDraw(CQuadItem *pArray, int Num) override;
|
||||
void QuadsDrawTL(const CQuadItem *pArray, int Num) override;
|
||||
void QuadsDrawFreeform(const CFreeformItem *pArray, int Num) override;
|
||||
void QuadsText(float x, float y, float Size, const char *pText) override;
|
||||
|
||||
virtual int CreateQuadContainer();
|
||||
virtual void QuadContainerUpload(int ContainerIndex);
|
||||
virtual void QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num);
|
||||
virtual void QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num);
|
||||
virtual void QuadContainerReset(int ContainerIndex);
|
||||
virtual void DeleteQuadContainer(int ContainerIndex);
|
||||
virtual void RenderQuadContainer(int ContainerIndex, int QuadDrawNum);
|
||||
virtual void RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum);
|
||||
virtual void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f);
|
||||
virtual void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo);
|
||||
int CreateQuadContainer() override;
|
||||
void QuadContainerUpload(int ContainerIndex) override;
|
||||
void QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num) override;
|
||||
void QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num) override;
|
||||
void QuadContainerReset(int ContainerIndex) override;
|
||||
void DeleteQuadContainer(int ContainerIndex) override;
|
||||
void RenderQuadContainer(int ContainerIndex, int QuadDrawNum) override;
|
||||
void RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum) override;
|
||||
void RenderQuadContainerAsSprite(int ContainerIndex, int QuadOffset, float X, float Y, float ScaleX = 1.f, float ScaleY = 1.f) override;
|
||||
void RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo) override;
|
||||
|
||||
virtual void FlushVertices(bool KeepVertices = false);
|
||||
virtual void FlushTextVertices(int TextureSize, int TextTextureIndex, int TextOutlineTextureIndex, float *pOutlineTextColor);
|
||||
void FlushVertices(bool KeepVertices = false) override;
|
||||
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);
|
||||
virtual void RenderBorderTiles(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, int JumpIndex, unsigned int DrawNum);
|
||||
virtual void RenderBorderTileLines(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, unsigned int IndexDrawNum, unsigned int RedrawNum);
|
||||
virtual void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo* pQuadInfo, int QuadNum);
|
||||
virtual void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, float* pTextColor, float* pTextoutlineColor);
|
||||
void RenderTileLayer(int BufferContainerIndex, float *pColor, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffet) override;
|
||||
void RenderBorderTiles(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, int JumpIndex, unsigned int DrawNum) override;
|
||||
void RenderBorderTileLines(int BufferContainerIndex, float *pColor, char *pIndexBufferOffset, float *pOffset, float *pDir, unsigned int IndexDrawNum, unsigned int RedrawNum) override;
|
||||
void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, int QuadNum) override;
|
||||
void RenderText(int BufferContainerIndex, int TextQuadNum, int TextureSize, int TextureTextIndex, int TextureTextOutlineIndex, float *pTextColor, float *pTextoutlineColor) override;
|
||||
|
||||
// opengl 3.3 functions
|
||||
virtual int CreateBufferObject(size_t UploadDataSize, void* pUploadData);
|
||||
virtual void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void* pUploadData);
|
||||
virtual void UpdateBufferObject(int BufferIndex, size_t UploadDataSize, void* pUploadData, void* pOffset);
|
||||
virtual void CopyBufferObject(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize);
|
||||
virtual void DeleteBufferObject(int BufferIndex);
|
||||
int CreateBufferObject(size_t UploadDataSize, void *pUploadData) override;
|
||||
void RecreateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData) override;
|
||||
void UpdateBufferObject(int BufferIndex, size_t UploadDataSize, void *pUploadData, void *pOffset) override;
|
||||
void CopyBufferObject(int WriteBufferIndex, int ReadBufferIndex, size_t WriteOffset, size_t ReadOffset, size_t CopyDataSize) override;
|
||||
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
|
||||
virtual void DeleteBufferContainer(int ContainerIndex, bool DestroyAllBO = true);
|
||||
virtual void UpdateBufferContainer(int ContainerIndex, SBufferContainerInfo *pContainerInfo);
|
||||
virtual void IndicesNumRequiredNotify(unsigned int RequiredIndicesCount);
|
||||
void DeleteBufferContainer(int ContainerIndex, bool DestroyAllBO = true) override;
|
||||
void UpdateBufferContainer(int ContainerIndex, SBufferContainerInfo *pContainerInfo) override;
|
||||
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;
|
||||
virtual void Minimize();
|
||||
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();
|
||||
int WindowActive() override;
|
||||
int WindowOpen() override;
|
||||
|
||||
virtual int WindowActive();
|
||||
virtual int WindowOpen();
|
||||
void SetWindowGrab(bool Grab) override;
|
||||
void NotifyWindow() override;
|
||||
|
||||
virtual void SetWindowGrab(bool Grab);
|
||||
virtual void NotifyWindow();
|
||||
int Init() override;
|
||||
void Shutdown() override;
|
||||
|
||||
virtual int Init();
|
||||
virtual void Shutdown();
|
||||
void TakeScreenshot(const char *pFilename) override;
|
||||
void TakeCustomScreenshot(const char *pFilename) override;
|
||||
void Swap() override;
|
||||
bool SetVSync(bool State) override;
|
||||
|
||||
virtual void TakeScreenshot(const char *pFilename);
|
||||
virtual void TakeCustomScreenshot(const char *pFilename);
|
||||
virtual void Swap();
|
||||
virtual bool SetVSync(bool State);
|
||||
|
||||
virtual int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen);
|
||||
int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) override;
|
||||
|
||||
virtual int GetDesktopScreenWidth() { return m_DesktopScreenWidth; }
|
||||
virtual int GetDesktopScreenHeight() { return m_DesktopScreenHeight; }
|
||||
|
||||
// synchronization
|
||||
virtual void InsertSignal(semaphore *pSemaphore);
|
||||
virtual bool IsIdle();
|
||||
virtual void WaitForIdle();
|
||||
void InsertSignal(semaphore *pSemaphore) override;
|
||||
bool IsIdle() override;
|
||||
void WaitForIdle() override;
|
||||
|
||||
virtual SGraphicsWarning *GetCurWarning();
|
||||
SGraphicsWarning *GetCurWarning() override;
|
||||
|
||||
virtual bool IsTileBufferingEnabled() { return m_OpenGLTileBufferingEnabled; }
|
||||
virtual bool IsQuadBufferingEnabled() { return m_OpenGLQuadBufferingEnabled; }
|
||||
virtual bool IsTextBufferingEnabled() { return m_OpenGLTextBufferingEnabled; }
|
||||
virtual bool IsQuadContainerBufferingEnabled() { return m_OpenGLQuadContainerBufferingEnabled; }
|
||||
virtual bool HasTextureArrays() { return m_OpenGLHasTextureArrays; }
|
||||
bool IsTileBufferingEnabled() override { return m_OpenGLTileBufferingEnabled; }
|
||||
bool IsQuadBufferingEnabled() override { return m_OpenGLQuadBufferingEnabled; }
|
||||
bool IsTextBufferingEnabled() override { return m_OpenGLTextBufferingEnabled; }
|
||||
bool IsQuadContainerBufferingEnabled() override { return m_OpenGLQuadContainerBufferingEnabled; }
|
||||
bool HasTextureArrays() override { return m_OpenGLHasTextureArrays; }
|
||||
};
|
||||
|
||||
extern IGraphicsBackend *CreateGraphicsBackend();
|
||||
|
|
|
@ -193,6 +193,9 @@ public:
|
|||
|
||||
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 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;
|
||||
|
|
|
@ -18,7 +18,7 @@ CMapImages::CMapImages(int TextureSize)
|
|||
{
|
||||
m_Count = 0;
|
||||
m_TextureScale = TextureSize;
|
||||
m_EntitiesIsLoaded = false;
|
||||
mem_zero(m_EntitiesIsLoaded, sizeof(m_EntitiesIsLoaded));
|
||||
m_SpeedupArrowIsLoaded = false;
|
||||
|
||||
mem_zero(m_aTextureUsedByTileOrQuadLayerFlag, sizeof(m_aTextureUsedByTileOrQuadLayerFlag));
|
||||
|
@ -59,7 +59,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
|
|||
CMapItemLayerTilemap *pTLayer = (CMapItemLayerTilemap *)pLayer;
|
||||
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)
|
||||
|
@ -67,7 +67,7 @@ void CMapImages::OnMapLoadImpl(class CLayers *pLayers, IMap *pMap)
|
|||
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
||||
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);
|
||||
}
|
||||
|
||||
IGraphics::CTextureHandle CMapImages::GetEntities()
|
||||
bool CMapImages::HasFrontLayer()
|
||||
{
|
||||
// DDNet default to prevent delay in seeing entities
|
||||
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";
|
||||
return GameClient()->m_GameInfo.m_EntitiesDDNet || GameClient()->m_GameInfo.m_EntitiesDDRace;
|
||||
}
|
||||
|
||||
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];
|
||||
str_format(aPath, sizeof(aPath), "editor/entities_clear/%s.png", pEntities);
|
||||
|
||||
if(m_EntitiesTextures >= 0)
|
||||
Graphics()->UnloadTexture(m_EntitiesTextures);
|
||||
bool GameTypeHasFrontLayer = HasFrontLayer() || WasUnknwon;
|
||||
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;
|
||||
m_EntitiesTextures = Graphics()->LoadTexture(aPath, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, TextureLoadFlag);
|
||||
m_EntitiesIsLoaded = true;
|
||||
m_pEntitiesGameType = pEntities;
|
||||
|
||||
CImageInfo ImgInfo;
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
return m_EntitiesTextures[EntitiesModType][EntityLayerType];
|
||||
}
|
||||
|
||||
IGraphics::CTextureHandle CMapImages::GetSpeedupArrow()
|
||||
|
|
|
@ -4,6 +4,31 @@
|
|||
#define GAME_CLIENT_COMPONENTS_MAPIMAGES_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
|
||||
{
|
||||
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_Count;
|
||||
|
||||
const char *m_pEntitiesGameType;
|
||||
bool HasFrontLayer();
|
||||
bool HasSpeedupLayer();
|
||||
bool HasSwitchLayer();
|
||||
bool HasTeleLayer();
|
||||
bool HasTuneLayer();
|
||||
|
||||
public:
|
||||
CMapImages();
|
||||
CMapImages(int ImageSize);
|
||||
|
@ -26,7 +56,7 @@ public:
|
|||
void LoadBackground(class CLayers *pLayers, class IMap *pMap);
|
||||
|
||||
// DDRace
|
||||
IGraphics::CTextureHandle GetEntities();
|
||||
IGraphics::CTextureHandle GetEntities(EMapImageEntityLayerType EntityLayerType);
|
||||
IGraphics::CTextureHandle GetSpeedupArrow();
|
||||
|
||||
IGraphics::CTextureHandle GetOverlayBottom();
|
||||
|
@ -37,13 +67,14 @@ public:
|
|||
int GetTextureScale();
|
||||
|
||||
private:
|
||||
bool m_EntitiesIsLoaded;
|
||||
bool m_EntitiesIsLoaded[MAP_IMAGE_MOD_TYPE_COUNT];
|
||||
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_OverlayBottomTexture;
|
||||
IGraphics::CTextureHandle m_OverlayTopTexture;
|
||||
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
||||
IGraphics::CTextureHandle m_TransparentTexture;
|
||||
int m_TextureScale;
|
||||
|
||||
void InitOverlayTextures();
|
||||
|
|
|
@ -587,25 +587,19 @@ void CMapLayers::OnMapLoad()
|
|||
{
|
||||
if(IsGameLayer)
|
||||
{
|
||||
Index = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Index;
|
||||
Flags = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
||||
if(!GameClient()->m_GameInfo.m_DontMaskEntities && !IsValidGameTile(Index))
|
||||
Index = 0;
|
||||
Index = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Index;
|
||||
Flags = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Flags;
|
||||
}
|
||||
if(IsFrontLayer)
|
||||
{
|
||||
Index = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Index;
|
||||
Flags = ((CTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
||||
if(!GameClient()->m_GameInfo.m_DontMaskEntities && !IsValidFrontTile(Index))
|
||||
Index = 0;
|
||||
Index = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Index;
|
||||
Flags = ((CTile *)pTiles)[y * pTMap->m_Width + x].m_Flags;
|
||||
}
|
||||
if(IsSwitchLayer)
|
||||
{
|
||||
Flags = 0;
|
||||
Index = ((CSwitchTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
||||
if(!IsValidSwitchTile(Index))
|
||||
Index = 0;
|
||||
else if(CurOverlay == 0)
|
||||
Index = ((CSwitchTile *)pTiles)[y * pTMap->m_Width + x].m_Type;
|
||||
if(CurOverlay == 0)
|
||||
{
|
||||
Flags = ((CSwitchTile*)pTiles)[y*pTMap->m_Width+x].m_Flags;
|
||||
if(Index == TILE_SWITCHTIMEDOPEN) Index = 8;
|
||||
|
@ -619,9 +613,7 @@ void CMapLayers::OnMapLoad()
|
|||
{
|
||||
Index = ((CTeleTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
||||
Flags = 0;
|
||||
if(!IsValidTeleTile(Index))
|
||||
Index = 0;
|
||||
else if(CurOverlay == 1)
|
||||
if(CurOverlay == 1)
|
||||
{
|
||||
if(Index != TILE_TELECHECKIN && Index != TILE_TELECHECKINEVIL)
|
||||
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;
|
||||
Flags = 0;
|
||||
AngleRotate = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width + x].m_Angle;
|
||||
if(!IsValidSpeedupTile(Index) || ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Force == 0)
|
||||
AngleRotate = ((CSpeedupTile *)pTiles)[y * pTMap->m_Width + x].m_Angle;
|
||||
if(((CSpeedupTile *)pTiles)[y * pTMap->m_Width + x].m_Force == 0)
|
||||
Index = 0;
|
||||
else if(CurOverlay == 1)
|
||||
Index = ((CSpeedupTile*)pTiles)[y*pTMap->m_Width+x].m_Force;
|
||||
|
@ -642,9 +634,7 @@ void CMapLayers::OnMapLoad()
|
|||
}
|
||||
if(IsTuneLayer)
|
||||
{
|
||||
Index = ((CTuneTile*)pTiles)[y*pTMap->m_Width+x].m_Type;
|
||||
if(!IsValidTuneTile(Index))
|
||||
Index = 0;
|
||||
Index = ((CTuneTile *)pTiles)[y * pTMap->m_Width + x].m_Type;
|
||||
Flags = 0;
|
||||
}
|
||||
} else
|
||||
|
@ -1684,7 +1674,7 @@ void CMapLayers::OnRender()
|
|||
if(!IsGameLayer)
|
||||
Graphics()->TextureClear();
|
||||
else
|
||||
Graphics()->TextureSet(m_pImages->GetEntities());
|
||||
Graphics()->TextureSet(m_pImages->GetEntities(MAP_IMAGE_ENTITY_LAYER_TYPE_GAME));
|
||||
}
|
||||
else
|
||||
Graphics()->TextureSet(m_pImages->Get(pTMap->m_Image));
|
||||
|
@ -1784,7 +1774,7 @@ void CMapLayers::OnRender()
|
|||
else if(Render && g_Config.m_ClOverlayEntities && IsFrontLayer)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
unsigned int Size = m_pLayers->Map()->GetDataSize(pTMap->m_Tune);
|
||||
|
|
|
@ -1548,18 +1548,20 @@ void CLayerSpeedup::BrushDraw(CLayer *pBrush, float wx, float wy)
|
|||
}
|
||||
else
|
||||
{
|
||||
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_Angle = 0;
|
||||
m_pTiles[fy*m_Width+fx].m_Index = 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_Angle = 0;
|
||||
m_pSpeedupTile[fy * m_Width + fx].m_Type = 0;
|
||||
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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_Angle = 0;
|
||||
m_pTiles[fy*m_Width+fx].m_Index = 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_Angle = 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);
|
||||
|
|
|
@ -111,3 +111,17 @@ bool IsRotatableTile(int Index)
|
|||
|| 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 IsValidEntity(int Index);
|
||||
bool IsRotatableTile(int Index);
|
||||
bool IsCreditsTile(int TileIndex);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue