mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
b5c3ced9a9
9 changed files with 175 additions and 3 deletions
|
@ -2668,6 +2668,11 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
||||||
players[player].camera = players[player].mo;
|
players[player].camera = players[player].mo;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DEM_FINISHGAME:
|
||||||
|
// Simulate an end-of-game action
|
||||||
|
G_ChangeLevel(NULL, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
I_Error ("Unknown net command: %d", type);
|
I_Error ("Unknown net command: %d", type);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -164,7 +164,8 @@ enum EDemoCommand
|
||||||
DEM_RUNNAMEDSCRIPT, // 65 String: Script name, Byte: Arg count + Always flag; each arg is a 4-byte int
|
DEM_RUNNAMEDSCRIPT, // 65 String: Script name, Byte: Arg count + Always flag; each arg is a 4-byte int
|
||||||
DEM_REVERTCAMERA, // 66
|
DEM_REVERTCAMERA, // 66
|
||||||
DEM_SETSLOTPNUM, // 67 Byte: player number, the rest is the same as DEM_SETSLOT
|
DEM_SETSLOTPNUM, // 67 Byte: player number, the rest is the same as DEM_SETSLOT
|
||||||
DEM_REMOVE, // 68
|
DEM_REMOVE, // 68
|
||||||
|
DEM_FINISHGAME, // 69
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
||||||
|
|
|
@ -138,6 +138,17 @@ void AFastProjectile::Tick ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT))
|
||||||
|
{
|
||||||
|
flags7 &= ~MF7_HANDLENODELAY;
|
||||||
|
if (state->GetNoDelay())
|
||||||
|
{
|
||||||
|
// For immediately spawned objects with the NoDelay flag set for their
|
||||||
|
// Spawn state, explicitly call the current state's function.
|
||||||
|
if (state->CallAction(this, this) && (ObjectFlags & OF_EuthanizeMe))
|
||||||
|
return; // freed itself
|
||||||
|
}
|
||||||
|
}
|
||||||
// Advance the state
|
// Advance the state
|
||||||
if (tics != -1)
|
if (tics != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -945,6 +945,14 @@ public:
|
||||||
{
|
{
|
||||||
return mMaxValid >= 0;
|
return mMaxValid >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ticker()
|
||||||
|
{
|
||||||
|
if (Selectable() && mSelection > mMaxValid)
|
||||||
|
{
|
||||||
|
mSelection = mMaxValid;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "d_dehacked.h"
|
#include "d_dehacked.h"
|
||||||
|
#include "d_net.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "m_png.h"
|
#include "m_png.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
|
@ -604,7 +605,7 @@ CCMD(printstats)
|
||||||
CCMD(finishgame)
|
CCMD(finishgame)
|
||||||
{
|
{
|
||||||
// This CCMD simulates an end-of-game action and exists to end mods that never exit their last level.
|
// This CCMD simulates an end-of-game action and exists to end mods that never exit their last level.
|
||||||
G_ChangeLevel(NULL, 0, 0);
|
Net_WriteByte(DEM_FINISHGAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_STAT(statistics)
|
ADD_STAT(statistics)
|
||||||
|
|
|
@ -5122,6 +5122,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
||||||
ACTION_SET_RESULT(given);
|
ACTION_SET_RESULT(given);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_CheckSpecies
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(3);
|
||||||
|
ACTION_PARAM_STATE(jump, 0);
|
||||||
|
ACTION_PARAM_NAME(species, 1);
|
||||||
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
|
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
//Needs at least one state jump to work.
|
||||||
|
if (!mobj)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jump && mobj->GetSpecies() == species)
|
||||||
|
ACTION_JUMP(jump);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -6196,3 +6221,114 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
|
||||||
ACTION_JUMP(block);
|
ACTION_JUMP(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_FaceMovementDirection(angle offset, bool pitch, ptr)
|
||||||
|
//
|
||||||
|
// Sets the actor('s pointer) to face the direction of travel.
|
||||||
|
//===========================================================================
|
||||||
|
enum FMDFlags
|
||||||
|
{
|
||||||
|
FMDF_NOPITCH = 1 << 0,
|
||||||
|
FMDF_INTERPOLATE = 1 << 1,
|
||||||
|
FMDF_NOANGLE = 1 << 2,
|
||||||
|
};
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(5);
|
||||||
|
ACTION_PARAM_ANGLE(offset, 0);
|
||||||
|
ACTION_PARAM_ANGLE(anglelimit, 1);
|
||||||
|
ACTION_PARAM_ANGLE(pitchlimit, 2);
|
||||||
|
ACTION_PARAM_INT(flags, 3);
|
||||||
|
ACTION_PARAM_INT(ptr, 4);
|
||||||
|
|
||||||
|
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
//Need an actor.
|
||||||
|
if (!mobj || ((flags & FMDF_NOPITCH) && (flags & FMDF_NOANGLE)))
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Don't bother calculating this if we don't have any horizontal movement.
|
||||||
|
if (!(flags & FMDF_NOANGLE) && (mobj->velx != 0 || mobj->vely != 0))
|
||||||
|
{
|
||||||
|
angle_t current = mobj->angle;
|
||||||
|
const angle_t angle = R_PointToAngle2(0, 0, mobj->velx, mobj->vely);
|
||||||
|
//Done because using anglelimit directly causes a signed/unsigned mismatch.
|
||||||
|
const angle_t limit = anglelimit;
|
||||||
|
|
||||||
|
//Code borrowed from A_Face*.
|
||||||
|
if (limit > 0 && (absangle(current - angle) > limit))
|
||||||
|
{
|
||||||
|
if (current < angle)
|
||||||
|
{
|
||||||
|
// [MC] This may appear backwards, but I assure any who
|
||||||
|
// reads this, it works.
|
||||||
|
if (current - angle > ANGLE_180)
|
||||||
|
current += limit + offset;
|
||||||
|
else
|
||||||
|
current -= limit + offset;
|
||||||
|
mobj->SetAngle(current, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
else if (current > angle)
|
||||||
|
{
|
||||||
|
if (angle - current > ANGLE_180)
|
||||||
|
current -= limit + offset;
|
||||||
|
else
|
||||||
|
current += limit + offset;
|
||||||
|
mobj->SetAngle(current, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mobj->SetAngle(angle + ANGLE_180 + offset, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mobj->SetAngle(angle + offset, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(flags & FMDF_NOPITCH))
|
||||||
|
{
|
||||||
|
fixed_t current = mobj->pitch;
|
||||||
|
const FVector2 velocity(mobj->velx, mobj->vely);
|
||||||
|
const fixed_t pitch = R_PointToAngle2(0, 0, (fixed_t)velocity.Length(), -mobj->velz);
|
||||||
|
if (pitchlimit > 0)
|
||||||
|
{
|
||||||
|
// [MC] angle_t for pitchlimit was required because otherwise
|
||||||
|
// we would wind up with less than desirable turn rates that didn't
|
||||||
|
// match that of A_SetPitch. We want consistency. Also, I didn't know
|
||||||
|
// of a better way to convert from angle_t to fixed_t properly so I
|
||||||
|
// used this instead.
|
||||||
|
fixed_t plimit = fixed_t(pitchlimit);
|
||||||
|
|
||||||
|
if (abs(current - pitch) > plimit)
|
||||||
|
{
|
||||||
|
fixed_t max = 0;
|
||||||
|
|
||||||
|
if (current > pitch)
|
||||||
|
{
|
||||||
|
max = MIN(plimit, (current - pitch));
|
||||||
|
current -= max;
|
||||||
|
}
|
||||||
|
else //if (current > pitch)
|
||||||
|
{
|
||||||
|
max = MIN(plimit, (pitch - current));
|
||||||
|
current += max;
|
||||||
|
}
|
||||||
|
mobj->SetPitch(current, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mobj->SetPitch(pitch, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mobj->SetPitch(pitch, !!(flags & FMDF_INTERPOLATE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ const char *GetVersionString();
|
||||||
// Protocol version used in demos.
|
// Protocol version used in demos.
|
||||||
// Bump it if you change existing DEM_ commands or add new ones.
|
// Bump it if you change existing DEM_ commands or add new ones.
|
||||||
// Otherwise, it should be safe to leave it alone.
|
// Otherwise, it should be safe to leave it alone.
|
||||||
#define DEMOGAMEVERSION 0x21C
|
#define DEMOGAMEVERSION 0x21D
|
||||||
|
|
||||||
// Minimum demo version we can play.
|
// Minimum demo version we can play.
|
||||||
// Bump it whenever you change or remove existing DEM_ commands.
|
// Bump it whenever you change or remove existing DEM_ commands.
|
||||||
|
|
|
@ -259,6 +259,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_GiveToTarget(class<Inventory> itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT);
|
action native A_GiveToTarget(class<Inventory> itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT);
|
||||||
action native A_TakeFromTarget(class<Inventory> itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT);
|
action native A_TakeFromTarget(class<Inventory> itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT);
|
||||||
action native A_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0);
|
action native A_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0);
|
||||||
|
action native A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT);
|
||||||
action native A_CountdownArg(int argnum, state targstate = "");
|
action native A_CountdownArg(int argnum, state targstate = "");
|
||||||
action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);
|
action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);
|
||||||
action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
|
action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
|
||||||
|
@ -342,6 +343,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
|
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
||||||
action native A_CheckRange(float distance, state label, bool two_dimension = false);
|
action native A_CheckRange(float distance, state label, bool two_dimension = false);
|
||||||
|
action native A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
|
|
||||||
action native A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
|
action native A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
|
||||||
action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
|
action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
|
||||||
|
|
|
@ -529,6 +529,14 @@ enum
|
||||||
SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG
|
SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Flags for A_FaceMovementDirection
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
FMDF_NOPITCH = 1 << 0,
|
||||||
|
FMDF_INTERPOLATE = 1 << 1,
|
||||||
|
FMDF_NOANGLE = 1 << 2,
|
||||||
|
};
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue