comparison DecalBuilder.cpp @ 2195:70b63fe6587c

fixing a few bugs reported by PVS
author Grumpy7
date Thu, 30 Jan 2014 23:03:04 +0100
parents 0a1438c16c2b
children e18200fcfb50
comparison
equal deleted inserted replaced
2194:d0e321190c86 2195:70b63fe6587c
9 #include "mm7_unsorted_subs.h" 9 #include "mm7_unsorted_subs.h"
10 10
11 #include "stru9.h" 11 #include "stru9.h"
12 12
13 #include "Outdoor_stuff.h" 13 #include "Outdoor_stuff.h"
14 #include "OurMath.h"
14 15
15 16
16 struct DecalBuilder *pDecalBuilder = new DecalBuilder; 17 struct DecalBuilder *pDecalBuilder = new DecalBuilder;
17 struct BloodsplatContainer *pBloodsplatContainer = new BloodsplatContainer; 18 struct BloodsplatContainer *pBloodsplatContainer = new BloodsplatContainer;
18 19
39 40
40 41
41 42
42 43
43 //----- (0043B6EF) -------------------------------------------------------- 44 //----- (0043B6EF) --------------------------------------------------------
44 bool BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b) 45 void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b)
45 { 46 {
46 int *v8; // esi@1 47 int v8; // esi@1
47 int v9; // eax@3 48 int v9; // eax@3
48 Bloodsplat *v10; // eax@3 49 Bloodsplat *v10; // eax@3
49 int *result; // eax@3 50
50 int v12; // ecx@3 51 v8 = this->uNumBloodsplats;
51
52 v8 = &this->uNumBloodsplats;
53 if ( this->uNumBloodsplats == 64 ) 52 if ( this->uNumBloodsplats == 64 )
54 *v8 = 0; 53 v8 = 0;
55 v9 = 5 * (*v8)++; 54 v9 = 5 * (v8 + 1);
56 v10 = &this->std__vector_pBloodsplats[8 * v9 / 0x28u]; 55 v10 = &this->std__vector_pBloodsplats[8 * v9 / 0x28u];
57 v10->x = x; 56 v10->x = x;
58 v10->y = y; 57 v10->y = y;
59 v10->z = z; 58 v10->z = z;
60 v10->radius = radius; 59 v10->radius = radius;
61 v10->r = r; 60 v10->r = r;
62 v10->g = g; 61 v10->g = g;
63 v10->b = b; 62 v10->b = b;
64 result = (int *)&this->std__vector_pBloodsplats_size; 63 this->std__vector_pBloodsplats_size = min(this->std__vector_pBloodsplats_size + 1, 64);
65 v12 = this->std__vector_pBloodsplats_size + 1;
66 if ( v12 > 64 )
67 v12 = 64;
68 *result = v12;
69 LOBYTE(result) = 1;
70 return (bool)result;
71 } 64 }
72 65
73 //----- (0049B490) -------------------------------------------------------- 66 //----- (0049B490) --------------------------------------------------------
74 bool DecalBuilder::AddBloodsplat(float x, float y, float z, float r, float g, float b, float radius, int a8, int a9) 67 void DecalBuilder::AddBloodsplat(float x, float y, float z, float r, float g, float b, float radius, int a8, int a9)
75 { 68 {
76 //double v10; // ST1C_8@1 69 //double v10; // ST1C_8@1
77 char v11; // ST24_1@1 70 char v11; // ST24_1@1
78 //double v12; // ST1C_8@1 71 //double v12; // ST1C_8@1
79 //double v13; // ST1C_8@1 72 //double v13; // ST1C_8@1
88 arg14b = g * 255.0; 81 arg14b = g * 255.0;
89 v12 = arg14b + 6.7553994e15; 82 v12 = arg14b + 6.7553994e15;
90 a7a = LODWORD(v12); 83 a7a = LODWORD(v12);
91 arg14c = r * 255.0; 84 arg14c = r * 255.0;
92 v13 = arg14c + 6.7553994e15;*/ 85 v13 = arg14c + 6.7553994e15;*/
93 return pBloodsplatContainer->AddBloodsplat(x, y, z, radius, 86 pBloodsplatContainer->AddBloodsplat(x, y, z, radius,
94 //SLOBYTE(v13), a7a, v11); 87 //SLOBYTE(v13), a7a, v11);
95 r * 255.0f, 88 bankersRounding(r * 255.0f),
96 g * 255.0f, 89 bankersRounding(g * 255.0f),
97 b * 255.0f); 90 bankersRounding(b * 255.0f));
98 } 91 }
99 92
100 //----- (0049B525) -------------------------------------------------------- 93 //----- (0049B525) --------------------------------------------------------
101 void DecalBuilder::Reset(unsigned int bPreserveBloodsplats) 94 void DecalBuilder::Reset(unsigned int bPreserveBloodsplats)
102 { 95 {