// The spawner object class constructor. SpawnerObject::SpawnerObject( char *name, char *path, unsigned long type ) : SceneObject( type ) { // Set spawner objects as ghosts. SetGhost( true ); // Load the spawner's script. Script *script = new Script( name, path ); // Get the spawner's frequency. m_frequency = *script->GetFloatData( "frequency" ); // Clear the spawn timer. m_spawnTimer = 0.0f; // Load the sound to play when the spawner's object is collected. if( script->GetStringData( "sound" ) != NULL ) { m_sound = new Sound( script->GetStringData( "sound" ) ); m_audioPath = new AudioPath3D; } // No object found, so clear pointers for sound and audio else { m_sound = NULL; m_audioPath = NULL; } // Load the script for the spawner's object. m_objectScript = g_engine->GetScriptManager()->Add( script->GetStringData( "object" ), script->GetStringData( "object_path" ) ); // Get the name of the spawner's object. m_name = new char[strlen( m_objectScript->GetStringData( "name" ) ) + 1]; strcpy( m_name, m_objectScript->GetStringData( "name" ) ); // Set the spawner's mesh to use the object's mesh. SetMesh( m_objectScript->GetStringData( "mesh" ), m_objectScript->GetStringData( "mesh_path" ) ); // Set the object to spin slowly. SetSpin( 0.0f, 1.0f, 0.0f ); // Get the spawner's radius. A radius of 0.0 indicates that it must be // taken from the object to be spawned. if( *script->GetFloatData( "radius" ) != 0.0f ) SetBoundingSphere( D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), *script->GetFloatData( "radius" ) ); // Get mesh for spawner's ellipse radius else if( GetMesh() != NULL ) SetEllipsoidRadius( *m_objectScript->GetVectorData( "ellipse_radius" ) ); // Destroy the spawner's script. SAFE_DELETE( script ); }
BOOL CParmCopyBorderDlg::OnInitDialog() { IppiSize srcSize = {0, 0}, dstSize = {0, 0}; srcSize = m_pDocSrc->GetImage()->GetActualSize(); m_bDst = m_pDocDst ? TRUE : FALSE; if (m_bDst) dstSize = m_pDocDst->GetImage()->GetActualSize(); m_dhw[0] = dstSize.height; m_dhw[1] = dstSize.width; m_shw[0] = srcSize.height; m_shw[1] = srcSize.width; CImage* aroundImage = NULL; if (m_bDst) aroundImage = m_pDocDst->GetImage(); else if (m_Func.Inplace()) aroundImage = m_pDocSrc->GetImage(); if (aroundImage) { const IppiRect* roi = aroundImage->GetRoi(); if (roi) { m_ayx[0] = roi->y; m_ayx[1] = roi->x; m_a_y_x[0] = aroundImage->Height() - roi->height - roi->y; m_a_y_x[1] = aroundImage->Width () - roi->width - roi->x; } else aroundImage = NULL; } if (!aroundImage) m_aroundRoi = FALSE; UpdateBorders(); CParamDlg::OnInitDialog(); if (!aroundImage) m_aroundButton.EnableWindow(FALSE); SetSpin(); EnableBorders(); UpdateMyData(FALSE); return TRUE; }
// The scene object class constructor. SceneObject::SceneObject( unsigned long type, char *meshName, char *meshPath, bool sharedMesh ) { // Set object's type SetType( type ); // Zero scene object's translation and rotation. SetTranslation( 0.0f, 0.0f, 0.0f ); SetRotation( 0.0f, 0.0f, 0.0f ); // Set object at rest. SetVelocity( 0.0f, 0.0f, 0.0f ); SetSpin( 0.0f, 0.0f, 0.0f ); // Object is initially facing into the positive z-axis. m_forward = D3DXVECTOR3( 0.0f, 0.0f, 1.0f ); m_right = D3DXVECTOR3( 1.0f, 0.0f, 0.0f ); // Initially the object has no friction. m_friction = 0.0f; // Clear the collision stamp. m_collisionStamp = -1; // Object is visible, enabled, solid, and registering collisons by default. m_visible = true; m_enabled = true; m_ghost = false; m_ignoreCollisions = false; // Initially the object is not touching the ground. m_touchingGround = false; // Set the object's mesh. m_mesh = NULL; SetMesh( meshName, meshPath, sharedMesh ); }