Sailing Ships - Development Topic

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by andythenorth »

This is (uncompiled) code from FISH for the same thing. The capacities are set using C pre-processor defines for each vehicle (this is a template that is reused by different vehicles).

I would recommend you join us in using the openttdcoop build system for grfs - you'll be able to lift quite a bit of FISH code, and you'll get a bit more help and support with problems.

Code: Select all

// PAX capacity is handled if missing.  
// Freight capacity isn't - helps show up errors and omissions with individual ships (compile will fail).
#ifndef THIS_PAX_CAPACITY
  #define THIS_PAX_CAPACITY   00 80 // // define without escapes and setting 80 to make it a cb result
#endif

// warning about default result being same as earlier - can be valid when freight capacity == PAX capacity
//@@WARNING DISABLE 100
-1 * 70	 02 02 E1  // set refitted capacity according to cargo class
                 85 47 10 \w1 // var 47 in format ccccwwtt where I want cccc; mask for just bit 0 (PAX class)
                 \b1 // range
                   THIS_PAX_CAPACITY  \wx01  \wx01 // PAX class
                 THIS_FREIGHT_CAPACITY // default                  
//@@WARNING ENABLE 100

-1 * 0  02 02 E0 // 
              81 10 00 FF
              01 // range
                 E1 00 0D 0D // new capacity
               A0 00 // default (end cb36 checks using ID for applying graphics)

#undef THIS_PAX_CAPACITY
#undef THIS_FREIGHT_CAPACITY


Compiled, it looks like this (this is all the nfo for a Ferry in FISH, except smoke + some strings):

Code: Select all

 1498 * 51	 00 02 \b18 01 72 // Action 0
    00 \w01-01-1970 // date of introduction
    03 \b35 // vehicle life in years
    06 0F // climate availability - use 0F for all, 00 none (to hide vehicle)  
    07 \b30 // loading speed
    08 FF // use new graphics
    09 01 // refittable (0 = no, 1 = yes)
    0A \b50 // cost factor (purchase cost)
    0B \b48 // speed in mph * 3.2      
    0C 00 // cargo type 
    0D \w218 // capacity 
    0F \b83 // running cost factor
    10 05 // sound effect (4=cargo ship, 5=passenger ship)
    11 00 00 00 00 // cargo types available for refitting
    12 00 // callbacks
    17 02 // miscellaneous flags (inc. use 2CC)
    18 FF 00 // refittable cargo classes
    19 00 01 // non-refittable cargo classes
    1A \d01-01-1870 // long format introduction date
 1499 * 19	 04 02 7F 01 72
    01 2F
    "Tiree Ferry" 00

 1500 * 4	 01 02 \b01 08
// buy menu sprites
 1501 * 1	 00
 1502 * 1	 00
 1503 * 1	 00
 1504 * 1	 00
 1505 * 1	 00
 1506 * 1	 00
 1507 sprites/graphics/vehicle_ferry_small.pcx 620 29 01 22 116 -36 -10
 1508 * 1	 00

 1509 * 9	 02 02 B0 // buy menu  
      01 // number loaded states
      01 // loading states
      00 00 // loaded sprites
      00 00 // loading sprites

 1510 * 4	 01 02 \b4 08
// \w00 default unloaded - not moving (no wash)
 1511 sprites/graphics/vehicle_ferry_small.pcx 20 10 01 89 28 -14 -54
 1512 sprites/graphics/vehicle_ferry_small.pcx 60 10 01 66 113 -61 -28
 1513 sprites/graphics/vehicle_ferry_small.pcx 186 10 01 48 138 -36 -29
 1514 sprites/graphics/vehicle_ferry_small.pcx 328 10 01 66 113 -10 -28
 1515 sprites/graphics/vehicle_ferry_small.pcx 454 10 01 89 28 -14 -54
 1516 sprites/graphics/vehicle_ferry_small.pcx 494 10 01 66 113 -55 -26
 1517 sprites/graphics/vehicle_ferry_small.pcx 620 10 01 48 138 -36 -29
 1518 sprites/graphics/vehicle_ferry_small.pcx 762 10 01 66 113 0 -24
// \w01 default unloaded - moving (wash)
 1519 sprites/graphics/vehicle_ferry_small.pcx 20 110 01 89 28 -14 -54
 1520 sprites/graphics/vehicle_ferry_small.pcx 60 110 01 66 113 -61 -28
 1521 sprites/graphics/vehicle_ferry_small.pcx 186 110 01 48 138 -36 -29
 1522 sprites/graphics/vehicle_ferry_small.pcx 328 110 01 66 113 -10 -28
 1523 sprites/graphics/vehicle_ferry_small.pcx 454 110 01 89 28 -14 -54
 1524 sprites/graphics/vehicle_ferry_small.pcx 494 110 01 66 113 -55 -26
 1525 sprites/graphics/vehicle_ferry_small.pcx 620 110 01 48 138 -36 -29
 1526 sprites/graphics/vehicle_ferry_small.pcx 762 110 01 66 113 0 -24
// \w02 default loaded - not moving (no wash)
 1527 sprites/graphics/vehicle_ferry_small.pcx 20 510 01 89 28 -14 -54
 1528 sprites/graphics/vehicle_ferry_small.pcx 60 510 01 66 113 -61 -28
 1529 sprites/graphics/vehicle_ferry_small.pcx 186 510 01 48 138 -36 -29
 1530 sprites/graphics/vehicle_ferry_small.pcx 328 510 01 66 113 -10 -28
 1531 sprites/graphics/vehicle_ferry_small.pcx 454 510 01 89 28 -14 -54
 1532 sprites/graphics/vehicle_ferry_small.pcx 494 510 01 66 113 -55 -26
 1533 sprites/graphics/vehicle_ferry_small.pcx 620 510 01 48 138 -36 -29
 1534 sprites/graphics/vehicle_ferry_small.pcx 762 510 01 66 113 0 -24
// \w03 default loaded - moving (wash)
 1535 sprites/graphics/vehicle_ferry_small.pcx 20 610 01 89 28 -14 -54
 1536 sprites/graphics/vehicle_ferry_small.pcx 60 610 01 66 113 -61 -28
 1537 sprites/graphics/vehicle_ferry_small.pcx 186 610 01 48 138 -36 -29
 1538 sprites/graphics/vehicle_ferry_small.pcx 328 610 01 66 113 -10 -28
 1539 sprites/graphics/vehicle_ferry_small.pcx 454 610 01 89 28 -14 -54
 1540 sprites/graphics/vehicle_ferry_small.pcx 494 610 01 66 113 -55 -26
 1541 sprites/graphics/vehicle_ferry_small.pcx 620 610 01 48 138 -36 -29
 1542 sprites/graphics/vehicle_ferry_small.pcx 762 610 01 66 113 0 -24
 1543 * 13	 02 02 B1 // default cargos - not moving
      02 // number loaded states
      02 // number loading states
      \w00 \w02 // loaded sprites
      \w00 \w02 // loading sprites
 1544 * 11	 02 02 B2 // default cargos - moving  
      02 // number loaded states
      01 // number loading states
      \w01 \w03 // loaded sprites
      \w01 // loading sprites (n/a if moving)
 1545 * 14	 02 02 A0 // choose sprites according to vehicle speed
                 81 B4 00 FF //
                 01 // range
                  B1 00 00 00 // not moving (speed == 0)
                 B2 00 // moving (speed != 0) 

// warning about default result being same as earlier - can be valid when freight capacity == PAX capacity
//@@WARNING DISABLE 100
 1546 * 17	 02 02 E1 // set refitted capacity according to cargo class
                 85 47 10 \w1 // var 47 in format ccccwwtt where I want cccc; mask for just bit 0 (PAX class)
                 \b1 // range
                   DA 80 \wx01 \wx01 // PAX class
                 7F 80 // default                  
//@@WARNING ENABLE 100

 1547 * 14	 02 02 E0 // 
              81 10 00 FF
              01 // range
                 E1 00 0D 0D // new capacity
               A0 00 // default (end cb36 checks using ID for applying graphics)

// handle callbacks etc - use separate varaction 2s for 'real' vehicles and buy menu - shared cb chain, different graphics IDs 
 1548 * 14	 02 02 C0
               81 0C 00 FF
               01 // range
                 E0 00 36 36 // change vehicle properties
               A0 00 // default 
 1549 * 14	 02 02 C1 // buy menu 
               81 0C 00 FF //handle callbacks for buy menu
               \b1 // range
                 A3 80 23 23 // text for vehicle window (unless using varact 2 chain, simply return ID of D0 text) 
               B0 00 //otherwise go to next action 2 ID 

 1550 * 10	 03 02 01 72 // Action 3 
   01 // number of cargo types to support
    FF C1 00 // buy menu sprites 
   C0 00 // default sprites
User avatar
Mouse
Engineer
Engineer
Posts: 39
Joined: 27 Jun 2010 22:19
Location: Stamford, UK

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by Mouse »

Ooh err...!

Thanks for the help - I'll have a tinker and see what comes out.

What IS the openttdcoop build system?

Edit:

P.S.

Two possibilities for depot menu below. Preferences? (second option needs to be re-clipped)
Attachments
Screen 4.png
Screen 4.png (3.97 KiB) Viewed 9644 times
The early bird may catch the worm, but the second mouse gets the cheese.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by Kogut »

first
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
DanMacK
Tycoon
Tycoon
Posts: 3906
Joined: 27 Feb 2004 20:03
Location: Ontario, Canada
Contact:

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by DanMacK »

Definitely the first option.
User avatar
Mouse
Engineer
Engineer
Posts: 39
Joined: 27 Jun 2010 22:19
Location: Stamford, UK

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by Mouse »

It's half term! Had time to figure out the callback chain, and I think I understand it now. In celebration, new release on front page and BaNaNaNaNaNaS.

Steamer sprites re-aligned, and sail textures changed
Two new small capacity ships
Adjusted cargo availablility
Adjusted buy menu sprites.

