Bug 5005 - change setviewpos to work as it sounds like
Status: NEW
Alias: None
Product: Tremulous
Classification: Unclassified
Component: Misc
Version: SVN HEAD
Hardware: All All
: P3 normal
Assignee: Tim Angus
QA Contact: Tremulous Bugs
URL:
Depends on: 5000
Blocks: 5008 5086
 
Reported: 2011-05-23 21:34 EDT by /dev/humancontroller
Modified: 2011-07-18 14:47:39 EDT
1 user (show)

See Also:


Attachments
change setviewpos to work as it sounds like (4.90 KB, patch)
2011-05-23 21:34 EDT, /dev/humancontroller
change setviewpos to work as it sounds like (4.89 KB, patch)
2011-06-10 04:44 EDT, /dev/humancontroller

Description /dev/humancontroller 2011-05-23 21:34:49 EDT
Created attachment 2742 [details]
change setviewpos to work as it sounds like

setviewpos now precisely puts the player's view origin to the specified coordinates, and does not spit the player forward. it now optionally takes yaw and pitch arguments.

for this, setviewpos takes ps->viewheight into account when teleporting the player. TeleportPlayer() now takes an addition float argument specifying how fast spit the player forward, currently it's called with 0 only from the setviewpos function.
Comment 1 Ben Millwood 2011-06-09 07:27:55 EDT
Um, you don't actually *use* the speed value in Teleport, apart from checking it is nonzero (with a float equality comparison, naughty)

I'm undecided whether setviewpos should take viewheight into account. I don't think that's what I'd expect while using it.
Comment 2 /dev/humancontroller 2011-06-10 04:44:51 EDT
Created attachment 2771 [details]
change setviewpos to work as it sounds like

a fixed and improved version of the previous patch
Comment 3 /dev/humancontroller 2011-06-10 04:50:00 EDT
(In reply to comment #1)
> I'm undecided whether setviewpos should take viewheight into account. I don't
> think that's what I'd expect while using it.

setviewpos is a companion function to the viewpos function, both should operate your view origin (setting and displaying, respectively). there is also a function named "where", which prints out your player entity's internal origin, and a corresponding function ("teleport" or "setpos") could be added to set that origin.
Comment 4 Ben Millwood 2011-06-10 05:50:18 EDT
Okay, I agree that /setviewpos and /viewpos should be consistent.

I'm somewhat inclined to move the whole "spit the player out" logic out of TeleportPlayer, possibly into a separate SpitPlayer function. If you want to do that that would be great, otherwise I'll probably commit what you've done already.
Comment 5 /dev/humancontroller 2011-06-10 12:15:47 EDT
(In reply to comment #4)
> I'm somewhat inclined to move the whole "spit the player out" logic out of
> TeleportPlayer, possibly into a separate SpitPlayer function.

then we would be basically calling TeleportPlayer and SpitPlayer consecutively (or renaming TeleportPlayer to TeleportAndSpitPlayer) because the majority of the code utilizes spitting. are you still inclined?
Comment 6 Ben Millwood 2011-06-10 12:53:36 EDT
We'd be using them consecutively in three places, one of which we want to remove to fix #2757, so yes, I'm still inclined, especially as those might not be the only places where SpitPlayer would be used (what about spawning aliens, for example?)
Comment 7 /dev/humancontroller 2011-06-13 01:14:49 EDT
after a trial i'd say that i can't be assed to do the spit separation.
Comment 8 /dev/humancontroller 2011-06-16 12:14:30 EDT
to cleanly apply this patch, first apply attachment 2737 [details] of bug 5000.