mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 23:30:01 +00:00
cleanup
This commit is contained in:
parent
a44510d1df
commit
fe3a3ad8b5
|
@ -394,7 +394,7 @@ CFont::PrintChar(float x, float y, wchar c)
|
||||||
CSprite2d::AddToBuffer(
|
CSprite2d::AddToBuffer(
|
||||||
CRect(x, y,
|
CRect(x, y,
|
||||||
x + 32.0f * RenderState.scaleX * w,
|
x + 32.0f * RenderState.scaleX * w,
|
||||||
y + 32.0f * RenderState.scaleX * 0.5f),
|
y + 32.0f * RenderState.scaleY * 0.5f),
|
||||||
RenderState.color,
|
RenderState.color,
|
||||||
xoff / 16.0f, yoff / 16.0f,
|
xoff / 16.0f, yoff / 16.0f,
|
||||||
(xoff + w) / 16.0f, yoff / 16.0f,
|
(xoff + w) / 16.0f, yoff / 16.0f,
|
||||||
|
@ -811,8 +811,8 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
|
||||||
RenderState.style = Details.style;
|
RenderState.style = Details.style;
|
||||||
}
|
}
|
||||||
|
|
||||||
float dropShadowPosition = CFont::Details.dropShadowPosition;
|
float dropShadowPosition = Details.dropShadowPosition;
|
||||||
if (dropShadowPosition != 0.0f && (CFont::Details.style == FONT_BANK || CFont::Details.style == FONT_STANDARD)) {
|
if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
|
||||||
CRGBA color = Details.color;
|
CRGBA color = Details.color;
|
||||||
Details.color = Details.dropColor;
|
Details.color = Details.dropColor;
|
||||||
Details.dropShadowPosition = 0;
|
Details.dropShadowPosition = 0;
|
||||||
|
@ -828,11 +828,11 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
|
||||||
}
|
}
|
||||||
Details.color = color;
|
Details.color = color;
|
||||||
Details.dropShadowPosition = dropShadowPosition;
|
Details.dropShadowPosition = dropShadowPosition;
|
||||||
Details.bIsShadow = 0;
|
Details.bIsShadow = false;
|
||||||
}
|
}
|
||||||
if (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[1024] - (end - start + 26)) // why 26?
|
if (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - (end - start + 26)) // why 26?
|
||||||
CFont::RenderFontBuffer();
|
RenderFontBuffer();
|
||||||
CFontRenderState* pRenderState = FontRenderStatePointer.pRenderState;
|
CFontRenderState *pRenderState = FontRenderStatePointer.pRenderState;
|
||||||
pRenderState->fTextPosX = x;
|
pRenderState->fTextPosX = x;
|
||||||
pRenderState->fTextPosY = y;
|
pRenderState->fTextPosY = y;
|
||||||
pRenderState->scaleX = Details.scaleX;
|
pRenderState->scaleX = Details.scaleX;
|
||||||
|
@ -994,15 +994,28 @@ CFont::GetStringWidth(wchar *s, bool spaces)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
for (; (*s != ' ' || spaces) && *s != '\0'; s++) {
|
for (wchar c = *s; (c != ' ' || spaces) && c != '\0'; c = *(++s)) {
|
||||||
if (*s == '~') {
|
if (c == '~') {
|
||||||
|
|
||||||
|
// This is original code
|
||||||
|
#if 0
|
||||||
s++;
|
s++;
|
||||||
while (*s != '~') s++;
|
while (*s != '~') {
|
||||||
s++;
|
s++;
|
||||||
if (*s == ' ' && !spaces)
|
}
|
||||||
break;
|
#else
|
||||||
|
// TODO(Miami): This is my code to prevent fuck up until InsertPlayerControlKeysInString is done
|
||||||
|
if (*(s + 1) != '~') {
|
||||||
|
s++;
|
||||||
|
while (*s != '~') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
w += GetCharacterSize(c - ' ');
|
||||||
}
|
}
|
||||||
w += GetCharacterSize(*s - ' ');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
|
@ -1136,7 +1149,7 @@ CFont::ParseToken(wchar *s)
|
||||||
wchar*
|
wchar*
|
||||||
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
{
|
{
|
||||||
Details.anonymous_23 = 0;
|
Details.anonymous_23 = false;
|
||||||
wchar *s = str + 1;
|
wchar *s = str + 1;
|
||||||
if (Details.color.r || Details.color.g || Details.color.b)
|
if (Details.color.r || Details.color.g || Details.color.b)
|
||||||
{
|
{
|
||||||
|
@ -1215,7 +1228,7 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
while (*s != '~')
|
while (*s != '~')
|
||||||
++s;
|
++s;
|
||||||
if (*(++s) == '~')
|
if (*(++s) == '~')
|
||||||
s = CFont::ParseToken(s, color, flash, bold);
|
s = ParseToken(s, color, flash, bold);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,7 +1273,7 @@ CFont::RenderFontBuffer()
|
||||||
color = RenderState.color;
|
color = RenderState.color;
|
||||||
}
|
}
|
||||||
if (*pRenderStateBufPointer.pStr == '~') {
|
if (*pRenderStateBufPointer.pStr == '~') {
|
||||||
pRenderStateBufPointer.pStr = CFont::ParseToken(pRenderStateBufPointer.pStr, color, bFlash, bBold);
|
pRenderStateBufPointer.pStr = ParseToken(pRenderStateBufPointer.pStr, color, bFlash, bBold);
|
||||||
if (bFlash) {
|
if (bFlash) {
|
||||||
if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
|
if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
|
||||||
Details.bFlashState = !Details.bFlashState;
|
Details.bFlashState = !Details.bFlashState;
|
||||||
|
@ -1286,9 +1299,9 @@ CFont::RenderFontBuffer()
|
||||||
PrintChar(textPosX + 2.0f, textPosY, c);
|
PrintChar(textPosX + 2.0f, textPosY, c);
|
||||||
textPosX += 2.0f;
|
textPosX += 2.0f;
|
||||||
}
|
}
|
||||||
textPosX += CFont::RenderState.scaleX * (RenderState.proportional ? Size[RenderState.style][c] : Size[RenderState.style][209]);
|
textPosX += RenderState.scaleX * (RenderState.proportional ? Size[RenderState.style][c] : Size[RenderState.style][209]);
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
textPosX += CFont::RenderState.fExtraSpace;
|
textPosX += RenderState.fExtraSpace;
|
||||||
}
|
}
|
||||||
CSprite2d::RenderVertexBuffer();
|
CSprite2d::RenderVertexBuffer();
|
||||||
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
|
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
|
||||||
|
|
|
@ -27,8 +27,7 @@ struct CFontDetails
|
||||||
uint32 bank;
|
uint32 bank;
|
||||||
int16 dropShadowPosition;
|
int16 dropShadowPosition;
|
||||||
CRGBA dropColor;
|
CRGBA dropColor;
|
||||||
char bFlashState;
|
bool bFlashState;
|
||||||
char anonymous_21;
|
|
||||||
int nFlashTimer;
|
int nFlashTimer;
|
||||||
bool anonymous_23;
|
bool anonymous_23;
|
||||||
uint32 anonymous_25;
|
uint32 anonymous_25;
|
||||||
|
|
|
@ -430,43 +430,26 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float a3, float a4, float a5, float a6, float a7, float a8, float a9, float a10)
|
CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
|
||||||
{
|
{
|
||||||
RwIm2DVertex* v = TempVertexBuffer;
|
SetVertices(&TempVertexBuffer[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2);
|
||||||
SetVertices(
|
RwImVertexIndex *pIndexList = &TempBufferRenderIndexList[nextBufferIndex];
|
||||||
&v[nextBufferVertex],
|
pIndexList[0] = nextBufferVertex;
|
||||||
r,
|
pIndexList[1] = nextBufferVertex + 1;
|
||||||
c,
|
pIndexList[2] = nextBufferVertex + 2;
|
||||||
c,
|
pIndexList[3] = nextBufferVertex + 3;
|
||||||
c,
|
pIndexList[4] = nextBufferVertex;
|
||||||
c,
|
pIndexList[5] = nextBufferVertex + 2;
|
||||||
a3,
|
|
||||||
a4,
|
|
||||||
a5,
|
|
||||||
a6,
|
|
||||||
a7,
|
|
||||||
a8,
|
|
||||||
a9,
|
|
||||||
a10);
|
|
||||||
RwImVertexIndex *v12 = &TempBufferRenderIndexList[nextBufferIndex];
|
|
||||||
v12[0] = nextBufferVertex;
|
|
||||||
v12[1] = nextBufferVertex + 1;
|
|
||||||
v12[2] = nextBufferVertex + 2;
|
|
||||||
v12[3] = nextBufferVertex + 3;
|
|
||||||
v12[4] = nextBufferVertex;
|
|
||||||
v12[5] = nextBufferVertex + 2;
|
|
||||||
nextBufferIndex += 6;
|
nextBufferIndex += 6;
|
||||||
nextBufferVertex += 4;
|
nextBufferVertex += 4;
|
||||||
if (IsVertexBufferFull())
|
if (IsVertexBufferFull())
|
||||||
RenderVertexBuffer();
|
RenderVertexBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSprite2d::IsVertexBufferFull()
|
bool
|
||||||
|
CSprite2d::IsVertexBufferFull()
|
||||||
{
|
{
|
||||||
bool result = true;
|
return (nextBufferVertex > ARRAY_SIZE(TempVertexBuffer)-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6);
|
||||||
if (nextBufferVertex <= 380 && nextBufferIndex <= 1018)
|
|
||||||
result = false;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -12,10 +12,6 @@ public:
|
||||||
|
|
||||||
static void SetRecipNearClip(void);
|
static void SetRecipNearClip(void);
|
||||||
static void InitPerFrame(void);
|
static void InitPerFrame(void);
|
||||||
//static int32 GetBank(int32 n, RwTexture *tex);
|
|
||||||
//static void AddSpriteToBank(int32 bank, const CRect &rect, const CRGBA &col,
|
|
||||||
// float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2);
|
|
||||||
//static void DrawBank(int32 bank);
|
|
||||||
|
|
||||||
CSprite2d(void) : m_pTexture(nil) {};
|
CSprite2d(void) : m_pTexture(nil) {};
|
||||||
~CSprite2d(void) { Delete(); };
|
~CSprite2d(void) { Delete(); };
|
||||||
|
|
Loading…
Reference in a new issue