diff --git a/ref/vk/vk_mapents.c b/ref/vk/vk_mapents.c index d8bb9b27..cfa3e46d 100644 --- a/ref/vk/vk_mapents.c +++ b/ref/vk/vk_mapents.c @@ -334,6 +334,7 @@ static void readFuncWall( const entity_props_t *const props, uint32_t have_field xvk_mapent_func_wall_t *const e = g_map_entities.func_walls + (g_map_entities.func_walls_count++); *e = (xvk_mapent_func_wall_t){0}; + e->rendercolor.r = 255; e->rendercolor.g = 255; e->rendercolor.b = 255; @@ -346,7 +347,6 @@ static void readFuncWall( const entity_props_t *const props, uint32_t have_field if (have_fields & Field_renderfx) e->renderfx = props->renderfx; - if (have_fields & Field_rendermode) e->rendermode = props->rendermode; @@ -355,6 +355,8 @@ static void readFuncWall( const entity_props_t *const props, uint32_t have_field e->rendercolor.g = props->rendercolor[1]; e->rendercolor.b = props->rendercolor[2]; } + + e->entity_index = g_map_entities.entity_count; } static void addPatchSurface( const entity_props_t *props, uint32_t have_fields ) { diff --git a/ref/vk/vk_mapents.h b/ref/vk/vk_mapents.h index b30b6b73..61b81e37 100644 --- a/ref/vk/vk_mapents.h +++ b/ref/vk/vk_mapents.h @@ -86,6 +86,7 @@ typedef struct { #define MAX_MAPENT_TARGETS 256 typedef struct { + int entity_index; string model; int rendermode, renderamt, renderfx; color24 rendercolor; diff --git a/ref/vk/vk_scene.c b/ref/vk/vk_scene.c index 59a92aea..a7bd5964 100644 --- a/ref/vk/vk_scene.c +++ b/ref/vk/vk_scene.c @@ -576,6 +576,16 @@ static void drawEntity( cl_entity_t *ent, int render_mode ) { case mod_brush: R_RotateForEntity( model, ent ); + + // Patch func_wall offsets + // TODO universal entity patching by index O(1); don't loop like that + for (int i = 0; i < g_map_entities.func_walls_count; ++i) { + xvk_mapent_func_wall_t *const fw = g_map_entities.func_walls + i; + if (fw->entity_index == ent->index + 1) { + Matrix4x4_ConcatTranslate(model, fw->offset[0], fw->offset[1], fw->offset[2]); + break; + } + } VK_RenderStateSetMatrixModel( model ); VK_BrushModelDraw( ent, render_mode, blend, model ); break;