Page 1 of 2
Planeset and OpenTTD
Posted: 25 Jan 2005 18:47
by 459
I'd like to see our Planeset working well enough with OpenTTD sometime. I'm bored using the normal planes

Currently the airplanes in set seem to work somehow but helicopters (even the basic ones) are more or less broken. You have my permission to do anything with files mentioned below to get the set working.
There are two packages. First is the Planeset - 459 Remix (can be found by following the first link) which doesn't have any advanced GRF features so there's much less to fix. I suggest that if you are trying to make something work this is the set to start. Under the second link is the current Planeset which has more advanced features. I don't suggest touching it before the 459 remix works fine. Both packages also include reference NFO/PCX for troubleshooting/reverse-engineering etc.
http://www.tt-forums.net/viewtopic.php? ... start=1040
http://www.tt-forums.net/viewtopic.php? ... start=1360
Posted: 25 Jan 2005 18:58
by dominik81
I was planning on getting used to the newgrf code anyway. So I might give it a shot to make your planeset working.

Are you using any callbacks in the set, those are not implemented at all yet.
Posted: 25 Jan 2005 20:08
by 459
The 459 Remix doesn't have callbacks as far as I remember - try to get it working first instead of the development version. The development version uses some callbacks for some helicopters (airships).
Posted: 26 Jan 2005 08:51
by DaleStan
459 wrote:The development version uses some callbacks
Um... no it doesn't.
What it does use is constructs like:
Code: Select all
498 * 10 03 03 01 01 01 FF 03 00 01 00
499 * 7 03 03 81 01 00 04 00
The second action 3 sets the rotor sprites.
(A similar construct appears at sprites 481-2)
Posted: 26 Jan 2005 14:56
by 459
OK, maybe the talks of using callbacks to adjust cargo capacity&type properties and running costs have confused me.
Anyway, the Remix is still more basic in behaviour.
Posted: 26 Jan 2005 18:10
by dominik81
OK, choppers are working correctly now. They don't take off on the runway any more.

