| 191 | void zEntTeleportBox_Setup(_zEntTeleportBox* ent); |
| 192 | |
| 193 | void zEntTeleportBox_Update(xEnt* rawent, xScene* sc, F32 dt) |
| 194 | { |
| 195 | _zEntTeleportBox* ent = (_zEntTeleportBox*)rawent; |
| 196 | _zEntTeleportBox* target = (_zEntTeleportBox*)ent->target; |
| 197 | |
| 198 | xEntUpdate(ent, sc, dt); |
| 199 | |
| 200 | F32 dx__ = globals.player.ent.bound.sph.center.x - ent->model->Mat->pos.x; |
| 201 | F32 dy__ = globals.player.ent.bound.sph.center.y - ent->model->Mat->pos.y; |
| 202 | F32 dz__ = globals.player.ent.bound.sph.center.z - ent->model->Mat->pos.z; |
| 203 | |
| 204 | if (SQR(dx__) + SQR(dy__) + SQR(dz__) < 11.56f) |
| 205 | { |
| 206 | ent->currPlayerNear = 1; |
| 207 | } |
| 208 | else |
| 209 | { |
| 210 | ent->currPlayerNear = 0; |
| 211 | } |
| 212 | |
| 213 | if (ent->currPlayerNear != ent->prevPlayerNear) |
| 214 | { |
| 215 | if (ent->currPlayerNear) |
| 216 | { |
| 217 | sPlayerNear = 1; |
| 218 | } |
| 219 | else |
| 220 | { |
| 221 | sPlayerNear = 0; |
| 222 | zEntEvent("mnu4 teleport box", eEventInvisible); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | ent->prevPlayerNear = ent->currPlayerNear; |
| 227 | |
| 228 | if (ent->currPlayerNear) |
| 229 | { |
| 230 | if (cruise_bubble::active()) |
| 231 | { |
| 232 | if (xEntIsVisible(sTeleportUI)) |
| 233 | { |
| 234 | zEntEvent("mnu4 teleport box", eEventInvisible); |
| 235 | } |
| 236 | } |
| 237 | else |
| 238 | { |
| 239 | if (!xEntIsVisible(sTeleportUI) && target->status == STATUS_CLOSED) |
| 240 | { |
| 241 | zEntEvent("mnu4 teleport box", eEventVisible); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | xVec3 playerMid; |
| 247 | xVec3Copy(&playerMid, (xVec3*)&globals.player.ent.model->Mat->pos); |
| 248 | |
| 249 | playerMid.y += 0.5f; |
| 250 |
nothing calls this directly
no test coverage detected