diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
commit | 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch) | |
tree | 62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL/UT2BkgndInfo.cpp | |
parent | c0c336500955a23e344651e5412c9d9d441ef4ee (diff) | |
download | t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip |
i am in hell
Diffstat (limited to 'src/T2DLL/UT2BkgndInfo.cpp')
-rw-r--r-- | src/T2DLL/UT2BkgndInfo.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/T2DLL/UT2BkgndInfo.cpp b/src/T2DLL/UT2BkgndInfo.cpp index b62afaf..14e62aa 100644 --- a/src/T2DLL/UT2BkgndInfo.cpp +++ b/src/T2DLL/UT2BkgndInfo.cpp @@ -1,31 +1,32 @@ #include "UT2BkgndInfo.h" /*static*/ BkgndInfo* UT2BkgndInfo::SetupBkgndInfo(const RECT& rect, int z) { - BkgndInfo *bkgndInfo = NULL; + BkgndInfo *bkgndInfoPtr = NULL; + int size; int vRange = (rect.bottom - rect.top) / 2; int hRange = (rect.right - rect.left) / 8; int zRange = z / 2; if (vRange > 0 && hRange > 0) { - int size = sizeof(BkgndInfo) + sizeof(void *) * (vRange - 1); - bkgndInfo = (BkgndInfo *) malloc(size); - memset(bkgndInfo, 0, size); + size = sizeof(BkgndInfo) + sizeof(void *) * (vRange - 1); + bkgndInfoPtr = (BkgndInfo *) malloc(size); + memset(bkgndInfoPtr, 0, size); - bkgndInfo->vRange = vRange; - bkgndInfo->hRange = hRange; - bkgndInfo->zRange = zRange; + bkgndInfoPtr->vRange = vRange; + bkgndInfoPtr->hRange = hRange; + bkgndInfoPtr->zRange = zRange; - for (int i = 0; i < vRange && bkgndInfo; i++) { + for (int i = 0; i < vRange && bkgndInfoPtr; i++) { size = sizeof(unsigned int) * hRange; - bkgndInfo->arrays[i] = (unsigned int *) malloc(size); - memset(bkgndInfo->arrays[i], 0, size); - if (!bkgndInfo->arrays[i]) - DisposeBkgndInfo(bkgndInfo); + bkgndInfoPtr->arrays[i] = (unsigned int *) malloc(size); + memset(bkgndInfoPtr->arrays[i], 0, size); + if (!bkgndInfoPtr->arrays[i]) + DisposeBkgndInfo(bkgndInfoPtr); } } - return bkgndInfo; + return bkgndInfoPtr; } /*static*/ void UT2BkgndInfo::DisposeBkgndInfo(BkgndInfo*& info) { |