Пример #1
0
void Class::SetName(ConstString name,bool badd2map)
{
	if(name.length())
	{
		mClassName = AddPooledString(name.c_str());

		if( badd2map )
		{
			ClassMapType::iterator it = mClassMap.find(mClassName);
			if(it != mClassMap.end())
			{
				if(it->second != this)
				{
					Class *previous = it->second;

					orkprintf("ERROR: Duplicate class name %s! previous class %p\n", mClassName.c_str(), previous);
					OrkAssert(false);
				}
			}
			else
			{
				mClassMap.AddSorted(mClassName, this);
			}
		}
	}
}
Пример #2
0
CReal SnapReal( CReal Input, CReal SnapVal )
{
	int ival = int(Input/SnapVal);

	CReal ret( CReal(ival)*SnapVal );
		
	orkprintf( "SnapReal %f [%d] -> %f \n", Input, ival, ret );

	return ret;
}
Пример #3
0
void BulletWorldControllerInst::InitWorld()
{
	btDefaultCollisionConstructionInfo cinfo;
	cinfo.m_stackAlloc = 0;
	cinfo.m_persistentManifoldPool = 0;
	cinfo.m_collisionAlgorithmPool = 0;

	cinfo.m_defaultMaxPersistentManifoldPoolSize = 512;
	cinfo.m_defaultMaxCollisionAlgorithmPoolSize = 512;
	cinfo.m_defaultStackAllocatorSize = 8<<20; // 2MB

	// collision configuration contains default setup for memory, collision setup
	mBtConfig = new btDefaultCollisionConfiguration(cinfo);

	// use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
	mDispatcher = new btCollisionDispatcher(mBtConfig);

	if( USE_GIMPACT )
	{
		btGImpactCollisionAlgorithm::registerAlgorithm(mDispatcher);
	}

	// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
	mSolver = new btSequentialImpulseConstraintSolver;

	btDbvtBroadphase *broadphase = new btDbvtBroadphase();
	// OR
	//btVector3 worldMin(-1000,-1000,-1000);
	//btVector3 worldMax(1000,1000,1000);
	//btAxisSweep3 *broadphase = new btAxisSweep3(worldMin, worldMax);

	mBroadPhase = broadphase;

	mDynamicsWorld = new btDiscreteDynamicsWorld(mDispatcher, mBroadPhase, mSolver, mBtConfig);
	mDynamicsWorld->getSolverInfo().m_solverMode &= ~SOLVER_RANDMIZE_ORDER;
	
	mDynamicsWorld->setGravity( ! mBWCBD.GetGravity() );
	orkprintf( "mDynamicsWorld<%p>\n", mDynamicsWorld );

}
Пример #4
0
void CInputDeviceWii::Input_Poll()
{
	mConnectionStatus = CONN_STATUS_ACTIVE;

	MCheckPointContext( "CInputDeviceWii::Input_Poll" );

	InputState& inpstate = RefInputState();
	inpstate.BeginCycle();

	s32 status;
    u32 type;
    u32 index;


/*
	ork::FileProgressWatcher *fw =  ork::CFileEnv::GetRef().GetDefaultDevice()->GetWatcher();
	if(fw) {
		fw->SetEnable( true);
		fw->Reading( 0, 1 );
		fw->SetEnable( false);
	}
*/
	//

	/*
	PADRead( padsTmp ) ;
	if ( padsTmp[ 0 ].err == PAD_ERR_NONE ) {
	pads[ 0 ] = padsTmp[ 0 ] ;
	}
	padsTrig[ 0 ].button = (u16)( (padsTrig[ 0 ].button ^ pads[ 0 ].button) & pads[ 0 ].button ) ;
	 */
	for( orkmap<int,int>::const_iterator it= mInputMap.begin(); it!=mInputMap.end(); it++ )
	{
		std::pair<int,int> Value = *it;
		int ikey = Value.first;
		int iout = Value.second;
		inpstate.SetPressure( iout, 0 );
	}

	KPADDisableStickCrossClamp() ;
	KPADDisableDPD(m_channel);




	if (WPADProbe(m_channel, NULL) == WPAD_ERR_NO_CONTROLLER) {

		if(mdisconnectframe == 10)
			inpstate.SetPressure( ETRIG_RAW_DISCONNECT, 127);
		else
			mdisconnectframe++;

		inpstate.EndCycle();
		return;
	}

	mkpad_reads = KPADRead( m_channel, &mkpad[0], KPAD_MAX_READ_BUFS ) ;
//For some reason when you reconnect you have your state in there yuck!
    if(mdisconnectframe) {
		mdisconnectframe = 0;
		for (int i=0;i< KPAD_MAX_READ_BUFS;i++)
			mkpad[i].hold = 0;
		inpstate.EndCycle();
		return;
	}

	for( orkmap<int,int>::const_iterator it=mInputMap.begin(); it!=mInputMap.end(); it++ )
	{
		std::pair<int,int> Value = *it;
		int ikey = Value.first;
		int iout = Value.second;

		bool bkey = mkpad[0].hold & ikey ;

		if ( bkey)
		{
			if(mkpad[0].dev_type != WPAD_DEV_FREESTYLE)
			{
				U32 outrotated = iout;


				switch( iout )
				{
					case ETRIG_RAW_JOY0_LDIG_LEFT:
						outrotated = ETRIG_RAW_JOY0_LDIG_DOWN;
						break;
					case ETRIG_RAW_JOY0_LDIG_RIGHT:
						outrotated = ETRIG_RAW_JOY0_LDIG_UP;
						break;
					case ETRIG_RAW_JOY0_LDIG_DOWN:
						outrotated = ETRIG_RAW_JOY0_LDIG_RIGHT;
						break;
					case ETRIG_RAW_JOY0_LDIG_UP:
						outrotated = ETRIG_RAW_JOY0_LDIG_LEFT;
						break;
					//default:

				}
				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_XAXIS, 0.0f);
				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_YAXIS, 0.0f);

				inpstate.SetPressure( outrotated, 127);

				if(outrotated == 144)
					OSReport("IP: %x\n",(void *) &inpstate);

			}
			else
			{
				inpstate.SetPressure( iout, 127);
			}
		}

		if((mkpad[0].wpad_err == WPAD_ERR_NONE))
		{
			if(mkpad[0].dev_type == WPAD_DEV_FREESTYLE)
			{
				#define BOOL_TO_S8(v)		(S8)((v) ? 127 : 0)
				#define F32NORM_TO_S8(v)	(S8)((v) * 127.0f)

				S8 rdown = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_DOWN);
				S8 rup = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_UP);
				S8 rleft = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_LEFT);
				S8 rright = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_RIGHT);

				inpstate.SetPressure(ETRIG_RAW_JOY0_RDIG_DOWN, rdown);
				inpstate.SetPressure(ETRIG_RAW_JOY0_RDIG_UP, rup);
				inpstate.SetPressure(ETRIG_RAW_JOY0_RDIG_LEFT, rleft);
				inpstate.SetPressure(ETRIG_RAW_JOY0_RDIG_RIGHT, rright);

				S8 lthumbX = F32NORM_TO_S8(mkpad[0].ex_status.fs.stick.x);
				S8 lthumbY = F32NORM_TO_S8(mkpad[0].ex_status.fs.stick.y);

				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_XAXIS, lthumbX);
				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_YAXIS, lthumbY);

				S8 bA = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_A);
				S8 bB = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_B);
				S8 b1 = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_1);
				S8 b2 = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_2);

				inpstate.SetPressure(ETRIG_RAW_ALPHA_A, bA);
				inpstate.SetPressure(ETRIG_RAW_ALPHA_B, bB);
				inpstate.SetPressure(ETRIG_RAW_NUMBER_1, b1);
				inpstate.SetPressure(ETRIG_RAW_NUMBER_2, b2);

				S8 bPLUS = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_PLUS);
				S8 bMINUS = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_MINUS);

				inpstate.SetPressure(ETRIG_RAW_KEY_PLUS, bPLUS);
				inpstate.SetPressure(ETRIG_RAW_KEY_MINUS, bMINUS);

				S8 bC = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_C);
				S8 bZ = BOOL_TO_S8(mkpad[0].hold & KPAD_BUTTON_Z);
				
				inpstate.SetPressure(ETRIG_RAW_ALPHA_C, bC);
				inpstate.SetPressure(ETRIG_RAW_ALPHA_Z, bZ);

