From d8d27719a9145ea15d0a4702dc48271c571ca172 Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Tue, 3 Jan 2023 19:58:10 -0500 Subject: [PATCH 1/2] Ian fixed Sprite loading on NX/Vita Powerups and ect. work now yay --- source/gl_model.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/source/gl_model.c b/source/gl_model.c index 3b32208..762571b 100644 --- a/source/gl_model.c +++ b/source/gl_model.c @@ -2983,27 +2983,30 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) //johnfitz // rbaldwin2 -- new sprite loading - COM_StripExtension(loadmodel->name, possiblename, strlen(loadmodel->name)); - q_snprintf (withext, sizeof(possiblename), "%s_%i.tga", possiblename, framenum); - q_snprintf (possiblename, sizeof(possiblename), "%s_%i", possiblename, framenum); + char filename[MAX_QPATH]; + byte *data; + int fwidth = 0, fheight = 0; + qboolean malloced=false; + + q_snprintf (filename, sizeof(filename), "%s_%i", loadmodel->name, framenum); - FILE *f; - COM_FOpenFile (withext, &f, NULL); - if (f) { - // New sprite loading with _.tga - pspriteframe->gltexture = loadtextureimage(possiblename); - } else { - // Old spr loading - q_snprintf (name, sizeof(name), "%s:frame%i", loadmodel->name, framenum); - offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz - pspriteframe->gltexture = - TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED, - (byte *)(pinframe + 1), loadmodel->name, offset, - TEXPREF_PAD | TEXPREF_ALPHA | TEXPREF_NOPICMIP); //johnfitz -- TexMgr - } + data = Image_LoadImage(filename, &fwidth, &fheight); + + if (data) { + pspriteframe->gltexture = TexMgr_LoadImage (loadmodel, filename, fwidth, fheight, + SRC_RGBA, data, filename, 0, TEXPREF_ALPHA|TEXPREF_PAD|TEXPREF_MIPMAP); + } else { + // Old spr loading + q_snprintf (name, sizeof(name), "%s:frame%i", loadmodel->name, framenum); + offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz + pspriteframe->gltexture = + TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED, + (byte *)(pinframe + 1), loadmodel->name, offset, + TEXPREF_PAD | TEXPREF_ALPHA | TEXPREF_NOPICMIP); //johnfitz -- TexMgr + } - return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size); + return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size); } From 92cc54eea2ec973d29696aede3a95849183ae766 Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Sat, 7 Jan 2023 16:16:13 -0500 Subject: [PATCH 2/2] Fixed ADS viewmodel [PITCH] changing with joy input on Vita/NX. --- source/cl_input.c | 8 ++++---- source/gl_screen.c | 4 ++-- source/view.c | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/source/cl_input.c b/source/cl_input.c index 0da2220..49c5c1b 100644 --- a/source/cl_input.c +++ b/source/cl_input.c @@ -296,8 +296,8 @@ void CL_AdjustAngles (void) up = CL_KeyState (&in_lookup); down = CL_KeyState(&in_lookdown); - cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up; - cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down; + cl.viewangles[PITCH] -= speed*cl_pitchspeed.value *up; // *up + cl.viewangles[PITCH] += speed*cl_pitchspeed.value *down; //down if (up || down) V_StopPitchDrift (); @@ -317,7 +317,7 @@ void CL_AdjustAngles (void) // vita gyro support by rinnegatamante (originally from vitaquake) // creds to the switch-examples for nx support if (motioncam.value) { - if (gyromode.value && cl.stats[STAT_ZOOM] == 0 || client_sprinting == 1) //sB fix gyro activating while sprinting. + if (gyromode.value && cl.stats[STAT_ZOOM] == 0 && client_sprinting == 1) //sB fix gyro activating while sprinting. return; #ifdef VITA @@ -352,7 +352,7 @@ void CL_AdjustAngles (void) cl.viewangles[YAW] += x_gyro_cam; V_StopPitchDrift(); - + if (joy_invert.value) cl.viewangles[PITCH] += y_gyro_cam; else diff --git a/source/gl_screen.c b/source/gl_screen.c index 73df364..c2ee07b 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -1965,9 +1965,9 @@ void SCR_UpdateScreen (void) if(scr_fov.value > (GetWeaponZoomAmmount() + 1))//+1 for accounting for floating point inaccurraces { scr_fov.value += ((original_fov - GetWeaponZoomAmmount()) - scr_fov.value) * 0.25; - //scr_fov_viewmodel.value += ((original_view_fov - GetWeaponZoomAmmount()) - scr_fov_viewmodel.value) * 0.25; + scr_fov_viewmodel.value += ((original_view_fov - GetWeaponZoomAmmount()) - scr_fov_viewmodel.value) * 0.25; Cvar_SetValue("fov",scr_fov.value); - //Cvar_SetValue("r_viewmodel_fov", scr_fov_viewmodel.value); + Cvar_SetValue("r_viewmodel_fov", scr_fov_viewmodel.value); } } else if (cl.stats[STAT_ZOOM] == 2) diff --git a/source/view.c b/source/view.c index 45f7986..2d7fd52 100644 --- a/source/view.c +++ b/source/view.c @@ -799,14 +799,15 @@ void CalcGunAngle (void) { cl.viewent.angles[YAW] = (r_refdef.viewangles[YAW] + yaw) - (angledelta((r_refdef.viewangles[YAW] + yaw) - OldYawTheta ) * 0.6);//0.6 } - - cl.viewent.angles[PITCH] = -1 * ((r_refdef.viewangles[PITCH] + pitch) - (angledelta((r_refdef.viewangles[PITCH] + pitch) + OldPitchTheta ) * 0.2)); + + cl.viewent.angles[PITCH] = -1 * ((r_refdef.viewangles[PITCH] + pitch) - (angledelta((r_refdef.viewangles[PITCH] + pitch) + OldPitchTheta ) * 0.2)); //sB something here... + OldYawTheta = cl.viewent.angles[YAW]; OldPitchTheta = cl.viewent.angles[PITCH]; - + + /* //cl.viewent.angles[YAW] = r_refdef.viewangles[YAW] + yaw; - //cl.viewent.angles[PITCH] = - (r_refdef.viewangles[PITCH] + pitch); - + cl.viewent.angles[PITCH] = - (angledelta(r_refdef.viewangles[PITCH] + pitch)); cl.viewent.angles[ROLL] -= v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value; cl.viewent.angles[PITCH] -= v_idlescale.value * sin(cl.time*v_ipitch_cycle.value) * v_ipitch_level.value; cl.viewent.angles[YAW] -= v_idlescale.value * sin(cl.time*v_iyaw_cycle.value) * v_iyaw_level.value; @@ -814,8 +815,11 @@ void CalcGunAngle (void) cl.viewent2.angles[ROLL] = cl.viewent.angles[ROLL] -= v_idlescale.value * sinf(cl.time*v_iroll_cycle.value * 2) * v_iroll_level.value; cl.viewent2.angles[PITCH] = cl.viewent.angles[PITCH] -= v_idlescale.value * sinf(cl.time*v_ipitch_cycle.value * 2) * v_ipitch_level.value; cl.viewent2.angles[YAW] = cl.viewent.angles[YAW] -= v_idlescale.value * sinf(cl.time*v_iyaw_cycle.value * 2) * v_iyaw_level.value; - + */ + cl.viewent2.angles[ROLL] = cl.viewent.angles[ROLL] -= v_idlescale.value * sinf(cl.time*v_iroll_cycle.value * 2) * v_iroll_level.value; + cl.viewent2.angles[PITCH] = cl.viewent.angles[PITCH] -= v_idlescale.value * sinf(cl.time*v_ipitch_cycle.value * 2) * v_ipitch_level.value; + cl.viewent2.angles[YAW] = cl.viewent.angles[YAW] -= v_idlescale.value * sinf(cl.time*v_iyaw_cycle.value * 2) * v_iyaw_level.value; //Evaluating total offset CWeaponRot[PITCH] -= cl.viewent.angles[PITCH]; @@ -1237,7 +1241,7 @@ void V_CalcRefdef (void) } //Side offset cADSOfs [0] += (ADSOffset[0] - cADSOfs[0]) * 0.25; - cADSOfs [1] = (ADSOffset[1] /*- cADSOfs[1]*/) * 0.25; // naievil -- removed this because it caused some viewmodel errors + cADSOfs [1] += (ADSOffset[1] - cADSOfs[1]) * 0.25; // naievil -- removed "- cADSOfs[1]" because it caused some viewmodel errors. sB re-enabled it for now. temp_right[0] *= cADSOfs[0]; temp_right[1] *= cADSOfs[0]; @@ -1245,7 +1249,7 @@ void V_CalcRefdef (void) temp_up[0] *= cADSOfs[1]; temp_up[1] *= cADSOfs[1]; - temp_up[2] *= (cADSOfs[1] * 4); // motolegacy -- another vmodel hack: standard ADS offsets don't go up enough + temp_up[2] *= cADSOfs[1]; // motolegacy -- another vmodel hack: standard ADS offsets don't go up enough. sB was cADSOfs[1] view->origin[0] +=(temp_right[0] + temp_up[0]); view->origin[1] +=(temp_right[1] + temp_up[1]);