Example #1
0
void Player::MoveToDestAngle()
{
	float beginangle = GetAngle();
	if (beginangle > 0)
		beginangle = fmodf(beginangle, 2.f*D3DX_PI);
	else
		beginangle = fmodf(beginangle, -2.f*D3DX_PI);

	float deltaangle = destangle - beginangle;
	if (deltaangle > D3DX_PI)
		deltaangle -= 2.f*D3DX_PI;
	if (deltaangle < -D3DX_PI)
		deltaangle += 2.f*D3DX_PI;

	float anglespeed = .9f;
	if (anglespeed > abs(deltaangle))
	{
		SetAngle(destangle);
	}
	else
	{
		float sign = 1.f;
		if (deltaangle < 0.f) sign = -1.f;
		SetAngle(sign * anglespeed + GetAngle());
	}
}
Example #2
0
/**\brief Ship constructor that initializes default values.
 */
Ship::Ship()
{
	model = NULL;
	engine = NULL;
	flareAnimation = NULL;
	
	/* Initalize ship's condition */
	damageBooster=1.0;
	engineBooster=1.0;
	shieldBooster=1.0;
	status.hullDamage = 0;
	status.shieldDamage = 0;
	status.lastWeaponChangeAt = 0;

	memset(status.lastFiredAt, 0, sizeof(status.lastFiredAt));

	status.selectedWeapon = 0;
	status.cargoSpaceUsed = 0;
	status.isAccelerating = false;
	status.isRotatingLeft = false;
	status.isRotatingRight = false;
	status.isDisabled = false;
	for(int a=0;a<max_ammo;a++){
		ammo[a]=0;
	}

	shipStats = Outfit();

	SetRadarColor( RED );
	SetAngle( float( rand() %360 ) );
}
Example #3
0
OGSprite* SpriteFactory::CreateCap(WOGPipe* a_pipe,
                                   const QString& a_id,
                                   bool a_visible)
{
    auto src = CreateImageSource(a_id);

    if (!src || a_pipe->vertex->size() < 2)
        return nullptr;

    QPointF p1 = a_pipe->vertex->at(0);
    QPointF p2 = a_pipe->vertex->at(1);
    auto v = p2 - p1;
    float angle = (v.x() == 0 ? (v.y() > 0 ? 0 : 180) : (v.x() > 0 ? 90 : -90));

    float x = p1.x();
    float y = -p1.y();

    auto spr = std::unique_ptr<OGSprite>(new OGSprite(x, y, src));
    spr->CenterOrigin();
    spr->SetAngle(angle);
    spr->SetVisible(a_visible);
    spr->SetDepth(a_pipe->depth);

    return spr.release();
}
Example #4
0
//////////////////////////////////////////////////////////////////////
// TThingEditDialog
// ----------
//
void
TThingEditDialog::SetupWindow ()
{
	TDialog::SetupWindow();
	::CenterWindow (this);

	// Retreive thing set and setup check boxes
	InitThingSet ();

	// Add thing types of thing set in list box
	SetupListBox();

	// Set angle and appearence boxes
	SetAngle();

	// Insert thing position in edit boxes
	char tmp[20];
	sprintf (tmp, "%d", CurThing.xpos);
	pXPosEdit->SetText(tmp);

	sprintf (tmp, "%d", CurThing.ypos);
	pYPosEdit->SetText(tmp);

	sprintf (tmp, "%d", CurThing.xExitPos);
	pXExit->SetText(tmp);

	sprintf (tmp, "%d", CurThing.yExitPos);
	pYExit->SetText(tmp);

	pComment->SetText(CurThing.comment);
}
Example #5
0
void TThingEditDialog::SelectFromEntrancesClicked ()
{
  // Disabled 7/3/04 ARK.  See comment in windeu.cpp about entrances
#if 0  
	int startExitRoomID = CurThing.when;
	int exitRoomID,exitRow,exitCol,exitAngle;
	int id = SelectEntrance(this,startExitRoomID,CurThing.id,&exitRoomID,&exitRow,&exitCol,&exitAngle);
	if (id >= 0)
	{
		int roomIndex = GetKodIndexFromID(exitRoomID);
		if (roomIndex >= 0)
		{
			char tmp[256];
			sprintf (tmp, "%d", exitCol);
			pXExit->SetText(tmp);
			sprintf (tmp, "%d", exitRow);
			pYExit->SetText(tmp);
			pExitRoomID->SetSelIndex(pExitRoomID->FindString(GetKodRoomDecorativeName(roomIndex),-1));
			CurThing.xExitPos = exitCol;
			CurThing.yExitPos = exitRow;
			CurThing.id = id;
			CurThing.angle = exitAngle;
			CurThing.when = exitRoomID;
			SetAngle();
			SetupListBox();
		}
	}
#endif
}
Example #6
0
File: ship.cpp Project: eoi/Epiar
/**\brief Rotates the ship in the given direction (relative angle).
 * \param direction Relative angle to rotate by
 * \sa Model::GetRotationsperSecond()
 */
