Esempio n. 1
0
void update_god_lightning_ball(struct Thing *thing)
{
    struct CreatureControl *cctrl;
    struct Thing *target;
    struct ShotConfigStats *shotst;
    long i;
//    _DK_update_god_lightning_ball(thing);
    if (thing->health <= 0)
    {
        lightning_modify_palette(thing);
        return;
    }
    i = (game.play_gameturn - thing->creation_turn) % 16;
    switch (i)
    {
    case 0:
        god_lightning_choose_next_creature(thing);
        break;
    case 1:
        target = thing_get(thing->shot.target_idx);
        if (thing_is_invalid(target))
            break;
        draw_lightning(&thing->mappos,&target->mappos, 96, 60);
        break;
    case 2:
        target = thing_get(thing->shot.target_idx);
        if (thing_is_invalid(target))
            break;
        shotst = get_shot_model_stats(24);
        apply_damage_to_thing_and_display_health(target, shotst->old->damage, shotst->damage_type, thing->owner);
        if (target->health < 0)
        {
            cctrl = creature_control_get_from_thing(target);
            cctrl->shot_model = ShM_GodLightBall;
            kill_creature(target, INVALID_THING, thing->owner, CrDed_DiedInBattle);
        }
        thing->shot.target_idx = 0;
        break;
    }
}
Esempio n. 2
0
void draw_god_lightning(struct Thing *shotng)
{
    //_DK_draw_god_lightning(shotng); return;
    struct PlayerInfo *player;
    player = get_player(shotng->owner);
    const struct Camera *cam;
    cam = player->acamera;
    if (cam == NULL) {
        return;
    }
    int i;
    for (i = LbFPMath_PI/4; i < 2*LbFPMath_PI; i += LbFPMath_PI/2)
    {
        struct Coord3d locpos;
        locpos.x.val = shotng->mappos.x.val;
        locpos.y.val = shotng->mappos.y.val;
        locpos.z.val = shotng->mappos.z.val;
        locpos.x.val +=  (LbSinL(i + cam->orient_a) >> (LbFPMath_TrigmBits - 10));
        locpos.y.val += -(LbCosL(i + cam->orient_a) >> (LbFPMath_TrigmBits - 10));
        locpos.z.val = subtile_coord(12,0);
        draw_lightning(&locpos, &shotng->mappos, 256, 60);
    }
}