| 1 | #include "Library/Play/Layout/SimplePopupMessageLayout.h" |
| 2 | |
| 3 | #include "Library/Layout/LayoutActionFunction.h" |
| 4 | #include "Library/Layout/LayoutActor.h" |
| 5 | #include "Library/Layout/LayoutActorUtil.h" |
| 6 | #include "Library/Layout/LayoutInitInfo.h" |
| 7 | #include "Library/Nerve/NerveSetupUtil.h" |
| 8 | #include "Library/Nerve/NerveUtil.h" |
| 9 | #include "Library/Screen/ScreenFunction.h" |
| 10 | |
| 11 | namespace { |
| 12 | using namespace al; |
| 13 | NERVE_HOST_TYPE_IMPL(SimplePopupMessageLayout, Appear); |
| 14 | NERVE_HOST_TYPE_IMPL(SimplePopupMessageLayout, End); |
| 15 | NERVE_HOST_TYPE_IMPL(SimplePopupMessageLayout, Wait); |
| 16 | |
| 17 | NERVES_MAKE_NOSTRUCT(HostType, End); |
| 18 | NERVES_MAKE_STRUCT(HostType, Appear, Wait); |
| 19 | } // namespace |
| 20 | |
| 21 | namespace al { |
| 22 | |
| 23 | SimplePopupMessageLayout::(const char* name, const char* layoutName, |
| 24 | const LayoutInitInfo& info, |
| 25 | const char* archiveName, bool localize) |
| 26 | : LayoutActor(name) { |
| 27 | if (localize) |
| 28 | initLayoutActorLocalized(this, info, layoutName, archiveName); |
| 29 | else |
| 30 | initLayoutActor(this, info, layoutName, archiveName); |
| 31 | initNerve(&NrvHostType.Appear, 0); |
| 32 | } |
| 33 | |
| 34 | void SimplePopupMessageLayout::() { |
| 35 | startAction(layout: this, actionName: "Appear" , paneName: nullptr); |
| 36 | LayoutActor::appear(); |
| 37 | setNerve(user: this, nerve: &NrvHostType.Appear); |
| 38 | } |
| 39 | |
| 40 | void SimplePopupMessageLayout::() { |
| 41 | if (!isNerve(user: this, nerve: &End)) |
| 42 | setNerve(user: this, nerve: &End); |
| 43 | } |
| 44 | |
| 45 | void SimplePopupMessageLayout::() { |
| 46 | startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 47 | LayoutActor::appear(); |
| 48 | setNerve(user: this, nerve: &NrvHostType.Wait); |
| 49 | } |
| 50 | |
| 51 | void SimplePopupMessageLayout::() { |
| 52 | refreshPos(); |
| 53 | |
| 54 | if (isActionEnd(layout: this, paneName: nullptr)) |
| 55 | setNerve(user: this, nerve: &NrvHostType.Wait); |
| 56 | } |
| 57 | |
| 58 | void SimplePopupMessageLayout::() { |
| 59 | sead::Vector2f layoutPos = sead::Vector2f::zero; |
| 60 | calcLayoutPosFromWorldPos(output: &layoutPos, this, mWorldPos); |
| 61 | setLocalTrans(this, layoutPos); |
| 62 | } |
| 63 | |
| 64 | void SimplePopupMessageLayout::() { |
| 65 | refreshPos(); |
| 66 | |
| 67 | if (isFirstStep(user: this)) |
| 68 | startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 69 | if (mLifetime >= 0 && isGreaterEqualStep(user: this, step: mLifetime)) |
| 70 | setNerve(user: this, nerve: &End); |
| 71 | } |
| 72 | |
| 73 | void SimplePopupMessageLayout::() { |
| 74 | refreshPos(); |
| 75 | |
| 76 | if (isFirstStep(user: this)) |
| 77 | startAction(layout: this, actionName: "End" , paneName: nullptr); |
| 78 | if (isActionEnd(layout: this, paneName: nullptr)) |
| 79 | kill(); |
| 80 | } |
| 81 | |
| 82 | bool SimplePopupMessageLayout::() const { |
| 83 | return isNerve(user: this, nerve: &NrvHostType.Wait); |
| 84 | } |
| 85 | |
| 86 | bool SimplePopupMessageLayout::() const { |
| 87 | return isWait() || isNerve(user: this, nerve: &NrvHostType.Appear); |
| 88 | } |
| 89 | |
| 90 | } // namespace al |
| 91 | |