From bb3ac6ef9cbe2c49b8072db5f9178a2e73e6787f Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sun, 17 Mar 2024 00:23:24 +0200 Subject: [PATCH] renders: load mdx/Kingpin models support --- README.md | 3 ++- src/client/menu/menu.c | 1 + src/client/refresh/files/models.c | 11 +++++++++++ src/client/refresh/gl1/gl1_model.c | 2 ++ src/client/refresh/gl3/gl3_model.c | 2 ++ src/client/refresh/gl4/gl4_model.c | 2 ++ src/client/refresh/soft/sw_model.c | 2 ++ src/client/refresh/vk/vk_model.c | 2 ++ 8 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b83d508..ea6d4b6d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ Models support: | mdl | Quake 1 | 8 bit | unsupported grouped textures | | md2 | Quake 2 | 8 bit | full support | | md2 | Anachronox | 8/10/16 bit | does no suport tagged surfaces | -| fm | Heretic 2 | 8 bit | show all meshes, | +| mdx | Kingpin | 8 bit | unchecked with game | +| fm | Heretic 2 | 8 bit | show all meshes | | dkm | Daikatana DKM1 | 8 bit | unchecked with game | | dkm | Daikatana DKM2 | 10 bit | unchecked with game | | md3 | Quake 3 | 16 bit | show all meshes, no tags support, unchecked | diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index 65515429..4c679082 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -5735,6 +5735,7 @@ PlayerModelList(void) ContainsFile(s, "tris.md2") == false && ContainsFile(s, "tris.md3") == false && ContainsFile(s, "tris.md5mesh") == false && + ContainsFile(s, "tris.mdx") == false && ContainsFile(s, "tris.mdl") == false) { /* invalid player model */ diff --git a/src/client/refresh/files/models.c b/src/client/refresh/files/models.c index 866669c2..318ff0e4 100644 --- a/src/client/refresh/files/models.c +++ b/src/client/refresh/files/models.c @@ -2820,6 +2820,7 @@ Mod_LoadFileWithoutExt(const char *namewe, void **buffer, const char* ext) !strcmp(ext, "md2") || !strcmp(ext, "md3") || !strcmp(ext, "md5mesh") || + !strcmp(ext, "mdx") || !strcmp(ext, "mdl")) { int filesize; @@ -2865,6 +2866,16 @@ Mod_LoadFileWithoutExt(const char *namewe, void **buffer, const char* ext) return filesize; } + /* Check Kingpin model */ + Q_strlcpy(newname + tlen, ".mdx", sizeof(newname)); + filesize = ri.FS_LoadFile(newname, buffer); + if (filesize > 0) + { + R_Printf(PRINT_DEVELOPER, "%s: %s loaded as mdx (Kingpin)\n", + __func__, namewe); + return filesize; + } + /* Check Daikatana model */ Q_strlcpy(newname + tlen, ".dkm", sizeof(newname)); filesize = ri.FS_LoadFile(newname, buffer); diff --git a/src/client/refresh/gl1/gl1_model.c b/src/client/refresh/gl1/gl1_model.c index b48ca074..d831cf3a 100644 --- a/src/client/refresh/gl1/gl1_model.c +++ b/src/client/refresh/gl1/gl1_model.c @@ -820,6 +820,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash) /* call the apropriate loader */ switch (LittleLong(*(unsigned *)buf)) { + case MDXHEADER: + /* fall through */ case DKMHEADER: /* fall through */ case RAVENFMHEADER: diff --git a/src/client/refresh/gl3/gl3_model.c b/src/client/refresh/gl3/gl3_model.c index abdb9652..de7692d2 100644 --- a/src/client/refresh/gl3/gl3_model.c +++ b/src/client/refresh/gl3/gl3_model.c @@ -821,6 +821,8 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash) /* call the apropriate loader */ switch (LittleLong(*(unsigned *)buf)) { + case MDXHEADER: + /* fall through */ case DKMHEADER: /* fall through */ case RAVENFMHEADER: diff --git a/src/client/refresh/gl4/gl4_model.c b/src/client/refresh/gl4/gl4_model.c index 05285b40..884d911f 100644 --- a/src/client/refresh/gl4/gl4_model.c +++ b/src/client/refresh/gl4/gl4_model.c @@ -821,6 +821,8 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash) /* call the apropriate loader */ switch (LittleLong(*(unsigned *)buf)) { + case MDXHEADER: + /* fall through */ case DKMHEADER: /* fall through */ case RAVENFMHEADER: diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 036af28d..0d98a1c0 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -645,6 +645,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash) /* call the apropriate loader */ switch (LittleLong(*(unsigned *)buf)) { + case MDXHEADER: + /* fall through */ case DKMHEADER: /* fall through */ case RAVENFMHEADER: diff --git a/src/client/refresh/vk/vk_model.c b/src/client/refresh/vk/vk_model.c index 055f63f6..94d9292c 100644 --- a/src/client/refresh/vk/vk_model.c +++ b/src/client/refresh/vk/vk_model.c @@ -804,6 +804,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash) /* call the apropriate loader */ switch (LittleLong(*(unsigned *)buf)) { + case MDXHEADER: + /* fall through */ case DKMHEADER: /* fall through */ case RAVENFMHEADER: