Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stars_orbiting.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
6
9
13void func_E005E318(EffectInstance* effect);
14void func_E005E334(EffectInstance* effect);
15
17 s32 type,
18 f32 posX,
19 f32 posY,
20 f32 posZ,
21 f32 radius,
22 s32 numStars,
24) {
26 EffectInstance* effect;
28 s32 i;
29
30 numStars++;
31
34 bp.renderScene = stars_orbiting_render;
35 bp.unk_00 = 0;
36 bp.renderUI = func_E005E318;
37 bp.effectID = EFFECT_STARS_ORBITING;
38
39 effect = create_effect_instance(&bp);
40 effect->numParts = numStars;
42 ASSERT(effect->data.starsOrbiting != NULL);
43
44 mem_clear(part, numStars * sizeof(*part));
45
46 part->type = type;
47 part->pos.x = posX;
48 part->pos.y = posY;
49 part->pos.z = posZ;
50 part->orbitRadius = 0;
51 part->yaw = 0;
52 part->targetRadius = radius;
53 part->enabled = TRUE;
54
55 part++;
56 for (i = 1; i < numStars; i++, part++) {
57 part->pos.x = 0;
58 part->pos.y = 0;
59 part->pos.z = 0;
60 part->roll = (i - 1) * 360 / (numStars - 1);
61 part->rollSpinRate = 20.0f;
62 part->pitch = 0;
63 part->yaw = (i - 1) * 360 / (numStars - 1);
64 }
65
66 *outEffect = effect;
67}
68
71
74 f32 radius;
75 s32 i;
76
77 if (part->enabled) {
78 part->yaw++;
79 part->orbitRadius += (part->targetRadius - part->orbitRadius) * 0.1;
80 radius = part->orbitRadius;
81
82 part++;
83 for (i = 1; i < effect->numParts; i++, part++) {
84 part->pos.x = radius * sin_deg(part->yaw);
85 part->pos.z = radius * cos_deg(part->yaw) * cos_deg(part->pitch);
86 part->pos.y = radius * cos_deg(part->yaw) * sin_deg(part->pitch);
87 part->roll += part->rollSpinRate;
88 part->pitch = 0.0f;
89 part->yaw += 16;
90 if (part->yaw > 360) {
91 part->yaw -= 360;
92 }
93 }
94 }
95}
96
99
101 func_E005E334(effect);
102}
103
109 s32 i;
110
111 if (part->enabled) {
112 Gfx* dlist = D_E005E670[0];
113 Gfx* dlist2 = D_E005E674[0];
114
116 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics));
118
119 guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
120 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
123
125 gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 220, 40, 255);
126
127 part++;
128 for (i = 1; i < effect->numParts; i++, part++) {
129 guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
130 guRotateF(sp58, part->roll, 0.0f, 0.0f, 1.0f);
133
135 gSPDisplayList(gMainGfxPos++, dlist);
137 }
138
140 }
141}
BSS s32 PopupMenu_SelectedIndex
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define cos_deg
#define create_effect_instance
#define mem_clear
struct StarsOrbitingFXData * starsOrbiting
Definition effects.h:2511
EffectInstanceDataPtr data
Definition effects.h:2605
#define ASSERT(condition)
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * D_E005E670[]
void stars_orbiting_render(EffectInstance *effect)
void func_E005E334(EffectInstance *effect)
Gfx D_09000440_363090[]
void stars_orbiting_update(EffectInstance *effect)
void stars_orbiting_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 radius, s32 numStars, EffectInstance **outEffect)
void func_E005E318(EffectInstance *effect)
Gfx * D_E005E674[]
Gfx D_090004F0_363140[]
void stars_orbiting_init(EffectInstance *effect)
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
s32 gCurrentCameraID
Definition cam_math.c:4
DisplayContext * gDisplayContext
Definition cam_main.c:16