/* ================= PlayerSettings_DrawPlayer ================= */ static void PlayerSettings_DrawPlayer(void* self) { menubitmap_s* b; vec3_t viewangles; char buf[MAX_QPATH]; trap_Cvar_VariableStringBuffer("model", buf, sizeof(buf)); if (strcmp(buf, s_playersettings.playerModel) != 0) { UI_PlayerInfo_SetModel(&s_playersettings.playerinfo, buf); strcpy(s_playersettings.playerModel, buf); viewangles[YAW] = 180 - 30; viewangles[PITCH] = 0; viewangles[ROLL] = 0; UI_PlayerInfo_SetInfo(&s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse); } b = (menubitmap_s*) self; UI_DrawPlayer(b->generic.x, b->generic.y, b->width, b->height, &s_playersettings.playerinfo, uis.realtime / 2); }
/* * PlayerModel_UpdateModel */ static void PlayerModel_UpdateModel(void) { Vec3 viewangles; Vec3 moveangles; memset(&s_playermodel.playerinfo, 0, sizeof(Playerinfo)); viewangles[YAW] = 180 - 30; viewangles[PITCH] = 0; viewangles[ROLL] = 0; clearv3(moveangles); UI_PlayerInfo_SetModel(&s_playermodel.playerinfo, s_playermodel.modelskin); UI_PlayerInfo_SetInfo(&s_playermodel.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, moveangles, Wmachinegun, qfalse); }
/* ================= PlayerSettings_SetMenuItems ================= */ static void PlayerSettings_SetMenuItems( void ) { vec3_t viewangles; int c1, c2, c3; int h; char temp[6]; // name Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) ); // effects color trap_Cvar_VariableStringBuffer( "color1", temp, sizeof(temp) ); c1 = atoi( va( "%c", temp[0] ) ) - 1; c2 = atoi( va( "%c", temp[2] ) ) - 1; c3 = atoi( va( "%c", temp[4] ) ) - 1; if ( c1 > 6 || c1 < 0 ) c1 = 6; if ( c2 > 6 || c2 < 0 ) c2 = 6; if ( c3 > 6 || c3 < 0 ) c3 = 6; s_playersettings.effects.curvalue = gamecodetoui[c1]; s_playersettings.effects2.curvalue = gamecodetoui[c2]; s_playersettings.effects3.curvalue = gamecodetoui[c3]; // model/skin memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) ); viewangles[YAW] = 180 - 30; viewangles[PITCH] = 0; viewangles[ROLL] = 0; UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) ); UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_RAILGUN, qfalse ); // handicap h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") ); s_playersettings.handicap.curvalue = 20 - h / 5; }
/* ================= PlayerSettings_SetMenuItems ================= */ static void PlayerSettings_SetMenuItems( void ) { vec3_t viewangles; int c; int h; // name Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) ); // effects color c = trap_Cvar_VariableValue( "color1" ) - 1; if( c < 0 || c > 6 ) { c = 6; } s_playersettings.effects.curvalue = gamecodetoui[c]; // effects2 color c = trap_Cvar_VariableValue( "color2" ) - 1; if( c < 0 || c > 6 ) { c = 6; } s_playersettings.effects2.curvalue = gamecodetoui[c]; // model/skin memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) ); viewangles[YAW] = 180 - 30; viewangles[PITCH] = 0; viewangles[ROLL] = 0; UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) ); UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse ); // handicap h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") ); s_playersettings.handicap.curvalue = 20 - h / 5; }
/* ================= Controls_UpdateModel ================= */ static void Controls_UpdateModel( int anim ) { VectorClear( s_controls.playerViewangles ); VectorClear( s_controls.playerMoveangles ); s_controls.playerViewangles[YAW] = 180 - 30; s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW]; s_controls.playerLegs = LEGS_IDLE; s_controls.playerTorso = TORSO_STAND; s_controls.playerWeapon = -1; s_controls.playerChat = qfalse; switch( anim ) { case ANIM_RUN: s_controls.playerLegs = LEGS_RUN; break; case ANIM_WALK: s_controls.playerLegs = LEGS_WALK; break; case ANIM_BACK: s_controls.playerLegs = LEGS_BACK; break; case ANIM_JUMP: s_controls.playerLegs = LEGS_JUMP; break; case ANIM_CROUCH: s_controls.playerLegs = LEGS_IDLECR; break; case ANIM_TURNLEFT: s_controls.playerViewangles[YAW] += 90; break; case ANIM_TURNRIGHT: s_controls.playerViewangles[YAW] -= 90; break; case ANIM_STEPLEFT: s_controls.playerLegs = LEGS_WALK; s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW] + 90; break; case ANIM_STEPRIGHT: s_controls.playerLegs = LEGS_WALK; s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW] - 90; break; case ANIM_LOOKUP: s_controls.playerViewangles[PITCH] = -45; break; case ANIM_LOOKDOWN: s_controls.playerViewangles[PITCH] = 45; break; case ANIM_WEAPON1: s_controls.playerWeapon = WP_PUNCHY; break; case ANIM_WEAPON2: s_controls.playerWeapon = WP_NIPPER; break; case ANIM_WEAPON3: s_controls.playerWeapon = WP_PUMPER; break; case ANIM_WEAPON4: s_controls.playerWeapon = WP_BALLOONY; break; case ANIM_WEAPON5: s_controls.playerWeapon = WP_BETTY; break; case ANIM_WEAPON6: s_controls.playerWeapon = WP_BOASTER; break; case ANIM_WEAPON7: s_controls.playerWeapon = WP_SPLASHER; break; case ANIM_WEAPON8: s_controls.playerWeapon = WP_BUBBLEG; break; case ANIM_WEAPON9: s_controls.playerWeapon = WP_IMPERIUS; break; case ANIM_WEAPON10: s_controls.playerWeapon = WP_GRAPPLING_HOOK; break; case ANIM_ATTACK: s_controls.playerTorso = TORSO_ATTACK; break; case ANIM_GESTURE: s_controls.playerTorso = TORSO_GESTURE; break; case ANIM_DIE: s_controls.playerLegs = BOTH_DEATH1; s_controls.playerTorso = BOTH_DEATH1; s_controls.playerWeapon = WP_NONE; break; case ANIM_CHAT: s_controls.playerChat = qtrue; break; default: break; } UI_PlayerInfo_SetInfo( &s_controls.playerinfo, s_controls.playerLegs, s_controls.playerTorso, s_controls.playerViewangles, s_controls.playerMoveangles, s_controls.playerWeapon, s_controls.playerChat ); }