Exemplo n.º 1
0
void AMech_RPGCharacter::PostHealthChange(FHealthChange healthChange)
{
	CLAMP(health, GetMaxHealth(), 0);

	if (OnPostHealthChange.IsBound()) {
		OnPostHealthChange.Broadcast(healthChange);
	}

	UFloatingTextUI::CreateFloatingText(floatingTextClass, healthChange);

	if (health <= 0) {
		health = 0;
		SetDead(true);
		SetActorHiddenInGame(true);
		if (GetCurrentWeapon() != nullptr) GetCurrentWeapon()->SetActorHiddenInGame(true);
		OnStopFiring.Broadcast();
		healthChange.manipulator->EnemyKilled(this);

		if (GetGroup()->GetPlayer() == nullptr) {
			ItemEnumns::ItemType type = UMiscLibrary::GetRandomEnum(ItemEnumns::Resource);
			AItem* newItem = CalucluateItemDrop(healthChange.manipulator->GetGroup(), type);
			AItemPickup::CreateItemPickup(newItem)->SetActorLocation(GetActorLocation());
		}
	}

	if (GetFloatingStats() != nullptr) {
		GetFloatingStats()->UpdateHealthBar();
	}

	if (GetCharacterStats() != nullptr) {
		GetCharacterStats()->UpdateHealthBar();
	}
}
Exemplo n.º 2
0
void CNetworkPlayer::Respawn( void )
{
	DEBUG_TRACE("CNetworkPlayer::Respawn");

	// Is the localplayer not spawned?
	if( !pCore->GetPlayerManager()->GetLocalPlayer()->IsSpawned() )
		return;

	// Is the player inactive?
	if( !m_pPlayerPed )
		return;

	// Deactivate the player ped
	m_pPlayerPed->Deactivate();

	// Activate the player ped
	m_pPlayerPed->Activate();

	// Restore invulnerability
	m_pPlayerPed->SetInvulnerable( true );

	// Set the player health
	m_pPlayerPed->SetHealth( 720.0f );

	// Mark as not dead
	SetDead( false );

	// Mark as spawned
	SetSpawned( true );

	// Reset the playerstate
	m_playerState = ePlayerState::PLAYERSTATE_ONFOOT;
}
Exemplo n.º 3
0
void Unit::update(float eTime) {
    Thing::update(eTime);

    //Status가 살아있고, HP가 0보다 작을 때, 죽은 상태로 전환한다.
    if( GetHp() <= 0 && IsAlive() ) {
        SetDead();
    }

    //유한 상태 기계
    m_pFSM->Update(eTime);

    //체력, 마나 리젠
    m_fHp += m_fHpRegen * eTime;
    m_fMp += m_fMpRegen * eTime;
    MathMgr->Clamp(m_fHp,0,m_fMaxHp);
    MathMgr->Clamp(m_fMp, 0, m_fMaxMp);

    //방향 설정한다.
    //dir : 0~360
    m_iPrevDir = m_iDir;
    float Angle = static_cast<float>( (acos(m_vHeading.dot(Vec2(1,0)))) *
                                      180.0f / MathMgr->Pi *
                                      m_vHeading.sign(Vec2(1, 0))) + 180;

    m_iDir = (int)(Angle / 22.5);
    MathMgr->Clamp(m_iDir, 0, 15);

    //유닛이 맵 전체에서 나가지 못하게 한다.
    //MathMgr->Clamp(_position.x,30,GAME_SCREEN_WIDTH-30);
    //MathMgr->Clamp(_position.y, 30, GAME_SCREEN_HEIGHT - 30);

}
Exemplo n.º 4
0
void EjectedPilotClass::HitGround()
{
	if(drawPointer){
		OTWDriver.RemoveObject(drawPointer, TRUE);
		drawPointer = NULL;
	}

	if (_stage != PD_SAFE_LANDING ){
		// No strength left.
		strength = 0.0;
		pctStrength = 0.0;

		// Send the death message
		if(_deathMsg != NULL)
		{
			FalconSendMessage (_deathMsg,FALSE);
			_deathMsg = NULL;
		}

		// Dead.  No countdown.  Just dead.
		dyingTimer = 0.0f;
	}

	// Right now, handle the same way whether dead or alive, just destroy
	// the object.
	SetDead(TRUE);
    SetExploding(TRUE);
}
void Host :: UpdateParameters(double timeStep, double simulationTime)
{
	age += (timeStep/YEAR);
	
	//update (get) all the information for each infection
	double vl = 0.0;
	double extra_vl = 0.0;
	list<Infection>::iterator it = infections.begin();
	while(it != infections.end())
	{
		it->SetInfectionType(simulationTime);
		if(it->IsCured())
		{//if the infection has been cleared again,remove it from the infections list!
			it = infections.erase(it);
			continue;
		}
		if(it->GetViralLoad() > vl)
			vl = it->GetViralLoad();
		if(it->GetDeadFlag()==true)
			SetDead();
		
		it++;
		//extra_vl += 0.0005;
	}
	viralDeathRate = vl+extra_vl;
	numberOfInfections = CountInfections();
}
Exemplo n.º 6
0
void FlareClass::UpdateTrail (void)
{
 	Tpoint newPoint;
    
	newPoint.x = XPos();
	newPoint.y = YPos();
	newPoint.z = ZPos();

	// I-Hawk - Removed, flare's trail isn't managed here anymore but from PS

/*	OTWDriver.AddTrailHead (trail, newPoint.x, newPoint.y, newPoint.z);
	 // OTWDriver.TrimTrail(trail, 25); // MLR 12/14/2003 - removed
//	DrawableParticleSys::PS_UpdateTrail((PS_PTR)trail, XPos(), YPos(), ZPos());
	//trail = (DrawableTrail*)DrawableParticleSys::PS_EmitTrail((TRAIL_HANDLE)trail, TRAIL_FLARE, XPos(), YPos(), ZPos());

	trailGlow->SetPosition( &newPoint );
	trailSphere->SetPosition( &newPoint );
	((Drawable2D *)drawPointer)->SetPosition( &newPoint );
*/    
	if (SimLibElapsedTime - timeOfDeath > 10 * SEC_TO_MSEC){
      SetDead (TRUE);
	}
	
	BombClass::UpdateTrail();
	
}
Exemplo n.º 7
0
void C4Effect::Kill(C4Object *pObj) {
  // active?
  C4Effect *pLastRemovedEffect = NULL;
  if (IsActive())
    // then temp remove all higher priority effects
    TempRemoveUpperEffects(pObj, false, &pLastRemovedEffect);
  else
      // otherwise: temp reactivate before real removal
      // this happens only if a lower priority effect removes an upper priority
      // effect in its add- or removal-call
      if (pFnStart && iPriority != 1)
    pFnStart->Exec(pCommandTarget,
                   &C4AulParSet(C4VObj(pObj), C4VInt(iNumber),
                                C4VInt(C4FxCall_TempAddForRemoval)));
  // remove this effect
  int32_t iPrevPrio = iPriority;
  SetDead();
  if (pFnStop)
    if (pFnStop->Exec(pCommandTarget,
                      &C4AulParSet(C4VObj(pObj), C4VInt(iNumber))).getInt() ==
        C4Fx_Stop_Deny)
      // effect denied to be removed: recover
      iPriority = iPrevPrio;
  // reactivate other effects
  TempReaddUpperEffects(pObj, pLastRemovedEffect);
}
Exemplo n.º 8
0
void CNetworkPlayer::HandlePlayerDeath( void )
{
	DEBUG_TRACE("CNetworkPlayer::HandlePlayerDeath");

	// Is the localplayer not spawned?
	if( !pCore->GetPlayerManager()->GetLocalPlayer()->IsSpawned() )
		return;

	// Is the player invalid?
	if( !IsSpawned() || !m_pPlayerPed )
		return;

	// Reset invulnerability
	m_pPlayerPed->SetInvulnerable( false );

	// Set the player health
	m_pPlayerPed->SetHealth( 0.0f );

	// Mark as dead
	SetDead( true );

	// Mark as not spawned
	SetSpawned( false );

	// Are we in a vehicle as driver?
	if( IsInVehicle() )
	{
		// Reset the vehicle interpolation
		m_pVehicle->ResetInterpolation();
	}

	// Set the playerstate
	m_playerState = ePlayerState::PLAYERSTATE_DEAD;
}
Exemplo n.º 9
0
/*
 * dead_link - Adds client to a list of clients that need an exit_client()
 *
 */
