- Fixed: Changed initialization of Weapon.Kickback so that it is only done

for direct descendants of AWeapon and not for every weapon being defined.
- Changed parsing of actor names back to not use C-mode. This change breaks
  any definition that contain periods in their name and apparently there's
  more than anyone could expect. Also altered the parser to manually check
  for colons inside the parsed string so that placing spaces around them
  is no longer necessary.
- Fixed: Weapons could be picked up for ammo even if they gave none.
- Fixed: A_Beacon was missing a NULL pointer check for the beacon's owner.
- Fixed: The status bar tried to access CPlayer->camera without checking
  its validity. In spy mode there is a possibility that it is NULL.

SVN r237 (trunk)
This commit is contained in:
Christoph Oelckers 2006-07-03 09:07:56 +00:00
parent 9e6d5c8fd9
commit 43c1ec4a74
8 changed files with 65 additions and 22 deletions

View file

@ -1,3 +1,16 @@
July 3, 2006 (Changes by Graf Zahl)
- Fixed: Changed initialization of Weapon.Kickback so that it is only done
for direct descendants of AWeapon and not for every weapon being defined.
- Changed parsing of actor names back to not use C-mode. This change breaks
any definition that contains periods in their name and apparently there's
more than anyone could expect. Also altered the parser to manually check
for colons inside the parsed string so that placing spaces around them
is no longer necessary.
- Fixed: Weapons could be picked up for ammo even if they gave none.
- Fixed: A_Beacon was missing a NULL pointer check for the beacon's owner.
- Fixed: The status bar tried to access CPlayer->camera without checking
its validity. In spy mode there is a possibility that it is NULL.
July 2, 2006 (Changes by Graf Zahl) July 2, 2006 (Changes by Graf Zahl)
- Fixed: G_NewInit destroyed the players' userinfo data. - Fixed: G_NewInit destroyed the players' userinfo data.
- Changed the special radius damage handling for the barrel and boss brain - Changed the special radius damage handling for the barrel and boss brain

View file

