mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- Fixed: The correct player class was not remembered when the menu had both
a player class selection menu and an episode menu. - Fixed: AddToConsole could write outside its working buffer. - Fixed: 0 was no longer recognized as placeholder for 'no state' in A_Chase. - Fixed: When picking up weapons the code did not check if it should switch away from weak weapons. SVN r1332 (trunk)
This commit is contained in:
parent
a66eb7f8c3
commit
37d056c041
8 changed files with 73 additions and 16 deletions
|
@ -1,3 +1,11 @@
|
|||
December 27, 2008 (Changes by Graf Zahl)
|
||||
- Fixed: The correct player class was not remembered when the menu had both
|
||||
a player class selection menu and an episode menu.
|
||||
- Fixed: AddToConsole could write outside its working buffer.
|
||||
- Fixed: 0 was no longer recognized as placeholder for 'no state' in A_Chase.
|
||||
- Fixed: When picking up weapons the code did not check if it should switch away
|
||||
from weak weapons.
|
||||
|
||||
December 20, 2008
|
||||
- OggMod improperly decodes the right channel of stereo samples when sending
|
||||
them to OggEnc, so I have no choice but to convert them to mono by chopping
|
||||
|
|
|
@ -667,7 +667,7 @@ void AddToConsole (int printlevel, const char *text)
|
|||
}
|
||||
|
||||
len = (int)strlen (text);
|
||||
size = len + 3;
|
||||
size = len + 20;
|
||||
|
||||
if (addtype != NEWLINE)
|
||||
{
|
||||
|
@ -767,6 +767,15 @@ void AddToConsole (int printlevel, const char *text)
|
|||
if (*work_p)
|
||||
{
|
||||
linestart = work_p - 1 - cc.Len();
|
||||
if (linestart < work)
|
||||
{
|
||||
// The line start is outside the buffer.
|
||||
// Make space for the newly inserted stuff.
|
||||
size_t movesize = work-linestart;
|
||||
memmove(work + movesize, work, strlen(work));
|
||||
work_p += movesize;
|
||||
linestart = work;
|
||||
}
|
||||
linestart[0] = TEXTCOLOR_ESCAPE;
|
||||
strncpy (linestart + 1, cc, cc.Len());
|
||||
}
|
||||
|
|
|
@ -80,8 +80,9 @@ public:
|
|||
virtual void TweakSpeeds (int &forwardmove, int &sidemove);
|
||||
virtual void MorphPlayerThink ();
|
||||
virtual void ActivateMorphWeapon ();
|
||||
virtual AWeapon *PickNewWeapon (const PClass *ammotype);
|
||||
virtual AWeapon *BestWeapon (const PClass *ammotype);
|
||||
AWeapon *PickNewWeapon (const PClass *ammotype);
|
||||
AWeapon *BestWeapon (const PClass *ammotype);
|
||||
void CheckWeaponSwitch(const PClass *ammotype);
|
||||
virtual void GiveDeathmatchInventory ();
|
||||
virtual void FilterCoopRespawnInventory (APlayerPawn *oldplayer);
|
||||
|
||||
|
|
|
@ -96,18 +96,9 @@ bool AAmmo::HandlePickup (AInventory *item)
|
|||
|
||||
assert (Owner != NULL);
|
||||
|
||||
if (oldamount == 0 && Owner != NULL && Owner->player != NULL &&
|
||||
!Owner->player->userinfo.neverswitch &&
|
||||
Owner->player->PendingWeapon == WP_NOCHANGE &&
|
||||
(Owner->player->ReadyWeapon == NULL ||
|
||||
(Owner->player->ReadyWeapon->WeaponFlags & WIF_WIMPY_WEAPON)))
|
||||
if (oldamount == 0 && Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
AWeapon *best = barrier_cast<APlayerPawn *>(Owner)->BestWeapon (GetClass());
|
||||
if (best != NULL && (Owner->player->ReadyWeapon == NULL ||
|
||||
best->SelectionOrder < Owner->player->ReadyWeapon->SelectionOrder))
|
||||
{
|
||||
Owner->player->PendingWeapon = best;
|
||||
}
|
||||
barrier_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(GetClass());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -158,8 +158,17 @@ bool AWeapon::PickupForAmmo (AWeapon *ownedWeapon)
|
|||
// Don't take ammo if the weapon sticks around.
|
||||
if (!ShouldStay ())
|
||||
{
|
||||
int oldamount = 0;
|
||||
if (ownedWeapon->Ammo1 != NULL) oldamount = ownedWeapon->Ammo1->Amount;
|
||||
|
||||
if (AmmoGive1 > 0) gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1);
|
||||
if (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
|
||||
|
||||
AActor *Owner = ownedWeapon->Owner;
|
||||
if (gotstuff && oldamount == 0 && Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo1->GetClass());
|
||||
}
|
||||
}
|
||||
return gotstuff;
|
||||
}
|
||||
|
|
|
@ -267,6 +267,8 @@ static FSaveGameNode NewSaveNode;
|
|||
|
||||
static int epi; // Selected episode
|
||||
|
||||
static const char *saved_playerclass = NULL;
|
||||
|
||||
// PRIVATE MENU DEFINITIONS ------------------------------------------------
|
||||
|
||||
//
|
||||
|
@ -1821,15 +1823,18 @@ void M_Episode (int choice)
|
|||
|
||||
if (AllSkills.Size() == 1)
|
||||
{
|
||||
saved_playerclass = NULL;
|
||||
M_ChooseSkill(0);
|
||||
return;
|
||||
}
|
||||
else if (EpisodeNoSkill[choice])
|
||||
{
|
||||
saved_playerclass = NULL;
|
||||
M_ChooseSkill(AllSkills.Size() == 2? 1:2);
|
||||
return;
|
||||
}
|
||||
M_StartupSkillMenu(NULL);
|
||||
M_StartupSkillMenu(saved_playerclass);
|
||||
saved_playerclass = NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1856,6 +1861,7 @@ static void SCClass (int option)
|
|||
|
||||
if (EpiDef.numitems > 1)
|
||||
{
|
||||
saved_playerclass = playerclass;
|
||||
M_SetupNextMenu (&EpiDef);
|
||||
}
|
||||
else if (AllSkills.Size() == 1)
|
||||
|
@ -1888,6 +1894,7 @@ static void M_ChooseClass (int choice)
|
|||
|
||||
if (EpiDef.numitems > 1)
|
||||
{
|
||||
saved_playerclass = playerclass;
|
||||
M_SetupNextMenu (&EpiDef);
|
||||
}
|
||||
else if (AllSkills.Size() == 1)
|
||||
|
|
|
@ -680,6 +680,31 @@ AWeapon *APlayerPawn::PickNewWeapon (const PClass *ammotype)
|
|||
return best;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APlayerPawn :: CheckWeaponSwitch
|
||||
//
|
||||
// Checks if weapons should be changed after picking up ammo
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APlayerPawn::CheckWeaponSwitch(const PClass *ammotype)
|
||||
{
|
||||
if (!player->userinfo.neverswitch &&
|
||||
player->PendingWeapon == WP_NOCHANGE &&
|
||||
(player->ReadyWeapon == NULL ||
|
||||
(player->ReadyWeapon->WeaponFlags & WIF_WIMPY_WEAPON)))
|
||||
{
|
||||
AWeapon *best = BestWeapon (ammotype);
|
||||
if (best != NULL && (player->ReadyWeapon == NULL ||
|
||||
best->SelectionOrder < player->ReadyWeapon->SelectionOrder))
|
||||
{
|
||||
player->PendingWeapon = best;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APlayerPawn :: GiveDeathmatchInventory
|
||||
|
|
|
@ -325,7 +325,14 @@ do_stop:
|
|||
sc.ScriptError("Negative jump offsets are not allowed");
|
||||
}
|
||||
|
||||
x = new FxStateByIndex(bag.statedef.GetStateCount() + v, sc);
|
||||
if (x > 0)
|
||||
{
|
||||
x = new FxStateByIndex(bag.statedef.GetStateCount() + v, sc);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = new FxConstant((FState*)NULL, sc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue