Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
SaveBlock.c File Reference

Go to the source code of this file.

Functions

void entity_SaveBlock_setupGfx (s32 index)
 
void entity_SaveBlock_idle (Entity *entity)
 
void entity_SaveBlock_pause_game (void)
 
void entity_SaveBlock_resume_game (void)
 
void entity_SaveBlock_save_data (void)
 
void entity_SaveBlock_show_tutorial_message (Entity *entity)
 
void entity_SaveBlock_wait_for_close_tutorial (Entity *entity)
 
void entity_SaveBlock_show_choice_message (void)
 
void entity_SaveBlock_show_result_message (void)
 
void entity_SaveBlock_wait_for_close_result (Entity *entity)
 
void entity_SaveBlock_wait_for_close_choice (Entity *entity)
 
void entity_SaveBlock_init (Entity *entity)
 

Variables

Mtx Entity_SaveBlock_Mtx
 
Gfx Entity_SaveBlock_RenderContent []
 
Gfx Entity_SaveBlock_RenderBlock []
 
Gfx Entity_SaveBlock_RenderNone []
 
s32 Entity_SaveBlock_ScriptResume []
 
BSS s32 SaveBlockTutorialPrinterClosed
 
BSS s32 SaveBlockResultPrinterClosed
 
BSS MessagePrintStateSaveBlockTutorialPrinter
 
BSS MessagePrintStateSaveBlockResultPrinter
 
EntityScript Entity_SaveBlock_Script
 
EntityModelScript Entity_SaveBlock_RenderScript = STANDARD_ENTITY_MODEL_SCRIPT(Entity_SaveBlock_RenderNone, RENDER_MODE_SURFACE_XLU_LAYER3)
 
EntityBlueprint Entity_SavePoint
 

Function Documentation

◆ entity_SaveBlock_setupGfx()

void entity_SaveBlock_setupGfx ( s32 index)

Definition at line 30 of file SaveBlock.c.

30 {
31 Gfx* gfxPos = gMainGfxPos;
33 Entity* entity = get_entity_by_index(index);
34 SaveBlockData* blockData = entity->dataBuf.saveBlock;
35 s32 alpha = 128;
36 Matrix4f sp18;
37 Matrix4f sp58;
38
39 guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &Entity_SaveBlock_Mtx));
40 sp18[3][1] += 12.5f;
41 guRotateF(sp58, blockData->angle, 0.0f, 1.0f, 0.0f);
42 guMtxCatF(sp58, sp18, sp58);
44
45 gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
46 gDPSetRenderMode(gfxPos++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2);
47 gDPSetCombineMode(gfxPos++, PM_CC_01, PM_CC_02);
48 gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, alpha);
49 gSPDisplayList(gfxPos++, dlist);
50 gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);
51
52#if VERSION_PAL
53 switch (gCurrentLanguage) {
54 default:
55 dlist = ENTITY_ADDR(entity, Gfx*, Entity_SaveBlock_RenderBlock);
56 break;
57
58 case LANGUAGE_ES:
59 dlist = ENTITY_ADDR(entity, Gfx*, Entity_SaveBlock_RenderBlock_es);
60 break;
61 }
62#else
63 dlist = ENTITY_ADDR(entity, Gfx*, Entity_SaveBlock_RenderBlock);
64#endif
65 guMtxL2F(sp58, ENTITY_ADDR(entity, Mtx*, &Entity_SaveBlock_Mtx));
66 sp58[3][1] += 12.5f;
67 gDPPipeSync(gfxPos++);
69
70 gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
71 gDPSetRenderMode(gfxPos++, G_RM_AA_XLU_SURF | Z_CMP, G_RM_AA_XLU_SURF2 | Z_CMP);
72 gDPSetCombineMode(gfxPos++, PM_CC_01, PM_CC_02);
73 gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, alpha);
74 gSPDisplayList(gfxPos++, dlist);
75 gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);
76
77 gMainGfxPos = gfxPos;
78}
Mtx Entity_SaveBlock_Mtx
Definition SaveBlock.c:67
Gfx Entity_SaveBlock_RenderContent[]
Definition SaveBlock.c:184
Gfx Entity_SaveBlock_RenderBlock[]
Definition SaveBlock.c:189
Mtx matrixStack[0x200]
struct SaveBlockData * saveBlock
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guMtxCatF
#define ENTITY_ADDR(entity, type, data)
Definition entity.h:64
@ LANGUAGE_ES
Definition enums.h:6403
Entity * get_entity_by_index(s32 index)
Definition entity.c:530
#define PM_CC_01
Definition macros.h:276
#define PM_CC_02
Definition macros.h:277
EntityData dataBuf
#define gCurrentLanguage
Definition variables.h:115
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by entity_SaveBlock_init().

◆ entity_SaveBlock_idle()

void entity_SaveBlock_idle ( Entity * entity)

Definition at line 80 of file SaveBlock.c.

80 {
81 SaveBlockData* data;
82
83 data = entity->dataBuf.saveBlock;
84 data->angle = clamp_angle(data->angle + 6);
86}
#define clamp_angle
s32 entity_base_block_idle(Entity *entity)
Definition Block.c:195

