Bithack / principia

Open source physics-based sandbox game.
https://principia-web.se
Other
258 stars 25 forks source link

fix IF-select socket positions #112

Closed griffi-gh closed 1 year ago

griffi-gh commented 1 year ago

Fix positions of input/output sockets on IF-select

Before After
before-image after-image

This change shouldn't break compatability
Nope, it breaks stuff: https://github.com/Bithack/principia/pull/112#issuecomment-1516940487

waiting for the version code increase
letest comit checks for <= 1.5.1

rollerozxa commented 1 year ago

it should still be gated behind the 1.5.2 level version code after it's release?

Either we do it now or never. Make up your mind. Does this affect compatibility?

griffi-gh commented 1 year ago

it should still be gated behind the 1.5.2 level version code after it's release?

Either we do it now or never. Make up your mind. Does this affect compatibility?

basically it doesn't affect anything

rollerozxa commented 1 year ago

I tested opening a level made without this PR, with cords attached to the IF-select. The OUT0 cable popped out when reopening the level with this PR applied. That's not good.

griffi-gh commented 1 year ago

uh, weird... i tested it a bit but didn't test all any the edge cases
i tried reloading the same level from the Before/after screenshots and a similar one but with 4 wires attached instead, and they all stayed in their slots?

also, aren't wire connections stored as A->B constraint referencing the exact socket by id?

then version-gate it?

iomiscgate.cc

#include "game.hh"
ifselect::ifselect()
: i3o1gate() {
    //No version code for 1.5.2 yet
    if (W->level.version < LEVEL_VERSION_1_5_2) { 
        return;
    }
    this->s_in[0].lpos  = b2Vec2(-.25f, -.125f);
    this->s_in[1].lpos  = b2Vec2(  0.f, -.125f);
    this->s_in[2].lpos  = b2Vec2( .25f, -.125f);
    this->s_out[0].lpos = b2Vec2(  0.f,  .125f);
}