/* ================= CG_RegisterSounds called during a precache command ================= */ static void CG_RegisterSounds( void ) { int i; char items[MAX_ITEMS+1]; char name[MAX_QPATH]; const char *soundName; // voice commands cgs.media.oneMinuteSound = trap_S_RegisterSound( "sound/feedback/1_minute.wav", qtrue ); cgs.media.fiveMinuteSound = trap_S_RegisterSound( "sound/feedback/5_minute.wav", qtrue ); cgs.media.suddenDeathSound = trap_S_RegisterSound( "sound/feedback/sudden_death.wav", qtrue ); cgs.media.oneFragSound = trap_S_RegisterSound( "sound/feedback/1_frag.wav", qtrue ); cgs.media.twoFragSound = trap_S_RegisterSound( "sound/feedback/2_frags.wav", qtrue ); cgs.media.threeFragSound = trap_S_RegisterSound( "sound/feedback/3_frags.wav", qtrue ); cgs.media.count3Sound = trap_S_RegisterSound( "sound/feedback/three.wav", qtrue ); cgs.media.count2Sound = trap_S_RegisterSound( "sound/feedback/two.wav", qtrue ); cgs.media.count1Sound = trap_S_RegisterSound( "sound/feedback/one.wav", qtrue ); cgs.media.countFightSound = trap_S_RegisterSound( "sound/feedback/fight.wav", qtrue ); cgs.media.countPrepareSound = trap_S_RegisterSound( "sound/feedback/prepare.wav", qtrue ); if ( CG_IsTeamGame() || cg_buildScript.integer ) { cgs.media.captureAwardSound = trap_S_RegisterSound( "sound/teamplay/flagcapture_yourteam.wav", qtrue ); cgs.media.redLeadsSound = trap_S_RegisterSound( "sound/feedback/redleads.wav", qtrue ); cgs.media.blueLeadsSound = trap_S_RegisterSound( "sound/feedback/blueleads.wav", qtrue ); cgs.media.teamsTiedSound = trap_S_RegisterSound( "sound/feedback/teamstied.wav", qtrue ); cgs.media.hitTeamSound = trap_S_RegisterSound( "sound/feedback/hit_teammate.wav", qtrue ); cgs.media.redScoredSound = trap_S_RegisterSound( "sound/teamplay/voc_red_scores.wav", qtrue ); cgs.media.blueScoredSound = trap_S_RegisterSound( "sound/teamplay/voc_blue_scores.wav", qtrue ); cgs.media.captureYourTeamSound = trap_S_RegisterSound( "sound/teamplay/flagcapture_yourteam.wav", qtrue ); cgs.media.captureOpponentSound = trap_S_RegisterSound( "sound/teamplay/flagcapture_opponent.wav", qtrue ); cgs.media.returnYourTeamSound = trap_S_RegisterSound( "sound/teamplay/flagreturn_yourteam.wav", qtrue ); cgs.media.returnOpponentSound = trap_S_RegisterSound( "sound/teamplay/flagreturn_opponent.wav", qtrue ); cgs.media.takenYourTeamSound = trap_S_RegisterSound( "sound/teamplay/flagtaken_yourteam.wav", qtrue ); cgs.media.takenOpponentSound = trap_S_RegisterSound( "sound/teamplay/flagtaken_opponent.wav", qtrue ); if ( cg_buildScript.integer ) { cgs.media.redFlagReturnedSound = trap_S_RegisterSound( "sound/teamplay/voc_red_returned.wav", qtrue ); cgs.media.blueFlagReturnedSound = trap_S_RegisterSound( "sound/teamplay/voc_blue_returned.wav", qtrue ); cgs.media.enemyTookYourFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_enemy_flag.wav", qtrue ); cgs.media.yourTeamTookEnemyFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_team_flag.wav", qtrue ); } cgs.media.youHaveFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_you_flag.wav", qtrue ); cgs.media.holyShitSound = trap_S_RegisterSound("sound/feedback/voc_holyshit.wav", qtrue); cgs.media.neutralFlagReturnedSound = trap_S_RegisterSound( "sound/teamplay/flagreturn_opponent.wav", qtrue ); cgs.media.yourTeamTookTheFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_team_1flag.wav", qtrue ); cgs.media.enemyTookTheFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_enemy_1flag.wav", qtrue ); } cgs.media.tracerSound = trap_S_RegisterSound( "sound/weapons/machinegun/buletby1.wav", qfalse ); cgs.media.selectSound = trap_S_RegisterSound( "sound/weapons/change.wav", qfalse ); cgs.media.wearOffSound = trap_S_RegisterSound( "sound/items/wearoff.wav", qfalse ); cgs.media.useNothingSound = trap_S_RegisterSound( "sound/items/use_nothing.wav", qfalse ); cgs.media.gibSound = trap_S_RegisterSound( "sound/player/gibsplt1.wav", qfalse ); cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse ); cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse ); cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse ); cgs.media.teleInSound = trap_S_RegisterSound( "sound/world/telein.wav", qfalse ); cgs.media.teleOutSound = trap_S_RegisterSound( "sound/world/teleout.wav", qfalse ); cgs.media.respawnSound = trap_S_RegisterSound( "sound/items/respawn1.wav", qfalse ); cgs.media.noAmmoSound = trap_S_RegisterSound( "sound/weapons/noammo.wav", qfalse ); cgs.media.talkSound = trap_S_RegisterSound( "sound/player/talk.wav", qfalse ); cgs.media.landSound = trap_S_RegisterSound( "sound/player/land1.wav", qfalse); cgs.media.hitSound = trap_S_RegisterSound( "sound/feedback/hit.wav", qfalse ); cgs.media.impressiveSound = trap_S_RegisterSound( "sound/feedback/impressive.wav", qtrue ); cgs.media.excellentSound = trap_S_RegisterSound( "sound/feedback/excellent.wav", qtrue ); cgs.media.deniedSound = trap_S_RegisterSound( "sound/feedback/denied.wav", qtrue ); cgs.media.humiliationSound = trap_S_RegisterSound( "sound/feedback/humiliation.wav", qtrue ); cgs.media.assistSound = trap_S_RegisterSound( "sound/feedback/assist.wav", qtrue ); cgs.media.defendSound = trap_S_RegisterSound( "sound/feedback/defense.wav", qtrue ); cgs.media.takenLeadSound = trap_S_RegisterSound( "sound/feedback/takenlead.wav", qtrue); cgs.media.tiedLeadSound = trap_S_RegisterSound( "sound/feedback/tiedlead.wav", qtrue); cgs.media.lostLeadSound = trap_S_RegisterSound( "sound/feedback/lostlead.wav", qtrue); cgs.media.watrInSound = trap_S_RegisterSound( "sound/player/watr_in.wav", qfalse); cgs.media.watrOutSound = trap_S_RegisterSound( "sound/player/watr_out.wav", qfalse); cgs.media.watrUnSound = trap_S_RegisterSound( "sound/player/watr_un.wav", qfalse); cgs.media.jumpPadSound = trap_S_RegisterSound ("sound/world/jumppad.wav", qfalse ); for (i=0 ; i<4 ; i++) { Com_sprintf (name, sizeof(name), "sound/player/footsteps/step%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_NORMAL][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/boot%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_BOOT][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/flesh%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_FLESH][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/mech%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_MECH][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/energy%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_ENERGY][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/splash%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_SPLASH][i] = trap_S_RegisterSound (name, qfalse); Com_sprintf (name, sizeof(name), "sound/player/footsteps/clank%i.wav", i+1); cgs.media.footsteps[FOOTSTEP_METAL][i] = trap_S_RegisterSound (name, qfalse); } // only register the items that the server says we need strcpy( items, CG_ConfigString( CS_ITEMS ) ); for ( i = 1 ; i < bg_numItems ; i++ ) { // if ( items[ i ] == '1' || cg_buildScript.integer ) { CG_RegisterItemSounds( i ); // } } for ( i = 1 ; i < MAX_SOUNDS ; i++ ) { soundName = CG_ConfigString( CS_SOUNDS+i ); if ( !soundName[0] ) { break; } if ( soundName[0] == '*' ) { continue; // custom sound } cgs.gameSounds[i] = trap_S_RegisterSound( soundName, qfalse ); } // FIXME: only needed with item cgs.media.flightSound = trap_S_RegisterSound( "sound/items/flight.wav", qfalse ); cgs.media.medkitSound = trap_S_RegisterSound ("sound/items/use_medkit.wav", qfalse); cgs.media.quadSound = trap_S_RegisterSound("sound/items/damage3.wav", qfalse); cgs.media.sfx_ric1 = trap_S_RegisterSound ("sound/weapons/machinegun/ric1.wav", qfalse); cgs.media.sfx_ric2 = trap_S_RegisterSound ("sound/weapons/machinegun/ric2.wav", qfalse); cgs.media.sfx_ric3 = trap_S_RegisterSound ("sound/weapons/machinegun/ric3.wav", qfalse); cgs.media.sfx_railg = trap_S_RegisterSound ("sound/weapons/railgun/railgf1a.wav", qfalse); cgs.media.sfx_rockexp = trap_S_RegisterSound ("sound/weapons/rocket/rocklx1a.wav", qfalse); cgs.media.sfx_plasmaexp = trap_S_RegisterSound ("sound/weapons/plasma/plasmx1a.wav", qfalse); cgs.media.regenSound = trap_S_RegisterSound("sound/items/regen.wav", qfalse); cgs.media.protectSound = trap_S_RegisterSound("sound/items/protect3.wav", qfalse); cgs.media.n_healthSound = trap_S_RegisterSound("sound/items/n_health.wav", qfalse ); cgs.media.hgrenb1aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb1a.wav", qfalse); cgs.media.hgrenb2aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb2a.wav", qfalse); }
int WM_DrawObjectives( int x, int y, int width, float fade ) { const char *s, *str; int tempy, rows; int msec, mins, seconds, tens; // JPW NERVE vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; if ( cg.snap->ps.pm_type == PM_INTERMISSION ) { const char *s, *buf, *shader = NULL, *flagshader = NULL, *nameshader = NULL; // Moved to CG_DrawIntermission /* static int doScreenshot = 0, doDemostop = 0; // OSP - End-of-level autoactions if(!cg.demoPlayback) { if(!cg.latchVictorySound) { if(cg_autoAction.integer & AA_SCREENSHOT) { doScreenshot = cg.time + 1000; } if(cg_autoAction.integer & AA_STATSDUMP) { CG_dumpStats_f(); } if((cg_autoAction.integer & AA_DEMORECORD) && (cgs.gametype == GT_WOLF_STOPWATCH && cgs.currentRound != 1)) { doDemostop = cg.time + 5000; // stats should show up within 5 seconds } } if(doScreenshot > 0 && doScreenshot < cg.time) { CG_autoScreenShot_f(); doScreenshot = 0; } if(doDemostop > 0 && doDemostop < cg.time) { trap_SendConsoleCommand("stoprecord\n"); doDemostop = 0; } } */ rows = 8; y += SMALLCHAR_HEIGHT * ( rows - 1 ); s = CG_ConfigString( CS_MULTI_MAPWINNER ); buf = Info_ValueForKey( s, "winner" ); if ( atoi( buf ) == -1 ) str = "ITS A TIE!"; else if ( atoi( buf ) ) { str = "ALLIES"; // shader = "ui/assets/portraits/allies_win"; flagshader = "ui/assets/portraits/allies_win_flag.tga"; nameshader = "ui/assets/portraits/text_allies.tga"; /* if ( !cg.latchVictorySound ) { cg.latchVictorySound = qtrue; trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/allies_win.wav", qtrue ), CHAN_LOCAL_SOUND ); // FIXME: stream }*/ } else { str = "AXIS"; // shader = "ui/assets/portraits/axis_win"; flagshader = "ui/assets/portraits/axis_win_flag.tga"; nameshader = "ui/assets/portraits/text_axis.tga"; /* if ( !cg.latchVictorySound ) { cg.latchVictorySound = qtrue; trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/axis_win.wav", qtrue ), CHAN_LOCAL_SOUND ); // FIXME: stream }*/ } y += SMALLCHAR_HEIGHT * ( ( rows - 2 ) / 2 ); if ( flagshader ) { CG_DrawPic( 100, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); CG_DrawPic( 325, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); } if ( shader ) CG_DrawPic( 229, 10, 182, 136, trap_R_RegisterShaderNoMip( shader ) ); if ( nameshader ) { CG_DrawPic( 140, 50, 127, 64, trap_R_RegisterShaderNoMip( nameshader ) ); CG_DrawPic( 365, 50, 127, 64, trap_R_RegisterShaderNoMip( "ui/assets/portraits/text_win.tga" ) ); } return y; } // JPW NERVE -- mission time & reinforce time else { tempy = y; rows = 1; CG_FillRect( x-5, y-2, width+5, 21, clrUiBack ); CG_FillRect( x-5, y-2, width+5, 21, clrUiBar ); CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack ); y += SMALLCHAR_HEIGHT * ( rows - 1 ); if( cgs.timelimit > 0.0f ) { msec = ( cgs.timelimit * 60.f * 1000.f ) - ( cg.time - cgs.levelStartTime ); seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; } else { mins = tens = seconds = 0; } if( cgs.gamestate != GS_PLAYING ) { s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("WARMUP")); } else if ( msec < 0 && cgs.timelimit > 0.0f ) { if ( cgs.gamestate == GS_WAITING_FOR_PLAYERS ) s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "GAME STOPPED" ) ); else s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "SUDDEN DEATH" ) ); } else { s = va( "%s %2.0f:%i%i", CG_TranslateString( "MISSION TIME:" ), (float)mins, tens, seconds ); // float cast to line up with reinforce time } CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); if( cgs.gametype != GT_WOLF_LMS ) { if(cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS || cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) { msec = CG_CalculateReinfTime( qfalse ) * 1000; } else // no team (spectator mode) msec = 0; if (msec) { seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va( "%s %2.0f:%i%i", CG_TranslateString( "REINFORCE TIME:" ), (float)mins, tens, seconds ); CG_Text_Paint_Ext( 640 - 20 - CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ), y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } } // NERVE - SMF if ( cgs.gametype == GT_WOLF_STOPWATCH ) { int w; s = va( "%s %i", CG_TranslateString( "STOPWATCH ROUND" ), cgs.currentRound + 1 ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_LMS ) { int w; s = va( "%s %i %s %i-%i", CG_TranslateString( "ROUND" ), cgs.currentRound + 1, CG_TranslateString( "SCORE" ), cg.teamWonRounds[1], cg.teamWonRounds[0] ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_CAMPAIGN ) { int w; s = va( "MAP %i of %i", cgs.currentCampaignMap + 1, cgs.campaignData.mapCount ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } y += SMALLCHAR_HEIGHT * 2; } // jpw return y; }
/* ============= CG_Obituary ============= */ static void CG_Obituary( entityState_t *ent ) { int mod; int target, attacker; char *message; char *message2; const char *targetInfo; const char *attackerInfo; char targetName[32]; char attackerName[32]; gender_t gender; clientInfo_t *ci; target = ent->otherEntityNum; attacker = ent->otherEntityNum2; mod = ent->eventParm; if ( target < 0 || target >= MAX_CLIENTS ) { CG_Error( "CG_Obituary: target out of range" ); } ci = &cgs.clientinfo[target]; if ( attacker < 0 || attacker >= MAX_CLIENTS ) { attacker = ENTITYNUM_WORLD; attackerInfo = NULL; } else { attackerInfo = CG_ConfigString( CS_PLAYERS + attacker ); } targetInfo = CG_ConfigString( CS_PLAYERS + target ); if ( !targetInfo ) { return; } Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2); strcat( targetName, S_COLOR_WHITE ); message2 = ""; // check for single client messages switch( mod ) { case MOD_SUICIDE: message = "suicides"; break; case MOD_FALLING: message = "cratered"; break; case MOD_CRUSH: message = "was squished"; break; case MOD_WATER: message = "sank like a rock"; break; case MOD_SLIME: message = "melted"; break; case MOD_LAVA: message = "does a back flip into the lava"; break; case MOD_TARGET_LASER: message = "saw the light"; break; case MOD_TRIGGER_HURT: message = "was in the wrong place"; break; default: message = NULL; break; } if (attacker == target) { gender = ci->gender; switch (mod) { #ifdef MISSIONPACK case MOD_KAMIKAZE: message = "goes out with a bang"; break; #endif case MOD_GRENADE_SPLASH: if ( gender == GENDER_FEMALE ) message = "tripped on her own grenade"; else if ( gender == GENDER_NEUTER ) message = "tripped on its own grenade"; else message = "tripped on his own grenade"; break; case MOD_ROCKET_SPLASH: if ( gender == GENDER_FEMALE ) message = "blew herself up"; else if ( gender == GENDER_NEUTER ) message = "blew itself up"; else message = "blew himself up"; break; case MOD_PLASMA_SPLASH: if ( gender == GENDER_FEMALE ) message = "melted herself"; else if ( gender == GENDER_NEUTER ) message = "melted itself"; else message = "melted himself"; break; case MOD_BFG_SPLASH: message = "should have used a smaller gun"; break; #ifdef MISSIONPACK case MOD_PROXIMITY_MINE: if( gender == GENDER_FEMALE ) { message = "found her prox mine"; } else if ( gender == GENDER_NEUTER ) { message = "found its prox mine"; } else { message = "found his prox mine"; } break; #endif default: if ( gender == GENDER_FEMALE ) message = "killed herself"; else if ( gender == GENDER_NEUTER ) message = "killed itself"; else message = "killed himself"; break; } } if (message) { CG_Printf( "%s %s.\n", targetName, message); return; } // check for kill messages from the current clientNum if ( attacker == cg.snap->ps.clientNum ) { char *s; if ( cgs.gametype < GT_TEAM ) { s = va("You fragged %s\n%s place with %i", targetName, CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ), cg.snap->ps.persistant[PERS_SCORE] ); } else { s = va("You fragged %s", targetName ); } #ifdef MISSIONPACK if (!(cg_singlePlayerActive.integer && cg_cameraOrbit.integer)) { CG_CenterPrint( s, SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); } #else CG_CenterPrint( s, SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); #endif // print the text message as well } // check for double client messages if ( !attackerInfo ) { attacker = ENTITYNUM_WORLD; strcpy( attackerName, "noname" ); } else { Q_strncpyz( attackerName, Info_ValueForKey( attackerInfo, "n" ), sizeof(attackerName) - 2); strcat( attackerName, S_COLOR_WHITE ); // check for kill messages about the current clientNum if ( target == cg.snap->ps.clientNum ) { Q_strncpyz( cg.killerName, attackerName, sizeof( cg.killerName ) ); } } if ( attacker != ENTITYNUM_WORLD ) { switch (mod) { case MOD_POISON: message = "was poisoned by"; break; case MOD_NUKE: message = "was introduced to the nuclear family by"; break; case MOD_GRAPPLE: message = "was caught by"; break; case MOD_GAUNTLET: message = "was pummeled by"; break; case MOD_MACHINEGUN: message = "was machinegunned by"; break; case MOD_SHOTGUN: message = "was gunned down by"; break; case MOD_GRENADE: message = "ate"; message2 = "'s grenade"; break; case MOD_GRENADE_SPLASH: message = "was shredded by"; message2 = "'s shrapnel"; break; case MOD_ROCKET: message = "ate"; message2 = "'s rocket"; break; case MOD_ROCKET_SPLASH: message = "almost dodged"; message2 = "'s rocket"; break; case MOD_PLASMA: message = "was melted by"; message2 = "'s plasmagun"; break; case MOD_PLASMA_SPLASH: message = "was melted by"; message2 = "'s plasmagun"; break; case MOD_RAILGUN: message = "was railed by"; break; case MOD_LIGHTNING: message = "was electrocuted by"; break; case MOD_BFG: case MOD_BFG_SPLASH: message = "was blasted by"; message2 = "'s BFG"; break; #ifdef MISSIONPACK case MOD_NAIL: message = "was nailed by"; break; case MOD_CHAINGUN: message = "got lead poisoning from"; message2 = "'s Chaingun"; break; case MOD_PROXIMITY_MINE: message = "was too close to"; message2 = "'s Prox Mine"; break; case MOD_KAMIKAZE: message = "falls to"; message2 = "'s Kamikaze blast"; break; case MOD_JUICED: message = "was juiced by"; break; #endif case MOD_TELEFRAG: message = "tried to invade"; message2 = "'s personal space"; break; default: message = "was killed by"; break; } if (message) { CG_Printf( "%s %s %s%s\n", targetName, message, attackerName, message2); return; } } // we don't know what it was CG_Printf( "%s died.\n", targetName ); }
int CG_NewParticleArea(int num) { // const char *str; char *str; char *token; int type; vec3_t origin, origin2; int i; float range = 0; int turb; int numparticles; int snum; str = (char *)CG_ConfigString(num); if(!str[0]) { return (0); } // returns type 128 64 or 32 token = COM_Parse(&str); type = atoi(token); if(type == 1) { range = 128; } else if(type == 2) { range = 64; } else if(type == 3) { range = 32; } else if(type == 0) { range = 256; } else if(type == 4) { range = 8; } else if(type == 5) { range = 16; } else if(type == 6) { range = 32; } else if(type == 7) { range = 64; } for(i = 0; i < 3; i++) { token = COM_Parse(&str); origin[i] = atof(token); } for(i = 0; i < 3; i++) { token = COM_Parse(&str); origin2[i] = atof(token); } token = COM_Parse(&str); numparticles = atoi(token); token = COM_Parse(&str); turb = atoi(token); token = COM_Parse(&str); snum = atoi(token); for(i = 0; i < numparticles; i++) { if(type >= 4) { CG_ParticleBubble(cgs.media.waterBubbleShader, origin, origin2, turb, range, snum); } else { CG_ParticleSnow(cgs.media.snowShader, origin, origin2, turb, range, snum); } } return (1); }
void TurretClientRun(centity_t *ent) { if (!ent->ghoul2) { weaponInfo_t *weaponInfo; trap_G2API_InitGhoul2Model(&ent->ghoul2, CG_ConfigString( CS_MODELS+ent->currentState.modelindex ), 0, 0, 0, 0, 0); if (!ent->ghoul2) { //bad return; } ent->torsoBolt = trap_G2API_AddBolt( ent->ghoul2, 0, "*flash02" ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_gback", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_barrel", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); trap_G2API_SetBoneAnim( ent->ghoul2, 0, "model_root", 0, 11, BONE_ANIM_OVERRIDE_FREEZE, 0.8f, cg->time, 0, 0 ); ent->turAngles[ROLL] = 0; ent->turAngles[PITCH] = 90; ent->turAngles[YAW] = 0; weaponInfo = &cg_weapons[WP_TURRET]; if ( !weaponInfo->registered ) { CG_RegisterWeapon(WP_TURRET); } } if (ent->currentState.fireflag == 2) { //I'm about to blow if (ent->turAngles) { trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", ent->turAngles, BONE_ANGLES_REPLACE, NEGATIVE_Y, NEGATIVE_Z, NEGATIVE_X, NULL, 100, cg->time ); } return; } else if (ent->currentState.fireflag && ent->bolt4 != ent->currentState.fireflag) { vec3_t muzzleOrg, muzzleDir; mdxaBone_t boltMatrix; trap_G2API_GetBoltMatrix(ent->ghoul2, 0, ent->torsoBolt, &boltMatrix, /*ent->lerpAngles*/vec3_origin, ent->lerpOrigin, cg->time, cgs.gameModels, ent->modelScale); BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, muzzleOrg); BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_X, muzzleDir); trap_FX_PlayEffectID(cgs.effects.mTurretMuzzleFlash, muzzleOrg, muzzleDir, -1, -1); ent->bolt4 = ent->currentState.fireflag; } else if (!ent->currentState.fireflag) { ent->bolt4 = 0; } if (ent->currentState.bolt2 != ENTITYNUM_NONE) { //turn toward the enemy centity_t *enemy = &cg_entities[ent->currentState.bolt2]; if (enemy) { vec3_t enAng; vec3_t enPos; VectorCopy(enemy->currentState.pos.trBase, enPos); VectorSubtract(enPos, ent->lerpOrigin, enAng); VectorNormalize(enAng); vectoangles(enAng, enAng); enAng[ROLL] = 0; enAng[PITCH] += 90; CreepToPosition(enAng, ent->turAngles); } } else { vec3_t idleAng; float turnAmount; if (ent->turAngles[YAW] > 360) { ent->turAngles[YAW] -= 361; } if (!ent->dustTrailTime) { ent->dustTrailTime = cg->time; } turnAmount = (cg->time-ent->dustTrailTime)*0.03; if (turnAmount > 360) { turnAmount = 360; } idleAng[PITCH] = 90; idleAng[ROLL] = 0; idleAng[YAW] = ent->turAngles[YAW] + turnAmount; ent->dustTrailTime = cg->time; CreepToPosition(idleAng, ent->turAngles); } if (cg->time < ent->frame_minus1_refreshed) { ent->frame_minus1_refreshed = cg->time; return; } ent->frame_minus1_refreshed = cg->time; trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", ent->turAngles, BONE_ANGLES_REPLACE, NEGATIVE_Y, NEGATIVE_Z, NEGATIVE_X, NULL, 100, cg->time ); }
/* ================ CG_ConfigStringModified ================ */ static void CG_ConfigStringModified( void ) { const char *str; int num; num = atoi( CG_Argv( 1 ) ); // get the gamestate from the client system, which will have the // new configstring already integrated trap_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_MUSIC ) { CG_StartMusic(); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num == CS_WARMUP ) { CG_ParseWarmup(); } else if ( num == CS_SCORES1 ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_YES ) { cgs.voteYes = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_NO ) { cgs.voteNo = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_STRING ) { Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); #ifdef MISSIONPACK trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER ); #endif //MISSIONPACK } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) { cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue; } else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) { cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue; } else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) { cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue; } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) { Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) ); #ifdef MISSIONPACK trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER ); #endif } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.gameModels[ num-CS_MODELS ] = trap_R_RegisterModel( str ); } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_MODELS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameSounds[ num-CS_SOUNDS] = trap_S_RegisterSound( str, qfalse ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS ); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } #ifdef MISSIONPACK else if( cgs.gametype == GT_1FCTF ) { cgs.flagStatus = str[0] - '0'; } #endif } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } }
void CG_HandleNPCSounds(centity_t *cent) { if (!cent->npcClient) { return; } //standard if (cent->currentState.csSounds_Std) { const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Std ); if (s && s[0]) { char sEnd[MAX_QPATH]; int i = 2; int j = 0; //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates //it is an NPC custom sound dir. while (s[i]) { sEnd[j] = s[i]; j++; i++; } sEnd[j] = 0; CG_RegisterCustomSounds(cent->npcClient, 1, sEnd); } } else { memset(¢->npcClient->sounds, 0, sizeof(cent->npcClient->sounds)); } //combat if (cent->currentState.csSounds_Combat) { const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Combat ); if (s && s[0]) { char sEnd[MAX_QPATH]; int i = 2; int j = 0; //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates //it is an NPC custom sound dir. while (s[i]) { sEnd[j] = s[i]; j++; i++; } sEnd[j] = 0; CG_RegisterCustomSounds(cent->npcClient, 2, sEnd); } } else { memset(¢->npcClient->combatSounds, 0, sizeof(cent->npcClient->combatSounds)); } //extra if (cent->currentState.csSounds_Extra) { const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Extra ); if (s && s[0]) { char sEnd[MAX_QPATH]; int i = 2; int j = 0; //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates //it is an NPC custom sound dir. while (s[i]) { sEnd[j] = s[i]; j++; i++; } sEnd[j] = 0; CG_RegisterCustomSounds(cent->npcClient, 3, sEnd); } } else { memset(¢->npcClient->extraSounds, 0, sizeof(cent->npcClient->extraSounds)); } //jedi if (cent->currentState.csSounds_Jedi) { const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Jedi ); if (s && s[0]) { char sEnd[MAX_QPATH]; int i = 2; int j = 0; //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates //it is an NPC custom sound dir. while (s[i]) { sEnd[j] = s[i]; j++; i++; } sEnd[j] = 0; CG_RegisterCustomSounds(cent->npcClient, 4, sEnd); } } else { memset(¢->npcClient->jediSounds, 0, sizeof(cent->npcClient->jediSounds)); } }
/* ==================== CG_DrawInformation Draw all the status / pacifier stuff during level loading ==================== */ void CG_DrawInformation(void) { const char *s; const char *info; const char *sysInfo; int y; int value; qhandle_t levelshot; qhandle_t detail; char buf[1024]; info = CG_ConfigString(CS_SERVERINFO); sysInfo = CG_ConfigString(CS_SYSTEMINFO); s = Info_ValueForKey(info, "mapname"); levelshot = trap_R_RegisterShaderNoMip(va("levelshots/%s.tga", s)); if (!levelshot) { levelshot = trap_R_RegisterShaderNoMip("menu/art/unknownmap"); } trap_R_SetColor(NULL); CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot); // blend a detail texture over it detail = trap_R_RegisterShader("levelShotDetail"); trap_R_DrawStretchPic(0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail); // draw the icons of things as they are loaded CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if (cg.infoScreenText[0]) { UI_DrawProportionalString(320, 128-32, va("Loading... %s", cg.infoScreenText), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); } else { UI_DrawProportionalString(320, 128-32, "Awaiting snapshot...", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); } // draw info string information y = 180-32; // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer("sv_running", buf, sizeof(buf)); if (!atoi(buf)) { // server hostname Q_strncpyz(buf, Info_ValueForKey(info, "sv_hostname"), 1024); Q_CleanStr(buf); UI_DrawProportionalString(320, y, buf, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; // pure server s = Info_ValueForKey(sysInfo, "sv_pure"); if (s[0] == '1') { UI_DrawProportionalString(320, y, "Pure Server", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } // server-specific message of the day s = CG_ConfigString(CS_MOTD); if (s[0]) { UI_DrawProportionalString(320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString(CS_MESSAGE); if (s[0]) { UI_DrawProportionalString(320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } // cheats warning s = Info_ValueForKey(sysInfo, "sv_cheats"); if (s[0] == '1') { UI_DrawProportionalString(320, y, "CHEATS ARE ENABLED", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } // game type switch (cgs.gametype) { case GT_FFA: s = "Free For All"; break; case GT_SINGLE_PLAYER: s = "Single Player"; break; case GT_TOURNAMENT: s = "Tournament"; break; case GT_TEAM: s = "Team Deathmatch"; break; case GT_CTF: s = "Capture The Flag"; break; case GT_DESTROY: s = "Invasion b"INVASION_VERSION" - Destroy All Eggs"; break; case GT_INVASION: s = "Invasion b"INVASION_VERSION" - Teleport The Egg"; break; /*#ifdef MISSIONPACK case GT_1FCTF: s = "One Flag CTF"; break; case GT_OBELISK: s = "Overload"; break; case GT_HARVESTER: s = "Harvester"; break; #endif*/ default: s = "Unknown Gametype"; break; } UI_DrawProportionalString(320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; value = atoi(Info_ValueForKey(info, "timelimit")); if (value) { UI_DrawProportionalString(320, y, va("timelimit %i", value), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } if (cgs.gametype < GT_CTF) { value = atoi(Info_ValueForKey(info, "fraglimit")); if (value) { UI_DrawProportionalString(320, y, va("fraglimit %i", value), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } } if (cgs.gametype >= GT_CTF) { char *StrType[] = { "capturelimit", "winlimit" }; value = atoi(Info_ValueForKey(info, StrType[0])); if (value) { char *s = NULL; if (cgs.gametype == GT_INVASION || cgs.gametype == GT_DESTROY) s = StrType[1]; else s = StrType[0]; UI_DrawProportionalString(320, y, va("%s %i", s, value), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT; } } }
/* =================== CG_LoadingClient =================== */ void CG_LoadingClient(int clientNum) { const char *info; char *skin; char personality[MAX_QPATH]; char model[MAX_QPATH]; char iconName[MAX_QPATH]; info = CG_ConfigString(CS_PLAYERS + clientNum); if (loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS) { Q_strncpyz(model, Info_ValueForKey(info, "model"), sizeof(model)); skin = Q_strrchr(model, '/'); if (skin) { *skin++ = '\0'; } else { switch (atoi(Info_ValueForKey(info, "t"))) { case TEAM_BLUE: skin = "default"; break; default: skin = "red"; break; } } if (!model[0]) strcpy(model, DEFAULT_MODEL); Com_sprintf(iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", model, skin); loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip(iconName); if (!loadingPlayerIcons[loadingPlayerIconCount]) { Com_sprintf( iconName, MAX_QPATH, "models/players/characters/%s/icon_%s.tga", model, skin ); loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName ); } if (!loadingPlayerIcons[loadingPlayerIconCount]) { Com_sprintf(iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", DEFAULT_MODEL, "default"); loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip(iconName); } if (loadingPlayerIcons[loadingPlayerIconCount]) { loadingPlayerIconCount++; } } Q_strncpyz(personality, Info_ValueForKey(info, "n"), sizeof(personality)); Q_CleanStr(personality); if (cgs.gametype == GT_SINGLE_PLAYER) { trap_S_RegisterSound(va("sound/player/announce/%s.wav", personality), qtrue); } CG_LoadingString(personality); }
/* ============= CG_GroundVehicleObituary General ugly function, needs to be made prettier some day... ============= */ void CG_LQMObituary( entityState_t *ent, clientInfo_t *ci ) { // add some cool stuff here :-) int mod; int target, attacker; char *message; char *message2; const char *targetInfo; const char *attackerInfo; char targetName[32]; char attackerName[32]; gender_t gender; target = ent->otherEntityNum; attacker = ent->otherEntityNum2; mod = ent->eventParm; if ( attacker < 0 || attacker >= MAX_CLIENTS ) { attacker = ENTITYNUM_WORLD; attackerInfo = NULL; } else { attackerInfo = CG_ConfigString( CS_PLAYERS + attacker ); } targetInfo = CG_ConfigString( CS_PLAYERS + target ); if ( !targetInfo ) { return; } #pragma message("remove the problem checking here!") if( Info_ValueForKey( targetInfo, "n" ) != 0 ) { Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2); } else { Com_Error( ERR_DROP, "MFQ3 Error (3): Invalid targetinfo\n" ); } strcat( targetName, S_COLOR_WHITE ); message2 = ""; // check for single client messages switch( mod ) { case MOD_SUICIDE: message = "suicides"; break; case MOD_FALLING: message = "cratered"; break; case MOD_CRUSH: message = "was squished"; break; case MOD_WATER: message = "sank like a rock"; break; case MOD_SLIME: message = "melted"; break; case MOD_LAVA: message = "does a back flip into the lava"; break; default: message = NULL; break; } if (attacker == target) { gender = ci->gender; switch (mod) { case MOD_CRASH: message = "was unable to control his vehicle"; break; default: if ( gender == GENDER_FEMALE ) message = "killed herself"; else if ( gender == GENDER_NEUTER ) message = "killed itself"; else message = "killed himself"; break; } } if (message) { CG_Printf( "%s %s.\n", targetName, message); return; } // check for kill messages from the current clientNum if ( attacker == cg.snap->ps.clientNum ) { char *s; if ( cgs.gametype < GT_TEAM ) { s = va("You fragged %s\n%s place with %i", targetName, CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ), cg.snap->ps.persistant[PERS_SCORE] ); } else { s = va("You fragged %s", targetName ); } CG_CenterPrint( s, SCREEN_HEIGHT * 0.25, BIGCHAR_WIDTH ); // print the text message as well } // check for double client messages if ( !attackerInfo ) { attacker = ENTITYNUM_WORLD; strcpy( attackerName, "noname" ); } else { if( Info_ValueForKey( attackerInfo, "n" ) != 0 ) { Q_strncpyz( attackerName, Info_ValueForKey( attackerInfo, "n" ), sizeof(attackerName) - 2); } else { Com_Error( ERR_DROP, "MFQ3 Error (1): Bad attackerInfo!\n" ); } strcat( attackerName, S_COLOR_WHITE ); // check for kill messages about the current clientNum if ( target == cg.snap->ps.clientNum ) { if( attackerName != 0 ) { Q_strncpyz( cg.killerName, attackerName, sizeof( cg.killerName ) ); } else { Com_Error( ERR_DROP, "MFQ3 Error (2): No attackerName!\n" ); } } } if( attacker != ENTITYNUM_WORLD ) { switch(mod) { case MOD_FFAR: message = "couldn't evade"; message2 = "'s rocket attack"; break; case MOD_FFAR_SPLASH: message = "was shredded by"; message2 = "'s rocket shrapnel"; break; case MOD_IRONBOMB: case MOD_IRONBOMB_SPLASH: message = "was bombed to smithereens by"; message2 = "'s iron bombs"; break; case MOD_AUTOCANNON: message = "was blown out of the sky by"; message2 = "'s bullets"; break; case MOD_MAINGUN: message = "was shelled by"; break; case MOD_VEHICLEEXPLOSION: message = "died in"; message2 = "'s explosion"; break; case MOD_TELEFRAG: message = "tried to invade"; message2 = "'s personal space"; break; default: message = "was killed by"; break; } if( message ) { CG_Printf( "%s %s %s%s\n", targetName, message, attackerName, message2); return; } } // we don't know what it was CG_Printf( "%s died.\n", targetName ); }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y; int value, valueNOFP; qhandle_t levelshot; char buf[1024]; int iPropHeight = 18; // I know, this is total crap, but as a post release asian-hack.... -Ste info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" ); } trap_R_SetColor( NULL ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); CG_LoadBar(); // draw the icons of things as they are loaded // CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { const char *psLoading = CG_GetStripEdString("MENUS3", "LOADING_MAPNAME"); UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg.infoScreenText), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } else { const char *psAwaitingSnapshot = CG_GetStripEdString("MENUS3", "AWAITING_SNAPSHOT"); UI_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } // draw info string information y = 180-32; // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) ); if ( !atoi( buf ) ) { // server hostname Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024); Q_CleanStr(buf); UI_DrawProportionalString( 320, y, buf, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { const char *psPure = CG_GetStripEdString("INGAMETEXT", "PURE_SERVER"); UI_DrawProportionalString( 320, y, psPure, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } { // display global MOTD at bottom (mirrors ui_main UI_DrawConnectScreen char motdString[1024]; trap_Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) ); if (motdString[0]) { UI_DrawProportionalString( 320, 425, motdString, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { UI_DrawProportionalString( 320, y, CG_GetStripEdString("INGAMETEXT", "CHEATSAREENABLED"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // game type switch ( cgs.gametype ) { case GT_FFA: s = "Free For All"; break; case GT_HOLOCRON: s = "Holocron FFA"; break; case GT_JEDIMASTER: s = "Jedi Master"; break; case GT_SINGLE_PLAYER: s = "Single Player"; break; case GT_TOURNAMENT: s = "Duel"; break; case GT_TEAM: s = "Team FFA"; break; case GT_SAGA: s = "N/A"; break; case GT_CTF: s = "Capture The Flag"; break; case GT_CTY: s = "Capture The Ysalamiri"; break; default: s = "Unknown Gametype"; break; } UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; value = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStripEdString("INGAMETEXT", "TIMELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (!GT_Flag(cgs.gametype)) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStripEdString("INGAMETEXT", "FRAGLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_TOURNAMENT) { value = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStripEdString("INGAMETEXT", "WINLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } } if (GT_Flag(cgs.gametype)) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStripEdString("INGAMETEXT", "CAPTURELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (GT_Team(cgs.gametype)) { value = atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) ); if ( value ) { UI_DrawProportionalString( 320, y, CG_GetStripEdString("INGAMETEXT", "FORCEBASEDTEAMS"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } valueNOFP = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) ); value = atoi( Info_ValueForKey( info, "g_maxForceRank" ) ); if ( value && !valueNOFP ) { char fmStr[1024]; trap_SP_GetStringTextString("INGAMETEXT_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, CG_GetStripEdString("INGAMETEXT", forceMasteryLevels[value]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } else if (!valueNOFP) { char fmStr[1024]; trap_SP_GetStringTextString("INGAMETEXT_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, (char *)CG_GetStripEdString("INGAMETEXT", forceMasteryLevels[7]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_TOURNAMENT) { value = atoi( Info_ValueForKey( info, "g_duelWeaponDisable" ) ); } else { value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) ); } if ( cgs.gametype != GT_JEDIMASTER && value ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "SABERONLYSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if ( valueNOFP ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "NOFPSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // Display the rules based on type y += iPropHeight; switch ( cgs.gametype ) { case GT_FFA: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_FFA_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_HOLOCRON: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_HOLO_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_HOLO_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_JEDIMASTER: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_JEDI_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_JEDI_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SINGLE_PLAYER: break; case GT_TOURNAMENT: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_DUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_DUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_TEAM: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_TEAM_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_TEAM_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SAGA: break; case GT_CTF: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_CTF_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_CTF_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_CTY: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_CTY_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStripEdString("INGAMETEXT", "RULES_CTY_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; default: break; } }
void CG_DrawConnectScreen(qboolean interactive, qboolean forcerefresh) { static qboolean inside = qfalse; char buffer[1024]; bg_loadscreeninteractive = interactive; if (!DC) { return; } if (inside) { return; } inside = qtrue; if (!bg_loadscreeninited) { trap_Cvar_Set("ui_connecting", "0"); DC->registerFont("ariblk", 27, &bg_loadscreenfont1); DC->registerFont("courbd", 30, &bg_loadscreenfont2); bg_axispin = DC->registerShaderNoMip("gfx/loading/pin_axis"); bg_alliedpin = DC->registerShaderNoMip("gfx/loading/pin_allied"); bg_neutralpin = DC->registerShaderNoMip("gfx/loading/pin_neutral"); bg_pin = DC->registerShaderNoMip("gfx/loading/pin_shot"); bg_filter_bo = DC->registerShaderNoMip("ui/assets/filter_bots"); bg_filter_ff = DC->registerShaderNoMip("ui/assets/filter_ff"); bg_filter_hw = DC->registerShaderNoMip("ui/assets/filter_weap"); bg_filter_lv = DC->registerShaderNoMip("ui/assets/filter_lives"); bg_filter_al = DC->registerShaderNoMip("ui/assets/filter_antilag"); bg_filter_bt = DC->registerShaderNoMip("ui/assets/filter_balance"); bg_mappic = 0; BG_PanelButtonsSetup(loadpanelButtons); C_PanelButtonsSetup(loadpanelButtons, cgs.wideXoffset); bg_loadscreeninited = qtrue; } BG_PanelButtonsRender(loadpanelButtons); if (interactive) { DC->drawHandlePic(DC->cursorx, DC->cursory, 32, 32, DC->Assets.cursor); } DC->getConfigString(CS_SERVERINFO, buffer, sizeof(buffer)); if (*buffer) { const char *str; float x = 540.0f + cgs.wideXoffset; float y = 322; int i; qboolean enabled = qfalse; CG_Text_Paint_Centred_Ext(x, y, 0.22f, 0.22f, clr3, ("^1" LEGACY_MOD " ^0" LEGACY_MOD_VERSION), 0, 0, 0, &bg_loadscreenfont1); y = 340; str = Info_ValueForKey(buffer, "sv_hostname"); CG_Text_Paint_Centred_Ext(x, y, 0.2f, 0.2f, colorWhite, str && *str ? str : "ETHost", 0, 26, 0, &bg_loadscreenfont2); y += 14; for (i = 0; i < MAX_MOTDLINES; i++) { str = CG_ConfigString(CS_CUSTMOTD + i); if (!str || !*str) { break; } CG_Text_Paint_Centred_Ext(x, y, 0.2f, 0.2f, colorWhite, str, 0, 26, 0, &bg_loadscreenfont2); y += 10; } y = 417; str = Info_ValueForKey(buffer, "g_friendlyfire"); if (str && *str && atoi(str)) { x = 461 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_ff); } if (atoi(Info_ValueForKey(buffer, "g_gametype")) != GT_WOLF_LMS) { str = Info_ValueForKey(buffer, "g_maxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } if (!enabled) { str = Info_ValueForKey(buffer, "g_alliedmaxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } } if (!enabled) { str = Info_ValueForKey(buffer, "g_axismaxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } } } if (enabled) { x = 489 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_lv); } str = Info_ValueForKey(buffer, "omnibot_playing"); if (str && *str && atoi(str)) { x = 518 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_bo); } str = Info_ValueForKey(buffer, "g_heavyWeaponRestriction"); if (str && *str && atoi(str) != 100) { x = 546 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_hw); } str = Info_ValueForKey(buffer, "g_antilag"); if (str && *str && atoi(str)) { x = 575 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_al); } str = Info_ValueForKey(buffer, "g_balancedteams"); if (str && *str && atoi(str)) { x = 604 + cgs.wideXoffset; CG_DrawPic(x, y, 16, 16, bg_filter_bt); } } if (*cgs.rawmapname) { float x = 16 + cgs.wideXoffset + 1; if (!bg_mappic) { bg_mappic = DC->registerShaderNoMip(va("levelshots/%s", cgs.rawmapname)); if (!bg_mappic) { bg_mappic = DC->registerShaderNoMip("levelshots/unknownmap"); } } trap_R_SetColor(colorBlack); CG_DrawPic(x, 2 + 1, 192, 144, bg_mappic); trap_R_SetColor(NULL); x = 16 + cgs.wideXoffset; CG_DrawPic(x, 2, 192, 144, bg_mappic); x = 16 + cgs.wideXoffset + 80; CG_DrawPic(x, 2 + 6, 20, 20, bg_pin); } if (forcerefresh) { DC->updateScreen(); } inside = qfalse; }
/* ================= CG_DrawTourneyScoreboard Draw the oversize scoreboard for tournements ================= */ void CG_DrawOldTourneyScoreboard( void ) { const char *s; vec4_t color; int min, tens, ones; clientInfo_t *ci; int y; int i; // request more scores regularly if ( cg.scoresRequestTime + 2000 < cg.time ) { cg.scoresRequestTime = cg.time; _CG_trap_SendClientCommand( "score" ); } color[0] = GFIXED_1; color[1] = GFIXED_1; color[2] = GFIXED_1; color[3] = GFIXED_1; // draw the dialog background color[0] = color[1] = color[2] = GFIXED_0; color[3] = GFIXED_1; CG_FillRect( GFIXED_0, GFIXED_0, GFIXED(SCREEN_WIDTH,0), GFIXED(SCREEN_HEIGHT,0), color ); // print the mesage of the day s = CG_ConfigString( CS_MOTD ); if ( !s[0] ) { s = "Scoreboard"; } // print optional title CG_CenterGiantLine( GFIXED(8,0), s ); // print server time ones = cg.time / 1000; min = ones / 60; ones %= 60; tens = ones / 10; ones %= 10; s = va("%i:%i%i", min, tens, ones ); CG_CenterGiantLine( GFIXED(64,0), s ); // print the two scores y = 160; if ( cgs.gametype >= GT_TEAM ) { // // teamplay scoreboard // CG_DrawStringExt( 8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[0] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; CG_DrawStringExt( 8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[1] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); } else { // // free for all scoreboard // for ( i = 0 ; i < MAX_CLIENTS ; i++ ) { ci = &cgs.clientinfo[i]; if ( !ci->infoValid ) { continue; } if ( ci->team != TEAM_FREE ) { continue; } CG_DrawStringExt( 8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", ci->score ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; } } }
/* ================= CG_RegisterGraphics This function may execute for a couple of minutes with a slow disk. ================= */ static void CG_RegisterGraphics( void ) { gitem_t *backpack; int i; char items[MAX_ITEMS+1]; static char *sb_nums[11] = { "gfx/2d/numbers/zero_32b", "gfx/2d/numbers/one_32b", "gfx/2d/numbers/two_32b", "gfx/2d/numbers/three_32b", "gfx/2d/numbers/four_32b", "gfx/2d/numbers/five_32b", "gfx/2d/numbers/six_32b", "gfx/2d/numbers/seven_32b", "gfx/2d/numbers/eight_32b", "gfx/2d/numbers/nine_32b", "gfx/2d/numbers/minus_32b", }; // clear any references to old media memset( &cg.refdef, 0, sizeof( cg.refdef ) ); trap_R_ClearScene(); CG_LoadingString( cgs.mapname ); trap_R_LoadWorldMap( cgs.mapname ); // precache status bar pics CG_LoadingString( "game media" ); for ( i=0 ; i<11 ; i++) { cgs.media.numberShaders[i] = trap_R_RegisterShader( sb_nums[i] ); } cgs.media.botSkillShaders[0] = trap_R_RegisterShader( "menu/art/skill1.tga" ); cgs.media.botSkillShaders[1] = trap_R_RegisterShader( "menu/art/skill2.tga" ); cgs.media.botSkillShaders[2] = trap_R_RegisterShader( "menu/art/skill3.tga" ); cgs.media.botSkillShaders[3] = trap_R_RegisterShader( "menu/art/skill4.tga" ); cgs.media.botSkillShaders[4] = trap_R_RegisterShader( "menu/art/skill5.tga" ); cgs.media.viewBloodShader = trap_R_RegisterShader( "viewBloodBlend" ); cgs.media.deferShader = trap_R_RegisterShaderNoMip( "gfx/2d/defer.tga" ); cgs.media.scoreboardName = trap_R_RegisterShaderNoMip( "menu/tab/name.tga" ); cgs.media.scoreboardPing = trap_R_RegisterShaderNoMip( "menu/tab/ping.tga" ); cgs.media.scoreboardScore = trap_R_RegisterShaderNoMip( "menu/tab/score.tga" ); cgs.media.scoreboardTime = trap_R_RegisterShaderNoMip( "menu/tab/time.tga" ); cgs.media.objectivesOverlay = trap_R_RegisterShaderNoMip( CG_ConfigString(CS_OBJECTIVESOVERLAY) ); cgs.media.objectivesUpdated = trap_R_RegisterShaderNoMip( "menu/objectives/updated.tga" ); cgs.media.objectivesUpdatedSound = trap_S_RegisterSound( "sound/misc/objective_update_01.wav", qfalse ); cgs.media.deathImage = trap_R_RegisterShaderNoMip( "menu/art/level_complete5" ); cgs.media.scoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); cgs.media.finalScoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); cgs.media.smokePuffShader = trap_R_RegisterShader( "smokePuff" ); cgs.media.smokePuffRageProShader = trap_R_RegisterShader( "smokePuffRagePro" ); cgs.media.shotgunSmokePuffShader = trap_R_RegisterShader( "shotgunSmokePuff" ); cgs.media.plasmaBallShader = trap_R_RegisterShader( "sprites/plasma1" ); cgs.media.bloodTrailShader = trap_R_RegisterShader( "bloodTrail" ); cgs.media.lagometerShader = trap_R_RegisterShader("lagometer" ); cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" ); cgs.media.waterBubbleShader = trap_R_RegisterShader( "waterBubble" ); cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" ); cgs.media.selectShader = trap_R_RegisterShader( "gfx/2d/select" ); for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) { cgs.media.crosshairShader[i] = trap_R_RegisterShader( va("gfx/2d/crosshair%c", 'a'+i) ); } cgs.media.backTileShader = trap_R_RegisterShader( "gfx/2d/backtile" ); cgs.media.noammoShader = trap_R_RegisterShader( "icons/noammo" ); // powerup shaders cgs.media.quadShader = trap_R_RegisterShader("powerups/quad" ); cgs.media.quadWeaponShader = trap_R_RegisterShader("powerups/quadWeapon" ); cgs.media.battleSuitShader = trap_R_RegisterShader("powerups/battleSuit" ); cgs.media.battleWeaponShader = trap_R_RegisterShader("powerups/battleWeapon" ); cgs.media.invisShader = trap_R_RegisterShader("powerups/invisibility" ); cgs.media.regenShader = trap_R_RegisterShader("powerups/regen" ); cgs.media.hastePuffShader = trap_R_RegisterShader("hasteSmokePuff" ); if ( cg_buildScript.integer ) { cgs.media.redCubeModel = trap_R_RegisterModel( "models/powerups/orb/r_orb.md3" ); cgs.media.blueCubeModel = trap_R_RegisterModel( "models/powerups/orb/b_orb.md3" ); cgs.media.redCubeIcon = trap_R_RegisterShader( "icons/skull_red" ); cgs.media.blueCubeIcon = trap_R_RegisterShader( "icons/skull_blue" ); } if ( cg_buildScript.integer ) { cgs.media.redFlagModel = trap_R_RegisterModel( "models/flags/r_flag.md3" ); cgs.media.blueFlagModel = trap_R_RegisterModel( "models/flags/b_flag.md3" ); cgs.media.redFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_red1" ); cgs.media.redFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_red2" ); cgs.media.redFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_red3" ); cgs.media.blueFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_blu1" ); cgs.media.blueFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_blu2" ); cgs.media.blueFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_blu3" ); } cgs.media.dustPuffShader = trap_R_RegisterShader("hasteSmokePuff" ); if ( CG_IsTeamGame() || cg_buildScript.integer ) { cgs.media.friendShader = trap_R_RegisterShader( "sprites/foe" ); cgs.media.redQuadShader = trap_R_RegisterShader("powerups/blueflag" ); cgs.media.teamStatusBar = trap_R_RegisterShader( "gfx/2d/colorbar.tga" ); } cgs.media.armorModel = trap_R_RegisterModel( "models/powerups/armor/armor_yel.md3" ); cgs.media.armorIcon = trap_R_RegisterShaderNoMip( "icons/iconr_yellow" ); cgs.media.machinegunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" ); cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" ); cgs.media.gibAbdomen = trap_R_RegisterModel( "models/gibs/abdomen.md3" ); cgs.media.gibArm = trap_R_RegisterModel( "models/gibs/arm.md3" ); cgs.media.gibChest = trap_R_RegisterModel( "models/gibs/chest.md3" ); cgs.media.gibFist = trap_R_RegisterModel( "models/gibs/fist.md3" ); cgs.media.gibFoot = trap_R_RegisterModel( "models/gibs/foot.md3" ); cgs.media.gibForearm = trap_R_RegisterModel( "models/gibs/forearm.md3" ); cgs.media.gibIntestine = trap_R_RegisterModel( "models/gibs/intestine.md3" ); cgs.media.gibLeg = trap_R_RegisterModel( "models/gibs/leg.md3" ); cgs.media.gibSkull = trap_R_RegisterModel( "models/gibs/skull.md3" ); cgs.media.gibBrain = trap_R_RegisterModel( "models/gibs/brain.md3" ); cgs.media.debrislight1 = trap_R_RegisterModel( "models/debris/concrete_b1.md3" ); cgs.media.debrislight2 = trap_R_RegisterModel( "models/debris/concrete_b2.md3" ); cgs.media.debrislight3 = trap_R_RegisterModel( "models/debris/concrete_b3.md3" ); cgs.media.debrislight4 = trap_R_RegisterModel( "models/debris/concrete_b4.md3" ); cgs.media.debrislight5 = trap_R_RegisterModel( "models/debris/concrete_b5.md3" ); cgs.media.debrislight6 = trap_R_RegisterModel( "models/debris/concrete_b6.md3" ); cgs.media.debrislight7 = trap_R_RegisterModel( "models/debris/concrete_b7.md3" ); cgs.media.debrislight8 = trap_R_RegisterModel( "models/debris/concrete_b8.md3" ); cgs.media.debrisdark1 = trap_R_RegisterModel( "models/debris/concrete_d1.md3" ); cgs.media.debrisdark2 = trap_R_RegisterModel( "models/debris/concrete_d2.md3" ); cgs.media.debrisdark3 = trap_R_RegisterModel( "models/debris/concrete_d3.md3" ); cgs.media.debrisdark4 = trap_R_RegisterModel( "models/debris/concrete_d4.md3" ); cgs.media.debrisdark5 = trap_R_RegisterModel( "models/debris/concrete_d5.md3" ); cgs.media.debrisdark6 = trap_R_RegisterModel( "models/debris/concrete_d6.md3" ); cgs.media.debrisdark7 = trap_R_RegisterModel( "models/debris/concrete_d7.md3" ); cgs.media.debrisdark8 = trap_R_RegisterModel( "models/debris/concrete_d8.md3" ); cgs.media.debrislightlarge1 = trap_R_RegisterModel( "models/debris/concrete_b1_large.md3" ); cgs.media.debrislightlarge2 = trap_R_RegisterModel( "models/debris/concrete_b2_large.md3" ); cgs.media.debrislightlarge3 = trap_R_RegisterModel( "models/debris/concrete_b3_large.md3" ); cgs.media.debrisdarklarge1 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debrisdarklarge2 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debrisdarklarge3 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debriswood1 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debriswood2 = trap_R_RegisterModel( "models/debris/wood_b2.md3" ); cgs.media.debriswood3 = trap_R_RegisterModel( "models/debris/wood_b3.md3" ); cgs.media.debriswood4 = trap_R_RegisterModel( "models/debris/wood_b4.md3" ); cgs.media.debriswood5 = trap_R_RegisterModel( "models/debris/wood_b5.md3" ); cgs.media.debrisglass1 = trap_R_RegisterModel( "models/debris/glass_1.md3" ); cgs.media.debrisglass2 = trap_R_RegisterModel( "models/debris/glass_2.md3" ); cgs.media.debrisglass3 = trap_R_RegisterModel( "models/debris/glass_3.md3" ); cgs.media.debrisglass4 = trap_R_RegisterModel( "models/debris/glass_4.md3" ); cgs.media.debrisglass5 = trap_R_RegisterModel( "models/debris/glass_5.md3" ); cgs.media.debrisglasslarge1 = trap_R_RegisterModel( "models/debris/glass_1_large.md3" ); cgs.media.debrisglasslarge2 = trap_R_RegisterModel( "models/debris/glass_2_large.md3" ); cgs.media.debrisglasslarge3 = trap_R_RegisterModel( "models/debris/glass_3_large.md3" ); cgs.media.debrisglasslarge4 = trap_R_RegisterModel( "models/debris/glass_4_large.md3" ); cgs.media.debrisglasslarge5 = trap_R_RegisterModel( "models/debris/glass_5_large.md3" ); cgs.media.debrisstone1 = trap_R_RegisterModel( "models/debris/stone_1.md3" ); cgs.media.debrisstone2 = trap_R_RegisterModel( "models/debris/stone_2.md3" ); cgs.media.debrisstone3 = trap_R_RegisterModel( "models/debris/stone_3.md3" ); cgs.media.debrisstone4 = trap_R_RegisterModel( "models/debris/stone_4.md3" ); cgs.media.debrisstone5 = trap_R_RegisterModel( "models/debris/stone_5.md3" ); cgs.media.sparkShader = trap_R_RegisterShaderNoMip("spark"); cgs.media.smoke2 = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" ); cgs.media.balloonShader = trap_R_RegisterShader( "sprites/balloon3" ); cgs.media.bloodExplosionShader = trap_R_RegisterShader( "bloodExplosion" ); cgs.media.bulletFlashModel = trap_R_RegisterModel("models/weaphits/bullet.md3"); cgs.media.ringFlashModel = trap_R_RegisterModel("models/weaphits/ring02.md3"); cgs.media.dishFlashModel = trap_R_RegisterModel("models/weaphits/boom01.md3"); cgs.media.teleportEffectModel = trap_R_RegisterModel( "models/misc/telep.md3" ); cgs.media.teleportEffectShader = trap_R_RegisterShader( "teleportEffect" ); cgs.media.invulnerabilityPowerupModel = trap_R_RegisterModel( "models/powerups/shield/shield.md3" ); cgs.media.medalImpressive = trap_R_RegisterShaderNoMip( "medal_impressive" ); cgs.media.medalExcellent = trap_R_RegisterShaderNoMip( "medal_excellent" ); cgs.media.medalGauntlet = trap_R_RegisterShaderNoMip( "medal_gauntlet" ); cgs.media.medalDefend = trap_R_RegisterShaderNoMip( "medal_defend" ); cgs.media.medalAssist = trap_R_RegisterShaderNoMip( "medal_assist" ); cgs.media.medalCapture = trap_R_RegisterShaderNoMip( "medal_capture" ); memset( cg_items, 0, sizeof( cg_items ) ); memset( cg_weapons, 0, sizeof( cg_weapons ) ); // only register the items that the server says we need strcpy( items, CG_ConfigString( CS_ITEMS) ); for ( i = 1 ; i < bg_numItems ; i++ ) { if ( items[ i ] == '1' || cg_buildScript.integer ) { CG_LoadingItem( i ); CG_RegisterItemVisuals( i ); } } // wall marks cgs.media.bulletMarkShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk" ); cgs.media.burnMarkShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk" ); cgs.media.holeMarkShader = trap_R_RegisterShader( "gfx/damage/hole_lg_mrk" ); cgs.media.energyMarkShader = trap_R_RegisterShader( "gfx/damage/plasma_mrk" ); cgs.media.shadowMarkShader = trap_R_RegisterShader( "markShadow" ); cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" ); cgs.media.bloodMarkShader = trap_R_RegisterShader( "bloodMark" ); // paintball mode marks cgs.media.bulletMarkPaintShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk_paint" ); cgs.media.burnMarkPaintShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk_paint" ); cgs.media.holeMarkPaintShader = trap_R_RegisterShader( "gfx/damage/hole_lg_mrk_paint" ); cgs.media.energyMarkPaintShader = trap_R_RegisterShader( "gfx/damage/plasma_mrk_paint" ); // register the inline models cgs.numInlineModels = trap_CM_NumInlineModels(); for ( i = 1 ; i < cgs.numInlineModels ; i++ ) { char name[10]; vec3_t mins, maxs; int j; Com_sprintf( name, sizeof(name), "*%i", i ); cgs.inlineDrawModel[i] = trap_R_RegisterModel( name ); trap_R_ModelBounds( cgs.inlineDrawModel[i], mins, maxs ); for ( j = 0 ; j < 3 ; j++ ) { cgs.inlineModelMidpoints[i][j] = mins[j] + 0.5 * ( maxs[j] - mins[j] ); } } // register all the server specified models for (i=1 ; i<MAX_MODELS ; i++) { const char *modelName; modelName = CG_ConfigString( CS_MODELS+i ); if ( !modelName[0] ) { break; } cgs.gameModels[i] = trap_R_RegisterModel( modelName ); } CG_ClearParticles (); /* for (i=1; i<MAX_PARTICLES_AREAS; i++) { { int rval; rval = CG_NewParticleArea ( CS_PARTICLES + i); if (!rval) break; } } */ }
/* ============== CG_DrawSkyBoxPortal ============== */ void CG_DrawSkyBoxPortal( void ) { static float lastfov = 90; // for transitions back from zoomed in modes refdef_t backuprefdef; float fov_x; float fov_y; float x; char *cstr; char *token; float zoomFov; float f; static qboolean foginited = qfalse; // only set the portal fog values once if ( !cg_skybox.integer ) { return; } if ( !( cstr = (char *)CG_ConfigString( CS_SKYBOXORG ) ) || !strlen( cstr ) ) { // no skybox in this map return; } // if they are waiting at the mission stats screen, show the stats if ( cg_gameType.integer == GT_SINGLE_PLAYER ) { if ( strlen( cg_missionStats.string ) > 1 ) { return; } } backuprefdef = cg.refdef; token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n" ); } cg.refdef.vieworg[0] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n" ); } cg.refdef.vieworg[1] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n" ); } cg.refdef.vieworg[2] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring\n" ); } fov_x = atoi( token ); if ( !fov_x ) { fov_x = 90; } // setup fog the first time, ignore this part of the configstring after that token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring. No fog state\n" ); } else { vec4_t fogColor; int fogStart, fogEnd; if ( atoi( token ) ) { // this camera has fog if ( !foginited ) { token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring. No fog[0]\n" ); } fogColor[0] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring. No fog[1]\n" ); } fogColor[1] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring. No fog[2]\n" ); } fogColor[2] = atof( token ); token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { fogStart = 0; } else { fogStart = atoi( token ); } token = COM_ParseExt( &cstr, qfalse ); if ( !token || !token[0] ) { fogEnd = 0; } else { fogEnd = atoi( token ); } trap_R_SetFog( FOG_PORTALVIEW, fogStart, fogEnd, fogColor[0], fogColor[1], fogColor[2], 1.1 ); foginited = qtrue; } } else { if ( !foginited ) { trap_R_SetFog( FOG_PORTALVIEW, 0,0,0,0,0,0 ); // init to null foginited = qtrue; } } } //----(SA) end if ( cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { // if in intermission, use a fixed value fov_x = 90; } else { // user selectable if ( cgs.dmflags & DF_FIXED_FOV ) { // dmflag to prevent wide fov for all clients fov_x = 90; } else { fov_x = cg_fov.value; if ( fov_x < 1 ) { fov_x = 1; } else if ( fov_x > 160 ) { fov_x = 160; } } // account for zooms if ( cg.zoomval ) { zoomFov = cg.zoomval; // (SA) use user scrolled amount if ( zoomFov < 1 ) { zoomFov = 1; } else if ( zoomFov > 160 ) { zoomFov = 160; } } else { zoomFov = lastfov; } // do smooth transitions for the binocs if ( cg.zoomedBinoc ) { // binoc zooming in f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME; if ( f > 1.0 ) { fov_x = zoomFov; } else { fov_x = fov_x + f * ( zoomFov - fov_x ); } lastfov = fov_x; } else if ( cg.zoomval ) { // zoomed by sniper/snooper fov_x = cg.zoomval; lastfov = fov_x; } else { // binoc zooming out f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME; if ( f <= 1.0 ) { fov_x = zoomFov + f * ( fov_x - zoomFov ); } } } if ( cg.weaponSelect == WP_SNOOPERSCOPE ) { cg.refdef.rdflags |= RDF_SNOOPERVIEW; } else { cg.refdef.rdflags &= ~RDF_SNOOPERVIEW; } if ( cg.snap->ps.persistant[PERS_HWEAPON_USE] ) { fov_x = 55; } cg.refdef.time = cg.time; x = cg.refdef.width / tan( fov_x / 360 * M_PI ); fov_y = atan2( cg.refdef.height, x ); fov_y = fov_y * 360 / M_PI; cg.refdef.fov_x = fov_x; cg.refdef.fov_y = fov_y; cg.refdef.rdflags |= RDF_SKYBOXPORTAL; // draw the skybox trap_R_RenderScene( &cg.refdef ); cg.refdef = backuprefdef; }
/* ================ CG_ParseServerinfo This is called explicitly when the gamestate is first received, and whenever the server updates any serverinfo flagged cvars ================ */ void CG_ParseServerinfo( void ) { const char *info = NULL; char *mapname; int i, value; info = CG_ConfigString( CS_SERVERINFO ); cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu"); cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) ); cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) ); cgs.siegeTeamSwitch = atoi( Info_ValueForKey( info, "g_siegeTeamSwitch" ) ); cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) ); cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); trap->Cvar_Set("g_gametype", va("%i", cgs.gametype)); cgs.needpass = atoi( Info_ValueForKey( info, "g_needpass" ) ); cgs.jediVmerc = atoi( Info_ValueForKey( info, "g_jediVmerc" ) ); // this changes on map_restart, attempt to precache weapons value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) ); if ( cgs.wDisable != value ) { gitem_t *item = NULL; itemInfo_t *itemInfo = NULL; cgs.wDisable = value; for ( i=1, item=bg_itemlist, itemInfo = cg_items; i<bg_numItems; i++, item++, itemInfo++ ) {// register all weapons that aren't disabled if ( item->giType == IT_WEAPON ) CG_RegisterWeapon( item->giTag ); } } cgs.fDisable = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) ); cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) ); cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) ); // reset fraglimit warnings i = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( cgs.fraglimit < i ) cg.fraglimitWarnings &= ~(1|2|4); cgs.fraglimit = i; // reset timelimit warnings i = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( cgs.timelimit != i ) cg.timelimitWarnings &= ~(1|2); cgs.timelimit = i; cgs.maxclients = Com_Clampi( 0, MAX_CLIENTS, atoi( Info_ValueForKey( info, "sv_maxclients" ) ) ); mapname = Info_ValueForKey( info, "mapname" ); //rww - You must do this one here, Info_ValueForKey always uses the same memory pointer. trap->Cvar_Set ( "ui_about_mapname", mapname ); Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname ); Com_sprintf( cgs.rawmapname, sizeof( cgs.rawmapname ), "maps/%s", mapname ); // Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) ); // trap->Cvar_Set("g_redTeam", cgs.redTeam); // Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) ); // trap->Cvar_Set("g_blueTeam", cgs.blueTeam); trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) ); trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) ); trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) ); trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) ); trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) ); trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) ); trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) ); trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) ); trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) ); trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) ); //Set the siege teams based on what the server has for overrides. trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1")); trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2")); Q_strncpyz( cgs.voteString, CG_ConfigString( CS_VOTE_STRING ), sizeof( cgs.voteString ) ); // synchronise our expected snaps/sec with the server's framerate i = atoi( Info_ValueForKey( info, "sv_fps" ) ); if ( i ) trap->Cvar_Set( "snaps", va( "%i", i ) ); }
/* ======================================================================================================================================= WM_ScoreboardOverlay ======================================================================================================================================= */ int WM_ScoreboardOverlay(int x, int y, float fade) { vec4_t hcolor; int width; char *s; // JPW NERVE int msec, mins, seconds, tens; // JPW NERVE width = INFO_PLAYER_WIDTH + INFO_LATENCY_WIDTH + INFO_SCORE_WIDTH + 25; VectorSet(hcolor, 0, 0, 0); hcolor[3] = 0.7 * fade; // draw background CG_FillRect(x - 12, y, width, 400, hcolor); // draw title frame VectorSet(hcolor, 0.0039, 0.0039, 0.2461); hcolor[3] = 1 * fade; CG_FillRect(x - 12, y, width, 30, hcolor); CG_DrawRect(x - 12, y, width, 400, 2, hcolor); if (cg.snap->ps.pm_type == PM_INTERMISSION) { const char *s, *buf; s = CG_ConfigString(CS_MULTI_INFO); buf = Info_ValueForKey(s, "winner"); if (atoi(buf)) { CG_DrawSmallString(x - 12 + 5, y, "ALLIES WIN!", fade); } else { CG_DrawSmallString(x - 12 + 5, y, "AXIS WIN!", fade); } } // mission time & reinforce time else { msec = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime); seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va("Mission time: %2.0f:%i%i", (float)mins, tens, seconds); // float cast to line up with reinforce time CG_DrawSmallString(x - 7, y, s, fade); if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_RED) { msec = cg_redlimbotime.integer - (cg.time % cg_redlimbotime.integer); } else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_BLUE) { msec = cg_bluelimbotime.integer - (cg.time % cg_bluelimbotime.integer); } else { // no team(spectator mode) msec = 0; } if (msec) { seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va("Reinforce time: %2.0f:%i%i", (float)mins, tens, seconds); CG_DrawSmallString(x - 7, y + 16, s, fade); } } // CG_DrawSmallString(x - 12 + 5, y, "Wolfenstein Multiplayer", fade); // old one y = WM_DrawObjectives(x, y, width, fade); y += 5; // draw field names CG_DrawSmallString(x, y, "Players", fade); x += INFO_PLAYER_WIDTH; CG_DrawSmallString(x, y, "Score", fade); x += INFO_SCORE_WIDTH; CG_DrawSmallString(x, y, "Latency", fade); y += 20; return y; }
void CG_DrawConnectScreen(qboolean interactive, qboolean forcerefresh) { static qboolean inside = qfalse; char buffer[1024]; bg_loadscreeninteractive = interactive; if (!DC) { return; } if (inside) { return; } inside = qtrue; if (!bg_loadscreeninited) { trap_Cvar_Set("ui_connecting", "0"); DC->registerFont("ariblk", 27, &bg_loadscreenfont1); DC->registerFont("courbd", 30, &bg_loadscreenfont2); bg_axispin = DC->registerShaderNoMip("gfx/loading/pin_axis"); bg_alliedpin = DC->registerShaderNoMip("gfx/loading/pin_allied"); bg_neutralpin = DC->registerShaderNoMip("gfx/loading/pin_neutral"); bg_pin = DC->registerShaderNoMip("gfx/loading/pin_shot"); bg_filter_pb = DC->registerShaderNoMip("ui/assets/filter_pb"); bg_filter_ff = DC->registerShaderNoMip("ui/assets/filter_ff"); bg_filter_hw = DC->registerShaderNoMip("ui/assets/filter_weap"); bg_filter_lv = DC->registerShaderNoMip("ui/assets/filter_lives"); bg_filter_al = DC->registerShaderNoMip("ui/assets/filter_antilag"); bg_filter_bt = DC->registerShaderNoMip("ui/assets/filter_balance"); bg_mappic = 0; BG_PanelButtonsSetup(loadpanelButtons); bg_loadscreeninited = qtrue; } BG_PanelButtonsRender(loadpanelButtons); if (interactive) { DC->drawHandlePic(DC->cursorx, DC->cursory, 32, 32, DC->Assets.cursor); } DC->getConfigString(CS_SERVERINFO, buffer, sizeof(buffer)); if (*buffer) { const char *str; qboolean enabled = qfalse; float x, y; int i; // vec4_t clr1 = { 41/255.f, 51/255.f, 43/255.f, 204/255.f }; // vec4_t clr2 = { 0.f, 0.f, 0.f, 225/255.f }; vec4_t clr3 = { 1.f, 1.f, 1.f, .6f }; /* CG_FillRect( 8, 8, 230, 16, clr1 ); CG_DrawRect_FixedBorder( 8, 8, 230, 16, 1, colorMdGrey ); CG_FillRect( 8, 23, 230, 210, clr2 ); CG_DrawRect_FixedBorder( 8, 23, 230, 216, 1, colorMdGrey );*/ y = 322; CG_Text_Paint_Centred_Ext(540, y, 0.22f, 0.22f, clr3, "SERVER INFO", 0, 0, 0, &bg_loadscreenfont1); y = 340; str = Info_ValueForKey(buffer, "sv_hostname"); CG_Text_Paint_Centred_Ext(540, y, 0.2f, 0.2f, colorWhite, str && *str ? str : "ETHost", 0, 26, 0, &bg_loadscreenfont2); y += 14; for (i = 0; i < MAX_MOTDLINES; i++) { str = CG_ConfigString(CS_CUSTMOTD + i); if (!str || !*str) { break; } CG_Text_Paint_Centred_Ext(540, y, 0.2f, 0.2f, colorWhite, str, 0, 26, 0, &bg_loadscreenfont2); y += 10; } y = 417; str = Info_ValueForKey(buffer, "g_friendlyfire"); if (str && *str && atoi(str)) { x = 461; CG_DrawPic(x, y, 16, 16, bg_filter_ff); } if (atoi(Info_ValueForKey(buffer, "g_gametype")) != GT_WOLF_LMS) { str = Info_ValueForKey(buffer, "g_alliedmaxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } else { str = Info_ValueForKey(buffer, "g_axismaxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } else { str = Info_ValueForKey(buffer, "g_maxlives"); if (str && *str && atoi(str)) { enabled = qtrue; } } } } if (enabled) { x = 489; CG_DrawPic(x, y, 16, 16, bg_filter_lv); } str = Info_ValueForKey(buffer, "sv_punkbuster"); if (str && *str && atoi(str)) { x = 518; CG_DrawPic(x, y, 16, 16, bg_filter_pb); } str = Info_ValueForKey(buffer, "g_heavyWeaponRestriction"); if (str && *str && atoi(str) != 100) { x = 546; CG_DrawPic(x, y, 16, 16, bg_filter_hw); } str = Info_ValueForKey(buffer, "g_antilag"); if (str && *str && atoi(str)) { x = 575; CG_DrawPic(x, y, 16, 16, bg_filter_al); } str = Info_ValueForKey(buffer, "g_balancedteams"); if (str && *str && atoi(str)) { x = 604; CG_DrawPic(x, y, 16, 16, bg_filter_bt); } } if (*cgs.rawmapname) { if (!bg_mappic) { bg_mappic = DC->registerShaderNoMip(va("levelshots/%s", cgs.rawmapname)); if (!bg_mappic) { bg_mappic = DC->registerShaderNoMip("levelshots/unknownmap"); } } trap_R_SetColor(colorBlack); CG_DrawPic(16 + 1, 2 + 1, 192, 144, bg_mappic); trap_R_SetColor(NULL); CG_DrawPic(16, 2, 192, 144, bg_mappic); CG_DrawPic(16 + 80, 2 + 6, 20, 20, bg_pin); } if (forcerefresh) { DC->updateScreen(); } inside = qfalse; }
/* ================ CG_ParseServerinfo This is called explicitly when the gamestate is first received, and whenever the server updates any serverinfo flagged cvars ================ */ void CG_ParseServerinfo( void ) { const char *info; char *mapname; int i; info = CG_ConfigString( CS_SERVERINFO ); cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu"); cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) ); cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) ); //trap->Cvar_Set("bg_fighterAltControl", Info_ValueForKey( info, "bg_fighterAltControl" )); cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) ); cgs.gametype = (gametype_t)atoi( Info_ValueForKey( info, "g_gametype" ) ); trap->Cvar_Set("g_gametype", va("%i", cgs.gametype)); cgs.needpass = atoi( Info_ValueForKey( info, "needpass" ) ); cgs.wDisable = atoi( Info_ValueForKey( info, "wdisable" ) ); cgs.fDisable = atoi( Info_ValueForKey( info, "fdisable" ) ); cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) ); cgs.teamflags = atoi( Info_ValueForKey( info, "teamflags" ) ); cgs.fraglimit = atoi( Info_ValueForKey( info, "fraglimit" ) ); cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) ); cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) ); cgs.maxclients = atoi( Info_ValueForKey( info, "sv_maxclients" ) ); mapname = Info_ValueForKey( info, "mapname" ); //rww - You must do this one here, Info_ValueForKey always uses the same memory pointer. trap->Cvar_Set ( "ui_about_mapname", mapname ); Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname ); Com_sprintf( cgs.rawmapname, sizeof( cgs.rawmapname ), "%s", mapname ); // Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) ); // trap->Cvar_Set("g_redTeam", cgs.redTeam); // Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) ); // trap->Cvar_Set("g_blueTeam", cgs.blueTeam); trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) ); trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) ); trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) ); trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) ); trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) ); trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) ); trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) ); trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) ); trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) ); trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) ); //Set the siege teams based on what the server has for overrides. trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1")); trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2")); //Raz: Fix bogus vote strings Q_strncpyz( cgs.voteString, CG_ConfigString( CS_VOTE_STRING ), sizeof( cgs.voteString ) ); //Raz: Synchronise our expected snaps/sec with the server's framerate // OpenJK servers will try to match us to the sv_fps too (sv_client.cpp -> SV_UserinfoChanged) i = atoi( Info_ValueForKey( info, "sv_fps" ) ); if ( i ) trap->Cvar_Set( "snaps", va( "%i", i ) ); }
void CG_LoadPanel_RenderCampaignPins(panel_button_t *button) { int i; qhandle_t shader; /*char buffer[1024]; char *s; int gametype; DC->getConfigString( CS_SERVERINFO, buffer, sizeof( buffer ) ); s = Info_ValueForKey( buffer, "g_gametype" ); gametype = atoi(s); */ if (cgs.gametype == GT_WOLF_STOPWATCH || cgs.gametype == GT_WOLF_LMS || cgs.gametype == GT_WOLF) { float px, py; if (!cgs.arenaInfoLoaded) { return; } px = (cgs.arenaData.mappos[0] / 1024.f) * 440.f; py = (cgs.arenaData.mappos[1] / 1024.f) * 480.f; CG_LoadPanel_DrawPin(cgs.arenaData.longname, px, py, 0.22f, 0.25f, bg_neutralpin, 16.f, 16.f); } else { if (!cgs.campaignInfoLoaded) { return; } for (i = 0; i < cgs.campaignData.mapCount; i++) { float px, py; cg.teamWonRounds[1] = atoi(CG_ConfigString(CS_ROUNDSCORES1)); cg.teamWonRounds[0] = atoi(CG_ConfigString(CS_ROUNDSCORES2)); if (cg.teamWonRounds[1] & (1 << i)) { shader = bg_axispin; } else if (cg.teamWonRounds[0] & (1 << i)) { shader = bg_alliedpin; } else { shader = bg_neutralpin; } px = (cgs.campaignData.arenas[i].mappos[0] / 1024.f) * 440.f; py = (cgs.campaignData.arenas[i].mappos[1] / 1024.f) * 480.f; CG_LoadPanel_DrawPin(cgs.campaignData.arenas[i].longname, px, py, 0.22f, 0.25f, shader, 16.f, 16.f); } } }
static void CG_ConfigStringModified( void ) { const char *str; int num; num = atoi( CG_Argv( 1 ) ); // get the gamestate from the client system, which will have the // new configstring already integrated trap->GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_MUSIC ) { CG_StartMusic( qtrue ); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num == CS_WARMUP ) { CG_ParseWarmup(); } else if ( num == CS_SCORES1 ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); } else if ( num == CS_CLIENT_DUELWINNER ) { cgs.duelWinner = atoi ( str ); } else if ( num == CS_CLIENT_DUELISTS ) { char buf[64]; int c = 0; int i = 0; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist1 = atoi ( buf ); c = 0; i++; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist2 = atoi ( buf ); if (str[i]) { c = 0; i++; while (str[i]) { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist3 = atoi(buf); } } else if ( num == CS_CLIENT_DUELHEALTHS ) { // nmckenzie: DUEL_HEALTH SetDuelistHealthsFromConfigString(str); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_YES ) { cgs.voteYes = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_NO ) { cgs.voteNo = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_STRING ) { Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) { cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue; } else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) { cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue; } else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) { cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue; } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) { Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) ); } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { char modelName[MAX_QPATH]; strcpy(modelName, str); if (strstr(modelName, ".glm") || modelName[0] == '$') { //Check to see if it has a custom skin attached. CG_HandleAppendedSkin(modelName); CG_CacheG2AnimInfo(modelName); } cgs.gameModels[ num-CS_MODELS ] = 0; } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameSounds[ num-CS_SOUNDS] = trap->S_RegisterSound( str ); } else if (str[1] == '$') { //an NPC soundset CG_PrecacheNPCSounds(str); } } else if ( num >= CS_EFFECTS && num < CS_EFFECTS+MAX_FX ) { if (str[0] == '*') { //it's a special global weather effect CG_ParseWeatherEffect(str); cgs.gameEffects[ num-CS_EFFECTS] = 0; } else { cgs.gameEffects[ num-CS_EFFECTS] = trap->FX_RegisterEffect( str ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS, qtrue); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } }
/* ================= CG_Init Called after every level change or subsystem restart Will perform callbacks to make the loading info screen update. ================= */ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) { const char *s; // clear everything memset( &cgs, 0, sizeof( cgs ) ); memset( &cg, 0, sizeof( cg ) ); memset( cg_entities, 0, sizeof(cg_entities) ); memset( cg_weapons, 0, sizeof(cg_weapons) ); memset( cg_items, 0, sizeof(cg_items) ); cg.clientNum = clientNum; cgs.processedSnapshotNum = serverMessageNum; cgs.serverCommandSequence = serverCommandSequence; // load a few needed things before we do any screen updates cgs.media.charsetShader = trap_R_RegisterShader( "gfx/2d/bigchars" ); cgs.media.whiteShader = trap_R_RegisterShader( "white" ); cgs.media.charsetProp = trap_R_RegisterShaderNoMip( "menu/art/font1_prop.tga" ); cgs.media.charsetPropGlow = trap_R_RegisterShaderNoMip( "menu/art/font1_prop_glo.tga" ); cgs.media.charsetPropB = trap_R_RegisterShaderNoMip( "menu/art/font2_prop.tga" ); CG_RegisterCvars(); CG_InitConsoleCommands(); cg.weaponSelect = WP_MACHINEGUN; cgs.redflag = cgs.blueflag = -1; // For compatibily, default to unset for cgs.flagStatus = -1; // old servers // get the rendering configuration from the client system trap_GetGlconfig( &cgs.glconfig ); cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; // get the gamestate from the client system trap_GetGameState( &cgs.gameState ); // check version s = CG_ConfigString( CS_GAME_VERSION ); if ( strcmp( s, GAME_VERSION ) ) { CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s ); } s = CG_ConfigString( CS_LEVEL_START_TIME ); cgs.levelStartTime = atoi( s ); CG_ParseServerinfo(); // load the new map CG_LoadingString( "collision map" ); trap_CM_LoadMap( cgs.mapname ); cg.loading = qtrue; // force players to load instead of defer CG_LoadingString( "sounds" ); CG_RegisterSounds(); CG_LoadingString( "graphics" ); CG_RegisterGraphics(); CG_LoadingString( "clients" ); CG_RegisterClients(); // if low on memory, some clients will be deferred cg.loading = qfalse; // future players will be deferred CG_InitLocalEntities(); CG_InitMarkPolys(); // remove the last loading update cg.infoScreenText[0] = 0; // Make sure we have update values (scores) CG_SetConfigValues(); CG_StartMusic(); CG_LoadingString( "" ); CG_ShaderStateChanged(); trap_S_ClearLoopingSounds( qtrue ); }
// Parses fireteam servercommand void CG_ParseFireteams() { int i, j; char *s; const char *p; int clnts[2]; qboolean onFireteam2; qboolean isLeader2; // qboolean onFireteam = CG_IsOnFireteam( cg.clientNum ) ? qtrue : qfalse; // qboolean isLeader = CG_IsFireTeamLeader( cg.clientNum ) ? qtrue : qfalse; for (i = 0; i < MAX_CLIENTS; i++) { cgs.clientinfo[i].fireteamData = NULL; } for (i = 0; i < MAX_FIRETEAMS; i++) { char hexbuffer[11] = "0x00000000"; p = CG_ConfigString(CS_FIRETEAMS + i); /* s = Info_ValueForKey(p, "n"); if(!s || !*s) { cg.fireTeams[i].inuse = qfalse; continue; } else { cg.fireTeams[i].inuse = qtrue; }*/ // Q_strncpyz(cg.fireTeams[i].name, s, 32); // CG_Printf("Fireteam: %s\n", cg.fireTeams[i].name); j = atoi(Info_ValueForKey(p, "id")); if (j == -1) { cg.fireTeams[i].inuse = qfalse; continue; } else { cg.fireTeams[i].inuse = qtrue; cg.fireTeams[i].ident = j; } s = Info_ValueForKey(p, "l"); cg.fireTeams[i].leader = atoi(s); s = Info_ValueForKey(p, "c"); Q_strncpyz(hexbuffer + 2, s, 9); sscanf(hexbuffer, "%x", &clnts[1]); Q_strncpyz(hexbuffer + 2, s + 8, 9); sscanf(hexbuffer, "%x", &clnts[0]); for (j = 0; j < MAX_CLIENTS; j++) { if (COM_BitCheck(clnts, j)) { cg.fireTeams[i].joinOrder[j] = qtrue; cgs.clientinfo[j].fireteamData = &cg.fireTeams[i]; // CG_Printf("%s\n", cgs.clientinfo[j].name); } else { cg.fireTeams[i].joinOrder[j] = qfalse; } } } CG_SortClientFireteam(); onFireteam2 = CG_IsOnFireteam(cg.clientNum) ? qtrue : qfalse; isLeader2 = CG_IsFireTeamLeader(cg.clientNum) ? qtrue : qfalse; }
/* * CG_Init */ void CG_Init( const char *serverName, unsigned int playerNum, int vidWidth, int vidHeight, qboolean demoplaying, const char *demoName, qboolean pure, unsigned int snapFrameTime, int protocol, int sharedSeed ) { CG_InitGameShared(); memset( &cg, 0, sizeof( cg_state_t ) ); memset( &cgs, 0, sizeof( cg_static_t ) ); memset( cg_entities, 0, sizeof( cg_entities ) ); #ifdef PURE_CHEAT CG_Printf( S_COLOR_MAGENTA"Hi, I'm an unpure bitch 7\n" ); #endif // save server name cgs.serverName = CG_CopyString( serverName ); // save local player number cgs.playerNum = playerNum; // save current width and height cgs.vidWidth = vidWidth; cgs.vidHeight = vidHeight; // demo cgs.demoPlaying = demoplaying == qtrue; cgs.demoName = demoName; // whether to only allow pure files cgs.pure = pure == qtrue; // whether we are connected to a tv-server cgs.tv = false; cgs.tvRequested = false; // game protocol number cgs.gameProtocol = protocol; cgs.snapFrameTime = snapFrameTime; cgs.initialSharedSeed = sharedSeed; cg.sharedSeed = cgs.initialSharedSeed; cgs.hasGametypeMenu = false; // this will update as soon as we receive configstrings CG_RegisterVariables(); CG_InitTemporaryBoneposesCache(); CG_PModelsInit(); CG_ScreenInit(); // get configstrings CG_RegisterConfigStrings(); // register fonts here so loading screen works CG_RegisterFonts(); cgs.shaderWhite = trap_R_RegisterPic( "$whiteimage" ); // l10n CG_InitL10n(); CG_RegisterLevelMinimap(); CG_RegisterModels(); CG_RegisterSounds(); CG_RegisterShaders(); CG_RegisterSkinFiles(); CG_RegisterClients(); CG_RegisterCGameCommands(); CG_ValidateItemList(); CG_LoadStatusBar(); CG_LoadingString( "" ); CG_ClearDecals(); CG_ClearPolys(); CG_ClearEffects(); CG_ClearLocalEntities(); CG_InitChat( &cg.chat ); CG_RegisterLightStyles(); // start up announcer events queue from clean CG_ClearAnnouncerEvents(); cgs.precacheDone = true; cgs.demoTutorial = cgs.demoPlaying && (strstr( cgs.demoName, "tutorials/" ) != NULL); cg.firstFrame = true; // think of the next frame in CG_NewFrameSnap as of the first one // now that we're done with precaching, let the autorecord actions do something CG_ConfigString( CS_AUTORECORDSTATE, cgs.configStrings[CS_AUTORECORDSTATE] ); CG_DemocamInit(); }
/* ================ CG_ParseServerinfo This is called explicitly when the gamestate is first received, and whenever the server updates any serverinfo flagged cvars ================ */ void CG_ParseServerinfo( void ) { const char *info; char *mapname; info = CG_ConfigString( CS_SERVERINFO ); cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) ); cgs.teamflags = atoi( Info_ValueForKey( info, "teamflags" ) ); cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) ); cgs.maxclients = 1; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname ); char *p = strrchr(mapname,'/'); strcpy( cgs.stripLevelName[0], p?p+1:mapname ); strupr( cgs.stripLevelName[0] ); for (int i=1; i<STRIPED_LEVELNAME_VARIATIONS; i++) // clear retry-array { cgs.stripLevelName[i][0]='\0'; } // be careful with the []-numbers here. Currently I use 0,1,2 for replacements or substitution, and [3] for "INGAME" // I know, if I'd known there was going to be this much messing about I'd have subroutinised it all and done it // neater, but it kinda evolved... Feel free to bug me if you want to add to it... ? -Ste. // //FIXME: a better way to handle sound-matched strings from other levels (currently uses levelname+sound as key) // additional String files needed for some levels... // // JKA... if (!stricmp(cgs.stripLevelName[0],"YAVIN1B")) { strcpy( cgs.stripLevelName[1], "YAVIN1"); } /* // JK2... if (!stricmp(cgs.stripLevelName[0],"KEJIM_BASE") || !stricmp(cgs.stripLevelName[0],"KEJIM_POST") ) { strcpy( cgs.stripLevelName[1], "ARTUS_MINE" ); } if (!stricmp(cgs.stripLevelName[0],"DOOM_DETENTION") || !stricmp(cgs.stripLevelName[0],"DOOM_SHIELDS") ) { strcpy( cgs.stripLevelName[1], "DOOM_COMM" ); } if (!stricmp(cgs.stripLevelName[0],"DOOM_COMM")) { strcpy( cgs.stripLevelName[1], "CAIRN_BAY" ); } if (!stricmp(cgs.stripLevelName[0],"NS_STARPAD")) { strcpy( cgs.stripLevelName[1], "ARTUS_TOPSIDE" ); // for dream sequence... strcpy( cgs.stripLevelName[2], "BESPIN_UNDERCITY" ); // for dream sequence... } if (!stricmp(cgs.stripLevelName[0],"BESPIN_PLATFORM")) { strcpy( cgs.stripLevelName[1], "BESPIN_UNDERCITY" ); } */ }
/** * @brief CG_NewParticleArea * @param[in] num * @return * * @note Unused */ int CG_NewParticleArea(int num) { char *str; char *token; int type; vec3_t origin, origin2; int i; float range; int turb; int numparticles; int snum; str = (char *) CG_ConfigString(num); if (!str[0]) { return (0); } // returns type 128 64 or 32 token = COM_Parse(&str); type = atoi(token); switch (type) { case 0: range = 256; break; case 1: range = 128; break; case 2: case 7: range = 64; break; case 3: case 6: range = 32; break; case 4: range = 8; break; case 5: range = 16; break; default: range = 0; break; } for (i = 0; i < 3; i++) { token = COM_Parse(&str); origin[i] = (float)atof(token); } for (i = 0; i < 3; i++) { token = COM_Parse(&str); origin2[i] = (float)atof(token); } token = COM_Parse(&str); numparticles = atoi(token); token = COM_Parse(&str); turb = atoi(token); token = COM_Parse(&str); snum = atoi(token); for (i = 0; i < numparticles; i++) { if (type >= 4) { CG_ParticleBubble(cgs.media.waterBubbleShader, origin, origin2, turb, range, snum); } else { CG_ParticleSnow(cgs.media.snowShader, origin, origin2, turb, range, snum); } } return 1; }
void CG_EntityEvent( centity_t *cent, vec3_t position ) { entityState_t *es; int event; vec3_t dir; const char *s; int clientNum; clientInfo_t *ci; es = ¢->currentState; event = es->event & ~EV_EVENT_BITS; if ( cg_debugEvents.integer ) { CG_Printf( "ent:%3i event:%3i ", es->number, event ); } if ( !event ) { DEBUGNAME("ZEROEVENT"); return; } clientNum = es->clientNum; if ( clientNum < 0 || clientNum >= MAX_CLIENTS ) { clientNum = 0; } ci = &cgs.clientinfo[ clientNum ]; switch ( event ) { // // movement generated events // case EV_FOOTSTEP: DEBUGNAME("EV_FOOTSTEP"); if (cg_footsteps.integer) { trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ ci->footsteps ][rand()&3] ); } break; case EV_FOOTSTEP_METAL: DEBUGNAME("EV_FOOTSTEP_METAL"); if (cg_footsteps.integer) { trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_METAL ][rand()&3] ); } break; case EV_FOOTSPLASH: DEBUGNAME("EV_FOOTSPLASH"); if (cg_footsteps.integer) { trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] ); } break; case EV_FOOTWADE: DEBUGNAME("EV_FOOTWADE"); if (cg_footsteps.integer) { trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] ); } break; case EV_SWIM: DEBUGNAME("EV_SWIM"); if (cg_footsteps.integer) { trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] ); } break; case EV_FALL_SHORT: DEBUGNAME("EV_FALL_SHORT"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.landSound ); if ( clientNum == cg.predictedPlayerState.clientNum ) { // smooth landing z changes cg.landChange = -8; cg.landTime = cg.time; } break; case EV_FALL_MEDIUM: DEBUGNAME("EV_FALL_MEDIUM"); // use normal pain sound trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*pain100_1.wav" ) ); if ( clientNum == cg.predictedPlayerState.clientNum ) { // smooth landing z changes cg.landChange = -16; cg.landTime = cg.time; } break; case EV_FALL_FAR: DEBUGNAME("EV_FALL_FAR"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*fall1.wav" ) ); cent->pe.painTime = cg.time; // don't play a pain sound right after this if ( clientNum == cg.predictedPlayerState.clientNum ) { // smooth landing z changes cg.landChange = -24; cg.landTime = cg.time; } break; case EV_STEP_4: case EV_STEP_8: case EV_STEP_12: case EV_STEP_16: // smooth out step up transitions DEBUGNAME("EV_STEP"); { float oldStep; int delta; int step; if ( clientNum != cg.predictedPlayerState.clientNum ) { break; } // if we are interpolating, we don't need to smooth steps if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) || cg_nopredict.integer || cg_synchronousClients.integer ) { break; } // check for stepping up before a previous step is completed delta = cg.time - cg.stepTime; if (delta < STEP_TIME) { oldStep = cg.stepChange * (STEP_TIME - delta) / STEP_TIME; } else { oldStep = 0; } // add this amount step = 4 * (event - EV_STEP_4 + 1 ); cg.stepChange = oldStep + step; if ( cg.stepChange > MAX_STEP_CHANGE ) { cg.stepChange = MAX_STEP_CHANGE; } cg.stepTime = cg.time; break; } case EV_JUMP_PAD: DEBUGNAME("EV_JUMP_PAD"); // CG_Printf( "EV_JUMP_PAD w/effect #%i\n", es->eventParm ); { vec3_t up = {0, 0, 1}; CG_SmokePuff( cent->lerpOrigin, up, 32, 1, 1, 1, 0.33f, 1000, cg.time, 0, LEF_PUFF_DONT_SCALE, cgs.media.smokePuffShader ); } // boing sound at origin, jump sound on player trap_S_StartSound ( cent->lerpOrigin, -1, CHAN_VOICE, cgs.media.jumpPadSound ); trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) ); break; case EV_JUMP: DEBUGNAME("EV_JUMP"); trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) ); break; case EV_TAUNT: DEBUGNAME("EV_TAUNT"); trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*taunt.wav" ) ); break; #ifdef MISSIONPACK case EV_TAUNT_YES: DEBUGNAME("EV_TAUNT_YES"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_YES); break; case EV_TAUNT_NO: DEBUGNAME("EV_TAUNT_NO"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_NO); break; case EV_TAUNT_FOLLOWME: DEBUGNAME("EV_TAUNT_FOLLOWME"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_FOLLOWME); break; case EV_TAUNT_GETFLAG: DEBUGNAME("EV_TAUNT_GETFLAG"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_ONGETFLAG); break; case EV_TAUNT_GUARDBASE: DEBUGNAME("EV_TAUNT_GUARDBASE"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_ONDEFENSE); break; case EV_TAUNT_PATROL: DEBUGNAME("EV_TAUNT_PATROL"); CG_VoiceChatLocal(SAY_TEAM, qfalse, es->number, COLOR_CYAN, VOICECHAT_ONPATROL); break; #endif case EV_WATER_TOUCH: DEBUGNAME("EV_WATER_TOUCH"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrInSound ); break; case EV_WATER_LEAVE: DEBUGNAME("EV_WATER_LEAVE"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrOutSound ); break; case EV_WATER_UNDER: DEBUGNAME("EV_WATER_UNDER"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrUnSound ); break; case EV_WATER_CLEAR: DEBUGNAME("EV_WATER_CLEAR"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*gasp.wav" ) ); break; case EV_ITEM_PICKUP: DEBUGNAME("EV_ITEM_PICKUP"); { gitem_t *item; int index; index = es->eventParm; // player predicted if ( index < 1 || index >= bg_numItems ) { break; } item = &bg_itemlist[ index ]; // powerups and team items will have a separate global sound, this one // will be played at prediction time if ( item->giType == IT_POWERUP || item->giType == IT_TEAM) { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.n_healthSound ); } else if (item->giType == IT_PERSISTANT_POWERUP) { #ifdef MISSIONPACK switch (item->giTag ) { case PW_SCOUT: trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.scoutSound ); break; case PW_GUARD: trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.guardSound ); break; case PW_DOUBLER: trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.doublerSound ); break; case PW_AMMOREGEN: trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.ammoregenSound ); break; } #endif } else { trap_S_StartSound (NULL, es->number, CHAN_AUTO, trap_S_RegisterSound( item->pickup_sound, qfalse ) ); } // show icon and name on status bar if ( es->number == cg.snap->ps.clientNum ) { CG_ItemPickup( index ); } } break; case EV_GLOBAL_ITEM_PICKUP: DEBUGNAME("EV_GLOBAL_ITEM_PICKUP"); { gitem_t *item; int index; index = es->eventParm; // player predicted if ( index < 1 || index >= bg_numItems ) { break; } item = &bg_itemlist[ index ]; // powerup pickups are global if( item->pickup_sound ) { trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, trap_S_RegisterSound( item->pickup_sound, qfalse ) ); } // show icon and name on status bar if ( es->number == cg.snap->ps.clientNum ) { CG_ItemPickup( index ); } } break; // // weapon events // case EV_NOAMMO: DEBUGNAME("EV_NOAMMO"); // trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.noAmmoSound ); if ( es->number == cg.snap->ps.clientNum ) { CG_OutOfAmmoChange(); } break; case EV_CHANGE_WEAPON: DEBUGNAME("EV_CHANGE_WEAPON"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.selectSound ); break; case EV_FIRE_WEAPON: DEBUGNAME("EV_FIRE_WEAPON"); CG_FireWeapon( cent ); break; case EV_USE_ITEM0: DEBUGNAME("EV_USE_ITEM0"); CG_UseItem( cent ); break; case EV_USE_ITEM1: DEBUGNAME("EV_USE_ITEM1"); CG_UseItem( cent ); break; case EV_USE_ITEM2: DEBUGNAME("EV_USE_ITEM2"); CG_UseItem( cent ); break; case EV_USE_ITEM3: DEBUGNAME("EV_USE_ITEM3"); CG_UseItem( cent ); break; case EV_USE_ITEM4: DEBUGNAME("EV_USE_ITEM4"); CG_UseItem( cent ); break; case EV_USE_ITEM5: DEBUGNAME("EV_USE_ITEM5"); CG_UseItem( cent ); break; case EV_USE_ITEM6: DEBUGNAME("EV_USE_ITEM6"); CG_UseItem( cent ); break; case EV_USE_ITEM7: DEBUGNAME("EV_USE_ITEM7"); CG_UseItem( cent ); break; case EV_USE_ITEM8: DEBUGNAME("EV_USE_ITEM8"); CG_UseItem( cent ); break; case EV_USE_ITEM9: DEBUGNAME("EV_USE_ITEM9"); CG_UseItem( cent ); break; case EV_USE_ITEM10: DEBUGNAME("EV_USE_ITEM10"); CG_UseItem( cent ); break; case EV_USE_ITEM11: DEBUGNAME("EV_USE_ITEM11"); CG_UseItem( cent ); break; case EV_USE_ITEM12: DEBUGNAME("EV_USE_ITEM12"); CG_UseItem( cent ); break; case EV_USE_ITEM13: DEBUGNAME("EV_USE_ITEM13"); CG_UseItem( cent ); break; case EV_USE_ITEM14: DEBUGNAME("EV_USE_ITEM14"); CG_UseItem( cent ); break; case EV_USE_ITEM15: DEBUGNAME("EV_USE_ITEM15"); CG_UseItem( cent ); break; //================================================================= // // other events // case EV_PLAYER_TELEPORT_IN: DEBUGNAME("EV_PLAYER_TELEPORT_IN"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.teleInSound ); CG_SpawnEffect( position); break; case EV_PLAYER_TELEPORT_OUT: DEBUGNAME("EV_PLAYER_TELEPORT_OUT"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.teleOutSound ); CG_SpawnEffect( position); break; case EV_ITEM_POP: DEBUGNAME("EV_ITEM_POP"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.respawnSound ); break; case EV_ITEM_RESPAWN: DEBUGNAME("EV_ITEM_RESPAWN"); cent->miscTime = cg.time; // scale up from this trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.respawnSound ); break; case EV_GRENADE_BOUNCE: DEBUGNAME("EV_GRENADE_BOUNCE"); if ( rand() & 1 ) { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.hgrenb1aSound ); } else { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.hgrenb2aSound ); } break; #ifdef MISSIONPACK case EV_PROXIMITY_MINE_STICK: DEBUGNAME("EV_PROXIMITY_MINE_STICK"); if( es->eventParm & SURF_FLESH ) { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.wstbimplSound ); } else if( es->eventParm & SURF_METALSTEPS ) { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.wstbimpmSound ); } else { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.wstbimpdSound ); } break; case EV_PROXIMITY_MINE_TRIGGER: DEBUGNAME("EV_PROXIMITY_MINE_TRIGGER"); trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.wstbactvSound ); break; case EV_KAMIKAZE: DEBUGNAME("EV_KAMIKAZE"); CG_KamikazeEffect( cent->lerpOrigin ); break; case EV_OBELISKEXPLODE: DEBUGNAME("EV_OBELISKEXPLODE"); CG_ObeliskExplode( cent->lerpOrigin, es->eventParm ); break; case EV_OBELISKPAIN: DEBUGNAME("EV_OBELISKPAIN"); CG_ObeliskPain( cent->lerpOrigin ); break; case EV_INVUL_IMPACT: DEBUGNAME("EV_INVUL_IMPACT"); CG_InvulnerabilityImpact( cent->lerpOrigin, cent->currentState.angles ); break; case EV_JUICED: DEBUGNAME("EV_JUICED"); CG_InvulnerabilityJuiced( cent->lerpOrigin ); break; case EV_LIGHTNINGBOLT: DEBUGNAME("EV_LIGHTNINGBOLT"); CG_LightningBoltBeam(es->origin2, es->pos.trBase); break; #endif case EV_SCOREPLUM: DEBUGNAME("EV_SCOREPLUM"); CG_ScorePlum( cent->currentState.otherEntityNum, cent->lerpOrigin, cent->currentState.time ); break; // // missile impacts // case EV_MISSILE_HIT: DEBUGNAME("EV_MISSILE_HIT"); ByteToDir( es->eventParm, dir ); CG_MissileHitPlayer( es->weapon, position, dir, es->otherEntityNum ); break; case EV_MISSILE_MISS: DEBUGNAME("EV_MISSILE_MISS"); ByteToDir( es->eventParm, dir ); CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_DEFAULT ); break; case EV_MISSILE_MISS_METAL: DEBUGNAME("EV_MISSILE_MISS_METAL"); ByteToDir( es->eventParm, dir ); CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_METAL ); break; case EV_RAILTRAIL: DEBUGNAME("EV_RAILTRAIL"); cent->currentState.weapon = WP_RAILGUN; if(es->clientNum == cg.snap->ps.clientNum && !cg.renderingThirdPerson) { if(cg_drawGun.integer == 2) VectorMA(es->origin2, 8, cg.refdef.viewaxis[1], es->origin2); else if(cg_drawGun.integer == 3) VectorMA(es->origin2, 4, cg.refdef.viewaxis[1], es->origin2); } CG_RailTrail(ci, es->origin2, es->pos.trBase); // if the end was on a nomark surface, don't make an explosion if ( es->eventParm != 255 ) { ByteToDir( es->eventParm, dir ); CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT ); } break; case EV_BULLET_HIT_WALL: DEBUGNAME("EV_BULLET_HIT_WALL"); ByteToDir( es->eventParm, dir ); CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD ); break; case EV_BULLET_HIT_FLESH: DEBUGNAME("EV_BULLET_HIT_FLESH"); CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm ); break; case EV_SHOTGUN: DEBUGNAME("EV_SHOTGUN"); CG_ShotgunFire( es ); break; case EV_GENERAL_SOUND: DEBUGNAME("EV_GENERAL_SOUND"); if ( cgs.gameSounds[ es->eventParm ] ) { trap_S_StartSound (NULL, es->number, CHAN_VOICE, cgs.gameSounds[ es->eventParm ] ); } else { s = CG_ConfigString( CS_SOUNDS + es->eventParm ); trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, s ) ); } break; case EV_GLOBAL_SOUND: // play from the player's head so it never diminishes DEBUGNAME("EV_GLOBAL_SOUND"); if ( cgs.gameSounds[ es->eventParm ] ) { trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.gameSounds[ es->eventParm ] ); } else { s = CG_ConfigString( CS_SOUNDS + es->eventParm ); trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, CG_CustomSound( es->number, s ) ); } break; case EV_GLOBAL_TEAM_SOUND: // play from the player's head so it never diminishes { DEBUGNAME("EV_GLOBAL_TEAM_SOUND"); switch( es->eventParm ) { case GTS_RED_CAPTURE: // CTF: red team captured the blue flag, 1FCTF: red team captured the neutral flag if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) CG_AddBufferedSound( cgs.media.captureYourTeamSound ); else CG_AddBufferedSound( cgs.media.captureOpponentSound ); break; case GTS_BLUE_CAPTURE: // CTF: blue team captured the red flag, 1FCTF: blue team captured the neutral flag if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) CG_AddBufferedSound( cgs.media.captureYourTeamSound ); else CG_AddBufferedSound( cgs.media.captureOpponentSound ); break; case GTS_RED_RETURN: // CTF: blue flag returned, 1FCTF: never used if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED ) CG_AddBufferedSound( cgs.media.returnYourTeamSound ); else CG_AddBufferedSound( cgs.media.returnOpponentSound ); // CG_AddBufferedSound( cgs.media.blueFlagReturnedSound ); break; case GTS_BLUE_RETURN: // CTF red flag returned, 1FCTF: neutral flag returned if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) CG_AddBufferedSound( cgs.media.returnYourTeamSound ); else CG_AddBufferedSound( cgs.media.returnOpponentSound ); // CG_AddBufferedSound( cgs.media.redFlagReturnedSound ); break; case GTS_RED_TAKEN: // CTF: red team took blue flag, 1FCTF: blue team took the neutral flag // if this player picked up the flag then a sound is played in CG_CheckLocalSounds if (cg.snap->ps.powerups[PW_BLUEFLAG] || cg.snap->ps.powerups[PW_NEUTRALFLAG]) { } else { if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE) { #ifdef MISSIONPACK if (cgs.gametype == GT_1FCTF) CG_AddBufferedSound( cgs.media.yourTeamTookTheFlagSound ); else #endif CG_AddBufferedSound( cgs.media.enemyTookYourFlagSound ); } else if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED) { #ifdef MISSIONPACK if (cgs.gametype == GT_1FCTF) CG_AddBufferedSound( cgs.media.enemyTookTheFlagSound ); else #endif CG_AddBufferedSound( cgs.media.yourTeamTookEnemyFlagSound ); } } break; case GTS_BLUE_TAKEN: // CTF: blue team took the red flag, 1FCTF red team took the neutral flag // if this player picked up the flag then a sound is played in CG_CheckLocalSounds if (cg.snap->ps.powerups[PW_REDFLAG] || cg.snap->ps.powerups[PW_NEUTRALFLAG]) { } else { if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED) { #ifdef MISSIONPACK if (cgs.gametype == GT_1FCTF) CG_AddBufferedSound( cgs.media.yourTeamTookTheFlagSound ); else #endif CG_AddBufferedSound( cgs.media.enemyTookYourFlagSound ); } else if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE) { #ifdef MISSIONPACK if (cgs.gametype == GT_1FCTF) CG_AddBufferedSound( cgs.media.enemyTookTheFlagSound ); else #endif CG_AddBufferedSound( cgs.media.yourTeamTookEnemyFlagSound ); } } break; #ifdef MISSIONPACK case GTS_REDOBELISK_ATTACKED: // Overload: red obelisk is being attacked if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED) { CG_AddBufferedSound( cgs.media.yourBaseIsUnderAttackSound ); } break; case GTS_BLUEOBELISK_ATTACKED: // Overload: blue obelisk is being attacked if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE) { CG_AddBufferedSound( cgs.media.yourBaseIsUnderAttackSound ); } break; #endif case GTS_REDTEAM_SCORED: CG_AddBufferedSound(cgs.media.redScoredSound); break; case GTS_BLUETEAM_SCORED: CG_AddBufferedSound(cgs.media.blueScoredSound); break; case GTS_REDTEAM_TOOK_LEAD: CG_AddBufferedSound(cgs.media.redLeadsSound); break; case GTS_BLUETEAM_TOOK_LEAD: CG_AddBufferedSound(cgs.media.blueLeadsSound); break; case GTS_TEAMS_ARE_TIED: CG_AddBufferedSound( cgs.media.teamsTiedSound ); break; #ifdef MISSIONPACK case GTS_KAMIKAZE: trap_S_StartLocalSound(cgs.media.kamikazeFarSound, CHAN_ANNOUNCER); break; #endif default: break; } break; } case EV_PAIN: // local player sounds are triggered in CG_CheckLocalSounds, // so ignore events on the player DEBUGNAME("EV_PAIN"); if ( cent->currentState.number != cg.snap->ps.clientNum ) { CG_PainEvent( cent, es->eventParm ); } break; case EV_DEATH1: case EV_DEATH2: case EV_DEATH3: DEBUGNAME("EV_DEATHx"); if (CG_WaterLevel(cent) == 3) { trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, "*drown.wav")); } else { trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1))); } break; case EV_OBITUARY: DEBUGNAME("EV_OBITUARY"); CG_Obituary( es ); break; // // powerup events // case EV_POWERUP_QUAD: DEBUGNAME("EV_POWERUP_QUAD"); if ( es->number == cg.snap->ps.clientNum ) { cg.powerupActive = PW_QUAD; cg.powerupTime = cg.time; } trap_S_StartSound (NULL, es->number, CHAN_ITEM, cgs.media.quadSound ); break; case EV_POWERUP_BATTLESUIT: DEBUGNAME("EV_POWERUP_BATTLESUIT"); if ( es->number == cg.snap->ps.clientNum ) { cg.powerupActive = PW_BATTLESUIT; cg.powerupTime = cg.time; } trap_S_StartSound (NULL, es->number, CHAN_ITEM, cgs.media.protectSound ); break; case EV_POWERUP_REGEN: DEBUGNAME("EV_POWERUP_REGEN"); if ( es->number == cg.snap->ps.clientNum ) { cg.powerupActive = PW_REGEN; cg.powerupTime = cg.time; } trap_S_StartSound (NULL, es->number, CHAN_ITEM, cgs.media.regenSound ); break; case EV_GIB_PLAYER: DEBUGNAME("EV_GIB_PLAYER"); // don't play gib sound when using the kamikaze because it interferes // with the kamikaze sound, downside is that the gib sound will also // not be played when someone is gibbed while just carrying the kamikaze if ( !(es->eFlags & EF_KAMIKAZE) ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.gibSound ); } CG_GibPlayer( cent->lerpOrigin ); break; case EV_STOPLOOPINGSOUND: DEBUGNAME("EV_STOPLOOPINGSOUND"); trap_S_StopLoopingSound( es->number ); es->loopSound = 0; break; case EV_DEBUG_LINE: DEBUGNAME("EV_DEBUG_LINE"); CG_Beam( cent ); break; case EV_STINGER: DEBUGNAME("EV_STINGER"); cent->currentState.weapon = WP_STINGER; BOTS_StingerTrail(ci, es->origin2, es->pos.trBase); // if the end was on a nomark surface, don't make an explosion if ( es->eventParm != 255 ) { ByteToDir( es->eventParm, dir ); CG_MissileHitWall( es->weapon, es->clientNum, position, dir,IMPACTSOUND_DEFAULT ); } break; case EV_HEALRADIUS: DEBUGNAME("EV_HEALRADIUS"); BOTS_HealRadius(es->clientNum,es->eventParm); break; default: DEBUGNAME("UNKNOWN"); CG_Error( "Unknown event: %i", event ); break; } }
/** * @brief Let the client system know about all of our commands so it can perform tab * completion */ void CG_InitConsoleCommands(void) { int i; const char *s; for (i = 0 ; i < sizeof(commands) / sizeof(commands[0]) ; i++) { trap_AddCommand(commands[i].cmd); } // the game server will interpret these commands, which will be automatically // forwarded to the server after they are not recognized locally trap_AddCommand("kill"); trap_AddCommand("say"); trap_AddCommand("give"); trap_AddCommand("god"); trap_AddCommand("notarget"); trap_AddCommand("noclip"); trap_AddCommand("team"); trap_AddCommand("follow"); trap_AddCommand("setviewpos"); trap_AddCommand("callvote"); trap_AddCommand("vote"); trap_AddCommand("nofatigue"); trap_AddCommand("follownext"); trap_AddCommand("followprev"); trap_AddCommand("start_match"); trap_AddCommand("reset_match"); trap_AddCommand("swap_teams"); trap_AddCommand("?"); trap_AddCommand("bottomshots"); trap_AddCommand("commands"); trap_AddCommand("lock"); #ifdef FEATURE_MULTIVIEW trap_AddCommand("mvadd"); trap_AddCommand("mvaxis"); trap_AddCommand("mvallies"); trap_AddCommand("mvall"); trap_AddCommand("mvnone"); #endif trap_AddCommand("notready"); trap_AddCommand("pause"); trap_AddCommand("players"); trap_AddCommand("readyteam"); trap_AddCommand("ready"); trap_AddCommand("ref"); trap_AddCommand("say_teamnl"); trap_AddCommand("say_team"); trap_AddCommand("scores"); trap_AddCommand("specinvite"); trap_AddCommand("speclock"); trap_AddCommand("specunlock"); trap_AddCommand("statsall"); trap_AddCommand("statsdump"); trap_AddCommand("timein"); trap_AddCommand("timeout"); trap_AddCommand("topshots"); trap_AddCommand("unlock"); trap_AddCommand("unpause"); trap_AddCommand("unready"); trap_AddCommand("weaponstats"); trap_AddCommand("fireteam"); trap_AddCommand("showstats"); trap_AddCommand("ignore"); trap_AddCommand("unignore"); trap_AddCommand("campaign"); trap_AddCommand("listcampaigns"); trap_AddCommand("imready"); trap_AddCommand("say_buddy"); trap_AddCommand("setspawnpt"); trap_AddCommand("vsay"); trap_AddCommand("vsay_buddy"); trap_AddCommand("vsay_team"); trap_AddCommand("where"); #ifdef FEATURE_LUA trap_AddCommand("lua_status"); #endif // remove engine commands to avoid abuse trap_RemoveCommand("+lookup"); trap_RemoveCommand("-lookup"); trap_RemoveCommand("+lookdown"); trap_RemoveCommand("-lookdown"); // only allow configstrings command when cheats enabled s = Info_ValueForKey(CG_ConfigString(CS_SYSTEMINFO), "sv_cheats"); if (s[0] != '1') { trap_RemoveCommand("configstrings"); } }
void CG_ParseServerinfo( void ) { const char *info = NULL, *tinfo = NULL; char *mapname; int i; info = CG_ConfigString( CS_SERVERINFO ); cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu"); cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) ); cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) ); trap->Cvar_Set("bg_fighterAltControl", Info_ValueForKey( info, "bg_fighterAltControl" )); cgs.siegeTeamSwitch = atoi( Info_ValueForKey( info, "g_siegeTeamSwitch" ) ); cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) ); cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); trap->Cvar_Set("g_gametype", va("%i", cgs.gametype)); cgs.needpass = atoi( Info_ValueForKey( info, "needpass" ) ); cgs.jediVmerc = atoi( Info_ValueForKey( info, "g_jediVmerc" ) ); cgs.wDisable = atoi( Info_ValueForKey( info, "wdisable" ) ); cgs.fDisable = atoi( Info_ValueForKey( info, "fdisable" ) ); cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) ); cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) ); // reset fraglimit warnings i = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( cgs.fraglimit < i ) cg.fraglimitWarnings &= ~(1|2|4); cgs.fraglimit = i; // reset timelimit warnings i = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( cgs.timelimit != i ) cg.timelimitWarnings &= ~(1|2); cgs.timelimit = i; cgs.maxclients = Com_Clampi( 0, MAX_CLIENTS, atoi( Info_ValueForKey( info, "sv_maxclients" ) ) ); cgs.japp.jp_cinfo = atoi( Info_ValueForKey( info, "jp_cinfo" ) ); cgs.japp.overbounce = atoi( Info_ValueForKey( info, "pmove_overbounce" ) ); //Raz: Server support flags tinfo = Info_ValueForKey( info, "ssf" ); if ( !Q_stricmpn( Info_ValueForKey( info, "gamename" ), "JA+ Mod", 7 ) ) cg.japp.SSF = JAPLUS_SERVER_FLAGS; #if MAC_PORT if ( tinfo[0] && sscanf( tinfo, "%X", &cg.japp.SSF ) != 1 ) #else if ( tinfo[0] && sscanf_s( tinfo, "%X", &cg.japp.SSF ) != 1 ) #endif CG_SecurityLogPrintf( "CG_ParseServerinfo: serverinfo 'ssf' was found, but invalid.\n" ); Com_Printf( "Server support hints: 0x%X\n", cg.japp.SSF ); mapname = Info_ValueForKey( info, "mapname" ); //rww - You must do this one here, Info_ValueForKey always uses the same memory pointer. trap->Cvar_Set ( "ui_about_mapname", mapname ); Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname ); // Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) ); // trap->Cvar_Set("g_redTeam", cgs.redTeam); // Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) ); // trap->Cvar_Set("g_blueTeam", cgs.blueTeam); trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) ); trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) ); trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) ); trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) ); trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) ); trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) ); trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) ); trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) ); trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) ); trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) ); //Set the siege teams based on what the server has for overrides. trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1")); trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2")); tinfo = CG_ConfigString( CS_TERRAINS + 1 ); if ( !tinfo || !*tinfo ) { cg.mInRMG = qfalse; } else { int weather = 0; cg.mInRMG = qtrue; trap->Cvar_Set("RMG", "1"); weather = atoi( Info_ValueForKey( info, "RMG_weather" ) ); trap->Cvar_Set("RMG_weather", va("%i", weather)); if (weather == 1 || weather == 2) { cg.mRMGWeather = qtrue; } else { cg.mRMGWeather = qfalse; } } // cg.japp.mod = GetMod( info ); Q_strncpyz( cgs.japp.serverName, Info_ValueForKey( info, "sv_hostname" ), sizeof( cgs.japp.serverName ) ); CPM_UpdateSettings( !!(cgs.japp.jp_cinfo & CINFO_CPMPHYSICS) ); //Fix f****d up vote strings =o Q_strncpyz( cgs.voteString, CG_ConfigString( CS_VOTE_STRING ), sizeof( cgs.voteString ) ); //Raz: Synchronise our expected snaps/sec with the server's framerate // OpenJK servers will try to match us to the sv_fps too (sv_client.cpp -> SV_UserinfoChanged) i = atoi( Info_ValueForKey( info, "sv_fps" ) ); if ( i ) trap->Cvar_Set( "snaps", va( "%i", i ) ); }
const char *CG_GetPMItemText(centity_t *cent) { switch (cent->currentState.effect1Time) { case PM_DYNAMITE: switch (cent->currentState.effect2Time) { case 0: return va(CG_TranslateString("Planted at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("Defused at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_CONSTRUCTION: switch (cent->currentState.effect2Time) { case -1: return CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time); case 0: return va(CG_TranslateString("%s has been constructed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_DESTRUCTION: switch (cent->currentState.effect2Time) { case 0: return va(CG_TranslateString("%s has been damaged."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("%s has been destroyed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_MINES: // Prevent spectators from being informed when a mine is spotted if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) { return NULL; } if (cgs.clientinfo[cg.clientNum].team == cent->currentState.effect2Time) { return NULL; } if (cg_locations.integer & LOC_LANDMINES) { char *locStr = CG_BuildLocationString(-1, cent->currentState.origin, LOC_LANDMINES); if (!locStr || !*locStr) { return va("%sSpotted by ^7%s", TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name); } return va(CG_TranslateString("%sSpotted by ^7%s%s at %s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name, TXTCOLOR_OBJ, locStr); } else { return va(CG_TranslateString("%sSpotted by ^7%s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name); } break; case PM_OBJECTIVE: switch (cent->currentState.density) { case 0: return va(CG_TranslateString("%s have stolen %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("%s have returned %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time)); } break; case PM_TEAM: switch (cent->currentState.density) { case 0: // joined { const char *teamstr = NULL; switch (cent->currentState.effect2Time) { case TEAM_AXIS: teamstr = "Axis team"; break; case TEAM_ALLIES: teamstr = "Allied team"; break; default: teamstr = "Spectators"; break; } return va(CG_TranslateString("%s^7 has joined the %s^7!"), cgs.clientinfo[cent->currentState.effect3Time].name, CG_TranslateString(teamstr)); } case 1: return va(CG_TranslateString("%s^7 disconnected"), cgs.clientinfo[cent->currentState.effect3Time].name); } break; } return NULL; }