Houses - substitute, override and other properties

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Houses - substitute, override and other properties

Post by TadeuszD »

Thanks! But these variables are not implemented in OTTD. Additionally, I afraid that increasing offsets for all tiles on the map (not only the building bottoms) will decrease the overall game performance.

And what about animations? Building animations works fine without any glitches. I can control two animation frames instead of switching between two spritelayouts (normal and snowy). Is this idea OK?
Image
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Houses - substitute, override and other properties

Post by Eddi »

i don't see anything wrong with that approach.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Houses - substitute, override and other properties

Post by TadeuszD »

Hi, I have new question...
Can I use random_switch in case of house not created (not placed on the map) yet?
For example, I want to modify house probability when certain conditions are met.
Will this code work?

Code: Select all

random_switch(FEAT_HOUSES, switch_decrease_probability) {
    5: return 0;
    3: return 1;   // decreases construction probability to 3/8 of original probability
}
switch( FEAT_HOUSE, SELF, switch_construction_check, [condition]) {
    1: return switch_decrease_probability;
    return 1;    // house is constructed with original probaility
}

item(FEAT_HOUSES, my_house, ...) {
    probability:    1;  // original probability
    ...
    graphics {
        construction_check:  return switch_construction_check;
    }
}
Image
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Houses - substitute, override and other properties

Post by Eddi »

probably not. none of the variables are initialized before construction, you can only use global variables or extra_callback_info and stuff like that
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Houses - substitute, override and other properties

Post by frosch »

Yes, "construction_check" has already access to the random bits, which the house will get if construction is allowed.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Houses - substitute, override and other properties

Post by TadeuszD »

frosch wrote:Yes, "construction_check" has already access to the random bits.
Thanks! It looks like it works. :)
Using this method I can create local residential districts, constructed using "normalized" houses.
Image
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Houses - substitute, override and other properties

Post by TadeuszD »

Hi, again...
I encountered the problem with recolour_mode: RECOLOUR_REMAP statement in house spritelayout.
If I use:

Code: Select all

spritelayout slay_building_prl6 {
...
    building {
        ...
        recolour_mode: RECOLOUR_REMAP;
        palette:       PALETTE_USE_DEFAULT;
    }
}
...every is OK.
But if I define my own recolour sprite and use it in spritelayout:

Code: Select all

recolour_house_palette = reserve_sprites(1);
replace(recolour_house_palette) {
    recolour_sprite {
        0x48: 0x58;
        0x49: 0x59;
        0x4A: 0x5A;
        0x4B: 0x5B;
        }
}

spritelayout slay_building_prl6 {
...
    building {
        ...
        recolour_mode: RECOLOUR_REMAP;
        palette:       recolour_house_palette;
    }
}
...the house which uses this spritelayout doesn't apper in the game at all. :(
What is wrong?
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 20 guests