void Ship::Rotate( float direction ) {
	float rotPerSecond, timerDelta, maxturning;
	float angle = GetAngle();
	
	if( !model ) {
		LogMsg(WARN, "Attempt to rotate sprite with no model." );
		return;
	}

	// Compute the maximum amount that the ship can turn
	rotPerSecond = shipStats.GetRotationsPerSecond();
	timerDelta = Timer::GetDelta();
	maxturning = static_cast<float>((rotPerSecond * timerDelta) * 360.);

	// Cap the ship rotation
	if (fabs(direction) > maxturning){
		if (direction > 0 )
			angle += maxturning;
		else
			angle -= maxturning;
	} else {
		angle += direction;
	}
	
	// Normalize
	angle = normalizeAngle(angle);
	
	SetAngle( angle );
}
Example #7
0
void xTEDSOrientationItem::SetOrientation(const orientation* NewOrientation)
{
	if (NewOrientation == NULL) return;
	SetAxis(NewOrientation->axis_value);
	SetAngle(NewOrientation->angle_value);
	SetUnits(NewOrientation->units_value);
}
void Player::DoUpdate(int iCurrentTime)
{
	// Get time since last update
	double delta = iCurrentTime - _previousTime;

	// Get x y components of distance to mouse
	double dx = _pGameMain->GetCurrentMouseX() - _x;
	double dy =  _pGameMain->GetCurrentMouseY() - _y;

	// Euclidean distance to mouse
	double dist = sqrt(pow(dx, 2) + pow(dy, 2));

	// Vary speed based upon distance from mouse
	if (dist > 1 && dist < 50)
		SetSpeed(_maxVelocity * dist / 50);
	else if (dist > 1)
		SetSpeed(_maxVelocity);
	else
		SetSpeed(0);

	// Set angle to point towards the mouse
	int angle = (int) ((atan2(dy, dx) * 180 / PI) + 450) % 360;
	SetAngle(angle);

	CheckPowerups(iCurrentTime);
	CheckKeys(iCurrentTime);

	// Call to the super call DoUpdate method
	Actor::DoUpdate(iCurrentTime);
}
Example #9
0
/**\brief Update the Projectile
 *
 * Projectiles do all the normal Sprite things like moving.
 * Projectiles check for collisions with nearby Ships, and if they collide,
 * they deal damage to that ship. Note that since each projectile knows which ship fired it and will never collide with them.
 *
 * Projectiles have a life time limit (in milli-seconds).  Each tick they need
 * to check if they've lived to long and need to disappear.
 *
 * Projectiles have the ability to track down a specific target.  This only
 * means that they will turn slightly to head towards their target.
 */
