2015-05-19 21:54:34 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-10-09 16:09:05 +00:00
|
|
|
#include "ns.h"
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "tags.h"
|
|
|
|
#include "ai.h"
|
|
|
|
#include "sprite.h"
|
2020-08-05 22:18:45 +00:00
|
|
|
#include "misc.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "weapon.h"
|
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
BEGIN_SW_NS
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
ANIMATOR InitCoolieCharge;
|
|
|
|
|
|
|
|
DECISION CoolieBattle[] =
|
|
|
|
{
|
|
|
|
{700, InitCoolieCharge },
|
|
|
|
{990, InitActorMoveCloser },
|
|
|
|
{1000, InitActorAttackNoise },
|
|
|
|
{1024, InitActorRunAway }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieOffense[] =
|
|
|
|
{
|
|
|
|
{700, InitCoolieCharge },
|
|
|
|
{1015, InitActorMoveCloser },
|
|
|
|
{1024, InitActorAttackNoise }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieBroadcast[] =
|
|
|
|
{
|
|
|
|
//{1, InitActorAlertNoise },
|
|
|
|
{16, InitActorAmbientNoise },
|
|
|
|
{1024, InitActorDecide }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieSurprised[] =
|
|
|
|
{
|
|
|
|
{700, InitActorMoveCloser },
|
|
|
|
{703, InitActorAmbientNoise },
|
|
|
|
{1024, InitActorDecide }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieEvasive[] =
|
|
|
|
{
|
|
|
|
{10, InitActorEvade },
|
2021-07-10 12:25:18 +00:00
|
|
|
{1024, nullptr }
|
2015-05-19 21:54:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieLostTarget[] =
|
|
|
|
{
|
|
|
|
{900, InitActorFindPlayer },
|
|
|
|
{1024, InitActorWanderAround }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION CoolieCloseRange[] =
|
|
|
|
{
|
|
|
|
{400, InitCoolieCharge },
|
|
|
|
{1024, InitActorReposition }
|
|
|
|
};
|
|
|
|
|
|
|
|
PERSONALITY CooliePersonality =
|
|
|
|
{
|
|
|
|
CoolieBattle,
|
|
|
|
CoolieOffense,
|
|
|
|
CoolieBroadcast,
|
|
|
|
CoolieSurprised,
|
|
|
|
CoolieEvasive,
|
|
|
|
CoolieLostTarget,
|
|
|
|
CoolieCloseRange,
|
|
|
|
CoolieCloseRange
|
|
|
|
};
|
|
|
|
|
|
|
|
ATTRIBUTE CoolieAttrib =
|
|
|
|
{
|
|
|
|
{60, 80, 100, 200}, // Speeds
|
|
|
|
{3, 0, -2, -3}, // Tic Adjusts
|
|
|
|
3, // MaxWeapons;
|
|
|
|
{
|
|
|
|
DIGI_COOLIEAMBIENT, DIGI_COOLIEALERT, DIGI_COOLIEALERT,
|
|
|
|
DIGI_COOLIEPAIN, 0, DIGI_CGMATERIALIZE,
|
|
|
|
DIGI_COOLIEEXPLODE,0,0,0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// COOLIE RUN
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define COOLIE_RATE 12
|
|
|
|
|
|
|
|
ANIMATOR DoCoolieMove,NullCoolie,DoStayOnFloor,
|
|
|
|
DoActorDebris, SpawnCoolieExp,
|
|
|
|
SpawnCoolg;
|
|
|
|
|
|
|
|
STATE s_CoolieRun[5][4] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R0 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[0][1]},
|
|
|
|
{COOLIE_RUN_R0 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[0][2]},
|
|
|
|
{COOLIE_RUN_R0 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[0][3]},
|
|
|
|
{COOLIE_RUN_R0 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[0][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R1 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[1][1]},
|
|
|
|
{COOLIE_RUN_R1 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[1][2]},
|
|
|
|
{COOLIE_RUN_R1 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[1][3]},
|
|
|
|
{COOLIE_RUN_R1 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[1][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R2 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[2][1]},
|
|
|
|
{COOLIE_RUN_R2 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[2][2]},
|
|
|
|
{COOLIE_RUN_R2 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[2][3]},
|
|
|
|
{COOLIE_RUN_R2 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[2][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R3 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[3][1]},
|
|
|
|
{COOLIE_RUN_R3 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[3][2]},
|
|
|
|
{COOLIE_RUN_R3 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[3][3]},
|
|
|
|
{COOLIE_RUN_R3 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[3][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R4 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[4][1]},
|
|
|
|
{COOLIE_RUN_R4 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[4][2]},
|
|
|
|
{COOLIE_RUN_R4 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[4][3]},
|
|
|
|
{COOLIE_RUN_R4 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieRun[4][0]},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CoolieRun[] =
|
|
|
|
{
|
|
|
|
&s_CoolieRun[0][0],
|
|
|
|
&s_CoolieRun[1][0],
|
|
|
|
&s_CoolieRun[2][0],
|
|
|
|
&s_CoolieRun[3][0],
|
|
|
|
&s_CoolieRun[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// COOLIE CHARGE
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define COOLIE_RATE 12
|
|
|
|
|
|
|
|
ANIMATOR DoCoolieMove,NullCoolie,DoStayOnFloor,
|
|
|
|
DoActorDebris, SpawnCoolieExp,
|
|
|
|
SpawnCoolg;
|
|
|
|
|
|
|
|
STATE s_CoolieCharge[5][4] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{COOLIE_CHARGE_R0 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[0][1]},
|
|
|
|
{COOLIE_CHARGE_R0 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[0][2]},
|
|
|
|
{COOLIE_CHARGE_R0 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[0][3]},
|
|
|
|
{COOLIE_CHARGE_R0 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[0][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_CHARGE_R1 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[1][1]},
|
|
|
|
{COOLIE_CHARGE_R1 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[1][2]},
|
|
|
|
{COOLIE_CHARGE_R1 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[1][3]},
|
|
|
|
{COOLIE_CHARGE_R1 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[1][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_CHARGE_R2 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[2][1]},
|
|
|
|
{COOLIE_CHARGE_R2 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[2][2]},
|
|
|
|
{COOLIE_CHARGE_R2 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[2][3]},
|
|
|
|
{COOLIE_CHARGE_R2 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[2][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_CHARGE_R3 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[3][1]},
|
|
|
|
{COOLIE_CHARGE_R3 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[3][2]},
|
|
|
|
{COOLIE_CHARGE_R3 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[3][3]},
|
|
|
|
{COOLIE_CHARGE_R3 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[3][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_CHARGE_R4 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[4][1]},
|
|
|
|
{COOLIE_CHARGE_R4 + 1, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[4][2]},
|
|
|
|
{COOLIE_CHARGE_R4 + 2, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[4][3]},
|
|
|
|
{COOLIE_CHARGE_R4 + 3, COOLIE_RATE, DoCoolieMove, &s_CoolieCharge[4][0]},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CoolieCharge[] =
|
|
|
|
{
|
|
|
|
&s_CoolieCharge[0][0],
|
|
|
|
&s_CoolieCharge[1][0],
|
|
|
|
&s_CoolieCharge[2][0],
|
|
|
|
&s_CoolieCharge[3][0],
|
|
|
|
&s_CoolieCharge[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// COOLIE STAND
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
STATE s_CoolieStand[5][6] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R0 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieStand[0][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R1 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieStand[1][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R2 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieStand[2][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R3 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieStand[3][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_RUN_R4 + 0, COOLIE_RATE, DoCoolieMove, &s_CoolieStand[4][0]}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CoolieStand[] =
|
|
|
|
{
|
|
|
|
&s_CoolieStand[0][0],
|
|
|
|
&s_CoolieStand[1][0],
|
|
|
|
&s_CoolieStand[2][0],
|
|
|
|
&s_CoolieStand[3][0],
|
|
|
|
&s_CoolieStand[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// COOLIE PAIN
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define COOLIE_PAIN_RATE 60
|
|
|
|
ANIMATOR CooliePain;
|
|
|
|
|
|
|
|
STATE s_CooliePain[5][1] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{COOLIE_PAIN_R0 + 0, COOLIE_PAIN_RATE, CooliePain, &s_CooliePain[0][0]},
|
|
|
|
//{COOLIE_PAIN_R0 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_CooliePain[0][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_PAIN_R1 + 0, COOLIE_PAIN_RATE, CooliePain, &s_CooliePain[1][0]},
|
|
|
|
//{COOLIE_PAIN_R1 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_CooliePain[1][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_PAIN_R2 + 0, COOLIE_PAIN_RATE, CooliePain, &s_CooliePain[2][0]},
|
|
|
|
//{COOLIE_PAIN_R2 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_CooliePain[2][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_PAIN_R3 + 0, COOLIE_PAIN_RATE, CooliePain, &s_CooliePain[3][0]},
|
|
|
|
//{COOLIE_PAIN_R3 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_CooliePain[3][0]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{COOLIE_PAIN_R4 + 0, COOLIE_PAIN_RATE, CooliePain, &s_CooliePain[4][0]},
|
|
|
|
//{COOLIE_PAIN_R4 + 0, 0|SF_QUICK_CALL, InitActorDecide, &s_CooliePain[4][0]}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CooliePain[] =
|
|
|
|
{
|
|
|
|
&s_CooliePain[0][0],
|
|
|
|
&s_CooliePain[1][0],
|
|
|
|
&s_CooliePain[2][0],
|
|
|
|
&s_CooliePain[3][0],
|
|
|
|
&s_CooliePain[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// COOLIE DIE
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define COOLIE_DIE_RATE 30
|
|
|
|
ANIMATOR DoCoolieWaitBirth;
|
|
|
|
|
|
|
|
STATE s_CoolieDie[] =
|
|
|
|
{
|
|
|
|
{COOLIE_DIE + 0, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[1]},
|
|
|
|
|
|
|
|
{COOLIE_DIE + 0, 0|SF_QUICK_CALL, SpawnCoolieExp, &s_CoolieDie[2]},
|
|
|
|
|
|
|
|
{COOLIE_DIE + 1, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[3]},
|
|
|
|
{COOLIE_DIE + 2, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[4]},
|
|
|
|
{COOLIE_DIE + 3, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[5]},
|
|
|
|
{COOLIE_DIE + 4, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[6]},
|
|
|
|
{COOLIE_DIE + 5, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[7]},
|
|
|
|
{COOLIE_DIE + 6, COOLIE_DIE_RATE, NullCoolie, &s_CoolieDie[8]},
|
|
|
|
{COOLIE_DIE + 7, COOLIE_DIE_RATE, DoCoolieWaitBirth, &s_CoolieDie[8]},
|
|
|
|
|
|
|
|
{COOLIE_DIE + 7, COOLIE_DIE_RATE*5, DoActorDebris, &s_CoolieDie[10]},
|
|
|
|
{COOLIE_DIE + 7, 0|SF_QUICK_CALL, SpawnCoolg, &s_CoolieDie[11]},
|
|
|
|
{COOLIE_DEAD_NOHEAD, SF_QUICK_CALL, QueueFloorBlood, &s_CoolieDie[12]},
|
|
|
|
{COOLIE_DEAD_NOHEAD, COOLIE_DIE_RATE, DoActorDebris, &s_CoolieDie[12]}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CoolieDie[] =
|
|
|
|
{
|
|
|
|
s_CoolieDie
|
|
|
|
};
|
|
|
|
|
|
|
|
STATE s_CoolieDead[] =
|
|
|
|
{
|
|
|
|
{COOLIE_DEAD, COOLIE_DIE_RATE, DoActorDebris, &s_CoolieDead[0]},
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_CoolieDead[] =
|
|
|
|
{
|
|
|
|
s_CoolieDead
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
#define MAX_ACTOR_CLOSE_ATTACK 2
|
|
|
|
#define MAX_ACTOR_ATTACK 6
|
|
|
|
STATEp *Stand;
|
|
|
|
STATEp *Run;
|
|
|
|
STATEp *Jump;
|
|
|
|
STATEp *Fall;
|
|
|
|
STATEp *Crawl;
|
|
|
|
STATEp *Swim;
|
|
|
|
STATEp *Fly;
|
|
|
|
STATEp *Rise;
|
|
|
|
STATEp *Sit;
|
|
|
|
STATEp *Look;
|
|
|
|
STATEp *Climb;
|
|
|
|
STATEp *Pain;
|
|
|
|
STATEp *Death1;
|
|
|
|
STATEp *Death2;
|
|
|
|
STATEp *Dead;
|
|
|
|
STATEp *DeathJump;
|
|
|
|
STATEp *DeathFall;
|
|
|
|
|
|
|
|
STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
|
|
|
|
short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
|
|
|
|
|
|
|
|
STATEp *Attack[MAX_ACTOR_ATTACK];
|
|
|
|
short AttackPercent[MAX_ACTOR_ATTACK];
|
|
|
|
|
|
|
|
STATEp *Special[2];
|
|
|
|
STATEp *Duck;
|
|
|
|
STATEp *Dive;
|
|
|
|
}ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
|
|
|
|
*/
|
|
|
|
|
|
|
|
ACTOR_ACTION_SET CoolieActionSet =
|
|
|
|
{
|
|
|
|
sg_CoolieStand,
|
|
|
|
sg_CoolieRun,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr, //climb
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_CooliePain, //pain
|
|
|
|
sg_CoolieDie,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_CoolieDead,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
{sg_CoolieCharge},
|
|
|
|
{1024},
|
|
|
|
{sg_CoolieCharge},
|
|
|
|
{1024},
|
2021-07-10 12:25:18 +00:00
|
|
|
{nullptr},
|
|
|
|
nullptr,
|
|
|
|
nullptr
|
2015-05-19 21:54:34 +00:00
|
|
|
};
|
|
|
|
|
2015-05-19 21:58:29 +00:00
|
|
|
void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-30 18:00:02 +00:00
|
|
|
auto actor = &swActors[SpriteNum];
|
|
|
|
USERp u = actor->u();
|
|
|
|
SPRITEp sp = &actor->s();
|
2015-05-19 21:54:34 +00:00
|
|
|
unsigned int wpn;
|
|
|
|
short wpn_cnt;
|
|
|
|
short depth = 0;
|
|
|
|
extern short TotalKillable;
|
|
|
|
|
|
|
|
switch (u->ID)
|
|
|
|
{
|
|
|
|
case PACHINKO1:
|
|
|
|
case PACHINKO2:
|
|
|
|
case PACHINKO3:
|
|
|
|
case PACHINKO4:
|
|
|
|
case 623:
|
|
|
|
case TOILETGIRL_R0:
|
|
|
|
case WASHGIRL_R0:
|
|
|
|
case CARGIRL_R0:
|
|
|
|
case MECHANICGIRL_R0:
|
|
|
|
case SAILORGIRL_R0:
|
|
|
|
case PRUNEGIRL_R0:
|
|
|
|
case TRASHCAN:
|
|
|
|
case BUNNY_RUN_R0:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
TotalKillable++;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
RESET(sp->cstat, CSTAT_SPRITE_RESTORE);
|
|
|
|
|
|
|
|
u->spal = sp->pal;
|
|
|
|
|
|
|
|
u->RotNum = 5;
|
|
|
|
sp->clipdist = (256) >> 2;
|
|
|
|
|
|
|
|
u->zclip = Z(48);
|
|
|
|
u->lo_step = Z(32);
|
|
|
|
|
|
|
|
u->floor_dist = u->zclip - u->lo_step;
|
|
|
|
u->ceiling_dist = SPRITEp_SIZE_Z(sp) - u->zclip;
|
|
|
|
|
|
|
|
u->Radius = 400;
|
|
|
|
|
|
|
|
u->MaxHealth = u->Health;
|
|
|
|
|
|
|
|
u->PainThreshold = DIV16(u->Health) - 1;
|
|
|
|
//u->PainThreshold = DIV4(u->Health) - 1;
|
|
|
|
|
|
|
|
SET(sp->cstat,CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
|
|
|
SET(sp->extra,SPRX_PLAYER_OR_ENEMY);
|
|
|
|
|
|
|
|
sprite[SpriteNum].picnum = u->State->Pic;
|
2021-10-30 18:00:02 +00:00
|
|
|
change_actor_stat(actor, STAT_ENEMY);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
u->Personality = person;
|
|
|
|
u->ActorActionSet = action;
|
|
|
|
|
|
|
|
DoActorZrange(SpriteNum);
|
|
|
|
|
2021-10-29 20:34:54 +00:00
|
|
|
//KeepActorOnFloor(actor); // for swimming actors
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// make sure we start in the water if thats where we are
|
|
|
|
if (u->lo_sectp) // && SectUser[u->lo_sectp - sector])
|
|
|
|
{
|
2020-10-15 15:45:07 +00:00
|
|
|
int i;
|
2021-05-12 00:02:26 +00:00
|
|
|
short sectnum = short(u->lo_sectp - sector);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-04-02 10:55:58 +00:00
|
|
|
if (SectUser[sectnum].Data() && TEST(u->lo_sectp->extra, SECTFX_SINK))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-04-18 22:24:25 +00:00
|
|
|
depth = FixedToInt(SectUser[sectnum]->depth_fixed);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-15 15:40:22 +00:00
|
|
|
SectIterator it(sectnum);
|
|
|
|
while ((i = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
SPRITEp np = &sprite[i];
|
|
|
|
if (np->picnum == ST1 && np->hitag == SECT_SINK)
|
|
|
|
{
|
|
|
|
depth = np->lotag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (depth && labs(sp->z - u->loz) < Z(8))
|
|
|
|
{
|
|
|
|
sp->z += Z(depth);
|
|
|
|
u->loz = sp->z;
|
2021-01-05 12:43:49 +00:00
|
|
|
sp->backupz();
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!action)
|
|
|
|
return;
|
|
|
|
|
|
|
|
NewStateGroup(SpriteNum, u->ActorActionSet->Run);
|
|
|
|
|
|
|
|
u->ActorActionFunc = DoActorDecide;
|
|
|
|
|
|
|
|
// find the number of long range attacks
|
|
|
|
for (wpn = wpn_cnt = 0; wpn < SIZ(u->ActorActionSet->Attack); wpn++)
|
|
|
|
{
|
|
|
|
if (u->ActorActionSet->Attack[wpn])
|
|
|
|
wpn_cnt++;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// for actors this tells the number of weapons available
|
|
|
|
// for player it tells the current weapon
|
2021-05-12 00:02:26 +00:00
|
|
|
u->WeaponNum = int8_t(wpn_cnt);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
SetupCoolie(short SpriteNum)
|
|
|
|
{
|
2021-10-30 10:09:34 +00:00
|
|
|
auto actor = &swActors[SpriteNum];
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp sp = &sprite[SpriteNum];
|
|
|
|
USERp u;
|
|
|
|
ANIMATOR DoActorDecide;
|
|
|
|
|
|
|
|
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
|
|
|
{
|
2021-04-02 09:13:33 +00:00
|
|
|
u = User[SpriteNum].Data();
|
2015-05-19 21:54:34 +00:00
|
|
|
ASSERT(u);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-02 09:13:33 +00:00
|
|
|
u = SpawnUser(SpriteNum,COOLIE_RUN_R0,s_CoolieRun[0]);
|
2015-05-19 21:54:34 +00:00
|
|
|
u->Health = HEALTH_COOLIE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ChangeState(SpriteNum,s_CoolieRun[0]);
|
|
|
|
u->Attrib = &CoolieAttrib;
|
2021-10-30 10:09:34 +00:00
|
|
|
DoActorSetSpeed(actor, NORM_SPEED);
|
2015-05-19 21:54:34 +00:00
|
|
|
u->StateEnd = s_CoolieDie;
|
|
|
|
u->Rot = sg_CoolieRun;
|
|
|
|
|
|
|
|
EnemyDefaults(SpriteNum, &CoolieActionSet, &CooliePersonality);
|
|
|
|
|
|
|
|
sp->xrepeat = 42;
|
|
|
|
sp->yrepeat = 42;
|
|
|
|
|
|
|
|
SET(u->Flags, SPR_XFLIP_TOGGLE);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-30 17:02:53 +00:00
|
|
|
int NewCoolg(DSWActor*);
|
2021-10-29 18:49:57 +00:00
|
|
|
int SpawnCoolg(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2021-10-08 08:03:14 +00:00
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
// Don't do a ghost every time
|
2021-09-20 06:59:54 +00:00
|
|
|
if (RandomRange(1000) > 700 || Skill < MinEnemySkill - 1)
|
2019-11-17 17:02:17 +00:00
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-30 17:02:53 +00:00
|
|
|
NewCoolg(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
PlaySpriteSound(SpriteNum,attr_extra1,v3df_follow);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int CooliePain(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if (TEST(u->Flags,SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if (!TEST(u->Flags,SPR_CLIMBING))
|
2021-10-29 20:34:54 +00:00
|
|
|
KeepActorOnFloor(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSectorDamage(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
2021-10-29 18:49:57 +00:00
|
|
|
InitActorDecide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int NullCoolie(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if (TEST(u->Flags,SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if (!TEST(u->Flags,SPR_CLIMBING))
|
2021-10-29 20:34:54 +00:00
|
|
|
KeepActorOnFloor(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSectorDamage(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int DoCoolieMove(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp sp = &sprite[SpriteNum];
|
|
|
|
|
|
|
|
if (TEST(u->Flags,SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if (u->track >= 0)
|
|
|
|
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
|
|
|
|
else
|
2021-10-29 18:49:57 +00:00
|
|
|
(*u->ActorActionFunc)(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 20:34:54 +00:00
|
|
|
KeepActorOnFloor(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
if (DoActorSectorDamage(actor))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-30 11:16:40 +00:00
|
|
|
if (Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y) < 1200)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
//DoActorDie(SpriteNum, -3);
|
|
|
|
UpdateSinglePlayKills(SpriteNum);
|
2021-10-29 20:00:27 +00:00
|
|
|
DoActorDie(actor, actor, 0);
|
2015-05-19 21:54:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int InitCoolieCharge(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp sp = &sprite[SpriteNum];
|
|
|
|
|
|
|
|
if (RANDOM_P2(1024) > 950)
|
2019-12-18 10:09:01 +00:00
|
|
|
PlaySound(DIGI_COOLIESCREAM, sp, v3df_follow);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-30 10:09:34 +00:00
|
|
|
DoActorSetSpeed(actor, FAST_SPEED);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
InitActorMoveCloser(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
NewStateGroup(SpriteNum, sg_CoolieCharge);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2021-10-29 18:49:57 +00:00
|
|
|
DoCoolieWaitBirth(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 18:49:57 +00:00
|
|
|
USER* u = actor->u();
|
|
|
|
int SpriteNum = u->SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
if ((u->Counter -= ACTORMOVETICS) <= 0)
|
|
|
|
{
|
|
|
|
ChangeState(SpriteNum,&s_CoolieDie[9]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "saveable.h"
|
|
|
|
|
|
|
|
static saveable_code saveable_coolie_code[] =
|
|
|
|
{
|
|
|
|
SAVE_CODE(SpawnCoolg),
|
|
|
|
SAVE_CODE(CooliePain),
|
|
|
|
SAVE_CODE(NullCoolie),
|
|
|
|
SAVE_CODE(DoCoolieMove),
|
|
|
|
SAVE_CODE(InitCoolieCharge),
|
|
|
|
SAVE_CODE(DoCoolieWaitBirth),
|
|
|
|
};
|
|
|
|
|
|
|
|
static saveable_data saveable_coolie_data[] =
|
|
|
|
{
|
|
|
|
SAVE_DATA(CoolieBattle),
|
|
|
|
SAVE_DATA(CoolieOffense),
|
|
|
|
SAVE_DATA(CoolieBroadcast),
|
|
|
|
SAVE_DATA(CoolieSurprised),
|
|
|
|
SAVE_DATA(CoolieEvasive),
|
|
|
|
SAVE_DATA(CoolieLostTarget),
|
|
|
|
SAVE_DATA(CoolieCloseRange),
|
|
|
|
|
|
|
|
SAVE_DATA(CooliePersonality),
|
|
|
|
|
|
|
|
SAVE_DATA(CoolieAttrib),
|
|
|
|
|
|
|
|
SAVE_DATA(s_CoolieRun),
|
|
|
|
SAVE_DATA(sg_CoolieRun),
|
|
|
|
SAVE_DATA(s_CoolieCharge),
|
|
|
|
SAVE_DATA(sg_CoolieCharge),
|
|
|
|
SAVE_DATA(s_CoolieStand),
|
|
|
|
SAVE_DATA(sg_CoolieStand),
|
|
|
|
SAVE_DATA(s_CooliePain),
|
|
|
|
SAVE_DATA(sg_CooliePain),
|
|
|
|
SAVE_DATA(s_CoolieDie),
|
|
|
|
SAVE_DATA(sg_CoolieDie),
|
|
|
|
SAVE_DATA(s_CoolieDead),
|
|
|
|
SAVE_DATA(sg_CoolieDead),
|
|
|
|
|
|
|
|
SAVE_DATA(CoolieActionSet),
|
|
|
|
};
|
|
|
|
|
|
|
|
saveable_module saveable_coolie =
|
|
|
|
{
|
|
|
|
// code
|
|
|
|
saveable_coolie_code,
|
|
|
|
SIZ(saveable_coolie_code),
|
|
|
|
|
|
|
|
// data
|
|
|
|
saveable_coolie_data,
|
|
|
|
SIZ(saveable_coolie_data)
|
|
|
|
};
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|