forked from townforge/townforge
game: allow lowering a loaded model below base height
This commit is contained in:
parent
45fca36815
commit
be32085cdd
@ -4190,7 +4190,9 @@ bool CryptoCityUrho3D::LoadModelData(const std::shared_ptr<Flag> &flag, const st
|
||||
}
|
||||
}
|
||||
|
||||
const int32_t signed_base_height = (int32_t)base_height + placing_model_dh;
|
||||
base_height = std::max<int32_t>((int32_t)base_height + placing_model_dh, 0);
|
||||
const uint32_t cut = signed_base_height < 0 ? - signed_base_height : 0;
|
||||
|
||||
uint64_t n_blocks_total = 0;
|
||||
for (uint16_t h = 0; h < mm.front().height; ++h )
|
||||
@ -4204,7 +4206,7 @@ bool CryptoCityUrho3D::LoadModelData(const std::shared_ptr<Flag> &flag, const st
|
||||
|
||||
bool ok = true;
|
||||
uint64_t n_blocks_used = 0;
|
||||
for (uint16_t h = 0; h < mm.front().height; ++h )
|
||||
for (uint16_t h = cut; h < mm.front().height; ++h )
|
||||
{
|
||||
const uint8_t *model_data = mm.front().data.data() + mm.front().width * mm.front().depth * h;
|
||||
|
||||
@ -4216,7 +4218,7 @@ bool CryptoCityUrho3D::LoadModelData(const std::shared_ptr<Flag> &flag, const st
|
||||
cmd.push_area.dy = my0 - flag->y0;
|
||||
cmd.push_area.wm1 = mx1 - mx0;
|
||||
cmd.push_area.hm1 = my1 - my0;
|
||||
cmd.push_area.height = base_height + h;
|
||||
cmd.push_area.height = base_height + h - cut;
|
||||
|
||||
uint8_t raw_types[65536];
|
||||
unsigned int idx = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user