Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
TexturePan.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4#include "TexturePan.h"
5
6API_CALLABLE(N(UpdateTexturePanSmooth)) {
7 script->varTable[9] += script->varTable[1];
8 if (script->varTable[9] < 0) {
9 script->varTable[9] += script->varTable[13];
10 } else if (script->varTable[9] > script->varTable[13]) {
11 script->varTable[9] -= script->varTable[13];
12 }
13
14 script->varTable[10] += script->varTable[2];
15 if (script->varTable[10] < 0) {
16 script->varTable[10] += script->varTable[13];
17 } else if (script->varTable[10] > script->varTable[13]) {
18 script->varTable[10] -= script->varTable[13];
19 }
20
21 script->varTable[11] += script->varTable[3];
22 if (script->varTable[11] < 0) {
23 script->varTable[11] += script->varTable[13];
24 } else if (script->varTable[11] > script->varTable[13]) {
25 script->varTable[11] -= script->varTable[13];
26 }
27
28 script->varTable[12] += script->varTable[4];
29 if (script->varTable[12] < 0) {
30 script->varTable[12] += script->varTable[13];
31 } else if (script->varTable[12] > script->varTable[13]) {
32 script->varTable[12] -= script->varTable[13];
33 }
34
35 set_main_pan_u(script->varTable[0], script->varTable[9]);
36 set_main_pan_v(script->varTable[0], script->varTable[10]);
37 set_aux_pan_u(script->varTable[0], script->varTable[11]);
38 set_aux_pan_v(script->varTable[0], script->varTable[12]);
39 return ApiStatus_BLOCK;
40}
41
42API_CALLABLE(N(UpdateTexturePanStepped)) {
43 if (isInitialCall) {
44 script->functionTemp[0] = 0;
45 script->functionTemp[1] = 0;
46 script->functionTemp[2] = 0;
47 script->functionTemp[3] = 0;
48 }
49
50 if (script->functionTemp[0] == 0) {
51 script->varTable[9] += script->varTable[1];
52 if (script->varTable[9] < 0) {
53 script->varTable[9] += script->varTable[13];
54 } else if (script->varTable[9] > script->varTable[13]) {
55 script->varTable[9] -= script->varTable[13];
56 }
57 }
58
59 if (script->functionTemp[1] == 0) {
60 script->varTable[10] += script->varTable[2];
61 if (script->varTable[10] < 0) {
62 script->varTable[10] += script->varTable[13];
63 } else if (script->varTable[10] > script->varTable[13]) {
64 script->varTable[10] -= script->varTable[13];
65 }
66 }
67
68 if (script->functionTemp[2] == 0) {
69 script->varTable[11] += script->varTable[3];
70 if (script->varTable[11] < 0) {
71 script->varTable[11] += script->varTable[13];
72 } else if (script->varTable[11] > script->varTable[13]) {
73 script->varTable[11] -= script->varTable[13];
74 }
75 }
76
77 if (script->functionTemp[3] == 0) {
78 script->varTable[12] += script->varTable[4];
79 if (script->varTable[12] < 0) {
80 script->varTable[12] += script->varTable[13];
81 } else if (script->varTable[12] > script->varTable[13]) {
82 script->varTable[12] -= script->varTable[13];
83 }
84 }
85
86 set_main_pan_u(script->varTable[0], script->varTable[9]);
87 set_main_pan_v(script->varTable[0], script->varTable[10]);
88 set_aux_pan_u(script->varTable[0], script->varTable[11]);
89 set_aux_pan_v(script->varTable[0], script->varTable[12]);
90
91 script->functionTemp[0]++;
92 script->functionTemp[1]++;
93 script->functionTemp[2]++;
94 script->functionTemp[3]++;
95
96 if (script->functionTemp[0] >= script->varTable[5]) {
97 script->functionTemp[0] = 0;
98 }
99 if (script->functionTemp[1] >= script->varTable[6]) {
100 script->functionTemp[1] = 0;
101 }
102 if (script->functionTemp[2] >= script->varTable[7]) {
103 script->functionTemp[2] = 0;
104 }
105 if (script->functionTemp[3] >= script->varTable[8]) {
106 script->functionTemp[3] = 0;
107 }
108
109 return ApiStatus_BLOCK;
110}
111
112EvtScript N(EVS_UpdateTexturePan) = {
114 IfEq(LVar5, 1)
115 IfEq(LVar6, 1)
116 IfEq(LVar7, 1)
117 IfEq(LVar8, 1)
118 Call(N(UpdateTexturePanSmooth))
119 Return
120 EndIf
121 EndIf
122 EndIf
123 EndIf
124 Call(N(UpdateTexturePanStepped))
125 Return
126 End
127};
128
Bytecode EvtScript[]
@ EVT_GROUP_NEVER_PAUSE
Definition evt.h:142
#define ApiStatus_BLOCK
Definition evt.h:116
void set_aux_pan_v(s32 texPannerID, s32 value)
Definition model.c:3828
void set_main_pan_u(s32 texPannerID, s32 value)
Definition model.c:3816
void set_aux_pan_u(s32 texPannerID, s32 value)
Definition model.c:3824
void set_main_pan_v(s32 texPannerID, s32 value)
Definition model.c:3820
#define LVar6
Definition macros.h:154
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar5
Definition macros.h:153
#define LVar7
Definition macros.h:155
#define LVar8
Definition macros.h:156
#define SetGroup(GROUP)
Sets the current thread's group. Group value meanings are currently not known.
Definition macros.h:519
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Return
Kills the current EVT thread.
Definition macros.h:217