Not sure what the deal is with this line:
```
if ((u16)_svm_voice[voice].unke == (u16)temp) {
```
changing unke to unsigned causes a mismatch in SpuVmInit
Solves an annoying fake match that made the US version to match but not
in the HD version. Special thanks to @Gillou68310 for figuring out the
right switch/case pattern!
Don't get fooled by the size of this function. I struggled more than I
thought I would. I think it generates the map bitmap but I am not yet
sure. There is a lot that I still do not understand of how the map gets
filled while walking through the castle. I do not even know how
partially explored maps work (e.g. when you get the Castle Map 1 or 2
from the Librarian but you do not actually pass by those unexplored
areas). I would like to wait to know more of the logic here before
documenting.
![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/fad98e8c-ff42-4944-b54f-7e97f46dd98c)
This. It still misses the texture and I do not know what the green lines
are about. All the stuff within the `#else` and `#endif` are
placeholders that will hopefully be fixed later on the same way.
To get the same result from the screenshot I had to use the
[func_800F1B08](https://decomp.me/scratch/nW7lV) scratch, comment
`g_CastleMap[i] = 0;` from `InitStatsAndGear` and use the following to
read the map from a memory card's save:
```c
if (!FileRead(LoadMemcardSave, "memcard1.mcd")) {
WARNF("unable to correctly load the save file");
}
```
```c
s32 LoadSaveData(SaveData* save);
bool LoadMemcardSave(FILE* f) {
const int slot = 0;
SaveData save;
fseek(f, 0x2000 + slot * 0x2000, SEEK_SET);
fread(&save, sizeof(SaveData), 1, f);
return LoadSaveData(&save) == 0;
}
```
![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/e3b9b89c-6a6b-49a9-8804-b0f49da6dc79)
This thing here. Special thanks to @sonicdcer who helped me on the final
reg swaps!
I renamed `D_8003C104` as `g_ClutIds`. I am not a fan of the name, but
it gets used by `poly->clut = g_ClutIds[xyz]`, the function that
populates the table is called `GetClut` and the [official
docs](file:///run/media/xeeynamo/wd_black/SDK/sony_ps1/psyq_sdk/DOCS/LIBREF46.PDF)
mentions _Calculates and returns the texture CLUT ID_ . So that seems to
be the most appropriate name.
A relatively small but complicated function. I matched it by decompiling
from scratch while taking some inspiration from an old scratch made by
@sonicdcer
Some data belong to `7A4D0.c` but I had to import to `7E4BC.c` instead
due to the `factory_blueprint` getting extracted in the between. I think
in the future those JSON assets need to generate C files.
Completes `90264.c` with the exception of the BSS section.
After this PR I am thinking to either decompile and move
`func_8012F178`, `func_8012F83C` and `func_8012F894` into `90264.c` as
they all follow the same pattern, or move back `90264.c` before the
split back into `8D3E8.c` as all the code seem to be related to the wolf
form.
As per title.
`#if !defined(VERSION_PC) && !defined(M2CTX)` allows
`tools/decompile.py` to work on files where the GTE instructions are
used. Otherwise it wouldn't normally work.