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

Function xParCmdDamagePlayer_Update

src/SB/Game/zParCmd.cpp:136–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void xParCmdDamagePlayer_Update(xParCmd* c, xParGroup* ps, float dt)
137{
138 xPar* p;
139 xParCmdDamagePlayer* cmd = (xParCmdDamagePlayer*)c->tasset;
140 xBound* pbound = &globals.player.ent.bound;
141 S32 last_idx = 10 - (xrand() & 1);
142
143 p = ps->m_root;
144 while (p != NULL && last_idx-- > 0)
145 {
146 p = p->m_next;
147 }
148
149 static xCollis collis;
150 static xBound bnd_fake;
151
152 memset(&collis, 0, sizeof(xCollis));
153 memset(&bnd_fake, 0, sizeof(xBound));
154 bnd_fake.type = XBOUND_TYPE_SPHERE;
155
156 while (p != NULL)
157 {
158 if (p->m_lifetime > 0.1f)
159 {
160 collis.flags = 0;
161 if (p->m_size > 1.0f)
162 {
163 bnd_fake.sph.r = 0.5f * p->m_size;
164 xVec3Copy(&bnd_fake.sph.center, &p->m_pos);
165 xQuickCullForBound(&bnd_fake.qcd, &bnd_fake);
166 xBoundHitsBound(&bnd_fake, pbound, &collis);
167 }
168 else
169 {
170 xVecHitsBound(&p->m_pos, pbound, &collis);
171 }
172
173 if (collis.flags & 1)
174 {
175 zEntPlayer_Damage(NULL, 1, NULL);
176 }
177 }
178
179 for (S32 i = 0; i < cmd->granular; i++)
180 {
181 if (p == NULL)
182 {
183 break;
184 }
185 p = p->m_next;
186 }
187 }
188}
189
190void xParCmdJet_Update(xParCmd* c, xParGroup* ps, float dt)
191{

Callers

nothing calls this directly

Calls 7

xrandFunction · 0.85
memsetFunction · 0.85
xVec3CopyFunction · 0.85
xBoundHitsBoundFunction · 0.85
zEntPlayer_DamageFunction · 0.70
xQuickCullForBoundFunction · 0.50
xVecHitsBoundFunction · 0.50

Tested by

no test coverage detected