Exemple #1
0
 public AIAction(ConAction action, MoveAction moveAction, int val = 0, int unknown = 0)
 {
     this.action     = action;
     this.moveAction = moveAction;
     this.val        = val;
 }
Exemple #2
0
 public abstract bool ifaction(ConAction action);
Exemple #3
0
 public abstract void RegisterActor(ScriptActorRegistration.Function_t function, int picnum, int aiType, int aiType2 = 0, ConAction action = null, MoveAction unknown2 = null, int unknown3 = 0, int unknown4 = 0);
Exemple #4
0
 public abstract void SetAction(ConAction action);
Exemple #5
0
    public static void execute(int i, short p, int x)
    {
        char done;

        //g_i = (short)i;
        //g_p = p;
        //g_x = x;
        //g_sp = Engine.board.sprite[g_i];
        VMPushNewState(i, p, x);

        if (GlobalMembers.scriptActorRegPtr[g_sp.picnum] == null)
        {
            return;
        }

        //insptr = 4 + ();

        killit_flag = (char)0;

        if (g_sp.sectnum < 0 || g_sp.sectnum >= DefineConstants.MAXSECTORS)
        {
            if (badguy(g_sp) != 0)
            {
                ps[g_p].actors_killed++;
            }
            Engine.board.deletesprite(g_i);
            return;
        }
        // jmarshall: eval

        /*
         * if (g_t[4] != 0)
         * {
         *  g_sp.lotag += (DefineConstants.TICRATE / 26);
         *  if (g_sp.lotag > scriptptr.buffer[g_t[4] + 16])
         *  {
         *      hittype[g_i].actioncount++;
         *      g_sp.lotag = 0;
         *      hittype[g_i].animcounter += scriptptr.buffer[(g_t[4] + 12)];
         *  }
         *  if (pragmas.klabs(hittype[g_i].animcounter) >= pragmas.klabs(scriptptr.buffer[(g_t[4] + 4)] * scriptptr.buffer[(g_t[4] + 12)]))
         *  {
         *      hittype[g_i].animcounter = 0;
         *  }
         * }
         */

        if (hittype[g_i].action != null)
        {
            ConAction action = hittype[g_i].action;
            g_sp.lotag += (DefineConstants.TICRATE / 26);
            if (g_sp.lotag > action.delay)
            {
                g_sp.lotag = 0;
                hittype[g_i].actioncount++;
                hittype[g_i].animcounter += action.invvalue;
                if (pragmas.klabs(hittype[g_i].animcounter) >= pragmas.klabs(action.frames * action.invvalue))
                {
                    hittype[g_i].animcounter = 0;
                }
            }
        }
        // jmarshall end
        GlobalMembers.scriptActorRegPtr[g_sp.picnum].func();

        if (killit_flag == 1)
        {
            if (ps[g_p].actorsqu == g_i)
            {
                ps[g_p].actorsqu = -1;
            }
            Engine.board.deletesprite(g_i);
        }
        else
        {
            move();

            if (g_sp.statnum == 1)
            {
                if (badguy(g_sp) != 0)
                {
                    if (g_sp.xrepeat > 60)
                    {
                        return;
                    }
                    if (ud.respawn_monsters == 1 && g_sp.extra <= 0)
                    {
                        return;
                    }
                }
                else if (ud.respawn_items == 1 && (g_sp.cstat & 32768) != 0)
                {
                    return;
                }

                if (hittype[g_i].timetosleep > 1)
                {
                    hittype[g_i].timetosleep--;
                }
                else if (hittype[g_i].timetosleep == 1)
                {
                    Engine.board.changespritestat(g_i, 2);
                }
            }

            else if (g_sp.statnum == 6)
            {
                switch (g_sp.picnum)
                {
                case DefineConstants.RUBBERCAN:
                case DefineConstants.EXPLODINGBARREL:
                case DefineConstants.WOODENHORSE:
                case DefineConstants.HORSEONSIDE:
                case DefineConstants.CANWITHSOMETHING:
                case DefineConstants.FIREBARREL:
                case DefineConstants.NUKEBARREL:
                case DefineConstants.NUKEBARRELDENTED:
                case DefineConstants.NUKEBARRELLEAKED:
                case DefineConstants.TRIPBOMB:
                case DefineConstants.EGG:
                    if (hittype[g_i].timetosleep > 1)
                    {
                        hittype[g_i].timetosleep--;
                    }
                    else if (hittype[g_i].timetosleep == 1)
                    {
                        Engine.board.changespritestat(g_i, 2);
                    }
                    break;
                }
            }
        }
    }