|
Author Topic:   52 "new" maps for TM (don't get TOO excited about it, though)...
MW
New Member
posted September 01, 2000 11:19 PM            
ok... i made a (useless) utility that can invert landscape of existing maps (wich probably will be usefull only until an (un)official editor will be released)... however, it has disadvantage (the major one) - you HAVE TO replace the existing map with a converted map (or the game will be using original/un-inverted map). here is a source code (it takes about 5 seconds to convert the map on my PC):

--------------------------------------------


#include <stdio.h>

int file_copy ( char *oldname, char *newname );

int main()
{

char source[80], destination[80];


/* get the source and destination file names */
printf("\n enter the source-map file name:");
gets(source);
printf("\n enter the destination-map file name:");
gets(destination);


if ( file_copy ( source, destination ) == 0 )
puts("converting successfull");
else
fprintf ( stderr, "Error during converting operation" );


return;

}


int file_copy ( char *oldname, char *newname )
{

FILE *fold, *fnew;
int c;
double count;
count=0;
/* open source for readin'/writin' (in binary) */

if (( fold = fopen ( oldname, "rb" )) == NULL)
return -1;

if (( fnew = fopen ( newname, "wb" )) == NULL)
{
fclose ( fold );
return -1;
}

while (1==1)
{
c = fgetc ( fold );


if ( !feof ( fold ))
{
count=count+1;
if ((count>40) && (count<1048616))
{
if (c>127)
c=127-(c-128);
else {
if (c<127)
c = 255 - c;
}
}

fputc (c, fnew );
}
else
break;
}


fclose ( fnew );
fclose ( fold );

return 0;
}

--------------------------------------

a word of caution - don't make "source" map's name the same as "destination" map's name... it'll probably crash the program... or the program will exit... (actually i don't know what will happen, cuz i have not tried to do mix the names... just don't do it).

P.S. don't forget to back up the original maps for using them later.

IP: