Merge remote-tracking branch 'remotes/zdoom/master'

Conflicts:
	src/posix/sdl/hardware.cpp
This commit is contained in:
Christoph Oelckers 2015-02-07 14:29:31 +01:00
commit e846d06a9f
20 changed files with 200 additions and 80 deletions

View file

@ -951,7 +951,7 @@ void NetUpdate (void)
newtics = nowtime - gametime; newtics = nowtime - gametime;
gametime = nowtime; gametime = nowtime;
if (newtics <= 0 || pauseext) // nothing new to update or window paused if (newtics <= 0) // nothing new to update
{ {
GetPackets (); GetPackets ();
return; return;
@ -1810,6 +1810,7 @@ void TryRunTics (void)
// If paused, do not eat more CPU time than we need, because it // If paused, do not eat more CPU time than we need, because it
// will all be wasted anyway. // will all be wasted anyway.
if (pauseext) r_NoInterpolate = true;
bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/; bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/;
// get real tics // get real tics
@ -1934,7 +1935,7 @@ void TryRunTics (void)
C_Ticker (); C_Ticker ();
M_Ticker (); M_Ticker ();
I_GetTime (true); I_GetTime (true);
G_Ticker (); if (!pauseext) G_Ticker();
gametic++; gametic++;
NetUpdate (); // check for new console commands NetUpdate (); // check for new console commands

View file

@ -301,14 +301,14 @@ void APathFollower::Tick ()
bJustStepped = false; bJustStepped = false;
if (CurrNode->args[2]) if (CurrNode->args[2])
{ {
HoldTime = gametic + CurrNode->args[2] * TICRATE / 8; HoldTime = level.time + CurrNode->args[2] * TICRATE / 8;
x = CurrNode->x; x = CurrNode->x;
y = CurrNode->y; y = CurrNode->y;
z = CurrNode->z; z = CurrNode->z;
} }
} }
if (HoldTime > gametic) if (HoldTime > level.time)
return; return;
// Splines must have a previous node. // Splines must have a previous node.

View file

@ -1372,6 +1372,8 @@ bool AInventory::TryPickupRestricted (AActor *&toucher)
bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return) 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. // unmorphed versions of a currently morphed actor cannot pick up anything.
if (toucher->flags & MF_UNMORPHED) return false; if (toucher->flags & MF_UNMORPHED) return false;
@ -1392,7 +1394,27 @@ bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
GoAwayAndDie(); 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; return res;
} }

View file

@ -136,7 +136,7 @@ enum
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen 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_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop)
IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag 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
}; };

View file

@ -1280,8 +1280,8 @@ public:
// We can't use DTA_HUDRules since it forces a width and height. // We can't use DTA_HUDRules since it forces a width and height.
// Translation: No high res. // Translation: No high res.
bool xright = *x < 0; bool xright = *x < 0 && !x.RelCenter();
bool ybot = *y < 0; bool ybot = *y < 0 && !y.RelCenter();
w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth); w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth);
h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight); h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight);

View file

