2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_strifeglobal.h"
|
2006-04-13 16:52:24 +00:00
|
|
|
#include "c_console.h"
|
2006-05-07 00:27:22 +00:00
|
|
|
#include "gstrings.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static FRandom pr_spectrespawn ("AlienSpectreSpawn");
|
2008-07-12 10:59:36 +00:00
|
|
|
static FRandom pr_spectrechunk ("212e4");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-06 17:49:22 +00:00
|
|
|
static void GenericSpectreSpawn (AActor *actor, const char *type)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
AActor *spectre = Spawn (type, actor->x, actor->y, actor->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spectre != NULL)
|
|
|
|
{
|
|
|
|
spectre->momz = pr_spectrespawn() << 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void A_SpawnSpectre4 (AActor *actor)
|
|
|
|
{
|
2008-08-06 17:49:22 +00:00
|
|
|
GenericSpectreSpawn (actor, "AlienSpectre4");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
void A_SpectreChunkSmall (AActor *self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 17:49:22 +00:00
|
|
|
AActor *foo = Spawn("AlienChunkSmall", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (foo != NULL)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
t = pr_spectrechunk() & 15;
|
|
|
|
foo->momx = (t - (pr_spectrechunk() & 7)) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
t = pr_spectrechunk() & 15;
|
|
|
|
foo->momy = (t - (pr_spectrechunk() & 7)) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
foo->momz = (pr_spectrechunk() & 15) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
void A_SpectreChunkLarge (AActor *self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 17:49:22 +00:00
|
|
|
AActor *foo = Spawn("AlienChunkLarge", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (foo != NULL)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
t = pr_spectrechunk() & 7;
|
|
|
|
foo->momx = (t - (pr_spectrechunk() & 15)) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
t = pr_spectrechunk() & 7;
|
|
|
|
foo->momy = (t - (pr_spectrechunk() & 15)) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
foo->momz = (pr_spectrechunk() & 7) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
void A_Spectre3Attack (AActor *self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (self->target == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
AActor *foo = Spawn("SpectralLightningV2", self->x, self->y, self->z + 32*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
foo->momz = -12*FRACUNIT;
|
|
|
|
foo->target = self;
|
|
|
|
foo->health = -2;
|
|
|
|
foo->tracer = self->target;
|
|
|
|
|
|
|
|
self->angle -= ANGLE_180 / 20 * 10;
|
|
|
|
for (int i = 0; i < 20; ++i)
|
|
|
|
{
|
|
|
|
self->angle += ANGLE_180 / 20;
|
2008-08-05 22:51:51 +00:00
|
|
|
P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall2"), self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
self->angle -= ANGLE_180 / 20 * 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
void A_AlienSpectreDeath (AActor *self)
|
|
|
|
{
|
|
|
|
AActor *player;
|
|
|
|
char voc[32];
|
|
|
|
int log;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
A_NoBlocking (self); // [RH] Need this for Sigil rewarding
|
|
|
|
if (!CheckBossDeath (self))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (i = 0, player = NULL; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].health > 0)
|
|
|
|
{
|
|
|
|
player = players[i].mo;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (player == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
switch (self->GetClass()->TypeName)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-05 22:51:51 +00:00
|
|
|
case NAME_AlienSpectre1:
|
2008-03-19 22:47:04 +00:00
|
|
|
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 999, FRACUNIT, 0, 0, 0, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
log = 95;
|
2008-08-05 22:51:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_AlienSpectre2:
|
2006-05-07 00:27:22 +00:00
|
|
|
C_MidPrint(GStrings("TXT_KILLED_BISHOP"));
|
2006-02-24 04:48:15 +00:00
|
|
|
log = 74;
|
|
|
|
player->GiveInventoryType (QuestItemClasses[20]);
|
2008-08-05 22:51:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_AlienSpectre3:
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-07 00:27:22 +00:00
|
|
|
C_MidPrint(GStrings("TXT_KILLED_ORACLE"));
|
2006-02-24 04:48:15 +00:00
|
|
|
// If there are any Oracles still alive, kill them.
|
|
|
|
TThinkerIterator<AOracle> it;
|
|
|
|
AOracle *oracle;
|
|
|
|
|
|
|
|
while ( (oracle = it.Next()) != NULL)
|
|
|
|
{
|
|
|
|
if (oracle->health > 0)
|
|
|
|
{
|
|
|
|
oracle->health = 0;
|
|
|
|
oracle->Die (self, self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
player->GiveInventoryType (QuestItemClasses[22]);
|
|
|
|
if (player->FindInventory (QuestItemClasses[20]))
|
|
|
|
{ // If the Bishop is dead, set quest item 22
|
|
|
|
player->GiveInventoryType (QuestItemClasses[21]);
|
|
|
|
}
|
|
|
|
if (player->FindInventory (QuestItemClasses[23]) == NULL)
|
|
|
|
{ // Macil is calling us back...
|
|
|
|
log = 87;
|
|
|
|
}
|
|
|
|
else
|
2008-08-06 17:49:22 +00:00
|
|
|
{ // You wield the power of the complete Sigil.
|
2006-02-24 04:48:15 +00:00
|
|
|
log = 85;
|
|
|
|
}
|
|
|
|
EV_DoDoor (DDoor::doorOpen, NULL, NULL, 222, 8*FRACUNIT, 0, 0, 0);
|
2008-08-05 22:51:51 +00:00
|
|
|
break;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-05 22:51:51 +00:00
|
|
|
|
|
|
|
case NAME_AlienSpectre4:
|
2006-05-07 00:27:22 +00:00
|
|
|
C_MidPrint(GStrings("TXT_KILLED_MACIL"));
|
2006-02-24 04:48:15 +00:00
|
|
|
player->GiveInventoryType (QuestItemClasses[23]);
|
|
|
|
if (player->FindInventory (QuestItemClasses[24]) == NULL)
|
|
|
|
{ // Richter has taken over. Macil is a snake.
|
|
|
|
log = 79;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Back to the factory for another Sigil!
|
|
|
|
log = 106;
|
|
|
|
}
|
2008-08-05 22:51:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_AlienSpectre5:
|
2006-05-07 00:27:22 +00:00
|
|
|
C_MidPrint(GStrings("TXT_KILLED_LOREMASTER"));
|
2006-02-24 04:48:15 +00:00
|
|
|
ASigil *sigil;
|
|
|
|
|
|
|
|
player->GiveInventoryType (QuestItemClasses[25]);
|
|
|
|
if (!multiplayer)
|
|
|
|
{
|
|
|
|
player->GiveInventoryType (RUNTIME_CLASS(AUpgradeStamina));
|
|
|
|
player->GiveInventoryType (RUNTIME_CLASS(AUpgradeAccuracy));
|
|
|
|
}
|
|
|
|
sigil = player->FindInventory<ASigil>();
|
|
|
|
if (sigil != NULL && sigil->NumPieces == 5)
|
2008-08-06 17:49:22 +00:00
|
|
|
{ // You wield the power of the complete Sigil.
|
2006-02-24 04:48:15 +00:00
|
|
|
log = 85;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Another Sigil piece. Woohoo!
|
|
|
|
log = 83;
|
|
|
|
}
|
2008-03-19 22:47:04 +00:00
|
|
|
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, 0, 0, false);
|
2008-08-05 22:51:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (voc, countof(voc), "svox/voc%d", log);
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (CHAN_VOICE, voc, 1, ATTN_NORM);
|
|
|
|
player->player->SetLogNumber (log);
|
|
|
|
}
|