This commit is contained in:
Christoph Oelckers 2016-01-22 01:11:08 +01:00
commit 1a631670fb
26 changed files with 4440 additions and 4293 deletions

View file

@ -276,12 +276,12 @@ static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU
return oldPtr;
}
#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16)))
#define SUCCESSOR(p) ((CPpmd_Void_Ref)(size_t)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16)))
static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v)
{
(p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF);
(p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF);
(p)->SuccessorLow = (UInt16)((UInt32)((size_t)v) & 0xFFFF);
(p)->SuccessorHigh = (UInt16)(((UInt32)((size_t)v) >> 16) & 0xFFFF);
}
static void RestartModel(CPpmd7 *p)

View file

@ -881,7 +881,7 @@ public:
bool intersects(AActor *other) const
{
fixed_t blockdist = radius + other->radius;
return ( abs(X() - other->Y()) < blockdist && abs(Y() - other->Y()) < blockdist);
return ( abs(X() - other->X()) < blockdist && abs(Y() - other->Y()) < blockdist);
}
// 'absolute' is reserved for a linked portal implementation which needs

View file

@ -77,6 +77,7 @@
#include "decallib.h"
#include "p_terrain.h"
#include "version.h"
#include "p_effect.h"
#include "g_shared/a_pickups.h"
@ -4464,6 +4465,7 @@ enum EACSFunctions
ACSF_GetMaxInventory,
ACSF_SetSectorDamage,
ACSF_SetSectorTerrain,
ACSF_SpawnParticle,
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
@ -5989,6 +5991,34 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
}
break;
case ACSF_SpawnParticle:
{
fixed_t x = args[0];
fixed_t y = args[1];
fixed_t z = args[2];
fixed_t xvel = args[3];
fixed_t yvel = args[4];
fixed_t zvel = args[5];
PalEntry color = args[6];
int lifetime = args[7];
bool fullbright = argCount > 8 ? !!args[8] : false;
int startalpha = argCount > 9 ? args[9] : 0xFF; // Byte trans
int size = argCount > 10 ? args[10] : 1;
int fadestep = argCount > 11 ? args[11] : -1;
fixed_t accelx = argCount > 12 ? args[12] : 0;
fixed_t accely = argCount > 13 ? args[13] : 0;
fixed_t accelz = argCount > 14 ? args[14] : 0;
startalpha = clamp<int>(startalpha, 0, 0xFF); // Clamp to byte
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
fadestep = clamp<int>(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic)
size = clamp<int>(size, 0, 0xFF); // Clamp to byte
if (lifetime != 0)
P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz);
}
break;
default:
break;
}

View file

@ -1345,12 +1345,15 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
if (reply->NextNode != 0)
{
int rootnode = npc->ConversationRoot;
unsigned next = (unsigned)(rootnode + (reply->NextNode < 0 ? -1 : 1) * reply->NextNode - 1);
const bool isNegative = reply->NextNode < 0;
const unsigned next = (unsigned)(rootnode + (isNegative ? -1 : 1) * reply->NextNode - 1);
if (next < StrifeDialogues.Size())
{
npc->Conversation = StrifeDialogues[next];
if (isNegative)
{
if (gameaction != ga_slideshow)
{
P_StartConversation (npc, player->mo, player->ConversationFaceTalker, false);
@ -1362,6 +1365,11 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
}
}
}
else
{
Printf ("Next node %u is invalid, no such dialog page\n", next);
}
}
npc->angle = player->ConversationNPCAngle;

View file

@ -284,6 +284,31 @@ void P_ThinkParticles ()
}
}
void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t velx, fixed_t vely, fixed_t velz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, BYTE size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz)
{
particle_t *particle = NewParticle();
if (particle)
{
particle->x = x;
particle->y = y;
particle->z = z;
particle->velx = velx;
particle->vely = vely;
particle->velz = velz;
particle->color = ParticleColor(color);
particle->trans = startalpha;
if (fadestep < 0) fadestep = FADEFROMTTL(lifetime);
particle->fade = fadestep;
particle->ttl = lifetime;
particle->accx = accelx;
particle->accy = accely;
particle->accz = accelz;
particle->bright = fullbright;
particle->size = size;
}
}
//
// P_RunEffects
//

View file

@ -83,6 +83,7 @@ particle_t *JitterParticle (int ttl);
particle_t *JitterParticle (int ttl, float drift);
void P_ThinkParticles (void);
void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t velx, fixed_t vely, fixed_t velz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, BYTE size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz);
void P_InitEffects (void);
void P_RunEffects (void);

View file

