- Added a simple check for abstract weapon classes so that I can properly define

the DoomWeapon base class.
- Fixed: When the Tome of Power runs out it must also set any pending weapon
  back to their regular state.


SVN r521 (trunk)
This commit is contained in:
Christoph Oelckers 2007-04-29 08:44:32 +00:00
parent 725c6d195e
commit 6e5b1f1182
5 changed files with 36 additions and 17 deletions

View File

@ -1,3 +1,9 @@
April 29, 2007 (Changes by Graf Zahl)
- Added a simple check for abstract weapon classes so that I can properly define
the DoomWeapon base class.
- Fixed: When the Tome of Power runs out it must also set any pending weapon
back to their regular state.
April 27, 2007 (Changes by Graf Zahl) April 27, 2007 (Changes by Graf Zahl)
- Added damage factors that allows to make monsters more or less resistant - Added damage factors that allows to make monsters more or less resistant
to specific damage types. to specific damage types.

View File

@ -1108,13 +1108,21 @@ void APowerWeaponLevel2::EndEffect ()
{ {
player_t *player = Owner != NULL ? Owner->player : NULL; player_t *player = Owner != NULL ? Owner->player : NULL;
if (player != NULL && if (player != NULL)
player->ReadyWeapon != NULL &&
player->ReadyWeapon->WeaponFlags & WIF_POWERED_UP)
{ {
player->ReadyWeapon->EndPowerup ();
if (player->ReadyWeapon != NULL &&
player->ReadyWeapon->WeaponFlags & WIF_POWERED_UP)
{
player->ReadyWeapon->EndPowerup ();
}
if (player->PendingWeapon != NULL &&
player->PendingWeapon->WeaponFlags & WIF_POWERED_UP &&
player->PendingWeapon->SisterWeapon != NULL)
{
player->PendingWeapon = player->PendingWeapon->SisterWeapon;
}
} }
// BorderTopRefresh = screen->GetPageCount ();
} }
// Player Speed Trail (used by the Speed Powerup) ---------------------------- // Player Speed Trail (used by the Speed Powerup) ----------------------------

View File

@ -486,7 +486,8 @@ void AWeapon::EndPowerup ()
{ {
if (GetReadyState() != SisterWeapon->GetReadyState()) if (GetReadyState() != SisterWeapon->GetReadyState())
{ {
Owner->player->PendingWeapon = SisterWeapon; if (Owner->player->PendingWeapon != NULL)
Owner->player->PendingWeapon = SisterWeapon;
} }
else else
{ {

View File

@ -4362,11 +4362,21 @@ void FinishThingdef()
if (isRuntimeActor) if (isRuntimeActor)
{ {
// Do some consistency checks. If these states are undefined the weapon cannot work! FState * ready = ti->ActorInfo->FindState(NAME_Ready);
if (!ti->ActorInfo->FindState(NAME_Ready)) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars()); FState * select = ti->ActorInfo->FindState(NAME_Select);
if (!ti->ActorInfo->FindState(NAME_Select)) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars()); FState * deselect = ti->ActorInfo->FindState(NAME_Deselect);
if (!ti->ActorInfo->FindState(NAME_Deselect)) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars()); FState * fire = ti->ActorInfo->FindState(NAME_Fire);
if (!ti->ActorInfo->FindState(NAME_Fire)) I_Error("Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
// Consider any weapon without any valid state abstract and don't output a warning
// This is for creating base classes for weapon groups that only set up some properties.
if (ready || select || deselect || fire)
{
// Do some consistency checks. If these states are undefined the weapon cannot work!
if (!ready) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars());
if (!select) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars());
if (!deselect) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars());
if (!fire) I_Error("Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
}
} }
} }

View File

@ -12,12 +12,6 @@ ACTOR DoomWeapon : Weapon
LightDone: LightDone:
SHTG E 0 A_Light0 SHTG E 0 A_Light0
Stop Stop
Ready: // get around the consistency checks
Deselect:
Select:
Fire:
TNT1 A 0
Stop
} }
} }