示例#1
0
bool RoboCat::MoveToLocation( float inDeltaTime, const Vector3& inLocation )
{
	bool finishedMove = false;

	Vector3 toMoveVec = inLocation - GetLocation();
	float distToTarget = toMoveVec.Length();
	toMoveVec.Normalize2D();
	if( distToTarget > 0.1f )
	{
		if ( distToTarget > ( kMoveSpeed * inDeltaTime ) )
		{
			SetLocation( GetLocation() + toMoveVec * inDeltaTime * kMoveSpeed );
		}
		else
		{
			//we're basically almost there, so set it to move location
			SetLocation( inLocation );
			finishedMove = true;
		}
	}
	else
	{
		//since we're close, stop moving towards the target
		finishedMove = true;
	}

	return finishedMove;
}
示例#2
0
extern  void    DFObjFiniDbgInfo( offset codesize ) {
/******************************/
    segment_id      old;
    offset          here;
    back_handle     bck;

    if( _IsModel( DBG_LOCALS | DBG_TYPES ) ) {
        bck = Comp_High;
        if( bck != NULL ){
            old = SetOP( AskCodeSeg() );
            OutLabel( bck->lbl );
            SetOP( old );
            BEFreeBack( bck );
            Comp_High = NULL;
        }
        DWEndCompileUnit( Client );
        DWFini( Client );
        old = SetOP( UnitSize->segment );
        here = AskLocation();
        SetLocation( UnitSize->offset );
        DataLong( codesize );
        SetLocation( here );
        SetOP( old );
        FiniSegBck();
    }
}
void
GlueMapWindow::SetLocationLazy(const GeoPoint location)
{
  if (!visible_projection.IsValid()) {
    SetLocation(location);
    return;
  }

  const fixed distance_meters =
    visible_projection.GetGeoLocation().Distance(location);
  const fixed distance_pixels =
    visible_projection.DistanceMetersToPixels(distance_meters);
  if (distance_pixels > fixed(0.5))
    SetLocation(location);
}
Object::Object()
{
	vertexBuffer = NULL;
	indexBuffer  = NULL;

	vertexBufferTangent = NULL;

	//vertexShader = NULL;
	//pixelShader  = NULL;

	vertex  = NULL;
	face    = NULL;
	tangent = NULL;

	isCreated  = false;
	isFinished = false;

	SetEnvmapEnable(false);
	SetCullMode(CULL_CW);
	SetTexture(NULL);
	SetLightmap(NULL);
	SetFlipNormals(false);
	SetCalculateNormals(true);
	SetEnabled(true);
	SetTransparency(BLEND_NONE);
	SetWriteZBuffer(true);
	//SetPerPixelLighting(false);

	SetScale(1, 1, 1);
	SetLocation(0, 0, 0);
	SetRotation(0, 0, 0);
}
Light::Light()
{
/*
	setType(D3DLIGHT_POINT);
	setDiffuse(r, g, b, a); 
	setAmbient(0, 0, 0, 0);
	setRange((float)sqrt(FLT_MAX));
	setSpecular(r, g, b, a);
    setAttenuation(1, 0, 0);
*/
	
	SetType(LIGHT_POINT);

	SetDiffuse(1, 1, 1, 1);
	SetSpecular(1, 1, 1, 1);
	SetAmbient(0, 0, 0, 0);

	SetRange((float)sqrt(FLT_MAX));

    SetAttenuation(1, 0, 0);
	SetThetaPhi(1.f, 2.f);
	SetFalloff(1.f);

	SetLocation(0, 0, 0);
	SetDirection(0, 1, 0);
}
示例#6
0
void Player::HyperSpaceButtonPressed(void)
{
	if (m_Active && !m_Hit)
	{
		 SetLocation(RandomLocation());
	}
}
示例#7
0
void TommyCoin::Read( IncomingPacketBuffer& inPacket )
{

	bool poseDirty;
	bool colorDirty;
	
	inPacket.Read(poseDirty);
	if (poseDirty) {
		XMVECTORF32 location = { 0 };
		inPacket.Read(location.f[0]);
		inPacket.Read(location.f[1]);
		SetLocation(location);

		float rotation;
		inPacket.Read(rotation);
		SetRotation(rotation);
	}

	inPacket.Read(colorDirty);
	if (colorDirty) {
		XMVECTOR color;
		inPacket.Read(color);
		SetColor(color);
	}

}
示例#8
0
void GUIWindow::SetMinimized(bool minimized)
{
	m_bMinimized = minimized;

	if(m_bMinimized)
	{
		// Hide all our children components when we are minimized
		ComponentList::const_iterator iterator;

		for(iterator = m_vpComponentList.begin(); iterator != m_vpComponentList.end(); ++iterator)
		{
			(*iterator)->SetVisible(false);
			(*iterator)->SetEnabled(false);
		}
	}
	else
	{
		// Else show all our children components
		ComponentList::const_iterator iterator;

		for(iterator = m_vpComponentList.begin(); iterator != m_vpComponentList.end(); ++iterator)
		{
			(*iterator)->SetVisible(true);
			(*iterator)->SetEnabled(true);
		}
	}

	m_titleBar->SetVisible(true);
	m_titleBar->SetEnabled(true);

	SetLocation(GetLocation().m_x, GetLocation().m_y);
}
示例#9
0
void GUIWindow::SetLocation(const Point& p)
{
    int x = p.m_x;
    int y = p.m_x;

	SetLocation(x, y);
}
示例#10
0
/** \brief Handle updates in time of our fish
*
* This is called before we draw and allows us to
* move our fish. We add our speed times the amount
* of time that has elapsed.
* \param elapsed Time elapsed since the class call
*/
void CFish::Update(double elapsed)
{
	SetLocation(GetX() + mSpeedX * elapsed,
		GetY() + mSpeedY * elapsed);

	// X movement
	if (mSpeedX > 0 && GetX() + GetWidth()/2 + flipOffset >= GetAquarium()->GetWidth())
	{
		mSpeedX = -mSpeedX;
		SetMirror(mSpeedX < 0);
	}
	else if (mSpeedX < 0 && GetX() - GetWidth()/2 - flipOffset <= 0){
		mSpeedX = -mSpeedX;
		SetMirror(mSpeedX < 0);
	}

	// Y movement
	if (mSpeedY > 0 && GetY() + GetHeight() / 2 + heightOffset >= GetAquarium()->GetHeight())
	{
		mSpeedY = -mSpeedY;
	}
	else if (mSpeedY < 0 && GetY() - GetHeight() / 2 - heightOffset <= 0){
		mSpeedY = -mSpeedY;
	}

}
示例#11
0
void CDayPlanSlider::OnMouseMove(LPARAM lParam)
{
	POINT p = { static_cast<short>(LOWORD(lParam)), static_cast<short>(HIWORD(lParam)) };
//    MapWindowPoints(m_hwnd, m_parent, &p, 1);
	RECT rp;
	GetClientRect(m_parentHwnd, &rp);
    int x = p.x;
    int offset = quickTabWidth + 2;
    if(x - offset > 70 && x + offset < rp.right)
    {
		RECT r = { left, top, right, bottom };
        SetLocation(x - offset, 0);

		RECT rr = { m_pLeft->left, m_pLeft->top, m_pLeft->right, m_pLeft->bottom };
		r = rr;
        r.right = x - 3;
		rp.left += 70;
        m_pLeft->SetBounds(rp.left, 0, r.right - r.left, r.bottom);
        
        r.left = x + 3;
        m_pRight->SetBounds(r.left, 0, rp.right - r.left, r.bottom);
        
        CalcPosition();

		InvalidateRect(m_parentHwnd, NULL, FALSE);
//		UpdateWindow(m_parent);
    }	
}
示例#12
0
Node::Node(const string& name, const Point_3& loc, double r, double s) :
    Name(name),
	Properties(0),
	Neighbors() { 
		SetLocation(loc);
		SetSquaredRange(r);
		SetSpeed(s);
}
void
GlueMapWindow::PanTo(const GeoPoint &location)
{
  follow_mode = FOLLOW_PAN;
  SetLocation(location);

  FullRedraw();
}
示例#14
0
void AZanshinAIController::FindNextPathNode()
{
	PathIndex++;
	if (!LocationsToWalk.IsValidIndex(PathIndex)) {
		PathIndex = 0;
	}

	SetLocation();
}
// Configuration methods
void CClickWindowController::InitDefaults()
{
	SetFastMode (false);
	SetDesign (CClickWindowController::NORMAL);	
	//SetDockingMode(CClickWindowController::TOP_DOCKING);
	SetLocation (CClickWindowController::TOP_DOCKED);
	SetAutohide(false);
	//m_status= CClickWindowController::HIDDEN;
}
示例#16
0
/**
 *	Handles the creation of world objects (town signs, wells, etc).
 *
 *	Called whenever a world object should be initialized.
 */