@ -878,6 +878,7 @@ FArchive &operator<< (FArchive &arc, secspecial_t &p)
int special;
arc << special;
sector_t sec;
memset(&sec, 0, sizeof(sec));
P_InitSectorSpecial(&sec, special, true);
sec.GetSpecial(&p);
}

View file

@ -51,6 +51,7 @@
#include "s_sound.h"
#include "cmdlib.h"
#include "p_lnspec.h"
#include "p_effect.h"
#include "p_enemy.h"
#include "a_action.h"
#include "decallib.h"
@ -2627,6 +2628,75 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
}
}
//===========================================================================
//
// A_SpawnParticle
//
//===========================================================================
enum SPFflag
{
SPF_FULLBRIGHT = 1,
SPF_RELPOS = 1 << 1,
SPF_RELVEL = 1 << 2,
SPF_RELACCEL = 1 << 3,
SPF_RELANG = 1 << 4,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle)
{
ACTION_PARAM_START(15);
ACTION_PARAM_FIXED(xoff, 0);
ACTION_PARAM_FIXED(yoff, 1);
ACTION_PARAM_FIXED(zoff, 2);
ACTION_PARAM_FIXED(xvel, 3);
ACTION_PARAM_FIXED(yvel, 4);
ACTION_PARAM_FIXED(zvel, 5);
ACTION_PARAM_COLOR(color, 6);
ACTION_PARAM_INT(lifetime, 7);
ACTION_PARAM_INT(flags, 8);
ACTION_PARAM_FIXED(startalphaf, 9);
ACTION_PARAM_INT(size, 10);
ACTION_PARAM_FIXED(fadestepf, 11);
ACTION_PARAM_FIXED(accelx, 12);
ACTION_PARAM_FIXED(accely, 13);
ACTION_PARAM_FIXED(accelz, 14);
ACTION_PARAM_ANGLE(angle, 15);
BYTE startalpha = (BYTE)Scale(clamp(startalphaf, 0, FRACUNIT), 255, FRACUNIT);
int fadestep = fadestepf < 0? -1 : Scale(clamp(fadestepf, 0, FRACUNIT), 255, FRACUNIT);
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
size = clamp<int>(size, 0, 0xFF); // Clamp to byte
if (lifetime != 0)
{
const angle_t ang = (angle + ((flags & SPF_RELANG) ? self->angle : 0)) >> ANGLETOFINESHIFT;
fixedvec3 pos;
//[MC] Code ripped right out of A_SpawnItemEx.
if (flags & SPF_RELPOS)
{
// in relative mode negative y values mean 'left' and positive ones mean 'right'
// This is the inverse orientation of the absolute mode!
const fixed_t xof1 = xoff;
xoff = FixedMul(xof1, finecosine[ang]) + FixedMul(yoff, finesine[ang]);
yoff = FixedMul(xof1, finesine[ang]) - FixedMul(yoff, finecosine[ang]);
}
if (flags & SPF_RELVEL)
{
const fixed_t newxvel = FixedMul(xvel, finecosine[ang]) + FixedMul(yvel, finesine[ang]);
yvel = FixedMul(xvel, finesine[ang]) - FixedMul(yvel, finecosine[ang]);
xvel = newxvel;
}
if (flags & SPF_RELACCEL)
{
fixed_t newaccelx = FixedMul(accelx, finecosine[ang]) + FixedMul(accely, finesine[ang]);
accely = FixedMul(accelx, finesine[ang]) - FixedMul(accely, finecosine[ang]);
accelx = newaccelx;
}
pos = self->Vec3Offset(xoff, yoff, zoff);
P_SpawnParticle(pos.x, pos.y, pos.z, xvel, yvel, zvel, color, !!(flags & SPF_FULLBRIGHT), startalpha, lifetime, size, fadestep, accelx, accely, accelz);
}
}
//===========================================================================
//

View file

@ -234,6 +234,7 @@ ACTOR Actor native //: Thinker
action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT);
action native A_SetMass(int mass);
action native A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1);
action native A_SpawnParticle(float xoff, float yoff, float zoff, float velx, float vely, float velz, color color1, int lifetime, int flags = 0, float startalpha = 1, int size = 1, float fadestep = -1, float accelx = 0.0, float accely = 0.0, float accelz = 0.0, float angle = 0);
action native A_CheckSight(state label);
action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
action native A_DropInventory(class<Inventory> itemtype);

View file

@ -511,6 +511,17 @@ enum
CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self.
};
enum
{
SPF_FULLBRIGHT = 1,
SPF_RELPOS = 1 << 1,
SPF_RELVEL = 1 << 2,
SPF_RELACCEL = 1 << 3,
SPF_RELANG = 1 << 4,
SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG
};
// This is only here to provide one global variable for testing.
native int testglobalvar;