summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-07-18 13:09:21 +0300
committerSergeanur <s.anureev@yandex.ua>2020-07-18 13:09:21 +0300
commitcf5dd6289e5f4a805131aca4b57acb6c5d66adc8 (patch)
tree0128edc947d4a32fb4f975768d4b95a6eb1cd773
parent30384bb4efa5905051859eb931883e7401056c66 (diff)
Fix TempVertexBuffer overflow
-rw-r--r--src/render/RenderBuffer.cpp4
-rw-r--r--src/render/RenderBuffer.h4
-rw-r--r--src/render/Sprite2d.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp
index 5239dc06..b4f48a26 100644
--- a/src/render/RenderBuffer.cpp
+++ b/src/render/RenderBuffer.cpp
@@ -5,8 +5,8 @@
int32 TempBufferVerticesStored;
int32 TempBufferIndicesStored;
-RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE];
-RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex * )TempVertexBuffer;
+RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
+RwIm2DVertex *TempVertexBuffer = (RwIm2DVertex*)TempBufferRenderVertices;
RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
int RenderBuffer::VerticesToBeStored;
diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h
index e67a28d0..0789dfa5 100644
--- a/src/render/RenderBuffer.h
+++ b/src/render/RenderBuffer.h
@@ -14,6 +14,6 @@ public:
extern int32 TempBufferVerticesStored;
extern int32 TempBufferIndicesStored;
-extern RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE];
-extern RwIm3DVertex *TempBufferRenderVertices;
+extern RwIm2DVertex *TempVertexBuffer;
+extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; \ No newline at end of file
diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp
index bf39d15e..5f1e79db 100644
--- a/src/render/Sprite2d.cpp
+++ b/src/render/Sprite2d.cpp
@@ -449,7 +449,7 @@ CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float
bool
CSprite2d::IsVertexBufferFull()
{
- return (nextBufferVertex > ARRAY_SIZE(TempVertexBuffer)-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6);
+ return (nextBufferVertex > TEMPBUFFERINDEXSIZE-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6);
}
void