36 nextWaypoint = currentWaypoint + 1;
42 temp_f20 = temp_f2 - shell->
pos[0];
43 temp_f22 = temp_f12 - shell->
pos[1];
44 temp_f24 = temp_f28 - shell->
pos[2];
45 temp_f0 = (temp_f20 * temp_f20) + (temp_f22 * temp_f22) + (temp_f24 * temp_f24);
46 if (temp_f0 > 400.0f) {
51 temp_f12_0 = temp_f18_3 - shell->
pos[0];
52 temp_f12_1 = temp_f16_3 - shell->
pos[1];
53 temp_f12_2 = temp_f26 - shell->
pos[2];
55 temp_f0_3 = (temp_f12_0 * temp_f12_0) + (temp_f12_1 * temp_f12_1) + (temp_f12_2 * temp_f12_2);
56 if (temp_f0_3 < temp_f0) {
59 temp_f0_2 =
sqrtf(temp_f0) * 4.0f;
60 temp_f20 /= temp_f0_2;
61 temp_f22 /= temp_f0_2;
62 temp_f24 /= temp_f0_2;
68 temp_f12_3 += temp_f20;
69 temp_f14_2 += temp_f22;
70 temp_f16_2 += temp_f24;
71 temp_f0 =
sqrtf((temp_f12_3 * temp_f12_3) + (temp_f14_2 * temp_f14_2) + (temp_f16_2 * temp_f16_2));
74 temp_f12_3 /= temp_f0;
75 temp_f14_2 /= temp_f0;
76 temp_f16_2 /= temp_f0;
82 origPos[0] = shell->
pos[0];
83 origPos[1] = shell->
pos[1];
84 origPos[2] = shell->
pos[2];
86 shell->
pos[0] += temp_f12_3;
87 shell->
pos[1] += temp_f14_2;
88 shell->
pos[2] += temp_f16_2;
90 origPos[1], origPos[2]);
95 shell->
pos[0] = temp_f2;
97 shell->
pos[2] = temp_f28;
104 shell->
pos[0] = (temp_f2 + temp_f18_3) * 0.5f;
106 shell->
pos[2] = (temp_f28 + temp_f26) * 0.5f;
108 shell->
velocity[0] = (temp_f18_3 - temp_f2) * 0.5f;
109 shell->
velocity[1] = (temp_f16_3 - temp_f12) * 0.5f;
110 shell->
velocity[2] = (temp_f26 - temp_f28) * 0.5f;
121 x_velocity = player->
pos[0];
122 x_velocity -= shell->
pos[0];
123 z_velocity = player->
pos[2];
124 z_velocity -= shell->
pos[2];
125 xz_dist =
sqrtf((x_velocity * x_velocity) + (z_velocity * z_velocity)) / 8;
126 if (xz_dist == 0.0f) {
130 x_velocity /= xz_dist;
131 z_velocity /= xz_dist;
134 newPosition[0] = shell->
pos[0];
135 newPosition[1] = shell->
pos[1];
136 newPosition[2] = shell->
pos[2];
137 shell->
pos[0] += x_velocity;
138 shell->
pos[1] -= 2.0f;
139 shell->
pos[2] += z_velocity;
148 newPosition[1], newPosition[2]);
161 f32 playerToShellDistance;
163 f32 smallestDistance = 25000000.0f;
165 for (playerIndex = 0; playerIndex < 4; playerIndex++) {
170 if (player == owner) {
179 if (playerToShellDistance < smallestDistance) {
180 smallestDistance = playerToShellDistance;
193 shell->
flags |= 0x80;
198 shell->
flags |= 0x80;
237 pad1 = shell->
pos[0];
238 pad0 = shell->
pos[2];
239 pad2 = shell->
pos[1];
247 switch (shell->
state) {
251 somePosVel[0] = 0.0f;
255 shell->
pos[0] = player->
pos[0] + somePosVel[0];
256 pad7 = player->
pos[1] - somePosVel[1];
257 shell->
pos[2] = player->
pos[2] + somePosVel[2];
259 temp_f2 = pad7 - height;
261 if ((temp_f2 < 5.0f) && (temp_f2 > -5.0f)) {
264 shell->
pos[1] = pad7;
330 if (player->
speed > 8.0f) {
331 height = player->
speed * 1.2f;
333 somePosVel[0] = 0.0f;
334 somePosVel[1] = 0.0f;
335 somePosVel[2] = height;
345 shell->
pos[0] = player->
pos[0] + somePosVel[0];
346 shell->
pos[1] = player->
pos[1] + somePosVel[1];
347 shell->
pos[2] = player->
pos[2] + somePosVel[2];
354 shell->
flags &= 0xEFFF;
368 shell->
flags = 0x8000;
405 origPos[0] = shell->
pos[0];
406 origPos[1] = shell->
pos[1];
407 origPos[2] = shell->
pos[2];
412 origPos[1], origPos[2]);
421 if (shell->someTimer == 0) {
422 if ((shell->
flags & 0xF) == 0) {
425 shell->someTimer -= 1;
431 player = &
gPlayers[shell->targetPlayer];
432 height = player->
pos[0];
433 height -= shell->
pos[0];
434 temp_f2 = player->
pos[2];
435 temp_f2 -= shell->
pos[2];
436 if (((height * height) + (temp_f2 * temp_f2)) < 40000.0f) {
441 player = &
gPlayers[shell->playerId];
447 somePosVel[0] =
sins(shell->rotAngle) * 8.0f;
449 somePosVel[2] =
coss(shell->rotAngle) * 8.0f;
451 origPos[0] = shell->
pos[0];
452 origPos[1] = shell->
pos[1];
453 origPos[2] = shell->
pos[2];
454 shell->
pos[0] = player->
pos[0] + somePosVel[0];
455 shell->
pos[1] = player->
pos[1] + somePosVel[1];
456 shell->
pos[2] = player->
pos[2] + somePosVel[2];
458 origPos[1], origPos[2]);
467 shell->rotAngle += 0x5B0;
468 shell->someTimer -= 1;
470 if (shell->someTimer == 0) {
478 height = player->
pos[0];
479 height -= shell->
pos[0];
480 temp_f2 = player->
pos[2];
481 temp_f2 -= shell->
pos[2];
482 if (((height * height) + (temp_f2 * temp_f2)) < 40000.0f) {
size_t CM_FindActorIndex(Actor *actor)
Definition Game.cpp:628
@ ACTOR_BLUE_SPINY_SHELL
Definition actor_types.h:81
@ ACTOR_RED_SHELL
Definition actor_types.h:47
@ ACTOR_TRIPLE_RED_SHELL
Definition actor_types.h:61
@ DESTROYED_SHELL
Definition actor_types.h:104
@ MOVING_SHELL
Definition actor_types.h:99
@ HELD_SHELL
Definition actor_types.h:97
@ TRIPLE_RED_SHELL
Definition actor_types.h:103
@ BLUE_SHELL_TARGET_ELIMINATED
Definition actor_types.h:106
@ RELEASED_SHELL
Definition actor_types.h:98
@ GREEN_SHELL_HIT_A_RACER
Definition actor_types.h:102
@ TRIPLE_GREEN_SHELL
Definition actor_types.h:101
@ BLUE_SHELL_LOCK_ON
Definition actor_types.h:105
@ RED_SHELL_LOCK_ON
Definition actor_types.h:100
#define GET_ACTOR(index)
Definition actor_types.h:90
void destroy_destructable_actor(struct Actor *actor)
Definition actors.c:1821
void destroy_actor(struct Actor *actor)
Definition actors.c:1289
void copy_collision(Collision *src, Collision *dest)
Definition actors_extended.c:20
void func_802B4E30(struct Actor *arg0)
Definition actors_extended.c:973
void func_802B3E7C(struct ShellActor *shell, Player *player)
Definition update.inc.c:115
void func_802B3B44(struct ShellActor *shell)
Definition update.inc.c:9
void func_802B4104(struct ShellActor *shell)
Definition update.inc.c:188
void update_actor_red_blue_shell(struct ShellActor *shell)
Update the red and blue shell actors.
Definition update.inc.c:207
s16 func_802B3FD0(Player *owner, struct ShellActor *shell)
Definition update.inc.c:158
s16 gCourseMinZ
Definition code_800029B0.c:99
s16 gCourseMaxZ
Definition code_800029B0.c:98
s16 gCourseMinX
Definition code_800029B0.c:93
s16 gCourseMinY
Definition code_800029B0.c:96
s16 gCourseMaxX
Definition code_800029B0.c:92
s16 gPlayerPositionLUT[8]
Definition code_800029B0.c:150
s32 add_red_shell_in_unexpired_actor_list(s32 actorIndex)
Definition code_80005FD0.c:3306
s32 add_blue_shell_in_unexpired_actor_list(s32 arg0)
Definition code_80005FD0.c:3322
u16 gSelectedPathCount
Definition code_80005FD0.c:171
TrackPathPoint * gCurrentTrackPath
Definition code_80005FD0.c:176
u16 gNearestPathPointByPlayerId[12]
Definition code_80005FD0.c:172
s16 gPlayerBalloonCount[8]
Definition code_80057C60_var.c:213
f32 calculate_surface_height(f32 x, f32 y, f32 z, u16 index)
Definition collision.c:462
u16 actor_terrain_collision(Collision *collision, f32 boundingBoxSize, f32 newX, f32 newY, f32 newZ, f32 oldX, f32 oldY, f32 oldZ)
Definition collision.c:1177
f32 Vec3f[3]
Definition common_structs.h:10
#define BOO_EFFECT
Definition defines.h:387
#define BATTLE
Definition defines.h:147
#define PLAYER_EXISTS
Definition defines.h:103
#define PLAYER_HUMAN
Definition defines.h:102
void func_800C9060(u8 playerId, u32 soundBits)
Definition external.c:2927
void func_800C90F4(u8 playerId, u32 soundBits)
Definition external.c:2940
void func_800C9D80(Vec3f position, Vec3f velocity, u32 soundBits)
Definition external.c:3180
void func_800C98B8(Vec3f position, Vec3f velocity, u32 soundBits)
Definition external.c:3092
#define UNUSED
Definition macros.h:26
Player * gPlayerOne
Definition main.c:79
Player gPlayers[NUM_PLAYERS]
Definition main.c:78
struct Controller gControllers[NUM_PLAYERS]
Definition main.c:68
u16 gDemoMode
Definition main.c:177
struct Controller * gControllerOne
Definition main.c:69
s32 gModeSelection
Definition main.c:186
f32 sins(u16 arg0)
Definition math_util.c:1063
void func_802B64C4(Vec3f arg0, s16 arg1)
Definition math_util.c:589
f32 func_802B51E8(Vec3f arg0, Vec3f arg1)
Definition math_util.c:84
void mtxf_translate_vec3f_mat3(Vec3f pos, Mat3 mat)
Definition math_util.c:557
f32 coss(u16 arg0)
Definition math_util.c:1067
#define SOUND_ARG_LOAD(sound_bank, byte2, byte3, sound_id)
Definition sounds.h:14
Definition actor_types.h:124
s16 state
Definition actor_types.h:128
Vec3f velocity
Definition actor_types.h:134
Collision unk30
Definition actor_types.h:135
s16 flags
Definition actor_types.h:126
Vec3f pos
Definition actor_types.h:133
f32 boundingBoxSize
Definition actor_types.h:130
Vec3f surfaceDistance
Definition common_structs.h:155
Vec3f unk54
Definition common_structs.h:157
u16 meshIndexZX
Definition common_structs.h:154
Vec3f unk48
Definition common_structs.h:156
Definition common_structs.h:66
u16 buttonDepressed
Definition common_structs.h:73
Definition common_structs.h:264
s16 unk_0C0
Definition common_structs.h:314
f32 speed
Definition common_structs.h:299
Mat3 orientationMatrix
Definition common_structs.h:341
u16 characterId
Definition common_structs.h:369
u32 effects
Definition common_structs.h:313
Vec3s rotation
Definition common_structs.h:276
Collision collision
Definition common_structs.h:339
f32 boundingBoxSize
Definition common_structs.h:289
u16 type
Definition common_structs.h:265
s16 currentRank
Definition common_structs.h:267
Vec3f pos
Definition common_structs.h:274
Definition actor_types.h:320
s16 rotAngle
Definition actor_types.h:336
s16 rotVelocity
Definition actor_types.h:334
s16 flags
Definition actor_types.h:322
f32 boundingBoxSize
Definition actor_types.h:333
s16 state
Definition actor_types.h:331
f32 shellId
Definition actor_types.h:332
s16 type
Definition actor_types.h:321
s16 playerId
Definition actor_types.h:340
Vec3f velocity
Definition actor_types.h:343
Vec3f pos
Definition actor_types.h:342
Collision unk30
Definition actor_types.h:344
s16 targetPlayer
Definition actor_types.h:329
s16 someTimer
Definition actor_types.h:327
u16 pathIndex
Definition actor_types.h:337
Definition actor_types.h:303
s16 rotVelocity
Definition actor_types.h:310
s16 type
Definition actor_types.h:304