| 59 | } |
| 60 | |
| 61 | void zBusStop_Update(xBase* to, xScene* scene, F32 dt) |
| 62 | { |
| 63 | // If nearby, advance out of state 0, otherwise, drop back to state 0 |
| 64 | zBusStop* bstop = (zBusStop*)to; |
| 65 | //zEnt* player = &globals.player.ent; |
| 66 | F32 dx = globals.player.ent.bound.box.center.x - bstop->pos.x; |
| 67 | F32 dy = globals.player.ent.bound.box.center.y - bstop->pos.y; |
| 68 | F32 dz = globals.player.ent.bound.box.center.z - bstop->pos.z; |
| 69 | if (dx * dx + dy * dy + dz * dz < 6.25f) |
| 70 | { |
| 71 | if (bstop->currState == 0) |
| 72 | { |
| 73 | bstop->currState = 1; |
| 74 | } |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | bstop->currState = 0; |
| 79 | } |
| 80 | |
| 81 | switch (bstop->currState) |
| 82 | { |
| 83 | case 0: |
| 84 | break; |
| 85 | |
| 86 | case 1: |
| 87 | if (globals.player.JumpState == 0) |
| 88 | { |
| 89 | if (!cruise_bubble::active()) |
| 90 | { |
| 91 | if (globals.pad0->pressed & (1 << 12)) |
| 92 | { |
| 93 | bstop->currState = 2; |
| 94 | zEntPlayer_SNDPlay(ePlayerSnd_Bus, 0.0f); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | if (cruise_bubble::active()) |
| 100 | { |
| 101 | zEntEvent("mnu4 busstop", eEventInvisible); |
| 102 | } |
| 103 | else if (!xEntIsVisible(sBusStopUI)) |
| 104 | { |
| 105 | zEntEvent("mnu4 busstop", eEventVisible); |
| 106 | } |
| 107 | break; |
| 108 | |
| 109 | case 2: |
| 110 | globals.player.ent.frame->vel.x = 0.0f; |
| 111 | globals.player.ent.frame->vel.y = 0.0f; |
| 112 | globals.player.ent.frame->vel.z = 0.0f; |
| 113 | break; |
| 114 | |
| 115 | case 3: |
| 116 | xAnimSingle* single = bstop->bus->model->Anim->Single; |
| 117 | if (single->Time < 0.1f || single->LastTime < 0.1f) |
| 118 | { |
no test coverage detected