~ubuntu-branches/ubuntu/trusty/teeworlds/trusty-updates

« back to all changes in this revision

Viewing changes to src/game/server/entities/character.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-05-05 09:49:34 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20130505094934-uidw42ov1t0jlvrz
Tags: 0.6.2+dfsg-1
* New upstream release.
  - Update patches.
* Pass $CPPFLAGS to the build system.
* Switch to my @debian.org email address.
* Bump Standards-Version to 3.9.4, no changes needed.
* Change Vcs host to anonscm.debian.org.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
{
57
57
        m_EmoteStop = -1;
58
58
        m_LastAction = -1;
 
59
        m_LastNoAmmoSound = -1;
59
60
        m_ActiveWeapon = WEAPON_GUN;
60
61
        m_LastWeapon = WEAPON_HAMMER;
61
62
        m_QueuedWeapon = -1;
270
271
        {
271
272
                // 125ms is a magical limit of how fast a human can click
272
273
                m_ReloadTimer = 125 * Server()->TickSpeed() / 1000;
273
 
                GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);
 
274
                if(m_LastNoAmmoSound+Server()->TickSpeed() <= Server()->Tick())
 
275
                {
 
276
                        GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);
 
277
                        m_LastNoAmmoSound = Server()->Tick();
 
278
                }
274
279
                return;
275
280
        }
276
281
 
507
512
        mem_copy(&m_Input, pNewInput, sizeof(m_Input));
508
513
        m_NumInputs++;
509
514
 
510
 
        // or are not allowed to aim in the center
 
515
        // it is not allowed to aim in the center
511
516
        if(m_Input.m_TargetX == 0 && m_Input.m_TargetY == 0)
512
517
                m_Input.m_TargetY = -1;
513
518
}
517
522
        mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
518
523
        mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
519
524
 
 
525
        // it is not allowed to aim in the center
 
526
        if(m_LatestInput.m_TargetX == 0 && m_LatestInput.m_TargetY == 0)
 
527
                m_LatestInput.m_TargetY = -1;
 
528
 
520
529
        if(m_NumInputs > 2 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
521
530
        {
522
531
                HandleWeaponSwitch();
653
662
        }
654
663
}
655
664
 
 
665
void CCharacter::TickPaused()
 
666
{
 
667
        ++m_AttackTick;
 
668
        ++m_DamageTakenTick;
 
669
        ++m_Ninja.m_ActivationTick;
 
670
        ++m_ReckoningTick;
 
671
        if(m_LastAction != -1)
 
672
                ++m_LastAction;
 
673
        if(m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart > -1)
 
674
                ++m_aWeapons[m_ActiveWeapon].m_AmmoRegenStart;
 
675
        if(m_EmoteStop > -1)
 
676
                ++m_EmoteStop;
 
677
}
 
678
 
656
679
bool CCharacter::IncreaseHealth(int Amount)
657
680
{
658
681
        if(m_Health >= 10)