Merge pull request #7 from ScatterBox/main

Ian fixed Sprite loading on NX/Vita
This commit is contained in:
Ian 2023-01-13 20:04:30 -05:00 committed by GitHub
commit 86c9828100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 32 deletions

View file

@ -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

View file

@ -2983,15 +2983,18 @@ 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;
FILE *f;
COM_FOpenFile (withext, &f, NULL);
if (f) {
// New sprite loading with _<framenum>.tga
pspriteframe->gltexture = loadtextureimage(possiblename);
q_snprintf (filename, sizeof(filename), "%s_%i", loadmodel->name, framenum);
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);

View file

@ -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)

View file

@ -800,13 +800,14 @@ 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]);