22 Jul 2010

This commit is contained in:
g-cont 2010-07-22 00:00:00 +04:00 committed by Alibek Omarov
parent fb9bac93da
commit c6f5fcf188
54 changed files with 273 additions and 434 deletions

View File

@ -12,7 +12,6 @@ release.bat
launchers.bat
change.log
baserc\
bshift\
client\
client\hud\

View File

@ -1,145 +0,0 @@
# Microsoft Developer Studio Project File - Name="baserc" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=baserc - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "baserc.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "baserc.mak" CFG="baserc - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "baserc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "baserc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "baserc - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\temp\baserc\!release"
# PROP Intermediate_Dir "..\temp\baserc\!release"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 /dll /machine:I386 /opt:nowin98
# ADD LINK32 msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# SUBTRACT LINK32 /profile /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\baserc\!release
InputPath=\Xash3D\src_main\temp\baserc\!release\baserc.dll
SOURCE="$(InputPath)"
"D:\Xash3D\bin\baserc.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\baserc.dll "D:\Xash3D\bin\baserc.dll"
# End Custom Build
!ELSEIF "$(CFG)" == "baserc - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\temp\baserc\!debug"
# PROP Intermediate_Dir "..\temp\baserc\!debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 msvcrtd.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\baserc\!debug
InputPath=\Xash3D\src_main\temp\baserc\!debug\baserc.dll
SOURCE="$(InputPath)"
"D:\Xash3D\bin\baserc.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\baserc.dll "D:\Xash3D\bin\baserc.dll"
# End Custom Build
!ENDIF
# Begin Target
# Name "baserc - Win32 Release"
# Name "baserc - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\rc_main.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\client.h
# End Source File
# Begin Source File
SOURCE=.\images.h
# End Source File
# Begin Source File
SOURCE=.\q1texture.h
# End Source File
# Begin Source File
SOURCE=.\server.h
# End Source File
# Begin Source File
SOURCE=.\uimenu.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,67 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// rc_main.c - resource library
//=======================================================================
#include <windows.h>
#include "launch_api.h"
#include "baserc_api.h"
// resources
#include "images.h"
stdlib_api_t com;
typedef struct loadres_s
{
const char *intname;
const byte *buffer;
const size_t filesize;
} loadres_t;
loadres_t load_resources[] =
{
// add new resource description here
{"blank.bmp", blank_bmp, sizeof(blank_bmp)},
{NULL, NULL, 0 }
};
byte *RC_FindFile( const char *filename, fs_offset_t *size )
{
loadres_t *res;
// now try all the formats in the selected list
for( res = load_resources; res->intname; res++ )
{
if(!com.stricmp( filename, res->intname ))
{
MsgDev( D_LOAD, "RC_FindFile: %s\n", res->intname );
if( size ) *size = res->filesize;
return ( byte *)res->buffer;
}
}
// no matching found
if( size ) *size = 0;
return NULL;
}
// main DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
return TRUE;
}
baserc_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input, void *unused )
{
static baserc_exp_t Com;
com = *input;
// generic functions
Com.api_size = sizeof( baserc_exp_t );
Com.com_size = sizeof( stdlib_api_t );
Com.LoadFile = RC_FindFile;
return &Com;
}

View File

@ -3,6 +3,9 @@ build ????
Engine: add 'allow_levelshots' cvar (disabled by default) to switch between custom levelshots and normal 'loading' screen
Client: remove fmod.dll implementation
Engine: implement variable-sized fonts
Sound: added support for stereo wavs plays (menu sounds)
Render: enable custom game icons (game.ico in mod folder)
Engine: move menu code into new user dll called GameUI.dll (based on original q2e 0.40 menu code)
build 1254

View File

@ -8,9 +8,6 @@ set build_type=debug
set BUILD_ERROR=
call vcvars32
%MSDEV% baserc/baserc.dsp %CONFIG%"baserc - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% bshift/bshift.dsp %CONFIG%"bshift - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
@ -60,7 +57,6 @@ goto done
:build_ok
rem //delete log files
if exist baserc\baserc.plg del /f /q baserc\baserc.plg
if exist bshift\bshift.plg del /f /q bshift\bshift.plg
if exist client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.plg

View File

@ -658,6 +658,7 @@ static void CL_DrawLoading( float percent )
MakeRGBA( color, 128, 128, 128, 255 );
re->SetColor( color );
re->SetParms( cls.loadingBar, kRenderTransTexture, 0 );
re->DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
step = (float)width / 100.0f;

View File

@ -436,6 +436,7 @@ pfnPlaySound
*/
static void pfnPlaySound( const char *szSound )
{
if( !szSound || !*szSound ) return;
S_StartLocalSound( szSound );
}

View File

@ -318,7 +318,10 @@ void SCR_Init( void )
Cmd_AddCommand( "viewpos", SCR_Viewpos_f, "prints current player origin" );
if( !UI_LoadProgs( "GameUI.dll" ))
MsgDev( D_ERROR, "can't initialize gameui.dll\n" ); // there is non fatal for us
{
Msg( "^1Error: ^7can't initialize gameui.dll\n" ); // there is non fatal for us
if( !host.developer ) host.developer = 1; // we need console, because menu is missing
}
SCR_RegisterShaders ();
SCR_LoadCreditsFont ();

View File

