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 "game.h"
|
|
|
|
#include "tags.h"
|
|
|
|
#include "ai.h"
|
|
|
|
#include "weapon.h"
|
2020-08-05 22:18:45 +00:00
|
|
|
#include "misc.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
BEGIN_SW_NS
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
DECISION EelBattle[] =
|
|
|
|
{
|
|
|
|
{649, InitActorMoveCloser },
|
|
|
|
{650, InitActorAlertNoise },
|
|
|
|
{1024, InitActorMoveCloser }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelOffense[] =
|
|
|
|
{
|
|
|
|
{649, InitActorMoveCloser },
|
|
|
|
{750, InitActorAlertNoise },
|
|
|
|
{1024, InitActorMoveCloser }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelBroadcast[] =
|
|
|
|
{
|
|
|
|
{3, InitActorAlertNoise },
|
|
|
|
{6, InitActorAmbientNoise },
|
|
|
|
{1024, InitActorDecide }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelSurprised[] =
|
|
|
|
{
|
|
|
|
{701, InitActorMoveCloser },
|
|
|
|
{1024, InitActorDecide }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelEvasive[] =
|
|
|
|
{
|
|
|
|
{ 790, InitActorRunAway },
|
|
|
|
{1024, InitActorMoveCloser },
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelLostTarget[] =
|
|
|
|
{
|
|
|
|
{900, InitActorFindPlayer },
|
|
|
|
{1024, InitActorWanderAround }
|
|
|
|
};
|
|
|
|
|
|
|
|
DECISION EelCloseRange[] =
|
|
|
|
{
|
|
|
|
{950, InitActorAttack },
|
|
|
|
{1024, InitActorReposition }
|
|
|
|
};
|
|
|
|
|
|
|
|
ANIMATOR InitEelFire;
|
|
|
|
|
|
|
|
DECISION EelTouchTarget[] =
|
|
|
|
{
|
|
|
|
{1024, InitActorAttack },
|
|
|
|
};
|
|
|
|
|
|
|
|
PERSONALITY EelPersonality =
|
|
|
|
{
|
|
|
|
EelBattle,
|
|
|
|
EelOffense,
|
|
|
|
EelBroadcast,
|
|
|
|
EelSurprised,
|
|
|
|
EelEvasive,
|
|
|
|
EelLostTarget,
|
|
|
|
EelCloseRange,
|
|
|
|
EelTouchTarget
|
|
|
|
};
|
|
|
|
|
|
|
|
ATTRIBUTE EelAttrib =
|
|
|
|
{
|
|
|
|
{100, 110, 120, 130}, // Speeds
|
|
|
|
{3, 0, -2, -3}, // Tic Adjusts
|
|
|
|
3, // MaxWeapons;
|
|
|
|
{
|
|
|
|
0, 0, 0,
|
|
|
|
0, 0, 0,
|
|
|
|
0,0,0,0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
// EEL RUN
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define EEL_RUN_RATE 20
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
ANIMATOR DoEelMove,DoStayOnFloor, DoActorDebris, NullEel;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
STATE s_EelRun[5][4] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{EEL_RUN_R0 + 0, EEL_RUN_RATE, DoEelMove, &s_EelRun[0][1]},
|
|
|
|
{EEL_RUN_R0 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[0][2]},
|
|
|
|
{EEL_RUN_R0 + 2, EEL_RUN_RATE, DoEelMove, &s_EelRun[0][3]},
|
|
|
|
{EEL_RUN_R0 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[0][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R1 + 0, EEL_RUN_RATE, DoEelMove, &s_EelRun[1][1]},
|
|
|
|
{EEL_RUN_R1 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[1][2]},
|
|
|
|
{EEL_RUN_R1 + 2, EEL_RUN_RATE, DoEelMove, &s_EelRun[1][3]},
|
|
|
|
{EEL_RUN_R1 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[1][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R2 + 0, EEL_RUN_RATE, DoEelMove, &s_EelRun[2][1]},
|
|
|
|
{EEL_RUN_R2 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[2][2]},
|
|
|
|
{EEL_RUN_R2 + 2, EEL_RUN_RATE, DoEelMove, &s_EelRun[2][3]},
|
|
|
|
{EEL_RUN_R2 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[2][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R3 + 0, EEL_RUN_RATE, DoEelMove, &s_EelRun[3][1]},
|
|
|
|
{EEL_RUN_R3 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[3][2]},
|
|
|
|
{EEL_RUN_R3 + 2, EEL_RUN_RATE, DoEelMove, &s_EelRun[3][3]},
|
|
|
|
{EEL_RUN_R3 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[3][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R4 + 0, EEL_RUN_RATE, DoEelMove, &s_EelRun[4][1]},
|
|
|
|
{EEL_RUN_R4 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[4][2]},
|
|
|
|
{EEL_RUN_R4 + 2, EEL_RUN_RATE, DoEelMove, &s_EelRun[4][3]},
|
|
|
|
{EEL_RUN_R4 + 1, EEL_RUN_RATE, DoEelMove, &s_EelRun[4][0]},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_EelRun[] =
|
|
|
|
{
|
|
|
|
&s_EelRun[0][0],
|
|
|
|
&s_EelRun[1][0],
|
|
|
|
&s_EelRun[2][0],
|
|
|
|
&s_EelRun[3][0],
|
|
|
|
&s_EelRun[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// EEL STAND
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
STATE s_EelStand[5][1] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{EEL_RUN_R0 + 0, EEL_RUN_RATE, DoEelMove, &s_EelStand[0][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R1 + 0, EEL_RUN_RATE, DoEelMove, &s_EelStand[1][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R2 + 0, EEL_RUN_RATE, DoEelMove, &s_EelStand[2][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R3 + 0, EEL_RUN_RATE, DoEelMove, &s_EelStand[3][0]},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R4 + 0, EEL_RUN_RATE, DoEelMove, &s_EelStand[4][0]},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_EelStand[] =
|
|
|
|
{
|
|
|
|
&s_EelStand[0][0],
|
|
|
|
&s_EelStand[1][0],
|
|
|
|
&s_EelStand[2][0],
|
|
|
|
&s_EelStand[3][0],
|
|
|
|
&s_EelStand[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// EEL FIRE
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
ANIMATOR InitEelFire, EelShock;
|
|
|
|
#define EEL_FIRE_RATE 12
|
|
|
|
|
|
|
|
STATE s_EelAttack[5][7] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{EEL_FIRE_R0 + 0, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[0][1]},
|
|
|
|
{EEL_FIRE_R0 + 1, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[0][2]},
|
|
|
|
{EEL_FIRE_R0 + 2, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[0][3]},
|
|
|
|
{EEL_FIRE_R0 + 2, 0|SF_QUICK_CALL, InitEelFire, &s_EelAttack[0][4]},
|
|
|
|
{EEL_FIRE_R0 + 2, EEL_FIRE_RATE, NullEel, &s_EelAttack[0][5]},
|
|
|
|
{EEL_FIRE_R0 + 3, 0|SF_QUICK_CALL, InitActorDecide, &s_EelAttack[0][6]},
|
|
|
|
{EEL_RUN_R0 + 3, EEL_FIRE_RATE, DoEelMove, &s_EelAttack[0][6]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_FIRE_R1 + 0, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[1][1]},
|
|
|
|
{EEL_FIRE_R1 + 1, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[1][2]},
|
|
|
|
{EEL_FIRE_R1 + 2, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[1][3]},
|
|
|
|
{EEL_FIRE_R1 + 2, 0|SF_QUICK_CALL, InitEelFire, &s_EelAttack[1][5]},
|
|
|
|
{EEL_FIRE_R1 + 2, EEL_FIRE_RATE, NullEel, &s_EelAttack[1][6]},
|
|
|
|
{EEL_FIRE_R1 + 3, 0|SF_QUICK_CALL, InitActorDecide, &s_EelAttack[1][7]},
|
|
|
|
{EEL_RUN_R0 + 3, EEL_FIRE_RATE, DoEelMove, &s_EelAttack[1][7]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_FIRE_R2 + 0, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[2][1]},
|
|
|
|
{EEL_FIRE_R2 + 1, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[2][2]},
|
|
|
|
{EEL_FIRE_R2 + 2, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[2][3]},
|
|
|
|
{EEL_FIRE_R2 + 2, 0|SF_QUICK_CALL, InitEelFire, &s_EelAttack[2][4]},
|
|
|
|
{EEL_FIRE_R2 + 2, EEL_FIRE_RATE, NullEel, &s_EelAttack[2][5]},
|
|
|
|
{EEL_FIRE_R2 + 3, 0|SF_QUICK_CALL, InitActorDecide, &s_EelAttack[2][6]},
|
|
|
|
{EEL_RUN_R0 + 3, EEL_FIRE_RATE, DoEelMove, &s_EelAttack[2][6]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R3 + 0, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[3][1]},
|
|
|
|
{EEL_RUN_R3 + 1, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[3][2]},
|
|
|
|
{EEL_RUN_R3 + 2, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[3][3]},
|
|
|
|
{EEL_RUN_R3 + 2, 0|SF_QUICK_CALL, InitEelFire, &s_EelAttack[3][4]},
|
|
|
|
{EEL_RUN_R3 + 2, EEL_FIRE_RATE, NullEel, &s_EelAttack[3][5]},
|
|
|
|
{EEL_RUN_R3 + 3, 0|SF_QUICK_CALL, InitActorDecide, &s_EelAttack[3][6]},
|
|
|
|
{EEL_RUN_R0 + 3, EEL_FIRE_RATE, DoEelMove, &s_EelAttack[3][6]}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{EEL_RUN_R4 + 0, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[4][1]},
|
|
|
|
{EEL_RUN_R4 + 1, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[4][2]},
|
|
|
|
{EEL_RUN_R4 + 2, EEL_FIRE_RATE*2, NullEel, &s_EelAttack[4][3]},
|
|
|
|
{EEL_RUN_R4 + 2, 0|SF_QUICK_CALL, InitEelFire, &s_EelAttack[4][4]},
|
|
|
|
{EEL_RUN_R4 + 2, EEL_FIRE_RATE, NullEel, &s_EelAttack[4][5]},
|
|
|
|
{EEL_RUN_R4 + 3, 0|SF_QUICK_CALL, InitActorDecide, &s_EelAttack[4][6]},
|
|
|
|
{EEL_RUN_R0 + 3, EEL_FIRE_RATE, DoEelMove, &s_EelAttack[4][6]}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_EelAttack[] =
|
|
|
|
{
|
|
|
|
&s_EelAttack[0][0],
|
|
|
|
&s_EelAttack[1][0],
|
|
|
|
&s_EelAttack[2][0],
|
|
|
|
&s_EelAttack[3][0],
|
|
|
|
&s_EelAttack[4][0]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//
|
|
|
|
// EEL DIE
|
|
|
|
//
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
#define EEL_DIE_RATE 20
|
|
|
|
|
|
|
|
ANIMATOR DoEelDeath;
|
|
|
|
STATE s_EelDie[] =
|
|
|
|
{
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[1]},
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[2]},
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[3]},
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[4]},
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[5]},
|
|
|
|
{EEL_DIE + 0, EEL_DIE_RATE, DoEelDeath, &s_EelDie[5]},
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_EelDie[] =
|
|
|
|
{
|
|
|
|
s_EelDie
|
|
|
|
};
|
|
|
|
|
|
|
|
STATE s_EelDead[] =
|
|
|
|
{
|
|
|
|
// {EEL_DEAD, SF_QUICK_CALL , QueueFloorBlood, &s_EelDead[1]},
|
|
|
|
{EEL_DEAD, EEL_DIE_RATE, DoActorDebris, &s_EelDead[0]},
|
|
|
|
};
|
|
|
|
|
|
|
|
STATEp sg_EelDead[] =
|
|
|
|
{
|
|
|
|
s_EelDead
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
STATEp *Stand[MAX_WEAPONS];
|
|
|
|
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[2];
|
|
|
|
STATEp *Attack[6];
|
|
|
|
STATEp *Special[2];
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
ACTOR_ACTION_SET EelActionSet =
|
|
|
|
{
|
|
|
|
sg_EelStand,
|
|
|
|
sg_EelRun,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_EelRun,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_EelStand,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr, //climb
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_EelStand, //pain
|
|
|
|
sg_EelDie,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
sg_EelDead,
|
2021-07-10 12:25:18 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2015-05-19 21:54:34 +00:00
|
|
|
{sg_EelAttack},
|
|
|
|
{1024},
|
|
|
|
{sg_EelAttack},
|
|
|
|
{1024},
|
2021-07-10 12:25:18 +00:00
|
|
|
{nullptr,nullptr},
|
|
|
|
nullptr,
|
|
|
|
nullptr
|
2015-05-19 21:54:34 +00:00
|
|
|
};
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int DoEelMatchPlayerZ(DSWActor* actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
|
2021-10-31 22:05:31 +00:00
|
|
|
void EelCommon(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-24 12:21:49 +00:00
|
|
|
actor->spr.clipdist = (100) >> 2;
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.floor_dist = Z(16);
|
|
|
|
actor->user.floor_dist = Z(16);
|
|
|
|
actor->user.ceiling_dist = Z(20);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz = actor->spr.pos.Z;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-24 12:21:49 +00:00
|
|
|
actor->spr.xrepeat = 35;
|
|
|
|
actor->spr.yrepeat = 27;
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.Radius = 400;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 22:05:31 +00:00
|
|
|
int SetupEel(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
ANIMATOR DoActorDecide;
|
|
|
|
|
2021-12-25 20:05:29 +00:00
|
|
|
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:05:29 +00:00
|
|
|
SpawnUser(actor,EEL_RUN_R0,s_EelRun[0]);
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.Health = 40;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-10-30 18:11:31 +00:00
|
|
|
ChangeState(actor, s_EelRun[0]);
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.Attrib = &EelAttrib;
|
2021-10-30 10:09:34 +00:00
|
|
|
DoActorSetSpeed(actor, NORM_SPEED);
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.StateEnd = s_EelDie;
|
|
|
|
actor->user.Rot = sg_EelRun;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-31 20:17:31 +00:00
|
|
|
EnemyDefaults(actor, &EelActionSet, &EelPersonality);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
SET(actor->user.Flags, SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-31 22:05:31 +00:00
|
|
|
EelCommon(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
RESET(actor->user.Flags, SPR_SHADOW); // Turn off shadows
|
|
|
|
actor->user.zclip = Z(8);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int NullEel(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
if (TEST(actor->user.Flags,SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
DoEelMatchPlayerZ(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 DoEelMatchPlayerZ(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
int zdiff,zdist;
|
|
|
|
int loz,hiz;
|
|
|
|
int dist,a,b,c;
|
|
|
|
|
|
|
|
int bound;
|
|
|
|
|
2021-12-24 12:21:49 +00:00
|
|
|
if (FAF_ConnectArea(actor->spr.sector()))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.hi_sectp)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.hiz = actor->spr.sector()->ceilingz + Z(16);
|
|
|
|
actor->user.hi_sectp = actor->spr.sector();
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.hiz < actor->spr.sector()->ceilingz + Z(16))
|
|
|
|
actor->user.hiz = actor->spr.sector()->ceilingz + Z(16);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
// actor does a sine wave about actor->user.sz - this is the z mid point
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
zdiff = (ActorZOfBottom(actor->user.targetActor) - Z(8)) - actor->user.sz;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// check z diff of the player and the sprite
|
2021-09-20 06:59:54 +00:00
|
|
|
zdist = Z(20 + RandomRange(64)); // put a random amount
|
2015-05-19 21:54:34 +00:00
|
|
|
if (labs(zdiff) > zdist)
|
|
|
|
{
|
|
|
|
if (zdiff > 0)
|
|
|
|
// manipulate the z midpoint
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz += 160 * ACTORMOVETICS;
|
2015-05-19 21:54:34 +00:00
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz -= 160 * ACTORMOVETICS;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 22:05:31 +00:00
|
|
|
const int EEL_BOB_AMT = (Z(4));
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// save off lo and hi z
|
2021-12-25 20:04:48 +00:00
|
|
|
loz = actor->user.loz;
|
|
|
|
hiz = actor->user.hiz;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// adjust loz/hiz for water depth
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.lo_sectp && actor->user.lo_sectp->hasU() && FixedToInt(actor->user.lo_sectp->depth_fixed))
|
|
|
|
loz -= Z(FixedToInt(actor->user.lo_sectp->depth_fixed)) - Z(8);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// lower bound
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.lowActor && actor->user.targetActor == actor->user.highActor) // this doesn't look right...
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, actor->user.lowActor->spr.pos.X, actor->user.lowActor->spr.pos.Y, dist, a, b, c);
|
2015-05-19 21:54:34 +00:00
|
|
|
if (dist <= 300)
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = actor->user.sz;
|
2015-05-19 21:54:34 +00:00
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = loz - actor->user.floor_dist;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = loz - actor->user.floor_dist - EEL_BOB_AMT;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.sz > bound)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz = bound;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// upper bound
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.highActor && actor->user.targetActor == actor->user.highActor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
DISTANCE(actor->spr.pos.X, actor->spr.pos.Y, actor->user.highActor->spr.pos.X, actor->user.highActor->spr.pos.Y, dist, a, b, c);
|
2015-05-19 21:54:34 +00:00
|
|
|
if (dist <= 300)
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = actor->user.sz;
|
2015-05-19 21:54:34 +00:00
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = hiz + actor->user.ceiling_dist;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = hiz + actor->user.ceiling_dist + EEL_BOB_AMT;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.sz < bound)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz = bound;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.sz = min(actor->user.sz, loz - actor->user.floor_dist);
|
|
|
|
actor->user.sz = max(actor->user.sz, hiz + actor->user.ceiling_dist);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
|
|
|
|
actor->spr.pos.Z = actor->user.sz + MulScale(EEL_BOB_AMT, bsin(actor->user.Counter), 14);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
bound = actor->user.hiz + actor->user.ceiling_dist + EEL_BOB_AMT;
|
2021-12-24 12:21:49 +00:00
|
|
|
if (actor->spr.pos.Z < bound)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
// bumped something
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->spr.pos.Z = actor->user.sz = bound + EEL_BOB_AMT;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-31 22:05:31 +00:00
|
|
|
int DoEelDeath(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
int nx, ny;
|
2021-12-25 20:04:48 +00:00
|
|
|
if (TEST(actor->user.Flags, SPR_FALLING))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-10-29 21:41:33 +00:00
|
|
|
DoFall(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-30 22:01:08 +00:00
|
|
|
DoFindGroundPoint(actor);
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.floor_dist = 0;
|
2021-10-29 21:41:33 +00:00
|
|
|
DoBeginFall(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (TEST(actor->user.Flags, SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// slide while falling
|
2021-12-24 12:21:49 +00:00
|
|
|
nx = MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14);
|
|
|
|
ny = MulScale(actor->spr.xvel, bsin(actor->spr.ang), 14);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
actor->user.coll = move_sprite(actor, nx, ny, 0L, actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
|
2021-10-30 22:01:08 +00:00
|
|
|
DoFindGroundPoint(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// on the ground
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->spr.pos.Z >= actor->user.loz)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
RESET(actor->user.Flags, SPR_FALLING|SPR_SLIDING);
|
2021-09-20 06:59:54 +00:00
|
|
|
if (RandomRange(1000) > 500)
|
2021-12-24 12:21:49 +00:00
|
|
|
SET(actor->spr.cstat, CSTAT_SPRITE_XFLIP);
|
2021-09-20 06:59:54 +00:00
|
|
|
if (RandomRange(1000) > 500)
|
2021-12-24 12:21:49 +00:00
|
|
|
SET(actor->spr.cstat, CSTAT_SPRITE_YFLIP);
|
2021-12-25 20:04:48 +00:00
|
|
|
NewStateGroup(actor, actor->user.ActorActionSet->Dead);
|
2015-05-19 21:54:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
int DoEelMove(DSWActor* actor)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-12-25 20:04:48 +00:00
|
|
|
ASSERT(actor->user.Rot != nullptr);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (SpriteOverlap(actor, actor->user.targetActor))
|
|
|
|
NewStateGroup(actor, actor->user.ActorActionSet->CloseAttack[0]);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (TEST(actor->user.Flags,SPR_SLIDING))
|
2021-10-29 18:49:57 +00:00
|
|
|
DoActorSlide(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-12-25 20:04:48 +00:00
|
|
|
if (actor->user.track >= 0)
|
2021-11-01 13:36:46 +00:00
|
|
|
ActorFollowTrack(actor, ACTORMOVETICS);
|
2015-05-19 21:54:34 +00:00
|
|
|
else
|
2021-12-25 20:04:48 +00:00
|
|
|
(*actor->user.ActorActionFunc)(actor);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-10-29 18:49:57 +00:00
|
|
|
DoEelMatchPlayerZ(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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "saveable.h"
|
|
|
|
|
|
|
|
static saveable_code saveable_eel_code[] =
|
|
|
|
{
|
|
|
|
SAVE_CODE(DoEelMatchPlayerZ),
|
|
|
|
SAVE_CODE(DoEelDeath),
|
|
|
|
SAVE_CODE(DoEelMove)
|
|
|
|
};
|
|
|
|
|
|
|
|
static saveable_data saveable_eel_data[] =
|
|
|
|
{
|
|
|
|
SAVE_DATA(EelBattle),
|
|
|
|
SAVE_DATA(EelOffense),
|
|
|
|
SAVE_DATA(EelBroadcast),
|
|
|
|
SAVE_DATA(EelSurprised),
|
|
|
|
SAVE_DATA(EelEvasive),
|
|
|
|
SAVE_DATA(EelLostTarget),
|
|
|
|
SAVE_DATA(EelCloseRange),
|
|
|
|
SAVE_DATA(EelTouchTarget),
|
|
|
|
|
|
|
|
SAVE_DATA(EelPersonality),
|
|
|
|
|
|
|
|
SAVE_DATA(EelAttrib),
|
|
|
|
|
|
|
|
SAVE_DATA(s_EelRun),
|
|
|
|
SAVE_DATA(sg_EelRun),
|
|
|
|
SAVE_DATA(s_EelStand),
|
|
|
|
SAVE_DATA(sg_EelStand),
|
|
|
|
SAVE_DATA(s_EelAttack),
|
|
|
|
SAVE_DATA(sg_EelAttack),
|
|
|
|
SAVE_DATA(s_EelDie),
|
|
|
|
SAVE_DATA(sg_EelDie),
|
|
|
|
SAVE_DATA(s_EelDead),
|
|
|
|
SAVE_DATA(sg_EelDead),
|
|
|
|
|
|
|
|
SAVE_DATA(EelActionSet)
|
|
|
|
};
|
|
|
|
|
|
|
|
saveable_module saveable_eel =
|
|
|
|
{
|
|
|
|
// code
|
|
|
|
saveable_eel_code,
|
|
|
|
SIZ(saveable_eel_code),
|
|
|
|
|
|
|
|
// data
|
|
|
|
saveable_eel_data,
|
|
|
|
SIZ(saveable_eel_data)
|
|
|
|
};
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|