cWorldObject::cWorldObject(WORD type, DWORD dwGUID, cLocation *pcLoc, char *szName, char *szDesc)
{
	SetLocation(pcLoc);
	m_dwGUID = dwGUID;
	m_strName.assign( szName );
	m_strDescription.assign( szDesc );
	m_dwModel = type;
	m_fStatic = TRUE;
}
示例#17
0
void
TBarWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kFindButton:
		{
			BMessenger tracker(kTrackerSignature);
			tracker.SendMessage(message);
			break;
		}

		case 'gloc':
			GetLocation(message);
			break;

		case 'sloc':
			SetLocation(message);
			break;

		case 'gexp':
			IsExpanded(message);
			break;

		case 'sexp':
			Expand(message);
			break;

		case 'info':
			ItemInfo(message);
			break;

		case 'exst':
			ItemExists(message);
			break;

		case 'cwnt':
			CountItems(message);
			break;

		case 'adon':
		case 'icon':
			AddItem(message);
			break;

		case 'remv':
			RemoveItem(message);
			break;

		case 'iloc':
			GetIconFrame(message);
			break;

		default:
			BWindow::MessageReceived(message);
			break;
	}
}
示例#18
0
TextBox::TextBox(std::string text, SDL_Rect location, Renderer *renderer)
{
  SetLocation(location);
  SDL_Color color = { 160, 160, 160, 255};
  SetTexture(TextureFactory::CreateWindowTexture(location.w, location.h, color, renderer));

  std::unique_ptr<TextField> element(new TextField(text, 13, location, renderer));
  AddWindow(std::move(element));
}
示例#19
0
/** \brief Handle updates in time of our fish
*
* This is called before we draw and allows us to
* move our fish. We add our speed times the amount
* of time that has elapsed.
* \param elapsed Time elapsed since the class call
*/
void CFish::Update(double elapsed)
{
	SetLocation(GetX() + mSpeedX * elapsed,
		GetY() + mSpeedY * elapsed);


	int reverseAtXLocation = BackgroundWidth - EdgeTolerance - (GetImageWidth() / 2);
	int reverseAtStart = BackgroundWidth - reverseAtXLocation;

	int HitTopYLocation = BackgroundHeight - 2 * EdgeTolerance - (GetImageHeight() / 2);
	int HitBottomYLocation = BackgroundHeight  - EdgeTolerance - HitTopYLocation;


	//Fish logic to stay inbounds
	if (mSpeedX > 0 && GetX() >= reverseAtXLocation)
	{
		mSpeedX = -mSpeedX;
		SetMirror(mSpeedX < 0);
	}
	else if (mSpeedX < 0 && GetX() <= reverseAtStart)
	{
		mSpeedX = abs(mSpeedX);
		SetMirror(false);
	}
	else if (mSpeedY > 0 && GetY() >= HitTopYLocation)
	{
		mSpeedY = -mSpeedY;
	}
	else if (mSpeedY < 0 && GetY() <= HitBottomYLocation)
	{
		mSpeedY = -mSpeedY;
	}

	BreedingUpdate(elapsed);
	AgeUpdate(elapsed);	

	//increases the time used to track feeding for fish
	mTimeFeeding++;

	//adjusts the fishes condtion based on the time since they were fed
	if (mTimeFeeding < TimeTillHungry)
	{
		mIsHungry = false;
		mIsDead = false;
		this->SetNotHungryImage();
	}
	else if (mTimeFeeding >= TimeTillHungry && mTimeFeeding < (TimeTillDead))
	{
		mIsHungry = true;
		this->SetHungryImage();
	}
	else if (mTimeFeeding >= TimeTillDead)
	{
		mIsDead = true;
	}
}
示例#20
0
/**
 *	Handles the creation of housing hooks.
 *
 *	Called whenever a housing hook object should be initialized.
 */