void dead_link(struct Client *client_p)
{
  dlink_node *m;
  const char *notice;
  if(IsClosing(client_p))
    return;

  linebuf_donebuf(&client_p->localClient->buf_recvq);
  linebuf_donebuf(&client_p->localClient->buf_sendq);
  
  if(client_p->flags & FLAGS_SENDQEX)
    notice = "Max SendQ exceeded";
  else
    notice = "Dead link";
    	
  if (!IsPerson(client_p) && !IsUnknown(client_p) && !IsClosing(client_p))
  {
    sendto_realops_flags(FLAGS_ALL, L_ADMIN,
                         notice, get_client_name(client_p, HIDE_IP));
    sendto_realops_flags(FLAGS_ALL, L_OPER,
                         notice, get_client_name(client_p, MASK_IP));
  }
  Debug((DEBUG_ERROR, notice, get_client_name(to, HIDE_IP)));
  assert(dlinkFind(&abort_list, client_p) == NULL);
  m = make_dlink_node();
  dlinkAdd(client_p, m, &abort_list);
  SetDead(client_p); /* You are dead my friend */
}
Exemplo n.º 10
0
void C4Effect::Kill()
{
	// active?
	C4Effect *pLastRemovedEffect=NULL;
	if (IsActive())
		// then temp remove all higher priority effects
		TempRemoveUpperEffects(false, &pLastRemovedEffect);
	else
		// otherwise: temp reactivate before real removal
		// this happens only if a lower priority effect removes an upper priority effect in its add- or removal-call
		if (iPriority!=1) CallStart(C4FxCall_TempAddForRemoval, C4Value(), C4Value(), C4Value(), C4Value());
	// remove this effect
	int32_t iPrevPrio = iPriority; SetDead();
	if (CallStop(C4FxCall_Normal, false) == C4Fx_Stop_Deny)
		// effect denied to be removed: recover
		iPriority = iPrevPrio;
	// reactivate other effects
	TempReaddUpperEffects(pLastRemovedEffect);
	// Update OnFire cache
	if (Target && WildcardMatch(C4Fx_AnyFire, GetName()))
		if (!Get(C4Fx_AnyFire))
			Target->SetOnFire(false);
	if (IsDead() && !GetCallbackScript())
		Call(P_Destruction, &C4AulParSet(C4FxCall_Normal));
}
Exemplo n.º 11
0
int FlareClass::Exec(){
	if (trail){
	   // I-Hawk - Removed, flare's trail isn't managed here anymore but from PS
		//UpdateTrail();
		if (SimLibElapsedTime - timeOfDeath > 10 * SEC_TO_MSEC){
			SetDead (TRUE);
		}
	}
	
	BombClass::Exec();
	
	if(IsExploding())
	{
		SetFlag( SHOW_EXPLOSION );
		SetDead(TRUE);
		return TRUE;
	}
	
	// MLR 2003-11-15 flares were going thru the ground
	{
		float z;
		
		z = OTWDriver.GetGroundLevel(XPos(), YPos());
		if(ZPos() > z)
		{
			int gtype = OTWDriver.GetGroundType(XPos(),YPos());
			
			switch(gtype)
			{
			case COVERAGE_WATER:
			case COVERAGE_RIVER:
			case COVERAGE_SWAMP:
				// flare went into water.
				SetDead(TRUE);
				break;
			default:
				// give em a slight bounce.
				SetDelta((SM_SCALAR)(XDelta() * .25), (SM_SCALAR)(YDelta() * .25), (SM_SCALAR)(-ZDelta() * .25));
				SetPosition(XPos(),YPos(),z);
				break;
			}
		}
	}
	
	SetDelta (XDelta() * 0.99F, YDelta() * 0.99F, ZDelta() * 0.99F);
	return TRUE;
}
Exemplo n.º 12
0
void CLocalPlayer::HandleSpawn( bool bRespawn )
{
	// Are we respawning and not dead?
	if( bRespawn && !IsDead() )
		return;

	// Have we already just spawned?
	if( (SharedUtility::GetTime() - m_ulSpawnTime) < 500 )
		return;

	// Set the spawn time
	m_ulSpawnTime = SharedUtility::GetTime();

	// Reset the death time
	m_ulDeathTime = 0;

	// Set the state
	SetState( ePlayerState::PLAYERSTATE_ONFOOT );

	// Mark as not dead
	SetDead( false );

	// Mark as spawned
	SetSpawned( true );

	// Are we in a vehicle?
	if( IsInVehicle() )
	{
		// Handle this enter with the network vehicle
		m_pVehicle->HandlePlayerExit( this, m_seat, false );

		// Reset the vehicle
		SetVehicle( NULL );

		// Reset the seat
		SetSeat( INVALID_ENTITY_ID );
	}

	// Reset the player position and rotation
	Teleport ( CVector3() );
	SetRotation ( CVector3() );

	// Send RPC to server
	pCore->GetNetworkModule()->Call( RPC_PLAYER_SPAWN, NULL, HIGH_PRIORITY, RELIABLE, true );

	// Restore the camera (TODO: Use real game function to reset camera behind player!)
	pCore->GetCamera()->LockControl ( false );
	LockControls ( false );

	// Restore the camera control
	pCore->GetCamera()->LockControl ( bOldCameraState );

	// Restore the control state
	LockControls ( bOldCTRLState );
}
Exemplo n.º 13
0
void Enemy::Move(){
	bool addFrame = false;
	switch(GetState()){
	case Born:
		if(_BornFunc == nullptr){
			SetState(Exist);
			SetDeletable(true);
		}else{
			_BornFunc(*this);
			AddVxVy2XY();
			addFrame = true;
		}
		break;
	case Exist:
		if(_MoveFunc != nullptr){_MoveFunc(*this);}
		AddVxVy2XY();
		if(GetDeletable() == true && InScreen(GetX(),GetY(),-GetHitW(),-GetHitH()) == false){
			SetDead();
			break;
		}
		addFrame = true;
		//ここにショット関係
		while(GetShotWait() ==0){
			EnemyBullet::CreateInfo obj;
			EnemyBullet::ReturnInfo result;

			obj.x=GetX();
			obj.y=GetY();
			obj.MoveFunc=_ShotFunc;
			obj.shotCount=_shotCnt;
			obj.image = _bulletImg;
			obj.angleB4 = _angleShotB4;
			_bulletPtr->Create(obj,result);
			_angleShotB4 = result.angleShot;
			_shotCnt += result.shotCount;
			SetShotWait(result.waitFrame);
		}
		DecreaseShotWait();

		break;
	case Dead:
		if(_DeadFunc == nullptr){
			SetState(NotExist);
		}else{
			_DeadFunc(*this);
			AddVxVy2XY();
			addFrame = true;
		}

		break;
	case NotExist:
		break;
	}
	if(addFrame){AddFrame();}
}
Exemplo n.º 14
0
void CLocalPlayer::OnDeath( CNetworkPlayer * pKiller )
{
	// Are we not marked as dead?
	if( !IsDead() )
	{
		// Get the old camera lock state
		bOldCameraState = pCore->GetCamera()->IsLocked ();

		// Get the old control state
		bOldCTRLState = AreControlsLocked ();

		// Mark as dead
		SetDead( true );

		// Set the death time
		m_ulDeathTime = SharedUtility::GetTime();

		// Mark as not spawned
		SetSpawned( false );

		// Mark as not aiming
		SetAiming( false );

		// Mark as not shooting
		SetShooting( false );

		// Set the death time
		SetDeathTime( SharedUtility::GetTime() );

		// Remove all the weapons
		m_pPlayerPed->RemoveAllWeapons ();

		// Construct a new bitstream
		RakNet::BitStream pBitStream;

		// Write the killerid
		pBitStream.WriteCompressed( (pKiller ? pKiller->GetId() : INVALID_ENTITY_ID) );

		// Send RPC to server
		pCore->GetNetworkModule()->Call( RPC_PLAYER_DEATH, &pBitStream, HIGH_PRIORITY, RELIABLE, true );

		// Fade out the screen
		pCore->GetHud()->FadeOut ( 3000 );

		// Fade out the sound
		pCore->GetGame()->FadeSound ( true, 3 );

		// Lock the camera control
		pCore->GetCamera()->LockControl ( true );

		// Lock the player controls
		LockControls ( true );
	}
}
Exemplo n.º 15
0
void Asteroid::Update(DWORD delta)
{
	m_PosX += (int)((m_DeltaX / 10) * delta * m_Speed);
	m_PosY += (int)((m_DeltaY / 10) * delta * m_Speed);

	if (m_Rotation++ > 360 || m_Type != -1)
		m_Rotation = 0;

	if ((SCREEN_WIDTH + IMAGE_SIZE < m_PosX || m_PosX < -IMAGE_SIZE) || (SCREEN_HEIGHT + IMAGE_SIZE < m_PosY || m_PosY < -IMAGE_SIZE))
		SetDead();
}
Exemplo n.º 16
0
C4Effect * C4Effect::Init(C4PropList *pForObj, int32_t iPrio, const C4Value &rVal1, const C4Value &rVal2, const C4Value &rVal3, const C4Value &rVal4)
{
	Target = pForObj;
	// ask all effects with higher priority first - except for prio 1 effects, which are considered out of the priority call chain (as per doc)
	bool fRemoveUpper = (iPrio != 1);
	// note that apart from denying the creation of this effect, higher priority effects may also remove themselves
	// or do other things with the effect list
	// (which does not quite make sense, because the effect might be denied by another effect)
	// so the priority is assigned after this call, marking this effect dead before it's definitely valid
	if (fRemoveUpper && pNext)
	{
		C4Effect * pEffect2 = pNext->Check(GetName(), iPrio, iInterval, rVal1, rVal2, rVal3, rVal4);
		if (pEffect2)
		{
			// effect denied (iResult = -1), added to an effect (iResult = Number of that effect)
			// or added to an effect that destroyed itself (iResult = -2)
			if (pEffect2 != (C4Effect*)C4Fx_Effect_Deny && pEffect2 != (C4Effect*)C4Fx_Effect_Annul) return pEffect2;
			// effect is still marked dead
			return 0;
		}
	}
	// init effect
	// higher-priority effects must be deactivated temporarily, and then reactivated regarding the new effect
	// higher-level effects should not be inserted during the process of removing or adding a lower-level effect
	// because that would cause a wrong initialization order
	// (hardly ever causing trouble, however...)
	C4Effect *pLastRemovedEffect=NULL;
	C4AulFunc * pFn;
	if (!GetCallbackScript())
	{
		Call(P_Construction, &C4AulParSet(rVal1, rVal2, rVal3, rVal4)).getInt();
		if (pForObj && !pForObj->Status) return 0;
		pFn = GetFunc(P_Start);
	}
	else
		pFn = pFnStart;
	if (fRemoveUpper && pNext && pFn)
		TempRemoveUpperEffects(false, &pLastRemovedEffect);
	// bad things may happen
	if (pForObj && !pForObj->Status) return 0; // this will be invalid!
	iPriority = iPrio; // validate effect now
	if (CallStart(0, rVal1, rVal2, rVal3, rVal4) == C4Fx_Start_Deny)
		// the effect denied to start: assume it hasn't, and mark it dead
		SetDead();
	if (fRemoveUpper && pNext && pFn)
		TempReaddUpperEffects(pLastRemovedEffect);
	if (pForObj && !pForObj->Status) return 0; // this will be invalid!
	// Update OnFire cache
	if (!IsDead() && pForObj && WildcardMatch(C4Fx_AnyFire, GetName()))
		pForObj->SetOnFire(true);
	return this;
}
Exemplo n.º 17
0
//--------------------------------- ReduceHealth ----------------------------
void Raven_Bot::ReduceHealth(unsigned int val)
{
  m_iHealth -= val;

  if (m_iHealth <= 0)
  {
    SetDead();
  }

  m_bHit = true;

  m_iNumUpdatesHitPersistant = (int)(FrameRate * script->GetDouble("HitFlashTime"));
}
Exemplo n.º 18
0
int DebrisClass::Exec (void)
{
	BombClass::Exec();

   if(IsExploding())
   {
      SetFlag( SHOW_EXPLOSION );
      SetDead(TRUE);
      return TRUE;
   }

   SetDelta (XDelta() * 0.99F, YDelta() * 0.99F, ZDelta() * 0.99F);
   return TRUE;
}
Exemplo n.º 19
0
void
CTL_BCPInCmd::Close(void)
{
    if (x_GetSybaseCmd()) {
        // ????
        DetachInterface();

        try {

#ifdef FTDS_IN_USE
            SetDead(!Cancel());
#else
            if (WasSent()) {
                SetDead(!EndBCP());
            }
#endif

        } catch (...) {
            SetDead();
            throw;
        }
    }
}
Exemplo n.º 20
0
GUIVidget::GUIVidget()
{
	Init();
	SetX(0);
	SetY(0);
	SetWidth(0);
	SetHeight(0);
	SetColor(DEFAULT_CONTROL_COLOR);
	SetVisible(false);
	SetDead(false);
	SetTexture(NULL);
	SetParent((GUIBaseControl*)NULL);
	SetBorder(false);
	SetBorderType(btNone);
}
Exemplo n.º 21
0
void AMech_RPGCharacter::Resurrect()
{
	FindSpawnpoint();


	SetDead(false);
	SetActorHiddenInGame(false);
	SetActorEnableCollision(true);

	FHealthChange change;
	change.heals = true;
	change.healthChange = GetMaxHealth();
	change.manipulator = this;
	change.target = this;
	ChangeHealth(change);

	ApplyCrowdControl(EffectEnums::Damage, false);
	GetWorld()->GetTimerManager().SetTimer(TimerHandle_Invunrelbility, this, &AMech_RPGCharacter::ResetInvunrelbility, 3.0F);
}
Exemplo n.º 22
0
OpUnreadBadge::OpUnreadBadge() 
: OpButton(OpButton::TYPE_CUSTOM, OpButton::STYLE_TEXT)
, m_minimum_width(0)
{
#ifdef QUICK_TOOLKIT_ACCORDION_MAC_STYLE // Mac has ugly unread counts that need to be center aligned
	SetJustify(JUSTIFY_CENTER, FALSE);
	init_status = SetText(UNI_L("00"));
#else
	SetJustify(JUSTIFY_RIGHT, FALSE);
	init_status = SetText(UNI_L("0000"));
#endif // QUICK_TOOLKIT_ACCORDION_MAC_STYLE
	CHECK_STATUS(init_status);

	SetDead(TRUE);
	INT32 h;
	VisualDeviceHandler vis_dev_handler(this);
	GetRequiredSize(m_minimum_width, h);
	init_status = SetText(UNI_L(""));
}
Exemplo n.º 23
0
void C4Effect::ClearAll(C4Object *pObj, int32_t iClearFlag) {
  // simply remove access all effects recursively, and do removal calls
  // this does not regard lower-level effects being added in the removal calls,
  // because this could hang the engine with poorly coded effects
  if (pNext) pNext->ClearAll(pObj, iClearFlag);
  if ((pObj && !pObj->Status) || IsDead()) return;
  int32_t iPrevPrio = iPriority;
  SetDead();
  if (pFnStop)
    if (pFnStop->Exec(pCommandTarget,
                      &C4AulParSet(C4VObj(pObj), C4VInt(iNumber),
                                   C4VInt(iClearFlag))).getInt() ==
        C4Fx_Stop_Deny) {
      // this stop-callback might have deleted the object and then denied its
      // own removal
      // must not modify self in this case...
      if (pObj && !pObj->Status) return;
      // effect denied to be removed: recover it
      iPriority = iPrevPrio;
    }
}
Exemplo n.º 24
0
Arquivo: send.c Projeto: ahf/irc
/*
** dead_link
**	An error has been detected. The link *must* be closed,
**	but *cannot* call ExitClient (m_bye) from here.
**	Instead, mark it with FLAGS_DEADSOCK. This should
**	generate ExitClient from the main loop.
**
**	The notice is skipped for "uninteresting" cases,
**	like Persons and yet unknown connections...
*/
static	int	dead_link(aClient *to, char *pattern, ...)
{
	char	notice[BUFSIZE];
	va_list	va;

	va_start(va, pattern);
	vsprintf(notice, pattern, va);
	va_end(va);

	SetDead(to);
	/*
	 * If because of BUFFERPOOL problem then clean dbufs now so that
	 * notices don't hurt operators below.
	 */
	DBufClear(&to->recvQ);
	DBufClear(&to->sendQ);
	if (!IsPerson(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
		sendto_flag(SCH_ERROR, notice);
	Debug((DEBUG_ERROR, notice));
	return -1;
}
Exemplo n.º 25
0
void CNetworkPlayer::SetHealth( float fHealth )
{
	DEBUG_TRACE("CNetworkPlayer::SetHealth");

	// Is the player ped valid?
	if( m_pPlayerPed && IsSpawned() )
	{
		// Set the ped health
		m_pPlayerPed->SetHealth( fHealth );

		// Are we killing the ped?
		if( fHealth <= 0.0f )
		{
			// Mark as dead
			SetDead( true );

			// Mark as not spawned
			SetSpawned( false );
		}
	}
}
Exemplo n.º 26
0
GUIControl::GUIControl()
{
	prev_key_update = 0;
	SetPatternCount(0);
	SetCurrentPattern(0);
	SetFocus(true);
	SetEnabled(true);
	SetDead(false);
	SetLastCursorPos(0);
	SetLastPressState(0);
	SetLastSentMsg(0);
	SetLastPressedKey(0);
	SetCaption(NULL);
	SetCaptionFont(NULL);
	SetCaptionColor(DEFAULT_TEXT_COLOR);
	SetSelectedCaptionColor(DEFAULT_TEXT_COLOR);
	SetPressedCaptionColor(DEFAULT_TEXT_COLOR);
	SetCaptionX(0);
	SetCaptionY(0);
	sgns.resize(0);
	_draw_border = false;
}
Exemplo n.º 27
0
void C4Effect::Kill(C4Object *pObj)
{
	// active?
	C4Effect *pLastRemovedEffect=NULL;
	if (IsActive())
		// then temp remove all higher priority effects
		TempRemoveUpperEffects(pObj, false, &pLastRemovedEffect);
	else
		// otherwise: temp reactivate before real removal
		// this happens only if a lower priority effect removes an upper priority effect in its add- or removal-call
		if (pFnStart && iPriority!=1) pFnStart->Exec(CommandTarget, &C4AulParSet(C4VObj(pObj), C4VPropList(this), C4VInt(C4FxCall_TempAddForRemoval)));
	// remove this effect
	int32_t iPrevPrio = iPriority; SetDead();
	if (pFnStop)
		if (pFnStop->Exec(CommandTarget, &C4AulParSet(C4VObj(pObj), C4VPropList(this), C4VInt(C4FxCall_Normal))).getInt() == C4Fx_Stop_Deny)
			// effect denied to be removed: recover
			iPriority = iPrevPrio;
	// reactivate other effects
	TempReaddUpperEffects(pObj, pLastRemovedEffect);
	// Update OnFire cache
	if (pObj && WildcardMatch(C4Fx_AnyFire, GetName()))
		if (!Get(C4Fx_AnyFire))
			pObj->SetOnFire(false);
}
Exemplo n.º 28
0
void C4Effect::ClearAll(int32_t iClearFlag)
{
	// simply remove access all effects recursively, and do removal calls
	// this does not regard lower-level effects being added in the removal calls,
	// because this could hang the engine with poorly coded effects
	if (pNext) pNext->ClearAll(iClearFlag);
	if ((Target && !Target->Status) || IsDead()) return;
	int32_t iPrevPrio = iPriority;
	SetDead();
	if (CallStop(iClearFlag, false) == C4Fx_Stop_Deny)
	{
		// this stop-callback might have deleted the object and then denied its own removal
		// must not modify self in this case...
		if (Target && !Target->Status) return;
		// effect denied to be removed: recover it
		iPriority = iPrevPrio;
	}
	// Update OnFire cache
	if (Target && WildcardMatch(C4Fx_AnyFire, GetName()) && IsDead())
		if (!Get(C4Fx_AnyFire))
			Target->SetOnFire(false);
	if (IsDead() && !GetCallbackScript())
		Call(P_Destruction, &C4AulParSet(iClearFlag));
}
Exemplo n.º 29
0
void CNetworkPlayer::Destroy( void )
{
	DEBUG_TRACE("CNetworkPlayer::Destroy");

	// Is the playerped not created?
	if( !m_pPlayerPed )
		return;

	// Destroy the player icon
	pCore->GetGame()->GetNavigation()->UnregisterIconEntity( m_pPlayerPed->GetEntity() );

	// Remove the player from the vehicle
	if( m_pVehicle )
		m_pVehicle->HandlePlayerExit( this, (m_seat - 1), false );

	// Deactivate the entity
	m_pPlayerPed->Deactivate();

	// Detach any blips
	DetachBlip ();

	// Free the model
	CNetworkModelManager::Unload( m_pPlayerModelManager );

	// Delete the playerped instance
	SAFE_DELETE( m_pPlayerPed );

	// Mark as not dead
	SetDead( false );

	// Mark as not spawned
	SetSpawned( false );

	// Set the initial state
	m_playerState = ePlayerState::PLAYERSTATE_UNKNOWN;
}
Exemplo n.º 30
0
void __cdecl LoadLevel()
{
	int i; // esi
	int j; // esi
	char dst[260]; // [esp+Ch] [ebp-10Ch]
	int len; // [esp+110h] [ebp-8h]
	void *LoadBuff; // [esp+114h] [ebp-4h]

	GetPermLevelNames(dst);
	LoadBuff = pfile_read(dst, &len);
	tbuff = LoadBuff;

	if ( leveltype )
	{
		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dDead[j][i] = BLoad(); /* check */
			}
		}

		SetDead();
	}

	nummonsters = ILoad();
	numitems = ILoad();
	nobjects = ILoad();

	if ( leveltype )
	{
		for(i = 0; i < 200; i++)
			monstactive[i] = ILoad();

		for(i = 0; i < nummonsters; i++)
			LoadMonster(monstactive[i]);

		for(i = 0; i < 127; i++)
			objectactive[i] = BLoad();

		for(i = 0; i < 127; i++)
			objectavail[i] = BLoad();

		for(i = 0; i < nobjects; i++)
			LoadObject(objectactive[i]);

		for(i = 0; i < nobjects; i++)
			SyncObjectAnim(objectactive[i]);
	}

	for(i = 0; i < 127; i++)
		itemactive[i] = BLoad();

	for(i = 0; i < 127; i++)
		itemavail[i] = BLoad();

	for(i = 0; i < numitems; i++)
		LoadItem(itemactive[i]);

	for(i = 0; i < 112; i++)
	{
		for(j = 0; j < 112; j++)
		{
			dFlags[j][i] = BLoad();
		}
	}

	for(i = 0; i < 112; i++)
	{
		for(j = 0; j < 112; j++)
		{
			dItem[j][i] = BLoad();
		}
	}

	if ( leveltype )
	{
		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dMonster[j][i] = ILoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dObject[j][i] = BLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dTransVal[j][i] = BLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dTransVal2[j][i] = BLoad();
			}
		}

		for(i = 0; i < 40; i++)
		{
			for(j = 0; j < 40; j++)
			{
				automapview[j][i] = OLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dMissile[j][i] = 0;
			}
		}
	}

	AutomapZoomReset();
	ResyncQuests();
	SyncPortals();
	dolighting = 1;

	for(i = 0; i < 4; i++)
	{
		if ( plr[i].plractive && currlevel == plr[i].plrlevel )
			LightList[plr[i]._plid]._lunflag = 1;
	}

	mem_free_dbg(LoadBuff);
}