Coder Social home page Coder Social logo

r_drawworld 0 fails (fix) about darkplaces HOT 3 OPEN

Baker7 avatar Baker7 commented on August 11, 2024 1
r_drawworld 0 fails (fix)

from darkplaces.

Comments (3)

hemebond avatar hemebond commented on August 11, 2024 1

@Baker7 What does adding that line do? Is it because cl.csqc_vidvars.drawworld is not set in that code branch/path, but is set in the first?

Can you also give me an example of how I would test the fix, please?

from darkplaces.

Baker7 avatar Baker7 commented on August 11, 2024

To test: Start up a map

Type r_drawworld 0 ... it should draw entities and such, but not map. Then type r_drawworld 1, it should draw everything again.

r_drawworld 0 can be invaluable during engine or map testing, you can see every entity being draw from your view.

You can also use it to determine if something is an entity.

// if CSQC is loaded, it is required to provide the CSQC_UpdateView function,
	// and won't render a view if it does not call that.
	if (cl.csqc_loaded) {
		CL_VM_UpdateView(r_stereo_side ? 0.0 : max(0.0, cl.time - cl.oldtime));
	}
	else
	{
		cl.csqc_vidvars.drawworld = r_drawworld.integer != 0; // Baker: this line missing <===== ===== ==== JUST ADD THIS

		// Prepare the scene mesh for rendering - this is lightning beams and other effects rendered as normal surfaces
		CL_MeshEntities_Scene_FinalizeRenderEntity();

		CL_UpdateEntityShading();
		R_RenderView(0, NULL, NULL, r_refdef.view.x, r_refdef.view.y, r_refdef.view.width, r_refdef.view.height);
	}

from darkplaces.

hemebond avatar hemebond commented on August 11, 2024

I tried adding that line and it caused a segfault in demo1, when the player takes a grenade to the face, when r_drawworld is 0.

    Engine Crash: Segmentation fault    
./darkplaces-sdl(CL_ParticleExplosion+0x19c)[0x55dfa2ea5e43]
./darkplaces-sdl(+0xd2eb0)[0x55dfa2ea7eb0]
./darkplaces-sdl(+0xd8c3c)[0x55dfa2eadc3c]
./darkplaces-sdl(CL_ParticleBox+0x1f)[0x55dfa2eadd6d]
./darkplaces-sdl(CL_ParticleEffect+0x21)[0x55dfa2eadd94]
./darkplaces-sdl(+0xc59cc)[0x55dfa2e9a9cc]
./darkplaces-sdl(CL_ParseServerMessage+0x2c72)[0x55dfa2e9e277]
./darkplaces-sdl(CL_ReadDemoMessage+0x334)[0x55dfa2e7e179]
./darkplaces-sdl(CL_Frame+0x355)[0x55dfa2e92be5]
./darkplaces-sdl(Host_Main+0x1b6)[0x55dfa2f2f328]
./darkplaces-sdl(main+0x1f4)[0x55dfa304abff]
/lib/x86_64-linux-gnu/libc.so.6(+0x276ca)[0x7f19948856ca]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85)[0x7f1994885785]
./darkplaces-sdl(_start+0x21)[0x55dfa2e4cd71]
DarkPlaces-Quake Linux, buildstring: v20140513-1463-g58dc7879~ Apr 14 2024 debug
Segmentation fault
diff --git a/cl_screen.c b/cl_screen.c
index 04d25a01..6f0d3ccc 100644
--- a/cl_screen.c
+++ b/cl_screen.c
@@ -1686,6 +1686,8 @@ static void SCR_DrawScreen (void)
                        CL_VM_UpdateView(r_stereo_side ? 0.0 : max(0.0, cl.time - cl.oldtime));
                else
                {
+                       cl.csqc_vidvars.drawworld = r_drawworld.integer != 0;
+
                        // Prepare the scene mesh for rendering - this is lightning beams and other effects rendered as normal surfaces
                        CL_MeshEntities_Scene_FinalizeRenderEntity();

from darkplaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.