@ -466,7 +466,7 @@ void Con_Init( void )
scr_height = Cvar_Get( "height", "480", 0, "screen height" );
scr_conspeed = Cvar_Get( "scr_conspeed", "600", 0, "console moving speed" );
con_notifytime = Cvar_Get( "con_notifytime", "3", 0, "notify time to live" );
con_fontsize = Cvar_Get( "con_fontsize", "0", CVAR_ARCHIVE|CVAR_LATCH, "console font number (0, 1 or 2)" );
con_fontsize = Cvar_Get( "con_fontsize", "1", CVAR_ARCHIVE|CVAR_LATCH, "console font number (0, 1 or 2)" );
Con_CheckResize();
@ -537,9 +537,9 @@ void Con_Print( const char *txt )
color = ColorIndex( COLOR_DEFAULT );
while((c = *txt) != 0 )
while(( c = *txt ) != 0 )
{
if(IsColorString( txt ))
if( IsColorString( txt ))
{
color = ColorIndex(*(txt+1));
txt += 2;
@ -553,7 +553,7 @@ void Con_Print( const char *txt )
}
// word wrap
if( l != con.linewidth && (con.x + l >= con.linewidth ))
if( l != con.linewidth && ( con.x + l >= con.linewidth ))
Con_Linefeed( skipnotify);
txt++;

View File

@ -684,7 +684,6 @@ static void Host_Crash_f( void )
void Host_InitCommon( const int argc, const char **argv )
{
char dev_level[4];
dll_info_t check_vid, check_snd;
search_t *dlls;
int i;
@ -694,10 +693,8 @@ void Host_InitCommon( const int argc, const char **argv )
// overload some funcs
newcom.error = Host_Error;
// check developer mode
if(FS_CheckParm( "-console" )) host.developer = 1;
if( FS_GetParmFromCmdLine( "-dev", dev_level ))
host.developer = com.atoi( dev_level );
// get developer mode
host.developer = SI->developer;
Host_InitEvents();

View File

@ -32,11 +32,12 @@ cvar_t *ui_sensitivity;
uiStatic_t uiStatic;
char uiEmptyString[256];
const char *uiSoundIn = "common/menu1.wav";
const char *uiSoundMove = "common/menu2.wav";
const char *uiSoundOut = "common/menu3.wav";
const char *uiSoundBuzz = "common/menu4.wav";
const char *uiSoundGlow = "common/menu5.wav";
const char *uiSoundIn = "common/launch_upmenu1.wav";
const char *uiSoundOut = "common/launch_dnmenu1.wav";
const char *uiSoundLaunch = "common/launch_select2.wav";
const char *uiSoundGlow = "common/launch_glow1.wav";
const char *uiSoundBuzz = "common/menu1.wav";
const char *uiSoundMove = ""; // Xash3D not use movesound
const char *uiSoundNull = "";
int uiColorHelp = 0xFFFFFFFF; // 255, 255, 255, 255 // hint letters color
@ -100,6 +101,22 @@ void UI_DrawPic( int x, int y, int width, int height, const int color, const cha
PIC_Draw( 0, x, y, width, height );
}
/*
=================
UI_DrawPicAdditive
=================
*/
void UI_DrawPicAdditive( int x, int y, int width, int height, const int color, const char *pic )
{
HIMAGE hPic = PIC_Load( pic );
int r, g, b, a;
UnpackRGBA( r, g, b, a, color );
PIC_Set( hPic, r, g, b, a );
PIC_DrawAdditive( 0, x, y, width, height );
}
/*
=================
UI_FillRect
@ -228,8 +245,8 @@ void UI_DrawString( int x, int y, int w, int h, const char *string, const int co
if( ch != ' ' )
{
if( shadow ) TextMessageDrawChar( xx + ofsX, y + ofsY, charW, charH, ch, shadowModulate, uiStatic.hFont );
TextMessageDrawChar( xx, y, charW, charH, ch, modulate, uiStatic.hFont );
if( shadow ) TextMessageDrawChar( xx + ofsX, yy + ofsY, charW, charH, ch, shadowModulate, uiStatic.hFont );
TextMessageDrawChar( xx, yy, charW, charH, ch, modulate, uiStatic.hFont );
}
xx += charW;
}
@ -764,7 +781,7 @@ void UI_PushMenu( menuFramework_s *menu )
uiStatic.menuActive = menu;
uiStatic.firstDraw = true;
uiStatic.enterSound = true;
uiStatic.enterSound = gpGlobals->time + 0.2; // make some delay
uiStatic.visible = true;
KEY_SetDest ( KEY_MENU );
@ -850,10 +867,10 @@ void UI_UpdateMenu( float flTime )
// delay playing the enter sound until after the menu has been
// drawn, to avoid delay while caching images
if( uiStatic.enterSound )
if( uiStatic.enterSound > 0.0f && uiStatic.enterSound <= gpGlobals->time )
{
UI_StartSound( uiSoundIn );
uiStatic.enterSound = false;
uiStatic.enterSound = -1;
}
}

View File

@ -25,9 +25,7 @@ struct netadr_s
word port;
};
#define UI_WHITE_SHADER "*white"
#define ART_MAIN_SPLASH "gfx/shell/splash"
#define ART_BACKGROUND "gfx/shell/background"
#define ART_BACKGROUND "gfx/shell/splash"
#define UI_CURSOR_NORMAL "gfx/shell/cursor"
#define UI_CURSOR_DISABLED "gfx/shell/denied"
#define UI_CURSOR_TYPING "gfx/shell/typing"
@ -102,7 +100,7 @@ typedef enum
#define QMF_NUMBERSONLY BIT(6) // Edit field is only numbers
#define QMF_LOWERCASE BIT(7) // Edit field is all lower case
#define QMF_UPPERCASE BIT(8) // Edit field is all upper case
#define QMF_BLINKIFFOCUS BIT(9)
#define QMF_DRAW_ADDITIVE BIT(9) // enable additive for this bitmap
#define QMF_PULSEIFFOCUS BIT(10)
#define QMF_HIGHLIGHTIFFOCUS BIT(11)
#define QMF_SMALLFONT BIT(12)
@ -302,7 +300,7 @@ typedef struct
int cursorY;
int realTime;
int firstDraw;
int enterSound;
float enterSound;
int mouseInRect;
int hideCursor;
int visible;
@ -313,10 +311,11 @@ extern uiStatic_t uiStatic;
extern char uiEmptyString[256]; // HACKHACK
extern const char *uiSoundIn;
extern const char *uiSoundMove;
extern const char *uiSoundOut;
extern const char *uiSoundLaunch;
extern const char *uiSoundBuzz;
extern const char *uiSoundGlow;
extern const char *uiSoundMove;
extern const char *uiSoundNull;
extern int uiColorHelp;
@ -334,6 +333,7 @@ extern int uiColorBlack;
void UI_ScaleCoords( int *x, int *y, int *w, int *h );
int UI_CursorInRect( int x, int y, int w, int h );
void UI_DrawPic( int x, int y, int w, int h, const int color, const char *pic );
void UI_DrawPicAdditive( int x, int y, int w, int h, const int color, const char *pic );
void UI_FillRect( int x, int y, int w, int h, const int color );
#define UI_DrawRectangle( x, y, w, h, color ) UI_DrawRectangleExt( x, y, w, h, color, uiStatic.outlineWidth )
void UI_DrawRectangleExt( int in_x, int in_y, int in_w, int in_h, const int color, int outlineWidth );

View File

@ -96,26 +96,16 @@ inline void PIC_Draw( int frame, int x, int y, const wrect_t *prc )
g_engfuncs.pfnPIC_Draw( frame, x, y, -1, -1, prc );
}
inline void PIC_Draw( int frame, int x, int y, int width, int height, const wrect_t *prc )
{
g_engfuncs.pfnPIC_Draw( frame, x, y, width, height, prc );
}
inline void PIC_Draw( int frame, int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_Draw( frame, x, y, width, height, NULL );
}
inline void SPR_DrawTrans( int frame, int x, int y, const wrect_t *prc )
inline void PIC_DrawTrans( int frame, int x, int y, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, -1, -1, prc );
}
inline void PIC_DrawTrans( int frame, int x, int y, int width, int height, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, width, height, prc );
}
inline void PIC_DrawTrans( int frame, int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, width, height, NULL );
@ -131,16 +121,16 @@ inline void SPR_DrawHoles( int frame, int x, int y, int width, int height )
g_engfuncs.pfnPIC_DrawHoles( frame, x, y, width, height, NULL );
}
inline void PIC_DrawAdditive( int frame, int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, width, height, NULL );
}
inline void PIC_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, -1, -1, prc );
}
inline void PIC_DrawAdditive( int frame, int x, int y, int width, int height, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, width, height, prc );
}
inline void TextMessageSetColor( int r, int g, int b, int alpha = 255 )
{
g_engfuncs.pfnDrawSetTextColor( r, g, b, alpha );

View File

@ -193,7 +193,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.banner.generic.id = ID_BANNER;
uiAdvControls.banner.generic.type = QMTYPE_BITMAP;
uiAdvControls.banner.generic.flags = QMF_INACTIVE;
uiAdvControls.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiAdvControls.banner.generic.x = UI_BANNER_POSX;
uiAdvControls.banner.generic.y = UI_BANNER_POSY;
uiAdvControls.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -230,7 +230,7 @@ static void UI_Audio_Init( void )
uiAudio.banner.generic.id = ID_BANNER;
uiAudio.banner.generic.type = QMTYPE_BITMAP;
uiAudio.banner.generic.flags = QMF_INACTIVE;
uiAudio.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiAudio.banner.generic.x = UI_BANNER_POSX;
uiAudio.banner.generic.y = UI_BANNER_POSY;
uiAudio.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -164,7 +164,7 @@ static void UI_Options_Init( void )
uiOptions.banner.generic.id = ID_BANNER;
uiOptions.banner.generic.type = QMTYPE_BITMAP;
uiOptions.banner.generic.flags = QMF_INACTIVE;
uiOptions.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiOptions.banner.generic.x = UI_BANNER_POSX;
uiOptions.banner.generic.y = UI_BANNER_POSY;
uiOptions.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -177,7 +177,7 @@ static void UI_Controls_Init( void )
uiControls.banner.generic.id = ID_BANNER;
uiControls.banner.generic.type = QMTYPE_BITMAP;
uiControls.banner.generic.flags = QMF_INACTIVE;
uiControls.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiControls.banner.generic.x = UI_BANNER_POSX;
uiControls.banner.generic.y = UI_BANNER_POSY;
uiControls.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -250,7 +250,7 @@ static void UI_CreateGame_Init( void )
uiCreateGame.banner.generic.id = ID_BANNER;
uiCreateGame.banner.generic.type = QMTYPE_BITMAP;
uiCreateGame.banner.generic.flags = QMF_INACTIVE;
uiCreateGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiCreateGame.banner.generic.x = UI_BANNER_POSX;
uiCreateGame.banner.generic.y = UI_BANNER_POSY;
uiCreateGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "basemenu.h"
#include "utils.h"
#define ART_MAIN_CREDITS "gfx/shell/credits"
#define UI_CREDITS_PATH "scripts/credits.txt"
#define UI_CREDITS_MAXLINES 2048
@ -122,7 +121,7 @@ static void UI_Credits_DrawFunc( void )
// draw the background first
if( !uiCredits.finalCredits )
UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_MAIN_CREDITS );
UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_BACKGROUND );
// otherwise running on cutscene
// now draw the credits
@ -245,7 +244,7 @@ UI_Credits_Precache
*/
void UI_Credits_Precache( void )
{
PIC_Load( ART_MAIN_CREDITS );
PIC_Load( ART_BACKGROUND );
}
/*

View File

@ -243,7 +243,7 @@ static void UI_CustomGame_Init( void )
uiCustomGame.banner.generic.id = ID_BANNER;
uiCustomGame.banner.generic.type = QMTYPE_BITMAP;
uiCustomGame.banner.generic.flags = QMF_INACTIVE;
uiCustomGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiCustomGame.banner.generic.x = UI_BANNER_POSX;
uiCustomGame.banner.generic.y = UI_BANNER_POSY;
uiCustomGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -192,7 +192,7 @@ static void UI_GameOptions_Init( void )
uiGameOptions.banner.generic.id = ID_BANNER;
uiGameOptions.banner.generic.type = QMTYPE_BITMAP;
uiGameOptions.banner.generic.flags = QMF_INACTIVE;
uiGameOptions.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiGameOptions.banner.generic.x = UI_BANNER_POSX;
uiGameOptions.banner.generic.y = UI_BANNER_POSY;
uiGameOptions.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -204,7 +204,7 @@ static void UI_LanGame_Init( void )
uiLanGame.banner.generic.id = ID_BANNER;
uiLanGame.banner.generic.type = QMTYPE_BITMAP;
uiLanGame.banner.generic.flags = QMF_INACTIVE;
uiLanGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiLanGame.banner.generic.x = UI_BANNER_POSX;
uiLanGame.banner.generic.y = UI_BANNER_POSY;
uiLanGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -272,10 +272,10 @@ static void UI_LoadGame_Ownerdraw( void *self )
sprintf( saveshot, "save/%s.tga", uiLoadGame.saveName[uiLoadGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
@ -311,7 +311,7 @@ static void UI_LoadGame_Init( void )
uiLoadGame.banner.generic.id = ID_BANNER;
uiLoadGame.banner.generic.type = QMTYPE_BITMAP;
uiLoadGame.banner.generic.flags = QMF_INACTIVE;
uiLoadGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiLoadGame.banner.generic.x = UI_BANNER_POSX;
uiLoadGame.banner.generic.y = UI_BANNER_POSY;
uiLoadGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -304,7 +304,7 @@ static void UI_Main_Init( void )
uiMain.background.generic.y = 0;
uiMain.background.generic.width = 1024;
uiMain.background.generic.height = 768;
uiMain.background.pic = ART_MAIN_SPLASH;
uiMain.background.pic = ART_BACKGROUND;
uiMain.console.generic.id = ID_CONSOLE;
uiMain.console.generic.type = QMTYPE_ACTION;
@ -565,7 +565,7 @@ UI_Main_Precache
*/
void UI_Main_Precache( void )
{
PIC_Load( ART_MAIN_SPLASH );
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_MINIMIZE_N );
PIC_Load( ART_MINIMIZE_F );
PIC_Load( ART_MINIMIZE_D );

View File

@ -104,7 +104,7 @@ static void UI_MultiPlayer_Init( void )
uiMultiPlayer.banner.generic.id = ID_BANNER;
uiMultiPlayer.banner.generic.type = QMTYPE_BITMAP;
uiMultiPlayer.banner.generic.flags = QMF_INACTIVE;
uiMultiPlayer.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiMultiPlayer.banner.generic.x = UI_BANNER_POSX;
uiMultiPlayer.banner.generic.y = UI_BANNER_POSY;
uiMultiPlayer.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -171,7 +171,7 @@ static void UI_NewGame_Init( void )
uiNewGame.banner.generic.id = ID_BANNER;
uiNewGame.banner.generic.type = QMTYPE_BITMAP;
uiNewGame.banner.generic.flags = QMF_INACTIVE;
uiNewGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiNewGame.banner.generic.x = UI_BANNER_POSX;
uiNewGame.banner.generic.y = UI_BANNER_POSY;
uiNewGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -276,10 +276,10 @@ static void UI_PlayDemo_Ownerdraw( void *self )
sprintf( demoshot, "demos/%s.tga", uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] );
if( !FILE_EXISTS( demoshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, demoshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
@ -315,7 +315,7 @@ static void UI_PlayDemo_Init( void )
uiPlayDemo.banner.generic.id = ID_BANNER;
uiPlayDemo.banner.generic.type = QMTYPE_BITMAP;
uiPlayDemo.banner.generic.flags = QMF_INACTIVE;
uiPlayDemo.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiPlayDemo.banner.generic.x = UI_BANNER_POSX;
uiPlayDemo.banner.generic.y = UI_BANNER_POSY;
uiPlayDemo.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -275,7 +275,7 @@ static void UI_PlayerSetup_Init( void )
uiPlayerSetup.banner.generic.id = ID_BANNER;
uiPlayerSetup.banner.generic.type = QMTYPE_BITMAP;
uiPlayerSetup.banner.generic.flags = QMF_INACTIVE;
uiPlayerSetup.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiPlayerSetup.banner.generic.x = UI_BANNER_POSX;
uiPlayerSetup.banner.generic.y = UI_BANNER_POSY;
uiPlayerSetup.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -101,7 +101,7 @@ static void UI_PlayRec_Init( void )
uiPlayRec.banner.generic.id = ID_BANNER;
uiPlayRec.banner.generic.type = QMTYPE_BITMAP;
uiPlayRec.banner.generic.flags = QMF_INACTIVE;
uiPlayRec.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiPlayRec.banner.generic.x = UI_BANNER_POSX;
uiPlayRec.banner.generic.y = UI_BANNER_POSY;
uiPlayRec.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -303,10 +303,10 @@ static void UI_RecDemo_Ownerdraw( void *self )
sprintf( demoshot, "demos/%s.tga", uiRecDemo.demoName[uiRecDemo.demosList.curItem] );
if( !FILE_EXISTS( demoshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, demoshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
@ -342,7 +342,7 @@ static void UI_RecDemo_Init( void )
uiRecDemo.banner.generic.id = ID_BANNER;
uiRecDemo.banner.generic.type = QMTYPE_BITMAP;
uiRecDemo.banner.generic.flags = QMF_INACTIVE;
uiRecDemo.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiRecDemo.banner.generic.x = UI_BANNER_POSX;
uiRecDemo.banner.generic.y = UI_BANNER_POSY;
uiRecDemo.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -294,10 +294,10 @@ static void UI_SaveGame_Ownerdraw( void *self )
sprintf( saveshot, "save/%s.tga", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
@ -333,7 +333,7 @@ static void UI_SaveGame_Init( void )
uiSaveGame.banner.generic.id = ID_BANNER;
uiSaveGame.banner.generic.type = QMTYPE_BITMAP;
uiSaveGame.banner.generic.flags = QMF_INACTIVE;
uiSaveGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiSaveGame.banner.generic.x = UI_BANNER_POSX;
uiSaveGame.banner.generic.y = UI_BANNER_POSY;
uiSaveGame.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -102,7 +102,7 @@ static void UI_SaveLoad_Init( void )
uiSaveLoad.banner.generic.id = ID_BANNER;
uiSaveLoad.banner.generic.type = QMTYPE_BITMAP;
uiSaveLoad.banner.generic.flags = QMF_INACTIVE;
uiSaveLoad.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiSaveLoad.banner.generic.x = UI_BANNER_POSX;
uiSaveLoad.banner.generic.y = UI_BANNER_POSY;
uiSaveLoad.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -91,7 +91,7 @@ static void UI_Video_Init( void )
uiVideo.banner.generic.id = ID_BANNER;
uiVideo.banner.generic.type = QMTYPE_BITMAP;
uiVideo.banner.generic.flags = QMF_INACTIVE;
uiVideo.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiVideo.banner.generic.x = UI_BANNER_POSX;
uiVideo.banner.generic.y = UI_BANNER_POSY;
uiVideo.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -204,7 +204,7 @@ static void UI_VidModes_Init( void )
uiVidModes.banner.generic.id = ID_BANNER;
uiVidModes.banner.generic.type = QMTYPE_BITMAP;
uiVidModes.banner.generic.flags = QMF_INACTIVE;
uiVidModes.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiVidModes.banner.generic.x = UI_BANNER_POSX;
uiVidModes.banner.generic.y = UI_BANNER_POSY;
uiVidModes.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -153,7 +153,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.banner.generic.id = ID_BANNER;
uiVidOptions.banner.generic.type = QMTYPE_BITMAP;
uiVidOptions.banner.generic.flags = QMF_INACTIVE;
uiVidOptions.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiVidOptions.banner.generic.x = UI_BANNER_POSX;
uiVidOptions.banner.generic.y = UI_BANNER_POSY;
uiVidOptions.banner.generic.width = UI_BANNER_WIDTH;

View File

@ -611,14 +611,6 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
UI_DrawPic( upX, upY, arrowWidth, arrowHeight, (upFocus) ? color : sl->generic.color, (upFocus) ? sl->upArrowFocus : sl->upArrow );
UI_DrawPic( downX, downY, arrowWidth, arrowHeight, (downFocus) ? color : sl->generic.color, (downFocus) ? sl->downArrowFocus : sl->downArrow );
}
else if( sl->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
{
UI_DrawPic( upX, upY, arrowWidth, arrowHeight, (upFocus) ? sl->generic.focusColor : sl->generic.color, (upFocus) ? sl->upArrowFocus : sl->upArrow );
UI_DrawPic( downX, downY, arrowWidth, arrowHeight, (downFocus) ? sl->generic.focusColor : sl->generic.color, (downFocus) ? sl->downArrowFocus : sl->downArrow );
}
}
if( sl->generic.flags & QMF_FOCUSBEHIND )
{
@ -663,11 +655,6 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
UI_DrawString( x, y, w, h, sl->itemNames[i], color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
}
else if( sl->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.focusColor, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
}
if( sl->generic.flags & QMF_FOCUSBEHIND )
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
@ -912,15 +899,6 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, (leftFocus) ? color : sc->generic.color, (leftFocus) ? sc->leftArrowFocus : sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, (rightFocus) ? color : sc->generic.color, (rightFocus) ? sc->rightArrowFocus : sc->rightArrow );
}
else if( sc->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
{
UI_DrawString( x, y, w, h, sc->generic.name, sc->generic.focusColor, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, (leftFocus) ? sc->generic.focusColor : sc->generic.color, (leftFocus) ? sc->leftArrowFocus : sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, (rightFocus) ? sc->generic.focusColor : sc->generic.color, (rightFocus) ? sc->rightArrowFocus : sc->rightArrow );
}
}
if( sc->generic.flags & QMF_FOCUSBEHIND )
{
@ -1059,7 +1037,7 @@ void UI_Slider_Draw( menuSlider_s *sl )
{
int dist, numSteps;
// move slider with holded mouse button
// move slider follow the holded mouse button
dist = uiStatic.cursorX - sl->generic.x2 - (sl->generic.width2>>2);
numSteps = dist / (int)sl->drawStep;
sl->curValue = bound( sl->minValue, numSteps * sl->range, sl->maxValue );
@ -1610,16 +1588,6 @@ void UI_Field_Draw( menuField_s *f )
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
else if( f->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
}
if( f->generic.flags & QMF_FOCUSBEHIND )
{
@ -1697,13 +1665,13 @@ const char *UI_Action_Key( menuAction_s *a, int key, int down )
case K_MOUSE1:
if(!( a->generic.flags & QMF_HASMOUSEFOCUS ))
break;
sound = uiSoundMove;
sound = uiSoundLaunch;
break;
case K_ENTER:
case K_KP_ENTER:
if( a->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundMove;
sound = uiSoundLaunch;
break;
}
@ -1799,11 +1767,6 @@ void UI_Action_Draw( menuAction_s *a )
UI_DrawString( a->generic.x, a->generic.y, a->generic.width, a->generic.height, a->generic.name, color, false, a->generic.charWidth, a->generic.charHeight, justify, shadow );
}
else if( a->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
UI_DrawString( a->generic.x, a->generic.y, a->generic.width, a->generic.height, a->generic.name, a->generic.focusColor, false, a->generic.charWidth, a->generic.charHeight, justify, shadow );
}
if( a->generic.flags & QMF_FOCUSBEHIND )
UI_DrawString( a->generic.x, a->generic.y, a->generic.width, a->generic.height, a->generic.name, a->generic.color, false, a->generic.charWidth, a->generic.charHeight, justify, shadow );
@ -1838,13 +1801,13 @@ const char *UI_Bitmap_Key( menuBitmap_s *b, int key, int down )
case K_MOUSE1:
if(!( b->generic.flags & QMF_HASMOUSEFOCUS ))
break;
sound = uiSoundMove;
sound = uiSoundLaunch;
break;
case K_ENTER:
case K_KP_ENTER:
if( b->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundMove;
sound = uiSoundLaunch;
break;
}
if( sound && ( b->generic.flags & QMF_SILENT ))
@ -1891,13 +1854,15 @@ void UI_Bitmap_Draw( menuBitmap_s *b )
if((menuCommon_s *)b != (menuCommon_s *)UI_ItemAtCursor( b->generic.parent ))
{
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.color, b->pic );
// UNDONE: only inactive bitmaps supported
if( b->generic.flags & QMF_DRAW_ADDITIVE )
UI_DrawPicAdditive( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.color, b->pic );
else UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.color, b->pic );
return; // no focus
}
if(!( b->generic.flags & QMF_FOCUSBEHIND ))
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.color, b->pic );
if( b->generic.flags & QMF_HIGHLIGHTIFFOCUS )
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.focusColor, b->focusPic );
else if( b->generic.flags & QMF_PULSEIFFOCUS )
@ -1907,11 +1872,6 @@ void UI_Bitmap_Draw( menuBitmap_s *b )
color = PackAlpha( b->generic.color, 255 * (0.5 + 0.5 * sin( uiStatic.realTime / UI_PULSE_DIVISOR )));
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, color, b->focusPic );
}
else if( b->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.focusColor, b->focusPic );
}
if( b->generic.flags & QMF_FOCUSBEHIND )
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, b->generic.color, b->pic );

