• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Enable Widescreen Support

Status
Not open for further replies.
Custom Title Activated
Loyal Member
Joined
Feb 18, 2012
Messages
1,433
Reaction score
391
This will enable all Resolutions possible within the Options in the Resolutions tab such as 1920x1080p.

Okay, here we go!

First:
Open MFeatureDefine.h:
Add this at the bottom of the page under #endif
Code:
#define _EXTRESOLUTION 1

Next:
Open ZOptionInterace.cpp:
Find:
Code:
if( REnumAdapterMode( D3DADAPTER_DEFAULT,format[i], idm,  &ddm ))
                    {
                        if( ddm.Width < 640 || ddm.Height < 480 )
                            continue;


                        if( ((float)ddm.Height / (float)ddm.Width  != 0.75f) &&  
                            ((float)ddm.Height / (float)ddm.Width  != 0.625f) )
                            continue;


                        ddm.RefreshRate = DEFAULT_REFRESHRATE;

Replace with:
Code:
if( REnumAdapterMode( D3DADAPTER_DEFAULT,format[i], idm,  &ddm ))
                    {
#ifndef _EXTRESOLUTION
                        if( ddm.Width < 640 || ddm.Height < 480 )
                            continue;
 
                        if( ((float)ddm.Height / (float)ddm.Width  != 0.75f) &&  
                            ((float)ddm.Height / (float)ddm.Width  != 0.625f) )
                            continue;
#else
                        //The values here are your minimum resolution. Change them if you want to force a higher resolution. 640x480 is the default, 800x600 is what I like to use.
                        if( ddm.Width < 640 || ddm.Height < 480 )
                            continue;
#endif
                        ddm.RefreshRate = DEFAULT_REFRESHRATE;

Next:
Open ZScreenEffectManager:
Find:
Code:
bool ZScreenEffect::DrawCustom(unsigned long int nTime, rvector& vOffset, float fAngle)

Replace that whole section with this:
Code:
bool ZScreenEffect::DrawCustom(unsigned long int nTime, rvector& vOffset, float fAngle)
{
        RGetDevice()->SetRenderState(D3DRS_ZENABLE, FALSE);
        RGetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
 
        rmatrix World;
        D3DXMatrixIdentity(&World);
 
        if (fAngle != 0.0f)
        {
                D3DXMatrixRotationZ(&World, fAngle);
        }
 
        rmatrix View,Offset,Scale;
        D3DXMatrixIdentity(&Scale);
#ifndef _EXTRESOLUTION
        if(RGetIsWidthScreen())
        {
                const rvector eye(0,0,-780),at(0,0,0),up(0,1,0);
                D3DXMatrixLookAtLH(&View,&eye,&at,&up);
        }
#else
        if (RGetWidthScreen() != 0.75f)
        {
                const rvector eye(0,0, -(975.0f/RGetWidthScreen()/2)),at(0,0,0),up(0,1,0);
                D3DXMatrixLookAtLH(&View,&eye,&at,&up);
                D3DXMatrixScaling(&Scale, (float)RGetScreenWidth() / ((float)RGetScreenHeight() * (4.0f/3.0f)), 1, 1);
        }
#endif
        else
        {
                const rvector eye(0,0,-650),at(0,0,0),up(0,1,0);
                D3DXMatrixLookAtLH(&View,&eye,&at,&up);
        }
        D3DXMatrixTranslation(&Offset,vOffset.x,vOffset.y,vOffset.z);
 
        View=Offset*View;
        View=Scale*View;
 
        RGetDevice()->SetTransform( D3DTS_VIEW, &View );
 
        m_VMesh.SetWorldMatrix(World);
        //      m_VMesh.Frame();
        m_VMesh.Render();
 
        if(m_VMesh.isOncePlayDone()) {
                return false;
        }
 
        return true;
}

Next:
Find:
Code:
bool ZScreenEffectLetterBox::Draw(unsigned long int nTime)

Also Replace that whole section with this:
Code:
bool ZScreenEffectLetterBox::Draw(unsigned long int nTime)
{
        RGetDevice()->SetRenderState(D3DRS_ZENABLE, FALSE);
        RGetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
 
        rmatrix World;
        D3DXMatrixIdentity(&World);
 
        rmatrix View,Offset;
#ifndef _EXTRESOLUTION
        if(RGetIsWidthScreen())
        {
                const rvector eye(0,0,-780),at(0,0,0),up(0,1,0);
                D3DXMatrixLookAtLH(&View,&eye,&at,&up);
                m_VMesh.SetScale(rvector(5,1,1));
        }
        else
#endif
        {
                const rvector eye(0,0,-650),at(0,0,0),up(0,1,0);
                D3DXMatrixLookAtLH(&View,&eye,&at,&up);
        }
 
        RGetDevice()->SetTransform( D3DTS_VIEW, &View );
 
        m_VMesh.SetWorldMatrix(World);
        //      m_VMesh.Frame();
        m_VMesh.Render();
 
        if(m_VMesh.isOncePlayDone()) {
                return false;
        }
 
        return true;
}

Next:
Find:
Code:
void DrawGauge(float x,float y,float fWidth,float fHeight,float fLeanDir,DWORD color)

Replace that whole section with this:
Code:
void DrawGauge(float x,float y,float fWidth,float fHeight,float fLeanDir,DWORD color)
{
#ifndef _EXTRESOLUTION
        if( RGetIsWidthScreen() )
        {
                x = (x*800 + 80)/960;
                fWidth = fWidth*800/960;
        }
#endif
 
        struct TLVERTEX {
                float x, y, z, w;
                DWORD color;
                float u,v;
        } ;
 
        TLVERTEX ver[4];
 
#define SETVERTEX(_a,_x,_y,_z,_u,_v,_color) { ver[_a].x=_x;ver[_a].y=_y;ver[_a].z=_z;ver[_a].u=_u;ver[_a].v=_v;ver[_a].color=_color;  ver[_a].w=.1f; }
 
        float fLean=fHeight*(float)MGetWorkspaceHeight()*fLeanDir;
 
        int x1,y1,x2,y2;
        x1=x*(float)MGetWorkspaceWidth();
        y1=y*(float)MGetWorkspaceHeight();
        x2=(x+fWidth)*(float)MGetWorkspaceWidth();
        y2=(y+fHeight)*(float)MGetWorkspaceHeight();
 
        SETVERTEX(0,x1          ,y1,0,  0,0,color);
        SETVERTEX(1,x2          ,y1,0,  1,0,color);
        SETVERTEX(2,x1+fLean,y2,0,      0,1,color);
        SETVERTEX(3,x2+fLean,y2,0,      1,1,color);
 
        HRESULT hr=RGetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,ver,sizeof(TLVERTEX));
}

Next:
Open ZCombatInterface.cpp:
Find:
Code:
void TextRelative(MDrawContext* pDC,float x,float y,const char *szText,bool bCenter)

Replace that whole section with this:
Code:
void TextRelative(MDrawContext* pDC,float x,float y,const char *szText,bool bCenter)
{
#ifndef _EXTRESOLUTION
    if( RGetIsWidthScreen() )
        x = (x*800+80)/960.f;
#endif
 
    int screenx=x*MGetWorkspaceWidth();
    if(bCenter)
    {
        MFont *pFont=pDC->GetFont();
        screenx-=pFont->GetWidth(szText)/2;
    }
 
    pDC->Text(screenx,y*MGetWorkspaceHeight(),szText);
}

Next:
Find:
Code:
void BitmapRelative(MDrawContext* pDC, float x, float y, float w, float h, MBitmap* pBitmap, bool bCenter=false)

Replace that whole section with this:
Code:
void BitmapRelative(MDrawContext* pDC, float x, float y, float w, float h, MBitmap* pBitmap, bool bCenter=false)
{
    pDC->SetBitmap( pBitmap);
#ifndef _EXTRESOLUTION
    if( RGetIsWidthScreen() )
        x = (x*800+80)/960.f;
#endif
 
    int screenx=x*MGetWorkspaceWidth();
    if(bCenter)
    {
        MFont *pFont=pDC->GetFont();
        screenx-=w/2;
    }
 
    pDC->Draw( screenx, y*MGetWorkspaceHeight(), w, h);
}

Next:
Open ZObserver.cpp:
Find:
Code:
pDC->FillRectangleW( 432.0f*fRx, 37.0f*fRy, nWidth, 5.0f*fRy);

You will see this code underneath:
Code:
if ( pBitmap)
    {
        pDC->SetBitmap( pBitmap);
        if( RGetIsWidthScreen() )
            pDC->Draw( ( 800*167.0f*fRx+80*RGetScreenWidth() )/960.f, 0, 466.0f*fRy, 49.0f*fRy);
        else
            pDC->Draw( 167.0f*fRx, 0, 466.0f*fRx, 49.0f*fRx);
    }

Replace it with this:
Code:
if ( pBitmap)
    {
        pDC->SetBitmap( pBitmap);
#ifndef _EXTRESOLUTION
        if( RGetIsWidthScreen() )
            pDC->Draw( ( 800*167.0f*fRx+80*RGetScreenWidth() )/960.f, 0, 466.0f*fRy, 49.0f*fRy);
        else
#endif
            pDC->Draw( 167.0f*fRx, 0, 466.0f*fRx, 49.0f*fRx);
    }

Next:
Open Mint4R2.cpp:
Find:
Code:
void MDrawContextR2::FillRectangleW(int x, int y, int cx, int cy)

Replace that whole section with:
Code:
void MDrawContextR2::FillRectangleW(int x, int y, int cx, int cy)
{
#ifndef _EXTRESOLUTION
    if( RGetIsWidthScreen() )
    {
        x = ( 800*x+80*RGetScreenWidth() )/960.f;//( x/float(RGetScreenWidth()) *800 + 80 )/960 * RGetScreenWidth();
        cx = int(cx*800.f/960.f);
    }
#endif


    FillRectangle( x,  y,  cx,  cy);
}

Next:
Open Realspace2.cpp:
Find:
Code:
int RGetScreenWidth()        { return g_nScreenWidth; }
int RGetScreenHeight()        { return g_nScreenHeight; }
int RGetIsWidthScreen()        { return (float(g_nScreenHeight)/float(g_nScreenWidth) == 0.625f) ? 1 : 0; }

Replace with:
Code:
int RGetScreenWidth()           { return g_nScreenWidth; }
int RGetScreenHeight()          { return g_nScreenHeight; }
int RGetIsWidthScreen()         { return (float(g_nScreenHeight)/float(g_nScreenWidth) == 0.625f) ? 1 : 0; }
float RGetWidthScreen()         { return float(g_nScreenHeight)/float(g_nScreenWidth); }

Next:
Open RealSpace2.h:
Find:
Code:
int        RGetScreenWidth();
int        RGetScreenHeight();
int     RGetIsWidthScreen();

Replace with:
Code:
int        RGetScreenWidth();
int        RGetScreenHeight();
int     RGetIsWidthScreen();
float   RGetWidthScreen();

Rebuild and then have fun!

Credits:
Mark (Original Coder)
Sahar042 (Source)
Me.

If you need any assistance with this, please post your issues, I am more than happy to help, it's what i'm here for.

Your welcome.
 
Last edited:
DRGunZ 2 Creator
Loyal Member
Joined
Jan 21, 2007
Messages
4,493
Reaction score
161
Didn't understand a word of it, but a great tutorial for others. I would have clicked a thanks button, but for some reason, it's not showing.
 
Custom Title Activated
Loyal Member
Joined
Feb 18, 2012
Messages
1,433
Reaction score
391
Didn't understand a word of it, but a great tutorial for others. I would have clicked a thanks button, but for some reason, it's not showing.
Mines been disabled for some reason, but thanks.

Another Great Copy-Paste.
Yes this is copy and paste, but there's a poop tonne of people that don't know how to do it and this is the only tutorial for it, so go somewhere else if you don't like it.
 
Junior Spellweaver
Joined
Aug 11, 2010
Messages
124
Reaction score
11
Yah thanks man.... I like that :p thanks for u help i going to put it on my source.

PS: Where's the Like button??? i can't see :(

Anyway thanks ^^
 
Custom Title Activated
Loyal Member
Joined
Feb 18, 2012
Messages
1,433
Reaction score
391
Yah thanks man.... I like that :p thanks for u help i going to put it on my source.

PS: Where's the Like button??? i can't see :(

Anyway thanks ^^
It's not visible on me Q_Q
 
Elite Diviner
Joined
Aug 19, 2007
Messages
437
Reaction score
152
Credits:
Sahar042
Me.

Not that it really matters, but I originally wrote this. Also, you don't need all the conditional compilation stuff (#defines, #ifdefs and #ifndefs), that was just something I used so I could quickly enable/disable it and find all related code to certain features that I wrote.
 
Custom Title Activated
Loyal Member
Joined
Feb 18, 2012
Messages
1,433
Reaction score
391
Not that it really matters, but I originally wrote this. Also, you don't need all the conditional compilation stuff (#defines, #ifdefs and #ifndefs), that was just something I used so I could quickly enable/disable it and find all related code to certain features that I wrote.
Sorry, edited.
 
Junior Spellweaver
Joined
Apr 22, 2013
Messages
139
Reaction score
6
Thanks :), I needed this lol. You should contact RaGEZONE on the account support for the like button to be enabled for your usergroup.
 
Custom Title Activated
Loyal Member
Joined
Feb 18, 2012
Messages
1,433
Reaction score
391
Thank you for the credit but i didn't coded it, It was Mark - Aristurm so change it :p.
Thank you, I will also add your credits because it's from your source even though Mark coded it.

PS: Mann, my name looks awesome xDDD
 
Status
Not open for further replies.
Back
Top