82 lines
2.1 KiB
C
82 lines
2.1 KiB
C
/*
|
|
* This program source code file is part of SystemK, a library in the KTag project.
|
|
*
|
|
* 🛡️ <https://ktag.clubk.club> 🃞
|
|
*
|
|
* Copyright © 2016-2025 Joseph P. Kearney and the KTag developers.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
* the terms of the GNU Affero General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
|
* later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
* details.
|
|
*
|
|
* There should be a copy of the GNU Affero General Public License in the LICENSE
|
|
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef WEAPON_H
|
|
#define WEAPON_H
|
|
|
|
//! These have assigned values because they are stored in #NVM_WEAPON_ID.
|
|
typedef enum
|
|
{
|
|
TEST_PATTERN_ID = 0,
|
|
BAYONETTE_ID = 1,
|
|
PISTOL_ID = 2,
|
|
SHOTGUN_ID = 3,
|
|
RIFLE_ID = 4,
|
|
MACHINE_GUN_ID = 5,
|
|
NERF_LASER_OPS_ID = 6,
|
|
NERF_LASER_STRIKE_BLASTER_ID = 7,
|
|
NERF_PHOENIX_LTX_ID = 8,
|
|
SQUAD_HERO_PISTOL = 9,
|
|
LASER_X_ID = 10,
|
|
DUBUQUE_PROTOCOL_ID = 11,
|
|
// Leave this last!
|
|
NUMBER_OF_WEAPONS
|
|
} WeaponID_t;
|
|
|
|
typedef enum
|
|
{
|
|
EDGE,
|
|
PROJECTILE,
|
|
EXPLOSION,
|
|
ENERGY
|
|
} WeaponType_t;
|
|
|
|
typedef struct
|
|
{
|
|
WeaponID_t ID;
|
|
WeaponType_t Type;
|
|
Protocol_T Protocol;
|
|
uint16_t Damage_Per_Shot;
|
|
uint16_t Shots_Per_Reload;
|
|
|
|
uint32_t Delay_Before_Sending_Shot_in_ms;
|
|
//! This is the inverse of "Rate of Fire".
|
|
uint32_t Time_Between_Shots_in_ms;
|
|
uint32_t Time_To_Reload_in_ms;
|
|
|
|
} Weapon_t;
|
|
|
|
extern Weapon_t WeaponsByID[NUMBER_OF_WEAPONS];
|
|
|
|
__attribute__((always_inline)) inline Weapon_t GetWeaponFromID(WeaponID_t id)
|
|
{
|
|
Weapon_t result = WeaponsByID[TEST_PATTERN_ID];
|
|
|
|
if (id < NUMBER_OF_WEAPONS)
|
|
{
|
|
result = WeaponsByID[id];
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
#endif // WEAPON_H
|
|
|