diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2022-05-01 11:43:19 +0200 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2022-05-18 13:07:06 +0200 |
| commit | 60e33b636d7b9dca767b3833ee39affcc626f420 (patch) | |
| tree | 51d7752fb76f5044028c56404f75c780783d8002 /src/manager/fallingItemManager.c | |
| parent | 3afbd0e9012be95e687ccb36eb62f6df08cded19 (diff) | |
Rename managers
Diffstat (limited to 'src/manager/fallingItemManager.c')
| -rw-r--r-- | src/manager/fallingItemManager.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c new file mode 100644 index 00000000..966a5702 --- /dev/null +++ b/src/manager/fallingItemManager.c @@ -0,0 +1,45 @@ +/** + * @file fallingItemManager.c + * @ingroup Managers + * + * @brief Item that is falling from the sky. + * + * If you leave the room without picking the item up and enter again, the item falls from the sky again. + */ +#include "manager/fallingItemManager.h" +#include "flags.h" +#include "object.h" +#include "room.h" + +void FallingItemManager_Init(FallingItemManager*); +void FallingItemManager_Action1(FallingItemManager*); + +void FallingItemManager_Main(FallingItemManager* this) { + static void (*const FallingItemManager_Actions[])(FallingItemManager*) = { + FallingItemManager_Init, + FallingItemManager_Action1, + }; + FallingItemManager_Actions[super->action](this); +} + +void FallingItemManager_Init(FallingItemManager* this) { + super->action = 1; + if (CheckFlags(this->field_0x3c)) { + DeleteThisEntity(); + } + FallingItemManager_Action1(this); +} + +void FallingItemManager_Action1(FallingItemManager* this) { + if (CheckFlags(this->field_0x3e)) { + Entity* object = CreateObject(GROUND_ITEM, super->type, super->type2); + if (object != NULL) { + object->timer = this->field_0x35; + object->collisionLayer = this->field_0x36; + object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; + object->y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; + object->field_0x86.HWORD = this->field_0x3c; + } + DeleteThisEntity(); + } +} |