View File

@ -271,8 +271,8 @@ void Con_CreateConsole( void )
wc.hIcon = LoadIcon( Sys.hInstance, MAKEINTRESOURCE( IDI_ICON1 ));
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (void *)COLOR_3DSHADOW;
wc.lpszMenuName = 0;
wc.lpszClassName = SYSCONSOLE;
wc.lpszMenuName = 0;
if(!RegisterClass( &wc ))
{

View File

@ -1368,6 +1368,7 @@ void FS_ApplyBaseDir( void )
void FS_UpdateSysInfo( void )
{
com.strcpy( SI.username, Sys_GetCurrentUser());
SI.developer = Sys.developer;
SI.version = XASH_VERSION;
}

View File

@ -154,7 +154,6 @@ void Sys_Abort( void );
bool Sys_LoadLibrary( const char *dll_name, dll_info_t *dll );
void* Sys_GetProcAddress ( dll_info_t *dll, const char* name );
void Sys_ShellExecute( const char *path, const char *parms, bool exit );
byte *Sys_LoadRes( const char *filename, size_t *size );
bool Sys_FreeLibrary ( dll_info_t *dll );
void Sys_WaitForQuit( void );
void Sys_InitLog( void );

View File

@ -162,9 +162,9 @@ bool Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
}
sound.channels = GetLittleShort();
if( sound.channels != 1 )
if( sound.channels != 1 && sound.channels != 2 )
{
MsgDev( D_ERROR, "Sound_LoadWAV: only mono WAV files supported (%s)\n", name );
MsgDev( D_ERROR, "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name );
return false;
}
@ -231,9 +231,10 @@ bool Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
}
sound.type = WF_PCMDATA;
sound.samples /= sound.channels;
// Load the data
sound.size = sound.samples * sound.width;
sound.size = sound.samples * sound.width * sound.channels;
sound.wav = Mem_Alloc( Sys.soundpool, sound.size );
Mem_Copy( sound.wav, buffer + (iff_dataPtr - buffer), sound.size );

