diff --git a/src/d_net.cpp b/src/d_net.cpp index b3e70d410..a2a60a2d9 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -951,7 +951,7 @@ void NetUpdate (void) newtics = nowtime - gametime; gametime = nowtime; - if (newtics <= 0 || pauseext) // nothing new to update or window paused + if (newtics <= 0) // nothing new to update { GetPackets (); return; @@ -1810,6 +1810,7 @@ void TryRunTics (void) // If paused, do not eat more CPU time than we need, because it // will all be wasted anyway. + if (pauseext) r_NoInterpolate = true; bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/; // get real tics @@ -1934,7 +1935,7 @@ void TryRunTics (void) C_Ticker (); M_Ticker (); I_GetTime (true); - G_Ticker (); + if (!pauseext) G_Ticker(); gametic++; NetUpdate (); // check for new console commands diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index e3db71ff3..83d0d4695 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -301,14 +301,14 @@ void APathFollower::Tick () bJustStepped = false; if (CurrNode->args[2]) { - HoldTime = gametic + CurrNode->args[2] * TICRATE / 8; + HoldTime = level.time + CurrNode->args[2] * TICRATE / 8; x = CurrNode->x; y = CurrNode->y; z = CurrNode->z; } } - if (HoldTime > gametic) + if (HoldTime > level.time) return; // Splines must have a previous node. diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 1aab998a9..2888ea2b6 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -1372,6 +1372,8 @@ bool AInventory::TryPickupRestricted (AActor *&toucher) bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return) { + TObjPtr 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; } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 8616393e7..df0c94b46 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -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 }; diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index 8ffedb5a4..791021ae8 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1280,8 +1280,8 @@ public: // We can't use DTA_HUDRules since it forces a width and height. // Translation: No high res. - bool xright = *x < 0; - bool ybot = *y < 0; + bool xright = *x < 0 && !x.RelCenter(); + bool ybot = *y < 0 && !y.RelCenter(); w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth); h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight); diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index 38cadab34..d984bbdd3 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -30,7 +30,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype) thrust.Z = float(target->z - victim->z); 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->vely += fixed_t(thrust.Y); diff --git a/src/menu/optionmenu.cpp b/src/menu/optionmenu.cpp index eff53fc49..9a7715265 100644 --- a/src/menu/optionmenu.cpp +++ b/src/menu/optionmenu.cpp @@ -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) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index ef6136fdc..17af5c26d 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2721,7 +2721,14 @@ void A_Chase(AActor *self) // 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) 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) { - self->angle -= max_turn; + self->angle -= max_turn + ang_offset; } else { - self->angle += max_turn; + self->angle += max_turn + ang_offset; } } else { if (other_angle - self->angle < ANGLE_180) { - self->angle += max_turn; + self->angle += max_turn + ang_offset; } else { - self->angle -= max_turn; + self->angle -= max_turn + ang_offset; } } } else { - self->angle = other_angle; + self->angle = other_angle + ang_offset; } // [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. double dist_x = other->x - self->x; double dist_y = other->y - self->y; + // Positioning ala missile spawning, 32 units above foot level fixed_t source_z = self->z + 32*FRACUNIT + self->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 - // its body. + // its body. 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 = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z); - int other_pitch = (int)rad2bam(asin(dist_z / dist)); - + if (max_pitch != 0) { 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; } + if (flags & FAF_NODISTFACTOR) + self->pitch += pitch_offset; } + + // 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) ) @@ -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) { - ACTION_PARAM_START(2); + ACTION_PARAM_START(5); ACTION_PARAM_ANGLE(max_turn, 0); 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) { - ACTION_PARAM_START(2); + ACTION_PARAM_START(5); ACTION_PARAM_ANGLE(max_turn, 0); 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) { - ACTION_PARAM_START(2); + ACTION_PARAM_START(5); ACTION_PARAM_ANGLE(max_turn, 0); 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); } //=========================================================================== diff --git a/src/p_enemy.h b/src/p_enemy.h index f5cc387dd..799b4c0ff 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -72,8 +72,8 @@ DECLARE_ACTION(A_FreezeDeathChunks) DECLARE_ACTION(A_BossDeath) void A_Chase(AActor *self); -void A_FaceTarget(AActor *actor, 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); +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, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0); bool A_RaiseMobj (AActor *, fixed_t speed); bool A_SinkMobj (AActor *, fixed_t speed); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ef23ca0ba..c61b77eba 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -587,6 +587,7 @@ void AActor::RemoveInventory (AInventory *item) *invp = item->Inventory; item->DetachFromOwner (); item->Owner = NULL; + item->Inventory = NULL; 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. if (!(BlockingMobj->flags7 & MF7_THRUREFLECT)) { - //int dir; - //angle_t delta; angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y); bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle)); // Change angle for deflection/reflection @@ -1996,12 +1995,21 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) } 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; + if (BlockingMobj->flags7 & MF7_MIRRORREFLECT && (tg || blockingtg)) + { + mo->angle += ANGLE_180; + mo->velx = -mo->velx / 2; + mo->vely = -mo->vely / 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 @@ -2932,11 +2940,8 @@ bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle) { if (flags2 & MF2_DONTREFLECT) return true; if (thing->flags7 & MF7_THRUREFLECT) return false; - - if (thing->flags7 & MF7_MIRRORREFLECT) - angle += ANGLE_180; // Change angle for reflection - else if (thing->flags4&MF4_SHIELDREFLECT) + if (thing->flags4&MF4_SHIELDREFLECT) { // Shield reflection (from the Centaur if (abs (angle - thing->angle)>>24 > 45) @@ -2959,15 +2964,23 @@ bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle) else 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) + { A_Face(this, this->target); + } else if (thing->target != NULL) + { A_Face(this, thing->target); + } } - else - angle += ANGLE_1 * ((pr_reflect()%16)-8); + return false; } diff --git a/src/po_man.cpp b/src/po_man.cpp index c6e273a0f..bb9b3ca46 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -676,7 +676,7 @@ void DPolyDoor::Tick () break; case PODOOR_SWING: - if (poly->RotatePolyobj (m_Speed)) + if (m_Dist <= 0 || poly->RotatePolyobj (m_Speed)) { absSpeed = abs (m_Speed); if (m_Dist == -1) diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 4f1fa9e6f..83c855de5 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -99,10 +99,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"); diff --git a/src/posix/sdl/i_joystick.cpp b/src/posix/sdl/i_joystick.cpp index 9b1d326ae..d99caeca9 100644 --- a/src/posix/sdl/i_joystick.cpp +++ b/src/posix/sdl/i_joystick.cpp @@ -1,4 +1,4 @@ -#include +#include #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 &sticks) diff --git a/src/posix/sdl/i_main.cpp b/src/posix/sdl/i_main.cpp index ff700eff4..d60494d1a 100644 --- a/src/posix/sdl/i_main.cpp +++ b/src/posix/sdl/i_main.cpp @@ -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 diff --git a/src/posix/sdl/i_timer.cpp b/src/posix/sdl/i_timer.cpp index e3f9906b6..6255c8a96 100644 --- a/src/posix/sdl/i_timer.cpp +++ b/src/posix/sdl/i_timer.cpp @@ -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); } diff --git a/src/resourcefiles/file_wad.cpp b/src/resourcefiles/file_wad.cpp index 384290782..55a6f5f06 100644 --- a/src/resourcefiles/file_wad.cpp +++ b/src/resourcefiles/file_wad.cpp @@ -581,9 +581,18 @@ void FWadFile::SkinHack () namespc++; } } - if (lump->Name[0] == 'M' && - lump->Name[1] == 'A' && - lump->Name[2] == 'P') + if ((lump->Name[0] == 'M' && + lump->Name[1] == 'A' && + 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; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index be3921877..9db52f728 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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_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; @@ -1685,6 +1688,11 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO) if (mi) { AInventory *item = static_cast(Spawn (mi, 0, 0, 0, NO_REPLACE)); + if (!item) + { + ACTION_SET_RESULT(false); + return; + } if (item->IsKindOf(RUNTIME_CLASS(AHealth))) { item->Amount *= amount; @@ -1709,12 +1717,12 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) { - DoGiveInventory(self, PUSH_PARAMINFO); + DoGiveInventory(self, true, PUSH_PARAMINFO); } 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) @@ -1724,7 +1732,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) 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())) { - 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, }; -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_INT(amount, 1); ACTION_PARAM_INT(flags, 2); - ACTION_PARAM_INT(setreceiver, 3); - if (!item) return; - COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); + if (!item) + { + ACTION_SET_RESULT(false); + return; + } + if (use_aaptr) + { + ACTION_PARAM_INT(setreceiver, 3); + COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); + } bool res = false; @@ -1794,12 +1809,12 @@ void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) { - DoTakeInventory(self, PUSH_PARAMINFO); + DoTakeInventory(self, true, PUSH_PARAMINFO); } 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) @@ -1809,7 +1824,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) 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())) { - if (mo->master == self->master && mo != self) DoTakeInventory(mo, PUSH_PARAMINFO); + if (mo->master == self->master && mo != self) DoTakeInventory(mo, false, PUSH_PARAMINFO); } } } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index fbe28fb5b..e91c2ee65 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -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),}; diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index f0e68d9a5..c03c86596 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -82,9 +82,9 @@ ACTOR Actor native //: Thinker action native A_XScream(); action native A_Look(); 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_FaceTracer(float max_turn = 0, float max_pitch = 270); - action native A_FaceMaster(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, float ang_offset = 0, float pitch_offset = 0, int flags = 0); + 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_Scream(); action native A_SPosAttack(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 074953afe..b4bb4c532 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -447,6 +447,15 @@ enum 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. native int testglobalvar;