Fri Jan 27, 2017 11:03 pm
ZZYZX wrote:Vaecrius wrote:Thanks!
(I assume "&&(players[i].mo)" would do the trick? Or do I need to add a !=null after the mo?)
Objects implicitly cast to bool like in C, yes.Vaecrius wrote:What's the difference between the AddInventory and GiveInventory (and GiveAmmo) functions? Does Add bypass pickup states? Do the first two ignore skill-based ammo doubling?
AddInventory takes an Inventory object (possibly created using Spawn()).
GiveInventory takes a class name.
ZZYZX wrote:Ok, minus two scripted calls and minus four native calls http://pastebin.com/pmfTPmAq, because 30x slower function call here means noticeably smaller FPS with large usage counts.
class SetToSlope
{
static void SetToSlope(void)
{
// code
}
}
// trying it on a monster...
class Z_TestMonster : Z_MonsterBase
{
override void Tick(void)
{
Super.Tick();
SetToSlope.SetToSlope();
}
}
// trying it on a blood splat...
class Z_BloodSplat : Z_BloodBase
{
override void Tick(void)
{
Super.Tick();
SetToSlope.SetToSlope();
}
}
Fri Jan 27, 2017 11:41 pm
class Lib
{
static void SetToSlope(Actor self) { ... }
}
Lib.SetToSlope(self);
Fri Jan 27, 2017 11:53 pm
ZZYZX wrote:Solution
//===========================================================================
//
// GENERIC PHYSICS CLASS
//
//===========================================================================
class Physics
{
static void AlignToSlope(Actor self, double dAng, double dPitch)
{
vector3 fNormal = self.CurSector.FloorPlane.Normal;
vector2 fNormalP1 = (fNormal.X != 0 || fNormal.Y != 0) ? (fNormal.X, fNormal.Y).Unit() : (0, 0);
vector2 fNormalP2 = ((fNormal.X, fNormal.Y).Length(), fNormal.Z);
double fAng = atan2(fNormalP1.Y, fNormalP1.X); // floor angle (not pitch!)
double fPitch = -atan2(fNormalP2.X, fNormalP2.Y); // floor pitch
double dDiff1 = sin(fAng - (dAng + dPitch));
double dDiff2 = cos(fAng - dAng);
self.Pitch = fPitch * dDiff2 + dPitch;
self.Roll = fPitch * dDiff1;
self.Angle = dAng;
}
}
class Z_BloodSpot : Z_BloodBase
{
bool bSloped;
override void Tick()
{
if (!bSloped)
{
Physics.AlignToSlope(self, self.Angle, 0.f);
bSloped = true;
}
Super.Tick();
}
}
Fri Jan 27, 2017 11:57 pm
Fri Jan 27, 2017 11:59 pm
Sat Jan 28, 2017 12:04 am
class Lib{
static void ShootMissile(actor self,class<Actor> ms="DoomImpBall",double ht=-1){
if(ht<0) ht=self.height-12; //the real default
actor prj=Spawn(ms,(pos.x,pos.y,pos.z+ht),ALLOW_REPLACE);
prj.vel=vel;prj.angle=angle;prj.pitch=pitch;
prj.target=self;prj.master=self;
prj.vel+=(prj.speed*cos(pitch)*cos(angle),prj.speed*cos(pitch)*sin(angle),
prj.speed*sin(-pitch));
}
}
Sat Jan 28, 2017 12:15 am
Sat Jan 28, 2017 1:59 am
Sat Jan 28, 2017 5:53 am
Sat Jan 28, 2017 6:46 am
Sat Jan 28, 2017 6:51 am
Nash wrote:Very specific question: How do I make a bullet puff of a hitscan's weapon do something different depending on whether it hit a wall, or a ceiling/floor? Is there any mechanics built-in that can detect these situations?
Sat Jan 28, 2017 7:05 am
The Zombie Killer wrote:There's probably better ways to do it, but I'd use GetZAt or A_CheckSolidFooting on puff spawn to check if it's on the floor or ceiling.
Sun Jan 29, 2017 1:51 am
movetarget=spawn("idledummy",pos);
...[in between the movetarget is placed in a position flanking the target]...
//call A_Chase using the movetarget
targbak=target; target=movetarget;
A_Chase(null,null,CHF_NODIRECTIONTURN);
target=targbak;
Sun Jan 29, 2017 3:20 am
Sun Jan 29, 2017 3:54 am
Nash wrote:Okay, this solves the condition filtering... now is there any way to get any information about the LINEDEF that the bullet attack hit? I'm hoping to retrieve the angle of the wall that the bullet just hit.