Jazz2/Editor/Shell/WeaponPreview.h file

Namespaces

namespace Jazz2
Root namespace of Jazz² Resurrection.
namespace Jazz2::Resources
Structures for game resources.
namespace Jazz2::UI
User interface and menus.
namespace Jazz2::UI::Windows
Toolkit of windows, panels and controls, compiled only if WITH_UI_WINDOWS.
namespace Jazz2::Editor

Classes

struct Jazz2::Editor::SimulatedShot
A shot of the firing range, frame by frame.
struct Jazz2::Editor::FiringRange
The firing range the preview of a weapon shows.
class Jazz2::Editor::WeaponPreview
Preview of a custom weapon in a firing range.
class Jazz2::Editor::WeaponSpriteView
An animation of a weapon in a small box, as it plays in the game.

Enums

enum class SimulatedShotEnd : std::uint8_t { Lifetime, Wall, Target, Triggered }
How a shot of the firing range ended, see SimulateWeapon().

Functions

void SimulateWeapon(const WeaponDefinition& weapon, bool powered, SmallVectorImpl<SimulatedShot>& shots, const FiringRange& range = FiringRange(), std::int32_t volley = 0)
Simulates the shots one press of fire makes of a custom weapon in the firing range.
void SimulateHeldWeapon(const WeaponDefinition& weapon, bool powered, SmallVectorImpl<SimulatedShot>& shots, const FiringRange& range = FiringRange())
Simulates a weapon held for a while, it fires again whenever it can, only once if it fires once per press.
auto FindWeaponAnimation(StringView metadataPath, std::uint32_t animState) -> const GraphicResource*
Returns an animation of the game or of an image of the level, the first one of the metadata if it has no such state, nullptr for no metadata.
void DrawFittedFrame(Painter& painter, const GraphicResource& resource, std::int32_t frame, const Rectf& rect, bool additive = false)
Draws a frame of an animation fitted in a rectangle with its hotspot in the middle.

Enum documentation

enum class SimulatedShotEnd : std::uint8_t

How a shot of the firing range ended, see SimulateWeapon().

Enumerators
Lifetime

Its time ran out

Wall

It hit a wall, the floor or the ceiling

Target

It hit the target

Triggered

It went off by its trigger

Function documentation

void SimulateWeapon(const WeaponDefinition& weapon, bool powered, SmallVectorImpl<SimulatedShot>& shots, const FiringRange& range = FiringRange(), std::int32_t volley = 0)

Simulates the shots one press of fire makes of a custom weapon in the firing range.

Deterministic, a random spread is spread evenly instead, volley takes the next samples of it for a weapon that fires again. Fills one shot for each fired at once.

void SimulateHeldWeapon(const WeaponDefinition& weapon, bool powered, SmallVectorImpl<SimulatedShot>& shots, const FiringRange& range = FiringRange())

Simulates a weapon held for a while, it fires again whenever it can, only once if it fires once per press.

The shots of each press start at its frame, see SimulatedShot::StartFrame.

void DrawFittedFrame(Painter& painter, const GraphicResource& resource, std::int32_t frame, const Rectf& rect, bool additive = false)

Draws a frame of an animation fitted in a rectangle with its hotspot in the middle.

All frames of the animation are at the same scale and place, at most a pixel a unit of the interface, a whole scale if it's larger. With additive, it's added to what's behind, as shots that glow are.