Implements weapon systems including animations, shooting mechanics, and particle effects. More...
Go to the source code of this file.
Classes | |
| struct | GunResources |
| Resources used by a gun. More... | |
| struct | GunState |
| Gun state structure. More... | |
| struct | GunConfig |
| Gun configuration structure. More... | |
| struct | GunStats |
| Gun statistics structure. More... | |
| struct | GunData |
| Gun data structure. More... | |
Macros | |
| #define | GUN_SHOTGUN_NAME "Beretta 1301 Tactical" |
| Gun name definitions. | |
| #define | GUN_BATTLE_RIFLE_NAME "FN SCAR-H" |
| #define | GUN_SMG_NAME "HK UMP45" |
| #define | GUN_ASSAULT_RIFLE_NAME "M4A1 URG-I" |
| #define | GUN_PISTOL_NAME "Glock 17" |
| #define | GUN_REVOLVER_NAME "Chiappa Rhino 200DS" |
| #define | GUN_ARMOR_PISTOL_NAME "FN Five-seveN Mk3 MRD" |
| #define | GUN_RAPID_SMG_NAME "KRISS Vector" |
| #define | GUN_PDW_NAME "FN P90" |
| #define | GUN_BURST_RIFLE_NAME "M16A4" |
| #define | GUN_BULLPUP_RIFLE_NAME "Kel-Tec RFB" |
| #define | GUN_AUTO_SHOTGUN_NAME "Atchisson AA-12" |
| #define | BULLET_VELOCITY_SLOW 400 |
| Bullet velocity constants. | |
| #define | BULLET_VELOCITY_MID 600 |
| #define | BULLET_VELOCITY_FAST 800 |
| #define | BULLET_VELOCITY_REAL_FAST 1000 |
Typedefs | |
| typedef enum Gun | Gun |
| typedef enum GunFireMode | GunFireMode |
| typedef struct GunResources | GunResources |
| Resources used by a gun. | |
| typedef struct GunState | GunState |
| Gun state structure. | |
| typedef struct GunConfig | GunConfig |
| Gun configuration structure. | |
| typedef struct GunStats | GunStats |
| Gun statistics structure. | |
| typedef struct GunData | GunData |
| Gun data structure. | |
Enumerations | |
| enum | Gun { GUN_NONE = -1 , GUN_PISTOL , GUN_SMG , GUN_SHOTGUN , GUN_ASSAULT_RIFLE , GUN_BATTLE_RIFLE , GUN_REVOLVER , GUN_ARMOR_PISTOL , GUN_RAPID_SMG , GUN_PDW , GUN_BURST_RIFLE , GUN_BULLPUP_RIFLE , GUN_AUTO_SHOTGUN , GUN_COUNT } |
| enum | GunFireMode { FIREMODE_SEMI , FIREMODE_AUTO , FIREMODE_BURST } |
Functions | |
| void | Gun_UpdatePosition (GunData *gun, Vec2 ownerPosition, Vec2 targetPosition, Vec2 gunOffset) |
| Updates gun position, orientation and associated particle emitters. | |
| void | Gun_AnimationUpdate () |
| Updates gun animations. | |
| void | Gun_Render () |
| Renders all guns. | |
| void | Gun_Start () |
| Initializes gun systems. | |
| void | Gun_Update () |
| Updates gun state. | |
Variables | |
| GunData | Gun_Pistol |
| Pistol weapon data. | |
| GunData | Gun_SMG |
| SMG weapon data. | |
| GunData | Gun_Shotgun |
| Shotgun weapon data. | |
| GunData | Gun_AssaultRifle |
| Assault rifle weapon data. | |
| GunData | Gun_BattleRifle |
| Battle rifle weapon data. | |
| GunData | GunList [GUN_COUNT] |
| Array of all available guns. | |
Implements weapon systems including animations, shooting mechanics, and particle effects.
This includes the gun's animations, rendering, and updating.
| #define BULLET_VELOCITY_FAST 800 |
| #define BULLET_VELOCITY_MID 600 |
| #define BULLET_VELOCITY_REAL_FAST 1000 |
| #define BULLET_VELOCITY_SLOW 400 |
Bullet velocity constants.
| #define GUN_ARMOR_PISTOL_NAME "FN Five-seveN Mk3 MRD" |
| #define GUN_ASSAULT_RIFLE_NAME "M4A1 URG-I" |
| #define GUN_AUTO_SHOTGUN_NAME "Atchisson AA-12" |
| #define GUN_BATTLE_RIFLE_NAME "FN SCAR-H" |
| #define GUN_BULLPUP_RIFLE_NAME "Kel-Tec RFB" |
| #define GUN_BURST_RIFLE_NAME "M16A4" |
| #define GUN_PDW_NAME "FN P90" |
| #define GUN_PISTOL_NAME "Glock 17" |
| #define GUN_RAPID_SMG_NAME "KRISS Vector" |
| #define GUN_REVOLVER_NAME "Chiappa Rhino 200DS" |
| #define GUN_SHOTGUN_NAME "Beretta 1301 Tactical" |
Gun name definitions.
| #define GUN_SMG_NAME "HK UMP45" |
Gun configuration structure.
Contains positioning data and particle effect configurations for a gun
Gun data structure.
Complete definition of a gun, including name, resources, state, config, stats, and animation data
| typedef enum GunFireMode GunFireMode |
| typedef struct GunResources GunResources |
Resources used by a gun.
Gun state structure.
Contains the runtime state information for a gun
Gun statistics structure.
Contains the configuration values that define a gun's capabilities
| enum Gun |
| enum GunFireMode |
| void Gun_AnimationUpdate | ( | ) |
Updates gun animations.
Updates gun animations.
Selects the appropriate animation clip based on gun orientation and advances the animation frame.
| void Gun_Render | ( | ) |
Renders all guns.
Renders all guns.
Draws the current weapon with proper rotation and flipping, and renders muzzle flash and casing particles with correct layering based on weapon orientation.
| void Gun_Start | ( | ) |
Initializes gun systems.
Initializes gun systems.
Populates the gun list with all weapon types, assigns particle emitter presets, and creates animation resources for each gun.
| void Gun_Update | ( | ) |
Updates gun state.
Updates gun state.
Updates the gun's position relative to the player, calculates the angle based on mouse position, and updates particle emitter positions for muzzle flash and casings. Flips the gun sprite horizontally when aiming to the left.
Updates gun position, orientation and associated particle emitters.
| gun | Pointer to the gun data structure |
| ownerPosition | Position of the entity that owns the gun |
| targetPosition | Position to aim at (usually player position) |
| gunOffset | Additional offset from owner position |
A generalized function to handle gun positioning, orientation, and particle emitter updates for any entity (player or enemy) that uses a gun. This eliminates duplicate code across different enemy types.
| gun | Pointer to the gun data structure |
| ownerPosition | Position of the entity that owns the gun |
| targetPosition | Position to aim at (usually player position) |
| gunOffset | Additional offset from owner position |
|
extern |
Assault rifle weapon data.
Global definition for the assault rifle gun type
|
extern |
Battle rifle weapon data.
Global definition for the battle rifle gun type
|
extern |
Pistol weapon data.
Global definition for the pistol gun type
|
extern |
Shotgun weapon data.
Global definition for the shotgun gun type
|
extern |
SMG weapon data.
Global definition for the submachine gun type