Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ShatteringBlock.c
Go to the documentation of this file.
1#include "common.h"
2#include "ld_addrs.h"
3#include "entity.h"
4
5#if VERSION_JP // TODO remove once segments are split
6extern Addr entity_model_ShatteringBrickBlock_ROM_END;
7extern Addr entity_model_ShatteringBrickBlock_ROM_START;
8extern Addr entity_model_ShatteringHammer1Block_ROM_END;
9extern Addr entity_model_ShatteringHammer1Block_ROM_START;
10extern Addr entity_model_ShatteringHammer2Block_ROM_END;
11extern Addr entity_model_ShatteringHammer2Block_ROM_START;
12extern Addr entity_model_ShatteringHammer3Block_ROM_END;
13extern Addr entity_model_ShatteringHammer3Block_ROM_START;
14#endif
15
24
25extern Gfx Entity_RenderNone[];
27
28void entity_shattering_init_pieces(Entity* entity, Gfx** dlists, Mtx* matrices);
30
32
34 .flags = 0,
35 .typeDataSize = sizeof(ShatteringBlockData),
36 .renderCommandList = Entity_ShatteringBlock_RenderScript,
37 .modelAnimationNodes = 0,
39 .updateEntityScript = Entity_ShatteringBlock_Script,
40 .fpHandleCollision = NULL,
41 { .dma = ENTITY_ROM(ShatteringHammer1Block) },
42 .entityType = ENTITY_TYPE_HAMMER1_BLOCK,
43 .aabbSize = {16, 16, 16}
44};
45
47 .flags = 0,
48 .typeDataSize = sizeof(ShatteringBlockData),
49 .renderCommandList = Entity_ShatteringBlock_RenderScript,
50 .modelAnimationNodes = 0,
52 .updateEntityScript = Entity_ShatteringBlock_Script,
53 .fpHandleCollision = NULL,
54 { .dma = ENTITY_ROM(ShatteringHammer2Block) },
55 .entityType = ENTITY_TYPE_HAMMER2_BLOCK,
56 .aabbSize = {16, 16, 16}
57};
58
60 .flags = 0,
61 .typeDataSize = sizeof(ShatteringBlockData),
62 .renderCommandList = Entity_ShatteringBlock_RenderScript,
63 .modelAnimationNodes = 0,
65 .updateEntityScript = Entity_ShatteringBlock_Script,
66 .fpHandleCollision = NULL,
67 { .dma = ENTITY_ROM(ShatteringHammer3Block) },
68 .entityType = ENTITY_TYPE_HAMMER3_BLOCK,
69 .aabbSize = {16, 16, 16}
70};
71
73 .flags = 0,
74 .typeDataSize = sizeof(ShatteringBlockData),
75 .renderCommandList = Entity_ShatteringBlock_RenderScript,
76 .modelAnimationNodes = 0,
78 .updateEntityScript = Entity_ShatteringBlock_Script,
79 .fpHandleCollision = NULL,
80 { .dma = ENTITY_ROM(ShatteringHammer1Block) },
82 .aabbSize = {8, 8, 8}
83};
84
86 .flags = 0,
87 .typeDataSize = sizeof(ShatteringBlockData),
88 .renderCommandList = Entity_ShatteringBlock_RenderScript,
89 .modelAnimationNodes = 0,
91 .updateEntityScript = Entity_ShatteringBlock_Script,
92 .fpHandleCollision = NULL,
93 { .dma = ENTITY_ROM(ShatteringHammer2Block) },
95 .aabbSize = {8, 8, 8}
96};
97
99 .flags = 0,
100 .typeDataSize = sizeof(ShatteringBlockData),
101 .renderCommandList = Entity_ShatteringBlock_RenderScript,
102 .modelAnimationNodes = 0,
104 .updateEntityScript = Entity_ShatteringBlock_Script,
105 .fpHandleCollision = NULL,
106 { .dma = ENTITY_ROM(ShatteringHammer3Block) },
107 .entityType = ENTITY_TYPE_HAMMER3_BLOCK_TINY,
108 .aabbSize = {8, 8, 8}
109};
110
112 .flags = 0,
113 .typeDataSize = sizeof(ShatteringBlockData),
114 .renderCommandList = Entity_ShatteringBlock_RenderScript,
115 .modelAnimationNodes = 0,
117 .updateEntityScript = Entity_ShatteringBlock_Script,
118 .fpHandleCollision = NULL,
119 { .dma = ENTITY_ROM(ShatteringBrickBlock) },
120 .entityType = ENTITY_TYPE_BRICK_BLOCK,
121 .aabbSize = {8, 8, 8}
122};
123
125 u32 type;
126 Mtx* fragmentMatrices = NULL;
127 Gfx** fragmentDisplayLists = NULL;
128
129 entity->dataBuf.shatteringBlock->originalPosY = entity->pos.y;
130 type = get_entity_type(entity->listIndex);
131
132 if (type == ENTITY_TYPE_HAMMER1_BLOCK_TINY ||
135 {
136 entity->scale.x = 0.5f;
137 entity->scale.y = 0.5f;
138 entity->scale.z = 0.5f;
139 }
140
141 switch (type) {
146 break;
151 break;
156 break;
159 fragmentDisplayLists = Entity_ShatteringBrickBlock_FragmentsRender;
161 break;
168 break;
169 }
170
171 if (fragmentMatrices == NULL) {
172 return;
173 }
174
175 entity_shattering_init_pieces(entity, fragmentDisplayLists, fragmentMatrices);
176}
177
179 EntityBlueprint* bp = NULL;
180
181 switch (get_entity_type(entity->listIndex)) {
184 break;
187 break;
190 break;
193 break;
196 break;
199 break;
202 break;
209 break;
210 }
211
212 if (bp == NULL) {
213 return;
214 }
215
216 create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, 0, MAKE_ENTITY_END);
217}
Mtx Entity_ShatteringHammer2Block_FragmentsMatrices[]
void entity_breakable_block_create_shattering_entity(Entity *entity)
void entity_shattering_block_init(Entity *entity)
EntityModelScript Entity_ShatteringBlock_RenderScript
EntityBlueprint Entity_ShatteringHammer2BlockTiny
Gfx * Entity_ShatteringHammer1Block_FragmentsRender[]
EntityBlueprint Entity_ShatteringHammer1Block
Gfx * Entity_ShatteringHammer2Block_FragmentsRender[]
void entity_shattering_init_pieces(Entity *entity, Gfx **dlists, Mtx *matrices)
Mtx Entity_ShatteringHammer1Block_FragmentsMatrices[]
EntityScript Entity_ShatteringBlock_Script
EntityBlueprint Entity_ShatteringBrickBlock
EntityBlueprint Entity_ShatteringHammer1BlockTiny
Gfx * Entity_ShatteringHammer3Block_FragmentsRender[]
Mtx Entity_ShatteringBrickBlock_FragmentsMatrices[]
Mtx Entity_ShatteringHammer3Block_FragmentsMatrices[]
Gfx Entity_RenderNone[]
Definition Shadow.c:69
EntityBlueprint Entity_ShatteringHammer3Block
EntityBlueprint Entity_ShatteringHammer3BlockTiny
Gfx * Entity_ShatteringBrickBlock_FragmentsRender[]
EntityBlueprint Entity_ShatteringHammer2Block
struct ShatteringBlockData * shatteringBlock
#define sfx_play_sound_at_position
s32 EntityModelScript[]
Definition entity.h:7
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition entity.h:56
#define ENTITY_ROM(name)
Definition entity.h:65
s32 EntityScript[]
Definition entity.h:6
@ ENTITY_TYPE_HAMMER1_BLOCK
Definition enums.h:2564
@ ENTITY_TYPE_SINGLE_TRIGGER_BLOCK
Definition enums.h:2559
@ ENTITY_TYPE_HIDDEN_RED_BLOCK
Definition enums.h:2561
@ ENTITY_TYPE_HAMMER3_BLOCK
Definition enums.h:2566
@ ENTITY_TYPE_HAMMER2_BLOCK
Definition enums.h:2565
@ ENTITY_TYPE_INACTIVE_BLOCK
Definition enums.h:2562
@ ENTITY_TYPE_HAMMER3_BLOCK_TINY
Definition enums.h:2569
@ ENTITY_TYPE_MULTI_COIN_BRICK
Definition enums.h:2557
@ ENTITY_TYPE_BRICK_BLOCK
Definition enums.h:2556
@ ENTITY_TYPE_HAMMER2_BLOCK_TINY
Definition enums.h:2568
@ ENTITY_TYPE_HIDDEN_YELLOW_BLOCK
Definition enums.h:2560
@ ENTITY_TYPE_HAMMER1_BLOCK_TINY
Definition enums.h:2567
@ ENTITY_TYPE_YELLOW_BLOCK
Definition enums.h:2558
@ SOUND_BLOCK_SHATTER
Definition enums.h:775
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
#define MAKE_ENTITY_END
Definition evt.h:107
u32 get_entity_type(s32 arg0)
Definition entity.c:568
s32 create_entity(EntityBlueprint *bp,...)
Definition entity.c:1195
EntityData dataBuf
Vec3f scale
u8 Addr[]
Linker symbol address, as in ld_addrs.h.
Definition types.h:16