/* ================ CG_DrawHead Used for both the status bar and the scoreboard ================ */ void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles ) { clipHandle_t cm; clientInfo_t *ci; float len; vec3_t origin; vec3_t mins, maxs; tierConfig_cg *tier; qhandle_t icon; ci = &cgs.clientinfo[clientNum]; tier = &ci->tierConfig[ci->tierCurrent]; if(!cg_draw3dIcons.integer){ icon = tier->icon2D[0]; CG_DrawPic(qfalse, x, y, w, h,icon); } else{ cm = ci->headModel[ci->tierCurrent]; if(!cm){return;} trap_R_ModelBounds(cm,mins,maxs,0); len = 0.7 * ( maxs[2] - mins[2] ); origin[0] = len / (1.0 - tier->icon3DZoom); origin[1] = 0.5 * (mins[1] + maxs[1]); origin[2] = -0.5 * (mins[2] + maxs[2]); headAngles[0] = tier->icon3DRotation[0]; headAngles[1] = tier->icon3DRotation[1]; headAngles[2] = tier->icon3DRotation[2]; CG_Draw3DModel(x+tier->icon3DOffset[0],y+tier->icon3DOffset[1],w+tier->icon3DSize[0],h+tier->icon3DSize[1],ci->headModel[ci->tierCurrent],ci->headSkin[ci->tierCurrent],origin,headAngles); } }
/* ================ CG_DrawFlagModel Used for both the status bar and the scoreboard ================ */ void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean force2D ) { qhandle_t cm; float len; vec3_t origin, angles; vec3_t mins, maxs; qhandle_t handle; if ( !force2D && cg_draw3dIcons.integer ) { VectorClear( angles ); cm = cgs.media.redFlagModel; // offset the origin y and z to center the flag trap_R_ModelBounds( cm, mins, maxs ); origin[2] = -0.5 * ( mins[2] + maxs[2] ); origin[1] = 0.5 * ( mins[1] + maxs[1] ); // calculate distance so the flag nearly fills the box // assume heads are taller than wide len = 0.5 * ( maxs[2] - mins[2] ); origin[0] = len / 0.268; // len / tan( fov/2 ) angles[YAW] = 60 * sin( (cg.time / 2000.0) + cg.timeFraction / 2000.0 );; if( team == TEAM_RED ) { handle = cgs.media.redFlagModel; } else if( team == TEAM_BLUE ) { handle = cgs.media.blueFlagModel; } else if( team == TEAM_FREE ) { handle = cgs.media.neutralFlagModel; } else { return; } CG_Draw3DModel( x, y, w, h, handle, 0, origin, angles ); } else if ( cg_drawIcons.integer ) { gitem_t *item; if( team == TEAM_RED ) { item = BG_FindItemForPowerup( PW_REDFLAG ); } else if( team == TEAM_BLUE ) { item = BG_FindItemForPowerup( PW_BLUEFLAG ); } else if( team == TEAM_FREE ) { item = BG_FindItemForPowerup( PW_NEUTRALFLAG ); } else { return; } if (item) { CG_DrawPic( x, y, w, h, cg_items[ ITEM_INDEX(item) ].icon ); } } }
void SP_misc_weather_zone( void ) { char *model; vec3_t mins, maxs; CG_SpawnString( "model", "", &model ); if( !model || !model[0] ) { CG_Error( "misc_weather_zone with invalid brush model data." ); return; } trap_R_ModelBounds( trap_R_RegisterModel( model ), mins, maxs ); trap_WE_AddWeatherZone( mins, maxs ); }
/* ================ CG_DrawHUDModel ================ */ void CG_DrawHUDModel( int x, int y, int align, int w, int h, struct model_s *model, struct shader_s *shader, float yawspeed ) { vec3_t mins, maxs; vec3_t origin, angles; // get model bounds trap_R_ModelBounds( model, mins, maxs ); // try to fill the the window with the model origin[0] = 0.5 * ( maxs[2] - mins[2] ) * ( 1.0 / 0.179 ); origin[1] = 0.5 * ( mins[1] + maxs[1] ); origin[2] = -0.5 * ( mins[2] + maxs[2] ); VectorSet( angles, 0, anglemod( yawspeed * ( cg.time & 2047 ) * ( 360.0 / 2048.0 ) ), 0 ); CG_DrawModel( x, y, align, w, h, model, shader, origin, angles, cg_outlineModels->integer ? qtrue : qfalse ); }
static void CG_AddSpawnpoints(void) { refEntity_t re; int i; vec3_t mins, maxs; if (!cg_drawSpawnpoints.integer) { return; } if (!cgs.warmup) { return; } memset(&re, 0, sizeof re); re.hModel = cgs.media.spawnpoint; re.customShader = cgs.media.spawnpointShader; if (cg_drawSpawnpoints.integer == 2) { re.renderfx |= RF_DEPTHHACK; } // move spawnpoint to the ground trap_R_ModelBounds(cgs.media.spawnpoint, mins, maxs); for (i = 0; i < cg.numSpawnpoints; i++) { VectorCopy(cg.spawnOrigin[i], re.origin); AnglesToAxis(cg.spawnAngle[i], re.axis); re.origin[2] += maxs[2] - mins[2]; switch (cg.spawnTeam[i]) { case TEAM_FREE: SCR_SetRGBA(re.shaderRGBA, colorGreen); break; case TEAM_RED: SCR_SetRGBA(re.shaderRGBA, colorRed); break; case TEAM_BLUE: SCR_SetRGBA(re.shaderRGBA, colorBlue); break; default: continue; } trap_R_AddRefEntityToScene(&re); } }
/* ================ CG_DrawHead Used for both the status bar and the scoreboard ================ */ void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles ) { clipHandle_t cm; clientInfo_t *ci; float len; vec3_t origin; vec3_t mins, maxs; ci = &cgs.clientinfo[ clientNum ]; if ( cg_draw3dIcons.integer ) { cm = ci->headModel; if ( !cm ) { return; } // offset the origin y and z to center the head trap_R_ModelBounds( cm, mins, maxs ); origin[2] = -0.5 * ( mins[2] + maxs[2] ); origin[1] = 0.5 * ( mins[1] + maxs[1] ); // calculate distance so the head nearly fills the box // assume heads are taller than wide len = 0.7 * ( maxs[2] - mins[2] ); origin[0] = len / 0.268; // len / tan( fov/2 ) // allow per-model tweaking VectorAdd( origin, ci->headOffset, origin ); CG_Draw3DModel( x, y, w, h, ci->headModel, ci->headSkin, origin, headAngles ); } else if ( cg_drawIcons.integer ) { CG_DrawPic( x, y, w, h, ci->modelIcon ); } // if they are deferred, draw a cross out if ( ci->deferred ) { CG_DrawPic( x, y, w, h, cgs.media.deferShader ); } }
/* ================= CG_RegisterWeapon ================= */ void CG_RegisterWeapon( int weaponNum ) { weaponInfo_t *weaponInfo; char path[ MAX_QPATH ]; vec3_t mins, maxs; int i; if( weaponNum <= WP_NONE || weaponNum >= WP_NUM_WEAPONS ) { CG_Error( "CG_RegisterWeapon: out of range: %d", weaponNum ); return; } weaponInfo = &cg_weapons[ weaponNum ]; if( weaponInfo->registered ) { CG_Printf( "CG_RegisterWeapon: already registered: (%d) %s\n", weaponNum, BG_Weapon( weaponNum )->name ); return; } weaponInfo->registered = qtrue; if( !BG_Weapon( weaponNum )->name[ 0 ] ) CG_Error( "Couldn't find weapon %i", weaponNum ); Com_sprintf( path, MAX_QPATH, "models/weapons/%s/weapon.cfg", BG_Weapon( weaponNum )->name ); weaponInfo->humanName = BG_Weapon( weaponNum )->humanName; if( !CG_ParseWeaponFile( path, weaponInfo ) ) Com_Printf( S_COLOR_RED "ERROR: failed to parse %s\n", path ); // calc midpoint for rotation trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs ); for( i = 0 ; i < 3 ; i++ ) weaponInfo->weaponMidpoint[ i ] = mins[ i ] + 0.5 * ( maxs[ i ] - mins[ i ] ); }
/* ================= CG_RegisterWeapon ================= */ void CG_RegisterWeapon( int weaponNum ) { weaponInfo_t *weaponInfo; char path[ MAX_QPATH ]; vec3_t mins, maxs; int i; weaponInfo = &cg_weapons[ weaponNum ]; if( weaponNum == 0 ) return; if( weaponInfo->registered ) return; memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->registered = qtrue; if( !BG_FindNameForWeapon( weaponNum ) ) CG_Error( "Couldn't find weapon %i", weaponNum ); Com_sprintf( path, MAX_QPATH, "models/weapons/%s/weapon.cfg", BG_FindNameForWeapon( weaponNum ) ); weaponInfo->humanName = BG_FindHumanNameForWeapon( weaponNum ); if( !CG_ParseWeaponFile( path, weaponInfo ) ) Com_Printf( S_COLOR_RED "ERROR: failed to parse %s\n", path ); // calc midpoint for rotation trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs ); for( i = 0 ; i < 3 ; i++ ) weaponInfo->weaponMidpoint[ i ] = mins[ i ] + 0.5 * ( maxs[ i ] - mins[ i ] ); //FIXME: for( i = WPM_NONE + 1; i < WPM_NUM_WEAPONMODES; i++ ) weaponInfo->wim[ i ].loopFireSound = qfalse; }
void SP_misc_model_static( void ) { char* model; vec_t angle; vec3_t angles; vec_t scale; vec3_t vScale; vec3_t org; vec_t zoffset; int i; int modelIndex; cg_staticmodel_t *staticmodel; if( cgs.numMiscStaticModels >= MAX_STATIC_MODELS ) { CG_Error( "MAX_STATIC_MODELS(%i) hit", MAX_STATIC_MODELS ); } CG_SpawnString( "model", "", &model ); if( !model || !model[0] ) { CG_Error( "misc_model_static with no model." ); } CG_SpawnVector( "origin", "0 0 0", org ); CG_SpawnFloat( "zoffset", "0", &zoffset ); if( !CG_SpawnVector( "angles", "0 0 0", angles ) ) { if( CG_SpawnFloat( "angle", "0", &angle ) ) { angles[YAW] = angle; } } if( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) { if( CG_SpawnFloat( "modelscale", "1", &scale ) ) { VectorSet( vScale, scale, scale, scale ); } } modelIndex = trap_R_RegisterModel( model ); if( modelIndex == 0 ) { CG_Error( "misc_model_static failed to load model '%s'", model ); return; } staticmodel = &cgs.miscStaticModels[cgs.numMiscStaticModels++]; staticmodel->model = modelIndex; AnglesToAxis( angles, staticmodel->axes ); for( i = 0; i < 3; i++ ) { VectorScale( staticmodel->axes[i], vScale[i], staticmodel->axes[i] ); } VectorCopy( org, staticmodel->org ); staticmodel->zoffset = zoffset; if( staticmodel->model ) { vec3_t mins, maxs; trap_R_ModelBounds( staticmodel->model, mins, maxs ); VectorScaleVector( mins, vScale, mins ); VectorScaleVector( maxs, vScale, maxs ); staticmodel->radius = RadiusFromBounds( mins, maxs ); } else { staticmodel->radius = 0; } }
//================ //CG_DrawMiniMap //================ void CG_DrawMiniMap( int x, int y, int iw, int ih, qboolean draw_playernames, qboolean draw_itemnames, int align, vec4_t color ) { int i, entnum; centity_t *cent; vec3_t coords; vec4_t tmp_col, tmp_white_alpha, tmp_yellow_alpha; // background color of the map vec3_t mins, maxs, extend; int map_w, map_h, map_z; int x_lefttop, y_lefttop, z_lefttop; // the negative y coordinate (bottom of the map) float map_div_w, map_div_h; qboolean isSelf; if( !cg_showminimap->integer ) return; // if inside a team if( cg.predictedPlayerState.stats[STAT_REALTEAM] >= TEAM_PLAYERS && cg.predictedPlayerState.stats[STAT_REALTEAM] < GS_MAX_TEAMS ) { if( !GS_CanShowMinimap() || !( cg_showminimap->integer & 1 ) ) return; } else if( !( cg_showminimap->integer & 2 ) ) { // allow only when chasing a player and the player is allowed to see it if( !GS_CanShowMinimap() || !( cg_showminimap->integer & 1 ) || cg.predictedPlayerState.stats[STAT_REALTEAM] == cg.predictedPlayerState.stats[STAT_TEAM] ) return; } if( !cgs.shaderMiniMap ) return; x = CG_HorizontalAlignForWidth( x, align, iw ); y = CG_VerticalAlignForHeight( y, align, ih ); Vector4Copy( color, tmp_col ); Vector4Copy( colorWhite, tmp_white_alpha ); Vector4Copy( colorYellow, tmp_yellow_alpha ); tmp_white_alpha[3] = color[3]; tmp_yellow_alpha[3] = color[3]; // Get Worldmodel bounds... trap_R_ModelBounds( NULL, mins, maxs ); // NULL for world model... // make it a square bounding box VectorSubtract( maxs, mins, extend ); if( extend[1] > extend[0] ) { mins[0] -= ( extend[1] - extend[0] ) * 0.5; maxs[0] += ( extend[1] - extend[0] ) * 0.5; } else { mins[1] -= ( extend[0] - extend[1] ) * 0.5; maxs[1] += ( extend[0] - extend[1] ) * 0.5; } map_w = maxs[0] - mins[0]; // map width (in game units) map_h = maxs[1] - mins[1]; map_z = maxs[2] - mins[2]; x_lefttop = -mins[0]; // the negative x coordinate ( left of the map ) y_lefttop = -mins[1]; // the negative y coordinate (bottom of the map) z_lefttop = -mins[2]; // the negative y coordinate (bottom of the map) map_div_w = (float)map_w / (float)iw; map_div_h = (float)map_h / (float)ih; CG_DrawHUDRect( x, y, ALIGN_LEFT_TOP, iw, ih, 1, 1, tmp_col, cgs.shaderMiniMap ); //alignment test, to display green dot at 0,0 //CG_DrawHUDRect( x + x_lefttop/map_div_w -1, y + y_lefttop/map_div_h -1,ALIGN_LEFT_TOP,3,3,1,1, colorGreen, CG_MediaShader( cgs.media.shaderMiniMap ) ); for( i = 0; i < cg.frame.numEntities; i++ ) { entnum = cg.frame.parsedEntities[i&( MAX_PARSE_ENTITIES-1 )].number; // filter invalid ents if( entnum < 1 || entnum >= MAX_EDICTS ) continue; // retrieve the centity_t cent = &cg_entities[entnum]; isSelf = ( (unsigned)entnum == cg.predictedPlayerState.POVnum ); if( ( cent->current.type != ET_PLAYER ) && ( cent->current.type != ET_MINIMAP_ICON ) && !( cent->item ) ) continue; if( isSelf ) VectorCopy( cg.predictedPlayerState.pmove.origin, coords ); else VectorCopy( cent->current.origin, coords ); coords[0] = ( coords[0] + x_lefttop ) / map_div_w; coords[1] = ih - ( coords[1] + y_lefttop ) / map_div_h; coords[2] = ( coords[2] + (float)z_lefttop ) / (float)map_z; // is it a player? if( ( cent->current.type == ET_PLAYER ) ) { int box_size = (int)( 3.0 + coords[2] * 10.0 ); // check if we're allowed to see team members only (coaches, CA) if( cg.predictedPlayerState.stats[STAT_LAYOUTS] & STAT_LAYOUT_SPECTEAMONLY || (cg.predictedPlayerState.stats[STAT_REALTEAM] != TEAM_SPECTATOR && GS_TeamOnlyMinimap()) ) { if( cg.predictedPlayerState.stats[STAT_REALTEAM] != cent->current.team ) continue; } if( cent->current.team == TEAM_SPECTATOR ) { if( entnum != cg.view.POVent ) continue; VectorSet( tmp_col, 1, 1, 1 ); } else { CG_TeamColor( cent->current.team, tmp_col ); } // get color tmp_col[3] = bound( 0, color[3] + 0.3f, 1 ); CG_DrawHUDRect( x + (int)coords[0] -box_size/2, y + (int)coords[1] -box_size/2, ALIGN_LEFT_TOP, box_size, box_size, box_size, box_size, tmp_col, NULL ); // differentiate ourselves with an arrow if( isSelf ) { int thisX, thisY, thisSize; thisSize = max( box_size, 8 ); thisX = CG_VerticalAlignForHeight( x + (int)coords[0], ALIGN_CENTER_MIDDLE, thisSize ); thisY = CG_VerticalAlignForHeight( y + (int)coords[1] - thisSize, ALIGN_CENTER_MIDDLE, thisSize ); trap_R_DrawStretchPic( thisX, thisY, thisSize, thisSize, 0, 0, 1, 1, tmp_yellow_alpha, CG_MediaShader( cgs.media.shaderDownArrow ) ); } // do we want names too? if( draw_playernames == qtrue ) trap_SCR_DrawString( x + (int)coords[0] + 8, y + (int)coords[1] - 4, ALIGN_LEFT_TOP, COM_RemoveColorTokensExt( cgs.clientInfo[cent->current.number-1].name, qtrue ), cgs.fontSystemSmall, tmp_yellow_alpha ); } else if( cent->current.type == ET_MINIMAP_ICON ) { if( cent->ent.customShader ) { vec4_t tmp_this_color; int thisX, thisY, thisSize; thisSize = (float)cent->prev.frame + (float)( cent->current.frame - cent->prev.frame ) * cg.lerpfrac; if( thisSize <= 0 ) thisSize = 18; tmp_this_color[0] = (float)cent->ent.shaderRGBA[0] / 255.0f; tmp_this_color[1] = (float)cent->ent.shaderRGBA[1] / 255.0f; tmp_this_color[2] = (float)cent->ent.shaderRGBA[2] / 255.0f; tmp_this_color[3] = 1.0f; thisX = CG_VerticalAlignForHeight( x + coords[0], ALIGN_CENTER_MIDDLE, thisSize ); thisY = CG_VerticalAlignForHeight( y + coords[1], ALIGN_CENTER_MIDDLE, thisSize ); trap_R_DrawStretchPic( thisX, thisY, thisSize, thisSize, 0, 0, 1, 1, tmp_this_color, cent->ent.customShader ); } } else if( cent->item && cent->item->icon ) { // if ALIGN_CENTER_MIDDLE or something is used, images are f****d // so thats why they are set manually at the correct pos with -n CG_DrawHUDRect( x+(int)coords[0]-8, y+(int)coords[1]-8, ALIGN_LEFT_TOP, 15, 15, 1, 1, tmp_white_alpha, trap_R_RegisterPic( cent->item->icon ) ); if( draw_itemnames == qtrue ) trap_SCR_DrawString( x + (int)coords[0] + 16, y + (int)coords[1] - 8, ALIGN_LEFT_TOP, cent->item->shortname, cgs.fontSystemSmall, tmp_yellow_alpha ); } } }
/* ================= CG_RegisterGraphics This function may execute for a couple of minutes with a slow disk. ================= */ static void CG_RegisterGraphics( void ) { int i; static char *sb_nums[11] = { "interface/fonts/numbers/0", "interface/fonts/numbers/1", "interface/fonts/numbers/2", "interface/fonts/numbers/3", "interface/fonts/numbers/4", "interface/fonts/numbers/5", "interface/fonts/numbers/6", "interface/fonts/numbers/7", "interface/fonts/numbers/8", "interface/fonts/numbers/9", "interface/fonts/numbers/-", }; // 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 ); CG_LoadingString( "game media" ); for ( i=0 ; i<11 ; i++) { cgs.media.numberShaders[i] = trap_R_RegisterShader( sb_nums[i] ); } cgs.media.waterBubbleLargeShader = trap_R_RegisterShader( "waterBubbleLarge" ); cgs.media.waterBubbleMediumShader = trap_R_RegisterShader( "waterBubbleMedium" ); cgs.media.waterBubbleSmallShader = trap_R_RegisterShader( "waterBubbleSmall" ); cgs.media.waterBubbleTinyShader = trap_R_RegisterShader( "waterBubbleTiny" ); cgs.media.selectShader = trap_R_RegisterShader( "interface/hud/select.png" ); cgs.media.chatBubble = trap_R_RegisterShader( "chatBubble"); for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) { cgs.media.crosshairShader[i] = trap_R_RegisterShader( va("crosshair%c", 'a'+i) ); } cgs.media.speedLineShader = trap_R_RegisterShaderNoMip("speedLines"); cgs.media.speedLineSpinShader = trap_R_RegisterShaderNoMip("speedLinesSpin"); cgs.media.globalCelLighting = trap_R_RegisterShader("GlobalCelLighting"); cgs.media.waterSplashSkin = trap_R_RegisterSkin( "effects/water/waterSplash.skin" ); cgs.media.waterSplashModel = trap_R_RegisterModel( "effects/water/waterSplash.md3" ); cgs.media.waterRippleSkin = trap_R_RegisterSkin( "effects/water/waterRipple.skin" ); cgs.media.waterRippleModel = trap_R_RegisterModel( "effects/water/waterRipple.md3" ); cgs.media.waterRippleSingleSkin = trap_R_RegisterSkin( "effects/water/waterRippleSingle.skin" ); cgs.media.waterRippleSingleModel = trap_R_RegisterModel( "effects/water/waterRippleSingle.md3" ); cgs.media.meleeSpeedEffectShader = trap_R_RegisterShader( "skills/energyBlast" ); cgs.media.meleePowerEffectShader = trap_R_RegisterShader( "shockwave" ); cgs.media.teleportEffectShader = trap_R_RegisterShader( "teleportEffect" ); cgs.media.boltEffectShader = trap_R_RegisterShader( "boltEffect" ); cgs.media.auraLightningSparks1 = trap_R_RegisterShader( "AuraLightningSparks1" ); cgs.media.auraLightningSparks2 = trap_R_RegisterShader( "AuraLightningSparks2" ); cgs.media.powerStruggleRaysEffectShader = trap_R_RegisterShader( "PowerStruggleRays" ); cgs.media.powerStruggleShockwaveEffectShader = trap_R_RegisterShader( "PowerStruggleShockwave" ); cgs.media.bfgLFGlare = trap_R_RegisterShader("bfgLFGlare"); cgs.media.bfgLFDisc = trap_R_RegisterShader("bfgLFDisc"); cgs.media.bfgLFRing = trap_R_RegisterShader("bfgLFRing"); cgs.media.bfgLFStar = trap_R_RegisterShader("bfgLFStar"); cgs.media.bfgLFLine = trap_R_RegisterShader("bfgLFLine"); memset( cg_weapons, 0, sizeof( cg_weapons ) ); cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" ); cgs.media.dirtPushShader = trap_R_RegisterShader( "DirtPush" ); cgs.media.dirtPushSkin = trap_R_RegisterSkin( "effects/shockwave/dirtPush.skin" ); cgs.media.dirtPushModel = trap_R_RegisterModel( "effects/shockwave/dirtPush.md3" ); cgs.media.hudShader = trap_R_RegisterShaderNoMip( "interface/hud/main.png" ); cgs.media.chatBackgroundShader = trap_R_RegisterShaderNoMip("chatBox"); cgs.media.markerAscendShader = trap_R_RegisterShaderNoMip( "interface/hud/markerAscend.png" ); cgs.media.markerDescendShader = trap_R_RegisterShaderNoMip( "interface/hud/markerDescend.png" ); cgs.media.breakLimitShader = trap_R_RegisterShaderNoMip( "breakLimit" ); cgs.media.RadarBlipShader = trap_R_RegisterShaderNoMip( "interface/sense/blip.png" ); cgs.media.RadarBlipTeamShader = trap_R_RegisterShaderNoMip( "interface/sense/blipteam.png" ); cgs.media.RadarBurstShader = trap_R_RegisterShaderNoMip( "interface/sense/burst.png" ); cgs.media.RadarWarningShader = trap_R_RegisterShaderNoMip( "interface/sense/warning.png" ); cgs.media.RadarMidpointShader = trap_R_RegisterShaderNoMip( "interface/sense/midpoint.png" ); // END ADDING // 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, 0 ); 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 (); }
/* ================= CG_RegisterGraphics This function may execute for a couple of minutes with a slow disk. ================= */ static void CG_RegisterGraphics( void ) { int i; const char *str; // 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" ); cgs.media.crosshairShader[0] = trap_R_RegisterShader( "gfx/2d/BLANK" ); cgs.media.crosshairShader[1] = trap_R_RegisterShader( "textures/hud/crosshair" ); cgs.media.crosshairShader[2] = trap_R_RegisterShader( "gfx/2d/crosshair" ); cgs.media.backTileShader = trap_R_RegisterShader( "gfx/2d/backtile" ); cgs.media.shadowMarkShader = trap_R_RegisterShader( "markShadow" ); cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" ); // su44: MoHAA zoom overlays cgs.media.zoomOverlayShader = trap_R_RegisterShader("textures/hud/zoomoverlay"); cgs.media.kar98TopOverlayShader = trap_R_RegisterShader("textures/hud/kartop.tga"); cgs.media.kar98BottomOverlayShader = trap_R_RegisterShader("textures/hud/karbottom.tga"); cgs.media.binocularsOverlayShader = trap_R_RegisterShader("textures/hud/binocularsoverlay"); // 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 ); if( modelName[0] != '*') { cgs.gameTIKIs[i] = trap_TIKI_RegisterModel( modelName ); if(cgs.gameTIKIs[i] == 0) { CG_Printf("CG_RegisterGraphics: failed to load tiki file %s (%i)\n",modelName,i); } } } for (i=0; i<64; i++) { const char *itemName; itemName = CG_ConfigString( CS_WEAPONS+i ); if(itemName[0]) { CG_RegisterItemName(i, itemName); } } for( i = CS_RAIN_DENSITY; i != (CS_RAIN_NUMSHADERS+1); i++) { str = CG_ConfigString( i ); CG_RainCSUpdated(i,str); } str = CG_ConfigString( CS_FOGINFO ); sscanf(str, "%d %f %f %f %f", &cg.farplane_cull, &cg.farplane_distance, &cg.farplane_color[0], &cg.farplane_color[1], &cg.farplane_color[2]); CG_ClearParticles (); }
/* ================= 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_RegisterWeapon The server says this item is used on this level ================= */ void CG_RegisterWeapon( int weaponNum) { weaponInfo_t *weaponInfo; gitem_t *item, *ammo; char path[MAX_QPATH]; vec3_t mins, maxs; int i; weaponInfo = &cg_weapons[weaponNum]; if ( weaponNum == 0 ) { return; } if ( weaponInfo->registered ) { return; } memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->registered = qtrue; for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( item->giType == IT_WEAPON && item->giTag == weaponNum ) { weaponInfo->item = item; break; } } if ( !item->classname ) { CG_Error( "Couldn't find weapon %i", weaponNum ); } CG_RegisterItemVisuals( item - bg_itemlist ); // load cmodel before model so filecache works weaponInfo->weaponModel = trap_R_RegisterModel( item->world_model[0] ); // load in-view model also weaponInfo->viewModel = trap_R_RegisterModel(item->view_model); // calc midpoint for rotation trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs ); for ( i = 0 ; i < 3 ; i++ ) { weaponInfo->weaponMidpoint[i] = mins[i] + 0.5 * ( maxs[i] - mins[i] ); } weaponInfo->weaponIcon = trap_R_RegisterShader( item->icon ); weaponInfo->ammoIcon = trap_R_RegisterShader( item->icon ); for ( ammo = bg_itemlist + 1 ; ammo->classname ; ammo++ ) { if ( ammo->giType == IT_AMMO && ammo->giTag == weaponNum ) { break; } } if ( ammo->classname && ammo->world_model[0] ) { weaponInfo->ammoModel = trap_R_RegisterModel( ammo->world_model[0] ); } // strcpy( path, item->view_model ); // COM_StripExtension( path, path ); // strcat( path, "_flash.md3" ); weaponInfo->flashModel = 0;//trap_R_RegisterModel( path ); if (weaponNum == WP_DISRUPTOR || weaponNum == WP_FLECHETTE || weaponNum == WP_REPEATER || weaponNum == WP_ROCKET_LAUNCHER) { strcpy( path, item->view_model ); COM_StripExtension( path, path ); strcat( path, "_barrel.md3" ); weaponInfo->barrelModel = trap_R_RegisterModel( path ); } else if (weaponNum == WP_STUN_BATON) { //only weapon with more than 1 barrel.. trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel.md3"); trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel2.md3"); trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel3.md3"); } else { weaponInfo->barrelModel = 0; } if (weaponNum != WP_SABER) { strcpy( path, item->view_model ); COM_StripExtension( path, path ); strcat( path, "_hand.md3" ); weaponInfo->handsModel = trap_R_RegisterModel( path ); } else { weaponInfo->handsModel = 0; } // if ( !weaponInfo->handsModel ) { // weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" ); // } switch ( weaponNum ) { case WP_STUN_BATON: case WP_MELEE: /* MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/saber/saberhum.wav" ); // weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav" ); */ //trap_R_RegisterShader( "gfx/effects/stunPass" ); trap_FX_RegisterEffect( "stunBaton/flesh_impact" ); if (weaponNum == WP_STUN_BATON) { trap_S_RegisterSound( "sound/weapons/baton/idle.wav" ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/baton/fire.mp3" ); weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/baton/fire.mp3" ); } else { /* int j = 0; while (j < 4) { weaponInfo->flashSound[j] = trap_S_RegisterSound( va("sound/weapons/melee/swing%i", j+1) ); weaponInfo->altFlashSound[j] = weaponInfo->flashSound[j]; j++; } */ //No longer needed, animsound config plays them for us } break; case WP_SABER: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/saber/saberhum1.wav" ); weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/saber/saber_w.glm" ); break; case WP_CONCUSSION: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/concussion/select.wav"); weaponInfo->flashSound[0] = NULL_SOUND; weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "concussion/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; //weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_ConcussionProjectileThink; weaponInfo->altFlashSound[0] = NULL_SOUND; weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/bryar/altcharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "concussion/altmuzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; //weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_ConcussionProjectileThink; cgs.effects.disruptorAltMissEffect = trap_FX_RegisterEffect( "disruptor/alt_miss" ); cgs.effects.concussionShotEffect = trap_FX_RegisterEffect( "concussion/shot" ); cgs.effects.concussionImpactEffect = trap_FX_RegisterEffect( "concussion/explosion" ); trap_R_RegisterShader("gfx/effects/blueLine"); trap_R_RegisterShader("gfx/misc/whiteline2"); break; case WP_BRYAR_PISTOL: case WP_BRYAR_OLD: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/bryar/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bryar/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "bryar/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; //weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BryarProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/bryar/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/bryar/altcharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "bryar/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; //weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BryarAltProjectileThink; cgs.effects.bryarShotEffect = trap_FX_RegisterEffect( "bryar/shot" ); cgs.effects.bryarPowerupShotEffect = trap_FX_RegisterEffect( "bryar/crackleShot" ); cgs.effects.bryarWallImpactEffect = trap_FX_RegisterEffect( "bryar/wall_impact" ); cgs.effects.bryarWallImpactEffect2 = trap_FX_RegisterEffect( "bryar/wall_impact2" ); cgs.effects.bryarWallImpactEffect3 = trap_FX_RegisterEffect( "bryar/wall_impact3" ); cgs.effects.bryarFleshImpactEffect = trap_FX_RegisterEffect( "bryar/flesh_impact" ); cgs.effects.bryarDroidImpactEffect = trap_FX_RegisterEffect( "bryar/droid_impact" ); cgs.media.bryarFrontFlash = trap_R_RegisterShader( "gfx/effects/bryarFrontFlash" ); // Note these are temp shared effects trap_FX_RegisterEffect("blaster/wall_impact.efx"); trap_FX_RegisterEffect("blaster/flesh_impact.efx"); break; case WP_BLASTER: case WP_EMPLACED_GUN: //rww - just use the same as this for now.. weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/blaster/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/blaster/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "blaster/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BlasterProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/blaster/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "blaster/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BlasterProjectileThink; trap_FX_RegisterEffect( "blaster/deflect" ); cgs.effects.blasterShotEffect = trap_FX_RegisterEffect( "blaster/shot" ); cgs.effects.blasterWallImpactEffect = trap_FX_RegisterEffect( "blaster/wall_impact" ); cgs.effects.blasterFleshImpactEffect = trap_FX_RegisterEffect( "blaster/flesh_impact" ); cgs.effects.blasterDroidImpactEffect = trap_FX_RegisterEffect( "blaster/droid_impact" ); break; case WP_DISRUPTOR: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/disruptor/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/disruptor/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "disruptor/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/disruptor/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound("sound/weapons/disruptor/altCharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "disruptor/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.disruptorRingsEffect = trap_FX_RegisterEffect( "disruptor/rings" ); cgs.effects.disruptorProjectileEffect = trap_FX_RegisterEffect( "disruptor/shot" ); cgs.effects.disruptorWallImpactEffect = trap_FX_RegisterEffect( "disruptor/wall_impact" ); cgs.effects.disruptorFleshImpactEffect = trap_FX_RegisterEffect( "disruptor/flesh_impact" ); cgs.effects.disruptorAltMissEffect = trap_FX_RegisterEffect( "disruptor/alt_miss" ); cgs.effects.disruptorAltHitEffect = trap_FX_RegisterEffect( "disruptor/alt_hit" ); trap_R_RegisterShader( "gfx/effects/redLine" ); trap_R_RegisterShader( "gfx/misc/whiteline2" ); trap_R_RegisterShader( "gfx/effects/smokeTrail" ); trap_S_RegisterSound("sound/weapons/disruptor/zoomstart.wav"); trap_S_RegisterSound("sound/weapons/disruptor/zoomend.wav"); // Disruptor gun zoom interface cgs.media.disruptorMask = trap_R_RegisterShader( "gfx/2d/cropCircle2"); cgs.media.disruptorInsert = trap_R_RegisterShader( "gfx/2d/cropCircle"); cgs.media.disruptorLight = trap_R_RegisterShader( "gfx/2d/cropCircleGlow" ); cgs.media.disruptorInsertTick = trap_R_RegisterShader( "gfx/2d/insertTick" ); cgs.media.disruptorChargeShader = trap_R_RegisterShaderNoMip("gfx/2d/crop_charge"); cgs.media.disruptorZoomLoop = trap_S_RegisterSound( "sound/weapons/disruptor/zoomloop.wav" ); break; case WP_BOWCASTER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/bowcaster/select.wav"); weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/bowcaster/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "bowcaster/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor = {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BowcasterProjectileThink; weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bowcaster/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = trap_S_RegisterSound( "sound/weapons/bowcaster/altcharge.wav"); weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "bowcaster/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BowcasterAltProjectileThink; cgs.effects.bowcasterShotEffect = trap_FX_RegisterEffect( "bowcaster/shot" ); cgs.effects.bowcasterImpactEffect = trap_FX_RegisterEffect( "bowcaster/explosion" ); trap_FX_RegisterEffect( "bowcaster/deflect" ); cgs.media.greenFrontFlash = trap_R_RegisterShader( "gfx/effects/greenFrontFlash" ); break; case WP_REPEATER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/repeater/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/repeater/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "repeater/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_RepeaterProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/repeater/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "repeater/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_RepeaterAltProjectileThink; cgs.effects.repeaterProjectileEffect = trap_FX_RegisterEffect( "repeater/projectile" ); cgs.effects.repeaterAltProjectileEffect = trap_FX_RegisterEffect( "repeater/alt_projectile" ); cgs.effects.repeaterWallImpactEffect = trap_FX_RegisterEffect( "repeater/wall_impact" ); cgs.effects.repeaterFleshImpactEffect = trap_FX_RegisterEffect( "repeater/flesh_impact" ); //cgs.effects.repeaterAltWallImpactEffect = trap_FX_RegisterEffect( "repeater/alt_wall_impact" ); cgs.effects.repeaterAltWallImpactEffect = trap_FX_RegisterEffect( "repeater/concussion" ); break; case WP_DEMP2: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/demp2/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound("sound/weapons/demp2/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect("demp2/muzzle_flash"); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_DEMP2_ProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound("sound/weapons/demp2/altfire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound("sound/weapons/demp2/altCharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect("demp2/muzzle_flash"); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.demp2ProjectileEffect = trap_FX_RegisterEffect( "demp2/projectile" ); cgs.effects.demp2WallImpactEffect = trap_FX_RegisterEffect( "demp2/wall_impact" ); cgs.effects.demp2FleshImpactEffect = trap_FX_RegisterEffect( "demp2/flesh_impact" ); cgs.media.demp2Shell = trap_R_RegisterModel( "models/items/sphere.md3" ); cgs.media.demp2ShellShader = trap_R_RegisterShader( "gfx/effects/demp2shell" ); cgs.media.lightningFlash = trap_R_RegisterShader("gfx/misc/lightningFlash"); break; case WP_FLECHETTE: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/flechette/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/flechette/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "flechette/muzzle_flash" ); weaponInfo->missileModel = trap_R_RegisterModel("models/weapons2/golan_arms/projectileMain.md3"); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_FlechetteProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/flechette/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "flechette/muzzle_flash" ); weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/golan_arms/projectile.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_FlechetteAltProjectileThink; cgs.effects.flechetteShotEffect = trap_FX_RegisterEffect( "flechette/shot" ); cgs.effects.flechetteAltShotEffect = trap_FX_RegisterEffect( "flechette/alt_shot" ); cgs.effects.flechetteWallImpactEffect = trap_FX_RegisterEffect( "flechette/wall_impact" ); cgs.effects.flechetteFleshImpactEffect = trap_FX_RegisterEffect( "flechette/flesh_impact" ); break; case WP_ROCKET_LAUNCHER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/rocket/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "rocket/muzzle_flash" ); //trap_FX_RegisterEffect( "rocket/muzzle_flash2" ); //flash2 still looks crappy with the fx bolt stuff. Because the fx bolt stuff doesn't work entirely right. weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/merr_sonn/projectile.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/missleloop.wav"); weaponInfo->missileDlight = 125; VectorSet(weaponInfo->missileDlightColor, 1.0, 1.0, 0.5); weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_RocketProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "rocket/altmuzzle_flash" ); weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/merr_sonn/projectile.md3" ); weaponInfo->altMissileSound = trap_S_RegisterSound( "sound/weapons/rocket/missleloop.wav"); weaponInfo->altMissileDlight = 125; VectorSet(weaponInfo->altMissileDlightColor, 1.0, 1.0, 0.5); weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_RocketAltProjectileThink; cgs.effects.rocketShotEffect = trap_FX_RegisterEffect( "rocket/shot" ); cgs.effects.rocketExplosionEffect = trap_FX_RegisterEffect( "rocket/explosion" ); trap_R_RegisterShaderNoMip( "gfx/2d/wedge" ); trap_R_RegisterShaderNoMip( "gfx/2d/lock" ); trap_S_RegisterSound( "sound/weapons/rocket/lock.wav" ); trap_S_RegisterSound( "sound/weapons/rocket/tick.wav" ); break; case WP_THERMAL: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/thermal/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/thermal/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = trap_S_RegisterSound( "sound/weapons/thermal/charge.wav"); weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/thermal/thermal_proj.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/thermal/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/thermal/charge.wav"); weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/thermal/thermal_proj.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.thermalExplosionEffect = trap_FX_RegisterEffect( "thermal/explosion" ); cgs.effects.thermalShockwaveEffect = trap_FX_RegisterEffect( "thermal/shockwave" ); cgs.media.grenadeBounce1 = trap_S_RegisterSound( "sound/weapons/thermal/bounce1.wav" ); cgs.media.grenadeBounce2 = trap_S_RegisterSound( "sound/weapons/thermal/bounce2.wav" ); trap_S_RegisterSound( "sound/weapons/thermal/thermloop.wav" ); trap_S_RegisterSound( "sound/weapons/thermal/warning.wav" ); break; case WP_TRIP_MINE: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/detpack/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/laser_trap/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = 0;//trap_R_RegisterModel( "models/weapons2/laser_trap/laser_trap_w.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/laser_trap/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = 0;//trap_R_RegisterModel( "models/weapons2/laser_trap/laser_trap_w.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.tripmineLaserFX = trap_FX_RegisterEffect("tripMine/laserMP.efx"); cgs.effects.tripmineGlowFX = trap_FX_RegisterEffect("tripMine/glowbit.efx"); trap_FX_RegisterEffect( "tripMine/explosion" ); // NOTENOTE temp stuff trap_S_RegisterSound( "sound/weapons/laser_trap/stick.wav" ); trap_S_RegisterSound( "sound/weapons/laser_trap/warning.wav" ); break; case WP_DET_PACK: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/detpack/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/detpack/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/detpack/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); trap_S_RegisterSound( "sound/weapons/detpack/stick.wav" ); trap_S_RegisterSound( "sound/weapons/detpack/warning.wav" ); trap_S_RegisterSound( "sound/weapons/explosions/explode5.wav" ); break; case WP_TURRET: weaponInfo->flashSound[0] = NULL_SOUND; weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_HANDLE; weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_TurretProjectileThink; trap_FX_RegisterEffect("effects/blaster/wall_impact.efx"); trap_FX_RegisterEffect("effects/blaster/flesh_impact.efx"); break; default: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav" ); break; } }
/* ================= CG_RegisterWeapon The server says this item is used on this level ================= */ void CG_RegisterWeapon( int weaponNum ) { weaponInfo_t *weaponInfo; gitem_t *item, *ammo; char path[MAX_QPATH]; vec3_t mins, maxs; int i; weaponInfo = &cg_weapons[weaponNum]; if ( weaponNum == 0 ) { return; } if ( weaponInfo->registered ) { return; } memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->registered = qtrue; for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( item->giType == IT_WEAPON && item->giTag == weaponNum ) { weaponInfo->item = item; break; } } if ( !item->classname ) { CG_Error( "Couldn't find weapon %i", weaponNum ); } CG_RegisterItemVisuals( item - bg_itemlist ); // load cmodel before model so filecache works weaponInfo->weaponModel = trap_R_RegisterModel( item->world_model[0] ); // calc midpoint for rotation trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs ); for ( i = 0 ; i < 3 ; i++ ) { weaponInfo->weaponMidpoint[i] = mins[i] + 0.5 * ( maxs[i] - mins[i] ); } weaponInfo->weaponIcon = trap_R_RegisterShader( item->icon ); weaponInfo->ammoIcon = trap_R_RegisterShader( item->icon ); for ( ammo = bg_itemlist + 1 ; ammo->classname ; ammo++ ) { if ( ammo->giType == IT_AMMO && ammo->giTag == weaponNum ) { break; } } if ( ammo->classname && ammo->world_model[0] ) { weaponInfo->ammoModel = trap_R_RegisterModel( ammo->world_model[0] ); } strcpy( path, item->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_flash.md3" ); weaponInfo->flashModel = trap_R_RegisterModel( path ); strcpy( path, item->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_barrel.md3" ); weaponInfo->barrelModel = trap_R_RegisterModel( path ); strcpy( path, item->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_hand.md3" ); weaponInfo->handsModel = trap_R_RegisterModel( path ); if ( !weaponInfo->handsModel ) { weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" ); } weaponInfo->loopFireSound = qfalse; switch ( weaponNum ) { case WP_GAUNTLET: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/melee/fstrun.wav", qfalse ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; case WP_LIGHTNING: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/lightning/lg_hum.wav", qfalse ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/lightning/lg_fire.wav", qfalse ); cgs.media.lightningShader = trap_R_RegisterShader( "lightningBoltNew"); cgs.media.lightningExplosionModel = trap_R_RegisterModel( "models/weaphits/crackle.md3" ); cgs.media.sfx_lghit1 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit.wav", qfalse ); cgs.media.sfx_lghit2 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit2.wav", qfalse ); cgs.media.sfx_lghit3 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit3.wav", qfalse ); break; case WP_GRAPPLING_HOOK: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" ); weaponInfo->missileTrailFunc = CG_GrappleTrail; weaponInfo->missileDlight = 200; weaponInfo->wiTrailTime = 2000; weaponInfo->trailRadius = 64; MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 ); weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/melee/fstrun.wav", qfalse ); break; case WP_MACHINEGUN: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf1b.wav", qfalse ); weaponInfo->flashSound[1] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf2b.wav", qfalse ); weaponInfo->flashSound[2] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf3b.wav", qfalse ); weaponInfo->flashSound[3] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf4b.wav", qfalse ); weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass; cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" ); break; case WP_SHOTGUN: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/shotgun/sshotf1b.wav", qfalse ); weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass; break; case WP_ROCKET_LAUNCHER: weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse ); weaponInfo->missileTrailFunc = CG_RocketTrail; weaponInfo->missileDlight = 200; weaponInfo->wiTrailTime = 2000; weaponInfo->trailRadius = 64; MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse ); cgs.media.rocketExplosionShader = trap_R_RegisterShader( "rocketExplosion" ); break; case WP_GRENADE_LAUNCHER: weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/grenade1.md3" ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.70f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/grenade/grenlf1a.wav", qfalse ); cgs.media.grenadeExplosionShader = trap_R_RegisterShader( "grenadeExplosion" ); break; case WP_PLASMAGUN: weaponInfo->missileTrailFunc = CG_PlasmaTrail; weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/plasma/lasfly.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/plasma/hyprbf1a.wav", qfalse ); cgs.media.plasmaExplosionShader = trap_R_RegisterShader( "plasmaExplosion" ); cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); break; case WP_RAILGUN: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/railgun/rg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.5f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/railgun/railgf1a.wav", qfalse ); cgs.media.railExplosionShader = trap_R_RegisterShader( "railExplosion" ); cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); cgs.media.railCoreShader = trap_R_RegisterShader( "railCore" ); break; case WP_BFG: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/bfg/bfg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.7f, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bfg/bfg_fire.wav", qfalse ); cgs.media.bfgExplosionShader = trap_R_RegisterShader( "bfgExplosion" ); weaponInfo->missileModel = trap_R_RegisterModel( "models/weaphits/bfg.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse ); break; default: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse ); break; } }
void SP_misc_gamemodel( void ) { char* model; vec_t angle; vec3_t angles; vec_t scale; vec3_t vScale; vec3_t org; cg_gamemodel_t* gamemodel; int i; if ( CG_SpawnString( "targetname", "", &model ) || CG_SpawnString( "scriptname", "", &model ) || CG_SpawnString( "spawnflags", "", &model ) ) { // Gordon: this model may not be static, so let the server handle it return; } if ( cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS ) { CG_Error( "^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS ); } CG_SpawnString( "model", "", &model ); CG_SpawnVector( "origin", "0 0 0", org ); if ( !CG_SpawnVector( "angles", "0 0 0", angles ) ) { if ( CG_SpawnFloat( "angle", "0", &angle ) ) { angles[YAW] = angle; } } if ( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) { if ( CG_SpawnFloat( "modelscale", "1", &scale ) ) { VectorSet( vScale, scale, scale, scale ); } } gamemodel = &cgs.miscGameModels[cg.numMiscGameModels++]; gamemodel->model = trap_R_RegisterModel( model ); AnglesToAxis( angles, gamemodel->axes ); for ( i = 0; i < 3; i++ ) { VectorScale( gamemodel->axes[i], vScale[i], gamemodel->axes[i] ); } VectorCopy( org, gamemodel->org ); if ( gamemodel->model ) { vec3_t mins, maxs; trap_R_ModelBounds( gamemodel->model, mins, maxs ); for ( i = 0; i < 3; i++ ) { mins[i] *= vScale[i]; maxs[i] *= vScale[i]; } gamemodel->radius = RadiusFromBounds( mins, maxs ); } else { gamemodel->radius = 0; } }
void SP_misc_gamemodel( void ) { char* model; char* skin; vec_t angle; vec3_t angles; vec_t scale; vec3_t vScale; vec3_t org; cg_gamemodel_t* gamemodel; int i; #if 0 // ZTM: Note: Spearmint's game always drops misc_gamemodels. Also, RTCW has targetname set though I'm not sure what, if anything, it's used for. if ( CG_SpawnString( "targetname", "", &model ) || CG_SpawnString( "scriptname", "", &model ) || CG_SpawnString( "spawnflags", "", &model ) ) { // Gordon: this model may not be static, so let the server handle it return; } #endif if ( cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS ) { CG_Error( "^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS ); } CG_SpawnString( "model", "", &model ); CG_SpawnString( "skin", "", &skin ); CG_SpawnVector( "origin", "0 0 0", org ); if ( !CG_SpawnVector( "angles", "0 0 0", angles ) ) { if ( CG_SpawnFloat( "angle", "0", &angle ) ) { angles[YAW] = angle; } } if ( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) { if ( CG_SpawnFloat( "modelscale", "1", &scale ) ) { VectorSet( vScale, scale, scale, scale ); } } gamemodel = &cgs.miscGameModels[cg.numMiscGameModels++]; gamemodel->model = trap_R_RegisterModel( model ); if ( *skin ) { CG_RegisterSkin( skin, &gamemodel->skin, qfalse ); } AnglesToAxis( angles, gamemodel->axes ); for ( i = 0; i < 3; i++ ) { VectorScale( gamemodel->axes[i], vScale[i], gamemodel->axes[i] ); } VectorCopy( org, gamemodel->org ); if ( gamemodel->model ) { vec3_t mins, maxs; trap_R_ModelBounds( gamemodel->model, mins, maxs, 0, 0, 0 ); for ( i = 0; i < 3; i++ ) { mins[i] *= vScale[i]; maxs[i] *= vScale[i]; } gamemodel->radius = RadiusFromBounds( mins, maxs ); } else { gamemodel->radius = 0; } }