mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 14:58:10 -05:00
move parts to new common component to avoid circular dependency of zonecommon and objcommon
This commit is contained in:
39
src/Common/Game/T6/CommonT6.cpp
Normal file
39
src/Common/Game/T6/CommonT6.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "CommonT6.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
int CommonT6::Com_HashKey(const char* str, const int maxLen)
|
||||
{
|
||||
if (str == nullptr)
|
||||
return 0;
|
||||
|
||||
int hash = 0;
|
||||
for (int i = 0; i < maxLen; i++)
|
||||
{
|
||||
if (str[i] == '\0')
|
||||
break;
|
||||
|
||||
hash += str[i] * (0x77 + i);
|
||||
}
|
||||
|
||||
return hash ^ ((hash ^ (hash >> 10)) >> 10);
|
||||
}
|
||||
|
||||
int CommonT6::Com_HashString(const char* str, const int len)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
int result = 0x1505;
|
||||
int offset = 0;
|
||||
while(str[offset])
|
||||
{
|
||||
if (len > 0 && offset >= len)
|
||||
break;
|
||||
|
||||
const int c = tolower(str[offset++]);
|
||||
result = c + 33 * result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
8
src/Common/Game/T6/CommonT6.h
Normal file
8
src/Common/Game/T6/CommonT6.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class CommonT6
|
||||
{
|
||||
public:
|
||||
static int Com_HashKey(const char* str, int maxLen);
|
||||
static int Com_HashString(const char* str, int len);
|
||||
};
|
58
src/Common/Game/T6/GameT6.cpp
Normal file
58
src/Common/Game/T6/GameT6.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "GameT6.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "T6.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
GameT6 g_GameT6;
|
||||
|
||||
const std::string GameT6::NAME = "T6";
|
||||
|
||||
const std::string& GameT6::GetName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
void GameT6::AddZone(Zone* zone)
|
||||
{
|
||||
m_zones.push_back(zone);
|
||||
}
|
||||
|
||||
void GameT6::RemoveZone(Zone* zone)
|
||||
{
|
||||
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
|
||||
|
||||
if (foundEntry != m_zones.end())
|
||||
m_zones.erase(foundEntry);
|
||||
}
|
||||
|
||||
std::vector<Zone*> GameT6::GetZones()
|
||||
{
|
||||
return m_zones;
|
||||
}
|
||||
|
||||
std::vector<GameLanguagePrefix> GameT6::GetLanguagePrefixes()
|
||||
{
|
||||
std::vector<GameLanguagePrefix> prefixes;
|
||||
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_ENGLISH, "en_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH, "fr_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH_CAN, "fc_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_GERMAN, "ge_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_AUSTRIAN, "as_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_ITALIAN, "it_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_SPANISH, "sp_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_BRITISH, "br_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_RUSSIAN, "ru_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_POLISH, "po_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_KOREAN, "ko_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_JAPANESE, "ja_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_CZECH, "cz_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_FULL_JAPANESE, "fj_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_PORTUGUESE, "bp_");
|
||||
prefixes.emplace_back(GameLanguage::LANGUAGE_MEXICAN_SPANISH, "ms_");
|
||||
|
||||
return prefixes;
|
||||
}
|
17
src/Common/Game/T6/GameT6.h
Normal file
17
src/Common/Game/T6/GameT6.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "Game/IGame.h"
|
||||
|
||||
class GameT6 : public IGame
|
||||
{
|
||||
static const std::string NAME;
|
||||
std::vector<Zone*> m_zones;
|
||||
|
||||
public:
|
||||
const std::string& GetName() override;
|
||||
void AddZone(Zone* zone) override;
|
||||
void RemoveZone(Zone* zone) override;
|
||||
std::vector<Zone*> GetZones() override;
|
||||
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
|
||||
};
|
||||
|
||||
extern GameT6 g_GameT6;
|
126
src/Common/Game/T6/T6.h
Normal file
126
src/Common/Game/T6/T6.h
Normal file
@ -0,0 +1,126 @@
|
||||
#pragma once
|
||||
|
||||
//#include <d3d11.h>
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "T6_Assets.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
struct ScriptStringList
|
||||
{
|
||||
int count;
|
||||
const char** strings;
|
||||
};
|
||||
|
||||
struct XAsset
|
||||
{
|
||||
XAssetType type;
|
||||
XAssetHeader header;
|
||||
};
|
||||
|
||||
struct XAssetList
|
||||
{
|
||||
ScriptStringList stringList;
|
||||
int dependCount;
|
||||
const char** depends;
|
||||
int assetCount;
|
||||
XAsset* assets;
|
||||
};
|
||||
|
||||
struct cspField_t
|
||||
{
|
||||
const char* szName;
|
||||
int iOffset;
|
||||
int iFieldType;
|
||||
};
|
||||
|
||||
enum csParseFieldType_t
|
||||
{
|
||||
CSPFT_STRING = 0,
|
||||
CSPFT_STRING_MAX_STRING_CHARS,
|
||||
CSPFT_STRING_MAX_QPATH,
|
||||
CSPFT_STRING_MAX_OSPATH,
|
||||
CSPFT_INT,
|
||||
CSPFT_UINT,
|
||||
CSPFT_BOOL,
|
||||
CSPFT_QBOOLEAN,
|
||||
CSPFT_FLOAT,
|
||||
CSPFT_MILLISECONDS,
|
||||
CSPFT_FX,
|
||||
CSPFT_XMODEL,
|
||||
CSPFT_MATERIAL,
|
||||
CSPFT_MATERIAL_STREAM,
|
||||
CSPFT_PHYS_PRESET,
|
||||
CSPFT_SCRIPT_STRING,
|
||||
CSPFT_TRACER,
|
||||
CSPFT_SOUND_ALIAS_ID,
|
||||
|
||||
CSPFT_NUM_BASE_FIELD_TYPES
|
||||
};
|
||||
|
||||
enum weapFieldType_t
|
||||
{
|
||||
WFT_WEAPONTYPE = CSPFT_NUM_BASE_FIELD_TYPES,
|
||||
WFT_WEAPONCLASS,
|
||||
WFT_OVERLAYRETICLE,
|
||||
WFT_PENETRATE_TYPE,
|
||||
WFT_IMPACT_TYPE,
|
||||
WFT_STANCE,
|
||||
WFT_PROJ_EXPLOSION,
|
||||
WFT_OFFHAND_CLASS,
|
||||
WFT_OFFHAND_SLOT,
|
||||
WFT_ANIMTYPE,
|
||||
WFT_ACTIVE_RETICLE_TYPE,
|
||||
WFT_GUIDED_MISSILE_TYPE,
|
||||
WFT_BOUNCE_SOUND,
|
||||
WFT_STICKINESS,
|
||||
WFT_ROTATETYPE,
|
||||
WFT_OVERLAYINTERFACE,
|
||||
WFT_INVENTORYTYPE,
|
||||
WFT_FIRETYPE,
|
||||
WFT_CLIPTYPE,
|
||||
WFT_AMMOCOUNTER_CLIPTYPE,
|
||||
WFT_ICONRATIO_HUD,
|
||||
WFT_ICONRATIO_AMMOCOUNTER,
|
||||
WFT_ICONRATIO_KILL,
|
||||
WFT_ICONRATIO_DPAD,
|
||||
WFT_ICONRATIO_INDICATOR,
|
||||
WFT_BARRELTYPE,
|
||||
WFT_HIDETAGS,
|
||||
WFT_EXPLOSION_TAG,
|
||||
WFT_NOTETRACKSOUNDMAP,
|
||||
WFT_WEAPON_CAMO,
|
||||
|
||||
WFT_NUM_FIELD_TYPES
|
||||
};
|
||||
|
||||
enum VehicleFieldType
|
||||
{
|
||||
VFT_TYPE = CSPFT_NUM_BASE_FIELD_TYPES,
|
||||
VFT_CAMERAMODE,
|
||||
VFT_TRACTION_TYPE,
|
||||
VFT_MPH_TO_INCHES_PER_SECOND,
|
||||
VFT_POUNDS_TO_GAME_MASS,
|
||||
VFT_TEAM,
|
||||
VFT_KEY_BINDING,
|
||||
VFT_GRAPH,
|
||||
VFT_WIIUCONTROLOVERRIDE,
|
||||
|
||||
VFT_NUM
|
||||
};
|
||||
|
||||
enum tracerFieldType_t
|
||||
{
|
||||
TFT_TRACERTYPE = CSPFT_NUM_BASE_FIELD_TYPES,
|
||||
|
||||
TFT_NUM_FIELD_TYPES
|
||||
};
|
||||
|
||||
enum constraintsFieldType_t
|
||||
{
|
||||
CFT_TYPE = 0x12,
|
||||
|
||||
CFT_NUM
|
||||
};
|
||||
}
|
6585
src/Common/Game/T6/T6_Assets.h
Normal file
6585
src/Common/Game/T6/T6_Assets.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user