cHooks::cHooks( WORD type, DWORD dwGUID, DWORD dwHouseID, char *szName, char *szDescription, cLocation *pcLoc )
{
	SetLocation( pcLoc );
	m_dwGUID = dwGUID;
	m_strName.assign( szName );
	m_strDescription.assign( szDescription );
	m_dwModel = type;
	m_fStatic = TRUE;
	m_dwHouseID = dwHouseID;
}
示例#21
0
void Yarn::Update()
{
	
	float deltaTime = Timing::sInstance.GetDeltaTime();

	SetLocation( GetLocation() + mVelocity * deltaTime );
	

	//we'll let the cats handle the collisions
}
示例#22
0
void
GlueMapWindow::SetLocationLazy(const GeoPoint location)
{
  const fixed distance_meters =
    visible_projection.GetGeoLocation().Distance(location);
  const fixed distance_pixels =
    visible_projection.DistanceMetersToPixels(distance_meters);
  if (distance_pixels > fixed_half)
    SetLocation(location);
}
示例#23
0
GPortRef & GPortRef::Assign(const GPortRef & src)
{
    SetPortType(src.GetPortType());
    SetLocation(src.GetLocation());
    SetDisplayName(src.GetDisplayName());
    SetUSBVendorID(src.GetUSBVendorID());
    SetUSBProductID(src.GetUSBProductID());

    return (*this);
}
示例#24
0
/**
* brief Load the attributes for an Fish node.
*
* \param node The Xml node we are loading the item from
*/
void CFish::XmlLoad(const std::shared_ptr<xmlnode::CXmlNode> &node)
{
	SetLocation(node->GetAttributeDoubleValue(L"x", 0), node->GetAttributeDoubleValue(L"y", 0));
	SetSpeed(node->GetAttributeDoubleValue(L"speedx", 0), node->GetAttributeDoubleValue(L"speedy", 0));
	SetBreed(node->GetAttributeDoubleValue(L"gestatingTime", 0), node->GetAttributeDoubleValue(L"interestTime", 0), 
		node->GetAttributeDoubleValue(L"isInterested", 0), node->GetAttributeDoubleValue(L"isGestating", 0), node->GetAttributeDoubleValue(L"canBreed", 0), node->GetAttributeDoubleValue(L"isMale", 0));
	SetFeeding(node->GetAttributeDoubleValue(L"feedingTime", 0), node->GetAttributeDoubleValue(L"isHungry", 0));
	SetAge(node->GetAttributeDoubleValue(L"age", 0));

}
示例#25
0
extern  void    DFSegRange( void ) {
    /****************************/
    /* do arange for the current segment */
    back_handle bck;
    offset      off;
    offset      size;

    if( !_IsModel( DBG_LOCALS | DBG_TYPES ) )return;
    size = AskMaxSize();
    if( size > 0 ) {
        bck = MakeLabel();
        off = AskLocation();
        SetLocation( 0 );
        DataLabel( bck->lbl );
        SetLocation( off );
        ARange = bck;
        DWAddress( Client, size );
        BEFreeBack( bck );
    }
}
示例#26
0
void Yarn::InitFromShooter( GameObjectPtr inShooter, GameObjectPtr inTarget )
{
	SetPlayerId( inShooter->GetPlayerId() );

	Vector3 forward = inTarget->GetLocation() - inShooter->GetLocation();
	SetVelocity( forward * kMuzzleSpeed );
	SetLocation( inShooter->GetLocation() );

	mShooterCat = inShooter;
	mTargetCat = inTarget;
}
示例#27
0
void CGUIMoverControl::Move(int iX, int iY)
{
  int iLocX = m_iLocationX + iX;
  int iLocY = m_iLocationY + iY;
  // check if we are within the bounds
  if (iLocX < m_iX1) iLocX = m_iX1;
  if (iLocY < m_iY1) iLocY = m_iY1;
  if (iLocX > m_iX2) iLocX = m_iX2;
  if (iLocY > m_iY2) iLocY = m_iY2;
  // ok, now set the location of the mover
  SetLocation(iLocX, iLocY);
}
示例#28
0
bool RTFparfmt::ApplyStyle(const RTFparfmt* pStyleDef, int iStyle)
{
	m_iStyle = iStyle;
	GetFileContext()->sm_iPersistStyleIntoTextboxAsWordFailsToDoSo = m_iStyle;
	SetLocation(pStyleDef->m_fLocation); // Complains that we haven't already set it

	// were initially all tested to be >= 0 but now are applied all the time
	m_iLevel                  = pStyleDef->m_iLevel;
	m_iOutlineLevel           = pStyleDef->m_iOutlineLevel;
	m_iAutoHyphenate          = pStyleDef->m_iAutoHyphenate;
	m_Alignment               = pStyleDef->m_Alignment;
	m_iIndentFirst            = pStyleDef->m_iIndentFirst;
	m_iIndentLeft             = pStyleDef->m_iIndentLeft;
	m_iIndentRight            = pStyleDef->m_iIndentRight;
	m_iSpaceBefore            = pStyleDef->m_iSpaceBefore;
	m_iSpaceAfter             = pStyleDef->m_iSpaceAfter;
	m_iLineSpacing            = pStyleDef->m_iLineSpacing;
	m_ls                      = pStyleDef->m_ls;
	m_ilvl                    = pStyleDef->m_ilvl;
	m_iPard                   = pStyleDef->m_iPard;
	m_iSpacing                = pStyleDef->m_iSpacing;
	m_iRowHeight              = pStyleDef->m_iRowHeight;
	m_iLeftpos                = pStyleDef->m_iLeftpos;
	m_iTableIndent			  = pStyleDef->m_iTableIndent;
	m_iTableIndentType		  = pStyleDef->m_iTableIndentType;
	m_CellTextDirection       = pStyleDef->m_CellTextDirection;
	m_CellTextVerAlignment	  = pStyleDef->m_CellTextVerAlignment;
	Flags.byBits.m_bBreakBeforePara		   = pStyleDef->Flags.byBits.m_bBreakBeforePara;
	Flags.byBits.m_bHMergeFirst            = pStyleDef->Flags.byBits.m_bHMergeFirst;
	Flags.byBits.m_bHMergeLast             = pStyleDef->Flags.byBits.m_bHMergeLast;
	Flags.byBits.m_bVMergeFirst            = pStyleDef->Flags.byBits.m_bVMergeFirst;
	Flags.byBits.m_bVMergeLast             = pStyleDef->Flags.byBits.m_bVMergeLast;
	Flags.byBits.m_bSideBySide             = pStyleDef->Flags.byBits.m_bSideBySide;
	Flags.byBits.m_bHeader                 = pStyleDef->Flags.byBits.m_bHeader;
	Flags.byBits.m_bKeepTogether           = pStyleDef->Flags.byBits.m_bKeepTogether;
	Flags.byBits.m_bInTable                = pStyleDef->Flags.byBits.m_bInTable;
	Flags.byBits.m_bKeepIntact             = pStyleDef->Flags.byBits.m_bKeepIntact;
	Flags.byBits.m_bNoWidowOrOrphanControl = pStyleDef->Flags.byBits.m_bNoWidowOrOrphanControl;
	Flags.byBits.m_bWidowOrOrphanControl   = pStyleDef->Flags.byBits.m_bWidowOrOrphanControl;
	Flags.byBits.m_bKeepWithNext           = pStyleDef->Flags.byBits.m_bKeepWithNext;
	Flags.byBits.m_bNoLineNumbering        = pStyleDef->Flags.byBits.m_bNoLineNumbering;
	Flags.byBits.m_bSpacingIsMultiple      = pStyleDef->Flags.byBits.m_bSpacingIsMultiple;
	Flags.byBits.m_bReadsLeftToRight       = pStyleDef->Flags.byBits.m_bReadsLeftToRight;


    Flags.byBits.m_bSbAuto				   = pStyleDef->Flags.byBits.m_bSbAuto;
    Flags.byBits.m_bSaAuto				   = pStyleDef->Flags.byBits.m_bSaAuto;
    Flags.byBits.m_bContextualSpace		   = pStyleDef->Flags.byBits.m_bContextualSpace;
    //Flags.byBits.m_bTrAutofit			   = pStyleDef->Flags.byBits.m_bTrAutofit;

	return false;
}
示例#29
0
RTFparfmt& RTFparfmt::operator=(const RTFparfmt& rhs)
{
	SetLocation(rhs.m_fLocation); // Complains if we have already set it
	m_iLevel                  = rhs.m_iLevel                ;
	m_iStyle                  = rhs.m_iStyle                ;
	m_iOutlineLevel           = rhs.m_iOutlineLevel         ;
	m_iAutoHyphenate          = rhs.m_iAutoHyphenate        ;
	m_Alignment               = rhs.m_Alignment             ;
	m_iIndentFirst            = rhs.m_iIndentFirst          ;
	m_iIndentLeft             = rhs.m_iIndentLeft           ;
	m_iIndentRight            = rhs.m_iIndentRight          ;
	m_iSpaceBefore            = rhs.m_iSpaceBefore          ;
	m_iSpaceAfter             = rhs.m_iSpaceAfter           ;
	m_iLineSpacing            = rhs.m_iLineSpacing          ;
	m_LineSpacingRule         = rhs.m_LineSpacingRule       ;
	m_ls                      = rhs.m_ls                    ;
	m_ilvl                    = rhs.m_ilvl                  ;
	m_iPard                   = rhs.m_iPard                 ;
	m_iSpacing                = rhs.m_iSpacing              ;
	m_iRowHeight              = rhs.m_iRowHeight            ;
	m_iLeftpos                = rhs.m_iLeftpos              ;
	m_iTableIndent			  = rhs.m_iTableIndent			;
	m_iTableIndentType		  = rhs.m_iTableIndentType		;
	m_iTableftsWidth		  = rhs.m_iTableftsWidth		;
	m_iTablewWidth			  = rhs.m_iTablewWidth			;
	m_CellTextDirection       = rhs.m_CellTextDirection     ;
	m_CellTextVerAlignment	  = rhs.m_CellTextVerAlignment	;
	Flags.byDWORD			  = rhs.Flags.byDWORD			;
	m_iItap					  = rhs.m_iItap					;
	m_iPaddLeft				  = rhs.m_iPaddLeft				;
	m_iPaddRight			  = rhs.m_iPaddRight			;
	m_iPaddTop				  = rhs.m_iPaddTop				;
	m_iPaddBottom			  = rhs.m_iPaddBottom			;
	m_iPaddFLeft			  = rhs.m_iPaddFLeft			;
	m_iPaddFRight			  = rhs.m_iPaddFRight			;
	m_iPaddFTop				  = rhs.m_iPaddFTop				;
	m_iPaddFBottom			  = rhs.m_iPaddFBottom			;

	m_iCellPaddLeft			  = rhs.m_iCellPaddLeft			;
	m_iCellPaddRight		  = rhs.m_iCellPaddRight		;
	m_iCellPaddTop			  = rhs.m_iCellPaddTop			;
	m_iCellPaddBottom		  = rhs.m_iCellPaddBottom		;
	m_iCellPaddFLeft		  = rhs.m_iCellPaddFLeft		;
	m_iCellPaddFRight		  = rhs.m_iCellPaddFRight		;
	m_iCellPaddFTop			  = rhs.m_iCellPaddFTop			;
	m_iCellPaddFBottom		  = rhs.m_iCellPaddFBottom		;

	m_iCellftsWidth			  = rhs.m_iCellftsWidth			;
	m_iCellwWidth			  = rhs.m_iCellwWidth			;

	return *this;
}
示例#30
0
文件: Lightning.cpp 项目: NyouB/4t4c
LightningManager::LightningManager(void):LightPool(13)
{
	SetLocation(ELightLocation::OpenAir);
	//load the color tables
	FastStream Fst;
	if (!Fst.LoadFromFile(L".//gamefiles//lightloc_openair.dat"))
	{
		LOG("LightningManager : Unable to Load lightloc_openair.dat, Cannot continue\r\n");
		MessageBoxA(0,"Cannot open lightloc_openair.dat","fatal error",MB_OK);
		
	};
	Fst.Read(LightTables[ELightLocation::OpenAir],1440*sizeof(unsigned long));
};