Organize game-shared includes

This commit is contained in:
Robert Müller 2022-06-16 18:06:35 +02:00
parent 0813fbb537
commit 4949645663
27 changed files with 117 additions and 61 deletions

View file

@ -11,6 +11,7 @@
#include <game/client/components/maplayers.h>
#include <game/layers.h>
#include <game/mapitems.h>
#include "menu_background.h"

View file

@ -9,9 +9,10 @@
#include <engine/client.h>
#include <engine/console.h>
#include <engine/shared/config.h>
#include <game/collision.h>
#include <game/gamecore.h>
#include <game/layers.h>
#include <game/teamscore.h>
#include <game/client/prediction/gameworld.h>
@ -169,7 +170,7 @@ private:
#endif
CLayers m_Layers;
class CCollision m_Collision;
CCollision m_Collision;
CUI m_UI;
void ProcessEvents();
@ -216,7 +217,7 @@ public:
class IServerBrowser *ServerBrowser() const { return m_pServerBrowser; }
class CRenderTools *RenderTools() { return &m_RenderTools; }
class CLayers *Layers() { return &m_Layers; }
class CCollision *Collision() { return &m_Collision; }
CCollision *Collision() { return &m_Collision; }
class IEditor *Editor() { return m_pEditor; }
class IFriends *Friends() { return m_pFriends; }
class IFriends *Foes() { return m_pFoes; }

View file

@ -1,6 +1,7 @@
/* (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. */
#include <engine/shared/config.h>
#include <game/collision.h>
#include <game/generated/client_data.h>
#include <game/mapitems.h>

View file

@ -2,6 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "laser.h"
#include "character.h"
#include <game/collision.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>

View file

@ -2,6 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "pickup.h"
#include "character.h"
#include <game/collision.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>

View file

@ -3,6 +3,7 @@
#include <engine/shared/config.h>
#include <game/client/projectile_data.h>
#include <game/collision.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>

View file

@ -3,6 +3,8 @@
#include "entity.h"
#include <game/collision.h>
//////////////////////////////////////////////////
// Entity
//////////////////////////////////////////////////

View file

@ -4,15 +4,17 @@
#define GAME_CLIENT_PREDICTION_GAMEWORLD_H
#include <game/gamecore.h>
#include <game/teamscore.h>
#include <list>
class CEntity;
class CCollision;
class CCharacter;
class CEntity;
class CGameWorld
{
friend class CCharacter;
friend CCharacter;
public:
enum
@ -34,7 +36,7 @@ public:
CEntity *FindFirst(int Type);
CEntity *FindLast(int Type);
int FindEntities(vec2 Pos, float Radius, CEntity **ppEnts, int Max, int Type);
class CCharacter *IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, class CCharacter *pNotThis = nullptr, int CollideWith = -1, class CCharacter *pThisOnly = nullptr);
CCharacter *IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis = nullptr, int CollideWith = -1, CCharacter *pThisOnly = nullptr);
void InsertEntity(CEntity *pEntity, bool Last = false);
void RemoveEntity(CEntity *pEntity);
void RemoveCharacter(CCharacter *pChar);
@ -42,7 +44,7 @@ public:
// DDRace
void ReleaseHooked(int ClientID);
std::list<class CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis = nullptr);
std::list<CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, CEntity *pNotThis = nullptr);
int m_GameTick;
int m_GameTickSpeed;
@ -51,12 +53,12 @@ public:
// getter for server variables
int GameTick() { return m_GameTick; }
int GameTickSpeed() { return m_GameTickSpeed; }
class CCollision *Collision() { return m_pCollision; }
CCollision *Collision() { return m_pCollision; }
CTeamsCore *Teams() { return &m_Teams; }
std::vector<SSwitchers> &Switchers() { return m_Core.m_vSwitchers; }
CTuningParams *Tuning();
CEntity *GetEntity(int ID, int EntityType);
class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : nullptr; }
CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : nullptr; }
// from gamecontext
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
@ -100,7 +102,7 @@ private:
CEntity *m_pNextTraverseEntity = nullptr;
CEntity *m_apFirstEntityTypes[NUM_ENTTYPES];
class CCharacter *m_apCharacters[MAX_CLIENTS];
CCharacter *m_apCharacters[MAX_CLIENTS];
};
class CCharOrder

