Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri May 24, 2013 8:44 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Jan 08, 2012 8:52 pm 
Offline
Engineer
Engineer

Joined: Sun Jan 08, 2012 8:29 pm
Posts: 8
Hi,
We (a friend and I) are currently developing a NewGRF with some French locos and we are going to pack them in a NewGRF.
We use the NML language to generate the NewGRF and it works fine.
However, we would like to have it on 32bpp graphics (as we design the locos with blender) but we don't manage to see them in game.
Here is the code:

Code:
grf {
  // Some stuff
}

railtypetable {
  RAIL, ELRL, HSTR
}

template tmpl_z2_train() {
  // Dimensions of the graphics
}

template tmpl_z1_train() {
  // Dimensions of the graphics
}

template tmpl_z0_train() {
   // Dimensions of the graphics
}

template tmpl_8bpp_train() {
  // Dimensions of the graphics
}

template tmpl_single_train() {
  [1, 161, 53, 14, -25, -10] //xpos ypos xsize ysize xrel yrel
}

spriteset(nez_casse_sprite, "img/nez_casse_mask.png") { tmpl_8bpp_train() }
spriteset(nez_casse_purch, "img/nez_casse_mask.png") { tmpl_single_train() }

// 32-bpp support
alternative_sprites(nez_casse_sprite, ZOOM_LEVEL_Z0, "img/nez_casse.png") { tmpl_z0_train() }
alternative_sprites(nez_casse_sprite, ZOOM_LEVEL_Z1, "img/nez_casse.png") { tmpl_z1_train() }
alternative_sprites(nez_casse_sprite, ZOOM_LEVEL_Z2, "img/nez_casse.png") { tmpl_z2_train() }

item(FEAT_TRAINS, nez_casse1) {
  property {
    // Parameters of the loco
  }
  graphics {
    default: nez_casse_sprite;
    purchase: nez_casse_purch;
  }
}



The img/nez_casse.png is a full-red RGBA image (we don't have generated the images from blender yet) and the img/nez_casse_mask.png is a palette-bases image that contains a 8bpp loco in the Windows palette (this is actually the example loco from NML doc).

In game, with OpenTTD 1.1.0 32bpp-patched, the loco just appears as 8bpp, the alternative_sprites section seems ignored.

Does anybody have a clue to solve this?
Regards,
felixzero


Top
 Profile  
 
PostPosted: Sun Jan 08, 2012 8:56 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Mar 19, 2009 7:25 pm
Posts: 1568
Location: Paddock Wood, England
32bpp graphics use TAR files rather than PNGs, im not sure how this affects it on a coding level, but i understand that if you try to use PNGs you will only get 8bpp graphics.

_________________
Image
|UK Roads /w Signs|British Rail Openttd Set (BROS)|
|Road Types NewGRF Specification|Leanden's Screenshots|


Top
 Profile  
 
PostPosted: Sun Jan 08, 2012 9:29 pm 
Offline
Engineer
Engineer

Joined: Sun Jan 08, 2012 8:29 pm
Posts: 8
Leanden wrote:
32bpp graphics use TAR files rather than PNGs, im not sure how this affects it on a coding level, but i understand that if you try to use PNGs you will only get 8bpp graphics.


But in this case, what would be the use of alternative_sprites ?


Top
 Profile  
 
PostPosted: Sun Jan 08, 2012 9:47 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
felixzero wrote:
Leanden wrote:
32bpp graphics use TAR files rather than PNGs, im not sure how this affects it on a coding level, but i understand that if you try to use PNGs you will only get 8bpp graphics.


But in this case, what would be the use of alternative_sprites ?

It splits the original png files in correctly numbered png files with proper encoding. NML places those files in a "sprites/" directory. Those png files should be in "sprites/<name_of_newgrf>/*.png" instead of "sprites/*.png".


Top
 Profile  
 
PostPosted: Sun Jan 08, 2012 10:16 pm 
Offline
Engineer
Engineer

Joined: Sun Jan 08, 2012 8:29 pm
Posts: 8
Yexo wrote:
felixzero wrote:
Leanden wrote:
32bpp graphics use TAR files rather than PNGs, im not sure how this affects it on a coding level, but i understand that if you try to use PNGs you will only get 8bpp graphics.


But in this case, what would be the use of alternative_sprites ?

It splits the original png files in correctly numbered png files with proper encoding. NML places those files in a "sprites/" directory. Those png files should be in "sprites/<name_of_newgrf>/*.png" instead of "sprites/*.png".

Oh! Thank you! I just didn't realized that nmlc created this folder. Now it just works fine.
I hope I will be back with a nice train set then.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.