コード例 #1
0
tr1::shared_ptr<BulletActor> Enemy::setBullet(const Barrage& br, const Vector* ofs, float xr) {
    if (br.rank <= 0) {
        tr1::shared_ptr<BulletActor> null;
        return null;
    }
    BulletMLRunner* runner = BulletMLRunner_new_parser(br.parser);
    BulletActorPool::registFunctions(runner);
    tr1::shared_ptr<BulletActor> ba;
    float bx = pos.x;
    float by = pos.y;
    if (ofs) {
        bx += ofs->x;
        by += ofs->y;
    }
    if (br.morphCnt > 0)
        ba = bullets->addBullet
            (br.parser, runner,
             bx, by, baseDeg, 0, br.rank,
             br.speedRank,
             br.shape, br.color, br.bulletSize,
             br.xReverse * xr,
             br.morphParser, br.morphNum, br.morphCnt);
    else
        ba = bullets->addBullet
            (br.parser, runner,
             bx, by, baseDeg, 0, br.rank,
             br.speedRank,
             br.shape, br.color, br.bulletSize,
             br.xReverse * xr);
    return ba;
}
コード例 #2
0
void BulletActorPool::addBullet(float deg, float speed) {
    tr1::shared_ptr<BulletActor> ba = 
        tr1::dynamic_pointer_cast<BulletActor>(getInstance());
    if (!ba)
        return;
    P47Bullet* rb = 
        dynamic_cast<P47Bullet*>(Bullet::now);
    if (rb->isMorph) {
        BulletMLRunner* runner = BulletMLRunner_new_parser(rb->morphParser[rb->morphIdx]);
        BulletActorPool::registFunctions(runner);
        ba->set(runner, Bullet::now->pos.x, Bullet::now->pos.y, deg, speed,
                Bullet::now->rank, 
                rb->speedRank, rb->shape, rb->color, rb->bulletSize, rb->xReverse,
                rb->morphParser, rb->morphNum, rb->morphIdx + 1, rb->morphCnt - 1);
    } else {
        ba->set(Bullet::now->pos.x, Bullet::now->pos.y, deg, speed, 
                Bullet::now->rank,
                rb->speedRank, rb->shape, rb->color, rb->bulletSize, rb->xReverse);
    }
}
コード例 #3
0
void Enemy::set(const Vector& p, float d, tr1::shared_ptr<EnemyType> type,
                BulletMLParser* moveParser) {
    pos.x = p.x;
    pos.y = p.y;
    this->type = type;
    BulletMLRunner* moveRunner = BulletMLRunner_new_parser(moveParser);
    BulletActorPool::registFunctions(moveRunner);
    moveBullet = bullets->addBullet(moveRunner, pos.x, pos.y, d, 
                                    0, 0.5, 1, 0, 0, 1, 1);
    if (!moveBullet)
        return;
    cnt = 0;
    shield = type->shield;
    for (int i = 0; i < type->batteryNum; ++i) {
        battery[i].shield = type->batteryType[i].shield;
    }
    fireCnt = 0; barragePatternIdx = 0;
    baseDeg = d;
    appCnt = dstCnt = timeoutCnt = 0;
    z = 0;
    isBoss = false;
    isExist = true;
}