MantisBT - Zandronum
View Issue Details
0004007Zandronum[All Projects] Suggestionpublic2022-05-29 07:582022-12-01 18:50
Penguin 
Kaminsky 
normalfeatureN/A
resolvedfixed 
3.1 
3.23.2 
0004007: New actor pointer that can return a player's camera view
Currently TID is required to get the player number that is spying for. Therefore, if players are using the same TID, it cannot be obtained.

Current method
int GetPlayerSpyPN (int MyPN)
{
    SetActivator(CheckPlayerCamera(MyPN)); //TID assignment required
    int SpyPN = ConsolePlayerNumber();
    SetActivatorToPlayer(MyPN);
    
    return SpyPN;
}
No tags attached.
? 4007.wad (1,946) 2022-12-01 15:17
https://zandronum.com/tracker/file_download.php?file_id=2786&type=bug
? 4007_v2.wad (1,883) 2022-12-01 18:05
https://zandronum.com/tracker/file_download.php?file_id=2788&type=bug
Issue History
2022-05-29 07:58PenguinNew Issue
2022-05-29 14:53PenguinNote Added: 0022243
2022-06-04 15:00PenguinNote Added: 0022262
2022-06-06 20:11KaminskyNote Added: 0022264
2022-06-06 20:11KaminskyAssigned To => Kaminsky
2022-06-06 20:11KaminskyStatusnew => needs testing
2022-06-06 20:11KaminskyProduct Version => 3.1
2022-06-06 20:11KaminskyTarget Version => 3.2
2022-06-06 20:11KaminskySummaryGetPlayerNumberForSpy() => New actor pointer that can return a player's camera view
2022-06-06 20:11KaminskyDescription Updatedbug_revision_view_page.php?rev_id=13638#r13638
2022-12-01 15:17KaminskyFile Added: 4007.wad
2022-12-01 15:23KaminskyNote Added: 0022512
2022-12-01 17:38WaTaKiDNote Added: 0022516
2022-12-01 18:05KaminskyFile Added: 4007_v2.wad
2022-12-01 18:07KaminskyNote Added: 0022517
2022-12-01 18:08KaminskyNote Edited: 0022517bug_revision_view_page.php?bugnote_id=22517#r13775
2022-12-01 18:46WaTaKiDNote Added: 0022519
2022-12-01 18:50KaminskyNote Added: 0022520
2022-12-01 18:50KaminskyStatusneeds testing => resolved
2022-12-01 18:50KaminskyFixed in Version => 3.2
2022-12-01 18:50KaminskyResolutionopen => fixed

Notes
(0022243)
Penguin   
2022-05-29 14:53   
For server
GetPlayerNumberForSpy()

For client
GetConsolePlayerNumberForSpy()
(0022262)
Penguin   
2022-06-04 15:00   
I made a mistake. This is correct.
int GetPlayerSpyPN (int PN)
{
    int SpyPN;
    SetActivator(CheckPlayerCamera(PN)); //TID assignment required
    SpyPN = PlayerNumber(); //TID assignment required
    SetActivatorToPlayer(PN);
    
    return SpyPN;
}
(0022264)
Kaminsky   
2022-06-06 20:11   
After some thought and also discussing it with Penguin on Discord, adding a new actor pointer (e.g. AAPTR_PLAYER_GETCAMERA) that returns the actor a player is currently looking from would be more useful, instead of adding one or two new ACS functions that can only return which player is being spied on. As such, this commit adds the new pointer in 3.2:'http://hg.osdn.net/view/zandronum/zandronum-stable/rev/cf213fe93126 [^]'

I updated the ticket info to reflect on the new feature.
(0022512)
Kaminsky   
2022-12-01 15:23   
I uploaded an example WAD to test AAPTR_PLAYER_GETCAMERA. Here's how it works.

1a. If you're spying on yourself, then the message "you are viewing yourself" is displayed on the screen.

1b. If you're spying on another player, then the message "you are viewing another player named {other player's name}." is displayed.

1c. If you're spying on another actor that isn't a player, then the message "you are viewing an actor with the name {actor's name}." is displayed.

2. If you want to change your view to a non-player actor to test 1c, then you can puke the script "ChangeCamera" while an actor is underneath your crosshair. If successful, your view will change complemented by the message "ChangeCamera: found actor with the name {actor's name}." Otherwise, you get the message "ChangeCamera: couldn't find actor."
(0022516)
WaTaKiD   
2022-12-01 17:38   
using ZandroDev3.2-221030-0316windows-x86_64 with the example wad on windows and euroboros linux servers

1a 1b and 1c all work as a spectator at first, but after joining the game the text in the middle of the screen is permanently stuck as "you are viewing yourself" for that client even if going back to a spectator, but can be fixed by reconnecting
(0022517)
Kaminsky   
2022-12-01 18:07   
(edited on: 2022-12-01 18:08)
I uploaded an updated example WAD that should fix the problem you mentioned. The original script would terminate when the client joined from spectators.

(0022519)
WaTaKiD   
2022-12-01 18:46   
the updated example wad did the trick, things seem peachy now, ty
(0022520)
Kaminsky   
2022-12-01 18:50   
Thanks for checking again, I'll mark this ticket as resolved.