- added QuickUnpackCellObject

This commit is contained in:
Ilya Shurumov 2021-04-26 02:47:01 +06:00
parent 973b2da24e
commit f780cf3855
2 changed files with 15 additions and 0 deletions

View File

@ -176,4 +176,17 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near)
pco->type = (ppco->value >> 6) | ((ppco->pos.vy & 1) << 10);
return pco;
}
// [D] [T]
void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_OBJECT* pco)
{
cell_object_index = cell_object_index + 1U & 0x3ff;
pco->pos.vx = near->x + (((ppco->pos.vx - near->x) << 0x10) >> 0x10);
pco->pos.vz = near->z + (((ppco->pos.vz - near->z) << 0x10) >> 0x10);
pco->pos.vy = (ppco->pos.vy << 0x10) >> 0x11;
pco->yang = ppco->value & 0x3f;
pco->type = (ppco->value >> 6) | ((ppco->pos.vy & 1) << 10);
}

View File

@ -9,4 +9,6 @@ extern PACKED_CELL_OBJECT * GetFirstPackedCop(int cellx, int cellz, CELL_ITERATO
extern PACKED_CELL_OBJECT* GetNextPackedCop(CELL_ITERATOR* pci); // 0x0003F5F0
extern CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near); // 0x000418E8
extern void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_OBJECT* pco);
#endif