Merge branch 'master' into scripting

Conflicts:
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Christoph Oelckers 2015-08-01 09:42:31 +02:00
commit 36974431ba
11 changed files with 6363 additions and 6285 deletions

View file

@ -149,7 +149,8 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_FLY:
if (player->mo != NULL)
{
if ((player->mo->flags7 ^= MF7_FLYCHEAT) != 0)
player->mo->flags7 ^= MF7_FLYCHEAT;
if (player->mo->flags7 & MF7_FLYCHEAT)
{
player->mo->flags |= MF_NOGRAVITY;
player->mo->flags2 |= MF2_FLY;

View file

@ -137,7 +137,7 @@ inline SDWORD ModDiv (SDWORD num, SDWORD den, SDWORD *dmval)
}
#define FLOAT2FIXED(f) xs_Fix<16>::ToFix(f)
#define FLOAT2FIXED(f) ((fixed_t)xs_Fix<16>::ToFix(f))
#define FIXED2FLOAT(f) ((f) / float(65536))
#define FIXED2DBL(f) ((f) / double(65536))

View file

@ -3594,7 +3594,7 @@ int DoGetMasterTID (AActor *self)
else return 0;
}
static AActor *SingleActorFromTID (int tid, AActor *defactor)
AActor *SingleActorFromTID (int tid, AActor *defactor)
{
if (tid == 0)
{
@ -4421,6 +4421,8 @@ enum EACSFunctions
ACSF_ChangeActorRoll,
ACSF_GetActorRoll,
ACSF_QuakeEx,
ACSF_Warp, // 92
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
-101 : PlayerIsSpectator(1),
@ -5840,6 +5842,45 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetActorRoll:
actor = SingleActorFromTID(args[0], activator);
return actor != NULL? actor->roll >> 16 : 0;
// [ZK] A_Warp in ACS
case ACSF_Warp:
{
int tid_dest = args[0];
fixed_t xofs = args[1];
fixed_t yofs = args[2];
fixed_t zofs = args[3];
angle_t angle = args[4];
int flags = args[5];
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false;
FState *state = argCount > 6 ? activator->GetClass()->FindStateByString(statename, exact) : 0;
AActor *reference;
if((flags & WARPF_USEPTR) && tid_dest != AAPTR_DEFAULT)
{
reference = COPY_AAPTR(activator, tid_dest);
}
else
{
reference = SingleActorFromTID(tid_dest, activator);
}
// If there is no actor to warp to, fail.
if (!reference)
return false;
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags))
{
if (state && argCount > 6)
{
activator->SetState(state);
}
return true;
}
return false;
}
default:
break;

View file

@ -586,7 +586,7 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i
}
}
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff, int flags, const PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
{
double length, lengthsquared;
int steps, i;

View file

@ -88,7 +88,7 @@ void P_RunEffects (void);
void P_RunEffect (AActor *actor, int effects);
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff = 0, int flags = 0, const PClassActor *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270);
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270);
void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind);
void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);

View file

