From 711050de8a031c05d41aa19035de2a4ece94a0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20J=C3=B8rgen=20Solberg?= Date: Mon, 30 Oct 2017 19:08:51 +0100 Subject: [PATCH] fix frame pointer arithmetic --- code/MD2Loader.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/MD2Loader.cpp b/code/MD2Loader.cpp index cb494d5b2..f0a5432bf 100644 --- a/code/MD2Loader.cpp +++ b/code/MD2Loader.cpp @@ -274,11 +274,9 @@ void MD2Importer::InternReadFile( const std::string& pFile, aiMesh* pcMesh = pScene->mMeshes[0] = new aiMesh(); pcMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE; - // navigate to the begin of the frame data - BE_NCONST MD2::Frame* pcFrame = (BE_NCONST MD2::Frame*) ((uint8_t*) - m_pcHeader + m_pcHeader->offsetFrames); - - pcFrame += configFrameID; + // navigate to the begin of the current frame data + BE_NCONST MD2::Frame* pcFrame = (BE_NCONST MD2::Frame*) ((uint8_t*) + m_pcHeader + m_pcHeader->offsetFrames + (m_pcHeader->frameSize * configFrameID)); // navigate to the begin of the triangle data MD2::Triangle* pcTriangles = (MD2::Triangle*) ((uint8_t*)