MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / UpdateRain

Function UpdateRain

src/SB/Core/x/xClimate.cpp:92–171  ·  view source on GitHub ↗

NOTE (Square): I think it's equivalent but it's very hard to tell. Our compiler is optimizing the float ops much more aggresively and it's throwing the regalloc off.

Source from the content-addressed store, hash-verified

90// NOTE (Square): I think it's equivalent but it's very hard to tell. Our compiler is optimizing the float ops
91// much more aggresively and it's throwing the regalloc off.
92void UpdateRain(_tagClimate* climate, float seconds)
93{
94 _tagRain* r = &climate->rain;
95 xParEmitterCustomSettings info;
96 memset(&info, 0, sizeof(xParEmitterCustomSettings));
97 info.custom_flags = 0x100;
98
99 if (r->rain != 0)
100 {
101 S32 total_rain_drops = 25.0f * r->strength;
102 for (S32 i = 0; i < total_rain_drops; i++)
103 {
104 GetPosBigDogWhattupFool(&info.pos);
105 info.pos.x += 25.0f * xurand() - 12.5f;
106 info.pos.y += 8.0f;
107 info.pos.z += 25.0f * xurand() - 12.5f;
108 xParEmitterEmitCustom(r->rain_emitter, seconds, &info);
109 }
110 return;
111 }
112
113 xVec3 fool;
114 S32 total_snow_flakes = 25.0f * r->strength;
115 info.custom_flags |= 0x202;
116 GetPosBigDogWhattupFool(&fool);
117 if (gPTankDisable)
118 {
119 for (S32 i = 0; i < total_snow_flakes; i++)
120 {
121 info.pos = fool;
122 info.pos.x += 45.0f * xurand() - 22.5f;
123 info.pos.z += 25.0f * xurand() - 22.5f;
124
125 F32 xx = info.pos.x - fool.x;
126 F32 zz = info.pos.z - fool.z;
127 F32 perc = 1.0f - xx * zz / 506.25f;
128 info.pos.y += 4.0f * perc + 4.0f;
129
130 info.vel.x = snow_dvel.x * xurand() + snow_vel.x;
131 info.vel.y = snow_dvel.y * xurand() + snow_vel.y;
132 info.vel.z = snow_dvel.z * xurand() + snow_vel.z;
133
134 info.life.val[0] = snow_life * perc + snow_life;
135 xParEmitterEmitCustom(r->snow_emitter, seconds, &info);
136 }
137 return;
138 }
139
140 S32 num = (F32)total_snow_flakes * 0.1f;
141 if (num > 0)
142 {
143 xVec3* pos = (xVec3*)xMemPushTemp(num * 2 * sizeof(xVec3));
144 xVec3* vel = pos + num;
145 if (pos != NULL)
146 {
147 for (S32 i = 0; i < num; i++)
148 {
149 *pos = fool;

Callers 1

xClimateUpdateFunction · 0.70

Calls 7

memsetFunction · 0.85
GetPosBigDogWhattupFoolFunction · 0.85
xurandFunction · 0.85
xMemPopTempFunction · 0.85
xParEmitterEmitCustomFunction · 0.70
xMemPushTempFunction · 0.70
zParPTankSpawnSnowFunction · 0.50

Tested by

no test coverage detected