diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index a70c0e096..b67ac6024 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -1035,6 +1035,13 @@ const char *CSQC_GetExtraFieldInfo(void *went, char *out, size_t outsize) Q_snprintfz(out, e-out, "q1lower %#x\n", sk->q1lower); out+=strlen(out); } +#ifdef HEXEN2 + if (sk->h2class != Q1UNSPECIFIED) + { + Q_snprintfz(out, e-out, "h2class %i\n", sk->h2class); + out+=strlen(out); + } +#endif #endif return r; diff --git a/engine/client/render.h b/engine/client/render.h index 56b053eed..c2ea71b8d 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -178,6 +178,7 @@ typedef struct struct qwskin_s *qwskin; unsigned int q1upper; //Q1UNSPECIFIED unsigned int q1lower; //Q1UNSPECIFIED + unsigned int h2class; //Q1UNSPECIFIED. urgh. #endif struct { diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 14d1e9f48..b397953b3 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -273,6 +273,9 @@ skinid_t Mod_ReadSkinFile(const char *skinname, const char *skintext) #ifdef QWSKINS skin->q1lower = Q1UNSPECIFIED; skin->q1upper = Q1UNSPECIFIED; +#ifdef HEXEN2 + skin->h2class = Q1UNSPECIFIED; +#endif #endif @@ -387,6 +390,13 @@ skinid_t Mod_ReadSkinFile(const char *skinname, const char *skintext) else skin->q1upper = atoi(com_token); } +#ifdef HEXEN2 + else if (!strcmp(com_token, "h2class")) + { + skintext = COM_ParseToken(skintext, NULL); + skin->h2class = atoi(com_token); + } +#endif #endif else { @@ -612,7 +622,12 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e shader_t *shader; qwskin_t *plskin = NULL; unsigned int subframe; - unsigned int tc = e->topcolour, bc = e->bottomcolour, pc; + unsigned int tc = e->topcolour, bc = e->bottomcolour; +#ifdef HEXEN2 + unsigned int pc = e->h2playerclass; +#else + unsigned int pc = 0; +#endif qboolean generateupperlower = false; qboolean forced; extern int cl_playerindex; //so I don't have to strcmp @@ -649,6 +664,10 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e bc = e->bottomcolour = sk->q1lower; if (sk->q1upper != Q1UNSPECIFIED) tc = e->topcolour = sk->q1upper; +#ifdef HEXEN2 + if (sk->h2class != Q1UNSPECIFIED) + pc = sk->h2class; +#endif if (!sk->qwskin && *sk->qwskinname) sk->qwskin = Skin_Lookup(sk->qwskinname); plskin = sk->qwskin; @@ -716,11 +735,6 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e else plskin = NULL; } -#ifdef HEXEN2 - pc = e->h2playerclass; -#else - pc = 0; -#endif if (forced || tc != TOP_DEFAULT || bc != BOTTOM_DEFAULT || plskin) { diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index f5abb1263..13cc07b8e 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -12004,7 +12004,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs {"adddecal", PF_Fixme, 0, 0, 0, 375, D("void(string shadername, vector origin, vector up, vector side, vector rgb, float alpha)", "Adds a temporary clipped decal shader to the scene, centered at the given point with given orientation. Will be drawn by the next renderscene call, and freed by the next clearscene call.")}, {"setcustomskin", PF_Fixme, 0, 0, 0, 376, D("void(entity e, string skinfilename, optional string skindata)", "Sets an entity's skin overrides to a new skin object. Releases the entities old skin (refcounted).")}, - {"loadcustomskin", PF_Fixme, 0, 0, 0, 377, D("float(string skinfilename, optional string skindata)", "Creates a new skin object and returns it. These are custom per-entity surface->shader lookups. The skinfilename/data should be in .skin format:\nsurfacename,shadername - makes the named surface use the named shader (legacy format for compat with q3)\nreplace \"surfacename\" \"shadername\" - non-legacy equivalent.\nqwskin \"foo\" - use an unmodified quakeworld player skin (including crop+repalette rules)\nq1lower 0xff0000 - specify an override for the entity's lower colour, in this case to red\nq1upper 0x0000ff - specify an override for the entity's lower colour, in this case to blue\ncompose \"surfacename\" \"shader\" \"imagename@x,y:w,h$s,t,s2,t2?r,g,b,a\" - compose a skin texture from multiple images.\n The texture is determined to be sufficient to hold the first named image, additional images can be named as extra tokens on the same line.\n Use a + at the end of the line to continue reading image tokens from the next line also, the named shader must use 'map $diffuse' to read the composed texture (compatible with the defaultskin shader). Must be matched with a releasecustomskin call later, and is pointless without applycustomskin.")}, + {"loadcustomskin", PF_Fixme, 0, 0, 0, 377, D("float(string skinfilename, optional string skindata)", "Creates a new skin object and returns it. These are custom per-entity surface->shader lookups. The skinfilename/data should be in .skin format:\nsurfacename,shadername - makes the named surface use the named shader (legacy format for compat with q3)\nreplace \"surfacename\" \"shadername\" - non-legacy equivalent.\nqwskin \"foo\" - use an unmodified quakeworld player skin (including crop+repalette rules)\nq1lower 0xff0000 - specify an override for the entity's lower colour, in this case to red\nq1upper 0x0000ff - specify an override for the entity's lower colour, in this case to blue\nh2class 0 - specifies which class to use for hexen2's hacky class-specific player colouring\ncompose \"surfacename\" \"shader\" \"imagename@x,y:w,h$s,t,s2,t2?r,g,b,a\" - compose a skin texture from multiple images.\n The texture is determined to be sufficient to hold the first named image, additional images can be named as extra tokens on the same line.\n Use a + at the end of the line to continue reading image tokens from the next line also, the named shader must use 'map $diffuse' to read the composed texture (compatible with the defaultskin shader). Must be matched with a releasecustomskin call later, and is pointless without applycustomskin.")}, {"applycustomskin", PF_Fixme, 0, 0, 0, 378, D("void(entity e, float skinobj)", "Updates the entity's custom skin (refcounted).")}, {"releasecustomskin",PF_Fixme, 0, 0, 0, 379, D("void(float skinobj)", "Lets the engine know that the skin will no longer be needed. Thanks to refcounting any ents with the skin already applied will retain their skin until later changed. It is valid to destroy a skin just after applying it to an ent in the same function that it was created in, as the skin will only be destroyed once its refcount rops to 0.")},