1#include "Game/Screen/SubMeterLayout.hpp"
2#include "Game/Util.hpp"
4SubMeterLayout::SubMeterLayout(
const char *pName,
const char *pLayoutName) :
LayoutActor(pName, true) {
5 MR::connectToSceneLayout(
this);
6 initLayoutManager(pLayoutName, 1);
7 MR::createAndAddPaneCtrl(
this,
"Count", 1);
11 MR::startPaneAnim(
this,
"Count",
"Count", 0);
12 MR::setPaneAnimFrameAndStop(
this,
"Count", 0.0f, 0);
19void SubMeterLayout::setLifeRatio(f32 ratio) {
20 f32 mult = 128.0f * ratio;
22 MR::setPaneAnimFrameAndStop(
this,
"Count", 0x80 - _22, 0);
25void SubMeterLayout::requestDeactivate() {
30void SubMeterLayout::requestAppear() {
32 MR::startAnim(
this,
"Appear",
nullptr);
37void SubMeterLayout::requestFrameIn() {
39 MR::startAnim(
this,
"Appear", 0);
44void SubMeterLayout::requestFrameOut() {
45 MR::startAnim(
this,
"End", 0);
49void SubMeterLayout::control() {
54 if (MR::isAnimStopped(
this, 0)) {
55 MR::startAnim(
this,
"Wait", 0);
62 MR::startAnim(
this,
"Danger", 0);
68 MR::startAnim(
this,
"Wait", 0);
69 MR::setAnimRate(
this, 1.0f, 0);
73 MR::setAnimRate(
this, ((0x40 - _22) * 1.0f / 32.0f) + 1.0f, 0);
77 if (MR::isAnimStopped(
this, 0)) {
86 if (!MR::isPlayerInWaterMode()) {
87 if (!MR::isOnGroundPlayer()) {
92 if (!MR::isPlayerOnWaterSurface()) {
98 if (((_20 + 0xFE) & 0xFF) <= 1u && _22 == 0x80) {
100 MR::startAnim(
this,
"End", 0);
108 MR::startAnim(
this,
"Appear", 0);
111 if (!MR::isHiddenLayout(
this)) {
113 MR::calcScreenPosition(&screenPos, *MR::getPlayerPos());
114 screenPos.x += sScreenOffsetX;
115 screenPos.y += sScreenOffsetY;
120SubMeterLayout::~SubMeterLayout() {
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.