Files
tp/src/d/d_kantera_icon_meter.cpp
T
Luke Street 6a48380461 More GCC compatibility/warning fixes (#3118)
* Wrap >4-char literals in a MULTI_CHAR macro

Modern compilers do not support CW's non-standard behavior with
>4 char literals. We can, however, use a constexpr function to
compute the u64 values directly. This leaves <=4 char literals
unchanged.

* Replace non-pointer usages of NULL with 0

* Define NULL to nullptr on C++11 and above

* Fix more -Wpointer-arith and -Woverflow warnings

* Replace u32/s32 with uintptr_t/intptr_t where appropriate

* JSUOutputStream: Overload all standard int types
2026-02-28 20:19:17 -08:00

62 lines
1.6 KiB
C++

#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_kantera_icon_meter.h"
#include "JSystem/J2DGraph/J2DGrafContext.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "d/d_com_inf_game.h"
#include "d/d_meter_HIO.h"
#include "d/d_pane_class.h"
dKantera_icon_c::dKantera_icon_c() {
initiate();
}
dKantera_icon_c::~dKantera_icon_c() {
delete mpKanteraIcon->getScreen();
delete mpKanteraIcon;
mpKanteraIcon = NULL;
delete mpParent;
mpParent = NULL;
delete mpGauge;
mpGauge = NULL;
}
void dKantera_icon_c::initiate() {
mpKanteraIcon = new dDlst_KanteraIcon_c();
J2DScreen* scrn = new J2DScreen();
scrn->setPriority("zelda_kantera_icon_mater.blo", 0x20000, dComIfGp_getMain2DArchive());
dPaneClass_showNullPane(scrn);
mpKanteraIcon->setScreen(scrn);
mpParent = new CPaneMgr(scrn, MULTI_CHAR('kan_m_n'), 2, NULL);
mpGauge = new CPaneMgr(scrn, MULTI_CHAR('yellow_m'), 0, NULL);
}
void dKantera_icon_c::setAlphaRate(f32 alphaRate) {
mpParent->setAlphaRate(alphaRate);
}
void dKantera_icon_c::setPos(f32 x, f32 y) {
mpParent->translate(x + g_drawHIO.mLanternIconMeterPosX, y + g_drawHIO.mLanternIconMeterPosY);
}
void dKantera_icon_c::setScale(f32 h, f32 v) {
mpParent->scale(h * g_drawHIO.mLanternIconMeterSize, v * g_drawHIO.mLanternIconMeterSize);
}
void dKantera_icon_c::setNowGauge(u16 h, u16 v) {
mpGauge->scale((f32)v / (f32)h, 1.0f);
}
void dDlst_KanteraIcon_c::draw() {
J2DGrafContext* curGraf = dComIfGp_getCurrentGrafPort();
curGraf->setup2D();
mp_scrn->draw(0.0f, 0.0f, curGraf);
}
dDlst_KanteraIcon_c::~dDlst_KanteraIcon_c() {}