omi-eikyo/src/g_missile.c

53 lines
1.1 KiB
C

// Copyright © 2017 Project Golan, all rights reserved.
// See COPYING for more information.
#define _GNU_SOURCE // Required for sincos(3). See feature_test_macros(7)
#include "g_missile.h"
#include "g_object.h"
#include "m_math.h"
#include <math.h>
// Extern Functions ----------------------------------------------------------|
//
// G_Missile_Fire
//
void G_Missile_Fire(enum G_msltype type, unsigned owner, fixed x, fixed y, fixed z, ulfra yaw)
{
G_entity ot = {owner};
G_missile th = {DGE_MissileEntity_Create(0)};
th.subtype = subtype_missile;
th.x = ot.x + x;
th.y = ot.y + y;
th.z = ot.z + z;
th.yaw = yaw;
th.health = 1;
th.damage = 1;
th.owner = owner;
th.sz = 4;
float s, c;
sincosf(M_angle(yaw), &s, &c);
switch(type)
{
case missile_p_basicL:
th.sprite = DGE_Texture_Get(s"ent/shotl"); goto player;
case missile_p_basicR:
th.sprite = DGE_Texture_Get(s"ent/shotr"); goto player;
player:
th.ca = 0.7ulr;
th.rsx = 6;
th.rsy = 16;
th.sx = 6;
th.sy = 18;
th.vx = c * 14;
th.vy = s * 14;
break;
}
}
// EOF