📄 cl_tent.java
字号:
/* * java * Copyright (C) 2004 * * $Id: CL_tent.java,v 1.10 2005/02/20 21:50:52 salomo Exp $ *//* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package jake2.client;import jake2.Defines;import jake2.Globals;import jake2.game.player_state_t;import jake2.qcommon.Com;import jake2.qcommon.MSG;import jake2.render.model_t;import jake2.sound.S;import jake2.sound.sfx_t;import jake2.util.Lib;import jake2.util.Math3D;/** * CL_tent */public class CL_tent { static class explosion_t { int type; entity_t ent = new entity_t(); int frames; float light; float[] lightcolor = new float[3]; float start; int baseframe; void clear() { lightcolor[0] = lightcolor[1] = lightcolor[2] = light = start = type = frames = baseframe = 0; ent.clear(); } } static final int MAX_EXPLOSIONS = 32; static explosion_t[] cl_explosions = new explosion_t[MAX_EXPLOSIONS]; static final int MAX_BEAMS = 32; static beam_t[] cl_beams = new beam_t[MAX_BEAMS]; // PMM - added this for player-linked beams. Currently only used by the // plasma beam static beam_t[] cl_playerbeams = new beam_t[MAX_BEAMS]; static final int MAX_LASERS = 32; static laser_t[] cl_lasers = new laser_t[MAX_LASERS]; // ROGUE static final int MAX_SUSTAINS = 32; static cl_sustain_t[] cl_sustains = new cl_sustain_t[MAX_SUSTAINS]; static class beam_t { int entity; int dest_entity; model_t model; int endtime; float[] offset = new float[3]; float[] start = new float[3]; float[] end = new float[3]; void clear() { offset[0] = offset[1] = offset[2] = start[0] = start[1] = start[2] = end[0] = end[1] = end[2] = entity = dest_entity = endtime = 0; model = null; } } static { for (int i = 0; i < cl_explosions.length; i++) cl_explosions[i] = new explosion_t(); } static { for (int i = 0; i < cl_beams.length; i++) cl_beams[i] = new beam_t(); for (int i = 0; i < cl_playerbeams.length; i++) cl_playerbeams[i] = new beam_t(); } static class laser_t { entity_t ent = new entity_t(); int endtime; void clear() { endtime = 0; ent.clear(); } } static { for (int i = 0; i < cl_lasers.length; i++) cl_lasers[i] = new laser_t(); } static { for (int i = 0; i < cl_sustains.length; i++) cl_sustains[i] = new cl_sustain_t(); } static final int ex_free = 0; static final int ex_explosion = 1; static final int ex_misc = 2; static final int ex_flash = 3; static final int ex_mflash = 4; static final int ex_poly = 5; static final int ex_poly2 = 6; // ROGUE // all are references; static sfx_t cl_sfx_ric1; static sfx_t cl_sfx_ric2; static sfx_t cl_sfx_ric3; static sfx_t cl_sfx_lashit; static sfx_t cl_sfx_spark5; static sfx_t cl_sfx_spark6; static sfx_t cl_sfx_spark7; static sfx_t cl_sfx_railg; static sfx_t cl_sfx_rockexp; static sfx_t cl_sfx_grenexp; static sfx_t cl_sfx_watrexp; // RAFAEL static sfx_t cl_sfx_plasexp; static sfx_t cl_sfx_footsteps[] = new sfx_t[4]; static model_t cl_mod_explode; static model_t cl_mod_smoke; static model_t cl_mod_flash; static model_t cl_mod_parasite_segment; static model_t cl_mod_grapple_cable; static model_t cl_mod_parasite_tip; static model_t cl_mod_explo4; static model_t cl_mod_bfg_explo; static model_t cl_mod_powerscreen; // RAFAEL static model_t cl_mod_plasmaexplo; // ROGUE static sfx_t cl_sfx_lightning; static sfx_t cl_sfx_disrexp; static model_t cl_mod_lightning; static model_t cl_mod_heatbeam; static model_t cl_mod_monster_heatbeam; static model_t cl_mod_explo4_big; // ROGUE /* * ================= CL_RegisterTEntSounds ================= */ static void RegisterTEntSounds() { int i; String name; // PMM - version stuff // Com_Printf ("%s\n", ROGUE_VERSION_STRING); // PMM cl_sfx_ric1 = S.RegisterSound("world/ric1.wav"); cl_sfx_ric2 = S.RegisterSound("world/ric2.wav"); cl_sfx_ric3 = S.RegisterSound("world/ric3.wav"); cl_sfx_lashit = S.RegisterSound("weapons/lashit.wav"); cl_sfx_spark5 = S.RegisterSound("world/spark5.wav"); cl_sfx_spark6 = S.RegisterSound("world/spark6.wav"); cl_sfx_spark7 = S.RegisterSound("world/spark7.wav"); cl_sfx_railg = S.RegisterSound("weapons/railgf1a.wav"); cl_sfx_rockexp = S.RegisterSound("weapons/rocklx1a.wav"); cl_sfx_grenexp = S.RegisterSound("weapons/grenlx1a.wav"); cl_sfx_watrexp = S.RegisterSound("weapons/xpld_wat.wav"); // RAFAEL // cl_sfx_plasexp = S.RegisterSound ("weapons/plasexpl.wav"); S.RegisterSound("player/land1.wav"); S.RegisterSound("player/fall2.wav"); S.RegisterSound("player/fall1.wav"); for (i = 0; i < 4; i++) { //Com_sprintf (name, sizeof(name), "player/step%i.wav", i+1); name = "player/step" + (i + 1) + ".wav"; cl_sfx_footsteps[i] = S.RegisterSound(name); } // PGM cl_sfx_lightning = S.RegisterSound("weapons/tesla.wav"); cl_sfx_disrexp = S.RegisterSound("weapons/disrupthit.wav"); // version stuff // sprintf (name, "weapons/sound%d.wav", ROGUE_VERSION_ID); // if (name[0] == 'w') // name[0] = 'W'; // PGM } /* * ================= CL_RegisterTEntModels ================= */ static void RegisterTEntModels() { cl_mod_explode = Globals.re .RegisterModel("models/objects/explode/tris.md2"); cl_mod_smoke = Globals.re .RegisterModel("models/objects/smoke/tris.md2"); cl_mod_flash = Globals.re .RegisterModel("models/objects/flash/tris.md2"); cl_mod_parasite_segment = Globals.re .RegisterModel("models/monsters/parasite/segment/tris.md2"); cl_mod_grapple_cable = Globals.re .RegisterModel("models/ctf/segment/tris.md2"); cl_mod_parasite_tip = Globals.re .RegisterModel("models/monsters/parasite/tip/tris.md2"); cl_mod_explo4 = Globals.re .RegisterModel("models/objects/r_explode/tris.md2"); cl_mod_bfg_explo = Globals.re.RegisterModel("sprites/s_bfg2.sp2"); cl_mod_powerscreen = Globals.re .RegisterModel("models/items/armor/effect/tris.md2"); Globals.re.RegisterModel("models/objects/laser/tris.md2"); Globals.re.RegisterModel("models/objects/grenade2/tris.md2"); Globals.re.RegisterModel("models/weapons/v_machn/tris.md2"); Globals.re.RegisterModel("models/weapons/v_handgr/tris.md2"); Globals.re.RegisterModel("models/weapons/v_shotg2/tris.md2"); Globals.re.RegisterModel("models/objects/gibs/bone/tris.md2"); Globals.re.RegisterModel("models/objects/gibs/sm_meat/tris.md2"); Globals.re.RegisterModel("models/objects/gibs/bone2/tris.md2"); // RAFAEL // re.RegisterModel ("models/objects/blaser/tris.md2"); Globals.re.RegisterPic("w_machinegun"); Globals.re.RegisterPic("a_bullets"); Globals.re.RegisterPic("i_health"); Globals.re.RegisterPic("a_grenades"); // ROGUE cl_mod_explo4_big = Globals.re .RegisterModel("models/objects/r_explode2/tris.md2"); cl_mod_lightning = Globals.re .RegisterModel("models/proj/lightning/tris.md2"); cl_mod_heatbeam = Globals.re.RegisterModel("models/proj/beam/tris.md2"); cl_mod_monster_heatbeam = Globals.re .RegisterModel("models/proj/widowbeam/tris.md2"); // ROGUE } /* * ================= CL_ClearTEnts ================= */ static void ClearTEnts() { // memset (cl_beams, 0, sizeof(cl_beams)); for (int i = 0; i < cl_beams.length; i++) cl_beams[i].clear(); // memset (cl_explosions, 0, sizeof(cl_explosions)); for (int i = 0; i < cl_explosions.length; i++) cl_explosions[i].clear(); // memset (cl_lasers, 0, sizeof(cl_lasers)); for (int i = 0; i < cl_lasers.length; i++) cl_lasers[i].clear(); // // ROGUE // memset (cl_playerbeams, 0, sizeof(cl_playerbeams)); for (int i = 0; i < cl_playerbeams.length; i++) cl_playerbeams[i].clear(); // memset (cl_sustains, 0, sizeof(cl_sustains)); for (int i = 0; i < cl_sustains.length; i++) cl_sustains[i].clear(); // ROGUE } /* * ================= CL_AllocExplosion ================= */ static explosion_t AllocExplosion() { int i; int time; int index; for (i = 0; i < MAX_EXPLOSIONS; i++) { if (cl_explosions[i].type == ex_free) { //memset (&cl_explosions[i], 0, sizeof (cl_explosions[i])); cl_explosions[i].clear(); return cl_explosions[i]; } } // find the oldest explosion time = Globals.cl.time; index = 0; for (i = 0; i < MAX_EXPLOSIONS; i++) if (cl_explosions[i].start < time) { time = (int) cl_explosions[i].start; index = i; } //memset (&cl_explosions[index], 0, sizeof (cl_explosions[index]));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -