|
4 | 4 | #include "game.h" |
5 | 5 | #include "sfx.h" |
6 | 6 |
|
7 | | -static u8 anim_1[] = {3, 14, 4, 15, 4, 16, 4, 17, 4, 18, 4, 19, 3, 20}; |
8 | | -static u8 anim_2[] = {3, 21, 4, 22, 4, 23, 4, 24, 4, 25, 4, 26, 3, 27}; |
| 7 | +#define BREAKABLE_ZPRIORITY 176 |
| 8 | +#define NO_HITBOX_STATE |
9 | 9 |
|
10 | | -static u8* g_eBreakableAnimations[] = { |
11 | | - anim_1, anim_2, NULL, NULL, NULL, NULL, NULL, NULL}; |
12 | | -static u8 g_eBreakableHitboxes[] = {12, 20, 0, 0, 0, 0, 0, 0}; |
13 | | - |
14 | | -static u8 g_eBreakableExplosionTypes[] = {3, 3, 0, 0, 0, 0, 0, 0}; |
15 | | - |
16 | | -static u16 g_eBreakableanimSets[] = { |
17 | | - ANIMSET_OVL(1), ANIMSET_OVL(1), 0, 0, 0, 0, 0, 0, |
18 | | -}; |
19 | | - |
20 | | -static u8 g_eBreakableDrawModes[] = { |
21 | | - DRAW_TPAGE | DRAW_TPAGE2, |
22 | | - DRAW_TPAGE | DRAW_TPAGE2, |
23 | | - DRAW_DEFAULT, |
24 | | - DRAW_DEFAULT, |
25 | | - DRAW_DEFAULT, |
26 | | - DRAW_DEFAULT, |
27 | | - DRAW_DEFAULT, |
28 | | - DRAW_DEFAULT, |
29 | | -}; |
30 | | - |
31 | | -static s16 xyOffsets[] = { |
32 | | - -4, -4, 3, -6, 2, 9, -4, 12, 0, 2, 0, 15, 0, 31, |
33 | | -}; |
34 | | - |
35 | | -void EntityBreakable(Entity* self) { |
36 | | - Entity* newEntity; |
37 | | - u16* ptr; |
38 | | - s32 j; |
39 | | - s32 i; |
40 | | - u16 breakableType = self->params >> 0xC; |
41 | | - |
42 | | - if (self->step == 0) { |
43 | | - InitializeEntity(OVL_EXPORT(EInitBreakable)); |
44 | | - self->zPriority = 0xB0; |
45 | | - self->drawMode = g_eBreakableDrawModes[breakableType]; |
46 | | - newEntity = &self[1]; |
47 | | - self->hitboxHeight = g_eBreakableHitboxes[breakableType]; |
48 | | - self->animSet = g_eBreakableanimSets[breakableType]; |
49 | | - DestroyEntity(newEntity); |
50 | | - CreateEntityFromEntity(E_BACKGROUND_BLOCK, self, newEntity); |
51 | | - if (breakableType != 0) { |
52 | | - self[1].posY.i.hi -= 32; |
53 | | - } else { |
54 | | - self[1].posY.i.hi -= 16; |
55 | | - } |
56 | | - newEntity->params = 1; |
57 | | - } |
58 | | - |
59 | | - AnimateEntity(g_eBreakableAnimations[breakableType], self); |
60 | | - |
61 | | - if (self->hitParams) { |
62 | | - g_api.PlaySfx(SFX_CANDLE_HIT); |
63 | | - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); |
64 | | - if (newEntity != 0) { |
65 | | - CreateEntityFromCurrentEntity(E_EXPLOSION, newEntity); |
66 | | - newEntity->params = |
67 | | - g_eBreakableExplosionTypes[breakableType] | 0x10; |
68 | | - } |
69 | | - |
70 | | - for (ptr = &xyOffsets, i = 0; i < 4; i++) { |
71 | | - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); |
72 | | - if (newEntity != 0) { |
73 | | - CreateEntityFromEntity(E_BREAKABLE_UNK0, self, newEntity); |
74 | | - newEntity->posX.i.hi += *ptr; |
75 | | - ptr++; |
76 | | - newEntity->posY.i.hi = newEntity->posY.i.hi + *ptr; |
77 | | - ptr++; |
78 | | - if (breakableType != 0) { |
79 | | - newEntity->posY.i.hi -= 20; |
80 | | - } |
81 | | - newEntity->params = i; |
82 | | - } |
83 | | - } |
84 | | - |
85 | | - if (breakableType != 0) { |
86 | | - for (j = 0; j < 3; j++) { |
87 | | - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); |
88 | | - if (newEntity != 0) { |
89 | | - CreateEntityFromEntity(E_BREAKABLE_UNK0, self, newEntity); |
90 | | - newEntity->posX.i.hi += *ptr; |
91 | | - ptr++; |
92 | | - newEntity->posY.i.hi += *ptr; |
93 | | - ptr++; |
94 | | - newEntity->params = j + 4; |
95 | | - } |
96 | | - } |
97 | | - } |
98 | | - ReplaceBreakableWithItemDrop(self); |
99 | | - DestroyEntity(&self[1]); |
100 | | - } |
101 | | -} |
| 10 | +// These functions are unused since there are no breakables in CEN |
| 11 | +#include "../e_breakable_with_lighting.h" |
0 commit comments