View File

@ -6,7 +6,6 @@
#include "launch.h"
#include "library.h"
#include "baserc_api.h"
#include "engine_api.h"
#include "mathlib.h"
@ -16,7 +15,6 @@
system_t Sys;
stdlib_api_t com;
baserc_exp_t *rc; // library of resources
timer_t Clock;
launch_exp_t *Host; // callback to mainframe
sys_event_t event_que[MAX_QUED_EVENTS];
@ -24,7 +22,6 @@ int event_head, event_tail;
dll_info_t xtools_dll = { "xtools.dll", NULL, "CreateAPI", NULL, NULL, 1, sizeof( launch_exp_t ), sizeof( stdlib_api_t ) };
dll_info_t engine_dll = { "engine.dll", NULL, "CreateAPI", NULL, NULL, 1, sizeof( launch_exp_t ), sizeof( stdlib_api_t ) };
dll_info_t baserc_dll = { "baserc.dll", NULL, "CreateAPI", NULL, NULL, 0, sizeof( baserc_exp_t ), sizeof( stdlib_api_t ) };
static const char *show_credits = "\n\n\n\n\tCopyright XashXT Group %s ©\n\t\
All Rights Reserved\n\n\t Visit www.xash.ru\n";
@ -145,7 +142,6 @@ void Sys_GetStdAPI( void )
com.Com_Search = FS_Search; // returned list of founded files
com.Com_HashKey = Com_HashKey; // returns hash key for a string (generic fucntion)
com.Com_LoadRes = Sys_LoadRes; // get internal resource by name
// console variables
com.Cvar_Get = Cvar_Get;
@ -432,7 +428,7 @@ Find needed library, setup and run it
void Sys_CreateInstance( void )
{
// export
launch_t CreateHost, CreateBaserc;
launch_t CreateHost;
srand( time( NULL )); // init random generator
Sys_LoadLibrary( NULL, Sys.linked_dll ); // loading library if need
@ -448,7 +444,6 @@ void Sys_CreateInstance( void )
case HOST_STUDIO:
case HOST_WADLIB:
case HOST_RIPPER:
Sys_LoadLibrary( NULL, &baserc_dll ); // load baserc
CreateHost = (void *)Sys.linked_dll->main;
Host = CreateHost( &com, NULL ); // second interface not allowed
Sys.Init = Host->Init;
@ -457,11 +452,6 @@ void Sys_CreateInstance( void )
Sys.CPrint = Host->CPrint;
Sys.CmdFwd = Host->CmdForward;
Sys.CmdAuto = Host->CmdComplete;
if( baserc_dll.link )
{
CreateBaserc = (void *)baserc_dll.main;
rc = CreateBaserc( &com, NULL );
}
break;
case HOST_CREDITS:
Sys_Break( show_credits, com_timestamp( TIME_YEAR_ONLY ));
@ -998,6 +988,7 @@ void Sys_Init( void )
// get current hInstance
Sys.hInstance = (HINSTANCE)GetModuleHandle( NULL );
Sys.developer = 0;
Sys_GetStdAPI();
Sys.Init = NullInit;
@ -1018,8 +1009,16 @@ void Sys_Init( void )
// parse and copy args into local array
if( FS_CheckParm( "-log" )) Sys.log_active = true;
if( FS_CheckParm( "-console" )) Sys.developer = 1;
if( FS_GetParmFromCmdLine( "-dev", dev_level, sizeof( dev_level )))
Sys.developer = com_atoi( dev_level );
if( FS_CheckParm( "-dev" ))
{
if( FS_GetParmFromCmdLine( "-dev", dev_level, sizeof( dev_level )))
{
if( com.is_digit( dev_level ))
Sys.developer = abs( com_atoi( dev_level ));
else Sys.developer++; // -dev == 1, -dev -console == 2
}
else Sys.developer++; // -dev == 1, -dev -console == 2
}
if( Sys.log_active && !Sys.developer ) Sys.log_active = false; // nothing to logging :)
FS_UpdateEnvironmentVariables(); // set working directory
@ -1063,7 +1062,6 @@ void Sys_Shutdown( void )
Sys.Free();
Sys_FreeLibrary( Sys.linked_dll );
Sys.CPrint = NullPrint;
Sys_FreeLibrary( &baserc_dll );
FS_Shutdown();
Image_Shutdown();
@ -1228,15 +1226,6 @@ void Sys_ShellExecute( const char *path, const char *parms, bool exit )
if( exit ) Sys_Exit();
}
byte *Sys_LoadRes( const char *filename, size_t *size )
{
if( baserc_dll.link )
return rc->LoadFile( filename, size );
if( size ) *size = 0;
return NULL;
}
//=======================================================================
// MULTITHREAD SYSTEM
//=======================================================================