void Projectile::Update( void ) {
	Sprite::Update(); // update momentum and other generic sprite attributes
	SpriteManager *sprites = SpriteManager::Instance();

	// Check for projectile collisions
	Sprite* impact = sprites->GetNearestSprite( (Sprite*)this, 100,DRAW_ORDER_SHIP|DRAW_ORDER_PLAYER );
	if( (impact != NULL) && (impact->GetID() != ownerID) && ((this->GetWorldPosition() - impact->GetWorldPosition()).GetMagnitude() < impact->GetRadarSize() )) {
		((Ship*)impact)->Damage( (weapon->GetPayload())*damageBoost );
		sprites->Delete( (Sprite*)this );
		
		// Create a fire burst where this projectile hit the ship's shields.
		// TODO: This shows how much we need to improve our collision detection.
		Effect* hit = new Effect(this->GetWorldPosition(), "Resources/Animations/shield.ani", 0);
		hit->SetAngle( -this->GetAngle() );
		hit->SetMomentum( impact->GetMomentum() );
		sprites->Add( hit );
	}

	// Expire the projectile after a time period
	if (( Timer::GetTicks() > secondsOfLife + start )) {
		sprites->Delete( (Sprite*)this );
	}

	// Track the target
	Sprite* target = sprites->GetSpriteByID( targetID );
	float tracking = weapon->GetTracking();
	if( target != NULL && tracking > 0.00000001f ) {
		float angleTowards = normalizeAngle( ( target->GetWorldPosition() - this->GetWorldPosition() ).GetAngle() - GetAngle() );
		SetMomentum( GetMomentum().RotateBy( angleTowards*tracking ) );
		SetAngle( GetMomentum().GetAngle() );
	}
}
Example #10
0
/**\brief Constructor
 */
