ddnet/src/engine/shared/map.h
Robert Müller 4ae0928b47 Support bezier envelope curves in maps and editor
Port map and editor support for `CURVETYPE_BEZIER` from upstream, i.e. support bezier curves with configurable in- and out-tangents for every envelope point.

The in- and out-tangents are represented by triangles and can be dragged in the envelope editor like the envelope points.

Support reading and writing the bezier information as a separate UUID-based map item. If the bezier information is not found, bezier will default to linear behavior. Old clients will still be able to read the new maps and ignore the unknown map item. The unknown curvetype will also be handled as linear by old clients.

Allow reading upstream maps that use `CMapItemEnvelope` version 3. On upstream, a different struct is used to store all envelope points including bezier information, which broke compatibility to old clients.

Fix holding Ctrl for slow envelope point editing not working for vertical movement.

Highlight the currently selected element (envelope point or bezier tangent marker) which is being used with the value/time edit boxes.

Hide the value/time edit boxes when no element is selected.
2023-07-16 12:46:34 +02:00

45 lines
1.2 KiB
C++

/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_SHARED_MAP_H
#define ENGINE_SHARED_MAP_H
#include <base/system.h>
#include "datafile.h"
#include <engine/map.h>
class CMap : public IEngineMap
{
CDataFileReader m_DataFile;
public:
CMap();
CDataFileReader *GetReader() { return &m_DataFile; }
void *GetData(int Index) override;
int GetDataSize(int Index) const override;
void *GetDataSwapped(int Index) override;
void UnloadData(int Index) override;
int NumData() const override;
void *GetItem(int Index, int *pType = nullptr, int *pID = nullptr) override;
int GetItemSize(int Index) override;
void GetType(int Type, int *pStart, int *pNum) override;
void *FindItem(int Type, int ID) override;
int NumItems() const override;
bool Load(const char *pMapName) override;
void Unload() override;
bool IsLoaded() const override;
IOHANDLE File() const override;
SHA256_DIGEST Sha256() const override;
unsigned Crc() const override;
int MapSize() const override;
static void ExtractTiles(class CTile *pDest, size_t DestSize, const class CTile *pSrc, size_t SrcSize);
};
#endif