Disappearing crosshair bug fixed.

This commit is contained in:
Mari the Deer 2022-09-27 21:43:05 +02:00
commit ed5f382ff9
7 changed files with 5 additions and 41 deletions

View file

@ -86,7 +86,6 @@ server bool swwm_bonkhammer = false; // combat hammer makes bonk sounds when hi
server int swwm_friendlyfire = 0; // 0: allow all friendly fire, 1: block incoming damage, 2: block incoming and outgoing damage
nosave bool swwm_showmaptitle = false; // shows the name of the map when entering, just like in dark souls!
server bool swwm_lobdoubled = false; // [LOB] Enable Double Death monster spawns
nosave noarchive bool swwm_debugchair = false; // debug aid for precise crosshairs (temporarily available until a critical bug is fixed)
// minimap settings
nosave bool swwm_mm_enable = true; // show a minimap below the score counter

View file

@ -208,7 +208,6 @@ SWWM_DBG_FIXITEMCAPS = "Recalculate Item Caps";
SWWM_DBG_UPDATESHADOWS = "Update Simple Shadows";
SWWM_DBG_UPDATEGLOWS = "Update Item Glows";
SWWM_DBG_UPDATEHITBOXES = "Update Extended Hitboxes";
SWWM_DBG_DEBUGCHAIR = "Debug Crosshair Info";
TOOLTIP_SWWM_VOICETYPE = "Sets the voice pack for the player.";
TOOLTIP_SWWM_MUTEVOICE = "Control what gets muted, if you'd rather have a more silent protagonist.";
TOOLTIP_SWWM_FLASHSTRENGTH = "Screen flashes usually happen when firing some weapons, you can lower this if these effects are harmful for you.";
@ -299,7 +298,6 @@ TOOLTIP_NETEVENT_SWWMFIXITEMCAPS = "Recomputes carried item capacities. Only nee
TOOLTIP_NETEVENT_SWWMUPDATESHADOWS = "Adds/Removes simple shadows at runtime, without the need to restart the map. Unclear if it causes issues.";
TOOLTIP_NETEVENT_SWWMUPDATEGLOWS = "Adds/Removes item glows at runtime, without the need to restart the map. Unclear if it causes issues.";
TOOLTIP_NETEVENT_SWWMUPDATEHITBOXES = "Removes extended item hitboxes at runtime. Due to implementation quirks, they can't be added without a map restart.";
TOOLTIP_SWWM_DEBUGCHAIR = "Prints out debug information about active precise crosshairs.";
// main menu poses (do not localize)
SWWM_NMENUPOSE = "24";
SWWM_MENUPOSE1 = "graphics/M_DEMOCHAN_DEEPIMPACT.png";

View file

