Merge branch 'master' into scripting

Conflicts:
	src/actor.h
	src/g_hexen/a_clericstaff.cpp
	src/p_enemy.cpp
	src/p_interaction.cpp
	src/p_local.h
	src/p_mobj.cpp
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Christoph Oelckers 2016-01-17 20:57:55 +01:00
commit bf747075e8
179 changed files with 10280 additions and 4787 deletions

View file

@ -75,6 +75,7 @@
#include "actorptrselect.h"
#include "farchive.h"
#include "decallib.h"
#include "p_terrain.h"
#include "version.h"
#include "g_shared/a_pickups.h"
@ -1953,11 +1954,14 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
int arraynum = MapVarStore[LittleLong(chunk[2])];
if ((unsigned)arraynum < (unsigned)NumArrays)
{
int initsize = MIN<int> (ArrayStore[arraynum].ArraySize, (LittleLong(chunk[1])-4)/4);
// Use unsigned iterator here to avoid issue with GCC 4.9/5.x
// optimizer. Might be some undefined behavior in this code,
// but I don't know what it is.
unsigned int initsize = MIN<unsigned int> (ArrayStore[arraynum].ArraySize, (LittleLong(chunk[1])-4)/4);
SDWORD *elems = ArrayStore[arraynum].Elements;
for (i = 0; i < initsize; ++i)
for (unsigned int j = 0; j < initsize; ++j)
{
elems[i] = LittleLong(chunk[3+i]);
elems[j] = LittleLong(chunk[3+j]);
}
}
chunk = (DWORD *)NextChunk((BYTE *)chunk);
@ -3436,12 +3440,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc
while ( (aspot = iterator.Next ()) )
{
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, angle, force);
spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, angle, force);
}
}
else if (activator != NULL)
{
spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, angle, force);
spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, angle, force);
}
return spawned;
}
@ -3457,12 +3461,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
while ( (aspot = iterator.Next ()) )
{
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle >> 24, force);
spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->angle >> 24, force);
}
}
else if (activator != NULL)
{
spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, activator->angle >> 24, force);
spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->angle >> 24, force);
}
return spawned;
}
@ -4140,7 +4144,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
F3DFloor *ff = sec->e->XFloor.ffloors[i];
if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) &&
actor->z >= ff->top.plane->ZatPoint(actor->x, actor->y))
actor->Z() >= ff->top.plane->ZatPoint(actor))
{ // This floor is beneath our feet.
secpic = *ff->top.texture;
break;
@ -4153,14 +4157,14 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
}
else
{
fixed_t z = actor->z + actor->height;
fixed_t z = actor->Z() + actor->height;
// Looking through planes from bottom to top
for (i = numff-1; i >= 0; --i)
{
F3DFloor *ff = sec->e->XFloor.ffloors[i];
if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) &&
z <= ff->bottom.plane->ZatPoint(actor->x, actor->y))
z <= ff->bottom.plane->ZatPoint(actor))
{ // This floor is above our eyes.
secpic = *ff->bottom.texture;
break;
@ -4457,6 +4461,8 @@ enum EACSFunctions
ACSF_QuakeEx,
ACSF_Warp, // 92
ACSF_GetMaxInventory,
ACSF_SetSectorDamage,
ACSF_SetSectorTerrain,
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
@ -4714,8 +4720,8 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
{
angle += actor->angle;
}
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->x, actor->y,
actor->z + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(),
actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
angle, distance, !!(flags & SDF_PERMANENT));
}
@ -5389,6 +5395,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
FName damagetype = argCount > 5 && args[5]? FName(FBehavior::StaticLookupString(args[5])) : NAME_None;
fixed_t range = argCount > 6 && args[6]? args[6] : MISSILERANGE;
int flags = argCount > 7 && args[7]? args[7] : 0;
int pufftid = argCount > 8 && args[8]? args[8] : 0;
int fhflags = 0;
if (flags & FHF_NORANDOMPUFFZ) fhflags |= LAF_NORANDOMPUFFZ;
@ -5396,7 +5403,12 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
if (args[0] == 0)
{
P_LineAttack(activator, angle, range, pitch, damage, damagetype, pufftype, fhflags);
AActor *puff = P_LineAttack(activator, angle, range, pitch, damage, damagetype, pufftype, fhflags);
if (puff != NULL && pufftid != 0)
{
puff->tid = pufftid;
puff->AddToHash();
}
}
else
{
@ -5405,7 +5417,12 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
while ((source = it.Next()) != NULL)
{
P_LineAttack(source, angle, range, pitch, damage, damagetype, pufftype, fhflags);
AActor *puff = P_LineAttack(source, angle, range, pitch, damage, damagetype, pufftype, fhflags);
if (puff != NULL && pufftid != 0)
{
puff->tid = pufftid;
puff->AddToHash();
}
}
}
}
@ -5931,6 +5948,39 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
}
break;
case ACSF_SetSectorDamage:
if (argCount >= 2)
{
FSectorTagIterator it(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
sector_t *sec = &sectors[s];
sec->damageamount = args[1];
sec->damagetype = argCount >= 3 ? FName(FBehavior::StaticLookupString(args[2])) : FName(NAME_None);
sec->damageinterval = argCount >= 4 ? clamp(args[3], 1, INT_MAX) : 32;
sec->leakydamage = argCount >= 5 ? args[4] : 0;
}
}
break;
case ACSF_SetSectorTerrain:
if (argCount >= 3)
{
if (args[1] == sector_t::floor || args[1] == sector_t::ceiling)
{
int terrain = P_FindTerrain(FBehavior::StaticLookupString(args[2]));
FSectorTagIterator it(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
sectors[s].terrainnum[args[1]] = terrain;
}
}
}
break;
default:
break;
}
@ -8540,11 +8590,11 @@ scriptwait:
}
else if (pcd == PCD_GETACTORZ)
{
STACK(1) = actor->z + actor->GetBobOffset();
STACK(1) = actor->Z() + actor->GetBobOffset();
}
else
{
STACK(1) = (&actor->x)[pcd - PCD_GETACTORX];
STACK(1) = pcd == PCD_GETACTORX ? actor->X() : pcd == PCD_GETACTORY ? actor->Y() : actor->Z();
}
}
break;