void ArmSpecial(void) { /* ARM-SPECIAL Format: BType $42 BData0 BurstSize (1-15) BData1 Ammo (1-15) BData2 TrigRate (13-255) BSum $cs BurstSize is in the range 1 to 15, 15 meaning unlimited firing. Ammo is the amount of ready ammo to indicate in the Ammo Power Bar and should normally be in the range 1-10. TrigRate is the number of milliseconds between shots in increments of 10msec. */ //BType queueByte(0x42); //BData0 queueByte(BURSTSIZE); //BData1 queueByte(AMMO); //BData2 queueByte(TRIGRATE); //BSum queueChecksum(); //Send it! sendQueue(); //We're expecting another ACK from this. weAreReloading = 2; }
static inline void write(sword val) { if (val < 0) { queueByte('-'); write((word)-val); } else { write((word)val); } }
/** * Print given signed number */ static inline void write(sbyte val) { if (val < 0) { queueByte('-'); write((byte)-val); } else { write((byte)val); } }
void BarrelReply(void) { /* BARREL-REPLY Format: BType $40 BData0 Barrel Type BSum $cs Barrels send this block in response to $00 ROLL-CALL blocks. BData0 should be 0x01 for a shotgun, 0x02 for a machinegun, 0x03 for a sniper, 0x04 for a grenade launcher. Other values are undefined, but can be used. */ //BType queueByte(0x40); //BData0 queueByte(BARRELTYPE); //BSum queueChecksum(); //Send it! sendQueue(); }
void queueChecksum(void) { int i; unsigned char checksum = 0xFF; //Calculate a checksum for all the data that's currently in the queue. for(i = 0; i < temp_tx_size;i++) { checksum -= ser_tx_buffer[i]; } //Add the checksum to the queue. queueByte(checksum); }
void LoadSpecial(void) { /* LOAD-SPECIAL Format: BType $41 BData0 Ammo Needed (1-10) BData1 DoubleTaps BData2 LoadSFX BData3 FireSFX BData4 DisplayMode BSum $cs Unloads any ready ammo and loads special shot. Ammo Needed is how much ammo will be deducted from the available total. DoubleTaps is (UNKNOWN). LoadSFX is what sound effect will be played when this block is RX'd by the tagger. FireSFX is what sound effect will be played when the trigger is pulled after this special ammo is loaded/armed. DisplayMode is what will be shown on the ammo display of the tagger. */ //BType queueByte(0x41); //BData0 queueByte(AMMONEEDED); //BData1 queueByte(DOUBLETAPS); //BData2 queueByte(LOADSFX); //BData3 queueByte(FIRESFX); //BData4 queueByte(DISPLAYMODE); //BSum queueChecksum(); //We also need to mark that we're trying to load something and are expecting a response from the tagger. weAreReloading = 1; //Send it! sendQueue(); }
static inline void write(const char* str) { for (byte i=0;str[i]!='\0';i++) { queueByte(str[i]); } }
/** * Print given character or string */ static inline void write(char c) { queueByte(c); }