Free Hero Mesh

Check-in [d1dcb9242a]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Change some dealing with IMG/DEP lumps; in future the MUL lumps may also be implemented.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d1dcb9242a0acd78d77488a052f86fd1f197bb64
User & Date: user on 2022-07-18 03:06:09
Other Links: manifest | tags
Context
2022-07-18
06:38
Implement (partially) comconfig; also add back into game.c the ability to record solution timestamps (that was removed by mistake in the past), and improve documentation about compiling (in README file). check-in: 3bac201324 user: user tags: trunk
03:06
Change some dealing with IMG/DEP lumps; in future the MUL lumps may also be implemented. check-in: d1dcb9242a user: user tags: trunk
2022-07-16
01:20
Implement the global (Density) block. check-in: 6e7ed8025b user: user tags: trunk
Changes

Modified picedit.c from [a7247f6f66] to [11fb52bb5b].

207
208
209
210
211
212
213
214


215
216
217
218
219
220
221
207
208
209
210
211
212
213

214
215
216
217
218
219
220
221
222







-
+
+







    while(j=fgetc(fp)) {
      if(j==EOF) goto done;
      if(i<255) nam[i++]=j;
    }
    nam[i]=0;
    sqlite3_reset(st);
    sqlite3_bind_text(st,1,nam,i,SQLITE_TRANSIENT);
    sqlite3_bind_int(st,2,j=(i>4 && !memcmp(".IMG",nam+i-4,4)?1:!memcmp(".DEP",nam+i-4,4)?2:0));
    if(i>4) j=(!memcmp(".IMG",nam+i-4,4)?1:!memcmp(".DEP",nam+i-4,4)?2:0); else j=0;
    sqlite3_bind_int(st,2,j);
    if(j) r++;
    i=fgetc(fp)<<16;
    i|=fgetc(fp)<<24;
    i|=fgetc(fp)<<0;
    i|=fgetc(fp)<<8;
    if(!i) continue;
    if(i<0) fatal("Bad or too big lump in .xclass file\n");

Modified picture.c from [f61adccb5b] to [feff4c6f93].

701
702
703
704
705
706
707
708

709
710
711
712
713
714
715
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(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
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);
    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");