Difference for common/image.c from version 1.4 to 1.5


version 1.4 version 1.5
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_image_c =   * static char *rcsid_image_c =
  *   "$Id: image.c,v 1.4 2001/03/30 07:27:48 mwedel Exp $";   *   "$Id: image.c,v 1.5 2001/12/03 07:51:39 mwedel Exp $";
  */   */
   
 /*  /*
Line 69
 
Line 69
  */   */
 int nroffiles = 0, nrofpixmaps=0;  int nroffiles = 0, nrofpixmaps=0;
   
 /* This now merges the color alias and color name table together.  /* the only thing this table is used for now is to
  * The first entry is the color as it is referred to in objects,   * translate the colorname in the magicmap field of the
  * the second is the actual screen/X11 color to use.  NUM_COLORS is now   * face into a numeric index that is then sent to the
  * defined in global.h - if adding colors, increase that value, and everything   * client for magic map commands.  The order of this table
  * else should work appropriately.   * must match that of the NDI colors in include/newclient.h.
  */   */
 char *colorname[NUM_COLORS][2] = {  char *colorname[NUM_COLORS] = {
 {"black", "Black"}, /* 0  */  "black", /* 0  */
 {"white", "White"}, /* 1  */  "white", /* 1  */
 {"blue", "Navy"}, /* 2  */  "blue", /* 2  */
 {"red", "Red"}, /* 3  */  "red", /* 3  */
 {"orange", "Orange"}, /* 4  */  "orange", /* 4  */
 {"light_blue", "DodgerBlue"}, /* 5  */  "light_blue", /* 5  */
 {"dark_orange", "DarkOrange2"}, /* 6  */  "dark_orange", /* 6  */
 {"green", "SeaGreen"}, /* 7  */  "green", /* 7  */
 {"light_green", "DarkSeaGreen"}, /* 8  - Used for window background color */  "light_green", /* 8  */
 {"grey", "Grey50"}, /* 9  */  "grey", /* 9  */
 {"brown", "Sienna"}, /* 10 */  "brown", /* 10 */
 {"yellow", "Gold"}, /* 11 */  "yellow", /* 11 */
 {"khaki", "Khaki"} /* 12 */   "khaki" /* 12 */
 };  };
   
 static int compar (struct bmappair *a, struct bmappair *b) {  static int compar (struct bmappair *a, struct bmappair *b) {
Line 108
 
Line 108
 char find_color(char *name) {  char find_color(char *name) {
   int i;    int i;
   for(i=0;i<NUM_COLORS;i++)    for(i=0;i<NUM_COLORS;i++)
     if(!strcmp(name,colorname[i][0]))      if(!strcmp(name,colorname[i]))
       return i;        return i;
   LOG(llevError,"Unknown color: %s\n",name);    LOG(llevError,"Unknown color: %s\n",name);
   return 0;    return 0;
Line 156
 
Line 156
  else if (!strncmp(buf,"color_fg",8)) {   else if (!strncmp(buf,"color_fg",8)) {
      cp = buf + 9;       cp = buf + 9;
      cp[strlen(cp)-1] = '\0';       cp[strlen(cp)-1] = '\0';
      on_face->fg = find_color(cp);       if (on_face->magicmap==255) on_face->magicmap=find_color(cp);
      if (on_face->magicmap==255) on_face->magicmap=on_face->fg;  
  }   }
  else if (!strncmp(buf,"color_bg",8)) {   else if (!strncmp(buf,"color_bg",8)) {
      cp = buf + 9;       /* ignore it */
      cp[strlen(cp)-1] = '\0';  
      on_face->bg = find_color(cp);  
  }   }
  else if (!strncmp(buf,"visibility",10)) {   else if (!strncmp(buf,"visibility",10)) {
      on_face->visibility = atoi(buf + 11);       on_face->visibility = atoi(buf + 11);
Line 191
 
Line 188
 int ReadBmapNames () {  int ReadBmapNames () {
     char buf[MAX_BUF], *p, *q;      char buf[MAX_BUF], *p, *q;
     FILE *fp;      FILE *fp;
     int value, nrofbmaps = 0, i, fg,bg;      int value, nrofbmaps = 0, i;
   
     sprintf (buf,"%s/bmaps", settings.datadir);      sprintf (buf,"%s/bmaps", settings.datadir);
     LOG(llevDebug,"Reading bmaps from %s...",buf);      LOG(llevDebug,"Reading bmaps from %s...",buf);
Line 231
 
Line 228
     LOG(llevDebug,"done (got %d/%d/%d)\n",nrofpixmaps,nrofbmaps,nroffiles);      LOG(llevDebug,"done (got %d/%d/%d)\n",nrofpixmaps,nrofbmaps,nroffiles);
   
     new_faces = (New_Face *)malloc(sizeof(New_Face) * (nrofpixmaps+1));      new_faces = (New_Face *)malloc(sizeof(New_Face) * (nrofpixmaps+1));
     fg = find_color ("black");  
     bg = find_color ("khaki");  
     for (i = 0; i <= nrofpixmaps; i++) {      for (i = 0; i <= nrofpixmaps; i++) {
  new_faces[i].name = "";   new_faces[i].name = "";
  new_faces[i].number = i;   new_faces[i].number = i;
  new_faces[i].fg = fg;  
  new_faces[i].bg = bg;  
  new_faces[i].visibility=0;   new_faces[i].visibility=0;
  new_faces[i].magicmap=255;   new_faces[i].magicmap=255;
     }      }
Line 266
 
Line 259
     blank_face = &new_faces[FindFace(BLANK_FACE_NAME, 0)];      blank_face = &new_faces[FindFace(BLANK_FACE_NAME, 0)];
     blank_look.face = blank_face;      blank_look.face = blank_face;
     blank_look.flags = 0;      blank_look.flags = 0;
     blank_face->fg = find_color ("black");  
     blank_face->bg = find_color ("khaki");  
     blank_face->magicmap = find_color ("khaki") | FACE_FLOOR;      blank_face->magicmap = find_color ("khaki") | FACE_FLOOR;
   
     empty_face = &new_faces[FindFace(EMPTY_FACE_NAME, 0)];      empty_face = &new_faces[FindFace(EMPTY_FACE_NAME, 0)];
Line 277
 
Line 268
     dark_faces[2] = &new_faces[FindFace (DARK_FACE3_NAME,0)];      dark_faces[2] = &new_faces[FindFace (DARK_FACE3_NAME,0)];
   
     potion_face  = &new_faces[FindFace(POTION_FACE_NAME,0)];      potion_face  = &new_faces[FindFace(POTION_FACE_NAME,0)];
     potion_face->fg = find_color("light_blue");  
     potion_face->bg = find_color("khaki");  
   
     return nrofpixmaps;      return nrofpixmaps;
 }  }


Legend:
line(s) removed in v.1.4 
line(s) changed
 line(s) added in v.1.5

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:06