Quake3World.com Forums
     Programming Discussion
        CVAR_Update: handle out of range


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: CVAR_Update: handle out of range

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 12-21-2011 02:27 AM           Profile   Send private message  E-mail  Edit post Reply with quote


I ran into a bug with my mod where the game crashes (back to the menu if running as qvm and a hard crash if running as dll). If it crashes back to the menu I get this error message: "CVAR_Update: handle out of range".
This happens only when the g_synchronousclients cvar is set to 1 and the mod starts an in-game cutscene.

In g_misc.c (line 63) you can see how cutscenes are implemented. It builds an info string and sets that as configstring. In cg_view.c there's the CG_CalcCutsceneViewValues function which reads the configstring and translates it back to a view position. It adjusts the cg.refdef values to move the player's view to the desired position.

Also, to make sure the client is in the same vis area as the camera should be (so the world is actually drawn), server-side the client's position is updated as well. This is done in g_main.c in the G_RunCutscene function (line 1400). It's called from G_RunFrame.

What's probably also of importance is that the player's pmove_type is set to PM_CUTSCENE, a new constant.

I guess this method does something that g_synchronousclients doesn't really like, but I'm not sure what exactly goes wrong (or what g_synchronousclients really does). I tried building ioQuake so I could take a closer look at what happens there, but when trying to build the ioq3.sln from the misc\msvc folder I get the error "cannot open input file 'SDLmain.lib'"




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 12-21-2011 06:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


Compile a debug build, put a breakpoint on the error message (it's somewhere in qcommon/cvar.c) and inspect the stack backtrace when the breakpoint is hit.

Eraser wrote:
II tried building ioQuake so I could take a closer look at what happens there, but when trying to build the ioq3.sln from the misc\msvc folder I get the error "cannot open input file 'SDLmain.lib'"

You probably need to point MSVC to it, it's in code/libs/win(32|64)




Top
                 

Veteran
Veteran
Joined: 17 May 2011
Posts: 159
PostPosted: 08-10-2013 01:17 AM           Profile Send private message  E-mail  Edit post Reply with quote


Oh ! An old topic about a contemporary problem of mine !

^misantropia^ wrote:
Compile a debug build, put a breakpoint on the error message (it's somewhere in qcommon/cvar.c) and inspect the stack backtrace when the breakpoint is hit.


I'm using minGW and Msys to compile ioquake3, and I can compile a debug build. I located the error message in cvar.c, and I'm pretty sure I can get the info out of the cvar_t that breaks everything.

But what I'm really not sure about is understand the meaning or find the original cvar causing the trouble.

Can I have more information about that breakpoint method ?

Eraser, did you solve that error in another way that setting g_synchronousclients to 0 ?



_________________
My blog - My portfolio
---------------------
MJDM2 - DmeatSP01 - DmeatSP02


Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 08-10-2013 07:27 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Nope, never figured it out. I implemented a workaround by automtically disabling synchronous clients while running a cutscene. This behavior can be disabled through a cvar if someone wants to (manually disabling and enabling synchronous clients gives a nicer result, if timed right).

If you feel up to fixing the bug, go ahead. I'll merge the changes into the trunk.




Top
                 

Veteran
Veteran
Joined: 17 May 2011
Posts: 159
PostPosted: 08-10-2013 10:33 AM           Profile Send private message  E-mail  Edit post Reply with quote


I encounted the problem on my own project, and I don't think this time it has anything to do with g_synchronousclients ... sorry :)

What I do is I run a function that sets a "global" variable when the map is loaded. The funny thing is that the function seems to run well (The com_printf prints what it's told to before the error) and the "handle out of range" happens right after.

By the way, I declared my variable along with :
Code:
cg_t            cg;
cgs_t            cgs;
centity_t         cg_entities[MAX_GENTITIES];
weaponInfo_t      cg_weapons[MAX_WEAPONS];
itemInfo_t         cg_items[MAX_ITEMS];

//Insert here "global variable of the loopmap ? the map bounds vectors and the temp directions to shift concerned entities position
vec3_t            cg_loopBounds[2][8];
loopDirections_t   cg_loopDirections[3];

line 85.



_________________
My blog - My portfolio
---------------------
MJDM2 - DmeatSP01 - DmeatSP02


Top
                 

Veteran
Veteran
Joined: 17 May 2011
Posts: 159
PostPosted: 08-18-2013 05:32 AM           Profile Send private message  E-mail  Edit post Reply with quote


I "solved" the problem by declaring my array variable inside the cg_t structure (named "cg" inside the cgame chapter).

No explanation about anything though.



_________________
My blog - My portfolio
---------------------
MJDM2 - DmeatSP01 - DmeatSP02


Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.