@ -186,7 +186,9 @@ void AClericPlayer::SpecialInvulnerabilityHandling (EInvulState state, fixed_t *
// Cleric Weapon Base Class ------------------------------------------------- // Cleric Weapon Base Class -------------------------------------------------
IMPLEMENT_ABSTRACT_ACTOR (AClericWeapon) IMPLEMENT_STATELESS_ACTOR (AClericWeapon, Hexen, -1, 0)
PROP_Weapon_Kickback (150)
END_DEFAULTS
bool AClericWeapon::TryPickup (AActor *toucher) bool AClericWeapon::TryPickup (AActor *toucher)
{ {

View file

@ -395,7 +395,9 @@ bool AFighterPlayer::DoHealingRadius (APlayerPawn *other)
// Fighter Weapon Base Class ------------------------------------------------ // Fighter Weapon Base Class ------------------------------------------------
IMPLEMENT_ABSTRACT_ACTOR (AFighterWeapon) IMPLEMENT_STATELESS_ACTOR (AFighterWeapon, Hexen, -1, 0)
PROP_Weapon_Kickback (150)
END_DEFAULTS
bool AFighterWeapon::TryPickup (AActor *toucher) bool AFighterWeapon::TryPickup (AActor *toucher)
{ {

View file

@ -192,7 +192,9 @@ void AMagePlayer::SpecialInvulnerabilityHandling (EInvulState state, fixed_t * p
// Mage Weapon Base Class --------------------------------------------------- // Mage Weapon Base Class ---------------------------------------------------
IMPLEMENT_ABSTRACT_ACTOR (AMageWeapon) IMPLEMENT_STATELESS_ACTOR (AMageWeapon, Hexen, -1, 0)
PROP_Weapon_Kickback (150)
END_DEFAULTS
bool AMageWeapon::TryPickup (AActor *toucher) bool AMageWeapon::TryPickup (AActor *toucher)
{ {

View file

@ -149,8 +149,8 @@ bool AWeapon::PickupForAmmo (AWeapon *ownedWeapon)
// Don't take ammo if the weapon sticks around. // Don't take ammo if the weapon sticks around.
if (!ShouldStay ()) if (!ShouldStay ())
{ {
gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1); if (AmmoGive1 > 0) gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1);
gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2); if (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
} }
return gotstuff; return gotstuff;
} }

View file

@ -1115,7 +1115,7 @@ void FBaseStatusBar::Draw (EHudState state)
if (viewactive) if (viewactive)
{ {
if (CPlayer && CPlayer->camera->player) if (CPlayer && CPlayer->camera && CPlayer->camera->player)
{ {
DrawCrosshair (); DrawCrosshair ();
} }

View file

@ -277,7 +277,6 @@ void A_Beacon (AActor *self)
{ {
AActor *owner = self->target; AActor *owner = self->target;
ARebel *rebel; ARebel *rebel;
int friendNum;
angle_t an; angle_t an;
rebel = Spawn<ARebel1> (self->x, self->y, ONFLOORZ); rebel = Spawn<ARebel1> (self->x, self->y, ONFLOORZ);
@ -290,8 +289,6 @@ void A_Beacon (AActor *self)
self->flags &= ~MF_SPECIAL; self->flags &= ~MF_SPECIAL;
static_cast<AInventory *>(self)->DropTime = 0; static_cast<AInventory *>(self)->DropTime = 0;
// Set up the new rebel. // Set up the new rebel.
friendNum = owner->player != NULL ? int(owner->player - players + 1) : 0;
rebel->FriendPlayer = friendNum;
rebel->threshold = 100; rebel->threshold = 100;
rebel->target = NULL; rebel->target = NULL;
rebel->flags4 |= MF4_INCOMBAT; rebel->flags4 |= MF4_INCOMBAT;
@ -304,16 +301,15 @@ void A_Beacon (AActor *self)
{ {
// Rebels are the same color as their owner // Rebels are the same color as their owner
rebel->Translation = owner->Translation; rebel->Translation = owner->Translation;
rebel->FriendPlayer = owner->player != NULL ? int(owner->player - players + 1) : 0;
// Set the rebel's target to whatever last hurt the player, so long as it's not // Set the rebel's target to whatever last hurt the player, so long as it's not
// one of the player's other rebels. // one of the player's other rebels.
if (owner->target != NULL && if (owner->target != NULL && !rebel->IsFriend (owner->target))
(!(owner->target->flags & MF_FRIENDLY) ||
owner->target->FriendPlayer == 0 ||
owner->target->FriendPlayer != friendNum))
{ {
rebel->target = owner->target; rebel->target = owner->target;
} }
} }
rebel->SetState (rebel->SeeState); rebel->SetState (rebel->SeeState);
rebel->angle = self->angle; rebel->angle = self->angle;
an = self->angle >> ANGLETOFINESHIFT; an = self->angle >> ANGLETOFINESHIFT;

View file

@ -1214,6 +1214,12 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
FName typeName; FName typeName;
SC_MustGetString(); SC_MustGetString();
char * colon = strchr(sc_String, ':');
if (colon != NULL)
{
*colon++ = 0;
}
if (PClass::FindClass (sc_String) != NULL) if (PClass::FindClass (sc_String) != NULL)
{ {
@ -1226,19 +1232,38 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
if (parentc) if (parentc)
{ {
*parentc = NULL; *parentc = NULL;
SC_MustGetString();
if (SC_Compare(":")) // Do some tweaking so that a definition like 'Actor:Parent' which is read as a single token is recognized as well
// without having resort to C-mode (which disallows periods in actor names.)
if (colon == NULL)
{ {
SC_MustGetString(); SC_MustGetString ();
parent = const_cast<PClass *> (PClass::FindClass (sc_String)); if (sc_String[0]==':')
{
colon = sc_String + 1;
}
}
if (colon != NULL)
{
if (colon[0] == 0)
{
SC_MustGetString ();
colon = sc_String;
}
}
if (colon != NULL)
{
parent = const_cast<PClass *> (PClass::FindClass (colon));
if (parent == NULL) if (parent == NULL)
{ {
SC_ScriptError ("Parent type '%s' not found", sc_String); SC_ScriptError ("Parent type '%s' not found", colon);
} }
else if (parent->ActorInfo == NULL) else if (parent->ActorInfo == NULL)
{ {
SC_ScriptError ("Parent type '%s' is not an actor", sc_String); SC_ScriptError ("Parent type '%s' is not an actor", colon);
} }
else else
{ {
@ -1260,12 +1285,16 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
bag->Info = info; bag->Info = info;
info->DoomEdNum=-1; info->DoomEdNum=-1;
// Now, after the actor names have been parsed, it is time to switch to C-mode
// for the rest of the actor definition.
SC_SetCMode (true);
if (SC_CheckNumber()) if (SC_CheckNumber())
{ {
if (sc_Number>=-1 && sc_Number<32768) info->DoomEdNum=sc_Number; if (sc_Number>=-1 && sc_Number<32768) info->DoomEdNum = sc_Number;
else SC_ScriptError ("DoomEdNum must be in the range [-1,32767]"); else SC_ScriptError ("DoomEdNum must be in the range [-1,32767]");
} }
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon))) if (parent == RUNTIME_CLASS(AWeapon))
{ {
// preinitialize kickback to the default for the game // preinitialize kickback to the default for the game
((AWeapon*)(info->Class->Defaults))->Kickback=gameinfo.defKickback; ((AWeapon*)(info->Class->Defaults))->Kickback=gameinfo.defKickback;
@ -2148,7 +2177,6 @@ void ProcessActor(void (*process)(FState *, int))
{ {
FActorInfo * parent; FActorInfo * parent;
SC_SetCMode (true);
info=CreateNewActor(&parent, &bag); info=CreateNewActor(&parent, &bag);
defaults=(AActor*)info->Class->Defaults; defaults=(AActor*)info->Class->Defaults;