jak1: fix jsonc tpages being non-functional (#4074)
### The Problem:
The tpages list at the top of the JSONC, never actually gets used or is
written into memory:
<img width="270" height="195" alt="1"
src="https://github.com/user-attachments/assets/d3983363-23db-496e-bcea-136ab0e04058"
/>
This means that previously, the only way that texture remapping was
working was in very specific circumstances, which is when the autofill
would trigger. The autofill would only trigger under these specific
conditions:
- Both a sky remap and level remap are used
- The sky remap and level remap are the same level
- The tpages list is empty
If you went against any of these three parameters, texture remapping
could not be done.
### The Solution:
I simply reversed the logging line
[here](0fa93ce7b8/goalc/build_level/jak1/build_level.cpp (L240)),
which turns the tpages into numbers in order to print them, and reversed
the shift from << to >> to instead take the numbers and write them into
memory.
```cpp
if (!tpages.empty()) {
file.texture_ids.resize(tpages.size());
for (size_t i = 0; i < tpages.size(); ++i) {
file.texture_ids[i] = tpages[i] << 20;
}
}
```
Pictured: A sunken level remap (correct generic textures on water) with
a village1 sky (so not depending on the autofill that only runs when the
sky and level are matching):
<img width="1716" height="1012" alt="aaa"
src="https://github.com/user-attachments/assets/1af3eddb-a5fb-4387-b644-bf84ba60ab62"
/>
This commit is contained in:
parent
c60ae23e59
commit
5c9d891d54
|
|
@ -220,6 +220,12 @@ bool run_build_level(const std::string& input_file,
|
|||
file.texture_remap_table.resize(tex_remap.size());
|
||||
memcpy(file.texture_remap_table.data(), level_file.texture_remap_table.data(),
|
||||
tex_remap.size() * sizeof(level_tools::TextureRemap));
|
||||
if (!tpages.empty()) {
|
||||
file.texture_ids.resize(tpages.size());
|
||||
for (size_t i = 0; i < tpages.size(); ++i) {
|
||||
file.texture_ids[i] = tpages[i] << 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_sky_bsp) {
|
||||
// copy adgif data from bsp
|
||||
|
|
|
|||
Loading…
Reference in New Issue