#if 0
				static int accum = 0;
				accum++;
				if(accum >= 128)
				{
					accum = 0;
					orkprintf("rleft<%d> rright<%d> rup<%d> rdown<%d>\n", int(rleft), int(rright), int(rup), int(rdown));
					orkprintf("lthumbX<%d> lthumbY<%d>\n", int(lthumbX), int(lthumbY));
					orkprintf("A<%d> B<%d> 1<%d> 2<%d>\n", int(bA), int(bB), int(b1), int(b2));
					orkprintf("+<%d> -<%d>\n", int(bPLUS), int(bMINUS));
					orkprintf("C<%d> Z<%d>\n", int(bC), int(bZ));
				}
#endif
			}
			else if (mkpad[0].dev_type == WPAD_DEV_CLASSIC)
			{
				F32 zaxis = 0.0f;
				/////////////////////////////////////////////////////
				// Make the 2 triggers behave like the crappy 360 PC controller
				if(mkpad[0].ex_status.cl.rtrigger >= 0.1f)
					zaxis += mkpad[0].ex_status.cl.rtrigger;
				if(mkpad[0].ex_status.cl.ltrigger >= 0.1f)
					zaxis -= mkpad[0].ex_status.cl.ltrigger;

				inpstate.SetPressure(ETRIG_RAW_JOY0_ANA_ZAXIS, zaxis * 127.0f);


				/////////////////////////////////////////////////////
				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_XAXIS, mkpad[0].ex_status.cl.lstick.x * 127.0f);
				inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_YAXIS, -mkpad[0].ex_status.cl.lstick.y * 127.0f);

				inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_XAXIS, mkpad[0].ex_status.cl.rstick.x * 127.0f);
				inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_YAXIS, -mkpad[0].ex_status.cl.rstick.y * 127.0f);

				/////////////////////////////////////////////////////
				if(mkpad[0].ex_status.cl.lstick.y >= 0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_UP, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_UP, 0.0f);

				if(mkpad[0].ex_status.cl.lstick.y <= -0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_DOWN, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_DOWN, 0.0f);

				if(mkpad[0].ex_status.cl.lstick.x <= -0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_LEFT, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_LEFT, 0.0f);

				if(mkpad[0].ex_status.cl.lstick.y >= 0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_RIGHT, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_LANA_RIGHT, 0.0f);

				/////////////////////////////////////////////////////