@ -30,7 +30,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
thrust.Z = float(target->z - victim->z); thrust.Z = float(target->z - victim->z);
thrust.MakeUnit(); thrust.MakeUnit();
thrust *= float((255*50*FRACUNIT) / (victim->Mass ? target->Mass : 1)); thrust *= float((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
victim->velx += fixed_t(thrust.X); victim->velx += fixed_t(thrust.X);
victim->vely += fixed_t(thrust.Y); victim->vely += fixed_t(thrust.Y);

View file

@ -196,9 +196,9 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller)
--mDesc->mSelectedItem; --mDesc->mSelectedItem;
if (mDesc->mScrollPos > 0 && 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) if (mDesc->mSelectedItem < 0)

View file

@ -2721,7 +2721,14 @@ void A_Chase(AActor *self)
// A_FaceTracer // A_FaceTracer
// //
//============================================================================= //=============================================================================
void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch) enum FAF_Flags
{
FAF_BOTTOM = 1,
FAF_MIDDLE = 2,
FAF_TOP = 4,
FAF_NODISTFACTOR = 8,
};
void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{ {
if (!other) if (!other)
return; return;
@ -2744,28 +2751,28 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
{ {
if (self->angle - other_angle < ANGLE_180) if (self->angle - other_angle < ANGLE_180)
{ {
self->angle -= max_turn; self->angle -= max_turn + ang_offset;
} }
else else
{ {
self->angle += max_turn; self->angle += max_turn + ang_offset;
} }
} }
else else
{ {
if (other_angle - self->angle < ANGLE_180) if (other_angle - self->angle < ANGLE_180)
{ {
self->angle += max_turn; self->angle += max_turn + ang_offset;
} }
else else
{ {
self->angle -= max_turn; self->angle -= max_turn + ang_offset;
} }
} }
} }
else else
{ {
self->angle = other_angle; self->angle = other_angle + ang_offset;
} }
// [DH] Now set pitch. In order to maintain compatibility, this can be // [DH] Now set pitch. In order to maintain compatibility, this can be
@ -2776,20 +2783,33 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
// result is only used in a ratio. // result is only used in a ratio.
double dist_x = other->x - self->x; double dist_x = other->x - self->x;
double dist_y = other->y - self->y; double dist_y = other->y - self->y;
// Positioning ala missile spawning, 32 units above foot level // Positioning ala missile spawning, 32 units above foot level
fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset(); fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset(); fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset();
// If the target z is above the target's head, reposition to the middle of // If the target z is above the target's head, reposition to the middle of
// its body. // its body.
if (target_z >= other->z + other->height) if (target_z >= other->z + other->height)
{ {
target_z = other->z + other->height / 2; target_z = other->z + (other->height / 2);
} }
//Note there is no +32*FRACUNIT on purpose. This is for customization sake.
//If one doesn't want this behavior, just don't use FAF_BOTTOM.
if (flags & FAF_BOTTOM)
target_z = other->z + other->GetBobOffset();
if (flags & FAF_MIDDLE)
target_z = other->z + (other->height / 2) + other->GetBobOffset();
if (flags & FAF_TOP)
target_z = other->z + (other->height) + other->GetBobOffset();
if (!flags & FAF_NODISTFACTOR)
target_z += pitch_offset;
double dist_z = target_z - source_z; double dist_z = target_z - source_z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z); double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / dist)); int other_pitch = (int)rad2bam(asin(dist_z / dist));
if (max_pitch != 0) if (max_pitch != 0)
{ {
if (self->pitch > other_pitch) if (self->pitch > other_pitch)
@ -2807,7 +2827,11 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
{ {
self->pitch = other_pitch; self->pitch = other_pitch;
} }
if (flags & FAF_NODISTFACTOR)
self->pitch += pitch_offset;
} }
// This will never work well if the turn angle is limited. // This will never work well if the turn angle is limited.
if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) ) if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) )
@ -2816,46 +2840,55 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
} }
} }
void A_FaceTarget (AActor *self, angle_t max_turn, angle_t max_pitch) void A_FaceTarget(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{ {
A_Face(self, self->target, max_turn, max_pitch); A_Face(self, self->target, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
void A_FaceMaster (AActor *self, angle_t max_turn, angle_t max_pitch) void A_FaceMaster(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{ {
A_Face(self, self->master, max_turn, max_pitch); A_Face(self, self->master, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
void A_FaceTracer (AActor *self, angle_t max_turn, angle_t max_pitch) void A_FaceTracer(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{ {
A_Face(self, self->tracer, max_turn, max_pitch); A_Face(self, self->tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
{ {
ACTION_PARAM_START(2); ACTION_PARAM_START(5);
ACTION_PARAM_ANGLE(max_turn, 0); ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1); ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
A_FaceTarget(self, max_turn, max_pitch); A_FaceTarget(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster)
{ {
ACTION_PARAM_START(2); ACTION_PARAM_START(5);
ACTION_PARAM_ANGLE(max_turn, 0); ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1); ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
A_FaceMaster(self, max_turn, max_pitch); A_FaceMaster(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer)
{ {
ACTION_PARAM_START(2); ACTION_PARAM_START(5);
ACTION_PARAM_ANGLE(max_turn, 0); ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1); ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
A_FaceTracer(self, max_turn, max_pitch); A_FaceTracer(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
} }
//=========================================================================== //===========================================================================

View file

@ -72,8 +72,8 @@ DECLARE_ACTION(A_FreezeDeathChunks)
DECLARE_ACTION(A_BossDeath) DECLARE_ACTION(A_BossDeath)
void A_Chase(AActor *self); void A_Chase(AActor *self);
void A_FaceTarget(AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270); void A_FaceTarget(AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0);
void A_Face(AActor *self, AActor *other, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270); void A_Face(AActor *self, AActor *other, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0);
bool A_RaiseMobj (AActor *, fixed_t speed); bool A_RaiseMobj (AActor *, fixed_t speed);
bool A_SinkMobj (AActor *, fixed_t speed); bool A_SinkMobj (AActor *, fixed_t speed);

View file

@ -587,6 +587,7 @@ void AActor::RemoveInventory (AInventory *item)
*invp = item->Inventory; *invp = item->Inventory;
item->DetachFromOwner (); item->DetachFromOwner ();
item->Owner = NULL; item->Owner = NULL;
item->Inventory = NULL;
break; break;
} }
} }
@ -1968,8 +1969,6 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
// Don't change the angle if there's THRUREFLECT on the monster. // Don't change the angle if there's THRUREFLECT on the monster.
if (!(BlockingMobj->flags7 & MF7_THRUREFLECT)) if (!(BlockingMobj->flags7 & MF7_THRUREFLECT))
{ {
//int dir;
//angle_t delta;
angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y); angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y);
bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle)); bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle));
// Change angle for deflection/reflection // Change angle for deflection/reflection
@ -1996,12 +1995,21 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
} }
else else
{ {
if (BlockingMobj->flags7 & MF7_MIRRORREFLECT && (tg || blockingtg))
mo->angle = angle; {
angle >>= ANGLETOFINESHIFT; mo->angle += ANGLE_180;
mo->velx = FixedMul(mo->Speed >> 1, finecosine[angle]); mo->velx = -mo->velx / 2;
mo->vely = FixedMul(mo->Speed >> 1, finesine[angle]); mo->vely = -mo->vely / 2;
mo->velz = -mo->velz / 2; mo->velz = -mo->velz / 2;
}
else
{
mo->angle = angle;
angle >>= ANGLETOFINESHIFT;
mo->velx = FixedMul(mo->Speed >> 1, finecosine[angle]);
mo->vely = FixedMul(mo->Speed >> 1, finesine[angle]);
mo->velz = -mo->velz / 2;
}
} }
} }
else else
@ -2932,11 +2940,8 @@ bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle)
{ {
if (flags2 & MF2_DONTREFLECT) return true; if (flags2 & MF2_DONTREFLECT) return true;
if (thing->flags7 & MF7_THRUREFLECT) return false; if (thing->flags7 & MF7_THRUREFLECT) return false;
if (thing->flags7 & MF7_MIRRORREFLECT)
angle += ANGLE_180;
// Change angle for reflection // Change angle for reflection
else if (thing->flags4&MF4_SHIELDREFLECT) if (thing->flags4&MF4_SHIELDREFLECT)
{ {
// Shield reflection (from the Centaur // Shield reflection (from the Centaur
if (abs (angle - thing->angle)>>24 > 45) if (abs (angle - thing->angle)>>24 > 45)
@ -2959,15 +2964,23 @@ bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle)
else else
angle -= ANG45; angle -= ANG45;
} }
else if (thing->flags7 & MF7_AIMREFLECT) else
{
angle += ANGLE_1 * ((pr_reflect() % 16) - 8);
}
//Always check for AIMREFLECT, no matter what else is checked above.
if (thing->flags7 & MF7_AIMREFLECT)
{ {
if (this->target != NULL) if (this->target != NULL)
{
A_Face(this, this->target); A_Face(this, this->target);
}
else if (thing->target != NULL) else if (thing->target != NULL)
{
A_Face(this, thing->target); A_Face(this, thing->target);
}
} }
else
angle += ANGLE_1 * ((pr_reflect()%16)-8);
return false; return false;
} }

