| 1224 | } |
| 1225 | |
| 1226 | void zEntPickup_Drop(zEntPickup* ent) |
| 1227 | { |
| 1228 | ent->state = 0xC2; |
| 1229 | |
| 1230 | xEntShow(ent); |
| 1231 | |
| 1232 | if ((ent->flg_opts & 0x2) && ent->useThisEntPos) |
| 1233 | { |
| 1234 | xVec3Copy(&ent->droppos, xEntGetPos(ent->useThisEntPos)); |
| 1235 | xVec3Copy((xVec3*)&ent->model->Mat->pos, xEntGetPos(ent->useThisEntPos)); |
| 1236 | } |
| 1237 | |
| 1238 | F32 b = xsqrt(75.0f); |
| 1239 | F32 c = ent->model->Mat->pos.y - ent->droppos.y; |
| 1240 | |
| 1241 | ent->vel.x = 0.0f; |
| 1242 | ent->vel.y = b; |
| 1243 | ent->vel.z = 0.0f; |
| 1244 | |
| 1245 | if (!(ent->flg_opts & 0x1)) |
| 1246 | { |
| 1247 | F32 sol[2]; |
| 1248 | U32 solcnt = xMathSolveQuadratic(-7.5f, b, c, &sol[0], &sol[1]); |
| 1249 | |
| 1250 | if (solcnt) |
| 1251 | { |
| 1252 | if (solcnt == 2 && sol[1] > sol[0]) |
| 1253 | { |
| 1254 | sol[0] = sol[1]; |
| 1255 | } |
| 1256 | |
| 1257 | if (sol[0] > 0.0001f) |
| 1258 | { |
| 1259 | sol[0] = 1.0f / sol[0]; |
| 1260 | |
| 1261 | ent->vel.x = sol[0] * (ent->droppos.x - ent->model->Mat->pos.x); |
| 1262 | ent->vel.z = sol[0] * (ent->droppos.z - ent->model->Mat->pos.z); |
| 1263 | } |
| 1264 | } |
| 1265 | } |
| 1266 | |
| 1267 | ent->timer = 1.2f; |
| 1268 | } |
| 1269 | |
| 1270 | static U32 ShowPickupFx(zEntPickup* ent) |
| 1271 | { |
no test coverage detected