Annotation of sbbs/game/game.c, revision 1.1.1.1

1.1       root        1: /* GAME.C */
                      2: 
                      3: #include "game.h"
                      4: 
                      5: int caliber(int item)
                      6: {
                      7: 
                      8: if(item<ITEM_USSR_AKSU74_545MM || item>ITEM_WILD_AP_45MAG) {
                      9:        printf("ERROR caliber() item not a gun.\r\n");
                     10:        return(-1); }
                     11: 
                     12: if(item==ITEM_USSR_AKSU74_545MM || item==ITEM_USSR_PSM_545MM)
                     13:        return(ITEM_AMMO_545MM);
                     14: 
                     15: if((item>=ITEM_HECK_MP53_556MM && item <=ITEM_ZAST_M85_556MM)
                     16:        || (item>=ITEM_COLT_AR15A2_556MM && item<=ITEM_STYR_AUG_556MM)
                     17:        || (item>=ITEM_AMER_AAI_556MM && item<=ITEM_YUGO_M80_556MM)
                     18:        || (item>=ITEM_RUGR_M77_556MM && item<=ITEM_MCML_SIGN_556MM)
                     19:        || item==ITEM_BRWN_81BLR_556MM)
                     20:        return(ITEM_AMMO_556MM);
                     21: 
                     22: if(item>=ITEM_BELG_FNP90_57MM && item<=ITEM_FRNC_GIAT_57MM)
                     23:        return(ITEM_AMMO_57MM);
                     24: 
                     25: if(item==ITEM_CRIS_M62_30
                     26:        || item==ITEM_SPRG_M1903_30
                     27:        || item==ITEM_AMTT_AM3_30
                     28:        || (item>=ITEM_AMER_M1A1_30 && item<=ITEM_REMI_M1918_30))
                     29:        return(ITEM_AMMO_30);
                     30: 
                     31: if((item>=ITEM_CHIN_T64_762MM && item<=ITEM_YUGO_M84_762MM)
                     32:        || (item>=ITEM_BRWN_BAR_762MM && item<=ITEM_SPRG_M1A1_762MM)
                     33:        || (item>=ITEM_AMER_M14_762MM && item<=ITEM_YUGO_M79_762MM)
                     34:        || (item>=ITEM_AUST_SSG69_762MM && item<=ITEM_WINC_M70_762MM)
                     35:        || item==ITEM_BRWN_81BLR_762MM
                     36:        || item==ITEM_REMI_7600_762MM
                     37:        || (item>=ITEM_CHIN_T51_762MM && item<=ITEM_YUGO_M57_762MM))
                     38:        return(ITEM_AMMO_762MM);
                     39: 
                     40: if((item>=ITEM_CZEC_VZ62_765MM && item<=ITEM_FRNC_MAS38_765MM)
                     41:        || (item>=ITEM_BELG_M1889_765MM && item<=ITEM_TURK_M1890_765MM)
                     42:        || (item>=ITEM_BECK_BEHO_765MM && item<=ITEM_WALT_MPPK_765MM))
                     43:        return(ITEM_AMMO_765MM);
                     44: 
                     45: if(item==ITEM_JAPA_T100_8MM
                     46:        || (item>=ITEM_DENM_KRAG_8MM && item<=ITEM_MANN_SHORT_8MM)
                     47:        || (item>=ITEM_NAMB_M1904_8MM && item<=ITEM_ROTH_M1907_8MM))
                     48:        return(ITEM_AMMO_8MM);
                     49: 
                     50: if((item>=ITEM_AMER_UDM42_9PAR && item<=ITEM_WALT_MPK_9PAR)
                     51:        || item==ITEM_HECK_94A2_9PAR
                     52:        || item==ITEM_SMTH_M1940_9PAR
                     53:        || (item>=ITEM_AMRD_SEMM_9PAR && item<=ITEM_YUGO_M70_9PAR))
                     54:        return(ITEM_AMMO_9PAR);
                     55: 
                     56: if((item>=ITEM_BENE_CBM2_9MM && item<=ITEM_STYR_SI100_9MM)
                     57:        || item==ITEM_COLT_CAR15_9MM
                     58:        || item==ITEM_COLT_CAR15A_9MM
                     59:        || (item>=ITEM_ASTR_M1921_9MM && item<=ITEM_WYOM_PARK_9MM))
                     60:        return(ITEM_AMMO_9MM);
                     61: 
                     62: if((item>=ITEM_BRAZ_MB50_45ACP && item<=ITEM_INGR_MAC10_45ACP)
                     63:        || (item>=ITEM_THOM_A1_45ACP && item<=ITEM_THOM_M1_45ACP)
                     64:        || item==ITEM_HARR_M60_45ACP
                     65:        || (item>=ITEM_BALL_MOLIN_45ACP && item<=ITEM_WYOM_PARK_45ACP))
                     66:        return(ITEM_AMMO_9MM);
                     67: 
                     68: }
                     69: 
                     70: /************************************************************************/
                     71: /* Build description for any type of item - detail can be DETAIL_LOW,  */
                     72: /* DETAIL_MED, or DETAIL_HIGH                                                                                  */
                     73: /************************************************************************/
                     74: char *item_desc(int item, char detail)
                     75: {
                     76:        static char str[1024];
                     77:        ITEMSPEC spec=itemspec(item);
                     78: 
                     79: str[0]=0;
                     80: 
                     81: if(detail==DETAIL_MED || detail==DETAIL_HIGH)
                     82:        switch(item) {
                     83:                case ITEM_USSR_AKSU74_545MM:
                     84:                        strcpy(str,"Russian made AKSU 74 5.45mm");
                     85:                        break;
                     86:                case ITEM_HECK_MP53_556MM:
                     87:                        strcpy(str,"Heckler & Koch MP53 5.56mm");
                     88:                        break; }
                     89: 
                     90: /**********************/
                     91: /* Low detail section */
                     92: /**********************/
                     93: 
                     94: if(item<=ITEM_USSR_AKSU74_545MM && item<=ITEM_REIS_M50_45)
                     95:        strcat(str,"submachine gun");
                     96: 
                     97: if((item<=ITEM_COLT_AR15A2_556MM && item<=ITEM_STYR_AMR_15MM)
                     98:        || (item<=ITEM_ANSC_525_22LR && item<=ITEM_SURV_AR7_22LR))
                     99:        strcat(str,"rifle");
                    100: 
                    101: if(item<=ITEM_ARGR_M77_556MM && item<=ITEM_ARGR_7722_22MAG)
                    102:        strcat(str,"bolt action rifle");
                    103: 
                    104: if(item<=ITEM_BRWN_81BLR_556MM && item<=ITEM_WINC_94T_45)
                    105:        strcat(str,"lever action rifle");
                    106: 
                    107: if(item<=ITEM_REMI_572BDL_22LR && item<=ITEM_SPRG_TIMB_44MAG)
                    108:        strcat(str,"slide action rifle");
                    109: 
                    110: if((item<=ITEM_BERE_RS202_12 && item<=ITEM_MOSS_500_12)
                    111:        || (item<=ITEM_REMI_1100_410 && item<=ITEM_WINC_1400_12))
                    112:        strcat(str,"shotgun");
                    113: 
                    114: if(item<=ITEM_MOSS_500_410 && item<=ITEM_BRWN_BPS_10)
                    115:        strcat(str,"pump action shotgun");
                    116: 
                    117: if(item<=ITEM_SILE_PROT_410 && item<=ITEM_SILE_PROT_12)
                    118:        strcat(str,"single shot shotgun");
                    119: 
                    120: if(item<=ITEM_AMER_SILV_410 && item<=ITEM_AMER_OVER_10)
                    121:        strcat(str,"over and under shotgun");
                    122: 
                    123: if(item<=ITEM_PIOT_SHOT_410 && item<=ITEM_PIOT_SHOT_10)
                    124:        strcat(str,"double barrel shotgun");
                    125: 
                    126: if(item<=ITEM_SMTH_MD34_22LR && item<=ITEM_SMTH_MD25_45)
                    127:        strcat(str,"revolver");
                    128: 
                    129: if(item<=ITEM_BERE_950BS_22SR && item<=ITEM_WILD_AP_45MAG)
                    130:        strcat(str,"handgun");
                    131: 
                    132: if(detail==DETAIL_HIGH) {
                    133:        strcat(str,"\r\n");
                    134:        switch(item) {
                    135:                case ITEM_USSR_AKSU74_545MM:
                    136:                        strcat(str,gun_desc(19,26
                    137:                                ,spec.weight,spec.capacity,spec.value));
                    138:                        break;
                    139:                case ITEM_HECK_MP53_556MM:
                    140:                        strcat(str,gun_desc(16,25
                    141:                                ,spec.weight,spec.capacity,spec.value));
                    142:                        break;
                    143:         case ITEM_HECK_MP53_556MM:
                    144:                        strcat(str,gun_desc(16,27
                    145:                                ,spec.weight,spec.capacity,spec.value));
                    146:                        break;
                    147:         case ITEM_HECK_MP53_556MM:
                    148:                        strcat(str,gun_desc(16,27
                    149:                                ,spec.weight,spec.capacity,spec.value));
                    150:                        break;
                    151:                case ITEM_HECK_MP53_556MM:
                    152:                        strcat(str,gun_desc(16,26
                    153:                                ,spec.weight,spec.capacity,spec.value));
                    154:                        break; } }
                    155: 
                    156: 
                    157: return(str);
                    158: }
                    159: 
                    160: /************************************************************************/
                    161: /* Build high detailed description for gun from data given.                            */
                    162: /************************************************************************/
                    163: char *gun_desc(float barrel_length, float overall_length
                    164:        ,float weight, char capacity, int value)
                    165: {
                    166:        static char str[1024];
                    167: 
                    168: sprintf(str,"Barrel length: %3.1f  Overall Length: %3.1f  Weight: %3.1f\r\n"
                    169:        "Capacity: %5d  Value: %d\r\n",barrel_length,overall_length,weight
                    170:        ,capacity,value);
                    171: }
                    172: 
                    173: /************************************************************************/
                    174: /* Returns the specifications for a certain item                                               */
                    175: /************************************************************************/
                    176: ITEMSPEC itemspec(int item)
                    177: {
                    178:        ITEMSPEC spec;
                    179: 
                    180: 
                    181: switch(item) {
                    182:        case ITEM_USSR_AKSU74_545MM:
                    183:                spec.weight=13.5;
                    184:                spec.capacity=15;
                    185:                spec.value=5000;
                    186:                spec.size=LARGE;
                    187:                break;
                    188:        case ITEM_HECK_MP53_556MM:
                    189:                spec.weight=15.6;
                    190:                spec.capacity=30;
                    191:                spec.value=3000;
                    192:                spec.size=LARGE;
                    193:                break; }
                    194: 
                    195: return(spec);
                    196: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.