Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
UnkFloatFunc005.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2
3API_CALLABLE(N(UnkFloatFunc005)) {
4 Bytecode* args = script->ptrReadPos;
5 f32 vt0 = 0.0f;
6 f32 vt1 = 0.0f;
7 f32 vt2 = 0.0f;
8 f32 vt3;
9 f32 vt4;
10 f32 vt5;
11 f32 vt6;
12 f32 vt7;
13
14 f64 temp_f20;
15 f64 temp_f20_2;
16 f64 temp_f20_3;
17 f64 temp_f20_4;
18 s32 temp_s1;
19
20 script->functionTemp[0] = temp_s1 = evt_get_variable(script, *args++);
21
22 switch (temp_s1) {
23 case 0:
24 vt0 = 142.0f;
25 vt1 = 0.0f;
26 vt2 = -118.0f;
27 script->varTable[3] = 142;
28 script->varTable[4] = 0;
29 script->varTable[5] = -118;
30 script->varTable[6] = 44;
31 script->varTable[7] = -118;
32 script->varTable[8] = 3;
33 script->varTable[9] = 0;
34 script->varTable[11] = 0;
35 script->functionTemp[0] = 1;
36 break;
37 case 3:
38 vt0 = 91.0f;
39 vt1 = 0.0f;
40 vt2 = -118.0f;
41 script->varTable[3] = 91;
42 script->varTable[4] = 0;
43 script->varTable[5] = -118;
44 script->varTable[6] = 91;
45 script->varTable[7] = -118;
46 script->varTable[8] = 3;
47 script->varTable[9] = 0;
48 script->varTable[11] = 0;
49 script->functionTemp[0] = 1;
50 break;
51 case 1:
52 script->varTable[9] += script->varTable[8];
53 if (script->varTable[9] > 45) {
54 script->varTable[9] = 45;
55 }
56 vt0 = script->varTable[3];
57 vt1 = script->varTable[4];
58 vt2 = script->varTable[5];
59 vt3 = script->varTable[6];
60 vt4 = script->varTable[7];
61 temp_f20 = vt0 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
62 vt0 = (temp_f20 + (vt3 * sin_rad(DEG_TO_RAD(script->varTable[9]))));
63 vt1 = vt1 + sin_rad(DEG_TO_RAD(script->varTable[9] * 2)) * 90.0f;
64 temp_f20_2 = vt2 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
65 vt2 = temp_f20_2 + (vt4 * sin_rad(DEG_TO_RAD(script->varTable[9])));
66 if (script->varTable[9] == 45) {
67 script->varTable[11] = 1;
68 }
69 break;
70 case 2:
71 script->varTable[9] += script->varTable[8];
72 if (script->varTable[9] > 90) {
73 script->varTable[9] = 90;
74 }
75 vt0 = script->varTable[3];
76 vt1 = script->varTable[4];
77 vt2 = script->varTable[5];
78 vt3 = script->varTable[6];
79 vt4 = script->varTable[7];
80 temp_f20_3 = vt0 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
81 vt0 = (temp_f20_3 + (vt3 * sin_rad(DEG_TO_RAD(script->varTable[9]))));
82 vt1 = vt1 + sin_rad(DEG_TO_RAD(script->varTable[9] * 2)) * 90.0f;
83 temp_f20_4 = vt2 * (1.0 - sin_rad(DEG_TO_RAD(script->varTable[9])));
84 vt2 = temp_f20_4 + (vt4 * sin_rad(DEG_TO_RAD(script->varTable[9])));
85 if (script->varTable[9] == 90) {
86 script->varTable[11] = 2;
87 }
88 break;
89 }
90 script->varTable[0] = vt0;
91 script->varTable[1] = vt1;
92 script->varTable[2] = vt2;
93 return ApiStatus_DONE2;
94}
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
f32 sin_rad(f32 x)
Definition 43F0.c:713
#define DEG_TO_RAD(deg)
Definition macros.h:134