Projectile::Projectile(float damageBooster, float angleToFire, Coordinate worldPosition, Coordinate firedMomentum, Weapon* _weapon)
{
	damageBoost=damageBooster;
	// All Projectiles get these
	ownerID = 0;
	targetID = 0;
	start = Timer::GetTicks();
	SetRadarColor (Color(0x55,0x55,0x55));

	// These are based off of the Ship firing this projectile
	SetWorldPosition( worldPosition );
	SetAngle(angleToFire);

	// These are based off of the Weapon
	weapon = _weapon;
	secondsOfLife = weapon->GetLifetime();
	SetImage(weapon->GetImage());

	Trig *trig = Trig::Instance();
	Coordinate momentum = GetMomentum();
	float angle = static_cast<float>(trig->DegToRad( angleToFire ));

	momentum = firedMomentum +
	           Coordinate( trig->GetCos( angle ) * weapon->GetVelocity(),
	                      -trig->GetSin( angle ) * weapon->GetVelocity() );
	
	SetMomentum( momentum );
}
Example #11
0
//-----------------------------------------------------------------------------
void CFireBall::Create(Vec3f aeSrc, float afBeta, float afAlpha, float _fLevel)
{
	SetDuration(ulDuration);
	SetAngle(afBeta);

	eSrc.x = aeSrc.x - fBetaRadSin * 60;
	eSrc.y = aeSrc.y;
	eSrc.z = aeSrc.z + fBetaRadCos * 60;

	eMove.x = - fBetaRadSin * 80 * cos(radians(MAKEANGLE(afAlpha)));
	eMove.y = sin(radians(MAKEANGLE(afAlpha))) * 80;
	eMove.z = + fBetaRadCos * 80 * cos(radians(MAKEANGLE(afAlpha)));

	fLevel = _fLevel;

	//FIRE
	fire_1.p3Direction = -eMove;
	fire_1.fStartSize = 1 * _fLevel; 
	fire_1.fStartSizeRandom = 2 * _fLevel; 

	pPSFire.SetParams(fire_1);
	pPSFire.fParticleFreq = 100.0f;
	pPSFire.ulParticleSpawn = 0;
	pPSFire.SetTexture("graph/particles/fire", 0, 200);

	pPSFire.Update(0);

	//FIRE
	fire_2.p3Direction = -eMove;
	fire_2.fStartSize = 1 * _fLevel; 
	fire_2.fStartSizeRandom = 2 * _fLevel; 
	fire_2.fEndSize = 3 * _fLevel; 
	fire_2.fEndSizeRandom = 2 * _fLevel; 

	pPSFire2.SetParams(fire_2);
	pPSFire2.fParticleFreq = 20.0f;
	pPSFire2.ulParticleSpawn = 0;
	pPSFire2.SetTexture("graph/particles/fire", 0, 200);
	pPSFire2.Update(0);

	// Smoke
	smoke.p3Direction = -eMove;
	smoke.fEndSize = 7 * _fLevel;
	smoke.fEndSizeRandom = 2 * _fLevel; 

	pPSSmoke.SetParams(smoke);
	pPSSmoke.ulParticleSpawn = 0;
	pPSSmoke.fParticleFreq = 20.0f;

	pPSSmoke.SetTexture("graph/particles/big_greypouf", 0, 0);
	pPSSmoke.Update(0);

	pPSFire.SetPos(eSrc);
	pPSFire2.SetPos(eSrc);
	pPSSmoke.SetPos(eSrc);

	// Light
	lLightId = -1; 
	eCurPos = eSrc;
}
Example #12
0
//------------------------------------------------------
//	コンストラクタ
//------------------------------------------------------
iexMesh::iexMesh( char* filename )
{
	lpMesh = NULL;
	lpTexture = NULL;
	lpNormal = NULL;
	lpSpecular = NULL;
	lpHeight = NULL;

	//	ファイル読み込み
	char*	ext = &filename[ lstrlen(filename)-4 ];
	if( lstrcmpi( ext, ".imo" ) == 0 ) LoadIMO(filename);
	 else LoadX(filename);

	if( lpMesh == NULL )
	{
		//	読み込み失敗
		tdnSystem::printf( "*エラー[iexMesh] ---> ロード失敗: \"%s\"\n", filename );
		bLoad = FALSE;
	} else {
		DWORD* pAdjacency = new DWORD [ lpMesh->GetNumFaces() * 3 ];
		// 最適化
		lpMesh->GenerateAdjacency( 1e-6f, pAdjacency );
		lpMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_VERTEXCACHE, pAdjacency, NULL, NULL, NULL );
		delete[] pAdjacency;

		bLoad = TRUE;
	}
	SetPos(0,0,0);
	SetScale(1.0f);
	SetAngle(0);
	Update();
}
Example #13
0
//-----------------------------------------------------------------------------
void CMagicMissile::Create(EERIE_3D aeSrc, EERIE_3D angles)
{
	int i;
	EERIE_3D s, e;

	SetDuration(ulDuration);
	SetAngle(angles.b);

	Vector_Copy(&this->angles, &angles);
	eCurPos.x = eSrc.x = aeSrc.x;
	eCurPos.y = eSrc.y = aeSrc.y;
	eCurPos.z = eSrc.z = aeSrc.z;


	fSize = 1;
	bDone = true;

	s.x = eSrc.x;
	s.y = eSrc.y;
	s.z = eSrc.z;
	e.x = eSrc.x;
	e.y = eSrc.y;
	e.z = eSrc.z;

	i = 0;

	i = 40;
	e.x -= fBetaRadSin * 50 * i;
	e.y += sin(DEG2RAD(MAKEANGLE(this->angles.a))) * 50 * i;
	e.z += fBetaRadCos * 50 * i;

	pathways[0].sx = eSrc.x;
	pathways[0].sy = eSrc.y;
	pathways[0].sz = eSrc.z;
	pathways[5].sx = e.x;
	pathways[5].sy = e.y;
	pathways[5].sz = e.z;
	Split(pathways, 0, 5, 50, 0.5f);

	for (i = 0; i < 6; i++)
	{
		if (pathways[i].sy >= eSrc.y + 150)
		{
			pathways[i].sy = eSrc.y + 150;
		}
	}

	fTrail = 0;

	iLength = 50;
	fOneOnLength = 1.0f / (float) iLength;
	iBezierPrecision = BEZIERPrecision;
	fOneOnBezierPrecision = 1.0f / (float) iBezierPrecision;
	bExplo = false;
	bMove = true;

	ARX_SOUND_PlaySFX(SND_SPELL_MM_CREATE, &eCurPos);
	ARX_SOUND_PlaySFX(SND_SPELL_MM_LAUNCH, &eCurPos);
	snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_MM_LOOP, &eCurPos, 1.0F, ARX_SOUND_PLAY_LOOPED);
}
Example #14
0
/**
@brief	文字列を回転させて表示するサンプル。
*/
void TextObject2D_Rotate()
{
	// Altseedを初期化する。
	asd::Engine::Initialize(asd::ToAString("TextObject2D_Rotate").c_str(), 640, 480, asd::EngineOption());

	{
		// フォントと文字列描画オブジェクトの設定を行う。
		auto edgeFont = asd::Engine::GetGraphics()->CreateFont(asd::ToAString("Data/Font/Font1.aff").c_str());
		auto edgeObj = std::make_shared<asd::TextObject2D>();
		edgeObj->SetFont(edgeFont);
		edgeObj->SetPosition(asd::Vector2DF(100, 100));

		//回転角と描画する文字列を設定する。
		edgeObj->SetAngle(30);
		edgeObj->SetText(asd::ToAString("文字列の回転描画").c_str());

		// 文字描画オブジェクトのインスタンスをエンジンへ追加する。
		asd::Engine::AddObject2D(edgeObj);
	}

	// Altseedのウインドウが閉じられていないか確認する。
	while (asd::Engine::DoEvents())
	{
		// Altseedを更新する。
		asd::Engine::Update();
	}

	// Altseedを終了する。
	asd::Engine::Terminate();
}
void TBox::SetBox(TGfxVec2 Position, float W_Ray, float H_Ray, float Angle)
{
	SetCenter(Position);
	SetRayS(W_Ray, H_Ray);
	SetAngle(Angle);
	SetCollider();
}
Example #16
0
	void DamageRay::SetAngleFromVertex(int x1, int y1, int x2, int y2)
	{
		float dx = x2-x1;
		float dy = y2-y1;
		float angle = atan2(dy, dx);
		SetAngle(angle);
	}
