From: havoc Date: Sun, 11 Jun 2006 13:50:25 +0000 (+0000) Subject: removed crosshair_static cvar (now only the hud crosshair remains) X-Git-Tag: xonotic-v0.1.0preview~3913 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=bcb0a24c82db73c8b8203e1fd1f46ce1fb31e6a2 removed crosshair_static cvar (now only the hud crosshair remains) merged r_crosshairs.c into sbar.c git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6465 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_screen.c b/cl_screen.c index c35d1139..ab629fb6 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -51,7 +51,6 @@ float scr_con_current; extern int con_vislines; -void DrawCrosshair(int num); static void SCR_ScreenShot_f (void); static void R_Envmap_f (void); diff --git a/darkplaces-dedicated.dev b/darkplaces-dedicated.dev index 18131ee9..1a4577e1 100644 --- a/darkplaces-dedicated.dev +++ b/darkplaces-dedicated.dev @@ -1,7 +1,7 @@ [Project] FileName=darkplaces-dedicated.dev Name=DarkPlaces -UnitCount=147 +UnitCount=157 Type=1 Ver=1 ObjFiles= @@ -1099,16 +1099,6 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit112] -FileName=r_crosshairs.c -CompileCpp=0 -Folder=Source Files -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit113] FileName=r_explosion.c CompileCpp=0 @@ -1539,7 +1529,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit158] +[Unit112] FileName=builddate.c CompileCpp=0 Folder=Source Files diff --git a/darkplaces-dedicated.dsp b/darkplaces-dedicated.dsp index 427c353a..7e92eaf8 100644 --- a/darkplaces-dedicated.dsp +++ b/darkplaces-dedicated.dsp @@ -7,19 +7,19 @@ CFG=dedicated - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces-dedicated.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces-dedicated.mak" CFG="dedicated - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "dedicated - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "dedicated - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -83,7 +83,7 @@ LINK32=link.exe # ADD LINK32 user32.lib gdi32.lib opengl32.lib wsock32.lib winmm.lib comctl32.lib dxguid.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug-Dedicated/darkplaces-dedicated-debug.exe" /pdbtype:sept # SUBTRACT LINK32 /pdb:none -!ENDIF +!ENDIF # Begin Target @@ -310,10 +310,6 @@ SOURCE=.\prvm_exec.c # End Source File # Begin Source File -SOURCE=.\r_crosshairs.c -# End Source File -# Begin Source File - SOURCE=.\r_explosion.c # End Source File # Begin Source File diff --git a/darkplaces-sdl.dsp b/darkplaces-sdl.dsp index 9c40efb1..21397e9d 100644 --- a/darkplaces-sdl.dsp +++ b/darkplaces-sdl.dsp @@ -7,19 +7,19 @@ CFG=sdl - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces-sdl.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces-sdl.mak" CFG="sdl - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "sdl - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "sdl - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -83,7 +83,7 @@ LINK32=link.exe # ADD LINK32 user32.lib gdi32.lib opengl32.lib wsock32.lib winmm.lib comctl32.lib dxguid.lib sdl.lib sdlmain.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"Debug-SDL/darkplaces-sdl-debug.exe" /pdbtype:sept /libpath:"SDL/lib" # SUBTRACT LINK32 /pdb:none -!ENDIF +!ENDIF # Begin Target @@ -310,10 +310,6 @@ SOURCE=.\prvm_exec.c # End Source File # Begin Source File -SOURCE=.\r_crosshairs.c -# End Source File -# Begin Source File - SOURCE=.\r_explosion.c # End Source File # Begin Source File diff --git a/darkplaces.dev b/darkplaces.dev index ef906b63..6584102b 100644 --- a/darkplaces.dev +++ b/darkplaces.dev @@ -1,7 +1,7 @@ [Project] FileName=darkplaces.dev Name=DarkPlaces -UnitCount=157 +UnitCount=156 Type=0 Ver=1 ObjFiles= @@ -1189,16 +1189,6 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit117] -FileName=r_crosshairs.c -CompileCpp=0 -Folder=Source Files -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit118] FileName=r_explosion.c CompileCpp=0 @@ -1589,7 +1579,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit158] +[Unit117] FileName=builddate.c CompileCpp=0 Folder=Source Files diff --git a/darkplaces.dsp b/darkplaces.dsp index 15a2c330..4772a896 100644 --- a/darkplaces.dsp +++ b/darkplaces.dsp @@ -7,19 +7,19 @@ CFG=darkplaces - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "darkplaces.mak" CFG="darkplaces - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "darkplaces - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "darkplaces - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -83,7 +83,7 @@ LINK32=link.exe # ADD LINK32 user32.lib gdi32.lib opengl32.lib wsock32.lib winmm.lib comctl32.lib dxguid.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/darkplaces-debug.exe" /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib -!ENDIF +!ENDIF # Begin Target @@ -314,10 +314,6 @@ SOURCE=.\prvm_exec.c # End Source File # Begin Source File -SOURCE=.\r_crosshairs.c -# End Source File -# Begin Source File - SOURCE=.\r_explosion.c # End Source File # Begin Source File diff --git a/gl_rmain.c b/gl_rmain.c index 88c6e0bf..0cd996a4 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1023,7 +1023,6 @@ extern void GL_Main_Init(void); extern void R_Shadow_Init(void); extern void R_Sky_Init(void); extern void GL_Surf_Init(void); -extern void R_Crosshairs_Init(void); extern void R_Light_Init(void); extern void R_Particles_Init(void); extern void R_Explosion_Init(void); @@ -1041,11 +1040,10 @@ void Render_Init(void) R_Shadow_Init(); R_Sky_Init(); GL_Surf_Init(); - R_Crosshairs_Init(); + Sbar_Init(); R_Light_Init(); R_Particles_Init(); R_Explosion_Init(); - Sbar_Init(); R_LightningBeams_Init(); Mod_RenderInit(); } @@ -1825,12 +1823,6 @@ void R_RenderScene(void) if (r_timereport_active) R_TimeReport("coronas"); } - if(cl.csqc_vidvars.drawcrosshair) - { - R_DrawWorldCrosshair(); - if (r_timereport_active) - R_TimeReport("crosshair"); - } // don't let sound skip if going slow if (r_refdef.extraupdate) diff --git a/makefile.inc b/makefile.inc index 8a455a2e..efc5cdc4 100644 --- a/makefile.inc +++ b/makefile.inc @@ -106,7 +106,6 @@ OBJ_COMMON= \ prvm_cmds.o \ prvm_edict.o \ prvm_exec.o \ - r_crosshairs.o \ r_explosion.o \ r_lerpanim.o \ r_light.o \ diff --git a/menu.c b/menu.c index 45236a68..951fdeb0 100644 --- a/menu.c +++ b/menu.c @@ -1539,7 +1539,7 @@ static void M_DrawCheckbox (int x, int y, int on) } -#define OPTIONS_ITEMS 40 +#define OPTIONS_ITEMS 39 static int options_cursor; @@ -1603,8 +1603,6 @@ static void M_Menu_Options_AdjustSliders (int dir) Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 6)); else if (options_cursor == optnum++) Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5)); - else if (options_cursor == optnum++) - Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer); else if (options_cursor == optnum++) Cvar_SetValueQuick (&showfps, !showfps.integer); else if (options_cursor == optnum++) @@ -1721,7 +1719,6 @@ static void M_Options_Draw (void) M_Options_PrintCheckbox(" Text Shadow", true, r_textshadow.integer); M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5); M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5); - M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer); M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer); M_Options_PrintCheckbox(" Show Time", true, showtime.integer); M_Options_PrintCheckbox(" Show Date", true, showdate.integer); diff --git a/r_crosshairs.c b/r_crosshairs.c deleted file mode 100644 index a32226d6..00000000 --- a/r_crosshairs.c +++ /dev/null @@ -1,78 +0,0 @@ - -#include "quakedef.h" -#include "cl_collision.h" - -cvar_t crosshair_color_red = {CVAR_SAVE, "crosshair_color_red", "1", "customizable crosshair color"}; -cvar_t crosshair_color_green = {CVAR_SAVE, "crosshair_color_green", "0", "customizable crosshair color"}; -cvar_t crosshair_color_blue = {CVAR_SAVE, "crosshair_color_blue", "0", "customizable crosshair color"}; -cvar_t crosshair_color_alpha = {CVAR_SAVE, "crosshair_color_alpha", "1", "how opaque the crosshair should be"}; -cvar_t crosshair_size = {CVAR_SAVE, "crosshair_size", "1", "adjusts size of the crosshair on the screen"}; -cvar_t crosshair_static = {CVAR_SAVE, "crosshair_static", "1", "if 1 the crosshair is a 2D overlay, if 0 it is a sprite in the world indicating where your weapon will hit in standard quake mods (if the mod has the weapon somewhere else this won't be accurate)"}; - -void R_Crosshairs_Init(void) -{ - Cvar_RegisterVariable(&crosshair_color_red); - Cvar_RegisterVariable(&crosshair_color_green); - Cvar_RegisterVariable(&crosshair_color_blue); - Cvar_RegisterVariable(&crosshair_color_alpha); - Cvar_RegisterVariable(&crosshair_size); - Cvar_RegisterVariable(&crosshair_static); -} - -void R_DrawWorldCrosshair(void) -{ - int num; - cachepic_t *pic; - vec3_t v1, v2, spriteorigin; - vec_t spritescale; - trace_t trace; - if (r_letterbox.value) - return; - if (crosshair_static.integer) - return; - num = crosshair.integer; - if (num < 1 || num > NUMCROSSHAIRS || cl.intermission) - return; - if (!cl.viewentity || !cl.entities[cl.viewentity].state_current.active) - return; - pic = r_crosshairs[num]; - if (!pic) - return; - - // trace the shot path up to a certain distance - 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) - AngleVectors(cl.viewangles, v2, NULL, NULL); - //VectorCopy(r_view.origin, v1); - VectorMA(v1, 8192, v2, v2); - trace = CL_TraceBox(v1, vec3_origin, vec3_origin, v2, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_SKY, false); - spritescale = trace.fraction * (8192.0f / 40.0f) * crosshair_size.value; - VectorCopy(trace.endpos, spriteorigin); - - // draw the sprite - R_DrawSprite(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, pic->tex, NULL, true, spriteorigin, r_view.right, r_view.up, spritescale, -spritescale, -spritescale, spritescale, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value); -} - -void R_Draw2DCrosshair(void) -{ - int num; - cachepic_t *pic; - if (r_letterbox.value) - return; - if (!crosshair_static.integer) - return; - num = crosshair.integer; - if (num < 1 || num > NUMCROSSHAIRS || cl.intermission) - return; - if (!cl.viewentity || !cl.entities[cl.viewentity].state_current.active) - return; - pic = r_crosshairs[num]; - if (pic) - DrawQ_Pic((vid_conwidth.integer - pic->width * crosshair_size.value) * 0.5f, (vid_conheight.integer - pic->height * crosshair_size.value) * 0.5f, pic, pic->width * crosshair_size.value, pic->height * crosshair_size.value, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value, 0); -} - - - - diff --git a/render.h b/render.h index 5f22191d..dd0f0411 100644 --- a/render.h +++ b/render.h @@ -171,9 +171,6 @@ void R_TimeReport(char *name); // r_stain void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2); -void R_DrawWorldCrosshair(void); -void R_Draw2DCrosshair(void); - void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width); void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca); diff --git a/sbar.c b/sbar.c index 47a45736..95a79f36 100644 --- a/sbar.c +++ b/sbar.c @@ -96,6 +96,12 @@ cvar_t sbar_alpha_fg = {CVAR_SAVE, "sbar_alpha_fg", "1", "opacity value of the s cvar_t cl_deathscoreboard = {0, "cl_deathscoreboard", "1", "shows scoreboard (+showscores) while dead"}; +cvar_t crosshair_color_red = {CVAR_SAVE, "crosshair_color_red", "1", "customizable crosshair color"}; +cvar_t crosshair_color_green = {CVAR_SAVE, "crosshair_color_green", "0", "customizable crosshair color"}; +cvar_t crosshair_color_blue = {CVAR_SAVE, "crosshair_color_blue", "0", "customizable crosshair color"}; +cvar_t crosshair_color_alpha = {CVAR_SAVE, "crosshair_color_alpha", "1", "how opaque the crosshair should be"}; +cvar_t crosshair_size = {CVAR_SAVE, "crosshair_size", "1", "adjusts size of the crosshair on the screen"}; + void Sbar_MiniDeathmatchOverlay (int x, int y); void Sbar_DeathmatchOverlay (void); void Sbar_IntermissionOverlay (void); @@ -337,16 +343,22 @@ void sbar_newmap(void) void Sbar_Init (void) { - Cmd_AddCommand ("+showscores", Sbar_ShowScores, "show scoreboard"); - Cmd_AddCommand ("-showscores", Sbar_DontShowScores, "hide scoreboard"); - Cvar_RegisterVariable (&showfps); - Cvar_RegisterVariable (&showtime); - Cvar_RegisterVariable (&showtime_format); - Cvar_RegisterVariable (&showdate); - Cvar_RegisterVariable (&showdate_format); - Cvar_RegisterVariable (&sbar_alpha_bg); - Cvar_RegisterVariable (&sbar_alpha_fg); - Cvar_RegisterVariable (&cl_deathscoreboard); + Cmd_AddCommand("+showscores", Sbar_ShowScores, "show scoreboard"); + Cmd_AddCommand("-showscores", Sbar_DontShowScores, "hide scoreboard"); + Cvar_RegisterVariable(&showfps); + Cvar_RegisterVariable(&showtime); + Cvar_RegisterVariable(&showtime_format); + Cvar_RegisterVariable(&showdate); + Cvar_RegisterVariable(&showdate_format); + Cvar_RegisterVariable(&sbar_alpha_bg); + Cvar_RegisterVariable(&sbar_alpha_fg); + Cvar_RegisterVariable(&cl_deathscoreboard); + + Cvar_RegisterVariable(&crosshair_color_red); + Cvar_RegisterVariable(&crosshair_color_green); + Cvar_RegisterVariable(&crosshair_color_blue); + Cvar_RegisterVariable(&crosshair_color_alpha); + Cvar_RegisterVariable(&crosshair_size); R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap); } @@ -1014,6 +1026,8 @@ extern float v_dmg_time, v_dmg_roll, v_dmg_pitch; extern cvar_t v_kicktime; void Sbar_Draw (void) { + cachepic_t *pic; + if(cl.csqc_vidvars.drawenginesbar) //[515]: csqc drawsbar { if (cl.intermission == 1) @@ -1337,8 +1351,8 @@ void Sbar_Draw (void) Sbar_ShowFPS(); - if(cl.csqc_vidvars.drawcrosshair) - R_Draw2DCrosshair(); + if (cl.csqc_vidvars.drawcrosshair && crosshair.integer >= 1 && crosshair.integer <= NUMCROSSHAIRS && !cl.intermission && !r_letterbox.value && (pic = r_crosshairs[crosshair.integer])) + DrawQ_Pic((vid_conwidth.integer - pic->width * crosshair_size.value) * 0.5f, (vid_conheight.integer - pic->height * crosshair_size.value) * 0.5f, pic, pic->width * crosshair_size.value, pic->height * crosshair_size.value, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value, 0); if (cl_prydoncursor.integer) DrawQ_Pic((cl.cmd.cursor_screen[0] + 1) * 0.5 * vid_conwidth.integer, (cl.cmd.cursor_screen[1] + 1) * 0.5 * vid_conheight.integer, Draw_CachePic(va("gfx/prydoncursor%03i", cl_prydoncursor.integer), true), 0, 0, 1, 1, 1, 1, 0); diff --git a/screen.h b/screen.h index dfdb4e56..0a020fc0 100644 --- a/screen.h +++ b/screen.h @@ -40,7 +40,6 @@ extern cvar_t showdate; extern cvar_t crosshair; extern cvar_t crosshair_size; -extern cvar_t crosshair_static; extern cvar_t scr_conalpha; extern cvar_t scr_conbrightness;