|
|
1.06a MS-DOS
/* GAME.C */
#include "game.h"
int caliber(int item)
{
if(item<ITEM_USSR_AKSU74_545MM || item>ITEM_WILD_AP_45MAG) {
printf("ERROR caliber() item not a gun.\r\n");
return(-1); }
if(item==ITEM_USSR_AKSU74_545MM || item==ITEM_USSR_PSM_545MM)
return(ITEM_AMMO_545MM);
if((item>=ITEM_HECK_MP53_556MM && item <=ITEM_ZAST_M85_556MM)
|| (item>=ITEM_COLT_AR15A2_556MM && item<=ITEM_STYR_AUG_556MM)
|| (item>=ITEM_AMER_AAI_556MM && item<=ITEM_YUGO_M80_556MM)
|| (item>=ITEM_RUGR_M77_556MM && item<=ITEM_MCML_SIGN_556MM)
|| item==ITEM_BRWN_81BLR_556MM)
return(ITEM_AMMO_556MM);
if(item>=ITEM_BELG_FNP90_57MM && item<=ITEM_FRNC_GIAT_57MM)
return(ITEM_AMMO_57MM);
if(item==ITEM_CRIS_M62_30
|| item==ITEM_SPRG_M1903_30
|| item==ITEM_AMTT_AM3_30
|| (item>=ITEM_AMER_M1A1_30 && item<=ITEM_REMI_M1918_30))
return(ITEM_AMMO_30);
if((item>=ITEM_CHIN_T64_762MM && item<=ITEM_YUGO_M84_762MM)
|| (item>=ITEM_BRWN_BAR_762MM && item<=ITEM_SPRG_M1A1_762MM)
|| (item>=ITEM_AMER_M14_762MM && item<=ITEM_YUGO_M79_762MM)
|| (item>=ITEM_AUST_SSG69_762MM && item<=ITEM_WINC_M70_762MM)
|| item==ITEM_BRWN_81BLR_762MM
|| item==ITEM_REMI_7600_762MM
|| (item>=ITEM_CHIN_T51_762MM && item<=ITEM_YUGO_M57_762MM))
return(ITEM_AMMO_762MM);
if((item>=ITEM_CZEC_VZ62_765MM && item<=ITEM_FRNC_MAS38_765MM)
|| (item>=ITEM_BELG_M1889_765MM && item<=ITEM_TURK_M1890_765MM)
|| (item>=ITEM_BECK_BEHO_765MM && item<=ITEM_WALT_MPPK_765MM))
return(ITEM_AMMO_765MM);
if(item==ITEM_JAPA_T100_8MM
|| (item>=ITEM_DENM_KRAG_8MM && item<=ITEM_MANN_SHORT_8MM)
|| (item>=ITEM_NAMB_M1904_8MM && item<=ITEM_ROTH_M1907_8MM))
return(ITEM_AMMO_8MM);
if((item>=ITEM_AMER_UDM42_9PAR && item<=ITEM_WALT_MPK_9PAR)
|| item==ITEM_HECK_94A2_9PAR
|| item==ITEM_SMTH_M1940_9PAR
|| (item>=ITEM_AMRD_SEMM_9PAR && item<=ITEM_YUGO_M70_9PAR))
return(ITEM_AMMO_9PAR);
if((item>=ITEM_BENE_CBM2_9MM && item<=ITEM_STYR_SI100_9MM)
|| item==ITEM_COLT_CAR15_9MM
|| item==ITEM_COLT_CAR15A_9MM
|| (item>=ITEM_ASTR_M1921_9MM && item<=ITEM_WYOM_PARK_9MM))
return(ITEM_AMMO_9MM);
if((item>=ITEM_BRAZ_MB50_45ACP && item<=ITEM_INGR_MAC10_45ACP)
|| (item>=ITEM_THOM_A1_45ACP && item<=ITEM_THOM_M1_45ACP)
|| item==ITEM_HARR_M60_45ACP
|| (item>=ITEM_BALL_MOLIN_45ACP && item<=ITEM_WYOM_PARK_45ACP))
return(ITEM_AMMO_9MM);
}
/************************************************************************/
/* Build description for any type of item - detail can be DETAIL_LOW, */
/* DETAIL_MED, or DETAIL_HIGH */
/************************************************************************/
char *item_desc(int item, char detail)
{
static char str[1024];
ITEMSPEC spec=itemspec(item);
str[0]=0;
if(detail==DETAIL_MED || detail==DETAIL_HIGH)
switch(item) {
case ITEM_USSR_AKSU74_545MM:
strcpy(str,"Russian made AKSU 74 5.45mm");
break;
case ITEM_HECK_MP53_556MM:
strcpy(str,"Heckler & Koch MP53 5.56mm");
break; }
/**********************/
/* Low detail section */
/**********************/
if(item<=ITEM_USSR_AKSU74_545MM && item<=ITEM_REIS_M50_45)
strcat(str,"submachine gun");
if((item<=ITEM_COLT_AR15A2_556MM && item<=ITEM_STYR_AMR_15MM)
|| (item<=ITEM_ANSC_525_22LR && item<=ITEM_SURV_AR7_22LR))
strcat(str,"rifle");
if(item<=ITEM_ARGR_M77_556MM && item<=ITEM_ARGR_7722_22MAG)
strcat(str,"bolt action rifle");
if(item<=ITEM_BRWN_81BLR_556MM && item<=ITEM_WINC_94T_45)
strcat(str,"lever action rifle");
if(item<=ITEM_REMI_572BDL_22LR && item<=ITEM_SPRG_TIMB_44MAG)
strcat(str,"slide action rifle");
if((item<=ITEM_BERE_RS202_12 && item<=ITEM_MOSS_500_12)
|| (item<=ITEM_REMI_1100_410 && item<=ITEM_WINC_1400_12))
strcat(str,"shotgun");
if(item<=ITEM_MOSS_500_410 && item<=ITEM_BRWN_BPS_10)
strcat(str,"pump action shotgun");
if(item<=ITEM_SILE_PROT_410 && item<=ITEM_SILE_PROT_12)
strcat(str,"single shot shotgun");
if(item<=ITEM_AMER_SILV_410 && item<=ITEM_AMER_OVER_10)
strcat(str,"over and under shotgun");
if(item<=ITEM_PIOT_SHOT_410 && item<=ITEM_PIOT_SHOT_10)
strcat(str,"double barrel shotgun");
if(item<=ITEM_SMTH_MD34_22LR && item<=ITEM_SMTH_MD25_45)
strcat(str,"revolver");
if(item<=ITEM_BERE_950BS_22SR && item<=ITEM_WILD_AP_45MAG)
strcat(str,"handgun");
if(detail==DETAIL_HIGH) {
strcat(str,"\r\n");
switch(item) {
case ITEM_USSR_AKSU74_545MM:
strcat(str,gun_desc(19,26
,spec.weight,spec.capacity,spec.value));
break;
case ITEM_HECK_MP53_556MM:
strcat(str,gun_desc(16,25
,spec.weight,spec.capacity,spec.value));
break;
case ITEM_HECK_MP53_556MM:
strcat(str,gun_desc(16,27
,spec.weight,spec.capacity,spec.value));
break;
case ITEM_HECK_MP53_556MM:
strcat(str,gun_desc(16,27
,spec.weight,spec.capacity,spec.value));
break;
case ITEM_HECK_MP53_556MM:
strcat(str,gun_desc(16,26
,spec.weight,spec.capacity,spec.value));
break; } }
return(str);
}
/************************************************************************/
/* Build high detailed description for gun from data given. */
/************************************************************************/
char *gun_desc(float barrel_length, float overall_length
,float weight, char capacity, int value)
{
static char str[1024];
sprintf(str,"Barrel length: %3.1f Overall Length: %3.1f Weight: %3.1f\r\n"
"Capacity: %5d Value: %d\r\n",barrel_length,overall_length,weight
,capacity,value);
}
/************************************************************************/
/* Returns the specifications for a certain item */
/************************************************************************/
ITEMSPEC itemspec(int item)
{
ITEMSPEC spec;
switch(item) {
case ITEM_USSR_AKSU74_545MM:
spec.weight=13.5;
spec.capacity=15;
spec.value=5000;
spec.size=LARGE;
break;
case ITEM_HECK_MP53_556MM:
spec.weight=15.6;
spec.capacity=30;
spec.value=3000;
spec.size=LARGE;
break; }
return(spec);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.