]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Obtain image name from the character's text file
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 Jan 2012 20:49:59 +0000 (22:49 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 Jan 2012 20:49:59 +0000 (22:49 +0200)
data/qcsrc/client/hud.qc
data/qcsrc/server/miscfunctions.qc

index 282b1fa1001750c98e1137784f94027891d694ee..976c1ec6a8354eb81366e547f8bd17e7dea54c66 100644 (file)
@@ -3553,10 +3553,33 @@ void CSQC_race_hud(void)
 \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
index bd66439fde78b8cdcab5546343f9316424879194..2d7de74f151dbc181525949763e151ae2538c308 100644 (file)
@@ -2468,11 +2468,8 @@ float portrait_SendEntity(entity to, float sf)
 \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