{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreial6oughmgzqznkz3j6ki3iwymkqeglfg7wcazp43ww3pg3wd4f5y",
    "uri": "at://did:plc:i7budt2wflrcfy6jtvfocbix/app.bsky.feed.post/3mlskfvkxich2"
  },
  "path": "/viewtopic.php?p=1279108#p1279108",
  "publishedAt": "2026-05-14T07:41:14.000Z",
  "site": "https://www.tt-forums.net",
  "tags": [
    "https://github.com/althonos/2ccng",
    "althonos"
  ],
  "textContent": "> Will you be publishing the source code?\n\nThe source code is already on GitHub: https://github.com/althonos/2ccng. I have some of a logic done by macros so maybe not the most straightforward to have, but the gist can be summarized as follow. While previously you would have a \"front\" and a \"back\" sprite for the front and back car of an EMU, and select the graphics to use for a dual-headed engine with the 0xC8 variable (the \"sprite type\") or the \"vehicle_is_flipped\" property, e.g.\n\n\nCode:\n\n\n    switch(FEAT_TRAINS, SELF, switch_emu_reversed, var[0xC8]) { 0xFE: emu_back; 0xFF: emu_back; emu_front;}\n\nNow you need to have \"forward\" and \"backward\"-driving variants for both cars, and use a switch to select the right one (so that you can adjust e.g. the lights or the pantographs like I did):\n\nCode:\n\n\n    switch(FEAT_TRAINS, PARENT, switch_emu_front, vehicle_is_reversed) { 1: spriteset_emu_front_backward; 0: spriteset_emu_front_forward;}switch(FEAT_TRAINS, PARENT, switch_emu_back, vehicle_is_reversed) { 1: spriteset_emu_back_backward; 0: spriteset_emu_back_forward;}switch(FEAT_TRAINS, SELF, switch_emu_reversed, var[0xC8]) { 0xFE: switch_emu_back; 0xFF: switch_emu_back; switch_emu_front;}\n\nNow, for cars that are perfectly symmetric and that are 8/8 in dimension, then `spriteset_emu_front_forward` and `spriteset_emu_back_backward` (resp. `spriteset_emu_front_backward` and `spriteset_emu_back_forward`) are the same; therefore you don't need to have new dedicated sprites. But if there is any asymetry you need dedicated sprites or it will look like the car \"magically\" turns around.\n\nOne done you just need to add the new `VEHICLE_FLAG_TRAIN_HAS_CAB` flags to the `extra_flags` property of the engine, and you're set!\n\nStatistics: Posted by althonos — 14 May 2026 07:41\n\n* * *",
  "title": "Graphics Development • Re: [OTTD] 2cc Narrow-Gauge in NML - Development",
  "updatedAt": "2026-05-14T07:41:14.000Z"
}