Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion HD Backgrounds

Content

Warnings

  1. Unresolved dependency reference to oolite.oxp.Norby.HDBG-B:0
  2. No version in dependency reference to oolite.oxp.Layne.DockingFees:null
  3. No version in dependency reference to oolite.oxp.Norby.HDBG-A:null
  4. No version in dependency reference to oolite.oxp.Norby.HDBG-B:null
  5. Optional Expansions mismatch between OXP Manifest and Expansion Manager at character position 0062 (DIGIT ZERO vs LATIN SMALL LETTER N)

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Show station specific high resolution background images on Arrival Reports. Docking Fees OXP can help to see these more times. Prepared mission screens can use these images also. System screens are unchanged (handled by BackGroundSet, Better Screens and Xenon UI). Show station specific high resolution background images on Arrival Reports. Docking Fees OXP can help to see these more times. Prepared mission screens can use these images also. System screens are unchanged (handled by BackGroundSet, Better Screens and Xenon UI).
Identifier oolite.oxp.Norby.HDBG oolite.oxp.Norby.HDBG
Title HD Backgrounds HD Backgrounds
Category Ambience Ambience
Author Norby Norby
Version 1.0 1.0
Tags safe safe
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
  • oolite.oxp.Layne.DockingFees:0
  • oolite.oxp.Norby.HDBG-A:0
  • oolite.oxp.Norby.HDBG-B:0
  • oolite.oxp.Layne.DockingFees:
  • oolite.oxp.Norby.HDBG-A:
  • oolite.oxp.Norby.HDBG-B:
  • Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/HDBG n/a
    Download URL https://wiki.alioth.net/img_auth.php/1/18/HDBG_1.0.oxz n/a
    License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
    File Size n/a
    Upload date 1610873240

    Documentation

    Also read http://wiki.alioth.net/index.php/HD%20Backgrounds

    HDBG_readme.txt

    HD Backgrounds on Arrival Reports
    
    Show station specific high resolution background images in arrival reports.
    System screens are unchanged (handled by BackGroundSet, Better Screens and Xenon UI).
    
    Docking fees OXP is recommended to get more arrival reports.
    
    HD images are gathered in this topic: http://aegidian.org/bb/viewtopic.php?f=7&t=17492
    
    
    Mission screens can show the same image as arrival reports if screenID is set to 'hdbg-station'.
    A specific image of another station is accessible also if the role of the station is given, like 'hdbg-coriolis'.
    
    Custom images can be used in misson screens if a hdbg-mymission.png is placed into any Images folder, the following code is applied and the screenID of the mission screen is set to 'mymission'.
     this.startUp = function() {
      var w = worldScripts.hdbg;
      if( w ) w.$AddRoles([{role:'mymission', file:'hdbg-mymission.png', x:1920, y:1080}]);
     }
    
    You must give 'role' and 'file' at least, but 'x' and 'y' sizes of images are needed to align well in different screen ratios.
    
    You should give data about 'author', 'title', 'license' and 'source' like in this example:
     {role:"coriolis", file:"The_USS_Terraformer_by_Brendan_Biele.png", x:3840, y:2400, zoom:1,
      author:"Brendan Biele", title:"The USS Terraformer", licence:"CC BY-NC-SA 3.0",
      source:"https://www.flickr.com/photos/brendanbiele/5374095042/"}
    
    The optional 'zoom' parameter is usable to force the original aspect ratio of the image regardless of the current screen. If the image is narrower than the screen then will zoom in to fit the width but the screen will crop the image at top and bottom. When image is wider than the screen then zoom into until fill the height of the screen but this cause to extend over the sides horizontally.
    
    Without zoom the image always fit to the height of the screen but will be shrinked horizontally if too wide, like a 16:9 image on an old 4:3 monitor or stretched horizontally if too narrow, for example a 16:10 image on a 16:9 screen.
    
    When you insert a 16:9 image you must decide which case will be looking better in a narrow 4:3 screen, the zoomed without sides or the stretched which fit into the screen but distorted.
    
    If there are not so much important things in the sides and the cut lines at 5-5% for 16:10 and 12.5-12.5% for 4:3 will not break apart anything (like a human figure) then you can use 'zoom:1'.
    When no circles or other objects on the image which looks bad if shrinked horizontally then you can left out the zoom parameter so shrink the image into the screen.
    
    If you insert a 4:3 image then you must decide the same but the cut lines are at the top and bottom.
    
    When you insert a 16:10 or other exotic images then you must check both cases: side cuts for the 4:3 monitor users and top-bottom for 16:9 widescreen users before choose zoom:1. Requesting to stretch to the screen with distortion by leaving out the zoom parameter is usually better in this case.
    
    When an image is problematic both in zoomed and distorted mode then you can use 'zoom:-1' which will zoom out until the whole image fit into the screen, but this leave black bars at the top and bottom if the image is too wide or at the sides if too narrow, so this should be the last resort.
    
    
    
    Credits:
    
    Thanks for all authors of included images for the hard works and given permissions.
    
    The list of authors and sources are in the script.js files in HD image packs.
    
    
    Instructions:
    
    Do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation.
    
    License:
    
    This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0.
    If you are re-using any piece of this OXP, please let me know by sending an e-mail to norbylite@gmail.com.
    
    
    Changelog:
     2015.06.08. v1.0  First release.
    

    Equipment

    This expansion declares no equipment. This may be related to warnings.

    Ships

    This expansion declares no ships. This may be related to warnings.

    Models

    This expansion declares no models. This may be related to warnings.

    Scripts

    Path
    Scripts/hdbg.js
    "use strict";
    this.name	= "hdbg";
    this.author	= "Norby";
    this.copyright	= "2015 Norby";
    this.description= "HD Backgrounds on Arrival Reports";
    this.licence	= "CC BY-NC-SA 4.0";
    
    this.$Roles = []; //fill in scripts of image packs after the 0. image of unknown stations
    this.$R = [{ role:"unknown", file:"Dead_End_Final_by_Kheng_Teoh.png", x:1024, y:768, zoom:1,
    		author:"Kheng Teoh", title:"Dead End",
    		license:"no problem as long as you use cite the source",
    		source:"http://kheng.deviantart.com/art/Dead-End-Final-9278839"
    	}];
    	
    //worldscript events
    this.startUp = function() {
    	var w = worldScripts.hdbg;
    	if( w ) w.$AddRoles(this.$R);
    }
    
    this.guiScreenChanged = function(to, from) {
    	var ps = player.ship;
    	if( ps.docked && from == "GUI_SCREEN_REPORT" ) ps.hudHidden = false; //restore HUD
    	if( !ps.docked || to != "GUI_SCREEN_REPORT" && to != "GUI_SCREEN_MISSION" ) return;
    
    	var id = -1;
    	if( mission && mission.screenID && mission.screenID.indexOf("hdbg-") == 0 ) {
    		//mission screen requested a HD background?
    		var m = mission.screenID;
    		if( m == "hdbg-station" ) id = 0; //select image of the station below
    		else for( var i = 0; i < len; i++ ) {
    			var r = this.$Roles[i];
    			if( r && r.role && "hdbg-"+r.role == m ) { //like hdbg-coriolis
    				id = i; //found station role
    				i = len; //exit from for cycle
    			}
    		}
    	}
    	if( to == "GUI_SCREEN_MISSION" && id == -1 ) return; //no supported screenID
    
    	if( id < 0 ) id = 0; //0. item in $ID is "unknown"
    	if( id == 0 ) { //arrival report or unspecified missionscreen with HD background
    		var s = ps.dockedStation;
    		var len = this.$Roles.length;
    		if( s && s.hasRole ) for( var i = 0; i < len; i++ ) {
    			var r = this.$Roles[i];
    			if( r && r.role && s.hasRole( r.role ) ) {
    				id = i; //found station role
    				i = len; //exit from for cycle
    			}
    		}
    	}
    
    	var p = this.$Roles[id];
    	if( !this.$SetHDBG( p.file, p.x, p.y, p.zoom ) ) { //show in the real size in fullHD
    		var q = this.$Roles[0];  //fallback to the 0. image (defined above)
    		this.$SetHDBG( q.file, q.x, q.y, q.zoom );
    	}
    	if( to == "GUI_SCREEN_REPORT" ) ps.hudHidden = true; //hide HUD for HD images
    }
    
    //HDBG functions
    this.$AddRoles = function(roles) { //called by image packs, roles must be an array!
    	var h = worldScripts.hdbg;
    	var w = worldScripts.XenonUI;
    	if( roles && roles.length ) for( var i = 0; i < roles.length; i++ ) {
    		var ri = roles[i];
    		var ro = ri.role;
    		if( ro && ri.file ) { //at least role and filename is needed
    			h.$Roles.push(ri);
    			if (w) w.$addMissionScreenException("hdbg-"+ro);
    		}
    	}
    }
    
    this.$SetHDBG = function(pic, x, y, zoom) {  //show pic in real size in fullHD
    	var he = 480;
    	var wi = 0;
    	
    	//determine screen ratio
    	var o = oolite.gameSettings.gameWindow;
    //	if(o.width > 1.55 * o.height && o.width < 1.75 * o.height) {
    		//todo in 16:10
    //	}
    	var r = o.width / o.height; //screen ratio, 1.6 mean 16:10
    	if( x > 0 && y > 0 ) { //can stretch only if image sizes are given
    		if( x / y < r ) { //image is narrower than the screen
    			if( zoom < 0 ) wi = 0; //zoom out, fit height and leave black side bars
    			else {
    				if( zoom > 0 ) he = 0; //zoom (fit width, crop at top and bottom)
    				wi = r * 480; //or stretch horizontally without zoom,
    			}
    			//for example a 4:3 image in 16:9 screen will be stretched
    		} else if( zoom < 0 ) { //image is wider than the screen
    			//zoom out, fit width and leave black bars at top and bottom
    			he = 0;
    			wi = r * 480; 
    		} else {  //zoom (fit height, crop at sides)
    			if( !zoom ) wi = r * 480; //shrink horizontally if no zoom and too wide
    			//for example a 16:9 image in 4:3 screen will be shrinked
    		}
    	} //without image sizes fit to the height, crop if too wide or leave black bars if narrow
    	
    //	log(this.name, "setHDBG "+pic+" "+x+"x"+y+" wid:"+wid);
    	if( wi == 0 && he > 0 ) 
    		return( setScreenBackground({ name: pic, height: he }) );
    	else if( wi > 0 && he == 0 ) 
    		return( setScreenBackground({ name: pic, width: wi }) );
    	else return( setScreenBackground({ name: pic, height: he , width: wi }) );
    }