Annotation of quake2/rogue/m_float.c, revision 1.1.1.1

1.1       root        1: /*
                      2: ==============================================================================
                      3: 
                      4: floater
                      5: 
                      6: ==============================================================================
                      7: */
                      8: 
                      9: #include "g_local.h"
                     10: #include "m_float.h"
                     11: 
                     12: 
                     13: static int     sound_attack2;
                     14: static int     sound_attack3;
                     15: static int     sound_death1;
                     16: static int     sound_idle;
                     17: static int     sound_pain1;
                     18: static int     sound_pain2;
                     19: static int     sound_sight;
                     20: 
                     21: 
                     22: void floater_sight (edict_t *self, edict_t *other)
                     23: {
                     24:        gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
                     25: }
                     26: 
                     27: void floater_idle (edict_t *self)
                     28: {
                     29:        gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
                     30: }
                     31: 
                     32: 
                     33: //void floater_stand1 (edict_t *self);
                     34: void floater_dead (edict_t *self);
                     35: void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
                     36: void floater_run (edict_t *self);
                     37: void floater_wham (edict_t *self);
                     38: void floater_zap (edict_t *self);
                     39: 
                     40: 
                     41: void floater_fire_blaster (edict_t *self)
                     42: {
                     43:        vec3_t  start;
                     44:        vec3_t  forward, right;
                     45:        vec3_t  end;
                     46:        vec3_t  dir;
                     47:        int             effect;
                     48: 
                     49:        if(!self->enemy || !self->enemy->inuse)         //PGM
                     50:                return;                                                                 //PGM
                     51: 
                     52:        if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107))
                     53:                effect = EF_HYPERBLASTER;
                     54:        else
                     55:                effect = 0;
                     56:        AngleVectors (self->s.angles, forward, right, NULL);
                     57:        G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start);
                     58: 
                     59:        VectorCopy (self->enemy->s.origin, end);
                     60:        end[2] += self->enemy->viewheight;
                     61:        VectorSubtract (end, start, dir);
                     62: 
                     63:        monster_fire_blaster (self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect);
                     64: }
                     65: 
                     66: 
                     67: mframe_t floater_frames_stand1 [] =
                     68: {
                     69:        ai_stand, 0, NULL,
                     70:        ai_stand, 0, NULL,
                     71:        ai_stand, 0, NULL,
                     72:        ai_stand, 0, NULL,
                     73:        ai_stand, 0, NULL,
                     74:        ai_stand, 0, NULL,
                     75:        ai_stand, 0, NULL,
                     76:        ai_stand, 0, NULL,
                     77:        ai_stand, 0, NULL,
                     78:        ai_stand, 0, NULL,
                     79:        ai_stand, 0, NULL,
                     80:        ai_stand, 0, NULL,
                     81:        ai_stand, 0, NULL,
                     82:        ai_stand, 0, NULL,
                     83:        ai_stand, 0, NULL,
                     84:        ai_stand, 0, NULL,
                     85:        ai_stand, 0, NULL,
                     86:        ai_stand, 0, NULL,
                     87:        ai_stand, 0, NULL,
                     88:        ai_stand, 0, NULL,
                     89:        ai_stand, 0, NULL,
                     90:        ai_stand, 0, NULL,
                     91:        ai_stand, 0, NULL,
                     92:        ai_stand, 0, NULL,
                     93:        ai_stand, 0, NULL,
                     94:        ai_stand, 0, NULL,
                     95:        ai_stand, 0, NULL,
                     96:        ai_stand, 0, NULL,
                     97:        ai_stand, 0, NULL,
                     98:        ai_stand, 0, NULL,
                     99:        ai_stand, 0, NULL,
                    100:        ai_stand, 0, NULL,
                    101:        ai_stand, 0, NULL,
                    102:        ai_stand, 0, NULL,
                    103:        ai_stand, 0, NULL,
                    104:        ai_stand, 0, NULL,
                    105:        ai_stand, 0, NULL,
                    106:        ai_stand, 0, NULL,
                    107:        ai_stand, 0, NULL,
                    108:        ai_stand, 0, NULL,
                    109:        ai_stand, 0, NULL,
                    110:        ai_stand, 0, NULL,
                    111:        ai_stand, 0, NULL,
                    112:        ai_stand, 0, NULL,
                    113:        ai_stand, 0, NULL,
                    114:        ai_stand, 0, NULL,
                    115:        ai_stand, 0, NULL,
                    116:        ai_stand, 0, NULL,
                    117:        ai_stand, 0, NULL,
                    118:        ai_stand, 0, NULL,
                    119:        ai_stand, 0, NULL,
                    120:        ai_stand, 0, NULL
                    121: };
                    122: mmove_t        floater_move_stand1 = {FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL};
                    123: 
                    124: mframe_t floater_frames_stand2 [] =
                    125: {
                    126:        ai_stand, 0, NULL,
                    127:        ai_stand, 0, NULL,
                    128:        ai_stand, 0, NULL,
                    129:        ai_stand, 0, NULL,
                    130:        ai_stand, 0, NULL,
                    131:        ai_stand, 0, NULL,
                    132:        ai_stand, 0, NULL,
                    133:        ai_stand, 0, NULL,
                    134:        ai_stand, 0, NULL,
                    135:        ai_stand, 0, NULL,
                    136:        ai_stand, 0, NULL,
                    137:        ai_stand, 0, NULL,
                    138:        ai_stand, 0, NULL,
                    139:        ai_stand, 0, NULL,
                    140:        ai_stand, 0, NULL,
                    141:        ai_stand, 0, NULL,
                    142:        ai_stand, 0, NULL,
                    143:        ai_stand, 0, NULL,
                    144:        ai_stand, 0, NULL,
                    145:        ai_stand, 0, NULL,
                    146:        ai_stand, 0, NULL,
                    147:        ai_stand, 0, NULL,
                    148:        ai_stand, 0, NULL,
                    149:        ai_stand, 0, NULL,
                    150:        ai_stand, 0, NULL,
                    151:        ai_stand, 0, NULL,
                    152:        ai_stand, 0, NULL,
                    153:        ai_stand, 0, NULL,
                    154:        ai_stand, 0, NULL,
                    155:        ai_stand, 0, NULL,
                    156:        ai_stand, 0, NULL,
                    157:        ai_stand, 0, NULL,
                    158:        ai_stand, 0, NULL,
                    159:        ai_stand, 0, NULL,
                    160:        ai_stand, 0, NULL,
                    161:        ai_stand, 0, NULL,
                    162:        ai_stand, 0, NULL,
                    163:        ai_stand, 0, NULL,
                    164:        ai_stand, 0, NULL,
                    165:        ai_stand, 0, NULL,
                    166:        ai_stand, 0, NULL,
                    167:        ai_stand, 0, NULL,
                    168:        ai_stand, 0, NULL,
                    169:        ai_stand, 0, NULL,
                    170:        ai_stand, 0, NULL,
                    171:        ai_stand, 0, NULL,
                    172:        ai_stand, 0, NULL,
                    173:        ai_stand, 0, NULL,
                    174:        ai_stand, 0, NULL,
                    175:        ai_stand, 0, NULL,
                    176:        ai_stand, 0, NULL,
                    177:        ai_stand, 0, NULL
                    178: };
                    179: mmove_t        floater_move_stand2 = {FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL};
                    180: 
                    181: void floater_stand (edict_t *self)
                    182: {
                    183:        if (random() <= 0.5)            
                    184:                self->monsterinfo.currentmove = &floater_move_stand1;
                    185:        else
                    186:                self->monsterinfo.currentmove = &floater_move_stand2;
                    187: }
                    188: 
                    189: mframe_t floater_frames_activate [] =
                    190: {
                    191:        ai_move,        0,      NULL,   
                    192:        ai_move,        0,      NULL,   
                    193:        ai_move,        0,      NULL,   
                    194:        ai_move,        0,      NULL,   
                    195:        ai_move,        0,      NULL,   
                    196:        ai_move,        0,      NULL,   
                    197:        ai_move,        0,      NULL,   
                    198:        ai_move,        0,      NULL,   
                    199:        ai_move,        0,      NULL,   
                    200:        ai_move,        0,      NULL,   
                    201:        ai_move,        0,      NULL,   
                    202:        ai_move,        0,      NULL,   
                    203:        ai_move,        0,      NULL,   
                    204:        ai_move,        0,      NULL,   
                    205:        ai_move,        0,      NULL,   
                    206:        ai_move,        0,      NULL,   
                    207:        ai_move,        0,      NULL,   
                    208:        ai_move,        0,      NULL,   
                    209:        ai_move,        0,      NULL,   
                    210:        ai_move,        0,      NULL,   
                    211:        ai_move,        0,      NULL,   
                    212:        ai_move,        0,      NULL,   
                    213:        ai_move,        0,      NULL,   
                    214:        ai_move,        0,      NULL,   
                    215:        ai_move,        0,      NULL,   
                    216:        ai_move,        0,      NULL,   
                    217:        ai_move,        0,      NULL,   
                    218:        ai_move,        0,      NULL,   
                    219:        ai_move,        0,      NULL,   
                    220:        ai_move,        0,      NULL
                    221: };
                    222: mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL};
                    223: 
                    224: mframe_t floater_frames_attack1 [] =
                    225: {
                    226:        ai_charge,      0,      NULL,                   // Blaster attack
                    227:        ai_charge,      0,      NULL,
                    228:        ai_charge,      0,      NULL,
                    229:        ai_charge,      0,      floater_fire_blaster,                   // BOOM (0, -25.8, 32.5)        -- LOOP Starts
                    230:        ai_charge,      0,      floater_fire_blaster,
                    231:        ai_charge,      0,      floater_fire_blaster,
                    232:        ai_charge,      0,      floater_fire_blaster,
                    233:        ai_charge,      0,      floater_fire_blaster,
                    234:        ai_charge,      0,      floater_fire_blaster,
                    235:        ai_charge,      0,      floater_fire_blaster,
                    236:        ai_charge,      0,      NULL,
                    237:        ai_charge,      0,      NULL,
                    238:        ai_charge,      0,      NULL,
                    239:        ai_charge,      0,      NULL                    //                                                      -- LOOP Ends
                    240: };
                    241: mmove_t floater_move_attack1 = {FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run};
                    242: 
                    243: // PMM - circle strafe frames
                    244: mframe_t floater_frames_attack1a [] =
                    245: {
                    246:        ai_charge,      10,     NULL,                   // Blaster attack
                    247:        ai_charge,      10,     NULL,
                    248:        ai_charge,      10,     NULL,
                    249:        ai_charge,      10,     floater_fire_blaster,                   // BOOM (0, -25.8, 32.5)        -- LOOP Starts
                    250:        ai_charge,      10,     floater_fire_blaster,
                    251:        ai_charge,      10,     floater_fire_blaster,
                    252:        ai_charge,      10,     floater_fire_blaster,
                    253:        ai_charge,      10,     floater_fire_blaster,
                    254:        ai_charge,      10,     floater_fire_blaster,
                    255:        ai_charge,      10,     floater_fire_blaster,
                    256:        ai_charge,      10,     NULL,
                    257:        ai_charge,      10,     NULL,
                    258:        ai_charge,      10,     NULL,
                    259:        ai_charge,      10,     NULL                    //                                                      -- LOOP Ends
                    260: };
                    261: mmove_t floater_move_attack1a = {FRAME_attak101, FRAME_attak114, floater_frames_attack1a, floater_run};
                    262: //pmm
                    263: mframe_t floater_frames_attack2 [] =
                    264: {
                    265:        ai_charge,      0,      NULL,                   // Claws
                    266:        ai_charge,      0,      NULL,
                    267:        ai_charge,      0,      NULL,
                    268:        ai_charge,      0,      NULL,
                    269:        ai_charge,      0,      NULL,
                    270:        ai_charge,      0,      NULL,
                    271:        ai_charge,      0,      NULL,
                    272:        ai_charge,      0,      NULL,
                    273:        ai_charge,      0,      NULL,
                    274:        ai_charge,      0,      NULL,
                    275:        ai_charge,      0,      NULL,
                    276:        ai_charge,      0,      floater_wham,                   // WHAM (0, -45, 29.6)          -- LOOP Starts
                    277:        ai_charge,      0,      NULL,
                    278:        ai_charge,      0,      NULL,
                    279:        ai_charge,      0,      NULL,
                    280:        ai_charge,      0,      NULL,
                    281:        ai_charge,      0,      NULL,
                    282:        ai_charge,      0,      NULL,
                    283:        ai_charge,      0,      NULL,                   //                                                      -- LOOP Ends
                    284:        ai_charge,      0,      NULL,
                    285:        ai_charge,      0,      NULL,
                    286:        ai_charge,      0,      NULL,
                    287:        ai_charge,      0,      NULL,
                    288:        ai_charge,      0,      NULL,
                    289:        ai_charge,      0,      NULL
                    290: };
                    291: mmove_t floater_move_attack2 = {FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run};
                    292: 
                    293: mframe_t floater_frames_attack3 [] =
                    294: {
                    295:        ai_charge,      0,      NULL,
                    296:        ai_charge,      0,      NULL,
                    297:        ai_charge,      0,      NULL,
                    298:        ai_charge,      0,      NULL,
                    299:        ai_charge,      0,      NULL,
                    300:        ai_charge,      0,      NULL,
                    301:        ai_charge,      0,      NULL,
                    302:        ai_charge,      0,      NULL,
                    303:        ai_charge,      0,      floater_zap,            //                                                              -- LOOP Starts
                    304:        ai_charge,      0,      NULL,
                    305:        ai_charge,      0,      NULL,
                    306:        ai_charge,      0,      NULL,
                    307:        ai_charge,      0,      NULL,
                    308:        ai_charge,      0,      NULL,
                    309:        ai_charge,      0,      NULL,
                    310:        ai_charge,      0,      NULL,
                    311:        ai_charge,      0,      NULL,
                    312:        ai_charge,      0,      NULL,
                    313:        ai_charge,      0,      NULL,
                    314:        ai_charge,      0,      NULL,
                    315:        ai_charge,      0,      NULL,
                    316:        ai_charge,      0,      NULL,
                    317:        ai_charge,      0,      NULL,
                    318:        ai_charge,      0,      NULL,
                    319:        ai_charge,      0,      NULL,
                    320:        ai_charge,      0,      NULL,
                    321:        ai_charge,      0,      NULL,
                    322:        ai_charge,      0,      NULL,
                    323:        ai_charge,      0,      NULL,           //                                                              -- LOOP Ends
                    324:        ai_charge,      0,      NULL,
                    325:        ai_charge,      0,      NULL,
                    326:        ai_charge,      0,      NULL,
                    327:        ai_charge,      0,      NULL,
                    328:        ai_charge,      0,      NULL
                    329: };
                    330: mmove_t floater_move_attack3 = {FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run};
                    331: 
                    332: mframe_t floater_frames_death [] =
                    333: {
                    334:        ai_move,        0,      NULL,
                    335:        ai_move,        0,      NULL,
                    336:        ai_move,        0,      NULL,
                    337:        ai_move,        0,      NULL,
                    338:        ai_move,        0,      NULL,
                    339:        ai_move,        0,      NULL,
                    340:        ai_move,        0,      NULL,
                    341:        ai_move,        0,      NULL,
                    342:        ai_move,        0,      NULL,
                    343:        ai_move,        0,      NULL,
                    344:        ai_move,        0,      NULL,
                    345:        ai_move,        0,      NULL,
                    346:        ai_move,        0,      NULL
                    347: };
                    348: mmove_t floater_move_death = {FRAME_death01, FRAME_death13, floater_frames_death, floater_dead};
                    349: 
                    350: mframe_t floater_frames_pain1 [] =
                    351: {
                    352:        ai_move,        0,      NULL,
                    353:        ai_move,        0,      NULL,
                    354:        ai_move,        0,      NULL,
                    355:        ai_move,        0,      NULL,
                    356:        ai_move,        0,      NULL,
                    357:        ai_move,        0,      NULL,
                    358:        ai_move,        0,      NULL
                    359: };
                    360: mmove_t floater_move_pain1 = {FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run};
                    361: 
                    362: mframe_t floater_frames_pain2 [] =
                    363: {
                    364:        ai_move,        0,      NULL,
                    365:        ai_move,        0,      NULL,
                    366:        ai_move,        0,      NULL,
                    367:        ai_move,        0,      NULL,
                    368:        ai_move,        0,      NULL,
                    369:        ai_move,        0,      NULL,
                    370:        ai_move,        0,      NULL,
                    371:        ai_move,        0,      NULL
                    372: };
                    373: mmove_t floater_move_pain2 = {FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run};
                    374: 
                    375: mframe_t floater_frames_pain3 [] =
                    376: {
                    377:        ai_move,        0,      NULL,
                    378:        ai_move,        0,      NULL,
                    379:        ai_move,        0,      NULL,
                    380:        ai_move,        0,      NULL,
                    381:        ai_move,        0,      NULL,
                    382:        ai_move,        0,      NULL,
                    383:        ai_move,        0,      NULL,
                    384:        ai_move,        0,      NULL,
                    385:        ai_move,        0,      NULL,
                    386:        ai_move,        0,      NULL,
                    387:        ai_move,        0,      NULL,
                    388:        ai_move,        0,      NULL
                    389: };
                    390: mmove_t floater_move_pain3 = {FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run};
                    391: 
                    392: mframe_t floater_frames_walk [] =
                    393: {
                    394:        ai_walk, 5, NULL,
                    395:        ai_walk, 5, NULL,
                    396:        ai_walk, 5, NULL,
                    397:        ai_walk, 5, NULL,
                    398:        ai_walk, 5, NULL,
                    399:        ai_walk, 5, NULL,
                    400:        ai_walk, 5, NULL,
                    401:        ai_walk, 5, NULL,
                    402:        ai_walk, 5, NULL,
                    403:        ai_walk, 5, NULL,
                    404:        ai_walk, 5, NULL,
                    405:        ai_walk, 5, NULL,
                    406:        ai_walk, 5, NULL,
                    407:        ai_walk, 5, NULL,
                    408:        ai_walk, 5, NULL,
                    409:        ai_walk, 5, NULL,
                    410:        ai_walk, 5, NULL,
                    411:        ai_walk, 5, NULL,
                    412:        ai_walk, 5, NULL,
                    413:        ai_walk, 5, NULL,
                    414:        ai_walk, 5, NULL,
                    415:        ai_walk, 5, NULL,
                    416:        ai_walk, 5, NULL,
                    417:        ai_walk, 5, NULL,
                    418:        ai_walk, 5, NULL,
                    419:        ai_walk, 5, NULL,
                    420:        ai_walk, 5, NULL,
                    421:        ai_walk, 5, NULL,
                    422:        ai_walk, 5, NULL,
                    423:        ai_walk, 5, NULL,
                    424:        ai_walk, 5, NULL,
                    425:        ai_walk, 5, NULL,
                    426:        ai_walk, 5, NULL,
                    427:        ai_walk, 5, NULL,
                    428:        ai_walk, 5, NULL,
                    429:        ai_walk, 5, NULL,
                    430:        ai_walk, 5, NULL,
                    431:        ai_walk, 5, NULL,
                    432:        ai_walk, 5, NULL,
                    433:        ai_walk, 5, NULL,
                    434:        ai_walk, 5, NULL,
                    435:        ai_walk, 5, NULL,
                    436:        ai_walk, 5, NULL,
                    437:        ai_walk, 5, NULL,
                    438:        ai_walk, 5, NULL,
                    439:        ai_walk, 5, NULL,
                    440:        ai_walk, 5, NULL,
                    441:        ai_walk, 5, NULL,
                    442:        ai_walk, 5, NULL,
                    443:        ai_walk, 5, NULL,
                    444:        ai_walk, 5, NULL,
                    445:        ai_walk, 5, NULL
                    446: };
                    447: mmove_t        floater_move_walk = {FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL};
                    448: 
                    449: mframe_t floater_frames_run [] =
                    450: {
                    451:        ai_run, 13, NULL,
                    452:        ai_run, 13, NULL,
                    453:        ai_run, 13, NULL,
                    454:        ai_run, 13, NULL,
                    455:        ai_run, 13, NULL,
                    456:        ai_run, 13, NULL,
                    457:        ai_run, 13, NULL,
                    458:        ai_run, 13, NULL,
                    459:        ai_run, 13, NULL,
                    460:        ai_run, 13, NULL,
                    461:        ai_run, 13, NULL,
                    462:        ai_run, 13, NULL,
                    463:        ai_run, 13, NULL,
                    464:        ai_run, 13, NULL,
                    465:        ai_run, 13, NULL,
                    466:        ai_run, 13, NULL,
                    467:        ai_run, 13, NULL,
                    468:        ai_run, 13, NULL,
                    469:        ai_run, 13, NULL,
                    470:        ai_run, 13, NULL,
                    471:        ai_run, 13, NULL,
                    472:        ai_run, 13, NULL,
                    473:        ai_run, 13, NULL,
                    474:        ai_run, 13, NULL,
                    475:        ai_run, 13, NULL,
                    476:        ai_run, 13, NULL,
                    477:        ai_run, 13, NULL,
                    478:        ai_run, 13, NULL,
                    479:        ai_run, 13, NULL,
                    480:        ai_run, 13, NULL,
                    481:        ai_run, 13, NULL,
                    482:        ai_run, 13, NULL,
                    483:        ai_run, 13, NULL,
                    484:        ai_run, 13, NULL,
                    485:        ai_run, 13, NULL,
                    486:        ai_run, 13, NULL,
                    487:        ai_run, 13, NULL,
                    488:        ai_run, 13, NULL,
                    489:        ai_run, 13, NULL,
                    490:        ai_run, 13, NULL,
                    491:        ai_run, 13, NULL,
                    492:        ai_run, 13, NULL,
                    493:        ai_run, 13, NULL,
                    494:        ai_run, 13, NULL,
                    495:        ai_run, 13, NULL,
                    496:        ai_run, 13, NULL,
                    497:        ai_run, 13, NULL,
                    498:        ai_run, 13, NULL,
                    499:        ai_run, 13, NULL,
                    500:        ai_run, 13, NULL,
                    501:        ai_run, 13, NULL,
                    502:        ai_run, 13, NULL
                    503: };
                    504: mmove_t        floater_move_run = {FRAME_stand101, FRAME_stand152, floater_frames_run, NULL};
                    505: 
                    506: void floater_run (edict_t *self)
                    507: {
                    508:        if (self->monsterinfo.aiflags & AI_STAND_GROUND)
                    509:                self->monsterinfo.currentmove = &floater_move_stand1;
                    510:        else
                    511:                self->monsterinfo.currentmove = &floater_move_run;
                    512: }
                    513: 
                    514: void floater_walk (edict_t *self)
                    515: {
                    516:        self->monsterinfo.currentmove = &floater_move_walk;
                    517: }
                    518: 
                    519: void floater_wham (edict_t *self)
                    520: {
                    521:        static  vec3_t  aim = {MELEE_DISTANCE, 0, 0};
                    522:        gi.sound (self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
                    523:        fire_hit (self, aim, 5 + rand() % 6, -50);
                    524: }
                    525: 
                    526: void floater_zap (edict_t *self)
                    527: {
                    528:        vec3_t  forward, right;
                    529:        vec3_t  origin;
                    530:        vec3_t  dir;
                    531:        vec3_t  offset;
                    532: 
                    533:        VectorSubtract (self->enemy->s.origin, self->s.origin, dir);
                    534: 
                    535:        AngleVectors (self->s.angles, forward, right, NULL);
                    536:        //FIXME use a flash and replace these two lines with the commented one
                    537:        VectorSet (offset, 18.5, -0.9, 10);
                    538:        G_ProjectSource (self->s.origin, offset, forward, right, origin);
                    539: //     G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, origin);
                    540: 
                    541:        gi.sound (self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);
                    542: 
                    543:        //FIXME use the flash, Luke
                    544:        gi.WriteByte (svc_temp_entity);
                    545:        gi.WriteByte (TE_SPLASH);
                    546:        gi.WriteByte (32);
                    547:        gi.WritePosition (origin);
                    548:        gi.WriteDir (dir);
                    549:        gi.WriteByte (1);       //sparks
                    550:        gi.multicast (origin, MULTICAST_PVS);
                    551: 
                    552:        T_Damage (self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
                    553: }
                    554: 
                    555: void floater_attack(edict_t *self)
                    556: {
                    557:        float chance;
                    558: /*     if (random() <= 0.5)    
                    559:                self->monsterinfo.currentmove = &flyer_move_attack1;
                    560:        else */
                    561:        // 0% chance of circle in easy
                    562:        // 50% chance in normal
                    563:        // 75% chance in hard
                    564:        // 86.67% chance in nightmare
                    565:        if (!skill->value)
                    566:                chance = 0;
                    567:        else
                    568:                chance = 1.0 - (0.5/(float)(skill->value));
                    569: 
                    570:        if (random() > chance)
                    571:        {
                    572:                self->monsterinfo.attack_state = AS_STRAIGHT;
                    573:                self->monsterinfo.currentmove = &floater_move_attack1;
                    574:        }
                    575:        else // circle strafe
                    576:        {
                    577:                if (random () <= 0.5) // switch directions
                    578:                        self->monsterinfo.lefty = 1 - self->monsterinfo.lefty;
                    579:                self->monsterinfo.attack_state = AS_SLIDING;
                    580:                self->monsterinfo.currentmove = &floater_move_attack1a;
                    581:        }
                    582: }
                    583: 
                    584: 
                    585: void floater_melee(edict_t *self)
                    586: {
                    587:        if (random() < 0.5)             
                    588:                self->monsterinfo.currentmove = &floater_move_attack3;
                    589:        else
                    590:                self->monsterinfo.currentmove = &floater_move_attack2;
                    591: }
                    592: 
                    593: 
                    594: void floater_pain (edict_t *self, edict_t *other, float kick, int damage)
                    595: {
                    596:        int             n;
                    597: 
                    598:        if (self->health < (self->max_health / 2))
                    599:                self->s.skinnum = 1;
                    600: 
                    601:        if (level.time < self->pain_debounce_time)
                    602:                return;
                    603: 
                    604:        self->pain_debounce_time = level.time + 3;
                    605:        if (skill->value == 3)
                    606:                return;         // no pain anims in nightmare
                    607: 
                    608:        n = (rand() + 1) % 3;
                    609:        if (n == 0)
                    610:        {
                    611:                gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
                    612:                self->monsterinfo.currentmove = &floater_move_pain1;
                    613:        }
                    614:        else
                    615:        {
                    616:                gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
                    617:                self->monsterinfo.currentmove = &floater_move_pain2;
                    618:        }
                    619: }
                    620: 
                    621: void floater_dead (edict_t *self)
                    622: {
                    623:        VectorSet (self->mins, -16, -16, -24);
                    624:        VectorSet (self->maxs, 16, 16, -8);
                    625:        self->movetype = MOVETYPE_TOSS;
                    626:        self->svflags |= SVF_DEADMONSTER;
                    627:        self->nextthink = 0;
                    628:        gi.linkentity (self);
                    629: }
                    630: 
                    631: void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
                    632: {
                    633:        gi.sound (self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
                    634:        BecomeExplosion1(self);
                    635: }
                    636: 
                    637: //===========
                    638: //PGM
                    639: qboolean floater_blocked (edict_t *self, float dist)
                    640: {
                    641:        if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) ))
                    642:                return true;
                    643: 
                    644:        return false;
                    645: }
                    646: //PGM
                    647: //===========
                    648: 
                    649: /*QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
                    650: */
                    651: void SP_monster_floater (edict_t *self)
                    652: {
                    653:        if (deathmatch->value)
                    654:        {
                    655:                G_FreeEdict (self);
                    656:                return;
                    657:        }
                    658: 
                    659:        sound_attack2 = gi.soundindex ("floater/fltatck2.wav");
                    660:        sound_attack3 = gi.soundindex ("floater/fltatck3.wav");
                    661:        sound_death1 = gi.soundindex ("floater/fltdeth1.wav");
                    662:        sound_idle = gi.soundindex ("floater/fltidle1.wav");
                    663:        sound_pain1 = gi.soundindex ("floater/fltpain1.wav");
                    664:        sound_pain2 = gi.soundindex ("floater/fltpain2.wav");
                    665:        sound_sight = gi.soundindex ("floater/fltsght1.wav");
                    666: 
                    667:        gi.soundindex ("floater/fltatck1.wav");
                    668: 
                    669:        self->s.sound = gi.soundindex ("floater/fltsrch1.wav");
                    670: 
                    671:        self->movetype = MOVETYPE_STEP;
                    672:        self->solid = SOLID_BBOX;
                    673:        self->s.modelindex = gi.modelindex ("models/monsters/float/tris.md2");
                    674:        VectorSet (self->mins, -24, -24, -24);
                    675:        VectorSet (self->maxs, 24, 24, 32);
                    676: 
                    677:        self->health = 200;
                    678:        self->gib_health = -80;
                    679:        self->mass = 300;
                    680: 
                    681:        self->pain = floater_pain;
                    682:        self->die = floater_die;
                    683: 
                    684:        self->monsterinfo.stand = floater_stand;
                    685:        self->monsterinfo.walk = floater_walk;
                    686:        self->monsterinfo.run = floater_run;
                    687: //     self->monsterinfo.dodge = floater_dodge;
                    688:        self->monsterinfo.attack = floater_attack;
                    689:        self->monsterinfo.melee = floater_melee;
                    690:        self->monsterinfo.sight = floater_sight;
                    691:        self->monsterinfo.idle = floater_idle;
                    692:        self->monsterinfo.blocked = floater_blocked;            // PGM
                    693: 
                    694:        gi.linkentity (self);
                    695: 
                    696:        if (random() <= 0.5)            
                    697:                self->monsterinfo.currentmove = &floater_move_stand1;   
                    698:        else
                    699:                self->monsterinfo.currentmove = &floater_move_stand2;   
                    700:        
                    701:        self->monsterinfo.scale = MODEL_SCALE;
                    702: 
                    703:        flymonster_start (self);
                    704: }

unix.superglobalmegacorp.com

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