#include "ui_local.h"
Include dependency graph for ui_players.c:

Go to the source code of this file.
Defines | |
| #define | COAST_TIME 1000 |
| #define | JUMP_HEIGHT 56 |
| #define | SPIN_SPEED 0.9f |
| #define | SWINGSPEED 0.3f |
| #define | UI_TIMER_ATTACK 500 |
| #define | UI_TIMER_GESTURE 2300 |
| #define | UI_TIMER_JUMP 1000 |
| #define | UI_TIMER_LAND 130 |
| #define | UI_TIMER_MUZZLE_FLASH 20 |
| #define | UI_TIMER_WEAPON_DELAY 250 |
| #define | UI_TIMER_WEAPON_SWITCH 300 |
Functions | |
| void | UI_DrawPlayer (float x, float y, float w, float h, playerInfo_t *pi, int time) |
| qboolean | UI_FileExists (const char *filename) |
| qboolean | UI_FindClientHeadFile (char *filename, int length, const char *teamName, const char *headModelName, const char *headSkinName, const char *base, const char *ext) |
| void | UI_ForceLegsAnim (playerInfo_t *pi, int anim) |
| void | UI_ForceTorsoAnim (playerInfo_t *pi, int anim) |
| void | UI_LegsSequencing (playerInfo_t *pi) |
| float | UI_MachinegunSpinAngle (playerInfo_t *pi) |
| float | UI_MovedirAdjustment (playerInfo_t *pi) |
| qboolean | UI_ParseAnimationFile (const char *filename, animation_t *animations) |
| void | UI_PlayerAngles (playerInfo_t *pi, vec3_t legs[3], vec3_t torso[3], vec3_t head[3]) |
| void | UI_PlayerAnimation (playerInfo_t *pi, int *legsOld, int *legs, float *legsBackLerp, int *torsoOld, int *torso, float *torsoBackLerp) |
| void | UI_PlayerFloatSprite (playerInfo_t *pi, vec3_t origin, qhandle_t shader) |
| void | UI_PlayerInfo_SetInfo (playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat) |
| void | UI_PlayerInfo_SetModel (playerInfo_t *pi, const char *model, const char *headmodel, char *teamName) |
| void | UI_PlayerInfo_SetWeapon (playerInfo_t *pi, weapon_t weaponNum) |
| void | UI_PositionEntityOnTag (refEntity_t *entity, const refEntity_t *parent, clipHandle_t parentModel, char *tagName) |
| void | UI_PositionRotatedEntityOnTag (refEntity_t *entity, const refEntity_t *parent, clipHandle_t parentModel, char *tagName) |
| qboolean | UI_RegisterClientModelname (playerInfo_t *pi, const char *modelSkinName, const char *headModelSkinName, const char *teamName) |
| qboolean | UI_RegisterClientSkin (playerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName, const char *teamName) |
| void | UI_RunLerpFrame (playerInfo_t *ci, lerpFrame_t *lf, int newAnimation) |
| void | UI_SetLegsAnim (playerInfo_t *pi, int anim) |
| void | UI_SetLerpFrameAnimation (playerInfo_t *ci, lerpFrame_t *lf, int newAnimation) |
| void | UI_SetTorsoAnim (playerInfo_t *pi, int anim) |
| void | UI_SwingAngles (float destination, float swingTolerance, float clampTolerance, float speed, float *angle, qboolean *swinging) |
| void | UI_TorsoSequencing (playerInfo_t *pi) |
Variables | |
| int | dp_realtime |
| float | jumpHeight |
| sfxHandle_t | weaponChangeSound |
|
|
Definition at line 41 of file ui_players.c. |
|
|
Definition at line 36 of file ui_players.c. |
|
|
Definition at line 40 of file ui_players.c. |
|
|
Definition at line 38 of file ui_players.c. |
|
|
Definition at line 32 of file ui_players.c. |
|
|
Definition at line 28 of file ui_players.c. |
|
|
Definition at line 29 of file ui_players.c. |
|
|
Definition at line 30 of file ui_players.c. |
|
|
Definition at line 33 of file ui_players.c. |
|
|
Definition at line 34 of file ui_players.c. |
|
|
Definition at line 31 of file ui_players.c. |
|
||||||||||||||||||||||||||||
|
Definition at line 691 of file ui_players.c. References AnglesToAxis(), playerInfo_t::animations, atan2(), AxisClear(), playerInfo_t::barrelModel, CHAN_LOCAL, playerInfo_t::chat, playerInfo_t::currentWeapon, DEG2RAD, dp_realtime, playerInfo_t::flashDlightColor, playerInfo_t::flashModel, h(), head, playerInfo_t::headModel, playerInfo_t::headSkin, playerInfo_t::lastWeapon, playerInfo_t::legsModel, playerInfo_t::legsSkin, M_PI, memset(), playerInfo_t::muzzleFlashTime, animation_s::numFrames, refEntity_t::origin, playerInfo_t::pendingWeapon, rand(), playerInfo_t::realWeapon, RF_LIGHTING_ORIGIN, tan(), playerInfo_t::torsoModel, playerInfo_t::torsoSkin, trap_R_AddLightToScene(), trap_R_AddRefEntityToScene(), trap_R_ClearScene(), trap_R_RegisterShaderNoMip(), trap_R_RenderScene(), trap_S_StartLocalSound(), UI_AdjustFrom640(), UI_MachinegunSpinAngle(), UI_PlayerAngles(), UI_PlayerAnimation(), UI_PlayerFloatSprite(), UI_PositionEntityOnTag(), UI_PositionRotatedEntityOnTag(), vec3_t, VectorCopy, w, playerInfo_t::weapon, weaponChangeSound, playerInfo_t::weaponModel, playerInfo_t::weaponTimer, WP_GAUNTLET, WP_MACHINEGUN, x, xx, and y. Referenced by Controls_DrawPlayer(), PlayerModel_DrawPlayer(), PlayerSettings_DrawPlayer(), UI_DrawOpponent(), and UI_DrawPlayerModel(). 00691 {
00692 refdef_t refdef;
00693 refEntity_t legs;
00694 refEntity_t torso;
00695 refEntity_t head;
00696 refEntity_t gun;
00697 refEntity_t barrel;
00698 refEntity_t flash;
00699 vec3_t origin;
00700 int renderfx;
00701 vec3_t mins = {-16, -16, -24};
00702 vec3_t maxs = {16, 16, 32};
00703 float len;
00704 float xx;
00705
00706 if ( !pi->legsModel || !pi->torsoModel || !pi->headModel || !pi->animations[0].numFrames ) {
00707 return;
00708 }
00709
00710 // this allows the ui to cache the player model on the main menu
00711 if (w == 0 || h == 0) {
00712 return;
00713 }
00714
00715 dp_realtime = time;
00716
00717 if ( pi->pendingWeapon != -1 && dp_realtime > pi->weaponTimer ) {
00718 pi->weapon = pi->pendingWeapon;
00719 pi->lastWeapon = pi->pendingWeapon;
00720 pi->pendingWeapon = -1;
00721 pi->weaponTimer = 0;
00722 if( pi->currentWeapon != pi->weapon ) {
00723 trap_S_StartLocalSound( weaponChangeSound, CHAN_LOCAL );
00724 }
00725 }
00726
00727 UI_AdjustFrom640( &x, &y, &w, &h );
00728
00729 y -= jumpHeight;
00730
00731 memset( &refdef, 0, sizeof( refdef ) );
00732 memset( &legs, 0, sizeof(legs) );
00733 memset( &torso, 0, sizeof(torso) );
00734 memset( &head, 0, sizeof(head) );
00735
00736 refdef.rdflags = RDF_NOWORLDMODEL;
00737
00738 AxisClear( refdef.viewaxis );
00739
00740 refdef.x = x;
00741 refdef.y = y;
00742 refdef.width = w;
00743 refdef.height = h;
00744
00745 refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
00746 xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
00747 refdef.fov_y = atan2( refdef.height, xx );
00748 refdef.fov_y *= ( 360 / (float)M_PI );
00749
00750 // calculate distance so the player nearly fills the box
00751 len = 0.7 * ( maxs[2] - mins[2] );
00752 origin[0] = len / tan( DEG2RAD(refdef.fov_x) * 0.5 );
00753 origin[1] = 0.5 * ( mins[1] + maxs[1] );
00754 origin[2] = -0.5 * ( mins[2] + maxs[2] );
00755
00756 refdef.time = dp_realtime;
00757
00758 trap_R_ClearScene();
00759
00760 // get the rotation information
00761 UI_PlayerAngles( pi, legs.axis, torso.axis, head.axis );
00762
00763 // get the animation state (after rotation, to allow feet shuffle)
00764 UI_PlayerAnimation( pi, &legs.oldframe, &legs.frame, &legs.backlerp,
00765 &torso.oldframe, &torso.frame, &torso.backlerp );
00766
00767 renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
00768
00769 //
00770 // add the legs
00771 //
00772 legs.hModel = pi->legsModel;
00773 legs.customSkin = pi->legsSkin;
00774
00775 VectorCopy( origin, legs.origin );
00776
00777 VectorCopy( origin, legs.lightingOrigin );
00778 legs.renderfx = renderfx;
00779 VectorCopy (legs.origin, legs.oldorigin);
00780
00781 trap_R_AddRefEntityToScene( &legs );
00782
00783 if (!legs.hModel) {
00784 return;
00785 }
00786
00787 //
00788 // add the torso
00789 //
00790 torso.hModel = pi->torsoModel;
00791 if (!torso.hModel) {
00792 return;
00793 }
00794
00795 torso.customSkin = pi->torsoSkin;
00796
00797 VectorCopy( origin, torso.lightingOrigin );
00798
00799 UI_PositionRotatedEntityOnTag( &torso, &legs, pi->legsModel, "tag_torso");
00800
00801 torso.renderfx = renderfx;
00802
00803 trap_R_AddRefEntityToScene( &torso );
00804
00805 //
00806 // add the head
00807 //
00808 head.hModel = pi->headModel;
00809 if (!head.hModel) {
00810 return;
00811 }
00812 head.customSkin = pi->headSkin;
00813
00814 VectorCopy( origin, head.lightingOrigin );
00815
00816 UI_PositionRotatedEntityOnTag( &head, &torso, pi->torsoModel, "tag_head");
00817
00818 head.renderfx = renderfx;
00819
00820 trap_R_AddRefEntityToScene( &head );
00821
00822 //
00823 // add the gun
00824 //
00825 if ( pi->currentWeapon != WP_NONE ) {
00826 memset( &gun, 0, sizeof(gun) );
00827 gun.hModel = pi->weaponModel;
00828 VectorCopy( origin, gun.lightingOrigin );
00829 UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");
00830 gun.renderfx = renderfx;
00831 trap_R_AddRefEntityToScene( &gun );
00832 }
00833
00834 //
00835 // add the spinning barrel
00836 //
00837 if ( pi->realWeapon == WP_MACHINEGUN || pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
00838 vec3_t angles;
00839
00840 memset( &barrel, 0, sizeof(barrel) );
00841 VectorCopy( origin, barrel.lightingOrigin );
00842 barrel.renderfx = renderfx;
00843
00844 barrel.hModel = pi->barrelModel;
00845 angles[YAW] = 0;
00846 angles[PITCH] = 0;
00847 angles[ROLL] = UI_MachinegunSpinAngle( pi );
00848 if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
00849 angles[PITCH] = angles[ROLL];
00850 angles[ROLL] = 0;
00851 }
00852 AnglesToAxis( angles, barrel.axis );
00853
00854 UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");
00855
00856 trap_R_AddRefEntityToScene( &barrel );
00857 }
00858
00859 //
00860 // add muzzle flash
00861 //
00862 if ( dp_realtime <= pi->muzzleFlashTime ) {
00863 if ( pi->flashModel ) {
00864 memset( &flash, 0, sizeof(flash) );
00865 flash.hModel = pi->flashModel;
00866 VectorCopy( origin, flash.lightingOrigin );
00867 UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");
00868 flash.renderfx = renderfx;
00869 trap_R_AddRefEntityToScene( &flash );
00870 }
00871
00872 // make a dlight for the flash
00873 if ( pi->flashDlightColor[0] || pi->flashDlightColor[1] || pi->flashDlightColor[2] ) {
00874 trap_R_AddLightToScene( flash.origin, 200 + (rand()&31), pi->flashDlightColor[0],
00875 pi->flashDlightColor[1], pi->flashDlightColor[2] );
00876 }
00877 }
00878
00879 //
00880 // add the chat icon
00881 //
00882 if ( pi->chat ) {
00883 UI_PlayerFloatSprite( pi, origin, trap_R_RegisterShaderNoMip( "sprites/balloon3" ) );
00884 }
00885
00886 //
00887 // add an accent light
00888 //
00889 origin[0] -= 100; // + = behind, - = in front
00890 origin[1] += 100; // + = left, - = right
00891 origin[2] += 100; // + = above, - = below
00892 trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 1.0 );
00893
00894 origin[0] -= 100;
00895 origin[1] -= 100;
00896 origin[2] -= 100;
00897 trap_R_AddLightToScene( origin, 500, 1.0, 0.0, 0.0 );
00898
00899 trap_R_RenderScene( &refdef );
00900 }
|
Here is the call graph for this function:

