~ubuntu-branches/ubuntu/precise/openarena/precise

« back to all changes in this revision

Viewing changes to code/cgame/cg_ents.c

  • Committer: Bazaar Package Importer
  • Author(s): Ansgar Burchardt
  • Date: 2008-09-05 21:14:51 UTC
  • mfrom: (1.2.1 upstream) (2.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080905211451-243bmbl6l6gdav7l
* Remove non-free code/tools/lcc (Closes: #496346)
  + Remove hunk from patch 10_fix_build_and_binary_on_alpha
  + debian/rules: Add BUILD_GAME_QVM=0 to $(MAKE) call
    (thanks to Peter De Wachter)
* Remove code/libs containing binary libraries for Mac OS X and Win32
* debian/copyright: Explain which parts of upstream's sources were removed
* debian/rules: replace ${source:Upstream-Version} by 0.7.7
  because the variable also contains the `+dfsg1' part
* Add -fsigned-char to compiler options (Closes: #487970)
  (thanks to Peter De Wachter)
* Add myself to Uploaders
* debian/control: Remove article from beginning of short description,
  don't start short description with a capital letter
* debian/openarena.6: Escape minus signs
  + fixes lintian warnings: hyphen-used-as-minus-sign

Show diffs side-by-side

added added

removed removed

Lines of Context:
736
736
*/
737
737
static void CG_CalcEntityLerpPositions( centity_t *cent ) {
738
738
 
739
 
        // if this player does not want to see extrapolated players
740
 
        if ( !cg_smoothClients.integer ) {
741
 
                // make sure the clients use TR_INTERPOLATE
742
 
                if ( cent->currentState.number < MAX_CLIENTS ) {
743
 
                        cent->currentState.pos.trType = TR_INTERPOLATE;
744
 
                        cent->nextState.pos.trType = TR_INTERPOLATE;
745
 
                }
746
 
        }
 
739
//unlagged - projectile nudge
 
740
        // this will be set to how far forward projectiles will be extrapolated
 
741
        int timeshift = 0;
 
742
//unlagged - projectile nudge
 
743
 
 
744
//unlagged - smooth clients #2
 
745
        // this is done server-side now - cg_smoothClients is undefined
 
746
        // players will always be TR_INTERPOLATE
 
747
/*
 
748
        // if this player does not want to see extrapolated players
 
749
        if ( !cg_smoothClients.integer ) {
 
750
                // make sure the clients use TR_INTERPOLATE
 
751
                if ( cent->currentState.number < MAX_CLIENTS ) {
 
752
                        cent->currentState.pos.trType = TR_INTERPOLATE;
 
753
                        cent->nextState.pos.trType = TR_INTERPOLATE;
 
754
                }
 
755
        }
 
756
*/
 
757
//unlagged - smooth clients #2
747
758
 
748
759
        if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
749
760
                CG_InterpolateEntityPosition( cent );
758
769
                return;
759
770
        }
760
771
 
761
 
        // just use the current frame and evaluate as best we can
762
 
        BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
763
 
        BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
 
772
//unlagged - timenudge extrapolation
 
773
        // interpolating failed (probably no nextSnap), so extrapolate
 
774
        // this can also happen if the teleport bit is flipped, but that
 
775
        // won't be noticeable
 
776
        if ( cent->currentState.number < MAX_CLIENTS &&
 
777
                        cent->currentState.clientNum != cg.predictedPlayerState.clientNum ) {
 
778
                cent->currentState.pos.trType = TR_LINEAR_STOP;
 
779
                cent->currentState.pos.trTime = cg.snap->serverTime;
 
780
                cent->currentState.pos.trDuration = 1000 / sv_fps.integer;
 
781
        }
 
782
//unlagged - timenudge extrapolation
 
783
 
 
784
//unlagged - projectile nudge
 
785
        // if it's a missile but not a grappling hook
 
786
        if ( cent->currentState.eType == ET_MISSILE && cent->currentState.weapon != WP_GRAPPLING_HOOK ) {
 
787
                // if it's one of ours
 
788
                if ( cent->currentState.otherEntityNum == cg.clientNum ) {
 
789
                        // extrapolate one server frame's worth - this will correct for tiny
 
790
                        // visual inconsistencies introduced by backward-reconciling all players
 
791
                        // one server frame before running projectiles
 
792
                        timeshift = 1000 / sv_fps.integer;
 
793
                }
 
794
                // if it's not, and it's not a grenade launcher
 
795
                else if ( cent->currentState.weapon != WP_GRENADE_LAUNCHER ) {
 
796
                        // extrapolate based on cg_projectileNudge
 
797
                        timeshift = cg_projectileNudge.integer + 1000 / sv_fps.integer;
 
798
                }
 
799
        }
 
800
 
 
801
        // just use the current frame and evaluate as best we can
 
802
//      BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
 
803
//      BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
 
804
        BG_EvaluateTrajectory( &cent->currentState.pos, cg.time + timeshift, cent->lerpOrigin );
 
805
        BG_EvaluateTrajectory( &cent->currentState.apos, cg.time + timeshift, cent->lerpAngles );
 
806
 
 
807
        // if there's a time shift
 
808
        if ( timeshift != 0 ) {
 
809
                trace_t tr;
 
810
                vec3_t lastOrigin;
 
811
 
 
812
                BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, lastOrigin );
 
813
 
 
814
                CG_Trace( &tr, lastOrigin, vec3_origin, vec3_origin, cent->lerpOrigin, cent->currentState.number, MASK_SHOT );
 
815
 
 
816
                // don't let the projectile go through the floor
 
817
                if ( tr.fraction < 1.0f ) {
 
818
                        cent->lerpOrigin[0] = lastOrigin[0] + tr.fraction * ( cent->lerpOrigin[0] - lastOrigin[0] );
 
819
                        cent->lerpOrigin[1] = lastOrigin[1] + tr.fraction * ( cent->lerpOrigin[1] - lastOrigin[1] );
 
820
                        cent->lerpOrigin[2] = lastOrigin[2] + tr.fraction * ( cent->lerpOrigin[2] - lastOrigin[2] );
 
821
                }
 
822
        }
 
823
//unlagged - projectile nudge
764
824
 
765
825
        // adjust for riding a mover if it wasn't rolled into the predicted
766
826
        // player state
1028
1088
        // lerp the non-predicted value for lightning gun origins
1029
1089
        CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] );
1030
1090
 
 
1091
//unlagged - early transitioning
 
1092
        if ( cg.nextSnap ) {
 
1093
                // pre-add some of the entities sent over by the server
 
1094
                // we have data for them and they don't need to interpolate
 
1095
                for ( num = 0 ; num < cg.nextSnap->numEntities ; num++ ) {
 
1096
                        cent = &cg_entities[ cg.nextSnap->entities[ num ].number ];
 
1097
                        if ( cent->nextState.eType == ET_MISSILE || cent->nextState.eType == ET_GENERAL ) {
 
1098
                                // transition it immediately and add it
 
1099
                                CG_TransitionEntity( cent );
 
1100
                                cent->interpolate = qtrue;
 
1101
                                CG_AddCEntity( cent );
 
1102
                        }
 
1103
                }
 
1104
        }
 
1105
//unlagged - early transitioning
 
1106
 
1031
1107
        // add each entity sent over by the server
1032
1108
        for ( num = 0 ; num < cg.snap->numEntities ; num++ ) {
1033
1109
                cent = &cg_entities[ cg.snap->entities[ num ].number ];
1034
 
                CG_AddCEntity( cent );
 
1110
//unlagged - early transitioning
 
1111
                if ( !cg.nextSnap || (cent->nextState.eType != ET_MISSILE && cent->nextState.eType != ET_GENERAL) ) {
 
1112
//unlagged - early transitioning
 
1113
                        CG_AddCEntity( cent );
 
1114
                } //Also unlagged
1035
1115
        }
1036
1116
}
1037
1117