Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
CreateDarkness.inc.c
Go to the documentation of this file.
1#include "common.h"
2
3API_CALLABLE(N(DarkRoomUpdate)) {
4 PlayerStatus* playerStatus = &gPlayerStatus;
5 PlayerData* playerData = &gPlayerData;
6
7 if (isInitialCall) {
8 script->functionTemp[0] = 255;
9 script->functionTemp[1] = FALSE;
10 }
11
12 set_screen_overlay_center_worldpos(SCREEN_LAYER_BACK, 1, playerStatus->pos.x, playerStatus->pos.y + 8.0f, playerStatus->pos.z);
13
15 if (playerData->curPartner == PARTNER_WATT) {
16 if (!script->functionTemp[1]) {
17 script->functionTemp[1] = TRUE;
19 }
20 script->functionTemp[0] -= 8;
21 if (script->functionTemp[0] < 90) {
22 script->functionTemp[0] = 90;
23 }
24 }
25 } else if (playerData->curPartner == PARTNER_WATT) {
26 if (script->functionTemp[1]) {
27 script->functionTemp[1] = FALSE;
28 if (script->functionTemp[0] < 255) {
30 }
31 }
32 script->functionTemp[0] += 8;
33 if (script->functionTemp[0] >= 255) {
34 script->functionTemp[0] = 255;
35 }
36 } else {
37 script->functionTemp[0] = 255;
38 }
39
40 set_screen_overlay_alpha(SCREEN_LAYER_BACK, script->functionTemp[0]);
42
43 return ApiStatus_BLOCK;
44}
45
46EvtScript N(EVS_CreateDarkness) = {
47 Thread
48 Call(N(DarkRoomUpdate))
50 Return
51 End
52};
Bytecode EvtScript[]
@ OVERLAY_WORLD_DARKNESS
Definition enums.h:2399
@ SCREEN_LAYER_BACK
Definition enums.h:2383
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ SOUND_WATT_REPEL_DARKNESS
Definition enums.h:1326
@ SOUND_WATT_RESUME_DARKNESS
Definition enums.h:1327
@ PARTNER_WATT
Definition enums.h:2891
#define ApiStatus_BLOCK
Definition evt.h:116
void set_screen_overlay_params_back(u8, f32)
void set_screen_overlay_alpha(s32, f32)
void set_screen_overlay_center_worldpos(s32 idx, s32 posIdx, s32 x, s32 y, s32 z)
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#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
PartnerStatus gPartnerStatus
Definition partners.c:42
PlayerData gPlayerData
Definition 77480.c:40
PlayerStatus gPlayerStatus
Definition 77480.c:39