public void initTextures() { texture = new Texture2D[cant_subsets]; for (var i = 0; i < cant_subsets; ++i) { // busco en que directorio puede esta la textura bool found = false; for (var j = 0; j < cant_cdmaterials && !found; ++j) { string fname = CBspFile.tex_folder + cdmaterials[j] + subset[i].name + ".vmt"; if (File.Exists(fname)) { found = true; subset[i].image_name = cdmaterials[j] + subset[i].name; } } if (!found) { continue; } var name = CBspFile.que_tga_name(subset[i].image_name); var tga = CBspFile.tex_folder + name + ".tga"; texture[i] = CTextureLoader.Load(device, tga); // propiedades del material var vmt = CBspFile.tex_folder + name + ".vmt"; if (File.Exists(vmt)) { var content = File.ReadAllText(vmt).ToLower(); // "$translucent" "1" // "$translucent" 1 // "$alphatest" 1 // "$AlphaTestReference" "0.5" string value = ""; if (parseTag(content, "$translucent", out value) && int.Parse(value) == 1) { subset[i].traslucido = true; } if (parseTag(content, "$alphatest", out value) && int.Parse(value) == 1) { subset[i].traslucido = true; if (parseTag(content, "$alphatestreference", out value)) { subset[i].alphaTestReference = atof(value); } } } } }
public Texture2D insert(string image_name, GraphicsDevice device) { int n = que_textura(image_name); if (n == -1 && cant_texturas < MAX_TEXTURAS - 1) { var name = CBspFile.que_tga_name(image_name); var tga = CBspFile.tex_folder + name + ".tga"; texturas[cant_texturas] = CTextureLoader.Load(device, tga); tx_name[cant_texturas] = image_name; n = cant_texturas++; } return(n != -1 ? texturas[n] : null); }
public CEnemy(CBspFile p_scene, TGCGame p_game, CSMDModel p_model) : base(p_scene, p_game) { model = p_model; vel_lineal = model.speed; // 0 "ValveBiped.Bip01_Pelvis" -1 // 13 "ValveBiped.Bip01_Neck1" 12 // 14 "ValveBiped.Bip01_Head1" 13 // 45 "ValveBiped.weapon_bone" 9 int[] ndx_hp = { 0, 13, 14, 45 }; float[] hp_dw = { 10, 5, 5, 5 }; for (int i = 0; i < cant_hp; ++i) { hit_points[i] = new hit_point(); hit_points[i].Position = new Vector3(); hit_points[i].bone_id = ndx_hp[i]; hit_points[i].dw = hp_dw[i]; } }
public CPlayer(CBspFile p_scene, TGCGame p_game) { scene = p_scene; game = p_game; Height = p_game.soldier_height; }
void LoadContentGame() { font = Content.Load <SpriteFont>("SpriteFonts/Arial"); spriteBatch = new SpriteBatch(GraphicsDevice); EffectMesh = Content.Load <Effect>("Effects/BasicShader"); EffectSmd = Content.Load <Effect>("Effects/SMDEffect"); EffectSmd.CurrentTechnique = EffectSmd.Techniques["SkinnedMesh"]; // Arma weapon = new CWeapon(this, GraphicsDevice, Content, cs_folder); // Soldado soldier = new CSMDModel("player\\ct_sas", GraphicsDevice, Content, cs_folder); soldier.cargar_ani("player\\cs_player_shared_anims", "Death1"); soldier.anim[0].loop = false; soldier.cargar_ani("player\\cs_player_shared_anims", "a_WalkN"); soldier.anim[1].in_site = true; soldier_height = soldier.size.Y; soldier.debugEffect = EffectMesh; // Hostage for (int i = 0; i < NUM_HOSTAGE; ++i) { hostage_model[i] = new CSMDModel("characters\\hostage_0" + (i + 1).ToString(), GraphicsDevice, Content, cs_folder); hostage_model[i].cargar_ani("characters\\hostage_0" + (i + 1).ToString() + "_anims", "ragdoll"); hostage_model[i].anim[0].loop = false; hostage_model[i].debugEffect = EffectMesh; } // huevo de pascuas tgcLogo = Content.Load <Model>("Models/tgc-logo/tgc-logo"); var modelEffect = (BasicEffect)tgcLogo.Meshes[0].Effects[0]; modelEffect.DiffuseColor = Color.DarkBlue.ToVector3(); modelEffect.EnableDefaultLighting(); debug_box = new CDebugBox(GraphicsDevice); scene = new CBspFile(map_name, GraphicsDevice, Content); skybox = new CSkybox(GraphicsDevice); player = new CPlayer(scene, this); Random rnd = new Random(); for (int i = 0; i < MAX_ENEMIGOS; ++i) { enemigo[i] = new CEnemy(scene, this, soldier); enemigo[i].Position = new Vector3(rnd.Next((int)scene.p_min.X, (int)scene.p_max.X), scene.p_max.Y, rnd.Next((int)scene.p_min.Z, (int)scene.p_max.Z)); enemigo[i].Position = new Vector3(7242 + rnd.Next(-300, 300), -493, 6746 + rnd.Next(-300, 300)); float an = rnd.Next(0, 360) * MathF.PI / 180.0f; enemigo[i].Direction = new Vector3(MathF.Cos(an), 0, MathF.Sin(an)); enemigo[i].currentTime = rnd.Next(100); enemigo[i].currentAnimation = 1; } enemigo[0].PrevPosition = enemigo[0].Position = new Vector3(6447, -800, 6276); enemigo[0].Direction = new Vector3(0, 0, -1); player.Position = scene.info_player_start_pos; player.Direction = new Vector3(0, 0, 1); cant_hostages = scene.cant_hostages; for (int i = 0; i < cant_hostages; ++i) { hostage[i] = new CEnemy(scene, this, hostage_model[i % 4]); hostage[i].Position = scene.hostages[i].origin; hostage[i].Position.Y += hostage_model[i % 4].cg.Y; hostage[i].currentAnimation = 0; } base.LoadContent(); }
public info_decal(CBspFile scene, Vector3 p, string image_name, GraphicsDevice device, bool p_sangre = false) { origin = p; texture = scene.decals_tx_pool.insert(image_name, device); blood = p_sangre; }