2018-08-08 21:02:47 -07:00
|
|
|
// Copyright © 2016-2017 Graham Sanderson, all rights reserved.
|
|
|
|
// Required for sincos(3).
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include "lith_upgrades_common.h"
|
|
|
|
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lith_PunctuatorFire
|
|
|
|
//
|
2018-08-09 21:27:27 -07:00
|
|
|
script acs void Lith_PunctuatorFire(void)
|
2018-08-08 21:02:47 -07:00
|
|
|
{
|
|
|
|
withplayer(LocalPlayer)
|
|
|
|
{
|
|
|
|
int ptid = ACS_UniqueTID();
|
|
|
|
|
|
|
|
ACS_LineAttack(0, p->yaw, p->pitch, 128, "Lith_PunctuatorPuff", "None", 2048.0, FHF_NORANDOMPUFFZ, ptid);
|
|
|
|
|
|
|
|
if(ACS_ThingCount(T_NONE, ptid))
|
|
|
|
{
|
|
|
|
fixed x = ACS_GetActorX(ptid);
|
|
|
|
fixed y = ACS_GetActorY(ptid);
|
|
|
|
fixed z = ACS_GetActorZ(ptid);
|
|
|
|
|
|
|
|
float yaw = atan2f(p->y - y, p->x - x);
|
|
|
|
|
|
|
|
float ps, cz;
|
|
|
|
float ys, yc;
|
|
|
|
sincosf(p->pitchf, &ps, &cz);
|
|
|
|
sincosf(yaw, &ys, &yc);
|
|
|
|
|
|
|
|
float cx = ps * yc;
|
|
|
|
float cy = ps * ys;
|
|
|
|
|
|
|
|
for(int i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
float sx = x + (cx * -(32 * i));
|
|
|
|
float sy = y + (cy * -(32 * i));
|
|
|
|
float sz = z + (cz * -(32 * i));
|
|
|
|
|
|
|
|
int etid = ACS_UniqueTID();
|
|
|
|
|
|
|
|
ACS_SpawnForced("Lith_PunctuatorExplosion", sx, sy, sz, etid);
|
|
|
|
|
|
|
|
ACS_SetActivator(etid);
|
|
|
|
ACS_SetPointer(AAPTR_TARGET, p->tid);
|
|
|
|
p->setActivator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Deactivate
|
|
|
|
//
|
|
|
|
void Upgr_PunctCannon_Deactivate(struct player *p, upgrade_t *upgr)
|
|
|
|
{
|
|
|
|
InvGive("Lith_GTFO", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// EOF
|
|
|
|
|