Mercurial > mm7
diff Indoor.cpp @ 711:a5e587c8e30e
some cleaning
author | Gloval |
---|---|
date | Thu, 21 Mar 2013 23:10:57 +0400 |
parents | 436ae1842e92 |
children | e7c86528a2b3 |
line wrap: on
line diff
--- a/Indoor.cpp Thu Mar 21 12:37:49 2013 +0200 +++ b/Indoor.cpp Thu Mar 21 23:10:57 2013 +0400 @@ -1720,69 +1720,32 @@ } //----- (00498C45) -------------------------------------------------------- -int IndoorLocation::Alloc() -{ - IndoorLocation *v1; // esi@1 - void *v2; // eax@1 - const void *v3; // ST3C_4@1 - void *v4; // eax@1 - const void *v5; // ST3C_4@1 - void *v6; // eax@1 - const void *v7; // ST3C_4@1 - void *v8; // eax@1 - const void *v9; // ST3C_4@1 - void *v10; // eax@1 - const void *v11; // ST3C_4@1 - void *v12; // eax@1 - const void *v13; // ST3C_4@1 - void *v14; // eax@1 - const void *v15; // ST3C_4@1 - void *v16; // eax@1 - void *v17; // ecx@1 - signed int result; // eax@9 - - v1 = this; - v2 = pAllocator->AllocNamedChunk(this->pVertices, 0x15F90u, "L.V"); - v3 = v1->pFaces; - v1->pVertices = (Vec3_short_ *)v2; - v4 = pAllocator->AllocNamedChunk(v3, 0xEA600u, "L.F"); - v5 = v1->pFaceExtras; - v1->pFaces = (BLVFace *)v4; - v6 = pAllocator->AllocNamedChunk(v5, 0x2BF20u, "L.FX"); - v7 = v1->pSectors; - v1->pFaceExtras = (BLVFaceExtra *)v6; - v8 = pAllocator->AllocNamedChunk(v7, 0xE800u, "L.R"); - v9 = v1->pLights; - v1->pSectors = (BLVSector *)v8; - v10 = pAllocator->AllocNamedChunk(v9, 0x1900u, "L.L"); - v11 = v1->pDoors; - v1->pLights = (BLVLightMM7 *)v10; - v12 = pAllocator->AllocNamedChunk(v11, 0x3E80u, "L.D"); - v13 = v1->pNodes; - v1->pDoors = (BLVDoor *)v12; - v14 = pAllocator->AllocNamedChunk(v13, 0x9C40u, "L.BSP"); - v15 = v1->pMapOutlines; - v1->pNodes = (BSPNode *)v14; - v16 = pAllocator->AllocNamedChunk(v15, 0x14824u, "L.Map"); - v17 = v1->pVertices; - v1->pMapOutlines = (BLVMapOutlines *)v16; - if ( v17 && v1->pFaces && v1->pFaceExtras && v1->pSectors && v1->pLights && v1->pDoors && v1->pNodes && v16 ) +bool IndoorLocation::Alloc() + { + pVertices = (Vec3_short_ *) pAllocator->AllocNamedChunk(pVertices, 15000*sizeof(Vec3_short_), "L.V");//0x15F90u + pFaces = (BLVFace *) pAllocator->AllocNamedChunk(pFaces, 10000*sizeof(BLVFace), "L.F");//0xEA600u + pFaceExtras = (BLVFaceExtra *) pAllocator->AllocNamedChunk(pFaceExtras,5000*sizeof(BLVFaceExtra), "L.FX"); //0x2BF20u + pSectors = (BLVSector *) pAllocator->AllocNamedChunk(pSectors, 512*sizeof(BLVSector), "L.R");//0xE800u + pLights = (BLVLightMM7 *) pAllocator->AllocNamedChunk(pLights, 400*sizeof(BLVLightMM7), "L.L");//0x1900u + pDoors = (BLVDoor *) pAllocator->AllocNamedChunk(pDoors, 200*sizeof(BLVDoor), "L.D");//0x3E80u + pNodes = (BSPNode *) pAllocator->AllocNamedChunk(pNodes, 5000*sizeof(BSPNode), "L.BSP");//0x9C40u + pMapOutlines =(BLVMapOutlines *)pAllocator->AllocNamedChunk(pMapOutlines, sizeof(BLVMapOutlines), "L.Map");//0x14824u + if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines ) { - memset(v17, 90000, 0); - memset(v1->pFaces, 960000, 0); - memset(v1->pFaceExtras, 180000, 0); - memset(v1->pSectors, 59392, 0); - memset(v1->pLights, 6400, 0); - memset(v1->pDoors, 16000, 0); - memset(v1->pNodes, 40000, 0); - memset(v1->pMapOutlines, 84004, 0); - result = 1; + memset(pVertices, 0, 15000*sizeof(Vec3_short_)); + memset(pFaces, 0, 10000*sizeof(BLVFace)); + memset(pFaceExtras,0, 5000*sizeof(BLVFaceExtra)); + memset(pSectors, 0, 512*sizeof(BLVSector)); + memset(pLights, 0, 400*sizeof(BLVLightMM7)); + memset(pDoors, 0, 200*sizeof(BLVDoor)); + memset(pNodes, 0, 5000*sizeof(BSPNode)); + memset(pMapOutlines,0, sizeof(BLVMapOutlines)); + return true; } else { - result = 0; + return false; } - return result; } @@ -1802,13 +1765,13 @@ //----- (004488F7) -------------------------------------------------------- -void IndoorLocation::ToggleLight(unsigned int uLightID, unsigned int bToggle) +void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle) { char *v2; // eax@4 - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (signed int)uLightID <= pIndoor->uNumLights - 1 && (uLightID & 0x80000000u) == 0 ) + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) { - v2 = (char *)&pIndoor->pLights[uLightID].uAtributes; + v2 = (char *)&pIndoor->pLights[sLightID].uAtributes; if ( bToggle ) *v2 &= 0xF7u; else