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

Function zNPCTiki_ExplodeFX

src/SB/Game/zNPCTypeTiki.cpp:152–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void zNPCTiki_ExplodeFX(zNPCTiki* tiki)
153{
154 xVec3 shockwavePos;
155 xVec3 delta; // not in dwarf
156 NPCHazard* haz;
157 zScene* zsc;
158 U32 i;
159
160 if (tiki->SelfType() == NPC_TYPE_TIKI_THUNDER)
161 {
162 xScrFXGlareAdd((xVec3*)&tiki->model->Mat->pos, 0.7f, 0.2f, 5.0f, 1.0f, 1.0f, 0.75f, 1.0f,
163 NULL);
164
165 xVec3Copy(&shockwavePos, (xVec3*)&tiki->model->Mat->pos);
166 shockwavePos.y += 0.35f;
167
168 haz = HAZ_Acquire();
169 if (!haz)
170 return;
171
172 haz->ConfigHelper(NPC_HAZ_THUNDER);
173 haz->SetNPCOwner(tiki);
174 haz->Start(xEntGetCenter(tiki), -1.0f);
175
176 zsc = globals.sceneCur;
177
178 for (i = 0; i < zsc->num_npcs; i++)
179 {
180 if (zsc->npcs[i] == tiki || !((zNPCCommon*)zsc->npcs[i])->flg_vuln)
181 continue;
182
183 xVec3Sub(&delta, (xVec3*)&tiki->model->Mat->pos,
184 (xVec3*)&(zsc->npcs[i])->model->Mat->pos);
185 F32 dist2 = xVec3Length2(&delta);
186 if (dist2 < 25.0f)
187 {
188 if ((((zNPCCommon*)zsc->npcs[i])->SelfType() & ~0xFF) == 'NTT\0')
189 ((zNPCTiki*)zsc->npcs[i])->timeToLive = dist2 * 0.012f;
190 ((zNPCCommon*)zsc->npcs[i])->Damage(DMGTYP_THUNDER_TIKI_EXPLOSION, 0, 0);
191 }
192 }
193
194 for (i = 0; i < zsc->num_dyns; i++)
195 {
196 if ((zsc->dyns[i])->baseType != 0x1B)
197 continue;
198
199 xVec3Sub(&delta, (xVec3*)&tiki->model->Mat->pos,
200 (xVec3*)&((xEnt*)zsc->dyns[i])->model->Mat->pos);
201 if (xVec3Length2(&delta) < 25.0f)
202 zEntEvent(zsc->dyns[i], 0x3A);
203 }
204
205 xVec3Sub(&delta, (xVec3*)&tiki->model->Mat->pos,
206 (xVec3*)&globals.player.ent.model->Mat->pos);
207 if (xVec3Length2(&delta) < 25.0f)
208 zEntEvent((xBase*)&globals.player, 0x3A);
209 }

Callers 1

ExitMethod · 0.70

Calls 13

xVec3CopyFunction · 0.85
xEntGetCenterFunction · 0.85
xVec3SubFunction · 0.85
xVec3Length2Function · 0.85
SelfTypeMethod · 0.80
ConfigHelperMethod · 0.80
SetNPCOwnerMethod · 0.80
StartMethod · 0.80
SndPlayRandomMethod · 0.80
HAZ_AcquireFunction · 0.70
xScrFXGlareAddFunction · 0.50
zEntEventFunction · 0.50

Tested by

no test coverage detected