Fixed item col not working correctly

This commit is contained in:
korenkonder
2024-06-06 12:22:41 +03:00
parent f98c25edb6
commit 58cc073ab6
5 changed files with 17 additions and 12 deletions
+2 -2
View File
@@ -1170,8 +1170,8 @@ HOOK(void, FASTCALL, auth_3d_object_disp, 0x00000001401D0970, auth_3d_object* o,
sprintf_s(buf, sizeof(buf), "%.*s%03d",
(int32_t)(i.name.size() - 3), i.name.c_str(), (int32_t)prj::roundf(i.pattern.value));
tex_pat[tex_pat_count].src = i.texture_id;
tex_pat[tex_pat_count].dst = texture_info_get_id(buf);
tex_pat[tex_pat_count].src = texture_id(0x00, i.texture_id);
tex_pat[tex_pat_count].dst = texture_id(0x00, texture_info_get_id(buf));
tex_pat_count++;
}
+2 -3
View File
@@ -54,11 +54,10 @@ material_list_struct::material_list_struct(uint64_t hash, vec4& blend_color,
}
texture_pattern_struct::texture_pattern_struct() {
src = (uint32_t)-1;
dst = (uint32_t)-1;
}
texture_pattern_struct::texture_pattern_struct(uint32_t src, uint32_t dst) : src(src), dst(dst) {
texture_pattern_struct::texture_pattern_struct(texture_id src, texture_id dst) : src(src), dst(dst) {
}
+3 -3
View File
@@ -138,11 +138,11 @@ struct morph_struct {
static_assert(sizeof(morph_struct) == 0x08, "\"morph_struct\" struct should have a size of 0x08");
struct texture_pattern_struct {
uint32_t src;
uint32_t dst;
texture_id src;
texture_id dst;
texture_pattern_struct();
texture_pattern_struct(uint32_t src, uint32_t dst);
texture_pattern_struct(texture_id src, texture_id dst);
};
static_assert(sizeof(texture_pattern_struct) == 0x08, "\"texture_pattern_struct\" struct should have a size of 0x08");
+3 -3
View File
@@ -453,7 +453,7 @@ namespace mdl {
if (texture_id != -1) {
texture_id &= 0xFFFFF;
for (int32_t j = 0; j < args->texture_pattern_count; j++)
if (args->texture_pattern_array[j].src == tex_index) {
if (args->texture_pattern_array[j].src == ::texture_id(0x00, tex_index)) {
texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst);
if (tex)
tex_id = tex->glid;
@@ -678,7 +678,7 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo
GLuint tex_id = -1;
uint32_t texture_id = texdata->tex_index & 0xFFFFF;
for (int32_t j = 0; j < args->texture_pattern_count; j++)
if (args->texture_pattern_array[j].src == texture_id) {
if (args->texture_pattern_array[j].src == ::texture_id(0x00, texture_id)) {
texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst);
if (tex)
tex_id = tex->glid;
@@ -911,7 +911,7 @@ static void draw_object_material_set_reflect(const mdl::ObjSubMeshArgs* args) {
GLuint tex_id = -1;
for (int32_t j = 0; j < args->texture_pattern_count; j++)
if (args->texture_pattern_array[j].src == texture_id) {
if (args->texture_pattern_array[j].src == ::texture_id(0x00, texture_id)) {
texture* tex = texture_manager_get_texture(args->texture_pattern_array[j].dst);
if (tex)
tex_id = tex->glid;
+7 -1
View File
@@ -407,7 +407,7 @@ bool texture_txp_set_load(txp_set* t, texture*** texs, uint32_t* ids) {
*texs = force_malloc<texture*>(count + 1);
texture** tex = *texs;
for (size_t i = 0; i < count; i++)
tex[i] = texture_txp_load(&t->textures[i], texture_id(0, ids[i]));
tex[i] = texture_txp_load(&t->textures[i], texture_id(0x00, ids[i]));
tex[count] = 0;
return true;
}
@@ -444,6 +444,11 @@ HOOK(void, FASTCALL, texture_apply_color_tone, 0x00000001403B5DF0,
texture_apply_color_tone(chg_tex, org_tex, col_tone);
}
HOOK(texture*, FASTCALL, texture_copy, 0x000000014069B550,
texture_id id, texture* org_tex) {
return texture_copy(id, org_tex);
}
HOOK(texture*, FASTCALL, texture_load_tex_cube_map, 0x000000014069B860,
texture_id id, GLenum internal_format, int32_t width, int32_t height,
int32_t max_mipmap_level, void** data_ptr) {
@@ -468,6 +473,7 @@ HOOK(void, FASTCALL, texture_release, 0x000000014069DA70, texture* tex) {
void texture_patch() {
INSTALL_HOOK(texture_apply_color_tone);
INSTALL_HOOK(texture_copy);
INSTALL_HOOK(texture_load_tex_cube_map);
INSTALL_HOOK(texture_load_tex_2d);
INSTALL_HOOK(texture_manager_get_texture);