diff --git a/main/multi.c b/main/multi.c index 17191249c..e7de17364 100644 --- a/main/multi.c +++ b/main/multi.c @@ -2650,7 +2650,6 @@ multi_send_player_explode(char type) multi_strip_robots(Player_num); } -extern ubyte Secondary_weapon_to_powerup[], Primary_weapon_to_powerup[]; extern int Proximity_dropped, Smartmines_dropped; /* diff --git a/main/weapon.c b/main/weapon.c index 600fa583b..d9c87481e 100644 --- a/main/weapon.c +++ b/main/weapon.c @@ -46,20 +46,20 @@ int SOrderList (int num); //ubyte Default_secondary_ammo_level[MAX_SECONDARY_WEAPONS] = {3, 0, 0, 0, 0}; // Convert primary weapons to indices in Weapon_info array. -ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {LASER_ID, VULCAN_ID, SPREADFIRE_ID, PLASMA_ID, FUSION_ID, SUPER_LASER_ID, GAUSS_ID, HELIX_ID, PHOENIX_ID, OMEGA_ID}; -ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {CONCUSSION_ID, HOMING_ID, PROXIMITY_ID, SMART_ID, MEGA_ID, FLASH_ID, GUIDEDMISS_ID, SUPERPROX_ID, MERCURY_ID, EARTHSHAKER_ID}; +const ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {LASER_ID, VULCAN_ID, SPREADFIRE_ID, PLASMA_ID, FUSION_ID, SUPER_LASER_ID, GAUSS_ID, HELIX_ID, PHOENIX_ID, OMEGA_ID}; +const ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {CONCUSSION_ID, HOMING_ID, PROXIMITY_ID, SMART_ID, MEGA_ID, FLASH_ID, GUIDEDMISS_ID, SUPERPROX_ID, MERCURY_ID, EARTHSHAKER_ID}; //for each Secondary weapon, which gun it fires out of -ubyte Secondary_weapon_to_gun_num[MAX_SECONDARY_WEAPONS] = {4,4,7,7,7,4,4,7,4,7}; +const ubyte Secondary_weapon_to_gun_num[MAX_SECONDARY_WEAPONS] = {4,4,7,7,7,4,4,7,4,7}; -int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0, 0, VULCAN_AMMO_MAX, 0, 0, 0}; -ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5, 20, 20, 15, 10, 10}; +const int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0, 0, VULCAN_AMMO_MAX, 0, 0, 0}; +const ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5, 20, 20, 15, 10, 10}; //for each primary weapon, what kind of powerup gives weapon -ubyte Primary_weapon_to_powerup[MAX_PRIMARY_WEAPONS] = {POW_LASER,POW_VULCAN_WEAPON,POW_SPREADFIRE_WEAPON,POW_PLASMA_WEAPON,POW_FUSION_WEAPON,POW_LASER,POW_GAUSS_WEAPON,POW_HELIX_WEAPON,POW_PHOENIX_WEAPON,POW_OMEGA_WEAPON}; +const ubyte Primary_weapon_to_powerup[MAX_PRIMARY_WEAPONS] = {POW_LASER,POW_VULCAN_WEAPON,POW_SPREADFIRE_WEAPON,POW_PLASMA_WEAPON,POW_FUSION_WEAPON,POW_LASER,POW_GAUSS_WEAPON,POW_HELIX_WEAPON,POW_PHOENIX_WEAPON,POW_OMEGA_WEAPON}; //for each Secondary weapon, what kind of powerup gives weapon -ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS] = {POW_MISSILE_1,POW_HOMING_AMMO_1,POW_PROXIMITY_WEAPON,POW_SMARTBOMB_WEAPON,POW_MEGA_WEAPON,POW_SMISSILE1_1,POW_GUIDED_MISSILE_1,POW_SMART_MINE,POW_MERCURY_MISSILE_1,POW_EARTHSHAKER_MISSILE}; +const ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS] = {POW_MISSILE_1,POW_HOMING_AMMO_1,POW_PROXIMITY_WEAPON,POW_SMARTBOMB_WEAPON,POW_MEGA_WEAPON,POW_SMISSILE1_1,POW_GUIDED_MISSILE_1,POW_SMART_MINE,POW_MERCURY_MISSILE_1,POW_EARTHSHAKER_MISSILE}; weapon_info Weapon_info[MAX_WEAPON_TYPES]; int N_weapon_types=0; @@ -67,8 +67,8 @@ sbyte Primary_weapon, Secondary_weapon; // autoselect ordering -ubyte DefaultPrimaryOrder[]={9,8,7,6,5,4,3,2,1,0,255}; -ubyte DefaultSecondaryOrder[]={9,8,4,3,1,5,0,255,7,6,2}; +static const ubyte DefaultPrimaryOrder[]={9,8,7,6,5,4,3,2,1,0,255}; +static const ubyte DefaultSecondaryOrder[]={9,8,4,3,1,5,0,255,7,6,2}; //allow player to reorder menus? extern ubyte MenuReordering; @@ -105,7 +105,7 @@ extern ubyte MenuReordering; // "Mega\nMissile" //}; -sbyte Weapon_is_energy[MAX_WEAPON_TYPES] = { +const sbyte Weapon_is_energy[MAX_WEAPON_TYPES] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, diff --git a/main/weapon.h b/main/weapon.h index 4addfb401..7723b4b2c 100644 --- a/main/weapon.h +++ b/main/weapon.h @@ -162,17 +162,17 @@ extern void show_weapon_status(void); extern sbyte Primary_weapon, Secondary_weapon; -extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS]; -extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS]; +extern const ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS]; +extern const ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS]; //for each Secondary weapon, which gun it fires out of -extern ubyte Secondary_weapon_to_gun_num[MAX_SECONDARY_WEAPONS]; +extern const ubyte Secondary_weapon_to_gun_num[MAX_SECONDARY_WEAPONS]; //for each primary weapon, what kind of powerup gives weapon -extern ubyte Primary_weapon_to_powerup[MAX_SECONDARY_WEAPONS]; +extern const ubyte Primary_weapon_to_powerup[MAX_SECONDARY_WEAPONS]; //for each Secondary weapon, what kind of powerup gives weapon -extern ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS]; +extern const ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS]; //flags whether the last time we use this weapon, it was the 'super' version extern ubyte Primary_last_was_super[MAX_PRIMARY_WEAPONS]; @@ -181,13 +181,13 @@ extern ubyte Secondary_last_was_super[MAX_SECONDARY_WEAPONS]; extern void auto_select_weapon(int weapon_type); //parm is primary or secondary extern void select_weapon(int weapon_num, int secondary_flag, int print_message,int wait_for_rearm); -extern char *Primary_weapon_names_short[]; -extern char *Secondary_weapon_names_short[]; -extern char *Primary_weapon_names[]; -extern char *Secondary_weapon_names[]; -extern int Primary_ammo_max[MAX_PRIMARY_WEAPONS]; -extern ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS]; -extern sbyte Weapon_is_energy[MAX_WEAPON_TYPES]; +extern const char *const Primary_weapon_names_short[]; +extern const char *const Secondary_weapon_names_short[]; +extern const char *const Primary_weapon_names[]; +extern const char *const Secondary_weapon_names[]; +extern const int Primary_ammo_max[MAX_PRIMARY_WEAPONS]; +extern const ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS]; +extern const sbyte Weapon_is_energy[MAX_WEAPON_TYPES]; #define HAS_WEAPON_FLAG 1 #define HAS_ENERGY_FLAG 2