X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=cl_main.c;h=94f52fe8757d1f22958e87772eb8f9ebdefba8b6;hb=deedc73420b17742f8a9bb1c5158fca5c0896240;hp=8f3e00b274127c21f2970451eb44eb5d922da1b6;hpb=eb3aa49bcc51a01aff898d29ef285dbc4637eb99;p=xonotic%2Fdarkplaces.git diff --git a/cl_main.c b/cl_main.c index 8f3e00b2..94f52fe8 100644 --- a/cl_main.c +++ b/cl_main.c @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t cl_shownet = {0, "cl_shownet","0"}; cvar_t cl_nolerp = {0, "cl_nolerp", "0"}; -cvar_t cl_itembobheight = {0, "cl_itembobheight", "8"}; +cvar_t cl_itembobheight = {0, "cl_itembobheight", "0"}; // try 8 cvar_t cl_itembobspeed = {0, "cl_itembobspeed", "0.5"}; cvar_t lookspring = {CVAR_SAVE, "lookspring","0"}; @@ -112,7 +112,7 @@ void CL_ClearState(void) // wipe the entire cl structure memset (&cl, 0, sizeof(cl)); // reset the view zoom interpolation - cl.viewzoomold = cl.viewzoomnew = 1; + cl.mviewzoom[0] = cl.mviewzoom[1] = 1; SZ_Clear (&cls.message); @@ -233,7 +233,7 @@ void CL_EstablishConnection(const char *host) CL_Disconnect(); NetConn_ClientFrame(); NetConn_ServerFrame(); - + if (LHNETADDRESS_FromString(&cls.connect_address, host, 26000) && (cls.connect_mysocket = NetConn_ChooseClientSocketForAddress(&cls.connect_address))) { cls.connect_trying = true; @@ -560,17 +560,18 @@ void CL_LinkNetworkEntity(entity_t *e) e->render.flags |= t->render.flags & RENDER_EXTERIORMODEL; // if a valid tagindex is used, make it relative to that tag instead // FIXME: use a model function to get tag info (need to handle skeletal) - if (e->state_current.tagentity && e->state_current.tagindex >= 1 && (model = t->render.model) && e->state_current.tagindex <= t->render.model->alias.aliasnum_tags) + if (e->state_current.tagentity && e->state_current.tagindex >= 1 && (model = t->render.model)) { // blend the matrices memset(&blendmatrix, 0, sizeof(blendmatrix)); for (j = 0;j < 4 && t->render.frameblend[j].lerp > 0;j++) { - matrix = &t->render.model->alias.aliasdata_tags[t->render.frameblend[j].frame * t->render.model->alias.aliasnum_tags + (e->state_current.tagindex - 1)].matrix; + matrix4x4_t tagmatrix; + Mod_Alias_GetTagMatrix(model, t->render.frameblend[j].frame, e->state_current.tagindex - 1, &tagmatrix); d = t->render.frameblend[j].lerp; for (l = 0;l < 4;l++) for (k = 0;k < 4;k++) - blendmatrix.m[l][k] += d * matrix->m[l][k]; + blendmatrix.m[l][k] += d * tagmatrix.m[l][k]; } // concat the tag matrices onto the entity matrix Matrix4x4_Concat(&tempmatrix, &t->render.matrix, &blendmatrix); @@ -959,10 +960,11 @@ static void CL_RelinkNetworkEntities(void) // start on the entity after the world entitylinkframenumber++; - for (i = 1, ent = cl_entities + 1;i < MAX_EDICTS;i++, ent++) + for (i = 1;i < MAX_EDICTS;i++) { if (cl_entities_active[i]) { + ent = cl_entities + i; if (ent->state_current.active) CL_LinkNetworkEntity(ent); else @@ -1145,10 +1147,13 @@ void CL_LerpPlayer(float frac) int i; float d; - cl.viewzoom = cl.viewzoomold + frac * (cl.viewzoomnew - cl.viewzoomold); - + cl.viewzoom = cl.mviewzoom[1] + frac * (cl.mviewzoom[0] - cl.mviewzoom[1]); for (i = 0;i < 3;i++) + { + cl.punchangle[i] = cl.mpunchangle[1][i] + frac * (cl.mpunchangle[0][i] - cl.mpunchangle[1][i]); + cl.punchvector[i] = cl.mpunchvector[1][i] + frac * (cl.mpunchvector[0][i] - cl.mpunchvector[1][i]); cl.velocity[i] = cl.mvelocity[1][i] + frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]); + } if (cls.demoplayback) { @@ -1300,6 +1305,23 @@ static void CL_TimeRefresh_f (void) Con_Printf("%f seconds (%f fps)\n", timedelta, 128/timedelta); } +/* +=========== +CL_Shutdown +=========== +*/ +void CL_Shutdown (void) +{ + CL_CGVM_Shutdown(); + CL_Particles_Shutdown(); + CL_Parse_Shutdown(); + + SZ_Free (&cls.message); + + Mem_FreePool (&cl_entities_mempool); + Mem_FreePool (&cl_refdef_mempool); +} + /* ================= CL_Init @@ -1381,6 +1403,8 @@ void CL_Init (void) CL_Particles_Init(); CL_Screen_Init(); CL_CGVM_Init(); + + CL_Video_Init(); }