View file

@ -7,6 +7,8 @@
#include <game/client/prediction/gameworld.h>
#include <game/generated/protocol.h>
#include <game/collision.h>
bool UseProjectileExtraInfo(const CNetObj_Projectile *pProj)
{
return pProj->m_VelY >= 0 && (pProj->m_VelY & PROJECTILEFLAG_IS_DDNET) != 0;

View file

@ -1,7 +1,10 @@
/* (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. */
#include "gamecore.h"
#include "collision.h"
#include "mapitems.h"
#include "teamscore.h"
#include <engine/shared/config.h>

View file

@ -4,17 +4,19 @@
#define GAME_GAMECORE_H
#include <base/system.h>
#include <base/vmath.h>
#include <map>
#include <set>
#include <vector>
#include "collision.h"
#include <engine/shared/protocol.h>
#include <game/generated/protocol.h>
#include "prng.h"
#include "teamscore.h"
class CCollision;
class CTeamsCore;
class CTuneParam
{
@ -279,7 +281,7 @@ public:
int m_Id;
bool m_pReset;
class CCollision *Collision() { return m_pCollision; }
CCollision *Collision() { return m_pCollision; }
vec2 m_LastVel;
int m_Colliding;

View file

@ -1,6 +1,9 @@
/* (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. */
#include "layers.h"
#include "mapitems.h"
#include <engine/map.h>
CLayers::CLayers()

View file

@ -3,7 +3,12 @@
#ifndef GAME_LAYERS_H
#define GAME_LAYERS_H
#include <game/mapitems.h>
class IKernel;
class IMap;
struct CMapItemGroup;
struct CMapItemLayer;
struct CMapItemLayerTilemap;
class CLayers
{
@ -13,17 +18,17 @@ class CLayers
int m_LayersStart;
CMapItemGroup *m_pGameGroup;
CMapItemLayerTilemap *m_pGameLayer;
class IMap *m_pMap;
IMap *m_pMap;
void InitTilemapSkip();
public:
CLayers();
void Init(class IKernel *pKernel);
void InitBackground(class IMap *pMap);
void Init(IKernel *pKernel);
void InitBackground(IMap *pMap);
int NumGroups() const { return m_GroupsNum; }
int NumLayers() const { return m_LayersNum; }
class IMap *Map() const { return m_pMap; }
IMap *Map() const { return m_pMap; }
CMapItemGroup *GameGroup() const { return m_pGameGroup; }
CMapItemLayerTilemap *GameLayer() const { return m_pGameLayer; }
CMapItemGroup *GetGroup(int Index) const;

View file

@ -1,11 +1,14 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "door.h"
#include "character.h"
#include <game/generated/protocol.h>
#include <game/server/gamecontext.h>
#include <game/server/player.h>
#include <game/mapitems.h>
#include <game/teamscore.h>
#include <game/version.h>
#include "character.h"
#include "door.h"
#include <game/server/gamecontext.h>
#include <game/server/player.h>
CDoor::CDoor(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length,
int Number) :

View file

@ -1,15 +1,18 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "dragger.h"
#include "character.h"
#include "dragger_beam.h"
#include <engine/server.h>
#include <engine/shared/config.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/version.h>
#include <game/server/gamecontext.h>
#include <game/server/player.h>
#include <game/server/teams.h>
#include <game/version.h>
#include "character.h"
#include "dragger.h"
#include "dragger_beam.h"
CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool IgnoreWalls, int Layer, int Number) :
CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER)

View file

@ -2,9 +2,13 @@
#include "dragger_beam.h"
#include "character.h"
#include "dragger.h"
#include <engine/server.h>
#include <engine/shared/config.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/server/gamecontext.h>
CDraggerBeam::CDraggerBeam(CGameWorld *pGameWorld, CDragger *pDragger, vec2 Pos, float Strength, bool IgnoreWalls,

View file

@ -1,15 +1,18 @@
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#include "gun.h"
#include "character.h"
#include "plasma.h"
#include <engine/server.h>
#include <engine/shared/config.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/version.h>
#include <game/server/gamecontext.h>
#include <game/server/player.h>
#include <game/server/teams.h>
#include <game/version.h>
#include "character.h"
#include "gun.h"
#include "plasma.h"
CGun::CGun(CGameWorld *pGameWorld, vec2 Pos, bool Freeze, bool Explosive, int Layer, int Number) :
CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER)

View file

@ -1,14 +1,15 @@
/* (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. */
#include "laser.h"
#include <game/generated/protocol.h>
#include <game/server/gamecontext.h>
#include <game/server/gamemodes/DDRace.h>
#include "character.h"
#include <engine/shared/config.h>
#include <game/server/teams.h>
#include "character.h"
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/server/gamecontext.h>
#include <game/server/gamemodes/DDRace.h>
CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int Type) :
CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER)

