PricklyPea | | Lieutenant | Messages: 534
Registered: February 2005 | |
|
Can somebody test the code below. When I dump the beam weapons, the streaming pulveriser is repeated in place of the AMP. Could anyone confirm whether they get the same thing? (JRC4 required).
struct orbital{
short int ID;
unsigned char Ener;
unsigned char Weap;
unsigned char Prop;
unsigned char Cons;
unsigned char Elec;
unsigned char Bio;
unsigned char Name[32];
short int Mass;
short int Res;
short int Iron;
short int Bora;
short int Germ;
short int Image;
short int Max_Mass;
short int Max_Rng;
};
struct beam{
short int ID;
unsigned char Ener;
unsigned char Weap;
unsigned char Prop;
unsigned char Cons;
unsigned char Elec;
unsigned char Bio;
unsigned char Name[32];
short int Mass;
short int Res;
short int Iron;
short int Bora;
short int Germ;
short int Image;
short int Max_Rng;
short int Power;
short int Init;
short int Flag;
};
void printOrbital(orbital o){
printf("ID: %d\r\n",o.ID);
printf("Ener: %d\r\n",o.Ener);
printf("Weap: %d\r\n",o.Weap);
printf("Prop: %d\r\n",o.Prop);
printf("Cons: %d\r\n",o.Cons);
printf("Elec: %d\r\n",o.Elec);
printf("Bio: %d\r\n",o.Bio);
printf("Name: %s\r\n",o.Name);
printf("Mass: %d\r\n",o.Mass);
printf("Res: %d\r\n",o.Res);
printf("Iron: %d\r\n",o.Iron);
printf("Bora: %d\r\n",o.Bora);
printf("Germ: %d\r\n",o.Germ);
printf("Image: %d\r\n",o.Image);
printf("Mass/Warp: %d\r\n",o.Max_Mass);
printf("Max_Rng: %d\r\n",o.Max_Rng);
}
void exportOrbital(orbital o){
printf("%d,%d,%d,%d,%d,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d \r\n", o.ID, o.Ener, o.Weap, o.Prop, o.Cons, o.Elec, o.Bio, o.Name, o.Mass, o.Res, o.Iron, o.Bora, o.Germ, o.Image, o.Max_Mass, o.Max_Rng);
}
void exportBeam(beam o){
printf("%d,%d,%d,%d,%d,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d ,%d,%d\r\n", o.ID, o.Ener, o.Weap, o.Prop, o.Cons, o.Elec, o.Bio, o.Name, o.Mass, o.Res, o.Iron, o.Bora, o.Germ, o.Image, o.Max_Rng, o.Power, o.Init, o.Flag);
}
int main(int argc, char* argv[])
{
FILE *f;
struct orbital r;
struct beam b;
int i;
#define NUM_ORBITAL 16
#define NUM_BEAM 24
f=fopen("stars.exe","r");
if (!f) return 1;
for (i=0;i<NUM_ORBITAL;i++){
fseek(f,0x8d8a+(i*sizeof(struct orbital)),SEEK_SET);
if feof(f) return 1;
if ferror(f) return 1;
fread(&r,sizeof(struct orbital),1,f);
exportOrbital(r);
}
for (i=0;i<NUM_BEAM;i++){
fseek(f,0x6450+(i*sizeof(struct beam)),SEEK_SET);
if feof(f) return 1;
if ferror(f) {printf("ferror"); return 1;}
fread(&b,sizeof(struct beam),1,f);
exportBeam(b);
}
fclose(f);
printf("\n");
return 0;
}
Report message to a moderator
|