Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Main 5.2 – Render Number with Thousand Separator (DAMAGE)  (Visto 1077 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline plyn Posteado: July 11, 2025, 11:11:37 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 245
  • Gracias recibida: 769
  • br
Procure: void RenderPoints(BYTE byRenderOneMore) (zzzeffectpoint.cpp)

RenderNumber(o->Position, o->Type, o->Angle, o->Gravity * 0.4f, o->Scale+2.f);
alter
RenderNumberNew(o->Position, o->Type, o->Angle, o->Gravity * 0.4f, o->Scale+2.f);

ou você pode alterar a original.

Code: [Select]
.h
void RenderNumberNew(vec3_t Position, int Num, vec3_t Color, float Alpha = 1.f, float Scale = 15.f);

.cpp
void RenderNumberNew(vec3_t Position, int Num, vec3_t Color, float Alpha, float Scale)
{
vec3_t p;
VectorCopy(Position, p);
vec3_t Light[4];
VectorCopy(Color, Light[0]);
VectorCopy(Color, Light[1]);
VectorCopy(Color, Light[2]);
VectorCopy(Color, Light[3]);

if (Num == -1)
{
float UV[4][2];
TEXCOORD(UV[0], 0.f, 32.f / 32.f);
TEXCOORD(UV[1], 32.f / 256.f, 32.f / 32.f);
TEXCOORD(UV[2], 32.f / 256.f, 17.f / 32.f);
TEXCOORD(UV[3], 0.f, 17.f / 32.f);
RenderSpriteUV(BITMAP_FONT + 1, p, 45, 20, UV, Light, Alpha);
}
else if (Num == -2)
{
RenderSprite(BITMAP_FONT_HIT, p, 32 * Scale, 20 * Scale, Light[0], 0.f, 0.f, 0.f, 27.f / 32.f, 15.f / 16.f);
}
else
{
// ==== Novo código para adicionar separador de milhar ====
char buffer[32];
char formatted[32];
itoa(Num, buffer, 10);

SetConsoleTitleA(buffer);


int len = strlen(buffer);
int j = 0;
int count = 0;

// Percorre de trás para frente inserindo pontos
for (int i = len - 1; i >= 0; i--)
{
if (count && count % 3 == 0)
{
formatted[j++] = '.';  // separador de milhar
}
formatted[j++] = buffer[i];
count++;
}
formatted[j] = '\0';

// Inverte a string formatada para ficar na ordem correta
for (int i = 0; i < j / 2; i++)
{
char temp = formatted[i];
formatted[i] = formatted[j - 1 - i];
formatted[j - 1 - i] = temp;
}

// ==== Renderização ====
p[0] -= strlen(formatted) * 5.f;
unsigned int Length = strlen(formatted);
p[0] -= Length * Scale * 0.125f;
p[1] -= Length * Scale * 0.125f;

for (unsigned int i = 0; i < Length; i++)
{
float UV[4][2];
float u = 0;

if (formatted[i] == '.')
{
// Posição do caractere '.' no sprite font (suponha que esteja na posição 10, ajuste conforme seu bitmap)
u = (float)(10) * 16.f / 256.f;
}
else
{
u = (float)(formatted[i] - '0') * 16.f / 256.f;
}

TEXCOORD(UV[0], u, 16.f / 32.f);
TEXCOORD(UV[1], u + 16.f / 256.f, 16.f / 32.f);
TEXCOORD(UV[2], u + 16.f / 256.f, 0.f);
TEXCOORD(UV[3], u, 0.f);

RenderSpriteUV(BITMAP_FONT + 1, p, Scale, Scale, UV, Light, Alpha);
p[0] += Scale * 0.5f;
p[1] += Scale * 0.5f;
}
}
}




Creditos: newtin

Hisashiburi dana, Mugiwara!

Gracias:


Offline vammu307 #1 Posteado: August 11, 2025, 04:49:48 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 2
  • Gracias recibida: 0
  • vn

Offline plyn #2 Posteado: August 11, 2025, 10:03:25 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 245
  • Gracias recibida: 769
  • br
Hisashiburi dana, Mugiwara!

Gracias:


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
14 Replies
3094 Views
Last post March 07, 2024, 10:21:14 AM
by testaccount
7 Replies
4314 Views
Last post April 29, 2025, 07:46:48 AM
by TheRoyalX
9 Replies
2921 Views
Last post May 23, 2025, 10:27:53 PM
by HayllanderBR
17 Replies
4931 Views
Last post July 11, 2025, 06:14:05 PM
by nujd00
6 Replies
1322 Views
Last post May 13, 2025, 12:40:37 AM
by SPK