@ -205,7 +205,6 @@ SWWM_DBG_FIXITEMCAPS = "Recalcular Capacidades de Ítem";
SWWM_DBG_UPDATESHADOWS = "Actualizar Sombras Simples";
SWWM_DBG_UPDATEGLOWS = "Actualizar Brillos de Ítem";
SWWM_DBG_UPDATEHITBOXES = "Actualizar Hitboxes Extendidas";
SWWM_DBG_DEBUGCHAIR = "Información de Depurado de Miras";
TOOLTIP_SWWM_VOICETYPE = "Selecciona el pack de voz para el jugador.";
TOOLTIP_SWWM_MUTEVOICE = "Controla lo que se mutea, si prefieres tener un protagonista más silencioso.";
TOOLTIP_SWWM_FLASHSTRENGTH = "Los destellos en pantalla suelen ocurrir al disparar algunas armas, puedes reducirlo si este tipo de efectos te causan malestar.";
@ -297,7 +296,6 @@ TOOLTIP_NETEVENT_SWWMFIXITEMCAPS = "Recomputa las capacidades de los ítems en e
TOOLTIP_NETEVENT_SWWMUPDATESHADOWS = "Añade/Quita sombras simples en tiempo real, sin necesidad de reiniciar el mapa. No está claro si puede causar problemas.";
TOOLTIP_NETEVENT_SWWMUPDATEGLOWS = "Añade/Quite brillos de ítem en tiempo real, sin necesidad de reiniciar el mapa. No está claro si puede causar problemas.";
TOOLTIP_NETEVENT_SWWMUPDATEHITBOXES = "Quita hitboxes extendidas de ítem en tiempo real. Dados los detalles de implementación, no pueden añadirse sin reiniciar el mapa.";
TOOLTIP_SWWM_DEBUGCHAIR = "Muestra en pantalla información de depurado sobre miras precisas activas.";
// credits
SWWM_MCREDS = "Créditos de DEMOLITIONIST";
SWWM_CLEAD = "Desarrollo Principal:";

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r517 \cu(Tue 27 Sep 16:46:04 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r517 \cu(2022-09-27 16:46:04)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r518 \cu(Tue 27 Sep 21:43:05 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r518 \cu(2022-09-27 21:43:05)\c-";

View file

@ -239,7 +239,6 @@ OptionMenu "SWWMDebugMenu"
StaticText " "
Option "$SWWM_DBG_DEBUGBLAST", "swwm_debugblast", "YesNo"
Option "$SWWM_DBG_DEBUGVIEW", "swwm_debugview", "YesNo"
Option "$SWWM_DBG_DEBUGCHAIR", "swwm_debugchair", "YesNo"
StaticText " "
SafeCommand "$SWWM_DBG_FIXITEMCAPS", "netevent swwmfixitemcaps"
SafeCommand "$SWWM_DBG_UPDATESHADOWS", "netevent swwmupdateshadows"

View file

@ -34,7 +34,6 @@ extend Class SWWMHandler
transient ui Vector3 lagtndc[MAX_CROSSHAIRS]; // "lagged" NDC for crosshairs
transient ui bool tactive[MAX_CROSSHAIRS]; // denotes that the crosshair is "active" for drawing
transient ui double prevframe; // previous frame timestamp
ui Font TinyFont;
private ui void TraceCrosshairs( RenderEvent e )
{
@ -127,53 +126,26 @@ extend Class SWWMHandler
if ( crosshairgrow ) sz *= StatusBar.CrosshairSize;
SWWMUtility.PrepareProjData(tprojdata,e.ViewPos,e.ViewAngle,e.ViewPitch,e.ViewRoll,players[consoleplayer].fov);
Vector2 actpos[MAX_CROSSHAIRS];
if ( !TinyFont ) TinyFont = Font.GetFont('TewiFontOutline');
int fh = TinyFont.GetHeight();
bool debug = swwm_debugchair;
int nact = 0;
for ( int i=0; i<MAX_CROSSHAIRS; i++ ) nact += tactive[i];
if ( debug ) Screen.DrawText(TinyFont,Font.CR_UNTRANSLATED,4,4,(nact!=numcrosshairs)?String.Format("\cf%d USED CROSSHAIRS \cd%d ACTIVE CROSSHAIRS\c-",numcrosshairs,nact):String.Format("\cf%d USED CROSSHAIRS\c-",numcrosshairs));
for ( int i=0; i<MAX_CROSSHAIRS; i++ )
{
int xpos = 4+320*(i%5);
int ypos = 4+fh*2+160*(i/5);
int fc = (i<numcrosshairs)?Font.CR_GOLD:Font.CR_GREEN;
Vector3 cpos = tpos[i];
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("CPOS: (%g,%g,%g)",cpos.x,cpos.y,cpos.z));
ypos += fh;
Color ccol = tcol[i];
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("CCOL: %08X",ccol));
ypos += fh;
Vector3 tdir = level.Vec3Diff(e.ViewPos,cpos);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("TDIR: (%g,%g,%g)",tdir.x,tdir.y,tdir.z));
ypos += fh;
// project
Vector3 ndc = SWWMUtility.ProjectPoint(tprojdata,e.ViewPos+tdir);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("NDC: (%g,%g,%g)",ndc.x,ndc.y,ndc.z));
ypos += fh;
// project (but account for rare corner case where distance is zero)
Vector3 ndc = (tdir.length()<=double.epsilon)?(0,0,0):SWWMUtility.ProjectPoint(tprojdata,e.ViewPos+tdir);
if ( ndc.z >= 1. ) continue;
Vector2 vpos = SWWMUtility.NDCToViewport(tprojdata,ndc);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("VPOS: (%g,%g)",vpos.x,vpos.y));
ypos += fh;
if ( !prevframe ) lagtndc[i] = ndc;
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("LAGTNDC: (%g,%g,%g)",lagtndc[i].x,lagtndc[i].y,lagtndc[i].z));
ypos += fh;
if ( lagtndc[i].z >= 1. ) continue;
Vector2 oldvpos = SWWMUtility.NDCToViewport(tprojdata,lagtndc[i]);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("OLDVPOS: (%g,%g)",oldvpos.x,oldvpos.y));
ypos += fh;
lagtndc[i] = SWWMUtility.LerpVector3(lagtndc[i],ndc,theta);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("LAGTNDC: (%g,%g,%g)",lagtndc[i].x,lagtndc[i].y,lagtndc[i].z));
ypos += fh;
if ( lagtndc[i].z >= 1. ) continue;
Vector2 lagvpos = SWWMUtility.NDCToViewport(tprojdata,lagtndc[i]);
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("LAGVPOS: (%g,%g)",lagvpos.x,lagvpos.y));
ypos += fh;
if ( !tactive[i] ) continue;
// draw
int streak = int(max(abs(oldvpos.x-lagvpos.x),abs(oldvpos.y-lagvpos.y)));
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("STREAK: %d",streak));
ypos += fh;
double alph = 1.;
if ( i < numcrosshairs ) actpos[i] = lagvpos;
else
@ -185,8 +157,6 @@ extend Class SWWMHandler
tactive[i] = false;
alph = clamp(dist/max(2,streak+2),0.,1.); // this should make the merge less jarring
}
if ( debug && tactive[i] ) Screen.DrawText(TinyFont,fc,xpos,ypos,String.Format("ALPH: %g",alph));
ypos += fh;
for ( int i=0; i<streak; i++ ) Screen.DrawTexture(ctex,false,int(SWWMUtility.lerp(oldvpos.x,lagvpos.x,i/double(streak))),int(SWWMUtility.lerp(oldvpos.y,lagvpos.y,i/double(streak))),DTA_DestWidthF,ts.x*sz,DTA_DestHeightF,ts.y*sz,DTA_AlphaChannel,true,DTA_FillColor,ccol,DTA_Alpha,((i*.5)/streak)*alph);
Screen.DrawTexture(ctex,false,int(lagvpos.x),int(lagvpos.y),DTA_DestWidthF,ts.x*sz,DTA_DestHeightF,ts.y*sz,DTA_AlphaChannel,true,DTA_FillColor,ccol,DTA_Alpha,alph);
}

View file

@ -558,7 +558,7 @@ extend Class SWWMWeapon
{
HitNormal = (-d.HitLine.delta.y,d.HitLine.delta.x,0).unit();
if ( !d.LineSide ) HitNormal *= -1;
if ( !(flags&MELEE_NoUse) ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation+HitNormal*4);
d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation+HitNormal*4);
}
if ( impactclass )
{