Function for checking if an object is on the Viewport?

Freeform discussion about anything related to modding Transcendence.
Post Reply
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Can't find it, probably me just being herp derp :/
The viewport is the screen you see ships in, I saw it once, but it was probably only a reference to the viewport vocab on trac or something.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

are you looking for the various "reconned" functions ? Only for stations, you can check if the station has been viewed by the player.

http://xelerus.de/index.php?s=function_ser&search=recon
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

No, there is no existing function for checking whether a spaceObject can be seen on the screen.

Well, there wasn't:

Code: Select all

	(block Nil
		(setq sineTimes1000 
			(lambda (angle)
				(item '(0 17 35 52 70 87 105 122 139 156 174 191 208 225 242 259 276 292 309 326 342 358 375 391 407 423 438 454 469 485 500 515 530 545 559 574 588 602 616 629 643 656 669 682 695 707 719 731 743 755 766 777 788 799 809 819 829 839 848 857 866 875 883 891 899 906 914 921 927 934 940 946 951 956 961 966 970 974 978 982 985 988 990 993 995 996 998 999 999 1000 1000 1000 999 999 998 996 995 993 990 988 985 982 978 974 970 966 961 956 951 946 940 934 927 921 914 906 899 891 883 875 866 857 848 839 829 819 809 799 788 777 766 755 743 731 719 707 695 682 669 656 643 629 616 602 588 574 559 545 530 515 500 485 469 454 438 423 407 391 375 358 342 326 309 292 276 259 242 225 208 191 174 156 139 122 105 87 70 52 35 17 0) angle)
			)
		)
		(setq cosineTimes1000 
			(lambda (angle)
				(item '(1000 1000 999 999 998 996 995 993 990 988 985 982 978 974 970 966 961 956 951 946 940 934 927 921 914 906 899 891 883 875 866 857 848 839 829 819 809 799 788 777 766 755 743 731 719 707 695 682 669 656 643 629 616 602 588 574 559 545 530 515 500 485 469 454 438 423 407 391 375 358 342 326 309 292 276 259 242 225 208 191 174 156 139 122 105 87 70 52 35 17 0 17 35 52 70 87 105 122 139 156 174 191 208 225 242 259 276 292 309 326 342 358 375 391 407 423 438 454 469 485 500 515 530 545 559 574 588 602 616 629 643 656 669 682 695 707 719 731 743 755 766 777 788 799 809 819 829 839 848 857 866 875 883 891 899 906 914 921 927 934 940 946 951 956 961 966 970 974 978 982 985 988 990 993 995 996 998 999 999 1000 1000) angle)
			)
		)
		(setq RPC_objIsOnScreen
			(lambda (spaceObject)
				(block (distance angle)
					(setq distance (objGetDistance gPlayership spaceObject))
					(if (or (gr (setq angle (modulo (sysCalcFireSolution (sysVectorSubtract (objGetpos spaceObject) (objGetpos gPlayership)) (sysPolarVelocity 0 0) 1) 180)) 143) (ls angle 37))
						(if (ls (multiply (cosineTimes1000 angle) distance) 22000) <!-- Closer to the sides of the screen -->
							true
							Nil
						)
						(if (ls (multiply (sineTimes1000 angle) distance) 17000) <!-- Closer to the top/bottom of the screen -->
							true
							Nil
						)
						<!-- 
							Viewport is 21x16 ls, 1024x768 px
							37 = arctan(768/1024)
							143 = 180 - arctan(768/1024)
						-->
					)
				)
			)
		)
	)
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
User avatar
Cygnus.X1
Militia Lieutenant
Militia Lieutenant
Posts: 245
Joined: Sun Feb 24, 2008 6:21 pm
Location: Elysium Fields... I mean System
Contact:

Too much maths for me Image no please, don't try to explain :oops:

Based on some notes I took while figuring out distances from the playership in light seconds:
  • The SRS is a rectangle, but the player ship is centered on the screen... round pegs in square(ish) holes.
  • 1 lightsecond is the minimum distance a polar vector function will add, so fractional remainders are estimated.
  • maximum cardinal vertical radial distance is 16.1 ls
  • maximum cardinal horizontal radial distance is 21.5 ls
  • max radial distance to corners is about 26.5 ls
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

TVR: Thanks!
CygnusX1: I ended up hacking it by using ObjGetDistance from the playership and made a circle of 50 ls radius....
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Cygnus.X1
Militia Lieutenant
Militia Lieutenant
Posts: 245
Joined: Sun Feb 24, 2008 6:21 pm
Location: Elysium Fields... I mean System
Contact:

RPC wrote:CygnusX1: I ended up hacking it by using ObjGetDistance from the playership and made a circle of 50 ls radius....
So that's going to be half the distance of visibility on the LRS (100 ls total radial), and more or less twice the distance of visibility on the SRS.
Post Reply