Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PT Source Wide Screen

Imri Persiado
Joined
May 17, 2008
Messages
941
Reaction score
26
Hello everyone!
After a lot of time I found a way to implement a widescreen in the PT Source!
The reason that I'm posting it in the Dev section is because it's not complete yet and I hope that you guys will help me to develop it.

Let's look in here(src\smLib3d\smRend3d.cpp):
Code:
void SetDxProjection( float radians, int SizeX, int SizeY, float near_z, float far_z )
{
	s_DxProjection_h  = float(1.f / tan(radians/2.f));

	//Imri's edit
	if (SizeY / SizeX < 0.75)
		s_DxProjection_w = 2;
	else
		s_DxProjection_w = s_DxProjection_h / (float(SizeX) / float(SizeY));

	s_DxProjection_q1 = far_z / (far_z - near_z);
	s_DxProjection_q2 = -near_z * s_DxProjection_q1;

	s_CenterX = SizeX >> 1;
	s_CenterY = SizeY >> 1;

	float fWinSizeOffset_X = float(SizeX) / 800.f;
	float fWinSizeOffset_Y = float(SizeY) / 600.f;

	g_fZoomInAdd_x = (30.f  * fWinSizeOffset_X);
	g_fZoomInAdd_y = (337.f * fWinSizeOffset_Y);
	g_fZoomInDiv_x = (float(SizeX) / (320.f * fWinSizeOffset_X));
	g_fZoomInDiv_y = (float(SizeY) / (240.f * fWinSizeOffset_Y));
}

The original source didn't have the IF statement and it looked like that:
Code:
s_DxProjection_h  = float(1.f / tan(radians/2.f));
s_DxProjection_w = s_DxProjection_h / (float(SizeX) / float(SizeY));

I found out that if "s_DxProjection_w" is increased, then the game width is increased (which is what we are looking for).

No matter what the resolution is, "s_DxProjection_h" always equals to "2.68110371".
"s_DxProjection_w" is affected by ""s_DxProjection_h" as you can see and by the resolution ratio.

For example a 4:3 resolution would generate a:
Code:
h = 2.68110371
w = 2.01082778
h/w = 1.33 = 4/3 = 1.33

A 16:9 resolution:
Code:
h = 2.68110371
w = 1.50812078
h/w = 1.77 = 16/9 = 1.77

I'm not sure why h/w result is the correct ratio instead of w/h but the bottom line is that the width is adjusted correctly.

So if the code is right why in a 16:9 we keep on seeing black bars? I have no idea but what I do know is that if the value of "s_DxProjection_w" is equals "2" everything is printed properly in a 16:9 resolution:
(1366x768)
tnrh1 - PT Source Wide Screen - RaGEZONE Forums


So bottom line the widescreen is working, but I had to change code that seems to be right! I'll keep posting if I find out more information about it.

I would love to hear your opinion and help me and you work it out!
 
Last edited:
Junior Spellweaver
Joined
May 30, 2009
Messages
190
Reaction score
61
That's the wrong way to add widescreen... u r not doing widescreen, just "zooming" the screen.

The "right way" its using this variables:
smRender.SMSHIFT_PERSPECTIVE_WIDTH
smRender.SMMULT_PERSPECTIVE_HEIGHT
 
Imri Persiado
Joined
May 17, 2008
Messages
941
Reaction score
26
That's the wrong way to add widescreen... u r not doing widescreen, just "zooming" the screen.

The "right way" its using this variables:
Can you please share with us more about how to adjust them?
I set some breakpoints around the variables in the "playmain.cpp" but the code never stopped in one of them.

This code might be related:
Code:
if ( SizeMode )
		{
			//w = (int)((float)WinSizeX/4);
			h = (int)((float)WinSizeY/2);
			w = (int)((float)WinSizeY*1.34f/4);

			w += 20;
			h += 20;

			smRender.SMSHIFT_PERSPECTIVE_WIDTH = RENDCLIP_DEFAULT_SHIFT_PERSPECTIVE_WIDTH*3;
			smRender.SMMULT_PERSPECTIVE_HEIGHT = RENDCLIP_DEFAULT_MULT_PERSPECTIVE_HEIGHT*2;

			dist = 30*fONE;
			he = -1*fONE;
		}
		else 
		{
			//w = (int)((float)WinSizeX/8);
			h = (int)((float)WinSizeY/6);
			w = (int)((float)WinSizeY*1.34f/8);

			w += 10;
			h += 10;

			smRender.SMSHIFT_PERSPECTIVE_WIDTH = RENDCLIP_DEFAULT_SHIFT_PERSPECTIVE_WIDTH*4;
			smRender.SMMULT_PERSPECTIVE_HEIGHT = RENDCLIP_DEFAULT_MULT_PERSPECTIVE_HEIGHT*6;

			dist = 100*fONE;
			he = 3*fONE;
		}

But once again, the game doesn't stop in the breakpoint (I'm talking about the login screen).

EDIT:
it looks like when I'm playing with this variables that's what affected:
tnrh1 - PT Source Wide Screen - RaGEZONE Forums
 
Last edited:
Back
Top