View File

@ -266,6 +266,8 @@ typedef struct sysinfo_s
char savshot_ext[8]; // save shot write type.
char envshot_ext[8]; // sky or envshot write type
int developer; // developer level ( 1 - 7 )
gameinfo_t *GameInfo; // current GameInfo
gameinfo_t *games[MAX_MODS]; // environment games (founded at each engine start)
int numgames;
@ -585,7 +587,6 @@ typedef struct stdilib_api_s
search_t *(*Com_Search)( const char *pattern, int casecmp ); // returned list of found files
uint (*Com_HashKey)( const char *string, uint hashSize ); // returns hash key for a string
byte *(*Com_LoadRes)( const char *filename, size_t *size ); // find internal resource in baserc.dll
// console variables
cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags, const char *desc );
@ -836,7 +837,6 @@ filesystem manager
#define FS_FileTime( file ) com.Com_FileTime( file )
#define FS_Close( file ) com.fclose( file )
#define FS_FileBase( x, y ) com.Com_FileBase( x, y )
#define FS_LoadInternal( x, y ) com.Com_LoadRes( x, y )
#define FS_RemovePath( x ) com.Com_RemovePath( x )
#define FS_Printf (*com.fprintf)
#define FS_Print (*com.fprint)

View File

@ -8,9 +8,6 @@ set build_type=release
set BUILD_ERROR=
call vcvars32
%MSDEV% baserc/baserc.dsp %CONFIG%"baserc - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% bshift/bshift.dsp %CONFIG%"bshift - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
@ -60,7 +57,6 @@ goto done
:build_ok
rem //delete log files
if exist baserc\baserc.plg del /f /q baserc\baserc.plg
if exist bshift\bshift.plg del /f /q bshift\bshift.plg
if exist client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.plg

View File

@ -64,7 +64,7 @@ void S_ResampleSfx( sfx_t *sfx, int inrate, int inwidth, byte *data )
{
float stepscale;
int outcount, srcsample;
int i, sample, samplefrac, fracstep;
int i, sample, sample2, samplefrac, fracstep;
wavdata_t *sc;
if( !sfx ) return;
@ -80,14 +80,26 @@ void S_ResampleSfx( sfx_t *sfx, int inrate, int inwidth, byte *data )
sc->rate = dma.speed;
sc->width = inwidth;
sc->channels = 1; // default to Mono
sc->channels = sc->channels;
// resample / decimate to the current source rate
if( stepscale == 1 && inwidth == 1 && sc->width == 1 )
{
// fast special case
for( i = 0; i < outcount; i++ )
((signed char *)sc->buffer)[i] = (int)((unsigned char)(data[i]) - 128);
if( sc->channels == 2 )
{
// fast special case
for( i = 0; i < outcount; i++ )
{
((signed char *)sc->buffer)[i*2+0] = (int)((unsigned char)(data[i*2+0]) - 128);
((signed char *)sc->buffer)[i*2+1] = (int)((unsigned char)(data[i*2+1]) - 128);
}
}
else
{
// fast special case
for( i = 0; i < outcount; i++ )
((signed char *)sc->buffer)[i] = (int)((unsigned char)(data[i]) - 128);
}
}
else
{
@ -95,16 +107,49 @@ void S_ResampleSfx( sfx_t *sfx, int inrate, int inwidth, byte *data )
samplefrac = 0;
fracstep = stepscale * 256;
for( i = 0; i < outcount; i++ )
if( sc->channels == 2 )
{
srcsample = samplefrac >> 8;
samplefrac += fracstep;
for( i = 0; i < outcount; i++ )
{
srcsample = samplefrac >> 8;
samplefrac += fracstep;
if( inwidth == 2 ) sample = LittleShort(((short *)data)[srcsample] );
else sample = (int)( (unsigned char)(data[srcsample]) - 128) << 8;
if( inwidth == 2 )
{
sample = LittleShort(((short *)data)[srcsample*2+0] );
sample2 = LittleShort(((short *)data)[srcsample*2+1] );
}
else
{
sample = (int)( (unsigned char)(data[srcsample*2+0]) - 128) << 8;
sample2 = (int)( (unsigned char)(data[srcsample*2+1]) - 128) << 8;
}
if( sc->width == 2 ) ((short *)sc->buffer)[i] = sample;
else ((signed char *)sc->buffer)[i] = sample >> 8;
if( sc->width == 2 )
{
((short *)sc->buffer)[i*2+0] = sample;
((short *)sc->buffer)[i*2+1] = sample2;
}
else
{
((signed char *)sc->buffer)[i*2+0] = sample >> 8;
((signed char *)sc->buffer)[i*2+1] = sample2 >> 8;
}
}
}
else
{
for( i = 0; i < outcount; i++ )
{
srcsample = samplefrac >> 8;
samplefrac += fracstep;
if( inwidth == 2 ) sample = LittleShort(((short *)data)[srcsample] );
else sample = (int)( (unsigned char)(data[srcsample]) - 128) << 8;
if( sc->width == 2 ) ((short *)sc->buffer)[i] = sample;
else ((signed char *)sc->buffer)[i] = sample >> 8;
}
}
}
}