@ -180,6 +180,31 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser);
bool P_Thing_CanRaise(AActor *thing);
PClassActor *P_GetSpawnableType(int spawnnum);
void InitSpawnablesFromMapinfo();
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags);
enum WARPF
{
WARPF_ABSOLUTEOFFSET = 0x1,
WARPF_ABSOLUTEANGLE = 0x2,
WARPF_USECALLERANGLE = 0x4,
WARPF_NOCHECKPOSITION = 0x8,
WARPF_INTERPOLATE = 0x10,
WARPF_WARPINTERPOLATION = 0x20,
WARPF_COPYINTERPOLATION = 0x40,
WARPF_STOP = 0x80,
WARPF_TOFLOOR = 0x100,
WARPF_TESTONLY = 0x200,
WARPF_ABSOLUTEPOSITION = 0x400,
WARPF_BOB = 0x800,
WARPF_MOVEPTR = 0x1000,
WARPF_USEPTR = 0x2000,
WARPF_USETID = 0x2000,
};
//
// P_MAPUTL
@ -479,7 +504,7 @@ void P_TraceBleed (int damage, AActor *target); // random direction version
bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true);
void P_CheckSplash(AActor *self, fixed_t distance);
void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, double maxdiff = 0, int flags = 0, const PClassActor *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, double sparsity = 1.0, double drift = 1.0, const PClassActor *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun
void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, double maxdiff = 0, int flags = 0, PClassActor *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, double sparsity = 1.0, double drift = 1.0, PClassActor *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun
enum // P_RailAttack / A_RailAttack / A_CustomRailgun / P_DrawRailTrail flags
{

View file

@ -4150,7 +4150,7 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
//
//
//==========================================================================
void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, int color1, int color2, double maxdiff, int railflags, const PClassActor *puffclass, angle_t angleoffset, angle_t pitchoffset, fixed_t distance, int duration, double sparsity, double drift, const PClassActor *spawnclass, int SpiralOffset)
void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, int color1, int color2, double maxdiff, int railflags, PClassActor *puffclass, angle_t angleoffset, angle_t pitchoffset, fixed_t distance, int duration, double sparsity, double drift, PClassActor *spawnclass, int SpiralOffset)
{
fixed_t vx, vy, vz;
angle_t angle, pitch;

View file

@ -678,3 +678,130 @@ void InitSpawnablesFromMapinfo()
InitClassMap(SpawnableThings, SpawnablesFromMapinfo);
InitClassMap(StrifeTypes, ConversationIDsFromMapinfo);
}
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags)
{
if (flags & WARPF_MOVEPTR)
{
AActor *temp = reference;
reference = caller;
caller = temp;
}
fixed_t oldx = caller->x;
fixed_t oldy = caller->y;
fixed_t oldz = caller->z;
if (!(flags & WARPF_ABSOLUTEANGLE))
{
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
}
if (!(flags & WARPF_ABSOLUTEPOSITION))
{
if (!(flags & WARPF_ABSOLUTEOFFSET))
{
angle_t fineangle = angle >> ANGLETOFINESHIFT;
fixed_t xofs1 = xofs;
// (borrowed from A_SpawnItemEx, assumed workable)
// in relative mode negative y values mean 'left' and positive ones mean 'right'
// This is the inverse orientation of the absolute mode!
xofs = FixedMul(xofs1, finecosine[fineangle]) + FixedMul(yofs, finesine[fineangle]);
yofs = FixedMul(xofs1, finesine[fineangle]) - FixedMul(yofs, finecosine[fineangle]);
}
if (flags & WARPF_TOFLOOR)
{
// set correct xy
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->z);
// now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with
if (zofs)
{
// extra unlink, link and environment calculation
caller->SetOrigin(
caller->x,
caller->y,
caller->floorz + zofs);
}
else
{
// if there is no offset, there should be no ill effect from moving down to the already defined floor
// A_Teleport does the same thing anyway
caller->z = caller->floorz;
}
}
else
{
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->z + zofs);
}
}
else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's.
{
if (flags & WARPF_TOFLOOR)
{
caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
}
else
{
caller->SetOrigin(xofs, yofs, zofs);
}
}
if ((flags & WARPF_NOCHECKPOSITION) || P_TestMobjLocation(caller))
{
if (flags & WARPF_TESTONLY)
{
caller->SetOrigin(oldx, oldy, oldz);
}
else
{
caller->angle = angle;
if (flags & WARPF_STOP)
{
caller->velx = 0;
caller->vely = 0;
caller->velz = 0;
}
if (flags & WARPF_WARPINTERPOLATION)
{
caller->PrevX += caller->x - oldx;
caller->PrevY += caller->y - oldy;
caller->PrevZ += caller->z - oldz;
}
else if (flags & WARPF_COPYINTERPOLATION)
{
caller->PrevX = caller->x + reference->PrevX - reference->x;
caller->PrevY = caller->y + reference->PrevY - reference->y;
caller->PrevZ = caller->z + reference->PrevZ - reference->z;
}
else if (!(flags & WARPF_INTERPOLATE))
{
caller->PrevX = caller->x;
caller->PrevY = caller->y;
caller->PrevZ = caller->z;
}
if ((flags & WARPF_BOB) && (reference->flags2 & MF2_FLOATBOB))
{
caller->z += reference->GetBobOffset();
}
}
return true;
}
caller->SetOrigin(oldx, oldy, oldz);
return false;
}

File diff suppressed because it is too large Load diff

View file

@ -225,7 +225,7 @@ ACTOR Actor native //: Thinker
action native A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label, 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_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0);
action native A_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None");
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_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);

View file

@ -224,6 +224,12 @@ enum
RGF_CUBE = 1 << 9,
RGF_NOSIGHT = 1 << 10,
RGF_MISSILES = 1 << 11,
RGF_INCLUSIVE = 1 << 12,
RGF_ITEMS = 1 << 13,
RGF_KILLED = 1 << 14,
RGF_EXFILTER = 1 << 15,
RGF_EXSPECIES = 1 << 16,
RGF_EITHER = 1 << 17,
};
// Activation flags
@ -351,6 +357,7 @@ Const Int WAPRF_ABSOLUTEPOSITION = 0x400;
Const Int WARPF_ABSOLUTEPOSITION = 0x400;
Const Int WARPF_BOB = 0x800;
Const Int WARPF_MOVEPTR = 0x1000;
Const Int WARPF_USETID = 0x2000;
// flags for A_SetPitch/SetAngle/SetRoll
const int SPF_FORCECLAMP = 1;