group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
WeaponState.hpp File Reference

Weapon state component for armed entities. More...

#include <array>
#include <cstddef>
#include <cstdint>
Include dependency graph for WeaponState.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GunInstance
 Struct that defines this weapon's type, cooldown, and ammo. More...
struct  WeaponState
 Component attached to armed entities (players). More...

Enumerations

enum class  WeaponType : uint8_t {
  Rifle , Rocket , RailGun , EnergyGun ,
  HEGrenade , Molotov , Impulse
}
 Weapon type — determines tracer style, damage, sound, and impact effects. More...
enum class  WeaponSlot : uint8_t { PRIMARY , SECONDARY , Count }
 Identifier for one of the player's weapon slots. More...

Functions

GunInstancegetSlot (WeaponState &w, WeaponSlot s)
 Access a specific slot on a WeaponState by enum.
const GunInstancegetSlot (const WeaponState &w, WeaponSlot s)
GunInstancegetEquippedGun (WeaponState &w)
 The slot the player is currently holding.
const GunInstancegetEquippedGun (const WeaponState &w)

Detailed Description

Weapon state component for armed entities.

Enumeration Type Documentation

◆ WeaponSlot

enum class WeaponSlot : uint8_t
strong

Identifier for one of the player's weapon slots.

Count is a sentinel used to size the slots array; never use it as a real slot value. To add a new slot (e.g., melee), append before Count and update any per-slot policy helpers (see canAcceptType in a future commit). The slot array auto-resizes.

Enumerator
PRIMARY 
SECONDARY 
Count 

Sentinel — must be last. Equals the number of valid slots.

◆ WeaponType

enum class WeaponType : uint8_t
strong

Weapon type — determines tracer style, damage, sound, and impact effects.

Enumerator
Rifle 

Fast hitscan/projectile (R301-style capsule tracer).

Rocket 

Slow arcing projectile (ribbon trail).

RailGun 

Hitscan energy weapon (beam + lightning arcs).

EnergyGun 

Fast hitscan energy burst.

HEGrenade 

Bouncy grenade with 3s fuse, lethal explosion.

Molotov 

Impact-detonate, leaves a fire field (damage over time).

Impulse 

Sticky 1s fuse, big knockback, no damage (movement tool).

Function Documentation

◆ getEquippedGun() [1/2]

const GunInstance & getEquippedGun ( const WeaponState & w)
inline
Here is the call graph for this function:

◆ getEquippedGun() [2/2]

GunInstance & getEquippedGun ( WeaponState & w)
inline

The slot the player is currently holding.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSlot() [1/2]

const GunInstance & getSlot ( const WeaponState & w,
WeaponSlot s )
inline

◆ getSlot() [2/2]

GunInstance & getSlot ( WeaponState & w,
WeaponSlot s )
inline

Access a specific slot on a WeaponState by enum.

Here is the caller graph for this function: