Create duplicate powerups with movement MT_NONE
zicodxx reported an assertion failure when powerup duplication was enabled. Local debugging shows that some levels give preplaced powerups a movement type of MT_NONE rather than MT_PHYSICS. Such powerups have undefined data in their mtype.phys_info branch, which confuses the physics simulation code. Powerups only need MT_PHYSICS to bounce away from their spawn site. Preplaced powerups never move. Add assertions that preplaced powerups are MT_NONE. Change the duplication call to create the duplicates with movement MT_NONE. Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/268>
This commit is contained in:
parent
0c219e596e
commit
8817307f23
|
@ -3253,11 +3253,12 @@ void update_item_state::process_powerup(const object &o, const powerup_type_t id
|
|||
const auto &seg_verts = segp->verts;
|
||||
for (uint_fast32_t i = count++; i; --i)
|
||||
{
|
||||
const auto &&no = obj_create(OBJ_POWERUP, id, segp, vm_vec_avg(o.pos, Vertices[seg_verts[i % seg_verts.size()]]), &vmd_identity_matrix, o.size, CT_POWERUP, MT_PHYSICS, RT_POWERUP);
|
||||
assert(o.movement_type == MT_NONE);
|
||||
assert(o.render_type == RT_POWERUP);
|
||||
const auto &&no = obj_create(OBJ_POWERUP, id, segp, vm_vec_avg(o.pos, Vertices[seg_verts[i % seg_verts.size()]]), &vmd_identity_matrix, o.size, CT_POWERUP, MT_NONE, RT_POWERUP);
|
||||
if (no == object_none)
|
||||
return;
|
||||
m_modified.set(no);
|
||||
no->mtype.phys_info = o.mtype.phys_info;
|
||||
no->rtype.vclip_info = o.rtype.vclip_info;
|
||||
no->rtype.vclip_info.framenum = (o.rtype.vclip_info.framenum + (i * vc_num_frames) / count) % vc_num_frames;
|
||||
no->ctype.powerup_info = o.ctype.powerup_info;
|
||||
|
|
Loading…
Reference in a new issue