Page 1 of 1

Mr P and a demo :D

Posted: Thu Nov 27, 2008 12:28 am
by ardentcrest
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:

Re: Mr P and a demo :D

Posted: Thu Nov 27, 2008 3:49 pm
by paradoxnj
Give me until the end of January. I will release an FPS demo.

Re: Mr P and a demo :D

Posted: Sun Nov 30, 2008 2:52 am
by paradoxnj
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;
}

Re: Mr P and a demo :D

Posted: Fri Jul 17, 2009 9:39 am
by QuestOfDreams
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.

Re: Mr P and a demo :D

Posted: Fri Jul 17, 2009 11:02 pm
by paradoxnj
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.