Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ApplyTint.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3#include "model.h"
4
5enum {
9};
10
11API_CALLABLE(N(SetModelTintMode)) {
12 Bytecode* args = script->ptrReadPos;
13 s32 mode = evt_get_variable(script, *args++);
14 s32 testS0 = evt_get_variable(script, *args++);
15 s32 tintType = evt_get_variable(script, *args++);
16 s32* modelIDList = (s32*) testS0;
17 s32 listIndex;
18 Model* mdl;
19
20 if (modelIDList == PTR_LIST_END) {
21 mdl_set_all_tint_type(tintType);
22 return ApiStatus_DONE2;
23 }
24
25 switch (mode) {
27 while (TRUE) {
28 if (*modelIDList == 0xFFFF) {
29 break;
30 }
31 listIndex = get_model_list_index_from_tree_index(*modelIDList);
32 mdl = get_model_from_list_index(listIndex);
34 modelIDList++;
35 };
36 break;
37
39 while (TRUE) {
40 if (*modelIDList == 0xFFFF) {
41 break;
42 }
43 mdl_group_set_custom_gfx(*modelIDList, CUSTOM_GFX_NONE, tintType, FALSE);
44 modelIDList++;
45 };
46 break;
47
48 case APPLY_TINT_BG:
49 *gBackgroundTintModePtr = tintType;
50 break;
51
52 }
53 return ApiStatus_DONE2;
54}
55
56API_CALLABLE(N(SetModelTintParams)) {
57 Bytecode* args = script->ptrReadPos;
58 s32 tintType = evt_get_variable(script, *args++);
59 s32 arg0 = evt_get_variable(script, *args++);
60 s32 arg1 = evt_get_variable(script, *args++);
61 s32 arg2 = evt_get_variable(script, *args++);
62 s32 arg3 = evt_get_variable(script, *args++);
63 s32 arg4 = evt_get_variable(script, *args++);
64 s32 arg5 = evt_get_variable(script, *args++);
65 s32 arg6 = evt_get_variable(script, *args++);
66 s32 arg7 = evt_get_variable(script, *args++);
67 s32 arg8 = evt_get_variable(script, *args++);
68
69 switch (tintType) {
70 case ENV_TINT_SHROUD:
71 mdl_set_shroud_tint_params(arg0, arg1, arg2, arg3);
72 break;
73 case ENV_TINT_DEPTH:
74 mdl_set_depth_tint_params(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
75 break;
76 case ENV_TINT_REMAP:
77 mdl_set_remap_tint_params(arg0, arg1, arg2, arg3, arg4, arg5);
78 break;
79 }
80
81 return ApiStatus_DONE2;
82}
@ APPLY_TINT_BG
@ APPLY_TINT_MODELS
@ APPLY_TINT_GROUPS
@ ENV_TINT_SHROUD
Definition enums.h:4387
@ ENV_TINT_DEPTH
Definition enums.h:4389
@ ENV_TINT_REMAP
Definition enums.h:4393
@ CUSTOM_GFX_NONE
Definition enums.h:4420
#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
s32 get_model_list_index_from_tree_index(s32 treeIndex)
Definition model.c:3397
void mdl_set_all_tint_type(s32)
Definition model.c:4521
struct Model * get_model_from_list_index(s32 listIndex)
Definition model.c:3315
void mdl_group_set_custom_gfx(u16, s32, s32, b32)
Definition model.c:3695
void mdl_set_shroud_tint_params(u8 r, u8 g, u8 b, u8 a)
Definition model.c:3906
void mdl_set_remap_tint_params(u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB)
Definition model.c:3945
void set_mdl_custom_gfx_set(Model *, s32, u32)
Definition model.c:3832
void mdl_set_depth_tint_params(u8 primR, u8 primG, u8 primB, u8 primA, u8 fogR, u8 fogG, u8 fogB, s32 fogStart, s32 fogEnd)
Definition model.c:3920
Definition model.h:59
#define PTR_LIST_END
Definition macros.h:42
u8 * gBackgroundTintModePtr
Definition model.c:105