void ai_ccs_gun(Object *o) { Object *curly = o->linkedobject; if (!curly) return; o->dir = curly->dir; o->frame = curly->frame; switch(o->frame) { case 0: // horizontal/normal { if (curly->dir == RIGHT) o->x = curly->x + (8 << CSF); else o->x = curly->x - (8 << CSF); o->y = curly->y; } break; case 1: // looking up { o->x = curly->x; o->y = curly->y - (10 << CSF); } break; case 2: // looking down { o->x = curly->x; o->y = curly->y + (10 << CSF); } break; } if (pinputs[FIREKEY] != o->timer2) { o->timer2 = pinputs[FIREKEY]; if (pinputs[FIREKEY]) { if (CountObjectsOfType(OBJ_NEMESIS_SHOT_CURLY) < 2) { int shotdir = curly->dir; if (curly->frame == 1) shotdir = UP; if (curly->frame == 2) shotdir = DOWN; Object *shot = CreateObject(0, 0, OBJ_NEMESIS_SHOT_CURLY); SetupBullet(shot, curly->x, curly->y, B_CURLYS_NEMESIS, shotdir); } } } }
// fire a basic, single bullet static Object *FireSimpleBullet(int otype, int btype, int xoff, int yoff) { int x, y, dir; // get location to fire from GetPlayerShootPoint(&x, &y); x += xoff; y += yoff; // create the shot Object *shot = CreateObject(0, 0, otype); // set up the shot if (player->look) dir = player->look; else dir = player->dir; SetupBullet(shot, x, y, btype, dir); return shot; }