diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2021-12-02 11:06:50 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-02 11:06:50 -0800 |
| commit | 9a7760356048e3c7a9b39a5c19f8718fa42c33a2 (patch) | |
| tree | 12c0d09de17a08c6790ef6846223cd9340b84d5d /src | |
| parent | 0f13e4faffac5279726811819bdd673865240a2c (diff) | |
| parent | fc20ec78fc9d01c2a7030d48fa3a3c0cfdc5902d (diff) | |
Merge pull request #204 from jorundev/master
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/fireplace.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/object/fireplace.c b/src/object/fireplace.c new file mode 100644 index 00000000..fe2dc0d6 --- /dev/null +++ b/src/object/fireplace.c @@ -0,0 +1,51 @@ +#include "entity.h" +#include "functions.h" +#include "player.h" +#include "script.h" +#include "flags.h" +#include "room.h" + +extern void (*gUnk_08123D98[])(Entity*); + +void sub_0809B7A0(Entity* e); +void sub_0809B7DC(Entity* this); +void sub_0809B7C0(Entity* this); + +void Fireplace(Entity* e) { + gUnk_08123D98[e->action](e); +} + +void sub_0809B708(Entity* this) { + this->action = 1; + this->spriteSettings.draw = 1; + this->speed = 0x80; + if (CheckFlags(this->field_0x86.HWORD)) { + sub_0809B7DC(this); + DeleteThisEntity(); + } else { + sub_0807B7D8(0x30b, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); + SetTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + } + sub_0809B7A0(this); +} + +void sub_0809B7A0(Entity* this) { + sub_0809B7C0(this); + if (this->actionDelay) { + SetFlag(this->field_0x86.HWORD); + DeleteThisEntity(); + } +} + +void sub_0809B7C0(Entity* this) { + u32 tileType = GetTileTypeByEntity(this); + if (tileType != 0x4061 && tileType != 0x4062) { + sub_0809B7DC(this); + } +} + +void sub_0809B7DC(Entity* this) { + sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); + SetTile(0x4062, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + this->actionDelay = 1; +} |
