Ejemplo n.º 1
0
void Weapon::preloadAmmo(std::string name, double mass) {
    loadAmmo(name, mass);
    if (m_preload_avaiable) {
        m_reload_timer = 0;
        m_preload_avaiable = false;
    }
}
Ejemplo n.º 2
0
/***** funktionen tar spelarens pos. samt muspekarens pos. skapar längdvektor
       och sen bedömmer i vilken riktning ska projektilen färdas *****/
int addBullet(int x, int y,int dx, Bullet b[],int b1,int b2)
{
    int i = loadAmmo(b);
    if(i== -1)
    {
        printf("couldn't get a free slot for a bullet!\n");
        return i;
    }
    b[i].x = x;
    b[i].y = y;
    b[i].v_length = sqrt(((b1-b[i].x)*(b1-b[i].x)) + ((b2 - b[i].y)*(b2 - b[i].y)));

    b[i].directionX = b1 - b[i].x;
    b[i].directionY = b2 - b[i].y;

    b[i].vector_unitX = (b[i].directionX) / b[i].v_length;
    b[i].vector_unitY = (b[i].directionY) / b[i].v_length;
    return i;
}
Ejemplo n.º 3
0
void rxedBarrelAck(void) {
	/*	Format:		BType		$41
					BSum		$cs
	*/
	//This one we actually care about, if we were trying to reload.
	if(weAreReloading == 1) {
		//Because we still need to actually arm the secondary weapon!
		//Flag that we need to send this when possible.
		sendArmSpecial = 1;
	} else if(weAreReloading == 2) {
		weAreReloading = 0;
		//We're now in control of sending IR. Set everything up for that.
		loadAmmo(AMMO);
		if(DOUBLETAPS & 0x08) {
			//The "free" doubletap shot is loaded
			ir_doubletap_state = 2;
			ir_loaded_tags++;
		}
		//Slow down reloading a bit...
		reloadCooldown = 800;
	}
}