mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 22:22:08 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
4446922f26
10 changed files with 240 additions and 68 deletions
|
@ -151,5 +151,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
|
||||||
|
|
||||||
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
|
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
|
||||||
}
|
}
|
||||||
|
if (!(target->flags7 & MF7_DONTTHRUST))
|
||||||
target->velz = Scale(thrust, 1000, target->Mass);
|
target->velz = Scale(thrust, 1000, target->Mass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1280,8 +1280,8 @@ public:
|
||||||
|
|
||||||
// We can't use DTA_HUDRules since it forces a width and height.
|
// We can't use DTA_HUDRules since it forces a width and height.
|
||||||
// Translation: No high res.
|
// Translation: No high res.
|
||||||
bool xright = rx < 0;
|
bool xright = *x < 0;
|
||||||
bool ybot = ry < 0;
|
bool ybot = *y < 0;
|
||||||
|
|
||||||
w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth);
|
w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth);
|
||||||
h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight);
|
h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight);
|
||||||
|
|
|
@ -1278,7 +1278,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
||||||
if (!(flags & DMG_NO_ARMOR) && player->mo->Inventory != NULL)
|
if (!(flags & DMG_NO_ARMOR) && player->mo->Inventory != NULL)
|
||||||
{
|
{
|
||||||
int newdam = damage;
|
int newdam = damage;
|
||||||
|
if (damage > 0)
|
||||||
|
{
|
||||||
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
|
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
|
||||||
|
}
|
||||||
if (damage < TELEFRAG_DAMAGE)
|
if (damage < TELEFRAG_DAMAGE)
|
||||||
{
|
{
|
||||||
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
|
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
|
||||||
|
|
|
@ -1970,6 +1970,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
{
|
{
|
||||||
//int dir;
|
//int dir;
|
||||||
//angle_t delta;
|
//angle_t delta;
|
||||||
|
angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y);
|
||||||
bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle));
|
bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle));
|
||||||
// Change angle for deflection/reflection
|
// Change angle for deflection/reflection
|
||||||
|
|
||||||
|
@ -1989,18 +1990,13 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
//dest->x - source->x
|
//dest->x - source->x
|
||||||
FVector3 velocity(origin->x - mo->x, origin->y - mo->y, (origin->z + (origin->height/2)) - mo->z);
|
FVector3 velocity(origin->x - mo->x, origin->y - mo->y, (origin->z + (origin->height/2)) - mo->z);
|
||||||
velocity.Resize(speed);
|
velocity.Resize(speed);
|
||||||
angle = mo->angle >> ANGLETOFINESHIFT;
|
|
||||||
mo->velx = (fixed_t)(velocity.X);
|
mo->velx = (fixed_t)(velocity.X);
|
||||||
mo->vely = (fixed_t)(velocity.Y);
|
mo->vely = (fixed_t)(velocity.Y);
|
||||||
mo->velz = (fixed_t)(velocity.Z);
|
mo->velz = (fixed_t)(velocity.Z);
|
||||||
/*
|
|
||||||
mo->velx = FixedMul(mo->Speed, finecosine[angle]);
|
|
||||||
mo->vely = FixedMul(mo->Speed, finesine[angle]);
|
|
||||||
mo->velz = -mo->velz;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
mo->angle = angle;
|
mo->angle = angle;
|
||||||
angle >>= ANGLETOFINESHIFT;
|
angle >>= ANGLETOFINESHIFT;
|
||||||
mo->velx = FixedMul(mo->Speed >> 1, finecosine[angle]);
|
mo->velx = FixedMul(mo->Speed >> 1, finecosine[angle]);
|
||||||
|
@ -4959,6 +4955,13 @@ AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t
|
||||||
puff = Spawn (pufftype, x, y, z, ALLOW_REPLACE);
|
puff = Spawn (pufftype, x, y, z, ALLOW_REPLACE);
|
||||||
if (puff == NULL) return NULL;
|
if (puff == NULL) return NULL;
|
||||||
|
|
||||||
|
if ((puff->flags4 & MF4_RANDOMIZE) && puff->tics > 0)
|
||||||
|
{
|
||||||
|
puff->tics -= pr_spawnpuff() & 3;
|
||||||
|
if (puff->tics < 1)
|
||||||
|
puff->tics = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//Moved puff creation and target/master/tracer setting to here.
|
//Moved puff creation and target/master/tracer setting to here.
|
||||||
if (puff && vict)
|
if (puff && vict)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
|
@ -43,34 +44,23 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
|
||||||
|
|
||||||
static timeval s_startTicks;
|
namespace
|
||||||
|
|
||||||
|
|
||||||
unsigned int I_MSTime()
|
|
||||||
{
|
{
|
||||||
timeval now;
|
|
||||||
gettimeofday(&now, NULL);
|
|
||||||
|
|
||||||
const uint32_t ticks =
|
timeval s_gameStartTicks;
|
||||||
(now.tv_sec - s_startTicks.tv_sec ) * 1000
|
timeval s_systemBootTicks;
|
||||||
+ (now.tv_usec - s_startTicks.tv_usec) / 1000;
|
|
||||||
|
|
||||||
return ticks;
|
unsigned int GetMillisecondsSince(const timeval& time)
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int I_FPSTime()
|
|
||||||
{
|
{
|
||||||
timeval now;
|
timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
|
|
||||||
return static_cast<unsigned int>(
|
return static_cast<unsigned int>(
|
||||||
(now.tv_sec) * 1000 + (now.tv_usec) / 1000);
|
(now.tv_sec - time.tv_sec ) * 1000
|
||||||
|
+ (now.tv_usec - time.tv_usec) / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
bool s_isTicFrozen;
|
bool s_isTicFrozen;
|
||||||
|
|
||||||
timespec GetNextTickTime()
|
timespec GetNextTickTime()
|
||||||
|
@ -185,6 +175,17 @@ void FreezeTimeThreaded(bool frozen)
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int I_MSTime()
|
||||||
|
{
|
||||||
|
return GetMillisecondsSince(s_gameStartTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int I_FPSTime()
|
||||||
|
{
|
||||||
|
return GetMillisecondsSince(s_systemBootTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fixed_t I_GetTimeFrac(uint32* ms)
|
fixed_t I_GetTimeFrac(uint32* ms)
|
||||||
{
|
{
|
||||||
const uint32_t now = I_MSTime();
|
const uint32_t now = I_MSTime();
|
||||||
|
@ -205,7 +206,12 @@ void I_InitTimer()
|
||||||
assert(!s_timerInitialized);
|
assert(!s_timerInitialized);
|
||||||
s_timerInitialized = true;
|
s_timerInitialized = true;
|
||||||
|
|
||||||
gettimeofday(&s_startTicks, NULL);
|
gettimeofday(&s_gameStartTicks, NULL);
|
||||||
|
|
||||||
|
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
|
||||||
|
size_t len = sizeof s_systemBootTicks;
|
||||||
|
|
||||||
|
sysctl(mib, 2, &s_systemBootTicks, &len, NULL, 0);
|
||||||
|
|
||||||
pthread_cond_init (&s_timerEvent, NULL);
|
pthread_cond_init (&s_timerEvent, NULL);
|
||||||
pthread_mutex_init(&s_timerMutex, NULL);
|
pthread_mutex_init(&s_timerMutex, NULL);
|
||||||
|
|
|
@ -286,7 +286,6 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLFB *fb = new SDLFB (width, height, fullscreen);
|
SDLFB *fb = new SDLFB (width, height, fullscreen);
|
||||||
retry = 0;
|
|
||||||
|
|
||||||
// If we could not create the framebuffer, try again with slightly
|
// If we could not create the framebuffer, try again with slightly
|
||||||
// different parameters in this order:
|
// different parameters in this order:
|
||||||
|
@ -327,6 +326,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
||||||
++retry;
|
++retry;
|
||||||
fb = static_cast<SDLFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
|
fb = static_cast<SDLFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
|
||||||
}
|
}
|
||||||
|
retry = 0;
|
||||||
|
|
||||||
fb->SetFlash (flashColor, flashAmount);
|
fb->SetFlash (flashColor, flashAmount);
|
||||||
|
|
||||||
|
|
|
@ -150,11 +150,28 @@ void FResourceLump::LumpNameSetup(const char *iname)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
static bool IsWadInFolder(const FResourceFile* const archive, const char* const resPath)
|
||||||
|
{
|
||||||
|
// Checks a special case when <somefile.wad> was put in
|
||||||
|
// <myproject> directory inside <myproject.zip>
|
||||||
|
|
||||||
|
if (NULL == archive)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FString dirName = ExtractFileBase(archive->Filename);
|
||||||
|
const FString fileName = ExtractFileBase(resPath, true);
|
||||||
|
const FString filePath = dirName + '/' + fileName;
|
||||||
|
|
||||||
|
return 0 == filePath.CompareNoCase(resPath);
|
||||||
|
}
|
||||||
|
|
||||||
void FResourceLump::CheckEmbedded()
|
void FResourceLump::CheckEmbedded()
|
||||||
{
|
{
|
||||||
// Checks for embedded archives
|
// Checks for embedded archives
|
||||||
const char *c = strstr(FullName, ".wad");
|
const char *c = strstr(FullName, ".wad");
|
||||||
if (c && strlen(c) == 4 && !strchr(FullName, '/'))
|
if (c && strlen(c) == 4 && (!strchr(FullName, '/') || IsWadInFolder(Owner, FullName)))
|
||||||
{
|
{
|
||||||
// Mark all embedded WADs
|
// Mark all embedded WADs
|
||||||
Flags |= LUMPF_EMBEDDED;
|
Flags |= LUMPF_EMBEDDED;
|
||||||
|
|
|
@ -2504,12 +2504,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(2);
|
ACTION_PARAM_START(3);
|
||||||
ACTION_PARAM_FIXED(scalex, 0);
|
ACTION_PARAM_FIXED(scalex, 0);
|
||||||
ACTION_PARAM_FIXED(scaley, 1);
|
ACTION_PARAM_FIXED(scaley, 1);
|
||||||
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
self->scaleX = scalex;
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
self->scaleY = scaley ? scaley : scalex;
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ref->scaleX = scalex;
|
||||||
|
ref->scaleY = scaley ? scaley : scalex;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -3934,10 +3943,19 @@ enum
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(2);
|
ACTION_PARAM_START(3);
|
||||||
ACTION_PARAM_ANGLE(angle, 0);
|
ACTION_PARAM_ANGLE(angle, 0);
|
||||||
ACTION_PARAM_INT(flags, 1)
|
ACTION_PARAM_INT(flags, 1);
|
||||||
self->SetAngle(angle, !!(flags & SPF_INTERPOLATE));
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ref->SetAngle(angle, !!(flags & SPF_INTERPOLATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -3950,18 +3968,27 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(2);
|
ACTION_PARAM_START(3);
|
||||||
ACTION_PARAM_ANGLE(pitch, 0);
|
ACTION_PARAM_ANGLE(pitch, 0);
|
||||||
ACTION_PARAM_INT(flags, 1);
|
ACTION_PARAM_INT(flags, 1);
|
||||||
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
if (self->player != NULL || (flags & SPF_FORCECLAMP))
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ref->player != NULL || (flags & SPF_FORCECLAMP))
|
||||||
{ // clamp the pitch we set
|
{ // clamp the pitch we set
|
||||||
int min, max;
|
int min, max;
|
||||||
|
|
||||||
if (self->player != NULL)
|
if (ref->player != NULL)
|
||||||
{
|
{
|
||||||
min = self->player->MinPitch;
|
min = ref->player->MinPitch;
|
||||||
max = self->player->MaxPitch;
|
max = ref->player->MaxPitch;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3970,7 +3997,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
||||||
}
|
}
|
||||||
pitch = clamp<int>(pitch, min, max);
|
pitch = clamp<int>(pitch, min, max);
|
||||||
}
|
}
|
||||||
self->SetPitch(pitch, !!(flags & SPF_INTERPOLATE));
|
ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -3983,10 +4010,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(2);
|
ACTION_PARAM_START(3);
|
||||||
ACTION_PARAM_ANGLE(roll, 0);
|
ACTION_PARAM_ANGLE(roll, 0);
|
||||||
ACTION_PARAM_INT(flags, 1);
|
ACTION_PARAM_INT(flags, 1);
|
||||||
self->SetRoll(roll, !!(flags & SPF_INTERPOLATE));
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ref->SetRoll(roll, !!(flags & SPF_INTERPOLATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -3999,20 +4035,29 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll)
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(1);
|
ACTION_PARAM_START(2);
|
||||||
ACTION_PARAM_FIXED(scale, 0);
|
ACTION_PARAM_FIXED(scale, 0);
|
||||||
|
ACTION_PARAM_INT(ptr, 1);
|
||||||
|
|
||||||
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
INTBOOL was_moving = self->velx | self->vely | self->velz;
|
INTBOOL was_moving = self->velx | self->vely | self->velz;
|
||||||
|
|
||||||
self->velx = FixedMul(self->velx, scale);
|
ref->velx = FixedMul(ref->velx, scale);
|
||||||
self->vely = FixedMul(self->vely, scale);
|
ref->vely = FixedMul(ref->vely, scale);
|
||||||
self->velz = FixedMul(self->velz, scale);
|
ref->velz = FixedMul(ref->velz, scale);
|
||||||
|
|
||||||
// If the actor was previously moving but now is not, and is a player,
|
// If the actor was previously moving but now is not, and is a player,
|
||||||
// update its player variables. (See A_Stop.)
|
// update its player variables. (See A_Stop.)
|
||||||
if (was_moving)
|
if (was_moving)
|
||||||
{
|
{
|
||||||
CheckStopped(self);
|
CheckStopped(ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4029,12 +4074,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
|
||||||
ACTION_PARAM_FIXED(y, 1);
|
ACTION_PARAM_FIXED(y, 1);
|
||||||
ACTION_PARAM_FIXED(z, 2);
|
ACTION_PARAM_FIXED(z, 2);
|
||||||
ACTION_PARAM_INT(flags, 3);
|
ACTION_PARAM_INT(flags, 3);
|
||||||
|
ACTION_PARAM_INT(ptr, 4);
|
||||||
|
|
||||||
INTBOOL was_moving = self->velx | self->vely | self->velz;
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
INTBOOL was_moving = ref->velx | ref->vely | ref->velz;
|
||||||
|
|
||||||
fixed_t vx = x, vy = y, vz = z;
|
fixed_t vx = x, vy = y, vz = z;
|
||||||
fixed_t sina = finesine[self->angle >> ANGLETOFINESHIFT];
|
fixed_t sina = finesine[ref->angle >> ANGLETOFINESHIFT];
|
||||||
fixed_t cosa = finecosine[self->angle >> ANGLETOFINESHIFT];
|
fixed_t cosa = finecosine[ref->angle >> ANGLETOFINESHIFT];
|
||||||
|
|
||||||
if (flags & 1) // relative axes - make x, y relative to actor's current angle
|
if (flags & 1) // relative axes - make x, y relative to actor's current angle
|
||||||
{
|
{
|
||||||
|
@ -4043,15 +4097,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity)
|
||||||
}
|
}
|
||||||
if (flags & 2) // discard old velocity - replace old velocity with new velocity
|
if (flags & 2) // discard old velocity - replace old velocity with new velocity
|
||||||
{
|
{
|
||||||
self->velx = vx;
|
ref->velx = vx;
|
||||||
self->vely = vy;
|
ref->vely = vy;
|
||||||
self->velz = vz;
|
ref->velz = vz;
|
||||||
}
|
}
|
||||||
else // add new velocity to old velocity
|
else // add new velocity to old velocity
|
||||||
{
|
{
|
||||||
self->velx += vx;
|
ref->velx += vx;
|
||||||
self->vely += vy;
|
ref->vely += vy;
|
||||||
self->velz += vz;
|
ref->velz += vz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (was_moving)
|
if (was_moving)
|
||||||
|
@ -5064,10 +5118,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem)
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(1);
|
ACTION_PARAM_START(2);
|
||||||
ACTION_PARAM_FIXED(speed, 0);
|
ACTION_PARAM_FIXED(speed, 0);
|
||||||
|
ACTION_PARAM_INT(ptr, 1);
|
||||||
|
|
||||||
self->Speed = speed;
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ref->Speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DoCheckSpecies(AActor *mo, FName species, bool exclude)
|
static bool DoCheckSpecies(AActor *mo, FName species, bool exclude)
|
||||||
|
@ -5656,7 +5719,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
|
||||||
//
|
//
|
||||||
// A_SetFloatBobPhase
|
// A_SetFloatBobPhase
|
||||||
//
|
//
|
||||||
// Changes the FloatBobPhase of the
|
// Changes the FloatBobPhase of the actor.
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
||||||
|
@ -5669,6 +5732,73 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
||||||
self->FloatBobPhase = bob;
|
self->FloatBobPhase = bob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// A_SetHealth
|
||||||
|
//
|
||||||
|
// Changes the health of the actor.
|
||||||
|
// Takes a pointer as well.
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(2);
|
||||||
|
ACTION_PARAM_INT(health, 0);
|
||||||
|
ACTION_PARAM_INT(ptr, 1);
|
||||||
|
|
||||||
|
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!mobj)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player_t *player = mobj->player;
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
if (health <= 0)
|
||||||
|
player->mo->health = mobj->health = player->health = 1; //Copied from the buddha cheat.
|
||||||
|
else
|
||||||
|
player->mo->health = mobj->health = player->health = health;
|
||||||
|
}
|
||||||
|
else if (mobj)
|
||||||
|
{
|
||||||
|
if (health <= 0)
|
||||||
|
mobj->health = 1;
|
||||||
|
else
|
||||||
|
mobj->health = health;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// A_ResetHealth
|
||||||
|
//
|
||||||
|
// Resets the health of the actor to default, except if their dead.
|
||||||
|
// Takes a pointer.
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(1);
|
||||||
|
ACTION_PARAM_INT(ptr, 0);
|
||||||
|
|
||||||
|
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
|
if (!mobj)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player_t *player = mobj->player;
|
||||||
|
if (player && (player->mo->health > 0))
|
||||||
|
{
|
||||||
|
player->health = player->mo->health = player->mo->GetDefault()->health; //Copied from the resurrect cheat.
|
||||||
|
}
|
||||||
|
else if (mobj && (mobj->health > 0))
|
||||||
|
{
|
||||||
|
mobj->health = mobj->SpawnHealth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// A_SetRipperLevel(int level)
|
// A_SetRipperLevel(int level)
|
||||||
|
|
|
@ -296,6 +296,16 @@ protected:
|
||||||
static FNullStringData NullString;
|
static FNullStringData NullString;
|
||||||
|
|
||||||
friend struct FStringData;
|
friend struct FStringData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Prevent these from being called as current practices are to use Compare.
|
||||||
|
// Without this FStrings will be accidentally compared against char* ptrs.
|
||||||
|
bool operator == (const FString &illegal) const;
|
||||||
|
bool operator != (const FString &illegal) const;
|
||||||
|
bool operator < (const FString &illegal) const;
|
||||||
|
bool operator > (const FString &illegal) const;
|
||||||
|
bool operator <= (const FString &illegal) const;
|
||||||
|
bool operator >= (const FString &illegal) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace StringFormat
|
namespace StringFormat
|
||||||
|
|
|
@ -231,7 +231,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_FadeIn(float reduce = 0.1, int flags = 0);
|
action native A_FadeIn(float reduce = 0.1, int flags = 0);
|
||||||
action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true
|
action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true
|
||||||
action native A_FadeTo(float target, float amount = 0.1, int flags = 0);
|
action native A_FadeTo(float target, float amount = 0.1, int flags = 0);
|
||||||
action native A_SetScale(float scalex, float scaley = 0);
|
action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_SetMass(int mass);
|
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_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1);
|
||||||
action native A_CheckSight(state label);
|
action native A_CheckSight(state label);
|
||||||
|
@ -289,11 +289,11 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3);
|
action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3);
|
||||||
action native A_PigPain ();
|
action native A_PigPain ();
|
||||||
action native A_MonsterRefire(int chance, state label);
|
action native A_MonsterRefire(int chance, state label);
|
||||||
action native A_SetAngle(float angle = 0, int flags = 0);
|
action native A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_SetPitch(float pitch, int flags = 0);
|
action native A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_SetRoll(float roll, int flags = 0);
|
action native A_SetRoll(float roll, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_ScaleVelocity(float scale);
|
action native A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0);
|
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_SetArg(int pos, int value);
|
action native A_SetArg(int pos, int value);
|
||||||
action native A_SetUserVar(name varname, int value);
|
action native A_SetUserVar(name varname, int value);
|
||||||
action native A_SetUserArray(name varname, int index, int value);
|
action native A_SetUserArray(name varname, int index, int value);
|
||||||
|
@ -302,7 +302,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_SetTics(int tics);
|
action native A_SetTics(int tics);
|
||||||
action native A_SetDamageType(name damagetype);
|
action native A_SetDamageType(name damagetype);
|
||||||
action native A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
|
action native A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
|
||||||
action native A_SetSpeed(float speed);
|
action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
||||||
action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
||||||
action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
|
||||||
|
@ -327,6 +327,8 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_SetTeleFog(name oldpos, name newpos);
|
action native A_SetTeleFog(name oldpos, name newpos);
|
||||||
action native A_SwapTeleFog();
|
action native A_SwapTeleFog();
|
||||||
action native A_SetFloatBobPhase(int bob);
|
action native A_SetFloatBobPhase(int bob);
|
||||||
|
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
|
||||||
|
action native A_ResetHealth(int ptr = AAPTR_DEFAULT);
|
||||||
action native A_SetRipperLevel(int level);
|
action native A_SetRipperLevel(int level);
|
||||||
action native A_SetRipMin(int min);
|
action native A_SetRipMin(int min);
|
||||||
action native A_SetRipMax(int max);
|
action native A_SetRipMax(int max);
|
||||||
|
|
Loading…
Reference in a new issue