/*
				if(mkpad[0].ex_status.cl.rstick.y >= 0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_UP, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_UP, 0.0f);

				if(mkpad[0].ex_status.cl.rstick.y <= -0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_DOWN, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_DOWN, 0.0f);

				if(mkpad[0].ex_status.cl.rstick.x <= -0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_LEFT, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_LEFT, 0.0f);

				if(mkpad[0].ex_status.cl.rstick.y >= 0.8f)
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_RIGHT, 127.0f);
				else
					inpstate.SetPressure(ETRIG_RAW_JOY0_RANA_RIGHT, 0.0f);

  */

			}





		}
	}

	inpstate.EndCycle();

	return;
}
Пример #5
0
bool AudioDeviceNULL::DoLoadStream( AudioStream* streamhandle, ConstString fname )
{
	AssetPath filename = fname.c_str();

	bool b_uncompressed = (strstr(filename.c_str(),"streams")!=0);

	bool b_looped = (strstr(filename.c_str(),"Music")!=0) | (strstr(filename.c_str(),"stings")!=0);
	     b_looped |= (strstr(filename.c_str(),"music")!=0) | (strstr(filename.c_str(),"Stings")!=0);

	NullStreamData* psdata = new NullStreamData;

	float fmaxtime = 0.0f;

	streamhandle->SetPlatformHandle( psdata );

	if( false == b_uncompressed )
	{
		ork::EndianContext ec;
		ec.mendian = EENDIAN_LITTLE;

		filename.SetExtension( "mkr" );

		CFile ifile( filename, ork::EFM_READ );

		int icount = 0;
		ifile.Read( & icount, sizeof(icount) );
		swapbytes_dynamic( icount );

		psdata->stream_markers.reserve(icount);

		for( int i=0; i<icount; i++ )
		{
			float ftime = 0.0f;
			int istrlen = 0;

			ifile.Read( & ftime, sizeof(ftime) );
			ifile.Read( & istrlen, sizeof(istrlen) );
			swapbytes_dynamic( ftime );
			swapbytes_dynamic( istrlen );

			char* pstring = new char[ istrlen+1 ];
			memset( pstring, 0, istrlen+1 );

			ifile.Read( pstring, istrlen );

			orkprintf( "StreamMarker<%d> time<%f> name<%s>\n", i, ftime, pstring );



			//FMOD_SYNCPOINT *syncpoint = 0;

			unsigned int  offset = int(ftime*1000.0f);
			//FMOD_TIMEUNIT offsettype = FMOD_TIMEUNIT_MS;
			const char *name = pstring;
			//FMOD_SYNCPOINT **  point
			//fmod_result = phandle->addSyncPoint( offset, offsettype, name, & syncpoint );

			if( ftime > fmaxtime )
			{
				fmaxtime =ftime;
			}
			psdata->stream_markers.insert( std::pair<Char8,float>( name,ftime ) );
			//OrkAssert( fmod_result == FMOD_OK );
		}
		ifile.Close();
	}
	psdata->mfstreamlen = fmaxtime+3.0f;
	psdata->stream_markers.insert( std::pair<Char8,float>( "END",psdata->mfstreamlen ) );

	return true;
}