Esempio n. 1
0
BOOL CMemCommBase::Create(UINT32 dwSize, BOOL bLock, EnumOperType opType, string &strName)
{
	switch(opType)
	{
	case MEM_COMM_OPEN://打开
		{
			return Open(dwSize,bLock,strName);
		}
	case MEM_COMM_CREATE://创建
		{
			return ReCreate(dwSize,bLock,strName);
		}
	case MEM_COMM_OPEN_CREATE://尝试打开后创建
		{
			if (Open(dwSize,bLock,strName) == TRUE)	
			{
				return TRUE;
			}
			return ReCreate(dwSize,bLock,strName);
		}
	default:
		return FALSE;
	}
	return FALSE;

}
Esempio n. 2
0
void CLightning::Create(Vec3f aeFrom, Vec3f aeTo) {
	
	SetDuration(ulDuration);
	
	m_eSrc = aeFrom;
	m_eDest = aeTo;
	
	ReCreate(15);
}
Esempio n. 3
0
void CClientCheckpoint::SetSize ( float fSize )
{
    // Different from our current size
    if ( m_fSize != fSize )
    {
        // Set the new size and recreate
        m_fSize = fSize;
        ReCreate ();
    }
}
Esempio n. 4
0
void CClientCheckpoint::SetColor ( const SColor color )
{
    // Different from our current color?
    if ( m_Color != color )
    {
        // Set it and recreate
        m_Color = color;
        ReCreate ();
    }
}
Esempio n. 5
0
void CDrawItem::ReCreate(ItemConstructionStruct* pConstructionStruct)
{
	ASSERT(pConstructionStruct);
	ReCreate(pConstructionStruct->str, 
		pConstructionStruct->wClr, 
		pConstructionStruct->wFont, 
		pConstructionStruct->dwItemStyle, 
		pConstructionStruct->dWidth, 
		pConstructionStruct->dwExtent);
}
Esempio n. 6
0
void CClientPickup::SetModel ( unsigned short usModel )
{
    // Different from our current id?
    if ( m_usModel != usModel )
    {
        // Set the model and recreate the pickup
        m_usModel = usModel;
        UpdateSpatialData ();
        ReCreate ();
    }
}
Esempio n. 7
0
void CClientPickup::SetPosition ( const CVector& vecPosition )
{
    // Different from our current position?
    if ( m_vecPosition != vecPosition )
    {
        // Set the new position and recreate it
        m_vecPosition = vecPosition;
        ReCreate ();

        // Update our streaming position
        UpdateStreamPosition ( vecPosition );
    }
}
Esempio n. 8
0
void CClientCheckpoint::SetCheckpointType ( unsigned long ulType )
{
    // Set the type
    unsigned long ulNewType;
    switch ( ulType )
    {
        case CClientCheckpoint::TYPE_NORMAL:
        {
            // Set the correct type depending on the icon we want inside
            if ( m_uiIcon == CClientCheckpoint::ICON_ARROW )
                ulNewType = CHECKPOINT_TUBE;
            else if ( m_uiIcon == CClientCheckpoint::ICON_FINISH )
                ulNewType = CHECKPOINT_ENDTUBE;
            else
                ulNewType = CHECKPOINT_EMPTYTUBE;

            break;
        }

        case CClientCheckpoint::TYPE_RING:
        {
            ulNewType = CHECKPOINT_TORUS;
            break;
        }

        default:
        {
            // Set the correct type depending on the icon we want inside
            if ( m_uiIcon == CClientCheckpoint::ICON_ARROW )
                ulNewType = CHECKPOINT_TUBE;
            else if ( m_uiIcon == CClientCheckpoint::ICON_FINISH )
                ulNewType = CHECKPOINT_ENDTUBE;
            else
                ulNewType = CHECKPOINT_EMPTYTUBE;

            break;
        }
    }

    // Different from our current type
    if ( m_dwType != ulNewType )
    {
        // Set it
        m_dwType = ulNewType;

        // Recreate it
        ReCreate ();
    }
}
Esempio n. 9
0
void CClientCheckpoint::SetDirection ( const CVector& vecDirection )
{
    // Different target position than already?
    if ( m_vecDirection != vecDirection )
    {
        // Set the direction and reset the target position
        m_vecTargetPosition = CVector ( 0.0f, 0.0f, 0.0f );
        m_vecDirection = vecDirection;

        // Recreate
        if ( GetCheckpointType () == CClientCheckpoint::TYPE_RING ||
             m_uiIcon == CClientCheckpoint::ICON_ARROW )
        {
            ReCreate ();
        }
    }
}
Esempio n. 10
0
HRESULT IDirect3DIndexBuffer9Managed::Lock(UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) 
{
  dbgf("IDirect3DIndexBuffer9Managed 0x%08X: lock: off %d, %d bytes, %s", this, OffsetToLock, SizeToLock, getLock(Flags));

  if(OffsetToLock+SizeToLock > bufSize)
    dbg("WARNING: Application attempted to lock too large indexbuffer (%d > %d)", OffsetToLock+SizeToLock, bufSize);

  if(!bufSys || !buf)
    return D3DERR_INVALIDCALL;
  // Return handle to system memory buffer
  *ppbData = bufSys+OffsetToLock;

#ifdef RECREATE_ON_REUSE
  if(!fullDirty && lockSections.size() == 0)
  {
    // First lock
    if(ReCreate())
    {
      fullDirty = true;
    }
  }
#endif

#ifndef LATE_IB_UPDATE
  LOCKSECTION l;
  l.lockOffset = OffsetToLock;
  l.lockSize = SizeToLock;
  lockSections.push_back(l);
#else
  if((OffsetToLock == 0 && SizeToLock == 0) || (OffsetToLock == 0 && SizeToLock == bufSize))
  {
    // Whole IB locked
    fullDirty = true;
  }
  else
  {
    LOCKSECTION l; // Dirty sections
    l.lockOffset = OffsetToLock;
    l.lockSize = SizeToLock;
    lockSections.push_back(l);
  }
#endif

  return D3D_OK;
}
Esempio n. 11
0
void CClientCheckpoint::SetNextPosition ( const CVector& vecPosition )
{
    // Different target position than already?
    if ( m_vecTargetPosition != vecPosition )
    {
        // Set the new target position and direction
        m_vecTargetPosition = vecPosition;
        m_vecDirection = m_vecTargetPosition - m_Matrix.vPos;
        m_vecDirection.Normalize ();

        // Recreate
        if ( GetCheckpointType () == CClientCheckpoint::TYPE_RING ||
             m_uiIcon == CClientCheckpoint::ICON_ARROW )
        {
            ReCreate ();
        }
    }
}
Esempio n. 12
0
void CClientCheckpoint::SetIcon ( unsigned int uiIcon )
{
    // Different from our current icon?
    if ( m_uiIcon != uiIcon )
    {
        // Set the new icon
        m_uiIcon = uiIcon;

        // Normal checkpoint?
        if ( GetCheckpointType () == CClientCheckpoint::TYPE_NORMAL )
        {
            // Update the type
            unsigned long ulNewType;
            switch ( uiIcon )
            {
                case CClientCheckpoint::ICON_NONE:
                    ulNewType = CHECKPOINT_EMPTYTUBE;
                    break;

                case CClientCheckpoint::ICON_ARROW:
                    ulNewType = CHECKPOINT_TUBE;
                    break;

                case CClientCheckpoint::ICON_FINISH:
                    ulNewType = CHECKPOINT_ENDTUBE;
                    break;

                default:
                    ulNewType = CHECKPOINT_EMPTYTUBE;
                    break;
            }

            // Different from our previous type?
            if ( ulNewType != m_dwType )
            {
                // Set the new type and recreate the checkpoint
                m_dwType = ulNewType;
                ReCreate ();
            }
        }
    }
}
Esempio n. 13
0
void CLightning::Render()
{
	if(ulCurrentTime >= ulDuration)
		return;
	
	if(m_iTTL <= 0) {
		fTotoro = 0;
		fMySize = 2;
		ReCreate(8);
	}
	
	Vec3f ePos;
	
	float fBeta = 0.f;
	float falpha = 0.f;
	
	if(m_isMassLightning) {
		ePos = Vec3f_ZERO;
	} else {
		ePos = m_pos;
		fBeta = m_beta;
		falpha = m_alpha;
	}
	
	float f = 1.5f * fMySize;
	m_cnodetab[0].f = randomVec(-f, f);
	
	RenderMaterial mat;
	mat.setCulling(Renderer::CullNone);
	mat.setDepthTest(false);
	mat.setBlendType(RenderMaterial::Additive);
	
	float fbeta = fBeta + rnd() * 2 * fMySize;

	for(size_t i = 0; i < m_nbtotal && i <= fTotoro; i++) {
		CLightningNode & node = m_cnodetab[i];
		
		Vec3f astart = m_cnodetab[node.parent].pos + m_cnodetab[node.parent].f;
		float temp = 1.5f * fMySize;
		Vec3f z_z = m_cnodetab[node.parent].f + randomVec(-temp, temp);
		float zz = node.size + node.size * 0.3f * rnd();
		float xx = node.size * glm::cos(glm::radians(-fbeta));
		node.f = z_z;
		
		Vec3f a = node.pos + z_z;
		if(!m_isMassLightning) {
			Vec3f vv2;
			Vec3f vv1 = astart;
			vv1 = VRotateX(vv1, (falpha));  
			vv2 = VRotateY(vv1, 180 - MAKEANGLE(fBeta));
			astart = vv2;
			vv1 = a;
			vv1 = VRotateX(vv1, (falpha)); 
			vv2 = VRotateY(vv1, 180 - MAKEANGLE(fBeta));
			a = vv2;
			astart += ePos;
			a += ePos;
		}
		
		if(i % 4 == 0) {
			Sphere sphere;
			sphere.origin = a;
			sphere.radius = std::min(node.size, 50.f);

			if(CheckAnythingInSphere(sphere, m_caster, CAS_NO_SAME_GROUP)) {

				DamageParameters damage;
				damage.pos = sphere.origin;
				damage.radius = sphere.radius;
				damage.damages = m_fDamage * m_level * ( 1.0f / 3 );
				damage.area = DAMAGE_FULL;
				damage.duration = 1;
				damage.source = m_caster;
				damage.flags = DAMAGE_FLAG_DONT_HURT_SOURCE | DAMAGE_FLAG_ADD_VISUAL_FX;
				damage.type = DAMAGE_TYPE_FAKEFIRE | DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_LIGHTNING;
				DamageCreate(damage);
			}
		}
		
		{
		TexturedQuad q;
		
		q.v[0].color = Color(255, 255, 255, 255).toRGBA();
		q.v[1].color = Color(0, 0, 90, 255).toRGBA();
		q.v[2].color = Color(0, 0, 90, 255).toRGBA();
		q.v[3].color = Color(255, 255, 255, 255).toRGBA();
		q.v[0].uv = Vec2f(0.5f, 0.f);
		q.v[1].uv = Vec2f_ZERO;
		q.v[2].uv = Vec2f_Y_AXIS;
		q.v[3].uv = Vec2f(0.5f, 1.f);
		q.v[0].p = astart;
		q.v[1].p = astart + Vec3f(0.f, zz, 0.f);
		q.v[2].p = a + Vec3f(0.f, zz, 0.f);
		q.v[3].p = a;
		
		drawQuadRTP(mat, q);
		}
		
		{
		TexturedQuad q;

		q.v[0].color = Color(255, 255, 255, 255).toRGBA();
		q.v[1].color = Color(0, 0, 90, 255).toRGBA();
		q.v[2].color = Color(0, 0, 90, 255).toRGBA();
		q.v[3].color = Color(255, 255, 255, 255).toRGBA();
		q.v[0].uv = Vec2f(0.5f, 0.f);
		q.v[1].uv = Vec2f_X_AXIS;
		q.v[2].uv = Vec2f_ONE;
		q.v[3].uv = Vec2f(0.5f, 1.f);
		q.v[0].p = astart;
		q.v[1].p = astart - Vec3f(0.f, zz, 0.f);
		q.v[2].p = a - Vec3f(0.f, zz, 0.f);
		q.v[3].p = a;
		
		drawQuadRTP(mat, q);
		}
		
		zz *= glm::sin(glm::radians(fbeta));
		
		{
		TexturedQuad q;
		
		q.v[0].color = Color(255, 255, 255, 255).toRGBA();
		q.v[1].color = Color(0, 0, 90, 255).toRGBA();
		q.v[2].color = Color(0, 0, 90, 255).toRGBA();
		q.v[3].color = Color(255, 255, 255, 255).toRGBA();
		q.v[0].uv = Vec2f(0.5f, 0.f);
		q.v[1].uv = Vec2f_X_AXIS;
		q.v[2].uv = Vec2f_ONE;
		q.v[3].uv = Vec2f(0.5f, 1.f);
		q.v[0].p = astart;
		q.v[1].p = astart + Vec3f(xx, 0.f, zz);
		q.v[2].p = a + Vec3f(xx, 0.f, zz);
		q.v[3].p = a;
		
		drawQuadRTP(mat, q);
		}
		
		{
		TexturedQuad q;
		
		q.v[0].color = Color(255, 255, 255, 255).toRGBA();
		q.v[1].color = Color(0, 0, 90, 255).toRGBA();
		q.v[2].color = Color(0, 0, 90, 255).toRGBA();
		q.v[3].color = Color(255, 255, 255, 255).toRGBA();
		q.v[0].uv = Vec2f(0.5f, 0.f);
		q.v[1].uv = Vec2f_ZERO;
		q.v[2].uv = Vec2f_Y_AXIS;
		q.v[3].uv = Vec2f(0.5f, 1.f);
		q.v[0].p = astart;
		q.v[1].p = astart - Vec3f(xx, 0.f, zz);
		q.v[2].p = a - Vec3f(xx, 0.f, zz);
		q.v[3].p = a;
		
		drawQuadRTP(mat, q);
		}
	}
}