◆ entity_SaveBlock_pause_game()

void entity_SaveBlock_pause_game ( void )

Definition at line 88 of file SaveBlock.c.

88 {
92}
@ TIME_FREEZE_PARTIAL
Definition enums.h:3465
s32 disable_player_input(void)
Definition 77480.c:990
void set_time_freeze_mode(s32)
Time freeze modes: 0: none 1: NPCs move, can't be interacted with 2: NPCs don't move,...
Definition main_loop.c:358
PlayerStatus * gPlayerStatusPtr

◆ entity_SaveBlock_resume_game()

void entity_SaveBlock_resume_game ( void )

Definition at line 94 of file SaveBlock.c.

94 {
97}
@ TIME_FREEZE_NONE
Definition enums.h:3464
s32 enable_player_input(void)
Definition 77480.c:998

◆ entity_SaveBlock_save_data()

void entity_SaveBlock_save_data ( void )

Definition at line 99 of file SaveBlock.c.

◆ entity_SaveBlock_show_tutorial_message()

void entity_SaveBlock_show_tutorial_message ( Entity * entity)

Definition at line 106 of file SaveBlock.c.

106 {
109 msg_get_printer_for_msg(MSG_Menus_Tutorial_SaveBlock, &SaveBlockTutorialPrinterClosed);
111 return;
112 }
113
116}
BSS s32 SaveBlockTutorialPrinterClosed
Definition SaveBlock.c:20
MessagePrintState * msg_get_printer_for_msg(s32 msgID, s32 *a1)
Definition msg.c:1424
void exec_entity_commandlist(Entity *entity)
Definition entity.c:313
@ GF_Tutorial_SaveBlock
s32 set_global_flag(s32 index)
Definition vars_access.c:65
s32 get_global_flag(s32 index)
Definition vars_access.c:89

◆ entity_SaveBlock_wait_for_close_tutorial()

void entity_SaveBlock_wait_for_close_tutorial ( Entity * entity)

Definition at line 118 of file SaveBlock.c.

118 {
121 }
122}

◆ entity_SaveBlock_show_choice_message()

void entity_SaveBlock_show_choice_message ( void )

Definition at line 124 of file SaveBlock.c.

124 {
129}
BSS MessagePrintState * SaveBlockResultPrinter
Definition SaveBlock.c:23
BSS MessagePrintState * SaveBlockTutorialPrinter
Definition SaveBlock.c:22
BSS s32 SaveBlockResultPrinterClosed
Definition SaveBlock.c:21

◆ entity_SaveBlock_show_result_message()

void entity_SaveBlock_show_result_message ( void )

Definition at line 131 of file SaveBlock.c.

131 {
132 msg_printer_load_msg(MSG_Menus_SaveComplete, SaveBlockResultPrinter);
134}
@ SOUND_SAVE_CONFIRM
Definition enums.h:561
s32 msg_printer_load_msg(s32 msgID, MessagePrintState *printer)
Definition msg.c:1474
void sfx_play_sound(s32 soundID)
Definition sfx.c:517

◆ entity_SaveBlock_wait_for_close_result()

void entity_SaveBlock_wait_for_close_result ( Entity * entity)

Definition at line 136 of file SaveBlock.c.

136 {
139 }
140}

◆ entity_SaveBlock_wait_for_close_choice()

void entity_SaveBlock_wait_for_close_choice ( Entity * entity)

Definition at line 142 of file SaveBlock.c.

142 {
146 } else {
148 }
150 }
151}
s32 Entity_SaveBlock_ScriptResume[]
Definition SaveBlock.c:182
void close_message(MessagePrintState *msgPrintState)
Definition msg.c:1568
void set_entity_commandlist(Entity *entity, s32 *entityScript)
Definition entity.c:235

◆ entity_SaveBlock_init()

void entity_SaveBlock_init ( Entity * entity)

Definition at line 153 of file SaveBlock.c.

153 {
154 SaveBlockData* data = entity->dataBuf.saveBlock;
155
158 data->angle = 8;
159}
void entity_SaveBlock_setupGfx(s32 index)
Definition SaveBlock.c:30
void entity_base_block_init(Entity *entity)
Definition Block.c:213
void(* renderSetupFunc)(s32)

Variable Documentation

◆ Entity_SaveBlock_Mtx

Mtx Entity_SaveBlock_Mtx
extern

Definition at line 67 of file SaveBlock.c.

Referenced by entity_SaveBlock_setupGfx().

◆ Entity_SaveBlock_RenderContent

Gfx Entity_SaveBlock_RenderContent[]
extern

Definition at line 184 of file SaveBlock.c.

184 {
185 gsSPDisplayList(Entity_SaveBlock_RenderStar),
186 gsSPEndDisplayList(),
187};
Gfx Entity_SaveBlock_RenderStar[]
Definition SaveBlock.c:166

Referenced by entity_SaveBlock_setupGfx().

◆ Entity_SaveBlock_RenderBlock

