Mr P and a demo :D

Discuss the development of Reality Factory 2
Post Reply
User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Mr P and a demo :D

Post by ardentcrest » Thu Nov 27, 2008 12:28 am

Hay Mr.P. some time a go there was word, that you where helping Andy with RF2, and that you where working on a small demo. any word on the demo, and what you have added to the shell of RF2.

AND if you could update the SVN,with your great work,that would be great,


LOTS OF RF2 LOVE :oops:

ARDENTCREST :lol: :lol: :twisted: :roll:
He's a Bot Jim, But not as we know It.

User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Mr P and a demo :D

Post by paradoxnj » Thu Nov 27, 2008 3:49 pm

Give me until the end of January. I will release an FPS demo.
Many Bothans died to bring you this signature....

User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Mr P and a demo :D

Post by paradoxnj » Sun Nov 30, 2008 2:52 am

Just to show that I have been busy...I am working on some inline assembly math routines for floats. These will be used for collision detection and some physics stuff.

Code: Select all

// Inline Float routines
__inline DWORD F2DW(float f)
{
	DWORD			retval = 0;

	_asm {
		fld			f
		fistp		retval
	}

	return retval;
}

__inline float FloatRoundToInt(float f)
{
	_asm {
		fld			f
		frndint
		fstp		f
	}

	return f;
}

__inline float FloatSqrt(float f)
{
	_asm {
		fld			f
		fsqrt
		fstp		f
	}

	return f;
}

__inline float FloatSin(float f)
{
	_asm {
		fld			f
		fsin
		fstp		f
	}

	return f;
}

__inline float FloatCos(float f)
{
	_asm {
		fld			f
		fcos
		fstp		f
	}

	return f;
}
Many Bothans died to bring you this signature....

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Mr P and a demo :D

Post by QuestOfDreams » Fri Jul 17, 2009 9:39 am

Sorry for bringing up this old topic again but I just recently played around with these functions myself. Looking at the code generated by VC++ it seems that some instructions get duplicated when returning the float value explicitly via the return function. It seems to me that for example

Code: Select all

__inline float FloatSqrt(float f)
{
	__asm
	{
		fld 	f
		fsqrt
	}
}
would be sufficient. Can you confirm this paradoxnj? I'm not that good at assembly.

User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Mr P and a demo :D

Post by paradoxnj » Fri Jul 17, 2009 11:02 pm

Yes...you can do it that way. It just looks better to the untrained ASM eye if you have a C return value. It won't return duplicate data, the return statement will override the ASM register with its value. So yes...it is an extra step. I sacrifice for readbility.
Many Bothans died to bring you this signature....

Post Reply