Mario Kart 64
Loading...
Searching...
No Matches
update.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <main.h>
3
9void update_actor_fake_item_box(struct FakeItemBox* fake_item_box) {
10 u32 temp_v1 = fake_item_box->playerId;
11 Player* temp_v0_4 = &gPlayers[temp_v1];
12 struct Controller* temp_v1_3;
13
14 UNUSED s32 pad[7];
15 f32 temp_f2_2;
16 f32 temp_f14;
17 f32 temp_f16;
18 f32 temp_f18;
19 UNUSED s32 pad2[3];
20
21 switch (fake_item_box->state) {
22 case 0:
23 fake_item_box->boundingBoxSize = fake_item_box->sizeScaling * 5.5f;
24 fake_item_box->rot[0] -= 0xB6;
25 fake_item_box->rot[1] += 0x16C;
26 fake_item_box->rot[2] -= 0xB6;
27
28 temp_f14 = temp_v0_4->pos[0] - fake_item_box->pos[0];
29 temp_f16 = temp_v0_4->pos[1] - fake_item_box->pos[1];
30 temp_f18 = temp_v0_4->pos[2] - fake_item_box->pos[2];
31
32 temp_f2_2 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f18 * temp_f18)) / 10.0f;
33 temp_f14 /= temp_f2_2;
34 temp_f16 /= temp_f2_2;
35 temp_f18 /= temp_f2_2;
36 fake_item_box->pos[0] = temp_v0_4->pos[0] - temp_f14;
37 fake_item_box->pos[1] = (temp_v0_4->pos[1] - temp_f16) - 1.0f;
38 fake_item_box->pos[2] = temp_v0_4->pos[2] - temp_f18;
39 check_bounding_collision(&fake_item_box->unk30, fake_item_box->boundingBoxSize, fake_item_box->pos[0],
40 fake_item_box->pos[1], fake_item_box->pos[2]);
41 func_802B4E30((struct Actor*) fake_item_box);
42 temp_v1_3 = &gControllers[temp_v1];
43 if ((temp_v0_4->type & 0x4000) != 0) {
44
45 if ((temp_v1_3->buttonDepressed & Z_TRIG) != 0) {
46 temp_v1_3->buttonDepressed &= 0xDFFF;
47 func_802A1064(fake_item_box);
48 temp_v0_4->soundEffects &= 0xFFFBFFFF;
49 func_800C9060((u8) (temp_v0_4 - gPlayerOne), SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x12));
50 }
51 }
52 break;
53 case 1:
54 if (fake_item_box->sizeScaling < 1.0f) {
55 fake_item_box->sizeScaling += 0.05f;
56 } else if (fake_item_box->sizeScaling >= 1.0f) {
57 fake_item_box->sizeScaling = 1.0f;
58 }
59
60 fake_item_box->boundingBoxSize = fake_item_box->sizeScaling * 5.5f;
61 if (fake_item_box->targetY <= fake_item_box->pos[1]) {
62 fake_item_box->pos[1] = fake_item_box->targetY;
63 } else {
64 fake_item_box->pos[1] += 0.2f;
65 }
66 if ((fake_item_box->flags & 0x1000) != 0) {
67 if ((fake_item_box->someTimer <= 0) || (fake_item_box->someTimer >= 0x12D)) {
68 fake_item_box->flags &= 0xEFFF;
69 fake_item_box->someTimer = 0;
70 } else {
71 fake_item_box->someTimer--;
72 }
73 }
74 fake_item_box->rot[0] -= 0xB6;
75 fake_item_box->rot[1] += 0x16C;
76 fake_item_box->rot[2] -= 0xB6;
77 break;
78
79 case 2:
80 if ((fake_item_box->someTimer >= 0x14) || (fake_item_box->someTimer < 0)) {
81 destroy_actor((struct Actor*) fake_item_box);
82 } else {
83 fake_item_box->someTimer++;
84 fake_item_box->rot[0] += 0x444;
85 fake_item_box->rot[1] -= 0x2D8;
86 fake_item_box->rot[2] += 0x16C;
87 }
88 break;
89 default:
90 destroy_actor((struct Actor*) fake_item_box);
91 break;
92 }
93}
void destroy_actor(struct Actor *actor)
Definition actors.c:1313
void func_802A1064(struct FakeItemBox *fake_item_box)
Definition actors.c:2368
void func_802B4E30(struct Actor *arg0)
Definition actors_extended.c:972
u16 check_bounding_collision(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY, f32 posZ)
Definition collision.c:1356
void func_800C9060(u8 playerId, u32 soundBits)
Definition external.c:2862
void update_actor_fake_item_box(struct FakeItemBox *fake_item_box)
Updates the fake item box actor.
Definition update.inc.c:9
#define UNUSED
Definition macros.h:23
Player * gPlayerOne
Definition main.c:72
Player gPlayers[NUM_PLAYERS]
Definition main.c:71
struct Controller gControllers[NUM_PLAYERS]
Definition main.c:61
float sqrtf(float)
#define Z_TRIG
Definition os.h:393
#define SOUND_ARG_LOAD(sound_bank, byte2, byte3, sound_id)
Definition sounds.h:14
Definition actor_types.h:120
Vec3s rot
Definition actor_types.h:127
s16 flags
Definition actor_types.h:122
Vec3f pos
Definition actor_types.h:129
f32 boundingBoxSize
Definition actor_types.h:126
Definition common_structs.h:62
u16 buttonDepressed
Definition common_structs.h:67
Definition actor_types.h:349
Vec3s rot
Definition actor_types.h:356
f32 boundingBoxSize
Definition actor_types.h:355
f32 sizeScaling
Definition actor_types.h:354
Collision unk30
Definition actor_types.h:362
f32 playerId
Definition actor_types.h:359
s16 state
Definition actor_types.h:353
Vec3f pos
Definition actor_types.h:358
Definition common_structs.h:249
u16 type
Definition common_structs.h:250
s32 soundEffects
Definition common_structs.h:256
Vec3f pos
Definition common_structs.h:259
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16
float f32
Definition ultratypes.h:34
unsigned char u8
Definition ultratypes.h:12