View file

@ -1,13 +1,16 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "light.h"
#include "character.h"
#include <engine/server.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/server/gamecontext.h>
#include <game/server/player.h>
#include <game/teamscore.h>
#include <game/version.h>
#include "character.h"
#include <game/server/gamecontext.h>
#include <game/server/player.h>
CLight::CLight(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length,
int Layer, int Number) :

View file

@ -1,13 +1,15 @@
/* (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. */
#include "pickup.h"
#include <game/generated/protocol.h>
#include <game/server/gamecontext.h>
#include <game/server/player.h>
#include "character.h"
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/teamscore.h>
#include <game/version.h>
#include "character.h"
#include <game/server/gamecontext.h>
#include <game/server/player.h>
static constexpr int PickupPhysSize = 14;

View file

@ -1,11 +1,14 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "plasma.h"
#include <engine/server.h>
#include <game/generated/protocol.h>
#include <game/server/gamecontext.h>
#include "character.h"
#include <engine/server.h>
#include <game/generated/protocol.h>
#include <game/teamscore.h>
#include <game/server/gamecontext.h>
const float PLASMA_ACCEL = 1.1f;
CPlasma::CPlasma(CGameWorld *pGameWorld, vec2 Pos, vec2 Dir, bool Freeze,

View file

@ -1,15 +1,16 @@
/* (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. */
#include "projectile.h"
#include <game/generated/protocol.h>
#include <game/server/gamecontext.h>
#include <game/server/gamemodes/DDRace.h>
#include <game/version.h>
#include "character.h"
#include <engine/shared/config.h>
#include <game/server/teams.h>
#include "character.h"
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/version.h>
#include <game/server/gamecontext.h>
#include <game/server/gamemodes/DDRace.h>
CProjectile::CProjectile(
CGameWorld *pGameWorld,

View file

@ -18,8 +18,10 @@
#include <engine/shared/linereader.h>
#include <engine/shared/memheap.h>
#include <engine/storage.h>
#include <game/collision.h>
#include <game/gamecore.h>
#include <game/mapitems.h>
#include <game/version.h>
#include <game/generated/protocol7.h>

View file

@ -7,6 +7,7 @@
#include <engine/console.h>
#include <engine/server.h>
#include <game/collision.h>
#include <game/layers.h>
#include <game/mapbugs.h>
#include <game/voting.h>

View file

@ -1,20 +1,21 @@
/* (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. */
#include <engine/shared/config.h>
#include <game/mapitems.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>
#include <game/teamscore.h>
#include "entities/character.h"
#include "entities/pickup.h"
#include "gamecontext.h"
#include "gamecontroller.h"
#include "player.h"
#include "entities/character.h"
#include "entities/door.h"
#include "entities/dragger.h"
#include "entities/gun.h"
#include "entities/light.h"
#include "entities/pickup.h"
#include "entities/projectile.h"
IGameController::IGameController(class CGameContext *pGameServer)

View file

@ -7,7 +7,9 @@
#include "entities/character.h"
#include "gamecontext.h"
#include <engine/server.h>
#include <game/gamecore.h>
#include <game/teamscore.h>
#include <game/version.h>
MACRO_ALLOC_POOL_ID_IMPL(CPlayer, MAX_CLIENTS)

View file

@ -1,11 +1,13 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "teams.h"
#include "score.h"
#include "teehistorian.h"
#include <engine/shared/config.h>
#include "entities/character.h"
#include "player.h"
#include "score.h"
#include "teehistorian.h"
#include <engine/shared/config.h>
#include <game/mapitems.h>
CGameTeams::CGameTeams(CGameContext *pGameContext) :
m_pGameContext(pGameContext)