Some changes.

This commit is contained in:
momo5502 2016-01-21 01:01:22 +01:00
parent 622c6b5dff
commit 7e8663604b
5 changed files with 173 additions and 33 deletions

View File

@ -53,7 +53,7 @@ namespace Components
// Display DEBUG branding, so we know we're on a debug build // Display DEBUG branding, so we know we're on a debug build
Renderer::OnFrame([] () Renderer::OnFrame([] ()
{ {
Game::Font_s* font = Game::R_RegisterFont("fonts/normalFont"); Game::Font* font = Game::R_RegisterFont("fonts/normalFont");
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, 0); Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, 0);
}); });

View File

@ -101,7 +101,7 @@ namespace Components
{ {
if (!FastFiles::Current().size() || !Dvar::Var("ui_zoneDebug").Get<bool>()) return; if (!FastFiles::Current().size() || !Dvar::Var("ui_zoneDebug").Get<bool>()) return;
Game::Font_s* font = Game::R_RegisterFont("fonts/consoleFont"); // Inlining that seems to skip xpos, no idea why xD Game::Font* font = Game::R_RegisterFont("fonts/consoleFont"); // Inlining that seems to skip xpos, no idea why xD
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) }; float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
Game::R_AddCmdDrawText(Utils::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, (float)(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, 0); Game::R_AddCmdDrawText(Utils::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, (float)(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, 0);
}); });

View File

@ -36,7 +36,7 @@ namespace Game
typedef char* (__cdecl * Com_ParseExt_t)(const char**); typedef char* (__cdecl * Com_ParseExt_t)(const char**);
extern Com_ParseExt_t Com_ParseExt; extern Com_ParseExt_t Com_ParseExt;
typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* filename); typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* name);
extern DB_FindXAssetHeader_t DB_FindXAssetHeader; extern DB_FindXAssetHeader_t DB_FindXAssetHeader;
typedef const char* (__cdecl * DB_GetXAssetNameHandler_t)(Game::XAssetHeader* asset); typedef const char* (__cdecl * DB_GetXAssetNameHandler_t)(Game::XAssetHeader* asset);
@ -157,10 +157,10 @@ namespace Game
typedef bool(__cdecl * Menus_MenuIsInStack_t)(UiContext *dc, menuDef_t *menu); typedef bool(__cdecl * Menus_MenuIsInStack_t)(UiContext *dc, menuDef_t *menu);
extern Menus_MenuIsInStack_t Menus_MenuIsInStack; extern Menus_MenuIsInStack_t Menus_MenuIsInStack;
typedef void(__cdecl * MSG_Init_t)(void* msg, void* data, int maxsize); typedef void(__cdecl * MSG_Init_t)(msg_t *buf, char *data, int length);
extern MSG_Init_t MSG_Init; extern MSG_Init_t MSG_Init;
typedef int(__cdecl * MSG_ReadData_t)(msg_t* msg, char*, size_t); typedef void(__cdecl * MSG_ReadData_t)(msg_t *msg, void *data, int len);
extern MSG_ReadData_t MSG_ReadData; extern MSG_ReadData_t MSG_ReadData;
typedef int(__cdecl * MSG_ReadLong_t)(msg_t* msg); typedef int(__cdecl * MSG_ReadLong_t)(msg_t* msg);
@ -175,7 +175,10 @@ namespace Game
typedef char* (__cdecl * MSG_ReadString_t)(msg_t*); typedef char* (__cdecl * MSG_ReadString_t)(msg_t*);
extern MSG_ReadString_t MSG_ReadString; extern MSG_ReadString_t MSG_ReadString;
typedef void(__cdecl * MSG_WriteByte_t)(msg_t* msg, unsigned char); typedef int(__cdecl * MSG_ReadByte_t)(msg_t* msg);
extern MSG_ReadByte_t MSG_ReadByte;
typedef void(__cdecl * MSG_WriteByte_t)(msg_t* msg, unsigned char c);
extern MSG_WriteByte_t MSG_WriteByte; extern MSG_WriteByte_t MSG_WriteByte;
typedef void(__cdecl * MSG_WriteData_t)(msg_t* msg, char*, size_t); typedef void(__cdecl * MSG_WriteData_t)(msg_t* msg, char*, size_t);
@ -187,15 +190,6 @@ namespace Game
typedef int(__cdecl * MSG_WriteBitsCompress_t)(bool trainHuffman, const char *from, char *to, int size); typedef int(__cdecl * MSG_WriteBitsCompress_t)(bool trainHuffman, const char *from, char *to, int size);
extern MSG_WriteBitsCompress_t MSG_WriteBitsCompress; extern MSG_WriteBitsCompress_t MSG_WriteBitsCompress;
typedef short(__cdecl * MSG_ReadShort_t)(msg_t* msg);
extern MSG_ReadShort_t MSG_ReadShort;
typedef __int64(__cdecl * MSG_ReadInt64_t)(msg_t* msg);
extern MSG_ReadInt64_t MSG_ReadInt64;
typedef int(__cdecl * MSG_ReadByte_t)(msg_t* msg);
extern MSG_ReadByte_t MSG_ReadByte;
typedef const char* (__cdecl * NET_AdrToString_t)(netadr_t adr); typedef const char* (__cdecl * NET_AdrToString_t)(netadr_t adr);
extern NET_AdrToString_t NET_AdrToString; extern NET_AdrToString_t NET_AdrToString;
@ -256,19 +250,19 @@ namespace Game
typedef const char *(__cdecl * PartyHost_GetMemberName_t)(PartyData_s* party, const int clientNum); typedef const char *(__cdecl * PartyHost_GetMemberName_t)(PartyData_s* party, const int clientNum);
extern PartyHost_GetMemberName_t PartyHost_GetMemberName; extern PartyHost_GetMemberName_t PartyHost_GetMemberName;
typedef Font_s* (__cdecl * R_RegisterFont_t)(const char* asset); typedef Font* (__cdecl * R_RegisterFont_t)(const char* asset);
extern R_RegisterFont_t R_RegisterFont; extern R_RegisterFont_t R_RegisterFont;
typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font_s *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style); typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style);
extern R_AddCmdDrawText_t R_AddCmdDrawText; extern R_AddCmdDrawText_t R_AddCmdDrawText;
typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, void* material); typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, void* material);
extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic; extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic;
typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, Font_s* font); typedef int(__cdecl * R_TextWidth_t)(const char* text, int maxlength, Font* font);
extern R_TextWidth_t R_TextWidth; extern R_TextWidth_t R_TextWidth;
typedef int(__cdecl * R_TextHeight_t)(Font_s* font); typedef int(__cdecl * R_TextHeight_t)(Font* font);
extern R_TextHeight_t R_TextHeight; extern R_TextHeight_t R_TextHeight;
typedef script_t* (__cdecl * Script_Alloc_t)(int length); typedef script_t* (__cdecl * Script_Alloc_t)(int length);

View File