View file

@ -676,7 +676,7 @@ void DPolyDoor::Tick ()
break; break;
case PODOOR_SWING: case PODOOR_SWING:
if (poly->RotatePolyobj (m_Speed)) if (m_Dist <= 0 || poly->RotatePolyobj (m_Speed))
{ {
absSpeed = abs (m_Speed); absSpeed = abs (m_Speed);
if (m_Dist == -1) if (m_Dist == -1)

View file

@ -99,10 +99,20 @@ void I_ShutdownGraphics ()
} }
if (Video) if (Video)
delete Video, Video = NULL; delete Video, Video = NULL;
SDL_QuitSubSystem (SDL_INIT_VIDEO);
} }
void I_InitGraphics () 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; UCVarValue val;
val.Bool = !!Args->CheckParm ("-devparm"); val.Bool = !!Args->CheckParm ("-devparm");

View file

@ -1,4 +1,4 @@
#include <SDL_joystick.h> #include <SDL.h>
#include "doomdef.h" #include "doomdef.h"
#include "templates.h" #include "templates.h"
@ -266,11 +266,16 @@ static SDLInputJoystickManager *JoystickManager;
void I_StartupJoysticks() void I_StartupJoysticks()
{ {
JoystickManager = new SDLInputJoystickManager(); if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
JoystickManager = new SDLInputJoystickManager();
} }
void I_ShutdownJoysticks() void I_ShutdownJoysticks()
{ {
delete JoystickManager; if(JoystickManager)
{
delete JoystickManager;
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
} }
void I_GetJoysticks(TArray<IJoystickConfig *> &sticks) void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)

