2016-03-27 11:49:47 +02:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
Copyright (C) 2015 the OpenMoHAA team
|
|
|
|
|
|
|
|
This file is part of OpenMoHAA source code.
|
|
|
|
|
|
|
|
OpenMoHAA source code is free software; you can redistribute it
|
|
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
OpenMoHAA source code is distributed in the hope that it will be
|
|
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OpenMoHAA source code; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
// level.h: General Level Info
|
|
|
|
|
2023-01-29 20:59:31 +01:00
|
|
|
#pragma once
|
2016-03-27 11:49:47 +02:00
|
|
|
|
|
|
|
#include "listener.h"
|
2023-01-29 20:59:31 +01:00
|
|
|
#include "g_public.h"
|
2023-08-10 17:00:17 +02:00
|
|
|
#include "bg_voteoptions.h"
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
#define MAX_HEAD_SENTIENTS 2
|
|
|
|
#define MAX_EARTHQUAKES 10
|
|
|
|
|
|
|
|
enum INTTYPE_e {
|
|
|
|
TRANS_BSP,
|
|
|
|
TRANS_LEVEL,
|
|
|
|
TRANS_MISSION,
|
|
|
|
TRANS_MISSION_FAILED
|
|
|
|
};
|
|
|
|
|
|
|
|
enum fadetype_t {
|
|
|
|
fadein,
|
|
|
|
fadeout
|
|
|
|
};
|
|
|
|
|
|
|
|
enum fadestyle_t {
|
|
|
|
alphablend,
|
|
|
|
additive
|
|
|
|
};
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
enum letterboxdir_t {
|
|
|
|
letterbox_in,
|
|
|
|
letterbox_out
|
|
|
|
};
|
2016-03-27 11:49:47 +02:00
|
|
|
|
|
|
|
typedef struct earthquake_s {
|
2023-08-10 03:10:51 +02:00
|
|
|
int duration;
|
|
|
|
float magnitude;
|
|
|
|
bool no_rampup;
|
|
|
|
bool no_rampdown;
|
|
|
|
|
|
|
|
int starttime;
|
|
|
|
int endtime;
|
|
|
|
SafePtr<ScriptThread> m_Thread;
|
2016-03-27 11:49:47 +02:00
|
|
|
} earthquake_t;
|
|
|
|
|
2023-08-10 03:56:13 +02:00
|
|
|
struct badplace_t {
|
2023-09-12 00:01:07 +02:00
|
|
|
const_str m_name;
|
|
|
|
int m_iTeamSide;
|
|
|
|
Vector m_vOrigin;
|
|
|
|
float m_fRadius;
|
2023-09-13 00:00:06 +02:00
|
|
|
float m_fLifespan;
|
2023-09-12 00:01:07 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
badplace_t();
|
2023-08-10 03:56:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
2023-09-12 00:01:07 +02:00
|
|
|
str m_sName;
|
|
|
|
Vector m_vOrigin;
|
2023-08-10 03:56:13 +02:00
|
|
|
} landmark_t;
|
|
|
|
|
2016-03-27 11:49:47 +02:00
|
|
|
extern gclient_t *spawn_client;
|
|
|
|
|
|
|
|
class Camera;
|
|
|
|
class SimpleArchivedEntity;
|
2023-10-12 18:58:04 +02:00
|
|
|
class Actor;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
|
|
|
class Level : public Listener
|
|
|
|
{
|
|
|
|
public:
|
2023-08-10 03:10:51 +02:00
|
|
|
char *current_map;
|
|
|
|
|
|
|
|
int mHealthPopCount;
|
|
|
|
|
|
|
|
// Map name stuff
|
|
|
|
str m_mapscript;
|
|
|
|
str m_precachescript;
|
|
|
|
str m_pathfile;
|
|
|
|
str m_mapfile;
|
|
|
|
|
|
|
|
// Spawning variables
|
|
|
|
int spawn_entnum;
|
|
|
|
int spawnflags;
|
|
|
|
|
|
|
|
// Level time
|
|
|
|
int framenum;
|
|
|
|
int inttime;
|
|
|
|
int intframetime;
|
|
|
|
|
|
|
|
float time;
|
|
|
|
float frametime;
|
|
|
|
|
|
|
|
// Server time
|
|
|
|
int svsTime;
|
|
|
|
float svsFloatTime;
|
|
|
|
int svsStartTime;
|
2023-09-12 00:01:07 +02:00
|
|
|
int svsEndTime;
|
|
|
|
float svsStartFloatTime; // Added in 2.0
|
2023-08-10 03:10:51 +02:00
|
|
|
|
|
|
|
// Level name variables
|
|
|
|
str level_name;
|
|
|
|
str mapname;
|
|
|
|
str spawnpoint;
|
|
|
|
str nextmap;
|
|
|
|
|
|
|
|
// AI variables
|
|
|
|
int m_iCuriousVoiceTime;
|
|
|
|
int m_iAttackEntryAnimTime;
|
|
|
|
|
|
|
|
// Global players variables
|
|
|
|
qboolean playerfrozen;
|
|
|
|
|
|
|
|
// Intermission variables
|
|
|
|
float intermissiontime;
|
|
|
|
INTTYPE_e intermissiontype;
|
|
|
|
int exitintermission;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Secrets
|
|
|
|
int total_secrets;
|
|
|
|
int found_secrets;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Trace
|
|
|
|
trace_t impact_trace;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Earthquake stuff
|
|
|
|
float earthquake_magnitude;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Cinematic
|
|
|
|
qboolean cinematic;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// AI variables
|
|
|
|
qboolean ai_on;
|
|
|
|
qboolean m_bAlarm;
|
|
|
|
qboolean mbNoDropHealth;
|
2023-08-10 03:56:13 +02:00
|
|
|
qboolean mbNoDropWeapons; // Added in 2.0
|
2023-08-10 03:10:51 +02:00
|
|
|
int m_iPapersLevel;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Mission state
|
|
|
|
qboolean mission_failed;
|
|
|
|
qboolean died_already;
|
|
|
|
qboolean near_exit;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Water variables
|
|
|
|
Vector water_color;
|
|
|
|
Vector lava_color;
|
|
|
|
float water_alpha;
|
|
|
|
float lava_alpha;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Soundtrack variables
|
|
|
|
str current_soundtrack;
|
|
|
|
str saved_soundtrack;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Screen state
|
|
|
|
Vector m_fade_color;
|
|
|
|
float m_fade_alpha;
|
|
|
|
float m_fade_time;
|
|
|
|
float m_fade_time_start;
|
|
|
|
fadetype_t m_fade_type;
|
|
|
|
fadestyle_t m_fade_style;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Letterbox state
|
|
|
|
float m_letterbox_fraction;
|
|
|
|
float m_letterbox_time;
|
|
|
|
float m_letterbox_time_start;
|
|
|
|
letterboxdir_t m_letterbox_dir;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:56:13 +02:00
|
|
|
// Added in 2.0
|
|
|
|
// Bad places
|
|
|
|
Container<badplace_t> m_badPlaces;
|
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
Container<Camera *> automatic_cameras;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Quake remnants ?
|
|
|
|
int m_numArenas;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Voting variables
|
2024-01-02 00:43:27 +01:00
|
|
|
int m_voteTime;
|
|
|
|
int m_nextVoteTime;
|
|
|
|
int m_voteYes;
|
|
|
|
int m_voteNo;
|
|
|
|
int m_numVoters;
|
2023-08-10 03:56:13 +02:00
|
|
|
// Added in 2.0
|
2023-09-12 00:01:07 +02:00
|
|
|
str m_voteString;
|
|
|
|
str m_voteName;
|
|
|
|
VoteOptions m_voteOptions;
|
2023-08-10 03:10:51 +02:00
|
|
|
|
|
|
|
// Intermission locations
|
|
|
|
Vector m_intermission_origin;
|
|
|
|
Vector m_intermission_angle;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Skeleton variables
|
|
|
|
int frame_skel_index;
|
|
|
|
int skel_index[MAX_GENTITIES];
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// script variables
|
|
|
|
qboolean m_LoopProtection;
|
|
|
|
qboolean m_LoopDrop; // kill the server in loop exception
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
Container<SimpleArchivedEntity *> m_SimpleArchivedEntities;
|
|
|
|
class Sentient *m_HeadSentient[MAX_HEAD_SENTIENTS];
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Earthquake stuff
|
|
|
|
earthquake_t earthquakes[MAX_EARTHQUAKES];
|
|
|
|
int num_earthquakes;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Objective stuff
|
2023-09-12 00:01:07 +02:00
|
|
|
Vector m_vObjectiveLocation;
|
|
|
|
Vector m_vAlliedObjectiveLocation; // Added in 2.0
|
|
|
|
Vector m_vAxisObjectiveLocation; // Added in 2.0
|
2024-01-02 00:43:27 +01:00
|
|
|
// Added in OPM
|
|
|
|
// Forces axis/allied objectives location to be used
|
|
|
|
// even if the gametype is not TOW
|
|
|
|
bool m_bForceTeamObjectiveLocation;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Current level state
|
|
|
|
bool spawning;
|
2023-09-12 00:01:07 +02:00
|
|
|
bool m_bIgnoreClock;
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
|
|
|
// Added in 2.30
|
|
|
|
// Landmarks
|
2023-09-12 00:01:07 +02:00
|
|
|
float m_fLandmarkYDistMax;
|
|
|
|
float m_fLandmarkYDistMin;
|
|
|
|
float m_fLandmarkXDistMin;
|
2023-09-12 21:39:19 +02:00
|
|
|
float m_fLandmarkXDistMax;
|
2023-09-12 00:01:07 +02:00
|
|
|
landmark_t **m_pLandmarks;
|
|
|
|
int m_iMaxLandmarks;
|
|
|
|
int m_iLandmarksCount;
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
2023-09-12 00:01:07 +02:00
|
|
|
void *m_pAIStats;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// New Stuff
|
2016-03-27 11:49:47 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
// Script stuff
|
|
|
|
bool m_bScriptSpawn;
|
|
|
|
bool m_bRejectSpawn;
|
2016-03-27 11:49:47 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-10 03:10:51 +02:00
|
|
|
CLASS_PROTOTYPE(Level);
|
|
|
|
|
|
|
|
Level();
|
|
|
|
virtual ~Level();
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
void CleanUp(qboolean samemap = qfalse, qboolean resetConfigStrings = qfalse);
|
|
|
|
void ResetEdicts();
|
|
|
|
gentity_t *AllocEdict(Entity *ent);
|
|
|
|
void FreeEdict(gentity_t *ent);
|
|
|
|
void InitEdict(gentity_t *ent);
|
|
|
|
void LoadAllScripts(const char *name, const char *extension);
|
|
|
|
void Precache();
|
|
|
|
void SetMap(const char *themapname);
|
|
|
|
void FindTeams();
|
2023-08-10 03:56:13 +02:00
|
|
|
|
2023-09-12 00:01:07 +02:00
|
|
|
void SpawnEntities(char *entities, int _svsTime_);
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
|
|
|
// Added in 2.30
|
2023-09-12 00:01:07 +02:00
|
|
|
void ComputeDMWaypoints();
|
|
|
|
void AddLandmarkOrigin(const Vector& origin);
|
|
|
|
void AddLandmarkName(const str& name, const Vector& origin);
|
|
|
|
void FreeLandmarks();
|
2024-01-02 00:43:27 +01:00
|
|
|
str GetDynamicDMLocations(const Vector& origin);
|
|
|
|
str GetDMLocation(const Vector& origin);
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
2023-09-12 00:01:07 +02:00
|
|
|
void PreSpawnSentient(Event *ev);
|
|
|
|
void ServerSpawned();
|
|
|
|
qboolean inhibitEntity(int spawnflags);
|
2023-08-10 03:56:13 +02:00
|
|
|
|
2023-09-12 00:01:07 +02:00
|
|
|
void setSkill(int value);
|
|
|
|
void setTime(int _svsTime_);
|
|
|
|
void setFrametime(int frameTime);
|
2023-08-10 03:56:13 +02:00
|
|
|
|
2023-09-12 00:01:07 +02:00
|
|
|
void AddAutomaticCamera(Camera *cam);
|
2023-08-10 03:56:13 +02:00
|
|
|
|
2023-09-12 00:01:07 +02:00
|
|
|
void GetTime(Event *ev);
|
|
|
|
void GetTotalSecrets(Event *ev);
|
|
|
|
void GetFoundSecrets(Event *ev);
|
2023-08-10 03:56:13 +02:00
|
|
|
|
|
|
|
//====
|
|
|
|
// Added in 2.0
|
2023-09-12 00:01:07 +02:00
|
|
|
void InitVoteOptions();
|
|
|
|
void SendVoteOptionsFile(gentity_t *ent);
|
|
|
|
bool GetVoteOptionMain(int index, str *outOptionCommand, voteoptiontype_t *outOptionType);
|
|
|
|
bool GetVoteOptionSub(int index, int listIndex, str *outCommand);
|
|
|
|
bool GetVoteOptionMainName(int index, str *outVoteName);
|
|
|
|
bool GetVoteOptionSubName(int index, int listIndex, str *outName);
|
|
|
|
//====
|
|
|
|
void CheckVote();
|
|
|
|
void SetupMaplist(); // Added in 2.0
|
|
|
|
|
|
|
|
void GetAlarm(Event *ev);
|
|
|
|
void SetAlarm(Event *ev);
|
|
|
|
void SetNoDropHealth(Event *ev);
|
|
|
|
void SetNoDropWeapons(Event *ev); // Added in 2.0
|
|
|
|
void GetLoopProtection(Event *ev);
|
|
|
|
void SetLoopProtection(Event *ev);
|
|
|
|
void GetPapersLevel(Event *ev);
|
|
|
|
void SetPapersLevel(Event *ev);
|
|
|
|
void EventGetRoundStarted(Event *ev);
|
|
|
|
void EventGetDMRespawning(Event *ev);
|
|
|
|
void EventSetDMRespawning(Event *ev);
|
|
|
|
void EventGetDMRoundLimit(Event *ev);
|
|
|
|
void EventSetDMRoundLimit(Event *ev);
|
|
|
|
void EventGetClockSide(Event *ev);
|
|
|
|
void EventSetClockSide(Event *ev);
|
|
|
|
void EventGetBombPlantTeam(Event *ev);
|
|
|
|
void EventSetBombPlantTeam(Event *ev);
|
|
|
|
void EventGetTargetsToDestroy(Event *ev);
|
|
|
|
void EventSetTargetsToDestroy(Event *ev);
|
|
|
|
void EventGetTargetsDestroyed(Event *ev);
|
|
|
|
void EventSetTargetsDestroyed(Event *ev);
|
|
|
|
void EventGetBombsPlanted(Event *ev);
|
|
|
|
void EventSetBombsPlanted(Event *ev);
|
|
|
|
void EventGetRoundBased(Event *ev);
|
|
|
|
void EventGetObjectiveBased(Event *ev);
|
|
|
|
void EventRainDensitySet(Event *ev);
|
|
|
|
void EventRainDensityGet(Event *ev);
|
|
|
|
void EventRainSpeedSet(Event *ev);
|
|
|
|
void EventRainSpeedGet(Event *ev);
|
|
|
|
void EventRainSpeedVarySet(Event *ev);
|
|
|
|
void EventRainSpeedVaryGet(Event *ev);
|
|
|
|
void EventRainSlantSet(Event *ev);
|
|
|
|
void EventRainSlantGet(Event *ev);
|
|
|
|
void EventRainLengthSet(Event *ev);
|
|
|
|
void EventRainLengthGet(Event *ev);
|
|
|
|
void EventRainMin_DistSet(Event *ev);
|
|
|
|
void EventRainMin_DistGet(Event *ev);
|
|
|
|
void EventRainWidthSet(Event *ev);
|
|
|
|
void EventRainWidthGet(Event *ev);
|
|
|
|
void EventRainShaderSet(Event *ev);
|
|
|
|
void EventRainShaderGet(Event *ev);
|
|
|
|
void EventRainNumShadersSet(Event *ev);
|
|
|
|
void EventRainNumShadersGet(Event *ev);
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
|
|
|
// Added in 2.0
|
2024-01-02 00:43:27 +01:00
|
|
|
void EventAddBadPlace(Event *ev);
|
|
|
|
void EventRemoveBadPlace(Event *ev);
|
|
|
|
void EventIgnoreClock(Event *ev);
|
|
|
|
void UpdateBadPlaces();
|
|
|
|
int GetNearestBadPlace(const Vector& org, float radius, int team) const;
|
2023-08-10 03:56:13 +02:00
|
|
|
//====
|
2023-09-12 00:01:07 +02:00
|
|
|
str GetRandomHeadModel(const char *model);
|
|
|
|
str GetRandomHeadSkin(const char *model);
|
2023-08-10 03:10:51 +02:00
|
|
|
|
|
|
|
bool RoundStarted();
|
|
|
|
bool PreSpawned(void);
|
|
|
|
bool Spawned(void);
|
|
|
|
|
|
|
|
void AddEarthquake(earthquake_t *);
|
|
|
|
void DoEarthquakes(void);
|
|
|
|
|
2023-10-12 18:58:04 +02:00
|
|
|
void OpenActorStats();
|
2024-01-02 00:43:27 +01:00
|
|
|
void WriteActorStats(Actor *actor);
|
|
|
|
|
|
|
|
//====
|
|
|
|
// Added in OPM
|
|
|
|
void SetForceTeamObjectiveLocation(Event *ev);
|
|
|
|
void GetForceTeamObjectiveLocation(Event *ev);
|
|
|
|
//====
|
2023-10-12 18:58:04 +02:00
|
|
|
|
2023-08-10 03:10:51 +02:00
|
|
|
void Archive(Archiver& arc) override;
|
2016-03-27 11:49:47 +02:00
|
|
|
};
|
|
|
|
|
2023-08-15 01:40:06 +02:00
|
|
|
// Called when a restart/change was issued
|
|
|
|
void G_BeginIntermission2(void);
|
|
|
|
|
|
|
|
// Change the current map to the specified map with the possibility to fade the screen with fadetime.
|
2023-09-12 00:01:07 +02:00
|
|
|
void G_BeginIntermission(const char *map_name, INTTYPE_e transtype, bool no_fade = false);
|
2023-08-15 01:40:06 +02:00
|
|
|
|
|
|
|
//Exit the intermission screen.
|
|
|
|
void G_ExitIntermission(void);
|
|
|
|
|
|
|
|
// Exits the level
|
|
|
|
void G_ExitLevel(void);
|
|
|
|
|
2016-03-27 11:49:47 +02:00
|
|
|
extern Level level;
|