CheckPlayerCamera
Moderator: GZDoom Developers
- Cutmanmike
- Posts: 11353
- Joined: Mon Oct 06, 2003 3:41 pm
- Operating System Version (Optional): Windows 10
- Location: United Kingdom
- Contact:
CheckPlayerCamera
What an earth would that do!?
Checkplayercamera(tid, cameratid)
tid: Thing id of the player (might be better to use player numbers?). 0 = all/any players
cameratid: Thing id of the camera 0 = any camera
This would check if a player is viewing through a camera or not. Handy for things like, say freezing certain actors when the player is busy looking into a camera, or if the player is trying to cheat out of the camera by pressing coopspy.
Checkplayercamera(tid, cameratid)
tid: Thing id of the player (might be better to use player numbers?). 0 = all/any players
cameratid: Thing id of the camera 0 = any camera
This would check if a player is viewing through a camera or not. Handy for things like, say freezing certain actors when the player is busy looking into a camera, or if the player is trying to cheat out of the camera by pressing coopspy.
Re: CheckPlayerCamera
I agree this could be useful, but why in such a limited format? How about, instead of having to pass in both the player and camera TIDs, you just pass in the player TID and it returns the TID of the camera they're viewing?
Re: CheckPlayerCamera
I gave this a try yesterday. I attached a patch to my post.
Syntax is as follows:
CheckPlayerCamera(int tid)
Where tid is the players TID.
This will return the tag of the camera where the player watches through. And if not watching through the camera (so through it's own head) ir will return 0.
EDIT: I forget to make a patch of my ACC files and upload those. But since I do not have time for that right now, I'll do that later today.
Syntax is as follows:
CheckPlayerCamera(int tid)
Where tid is the players TID.
This will return the tag of the camera where the player watches through. And if not watching through the camera (so through it's own head) ir will return 0.
EDIT: I forget to make a patch of my ACC files and upload those. But since I do not have time for that right now, I'll do that later today.
- Attachments
-
PlayerCamera.rar
- (548 Bytes) Downloaded 24 times
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CheckPlayerCamera
Added. But there was a problem in the code: It didn't set a proper return value for non-players.
Re: CheckPlayerCamera
Yeah I now realize that I forget that
.
Anway, here is the ACC patch.

Anway, here is the ACC patch.
- Attachments
-
CheckPlayerCameraACC.rar
- (485 Bytes) Downloaded 28 times
-
-
- Posts: 3205
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: CheckPlayerCamera
Is there a particular reason why this uses the player's TID and not the player's number? I don't think there is something other than a player that we would want to use this on.
Re: CheckPlayerCamera
Very true. This means that, depending on usage, it might be required to assign TIDs to players that would be otherwise unnecessary. I recommend this be changed while it is still in SVN and thus doesn't need any compatibility taken into consideration.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CheckPlayerCamera
Done. I also changed it so that any error returns -1 so that 0 can be used for a player without tid not having a camera.
Re: CheckPlayerCamera
I'm having trouble wrapping my brain around that statement for some reason. Does the function now return -1 if the specified player isn't viewing through a camera? Or does it still return 0, and would return -1 if there was some other problem (like the player not being present, for example)?Graf Zahl wrote:I also changed it so that any error returns -1 so that 0 can be used for a player without tid not having a camera.
AFAIK, there should never be a case where the camera a player is viewing through wouldn't have a TID, since the TID is needed to change the player's viewpoint. (Right?) So 0 could be reserved for "no camera."
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CheckPlayerCamera
It always returns the camera's tid if the passed parameter references a valid player and -1 for any kind of error.