This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@@ -0,0 +1,67 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// Interface to the runtime map (VMF) building class
//
//===============================================================================
#ifndef IASW_MAP_BUILDER_H
#define IASW_MAP_BUILDER_H
#if defined( COMPILER_MSVC )
#pragma once
#endif
class KeyValues;
class IASW_Map_Builder
{
public:
//-----------------------------------------------------------------------------
// Ticks the map builder and updates progress.
//-----------------------------------------------------------------------------
virtual void Update( float flEngineTime ) = 0;
// @TODO: clean up these entrypoints to be more consistent. It's confusing
// and convoluted right now because of the sheer number of different ways
// to build a map.
//-----------------------------------------------------------------------------
// Schedules the random generation and BSP build of a map from its description
// or a pre-defined layout file.
//-----------------------------------------------------------------------------
virtual void ScheduleMapGeneration(
const char *pMapName,
float flTime,
KeyValues *pMissionSettings,
KeyValues *pMissionDefinition ) = 0;
//-----------------------------------------------------------------------------
// Schedules the VMF export and BSP build of a .layout file.
//-----------------------------------------------------------------------------
virtual void ScheduleMapBuild(
const char *pMapName,
const float flTime ) = 0;
//-----------------------------------------------------------------------------
// Gets a map build progress value in the range [0.0f, 1.0f] inclusive.
//-----------------------------------------------------------------------------
virtual float GetProgress() = 0;
//-----------------------------------------------------------------------------
// Gets a string which describes the current status of the map builder.
//-----------------------------------------------------------------------------
virtual const char *GetStatusMessage() = 0;
//-----------------------------------------------------------------------------
// Gets the name of the map being currently built.
//-----------------------------------------------------------------------------
virtual const char *GetMapName() = 0;
//-----------------------------------------------------------------------------
// Gets a value indicating whether a map build is scheduled or in progress.
//-----------------------------------------------------------------------------
virtual bool IsBuildingMission() = 0;
};
#endif // IASW_MAP_BUILDER_H

View File

@@ -0,0 +1,135 @@
#ifndef MISSION_CHOOSER_INT_H
#define MISSION_CHOOSER_INT_H
#ifdef _WIN32
#pragma once
#endif
#include "appframework/IAppSystem.h"
#include "utlvector.h"
class IASW_Random_Missions;
class IASW_Mission_Chooser_Source;
class IASW_Map_Builder;
class KeyValues;
class CUniformRandomStream;
class Color;
class IASWSpawnSelection;
class IASW_Location;
class IASW_Location_Group
{
public:
virtual const char* GetGroupName() = 0;
virtual const char* GetTitleText() = 0;
virtual const char* GetDescriptionText() = 0;
virtual const char* GetImageName() = 0;
virtual Color& GetColor() = 0;
virtual bool IsGroupLocked( CUtlVector<int> &completedMissions ) = 0;
virtual int GetHighestUnlockMissionID() = 0;
virtual int GetNumLocations() = 0;
virtual IASW_Location* GetLocation( int iIndex ) = 0;
};
enum ASW_Reward_Type
{
ASW_REWARD_MONEY=0,
ASW_REWARD_XP,
ASW_REWARD_ITEM,
ASW_REWARD_SKILL_SLOT,
};
class IASW_Reward
{
public:
virtual ASW_Reward_Type GetRewardType() = 0;
virtual int GetRewardAmount() = 0;
// for item rewards
virtual const char* GetRewardName() = 0;
virtual int GetRewardLevel() = 0;
virtual int GetRewardQuality() = 0;
};
class IASW_Location
{
public:
virtual int GetID() = 0;
virtual IASW_Location_Group* GetGroup() = 0;
virtual int GetDifficulty() = 0;
virtual bool GetCompleted() = 0;
virtual int GetXPos() = 0;
virtual int GetYPos() = 0;
// Mission Settings are settings not directly related to the level layout, but which have other effects on the mission.
// (This is the "mission_settings" sub-node of the mission definition).
virtual KeyValues* GetMissionSettings() = 0;
// Mission Definition is the key-values block fed to the layout system.
virtual KeyValues* GetMissionDefinition() = 0;
virtual const char* GetMapName() = 0;
virtual const char* GetStoryScene() = 0;
virtual const char* GetImageName() = 0;
virtual const char* GetCompanyName() = 0;
virtual const char* GetCompanyImage() = 0;
virtual int GetNumRewards() = 0;
virtual IASW_Reward* GetReward( int iRewardIndex ) = 0;
virtual int GetMoneyReward() = 0;
virtual int GetXPReward() = 0;
virtual int IsMissionOptional() = 0;
virtual bool IsLocationLocked( CUtlVector<int> &completedMissions ) = 0;
virtual void SetPos( int x, int y ) = 0;
};
class IASW_Location_Grid
{
public:
virtual int GetNumGroups() = 0;
virtual IASW_Location_Group* GetGroup( int iIndex ) = 0;
virtual IASW_Location_Group* GetGroupByName( const char *szName ) = 0;
virtual IASW_Location* GetLocationByID( int iLocationID ) = 0;
virtual void SetLocationComplete( int iLocationID ) = 0;
};
class IASW_Mission_Text_Database
{
public:
virtual const char *GetShortDescriptionByID( unsigned int id ) = 0;
virtual const char *GetLongDescriptionByID( unsigned int id ) = 0;
/// a unique identifier for each mission spec.
/// if they're loaded from the same files in the same
/// order by the database on both server and client,
/// we can refer to specs by this id across the network.
// if you change the size of this, also update the m_nObjectiveTextIdx
// datatable field in asw_objective.cpp.
typedef uint16 ID_t;
enum { INVALID_INDEX = ((ID_t)(~0)) };
static inline bool IsIDValid( ID_t idx ) { return idx != INVALID_INDEX; }
/// find the mission text id for a given entity name, mission filename, other criteria.
/// you can resolve the ID to textual descriptions with GetShortDescriptionByID() etc.
virtual ID_t FindMissionTextID( const char *pEntityName, const char *pMissionName ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface exposed from the mission chooser .dll (to the game dlls and tilegen.exe)
//-----------------------------------------------------------------------------
abstract_class IASW_Mission_Chooser : public IAppSystem
{
public:
virtual bool GetCurrentTimeAndDate(int *year, int *month, int *dayOfWeek, int *day, int *hour, int *minute, int *second) = 0;
virtual IASW_Random_Missions *RandomMissions() = 0;
virtual IASW_Mission_Chooser_Source *LocalMissionSource() = 0;
virtual IASW_Location_Grid *LocationGrid() = 0;
virtual IASW_Mission_Text_Database *MissionTextDatabase() = 0;
virtual IASW_Map_Builder *MapBuilder() = 0;
virtual IASWSpawnSelection *SpawnSelection() = 0;
};
#define ASW_MISSION_CHOOSER_VERSION "VASWMissionChooser001"
#endif // MISSION_CHOOSER_INT_H

View File

@@ -0,0 +1,70 @@
#ifndef _INCLUDED_IASW_MISSION_CHOOSER_SOURCE_H
#define _INCLUDED_IASW_MISSION_CHOOSER_SOURCE_H
#ifdef _WIN32
#pragma once
#endif
#include "tier0/platform.h"
struct ASW_Mission_Chooser_Mission
{
char m_szMissionName[64];
};
struct ASW_Mission_Chooser_Saved_Campaign
{
char m_szSaveName[64];
char m_szCampaignName[64];
char m_szDateTime[64];
int m_iMissionsComplete;
char m_szPlayerNames[256];
char m_szPlayerIDs[512];
bool m_bMultiplayer;
};
#define ASW_MISSIONS_PER_PAGE 8
#define ASW_CAMPAIGNS_PER_PAGE 3
#define ASW_SAVES_PER_PAGE 8
abstract_class IASW_Mission_Chooser_Source
{
public:
virtual void Think() = 0;
virtual void IdleThink() = 0;
virtual void FindMissions(int nMissionOffset, int iNumSlots, bool bRequireOverview) = 0;
virtual ASW_Mission_Chooser_Mission* GetMissions() = 0; // pass an array of mission names back
virtual ASW_Mission_Chooser_Mission* GetMission( int nIndex, bool bRequireOverview ) = 0; // may return NULL if asking for a mission outside of the found range
virtual int GetNumMissions(bool bRequireOverview) = 0;
virtual void FindCampaigns(int nCampaignOffset, int iNumSlots) = 0;
virtual ASW_Mission_Chooser_Mission* GetCampaigns() = 0; // Passes an array of campaign names back
virtual ASW_Mission_Chooser_Mission* GetCampaign( int nIndex ) = 0; // may return NULL when requesting a campaign outside the found range
virtual int GetNumCampaigns() = 0;
virtual void FindSavedCampaigns(int page, int iNumSlots, bool bMultiplayer, const char *szFilterID) = 0;
virtual ASW_Mission_Chooser_Saved_Campaign* GetSavedCampaigns() = 0; // passes an array of summary data for each save
virtual ASW_Mission_Chooser_Saved_Campaign* GetSavedCampaign( int nIndex, bool bMultiplayer, const char *szFilterID ) = 0; // may return NULL when requesting a save outside the found range
virtual int GetNumSavedCampaigns(bool bMultiplayer, const char *szFilterID) = 0;
virtual void RefreshSavedCampaigns() = 0; // call when the saved campaigns list is dirty and should be refreshed
virtual int GetNumMissionsCompleted(const char *szSaveName) = 0;
virtual void OnSaveDeleted(const char *szSaveName) = 0; // call when a particular save has been deleted
virtual void OnSaveUpdated(const char *szSaveName) = 0; // call when a particular save has been updated
// following only supporter by the local mission source
virtual bool MissionExists(const char *szMapName, bool bRequireOverview) = 0;
virtual bool CampaignExists(const char *szCampaignName) = 0;
virtual bool SavedCampaignExists(const char *szSaveName) = 0;
virtual bool ASW_Campaign_CreateNewSaveGame(char *szFileName, int iFileNameMaxLen, const char *szCampaignName, bool bMultiplayerGame) = 0;
virtual void NotifySaveDeleted(const char *szSaveName) = 0;
virtual const char* GetCampaignSaveIntroMap(const char* szSaveName) = 0; // returns the intro map for the campaign that this save uses
// returns nice version of the filenames (i.e. title from the overview.txt or from the campaign txt)
virtual const char* GetPrettyMissionName(const char *szMapName) = 0;
virtual const char* GetPrettyCampaignName(const char *szCampaignName) = 0;
virtual const char* GetPrettySavedCampaignName(const char *szSaveName) = 0;
// needed by network source
virtual void ResetCurrentPage() = 0;
};
#endif // _INCLUDED_IASW_MISSION_CHOOSER_SOURCE_H

View File

@@ -0,0 +1,94 @@
#ifndef _INCLUDED_IASW_RANDOM_MISSIONS_H
#define _INCLUDED_IASW_RANDOM_MISSIONS_H
#ifdef _WIN32
#pragma once
#endif
#include "iasw_mission_chooser.h"
namespace vgui
{
class Panel;
};
class Vector;
class KeyValues;
class IASW_Encounter;
enum
{
ASW_TILETYPE_UNKNOWN = 0,
ASW_TILETYPE_OUTDOOR1,
ASW_TILETYPE_OUTDOOR2,
ASW_TILETYPE_ARENA1,
ASW_TILETYPE_ARENA2,
ASW_TILETYPE_ARENA3,
ASW_TILETYPE_ROOM2,
ASW_TILETYPE_ROOM1,
ASW_TILETYPE_CORRIDOR1,
ASW_TILETYPE_CORRIDOR2,
ASW_TILETYPE_VENTS,
ASW_TILETYPE_COUNT
};
static const char *g_szASWTileTypeStrings[ASW_TILETYPE_COUNT] =
{
"Unknown",
"Outdoor1",
"Outdoor2",
"Arena1",
"Arena2",
"Arena3",
"Room1",
"Room2",
"Corridor1",
"Corridor2",
"Vents"
};
class IASW_Room_Details
{
public:
// tags
virtual bool HasTag( const char *szTag ) = 0;
virtual int GetNumTags() = 0;
virtual const char* GetTag( int i ) = 0;
virtual int GetSpawnWeight() = 0;
virtual int GetNumExits() = 0;
virtual IASW_Room_Details* GetAdjacentRoom( int nExit ) = 0;
virtual bool GetThumbnailName( char* szOut, int iBufferSize ) = 0;
virtual bool GetFullRoomName( char* szOut, int iBufferSize ) = 0;
virtual void GetSoundscape( char* szOut, int iBufferSize ) = 0;
virtual void GetTheme( char* szOut, int iBufferSize ) = 0;
virtual const Vector& GetAmbientLight() = 0;
virtual bool HasAlienEncounter() = 0;
virtual int GetTileType() = 0;
virtual const char* GetTileTypeName( int nType ) = 0;
virtual int GetRoomIndex() const = 0;
// location
virtual void GetWorldBounds( Vector *vecWorldMins, Vector *vecWorldMaxs ) = 0;
virtual const Vector& WorldSpaceCenter() = 0;
};
class IASW_Random_Missions
{
public:
virtual vgui::Panel* CreateTileGenFrame( vgui::Panel *parent ) = 0;
virtual void LevelInitPostEntity( const char *pszMapName ) = 0;
virtual bool ValidMapLayout() = 0;
virtual IASW_Room_Details* GetRoomDetails( const Vector &vecPos ) = 0;
virtual IASW_Room_Details* GetRoomDetails( int iRoomIndex ) = 0;
virtual IASW_Room_Details* GetStartRoomDetails() = 0;
virtual int GetNumRooms() = 0;
virtual void GetMapBounds( Vector *vecWorldMins, Vector *vecWorldMaxs ) = 0;
virtual KeyValues* GetGenerationOptions() = 0; // returns the generation options for the currently loaded random map
virtual int GetNumEncounters() = 0;
virtual IASW_Encounter* GetEncounter( int i ) = 0;
virtual bool CheckAndCleanDirtyLayout( void ) = 0;
};
#endif // _INCLUDED_IASW_RANDOM_MISSIONS_H

View File

@@ -0,0 +1,81 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
//
//
//===============================================================================
#ifndef IASW_SPAWN_SELECTION_H
#define IASW_SPAWN_SELECTION_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/strtools.h"
#include "mathlib/vector.h"
class IASWSpawnDefinitionEntry;
// NOTE: Text version of these enum types is in asw_spawn_selection.cpp!
enum
{
ASW_NPC_SPAWN_TYPE_INVALID = -1,
ASW_NPC_SPAWN_TYPE_ANY = 0,
ASW_NPC_SPAWN_TYPE_FIXED = 1,
ASW_NPC_SPAWN_TYPE_WANDERER,
ASW_NPC_SPAWN_TYPE_SWARM,
ASW_NPC_SPAWN_TYPE_BOSS,
ASW_NPC_SPAWN_TYPE_PROP,
ASW_NPC_SPAWN_TYPE_ARENAWAVE,
ASW_NPC_SPAWN_TYPE_CONSOLE,
ASW_NPC_SPAWN_TYPE_SPAWNER,
ASW_NPC_SPAWN_TYPE_BIFURCATE,
ASW_NPC_SPAWN_TYPE_SPECIAL1,
ASW_NPC_SPAWN_TYPE_SPECIAL2,
// Has to be last.
ASW_NPC_SPAWN_TYPE_COUNT
};
class IASWSpawnDefinitionEntry
{
public:
virtual const char *GetNPCClassname() = 0;
virtual void GetSpawnCountRange( int &nMin, int &nMax ) = 0;
virtual float GetEliteNPCChance( void ) = 0;
virtual bool UseSpawners() = 0;
};
class IASWSpawnDefinition
{
public:
virtual int GetEntryCount() = 0;
virtual IASWSpawnDefinitionEntry *GetEntry( int nEntry ) = 0;
};
class IASWSpawnSelection
{
public:
virtual IASWSpawnDefinition *GetSpawnDefinition( int nSpawnType ) = 0;
virtual bool IsAvailableNPC( const char *szName ) = 0;
virtual void SetCurrentSpawnSet( int iMissionDifficulty ) = 0;
virtual bool SetCurrentSpawnSet( const char *szSetName ) = 0;
virtual void DumpCurrentSpawnSet() = 0;
};
// fixed spawn encounter in the mission
class IASW_Encounter
{
public:
virtual const Vector& GetEncounterPosition() = 0;
virtual int GetNumSpawnDefs() = 0;
virtual IASWSpawnDefinition* GetSpawnDef( int i ) = 0;
virtual float GetEncounterRadius() = 0;
};
#endif // IASW_SPAWN_SELECTION_H