I got a 21:9 monitor and tried to play in a few servers to notice the game render badly. Thus I'm posting the proper way to fix gunz camera in wide & ultrawide monitors in the hope that major pservers will fix it.
Sample images:
BEFORE
AFTER
REFERENCE (4:3)
Fixing camera (FOV)
Find for "DEFAULT_FOV" (in entire solution), then add the following line below it
Next find for all ocurrences of "RSetProjection" and replace all calls (A, B and C are figurative names)
by
Congrats you're done fixing the camera! but we're not done yet, this change will mess the ZCombatInterface (the in-game interface) rendering.
Fixing ZCombatInterface
In MDrawContext.h
find
add below it
Go to Mint4R2.h and add below line
the following
Next go to Mint4R2.cpp and add the following lines in the end of the file
Then go to ZCombatInterface.cpp in function"void TextRelative"
find
replace by
In function "void ZCombatInterface::OnDraw" find
replace by
find
replace by
find
replace by
find
replace by
In function "int ZCombatInterface:rawVictory"
find
replace by
find
replace by
find
replace by
find
replace by
find
replace by
In function "void ZCombatInterface:rawScoreBoard"
find
replace by
find
replace by
find
replace by
find
replace by
find
replace by
find
replace by
In function "void ZCombatInterface:rawResultBoard"
find
replace by
find
replace by
find (no it is not wrongly repeated)
replace by
find
replace by
find
replace by
In function "void ZCombatInterface::IconRelative"
find
replace by
Go to file ZScreenEffectManager.cpp in function "void DrawGuage"
find
replace by
Also in ZScreenEffectManager.cpp, your function "bool ZScreenEffect:rawCustom" should look like
if it is different fron the above fix it!
Congrats! you fixed it!
Sample images:
BEFORE
You must be registered to see links
AFTER
You must be registered to see links
REFERENCE (4:3)
You must be registered to see links
Fixing camera (FOV)
Find for "DEFAULT_FOV" (in entire solution), then add the following line below it
Code:
[COLOR=#008000]#define FIXED_FOV(x)
(2. * atan(tan((2. * atan(tan((x) / 2.) / (4./3.))) / 2.) * (RGetScreenWidth()/(float)RGetScreenHeight())))[/COLOR]
Next find for all ocurrences of "RSetProjection" and replace all calls (A, B and C are figurative names)
Code:
[COLOR=#ff0000]RSetProjection(A, B, C);[/COLOR]
by
Code:
[COLOR=#008000]RSetProjection(FIXED_FOV(A), B, C);[/COLOR]
Congrats you're done fixing the camera! but we're not done yet, this change will mess the ZCombatInterface (the in-game interface) rendering.
Fixing ZCombatInterface
In MDrawContext.h
find
Code:
void FillRectangle(const MRECT& r);
Code:
[COLOR=#008000][SIZE=5][SIZE=2]virtual void DrawRelative(float x, float y, float w, float h) = 0;
virtual void DrawRelative(float x, float y, int w, int h) = 0;
virtual int TextRelative(float x, float y, const char* szText) = 0;
virtual void DrawRelative(float x, float y, float w, float h, int sx, int sy, int sw, int sh) = 0;
virtual void FillRectangleRelative(float x, float y, float cx, float cy) = 0;[/SIZE][/SIZE][/COLOR]
Go to Mint4R2.h and add below line
Code:
virtual void FillRectangleW(int x, int y, int cx, int cy);
the following
Code:
[COLOR=#008000]virtual void DrawRelative(float x, float y, float w, float h);
virtual void DrawRelative(float x, float y, int w, int h);
virtual int TextRelative(float x, float y, const char* szText);
virtual void DrawRelative(float x, float y, float w, float h, int sx, int sy, int sw, int sh);
virtual void FillRectangleRelative(float x, float y, float cx, float cy);[/COLOR]
Next go to Mint4R2.cpp and add the following lines in the end of the file
Code:
[COLOR=#008000]void MDrawContextR2::DrawRelative(float x, float y, float w, float h)
{
int correct_w = MGetWorkspaceWidth() / RGetAspect() * (4. / 3.);
int correct_h = MGetWorkspaceHeight();
int start = (MGetWorkspaceWidth() - correct_w) / 2;
float m = correct_w / 800.f;
MDrawContext::Draw(x * correct_w + start, y * correct_h, w * m, h * m);
}
void MDrawContextR2::DrawRelative(float x, float y, int w, int h)
{
int correct_w = MGetWorkspaceWidth() / (RGetScreenWidth()/(float)RGetScreenHeight()) * (4. / 3.);
int correct_h = MGetWorkspaceHeight();
int start = (MGetWorkspaceWidth() - correct_w) / 2;
MDrawContext::Draw(x * correct_w + start, y * correct_h, w, h);
}
int MDrawContextR2::TextRelative(float x, float y, const char* szText)
{
int correct_w = MGetWorkspaceWidth() / (RGetScreenWidth()/(float)RGetScreenHeight()) * (4. / 3.);
int correct_h = MGetWorkspaceHeight();
int start = (MGetWorkspaceWidth() - correct_w) / 2;
return Text(x * correct_w + start, y * correct_h, szText);
}
void MDrawContextR2::DrawRelative(float x, float y, float w, float h, int sx, int sy, int sw, int sh)
{
int correct_w = MGetWorkspaceWidth() / (RGetScreenWidth()/(float)RGetScreenHeight()) * (4. / 3.);
int correct_h = MGetWorkspaceHeight();
int start = (MGetWorkspaceWidth() - correct_w) / 2;
float m = correct_w / 800.f;
MDrawContext::Draw(x * correct_w + start, y * correct_h, w * m, h * m, sx, sy, sw, sh);
}
void MDrawContextR2::FillRectangleRelative(float x, float y, float cx, float cy)
{
int correct_w = MGetWorkspaceWidth() / (RGetScreenWidth()/(float)RGetScreenHeight()) * (4. / 3.);
int correct_h = MGetWorkspaceHeight();
int start = (MGetWorkspaceWidth() - correct_w) / 2;
FillRectangle(x * correct_w + start, y * correct_h, cx * correct_w, cy * correct_h);
}[/COLOR]
Then go to ZCombatInterface.cpp in function"void TextRelative"
find
Code:
[COLOR=#ff0000]int screenx = x*MGetWorkspaceWidth();[/COLOR]
Code:
[COLOR=#008000]int corrected_workspace_w = MGetWorkspaceWidth() / (RGetScreenWidth()/(float)RGetScreenHeight()) * (4. / 3.);
int start = (MGetWorkspaceWidth() - corrected_workspace_w) / 2;
int screenx = x * corrected_workspace_w + start;[/COLOR]
In function "void ZCombatInterface::OnDraw" find
Code:
[COLOR=#ff0000]int nIcon = 50.0f*fRx;
pDC->Draw( 8.0f*fRx, 153.0f*fRy, nIcon, nIcon);[/COLOR]
Code:
[COLOR=#008000]float nIcon = 50.0f;
pDC->DrawRelative(8.0f / 800.f, 153.0f / 600.f, nIcon, nIcon);[/COLOR]
find
Code:
[COLOR=#ff0000]int nIcon = 22.0f*fRx;
pDC->Draw( 60.0f*fRx, 175.0f*fRy, nIcon, nIcon);
pDC->Draw( 53.0f*fRx, 175.0f*fRy, nIcon, nIcon);[/COLOR]
Code:
[COLOR=#008000]float nIcon = 22.0f;
pDC->DrawRelative(60.0f / 800.f, 175.0f / 600.f, nIcon, nIcon);
pDC->DrawRelative(53.0f / 800.f, 175.0f / 600.f, nIcon, nIcon);[/COLOR]
find
Code:
[COLOR=#ff0000]int nPosY = 160.0f*fRy;
pDC->Text( 60.0f*fRx, nPosY, charName[ 0]);[/COLOR]
Code:
[COLOR=#008000]float nPosY = 160.0f / 600.f;
pDC->TextRelative(60.0f / 800.f, nPosY, charName[ 0]);[/COLOR]
find
Code:
[COLOR=#ff0000]nPosY += 20;
pDC->Text( 80.0f*fRx, nPosY, charName[ 1]);
nPosY += 15;[/COLOR]
Code:
[COLOR=#008000]nPosY += 20.f / MGetWorkspaceHeight();
pDC->Text(80.0f/ 800.f, nPosY, charName[ 1]);
nPosY += 15 / MGetWorkspaceHeight();[/COLOR]
In function "int ZCombatInterface:rawVictory"
find
Code:
[COLOR=#ff0000]int nPosX = x * fRx;
int nPosY = y * fRy;
int nSize = 17.0f * fRx;[/COLOR]
Code:
[COLOR=#008000]float nPosX = x / 800.f;
float nPosY = y / 600.f;
float nSize = 17.0f;[/COLOR]
find
Code:
[COLOR=#ff0000]pDC->Draw( nPosX, nPosY, nSize, nSize, nImage, 0, 32, 32);
nPosX -= nSize * 0.63f;[/COLOR]
Code:
[COLOR=#008000]pDC->DrawRelative(nPosX, nPosY, nSize, nSize, nImage, 0, 32, 32);
nPosX -= nSize * 0.63f / 800.f;[/COLOR]
find
Code:
[COLOR=#ff0000]nSize = 19.0f * fRx;
nPosY = ( y - 2) * fRy;[/COLOR]
Code:
[COLOR=#008000]nSize = 19.0f;
nPosY = ( y - 2) / 600.f;[/COLOR]
find
Code:
[COLOR=#ff0000]nPosX -= nSize * 0.2f;
pDC->Draw( nPosX, nPosY, nSize, nSize, nImage, 64, 32, 32);
nPosX -= nSize * 1.1f;[/COLOR]
Code:
[COLOR=#008000]nPosX -= nSize * 0.2f / 800.f;
pDC->DrawRelative(nPosX, nPosY, nSize, nSize, nImage, 64, 32, 32);
nPosX -= nSize * 1.1f / 800.f;[/COLOR]
find
Code:
[COLOR=#ff0000]nSize = 22.0f * fRx;
nPosY = ( y - 5) * fRy;[/COLOR]
Code:
[COLOR=#008000]nSize = 22.0f;
+ nPosY = ( y - 5) / 600.f;[/COLOR]
In function "void ZCombatInterface:rawScoreBoard"
find
Code:
[COLOR=#ff0000]const float fIconSize = .1f;
int nIconSize = fIconSize * MGetWorkspaceWidth();
int screenx=(clancenter-.5f*fIconSize)*MGetWorkspaceWidth();
int screeny=(clany)*MGetWorkspaceHeight();
pDC->Draw(screenx,screeny,nIconSize,nIconSize);[/COLOR]
Code:
[COLOR=#008000]const float fIconSize = .1f * 800.f;
pDC->DrawRelative(clancenter - 0.5f * fIconSize, clany, fIconSize, fIconSize);[/COLOR]
find
Code:
[COLOR=#ff0000]int y1 = itemy * MGetWorkspaceHeight();
int y2 = (y + linespace * nCount) * MGetWorkspaceHeight();[/COLOR]
Code:
[COLOR=#008000]float y1 = itemy;
float y2 = y + linespace * nCount;[/COLOR]
find
Code:
[COLOR=#ff0000]int x1 = bClanGame ? 0.43*MGetWorkspaceWidth() : 0.255*MGetWorkspaceWidth();
int x2 = (0.715+0.26)*MGetWorkspaceWidth();
pDC->SetColor(backgroundcolor);
pDC->FillRectangle(x1,y1,x2-x1,y2-y1);
pDC->FillRectangleRelative(x1,y1,x2-x1,y2-y1);[/COLOR]
Code:
[COLOR=#008000]float x1 = bClanGame ? 0.43 : 0.255;
float x2 = 0.715 + 0.26;
pDC->SetColor(backgroundcolor);
pDC->FillRectangleRelative(x1,y1,x2-x1,y2-y1);[/COLOR]
find
Code:
[COLOR=#ff0000]int screenx = ( ITEM_XPOS[0] - 0.024f) * MGetWorkspaceWidth();
int screeny = icony * MGetWorkspaceHeight();
pDC->Draw( screenx, screeny, nIconSize+4, nIconSize);[/COLOR]
Code:
[COLOR=#008000]float iconx = ITEM_XPOS[0] - 0.024f;
pDC->DrawRelative(iconx, icony, nIconSize+4, nIconSize);[/COLOR]
find
Code:
[COLOR=#ff0000]int screenx=x*MGetWorkspaceWidth();
int screeny=icony*MGetWorkspaceHeight();
pDC->Draw(screenx,screeny,nIconSize,nIconSize);[/COLOR]
Code:
[COLOR=#008000]pDC->DrawRelative(x, icony, nIconSize, nIconSize);[/COLOR]
find
Code:
[COLOR=#ff0000]float inv_h = 1.f / MGetWorkspaceHeight();
pDC->SetColor( MCOLOR( 0x40FF0000));
pDC->FillRectangle( (x*MGetWorkspaceWidth()), texty*MGetWorkspaceHeight()+1, 0.08*MGetWorkspaceWidth(), 7);
pQuestPlayerInfo->GetProperty()->fMaxHP;
pDC->SetColor( MCOLOR( 0x90FF0000));
pDC->FillRectangle( (x*MGetWorkspaceWidth()), texty*MGetWorkspaceHeight()+1, nValue*MGetWorkspaceWidth(), 7);
pDC->SetColor( MCOLOR( 0x4000FF00));
pDC->FillRectangle( (x*MGetWorkspaceWidth()), texty*MGetWorkspaceHeight()+9, 0.08*MGetWorkspaceWidth(), 3);
pQuestPlayerInfo->GetProperty()->fMaxAP;
pDC->SetColor( MCOLOR( 0x9000FF00));
pDC->FillRectangle( (x*MGetWorkspaceWidth()), texty*MGetWorkspaceHeight()+9, nValue*MGetWorkspaceWidth(), 3);[/COLOR]
Code:
[COLOR=#008000]float inv_h = 1.f / MGetWorkspaceHeight();
pDC->SetColor( MCOLOR( 0x40FF0000));
pDC->FillRectangleRelative(x, texty + inv_h, 0.08, 7.f * inv_h);
float nValue = 0.08 * pQuestPlayerInfo->GetHP() / pQuestPlayerInfo->GetProperty()->fMaxHP;
pDC->SetColor( MCOLOR( 0x90FF0000));
pDC->FillRectangle(x, texty + inv_h, nValue, 7.f * inv_h);
pDC->SetColor( MCOLOR( 0x4000FF00));
pDC->FillRectangle(x, texty + 9.f * inv_h, 0.08, 3.f * inv_h);
nValue = 0.08 * pQuestPlayerInfo->GetAP() / pQuestPlayerInfo->GetProperty()->fMaxAP;
pDC->SetColor( MCOLOR( 0x9000FF00));
pDC->FillRectangle(x, texty + 9.f * inv_h, nValue, 3.f * inv_h);[/COLOR]
In function "void ZCombatInterface:rawResultBoard"
find
Code:
[COLOR=#ff0000]int y1,y2;[/COLOR]
Code:
[COLOR=#008000]float y1, y2;[/COLOR]
find
Code:
[COLOR=#ff0000]y1 = itemy * MGetWorkspaceHeight();
y2 = (y + linespace * nLeft) * MGetWorkspaceHeight();[/COLOR]
Code:
[COLOR=#008000]y1 = itemy;
y2 = (y + linespace * nLeft);[/COLOR]
find (no it is not wrongly repeated)
Code:
[COLOR=#ff0000]y1 = itemy * MGetWorkspaceHeight();
y2 = (y + linespace * nRight) * MGetWorkspaceHeight();[/COLOR]
Code:
[COLOR=#008000]y1 = itemy;
y2 = (y + linespace * nRight);[/COLOR]
find
Code:
[COLOR=#ff0000]pDC->FillRectangle(
(x-.01f)*MGetWorkspaceWidth(),y1,
.44f*MGetWorkspaceWidth(),y2-y1);[/COLOR]
Code:
[COLOR=#008000]pDC->FillRectangleRelative(x - 0.01f, y1, 0.44f, y2 - y1);[/COLOR]
find
Code:
[COLOR=#ff0000]int y1 = itemy * MGetWorkspaceHeight();
int y2 = (y + linespace * nCount) * MGetWorkspaceHeight();
pDC->FillRectangle(
0.022f*MGetWorkspaceWidth(),y1,
0.960*MGetWorkspaceWidth(),y2-y1);[/COLOR]
Code:
[COLOR=#008000]int y1 = itemy * MGetWorkspaceHeight();
float y1 = itemy;
float y2 = (y + linespace * nCount);
pDC->FillRectangleRelative(0.022f, y1, 0.960, y2 - y1);[/COLOR]
In function "void ZCombatInterface::IconRelative"
find
Code:
[COLOR=#ff0000]pDC->SetBitmap(pbmp);
int screenx=x*MGetWorkspaceWidth();
int screeny=y*MGetWorkspaceHeight();
int nSize=pDC->GetFont()->GetHeight();
pDC->Draw(screenx,screeny,nSize,nSize);[/COLOR]
Code:
[COLOR=#008000]pDC->SetBitmap(pbmp);
int nSize=pDC->GetFont()->GetHeight();
pDC->DrawRelative(x, y, nSize, nSize);[/COLOR]
Go to file ZScreenEffectManager.cpp in function "void DrawGuage"
find
Code:
[COLOR=#ff0000]int x1,y1,x2,y2;
x1=x*(float)MGetWorkspaceWidth();
y1=y*(float)MGetWorkspaceHeight();
x2=(x+fWidth)*(float)MGetWorkspaceWidth();
y2=(y+fHeight)*(float)MGetWorkspaceHeight();[/COLOR]
Code:
[COLOR=#008000]int corrected_workspace_w = MGetWorkspaceWidth() / RGetAspect() * (4. / 3.);
int start = (MGetWorkspaceWidth() - corrected_workspace_w) / 2;
int x1,y1,x2,y2;
x1=x * corrected_workspace_w + start;
y1=y*(float)MGetWorkspaceHeight();
x2=(x+fWidth) * corrected_workspace_w + start;
y2=(y+fHeight)*(float)MGetWorkspaceHeight();[/COLOR]
Also in ZScreenEffectManager.cpp, your function "bool ZScreenEffect:rawCustom" should look like
Code:
[COLOR=#008000]bool ZScreenEffect::DrawCustom(unsigned long int nTime, const rvector& vOffset, float fAngle)
{
RGetDevice()->SetRenderState(D3DRS_ZENABLE, FALSE);
RGetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
rmatrix World;
GetIdentityMatrix(World);
if (fAngle != 0.0f)
{
World = RGetRotZ(fAngle);
}
const rvector eye(0, 0, -650), at(0, 0, 0), up(0, 1, 0);
auto View = ViewMatrix(eye, Normalized(at - eye), up);
auto Offset = TranslationMatrix(vOffset);
View = Offset * View;
RSetTransform(D3DTS_VIEW, View);
m_VMesh.SetWorldMatrix(World);
m_VMesh.Render();
if(m_VMesh.isOncePlayDone()) {
return false;
}
return true;
}[/COLOR]
Congrats! you fixed it!
Last edited: