17 Nov 2010

This commit is contained in:
g-cont 2010-11-17 00:00:00 +03:00 committed by Alibek Omarov
parent 38e8272324
commit 7e9f934ce3
11 changed files with 231 additions and 46 deletions

View File

@ -166,9 +166,7 @@ so the HUD can reinitialize itself.
int DLLEXPORT HUD_VidInit( void )
{
gHUD.VidInit();
// FIXME: implement Vgui
// VGui_Startup();
VGui_Startup();
return 1;
}
@ -253,8 +251,7 @@ void DLLEXPORT HUD_Frame( double time )
{
ServersThink( time );
if( gViewPort )
GetClientVoiceMgr()->Frame(time);
GetClientVoiceMgr()->Frame(time);
}
@ -268,8 +265,7 @@ Called when a player starts or stops talking.
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking)
{
if( gViewPort )
GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, bTalking);
GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, bTalking);
}
/*

View File

@ -539,8 +539,7 @@ void DLLEXPORT HUD_CreateEntities( void )
// Add in any game specific objects
Game_AddObjects();
if( gViewPort )
GetClientVoiceMgr()->CreateEntities();
GetClientVoiceMgr()->CreateEntities();
}
/*

View File

@ -347,8 +347,7 @@ void CHud :: Init( void )
m_TextMessage.Init();
m_StatusIcons.Init();
if( gViewPort )
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort);
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort);
m_Menu.Init();
@ -497,8 +496,7 @@ void CHud :: VidInit( void )
m_TextMessage.VidInit();
m_StatusIcons.VidInit();
if( gViewPort )
GetClientVoiceMgr()->VidInit();
GetClientVoiceMgr()->VidInit();
}
int CHud::MsgFunc_Logo(const char *pszName, int iSize, void *pbuf)

View File

@ -2592,29 +2592,6 @@ static void pfnSetScreenFade( struct screenfade_s *fade )
if( fade ) clgame.fade = *fade;
}
/*
=============
VGui_GetPanel
=============
*/
void *VGui_GetPanel( void )
{
// UNDONE: wait for version 0.75
return NULL;
}
/*
=============
VGui_ViewportPaintBackground
=============
*/
void VGui_ViewportPaintBackground( int extents[4] )
{
// UNDONE: wait for version 0.75
}
/*
=============
pfnLoadMapSprite
@ -3666,6 +3643,8 @@ qboolean CL_LoadProgs( const char *name )
CL_InitViewBeams ();
CL_InitTempEnts ();
VGui_Startup ();
// initialize game
clgame.dllFuncs.pfnInit();

View File

@ -770,6 +770,9 @@ void CL_SendDisconnectMessage( void )
BF_WriteByte( &buf, clc_stringcmd );
BF_WriteString( &buf, "disconnect" );
if( !cls.netchan.remote_address.type )
cls.netchan.remote_address.type = NA_LOOPBACK;
// make sure message will be delivered
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));
Netchan_Transmit( &cls.netchan, BF_GetNumBytesWritten( &buf ), BF_GetData( &buf ));

View File

@ -258,8 +258,10 @@ void SCR_UpdateScreen( void )
V_PostRender();
}
if( clgame.hInstance )
clgame.dllFuncs.pfnFrame( cl_time( ));
if( !clgame.hInstance ) return;
clgame.dllFuncs.pfnFrame( cl.time );
VGui_Paint ();
}
static void SCR_LoadCreditsFont( void )
@ -356,6 +358,8 @@ void SCR_RegisterShaders( void )
menu.globals->scrWidth = scr_width->integer;
menu.globals->scrHeight = scr_height->integer;
VGui_Startup ();
// vid_state has changed
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
if( menu.hInstance ) menu.dllFuncs.pfnVidInit();

View File

@ -426,12 +426,20 @@ typedef struct
file_t *demofile;
} client_static_t;
#ifdef __cplusplus
extern "C" {
#endif
extern client_t cl;
extern client_static_t cls;
extern clgame_static_t clgame;
extern menu_static_t menu;
extern render_exp_t *re;
#ifdef __cplusplus
}
#endif
//
// cvars
//
@ -530,8 +538,6 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize );
int pfnDecalIndexFromName( const char *szDecalName );
int CL_FindModelIndex( const char *m );
HSPRITE pfnSPR_Load( const char *szPicName );
void *VGui_GetPanel( void );
void VGui_ViewportPaintBackground( int extents[4] );
_inline cl_entity_t *CL_EDICT_NUM( int n, const char *file, const int line )
{
@ -676,4 +682,20 @@ void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
void CL_PlayVideo_f( void );
//
// vgui_int.cpp
//
#ifdef __cplusplus
extern "C" {
#endif
void VGui_Startup( void );
void *VGui_GetPanel( void );
void VGui_Paint( void );
void VGui_ViewportPaintBackground( int extents[4] );
#ifdef __cplusplus
}
#endif
#endif//CLIENT_H

View File

@ -7,11 +7,19 @@
#include "cm_local.h"
#ifdef __cplusplus
extern "C" {
#endif
// linked interfaces
extern stdlib_api_t com;
extern vsound_exp_t *se;
extern render_exp_t *re;
#ifdef __cplusplus
}
#endif
_inline int CL_CreateDecalList( decallist_t *pList, qboolean changelevel )
{
if( !re ) return 0;

169
engine/common/vgui_int.cpp Normal file
View File

@ -0,0 +1,169 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// vgi_int.c - vgui dll interaction
//=======================================================================
#include "common.h"
#include "client.h"
#include "const.h"
#include<VGUI.h>
#include<VGUI_App.h>
#include<VGUI_Panel.h>
#include<VGUI_SurfaceBase.h>
#include<VGUI_Surface.h>
#include<VGUI_SurfaceGL.h>
#include<VGUI_ActionSignal.h>
#include<VGUI_BorderLayout.h>
using namespace vgui;
SurfaceGL::SurfaceGL( Panel* embeddedPanel ):Surface( embeddedPanel )
{
_embeddedPanel = embeddedPanel;
}
void SurfaceGL::texturedRect( int x0, int y0, int x1, int y1 )
{
Msg( "texturedRect: %i %i %i %i\n", x0, y0, x1, y1 );
}
bool SurfaceGL:: recreateContext()
{
return true;
}
void SurfaceGL:: createPopup( Panel *embeddedPanel )
{
}
void SurfaceGL:: pushMakeCurrent( Panel* panel, bool useInsets )
{
}
void SurfaceGL:: popMakeCurrent( Panel* panel )
{
}
void SurfaceGL:: makeCurrent( void )
{
}
void SurfaceGL::swapBuffers( void )
{
}
void SurfaceGL::setColor( int r, int g, int b )
{
}
void SurfaceGL::filledRect( int x0, int y0, int x1, int y1 )
{
}
void SurfaceGL::outlinedRect( int x0, int y0, int x1, int y1 )
{
}
void SurfaceGL::setTextFont( Font* font )
{
}
void SurfaceGL::setTextColor( int r, int g, int b )
{
Msg( "setTextColor: %i %i %i\n", r, g, b );
}
void SurfaceGL::setDrawPos( int x, int y )
{
Msg( "setDrawPos: %i %i\n", x, y );
}
void SurfaceGL::printText( const char *str, int strlen )
{
Msg( "printText: %s\n", str );
}
void SurfaceGL::setTextureRGBA( int id, const char *rgba, int wide, int tall )
{
Msg( "setTextureRGBA: %i\n", id );
}
void SurfaceGL::setTexture( int id )
{
Msg( "setTexture: %i\n", id );
}
class CEngineApp : public App
{
public:
CEngineApp( void )
{
reset();
}
virtual void main( int argc, char* argv[] )
{
}
virtual void setCursorPos( int x, int y )
{
Msg( "setCursorPos: %i %i\n", x, y );
}
virtual void getCursorPos( int &x,int &y )
{
App::getCursorPos( x, y );
Msg( "getCursorPos: %i %i\n", x, y );
}
};
class CEnginePanel : public Panel, public CEngineApp
{
typedef Panel BaseClass;
public:
CEnginePanel( void )
{
_surfaceBase = new SurfaceGL( this );
setSurfaceBaseTraverse( _surfaceBase );
setParent( NULL );
}
};
CEnginePanel *rootpanel = NULL;
void VGui_Startup( void )
{
if( rootpanel )
{
rootpanel->reset();
rootpanel->setSize( menu.globals->scrWidth, menu.globals->scrHeight );
return;
}
rootpanel = new CEnginePanel();
rootpanel->setLayout( new BorderLayout( 0 ));
rootpanel->setEnabled( true );
rootpanel->setVisible( true );
ASSERT( rootpanel->getApp() != NULL );
ASSERT( rootpanel->getSurfaceBase() != NULL );
}
void VGui_Paint( void )
{
if( !rootpanel ) return;
rootpanel->solveTraverse();
rootpanel->paintTraverse();
}
void VGui_ViewportPaintBackground( int extents[4] )
{
Msg( "paint()\n" );
}
void *VGui_GetPanel( void )
{
return (void *)rootpanel;
}

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /I "../pm_shared" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /opt:nowin98
# ADD LINK32 user32.lib msvcrt.lib vfw32.lib msacm32.lib gdi32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# ADD LINK32 user32.lib msvcrt.lib vfw32.lib msacm32.lib gdi32.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# SUBTRACT LINK32 /debug /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\engine\!release
@ -80,7 +80,7 @@ SOURCE="$(InputPath)"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /I "../pm_shared" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -91,7 +91,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 user32.lib msvcrtd.lib vfw32.lib msacm32.lib gdi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
# ADD LINK32 user32.lib msvcrtd.lib vfw32.lib msacm32.lib gdi32.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /map /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\engine\!debug
@ -310,6 +310,10 @@ SOURCE=.\common\titles.c
# End Source File
# Begin Source File
SOURCE=.\common\vgui_int.cpp
# End Source File
# Begin Source File
SOURCE=.\common\world.c
# End Source File
# End Group

View File

@ -19,7 +19,10 @@
#define MAX_STRING_TABLES 8 // seperately stringsystems
#define EXPORT __declspec( dllexport )
#define BIT( n ) (1<<( n ))
#ifndef NULL
#define NULL ((void *)0)
#endif
// color strings
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
@ -748,7 +751,7 @@ script shared declaration
external and internal script_t struct have some differences
========================================================================
*/
typedef struct script_s
struct script_s
{
char *buffer;
char *text;
@ -756,7 +759,7 @@ typedef struct script_s
char TXcommand; // contain QuArK 'TX' command in the map file descriptions
};
typedef struct convar_s
struct convar_s
{
// this part shared with cvar_t
char *name;