\r
void Ent_ReadPortrait()\r
{\r
- string s, n;\r
- s = ReadString();\r
- n = ReadString();\r
+ string pl_model, pl_name, img;\r
+ float pl_skin;\r
+ pl_model = ReadString();\r
+ pl_skin = ReadByte();\r
+ pl_name = ReadString();\r
+\r
+ // obtain the image name from the text file\r
+ float glob, i, fh;\r
+ string fn;\r
+\r
+ glob = search_begin("models/player/*.txt", TRUE, TRUE);\r
+ if(glob < 0)\r
+ return;\r
+ for(i = 0; i < search_getsize(glob); ++i)\r
+ {\r
+ fn = search_getfilename(glob, i);\r
+ fh = fopen(fn, FILE_READ);\r
+ if(fh < 0)\r
+ continue;\r
\r
- dprint(strcat(s, " --------\n"));\r
- dprint(strcat(n, " --------\n"));\r
+ fgets(fh); // skip name\r
+ img = fgets(fh);\r
+ if(pl_skin == stof(fgets(fh)))\r
+ if(pl_model == fgets(fh))\r
+ dprint(strcat(img, " ----------------\n"));\r
+\r
+ fclose(fh);\r
+ }\r
+ search_end(glob);\r
}\r
\r
WriteByte(MSG_ENTITY, ENT_CLIENT_PORTRAIT);\r
\r
- string s;\r
- s = substring(self.model, 0, strlen(self.model) - 4); // remove extension\r
- s = strcat(s, "-", ftos(self.skin));\r
-\r
- WriteString(MSG_ENTITY, s);\r
+ WriteString(MSG_ENTITY, self.model);\r
+ WriteByte(MSG_ENTITY, self.skin);\r
WriteString(MSG_ENTITY, self.netname);\r
\r
return TRUE;\r