Example #17
0
void CRiseDead::Create(Vec3f aeSrc, float afBeta)
{
	int i;

	SetDuration(ulDurationIntro, ulDurationRender, ulDurationOuttro);

	eSrc.x = aeSrc.x;
	eSrc.y = aeSrc.y - 10.f; 
	eSrc.z = aeSrc.z;
	SetAngle(afBeta);
	sizeF = 0;
	fSizeIntro = 0.0f;
	fTexWrap = 0;
	fRand = (float) rand();
	end = 40 - 1;
	bIntro = true;

	for(i = 0; i < 40; i++) {
		tfRaysa[i] = 0.4f * rnd();
		tfRaysb[i] = 0.4f * rnd();
	}

	v1a[0].x = eSrc.x - fBetaRadSin * 100;
	v1a[0].y = eSrc.y;
	v1a[0].z = eSrc.z + fBetaRadCos * 100;
	v1a[end].x = eSrc.x + fBetaRadSin * 100;
	v1a[end].y = eSrc.y;
	v1a[end].z = eSrc.z - fBetaRadCos * 100;

	v1b[0] = v1a[0];
	v1b[end] = v1a[end];

	sizeF = 200;
	Split(v1a, 0, end, 20);
	Split(v1b, 0, end, -20);

	sizeF = 200;
	Split(v1a, 0, end, 80);
	Split(v1b, 0, end, -80);
	
	for(i = 0; i <= end; i++) {
		vb[i] = va[i] = eSrc;
	}
	
	sizeF = 0;
	
	// cailloux
	this->timestone = 0;
	this->nbstone = 0;
	this->stone[0] = stone0; 
	this->stone[1] = stone1; 

	int nb = 256;

	while (nb--)
	{
		this->tstone[nb].actif = 0;
	}
}
Example #18
0
bool
Simbox::setArea(const NRLib::Volume * volume, int nx, int ny, std::string & errText, bool scale)
{
  double scale_value = 1.0;

  if (scale == true) //SGRI
    scale_value = 1000;

  double x0  = volume->GetXMin()*scale_value;
  double y0  = volume->GetYMin()*scale_value;
  double lx  = volume->GetLX()*scale_value;
  double ly  = volume->GetLY()*scale_value;
  double rot = volume->GetAngle();
  double dx  = lx/static_cast<double>(nx);
  double dy  = ly/static_cast<double>(ny);

  try
  {
    SetDimensions(x0,y0,lx,ly);
  }
  catch (NRLib::Exception & e)
  {
    errText += "Could not set x0, y0, lx, and ly.\n";
    errText += e.what();
    return true; // Failed
  }
  try
  {
    SetAngle(rot);
  }
  catch (NRLib::Exception & e)
  {
    errText += "Could not set rotation angle.\n";
    errText += e.what();
    return true; // Failed
  }
  cosrot_      = cos(rot);
  sinrot_      = sin(rot);
  dx_          = dx;
  dy_          = dy;
  nx_          = static_cast<int>(0.5+lx/dx_);
  ny_          = static_cast<int>(0.5+ly/dy_);

  // In case IL/XL information is not available, we fall back
  //  on the following base case values ...
  inLine0_     = -0.5;
  crossLine0_  = -0.5;
  ilStepX_     =  cosrot_/dx_;
  ilStepY_     =  sinrot_/dx_;
  xlStepX_     = -sinrot_/dy_;
  xlStepY_     =  cosrot_/dy_;

  if(status_ == EMPTY)
    status_ = NODEPTH;
  else if(status_ == NOAREA)
    status_ = BOXOK;

  return false; // OK
}
Example #19
0
/** Reset this game object back to the center of the game world. */
void GameObject::Reset()
{
	SetPosition(GLVector3f(0,0,0));
	SetVelocity(GLVector3f(0,0,0));
	SetAcceleration(GLVector3f(0,0,0));
	SetAngle(0);
	SetRotation(0);
}
Example #20
0
void Shape::Init()
{
    SetColor( ofColor(ofRandom(100,255),ofRandom(70,225),ofRandom(100,255)));
    SetDistance(ofRandom(50,400));
    SetShape((ShapeType)ofRandom(ST_MAXLENGTH));
    SetSpeed(ofRandom(1,5));
    SetAngle(ofRandom(360));
    SetSize(ofRandom(10,30));
}
Example #21
0
bool
Simbox::setArea(const SegyGeometry * geometry, std::string & errText)
{
  double x0  = geometry->GetX0();
  double y0  = geometry->GetY0();
  double lx  = geometry->Getlx();
  double ly  = geometry->Getly();
  double rot = geometry->GetAngle();
  double dx  = geometry->GetDx();
  double dy  = geometry->GetDy();

  try
  {
    SetDimensions(x0,y0,lx,ly);
  }
  catch (NRLib::Exception & e)
  {
    errText += "Could not set x0, y0, lx, and ly.\n";
    errText += e.what();
    return true; // Failed
  }
  try
  {
    SetAngle(rot);
  }
  catch (NRLib::Exception & e)
  {
    errText += "Could not set rotation angle.\n";
    errText += e.what();
    return true; // Failed
  }
  cosrot_      = cos(rot);
  sinrot_      = sin(rot);
  dx_          = dx;
  dy_          = dy;
  nx_          = static_cast<int>(0.5+lx/dx_);
  ny_          = static_cast<int>(0.5+ly/dy_);

  // In case IL/XL information is not available, we fall back
  //  on the following base case values ...
  inLine0_     = -0.5;
  crossLine0_  = -0.5;
  ilStepX_     =  cosrot_/dx_;
  ilStepY_     =  sinrot_/dx_;
  xlStepX_     = -sinrot_/dy_;
  xlStepY_     =  cosrot_/dy_;

  if(status_ == EMPTY)
    status_ = NODEPTH;
  else if(status_ == NOAREA)
    status_ = BOXOK;

  return false; // OK
}
Example #22
0
CSpellFx::CSpellFx() :
	fBeta(0),
	fManaCostToLaunch(10),
	fManaCostPerSecond(10),
	lLightId(-1),
	lSrc(-1),
	spellinstance(-1)
{
	SetDuration(1000);
	SetAngle(fBeta);
};
Example #23
0
void CShipLoop::Process()
{
	D3DXMatrixInverse( GetInvTM(), NULL, &m_matWorld );		// 좌표변환이 이뤄지기전 매트릭스로 역행렬을 구해놔야 한다.
	
	D3DXVECTOR3	vPos = GetPos();
	D3DXVECTOR3 vDeltaAccu;
	FLOAT fAng = GetAngle();
	
	vDeltaAccu = D3DXVECTOR3(0, 0, 0);		// 누적 벡터는 항상 초기화 해줘야 한다.
	m_fDeltaAng = 0.07f;
#ifdef __X15
	int		i;
	for( i = 0; i < 4; i ++ )
#endif	
	{
		fAng += m_fDeltaAng;		// 왼쪽으로 계속 회전
		AngleToVectorXZ( &m_vAcc, fAng, 0.05f );		// fAng방향으로 추진력발생.
		vDeltaAccu += m_vAcc;		// 서버 15프레임에서만 사용되는 것으로 4번을 누적함.
	}
	
	m_vDelta = vDeltaAccu;
	vPos += m_vDelta;
	SetPos( vPos );
	SetAngle( fAng );
	
#ifdef __WORLDSERVER
	if( (m_nCount & 127) == 0 )
	{
		OBJID idCtrl = NULL_ID;

		g_UserMng.AddSetPosAngle( this, GetPos(), GetAngle() );		// 먼저 this(Ship)의 위치를 sync시킴.
		// 링크되어 있는 모든 ctrl의 위치를 다시 sync시킴.
		for( i = 0; i < MAX_LINKCTRL; i ++ )		
		{
			if( m_LinkCtrl[i] == 0 )	continue;
			idCtrl = m_LinkCtrl[i];
			CCtrl *pCtrl = prj.GetCtrl( idCtrl );
			if( IsValidObj( pCtrl ) )
			{
				if( pCtrl->GetIAObjLink() == this )
					g_UserMng.AddSetPosAngle( pCtrl, pCtrl->GetPos(), pCtrl->GetAngle() );		// this(Ship)의 위치를 sync시킴.
				else
					RemoveCtrl( pCtrl->GetId() );
			}
		}
	}
#endif
	
	// IA오브젝트는 다른 오브젝트를 태우고 다녀야 하므로
	// 실시간으로 매트릭스가 갱신되어야 한다.
	UpdateLocalMatrix();		

	m_nCount ++;
}
Example #24
0
void Box2DGameObject::InitBox2DBody(const b2BodyDef &bodyDef)
{
	DVASSERT_MSG(manager, "You need to set manager first");
	DVASSERT_MSG(box2DWorld, "Your box2d world is not set");

	box2DBody = box2DWorld->CreateBody(&bodyDef);
	box2DBody->SetUserData(this);

    SetPosition(((Box2DGameObjectManager *)manager)->VectorBox2DToGameManager(bodyDef.position));
    SetAngle(-bodyDef.angle);
    manager->RecalcObjectHierarchy(this);
}
Example #25
0
void CBless::Create(Vec3f _eSrc, float _fBeta) {
	
	SetDuration(ulDuration);
	SetAngle(_fBeta);
	
	eSrc = _eSrc;
	eTarget = eSrc;
	fSize = 1;
	fRot = 0;
	fRotPerMSec = 0.25f;
	bDone = true;
}
Example #26
0
CCommonCtrl::CCommonCtrl()
{
	m_dwType = OT_CTRL;

	/////////////////////////////////////////////////////////////////////////////////////////
	ZeroMemory( &m_CtrlElem, sizeof( m_CtrlElem ) );
	/////////////////////////////////////////////////////////////////////////////////////////
/*
	m_CtrlElem.m_dwMinItemNum			= 1;			//-최소 발생 아이템 수 
	m_CtrlElem.m_dwMaxiItemNum			= 3;			//-최대 발생 아이템 수 

	m_CtrlElem.m_dwInsideItemKind[0] = II_WEA_SWO_FLOWER;
	m_CtrlElem.m_dwInsideItemPer [0] = 1500000000;
	m_CtrlElem.m_dwInsideItemKind[1] = II_WEA_CHEE_ZANNE;
	m_CtrlElem.m_dwInsideItemPer [1] = 1500000000;
	m_CtrlElem.m_dwInsideItemKind[2] = II_WEA_WAN_BLUEBOW;
	m_CtrlElem.m_dwInsideItemPer [2] = 1500000000;
	m_CtrlElem.m_dwInsideItemKind[3] = II_ARM_ARM_SHI_FURY;
	m_CtrlElem.m_dwInsideItemPer [3] = 1500000000;
	
	m_CtrlElem.m_dwMonResKind  [0]      = MI_DEMIAN2;
	m_CtrlElem.m_dwMonResNum   [0]		= 0;
	m_CtrlElem.m_dwMonActAttack[0]		= 0;
	m_CtrlElem.m_dwMonResKind  [1]      = MI_BURUDENG2;
	m_CtrlElem.m_dwMonResNum   [1]		= 0;
	m_CtrlElem.m_dwMonActAttack[1]		= 0;
	m_CtrlElem.m_dwMonResKind  [2]      = MI_MIA2;
	m_CtrlElem.m_dwMonResNum   [2]		= 0;
	m_CtrlElem.m_dwMonActAttack[2]		= 0;

	m_CtrlElem.m_dwTrapOperType         = xRandom(2);
	m_CtrlElem.m_dwTrapRandomPer        = 2000000000;
	m_CtrlElem.m_dwTrapDelay            = 1000;
	
	m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNSINGLE;    
	//m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNGROUP;    
	m_CtrlElem.m_dwTrapLevel[0] = 3;

	m_CtrlElem.m_dwTrapKind [1] = SI_GEN_FLASH;
	//m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNGROUP;    
	m_CtrlElem.m_dwTrapLevel[1] = 3;
	
#ifdef	__Y_EXPBOX
	m_CtrlElem.m_dwExp    = 0;
	m_CtrlElem.m_idPlayer = NULL_ID;
#endif //__Y_EXPBOX	
*/		
	/////////////////////////////////////////////////////////////////////////////////////////
	SetAngle( (float)( xRandom(360) ) );
	
	Init();	
}
Example #27
0
File: gate.cpp Project: ebos/Epiar
Gate::Gate(Coordinate pos) {
	top = true;
	SetImage( Image::Get("Resources/Graphics/gate1_top.png") );
	
	// Create the PartnerID Gate
	Gate* partner = new Gate(this->GetID());
	partnerID = partner->GetID();
	exitID = 0;
	SpriteManager::Instance()->Add((Sprite*)partner);

	// Set both Position and Angle at the same time
	SetWorldPosition(pos);
	SetAngle( float( rand() %360 ) );
}
Example #28
0
Agent::Agent(double InitialXCoordinate, double InitialYCoordinate, double InitialAngle):
myColor(RobotColor), myRadius(RobotRadius),
myEnkiEpuck(new Enki::EPuck(Enki::EPuck::CAPABILITY_CAMERA | Enki::EPuck::CAPABILITY_BASIC_SENSORS))
{
	mySensorReading = 0;
	basketSeenFlag = 0;
	canPickedFlag = 0;
	SetXCoordinate(InitialXCoordinate);
	SetYCoordinate(InitialYCoordinate);
	SetAngle(InitialAngle);
	SetLeftSpeed(0);
	SetRightSpeed(0);
	myEnkiEpuck->camera.setRange(CameraRange);           //Camera range; default: unlimited
	myEnkiEpuck->camera.halfFieldOfView = CameraFieldOfView/2;                          // Camera half field of view
}
Example #29
0
void ShooterArm::TestPID(float setpoint,float p, float stage1I, float stage2I, float stage1D,float stage2D, float stage1Tol, float stage2Tol)
{
    //_maxFeedForward = 0.0;
    //float newFeedForward = 0.0;//_maxFeedForward * cos(GetCurrentRadians());
    //GetPIDController()->SetPID(p,i,d, newFeedForward);
    Disable();
    _bothStage_P = p;
    _stage_1_I = stage1I;
    _stage_2_I = stage2I;
    _stage_1_D = stage1D;
    _stage_2_D = stage2D;
    _stage_1_tolerance = stage1Tol;
    _stage_2_tolerance = stage2Tol;
    
    GetPIDController()->SetPID(_bothStage_P,_stage_1_I,_stage_1_D);
    SetAngle(setpoint);
}
Example #30
0
	//	初期化
	bool Player::Initialize( void )
	{
		//	読み込み
		bool loadSuccess = Load( "DATA/CHR/Y2009/Y2009.IEM" );

		if ( loadSuccess )
		{
			SetMotion( 1 );		//	仮
			SetPos( INIT_POS );
			SetAngle( INIT_ANGLE );
			SetScale( INIT_SCALE );
			UpdateInfo();
			return	true;
		}

		return	false;
	}