]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_crosshairs.c
Fix for Win64, by Willis
[xonotic/darkplaces.git] / r_crosshairs.c
index 413ee14e7b3d348ba8ed3dbca3bb24ab3204d434..aeec2190f6a16199d0d420daaa006b2eca7193e3 100644 (file)
@@ -25,7 +25,7 @@ void R_Crosshairs_Init(void)
 void R_GetCrosshairColor(float *out)
 {
        int i;
-       qbyte *color;
+       unsigned char *color;
        float scale, base;
        if (cl.viewentity >= 1 && cl.viewentity <= cl.maxclients)
        {
@@ -37,7 +37,7 @@ void R_GetCrosshairColor(float *out)
        }
        else
                i = 15;
-       color = (qbyte *) &palette_complete[i];
+       color = (unsigned char *) &palette_complete[i];
        if (crosshair_flashspeed.value >= 0.01f)
                base = (sin(realtime * crosshair_flashspeed.value * (M_PI*2.0f)) * crosshair_flashrange.value);
        else
@@ -72,13 +72,13 @@ void R_DrawWorldCrosshair(void)
                return;
        if (!cl.viewentity || !cl_entities[cl.viewentity].state_current.active)
                return;
-       pic = Draw_CachePic(va("gfx/crosshair%i.tga", num), true);
+       pic = Draw_CachePic(va("gfx/crosshair%i", num), true);
        if (!pic)
                return;
        R_GetCrosshairColor(color);
 
        // trace the shot path up to a certain distance
-       VectorCopy(cl_entities[cl.viewentity].render.origin, v1);
+       Matrix4x4_OriginFromMatrix(&cl_entities[cl.viewentity].render.matrix, v1);
        v1[2] += 16; // HACK: this depends on the QC
 
        // get the forward vector for the gun (not the view)
@@ -90,7 +90,7 @@ void R_DrawWorldCrosshair(void)
        VectorCopy(trace.endpos, spriteorigin);
 
        // draw the sprite
-       R_DrawSprite(GL_ONE, GL_ONE, pic->tex, NULL, true, spriteorigin, r_viewright, r_viewup, spritescale, -spritescale, -spritescale, spritescale, color[0], color[1], color[2], color[3]);
+       R_DrawSprite(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, pic->tex, NULL, true, spriteorigin, r_viewright, r_viewup, spritescale, -spritescale, -spritescale, spritescale, color[0], color[1], color[2], color[3]);
 }
 
 void R_Draw2DCrosshair(void)
@@ -107,7 +107,7 @@ void R_Draw2DCrosshair(void)
                return;
        if (!cl.viewentity || !cl_entities[cl.viewentity].state_current.active)
                return;
-       pic = Draw_CachePic(va("gfx/crosshair%i.tga", num), true);
+       pic = Draw_CachePic(va("gfx/crosshair%i", num), true);
        if (pic)
        {
                R_GetCrosshairColor(color);