Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
sbk_02.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
3
4#include "effects.h"
5#include "model.h"
6
7#define NAMESPACE A(sbk_02)
8
9API_CALLABLE(N(UpdateSunPos)) {
10 Bytecode* args = script->ptrReadPos;
11 s32 outPosX;
12 s32 outPosY;
13 s32 outPosZ;
14 f32 x;
15 f32 y;
16 f32 z;
17 f32 angle;
18#if !VERSION_PAL
20#endif
21
22 angle = evt_get_variable(script, *args++) / 10.0;
23 angle = angle * TAU;
24 angle = angle / 360.0f;
25
26 outPosX = *args++;
27 outPosY = *args++;
28 outPosZ = *args++;
29
30 x = sin_rad(angle) * 150.0f + 0.0f;
31 y = cos_rad(angle) * 150.0f + 0.0f;
32 z = -252.0f;
33
34 x -= script->varTable[11];
35 y -= script->varTable[12];
36 z -= script->varTable[13];
37
41
42 return ApiStatus_DONE2;
43}
44
45API_CALLABLE(N(GetModelPos)) {
46 s32 modelID = script->varTable[10];
49
50 script->varTable[11] = (s32) model->center.x;
51 script->varTable[12] = (s32) model->center.y;
52 script->varTable[13] = (s32) model->center.z;
53
54 return ApiStatus_DONE2;
55}
56
58 Set(LVarA, LVar0) // modelID
59 Set(LVar7, LVar1) // initialPhase
60 Mul(LVar7, 10)
62 Label(0)
63 Add(LVar7, 1)
64 IfGt(LVar7, 3599)
65 Sub(LVar7, 3600)
66 EndIf
69 Wait(1)
70 Goto(0)
71 Return
72 End
73};
74
78 Set(LVar1, 0)
81 Set(LVar1, 120)
84 Set(LVar1, 240)
86 PlayEffect(EFFECT_SUN, 0, 0, 0, 0, 0, 0, 0)
87 Return
88 End
89};
90
92 Return
93 End
94};
95
96s32 N(ForegroundModels)[] = {
102};
103
104Stage NAMESPACE = {
105 .texture = "sbk_tex",
106 .shape = "sbk_bt02_shape",
107 .hit = "sbk_bt02_hit",
108 .bg = "sbk_bg",
109 .preBattle = &N(EVS_PreBattle),
110 .postBattle = &N(EVS_PostBattle),
111 .foregroundModelList = N(ForegroundModels),
112};
BSS s32 PopupMenu_SelectedIndex
f32 Matrix4f[4][4]
Bytecode EvtScript[]
#define MODEL_g63
#define MODEL_g62
#define MODEL_o321
Definition dgb_13_shape.h:9
#define MODEL_g60
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
s32 get_model_list_index_from_tree_index(s32 treeIndex)
Definition model.c:3396
f32 evt_set_float_variable(Evt *script, Bytecode var, f32 value)
Definition evt.c:1976
f32 cos_rad(f32 x)
Definition 43F0.c:715
struct Model * get_model_from_list_index(s32 listIndex)
Definition model.c:3314
f32 sin_rad(f32 x)
Definition 43F0.c:711
#define MODEL_o320
#define MODEL_o322
#define MODEL_o319
Definition model.h:59
ApiStatus SetSpriteShading(Evt *script, b32 isInitialCall)
ApiStatus TranslateModel(Evt *script, b32 isInitialCall)
Translates the given model's position.
#define Mul(VAR, INT_VALUE)
Definition macros.h:378
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define TAU
Definition macros.h:132
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar7
Definition macros.h:155
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define PlayEffect(args...)
Definition macros.h:807
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define LVar0
Definition macros.h:148
#define Exec(EVT_SOURCE)
Launches a new thread.
Definition macros.h:455
#define Return
Kills the current EVT thread.
Definition macros.h:217
#define STAGE_MODEL_LIST_END
Definition battle.h:8