Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
StarRodAppearEffect.inc.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
effects.h
"
3
4
typedef
struct
StarOutlineState
{
5
/* 0x00 */
EffectInstance
*
effect
;
6
/* 0x04 */
Vec3f
pos
;
7
/* 0x10 */
f32
unk_10
;
8
/* 0x14 */
f32
unk_14
;
9
/* 0x18 */
f32
unk_18
;
10
/* 0x1C */
s32
delay
;
11
/* 0x20 */
s32
duration
;
12
/* 0x24 */
s32
unk_24
;
13
/* 0x28 */
s32
unk_28
;
14
/* 0x2C */
f32
unk_2C
;
15
/* 0x30 */
f32
unk_30
;
16
/* 0x34 */
f32
unk_34
;
17
/* 0x38 */
s32
effectEnded
;
18
}
StarOutlineState
;
// size = 0x3C
19
20
API_CALLABLE(N(
StarRodAppearEffect
)) {
21
Bytecode
* args =
script
->ptrReadPos;
22
Actor
* actor =
get_actor
(
script
->owner1.actorID);
23
s32 i;
24
s32
endedCount
;
25
StarOutlineState
*
effectState
;
26
27
if
(actor ==
NULL
) {
28
return
ApiStatus_DONE2
;
29
}
30
31
if
(
isInitialCall
) {
32
f32
x =
evt_get_variable
(
script
, *args++);
33
f32
y =
evt_get_variable
(
script
, *args++);
34
f32
z =
evt_get_variable
(
script
, *args++);
35
f32
arg4
=
evt_get_float_variable
(
script
, *args++);
36
f32
arg5
=
evt_get_float_variable
(
script
, *args++);
37
effectState
=
heap_malloc
(
sizeof
(
StarOutlineState
) * 3);
38
actor->
state
.functionTempPtr[0] =
effectState
;
39
40
for
(i = 0; i < 3;
effectState
++, i++) {
41
effectState
->pos.x = x;
42
effectState
->pos.y = y;
43
effectState
->pos.z = z;
44
effectState
->
unk_18
=
arg4
;
45
effectState
->unk_10 =
arg4
;
46
effectState
->unk_14 =
arg5
;
47
effectState
->delay = 1 + i * 10;
48
effectState
->duration = 40;
49
effectState
->unk_24 = 255;
50
effectState
->unk_28 = 255;
51
effectState
->unk_2C = 0.0f;
52
effectState
->unk_30 = 0.0f;
53
effectState
->unk_34 = 0.0f;
54
effectState
->effectEnded =
FALSE
;
55
}
56
return
ApiStatus_BLOCK
;
57
}
58
59
effectState
= actor->
state
.functionTempPtr[0];
60
endedCount
= 0;
61
62
for
(i = 0; i < 3;
effectState
++, i++) {
63
if
(
effectState
->delay > 0) {
64
effectState
->delay--;
65
if
(
effectState
->delay <= 0) {
66
effectState
->effect =
fx_star_outline
(0,
effectState
->pos.x,
effectState
->pos.y,
effectState
->pos.z,
67
effectState
->unk_18, -1);
68
effectState
->effect->data.starOutline->unk_3C.x =
effectState
->unk_2C;
69
effectState
->effect->data.starOutline->unk_3C.y =
effectState
->unk_30;
70
effectState
->effect->data.starOutline->unk_3C.z =
effectState
->unk_34;
71
effectState
->effect->data.starOutline->unk_00 = 0;
72
}
73
}
else
if
(
effectState
->effectEnded) {
74
endedCount
++;
75
}
else
{
76
effectState
->unk_34 += 9.0f;
77
effectState
->unk_18 =
fabsf
(
effectState
->unk_10 -
effectState
->unk_14) *
effectState
->duration / 40.0f +
effectState
->unk_14;
78
79
if
(
effectState
->duration <= 10) {
80
effectState
->unk_24 = (
effectState
->duration / 2 * 0.1f + 0.5f) * 255.0f;
81
effectState
->unk_28 = (
effectState
->duration / 2 * 0.1f + 0.5f) * 255.0f;
82
}
83
84
effectState
->duration--;
85
86
if
(
effectState
->duration <= 0) {
87
remove_effect
(
effectState
->effect);
88
effectState
->effectEnded =
TRUE
;
89
}
else
{
90
effectState
->effect->data.starOutline->pos.x =
effectState
->pos.x;
91
effectState
->effect->data.starOutline->pos.y =
effectState
->pos.y;
92
effectState
->effect->data.starOutline->pos.z =
effectState
->pos.z;
93
effectState
->effect->data.starOutline->unk_3C.x =
effectState
->unk_2C;
94
effectState
->effect->data.starOutline->unk_3C.y =
effectState
->unk_30;
95
effectState
->effect->data.starOutline->unk_3C.z =
effectState
->unk_34;
96
effectState
->effect->data.starOutline->unk_38 =
effectState
->unk_18;
97
effectState
->effect->data.starOutline->unk_24 =
effectState
->unk_24;
98
effectState
->effect->data.starOutline->unk_34 =
effectState
->unk_28;
99
}
100
}
101
}
102
103
if
(
endedCount
>= 3) {
104
heap_free
(
effectState
);
//@bug effectState doesn't point to allocated memory
105
return
ApiStatus_DONE2
;
106
}
else
{
107
return
ApiStatus_BLOCK
;
108
}
109
}
PopupMenu_SelectedIndex
BSS s32 PopupMenu_SelectedIndex
Definition
8a860_len_3f30.c:84
StarOutlineState::pos
Vec3f pos
Definition
StarRodAppearEffect.inc.c:6
StarOutlineState::unk_28
s32 unk_28
Definition
StarRodAppearEffect.inc.c:13
StarOutlineState::effect
EffectInstance * effect
Definition
StarRodAppearEffect.inc.c:5
StarOutlineState::unk_14
f32 unk_14
Definition
StarRodAppearEffect.inc.c:8
StarOutlineState::effectEnded
s32 effectEnded
Definition
StarRodAppearEffect.inc.c:17
StarOutlineState::unk_30
f32 unk_30
Definition
StarRodAppearEffect.inc.c:15
StarOutlineState::unk_34
f32 unk_34
Definition
StarRodAppearEffect.inc.c:16
StarOutlineState::unk_2C
f32 unk_2C
Definition
StarRodAppearEffect.inc.c:14
StarOutlineState::delay
s32 delay
Definition
StarRodAppearEffect.inc.c:10
StarOutlineState::unk_18
f32 unk_18
Definition
StarRodAppearEffect.inc.c:9
StarOutlineState::unk_24
s32 unk_24
Definition
StarRodAppearEffect.inc.c:12
StarOutlineState::duration
s32 duration
Definition
StarRodAppearEffect.inc.c:11
StarOutlineState::unk_10
f32 unk_10
Definition
StarRodAppearEffect.inc.c:7
StarOutlineState
Definition
StarRodAppearEffect.inc.c:4
Actor::state
ActorState state
Definition
common_structs.h:1859
ActorState::unk_18
Vec3f unk_18
Definition
common_structs.h:1824
Actor
Definition
common_structs.h:1855
Vec3f
Definition
common_structs.h:100
remove_effect
#define remove_effect
Definition
effect_shims.h:50
effects.h
EffectInstance
Definition
effects.h:2601
ApiStatus_DONE2
#define ApiStatus_DONE2
Definition
evt.h:118
Bytecode
s32 Bytecode
Definition
evt.h:7
ApiStatus_BLOCK
#define ApiStatus_BLOCK
Definition
evt.h:116
evt_get_variable
s32 evt_get_variable(Evt *script, Bytecode var)
Definition
evt.c:1689
fabsf
f32 fabsf(f32 f)
heap_free
s32 heap_free(void *ptr)
Definition
heap.c:42
get_actor
Actor * get_actor(s32 actorID)
Definition
actor_api.c:155
evt_get_float_variable
f32 evt_get_float_variable(Evt *script, Bytecode var)
Definition
evt.c:1929
heap_malloc
void * heap_malloc(s32 size)
Definition
heap.c:34
src
common
StarRodAppearEffect.inc.c
Generated by
1.10.0