|
|
Definition at line 907 of file ui_players.c. References FS_READ, qboolean, and trap_FS_FOpenFile(). Referenced by UI_FindClientHeadFile(). 00907 {
00908 int len;
00909
00910 len = trap_FS_FOpenFile( filename, 0, FS_READ );
00911 if (len>0) {
00912 return qtrue;
00913 }
00914 return qfalse;
00915 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||
|
Definition at line 922 of file ui_players.c. References Com_sprintf(), i, length(), qboolean, and UI_FileExists(). Referenced by UI_RegisterClientSkin(). 00922 {
00923 char *team, *headsFolder;
00924 int i;
00925
00926 team = "default";
00927
00928 if ( headModelName[0] == '*' ) {
00929 headsFolder = "heads/";
00930 headModelName++;
00931 }
00932 else {
00933 headsFolder = "";
00934 }
00935 while(1) {
00936 for ( i = 0; i < 2; i++ ) {
00937 if ( i == 0 && teamName && *teamName ) {
00938 Com_sprintf( filename, length, "models/players/%s%s/%s/%s%s_%s.%s", headsFolder, headModelName, headSkinName, teamName, base, team, ext );
00939 }
00940 else {
00941 Com_sprintf( filename, length, "models/players/%s%s/%s/%s_%s.%s", headsFolder, headModelName, headSkinName, base, team, ext );
00942 }
00943 if ( UI_FileExists( filename ) ) {
00944 return qtrue;
00945 }
00946 if ( i == 0 && teamName && *teamName ) {
00947 Com_sprintf( filename, length, "models/players/%s%s/%s%s_%s.%s", headsFolder, headModelName, teamName, base, headSkinName, ext );
00948 }
00949 else {
00950 Com_sprintf( filename, length, "models/players/%s%s/%s_%s.%s", headsFolder, headModelName, base, headSkinName, ext );
00951 }
00952 if ( UI_FileExists( filename ) ) {
00953 return qtrue;
00954 }
00955 if ( !teamName || !*teamName ) {
00956 break;
00957 }
00958 }
00959 // if tried the heads folder first
00960 if ( headsFolder[0] ) {
00961 break;
00962 }
00963 headsFolder = "heads/";
00964 }
00965
00966 return qfalse;
00967 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 156 of file ui_players.c. References playerInfo_t::legsAnim, and playerInfo_t::legsAnimationTimer. Referenced by UI_LegsSequencing(), UI_PlayerInfo_SetInfo(), and UI_SetLegsAnim(). 00156 {
00157 pi->legsAnim = ( ( pi->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
00158
00159 if ( anim == LEGS_JUMP ) {
00160 pi->legsAnimationTimer = UI_TIMER_JUMP;
00161 }
00162 }
|
|
||||||||||||
|
Definition at line 184 of file ui_players.c. References TORSO_ATTACK, playerInfo_t::torsoAnim, and playerInfo_t::torsoAnimationTimer. Referenced by UI_PlayerInfo_SetInfo(), UI_SetTorsoAnim(), and UI_TorsoSequencing(). 00184 {
00185 pi->torsoAnim = ( ( pi->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
00186
00187 if ( anim == TORSO_GESTURE ) {
00188 pi->torsoAnimationTimer = UI_TIMER_GESTURE;
00189 }
00190
00191 if ( anim == TORSO_ATTACK || anim == TORSO_ATTACK2 ) {
00192 pi->torsoAnimationTimer = UI_TIMER_ATTACK;
00193 }
00194 }
|
|
|
Definition at line 262 of file ui_players.c. References JUMP_HEIGHT, jumpHeight, LEGS_IDLE, LEGS_LAND, playerInfo_t::legsAnim, playerInfo_t::legsAnimationTimer, M_PI, sin(), UI_ForceLegsAnim(), UI_SetLegsAnim(), and UI_TIMER_JUMP. Referenced by UI_PlayerAnimation(). 00262 {
00263 int currentAnim;
00264
00265 currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
00266
00267 if ( pi->legsAnimationTimer > 0 ) {
00268 if ( currentAnim == LEGS_JUMP ) {
00269 jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
00270 }
00271 return;
00272 }
00273
00274 if ( currentAnim == LEGS_JUMP ) {
00275 UI_ForceLegsAnim( pi, LEGS_LAND );
00276 pi->legsAnimationTimer = UI_TIMER_LAND;
00277 jumpHeight = 0;
00278 return;
00279 }
00280
00281 if ( currentAnim == LEGS_LAND ) {
00282 UI_SetLegsAnim( pi, LEGS_IDLE );
00283 return;
00284 }
00285 }
|
Here is the call graph for this function:

|
|
Definition at line 654 of file ui_players.c. References AngleMod(), playerInfo_t::barrelAngle, playerInfo_t::barrelSpinning, playerInfo_t::barrelTime, COAST_TIME, dp_realtime, SPIN_SPEED, and playerInfo_t::torsoAnim. Referenced by UI_DrawPlayer(). 00654 {
00655 int delta;
00656 float angle;
00657 float speed;
00658 int torsoAnim;
00659
00660 delta = dp_realtime - pi->barrelTime;
00661 if ( pi->barrelSpinning ) {
00662 angle = pi->barrelAngle + delta * SPIN_SPEED;
00663 } else {
00664 if ( delta > COAST_TIME ) {
00665 delta = COAST_TIME;
00666 }
00667
00668 speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
00669 angle = pi->barrelAngle + delta * speed;
00670 }
00671
00672 torsoAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
00673 if( torsoAnim == TORSO_ATTACK2 ) {
00674 torsoAnim = TORSO_ATTACK;
00675 }
00676 if ( pi->barrelSpinning == !(torsoAnim == TORSO_ATTACK) ) {
00677 pi->barrelTime = dp_realtime;
00678 pi->barrelAngle = AngleMod( angle );
00679 pi->barrelSpinning = !!(torsoAnim == TORSO_ATTACK);
00680 }
00681
00682 return angle;
00683 }
|
Here is the call graph for this function:

|
|
Definition at line 532 of file ui_players.c. References AngleVectors(), playerInfo_t::moveAngles, NULL, Q_fabs(), vec3_t, VectorSubtract, and playerInfo_t::viewAngles. Referenced by UI_PlayerAngles(). 00532 {
00533 vec3_t relativeAngles;
00534 vec3_t moveVector;
00535
00536 VectorSubtract( pi->viewAngles, pi->moveAngles, relativeAngles );
00537 AngleVectors( relativeAngles, moveVector, NULL, NULL );
00538 if ( Q_fabs( moveVector[0] ) < 0.01 ) {
00539 moveVector[0] = 0.0;
00540 }
00541 if ( Q_fabs( moveVector[1] ) < 0.01 ) {
00542 moveVector[1] = 0.0;
00543 }
00544
00545 if ( moveVector[1] == 0 && moveVector[0] > 0 ) {
00546 return 0;
00547 }
00548 if ( moveVector[1] < 0 && moveVector[0] > 0 ) {
00549 return 22;
00550 }
00551 if ( moveVector[1] < 0 && moveVector[0] == 0 ) {
00552 return 45;
00553 }
00554 if ( moveVector[1] < 0 && moveVector[0] < 0 ) {
00555 return -22;
00556 }
00557 if ( moveVector[1] == 0 && moveVector[0] < 0 ) {
00558 return 0;
00559 }
00560 if ( moveVector[1] > 0 && moveVector[0] < 0 ) {
00561 return 22;
00562 }
00563 if ( moveVector[1] > 0 && moveVector[0] == 0 ) {
00564 return -45;
00565 }
00566
00567 return -22;
00568 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1024 of file ui_players.c. References animation_t, atof(), atoi, COM_Compress(), COM_Parse(), Com_Printf(), f, fileHandle_t, animation_s::firstFrame, animation_s::frameLerp, FS_READ, i, animation_s::initialLerp, animation_s::loopFrames, MAX_ANIMATIONS, memset(), animation_s::numFrames, Q_stricmp(), qboolean, token, trap_FS_FCloseFile(), trap_FS_FOpenFile(), and trap_FS_Read(). Referenced by UI_RegisterClientModelname(). 01024 {
01025 char *text_p, *prev;
01026 int len;
01027 int i;
01028 char *token;
01029 float fps;
01030 int skip;
01031 char text[20000];
01032 fileHandle_t f;
01033
01034 memset( animations, 0, sizeof( animation_t ) * MAX_ANIMATIONS );
01035
01036 // load the file
01037 len = trap_FS_FOpenFile( filename, &f, FS_READ );
01038 if ( len <= 0 ) {
01039 return qfalse;
01040 }
01041 if ( len >= ( sizeof( text ) - 1 ) ) {
01042 Com_Printf( "File %s too long\n", filename );
01043 return qfalse;
01044 }
01045 trap_FS_Read( text, len, f );
01046 text[len] = 0;
01047 trap_FS_FCloseFile( f );
01048
01049 COM_Compress(text);
01050
01051 // parse the text
01052 text_p = text;
01053 skip = 0; // quite the compiler warning
01054
01055 // read optional parameters
01056 while ( 1 ) {
01057 prev = text_p; // so we can unget
01058 token = COM_Parse( &text_p );
01059 if ( !token ) {
01060 break;
01061 }
01062 if ( !Q_stricmp( token, "footsteps" ) ) {
01063 token = COM_Parse( &text_p );
01064 if ( !token ) {
01065 break;
01066 }
01067 continue;
01068 } else if ( !Q_stricmp( token, "headoffset" ) ) {
01069 for ( i = 0 ; i < 3 ; i++ ) {
01070 token = COM_Parse( &text_p );
01071 if ( !token ) {
01072 break;
01073 }
01074 }
01075 continue;
01076 } else if ( !Q_stricmp( token, "sex" ) ) {
01077 token = COM_Parse( &text_p );
01078 if ( !token ) {
01079 break;
01080 }
01081 continue;
01082 }
01083
01084 // if it is a number, start parsing animations
01085 if ( token[0] >= '0' && token[0] <= '9' ) {
01086 text_p = prev; // unget the token
01087 break;
01088 }
01089
01090 Com_Printf( "unknown token '%s' is %s\n", token, filename );
01091 }
01092
01093 // read information for each frame
01094 for ( i = 0 ; i < MAX_ANIMATIONS ; i++ ) {
01095
01096 token = COM_Parse( &text_p );
01097 if ( !token ) {
01098 break;
01099 }
01100 animations[i].firstFrame = atoi( token );
01101 // leg only frames are adjusted to not count the upper body only frames
01102 if ( i == LEGS_WALKCR ) {
01103 skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
01104 }
01105 if ( i >= LEGS_WALKCR ) {
01106 animations[i].firstFrame -= skip;
01107 }
01108
01109 token = COM_Parse( &text_p );
01110 if ( !token ) {
01111 break;
01112 }
01113 animations[i].numFrames = atoi( token );
01114
01115 token = COM_Parse( &text_p );
01116 if ( !token ) {
01117 break;
01118 }
01119 animations[i].loopFrames = atoi( token );
01120
01121 token = COM_Parse( &text_p );
01122 if ( !token ) {
01123 break;
01124 }
01125 fps = atof( token );
01126 if ( fps == 0 ) {
01127 fps = 1;
01128 }
01129 animations[i].frameLerp = 1000 / fps;
01130 animations[i].initialLerp = 1000 / fps;
01131 }
01132
01133 if ( i != MAX_ANIMATIONS ) {
01134 Com_Printf( "Error parsing animation file: %s", filename );
01135 return qfalse;
01136 }
01137
01138 return qtrue;
01139 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 576 of file ui_players.c. References AngleMod(), AnglesSubtract(), AnglesToAxis(), f, head, playerInfo_t::legs, LEGS_IDLE, playerInfo_t::legsAnim, lerpFrame_t::pitchAngle, lerpFrame_t::pitching, SWINGSPEED, playerInfo_t::torso, playerInfo_t::torsoAnim, UI_MovedirAdjustment(), UI_SwingAngles(), vec3_t, VectorClear, VectorCopy, playerInfo_t::viewAngles, YAW, lerpFrame_t::yawAngle, and lerpFrame_t::yawing. Referenced by UI_DrawPlayer(). 00576 {
00577 vec3_t legsAngles, torsoAngles, headAngles;
00578 float dest;
00579 float adjust;
00580
00581 VectorCopy( pi->viewAngles, headAngles );
00582 headAngles[YAW] = AngleMod( headAngles[YAW] );
00583 VectorClear( legsAngles );
00584 VectorClear( torsoAngles );
00585
00586 // --------- yaw -------------
00587
00588 // allow yaw to drift a bit
00589 if ( ( pi->legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE
00590 || ( pi->torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND ) {
00591 // if not standing still, always point all in the same direction
00592 pi->torso.yawing = qtrue; // always center
00593 pi->torso.pitching = qtrue; // always center
00594 pi->legs.yawing = qtrue; // always center
00595 }
00596
00597 // adjust legs for movement dir
00598 adjust = UI_MovedirAdjustment( pi );
00599 legsAngles[YAW] = headAngles[YAW] + adjust;
00600 torsoAngles[YAW] = headAngles[YAW] + 0.25 * adjust;
00601
00602
00603 // torso
00604 UI_SwingAngles( torsoAngles[YAW], 25, 90, SWINGSPEED, &pi->torso.yawAngle, &pi->torso.yawing );
00605 UI_SwingAngles( legsAngles[YAW], 40, 90, SWINGSPEED, &pi->legs.yawAngle, &pi->legs.yawing );
00606
00607 torsoAngles[YAW] = pi->torso.yawAngle;
00608 legsAngles[YAW] = pi->legs.yawAngle;
00609
00610 // --------- pitch -------------
00611
00612 // only show a fraction of the pitch angle in the torso
00613 if ( headAngles[PITCH] > 180 ) {
00614 dest = (-360 + headAngles[PITCH]) * 0.75;
00615 } else {
00616 dest = headAngles[PITCH] * 0.75;
00617 }
00618 UI_SwingAngles( dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching );
00619 torsoAngles[PITCH] = pi->torso.pitchAngle;
00620
00621 // pull the angles back out of the hierarchial chain
00622 AnglesSubtract( headAngles, torsoAngles, headAngles );
00623 AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
00624 AnglesToAxis( legsAngles, legs );
00625 AnglesToAxis( torsoAngles, torso );
00626 AnglesToAxis( headAngles, head );
00627 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 635 of file ui_players.c. References memset(), trap_R_AddRefEntityToScene(), and VectorCopy. Referenced by UI_DrawPlayer(). 00635 {
00636 refEntity_t ent;
00637
00638 memset( &ent, 0, sizeof( ent ) );
00639 VectorCopy( origin, ent.origin );
00640 ent.origin[2] += 48;
00641 ent.reType = RT_SPRITE;
00642 ent.customShader = shader;
00643 ent.radius = 10;
00644 ent.renderfx = 0;
00645 trap_R_AddRefEntityToScene( &ent );
00646 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||
|
Definition at line 1269 of file ui_players.c. References BOTH_DEATH1, playerInfo_t::chat, playerInfo_t::currentWeapon, dp_realtime, jumpHeight, playerInfo_t::lastWeapon, playerInfo_t::legs, LEGS_JUMP, playerInfo_t::legsAnim, playerInfo_t::moveAngles, playerInfo_t::muzzleFlashTime, playerInfo_t::newModel, playerInfo_t::pendingLegsAnim, playerInfo_t::pendingTorsoAnim, playerInfo_t::pendingWeapon, playerInfo_t::torso, TORSO_ATTACK, TORSO_GESTURE, TORSO_RAISE, TORSO_STAND, playerInfo_t::torsoAnim, UI_ForceLegsAnim(), UI_ForceTorsoAnim(), UI_PlayerInfo_SetWeapon(), VectorCopy, playerInfo_t::viewAngles, playerInfo_t::weapon, weapon_t, playerInfo_t::weaponTimer, WP_NONE, lerpFrame_t::yawAngle, and lerpFrame_t::yawing. Referenced by Controls_UpdateModel(), PlayerModel_UpdateModel(), PlayerSettings_DrawPlayer(), PlayerSettings_SetMenuItems(), UI_DrawOpponent(), and UI_DrawPlayerModel(). 01269 {
01270 int currentAnim;
01271 weapon_t weaponNum;
01272
01273 pi->chat = chat;
01274
01275 // view angles
01276 VectorCopy( viewAngles, pi->viewAngles );
01277
01278 // move angles
01279 VectorCopy( moveAngles, pi->moveAngles );
01280
01281 if ( pi->newModel ) {
01282 pi->newModel = qfalse;
01283
01284 jumpHeight = 0;
01285 pi->pendingLegsAnim = 0;
01286 UI_ForceLegsAnim( pi, legsAnim );
01287 pi->legs.yawAngle = viewAngles[YAW];
01288 pi->legs.yawing = qfalse;
01289
01290 pi->pendingTorsoAnim = 0;
01291 UI_ForceTorsoAnim( pi, torsoAnim );
01292 pi->torso.yawAngle = viewAngles[YAW];
01293 pi->torso.yawing = qfalse;
01294
01295 if ( weaponNumber != -1 ) {
01296 pi->weapon = weaponNumber;
01297 pi->currentWeapon = weaponNumber;
01298 pi->lastWeapon = weaponNumber;
01299 pi->pendingWeapon = -1;
01300 pi->weaponTimer = 0;
01301 UI_PlayerInfo_SetWeapon( pi, pi->weapon );
01302 }
01303
01304 return;
01305 }
01306
01307 // weapon
01308 if ( weaponNumber == -1 ) {
01309 pi->pendingWeapon = -1;
01310 pi->weaponTimer = 0;
01311 }
01312 else if ( weaponNumber != WP_NONE ) {
01313 pi->pendingWeapon = weaponNumber;
01314 pi->weaponTimer = dp_realtime + UI_TIMER_WEAPON_DELAY;
01315 }
01316 weaponNum = pi->lastWeapon;
01317 pi->weapon = weaponNum;
01318
01319 if ( torsoAnim == BOTH_DEATH1 || legsAnim == BOTH_DEATH1 ) {
01320 torsoAnim = legsAnim = BOTH_DEATH1;
01321 pi-> |