reflex2q3/ReflexToQ3/includes/EntityConverter.hpp

82 lines
2.4 KiB
C++
Raw Normal View History

/*
* =====================================================================================
*
* Filename: EntityConverter.hpp
*
* Description: Convert reflex entities to xonotic entities
*
* Version: 1.0
* Created: 05/27/2017 08:21:14 AM
* Revision: none
* Compiler: gcc
*
* Author: suhrke@teknik.io
*
* =====================================================================================
*/
#ifndef ENTITY_CONVERTER_HPP
#define ENTITY_CONVERTER_HPP
// Reflex Format
// -"Pickup" denoted by ID
// conventional item and weapon conversion stored in r2x.ent
// -"PlayerSpawn" consists of coordinate (Vector3),
// angle (first element of Vector3),
// team indicator (on individual lines),
// game type indicator (on individual lines)
// -"JumpPad" stored as a brush and a Target
// -"Teleporter" stored as a brush and a Target
// -"Target" stored as a position (Vector3) and
// "name" (String32)
// ***Target can be destination of teleports OR jump pads
// -MORE TO BE ADDED (Effect, liquids etc)
// Xonotic Format
// -pickups prefixed by either "item_" or "weapon_"
// -spawns stored as separate entity types
// "info_player_deathmatch"
// "info_player_team1"
// "info_player_team2"
// "info_player_team3"
// "info_player_team4"
// where each consists of a coordinate "origin" (vector3)
// an angle "angle" (a single number)
// -jump pads stored as "classname" "target_push",
// a coordinate "origin" (vector3),
// a target "targetname"
// OR stored as "classname" "trigger_push",
// a target "target",
// a brush
// -teleports stored as "classname" "trigger_teleport"
// a target "target",
// a brush
// -teleport destinations stored as "classname" "misc_teleporter_dest",
// a coordinate "origin" (vector3),
// an angle "angle" (a single number),
// a target "targetname"
#include <map>
#include <string>
#include <vector>
class EntityConverter
{
public:
EntityConverter(std::string entityMapFile, std::string reflexMapFile);
std::vector<std::string> convert(std::vector<std::string> lines);
protected:
private:
std::string getAttributeType(std::string line);
void printMapping(); //DEBUG
void printTargetSources(); //DEBUG
// Map Reflex pickup IDs to Xonotic pickup identifiers
std::map<int, std::string> pickupMapping_;
// Map targets (by name) to their source type
std::map<std::string, std::string> targetMap_;
};
#endif //ENTITY_CONVERTER_HPP