mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 06:09:57 +00:00
9d80ada016
I found two issues with Jak 3 eyes. The first was simple - we were missing a `-pc` texture upload in `texture.gc` for `pris2` textures, which has eye textures for a few characters, like torn or damas. The second was a little more annoying. Unlike jak 2 and jak 1, jak 3 can dynamically assign eye slots when merc models are loaded. This involves modifying eye data to tell the eye renderer where to render, and modifying the merc model's adgif shaders to point to the correct eye texture. The modification to the merc adgif shader is problematic since our PC port of merc assumes this slot is constant. My solution here was to bypass this whole slot system entirely for jak 3. I modified the GOAL eye renderer to tell the c++ eye renderer the name of the merc-ctrl containing the eye. Then, the PC C++ Merc renderer can just look up the merc-ctrl by name. To make this fit nicely in the existing memory layout, I used a 64-bit fnv hash of the name. (which honestly is how we should have handled a lot of other texture/model names stuff...) Unrelated fix to Overlord2 so it handles the case where file size changes after the game starts, I had this in jak2/jak1 and forgot it for jak 3.
19 lines
381 B
C++
19 lines
381 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
inline u64 fnv64(const void* data, u64 len) {
|
|
u64 ret = 0xcbf29ce484222325;
|
|
const auto* ptr = (const u8*)data;
|
|
for (u64 i = 0; i < len; i++) {
|
|
ret = 1099511628211 * (((u64)*ptr) ^ ret);
|
|
ptr++;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
inline u64 fnv64(const std::string& str) {
|
|
return fnv64(str.data(), str.length());
|
|
} |