@ -6,6 +6,11 @@ namespace Game
{ {
#endif #endif
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef enum typedef enum
{ {
ASSET_TYPE_PHYSPRESET = 0, ASSET_TYPE_PHYSPRESET = 0,
@ -102,7 +107,7 @@ namespace Game
float vec2[2]; float vec2[2];
float vec3[3]; float vec3[3];
float vec4[4]; float vec4[4];
BYTE color[4]; //to get float: multiply by 0.003921568859368563 - BaberZz unsigned char color[4]; //to get float: multiply by 0.003921568859368563 - BaberZz
//__int64 integer64; only in Tx //__int64 integer64; only in Tx
}; };
union dvar_maxmin_t { union dvar_maxmin_t {
@ -158,18 +163,160 @@ namespace Game
int freeFlags; int freeFlags;
} XZoneInfo; } XZoneInfo;
typedef float vec_t;
typedef vec_t vec4_t[4];
struct expression_s; struct expression_s;
struct statement_s; struct statement_s;
struct menuDef_t; struct menuDef_t;
enum operationEnum; enum operationEnum;
struct GfxImageLoadDef // actually a IDirect3DTexture* but this is easier
{
char mipLevels;
char flags;
short dimensions[3];
int format; // usually the compression Magic
int dataSize; // set to zero to load from IWD
//char * data;
};
struct GfxImage
{
GfxImageLoadDef * /*Direct3DTexture9**/ texture;
char mapType; // 5 is cube, 4 is 3d, 3 is 2d
char semantic;
char category;
char flags;
int cardMemory;
int dataLen1;
int dataLen2;
short height;
short width;
short depth;
bool loaded;
char pad;
char* name;
};
struct water_t
{
float floatTime;
float *H0X; // Count = M * N
float *H0Y; // Count = M * N
float *wTerm; // Count = M * N
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage *image;
};
union MaterialTextureDefInfo
{
GfxImage *image; // MaterialTextureDef->semantic != SEMANTIC_WATER_MAP
water_t *water; // MaterialTextureDef->semantic == SEMANTIC_WATER_MAP
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char sampleState;
char semantic;
MaterialTextureDefInfo info;
};
struct ShaderArgumentDef
{
short type;
short dest;
short paramID;
short more;
};
struct VertexDecl
{
const char* name;
int unknown;
char pad[28];
/*IDirect3DVertexDeclaration9**/void* declarations[16];
};
struct PixelShader
{
const char* name;
/*IDirect3DPixelShader9*/void* shader;
DWORD* bytecode;
int codeLen;
};
struct VertexShader
{
const char* name;
void * /*IDirect3DVertexShader9**/ shader;
DWORD* bytecode;
int codeLen;
};
struct MaterialPass
{
VertexDecl* vertexDecl;
VertexShader* vertexShader;
PixelShader* pixelShader;
char argCount1;
char argCount2;
char argCount3;
char unk;
ShaderArgumentDef* argumentDef;
};
struct MaterialTechnique
{
char* name;
short pad2;
short numPasses;
MaterialPass passes[1];
};
struct MaterialTechniqueSet
{
const char* name;
char pad[4];
MaterialTechniqueSet* remappedTechniques;
MaterialTechnique* techniques[48];
};
struct MaterialConstantDef
{
int nameHash;
char name[12];
vec4_t literal;
};
struct Material struct Material
{ {
const char *name; const char *name;
char gameFlags;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
char drawSurf[12];
int surfaceTypeBits;
char stateBitsEntry[48];
char textureCount;
char constantCount;
char stateBitsCount;
char stateFlags;
char cameraRegion;
MaterialTechniqueSet *techniqueSet;
MaterialTextureDef *textureTable;
MaterialConstantDef *constantTable;
void *stateBitTable;
}; };
struct keyname_t struct keyname_t
@ -634,7 +781,7 @@ namespace Game
typedef union typedef union
{ {
BYTE bytes[4]; unsigned char bytes[4];
DWORD full; DWORD full;
} netIP_t; } netIP_t;
@ -643,7 +790,7 @@ namespace Game
netadrtype_t type; netadrtype_t type;
netIP_t ip; netIP_t ip;
unsigned short port; unsigned short port;
BYTE ipx[10]; unsigned char ipx[10];
} netadr_t; } netadr_t;
typedef struct typedef struct
@ -928,7 +1075,7 @@ namespace Game
char * compressedData; char * compressedData;
}; };
typedef struct fontEntry_s struct FontEntry
{ {
unsigned short character; unsigned short character;
unsigned char padLeft; unsigned char padLeft;
@ -941,17 +1088,17 @@ namespace Game
float uvTop; float uvTop;
float uvRight; float uvRight;
float uvBottom; float uvBottom;
} fontEntry_t; };
typedef struct Font_s struct Font
{ {
char* name; char* name;
int size; int size;
int entries; int entries;
Material* image; Material* image;
Material* glowImage; Material* glowImage;
fontEntry_t* characters; FontEntry* characters;
} Font; };
typedef enum typedef enum
{ {
@ -1199,7 +1346,7 @@ namespace Game
typedef struct party_s typedef struct party_s
{ {
BYTE pad1[544]; unsigned char pad1[544];
int privateSlots; int privateSlots;
int publicSlots; int publicSlots;
} party_t; } party_t;

View File

@ -1,6 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{ {
static Utils::Hook EntryPointHook; static Utils::Hook EntryPointHook;