marrub
/
Lithia
Archived
1
0
Fork 0
This repository has been archived on 2023-06-17. You can view files and clone it, but cannot push or open issues/pull-requests.
Lithia/source/Main/u_punctcannon.c

63 lines
1.4 KiB
C

// Copyright © 2016-2017 Graham Sanderson, all rights reserved.
// Required for sincos(3).
#define _GNU_SOURCE
#include "lith_upgrades_common.h"
// Extern Functions ----------------------------------------------------------|
//
// Lith_PunctuatorFire
//
script acs void Lith_PunctuatorFire(void)
{
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