Ejemplo n.º 1
0
void SetIscriptAnimation(Image *img, uint8_t anim)
{
    if (*bw::active_iscript_unit != nullptr)
        (*bw::active_iscript_unit)->SetIscriptAnimationForImage(img, anim);
    else
    {
        // This is unable to handle any unit-specific commands
        SimpleIscriptContext ctx(MainRng());
        img->SetIscriptAnimation(&ctx, anim);
    }
}
Ejemplo n.º 2
0
void __stdcall SetIscriptAnimation(int anim)
{
    REG_ECX(Image *, img);
    anim &= 0xff;
    if (*bw::active_iscript_unit != nullptr)
        (*bw::active_iscript_unit)->SetIscriptAnimationForImage(img, anim);
    else
    {
        // This is unable to handle any unit-specific commands
        SimpleIscriptContext ctx(MainRng());
        img->SetIscriptAnimation(&ctx, anim);
    }
}
Ejemplo n.º 3
0
static void ProgressIscriptFrame_Hook(Image *image, Iscript::Script *script, int test_run, uint32_t *out_speed)
{
    // Shouldn't be hooked from elsewhere
    Assert(*bw::active_iscript_unit != nullptr);
    if (test_run)
    {
        Assert(out_speed != nullptr);
        MovementIscriptContext ctx(*bw::active_iscript_unit, out_speed, MainRng());
        script->ProgressFrame(&ctx, image);
    }
    else
    {
        // What to do? Could try determining if we are using unit, bullet, sprite or what,
        // but this shouldn't be called anyways
        Warning("ProgressIscriptFrame hooked");
    }
}
Ejemplo n.º 4
0
void Unit::Order_NukeTrack()
{
    if (order_state == 0)
    {
        SetIscriptAnimation(Iscript::Animation::Special1, true, "Order_NukeTrack state 0", nullptr);
        ghost.nukedot = lone_sprites->AllocateLone(SpriteId::NukeDot, related->order_target_pos, player);
        ghost.nukedot->elevation = sprite->elevation + 1;
        ghost.nukedot->UpdateVisibilityPoint();
        order_state = 6;
    }
    else if (order_state == 6)
    {
        if (related && related->order_state != 5)
            return;
        if (order_queue_begin == nullptr)
            AppendOrderTargetingNothing(Type().ReturnToIdleOrder());
        bw::DoNextQueuedOrderIfAble(this);
        SetButtons(unit_id);
        SetIscriptAnimation(Iscript::Animation::Idle, true, "Order_NukeTrack state 6", nullptr);
        ghost.nukedot->SetIscriptAnimation_Lone(Iscript::Animation::Death, true, MainRng(), "Unit::Order_NukeTrack");
        ghost.nukedot = nullptr;
        bw::Ai_ReturnToNearestBaseForced(this);
    }
}