refactor: Mod_Q1BSP_DecompressVis -> DecompressVis
This commit is contained in:
parent
912dd0cdeb
commit
8f49cf3894
|
|
@ -603,14 +603,14 @@ size_t DecompressedVisSize(const mbsp_t *bsp)
|
||||||
return (bsp->dmodels[0].visleafs + 7) / 8;
|
return (bsp->dmodels[0].visleafs + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from DarkPlaces
|
// from DarkPlaces (Mod_Q1BSP_DecompressVis)
|
||||||
void Mod_Q1BSP_DecompressVis(const uint8_t *in, const uint8_t *inend, uint8_t *out, uint8_t *outend)
|
void DecompressVis(const uint8_t *in, const uint8_t *inend, uint8_t *out, uint8_t *outend)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
uint8_t *outstart = out;
|
uint8_t *outstart = out;
|
||||||
while (out < outend) {
|
while (out < outend) {
|
||||||
if (in == inend) {
|
if (in == inend) {
|
||||||
logging::print("Mod_Q1BSP_DecompressVis: input underrun (decompressed {} of {} output bytes)\n",
|
logging::print("DecompressVis: input underrun (decompressed {} of {} output bytes)\n",
|
||||||
(out - outstart), (outend - outstart));
|
(out - outstart), (outend - outstart));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -623,20 +623,20 @@ void Mod_Q1BSP_DecompressVis(const uint8_t *in, const uint8_t *inend, uint8_t *o
|
||||||
|
|
||||||
if (in == inend) {
|
if (in == inend) {
|
||||||
logging::print(
|
logging::print(
|
||||||
"Mod_Q1BSP_DecompressVis: input underrun (during zero-run) (decompressed {} of {} output bytes)\n",
|
"DecompressVis: input underrun (during zero-run) (decompressed {} of {} output bytes)\n",
|
||||||
(out - outstart), (outend - outstart));
|
(out - outstart), (outend - outstart));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int run_length = *in++;
|
const int run_length = *in++;
|
||||||
if (!run_length) {
|
if (!run_length) {
|
||||||
logging::print("Mod_Q1BSP_DecompressVis: 0 repeat\n");
|
logging::print("DecompressVis: 0 repeat\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = run_length; c > 0; c--) {
|
for (c = run_length; c > 0; c--) {
|
||||||
if (out == outend) {
|
if (out == outend) {
|
||||||
logging::print("Mod_Q1BSP_DecompressVis: output overrun (decompressed {} of {} output bytes)\n",
|
logging::print("DecompressVis: output overrun (decompressed {} of {} output bytes)\n",
|
||||||
(out - outstart), (outend - outstart));
|
(out - outstart), (outend - outstart));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ void Face_DebugPrint(const mbsp_t *bsp, const mface_t *face);
|
||||||
|
|
||||||
void CompressRow(const uint8_t *vis, const size_t numbytes, std::back_insert_iterator<std::vector<uint8_t>> it);
|
void CompressRow(const uint8_t *vis, const size_t numbytes, std::back_insert_iterator<std::vector<uint8_t>> it);
|
||||||
size_t DecompressedVisSize(const mbsp_t *bsp);
|
size_t DecompressedVisSize(const mbsp_t *bsp);
|
||||||
void Mod_Q1BSP_DecompressVis(const uint8_t *in, const uint8_t *inend, uint8_t *out, uint8_t *outend);
|
void DecompressVis(const uint8_t *in, const uint8_t *inend, uint8_t *out, uint8_t *outend);
|
||||||
|
|
||||||
bspx_decoupled_lm_perface BSPX_DecoupledLM(const bspxentries_t &entries, int face_num);
|
bspx_decoupled_lm_perface BSPX_DecoupledLM(const bspxentries_t &entries, int face_num);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ static bool Mod_LeafPvs(const mbsp_t *bsp, const mleaf_t *leaf, uint8_t *out)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mod_Q1BSP_DecompressVis(bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, leaf->cluster),
|
DecompressVis(bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, leaf->cluster),
|
||||||
bsp->dvis.bits.data() + bsp->dvis.bits.size(), out, out + num_pvsclusterbytes);
|
bsp->dvis.bits.data() + bsp->dvis.bits.size(), out, out + num_pvsclusterbytes);
|
||||||
} else {
|
} else {
|
||||||
if (leaf->visofs < 0) {
|
if (leaf->visofs < 0) {
|
||||||
|
|
@ -488,8 +488,8 @@ static bool Mod_LeafPvs(const mbsp_t *bsp, const mleaf_t *leaf, uint8_t *out)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mod_Q1BSP_DecompressVis(bsp->dvis.bits.data() + leaf->visofs, bsp->dvis.bits.data() + bsp->dvis.bits.size(),
|
DecompressVis(bsp->dvis.bits.data() + leaf->visofs, bsp->dvis.bits.data() + bsp->dvis.bits.size(), out,
|
||||||
out, out + num_pvsclusterbytes);
|
out + num_pvsclusterbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -172,9 +172,7 @@ void CalcPHS(mbsp_t *bsp)
|
||||||
for (int32_t i = 0; i < portalleafs; i++) {
|
for (int32_t i = 0; i < portalleafs; i++) {
|
||||||
const uint8_t *scan = bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, i);
|
const uint8_t *scan = bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, i);
|
||||||
|
|
||||||
Mod_Q1BSP_DecompressVis(scan,
|
DecompressVis(scan, bsp->dvis.bits.data() + bsp->dvis.bits.size(), uncompressed.data(),
|
||||||
bsp->dvis.bits.data() + bsp->dvis.bits.size(),
|
|
||||||
uncompressed.data(),
|
|
||||||
uncompressed.data() + uncompressed.size());
|
uncompressed.data() + uncompressed.size());
|
||||||
std::copy(uncompressed.begin(), uncompressed.end(), uncompressed_orig.begin());
|
std::copy(uncompressed.begin(), uncompressed.end(), uncompressed_orig.begin());
|
||||||
|
|
||||||
|
|
@ -192,9 +190,7 @@ void CalcPHS(mbsp_t *bsp)
|
||||||
if (index >= portalleafs)
|
if (index >= portalleafs)
|
||||||
FError("Bad bit in PVS"); // pad bits should be 0
|
FError("Bad bit in PVS"); // pad bits should be 0
|
||||||
const uint8_t *src_compressed = bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, index);
|
const uint8_t *src_compressed = bsp->dvis.bits.data() + bsp->dvis.get_bit_offset(VIS_PVS, index);
|
||||||
Mod_Q1BSP_DecompressVis(src_compressed,
|
DecompressVis(src_compressed, bsp->dvis.bits.data() + bsp->dvis.bits.size(), uncompressed_2.data(),
|
||||||
bsp->dvis.bits.data() + bsp->dvis.bits.size(),
|
|
||||||
uncompressed_2.data(),
|
|
||||||
uncompressed_2.data() + uncompressed_2.size());
|
uncompressed_2.data() + uncompressed_2.size());
|
||||||
const long *src = reinterpret_cast<long *>(uncompressed_2.data());
|
const long *src = reinterpret_cast<long *>(uncompressed_2.data());
|
||||||
long *dest = reinterpret_cast<long *>(uncompressed.data());
|
long *dest = reinterpret_cast<long *>(uncompressed.data());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue