public static void R_StoreEfrags(efrag_t ef) { while (ef != null) { entity_t pent = ef.entity; model_t clmodel = pent.model; switch (clmodel.type) { case modtype_t.mod_alias: case modtype_t.mod_brush: case modtype_t.mod_sprite: if ((pent.visframe != r_framecount) && (cl_numvisedicts < q_shared.MAX_VISEDICTS)) { cl_visedicts[cl_numvisedicts++] = pent; // mark that we've recorded this entity for this frame pent.visframe = r_framecount; } ef = ef.leafnext; break; default: Sys_Error("R_StoreEfrags: Bad entity type {0}\n", clmodel.type); break; } } }
/* =========== R_AddEfrags =========== */ public static void R_AddEfrags(entity_t ent) { model.model_t entmodel; int i; if (ent.model == null) return; if (ent == client.cl_entities[0]) return; // never add the world r_addent = ent; lastlink = null; r_pefragtopnode = null; entmodel = ent.model; for (i = 0; i < 3; i++) { r_emins[i] = ent.origin[i] + entmodel.mins[i]; r_emaxs[i] = ent.origin[i] + entmodel.maxs[i]; } R_SplitEntityOnNode(client.cl.worldmodel.nodes[0]); ent.topnode = r_pefragtopnode; }
/// <summary> /// R_StoreEfrags /// FIXME: a lot of this goes away with edge-based /// </summary> static void StoreEfrags(efrag_t ef) { while (ef != null) { entity_t pent = ef.entity; model_t clmodel = pent.model; switch (clmodel.type) { case modtype_t.mod_alias: case modtype_t.mod_brush: case modtype_t.mod_sprite: if ((pent.visframe != _FrameCount) && (Client.NumVisEdicts < Client.MAX_VISEDICTS)) { Client.VisEdicts[Client.NumVisEdicts++] = pent; // mark that we've recorded this entity for this frame pent.visframe = _FrameCount; } ef = ef.leafnext; break; default: Sys.Error("R_StoreEfrags: Bad entity type {0}\n", clmodel.type); break; } } }
/* * =========== * R_AddEfrags * =========== */ public static void R_AddEfrags(entity_t ent) { model.model_t entmodel; int i; if (ent.model == null) { return; } if (ent == client.cl_entities[0]) { return; // never add the world } r_addent = ent; lastlink = null; r_pefragtopnode = null; entmodel = ent.model; for (i = 0; i < 3; i++) { r_emins[i] = ent.origin[i] + entmodel.mins[i]; r_emaxs[i] = ent.origin[i] + entmodel.maxs[i]; } R_SplitEntityOnNode(client.cl.worldmodel.nodes[0]); ent.topnode = r_pefragtopnode; }
// CL_Init public static void Init() { InitInput(); InitTempEntities(); if (_Name == null) { _Name = new Cvar("_cl_name", "player", true); _Color = new Cvar("_cl_color", "0", true); _ShowNet = new Cvar("cl_shownet", "0"); // can be 0, 1, or 2 _NoLerp = new Cvar("cl_nolerp", "0"); _LookSpring = new Cvar("lookspring", "0", true); _LookStrafe = new Cvar("lookstrafe", "0", true); _Sensitivity = new Cvar("sensitivity", "3", true); _MPitch = new Cvar("m_pitch", "0.022", true); _MYaw = new Cvar("m_yaw", "0.022", true); _MForward = new Cvar("m_forward", "1", true); _MSide = new Cvar("m_side", "0.8", true); _UpSpeed = new Cvar("cl_upspeed", "200"); _ForwardSpeed = new Cvar("cl_forwardspeed", "200", true); _BackSpeed = new Cvar("cl_backspeed", "200", true); _SideSpeed = new Cvar("cl_sidespeed", "350"); _MoveSpeedKey = new Cvar("cl_movespeedkey", "2.0"); _YawSpeed = new Cvar("cl_yawspeed", "140"); _PitchSpeed = new Cvar("cl_pitchspeed", "150"); _AngleSpeedKey = new Cvar("cl_anglespeedkey", "1.5"); } for (int i = 0; i < _EFrags.Length; i++) { _EFrags[i] = new efrag_t(); } for (int i = 0; i < _Entities.Length; i++) { _Entities[i] = new entity_t(); } for (int i = 0; i < _StaticEntities.Length; i++) { _StaticEntities[i] = new entity_t(); } for (int i = 0; i < _DLights.Length; i++) { _DLights[i] = new dlight_t(); } // // register our commands // Cmd.Add("entities", PrintEntities_f); Cmd.Add("disconnect", Disconnect_f); Cmd.Add("record", Record_f); Cmd.Add("stop", Stop_f); Cmd.Add("playdemo", PlayDemo_f); Cmd.Add("timedemo", TimeDemo_f); }
public static void CL_Init() { CL_InitInput(); CL_InitTEnts(); cl_name = new cvar_t("_cl_name", "player", true); cl_color = new cvar_t("_cl_color", "0", true); cl_shownet = new cvar_t("cl_shownet", "0"); // can be 0, 1, or 2 cl_nolerp = new cvar_t("cl_nolerp", "0"); lookspring = new cvar_t("lookspring", "0", true); lookstrafe = new cvar_t("lookstrafe", "0", true); sensitivity = new cvar_t("sensitivity", "3", true); m_pitch = new cvar_t("m_pitch", "0.022", true); m_yaw = new cvar_t("m_yaw", "0.022", true); m_forward = new cvar_t("m_forward", "1", true); m_side = new cvar_t("m_side", "0.8", true); cl_upspeed = new cvar_t("cl_upspeed", "200"); cl_forwardspeed = new cvar_t("cl_forwardspeed", "200", true); cl_backspeed = new cvar_t("cl_backspeed", "200", true); cl_sidespeed = new cvar_t("cl_sidespeed", "350"); cl_movespeedkey = new cvar_t("cl_movespeedkey", "2.0"); cl_yawspeed = new cvar_t("cl_yawspeed", "140"); cl_pitchspeed = new cvar_t("cl_pitchspeed", "150"); cl_anglespeedkey = new cvar_t("cl_anglespeedkey", "1.5"); for (int i = 0; i < cl_efrags.Length; i++) { cl_efrags[i] = new efrag_t(); } for (int i = 0; i < cl_entities.Length; i++) { cl_entities[i] = new entity_t(); } for (int i = 0; i < cl_static_entities.Length; i++) { cl_static_entities[i] = new entity_t(); } for (int i = 0; i < cl_dlights.Length; i++) { cl_dlights[i] = new dlight_t(); } // // register our commands // Cmd_AddCommand("entities", CL_PrintEntities_f); Cmd_AddCommand("disconnect", CL_Disconnect_f); Cmd_AddCommand("record", CL_Record_f); Cmd_AddCommand("stop", CL_Stop_f); Cmd_AddCommand("playdemo", CL_PlayDemo_f); Cmd_AddCommand("timedemo", CL_TimeDemo_f); }
/* * ================ * R_StoreEfrags * * // FIXME: a lot of this goes away with edge-based * ================ */ static void R_StoreEfrags(ref efrag_t ppefrag) { entity_t pent; model.model_t clmodel; efrag_t pefrag; while ((pefrag = ppefrag) != null) { pent = pefrag.entity; clmodel = pent.model; switch (clmodel.type) { case model.modtype_t.mod_alias: case model.modtype_t.mod_brush: case model.modtype_t.mod_sprite: pent = pefrag.entity; if ((pent.visframe != r_framecount) && (client.cl_numvisedicts < client.MAX_VISEDICTS)) { client.cl_visedicts[client.cl_numvisedicts++] = pent; // mark that we've recorded this entity for this frame pent.visframe = r_framecount; } ppefrag = pefrag.leafnext; break; default: sys_linux.Sys_Error("R_StoreEfrags: Bad entity type " + clmodel.type + "\n"); break; } } }
public static void R_RemoveEfrags(entity_t ent) { efrag_t ef = ent.efrag; while (ef != null) { mleaf_t leaf = ef.leaf; while (true) { efrag_t walk = leaf.efrags; if (walk == null) { break; } if (walk == ef) { // remove this fragment leaf.efrags = ef.leafnext; break; } else { leaf = (mleaf_t)(object)walk.leafnext; } } efrag_t old = ef; ef = ef.entnext; // put it on the free list old.entnext = cl.free_efrags; cl.free_efrags = old; } ent.efrag = null; }
/* ================ R_StoreEfrags // FIXME: a lot of this goes away with edge-based ================ */ static void R_StoreEfrags(ref efrag_t ppefrag) { entity_t pent; model.model_t clmodel; efrag_t pefrag; while ((pefrag = ppefrag) != null) { pent = pefrag.entity; clmodel = pent.model; switch (clmodel.type) { case model.modtype_t.mod_alias: case model.modtype_t.mod_brush: case model.modtype_t.mod_sprite: pent = pefrag.entity; if ((pent.visframe != r_framecount) && (client.cl_numvisedicts < client.MAX_VISEDICTS)) { client.cl_visedicts[client.cl_numvisedicts++] = pent; // mark that we've recorded this entity for this frame pent.visframe = r_framecount; } ppefrag = pefrag.leafnext; break; default: sys_linux.Sys_Error("R_StoreEfrags: Bad entity type " + clmodel.type + "\n"); break; } } }
/* =================== R_SplitEntityOnNode =================== */ static void R_SplitEntityOnNode(model.node_or_leaf_t node) { efrag_t ef; model.mplane_t splitplane; model.mleaf_t leaf; int sides; if (node.contents == bspfile.CONTENTS_SOLID) { return; } // add an efrag if the node is a leaf if (node.contents < 0) { if (r_pefragtopnode == null) r_pefragtopnode = node; leaf = (model.mleaf_t)node; // grab an efrag off the free list ef = client.cl.free_efrags; if (ef == null) { console.Con_Printf("Too many efrags!\n"); return; // no free fragments... } client.cl.free_efrags = client.cl.free_efrags.entnext; ef.entity = r_addent; // add the entity link if (lastlink == null) r_addent.efrag = ef; else lastlink.entnext = ef; lastlink = ef; ef.entnext = null; // set the leaf links ef.leaf = leaf; ef.leafnext = leaf.efrags; leaf.efrags = ef; return; } // NODE_MIXED model.mnode_t _node = (model.mnode_t)node; splitplane = _node.plane; sides = mathlib.BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); if (sides == 3) { // split on this plane // if this is the first splitter of this bmodel, remember it if (r_pefragtopnode == null) r_pefragtopnode = node; } // recurse down the contacted sides if ((sides & 1) != 0) R_SplitEntityOnNode(_node.children[0]); if ((sides & 2) != 0) R_SplitEntityOnNode(_node.children[1]); }
public void Clear() { this.movemessages = 0; this.cmd.Clear(); Array.Clear(this.stats, 0, this.stats.Length); this.items = 0; Array.Clear(this.item_gettime, 0, this.item_gettime.Length); this.faceanimtime = 0; foreach (cshift_t cs in this.cshifts) { cs.Clear(); } foreach (cshift_t cs in this.prev_cshifts) { cs.Clear(); } this.mviewangles[0] = Vector3.Zero; this.mviewangles[1] = Vector3.Zero; this.viewangles = Vector3.Zero; this.mvelocity[0] = Vector3.Zero; this.mvelocity[1] = Vector3.Zero; this.velocity = Vector3.Zero; this.punchangle = Vector3.Zero; this.idealpitch = 0; this.pitchvel = 0; this.nodrift = false; this.driftmove = 0; this.laststop = 0; this.viewheight = 0; this.crouch = 0; this.paused = false; this.onground = false; this.inwater = false; this.intermission = 0; this.completed_time = 0; this.mtime[0] = 0; this.mtime[1] = 0; this.time = 0; this.oldtime = 0; this.last_received_message = 0; Array.Clear(this.model_precache, 0, this.model_precache.Length); Array.Clear(this.sound_precache, 0, this.sound_precache.Length); this.levelname = null; this.viewentity = 0; this.maxclients = 0; this.gametype = 0; this.worldmodel = null; this.free_efrags = null; this.num_entities = 0; this.num_statics = 0; this.viewent.Clear(); this.cdtrack = 0; this.looptrack = 0; this.scores = null; }
/// <summary> /// R_SplitEntityOnNode /// </summary> static void SplitEntityOnNode(mnodebase_t node) { if (node.contents == Contents.CONTENTS_SOLID) { return; } // add an efrag if the node is a leaf if (node.contents < 0) { if (_EfragTopNode == null) { _EfragTopNode = node as mnode_t; } mleaf_t leaf = (mleaf_t)(object)node; // grab an efrag off the free list efrag_t ef = Client.cl.free_efrags; if (ef == null) { Con.Print("Too many efrags!\n"); return; // no free fragments... } Client.cl.free_efrags = Client.cl.free_efrags.entnext; ef.entity = _AddEnt; // add the entity link // *lastlink = ef; if (_LastObj is entity_t) { ((entity_t)_LastObj).efrag = ef; } else { ((efrag_t)_LastObj).entnext = ef; } _LastObj = ef; // lastlink = &ef->entnext; ef.entnext = null; // set the leaf links ef.leaf = leaf; ef.leafnext = leaf.efrags; leaf.efrags = ef; return; } // NODE_MIXED mnode_t n = node as mnode_t; if (n == null) { return; } mplane_t splitplane = n.plane; int sides = Mathlib.BoxOnPlaneSide(ref _EMins, ref _EMaxs, splitplane); if (sides == 3) { // split on this plane // if this is the first splitter of this bmodel, remember it if (_EfragTopNode == null) { _EfragTopNode = n; } } // recurse down the contacted sides if ((sides & 1) != 0) { SplitEntityOnNode(n.children[0]); } if ((sides & 2) != 0) { SplitEntityOnNode(n.children[1]); } }
/* * =================== * R_SplitEntityOnNode * =================== */ static void R_SplitEntityOnNode(model.node_or_leaf_t node) { efrag_t ef; model.mplane_t splitplane; model.mleaf_t leaf; int sides; if (node.contents == bspfile.CONTENTS_SOLID) { return; } // add an efrag if the node is a leaf if (node.contents < 0) { if (r_pefragtopnode == null) { r_pefragtopnode = node; } leaf = (model.mleaf_t)node; // grab an efrag off the free list ef = client.cl.free_efrags; if (ef == null) { console.Con_Printf("Too many efrags!\n"); return; // no free fragments... } client.cl.free_efrags = client.cl.free_efrags.entnext; ef.entity = r_addent; // add the entity link if (lastlink == null) { r_addent.efrag = ef; } else { lastlink.entnext = ef; } lastlink = ef; ef.entnext = null; // set the leaf links ef.leaf = leaf; ef.leafnext = leaf.efrags; leaf.efrags = ef; return; } // NODE_MIXED model.mnode_t _node = (model.mnode_t)node; splitplane = _node.plane; sides = mathlib.BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); if (sides == 3) { // split on this plane // if this is the first splitter of this bmodel, remember it if (r_pefragtopnode == null) { r_pefragtopnode = node; } } // recurse down the contacted sides if ((sides & 1) != 0) { R_SplitEntityOnNode(_node.children[0]); } if ((sides & 2) != 0) { R_SplitEntityOnNode(_node.children[1]); } }