refactor: extreure helpers per reduir complexitat cognitiva (tidy net)

This commit is contained in:
2026-05-16 16:13:57 +02:00
parent b984e6041e
commit e1bc1b597f
31 changed files with 1145 additions and 1332 deletions
+16 -16
View File
@@ -1,8 +1,8 @@
#include "game/marcador.hpp"
Marcador::Marcador(Jd8::Surface gfx, Prota* sam) {
this->gfx = gfx;
this->sam = sam;
this->gfx_ = gfx;
this->sam_ = sam;
}
void Marcador::draw() {
@@ -15,47 +15,47 @@ void Marcador::draw() {
this->pintaNumero(156, 2, (Info::ctx.diners % 100) / 10);
this->pintaNumero(163, 2, Info::ctx.diners % 10);
if (this->sam->pergami) {
Jd8::blitCK(190, 1, this->gfx, 209, 185, 15, 14, 255);
if (this->sam_->pergami) {
Jd8::blitCK(190, 1, this->gfx_, 209, 185, 15, 14, 255);
}
Jd8::blitCK(271, 1, this->gfx, 0, 20, 15, Info::ctx.vida * 3, 255);
Jd8::blitCK(271, 1, this->gfx_, 0, 20, 15, Info::ctx.vida * 3, 255);
if (Info::ctx.vida < 5) {
Jd8::blitCK(271, 1 + (Info::ctx.vida * 3), this->gfx, 75, 20, 15, 15 - (Info::ctx.vida * 3), 255);
Jd8::blitCK(271, 1 + (Info::ctx.vida * 3), this->gfx_, 75, 20, 15, 15 - (Info::ctx.vida * 3), 255);
}
}
void Marcador::pintaNumero(Uint16 x, Uint16 y, Uint8 num) {
switch (num) {
case 0:
Jd8::blitCK(x, y, this->gfx, 141, 193, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 141, 193, 10, 7, 255);
break;
case 1:
Jd8::blitCK(x, y, this->gfx, 100, 185, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 100, 185, 10, 7, 255);
break;
case 2:
Jd8::blitCK(x, y, this->gfx, 110, 185, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 110, 185, 10, 7, 255);
break;
case 3:
Jd8::blitCK(x, y, this->gfx, 120, 185, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 120, 185, 10, 7, 255);
break;
case 4:
Jd8::blitCK(x, y, this->gfx, 130, 185, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 130, 185, 10, 7, 255);
break;
case 5:
Jd8::blitCK(x, y, this->gfx, 140, 185, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 140, 185, 10, 7, 255);
break;
case 6:
Jd8::blitCK(x, y, this->gfx, 101, 193, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 101, 193, 10, 7, 255);
break;
case 7:
Jd8::blitCK(x, y, this->gfx, 111, 193, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 111, 193, 10, 7, 255);
break;
case 8:
Jd8::blitCK(x, y, this->gfx, 121, 193, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 121, 193, 10, 7, 255);
break;
case 9:
Jd8::blitCK(x, y, this->gfx, 131, 193, 10, 7, 255);
Jd8::blitCK(x, y, this->gfx_, 131, 193, 10, 7, 255);
break;
default:
break;