示例#1
0
script GRAPPLE_GETUNUSEDTID (int mode, int fromItem)
{
    int newTID = TIDSTART;

    switch (mode)
    {
    case 0:
        while (ThingCount(0, newTID) > 0)
        {
            newTID++;
        }

        if (fromItem)
        {
            GiveInventory("ItemGrappleTID", newTID);
        }
        else
        {
            GiveInventory("GrappleTIDIndicator", newTID);
        }

        Thing_ChangeTID(0, newTID);
        break;

    case 1:
        if (fromItem)
        {
            SetResultValue(CheckInventory("ItemGrappleTID"));
        }
        else
        {
            SetResultValue(CheckInventory("GrappleTIDIndicator"));
        }
        break;

    case 2:
        while (ThingCount(0, newTID) > 0)
        {
            newTID++;
        }


        if (fromItem)
        {
            GiveInventory("ItemGrappleTID", newTID);
        }
        else
        {
            GiveInventory("GrappleTIDIndicator", newTID);
        }

        Thing_ChangeTID(0, newTID);
        SetResultValue(newTID);
        break;
    }
}
示例#2
0
script GRAPPLE_DRAWLINE (int grappleTid, int playerTid, int density)
{
    int plX; int plY;  int plZ;
    int grX; int grY;  int grZ;
    int vX;  int vY;   int vZ;
    int nX;  int nY;   int nZ;
    int bX;  int bY;   int bZ;
    int magnitude;
    int pointCount;
    int pointOffset;

    if (ThingCount(0, grappleTid) != 1)
    {
        terminate;
    }

    if (ThingCount(0, playerTid) != 1)
    {
        terminate;
    }

    plX = GetActorX(playerTid); grX = GetActorX(grappleTid);
    plY = GetActorY(playerTid); grY  = GetActorY(grappleTid);
    plZ = GetActorZ(playerTid) + 2400000; grZ  = GetActorZ(grappleTid);
    vX   = grX - plX;       vY   = grY - plY;       vZ   = grZ - plZ;

    // NOTE: More precision bullshit
    magnitude = magnitudeThree(vX >> 16, vY >> 16, vZ >> 16);

    pointCount  = magnitude / density;
    pointOffset = magnitude - (pointCount * density);

    if (magnitude != 0)
    {
        nX = vX / magnitude; nY = vY / magnitude; nZ = vZ / magnitude;

        int i; int j;
        for (i = 0; i < pointCount; i++)
        {
            j = (i * density) + pointOffset;

            bX = (nX * j) + plX;
            bY = (nY * j) + plY;
            bZ = (nZ * j) + plZ;

            Spawn("GrapplePoint", bX, bY, bZ);
        }
    }

}
示例#3
0
script GRAPPLE_REEL (int grappleTid, int strength, int firetype)
{
    int nX;   int nY;   int nZ;
    int plX;  int plY;  int plZ;
    int vX;   int vY;   int vZ;
    int velX; int velY; int velZ;

    int breakLoop = false;

    int magnitude;

    int pln = PlayerNumber();
    int playerTid = ActivatorTID();

    if (playerTid == 0) // can we give him a TID without breaking anything?
    {
        playerTid = unusedTID(TIDSTART, -1);
        Thing_ChangeTID(0, playerTid);
    }

    // if not, then okay, just use the one he has already

    int grX = GetActorX(grappleTid);
    int grY = GetActorY(grappleTid);
    int grZ = GetActorZ(grappleTid);

    while (!breakLoop)
    {
        if (ThingCount(0, grappleTID) != 1)
        {
            break;
        }
        
        plX  = GetActorX(0);    plY  = GetActorY(0);    plZ  = GetActorZ(0);
        vX   = grX - plX;       vY   = grY - plY;       vZ   = grZ - plZ;

        // NOTE: I had to drop precision here in exchange for not overflowing
        magnitude = magnitudeThree(vX >> 16, vY >> 16, vZ >> 16);

        if (magnitude != 0)
        {
            nX = vX / magnitude; nY = vY / magnitude; nZ = vZ / magnitude;
            ACS_ExecuteAlways(GRAPPLE_DRAWLINE, 0, grappleTid, playerTid, 16);
        }
        else
        {
            nX = 0; nY = 0; nZ = 0;
        }

        SetActorVelocity(0, nX*strength, nY*strength, nZ*strength, true, true);

        if (CheckInventory("Grappling") == 0)
            { breakLoop = true; }

        Delay(1);
    }

    Thing_Remove(grappleTid);
}
示例#4
0
static int CmdThingCount(void)
{
    int tid;

    tid = Pop();
    ThingCount(Pop(), tid);
    return SCRIPT_CONTINUE;
}
示例#5
0
static int CmdThingCountDirect(void)
{
    int type;

    type = LONG(*PCodePtr);
    ++PCodePtr;
    ThingCount(type, LONG(*PCodePtr));
    ++PCodePtr;
    return SCRIPT_CONTINUE;
}
示例#6
0
script GRAPPLE_HOOK (int strength, int firetype)
{
    int playerInput;
    int myX; int myY; int myZ;

    int firerPln = ACS_ExecuteWithResult(GETFIRERPLN, 0,0,0);
    int projTid = PROJOFFSET+firerPln;

    while (ThingCount(0, projTid) > 0)
    {
        projTid++;
    }

    Thing_ChangeTID(0, projTid);

    SetActivatorToTarget(0);

    while (ThingCount(0, projTid) > 0)
    {
        myX = GetActorX(projTid);
        myY = GetActorY(projTid);
        myZ = GetActorZ(projTid);
        playerInput = GetPlayerInput(-1, MODINPUT_BUTTONS);

        switch (firetype)
        {
        case 0:
            if (!(GetPlayerInput(-1, MODINPUT_BUTTONS) & BT_ALTATTACK))
            {
                Thing_Remove(projTid);
                Spawn("GuaranteedTeleportFog", myX, myY, myZ-20.0);
                terminate;
            }
            break;

        case 1:
            if (!(GetPlayerInput(-1, MODINPUT_BUTTONS) & BT_ATTACK))
            {
                Thing_Remove(projTid);
                Spawn("GuaranteedTeleportFog", myX, myY, myZ-20.0);
                terminate;
            }
            break;

        case 2:
            if (CheckInventory("InventoryToggle"))
            {
                Thing_Remove(projTid);
                Spawn("GuaranteedTeleportFog", myX, myY, myZ-20.0);
                terminate;
            }
            break;
        }

        Delay(1);
    }

    Spawn("GrappleSpot", myX, myY, myZ, projTid);

    ACS_ExecuteAlways(GRAPPLE_REEL, 0, projTid, strength, firetype);
}