static client() { int kk; for (kk = 0; kk < MAX_EFRAGS; kk++) { cl_efrags[kk] = new render.efrag_t(); } for (kk = 0; kk < quakedef.MAX_EDICTS; kk++) { cl_entities[kk] = new render.entity_t(); } for (kk = 0; kk < MAX_STATIC_ENTITIES; kk++) { cl_static_entities[kk] = new render.entity_t(); } for (kk = 0; kk < MAX_TEMP_ENTITIES; kk++) { cl_temp_entities[kk] = new render.entity_t(); } for (kk = 0; kk < quakedef.MAX_LIGHTSTYLES; kk++) { cl_lightstyle[kk] = new lightstyle_t(); } for (kk = 0; kk < MAX_DLIGHTS; kk++) { cl_dlights[kk] = new dlight_t(); } for (kk = 0; kk < MAX_BEAMS; kk++) { cl_beams[kk] = new beam_t(); } }
static client() { int kk; for (kk = 0; kk < MAX_EFRAGS; kk++) cl_efrags[kk] = new render.efrag_t(); for (kk = 0; kk < quakedef.MAX_EDICTS; kk++) cl_entities[kk] = new render.entity_t(); for (kk = 0; kk < MAX_STATIC_ENTITIES; kk++) cl_static_entities[kk] = new render.entity_t(); for (kk = 0; kk < MAX_TEMP_ENTITIES; kk++) cl_temp_entities[kk] = new render.entity_t(); for (kk = 0; kk < quakedef.MAX_LIGHTSTYLES; kk++) cl_lightstyle[kk] = new lightstyle_t(); for (kk = 0; kk < MAX_DLIGHTS; kk++) cl_dlights[kk] = new dlight_t(); for (kk = 0; kk < MAX_BEAMS; kk++) cl_beams[kk] = new beam_t(); }
public static void CL_InitTEnts() { cl_sfx_wizhit = S_PrecacheSound("wizard/hit.wav"); cl_sfx_knighthit = S_PrecacheSound("hknight/hit.wav"); cl_sfx_tink1 = S_PrecacheSound("weapons/tink1.wav"); cl_sfx_ric1 = S_PrecacheSound("weapons/ric1.wav"); cl_sfx_ric2 = S_PrecacheSound("weapons/ric2.wav"); cl_sfx_ric3 = S_PrecacheSound("weapons/ric3.wav"); cl_sfx_r_exp3 = S_PrecacheSound("weapons/r_exp3.wav"); for (int i = 0; i < cl_temp_entities.Length; i++) { cl_temp_entities[i] = new entity_t(); } for (int i = 0; i < cl_beams.Length; i++) { cl_beams[i] = new beam_t(); } }
public static void CL_ParseBeam(model_t m) { int ent = Reader.MSG_ReadShort(); Vector3 start = Reader.ReadCoords(); Vector3 end = Reader.ReadCoords(); // override any beam with the same entity for (int i = 0; i < q_shared.MAX_BEAMS; i++) { beam_t b = cl_beams[i]; if (b.entity == ent) { b.entity = ent; b.model = m; b.endtime = (float)(cl.time + 0.2); b.start = start; b.end = end; return; } } // find a free beam for (int i = 0; i < q_shared.MAX_BEAMS; i++) { beam_t b = cl_beams[i]; if (b.model == null || b.endtime < cl.time) { b.entity = ent; b.model = m; b.endtime = (float)(cl.time + 0.2); b.start = start; b.end = end; return; } } Con_Printf("beam list overflow!\n"); }
public static void CL_UpdateTEnts() { num_temp_entities = 0; // update lightning for (int i = 0; i < q_shared.MAX_BEAMS; i++) { beam_t b = cl_beams[i]; if (b.model == null || b.endtime < cl.time) { continue; } // if coming from the player, update the start position if (b.entity == cl.viewentity) { b.start = cl_entities[cl.viewentity].origin; } // calculate pitch and yaw Vector3 dist = b.end - b.start; float yaw, pitch, forward; if (dist.Y == 0 && dist.X == 0) { yaw = 0; if (dist.Z > 0) { pitch = 90; } else { pitch = 270; } } else { yaw = (int)(Math.Atan2(dist.Y, dist.X) * 180 / Math.PI); if (yaw < 0) { yaw += 360; } forward = (float)Math.Sqrt(dist.X * dist.X + dist.Y * dist.Y); pitch = (int)(Math.Atan2(dist.Z, forward) * 180 / Math.PI); if (pitch < 0) { pitch += 360; } } // add new entities for the lightning Vector3 org = b.start; float d = Mathlib.Normalize(ref dist); while (d > 0) { entity_t ent = CL_NewTempEntity(); if (ent == null) { return; } ent.origin = org; ent.model = b.model; ent.angles.X = pitch; ent.angles.Y = yaw; ent.angles.Z = Random() % 360; org += dist * 30; // Uze: is this code bug (i is outer loop variable!!!) or what?????????????? //for (i=0 ; i<3 ; i++) // org[i] += dist[i]*30; d -= 30; } } }