CheckPlayerCamera

Moderator: GZDoom Developers

Post Reply
User avatar
Cutmanmike
Posts: 11353
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

CheckPlayerCamera

Post by Cutmanmike »

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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: CheckPlayerCamera

Post by HotWax »

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?
Thomas
Posts: 53
Joined: Wed May 30, 2007 2:13 pm
Location: The Netherlands

Re: CheckPlayerCamera

Post by Thomas »

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.
Attachments
PlayerCamera.rar
(548 Bytes) Downloaded 24 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: CheckPlayerCamera

Post by Graf Zahl »

Added. But there was a problem in the code: It didn't set a proper return value for non-players.
Thomas
Posts: 53
Joined: Wed May 30, 2007 2:13 pm
Location: The Netherlands

Re: CheckPlayerCamera

Post by Thomas »

Yeah I now realize that I forget that :? .

Anway, here is the ACC patch.
Attachments
CheckPlayerCameraACC.rar
(485 Bytes) Downloaded 28 times
Blzut3
 
 
Posts: 3205
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: CheckPlayerCamera

Post by Blzut3 »

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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: CheckPlayerCamera

Post by HotWax »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: CheckPlayerCamera

Post by Graf Zahl »

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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: CheckPlayerCamera

Post by HotWax »

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.
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)?

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."
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: CheckPlayerCamera

Post by Graf Zahl »

It always returns the camera's tid if the passed parameter references a valid player and -1 for any kind of error.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”