⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cl_ents.java

📁 Jake2是一个Java 3D游戏引擎.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
				/*				 * PMM - at this point, all of the shells have been handled if				 * we're in the rogue pack, set up the custom mixing, otherwise				 * just keep going if(Developer_searchpath(2) == 2) { all of the				 * solo colors are fine. we need to catch any of the				 * combinations that look bad (double & half) and turn them into				 * the appropriate color, and make double/quad something special				 *  				 */				if ((renderfx & Defines.RF_SHELL_HALF_DAM) != 0) {					if (FS.Developer_searchpath(2) == 2) {						// ditch the half damage shell if any of red, blue, or						// double are on						if ((renderfx & (Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0)							renderfx &= ~Defines.RF_SHELL_HALF_DAM;					}				}				if ((renderfx & Defines.RF_SHELL_DOUBLE) != 0) {					if (FS.Developer_searchpath(2) == 2) {						// lose the yellow shell if we have a red, blue, or						// green shell						if ((renderfx & (Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_GREEN)) != 0)							renderfx &= ~Defines.RF_SHELL_DOUBLE;						// if we have a red shell, turn it to purple by adding						// blue						if ((renderfx & Defines.RF_SHELL_RED) != 0)							renderfx |= Defines.RF_SHELL_BLUE;						// if we have a blue shell (and not a red shell), turn						// it to cyan by adding green						else if ((renderfx & Defines.RF_SHELL_BLUE) != 0)							// go to green if it's on already, otherwise do cyan							// (flash green)							if ((renderfx & Defines.RF_SHELL_GREEN) != 0)								renderfx &= ~Defines.RF_SHELL_BLUE;							else								renderfx |= Defines.RF_SHELL_GREEN;					}				}				//				}				// pmm				ent.flags = renderfx | Defines.RF_TRANSLUCENT;				ent.alpha = 0.30f;				V.AddEntity(ent);			}			ent.skin = null; // never use a custom skin on others			ent.skinnum = 0;			ent.flags = 0;			ent.alpha = 0;			// duplicate for linked models			if (s1.modelindex2 != 0) {				if (s1.modelindex2 == 255) { // custom weapon					ci = Globals.cl.clientinfo[s1.skinnum & 0xff];					i = (s1.skinnum >> 8); // 0 is default weapon model					if (0 == Globals.cl_vwep.value || i > Defines.MAX_CLIENTWEAPONMODELS - 1)						i = 0;					ent.model = ci.weaponmodel[i];					if (null == ent.model) {						if (i != 0)							ent.model = ci.weaponmodel[0];						if (null == ent.model)							ent.model = Globals.cl.baseclientinfo.weaponmodel[0];					}				} else					ent.model = Globals.cl.model_draw[s1.modelindex2];				// PMM - check for the defender sphere shell .. make it				// translucent				// replaces the previous version which used the high bit on				// modelindex2 to determine transparency				if (Globals.cl.configstrings[Defines.CS_MODELS + (s1.modelindex2)].equalsIgnoreCase("models/items/shell/tris.md2")) {					ent.alpha = 0.32f;					ent.flags = Defines.RF_TRANSLUCENT;				}				// pmm				V.AddEntity(ent);				//PGM - make sure these get reset.				ent.flags = 0;				ent.alpha = 0;				//PGM			}			if (s1.modelindex3 != 0) {				ent.model = Globals.cl.model_draw[s1.modelindex3];				V.AddEntity(ent);			}			if (s1.modelindex4 != 0) {				ent.model = Globals.cl.model_draw[s1.modelindex4];				V.AddEntity(ent);			}			if ((effects & Defines.EF_POWERSCREEN) != 0) {				ent.model = CL_tent.cl_mod_powerscreen;				ent.oldframe = 0;				ent.frame = 0;				ent.flags |= (Defines.RF_TRANSLUCENT | Defines.RF_SHELL_GREEN);				ent.alpha = 0.30f;				V.AddEntity(ent);			}			// add automatic particle trails			if ((effects & ~Defines.EF_ROTATE) != 0) {				if ((effects & Defines.EF_ROCKET) != 0) {					CL_fx.RocketTrail(cent.lerp_origin, ent.origin, cent);					V.AddLight(ent.origin, 200, 1, 1, 0);				}				// PGM - Do not reorder EF_BLASTER and EF_HYPERBLASTER.				// EF_BLASTER | EF_TRACKER is a special case for EF_BLASTER2...				// Cheese!				else if ((effects & Defines.EF_BLASTER) != 0) {					//					CL_BlasterTrail (cent.lerp_origin, ent.origin);					//	  PGM					if ((effects & Defines.EF_TRACKER) != 0) // lame...															 // problematic?					{						CL_newfx.BlasterTrail2(cent.lerp_origin, ent.origin);						V.AddLight(ent.origin, 200, 0, 1, 0);					} else {						CL_fx.BlasterTrail(cent.lerp_origin, ent.origin);						V.AddLight(ent.origin, 200, 1, 1, 0);					}					//	  PGM				} else if ((effects & Defines.EF_HYPERBLASTER) != 0) {					if ((effects & Defines.EF_TRACKER) != 0) // PGM overloaded															 // for blaster2.						V.AddLight(ent.origin, 200, 0, 1, 0); // PGM					else						// PGM						V.AddLight(ent.origin, 200, 1, 1, 0);				} else if ((effects & Defines.EF_GIB) != 0) {					CL_fx.DiminishingTrail(cent.lerp_origin, ent.origin, cent, effects);				} else if ((effects & Defines.EF_GRENADE) != 0) {					CL_fx.DiminishingTrail(cent.lerp_origin, ent.origin, cent, effects);				} else if ((effects & Defines.EF_FLIES) != 0) {					CL_fx.FlyEffect(cent, ent.origin);				} else if ((effects & Defines.EF_BFG) != 0) {					if ((effects & Defines.EF_ANIM_ALLFAST) != 0) {						CL_fx.BfgParticles(ent);						i = 200;					} else {						i = bfg_lightramp[s1.frame];					}					V.AddLight(ent.origin, i, 0, 1, 0);				}				// RAFAEL				else if ((effects & Defines.EF_TRAP) != 0) {					ent.origin[2] += 32;					CL_fx.TrapParticles(ent);					i = (Globals.rnd.nextInt(100)) + 100;					V.AddLight(ent.origin, i, 1, 0.8f, 0.1f);				} else if ((effects & Defines.EF_FLAG1) != 0) {					CL_fx.FlagTrail(cent.lerp_origin, ent.origin, 242);					V.AddLight(ent.origin, 225, 1, 0.1f, 0.1f);				} else if ((effects & Defines.EF_FLAG2) != 0) {					CL_fx.FlagTrail(cent.lerp_origin, ent.origin, 115);					V.AddLight(ent.origin, 225, 0.1f, 0.1f, 1);				}				//	  ======				//	  ROGUE				else if ((effects & Defines.EF_TAGTRAIL) != 0) {					CL_newfx.TagTrail(cent.lerp_origin, ent.origin, 220);					V.AddLight(ent.origin, 225, 1.0f, 1.0f, 0.0f);				} else if ((effects & Defines.EF_TRACKERTRAIL) != 0) {					if ((effects & Defines.EF_TRACKER) != 0) {						float intensity;						intensity = (float) (50 + (500 * (Math.sin(Globals.cl.time / 500.0) + 1.0)));						// FIXME - check out this effect in rendition						if (Globals.vidref_val == Defines.VIDREF_GL)							V.AddLight(ent.origin, intensity, -1.0f, -1.0f, -1.0f);						else							V.AddLight(ent.origin, -1.0f * intensity, 1.0f, 1.0f, 1.0f);					} else {						CL_newfx.Tracker_Shell(cent.lerp_origin);						V.AddLight(ent.origin, 155, -1.0f, -1.0f, -1.0f);					}				} else if ((effects & Defines.EF_TRACKER) != 0) {					CL_newfx.TrackerTrail(cent.lerp_origin, ent.origin, 0);					// FIXME - check out this effect in rendition					if (Globals.vidref_val == Defines.VIDREF_GL)						V.AddLight(ent.origin, 200, -1, -1, -1);					else						V.AddLight(ent.origin, -200, 1, 1, 1);				}				//	  ROGUE				//	  ======				// RAFAEL				else if ((effects & Defines.EF_GREENGIB) != 0) {					CL_fx.DiminishingTrail(cent.lerp_origin, ent.origin, cent, effects);				}				// RAFAEL				else if ((effects & Defines.EF_IONRIPPER) != 0) {					CL_fx.IonripperTrail(cent.lerp_origin, ent.origin);					V.AddLight(ent.origin, 100, 1, 0.5f, 0.5f);				}				// RAFAEL				else if ((effects & Defines.EF_BLUEHYPERBLASTER) != 0) {					V.AddLight(ent.origin, 200, 0, 0, 1);				}				// RAFAEL				else if ((effects & Defines.EF_PLASMA) != 0) {					if ((effects & Defines.EF_ANIM_ALLFAST) != 0) {						CL_fx.BlasterTrail(cent.lerp_origin, ent.origin);					}					V.AddLight(ent.origin, 130, 1, 0.5f, 0.5f);				}			}			Math3D.VectorCopy(ent.origin, cent.lerp_origin);		}	}		// stack variable	private static final entity_t gun = new entity_t();	/*	 * ============== CL_AddViewWeapon ==============	 */	static void AddViewWeapon(player_state_t ps, player_state_t ops) {		int i;		// allow the gun to be completely removed		if (0 == Globals.cl_gun.value)			return;		// don't draw gun if in wide angle view		if (ps.fov > 90)			return;		//memset( gun, 0, sizeof(gun));		gun.clear();		if (Globals.gun_model != null)			gun.model = Globals.gun_model; // development tool		else			gun.model = Globals.cl.model_draw[ps.gunindex];		if (gun.model == null)			return;		// set up gun position		for (i = 0; i < 3; i++) {			gun.origin[i] = Globals.cl.refdef.vieworg[i] + ops.gunoffset[i] + Globals.cl.lerpfrac					* (ps.gunoffset[i] - ops.gunoffset[i]);			gun.angles[i] = Globals.cl.refdef.viewangles[i] + Math3D.LerpAngle(ops.gunangles[i], ps.gunangles[i], Globals.cl.lerpfrac);		}		if (Globals.gun_frame != 0) {			gun.frame = Globals.gun_frame; // development tool			gun.oldframe = Globals.gun_frame; // development tool		} else {			gun.frame = ps.gunframe;			if (gun.frame == 0)				gun.oldframe = 0; // just changed weapons, don't lerp from old			else				gun.oldframe = ops.gunframe;		}		gun.flags = Defines.RF_MINLIGHT | Defines.RF_DEPTHHACK | Defines.RF_WEAPONMODEL;		gun.backlerp = 1.0f - Globals.cl.lerpfrac;		Math3D.VectorCopy(gun.origin, gun.oldorigin); // don't lerp at all		V.AddEntity(gun);	}	/*	 * =============== CL_CalcViewValues	 * 	 * Sets cl.refdef view values ===============	 */	static void CalcViewValues() {		int i;		float lerp, backlerp;		frame_t oldframe;		player_state_t ps, ops;		// find the previous frame to interpolate from		ps = Globals.cl.frame.playerstate;		i = (Globals.cl.frame.serverframe - 1) & Defines.UPDATE_MASK;		oldframe = Globals.cl.frames[i];		if (oldframe.serverframe != Globals.cl.frame.serverframe - 1 || !oldframe.valid)			oldframe = Globals.cl.frame; // previous frame was dropped or										 // involid		ops = oldframe.playerstate;		// see if the player entity was teleported this frame		if (Math.abs(ops.pmove.origin[0] - ps.pmove.origin[0]) > 256 * 8				|| Math.abs(ops.pmove.origin[1] - ps.pmove.origin[1]) > 256 * 8				|| Math.abs(ops.pmove.origin[2] - ps.pmove.origin[2]) > 256 * 8)			ops = ps; // don't interpolate		lerp = Globals.cl.lerpfrac;		// calculate the origin		if ((Globals.cl_predict.value != 0) && 0 == (Globals.cl.frame.playerstate.pmove.pm_flags & pmove_t.PMF_NO_PREDICTION)) { // use																																 // predicted																																 // values			int delta;			backlerp = 1.0f - lerp;			for (i = 0; i < 3; i++) {				Globals.cl.refdef.vieworg[i] = Globals.cl.predicted_origin[i] + ops.viewoffset[i] + Globals.cl.lerpfrac						* (ps.viewoffset[i] - ops.viewoffset[i]) - backlerp * Globals.cl.prediction_error[i];			}			// smooth out stair climbing			delta = (int) (Globals.cls.realtime - Globals.cl.predicted_step_time);			if (delta < 100)				Globals.cl.refdef.vieworg[2] -= Globals.cl.predicted_step * (100 - delta) * 0.01;		} else { // just use interpolated values			for (i = 0; i < 3; i++)				Globals.cl.refdef.vieworg[i] = ops.pmove.origin[i] * 0.125f + ops.viewoffset[i] + lerp						* (ps.pmove.origin[i] * 0.125f + ps.viewoffset[i] - (ops.pmove.origin[i] * 0.125f + ops.viewoffset[i]));		}		// if not running a demo or on a locked frame, add the local angle		// movement		if (Globals.cl.frame.playerstate.pmove.pm_type < Defines.PM_DEAD) { // use																			// predicted																			// values			for (i = 0; i < 3; i++)				Globals.cl.refdef.viewangles[i] = Globals.cl.predicted_angles[i];		} else { // just use interpolated values			for (i = 0; i < 3; i++)				Globals.cl.refdef.viewangles[i] = Math3D.LerpAngle(ops.viewangles[i], ps.viewangles[i], lerp);		}		for (i = 0; i < 3; i++)			Globals.cl.refdef.viewangles[i] += Math3D.LerpAngle(ops.kick_angles[i], ps.kick_angles[i], lerp);		Math3D.AngleVectors(Globals.cl.refdef.viewangles, Globals.cl.v_forward, Globals.cl.v_right, Globals.cl.v_up);		// interpolate field of view		Globals.cl.refdef.fov_x = ops.fov + lerp * (ps.fov - ops.fov);		// don't interpolate blend color		for (i = 0; i < 4; i++)			Globals.cl.refdef.blend[i] = ps.blend[i];		// add the weapon		AddViewWeapon(ps, ops);	}	/*	 * =============== CL_AddEntities	 * 	 * Emits all entities, particles, and lights to the refresh ===============	 */	static void AddEntities() {		if (Globals.cls.state != Defines.ca_active)			return;		if (Globals.cl.time > Globals.cl.frame.servertime) {			if (Globals.cl_showclamp.value != 0)				Com.Printf("high clamp " + (Globals.cl.time - Globals.cl.frame.servertime) + "\n");			Globals.cl.time = Globals.cl.frame.servertime;			Globals.cl.lerpfrac = 1.0f;		} else if (Globals.cl.time < Globals.cl.frame.servertime - 100) {			if (Globals.cl_showclamp.value != 0)				Com.Printf("low clamp " + (Globals.cl.frame.servertime - 100 - Globals.cl.time) + "\n");			Globals.cl.time = Globals.cl.frame.servertime - 100;			Globals.cl.lerpfrac = 0;		} else			Globals.cl.lerpfrac = 1.0f - (Globals.cl.frame.servertime - Globals.cl.time) * 0.01f;		if (Globals.cl_timedemo.value != 0)			Globals.cl.lerpfrac = 1.0f;		/*		 * is ok.. CL_AddPacketEntities (cl.frame); CL_AddTEnts ();		 * CL_AddParticles (); CL_AddDLights (); CL_AddLightStyles ();		 */		CalcViewValues();		// PMM - moved this here so the heat beam has the right values for the		// vieworg, and can lock the beam to the gun		AddPacketEntities(Globals.cl.frame);		CL_tent.AddTEnts();		CL_fx.AddParticles();		CL_fx.AddDLights();		CL_fx.AddLightStyles();	}	/*	 * =============== CL_GetEntitySoundOrigin	 * 	 * Called to get the sound spatialization origin ===============	 */	public static void GetEntitySoundOrigin(int ent, float[] org) {		centity_t old;		if (ent < 0 || ent >= Defines.MAX_EDICTS)			Com.Error(Defines.ERR_DROP, "CL_GetEntitySoundOrigin: bad ent");		old = Globals.cl_entities[ent];		Math3D.VectorCopy(old.lerp_origin, org);		// FIXME: bmodel issues...	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -