Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [f61adccb5b]:

To Artifact [feff4c6f93]:


701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
    i=0;
    while(j=fgetc(fp)) {
      if(j==EOF) goto nomore1;
      if(i<255) nam[i++]=j;
    }
    nam[i]=0;
    if(i>4 && (!memcmp(".IMG",nam+i-4,4) || !memcmp(".DEP",nam+i-4,4))) {
      if(nam[i-3]=='D') j=0; else j=1;
      if(n++==32768) fatal("Too many pictures\n");
      sqlite3_reset(st);
      sqlite3_bind_int(st,1,n);
      sqlite3_bind_text(st,2,nam,i-4,SQLITE_TRANSIENT);
      sqlite3_bind_int64(st,3,ftell(fp)+4);
      sqlite3_bind_int(st,4,j^1);
      while((i=sqlite3_step(st))==SQLITE_ROW);







|







701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
    i=0;
    while(j=fgetc(fp)) {
      if(j==EOF) goto nomore1;
      if(i<255) nam[i++]=j;
    }
    nam[i]=0;
    if(i>4 && (!memcmp(".IMG",nam+i-4,4) || !memcmp(".DEP",nam+i-4,4))) {
      if(nam[i-3]=='I') j=1; else j=0;
      if(n++==32768) fatal("Too many pictures\n");
      sqlite3_reset(st);
      sqlite3_bind_int(st,1,n);
      sqlite3_bind_text(st,2,nam,i-4,SQLITE_TRANSIENT);
      sqlite3_bind_int64(st,3,ftell(fp)+4);
      sqlite3_bind_int(st,4,j^1);
      while((i=sqlite3_step(st))==SQLITE_ROW);
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
   fatal("Unable to prepare SQL statement while loading pictures: %s\n",sqlite3_errmsg(userdb));
  for(i=0;i<n;i++) {
    if((j=sqlite3_step(st))!=SQLITE_ROW) {
      if(j==SQLITE_DONE) break;
      fatal("SQL error (%d): %s\n",j,sqlite3_errmsg(userdb));
    }
    fseek(fp,sqlite3_column_int64(st,1)-4,SEEK_SET);
    load_dependent_picture(fp,sqlite3_column_int(st,0),altImage);
  }
  sqlite3_finalize(st);
  fclose(fp);
  SDL_SetColorKey(picts,SDL_SRCCOLORKEY|SDL_RLEACCEL,0);
done:
  if(n=sqlite3_exec(userdb,"COMMIT;",0,0,0)) fatal("SQL error (%d): %s\n",n,sqlite3_errmsg(userdb));
  fprintf(stderr,"Done\n");







|







765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
   fatal("Unable to prepare SQL statement while loading pictures: %s\n",sqlite3_errmsg(userdb));
  for(i=0;i<n;i++) {
    if((j=sqlite3_step(st))!=SQLITE_ROW) {
      if(j==SQLITE_DONE) break;
      fatal("SQL error (%d): %s\n",j,sqlite3_errmsg(userdb));
    }
    fseek(fp,sqlite3_column_int64(st,1)-4,SEEK_SET);
    load_dependent_picture(fp,sqlite3_column_int(st,0),0);
  }
  sqlite3_finalize(st);
  fclose(fp);
  SDL_SetColorKey(picts,SDL_SRCCOLORKEY|SDL_RLEACCEL,0);
done:
  if(n=sqlite3_exec(userdb,"COMMIT;",0,0,0)) fatal("SQL error (%d): %s\n",n,sqlite3_errmsg(userdb));
  fprintf(stderr,"Done\n");