View file

@ -265,14 +265,13 @@ int main (int argc, char **argv)
setlocale (LC_ALL, "C"); 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()); fprintf (stderr, "Could not initialize SDL:\n%s\n", SDL_GetError());
return -1; return -1;
} }
atterm (SDL_Quit); atterm (SDL_Quit);
printf("Using video driver %s\n", SDL_GetCurrentVideoDriver());
printf("\n"); printf("\n");
try try

View file

@ -195,6 +195,9 @@ fixed_t I_GetTimeFrac (uint32 *ms)
void I_InitTimer () 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_GetTime = I_GetTimeSelect;
I_WaitForTic = I_WaitForTicSelect; I_WaitForTic = I_WaitForTicSelect;
I_FreezeTime = I_FreezeTimeSelect; I_FreezeTime = I_FreezeTimeSelect;
@ -202,5 +205,5 @@ void I_InitTimer ()
void I_ShutdownTimer () void I_ShutdownTimer ()
{ {
SDL_QuitSubSystem(SDL_INIT_TIMER);
} }

View file

@ -581,9 +581,18 @@ void FWadFile::SkinHack ()
namespc++; namespc++;
} }
} }
if (lump->Name[0] == 'M' && if ((lump->Name[0] == 'M' &&
lump->Name[1] == 'A' && lump->Name[1] == 'A' &&
lump->Name[2] == 'P') lump->Name[2] == 'P' &&
lump->Name[3] >= '0' && lump->Name[3] <= '9' &&
lump->Name[4] >= '0' && lump->Name[4] <= '9' &&
lump->Name[5] >= '\0')
||
(lump->Name[0] == 'E' &&
lump->Name[1] >= '0' && lump->Name[1] <= '9' &&
lump->Name[2] == 'M' &&
lump->Name[3] >= '0' && lump->Name[3] <= '9' &&
lump->Name[4] >= '\0'))
{ {
hasmap = true; hasmap = true;
} }

View file

