Jazz2::Events::EventMap class

Represents event map, spawns triggered objects.

Public types

struct EventTile
Represents an event tile.

Constructors, destructors, conversion operators

EventMap(Vector2i layoutSize)

Public functions

void SetLevelHandler(ILevelHandler* levelHandler)
auto GetSize() const -> Vector2i
Returns size of event map in tiles.
auto GetPitType() const -> PitType
Returns pit type.
void SetPitType(PitType value)
Sets pit type.
auto GetSpawnPosition(PlayerType type) -> Vector2f
Returns spawn position for specified player type.
void CreateCheckpointForRollback()
Creates a checkpoint for eventual rollback.
void RollbackToCheckpoint()
Rolls back to the last checkpoint.
void StoreTileEvent(std::int32_t x, std::int32_t y, EventType eventType, Actors::ActorState eventFlags = Actors::ActorState::None, std::uint8_t* tileParams = nullptr)
Stores tile event description.
void PreloadEventsAsync()
Preloads assets of all contained events.
void ProcessGenerators(float timeMult)
Processes all generators.
void ActivateEvents(std::int32_t tx1, std::int32_t ty1, std::int32_t tx2, std::int32_t ty2, bool allowAsync)
Activates all inactive events in specified tile restangle.
void Deactivate(std::int32_t x, std::int32_t y)
Deactivates event on specified tile position.
void ResetGenerator(std::int32_t tx, std::int32_t ty)
Resets generator on specified tile position.
auto GetEventTile(std::int32_t x, std::int32_t y) const -> const EventTile&
Returns event description of specified tile position.
auto GetEventByPosition(float x, float y, std::uint8_t** eventParams) -> EventType
Returns event type on specified position.
auto GetEventByPosition(std::int32_t x, std::int32_t y, std::uint8_t** eventParams) -> EventType
auto HasEventByPosition(std::int32_t x, std::int32_t y) const -> bool
Returns true if specified tile position contains an event.
void ForEachEvent(EventType eventType, Function<bool(const EventTile&, std::int32_t, std::int32_t)>&& forEachCallback) const
Calls specified callback function for each event found by type.
auto IsHurting(float x, float y, Direction dir) -> bool
Returns true if specified position contains hurt event.
auto IsHurting(std::int32_t x, std::int32_t y, Direction dir) -> bool
auto GetWarpByPosition(float x, float y) -> std::int32_t
Returns ID of warp on specified position.
auto GetWarpTarget(std::uint32_t id) -> Vector2f
Returns target position for specified warp.
void ReadEvents(Stream& s, const std::unique_ptr<Tiles::TileMap>& tileMap, GameDifficulty difficulty)
Reads event layer data from stream.
void AddWarpTarget(std::uint16_t id, std::int32_t x, std::int32_t y)
Adds target position for specified warp.
void AddSpawnPosition(std::uint8_t typeMask, std::int32_t x, std::int32_t y)
Adds spawn position with specified player type mask.
void InitializeFromStream(Stream& src)
Initializes event map state from a stream.
void SerializeResumableToStream(Stream& dest)
Serializes event map state to a stream.

Function documentation

EventType Jazz2::Events::EventMap::GetEventByPosition(std::int32_t x, std::int32_t y, std::uint8_t** eventParams)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Jazz2::Events::EventMap::IsHurting(std::int32_t x, std::int32_t y, Direction dir)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.