Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stars_orbiting.c File Reference

Go to the source code of this file.

Functions

void stars_orbiting_init (EffectInstance *effect)
 
void stars_orbiting_update (EffectInstance *effect)
 
void stars_orbiting_render (EffectInstance *effect)
 
void func_E005E318 (EffectInstance *effect)
 
void func_E005E334 (EffectInstance *effect)
 
void stars_orbiting_main (s32 type, f32 posX, f32 posY, f32 posZ, f32 radius, s32 numStars, EffectInstance **outEffect)
 

Variables

Gfx D_09000440_363090 []
 
Gfx D_090004F0_363140 []
 
Gfx * D_E005E670 [] = { D_090004F0_363140 }
 
Gfx * D_E005E674 [] = { D_09000440_363090 }
 

Function Documentation

◆ stars_orbiting_init()

void stars_orbiting_init ( EffectInstance * effect)

Definition at line 69 of file stars_orbiting.c.

69 {
70}

Referenced by stars_orbiting_main().

◆ stars_orbiting_update()

void stars_orbiting_update ( EffectInstance * effect)

Definition at line 72 of file stars_orbiting.c.

72 {
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}
#define sin_deg
#define cos_deg
struct StarsOrbitingFXData * starsOrbiting
Definition effects.h:2511
EffectData data
Definition effects.h:2605

Referenced by stars_orbiting_main().

◆ stars_orbiting_render()

void stars_orbiting_render ( EffectInstance * effect)

Definition at line 97 of file stars_orbiting.c.

97 {
98}

Referenced by stars_orbiting_main().

◆ func_E005E318()

void func_E005E318 ( EffectInstance * effect)

Definition at line 100 of file stars_orbiting.c.

100 {
101 func_E005E334(effect);
102}
void func_E005E334(EffectInstance *effect)

Referenced by stars_orbiting_main().

◆ func_E005E334()

void func_E005E334 ( EffectInstance * effect)

Definition at line 104 of file stars_orbiting.c.

104 {
105 StarsOrbitingFXData* part = effect->data.starsOrbiting;
106 Matrix4f sp18;
107 Matrix4f sp58;
108 Matrix4f sp98;
109 s32 i;
110
111 if (part->enabled) {
112 Gfx* dlist = D_E005E670[0];
113 Gfx* dlist2 = D_E005E674[0];
114
115 gDPPipeSync(gMainGfxPos++);
116 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
117 gSPDisplayList(gMainGfxPos++, dlist2);
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);
121 guMtxCatF(sp58, sp18, sp98);
123
124 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
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);
131 guMtxCatF(sp58, sp18, sp18);
133
134 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
135 gSPDisplayList(gMainGfxPos++, dlist);
136 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
137 }
138
139 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
140 }
141}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * D_E005E670[]
Gfx * D_E005E674[]
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

Referenced by func_E005E318().

◆ stars_orbiting_main()

void stars_orbiting_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
f32 radius,
s32 numStars,
EffectInstance ** outEffect )

Definition at line 16 of file stars_orbiting.c.

24 {
26 EffectInstance* effect;
28 s32 i;
29
30 numStars++;
31
35 bp.unk_00 = 0;
37 bp.effectID = EFFECT_STARS_ORBITING;
38
39 effect = create_effect_instance(&bp);
40 effect->numParts = numStars;
41 part = effect->data.starsOrbiting = general_heap_malloc(numStars * sizeof(*part));
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}
#define general_heap_malloc
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
void stars_orbiting_render(EffectInstance *effect)
void stars_orbiting_update(EffectInstance *effect)
void func_E005E318(EffectInstance *effect)
void stars_orbiting_init(EffectInstance *effect)
void(* renderUI)(EffectInstance *effectInst)
Definition effects.h:2655
void(* init)(EffectInstance *effectInst)
Definition effects.h:2652
void(* update)(EffectInstance *effectInst)
Definition effects.h:2653
void(* renderWorld)(EffectInstance *effectInst)
Definition effects.h:2654

Variable Documentation

◆ D_09000440_363090

Gfx D_09000440_363090[]
extern

◆ D_090004F0_363140

Gfx D_090004F0_363140[]
extern

◆ D_E005E670

Gfx* D_E005E670[] = { D_090004F0_363140 }

Definition at line 7 of file stars_orbiting.c.

Gfx D_090004F0_363140[]

Referenced by func_E005E334().

◆ D_E005E674

Gfx* D_E005E674[] = { D_09000440_363090 }

Definition at line 8 of file stars_orbiting.c.

Gfx D_09000440_363090[]

Referenced by func_E005E334().