Bug fix - Correct viewangles on load game
Moderator: InsideQC Admins
12 posts
• Page 1 of 1
Bug fix - Correct viewangles on load game
This is another one of those little Quake annoyances - when you load a previously saved game your viewangles are incorrect - you're normally looking straight forward instead of in the actual direction you were looking, which may have been up or down. Let's fix it.
Find Host_Spawn_f and declare at the top:
Scroll down to the line where svc_setangle is sent (near the bottom) and add this between the MSG_WriteByte and the for loop:
Finally, change the body of the for loop to this:
Done - now when you reload you'll be looking in the correct direction. Easy as pie.
Find Host_Spawn_f and declare at the top:
- Code: Select all
float *sendangle;
Scroll down to the line where svc_setangle is sent (near the bottom) and add this between the MSG_WriteByte and the for loop:
- Code: Select all
sendangle = sv.loadgame ? ent->v.v_angle : ent->v.angles;
Finally, change the body of the for loop to this:
- Code: Select all
MSG_WriteAngle (&host_client->message, sendangle[i]);
Done - now when you reload you'll be looking in the correct direction. Easy as pie.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Bug fix - Correct viewangles on load game
I like this one a lot. In fact, I wasn't aware of the problem.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Bug fix - Correct viewangles on load game

Sadly I have NEVER saved a game in Quake....
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Bug fix - Correct viewangles on load game
Sweet, even works in winquake.
LOL people would play more carefully without savegame.r00k wrote:Sadly I have NEVER saved a game in Quake....
-
qbism - Posts: 1236
- Joined: Thu Nov 04, 2004 5:51 am
Re: Bug fix - Correct viewangles on load game
I mean i finish an episode, quit then come back to start 'nother misston, end the go again, oyd not like its that hard...
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Bug fix - Correct viewangles on load game
Thanks mh! This will be really helpful for me, since I often use saves to test features and bugfixes in my engine.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
Re: Bug fix - Correct viewangles on load game
mh: heh, I'd never noticed. I guess I'd always saved in a near enough to horizontal state.
The error is actually worse than just leaving you looking straight forward: it's -1/3 of the correct angle: if you're looking nearly straight down when you save, you'll be looking up at a bit less than 30 degrees when you load.
Anyway, issue confirmed and fixed* in QuakeForge. Thanks for the heads-up.
*Not yet pushed due to technical difficulties with the git repository on sourceforge
The error is actually worse than just leaving you looking straight forward: it's -1/3 of the correct angle: if you're looking nearly straight down when you save, you'll be looking up at a bit less than 30 degrees when you load.
Anyway, issue confirmed and fixed* in QuakeForge. Thanks for the heads-up.
*Not yet pushed due to technical difficulties with the git repository on sourceforge
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
- taniwha
- Posts: 399
- Joined: Thu Jan 14, 2010 7:11 am
Re: Bug fix - Correct viewangles on load game
mh wrote:This is another one of those little Quake annoyances - when you load a previously saved game your viewangles are incorrect - you're normally looking straight forward instead of in the actual direction you were looking, which may have been up or down. Let's fix it.
I had an aguirRe type of thought.
Perhaps this behavior was intentional for keyboarders? I mean if you load a game and you are looking up or down, that isn't a keyboard initiated action so force_centerview isn't going to fix where you were looking.
Just a thought, but I'm thinking might not have been a bug but a feature.
(I also haven't thought about the code, so maybe I'm missing something obvious ... )
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Bug fix - Correct viewangles on load game
Hmm - "intentional for keyboarders" is a reasonable assumption here, but unfortunately in the absence of comments on the relevant code, we'll never know for certain.
All the same, pitch drifting would resolve that on the client side, and there is the behaviour that taniwha observed - it doesn't just auto-center, it sets your pitch angle to -(viewangle * 0.3333f). That comes from some SV_ClientThink code:
We do know that "e->angles[0] = -e->angles[0];" is flagged as a "stupid quake bug" elsewhere in the engine too, so I'm thinking that balance of probability indicates that this one is actually a bug too.
All the same, pitch drifting would resolve that on the client side, and there is the behaviour that taniwha observed - it doesn't just auto-center, it sets your pitch angle to -(viewangle * 0.3333f). That comes from some SV_ClientThink code:
- Code: Select all
if (!sv_player->v.fixangle)
{
angles[PITCH] = -v_angle[PITCH] / 3;
angles[YAW] = v_angle[YAW];
}
We do know that "e->angles[0] = -e->angles[0];" is flagged as a "stupid quake bug" elsewhere in the engine too, so I'm thinking that balance of probability indicates that this one is actually a bug too.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Bug fix - Correct viewangles on load game
This one definitely is a bug as you do not look straight forward when loading the game: you look 1/3 of the angle in the opposite direction. Quite bad news for a keyboarder, I'd say.
Anyway, problems with git fixed: pushed.
Anyway, problems with git fixed: pushed.
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
- taniwha
- Posts: 399
- Joined: Thu Jan 14, 2010 7:11 am
Re: Bug fix - Correct viewangles on load game
It's worth noting as well that this one is fixed in Quake 2.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Bug fix - Correct viewangles on load game
This is a very nice fix. I never noticed how the load game angle was screwed up.
And this fix works properly with -mlook or +mlook ... so doesn't change even speculated behavior.
If +mlook, you stay looking at the ceiling if saved that way.
If -mlook, you load looking at the ceiling but it drifts down to level like force_centerview would.
It is perfect.
And this fix works properly with -mlook or +mlook ... so doesn't change even speculated behavior.
If +mlook, you stay looking at the ceiling if saved that way.
If -mlook, you load looking at the ceiling but it drifts down to level like force_centerview would.
It is perfect.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
12 posts
• Page 1 of 1
Return to Programming Tutorials
Who is online
Users browsing this forum: No registered users and 1 guest