Gfx Entity_SaveBlock_RenderBlock[]
extern

Definition at line 189 of file SaveBlock.c.

189 {
190 gsSPDisplayList(Entity_SaveBlock_RenderFaces),
191 gsSPDisplayList(Entity_SaveBlock_RenderLetterS),
192 gsSPEndDisplayList(),
193};
Gfx Entity_SaveBlock_RenderLetterS[]
Definition SaveBlock.c:74
Gfx Entity_SaveBlock_RenderFaces[]
Definition SaveBlock.c:130

Referenced by entity_SaveBlock_setupGfx().

◆ Entity_SaveBlock_RenderNone

Gfx Entity_SaveBlock_RenderNone[]
extern

Definition at line 203 of file SaveBlock.c.

203 {
204 gsSPEndDisplayList(),
205};

◆ Entity_SaveBlock_ScriptResume

EntityScript Entity_SaveBlock_ScriptResume
Initial value:
= {
es_SetCallback(NULL, 2)
}
void entity_SaveBlock_resume_game(void)
Definition SaveBlock.c:94
EntityScript Entity_SaveBlock_Script
Definition SaveBlock.c:161
#define es_Call(func)
Definition entity.h:37
#define es_SetCallback(func, time)
Definition entity.h:38
#define es_End
Definition entity.h:35
#define es_Jump(script)
Definition entity.h:36

Definition at line 182 of file SaveBlock.c.

Referenced by entity_SaveBlock_wait_for_close_choice().

◆ SaveBlockTutorialPrinterClosed

◆ SaveBlockResultPrinterClosed

BSS s32 SaveBlockResultPrinterClosed

◆ SaveBlockTutorialPrinter

BSS MessagePrintState* SaveBlockTutorialPrinter

◆ SaveBlockResultPrinter

◆ Entity_SaveBlock_Script

EntityScript Entity_SaveBlock_Script
Initial value:
= {
es_SetCallback(NULL, 2)
es_SetCallback(NULL, 14)
es_SetCallback(NULL, 12)
}
void entity_SaveBlock_wait_for_close_tutorial(Entity *entity)
Definition SaveBlock.c:118
void entity_SaveBlock_wait_for_close_choice(Entity *entity)
Definition SaveBlock.c:142
void entity_SaveBlock_save_data(void)
Definition SaveBlock.c:99
void entity_SaveBlock_pause_game(void)
Definition SaveBlock.c:88
void entity_SaveBlock_wait_for_close_result(Entity *entity)
Definition SaveBlock.c:136
void entity_SaveBlock_idle(Entity *entity)
Definition SaveBlock.c:80
void entity_SaveBlock_show_tutorial_message(Entity *entity)
Definition SaveBlock.c:106
void entity_SaveBlock_show_result_message(void)
Definition SaveBlock.c:131
void entity_SaveBlock_show_choice_message(void)
Definition SaveBlock.c:124
#define es_Restart
Definition entity.h:40
#define es_PlaySound(soundId)
Definition entity.h:45
@ SOUND_HIT_BLOCK
Definition enums.h:768
void entity_block_hit_animate_scale(Entity *entity)
Definition Block.c:90
f32 entity_block_hit_init_scale(Entity *entity)
Definition Block.c:75

Definition at line 161 of file SaveBlock.c.

◆ Entity_SaveBlock_RenderScript

◆ Entity_SavePoint

EntityBlueprint Entity_SavePoint
Initial value:
= {
.typeDataSize = sizeof(SaveBlockData),
.renderCommandList = Entity_SaveBlock_RenderScript,
.modelAnimationNodes = 0,
.updateEntityScript = Entity_SaveBlock_Script,
.fpHandleCollision = entity_block_handle_collision,
{ .dma = ENTITY_ROM(SaveBlock) },
.entityType = ENTITY_TYPE_SAVE_POINT,
.aabbSize = { 25, 25, 25 }
}
EntityModelScript Entity_SaveBlock_RenderScript
Definition SaveBlock.c:189
void entity_SaveBlock_init(Entity *entity)
Definition SaveBlock.c:153
#define ENTITY_ROM(name)
Definition entity.h:65
@ ENTITY_TYPE_SAVE_POINT
Definition enums.h:2575
@ ENTITY_FLAG_FIXED_SHADOW_SIZE
Definition enums.h:2622
@ ENTITY_FLAG_4000
Definition enums.h:2627
s32 entity_block_handle_collision(Entity *entity)
Definition Block.c:334

Definition at line 191 of file SaveBlock.c.

191 {
193 .typeDataSize = sizeof(SaveBlockData),
194 .renderCommandList = Entity_SaveBlock_RenderScript,
195 .modelAnimationNodes = 0,
196 .fpInit = entity_SaveBlock_init,
197 .updateEntityScript = Entity_SaveBlock_Script,
198 .fpHandleCollision = entity_block_handle_collision,
199 { .dma = ENTITY_ROM(SaveBlock) },
200 .entityType = ENTITY_TYPE_SAVE_POINT,
201 .aabbSize = { 25, 25, 25 }
202};