@ -1670,14 +1670,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
// //
//=========================================================================== //===========================================================================
static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO) static void DoGiveInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO)
{ {
ACTION_PARAM_START(3); ACTION_PARAM_START(2+use_aaptr);
ACTION_PARAM_CLASS(mi, 0); ACTION_PARAM_CLASS(mi, 0);
ACTION_PARAM_INT(amount, 1); ACTION_PARAM_INT(amount, 1);
ACTION_PARAM_INT(setreceiver, 2);
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); if (use_aaptr)
{
ACTION_PARAM_INT(setreceiver, 2);
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
}
bool res=true; bool res=true;
@ -1685,6 +1688,11 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
if (mi) if (mi)
{ {
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE)); AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE));
if (!item)
{
ACTION_SET_RESULT(false);
return;
}
if (item->IsKindOf(RUNTIME_CLASS(AHealth))) if (item->IsKindOf(RUNTIME_CLASS(AHealth)))
{ {
item->Amount *= amount; item->Amount *= amount;
@ -1709,12 +1717,12 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
{ {
DoGiveInventory(self, PUSH_PARAMINFO); DoGiveInventory(self, true, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
{ {
DoGiveInventory(self->target, PUSH_PARAMINFO); DoGiveInventory(self->target, true, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
@ -1724,7 +1732,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self) DoGiveInventory(mo, PUSH_PARAMINFO); if (mo->master == self) DoGiveInventory(mo, false, PUSH_PARAMINFO);
} }
} }
@ -1737,7 +1745,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings)
{ {
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self->master && mo != self) DoGiveInventory(mo, PUSH_PARAMINFO); if (mo->master == self->master && mo != self) DoGiveInventory(mo, false, PUSH_PARAMINFO);
} }
} }
} }
@ -1753,16 +1761,23 @@ enum
TIF_NOTAKEINFINITE = 1, TIF_NOTAKEINFINITE = 1,
}; };
void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO) void DoTakeInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO)
{ {
ACTION_PARAM_START(4); ACTION_PARAM_START(3+use_aaptr);
ACTION_PARAM_CLASS(item, 0); ACTION_PARAM_CLASS(item, 0);
ACTION_PARAM_INT(amount, 1); ACTION_PARAM_INT(amount, 1);
ACTION_PARAM_INT(flags, 2); ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_INT(setreceiver, 3);
if (!item) return; if (!item)
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); {
ACTION_SET_RESULT(false);
return;
}
if (use_aaptr)
{
ACTION_PARAM_INT(setreceiver, 3);
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
}
bool res = false; bool res = false;
@ -1794,12 +1809,12 @@ void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
{ {
DoTakeInventory(self, PUSH_PARAMINFO); DoTakeInventory(self, true, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
{ {
DoTakeInventory(self->target, PUSH_PARAMINFO); DoTakeInventory(self->target, true, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
@ -1809,7 +1824,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self) DoTakeInventory(mo, PUSH_PARAMINFO); if (mo->master == self) DoTakeInventory(mo, false, PUSH_PARAMINFO);
} }
} }
@ -1822,7 +1837,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings)
{ {
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self->master && mo != self) DoTakeInventory(mo, PUSH_PARAMINFO); if (mo->master == self->master && mo != self) DoTakeInventory(mo, false, PUSH_PARAMINFO);
} }
} }
} }

View file

@ -324,6 +324,7 @@ static FFlagDef InventoryFlags[] =
DEFINE_FLAG(IF, NOSCREENFLASH, AInventory, ItemFlags), DEFINE_FLAG(IF, NOSCREENFLASH, AInventory, ItemFlags),
DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags), DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags),
DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags), DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags),
DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH), DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),}; DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),};

View file

@ -82,9 +82,9 @@ ACTOR Actor native //: Thinker
action native A_XScream(); action native A_XScream();
action native A_Look(); action native A_Look();
action native A_Chase(state melee = "*", state missile = "none", int flags = 0); action native A_Chase(state melee = "*", state missile = "none", int flags = 0);
action native A_FaceTarget(float max_turn = 0, float max_pitch = 270); action native A_FaceTarget(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0);
action native A_FaceTracer(float max_turn = 0, float max_pitch = 270); action native A_FaceTracer(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0);
action native A_FaceMaster(float max_turn = 0, float max_pitch = 270); action native A_FaceMaster(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0);
action native A_PosAttack(); action native A_PosAttack();
action native A_Scream(); action native A_Scream();
action native A_SPosAttack(); action native A_SPosAttack();

View file

@ -447,6 +447,15 @@ enum
FTF_CLAMP = 1 << 1, FTF_CLAMP = 1 << 1,
}; };
// Flags for A_Face*
enum
{
FAF_BOTTOM = 1,
FAF_MIDDLE = 2,
FAF_TOP = 4,
FAF_NODISTFACTOR = 8,
};
// This is only here to provide one global variable for testing. // This is only here to provide one global variable for testing.
native int testglobalvar; native int testglobalvar;