View File

@ -171,7 +171,7 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx )
continue;
}
if( channel != 0 && ch->entnum == entnum && ( ch->entchannel == channel || channel == -1 ))
if( channel != CHAN_AUTO && ch->entnum == entnum && ( ch->entchannel == channel || channel == -1 ))
{
// always override sound from same entity
first_to_die = ch_idx;

View File

@ -4,6 +4,7 @@
//=======================================================================
#include "sound.h"
#include "byteorder.h"
#define PAINTBUFFER_SIZE 512
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
@ -154,6 +155,33 @@ void S_PaintChannelFrom8( channel_t *ch, wavdata_t *sc, int count, int offset )
ch->pos += count;
}
void S_PaintStereoFrom8( channel_t *ch, wavdata_t *sc, int count, int offset )
{
int *lscale, *rscale;
uint left, right;
unsigned short *data;
portable_samplepair_t *samp;
int i;
if( ch->leftvol > 255 ) ch->leftvol = 255;
if( ch->rightvol > 255 ) ch->rightvol = 255;
lscale = snd_scaletable[ch->leftvol>>3];
rscale = snd_scaletable[ch->rightvol>>3];
data = (unsigned short *)sc->buffer + ch->pos;
samp = &paintbuffer[offset];
for( i = 0; i < count; i++, samp++, data++ )
{
left = (byte)((*data & 0x00FF));
right = (byte)((*data & 0xFF00) >> 8);
samp->left += lscale[left];
samp->right += rscale[right];
}
ch->pos += count;
}
void S_PaintChannelFrom16( channel_t *ch, wavdata_t *sc, int count, int offset )
{
int data;
@ -180,6 +208,34 @@ void S_PaintChannelFrom16( channel_t *ch, wavdata_t *sc, int count, int offset )
ch->pos += count;
}
void S_PaintStereoFrom16( channel_t *ch, wavdata_t *sc, int count, int offset )
{
uint *data;
int leftvol, rightvol;
int left, right;
portable_samplepair_t *samp;
int i;
data = (uint *)sc->buffer + ch->pos;
samp = &paintbuffer[offset];
leftvol = ch->leftvol * snd_vol;
rightvol = ch->rightvol * snd_vol;
for( i = 0; i < count; i++, samp++, data++ )
{
left = (signed short)((*data & 0x0000FFFF));
right = (signed short)((*data & 0xFFFF0000) >> 16);
left = (left * leftvol ) >> 8;
right = (right * rightvol) >> 8;
samp->left += left;
samp->right += right;
}
ch->pos += count;
}
void S_MixAllChannels( int endtime, int end )
{
channel_t *ch;
@ -213,10 +269,18 @@ void S_MixAllChannels( int endtime, int end )
if( count > 0 )
{
if( sc->width == 1 )
S_PaintChannelFrom8( ch, sc, count, ltime - paintedtime );
else S_PaintChannelFrom16( ch, sc, count, ltime - paintedtime );
if( sc->channels == 1 )
{
if( sc->width == 1 )
S_PaintChannelFrom8( ch, sc, count, ltime - paintedtime );
else S_PaintChannelFrom16( ch, sc, count, ltime - paintedtime );
}
else
{
if( sc->width == 1 )
S_PaintStereoFrom8( ch, sc, count, ltime - paintedtime );
else S_PaintStereoFrom16( ch, sc, count, ltime - paintedtime );
}
ltime += count;
}

View File

@ -112,16 +112,6 @@ typedef struct
bool paused;
} listener_t;
typedef struct
{
int rate;
int width;
int channels;
int loopstart;
int samples;
int dataofs; // chunk starts this many bytes from file start
} wavinfo_t;
typedef struct
{
string loopName;

View File

@ -9,7 +9,8 @@ glwstate_t glw_state;
#define MAX_PFDS 256
#define num_vidmodes ((int)(sizeof(vidmode) / sizeof(vidmode[0])) - 1)
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE)
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_CAPTION|WS_VISIBLE)
#define WINDOW_EX_STYLE (0)
#define GL_DRIVER_OPENGL "OpenGL32"
typedef enum
@ -452,25 +453,39 @@ bool R_CreateWindow( int width, int height, bool fullscreen )
WNDCLASS wc;
RECT rect;
cvar_t *r_xpos, *r_ypos;
int stylebits = WINDOW_STYLE;
int x = 0, y = 0, w, h;
int exstyle = 0;
int stylebits = WINDOW_STYLE;
int exstyle = WINDOW_EX_STYLE;
static string wndname;
com.snprintf( wndname, sizeof( wndname ), "%s", GI->title );
// register the frame class
wc.style = 0;
wc.style = CS_OWNDC|CS_NOCLOSE;
wc.lpfnWndProc = (WNDPROC)glw_state.wndproc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = glw_state.hInst;
wc.hIcon = LoadIcon( glw_state.hInst, MAKEINTRESOURCE( 101 ));
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (void *)COLOR_3DSHADOW;
wc.lpszClassName = "Xash Window";
wc.lpszMenuName = 0;
// find the icon file in the filesystem
if( FS_FileExists( "†game.ico" ))
{
char localPath[MAX_PATH];
com.snprintf( localPath, sizeof( localPath ), "%s/game.ico", GI->gamedir );
wc.hIcon = LoadImage( NULL, localPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );
if( !wc.hIcon )
{
MsgDev( D_INFO, "Extract game.ico from pak if you want to see it.\n" );
wc.hIcon = LoadIcon( glw_state.hInst, MAKEINTRESOURCE( 101 ));
}
}
else wc.hIcon = LoadIcon( glw_state.hInst, MAKEINTRESOURCE( 101 ));
if( !RegisterClass( &wc ))
{
MsgDev( D_ERROR, "R_CreateWindow: couldn't register window class %s\n" "Xash Window" );
@ -479,8 +494,8 @@ bool R_CreateWindow( int width, int height, bool fullscreen )
if( fullscreen )
{
exstyle = WS_EX_TOPMOST;
stylebits = WS_POPUP|WS_VISIBLE;
exstyle = WS_EX_TOPMOST;
}
rect.left = 0;

View File

@ -621,18 +621,14 @@ void GL_RemoveCommands( void )
void GL_InitBackend( void )
{
char dev_level[4];
GL_InitCommands();
glw_state.wndproc = ri.WndProc;
glw_state.hInst = GetModuleHandle( NULL );
r_temppool = Mem_AllocPool( "Render Memory" );
// check developer mode
if(FS_CheckParm( "-console" )) glw_state.developer = 1;
if(FS_GetParmFromCmdLine( "-dev", dev_level ))
glw_state.developer = com.atoi( dev_level );
// get developer mode
glw_state.developer = SI->developer;
GL_SetDefaultState();
}

View File

@ -3648,20 +3648,7 @@ static ref_shader_t *Shader_CreateDefault( ref_shader_t *shader, int type, int a
pass = &shader->stages[0];
pass->flags = SHADERSTAGE_BLEND_REPLACE|SHADERSTAGE_RENDERMODE;
pass->glState = GLSTATE_NONE;
if( shader->name[0] == '#' )
{
// search for internal resource
size_t bufsize = 0;
byte *buffer = FS_LoadInternal( shader->name + 1, &bufsize );
pass->textures[0] = R_FindTexture( shader->name, buffer, bufsize, addFlags|TF_NOPICMIP|TF_CLAMP|TF_NOMIPMAP );
}
else pass->textures[0] = Shader_FindImage( shader, shortname, addFlags|TF_NOPICMIP|TF_CLAMP|TF_NOMIPMAP );
if( !pass->textures[0] )
{
MsgDev( D_WARN, "couldn't find texture for shader '%s', using default...\n", shader->name );
pass->textures[0] = tr.defaultTexture;
}
pass->textures[0] = Shader_FindImage( shader, shortname, addFlags|TF_NOPICMIP|TF_CLAMP|TF_NOMIPMAP );
pass->rgbGen.type = RGBGEN_IDENTITY;
pass->alphaGen.type = ALPHAGEN_IDENTITY;
pass->tcgen = TCGEN_BASE;

View File

@ -159,6 +159,10 @@ void Conv_RunSearch( void )
search_t *search;
int i, j, k, imageflags;
// set directory to extract
com.strncpy( gs_gamedir, "~tmpExtract", sizeof( gs_gamedir ));
Conv_DetectGameType();
if( game_family ) Msg( "Game: %s family\n", game_names[game_family] );

View File

@ -6,7 +6,6 @@
#include "xtools.h"
#include "utils.h"
extern string gs_gamedir;
bool unknown_rotate = false;
bool unknown_flip = false;
@ -86,7 +85,7 @@ bool ConvertImages( byte *mempool, const char *name, byte parms )
com.strncpy( outputname, name, sizeof( outputname ));
FS_StripExtension( outputname );
result = FS_SaveImage( va( "%s/%s.%s", gs_gamedir, outputname, ext ), pic );
result = FS_SaveImage( va( "~tmpXImage/%s.%s", outputname, ext ), pic );
if( result ) Msg( "%s.%s\n", outputname, ext ); // echo to console
else Msg( "can't save %s\n", outputname, ext );
FS_FreeImage( pic );

View File

@ -9,6 +9,7 @@
#include "xtools.h"
#include "engine_api.h"
#include "mathlib.h"
#include "badimage.h"
stdlib_api_t com;
char **com_argv;
@ -98,7 +99,8 @@ void InitCommon( const int argc, const char **argv )
Image_Init( NULL, imageflags );
case HOST_RIPPER:
// blamk image for missed resources
error_bmp = FS_LoadInternal( "blank.bmp", &error_bmp_size );
error_bmp = (byte *)blank_bmp;
error_bmp_size = sizeof( blank_bmp );
FS_InitRootDir(".");
start = Sys_DoubleTime();
@ -113,13 +115,10 @@ void CommonMain( void )
{
search_t *search;
bool (*CompileMod)( byte *mempool, const char *name, byte parms ) = NULL;
cvar_t *fs_defaultdir = Cvar_Get( "fs_defaultdir", "tmpQuArK", CVAR_SYSTEMINFO, NULL );
byte parms = 0; // future expansion
int i, j, numCompiledMods = 0;
string errorstring;
// directory to extract
com.strncpy( gs_gamedir, fs_defaultdir->string, sizeof( gs_gamedir ));
Mem_Set( errorstring, 0, MAX_STRING );
ClrMask();