Warning!
Due to a major overhaul of code, I would imagine using new version with old save-games will result in your PC going floppy and smelling of cheese
The early bird may catch the worm, but the second mouse gets the cheese.
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by oberhümer »

I think you ought to merge with FISH.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by SquireJames »

Old FISH perhaps? Although that's not a very appealing name!

Small question: Is it intended that the Schooner, Merchantman etc can't carry fish (if used with FIRS) but the Clipper can? I am going to assume it's a cargo type issue caused by using your ships with an industry set they weren't intended to be used with, but thought i'd ask.
Image
User avatar
Mouse
Engineer
Engineer
Posts: 39
Joined: 27 Jun 2010 22:19
Location: Stamford, UK

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by Mouse »

Um...

No, it isn't intended, but I know why that has happened. I think fish (the cargo!) is classed as 'refrigerated' which I thought I'd turn off for older ships. I will turn it back on I think - doesn't seem much point in having a fleet of ships that can't fish! Also, the steamer graphic clipping is wrong for the loaded still sprite, and I will have a fix for these and anything else anyone spots later in the week probably.
The early bird may catch the worm, but the second mouse gets the cheese.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by andythenorth »

Mouse wrote:I think fish (the cargo!) is classed as 'refrigerated' which I thought I'd turn off for older ships.
I could check for you later if it helps. Masks are fiddly :P

Anyway - they can use ice :D
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by SquireJames »

Ah, makes sense. I must admit fish is a tricky cargo to really simulate well. If it's modern fishery practices, or bulk transport, you need refrigeration. If it's 'back in the day', well you just need a boat capable of dragging a net, which have been around for millennia :) one of the original purposes for man creating watercraft I believe.

I believe Mr Blunk brought this up in NewShips also regarding his Reefer (whether the 'fish' cargo was processed fish or just-caught fish)
Image
User avatar
Mouse
Engineer
Engineer
Posts: 39
Joined: 27 Jun 2010 22:19
Location: Stamford, UK

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by Mouse »

andythenorth wrote: Anyway - they can use ice :D
There's a new cargo for FIRS there - Fishing grounds - requires ice! :D

No?

I was using action 0 18 and 19. I suppose the other refrigerated cargos are argable too - Fruit (which can be pickled/put in a jam) and Food (can be salted), although I wouldn't like to eat any milk that had been on a long sea voyage (Cheese?).

I'll have a fiddle with the bitmask - I think I know what I was doing wrong before

Ill try

Code: Select all

x * y      00 02 z 01 0D
           11 D9 6C 19 00

to disable just milk (though with ECS it will prevent Gold being carried). Is that right?

I also notice there is an Action 0 for visual effects such as steam. I didn't think that worked for ships? Anyone know otherwise?
The early bird may catch the worm, but the second mouse gets the cheese.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by planetmaker »

Please, if you don't already, make use a cargo translation table - and then define the permissible cargo by referring to that instead of making use of the (untranslated) cargo slots directly. That way you make sure your cargo properties are somewhat sensible irrespective of any industry set being used, especially mix-ups like gold vs. milk.
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by Ammler »

Mouse wrote: What IS the openttdcoop build system?
It does build the sources from DevZone and mainly verify the source is complete and working, as a side effect, you get a public location for nightleis releases etc...

you can apply for a DevZone project here: http://dev.openttdcoop.org

Greets
Ammler
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: [OTTD] Old ship graphics [Under development (v0.3)]

Post by andythenorth »

Ammler wrote:It does build the sources from DevZone and mainly verify the source is complete and working
and also you'd typically use a source control repo (probably hg) hosted by the DevZone, and also the issue tracker etc.
User avatar
Mouse
Engineer
Engineer
Posts: 39
Joined: 27 Jun 2010 22:19
Location: Stamford, UK

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by Mouse »

Thanks for the help - I will have to see if I can work it out some time.

Half term is now over, so I may go quiet for a while, due to having to do real work! I have attached a minor update below that just changes to all cargo being accepted for all the keen fishermen out there. Also fixes a few (but not all) glitches already mentioned
Attachments
sailing_ships.grf
V0.4a
(259.68 KiB) Downloaded 273 times
The early bird may catch the worm, but the second mouse gets the cheese.
kvwrd
Engineer
Engineer
Posts: 24
Joined: 02 Nov 2008 15:46

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by kvwrd »

Can you please make this mod compatible with FIRS? In 1800 there are a fishing grounds but no ships that can carry fish. :bow:

UPD: I downloaded grf posted here and there was all cargo types so im too hurry. Thank you!
User avatar
Jim Starluck
Traffic Manager
Traffic Manager
Posts: 135
Joined: 26 Jun 2005 20:12
Location: Cincinnati, OH
Contact:

Re: [OTTD] Old ship graphics [Under development (v0.4)]

Post by Jim Starluck »

I can't believe it took me this long to find this set. This is the ships grf I've been waiting for all these years. Between this and FISH, I'm going to be using ships a lot more now! :bow:
If at first you don't succeed, get a bigger locomotive and try again.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 9 guests