Ejemplo n.º 1
0
/*
============
idScriptObject::CallEvent
============
*/
void idScriptObject::CallEvent( const char* name ) {
	const sdProgram::sdFunction* function = GetFunction( name );
	if ( function == NULL ) {
		return;
	}

	sdScriptHelper h1;
	CallNonBlockingScriptEvent( function, h1 );
}
Ejemplo n.º 2
0
/*
================
sdClientScriptEntity::DeconstructScriptObject
================
*/
void sdClientScriptEntity::DeconstructScriptObject( void ) {
	if ( !scriptObject ) {
		return;
	}

	// call script object's destructor
	sdScriptHelper h;
	CallNonBlockingScriptEvent( scriptObject->GetDestructor(), h );

	gameLocal.program->FreeScriptObject( scriptObject );
}
Ejemplo n.º 3
0
/*
=====================
sdClientProjectile::Launch
=====================
*/
void sdClientProjectile::Launch( idEntity* owner, const idVec3& tracerMuzzleOrigin, const idMat3& tracerMuzzleAxis ) {
	idAngles tracerMuzzleAngles = tracerMuzzleAxis.ToAngles();
	idVec3 anglesVec( tracerMuzzleAngles.pitch, tracerMuzzleAngles.yaw, tracerMuzzleAngles.roll );

	AddOwner( owner );

	sdScriptHelper helper;
	helper.Push( tracerMuzzleOrigin );
	helper.Push( anglesVec );
	CallNonBlockingScriptEvent( scriptObject->GetFunction( "OnLaunch" ), helper );
}
Ejemplo n.º 4
0
/*
================
sdClientScriptEntity::ConstructScriptObject
================
*/
sdProgramThread* sdClientScriptEntity::ConstructScriptObject( void ) {
	// init the script object's data
	scriptObject->ClearObject();

	sdScriptHelper h1, h2;
	CallNonBlockingScriptEvent( scriptObject->GetSyncFunc(), h1 );
	CallNonBlockingScriptEvent( scriptObject->GetPreConstructor(), h2 );

	sdProgramThread* thread = NULL;

	// call script object's constructor
	const sdProgram::sdFunction* constructor = scriptObject->GetConstructor();
	if ( constructor ) {
		// start a thread that will initialize after Spawn is done being called
		thread = gameLocal.program->CreateThread();
		thread->SetName( "sdClientScriptEntity" );
		thread->CallFunction( scriptObject, constructor );
		thread->ManualControl();
		thread->ManualDelete();
	}

	return thread;
}