What other things aren't working yet? Note that there seems to be a problem with planeset savegames right now. Occasionaly it doesn't the game crashes while saving. I haven't found the cause of that problem yet.
Posted: 27 Jan 2005 03:03
by DaleStan
With the 24/Jan/2005 nightly build (r1641), and v0.3.6:
OTTD does not draw the zeppelins correctly. It draws nothing at all in the purchase window, and a zeppelin with a rotor on top in the aircraft details window, as well as in the main map.
Compare OpenTTD's version of the Graf with TTDPatch's version.
If I start a game in 1940 with only the PlaneSet loaded, I get an assertion failure on the expression "totpix > 0", line 1441 of ./gfx.c. when clicking the "New Aircraft" button in the hangar of a small airport. If ignored, the graphics go wonky, and OTTD dies. (0.3.6 does not have the assert, obviously, but everything else is the same)
Posted: 27 Jan 2005 06:44
by dominik81
Could you point me directly to the GRF set you've been using? I had tested with the Remix version of the planeset and seemed to work fine. The Remix doesn't even have a zeppelin.
Posted: 27 Jan 2005 07:24
by DaleStan
Oh, right. I was using the other version -- the 25/Jan/05 one. It's
over here (and at 459's second link)
Posted: 27 Jan 2005 09:54
by Darkvater
After Dominik played around with 459 it seems to work fine. The only thing that is "missing" is that the choppers don't have rotors in the 'build new aircraft' window.
Posted: 27 Jan 2005 10:03
by dominik81
I'll see what I can do.

One more question: Are zeppelins supposed to be choppers or airplanes? Or is there a new variable specifically for zeppelins? I couldn't find any information about that in the GRF Specs.
Posted: 27 Jan 2005 10:14
by Prof. Frink
They're helicopters, but with "wagon override" on the rotors to show a blank sprite.
Posted: 27 Jan 2005 12:55
by dominik81
I need some help with those rotor overrides. This section in the grf file is supposed to do it:
Code: Select all
//Airship rotor overrides
464 * 4 01 03 01 02
465 d:\pelit\ttd\TDX_EDIT\SPRITES\SPRITES\planesetw.pcx 2 1792 01 1 1 0 0
466 d:\pelit\ttd\TDX_EDIT\SPRITES\SPRITES\planesetw.pcx 18 1792 01 1 1 0 0
467 * 9 02 03 04 01 01 00 00 00 00
Line 464 defines a set of sprites for planes. One sprite set (=one vehicle) is specified, consisting of 2 sprites. The two sprites to override the rotors follow. Then in line 467 cargo IDs are defined (Action 02) for airplanes (type 03). It defines cargo ID 4, with only 1 state used while moving and only 1 state for loading/unloading. Set 0 (as previously defined) is used for both moving and loading/unloading.
So basically my question is: Are rotors defined as cargo graphics?
Posted: 27 Jan 2005 13:45
by Korenn
the problem is that cargo ID's and sprite set ID's are used interchangeably.
in this case it's a sprite set ID (thingamajib)
Posted: 27 Jan 2005 16:12
by DaleStan
I'm not sure I understand your question Dominik, so I'll just try to explain what's going on.
Code: Select all
//Airship rotor overrides
464 * 4 01 03 01 02
465 SPRITES\planesetw.pcx 2 1792 01 1 1 0 0
466 SPRITES\planesetw.pcx 18 1792 01 1 1 0 0
467 * 9 02 03 04 01 01 00 00 00 00
//LZ-127 "Graf Zeppelin"
468 * 4 01 03 01 08
//8 standard Graf zeppelin sprites
477 * 9 02 03 00 01 01 00 00 00 00
478 * 4 01 03 01 01
//purchase sprite for Graf (smaller, so it fits in the purchase window)
480 * 9 02 03 02 01 01 00 00 00 00
481 * 10 03 03 01 00 01 FF 02 00 00 00
482 * 7 03 03 81 00 00 04 00
Sprites 465-6 are the rotor sprites for both the Graf and the Hindenburg. The first sprite in a set of rotors is the sprite for when the rotor is stopped; the remainder should be cycled through to create the animation.
Sprite 481 sets the graphics for the Graf's body: sprite 479 in the purchase list, and sprites 469-76 in all other cases.
Sprite 482 uses a special-case livery override to replace the default rotor sprites with sprites 465-6.
I hope this helped.
Posted: 01 Feb 2005 05:20
by DaleStan
Well, something's changed, but it's not for the better.
The Zeppelin is now drawn in the purchase window, but it's drawn like this. (This is the Jan 31 nightly; svn 1754)
@Dominik: did my previous help/make sense/etc?
Also, now that the Chinook has decent (IMSelfServingO) rotors it may get folded in soon. (Or it may wait until I draw umpteen more liveries for the body.) Either way, it's about as complex as rotor-overrides can get, so it may be a good test of the rotor-override code.
You should be able to find whatever you need
over here, with the exception of decent comments in the source.
Posted: 01 Feb 2005 10:10
by dominik81
@DaleStan: Thanks for your excellent information I now understand how it works. However, fixing it in the code isn't all that easy, at least not without getting used to the newgrf code. I've been reading up on it a lot lately, but it is still very frustrating. And besides that I've been distracted by World of Warcraft

. I think I'll manage to fix the purchase list icon soon though. Rotor overrides are probably a bit more work.
Posted: 14 Apr 2005 23:39
by DaleStan
Does anyone have a list of the values and meanings of byte 62 WRT the larger airports? I tested my GRF files earlier today, and discovered that
the Osprey ... doesn't work. Not just the rotors (that's to be expected), but the engine nacelles too. I assume it's a simple matter of recoding the variational 02 on E2, but a list of meanings would be nice.
Posted: 18 May 2005 19:34
by 459
Planeset vs. OpenTTD 0.4.0:
-747 and An-124 latch noses don't work.
-Airships show garbage in buylist instead of those "scaled-down" pics.
-All advanced choppers have standard single rotors even if they shouldn't have rotors or if they have modified rotors.
-S-61 is called "Powernaut Helicopter" for some reason.
Developers: Do something

Users: Stick to the "Planeset 459 remix" with OpenTTD for the time being...
Posted: 18 May 2005 21:28
by DaleStan
On that subject, to make the Osprey work in the OTTD, I need:
1.) Access to TTD vehicle struct byte 62-equivalent information
2.) Access to TTD vehicle struct byte 66-equivalent information
3.) Airport type detection
4.) OTTD vs TTDPatch detection
5.) Working rotor overrides
Notes:
1.) v->u.air.state, apparently.
2.) I need to be able to determine:
Is in hangar?
Is on a pad? (Later, we'll need: Which pad?)
Is taxiing? (This should probably be split up, despite the fact that I don't forsee needing the distinction.)
In in flight?
3.) TTDPatch variable 44 (I'll need the second byte for the Chinook.)
4.) My proposal: Set action 7/9 variable 8D to 02 in OTTD.
5.) I can get the NFO done without these, but it won't look right until this is finished.
The 747s and Ruslan will need callback support, specifically, callback 19.
If someone around here can give me a brain dump on how the newgrf code in OTTD works, I could probably be convinced to work on these features myself.