home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dune2mm2.zip
/
DUNE2MM.C
next >
Wrap
C/C++ Source or Header
|
1992-12-12
|
2KB
|
63 lines
/* Dune 2 Money Maxxer v2.0 - by Patch - FLT Cheats / Editors */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(int argc, char **argv)
{
FILE *fp;
int i, t, start, end, amount, desclen;
char filename[20], descrip[30], temp[80], found = 0;
printf("%c[2J",27);
printf("Dune 2 Money Maxxer v2.0 - by Patch\n");
printf(" FLT Cheats / Editors \n");
printf("───────────────────────────────────\n");
if (argc < 2)
{
printf("Usage: DUNE2MM SAVEGAME AMOUNT\n");
printf("where: SAVEGAME represents the number of the save game you want\n");
printf(" to max; can be from 0 - whatever, or A for ALL\n");
printf(" AMOUNT represents the number of credits you want to\n");
printf(" have; can be from 0 - 32767; default is 32767\n");
exit(1);
}
if ((argv[1][0] == 'a') || (argv[1][0] == 'A'))
{
start = 0;
end = 999;
}
else start = end = atoi(argv[1]);
if (argc == 2) amount = 32767;
else amount = atoi(argv[2]);
for (i = start; i <= end; i++)
{
sprintf(filename,"_save%03d.dat",i);
fp = fopen(filename,"r+b");
if (fp == NULL)
{
if (start == end) printf("Could not open save file [%s]!\n",filename);
exit(1);
}
fseek(fp,19,0);
desclen = fgetc(fp);
fgets(descrip,desclen,fp);
printf("Maxxing money for [%s] - %s\n",filename,descrip);
fseek(fp,350,0);
fread(temp,1,80,fp);
for (t = 0; t < 80; t++)
{
if (strncmp(temp + t,"PLYR",4) == 0) found = 1;
if (found == 1) break;
}
fseek(fp,350 + t + 26,0);
fprintf(fp,"%c%c",amount & 0x00ff,((amount & 0xff00) >> 8));
fclose(fp);
}
}