Mario Kart 64
Loading...
Searching...
No Matches
update.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <code_800029B0.h>
3#include <main.h>
5
10 Vec3s sp24 = {60, 120, 180};
11 temp_v0 += rock->unk_06;
12 rock->respawnTimer = sp24[rock->unk_06]; // * 2
13 rock->pos[0] = (f32) temp_v0->pos[0] * gCourseDirection;
14 rock->pos[1] = (f32) temp_v0->pos[1] + 10.0f;
15 rock->pos[2] = (f32) temp_v0->pos[2];
16 vec3f_set(rock->velocity, 0, 0, 0);
17 vec3s_set(rock->rot, 0, 0, 0);
18}
19
29 // Casting this to prevent warning does not work.
30 struct ActorSpawnData *temp_s0 = (struct ActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[addr] + offset);
31 struct FallingRock *temp_v1;
35 s16 temp;
36
37 while (temp_s0->pos[0] != -0x8000) {
39 startingPos[1] = temp_s0->pos[1] + 10.0f;
40 startingPos[2] = temp_s0->pos[2];
42 vec3s_set(startingRot, 0, 0, 0);
44 temp_v1 = (struct FallingRock *) &gActorList[temp];
45
46 temp_v1->unk_06 = temp_s0->someId;
47 func_802AAAAC((Collision *) &temp_v1->unk30);
48 temp_s0++;
49 }
50}
51
60 f32 pad0;
61 f32 pad1;
62
63 if (rock->respawnTimer != 0) {
64 rock->respawnTimer -= 1;
65 return;
66 }
67 if (rock->pos[1] < D_8015F8E4) {
69 }
70 rock->rot[0] += (s16) ((rock->velocity[2] * 5461.0f) / 20.0f);
71 rock->rot[2] += (s16) ((rock->velocity[0] * 5461.0f) / 20.0f);
72 rock->velocity[1] -= 0.1;
73 if (rock->velocity[1] < (-2.0f)) {
74 rock->velocity[1] = -2.0f;
75 }
76 rock->pos[0] += rock->velocity[0];
77 rock->pos[1] += rock->velocity[1];
78 rock->pos[2] += rock->velocity[2];
79 pad1 = rock->velocity[1];
80 func_802ADDC8(&rock->unk30, 10.0f, rock->pos[0], rock->pos[1], rock->pos[2]);
81 pad0 = rock->unk30.unk3C[2];
82 if (pad0 < 0.0f) {
83 unkVec[0] = -rock->unk30.orientationVector[0];
84 unkVec[1] = -rock->unk30.orientationVector[1];
85 unkVec[2] = -rock->unk30.orientationVector[2];
86 rock->pos[0] += unkVec[0] * rock->unk30.unk3C[2];
87 rock->pos[1] += unkVec[1] * rock->unk30.unk3C[2];
88 rock->pos[2] += unkVec[2] * rock->unk30.unk3C[2];
89 func_802AC114(unkVec, pad0, rock->velocity, 2.0f);
90 rock->velocity[1] = -1.2f * pad1;
91 func_800C98B8(rock->pos, rock->velocity, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x0F));
92 }
93 pad0 = rock->unk30.unk3C[0];
94 if (pad0 < 0.0f) {
95 unkVec[1] = -rock->unk30.unk48[1];
96 if (unkVec[1] == 0.0f) {
97 rock->velocity[1] *= -1.2f;
98 return;
99 }
100 else {
101 unkVec[0] = -rock->unk30.unk48[0];
102 unkVec[2] = -rock->unk30.unk48[2];
103 rock->pos[0] += unkVec[0] * rock->unk30.unk3C[0];
104 rock->pos[1] += unkVec[1] * rock->unk30.unk3C[0];
105 rock->pos[2] += unkVec[2] * rock->unk30.unk3C[0];
106 func_802AC114(unkVec, pad0, rock->velocity, 2.0f);
107 rock->velocity[1] = -1.2f * pad1;
108 func_800C98B8(rock->pos, rock->velocity, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x0F));
109 }
110 }
111 pad0 = rock->unk30.unk3C[1];
112 if (pad0 < 0.0f) {
113 unkVec[1] = -rock->unk30.unk54[1];
114 if (unkVec[1] == 0.0f) {
115 rock->velocity[1] *= -1.2f;
116 }
117 else {
118 unkVec[0] = -rock->unk30.unk54[0];
119 unkVec[2] = -rock->unk30.unk54[2];
120 rock->pos[0] += unkVec[0] * rock->unk30.unk3C[1];
121 rock->pos[1] += unkVec[1] * rock->unk30.unk3C[1];
122 rock->pos[2] += unkVec[2] * rock->unk30.unk3C[1];
123 pad1 = rock->velocity[1];
124 func_802AC114(unkVec, pad0, rock->velocity, 2.0f);
125 rock->velocity[1] = -1.2f * pad1;
126 func_800C98B8(rock->pos, rock->velocity, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x0F));
127 }
128 }
129}
@ ACTOR_FALLING_ROCK
Definition actor_types.h:43
s16 add_actor_to_empty_slot(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actorType)
Definition actors.c:1418
struct ActorSpawnData d_course_choco_mountain_falling_rock_spawns[]
Definition course_data.c:3535
s16 gCourseMaxZ
Definition code_800029B0.c:92
f32 D_8015F8E4
Definition code_800029B0.c:142
struct Actor gActorList[ACTOR_LIST_SIZE]
Definition code_800029B0.c:148
f32 gCourseDirection
Definition code_800029B0.c:122
u16 func_802ADDC8(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY, f32 posZ)
Definition collision.c:1349
void func_802AAAAC(Collision *collision)
Definition collision.c:27
void func_802AC114(Vec3f pos1, f32 boundingBoxSize, Vec3f pos2, UNUSED f32 unk)
Definition collision.c:600
f32 Vec3f[3]
Definition common_structs.h:6
s16 Vec3s[3]
Definition common_structs.h:11
void func_800C98B8(Vec3f position, Vec3f velocity, u32 soundBits)
Definition external.c:3049
void update_actor_falling_rocks(struct FallingRock *rock)
Updates the falling rock actor. Actor used in Choco Mountain.
Definition update.inc.c:58
void func_8029CF0C(struct ActorSpawnData *spawnData, struct FallingRock *rock)
Definition update.inc.c:6
void spawn_falling_rocks(struct ActorSpawnData *spawnData)
Spawns falling rocks. Used in Choco Mountain.
Definition update.inc.c:26
#define VIRTUAL_TO_PHYSICAL2(addr)
Definition macros.h:79
uintptr_t gSegmentTable[16]
Definition main.c:132
void vec3f_set(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3)
Definition math_util.c:101
void vec3s_set(Vec3s arg0, s16 arg1, s16 arg2, s16 arg3)
Definition math_util.c:107
#define SEGMENT_OFFSET(a)
Definition mbi.h:92
#define SEGMENT_NUMBER2(a)
Definition mbi.h:94
#define SOUND_ARG_LOAD(sound_bank, byte2, byte3, sound_id)
Definition sounds.h:14
Definition actor_types.h:186
Vec3s pos
Definition actor_types.h:187
Definition common_structs.h:138
Definition actor_types.h:172
Vec3f pos
Definition actor_types.h:181
signed int s32
Definition ultratypes.h:15
signed short int s16
Definition ultratypes.h:13
float f32
Definition ultratypes.h:33