|
@@ -293,74 +293,72 @@ uint16 GetHouseCallback(CallbackID callb
|
|
|
object.callback_param2 = param2;
|
|
|
|
|
|
group = Resolve(GetHouseSpecs(house_id)->spritegroup, &object);
|
|
|
if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
|
|
|
|
|
|
return group->g.callback.result;
|
|
|
}
|
|
|
|
|
|
void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, HouseID house_id)
|
|
|
{
|
|
|
const DrawTileSprites *dts = group->g.layout.dts;
|
|
|
const DrawTileSeqStruct *dtss;
|
|
|
|
|
|
SpriteID image = dts->ground_sprite;
|
|
|
SpriteID pal = dts->ground_pal;
|
|
|
|
|
|
if (GB(image, 0, SPRITE_WIDTH) != 0) DrawGroundSprite(image, pal);
|
|
|
|
|
|
foreach_draw_tile_seq(dtss, dts->seq) {
|
|
|
if (GB(dtss->image, 0, SPRITE_WIDTH) == 0) continue;
|
|
|
|
|
|
image = dtss->image + stage;
|
|
|
pal = dtss->pal;
|
|
|
|
|
|
if (!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_HOUSES)) {
|
|
|
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
|
pal = PALETTE_TO_TRANSPARENT;
|
|
|
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
|
if ((HASBIT(image, SPRITE_MODIFIER_OPAQUE) || !HASBIT(_transparent_opt, TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
|
if (pal == 0) {
|
|
|
const HouseSpec *hs = GetHouseSpecs(house_id);
|
|
|
if (HASBIT(hs->callback_mask, CBM_BUILDING_COLOUR)) {
|
|
|
uint16 callback = GetHouseCallback(CBID_BUILDING_COLOUR, 0, 0, house_id, GetTownByTile(ti->tile), ti->tile);
|
|
|
if (callback != CALLBACK_FAILED) {
|
|
|
/* If bit 14 is set, we should use a 2cc colour map, else use the callback value. */
|
|
|
pal = HASBIT(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
|
|
|
}
|
|
|
} else {
|
|
|
pal = hs->random_colour[OriginalTileRandomiser(ti->x, ti->y)] + PALETTE_RECOLOR_START;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
pal = PAL_NONE;
|
|
|
}
|
|
|
|
|
|
if ((byte)dtss->delta_z != 0x80) {
|
|
|
AddSortableSpriteToDraw(
|
|
|
image, pal,
|
|
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
|
|
dtss->size_x, dtss->size_y,
|
|
|
dtss->size_z, ti->z + dtss->delta_z
|
|
|
dtss->size_z, ti->z + dtss->delta_z,
|
|
|
HASBIT(_transparent_opt, TO_HOUSES)
|
|
|
);
|
|
|
} else {
|
|
|
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
|
|
|
{
|
|
|
const HouseSpec *hs = GetHouseSpecs(house_id);
|
|
|
const SpriteGroup *group;
|
|
|
ResolverObject object;
|
|
|
|
|
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
|
|
|
|
|
|
NewHouseResolver(&object, house_id, ti->tile, GetTownByTile(ti->tile));
|
|
|
|
|
|
group = Resolve(hs->spritegroup, &object);
|
|
|
if (group == NULL || group->type != SGT_TILELAYOUT) {
|
|
|
/* XXX: This is for debugging purposes really, and shouldn't stay. */
|
|
|
DrawGroundSprite(SPR_SHADOW_CELL, PAL_NONE);
|
|
|
} else {
|
|
|
/* Limit the building stage to the number of stages supplied. */
|
|
|
byte stage = GetHouseBuildingStage(ti->tile);
|