Could someone direct me to what part of the source code interprets what is entered in the .dat and .scn files?
The coding really isn't commented to state what it does or doesn't do. Two functions that may help a bit:
if (strcmp(func,"power") == 0) {
moduleFunc = power_plant;
SetStat(store,par[0] * power);
//store = par[0] * power;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
}
else if (strcmp(func,"fuel") == 0) {
moduleFunc = fuel_cell;
SetStat(store,par[0] * power);
//store = par[0] * power;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"batt") == 0) {
moduleFunc = battery;
SetStat(store,par[0] * power);
//store = par[0] * power;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"eng") == 0) {
moduleFunc = engine;
MultToStat(par[0],unit_thrust / g_scale);
//par[0] *= unit_thrust / g_scale;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"qdrv") == 0) {
moduleFunc = qdrv;
MultToStat(par[0],game->lightSpeed);
//par[0] *= game->lightSpeed;
nPar = 2;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"tube") == 0) {
/************************************************/
/* tube weapon: */
/************************************************/
/* par: */
/* par[0]: number of frames of power in storage */
/* par[1]: cost per frame to fire */
/* par[2]: number of missiles */
/* par[3]: missile index */
/* par[4]: mode (same as tube) */
/************************************************/
/* specPar: */
/* par[0]: angular position on bitmap */
/* par[1]: radial position on bitmap */
/* par[2]: angle of fire */
/* par[3]: starting angle in firing arc */
/* par[4]: ending angle in firing arc */
/************************************************/
moduleFunc = tube;
workPar[0] = par[2]; /* load tube with full complement of ammo */
nPar = 6;
nSPar = 5;
nWPar = 1; //check this
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"beam") == 0) {
/************************************************/
/* beam weapon: */
/* par[0]: number of frames of power in storage */
/* par[1]: cost per frame to fire */
/* par[2]: maximum range */
/* par[3]: (not used) */
/* par[4]: mode (same as tube) */
/************************************************/
/* specPar: */
/* par[0]: angular position on bitmap */
/* par[1]: radial position on bitmap */
/* par[2]: angle of fire (not used) */
/* par[3]: starting angle in firing arc */
/* (not used) */
/* par[4]: ending angle in firing arc */
/* (not used) */
/************************************************/
moduleFunc = beam;
nPar = 5; //check this
nSPar = 5; //check this
nWPar = 2; //check this
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"ram") == 0) {
/************************************************/
/* ram weapon: */
/* par[0]: number of frames of power in storage */
/* par[1]: cost per frame to fire */
/* par[2]: number of rams */
/* par[3]: missile index */
/* par[4]: mode (same as tube) */
/************************************************/
/* specPar: */
/* par[0]: angular position on bitmap */
/* par[1]: radial position on bitmap */
/* par[2]: angle of fire */
/* par[3]: starting angle in firing arc */
/* (not used) */
/* par[4]: ending angle in firing arc */
/* (not used) */
/************************************************/
moduleFunc = ram;
workPar[0] = par[2]; /* load tube with full complement of ammo */
nPar = 5; //check this
nSPar = 3; //do not need firing arc
nWPar = 1; //check this
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"shield") == 0) {
moduleFunc = shield;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"armor") == 0) {
moduleFunc = armor;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"brake") == 0) {
moduleFunc = brake;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"sensor") == 0) {
moduleFunc = sensor;
nPar = 1;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
} else if (strcmp(func,"cm") == 0) {
moduleFunc = counter_measures;
nPar = 2;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"stealth") == 0) {
moduleFunc = cloak;
nPar = 4;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"boost") == 0) {
moduleFunc = boost;
nPar = 3;
nSPar = 0;
nWPar = 0;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"dock") == 0) {
/************************************************/
/* dock: */
/************************************************/
/* par: */
/* par[0]: number of frames of power in storage */
/* par[1]: thrust parameter (same units as */
/* engine) */
/* par[2]: range in pixels */
/************************************************/
/* specPar: */
/* par[0]: angular position on bitmap */
/* par[1]: radial position on bitmap */
/* par[2]: angle of docked target */
/************************************************/
moduleFunc = dock;
MultToStat(par[1],unit_thrust / g_scale);
//par[1] *= unit_thrust / g_scale;
nPar = 3;
nSPar = 3;
nWPar = 2;
checkSum = CheckSum();
Replenish();
} else if (strcmp(func,"factory") == 0) {
moduleFunc = factory;
nPar = 1;
nSPar = 4; /* 1: production ; 3: temporary port number assignment */
nWPar = 2;
checkSum = CheckSum();
}
}
void ModuleClass::IncreaseValue(long v, long p) {
if ( check != 0xAAAAAAAA ) return;
/* increase the value of the module by the amount v */
short nf;
long f, df, t;
switch (moduleFunc) {
case power_plant:
AddToStat(power,v/1000);
//power += v / 1000;
break;
case engine:
SetStat(par[0],min(par[0] + v/1000, 100000 /* max_engine_thr */));
//par[0] = min(par[0] + v/1000, 100000 /* max_engine_thr */);
break;
case qdrv:
nf = 2;
SetStat(par[0],min(par[0] + v/20/nf, 10*game->lightSpeed /* max_qspeed */));
//par[0] = min(par[0] + v/20/nf, 10*game->lightSpeed /* max_qspeed */);
SetStat(par[1],min(par[1] + v/20/nf, 100000 /* max_towable_qmass */));
//par[1] = min(par[1] + v/20/nf, 100000 /* max_towable_qmass */);
break;
case tube:
nf = 2;
/* increase the tube burst by increasing the amount of power it */
/* can store: par[0] */
/* increase the repeat rate by increasing the power recharge */
/* rate: power */
SetStat(par[0],min(par[0] * (100 + p/nf) / 100, 100 /* max_tube_cap */));
//par[0] = min(par[0] * (100 + p/nf) / 100, 100 /* max_tube_cap */);
SetStat(power,-min(-power * (100 + p/nf) / 100, 50 /* max_tube_power */));
//power = -min(-power * (100 + p/nf) / 100, 50 /* max_tube_power */);
break;
case shield:
/* increase the capacity */
nf = 2;
f = -power * par[0];
df = max(min(v/2000, 5000 - f /* max_shield_cap */), 0);
if ((f + df/nf) / max(par[0],1) != -power) {
/* try to divide it evenly */
t = (f + df/nf) / max(-power,1);
SetStat(power,-(f + df/nf) / max(par[0],1));
//power = -(f + df/nf) / max(par[0],1);
SetStat(par[0],t);
//par[0] = t;
} else
/* take it all out of par[0] */
SetStat(par[0],(f + df) / max(-power,1));
//par[0] = (f + df) / max(-power,1);
break;
case brake:
/* decrease the braking factor */
SetStat(par[0],max(par[0] + v/5, 50 /* max_brake_factor */));
//par[0] = max(par[0] + v/5, 50 /* max_brake_factor */);
break;
case sensor:
SetStat(par[0],min(par[0] + v/20000, 100 /* max_sensor_par */));
//par[0] = min(par[0] + v/20000, 100 /* max_sensor_par */);
break;
case fuel_cell:
/* do nothing */
break;
case battery:
/* do nothing */
break;
case counter_measures:
SetStat(par[1],min(par[1] + v/3000, 500 /* max_cm_range */));
par[1] = min(par[1] + v/3000, 500 /* max_cm_range */);
break;
case cloak:
/* increase the capacity */
nf = 2;
f = -power * par[0];
df = min(v/10, 40000 - f /* max_stealth_cap */);
if ((f + df/nf) / max(par[0],1) != -power) {
/* try to divide it evenly */
t = (f + df/nf) / max(-power,1);
SetStat(power,-(f + df/nf) / max(par[0],1));
//power = -(f + df/nf) / max(par[0],1);
SetStat(par[0],t);
//par[0] = t;
} else
/* take it all out of par[0] */
SetStat(par[0],(f + df) / max(-power,1));
//par[0] = (f + df) / max(-power,1);
break;
case boost:
/* increase the capacity first, then maxSpeed and acceleration */
nf = 4;
f = -power * par[0];
df = min(v / max(par[1]*par[2]/100,1), 500000 - f /* max_boost_cap */);
t = (f + df/nf) / max(-power,1);
SetStat(power,-(f + df/nf) / max(par[0],1));
//power = -(f + df/nf) / max(par[0],1);
SetStat(par[0],t);
//par[0] = t;
/* now adjust maxSpeed and accel */
SetStat(par[1],min(par[1] * (100 + p/nf)/100, 300 /* max_boost_vpct */));
//par[1] = min(par[1] * (100 + p/nf)/100, 300 /* max_boost_vpct */);
SetStat(par[2],min(par[2] * (100 + p/nf)/100, 80 /* max_boost_apct */));
//par[2] = min(par[2] * (100 + p/nf)/100, 80 /* max_boost_apct */);
break;
case dock:
/* increase the tractor capacity first, then range and strength */
nf = 4;
f = -power * par[0];
df = min(v / max(par[1]*par[2]/50000,1), 100000 - f /* max_dock_cap */);
t = (f + df/nf) / max(-power,1);
SetStat(power,-(f + df/nf) / max(par[0],1));
//power = -(f + df/nf) / max(par[0],1);
SetStat(par[0],t);
//par[0] = t;
/* now adjust maxSpeed and accel */
SetStat(par[1],min(par[1] * (100 + p/nf)/100,
5000*unit_thrust/g_scale /* max_tractor_thr */));
//par[1] = min(par[1] * (100 + p/nf)/100,
// 5000*unit_thrust/g_scale /* max_tractor_thr */);
SetStat(par[2],min(par[2] * (100 + p/nf)/100, 400 /* max_tractor_range */));
//par[2] = min(par[2] * (100 + p/nf)/100, 400 /* max_tractor_range */);
break;
case factory:
/* do nothing */
break;
case armor:
/* do nothing */
break;
}
The kick in the face is that most of it isn't actually specified. You'd have to research 'factory' for example and see what it does, if it doesn't have a comment.
par[0], par[1], par[2] etc refers to the numbers like factory*par0*par1, get me?
Otherwise the coding is rather messy. You'd have to find out what the pars do actually in the coding.
But its all in trek.cpp, trek.h, the two biggest, messest files. I really need to sum them down and split them up

p.s. battery is the same as fuel, which is basicly power without a recharge, you can even fit these on ships, but if they run out you explode.. :p