mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Merge branch 'Inventory.Transfer-flag' of https://github.com/Edward850/zdoom
This commit is contained in:
commit
2d4299608c
9 changed files with 51 additions and 10 deletions
|
@ -1372,6 +1372,8 @@ bool AInventory::TryPickupRestricted (AActor *&toucher)
|
|||
|
||||
bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
|
||||
{
|
||||
TObjPtr<AInventory> Invstack = Inventory; // A pointer of the inventories item stack.
|
||||
|
||||
// unmorphed versions of a currently morphed actor cannot pick up anything.
|
||||
if (toucher->flags & MF_UNMORPHED) return false;
|
||||
|
||||
|
@ -1392,7 +1394,27 @@ bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
|
|||
GoAwayAndDie();
|
||||
}
|
||||
|
||||
if (res) GiveQuest(toucher);
|
||||
if (res)
|
||||
{
|
||||
GiveQuest(toucher);
|
||||
|
||||
// Transfer all inventory accross that the old object had, if requested.
|
||||
if ((ItemFlags & IF_TRANSFER))
|
||||
{
|
||||
while (Invstack)
|
||||
{
|
||||
AInventory* titem = Invstack;
|
||||
Invstack = titem->Inventory;
|
||||
if (titem->Owner == this)
|
||||
{
|
||||
if (!titem->CallTryPickup(toucher)) // The object no longer can exist
|
||||
{
|
||||
titem->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ enum
|
|||
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen
|
||||
IF_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop)
|
||||
IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag
|
||||
|
||||
IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -196,9 +196,9 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
--mDesc->mSelectedItem;
|
||||
|
||||
if (mDesc->mScrollPos > 0 &&
|
||||
mDesc->mSelectedItem == mDesc->mScrollTop + mDesc->mScrollPos)
|
||||
mDesc->mSelectedItem <= mDesc->mScrollTop + mDesc->mScrollPos)
|
||||
{
|
||||
mDesc->mScrollPos--;
|
||||
mDesc->mScrollPos = MAX(mDesc->mSelectedItem - mDesc->mScrollTop - 1, 0);
|
||||
}
|
||||
|
||||
if (mDesc->mSelectedItem < 0)
|
||||
|
|
|
@ -587,6 +587,7 @@ void AActor::RemoveInventory (AInventory *item)
|
|||
*invp = item->Inventory;
|
||||
item->DetachFromOwner ();
|
||||
item->Owner = NULL;
|
||||
item->Inventory = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,10 +66,20 @@ void I_ShutdownGraphics ()
|
|||
}
|
||||
if (Video)
|
||||
delete Video, Video = NULL;
|
||||
|
||||
SDL_QuitSubSystem (SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
void I_InitGraphics ()
|
||||
{
|
||||
if (SDL_InitSubSystem (SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
I_FatalError ("Could not initialize SDL video:\n%s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
Printf("Using video driver %s\n", SDL_GetCurrentVideoDriver());
|
||||
|
||||
UCVarValue val;
|
||||
|
||||
val.Bool = !!Args->CheckParm ("-devparm");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <SDL_joystick.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "templates.h"
|
||||
|
@ -266,11 +266,16 @@ static SDLInputJoystickManager *JoystickManager;
|
|||
|
||||
void I_StartupJoysticks()
|
||||
{
|
||||
JoystickManager = new SDLInputJoystickManager();
|
||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
||||
JoystickManager = new SDLInputJoystickManager();
|
||||
}
|
||||
void I_ShutdownJoysticks()
|
||||
{
|
||||
delete JoystickManager;
|
||||
if(JoystickManager)
|
||||
{
|
||||
delete JoystickManager;
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
}
|
||||
}
|
||||
|
||||
void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)
|
||||
|
|
|
@ -265,14 +265,13 @@ int main (int argc, char **argv)
|
|||
|
||||
setlocale (LC_ALL, "C");
|
||||
|
||||
if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE|SDL_INIT_JOYSTICK) == -1)
|
||||
if (SDL_Init (0) < 0)
|
||||
{
|
||||
fprintf (stderr, "Could not initialize SDL:\n%s\n", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
atterm (SDL_Quit);
|
||||
|
||||
printf("Using video driver %s\n", SDL_GetCurrentVideoDriver());
|
||||
printf("\n");
|
||||
|
||||
try
|
||||
|
|
|
@ -195,6 +195,9 @@ fixed_t I_GetTimeFrac (uint32 *ms)
|
|||
|
||||
void I_InitTimer ()
|
||||
{
|
||||
if(SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
|
||||
I_FatalError("Could not initialize SDL timers:\n%s\n", SDL_GetError());
|
||||
|
||||
I_GetTime = I_GetTimeSelect;
|
||||
I_WaitForTic = I_WaitForTicSelect;
|
||||
I_FreezeTime = I_FreezeTimeSelect;
|
||||
|
@ -202,5 +205,5 @@ void I_InitTimer ()
|
|||
|
||||
void I_ShutdownTimer ()
|
||||
{
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_TIMER);
|
||||
}
|
||||
|
|
|
@ -324,6 +324,7 @@ static FFlagDef InventoryFlags[] =
|
|||
DEFINE_FLAG(IF, NOSCREENFLASH, AInventory, ItemFlags),
|
||||
DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags),
|
||||
DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags),
|
||||
DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags),
|
||||
|
||||
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
|
||||
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),};
|
||||
|
|
Loading…
Reference in a new issue