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;
14 f32 x;
15 f32 y;
16 f32 z;
17 f32 angle;
18
19 angle = evt_get_variable(script, *args++) / 10.0;
20 angle = angle * TAU;
21 angle = angle / 360.0f;
22
23 outPosX = *args++;
24 outPosY = *args++;
25 outPosZ = *args++;
26
27 x = sin_rad(angle) * 150.0f + 0.0f;
28 y = cos_rad(angle) * 150.0f + 0.0f;
29 z = -252.0f;
30
31 x -= script->varTable[11];
32 y -= script->varTable[12];
33 z -= script->varTable[13];
34
38
39 return ApiStatus_DONE2;
40}
41
42API_CALLABLE(N(GetModelPos)) {
43 s32 modelID = script->varTable[10];
46
47 script->varTable[11] = (s32) model->center.x;
48 script->varTable[12] = (s32) model->center.y;
49 script->varTable[13] = (s32) model->center.z;
50
51 return ApiStatus_DONE2;
52}
53
55 Set(LVarA, LVar0) // modelID
56 Set(LVar7, LVar1) // initialPhase
57 Mul(LVar7, 10)
59 Label(0)
60 Add(LVar7, 1)
61 IfGt(LVar7, 3599)
62 Sub(LVar7, 3600)
63 EndIf
66 Wait(1)
67 Goto(0)
68 Return
69 End
70};
71
75 Set(LVar1, 0)
78 Set(LVar1, 120)
81 Set(LVar1, 240)
83 PlayEffect(EFFECT_SUN, 0, 0, 0, 0, 0, 0, 0)
84 Return
85 End
86};
87
89 Return
90 End
91};
92
93s32 N(ForegroundModels)[] = {
99};
100
101Stage NAMESPACE = {
102 .texture = "sbk_tex",
103 .shape = "sbk_bt02_shape",
104 .hit = "sbk_bt02_hit",
105 .bg = "sbk_bg",
106 .preBattle = &N(EVS_PreBattle),
107 .postBattle = &N(EVS_PostBattle),
108 .foregroundModelList = N(ForegroundModels),
109};
BSS s32 PopupMenu_SelectedIndex
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:119
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1730
s32 get_model_list_index_from_tree_index(s32 treeIndex)
Definition model.c:3393
f32 evt_set_float_variable(Evt *script, Bytecode var, f32 value)
Definition evt.c:2017
f32 cos_rad(f32 x)
Definition 43F0.c:717
struct Model * get_model_from_list_index(s32 listIndex)
Definition model.c:3312
f32 sin_rad(f32 x)
Definition 43F0.c:713
#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:379
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:366
#define Sub(VAR, INT_VALUE)
Definition macros.h:378
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define Add(VAR, INT_VALUE)
Definition macros.h:377
#define TAU
Definition macros.h:139
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:233
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:279
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:228
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:299
#define LVar7
Definition macros.h:156
#define LVar2
Definition macros.h:151
#define LVar1
Definition macros.h:150
#define LVarA
Definition macros.h:159
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:255
#define PlayEffect(args...)
Definition macros.h:811
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define LVar0
Definition macros.h:149
#define Exec(EVT_SOURCE)
Launches a new thread.
Definition macros.h:456
#define Return
Kills the current EVT thread.
Definition macros.h:218
#define STAGE_MODEL_LIST_END
Definition battle.h:8