diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 1263b8c05..2df9deed1 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,14 @@ +May 28, 2006 (Changes by Graf Zahl) +- Fixed: Monsters couldn't hurt other monsters of the same species if they + were supposed to hate them. +- Since I was editing the file anyway I added checks for Heretic's and Strife's + damaging floor types to DCajunMaster::IsDangerous. +- Added a NULL pointer check to DCajunMaster::TurnToAng because a crash log + indicated that this can happen. +- Fixed: Strife's energy pod contains 20 units when dropped by monsters. + To achieve this I added an Ammo.DropAmount property because there are + no other means to control this from inside a conversation script. + May 27, 2006 (Changes by Graf Zahl) - Fixed: FString::FormatHelper must not alter the null string. - Fixed: FString::FormatHelper should use ReallocBuffer instead of directly diff --git a/src/b_move.cpp b/src/b_move.cpp index 8b41a43b6..80c8f815e 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -324,21 +324,25 @@ bool DCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm void DCajunMaster::TurnToAng (AActor *actor) { - if (actor->player->ReadyWeapon->WeaponFlags & WIF_BOT_EXPLOSIVE) - { - if (actor->player->t_roam && !actor->player->missile) - { //Keep angle that where when shot where decided. - return; - } - } - int maxturn = MAXTURN; - if(actor->player->enemy) - if(!actor->player->dest) //happens when running after item in combat situations, or normal, prevent's weak turns - if(actor->player->ReadyWeapon->ProjectileType == NULL && !(actor->player->ReadyWeapon->WeaponFlags & WIF_BOT_MELEE)) - if(Check_LOS(actor, actor->player->enemy, SHOOTFOV+5*ANGLE_1)) - maxturn = 3; + if (actor->player->ReadyWeapon != NULL) + { + if (actor->player->ReadyWeapon->WeaponFlags & WIF_BOT_EXPLOSIVE) + { + if (actor->player->t_roam && !actor->player->missile) + { //Keep angle that where when shot where decided. + return; + } + } + + + if(actor->player->enemy) + if(!actor->player->dest) //happens when running after item in combat situations, or normal, prevents weak turns + if(actor->player->ReadyWeapon->ProjectileType == NULL && !(actor->player->ReadyWeapon->WeaponFlags & WIF_BOT_MELEE)) + if(Check_LOS(actor, actor->player->enemy, SHOOTFOV+5*ANGLE_1)) + maxturn = 3; + } int distance = actor->player->angle - actor->angle; @@ -374,6 +378,12 @@ bool DCajunMaster::IsDangerous (sector_t *sec) || special == dDamage_Hellslime || special == dDamage_Nukage || special == dDamage_End - || special == dDamage_SuperHellslime; + || special == dDamage_SuperHellslime + || special == dDamage_LavaWimpy + || special == dDamage_LavaHefty + || special == dScroll_EastLavaDamage + || special == sLight_Strobe_Hurt + || special == Damage_InstantDeath + || special == sDamage_SuperHellslime; } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index d64599516..042c4a855 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -73,6 +73,7 @@ enum AIMETA_BASE = 0x71000, AIMETA_PickupMessage, // string AIMETA_GiveQuest, // optionally give one of the quest items. + AIMETA_DropAmount, // specifies the amount for a dropped ammo item }; enum diff --git a/src/g_strife/a_inquisitor.cpp b/src/g_strife/a_inquisitor.cpp index 61d69f911..2581e0d90 100644 --- a/src/g_strife/a_inquisitor.cpp +++ b/src/g_strife/a_inquisitor.cpp @@ -223,13 +223,13 @@ void A_InquisitorAttack (AActor *self) self->z += 32*FRACBITS; self->angle -= ANGLE_45/32; - proj = P_SpawnMissileZAimed (self, self->z + 32*FRACUNIT, self->target, RUNTIME_CLASS(AInquisitorShot)); + proj = P_SpawnMissileZAimed (self, self->z, self->target, RUNTIME_CLASS(AInquisitorShot)); if (proj != NULL) { proj->momz += 9*FRACUNIT; } self->angle += ANGLE_45/16; - proj = P_SpawnMissileZAimed (self, self->z + 32*FRACUNIT, self->target, RUNTIME_CLASS(AInquisitorShot)); + proj = P_SpawnMissileZAimed (self, self->z, self->target, RUNTIME_CLASS(AInquisitorShot)); if (proj != NULL) { proj->momz += 16*FRACUNIT; diff --git a/src/g_strife/a_strifeammo.cpp b/src/g_strife/a_strifeammo.cpp index ae181b60c..74eadc7a0 100644 --- a/src/g_strife/a_strifeammo.cpp +++ b/src/g_strife/a_strifeammo.cpp @@ -188,6 +188,7 @@ IMPLEMENT_ACTOR (AEnergyPod, Strife, 2047, 75) PROP_Inventory_MaxAmount (400) PROP_Ammo_BackpackAmount (20) PROP_Ammo_BackpackMaxAmount (800) + PROP_Ammo_DropAmount (20) PROP_Inventory_Icon ("I_BRY1") PROP_Tag ("energy_pod") END_DEFAULTS diff --git a/src/info.h b/src/info.h index 3d68dddf5..fdf63075f 100644 --- a/src/info.h +++ b/src/info.h @@ -326,6 +326,7 @@ enum ADEF_Ammo_BackpackAmount, ADEF_Ammo_BackpackMaxAmount, + ADEF_Ammo_DropAmount, ADEF_Weapon_Flags, ADEF_Weapon_FlagsSet, diff --git a/src/infodefaults.cpp b/src/infodefaults.cpp index 7cf75ac2f..8feba61eb 100644 --- a/src/infodefaults.cpp +++ b/src/infodefaults.cpp @@ -273,6 +273,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint) case ADEF_Ammo_BackpackAmount: ammo->BackpackAmount = dataint; break; case ADEF_Ammo_BackpackMaxAmount:ammo->BackpackMaxAmount = dataint; break; + case ADEF_Ammo_DropAmount: sgClass->Meta.SetMetaInt (AIMETA_DropAmount, dataint); case ADEF_Weapon_Flags: weapon->WeaponFlags = dataint; break; case ADEF_Weapon_FlagsSet: weapon->WeaponFlags |= dataint; break; diff --git a/src/infomacros.h b/src/infomacros.h index b781d95ad..efe1ec5e1 100644 --- a/src/infomacros.h +++ b/src/infomacros.h @@ -298,6 +298,7 @@ public: #define PROP_Ammo_BackpackAmount(x) ADD_WORD_PROP(ADEF_Ammo_BackpackAmount,x) #define PROP_Ammo_BackpackMaxAmount(x) ADD_WORD_PROP(ADEF_Ammo_BackpackMaxAmount,x) +#define PROP_Ammo_DropAmount(x) ADD_WORD_PROP(ADEF_Ammo_DropAmount,x) #define PROP_Weapon_Flags(x) ADD_LONG_PROP(ADEF_Weapon_Flags,x) #define PROP_Weapon_FlagsSet(x) ADD_LONG_PROP(ADEF_Weapon_FlagsSet,x) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index f2ccbfd25..2384b806a 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2214,14 +2214,15 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int special, int cha mo->flags &= ~MF_NOGRAVITY; // [RH] Make sure it is affected by gravity if (mo->IsKindOf (RUNTIME_CLASS(AInventory))) { + AInventory * inv = static_cast(mo); if (special > 0) { - static_cast(mo)->Amount = special; + inv->Amount = special; } else if (mo->IsKindOf (RUNTIME_CLASS(AAmmo))) { // Half ammo when dropped by bad guys. - static_cast(mo)->Amount /= 2; + inv->Amount = inv->GetClass()->Meta.GetMetaInt (AIMETA_DropAmount, inv->Amount / 2 ); } else if (mo->IsKindOf (RUNTIME_CLASS(AWeapon))) { @@ -2229,7 +2230,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int special, int cha static_cast(mo)->AmmoGive1 /= 2; static_cast(mo)->AmmoGive2 /= 2; } - if (static_cast(mo)->SpecialDropAction (source)) + if (inv->SpecialDropAction (source)) { return NULL; } diff --git a/src/p_map.cpp b/src/p_map.cpp index e6147c2f6..26d4c776a 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -987,11 +987,15 @@ BOOL PIT_CheckThing (AActor *thing) } if (thing->GetSpecies() == tmthing->target->GetSpecies()) { - // Don't hurt same species or any relative + // Don't hurt same species or any relative - + // but only if the target isn't one's hostile. if (!thing->IsHostile (tmthing->target)) { - // But only if the target isn't one's hostile. - return false; + // Allow hurting monsters the shooter hates. + if (thing->tid == 0 || tmthing->target->tid != thing->tid) + { + return false; + } } } } diff --git a/src/thingdef.cpp b/src/thingdef.cpp index 6da5fa83b..7aedf1405 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -3064,6 +3064,15 @@ static void AmmoBackpackMaxAmount (AAmmo *defaults, Baggage &bag) defaults->BackpackMaxAmount=sc_Number; } +//========================================================================== +// +//========================================================================== +static void AmmoDropAmount (AAmmo *defaults, Baggage &bag) +{ + SC_MustGetNumber(); + bag.Info->Class->Meta.SetMetaInt (AIMETA_DropAmount, sc_Number); +} + //========================================================================== // //========================================================================== @@ -3497,6 +3506,7 @@ static const ActorProps props[] = { "alpha", ActorAlpha, RUNTIME_CLASS(AActor) }, { "ammo.backpackamount", (apf)AmmoBackpackAmount, RUNTIME_CLASS(AAmmo) }, { "ammo.backpackmaxamount", (apf)AmmoBackpackMaxAmount, RUNTIME_CLASS(AAmmo) }, + { "ammo.dropamount", (apf)AmmoDropAmount, RUNTIME_CLASS(AAmmo) }, { "armor.maxsaveamount", (apf)ArmorMaxSaveAmount, RUNTIME_CLASS(ABasicArmorBonus) }, { "armor.saveamount", (apf)ArmorSaveAmount, RUNTIME_CLASS(AActor) }, { "armor.savepercent", (apf)ArmorSavePercent, RUNTIME_CLASS(AActor) },