Hi
@selarch, welcome to the forums.
It's been a while for me, but there are a few places in the code where the guns/cannons are defined.
It all depends on what you are actually trying to accomplish.
Before you change anything in the code, back up your files for safety and convenience -- in case things get messed up.
To define and add new guns to the game, have a look at "Program/cannons/Cannons_init.c", where the all the current guns in the game are created/initialised. "Cannons.h" and "Cannons.c" are, of course, related.
The three available types of "cannons" pre-defined in the game are culverins, cannons, and mortars, as well as a fourth class for anything that doesn't fit into those groupings, called "special cannon".
Code:
Types:
CANNON_NAME_CULVERINE
CANNON_NAME_CANNON
CANNON_NAME_MORTAR
CANNON_NAME_SPECIAL_CANNON
Here's a rough example of a new cannon to be added to the game (using an existing cannon/template):
Code:
makeref(rCannon,Cannon[CANNON_TYPE_CANNON_LBS16]);
rCannon.type = CANNON_NAME_CANNON;
rCannon.name = "my16caliber";
rCannon.picture = "cannons7";
rCannon.Sound = "cannon_fire";
rCannon.caliber = 16;
rCannon.ReloadTime = 100;
rCannon.Cost = 140;
rCannon.Weight = 30;
rCannon.FireAngMax = 0.60;
rCannon.FireAngMin = -0.35;
rCannon.TimeSpeedMultiply = 1.0;
rCannon.BigBall = 0;
rCannon.SizeMultiply = 1.0;
rCannon.HeightMultiply = 1.0;
rCannon.DamageMultiply = 2.6;
rCannon.hp = 70.0;
InitBaseCannons_CalcSpeedV0(&rCannon,560.0);
You then need to name your new cannon in "RESOURCE/INI/texts/(your language)/common.ini". Search for the keyword "caliber", and you'll find where all the other cannon name strings are defined:
Code:
; Cannon names and types
string = NoneCannons,"No cannons"
string = Cannon,"Cannons"
string = Culverine,"Culverin"
string = Mortar,"Mortar"
string = caliber8,"8lbs"
string = caliber12,"12 lbs"
string = caliber16,"16 lbs"
string = caliber24,"24 lbs"
string = caliber32,"32 lbs"
string = caliber36,"36 lbs"
string = caliber42,"42 lbs"
string = caliber48,"48 lbs"
string = caliber92,"92 lbs"
In this example, you'd add to this list:
Code:
string = my16caliber,"My Custom 16 lbs"
For changing the handling of things on the user end, on the shipyard screen -- for customising gun purchasing -- you'll need to poke around in "Program/interface/shipyard.c". This is the code that handles the shipyard store. But you may not need to change anything in here, as long as you follow the established system. Theoretically, the store should make your new gun available for purchase with the rest (if you did everything right to create/initialise it), and your new gun should work as you wanted it in-game. You'll need to test this, of course.