18 Jul 2010

This commit is contained in:
g-cont 2010-07-18 00:00:00 +04:00 committed by Alibek Omarov
parent 7bd4c26029
commit 569f1f9098
81 changed files with 13753 additions and 2269 deletions

View File

@ -19,6 +19,7 @@ client\hud\
client\global\
common\
game_shared\
gameui\
engine\
engine\client\
engine\server\

36
baserc/baserc.plg Normal file
View File

@ -0,0 +1,36 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: baserc - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D60.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\baserc\!release/" /Fd"..\temp\baserc\!release/" /FD /c
"D:\Xash3D\src_main\baserc\rc_main.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D60.tmp""
Creating command line "link.exe msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\baserc\!release/baserc.dll" /implib:"..\temp\baserc\!release/baserc.lib" /opt:nowin98 "\Xash3D\src_main\temp\baserc\!release\rc_main.obj" "
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D61.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\baserc\!release\baserc.dll "D:\Xash3D\bin\baserc.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D61.bat""
Compiling...
rc_main.c
Linking...
Creating library ..\temp\baserc\!release/baserc.lib and object ..\temp\baserc\!release/baserc.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\baserc\!release\baserc.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
baserc.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1,86 +1,3 @@
const unsigned char q1mip_dds[] = {
0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08,
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x31,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x55, 0x55, 0x55, 0x55, 0x01, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55,
0x55, 0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8,
0x20, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x55,
0x55, 0x55, 0x55, 0x01, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55,
0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x20,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x01, 0x00, 0x00, 0x00,
0x55, 0x55, 0x55, 0x55, 0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x1f, 0xf8, 0x20, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x01, 0x00, 0x00, 0x00, 0x55,
0x55, 0x55, 0x55
};
const unsigned char error_tga[] = {
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x20, 0x00, 0x18, 0x00, 0x9f, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80,
0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00,
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff,
0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00,
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff,
0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80,
0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff,
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
0x80, 0x00, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x9f, 0xff,
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80,
0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00,
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff,
0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00,
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff,
0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80,
0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff,
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff
};
const unsigned char net_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,

View File

@ -22,9 +22,7 @@ typedef struct loadres_s
loadres_t load_resources[] =
{
// add new resource description here
{"error.tga", error_tga, sizeof(error_tga)},
{"blank.bmp", blank_bmp, sizeof(blank_bmp)},
{"checkerboard.dds", q1mip_dds, sizeof(q1mip_dds)},
{"default.dds", deffont_dds, sizeof(deffont_dds)},
{"net.png", net_png, sizeof(net_png)},
{NULL, NULL, 0 }

339
bshift/bshift.plg Normal file
View File

@ -0,0 +1,339 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: bshift - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D66.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "..\bshift" /I "..\common" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fo"..\temp\bshift\!release/" /Fd"..\temp\bshift\!release/" /FD /c
"D:\Xash3D\src_main\bshift\aflock.cpp"
"D:\Xash3D\src_main\bshift\agrunt.cpp"
"D:\Xash3D\src_main\bshift\airtank.cpp"
"D:\Xash3D\src_main\bshift\animating.cpp"
"D:\Xash3D\src_main\bshift\animation.cpp"
"D:\Xash3D\src_main\bshift\apache.cpp"
"D:\Xash3D\src_main\bshift\barnacle.cpp"
"D:\Xash3D\src_main\bshift\barney.cpp"
"D:\Xash3D\src_main\bshift\bigmomma.cpp"
"D:\Xash3D\src_main\bshift\bloater.cpp"
"D:\Xash3D\src_main\bshift\bmodels.cpp"
"D:\Xash3D\src_main\bshift\bullsquid.cpp"
"D:\Xash3D\src_main\bshift\buttons.cpp"
"D:\Xash3D\src_main\bshift\cbase.cpp"
"D:\Xash3D\src_main\bshift\client.cpp"
"D:\Xash3D\src_main\bshift\combat.cpp"
"D:\Xash3D\src_main\bshift\controller.cpp"
"D:\Xash3D\src_main\bshift\crossbow.cpp"
"D:\Xash3D\src_main\bshift\crowbar.cpp"
"D:\Xash3D\src_main\bshift\defaultai.cpp"
"D:\Xash3D\src_main\bshift\doors.cpp"
"D:\Xash3D\src_main\bshift\effects.cpp"
"D:\Xash3D\src_main\bshift\egon.cpp"
"D:\Xash3D\src_main\bshift\explode.cpp"
"D:\Xash3D\src_main\bshift\flyingmonster.cpp"
"D:\Xash3D\src_main\bshift\func_break.cpp"
"D:\Xash3D\src_main\bshift\func_tank.cpp"
"D:\Xash3D\src_main\bshift\game.cpp"
"D:\Xash3D\src_main\bshift\gamerules.cpp"
"D:\Xash3D\src_main\bshift\gargantua.cpp"
"D:\Xash3D\src_main\bshift\gauss.cpp"
"D:\Xash3D\src_main\bshift\genericmonster.cpp"
"D:\Xash3D\src_main\bshift\ggrenade.cpp"
"D:\Xash3D\src_main\bshift\globals.cpp"
"D:\Xash3D\src_main\bshift\glock.cpp"
"D:\Xash3D\src_main\bshift\gman.cpp"
"D:\Xash3D\src_main\bshift\h_ai.cpp"
"D:\Xash3D\src_main\bshift\h_battery.cpp"
"D:\Xash3D\src_main\bshift\h_cine.cpp"
"D:\Xash3D\src_main\bshift\h_cycler.cpp"
"D:\Xash3D\src_main\bshift\h_export.cpp"
"D:\Xash3D\src_main\bshift\handgrenade.cpp"
"D:\Xash3D\src_main\bshift\hassassin.cpp"
"D:\Xash3D\src_main\bshift\headcrab.cpp"
"D:\Xash3D\src_main\bshift\healthkit.cpp"
"D:\Xash3D\src_main\bshift\hgrunt.cpp"
"D:\Xash3D\src_main\bshift\hornet.cpp"
"D:\Xash3D\src_main\bshift\hornetgun.cpp"
"D:\Xash3D\src_main\bshift\houndeye.cpp"
"D:\Xash3D\src_main\bshift\ichthyosaur.cpp"
"D:\Xash3D\src_main\bshift\islave.cpp"
"D:\Xash3D\src_main\bshift\items.cpp"
"D:\Xash3D\src_main\bshift\leech.cpp"
"D:\Xash3D\src_main\bshift\lights.cpp"
"D:\Xash3D\src_main\bshift\maprules.cpp"
"D:\Xash3D\src_main\bshift\monstermaker.cpp"
"D:\Xash3D\src_main\bshift\monsters.cpp"
"D:\Xash3D\src_main\bshift\monsterstate.cpp"
"D:\Xash3D\src_main\bshift\mortar.cpp"
"D:\Xash3D\src_main\bshift\mp5.cpp"
"D:\Xash3D\src_main\bshift\multiplay_gamerules.cpp"
"D:\Xash3D\src_main\bshift\nihilanth.cpp"
"D:\Xash3D\src_main\bshift\nodes.cpp"
"D:\Xash3D\src_main\bshift\osprey.cpp"
"D:\Xash3D\src_main\bshift\pathcorner.cpp"
"D:\Xash3D\src_main\bshift\plane.cpp"
"D:\Xash3D\src_main\bshift\plats.cpp"
"D:\Xash3D\src_main\bshift\player.cpp"
"D:\Xash3D\src_main\game_shared\pm_shared.cpp"
"D:\Xash3D\src_main\bshift\python.cpp"
"D:\Xash3D\src_main\bshift\rat.cpp"
"D:\Xash3D\src_main\bshift\roach.cpp"
"D:\Xash3D\src_main\bshift\rpg.cpp"
"D:\Xash3D\src_main\bshift\satchel.cpp"
"D:\Xash3D\src_main\bshift\schedule.cpp"
"D:\Xash3D\src_main\bshift\scientist.cpp"
"D:\Xash3D\src_main\bshift\scripted.cpp"
"D:\Xash3D\src_main\bshift\shotgun.cpp"
"D:\Xash3D\src_main\bshift\singleplay_gamerules.cpp"
"D:\Xash3D\src_main\bshift\skill.cpp"
"D:\Xash3D\src_main\bshift\sound.cpp"
"D:\Xash3D\src_main\bshift\soundent.cpp"
"D:\Xash3D\src_main\bshift\spectator.cpp"
"D:\Xash3D\src_main\bshift\squadmonster.cpp"
"D:\Xash3D\src_main\bshift\squeakgrenade.cpp"
"D:\Xash3D\src_main\bshift\subs.cpp"
"D:\Xash3D\src_main\bshift\talkmonster.cpp"
"D:\Xash3D\src_main\bshift\teamplay_gamerules.cpp"
"D:\Xash3D\src_main\bshift\tentacle.cpp"
"D:\Xash3D\src_main\bshift\triggers.cpp"
"D:\Xash3D\src_main\bshift\tripmine.cpp"
"D:\Xash3D\src_main\bshift\turret.cpp"
"D:\Xash3D\src_main\bshift\util.cpp"
"D:\Xash3D\src_main\bshift\weapons.cpp"
"D:\Xash3D\src_main\bshift\world.cpp"
"D:\Xash3D\src_main\bshift\xen.cpp"
"D:\Xash3D\src_main\bshift\zombie.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D66.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D67.tmp" with contents
[
msvcrt.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libcmt.lib" /def:".\bshift.def" /out:"..\temp\bshift\!release/server.dll" /implib:"..\temp\bshift\!release/server.lib"
"\Xash3D\src_main\temp\bshift\!release\aflock.obj"
"\Xash3D\src_main\temp\bshift\!release\agrunt.obj"
"\Xash3D\src_main\temp\bshift\!release\airtank.obj"
"\Xash3D\src_main\temp\bshift\!release\animating.obj"
"\Xash3D\src_main\temp\bshift\!release\animation.obj"
"\Xash3D\src_main\temp\bshift\!release\apache.obj"
"\Xash3D\src_main\temp\bshift\!release\barnacle.obj"
"\Xash3D\src_main\temp\bshift\!release\barney.obj"
"\Xash3D\src_main\temp\bshift\!release\bigmomma.obj"
"\Xash3D\src_main\temp\bshift\!release\bloater.obj"
"\Xash3D\src_main\temp\bshift\!release\bmodels.obj"
"\Xash3D\src_main\temp\bshift\!release\bullsquid.obj"
"\Xash3D\src_main\temp\bshift\!release\buttons.obj"
"\Xash3D\src_main\temp\bshift\!release\cbase.obj"
"\Xash3D\src_main\temp\bshift\!release\client.obj"
"\Xash3D\src_main\temp\bshift\!release\combat.obj"
"\Xash3D\src_main\temp\bshift\!release\controller.obj"
"\Xash3D\src_main\temp\bshift\!release\crossbow.obj"
"\Xash3D\src_main\temp\bshift\!release\crowbar.obj"
"\Xash3D\src_main\temp\bshift\!release\defaultai.obj"
"\Xash3D\src_main\temp\bshift\!release\doors.obj"
"\Xash3D\src_main\temp\bshift\!release\effects.obj"
"\Xash3D\src_main\temp\bshift\!release\egon.obj"
"\Xash3D\src_main\temp\bshift\!release\explode.obj"
"\Xash3D\src_main\temp\bshift\!release\flyingmonster.obj"
"\Xash3D\src_main\temp\bshift\!release\func_break.obj"
"\Xash3D\src_main\temp\bshift\!release\func_tank.obj"
"\Xash3D\src_main\temp\bshift\!release\game.obj"
"\Xash3D\src_main\temp\bshift\!release\gamerules.obj"
"\Xash3D\src_main\temp\bshift\!release\gargantua.obj"
"\Xash3D\src_main\temp\bshift\!release\gauss.obj"
"\Xash3D\src_main\temp\bshift\!release\genericmonster.obj"
"\Xash3D\src_main\temp\bshift\!release\ggrenade.obj"
"\Xash3D\src_main\temp\bshift\!release\globals.obj"
"\Xash3D\src_main\temp\bshift\!release\glock.obj"
"\Xash3D\src_main\temp\bshift\!release\gman.obj"
"\Xash3D\src_main\temp\bshift\!release\h_ai.obj"
"\Xash3D\src_main\temp\bshift\!release\h_battery.obj"
"\Xash3D\src_main\temp\bshift\!release\h_cine.obj"
"\Xash3D\src_main\temp\bshift\!release\h_cycler.obj"
"\Xash3D\src_main\temp\bshift\!release\h_export.obj"
"\Xash3D\src_main\temp\bshift\!release\handgrenade.obj"
"\Xash3D\src_main\temp\bshift\!release\hassassin.obj"
"\Xash3D\src_main\temp\bshift\!release\headcrab.obj"
"\Xash3D\src_main\temp\bshift\!release\healthkit.obj"
"\Xash3D\src_main\temp\bshift\!release\hgrunt.obj"
"\Xash3D\src_main\temp\bshift\!release\hornet.obj"
"\Xash3D\src_main\temp\bshift\!release\hornetgun.obj"
"\Xash3D\src_main\temp\bshift\!release\houndeye.obj"
"\Xash3D\src_main\temp\bshift\!release\ichthyosaur.obj"
"\Xash3D\src_main\temp\bshift\!release\islave.obj"
"\Xash3D\src_main\temp\bshift\!release\items.obj"
"\Xash3D\src_main\temp\bshift\!release\leech.obj"
"\Xash3D\src_main\temp\bshift\!release\lights.obj"
"\Xash3D\src_main\temp\bshift\!release\maprules.obj"
"\Xash3D\src_main\temp\bshift\!release\monstermaker.obj"
"\Xash3D\src_main\temp\bshift\!release\monsters.obj"
"\Xash3D\src_main\temp\bshift\!release\monsterstate.obj"
"\Xash3D\src_main\temp\bshift\!release\mortar.obj"
"\Xash3D\src_main\temp\bshift\!release\mp5.obj"
"\Xash3D\src_main\temp\bshift\!release\multiplay_gamerules.obj"
"\Xash3D\src_main\temp\bshift\!release\nihilanth.obj"
"\Xash3D\src_main\temp\bshift\!release\nodes.obj"
"\Xash3D\src_main\temp\bshift\!release\osprey.obj"
"\Xash3D\src_main\temp\bshift\!release\pathcorner.obj"
"\Xash3D\src_main\temp\bshift\!release\plane.obj"
"\Xash3D\src_main\temp\bshift\!release\plats.obj"
"\Xash3D\src_main\temp\bshift\!release\player.obj"
"\Xash3D\src_main\temp\bshift\!release\pm_shared.obj"
"\Xash3D\src_main\temp\bshift\!release\python.obj"
"\Xash3D\src_main\temp\bshift\!release\rat.obj"
"\Xash3D\src_main\temp\bshift\!release\roach.obj"
"\Xash3D\src_main\temp\bshift\!release\rpg.obj"
"\Xash3D\src_main\temp\bshift\!release\satchel.obj"
"\Xash3D\src_main\temp\bshift\!release\schedule.obj"
"\Xash3D\src_main\temp\bshift\!release\scientist.obj"
"\Xash3D\src_main\temp\bshift\!release\scripted.obj"
"\Xash3D\src_main\temp\bshift\!release\shotgun.obj"
"\Xash3D\src_main\temp\bshift\!release\singleplay_gamerules.obj"
"\Xash3D\src_main\temp\bshift\!release\skill.obj"
"\Xash3D\src_main\temp\bshift\!release\sound.obj"
"\Xash3D\src_main\temp\bshift\!release\soundent.obj"
"\Xash3D\src_main\temp\bshift\!release\spectator.obj"
"\Xash3D\src_main\temp\bshift\!release\squadmonster.obj"
"\Xash3D\src_main\temp\bshift\!release\squeakgrenade.obj"
"\Xash3D\src_main\temp\bshift\!release\subs.obj"
"\Xash3D\src_main\temp\bshift\!release\talkmonster.obj"
"\Xash3D\src_main\temp\bshift\!release\teamplay_gamerules.obj"
"\Xash3D\src_main\temp\bshift\!release\tempmonster.obj"
"\Xash3D\src_main\temp\bshift\!release\tentacle.obj"
"\Xash3D\src_main\temp\bshift\!release\triggers.obj"
"\Xash3D\src_main\temp\bshift\!release\tripmine.obj"
"\Xash3D\src_main\temp\bshift\!release\turret.obj"
"\Xash3D\src_main\temp\bshift\!release\util.obj"
"\Xash3D\src_main\temp\bshift\!release\weapons.obj"
"\Xash3D\src_main\temp\bshift\!release\world.obj"
"\Xash3D\src_main\temp\bshift\!release\xen.obj"
"\Xash3D\src_main\temp\bshift\!release\zombie.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D67.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D68.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\bshift\!release\server.dll "D:\Xash3D\valve\bin\server.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D68.bat""
Compiling...
aflock.cpp
agrunt.cpp
airtank.cpp
animating.cpp
animation.cpp
apache.cpp
barnacle.cpp
barney.cpp
bigmomma.cpp
bloater.cpp
bmodels.cpp
bullsquid.cpp
buttons.cpp
cbase.cpp
client.cpp
combat.cpp
controller.cpp
crossbow.cpp
crowbar.cpp
defaultai.cpp
Generating Code...
Compiling...
doors.cpp
effects.cpp
egon.cpp
explode.cpp
flyingmonster.cpp
func_break.cpp
func_tank.cpp
game.cpp
gamerules.cpp
gargantua.cpp
gauss.cpp
genericmonster.cpp
ggrenade.cpp
globals.cpp
glock.cpp
gman.cpp
h_ai.cpp
h_battery.cpp
h_cine.cpp
h_cycler.cpp
Generating Code...
Compiling...
h_export.cpp
handgrenade.cpp
hassassin.cpp
headcrab.cpp
healthkit.cpp
hgrunt.cpp
hornet.cpp
hornetgun.cpp
houndeye.cpp
ichthyosaur.cpp
islave.cpp
items.cpp
leech.cpp
lights.cpp
maprules.cpp
monstermaker.cpp
monsters.cpp
monsterstate.cpp
mortar.cpp
mp5.cpp
Generating Code...
Compiling...
multiplay_gamerules.cpp
nihilanth.cpp
nodes.cpp
osprey.cpp
pathcorner.cpp
plane.cpp
plats.cpp
player.cpp
pm_shared.cpp
python.cpp
rat.cpp
roach.cpp
rpg.cpp
satchel.cpp
schedule.cpp
scientist.cpp
scripted.cpp
shotgun.cpp
singleplay_gamerules.cpp
skill.cpp
Generating Code...
Compiling...
sound.cpp
soundent.cpp
spectator.cpp
squadmonster.cpp
squeakgrenade.cpp
subs.cpp
talkmonster.cpp
teamplay_gamerules.cpp
tentacle.cpp
triggers.cpp
tripmine.cpp
turret.cpp
util.cpp
weapons.cpp
world.cpp
xen.cpp
zombie.cpp
Generating Code...
Linking...
Creating library ..\temp\bshift\!release/server.lib and object ..\temp\bshift\!release/server.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\bshift\!release\server.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1,12 +1,16 @@
build ????
Engine: add 'allow_levelshots' cvar (disabled by default) to switch between custom levelshots and normal 'loading' screen
build 1254
SoundLib: ogg loop points (LOOP_START comment)
Client: recalc fov y for more matched with original HL
Bshift: fix env_laser entity
Client: fix fadeout for break model pieces
Gfx: replace default.bmp font with fixed alpha-channel (thx LokiMb)
Render: fix invisible beams behind glass
Render: fix glow-sprites drawing through walls
Render: fix glow-sprites drawing through walls (see also r_cullflares cvar)
FS: implement filter wadlumps by wadname (e.g. gfx.wad/backtile)
Render: implement kRenderTransColor
Engine: completely moving particle code into the client.dll

View File

@ -70,8 +70,8 @@ SOURCE="$(InputPath)"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "client___Win32_Debug"
# PROP BASE Intermediate_Dir "client___Win32_Debug"
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0

146
client/client.plg Normal file
View File

@ -0,0 +1,146 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: client - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6D.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "../common" /I "global" /I "hud" /I "../game_shared" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\client\!release/" /Fd"..\temp\client\!release/" /FD /c
"D:\Xash3D\src_main\client\global\aurora.cpp"
"D:\Xash3D\src_main\client\global\cl_tent.cpp"
"D:\Xash3D\src_main\client\global\dll_int.cpp"
"D:\Xash3D\src_main\client\global\ev_common.cpp"
"D:\Xash3D\src_main\client\global\ev_hldm.cpp"
"D:\Xash3D\src_main\client\hud\hud.cpp"
"D:\Xash3D\src_main\client\hud\hud_ammo.cpp"
"D:\Xash3D\src_main\client\hud\hud_ammohistory.cpp"
"D:\Xash3D\src_main\client\hud\hud_battery.cpp"
"D:\Xash3D\src_main\client\hud\hud_death.cpp"
"D:\Xash3D\src_main\client\hud\hud_flashlight.cpp"
"D:\Xash3D\src_main\client\hud\hud_geiger.cpp"
"D:\Xash3D\src_main\client\hud\hud_health.cpp"
"D:\Xash3D\src_main\client\hud\hud_icons.cpp"
"D:\Xash3D\src_main\client\hud\hud_menu.cpp"
"D:\Xash3D\src_main\client\hud\hud_message.cpp"
"D:\Xash3D\src_main\client\hud\hud_motd.cpp"
"D:\Xash3D\src_main\client\hud\hud_msg.cpp"
"D:\Xash3D\src_main\client\hud\hud_saytext.cpp"
"D:\Xash3D\src_main\client\hud\hud_scoreboard.cpp"
"D:\Xash3D\src_main\client\hud\hud_sound.cpp"
"D:\Xash3D\src_main\client\hud\hud_statusbar.cpp"
"D:\Xash3D\src_main\client\hud\hud_text.cpp"
"D:\Xash3D\src_main\client\hud\hud_train.cpp"
"D:\Xash3D\src_main\client\global\input.cpp"
"D:\Xash3D\src_main\game_shared\pm_shared.cpp"
"D:\Xash3D\src_main\client\global\r_beams.cpp"
"D:\Xash3D\src_main\client\global\r_particle.cpp"
"D:\Xash3D\src_main\client\global\r_tempents.cpp"
"D:\Xash3D\src_main\client\global\r_tracer.cpp"
"D:\Xash3D\src_main\client\global\r_weather.cpp"
"D:\Xash3D\src_main\client\global\studio.cpp"
"D:\Xash3D\src_main\client\global\triapi.cpp"
"D:\Xash3D\src_main\client\global\utils.cpp"
"D:\Xash3D\src_main\client\global\view.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6D.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6E.tmp" with contents
[
msvcrt.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\temp\client\!release/client.pdb" /machine:I386 /nodefaultlib:"libc" /def:".\client.def" /out:"..\temp\client\!release/client.dll" /implib:"..\temp\client\!release/client.lib" /libpath:"..\common\libs"
"\Xash3D\src_main\temp\client\!release\aurora.obj"
"\Xash3D\src_main\temp\client\!release\cl_tent.obj"
"\Xash3D\src_main\temp\client\!release\dll_int.obj"
"\Xash3D\src_main\temp\client\!release\ev_common.obj"
"\Xash3D\src_main\temp\client\!release\ev_hldm.obj"
"\Xash3D\src_main\temp\client\!release\hud.obj"
"\Xash3D\src_main\temp\client\!release\hud_ammo.obj"
"\Xash3D\src_main\temp\client\!release\hud_ammohistory.obj"
"\Xash3D\src_main\temp\client\!release\hud_battery.obj"
"\Xash3D\src_main\temp\client\!release\hud_death.obj"
"\Xash3D\src_main\temp\client\!release\hud_flashlight.obj"
"\Xash3D\src_main\temp\client\!release\hud_geiger.obj"
"\Xash3D\src_main\temp\client\!release\hud_health.obj"
"\Xash3D\src_main\temp\client\!release\hud_icons.obj"
"\Xash3D\src_main\temp\client\!release\hud_menu.obj"
"\Xash3D\src_main\temp\client\!release\hud_message.obj"
"\Xash3D\src_main\temp\client\!release\hud_motd.obj"
"\Xash3D\src_main\temp\client\!release\hud_msg.obj"
"\Xash3D\src_main\temp\client\!release\hud_saytext.obj"
"\Xash3D\src_main\temp\client\!release\hud_scoreboard.obj"
"\Xash3D\src_main\temp\client\!release\hud_sound.obj"
"\Xash3D\src_main\temp\client\!release\hud_statusbar.obj"
"\Xash3D\src_main\temp\client\!release\hud_text.obj"
"\Xash3D\src_main\temp\client\!release\hud_train.obj"
"\Xash3D\src_main\temp\client\!release\input.obj"
"\Xash3D\src_main\temp\client\!release\pm_shared.obj"
"\Xash3D\src_main\temp\client\!release\r_beams.obj"
"\Xash3D\src_main\temp\client\!release\r_particle.obj"
"\Xash3D\src_main\temp\client\!release\r_tempents.obj"
"\Xash3D\src_main\temp\client\!release\r_tracer.obj"
"\Xash3D\src_main\temp\client\!release\r_weather.obj"
"\Xash3D\src_main\temp\client\!release\studio.obj"
"\Xash3D\src_main\temp\client\!release\triapi.obj"
"\Xash3D\src_main\temp\client\!release\utils.obj"
"\Xash3D\src_main\temp\client\!release\view.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6E.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6F.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\client\!release\client.dll "D:\Xash3D\valve\bin\client.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D6F.bat""
Compiling...
aurora.cpp
cl_tent.cpp
dll_int.cpp
ev_common.cpp
ev_hldm.cpp
hud.cpp
hud_ammo.cpp
hud_ammohistory.cpp
hud_battery.cpp
hud_death.cpp
hud_flashlight.cpp
hud_geiger.cpp
hud_health.cpp
hud_icons.cpp
hud_menu.cpp
hud_message.cpp
hud_motd.cpp
hud_msg.cpp
hud_saytext.cpp
hud_scoreboard.cpp
Generating Code...
Compiling...
hud_sound.cpp
hud_statusbar.cpp
hud_text.cpp
hud_train.cpp
input.cpp
pm_shared.cpp
r_beams.cpp
r_particle.cpp
r_tempents.cpp
r_tracer.cpp
r_weather.cpp
studio.cpp
triapi.cpp
utils.cpp
view.cpp
Generating Code...
Linking...
Creating library ..\temp\client\!release/client.lib and object ..\temp\client\!release/client.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\client\!release\client.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
client.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -27,8 +27,6 @@ void DBG_AssertFunction( BOOL fExpr, const char* szExpr, const char* szFile, int
#define ASSERTSZ( f, sz )
#endif
#define MakeRGBA( r, g, b, a ) ((a)<<24)|((b)<<16)|((g)<<8)|(r)
extern DLL_GLOBAL const Vector g_vecZero;
extern cl_globalvars_t *gpGlobals;
extern movevars_t *gpMovevars;

View File

@ -253,8 +253,6 @@ int CHud :: Redraw( float flTime )
// clock was reset, reset delta
if( m_flTimeDelta < 0 ) m_flTimeDelta = 0;
m_iDrawPlaque = 1; // clear plaque stuff
// draw screen fade before hud
DrawScreenFade();

View File

@ -639,7 +639,6 @@ public:
int m_iWeaponBits;
int m_fPlayerDead;
int m_iIntermission;
int m_iDrawPlaque;
RainData Rain; // buz rain

View File

@ -78,7 +78,7 @@ int CHud :: InitMessages( void )
CVAR_REGISTER( "zoom_sensitivity_ratio", "1.2", 0, "mouse sensitivity when zooming" );
CVAR_REGISTER( "default_fov", "90", 0, "default client fov" );
CVAR_REGISTER( "hud_draw", "1", FCVAR_ARCHIVE, "hud drawing modes" );
CVAR_REGISTER( "hud_draw", "1", 0, "disable hud rendering" );
CVAR_REGISTER( "hud_takesshots", "0", 0, "take screenshots at 30 fps" );
CVAR_REGISTER( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
@ -102,9 +102,7 @@ int CHud :: InitMessages( void )
void CHud :: UserCmd_ChangeLevel( void )
{
m_iDrawPlaque = 0; // disable plaque rendering
// reset shake
// reset shake during changelevel
m_Shake.amplitude = 0;
m_Shake.frequency = 0;
m_Shake.duration = 0;
@ -144,9 +142,6 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
m_iIntermission = 0;
// enable plaque drawing
m_iDrawPlaque = 1;
// reset windspeed
m_vecWindVelocity = Vector( 0, 0, 0 );

View File

@ -24,12 +24,16 @@ typedef struct movevars_s movevars_t;
typedef struct usercmd_s usercmd_t;
typedef struct cl_priv_s cl_priv_t;
typedef struct sv_priv_s sv_priv_t;
typedef struct netadr_s netadr_t;
typedef unsigned short CRC16_t;
typedef unsigned long CRC32_t;
typedef float vec_t;
#define DLLEXPORT __declspec( dllexport )
#define FALSE 0
#define TRUE 1
#ifndef NULL
#define NULL ((void *)0)
#endif
@ -38,4 +42,8 @@ typedef float vec_t;
#define BIT( n ) (1<<( n ))
#endif
// color strings
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
#endif//BASETYPES_H

38
common/gameinfo.h Normal file
View File

@ -0,0 +1,38 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// gameinfo.h - current game info
//=======================================================================
#ifndef GAMEINFO_H
#define GAMEINFO_H
/*
========================================================================
GAMEINFO stuff
internal shared gameinfo structure (readonly for engine parts)
========================================================================
*/
typedef struct
{
// filesystem info
char gamefolder[64]; // used for change game '-game x'
char basedir[64]; // main game directory (like 'id1' for Quake or 'valve' for Half-Life)
char gamedir[64]; // game directory (used as primary dir and as write path)
char startmap[64]; // map to start singleplayer game
char trainmap[64]; // map to start hazard course (if specified)
char title[64]; // Game Main Title
char version[16]; // game version (optional)
// about mod info
char game_url[256]; // link to a developer's site
char update_url[256]; // link to updates page
char type[64]; // single, toolkit, multiplayer etc
char date[64];
char size[64]; // displayed mod size
int viewmode;
int gamemode;
} GAMEINFO;
#endif//GAMEINFO_H

185
common/gameui_api.h Normal file
View File

@ -0,0 +1,185 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// gameui_api.h - interface between engine and gameui
//=======================================================================
#ifndef GAMEUI_API_H
#define GAMEUI_API_H
#include "gameinfo.h"
struct netadr_s
{
int type; // NA_LOOPBACK = 0, NA_BROADCAST = 1, NA_IP = 2
byte ip[4];
word port;
};
typedef int HIMAGE; // handle to a graphic
#define SCRINFO_VIRTUALSPACE 1
typedef struct
{
int iFlags;
int iRealWidth;
int iRealHeight;
int iWidth;
int iHeight;
int iCharHeight;
byte charWidths[256];
} SCREENINFO;
typedef struct wrect_s
{
int left;
int right;
int top;
int bottom;
} wrect_t;
typedef struct ui_globalvars_s
{
float time; // unclamped host.realtime
float frametime;
int maxClients;
int developer;
int demoplayback;
int demorecording;
char demoname[64]; // name of currently playing demo
char maptitle[64]; // title of active map
} ui_globalvars_t;
typedef struct ui_enginefuncs_s
{
// image handlers
HIMAGE (*pfnPIC_Load)( const char *szPicName );
void (*pfnPIC_Free)( const char *szPicName );
int (*pfnPIC_Frames)( HIMAGE hPic );
int (*pfnPIC_Height)( HIMAGE hPic, int frame );
int (*pfnPIC_Width)( HIMAGE hPic, int frame );
void (*pfnPIC_Set)( HIMAGE hPic, int r, int g, int b, int a );
void (*pfnPIC_Draw)( int frame, int x, int y, int width, int height, const wrect_t *prc );
void (*pfnPIC_DrawHoles)( int frame, int x, int y, int width, int height, const wrect_t *prc );
void (*pfnPIC_DrawTrans)( int frame, int x, int y, int width, int height, const wrect_t *prc );
void (*pfnPIC_DrawAdditive)( int frame, int x, int y, int width, int height, const wrect_t *prc );
void (*pfnPIC_EnableScissor)( int x, int y, int width, int height );
void (*pfnPIC_DisableScissor)( void );
// screen handlers
void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a );
int (*pfnGetScreenInfo)( SCREENINFO *pscrinfo );
// cvar handlers
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *szDesc );
float (*pfnGetCvarFloat)( const char *szName );
char* (*pfnGetCvarString)( const char *szName );
void (*pfnCvarSetString)( const char *szName, const char *szValue );
void (*pfnCvarSetValue)( const char *szName, float flValue );
// command handlers
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void), const char *cmd_desc );
void (*pfnClientCmd)( int execute_now, const char *szCmdString );
void (*pfnDelCommand)( const char *cmd_name );
int (*pfnCmdArgc)( void );
const char* (*pfnCmdArgv)( int argc );
const char *(*pfnCmd_Args)( void );
// debug messages (im-menu shows only notify)
void (*pfnAlertMessage)( ALERT_TYPE, char *szFmt, ... );
// sound handlers
void (*pfnPlayLocalSound)( const char *szSound );
// text message system
int (*pfnDrawCharacter)( int x, int y, int number, int r, int g, int b );
int (*pfnDrawConsoleString)( int x, int y, char *string );
void (*pfnDrawSetTextColor)( float r, float g, float b );
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height );
// custom rendering (for playermodel preview)
edict_t* (*pfnGetPlayerModel)( void ); // for drawing playermodel previews
int (*pfnSetModel)( struct edict_s *ed, const char *path );
void (*pfnClearScene)( void );
void (*pfnRenderScene)( const struct ref_params_s *fd );
int (*R_AddEntity)( edict_t *pEnt, int ed_type, HIMAGE customShader );
// dlls managemenet
void* (*pfnLoadLibrary)( const char *name );
void* (*pfnGetProcAddress)( void *hInstance, const char *name );
void (*pfnFreeLibrary)( void *hInstance );
void (*pfnHostError)( const char *szFmt, ... );
int (*pfnFileExists)( const char *filename );
void (*pfnGetGameDir)( char *szGetGameDir );
// vgui handlers
void* (*VGui_GetPanel)( void ); // UNDONE: wait for version 0.75
void (*VGui_ViewportPaintBackground)( int extents[4] );
// gameinfo handlers
int (*pfnCreateMapsList)( int fRefresh );
int (*pfnClientInGame)( void );
void (*pfnClientJoin)( const netadr_t adr );
// parse txt files
byte* (*pfnLoadFile)( const char *filename, int *pLength );
char *(*pfnParseToken)( const char **data_p );
void (*pfnFreeFile)( void *buffer );
// keyfuncs
void (*pfnKeyClearStates)( void ); // call when menu open or close
void (*pfnSetKeyDest)( int dest );
const char *(*pfnKeynumToString)( int keynum );
const char *(*pfnKeyGetBinding)( int keynum );
void (*pfnKeySetBinding)( int keynum, const char *binding );
int (*pfnKeyIsDown)( int keynum );
int (*pfnKeyGetOverstrikeMode)( void );
void (*pfnKeySetOverstrikeMode)( int fActive );
// engine memory manager
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
// collect info from engine
int (*pfnGetGameInfo)( GAMEINFO *pgameinfo );
GAMEINFO **(*pfnGetGamesList)( int *numGames ); // collect info about all mods
char **(*pfnGetFilesList)( const char *pattern, int *numFiles ); // find in files
char **(*pfnGetVideoList)( int *numRenders );
char **(*pfnGetAudioList)( int *numRenders );
int (*pfnGetSaveComment)( const char *savename, char *comment );
int (*pfnGetDemoComment)( const char *demoname, char *comment );
char *(*pfnGetClipboardData)( void );
// engine launcher
void (*pfnShellExecute)( const char *name, const char *args, bool closeEngine );
void (*pfnWriteServerConfig)( void );
void (*pfnChangeInstance)( const char *newInstance, const char *szFinalMessage );
void (*pfnChangeVideo)( const char *dllName );
void (*pfnChangeAudio)( const char *dllName );
void (*pfnHostNewGame)( const char *mapName );
void (*pfnHostEndGame)( const char *szFinalMessage );
} ui_enginefuncs_t;
typedef struct
{
int (*pfnVidInit)( void );
void (*pfnInit)( void );
void (*pfnShutdown)( void );
void (*pfnRedraw)( float flTime );
void (*pfnKeyEvent)( int key, int down );
void (*pfnMouseMove)( int x, int y );
void (*pfnSetActiveMenu)( int active );
void (*pfnAddServerToList)( netadr_t adr, const char *info );
void (*pfnGetCursorPos)( int *pos_x, int *pos_y );
void (*pfnSetCursorPos)( int pos_x, int pos_y );
void (*pfnShowCursor)( int show );
void (*pfnCharEvent)( int key );
int (*pfnMouseInRect)( void ); // mouse entering\leave game window
int (*pfnIsVisible)( void );
int (*pfnCreditsActive)( void ); // unused
void (*pfnFinalCredits)( void ); // show credits + game end
} UI_FUNCTIONS;
typedef int (*GAMEUIAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals );
#endif//GAMEUI_API_H

75
common/keydefs.h Normal file
View File

@ -0,0 +1,75 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// keydefs.h - button keycodes
//=======================================================================
#ifndef KEYDEFS_H
#define KEYDEFS_H
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
#define K_KP_HOME 160
#define K_KP_UPARROW 161
#define K_KP_PGUP 162
#define K_KP_LEFTARROW 163
#define K_KP_5 164
#define K_KP_RIGHTARROW 165
#define K_KP_END 166
#define K_KP_DOWNARROW 167
#define K_KP_PGDN 168
#define K_KP_ENTER 169
#define K_KP_INS 170
#define K_KP_DEL 171
#define K_KP_SLASH 172
#define K_KP_MINUS 173
#define K_KP_PLUS 174
#define K_CAPSLOCK 175
#define K_KP_NUMLOCK 176
// mouse buttons generate virtual keys
#define K_MWHEELDOWN 239
#define K_MWHEELUP 240
#define K_MOUSE1 241
#define K_MOUSE2 242
#define K_MOUSE3 243
#define K_MOUSE4 244
#define K_MOUSE5 245
#define K_PAUSE 255
#endif//KEYDEFS_H

View File

@ -20,6 +20,9 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% engine/engine.dsp %CONFIG%"engine - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% gameui/gameui.dsp %CONFIG%"gameui - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1
@ -61,6 +64,7 @@ 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
if exist gameui\gameui.plg del /f /q gameui\gameui.plg
if exist launch\launch.plg del /f /q launch\launch.plg
if exist physic\physic.plg del /f /q physic\physic.plg
if exist spirit\spirit.plg del /f /q spirit\spirit.plg

View File

@ -265,7 +265,7 @@ void CL_ParseFrame( sizebuf_t *msg )
// client entered the game
cls.state = ca_active;
cl.force_refdef = true;
cls.drawplaque = true;
cls.changelevel = false; // changelevel is done
player = CL_GetLocalPlayer();
SCR_MakeLevelShot(); // make levelshot if needs

View File

@ -389,6 +389,7 @@ draw hudsprite routine
static void SPR_DrawGeneric( int frame, float x, float y, float width, float height, const wrect_t *prc )
{
float s1, s2, t1, t2;
bool hasCustomSize;
if( !re ) return;
@ -396,22 +397,35 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
{
int w, h;
// undoc feature: get drawsizes from image
// assume we get sizes from image
re->GetParms( &w, &h, NULL, frame, clgame.ds.hSprite );
width = w;
height = h;
hasCustomSize = false;
}
else hasCustomSize = true;
if( prc )
{
// calc user-defined rectangle
s1 = (float)prc->left / width;
t1 = (float)prc->top / height;
s2 = (float)prc->right / width;
t2 = (float)prc->bottom / height;
width = prc->right - prc->left;
height = prc->bottom - prc->top;
if( hasCustomSize )
{
// e.g. quake fonts
s1 = (float)prc->left;
t1 = (float)prc->top;
s2 = (float)prc->right;
t2 = (float)prc->bottom;
}
else
{
// calc user-defined rectangle
s1 = (float)prc->left / width;
t1 = (float)prc->top / height;
s2 = (float)prc->right / width;
t2 = (float)prc->bottom / height;
width = prc->right - prc->left;
height = prc->bottom - prc->top;
}
}
else
{
@ -1346,10 +1360,10 @@ static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
if( y < -clgame.scrInfo.iCharHeight )
return 0;
if( clgame.use_qfont )
if( clgame.creditsFont.use_qfont )
{
pfnSPR_Set( clgame.hHudFont, r, g, b, 255 );
pfnSPR_DrawAdditive( 0, x, y, -1, -1, &clgame.fontRc[number] );
pfnSPR_Set( clgame.creditsFont.hFontTexture, r, g, b, 255 );
pfnSPR_DrawAdditive( 0, x, y, -1, -1, &clgame.creditsFont.fontRc[number] );
}
else
{
@ -1363,7 +1377,7 @@ static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
aw = clgame.scrInfo.charWidths[number];
ah = clgame.scrInfo.iCharHeight;
re->GetParms( &fontWidth, &fontHeight, NULL, 0, clgame.hHudFont );
re->GetParms( &fontWidth, &fontHeight, NULL, 0, clgame.creditsFont.hFontTexture );
SPR_AdjustSize( &ax, &ay, &aw, &ah );
MakeRGBA( color, r, g, b, 255 );
@ -1373,8 +1387,8 @@ static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
fcol = (number & 15) * 0.0625f + (0.5f / (float)fontHeight);
size = 0.0625f - (1.0f / (float)fontWidth);
re->SetParms( clgame.hHudFont, kRenderTransAdd, 0 );
re->DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + size, frow + size, clgame.hHudFont );
re->SetParms( clgame.creditsFont.hFontTexture, kRenderTransAdd, 0 );
re->DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + size, frow + size, clgame.creditsFont.hFontTexture );
}
re->SetColor( NULL ); // don't forget reset color

View File

@ -571,8 +571,7 @@ void CL_Reconnect_f( void )
S_StopAllSounds ();
// disable plaque draw on change map
cls.drawplaque = false;
cls.changelevel = true;
Cmd_ExecuteString( "hud_changelevel\n" );
if( cls.demoplayback ) return;
@ -1105,7 +1104,6 @@ CL_InitLocal
void CL_InitLocal( void )
{
cls.state = ca_disconnected;
cls.drawplaque = true;
// register our variables
cl_predict = Cvar_Get( "cl_predict", "1", CVAR_ARCHIVE, "disables client movement prediction" );

View File

@ -526,17 +526,16 @@ void CL_ParseServerData( sizebuf_t *msg )
Cvar_Set( "cl_levelshot_name", va( "levelshots/%s", str ));
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
// FIXME: Quake3 may be use both 'jpg' and 'tga' levelshot types
if( !FS_FileExists( va( "†%s.%s", cl_levelshot_name->string, SI->levshot_ext )) && cls.drawplaque )
if( cl_allow_levelshots->integer && !cls.changelevel )
{
Cvar_Set( "cl_levelshot_name", MAP_DEFAULT_SHADER ); // render a black screen
cls.scrshot_request = scrshot_plaque; // make levelshot
// FIXME: Quake3 may be use both 'jpg' and 'tga' levelshot types
if( !FS_FileExists( va( "†%s.%s", cl_levelshot_name->string, SI->levshot_ext )))
{
Cvar_Set( "cl_levelshot_name", MAP_DEFAULT_SHADER ); // render a black screen
cls.scrshot_request = scrshot_plaque; // make levelshot
}
}
// seperate the printfs so the server message can have a color
Msg("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n");
Msg( "^2%s\n", clgame.maptitle );
// need to prep refresh at next oportunity
cl.video_prepped = false;
cl.audio_prepped = false;
@ -857,13 +856,13 @@ void CL_ParseServerMessage( sizebuf_t *msg )
Host_AbortCurrentFrame();
break;
case svc_changing:
cls.drawplaque = false;
cls.changelevel = true;
Cmd_ExecuteString( "hud_changelevel\n" );
S_StopAllSounds();
// intentional fallthrough
case svc_reconnect:
if( cls.drawplaque )
Msg( "Server disconnected, reconnecting\n" );
if( !cls.changelevel )
MsgDev( D_INFO, "Server disconnected, reconnecting\n" );
if( cls.download )
{
FS_Close( cls.download );
@ -914,7 +913,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
i = MSG_ReadByte( msg );
if( i == PRINT_CHAT ) // chat
S_StartLocalSound( "misc/talk.wav" ); // FIXME: INTRESOURCE
Con_Print( va( "^6%s\n", MSG_ReadString( msg )));
MsgDev( D_INFO, "^6%s\n", MSG_ReadString( msg ));
break;
case svc_centerprint:
CL_CenterPrint( MSG_ReadString( msg ), 160, SMALLCHAR_WIDTH );

View File

@ -16,7 +16,7 @@ cvar_t *scr_width;
cvar_t *scr_height;
cvar_t *cl_testentities;
cvar_t *cl_testlights;
cvar_t *cl_testflashlight;
cvar_t *cl_allow_levelshots;
cvar_t *cl_levelshot_name;
cvar_t *cl_envshot_size;
cvar_t *cl_font;
@ -361,7 +361,7 @@ void SCR_MakeScreenShot( void )
bool iRet = false;
if( !re && host.type == HOST_NORMAL )
return; // don't reset action - it will be wait for render initalization is done
return; // don't reset action - it will be wait until render initalization is done
switch( cls.scrshot_action )
{
@ -392,12 +392,15 @@ void SCR_MakeScreenShot( void )
void SCR_DrawPlaque( void )
{
shader_t levelshot;
shader_t levelshot;
if( !re || !cls.drawplaque ) return;
if( re && cl_allow_levelshots->integer && !cls.changelevel )
{
levelshot = re->RegisterShader( cl_levelshot_name->string, SHADER_NOMIP );
SCR_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
levelshot = re->RegisterShader( cl_levelshot_name->string, SHADER_NOMIP );
SCR_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
CL_DrawHUD( CL_LOADING ); // update progress bar
}
}
/*
@ -419,7 +422,6 @@ void SCR_UpdateScreen( void )
case ca_connecting:
case ca_connected:
SCR_DrawPlaque();
CL_DrawHUD( CL_LOADING );
break;
case ca_active:
V_RenderView();
@ -446,10 +448,10 @@ static void SCR_LoadCreditsFont( void )
if( !re ) return;
re->GetParms( &fontWidth, &fontHeight, NULL, 0, clgame.hHudFont );
re->GetParms( &fontWidth, &fontHeight, NULL, 0, clgame.creditsFont.hFontTexture );
// setup creditsfont
if( fontWidth != fontHeight )
if( FS_FileExists( "gfx/creditsfont.fnt" ))
{
byte *buffer;
size_t length;
@ -464,15 +466,15 @@ static void SCR_LoadCreditsFont( void )
src = (qfont_t *)buffer;
clgame.scrInfo.iCharHeight = LittleLong( src->rowheight );
clgame.use_qfont = true;
clgame.creditsFont.use_qfont = true;
// build rectangles
for( i = 0; i < 256; i++ )
{
clgame.fontRc[i].left = LittleShort( src->fontinfo[i].startoffset ) % fontWidth;
clgame.fontRc[i].right = clgame.fontRc[i].left + LittleShort( src->fontinfo[i].charwidth );
clgame.fontRc[i].top = LittleShort( src->fontinfo[i].startoffset ) / fontWidth;
clgame.fontRc[i].bottom = clgame.fontRc[i].top + LittleLong( src->rowheight );
clgame.creditsFont.fontRc[i].left = LittleShort( src->fontinfo[i].startoffset ) % fontWidth;
clgame.creditsFont.fontRc[i].right = clgame.creditsFont.fontRc[i].left + LittleShort( src->fontinfo[i].charwidth );
clgame.creditsFont.fontRc[i].top = LittleShort( src->fontinfo[i].startoffset ) / fontWidth;
clgame.creditsFont.fontRc[i].bottom = clgame.creditsFont.fontRc[i].top + LittleLong( src->rowheight );
clgame.scrInfo.charWidths[i] = LittleLong( src->fontinfo[i].charwidth );
}
}
@ -485,7 +487,7 @@ static void SCR_LoadCreditsFont( void )
// all quake fonts like quad 16x16 fields
clgame.scrInfo.iCharHeight = fontHeight / 16;
clgame.use_qfont = false;
clgame.creditsFont.use_qfont = false;
w = fontWidth / 16;
for( i = 0; i < 256; i++ )
@ -541,7 +543,7 @@ void SCR_RegisterShaders( void )
cls.pauseIcon = re->RegisterShader( "gfx/paused", SHADER_NOMIP ); // FIXME: INTRESOURCE
cls.fillShader = re->RegisterShader( "*white", SHADER_FONT ); // used for FillRGBA
cls.loadingBar = re->RegisterShader( "gfx/lambda", SHADER_NOMIP ); // FIXME: INTRESOURCE
clgame.hHudFont = re->RegisterShader( "gfx/creditsfont", SHADER_NOMIP );
clgame.creditsFont.hFontTexture = re->RegisterShader( "gfx/creditsfont", SHADER_NOMIP );
if( host.developer )
cls.consoleBack = re->RegisterShader( "cached/conback", SHADER_NOMIP );
@ -573,11 +575,11 @@ void SCR_Init( void )
scr_centertime = Cvar_Get( "scr_centertime", "2.5", 0, "centerprint hold time" );
scr_printspeed = Cvar_Get( "scr_printspeed", "8", 0, "centerprint speed of print" );
cl_levelshot_name = Cvar_Get( "cl_levelshot_name", MAP_DEFAULT_SHADER, 0, "contains path to current levelshot" );
cl_allow_levelshots = Cvar_Get( "allow_levelshots", "0", CVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
scr_loading = Cvar_Get("scr_loading", "0", 0, "loading bar progress" );
scr_download = Cvar_Get("scr_download", "0", 0, "downloading bar progress" );
cl_testentities = Cvar_Get ("cl_testentities", "0", 0, "test client entities" );
cl_testlights = Cvar_Get ("cl_testlights", "0", 0, "test dynamic lights" );
cl_testflashlight = Cvar_Get ("cl_testflashlight", "0", 0, "test generic flashlight" );
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", CVAR_ARCHIVE, "envshot size of cube side" );
cl_font = Cvar_Get( "cl_font", "default", CVAR_ARCHIVE, "in-game messages font" );

View File

@ -157,21 +157,23 @@ bool V_PreRender( void )
if( host.state == HOST_SLEEP )
return false;
if( cl.refdef.paused || !cls.drawplaque )
if( cl.refdef.paused || cls.changelevel )
clearScene = false;
re->BeginFrame( clearScene );
S_BeginFrame ();
if( oldState && !cls.drawplaque )
if( !oldState && cls.changelevel )
{
// fire once
CL_DrawHUD( CL_CHANGELEVEL );
re->EndFrame();
}
oldState = cls.drawplaque;
oldState = cls.changelevel;
return cls.drawplaque;
if( cls.changelevel )
return false;
return true;
}
/*

View File

@ -13,7 +13,6 @@
#define MAX_DEMOS 32
#define COMMAND_HISTORY 32
#define MAX_MESSAGES 1024
#define ColorIndex(c) (((c) - '0') & 7)
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - clgame.edicts))
#define EDICT_NUM( num ) CL_EDICT_NUM( num, __FILE__, __LINE__ )
@ -197,6 +196,13 @@ typedef struct
pfnEventHook func; // user-defined function
} user_event_t;
typedef struct
{
HSPRITE hFontTexture; // handle to texture shader
wrect_t fontRc[256]; // rectangles
bool use_qfont; // quake style font
} cl_font_t;
typedef struct
{
// temp handle
@ -251,10 +257,7 @@ typedef struct
draw_stuff_t ds; // draw2d stuff (hud, weaponmenu etc)
SCREENINFO scrInfo; // actual screen info
HSPRITE hHudFont; // handle to creditsfont
wrect_t fontRc[256]; // rectangles
bool use_qfont; // use half-life creditsfont with variable charWidth
cl_font_t creditsFont;
rgb_t palette[256]; // Quake1 palette used for particle colors
client_textmessage_t *titles; // title messages, not network messages
@ -270,6 +273,7 @@ typedef struct
typedef struct
{
connstate_t state;
bool changelevel; // during changelevel
bool initialized;
keydest_t key_dest;
@ -315,7 +319,6 @@ typedef struct
bool demorecording;
bool demoplayback;
bool demowaiting; // don't record until a non-delta message is received
int drawplaque; // draw plaque when level is loading
string demoname; // for demo looping
file_t *demofile;
@ -360,7 +363,7 @@ extern cvar_t *cl_crosshair;
extern cvar_t *cl_showmiss;
extern cvar_t *cl_testentities;
extern cvar_t *cl_testlights;
extern cvar_t *cl_testflashlight;
extern cvar_t *cl_allow_levelshots;
extern cvar_t *cl_levelshot_name;
extern cvar_t *cl_lightstyle_lerping;
extern cvar_t *scr_centertime;

View File

@ -35,6 +35,7 @@ extern cvar_t *scr_width;
extern cvar_t *scr_height;
extern cvar_t *allow_download;
extern cvar_t *sys_sharedstrings;
extern cvar_t *host_maxfps;
extern string video_dlls[MAX_RENDERS];
extern string audio_dlls[MAX_RENDERS];

View File

@ -51,7 +51,6 @@ keyname_t keynames[] =
{"ALT", K_ALT, "+strafe" },
{"CTRL", K_CTRL, "+attack" },
{"SHIFT", K_SHIFT, "+speed" }, // replace with +attack2 ?
{"COMMAND", K_COMMAND, "" },
{"CAPSLOCK", K_CAPSLOCK, "" },
{"F1", K_F1, "cmd help" },
{"F2", K_F2, "menu_savegame" },
@ -97,9 +96,6 @@ keyname_t keynames[] =
{"KP_SLASH", K_KP_SLASH, "" },
{"KP_MINUS", K_KP_MINUS, "" },
{"KP_PLUS", K_KP_PLUS, "" },
{"KP_NUMLOCK", K_KP_NUMLOCK, "" },
{"KP_STAR", K_KP_STAR, "" },
{"KP_EQUALS", K_KP_EQUALS, "" },
{"PAUSE", K_PAUSE, "pause" },
// raw semicolon seperates commands

View File

@ -56,7 +56,7 @@ typedef struct
float finalFrac; // 0.0 to 1.0 lines of console to display
int vislines; // in scanlines
double times[CON_TIMES]; // host.realtime the line was generated for transparent notify lines
double times[CON_TIMES]; // host.realtime the line was generated for transparent notify lines
rgba_t color;
} console_t;
@ -198,7 +198,7 @@ void Con_Init( void )
// register our commands
con_notifytime = Cvar_Get( "con_notifytime", "3", 0, "notify time to live" );
con_speed = Cvar_Get( "con_speed", "3", 0, "console moving speed" );
con_speed = Cvar_Get( "scr_conspeed", "600", 0, "console moving speed" );
con_font = Cvar_Get( "con_font", "default", CVAR_ARCHIVE, "path to console charset" );
Field_Clear( &g_consoleField );
@ -362,6 +362,8 @@ void Con_DrawNotify( void )
short *text;
float time;
if( !host.developer ) return;
currentColor = 7;
re->SetColor( g_color_table[currentColor] );
@ -404,8 +406,7 @@ void Con_DrawSolidConsole( float frac )
int row;
int lines;
int currentColor;
rgba_t color;
string curtime;
string curbuild;
lines = scr_height->integer * frac;
if( lines <= 0 ) return;
@ -419,28 +420,28 @@ void Con_DrawSolidConsole( float frac )
if( y < 1 ) y = 0;
else SCR_DrawPic( 0, y - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, cls.consoleBack );
MakeRGBA( color, 255, 0, 0, 255 );
SCR_FillRect( 0, y - 2, SCREEN_WIDTH, 2, color );
// draw current time
re->SetColor( g_color_table[ColorIndex(COLOR_YELLOW)] );
com.snprintf( curtime, MAX_STRING, "Xash3D %g (build %i)", SI->version, com_buildnum( ));
i = com.strlen( curtime );
for( x = 0; x < i; x++ )
SCR_DrawSmallChar( scr_width->integer - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), curtime[x] );
re->SetColor(NULL);
if( host.developer )
{
// draw current version
re->SetColor( g_color_table[ColorIndex(COLOR_YELLOW)] );
com.snprintf( curbuild, MAX_STRING, "Xash3D %g (build %i)", SI->version, com_buildnum( ));
i = com.strlen( curbuild );
for( x = 0; x < i; x++ )
SCR_DrawSmallChar( scr_width->integer - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), curbuild[x] );
re->SetColor( NULL );
}
// draw the text
con.vislines = lines;
rows = (lines - SMALLCHAR_WIDTH)/SMALLCHAR_WIDTH; // rows of text to draw
y = lines - (SMALLCHAR_HEIGHT * 3);
rows = ( lines - SMALLCHAR_WIDTH ) / SMALLCHAR_WIDTH; // rows of text to draw
y = lines - ( SMALLCHAR_HEIGHT * 3 );
// draw from the bottom up
if (con.display != con.current)
if( con.display != con.current )
{
// draw arrows to show the buffer is backscrolled
re->SetColor( g_color_table[ColorIndex(COLOR_RED)] );
for (x = 0; x < con.linewidth; x += 4)
for( x = 0; x < con.linewidth; x += 4 )
SCR_DrawSmallChar( con.xadjust + (x+1) * SMALLCHAR_WIDTH, y, '^' );
y -= SMALLCHAR_HEIGHT;
rows--;
@ -452,7 +453,7 @@ void Con_DrawSolidConsole( float frac )
currentColor = 7;
re->SetColor( g_color_table[currentColor] );
for (i = 0; i < rows; i++, y -= SMALLCHAR_HEIGHT, row--)
for( i = 0; i < rows; i++, y -= SMALLCHAR_HEIGHT, row-- )
{
if( row < 0 ) break;
if( con.current - row >= con.totallines )
@ -465,8 +466,8 @@ void Con_DrawSolidConsole( float frac )
for( x = 0; x < con.linewidth; x++ )
{
if((text[x] & 0xff ) == ' ' ) continue;
if(((text[x]>>8) & 7 ) != currentColor )
if(( text[x] & 0xff ) == ' ' ) continue;
if((( text[x]>>8) & 7 ) != currentColor )
{
currentColor = (text[x]>>8) & 7;
re->SetColor(g_color_table[currentColor]);
@ -487,15 +488,33 @@ Con_DrawConsole
*/
void Con_DrawConsole( void )
{
if( !host.developer ) return;
// never draw console whel changelevel in-progress
if( cls.changelevel ) return;
// check for console width changes from a vid mode change
Con_CheckResize ();
if( cls.state == ca_connecting || cls.state == ca_connected )
{
if( host.developer >= 4 ) con.displayFrac = 0.5f; // keep console open
else if( host.developer >= 2 ) Con_DrawNotify(); // draw notify lines
if( !cl_allow_levelshots->integer )
{
con.displayFrac = con.finalFrac = 1.0f;
}
else
{
if( host.developer >= 4 )
{
con.displayFrac = 0.5f; // keep console open
}
else
{
con.finalFrac = 0.0f;
Con_RunConsole();
if( host.developer >= 2 )
Con_DrawNotify(); // draw notify lines
}
}
}
// if disconnected, render console full screen
@ -504,7 +523,7 @@ void Con_DrawConsole( void )
case ca_uninitialized:
break;
case ca_disconnected:
if( cls.key_dest != key_menu )
if( cls.key_dest != key_menu && host.developer )
{
Con_DrawSolidConsole( 1.0f );
cls.key_dest = key_console;
@ -512,11 +531,8 @@ void Con_DrawConsole( void )
break;
case ca_connected:
case ca_connecting:
if( host.developer )
{
// force to show console always for -dev 3 and higher
if( con.displayFrac ) Con_DrawSolidConsole( con.displayFrac );
}
// force to show console always for -dev 3 and higher
if( con.displayFrac ) Con_DrawSolidConsole( con.displayFrac );
break;
case ca_active:
case ca_cinematic:
@ -536,10 +552,8 @@ Scroll it up or down
*/
void Con_RunConsole( void )
{
if( !host.developer ) return;
// decide on the destination height of the console
if( cls.key_dest == key_console )
if( host.developer && cls.key_dest == key_console )
{
if( cls.state == ca_disconnected )
con.finalFrac = 1.0f;// full screen
@ -547,15 +561,19 @@ void Con_RunConsole( void )
}
else con.finalFrac = 0; // none visible
// whel level is loading frametime may be is wrong
if( cls.state == ca_connecting || cls.state == ca_connected )
host.realframetime = ( MAX_FPS / host_maxfps->value ) * MIN_FRAMETIME;
if( con.finalFrac < con.displayFrac )
{
con.displayFrac -= con_speed->value * host.realframetime;
con.displayFrac -= con_speed->value * 0.002 * host.realframetime;
if( con.finalFrac > con.displayFrac )
con.displayFrac = con.finalFrac;
}
else if( con.finalFrac > con.displayFrac )
{
con.displayFrac += con_speed->value * host.realframetime;
con.displayFrac += con_speed->value * 0.002 * host.realframetime;
if( con.finalFrac < con.displayFrac )
con.displayFrac = con.finalFrac;
}

View File

@ -14,76 +14,7 @@ INPUT
==============================================================
*/
typedef enum e_keycodes
{
// keyboard
K_TAB = 9,
K_ENTER = 13,
K_ESCAPE = 27,
K_SPACE = 32,
K_BACKSPACE = 127,
K_COMMAND = 128,
K_CAPSLOCK,
K_POWER,
K_PAUSE,
K_UPARROW,
K_DOWNARROW,
K_LEFTARROW,
K_RIGHTARROW,
K_ALT,
K_CTRL,
K_SHIFT,
K_INS,
K_DEL,
K_PGDN,
K_PGUP,
K_HOME,
K_END,
K_F1,
K_F2,
K_F3,
K_F4,
K_F5,
K_F6,
K_F7,
K_F8,
K_F9,
K_F10,
K_F11,
K_F12,
K_F13,
K_F14,
K_F15,
K_KP_HOME,
K_KP_UPARROW,
K_KP_PGUP,
K_KP_LEFTARROW,
K_KP_5,
K_KP_RIGHTARROW,
K_KP_END,
K_KP_DOWNARROW,
K_KP_PGDN,
K_KP_ENTER,
K_KP_INS,
K_KP_DEL,
K_KP_SLASH,
K_KP_MINUS,
K_KP_PLUS,
K_KP_NUMLOCK,
K_KP_STAR,
K_KP_EQUALS,
// mouse
K_MOUSE1,
K_MOUSE2,
K_MOUSE3,
K_MOUSE4,
K_MOUSE5,
K_MWHEELDOWN,
K_MWHEELUP,
K_LAST_KEY // this had better be < 256!
} keyNum_t;
#include "keydefs.h"
//
// input.c

234
engine/engine.plg Normal file
View File

@ -0,0 +1,234 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: engine - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D75.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\engine\!release/" /Fd"..\temp\engine\!release/" /FD /c
"D:\Xash3D\src_main\engine\build.c"
"D:\Xash3D\src_main\engine\common\cinematic.c"
"D:\Xash3D\src_main\engine\client\cl_cmds.c"
"D:\Xash3D\src_main\engine\client\cl_demo.c"
"D:\Xash3D\src_main\engine\client\cl_effects.c"
"D:\Xash3D\src_main\engine\client\cl_frame.c"
"D:\Xash3D\src_main\engine\client\cl_game.c"
"D:\Xash3D\src_main\engine\client\cl_main.c"
"D:\Xash3D\src_main\engine\client\cl_move.c"
"D:\Xash3D\src_main\engine\client\cl_parse.c"
"D:\Xash3D\src_main\engine\client\cl_phys.c"
"D:\Xash3D\src_main\engine\client\cl_scrn.c"
"D:\Xash3D\src_main\engine\client\cl_tent.c"
"D:\Xash3D\src_main\engine\client\cl_video.c"
"D:\Xash3D\src_main\engine\client\cl_view.c"
"D:\Xash3D\src_main\engine\client\cl_world.c"
"D:\Xash3D\src_main\engine\common\com_keys.c"
"D:\Xash3D\src_main\engine\common\com_world.c"
"D:\Xash3D\src_main\engine\common\con_main.c"
"D:\Xash3D\src_main\engine\common\con_utils.c"
"D:\Xash3D\src_main\engine\common\engfuncs.c"
"D:\Xash3D\src_main\engine\host.c"
"D:\Xash3D\src_main\engine\common\infostring.c"
"D:\Xash3D\src_main\engine\common\input.c"
"D:\Xash3D\src_main\engine\common\net_chan.c"
"D:\Xash3D\src_main\engine\common\net_encode.c"
"D:\Xash3D\src_main\engine\common\net_huff.c"
"D:\Xash3D\src_main\engine\common\net_msg.c"
"D:\Xash3D\src_main\engine\server\sv_client.c"
"D:\Xash3D\src_main\engine\server\sv_cmds.c"
"D:\Xash3D\src_main\engine\server\sv_frame.c"
"D:\Xash3D\src_main\engine\server\sv_game.c"
"D:\Xash3D\src_main\engine\server\sv_init.c"
"D:\Xash3D\src_main\engine\server\sv_main.c"
"D:\Xash3D\src_main\engine\server\sv_move.c"
"D:\Xash3D\src_main\engine\server\sv_phys.c"
"D:\Xash3D\src_main\engine\server\sv_save.c"
"D:\Xash3D\src_main\engine\server\sv_world.c"
"D:\Xash3D\src_main\engine\common\titles.c"
"D:\Xash3D\src_main\engine\uimenu\ui_advcontrols.c"
"D:\Xash3D\src_main\engine\uimenu\ui_audio.c"
"D:\Xash3D\src_main\engine\uimenu\ui_configuration.c"
"D:\Xash3D\src_main\engine\uimenu\ui_controls.c"
"D:\Xash3D\src_main\engine\uimenu\ui_creategame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_credits.c"
"D:\Xash3D\src_main\engine\uimenu\ui_customgame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_gameoptions.c"
"D:\Xash3D\src_main\engine\uimenu\ui_langame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_loadgame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_main.c"
"D:\Xash3D\src_main\engine\uimenu\ui_menu.c"
"D:\Xash3D\src_main\engine\uimenu\ui_multiplayer.c"
"D:\Xash3D\src_main\engine\uimenu\ui_newgame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_playdemo.c"
"D:\Xash3D\src_main\engine\uimenu\ui_playersetup.c"
"D:\Xash3D\src_main\engine\uimenu\ui_playrec.c"
"D:\Xash3D\src_main\engine\uimenu\ui_qmenu.c"
"D:\Xash3D\src_main\engine\uimenu\ui_recdemo.c"
"D:\Xash3D\src_main\engine\uimenu\ui_savegame.c"
"D:\Xash3D\src_main\engine\uimenu\ui_saveload.c"
"D:\Xash3D\src_main\engine\uimenu\ui_video.c"
"D:\Xash3D\src_main\engine\uimenu\ui_vidmodes.c"
"D:\Xash3D\src_main\engine\uimenu\ui_vidoptions.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D75.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D76.tmp" with contents
[
user32.lib msvcrt.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\engine\!release/engine.dll" /implib:"..\temp\engine\!release/engine.lib" /opt:nowin98
"\Xash3D\src_main\temp\engine\!release\build.obj"
"\Xash3D\src_main\temp\engine\!release\cinematic.obj"
"\Xash3D\src_main\temp\engine\!release\cl_cmds.obj"
"\Xash3D\src_main\temp\engine\!release\cl_demo.obj"
"\Xash3D\src_main\temp\engine\!release\cl_effects.obj"
"\Xash3D\src_main\temp\engine\!release\cl_frame.obj"
"\Xash3D\src_main\temp\engine\!release\cl_game.obj"
"\Xash3D\src_main\temp\engine\!release\cl_main.obj"
"\Xash3D\src_main\temp\engine\!release\cl_move.obj"
"\Xash3D\src_main\temp\engine\!release\cl_parse.obj"
"\Xash3D\src_main\temp\engine\!release\cl_phys.obj"
"\Xash3D\src_main\temp\engine\!release\cl_scrn.obj"
"\Xash3D\src_main\temp\engine\!release\cl_tent.obj"
"\Xash3D\src_main\temp\engine\!release\cl_video.obj"
"\Xash3D\src_main\temp\engine\!release\cl_view.obj"
"\Xash3D\src_main\temp\engine\!release\cl_world.obj"
"\Xash3D\src_main\temp\engine\!release\com_keys.obj"
"\Xash3D\src_main\temp\engine\!release\com_world.obj"
"\Xash3D\src_main\temp\engine\!release\con_main.obj"
"\Xash3D\src_main\temp\engine\!release\con_utils.obj"
"\Xash3D\src_main\temp\engine\!release\engfuncs.obj"
"\Xash3D\src_main\temp\engine\!release\host.obj"
"\Xash3D\src_main\temp\engine\!release\infostring.obj"
"\Xash3D\src_main\temp\engine\!release\input.obj"
"\Xash3D\src_main\temp\engine\!release\net_chan.obj"
"\Xash3D\src_main\temp\engine\!release\net_encode.obj"
"\Xash3D\src_main\temp\engine\!release\net_huff.obj"
"\Xash3D\src_main\temp\engine\!release\net_msg.obj"
"\Xash3D\src_main\temp\engine\!release\sv_client.obj"
"\Xash3D\src_main\temp\engine\!release\sv_cmds.obj"
"\Xash3D\src_main\temp\engine\!release\sv_frame.obj"
"\Xash3D\src_main\temp\engine\!release\sv_game.obj"
"\Xash3D\src_main\temp\engine\!release\sv_init.obj"
"\Xash3D\src_main\temp\engine\!release\sv_main.obj"
"\Xash3D\src_main\temp\engine\!release\sv_move.obj"
"\Xash3D\src_main\temp\engine\!release\sv_phys.obj"
"\Xash3D\src_main\temp\engine\!release\sv_save.obj"
"\Xash3D\src_main\temp\engine\!release\sv_world.obj"
"\Xash3D\src_main\temp\engine\!release\titles.obj"
"\Xash3D\src_main\temp\engine\!release\ui_advcontrols.obj"
"\Xash3D\src_main\temp\engine\!release\ui_audio.obj"
"\Xash3D\src_main\temp\engine\!release\ui_configuration.obj"
"\Xash3D\src_main\temp\engine\!release\ui_controls.obj"
"\Xash3D\src_main\temp\engine\!release\ui_creategame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_credits.obj"
"\Xash3D\src_main\temp\engine\!release\ui_customgame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_gameoptions.obj"
"\Xash3D\src_main\temp\engine\!release\ui_langame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_loadgame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_main.obj"
"\Xash3D\src_main\temp\engine\!release\ui_menu.obj"
"\Xash3D\src_main\temp\engine\!release\ui_multiplayer.obj"
"\Xash3D\src_main\temp\engine\!release\ui_newgame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_playdemo.obj"
"\Xash3D\src_main\temp\engine\!release\ui_playersetup.obj"
"\Xash3D\src_main\temp\engine\!release\ui_playrec.obj"
"\Xash3D\src_main\temp\engine\!release\ui_qmenu.obj"
"\Xash3D\src_main\temp\engine\!release\ui_recdemo.obj"
"\Xash3D\src_main\temp\engine\!release\ui_savegame.obj"
"\Xash3D\src_main\temp\engine\!release\ui_saveload.obj"
"\Xash3D\src_main\temp\engine\!release\ui_video.obj"
"\Xash3D\src_main\temp\engine\!release\ui_vidmodes.obj"
"\Xash3D\src_main\temp\engine\!release\ui_vidoptions.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D76.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D77.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\engine\!release\engine.dll "D:\Xash3D\bin\engine.dll"
]
Creating command line ""C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2D77.bat""
Compiling...
build.c
cinematic.c
cl_cmds.c
cl_demo.c
cl_effects.c
cl_frame.c
cl_game.c
cl_main.c
cl_move.c
cl_parse.c
cl_phys.c
cl_scrn.c
cl_tent.c
cl_video.c
cl_view.c
cl_world.c
com_keys.c
com_world.c
con_main.c
con_utils.c
Generating Code...
Compiling...
engfuncs.c
host.c
infostring.c
input.c
net_chan.c
net_encode.c
net_huff.c
net_msg.c
sv_client.c
sv_cmds.c
sv_frame.c
sv_game.c
sv_init.c
sv_main.c
sv_move.c
sv_phys.c
sv_save.c
sv_world.c
titles.c
ui_advcontrols.c
Generating Code...
Compiling...
ui_audio.c
ui_configuration.c
ui_controls.c
ui_creategame.c
ui_credits.c
ui_customgame.c
ui_gameoptions.c
ui_langame.c
ui_loadgame.c
ui_main.c
ui_menu.c
ui_multiplayer.c
ui_newgame.c
ui_playdemo.c
ui_playersetup.c
ui_playrec.c
ui_qmenu.c
ui_recdemo.c
ui_savegame.c
ui_saveload.c
Generating Code...
Compiling...
ui_video.c
ui_vidmodes.c
ui_vidoptions.c
Generating Code...
Linking...
Creating library ..\temp\engine\!release/engine.lib and object ..\temp\engine\!release/engine.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\engine\!release\engine.dll
<EFBFBD>ŞŽŻ¨ŕŽ˘ ­Ž ä ŠŤŽ˘: 1.
<h3>Results</h3>
engine.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -536,7 +536,8 @@ bool Host_FilterTime( float time )
}
}
host.frametime = host.realframetime = host.realtime - oldtime;
host.frametime = host.realtime - oldtime;
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
oldtime = host.realtime;
if( host_framerate->value > 0 && ( Host_IsLocalGame() || CL_IsPlaybackDemo() ))

View File

@ -2447,7 +2447,7 @@ pfnServerPrint
void pfnServerPrint( const char *szMsg )
{
// while loading in-progress we can sending message only for local client
if( sv.state == ss_loading ) com.print( szMsg );
if( sv.state == ss_loading ) MsgDev( D_INFO, szMsg );
else SV_BroadcastPrintf( PRINT_HIGH, "%s", szMsg );
}

View File

@ -296,11 +296,11 @@ bool SV_SpawnServer( const char *mapname, const char *startspot )
if( startspot )
{
Msg( "Spawn Server: %s [%s]\n", mapname, startspot );
MsgDev( D_INFO, "Spawn Server: %s [%s]\n", mapname, startspot );
}
else
{
Msg( "Spawn Server: %s\n", mapname );
MsgDev( D_INFO, "Spawn Server: %s\n", mapname );
}
// save state

View File

@ -233,7 +233,7 @@ static void UI_Credits_Init( void )
uiCredits.active = true;
}
bool UI_CreditsActive( void )
int UI_CreditsActive( void )
{
return uiCredits.active;
}

View File

@ -1321,6 +1321,8 @@ void UI_Init( void )
uiStatic.menuFont = re->RegisterShader( va( "gfx/fonts/%s", ui_mainfont->string ), SHADER_FONT );
}
uiStatic.initialized = true;
UI_Precache ();
}
/*

View File

@ -1,176 +0,0 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef PLANE_H
#define PLANE_H
//=========================================================
// Plane
//=========================================================
typedef int SideType;
// Used to represent sides of things like planes.
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
#define VP_EPSILON 0.01f
class VPlane
{
public:
VPlane();
VPlane(const Vector &vNormal, vec_t dist);
void Init(const Vector &vNormal, vec_t dist);
void Init(const Vector &vNormal, const Vector &vecPoint);
// Return the distance from the point to the plane.
vec_t DistTo(const Vector &vVec) const;
// Flip the plane.
VPlane Flip();
// Get a point on the plane (normal*dist).
Vector GetPointOnPlane() const;
// Copy.
VPlane& operator=(const VPlane &thePlane);
// Snap the specified point to the plane (along the plane's normal).
Vector SnapPointToPlane(const Vector &vPoint) const;
// Returns SIDE_ON, SIDE_FRONT, or SIDE_BACK.
// The epsilon for SIDE_ON can be passed in.
SideType GetPointSide(const Vector &vPoint, vec_t sideEpsilon=VP_EPSILON) const;
// Returns SIDE_FRONT or SIDE_BACK.
SideType GetPointSideExact(const Vector &vPoint) const;
// Classify the box with respect to the plane.
// Returns SIDE_ON, SIDE_FRONT, or SIDE_BACK
SideType BoxOnPlaneSide(const Vector &vMin, const Vector &vMax) const;
public:
Vector m_Normal;
vec_t m_Dist;
};
// ------------------------------------------------------------------------------------------- //
// Inlines.
// ------------------------------------------------------------------------------------------- //
inline VPlane::VPlane()
{
}
inline VPlane::VPlane(const Vector &vNormal, vec_t dist)
{
m_Normal = vNormal;
m_Dist = dist;
}
inline void VPlane::Init(const Vector &vNormal, vec_t dist)
{
m_Normal = vNormal;
m_Dist = dist;
}
inline void VPlane::Init(const Vector &vNormal, const Vector &vecPoint)
{
m_Normal = vNormal;
m_Dist = vNormal.Dot( vecPoint );
}
inline vec_t VPlane::DistTo(const Vector &vVec) const
{
return DotProduct( vVec, m_Normal ) - m_Dist;
}
inline VPlane VPlane::Flip()
{
return VPlane(-m_Normal, -m_Dist);
}
inline Vector VPlane::GetPointOnPlane() const
{
return m_Normal * m_Dist;
}
inline VPlane& VPlane::operator=(const VPlane &thePlane)
{
m_Normal = thePlane.m_Normal;
m_Dist = thePlane.m_Dist;
return *this;
}
inline Vector VPlane::SnapPointToPlane(const Vector &vPoint) const
{
return vPoint - m_Normal * DistTo(vPoint);
}
inline SideType VPlane::GetPointSide(const Vector &vPoint, vec_t sideEpsilon) const
{
vec_t fDist;
fDist = DistTo(vPoint);
if(fDist >= sideEpsilon)
return SIDE_FRONT;
else if(fDist <= -sideEpsilon)
return SIDE_BACK;
else return SIDE_ON;
}
inline SideType VPlane::GetPointSideExact(const Vector &vPoint) const
{
return DistTo(vPoint) > 0.0f ? SIDE_FRONT : SIDE_BACK;
}
inline SideType VPlane::BoxOnPlaneSide(const Vector &vMin, const Vector &vMax) const
{
int i, firstSide, side;
Vector vPoints[8] =
{
Vector(vMin.x, vMin.y, vMin.z),
Vector(vMin.x, vMin.y, vMax.z),
Vector(vMin.x, vMax.y, vMax.z),
Vector(vMin.x, vMax.y, vMin.z),
Vector(vMax.x, vMin.y, vMin.z),
Vector(vMax.x, vMin.y, vMax.z),
Vector(vMax.x, vMax.y, vMax.z),
Vector(vMax.x, vMax.y, vMin.z),
};
firstSide = GetPointSideExact(vPoints[0]);
for(i=1; i < 8; i++)
{
side = GetPointSideExact(vPoints[i]);
// Does the box cross the plane?
if(side != firstSide)
return SIDE_ON;
}
// Ok, they're all on the same side, return that.
return firstSide;
}
#endif // PLANE_H

File diff suppressed because it is too large Load Diff

View File

@ -1,672 +0,0 @@
//=======================================================================
// Copyright (C) Shambler Team 2006
// vmatrix.h - shared matrix operations
//=======================================================================
#ifndef MATRIX_H
#define MATRIX_H
#include <windows.h>
#include "basetypes.h"
#include "vector.h"
#include "plane.h"
#include "const.h"
struct matrix3x4_t
{
matrix3x4_t() {}
matrix3x4_t(
float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23 )
{
m_flMatVal[0][0] = m00; m_flMatVal[0][1] = m01; m_flMatVal[0][2] = m02; m_flMatVal[0][3] = m03;
m_flMatVal[1][0] = m10; m_flMatVal[1][1] = m11; m_flMatVal[1][2] = m12; m_flMatVal[1][3] = m13;
m_flMatVal[2][0] = m20; m_flMatVal[2][1] = m21; m_flMatVal[2][2] = m22; m_flMatVal[2][3] = m23;
}
float *operator[]( int i ) { return m_flMatVal[i]; }
const float *operator[]( int i ) const { return m_flMatVal[i]; }
float *Base() { return &m_flMatVal[0][0]; }
const float *Base() const { return &m_flMatVal[0][0]; }
float m_flMatVal[3][4];
};
class VMatrix
{
public:
VMatrix ();
VMatrix(
vec_t m00, vec_t m01, vec_t m02, vec_t m03,
vec_t m10, vec_t m11, vec_t m12, vec_t m13,
vec_t m20, vec_t m21, vec_t m22, vec_t m23,
vec_t m30, vec_t m31, vec_t m32, vec_t m33
);
// Creates a matrix where the X axis = forward
// the Y axis = left, and the Z axis = up
VMatrix( const Vector& forward, const Vector& left, const Vector& up );
// Construct from a 3x4 matrix
VMatrix( const matrix3x4_t& matrix3x4 );
// Set the values in the matrix.
void Init(
vec_t m00, vec_t m01, vec_t m02, vec_t m03,
vec_t m10, vec_t m11, vec_t m12, vec_t m13,
vec_t m20, vec_t m21, vec_t m22, vec_t m23,
vec_t m30, vec_t m31, vec_t m32, vec_t m33
);
// Initialize from a 3x4
void Init( const matrix3x4_t& matrix3x4 );
// array access
float* operator[](int i) { return m[i]; }
float const* operator[](int i) const { return m[i]; }
// Access the basis vectors.
Vector GetLeft() const;
Vector GetUp() const;
Vector GetForward() const;
void SetLeft(const Vector &vLeft);
void SetUp(const Vector &vUp);
void SetForward(const Vector &vForward);
void GetBasisVectors(Vector &vForward, Vector &vLeft, Vector &vUp) const;
void SetBasisVectors(const Vector &vForward, const Vector &vLeft, const Vector &vUp);
// Get/set the translation.
Vector GetTranslation() const;
void SetTranslation(const Vector &vTrans);
void PreTranslate(const Vector &vTrans);
void PostTranslate(const Vector &vTrans);
matrix3x4_t& As3x4();
const matrix3x4_t& As3x4() const;
void CopyFrom3x4( const matrix3x4_t &m3x4 );
void Set3x4( matrix3x4_t& matrix3x4 ) const;
// Matrix->vector operations.
public:
// Multiply by a vector (divides by w, assumes input w is 1).
Vector operator*(const Vector &vVec) const;
// Multiply by the upper 3x3 part of the matrix (ie: only apply rotation).
Vector VMul3x3(const Vector &vVec) const;
// Apply the inverse (transposed) rotation (only works on pure rotation matrix)
Vector VMul3x3Transpose(const Vector &vVec) const;
// Multiply by the upper 3 rows.
Vector VMul4x3(const Vector &vVec) const;
// Apply the inverse (transposed) transformation (only works on pure rotation/translation)
Vector VMul4x3Transpose(const Vector &vVec) const;
// Multiply by a 3D vector (same as operator*).
void V3Mul(const Vector &vIn, Vector &vOut) const;
// Multiply by a 4D vector.
void V4Mul(const Vector4D &vIn, Vector4D &vOut) const;
// Applies the rotation (ignores translation in the matrix). (This just calls VMul3x3).
Vector ApplyRotation(const Vector &vVec) const;
// Matrix->plane operations.
public:
// Transform the plane. The matrix can only contain translation and rotation.
void TransformPlane( const VPlane &inPlane, VPlane &outPlane ) const;
// Just calls TransformPlane and returns the result.
VPlane operator*(const VPlane &thePlane) const;
// Matrix->matrix operations.
public:
VMatrix& operator=(const VMatrix &mOther);
// Multiply two matrices (out = this * vm).
void MatrixMul( const VMatrix &vm, VMatrix &out ) const;
// Just calls MatrixMul and returns the result.
VMatrix operator*(const VMatrix &mOther) const;
// Add two matrices.
VMatrix const& operator+=(const VMatrix &other);
// Add/Subtract two matrices.
VMatrix operator+(const VMatrix &other) const;
VMatrix operator-(const VMatrix &other) const;
// Negation.
VMatrix operator-() const;
// Return inverse matrix. Be careful because the results are undefined
// if the matrix doesn't have an inverse (ie: InverseGeneral returns false).
VMatrix operator~() const;
// Matrix operations.
public:
// Set to identity.
void Identity();
// Setup a matrix for origin and angles.
void SetupMatrixOrgAngles( const Vector &origin, const Vector &vAngles );
// General inverse. This may fail so check the return!
bool InverseGeneral(VMatrix &vInverse) const;
// Does a fast inverse, assuming the matrix only contains translation and rotation.
void InverseTR( VMatrix &mRet ) const;
VMatrix InverseTR() const; // This calls the other InverseTR and returns the result.
// Get the scale of the matrix's basis vectors.
Vector GetScale() const;
// (Fast) multiply by a scaling matrix setup from vScale.
VMatrix Scale(const Vector &vScale);
// Normalize the basis vectors.
VMatrix NormalizeBasisVectors() const;
// Transpose.
VMatrix Transpose() const;
// Transpose upper-left 3x3.
VMatrix Transpose3x3() const;
// Usually used for debug checks. Returns true if the upper 3x3 contains
// unit vectors and they are all orthogonal.
bool IsRotationMatrix() const;
public:
// The matrix.
vec_t m[4][4];
};
// ------------------------------------------------------------------------------------------- //
// Helper functions.
// ------------------------------------------------------------------------------------------- //
// Setup an identity matrix.
VMatrix SetupMatrixIdentity();
// Setup as a scaling matrix.
VMatrix SetupMatrixScale(const Vector &vScale);
// Setup a translation matrix.
VMatrix SetupMatrixTranslation(const Vector &vTranslation);
// Setup a matrix to reflect around the plane.
VMatrix SetupMatrixReflection(const VPlane &thePlane);
// Setup a matrix to project from vOrigin onto thePlane.
VMatrix SetupMatrixProjection(const Vector &vOrigin, const VPlane &thePlane);
// Setup a matrix to rotate the specified amount around the specified axis.
VMatrix SetupMatrixAxisRot(const Vector &vAxis, vec_t fDegrees);
// Setup a matrix from euler angles. Just sets identity and calls MatrixAngles.
VMatrix SetupMatrixAngles(const Vector &vAngles);
// Setup a matrix for origin and angles.
VMatrix SetupMatrixOrgAngles(const Vector &origin, const Vector &vAngles);
// Returns the point at the intersection on the 3 planes.
// Returns false if it can't be solved (2 or more planes are parallel).
bool PlaneIntersection(
const VPlane &vp1,
const VPlane &vp2,
const VPlane &vp3,
Vector &vOut
);
//-----------------------------------------------------------------------------
// These methods are faster. Use them if you want faster code
//-----------------------------------------------------------------------------
void MatrixSetIdentity( VMatrix &dst );
void MatrixTranspose( const VMatrix& src, VMatrix& dst );
void MatrixCopy( const VMatrix& src, VMatrix& dst );
void MatrixCopy( const matrix3x4_t &in, matrix3x4_t &out );
void MatrixInvert( const matrix3x4_t& in, matrix3x4_t& out );
void MatrixMultiply( const VMatrix& src1, const VMatrix& src2, VMatrix& dst );
void ConcatTransforms (const matrix3x4_t& in1, const matrix3x4_t& in2, matrix3x4_t& out);
// Accessors
void MatrixGetColumn( const VMatrix &src, int nCol, Vector *pColumn );
void MatrixSetColumn( VMatrix &src, int nCol, const Vector &column );
// Vector3DMultiply treats src2 as if it's a direction vector
void Vector3DMultiply( const VMatrix& src1, const Vector& src2, Vector& dst );
// Vector3DMultiplyPosition treats src2 as if it's a point (adds the translation)
inline void Vector3DMultiplyPosition( const VMatrix& src1, const Vector src2, Vector& dst );
// Vector3DMultiplyPositionProjective treats src2 as if it's a point
// and does the perspective divide at the end
void Vector3DMultiplyPositionProjective( const VMatrix& src1, const Vector &src2, Vector& dst );
// Vector3DMultiplyPosition treats src2 as if it's a direction
// and does the perspective divide at the end
// NOTE: src1 had better be an inverse transpose to use this correctly
void Vector3DMultiplyProjective( const VMatrix& src1, const Vector &src2, Vector& dst );
void Vector4DMultiply( const VMatrix& src1, const Vector4D& src2, Vector4D& dst );
// Multiplies the vector by the transpose of the matrix
void Vector3DMultiplyTranspose( const VMatrix& src1, const Vector& src2, Vector& dst );
void Vector4DMultiplyTranspose( const VMatrix& src1, const Vector4D& src2, Vector4D& dst );
void MatrixBuildTranslation( VMatrix& dst, float x, float y, float z );
void MatrixBuildTranslation( VMatrix& dst, const Vector &translation );
void MatrixBuildRotationAboutAxis( VMatrix& dst, const Vector& vAxisOfRot, float angleDegrees );
void MatrixBuildRotateZ( VMatrix& dst, float angleDegrees );
// Builds a rotation matrix that rotates one direction vector into another
void MatrixBuildRotation( VMatrix &dst, const Vector& initialDirection, const Vector& finalDirection );
// Builds a scale matrix
void MatrixBuildScale( VMatrix &dst, float x, float y, float z );
void MatrixBuildScale( VMatrix &dst, const Vector& scale );
// Setup a matrix from euler angles.
void MatrixFromAngles( const Vector& vAngles, VMatrix& dst );
// Creates euler angles from a matrix
void MatrixToAngles( const VMatrix& src, Vector& vAngles );
// Does a fast inverse, assuming the matrix only contains translation and rotation.
void MatrixInverseTR( const VMatrix& src, VMatrix &dst );
// Inverts any matrix at all
bool MatrixInverseGeneral(const VMatrix& src, VMatrix& dst);
// Computes the inverse transpose
void MatrixInverseTranspose( const VMatrix& src, VMatrix& dst );
// ------------------------------------------------------------------------------------------- //
// VMatrix inlines.
// ------------------------------------------------------------------------------------------- //
inline VMatrix::VMatrix()
{
}
inline VMatrix::VMatrix(
vec_t m00, vec_t m01, vec_t m02, vec_t m03,
vec_t m10, vec_t m11, vec_t m12, vec_t m13,
vec_t m20, vec_t m21, vec_t m22, vec_t m23,
vec_t m30, vec_t m31, vec_t m32, vec_t m33)
{
Init(
m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33
);
}
inline VMatrix::VMatrix( const matrix3x4_t& matrix3x4 )
{
Init( matrix3x4 );
}
//-----------------------------------------------------------------------------
// Creates a matrix where the X axis = forward
// the Y axis = left, and the Z axis = up
//-----------------------------------------------------------------------------
inline VMatrix::VMatrix( const Vector& xAxis, const Vector& yAxis, const Vector& zAxis )
{
Init(
xAxis.x, yAxis.x, zAxis.x, 0.0f,
xAxis.y, yAxis.y, zAxis.y, 0.0f,
xAxis.z, yAxis.z, zAxis.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
inline void VMatrix::Init(
vec_t m00, vec_t m01, vec_t m02, vec_t m03,
vec_t m10, vec_t m11, vec_t m12, vec_t m13,
vec_t m20, vec_t m21, vec_t m22, vec_t m23,
vec_t m30, vec_t m31, vec_t m32, vec_t m33
)
{
m[0][0] = m00;
m[0][1] = m01;
m[0][2] = m02;
m[0][3] = m03;
m[1][0] = m10;
m[1][1] = m11;
m[1][2] = m12;
m[1][3] = m13;
m[2][0] = m20;
m[2][1] = m21;
m[2][2] = m22;
m[2][3] = m23;
m[3][0] = m30;
m[3][1] = m31;
m[3][2] = m32;
m[3][3] = m33;
}
// Initialize from a 3x4
inline void VMatrix::Init( const matrix3x4_t& matrix3x4 )
{
memcpy(m, matrix3x4.Base(), sizeof( matrix3x4_t ) );
m[3][0] = 0.0f;
m[3][1] = 0.0f;
m[3][2] = 0.0f;
m[3][3] = 1.0f;
}
inline Vector VMatrix::GetForward() const
{
return Vector(m[0][0], m[1][0], m[2][0]);
}
inline Vector VMatrix::GetLeft() const
{
return Vector(m[0][1], m[1][1], m[2][1]);
}
inline Vector VMatrix::GetUp() const
{
return Vector(m[0][2], m[1][2], m[2][2]);
}
inline void VMatrix::SetForward(const Vector &vForward)
{
m[0][0] = vForward.x;
m[1][0] = vForward.y;
m[2][0] = vForward.z;
}
inline void VMatrix::SetLeft(const Vector &vLeft)
{
m[0][1] = vLeft.x;
m[1][1] = vLeft.y;
m[2][1] = vLeft.z;
}
inline void VMatrix::SetUp(const Vector &vUp)
{
m[0][2] = vUp.x;
m[1][2] = vUp.y;
m[2][2] = vUp.z;
}
inline void VMatrix::GetBasisVectors(Vector &vForward, Vector &vLeft, Vector &vUp) const
{
vForward = GetForward();
vLeft = GetLeft();
vUp = GetUp();
}
inline void VMatrix::SetBasisVectors(const Vector &vForward, const Vector &vLeft, const Vector &vUp)
{
SetForward(vForward);
SetLeft(vLeft);
SetUp(vUp);
}
inline Vector VMatrix::GetTranslation() const
{
return Vector(m[0][3], m[1][3], m[2][3]);
}
inline void VMatrix::SetTranslation(const Vector &vTrans)
{
m[0][3] = vTrans.x;
m[1][3] = vTrans.y;
m[2][3] = vTrans.z;
}
// appply translation to this matrix in the input space
inline void VMatrix::PreTranslate(const Vector &vTrans)
{
Vector tmp = VMul4x3( vTrans );
m[0][3] = tmp.x;
m[1][3] = tmp.y;
m[2][3] = tmp.z;
}
// appply translation to this matrix in the output space
inline void VMatrix::PostTranslate(const Vector &vTrans)
{
m[0][3] += vTrans.x;
m[1][3] += vTrans.y;
m[2][3] += vTrans.z;
}
inline const matrix3x4_t& VMatrix::As3x4() const
{
return *((const matrix3x4_t*)this);
}
inline matrix3x4_t& VMatrix::As3x4()
{
return *((matrix3x4_t*)this);
}
inline void VMatrix::CopyFrom3x4( const matrix3x4_t &m3x4 )
{
memcpy( m, m3x4.Base(), sizeof( matrix3x4_t ) );
m[3][0] = m[3][1] = m[3][2] = 0;
m[3][3] = 1;
}
inline void VMatrix::Set3x4( matrix3x4_t& matrix3x4 ) const
{
memcpy(matrix3x4.Base(), m, sizeof( matrix3x4_t ) );
}
inline Vector VMatrix::operator*(const Vector &vVec) const
{
Vector vRet;
vRet.x = m[0][0]*vVec.x + m[0][1]*vVec.y + m[0][2]*vVec.z + m[0][3];
vRet.y = m[1][0]*vVec.x + m[1][1]*vVec.y + m[1][2]*vVec.z + m[1][3];
vRet.z = m[2][0]*vVec.x + m[2][1]*vVec.y + m[2][2]*vVec.z + m[2][3];
return vRet;
}
inline const VMatrix& VMatrix::operator+=(const VMatrix &other)
{
for(int i=0; i < 4; i++)
{
for(int j=0; j < 4; j++)
{
m[i][j] += other.m[i][j];
}
}
return *this;
}
inline VMatrix VMatrix::operator+(const VMatrix &other) const
{
VMatrix ret;
for(int i=0; i < 16; i++)
{
((float*)ret.m)[i] = ((float*)m)[i] + ((float*)other.m)[i];
}
return ret;
}
inline VMatrix VMatrix::operator-(const VMatrix &other) const
{
VMatrix ret;
for(int i=0; i < 4; i++)
{
for(int j=0; j < 4; j++)
{
ret.m[i][j] = m[i][j] - other.m[i][j];
}
}
return ret;
}
inline VMatrix VMatrix::operator-() const
{
VMatrix ret;
for( int i=0; i < 16; i++ )
{
((float*)ret.m)[i] = ((float*)m)[i];
}
return ret;
}
inline Vector VMatrix::VMul4x3(const Vector &vVec) const
{
return Vector(
m[0][0]*vVec.x + m[0][1]*vVec.y + m[0][2]*vVec.z + m[0][3],
m[1][0]*vVec.x + m[1][1]*vVec.y + m[1][2]*vVec.z + m[1][3],
m[2][0]*vVec.x + m[2][1]*vVec.y + m[2][2]*vVec.z + m[2][3]
);
}
inline Vector VMatrix::VMul4x3Transpose(const Vector &vVec) const
{
Vector tmp = vVec;
tmp.x -= m[0][3];
tmp.y -= m[1][3];
tmp.z -= m[2][3];
return Vector(
m[0][0]*tmp.x + m[1][0]*tmp.y + m[2][0]*tmp.z,
m[0][1]*tmp.x + m[1][1]*tmp.y + m[2][1]*tmp.z,
m[0][2]*tmp.x + m[1][2]*tmp.y + m[2][2]*tmp.z
);
}
inline Vector VMatrix::VMul3x3(const Vector &vVec) const
{
return Vector(
m[0][0]*vVec.x + m[0][1]*vVec.y + m[0][2]*vVec.z,
m[1][0]*vVec.x + m[1][1]*vVec.y + m[1][2]*vVec.z,
m[2][0]*vVec.x + m[2][1]*vVec.y + m[2][2]*vVec.z
);
}
inline Vector VMatrix::VMul3x3Transpose(const Vector &vVec) const
{
return Vector(
m[0][0]*vVec.x + m[1][0]*vVec.y + m[2][0]*vVec.z,
m[0][1]*vVec.x + m[1][1]*vVec.y + m[2][1]*vVec.z,
m[0][2]*vVec.x + m[1][2]*vVec.y + m[2][2]*vVec.z
);
}
inline void VMatrix::V3Mul(const Vector &vIn, Vector &vOut) const
{
vec_t rw;
rw = 1.0f / (m[3][0]*vIn.x + m[3][1]*vIn.y + m[3][2]*vIn.z + m[3][3]);
vOut.x = (m[0][0]*vIn.x + m[0][1]*vIn.y + m[0][2]*vIn.z + m[0][3]) * rw;
vOut.y = (m[1][0]*vIn.x + m[1][1]*vIn.y + m[1][2]*vIn.z + m[1][3]) * rw;
vOut.z = (m[2][0]*vIn.x + m[2][1]*vIn.y + m[2][2]*vIn.z + m[2][3]) * rw;
}
inline void VMatrix::V4Mul(const Vector4D &vIn, Vector4D &vOut) const
{
vOut[0] = m[0][0]*vIn[0] + m[0][1]*vIn[1] + m[0][2]*vIn[2] + m[0][3]*vIn[3];
vOut[1] = m[1][0]*vIn[0] + m[1][1]*vIn[1] + m[1][2]*vIn[2] + m[1][3]*vIn[3];
vOut[2] = m[2][0]*vIn[0] + m[2][1]*vIn[1] + m[2][2]*vIn[2] + m[2][3]*vIn[3];
vOut[3] = m[3][0]*vIn[0] + m[3][1]*vIn[1] + m[3][2]*vIn[2] + m[3][3]*vIn[3];
}
inline Vector VMatrix::ApplyRotation(const Vector &vVec) const
{
return VMul3x3(vVec);
}
inline void VMatrix::TransformPlane( const VPlane &inPlane, VPlane &outPlane ) const
{
Vector vPlanePt, vTemp;
outPlane.m_Normal = VMul3x3( inPlane.m_Normal );
vPlanePt = inPlane.GetPointOnPlane();
vTemp = VMul4x3( vPlanePt );
outPlane.m_Dist = DotProduct( outPlane.m_Normal, vTemp );
}
inline VMatrix VMatrix::operator~() const
{
VMatrix mRet;
InverseGeneral(mRet);
return mRet;
}
inline void VMatrix::Identity()
{
*this = SetupMatrixIdentity();
}
//-----------------------------------------------------------------------------
// Accessors
//-----------------------------------------------------------------------------
inline void MatrixGetColumn( const VMatrix &src, int nCol, Vector *pColumn )
{
(*pColumn)[0] = src[0][nCol];
(*pColumn)[1] = src[1][nCol];
(*pColumn)[2] = src[2][nCol];
}
inline void MatrixSetColumn( VMatrix &src, int nCol, const Vector &column )
{
src.m[0][nCol] = column.x;
src.m[1][nCol] = column.y;
src.m[2][nCol] = column.z;
}
inline void MatrixSetColumn( const Vector &in, int column, matrix3x4_t& out )
{
out[0][column] = in.x;
out[1][column] = in.y;
out[2][column] = in.z;
}
//misc utils
void VectorITransform (const float *in1, const matrix3x4_t& in2, float *out);
void VectorTransform (const float *in1, const matrix3x4_t& in2, float *out);
void VectorIRotate( const float *in1, const matrix3x4_t& in2, float *out );
void VectorRotate( const float *in1, const matrix3x4_t& in2, float *out );
void SetIdentityMatrix( matrix3x4_t& matrix );
void MatrixAngles( const matrix3x4_t & matrix, float *angles ); // !!!!
void AngleMatrix( const Vector &angles, matrix3x4_t& matrix );
void AngleMatrix( const Vector &angles, const Vector &position, matrix3x4_t& matrix );
inline void MatrixAngles( const matrix3x4_t &matrix, Vector &angles )
{
MatrixAngles( matrix, &angles.x );
}
#endif

1376
gameui/basemenu.cpp Normal file

File diff suppressed because it is too large Load Diff

422
gameui/basemenu.h Normal file
View File

@ -0,0 +1,422 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// basemenu.h - gameui main header
//=======================================================================
#ifndef BASEMENU_H
#define BASEMENU_H
// engine constants
#define GAME_NORMAL 0
#define GAME_SINGLEPLAYER_ONLY 1
#define GAME_MULTIPLAYER_ONLY 2
#define KEY_CONSOLE 0
#define KEY_GAME 1
#define KEY_MENU 2
#define CS_SIZE 64 // size of one config string
#define CS_TIME 16 // size of time string
#define UI_WHITE_SHADER "*white"
#define ART_MAIN_SPLASH "gfx/shell/splash"
#define ART_BACKGROUND "gfx/shell/background"
#define UI_CURSOR_NORMAL "gfx/shell/cursor"
#define UI_CURSOR_DISABLED "gfx/shell/denied"
#define UI_CURSOR_TYPING "gfx/shell/typing"
#define UI_SLIDER_MAIN "gfx/shell/slider"
#define UI_LEFTARROW "gfx/shell/larrowdefault"
#define UI_LEFTARROWFOCUS "gfx/shell/larrowflyover"
#define UI_LEFTARROWPRESSED "gfx/shell/larrowpressed"
#define UI_RIGHTARROW "gfx/shell/rarrowdefault"
#define UI_RIGHTARROWFOCUS "gfx/shell/rarrowflyover"
#define UI_RIGHTARROWPRESSED "gfx/shell/rarrowpressed"
#define UI_UPARROW "gfx/shell/uparrowd"
#define UI_UPARROWFOCUS "gfx/shell/uparrowf"
#define UI_UPARROWPRESSED "gfx/shell/uparrowp"
#define UI_DOWNARROW "gfx/shell/dnarrowd"
#define UI_DOWNARROWFOCUS "gfx/shell/dnarrowf"
#define UI_DOWNARROWPRESSED "gfx/shell/dnarrowp"
#define UI_CHECKBOX_EMPTY "gfx/shell/cb_empty"
#define UI_CHECKBOX_GRAYED "gfx/shell/cb_disabled"
#define UI_CHECKBOX_FOCUS "gfx/shell/cb_over"
#define UI_CHECKBOX_PRESSED "gfx/shell/cb_down"
#define UI_CHECKBOX_ENABLED "gfx/shell/cb_checked"
#define UI_CURSOR_SIZE 40
#define UI_MAX_MENUDEPTH 8
#define UI_MAX_MENUITEMS 64
#define UI_PULSE_DIVISOR 75
#define UI_BLINK_TIME 250
#define UI_BLINK_MASK 499
#define UI_SMALL_CHAR_WIDTH 10
#define UI_SMALL_CHAR_HEIGHT 20
#define UI_MED_CHAR_WIDTH 18
#define UI_MED_CHAR_HEIGHT 26
#define UI_BIG_CHAR_WIDTH 20
#define UI_BIG_CHAR_HEIGHT 40
#define UI_MAX_FIELD_LINE 256
#define UI_OUTLINE_WIDTH uiStatic.outlineWidth // outline thickness
#define UI_MAXGAMES 100 // slots for savegame/demos
#define UI_MAX_SERVERS 32
#define MAX_HINT_TEXT 512
// menu banners used fiexed rectangle (virtual screenspace at 640x480)
#define UI_BANNER_POSX 72
#define UI_BANNER_POSY 72
#define UI_BANNER_WIDTH 736
#define UI_BANNER_HEIGHT 128
// Generic types
typedef enum
{
QMTYPE_SCROLLLIST,
QMTYPE_SPINCONTROL,
QMTYPE_CHECKBOX,
QMTYPE_SLIDER,
QMTYPE_FIELD,
QMTYPE_ACTION,
QMTYPE_BITMAP
} menuType_t;
// Generic flags
#define QMF_LEFT_JUSTIFY BIT(0)
#define QMF_CENTER_JUSTIFY BIT(1)
#define QMF_RIGHT_JUSTIFY BIT(2)
#define QMF_GRAYED BIT(3) // Grays and disables
#define QMF_INACTIVE BIT(4) // Disables any input
#define QMF_HIDDEN BIT(5) // Doesn't draw
#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_PULSEIFFOCUS BIT(10)
#define QMF_HIGHLIGHTIFFOCUS BIT(11)
#define QMF_SMALLFONT BIT(12)
#define QMF_BIGFONT BIT(13)
#define QMF_DROPSHADOW BIT(14)
#define QMF_SILENT BIT(15) // Don't play sounds
#define QMF_HASMOUSEFOCUS BIT(16)
#define QMF_MOUSEONLY BIT(17) // Only mouse input allowed
#define QMF_FOCUSBEHIND BIT(18) // Focus draws behind normal item
#define QMF_NOTIFY BIT(19) // draw notify at right screen side
#define QMF_ACT_ONRELEASE BIT(20) // call Key_Event when button is released
#define QMF_ALLOW_COLORSTRINGS BIT(21) // allow colorstring in MENU_FIELD
// Callback notifications
#define QM_GOTFOCUS 1
#define QM_LOSTFOCUS 2
#define QM_ACTIVATED 3
#define QM_CHANGED 4
#define QM_PRESSED 5
typedef struct
{
int cursor;
int cursorPrev;
void *items[UI_MAX_MENUITEMS];
int numItems;
void (*drawFunc)( void );
const char *(*keyFunc)( int key, int down );
void (*activateFunc)( void );
} menuFramework_s;
typedef struct
{
menuType_t type;
const char *name;
int id;
uint flags;
int x;
int y;
int width;
int height;
int x2;
int y2;
int width2;
int height2;
int color;
int focusColor;
int charWidth;
int charHeight;
const char *statusText;
menuFramework_s *parent;
void (*callback) (void *self, int event);
void (*ownerdraw) (void *self);
} menuCommon_s;
typedef struct
{
menuCommon_s generic;
const char *background;
const char *upArrow;
const char *upArrowFocus;
const char *downArrow;
const char *downArrowFocus;
const char **itemNames;
int numItems;
int curItem;
int topItem;
int numRows;
} menuScrollList_s;
typedef struct
{
menuCommon_s generic;
const char *background;
const char *leftArrow;
const char *rightArrow;
const char *leftArrowFocus;
const char *rightArrowFocus;
float minValue;
float maxValue;
float curValue;
float range;
} menuSpinControl_s;
typedef struct
{
menuCommon_s generic;
const char *background;
int maxLength; // can't be more than UI_MAX_FIELD_LINE
char buffer[UI_MAX_FIELD_LINE];
int widthInChars;
int cursor;
int scroll;
} menuField_s;
typedef struct
{
menuCommon_s generic;
const char *background;
} menuAction_s;
typedef struct
{
menuCommon_s generic;
const char *pic;
const char *focusPic;
} menuBitmap_s;
typedef struct
{
menuCommon_s generic;
int enabled;
const char *emptyPic;
const char *focusPic; // can be replaced with pressPic manually
const char *checkPic;
const char *grayedPic; // when QMF_GRAYED is set
} menuCheckBox_s;
typedef struct
{
menuCommon_s generic;
float minValue;
float maxValue;
float curValue;
float drawStep;
int numSteps;
float range;
int keepSlider; // when mouse button is holds
} menuSlider_s;
void UI_ScrollList_Init( menuScrollList_s *sl );
const char *UI_ScrollList_Key( menuScrollList_s *sl, int key, int down );
void UI_ScrollList_Draw( menuScrollList_s *sl );
void UI_SpinControl_Init( menuSpinControl_s *sc );
const char *UI_SpinControl_Key( menuSpinControl_s *sc, int key, int down );
void UI_SpinControl_Draw( menuSpinControl_s *sc );
void UI_Slider_Init( menuSlider_s *sl );
const char *UI_Slider_Key( menuSlider_s *sl, int key, int down );
void UI_Slider_Draw( menuSlider_s *sl );
void UI_CheckBox_Init( menuCheckBox_s *cb );
const char *UI_CheckBox_Key( menuCheckBox_s *cb, int key, int down );
void UI_CheckBox_Draw( menuCheckBox_s *cb );
void UI_Field_Init( menuField_s *f );
const char *UI_Field_Key( menuField_s *f, int key, int down );
void UI_Field_Char( menuField_s *f, int key );
void UI_Field_Draw( menuField_s *f );
void UI_Action_Init( menuAction_s *t );
const char *UI_Action_Key( menuAction_s *t, int key, int down );
void UI_Action_Draw( menuAction_s *t );
void UI_Bitmap_Init( menuBitmap_s *b );
const char *UI_Bitmap_Key( menuBitmap_s *b, int key, int down );
void UI_Bitmap_Draw( menuBitmap_s *b );
// =====================================================================
// Main menu interface
extern cvar_t *ui_mainfont;
extern cvar_t *ui_namefont;
extern cvar_t *ui_precache;
extern cvar_t *ui_sensitivity;
typedef struct
{
menuFramework_s *menuActive;
menuFramework_s *menuStack[UI_MAX_MENUDEPTH];
int menuDepth;
netadr_t serverAddresses[UI_MAX_SERVERS];
char serverNames[UI_MAX_SERVERS][80];
int numServers;
int updateServers; // true is receive new info about servers
float scaleX;
float scaleY;
int outlineWidth;
int sliderWidth;
int cursorX;
int cursorY;
int realTime;
int firstDraw;
int enterSound;
int mouseInRect;
int hideCursor;
int visible;
int initialized;
HIMAGE menuFont;
HIMAGE nameFont;
} uiStatic_t;
extern uiStatic_t uiStatic;
extern char uiEmptyString[256]; // HACKHACK
extern const char *uiSoundIn;
extern const char *uiSoundMove;
extern const char *uiSoundOut;
extern const char *uiSoundBuzz;
extern const char *uiSoundGlow;
extern const char *uiSoundNull;
extern int uiColorHelp;
extern int uiPromptBgColor;
extern int uiPromptTextColor;
extern int uiPromptFocusColor;
extern int uiInputTextColor;
extern int uiInputBgColor;
extern int uiInputFgColor;
extern int uiColorWhite;
extern int uiColorDkGrey;
extern int uiColorBlack;
extern HIMAGE m_hConcsoleFont;
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_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 );
#define UI_DrawString( x, y, w, h, str, col, fcol, cw, ch, j, s ) UI_DrawStringExt( x, y, w, h, str, col, fcol, cw, ch, j, s, uiStatic.menuFont )
void UI_DrawStringExt( int x, int y, int w, int h, const char *str, const int col, int forceCol, int charW, int charH, int justify, int shadow, HIMAGE font );
void UI_BuildPath( const char *dllname, char *fullpath );
void UI_StartSound( const char *sound );
void UI_AddItem ( menuFramework_s *menu, void *item );
void UI_CursorMoved( menuFramework_s *menu );
void UI_SetCursor( menuFramework_s *menu, int cursor );
void UI_SetCursorToItem( menuFramework_s *menu, void *item );
void *UI_ItemAtCursor( menuFramework_s *menu );
void UI_AdjustCursor( menuFramework_s *menu, int dir );
void UI_DrawMenu( menuFramework_s *menu );
const char *UI_DefaultKey( menuFramework_s *menu, int key, int down );
const char *UI_ActivateItem( menuFramework_s *menu, menuCommon_s *item );
void UI_RefreshServerList( void );
int UI_CreditsActive( void );
void UI_CloseMenu( void );
void UI_PushMenu( menuFramework_s *menu );
void UI_PopMenu( void );
// Precache
void UI_Main_Precache( void );
void UI_NewGame_Precache( void );
void UI_LoadGame_Precache( void );
void UI_SaveGame_Precache( void );
void UI_SaveLoad_Precache( void );
void UI_MultiPlayer_Precache( void );
void UI_Options_Precache( void );
void UI_LanGame_Precache( void );
void UI_PlayerSetup_Precache( void );
void UI_Controls_Precache( void );
void UI_AdvControls_Precache( void );
void UI_GameOptions_Precache( void );
void UI_CreateGame_Precache( void );
void UI_RecDemo_Precache( void );
void UI_PlayDemo_Precache( void );
void UI_PlayRec_Precache( void );
void UI_Audio_Precache( void );
void UI_Video_Precache( void );
void UI_VidOptions_Precache( void );
void UI_VidModes_Precache( void );
void UI_CustomGame_Precache( void );
void UI_Credits_Precache( void );
void UI_GoToSite_Precache( void );
// Menus
void UI_Main_Menu( void );
void UI_NewGame_Menu( void );
void UI_LoadGame_Menu( void );
void UI_SaveGame_Menu( void );
void UI_SaveLoad_Menu( void );
void UI_MultiPlayer_Menu( void );
void UI_Options_Menu( void );
void UI_LanGame_Menu( void );
void UI_PlayerSetup_Menu( void );
void UI_Controls_Menu( void );
void UI_AdvControls_Menu( void );
void UI_GameOptions_Menu( void );
void UI_CreateGame_Menu( void );
void UI_RecDemo_Menu( void );
void UI_PlayDemo_Menu( void );
void UI_PlayRec_Menu( void );
void UI_Audio_Menu( void );
void UI_Video_Menu( void );
void UI_VidOptions_Menu( void );
void UI_VidModes_Menu( void );
void UI_CustomGame_Menu( void );
void UI_Credits_Menu( void );
//
//-----------------------------------------------------
//
class CMenu
{
public:
// Screen information
SCREENINFO m_scrinfo;
// Game information
GAMEINFO m_gameinfo;
};
extern CMenu gMenu;
#endif // BASEMENU_H

138
gameui/enginecallback.h Normal file
View File

@ -0,0 +1,138 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// enginecallback.h - actual engine callbacks
//=======================================================================
#ifndef ENGINECALLBACKS_H
#define ENGINECALLBACKS_H
// built-in memory manager
#define MALLOC( x ) (*g_engfuncs.pfnMemAlloc)( x, __FILE__, __LINE__ )
#define CALLOC( x, y ) (*g_engfuncs.pfnMemAlloc)((x) * (y), __FILE__, __LINE__ )
#define FREE( x ) (*g_engfuncs.pfnMemFree)( x, __FILE__, __LINE__ )
// screen handlers
#define PIC_Frames (*g_engfuncs.pfnPIC_Frames)
#define PIC_Width (*g_engfuncs.pfnPIC_Width)
#define PIC_Height (*g_engfuncs.pfnPIC_Height)
#define PIC_EnableScissor (*g_engfuncs.pfnPIC_EnableScissor)
#define PIC_DisableScissor (*g_engfuncs.pfnPIC_DisableScissor)
#define FillRGBA (*g_engfuncs.pfnFillRGBA)
#define GetScreenInfo (*g_engfuncs.pfnGetScreenInfo)
#define PIC_Load (*g_engfuncs.pfnPIC_Load)
#define PIC_Free (*g_engfuncs.pfnPIC_Free)
#define PLAY_SOUND (*g_engfuncs.pfnPlayLocalSound)
#define CVAR_REGISTER (*g_engfuncs.pfnRegisterVariable)
#define CVAR_SET_FLOAT (*g_engfuncs.pfnCvarSetValue)
#define CVAR_GET_FLOAT (*g_engfuncs.pfnGetCvarFloat)
#define CVAR_GET_STRING (*g_engfuncs.pfnGetCvarString)
#define CVAR_SET_STRING (*g_engfuncs.pfnCvarSetString)
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCmd)
#define CLIENT_JOIN (*g_engfuncs.pfnClientJoin)
#define GET_MENU_EDICT (*g_engfuncs.pfnGetPlayerModel)
#define ENGINE_SET_MODEL (*g_engfuncs.pfnSetModel)
#define R_ClearScene (*g_engfuncs.pfnClearScene)
#define R_AddEntity (*g_engfuncs.R_AddEntity)
#define R_RenderFrame (*g_engfuncs.pfnRenderScene)
#define LOAD_FILE (*g_engfuncs.pfnLoadFile)
#define FILE_EXISTS (*g_engfuncs.pfnFileExists)
#define FREE_FILE (*g_engfuncs.pfnFreeFile)
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
#define LOAD_LIBRARY (*g_engfuncs.pfnLoadLibrary)
#define GET_PROC_ADDRESS (*g_engfuncs.pfnGetProcAddress)
#define FREE_LIBRARY (*g_engfuncs.pfnFreeLibrary)
#define HOST_ERROR (*g_engfuncs.pfnHostError)
#define COM_ParseToken (*g_engfuncs.pfnParseToken)
#define KEY_SetDest (*g_engfuncs.pfnSetKeyDest)
#define KEY_ClearStates (*g_engfuncs.pfnKeyClearStates)
#define KEY_KeynumToString (*g_engfuncs.pfnKeynumToString)
#define KEY_GetBinding (*g_engfuncs.pfnKeyGetBinding)
#define KEY_SetBinding (*g_engfuncs.pfnKeySetBinding)
#define KEY_IsDown (*g_engfuncs.pfnKeyIsDown)
#define KEY_GetOverstrike (*g_engfuncs.pfnKeyGetOverstrikeMode)
#define KEY_SetOverstrike (*g_engfuncs.pfnKeySetOverstrikeMode)
#define Cmd_AddCommand (*g_engfuncs.pfnAddCommand)
#define Cmd_RemoveCommand (*g_engfuncs.pfnDelCommand)
#define CMD_ARGC (*g_engfuncs.pfnCmdArgc)
#define CMD_ARGV (*g_engfuncs.pfnCmdArgv)
#define ALERT (*g_engfuncs.pfnAlertMessage)
#define GET_AUDIO_LIST (*g_engfuncs.pfnGetAudioList)
#define GET_VIDEO_LIST (*g_engfuncs.pfnGetVideoList)
#define GET_GAMES_LIST (*g_engfuncs.pfnGetGamesList)
#define CHANGE_AUDIO (*g_engfuncs.pfnChangeAudio)
#define CHANGE_VIDEO (*g_engfuncs.pfnChangeVideo)
#define SHELL_EXECUTE (*g_engfuncs.pfnShellExecute)
#define HOST_WRITECONFIG (*g_engfuncs.pfnWriteServerConfig)
#define HOST_CHANGEGAME (*g_engfuncs.pfnChangeInstance)
#define CHECK_MAP_LIST (*g_engfuncs.pfnCreateMapsList)
#define HOST_NEWGAME (*g_engfuncs.pfnHostNewGame)
#define HOST_ENDGAME (*g_engfuncs.pfnHostEndGame)
#define GET_CLIPBOARD (*g_engfuncs.pfnGetClipboardData)
#define FS_SEARCH (*g_engfuncs.pfnGetFilesList)
#define GET_SAVE_COMMENT (*g_engfuncs.pfnGetSaveComment)
#define GET_DEMO_COMMENT (*g_engfuncs.pfnGetDemoComment)
#define CL_IsActive (*g_engfuncs.pfnClientInGame)
inline void PIC_Set( HIMAGE hPic, int r, int g, int b )
{
g_engfuncs.pfnPIC_Set( hPic, r, g, b, 255 );
}
inline void PIC_Set( HIMAGE hPic, int r, int g, int b, int a )
{
g_engfuncs.pfnPIC_Set( hPic, r, g, b, a );
}
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_DrawTransColor( int frame, int x, int y, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, -1, -1, prc );
}
inline void PIC_DrawTransColor( int frame, int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, width, height, NULL );
}
inline void PIC_DrawHoles( int frame, int x, int y, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawHoles( frame, x, y, -1, -1, prc );
}
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, 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 )
{
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, width, height, NULL );
}
#endif//ENGINECALLBACKS_H

35
gameui/extdll.h Normal file
View File

@ -0,0 +1,35 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// extdll.h - must be included into all gameui files
//=======================================================================
#ifndef EXTDLL_H
#define EXTDLL_H
// shut-up compiler warnings
#pragma warning(disable : 4305) // int or float data truncation
#pragma warning(disable : 4201) // nameless struct/union
#pragma warning(disable : 4514) // unreferenced inline function removed
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4244) // conversion from 'float' to 'int', possible loss of data
#include "windows.h"
#include "basetypes.h"
// Misc C-runtime library headers
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// shared engine/DLL constants
#include "const.h"
// Vector class
#include "vector.h"
#include "gameui_api.h"
#include "game_shared.h"
#endif//EXTDLL_H

5
gameui/gameui.def Normal file
View File

@ -0,0 +1,5 @@
LIBRARY gameui
EXPORTS
CreateAPI @1
SECTIONS
.data READ WRITE

233
gameui/gameui.dsp Normal file
View File

@ -0,0 +1,233 @@
# Microsoft Developer Studio Project File - Name="gameui" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=gameui - 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 "gameui.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 "gameui.mak" CFG="gameui - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gameui - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "gameui - 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)" == "gameui - 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\gameui\!release"
# PROP Intermediate_Dir "..\temp\gameui\!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 "../common" /I "../game_shared" /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" /def:".\gameui.def" /opt:nowin98
# SUBTRACT LINK32 /profile /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\gameui\!release
InputPath=\Xash3D\src_main\temp\gameui\!release\gameui.dll
SOURCE="$(InputPath)"
"D:\Xash3D\bin\gameui.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\gameui.dll "D:\Xash3D\bin\gameui.dll"
# End Custom Build
!ELSEIF "$(CFG)" == "gameui - 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\gameui\!debug"
# PROP Intermediate_Dir "..\temp\gameui\!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 "../common" /I "../game_shared" /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 /def:".\gameui.def" /pdbtype:sept
# ADD LINK32 msvcrtd.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /def:".\gameui.def" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\gameui\!debug
InputPath=\Xash3D\src_main\temp\gameui\!debug\gameui.dll
SOURCE="$(InputPath)"
"D:\Xash3D\bin\gameui.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\gameui.dll "D:\Xash3D\bin\gameui.dll"
# End Custom Build
!ENDIF
# Begin Target
# Name "gameui - Win32 Release"
# Name "gameui - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\basemenu.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_advcontrols.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_audio.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_configuration.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_controls.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_creategame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_credits.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_customgame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_gameoptions.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_langame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_loadgame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_main.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_multiplayer.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_newgame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_playdemo.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_playersetup.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_playrec.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_recdemo.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_savegame.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_saveload.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_video.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_vidmodes.cpp
# End Source File
# Begin Source File
SOURCE=.\menu_vidoptions.cpp
# End Source File
# Begin Source File
SOURCE=.\udll_int.cpp
# End Source File
# Begin Source File
SOURCE=.\utils.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\basemenu.h
# End Source File
# Begin Source File
SOURCE=.\extdll.h
# End Source File
# Begin Source File
SOURCE=.\utils.h
# End Source File
# End Group
# End Target
# End Project

325
gameui/menu_advcontrols.cpp Normal file
View File

@ -0,0 +1,325 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_advanced"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DONE 2
#define ID_SENSITIVITY 3
#define ID_CROSSHAIR 4
#define ID_INVERTMOUSE 5
#define ID_MOUSELOOK 6
#define ID_LOOKSPRING 7
#define ID_LOOKSTRAFE 8
#define ID_MOUSEFILTER 9
#define ID_AUTOAIM 10
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s done;
menuCheckBox_s crosshair;
menuCheckBox_s invertMouse;
menuCheckBox_s mouseLook;
menuCheckBox_s lookSpring;
menuCheckBox_s lookStrafe;
menuCheckBox_s mouseFilter;
menuCheckBox_s autoaim;
menuSlider_s sensitivity;
} uiAdvControls_t;
static uiAdvControls_t uiAdvControls;
/*
=================
UI_AdvControls_UpdateConfig
=================
*/
static void UI_AdvControls_UpdateConfig( void )
{
if( uiAdvControls.invertMouse.enabled && CVAR_GET_FLOAT( "m_pitch" ) > 0 )
CVAR_SET_FLOAT( "m_pitch", -CVAR_GET_FLOAT( "m_pitch" ));
else if( !uiAdvControls.invertMouse.enabled && CVAR_GET_FLOAT( "m_pitch" ) < 0 )
CVAR_SET_FLOAT( "m_pitch", fabs( CVAR_GET_FLOAT( "m_pitch" )));
CVAR_SET_FLOAT( "crosshair", uiAdvControls.crosshair.enabled );
CVAR_SET_FLOAT( "freelook", uiAdvControls.mouseLook.enabled );
CVAR_SET_FLOAT( "lookspring", uiAdvControls.lookSpring.enabled );
CVAR_SET_FLOAT( "lookstrafe", uiAdvControls.lookStrafe.enabled );
CVAR_SET_FLOAT( "m_filter", uiAdvControls.mouseFilter.enabled );
CVAR_SET_FLOAT( "sv_aim", uiAdvControls.autoaim.enabled );
CVAR_SET_FLOAT( "m_sensitivity", (uiAdvControls.sensitivity.curValue * 20.0f) + 0.1f );
if( uiAdvControls.mouseLook.enabled )
{
uiAdvControls.lookSpring.generic.flags |= QMF_GRAYED;
uiAdvControls.lookStrafe.generic.flags |= QMF_GRAYED;
}
else
{
uiAdvControls.lookSpring.generic.flags &= ~QMF_GRAYED;
uiAdvControls.lookStrafe.generic.flags &= ~QMF_GRAYED;
}
}
/*
=================
UI_AdvControls_GetConfig
=================
*/
static void UI_AdvControls_GetConfig( void )
{
if( CVAR_GET_FLOAT( "m_pitch" ) < 0 )
uiAdvControls.invertMouse.enabled = true;
if( CVAR_GET_FLOAT( "crosshair" ))
uiAdvControls.crosshair.enabled = 1;
if( CVAR_GET_FLOAT( "freelook" ))
uiAdvControls.mouseLook.enabled = 1;
if( CVAR_GET_FLOAT( "lookspring" ))
uiAdvControls.lookSpring.enabled = 1;
if( CVAR_GET_FLOAT( "lookstrafe" ))
uiAdvControls.lookStrafe.enabled = 1;
if( CVAR_GET_FLOAT( "m_filter" ))
uiAdvControls.mouseFilter.enabled = 1;
if( CVAR_GET_FLOAT( "sv_aim" ))
uiAdvControls.autoaim.enabled = 1;
uiAdvControls.sensitivity.curValue = (CVAR_GET_FLOAT( "m_sensitivity" ) - 0.1f) / 20.0f;
if( uiAdvControls.mouseLook.enabled )
{
uiAdvControls.lookSpring.generic.flags |= QMF_GRAYED;
uiAdvControls.lookStrafe.generic.flags |= QMF_GRAYED;
}
else
{
uiAdvControls.lookSpring.generic.flags &= ~QMF_GRAYED;
uiAdvControls.lookStrafe.generic.flags &= ~QMF_GRAYED;
}
}
/*
=================
UI_AdvControls_Callback
=================
*/
static void UI_AdvControls_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_CROSSHAIR:
case ID_INVERTMOUSE:
case ID_MOUSELOOK:
case ID_LOOKSPRING:
case ID_LOOKSTRAFE:
case ID_MOUSEFILTER:
case ID_AUTOAIM:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_AdvControls_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_AdvControls_Init
=================
*/
static void UI_AdvControls_Init( void )
{
memset( &uiAdvControls, 0, sizeof( uiAdvControls_t ));
uiAdvControls.background.generic.id = ID_BACKGROUND;
uiAdvControls.background.generic.type = QMTYPE_BITMAP;
uiAdvControls.background.generic.flags = QMF_INACTIVE;
uiAdvControls.background.generic.x = 0;
uiAdvControls.background.generic.y = 0;
uiAdvControls.background.generic.width = 1024;
uiAdvControls.background.generic.height = 768;
uiAdvControls.background.pic = ART_BACKGROUND;
uiAdvControls.banner.generic.id = ID_BANNER;
uiAdvControls.banner.generic.type = QMTYPE_BITMAP;
uiAdvControls.banner.generic.flags = QMF_INACTIVE;
uiAdvControls.banner.generic.x = UI_BANNER_POSX;
uiAdvControls.banner.generic.y = UI_BANNER_POSY;
uiAdvControls.banner.generic.width = UI_BANNER_WIDTH;
uiAdvControls.banner.generic.height = UI_BANNER_HEIGHT;
uiAdvControls.banner.pic = ART_BANNER;
uiAdvControls.done.generic.id = ID_DONE;
uiAdvControls.done.generic.type = QMTYPE_ACTION;
uiAdvControls.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiAdvControls.done.generic.x = 72;
uiAdvControls.done.generic.y = 680;
uiAdvControls.done.generic.name = "Done";
uiAdvControls.done.generic.statusText = "Save changes and go back to the Customize Menu";
uiAdvControls.done.generic.callback = UI_AdvControls_Callback;
uiAdvControls.crosshair.generic.id = ID_CROSSHAIR;
uiAdvControls.crosshair.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.crosshair.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.crosshair.generic.x = 72;
uiAdvControls.crosshair.generic.y = 230;
uiAdvControls.crosshair.generic.name = "Crosshair";
uiAdvControls.crosshair.generic.callback = UI_AdvControls_Callback;
uiAdvControls.crosshair.generic.statusText = "Enable the weapon aiming crosshair";
uiAdvControls.invertMouse.generic.id = ID_INVERTMOUSE;
uiAdvControls.invertMouse.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.invertMouse.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.invertMouse.generic.x = 72;
uiAdvControls.invertMouse.generic.y = 280;
uiAdvControls.invertMouse.generic.name = "Reverse mouse";
uiAdvControls.invertMouse.generic.callback = UI_AdvControls_Callback;
uiAdvControls.invertMouse.generic.statusText = "Reverse mouse up/down axis";
uiAdvControls.mouseLook.generic.id = ID_MOUSELOOK;
uiAdvControls.mouseLook.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.mouseLook.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.mouseLook.generic.x = 72;
uiAdvControls.mouseLook.generic.y = 330;
uiAdvControls.mouseLook.generic.name = "Mouse look";
uiAdvControls.mouseLook.generic.callback = UI_AdvControls_Callback;
uiAdvControls.mouseLook.generic.statusText = "Use the mouse to look around instead of using the mouse to move";
uiAdvControls.lookSpring.generic.id = ID_LOOKSPRING;
uiAdvControls.lookSpring.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.lookSpring.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.lookSpring.generic.x = 72;
uiAdvControls.lookSpring.generic.y = 380;
uiAdvControls.lookSpring.generic.name = "Look spring";
uiAdvControls.lookSpring.generic.callback = UI_AdvControls_Callback;
uiAdvControls.lookSpring.generic.statusText = "Causes the screen to 'spring' back to looking straight ahead when you\nmove forward";
uiAdvControls.lookStrafe.generic.id = ID_LOOKSTRAFE;
uiAdvControls.lookStrafe.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.lookStrafe.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.lookStrafe.generic.x = 72;
uiAdvControls.lookStrafe.generic.y = 430;
uiAdvControls.lookStrafe.generic.name = "Look strafe";
uiAdvControls.lookStrafe.generic.callback = UI_AdvControls_Callback;
uiAdvControls.lookStrafe.generic.statusText = "In combination with your mouse look modifier, causes left-right movements\nto strafe instead of turn";
uiAdvControls.mouseFilter.generic.id = ID_MOUSEFILTER;
uiAdvControls.mouseFilter.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.mouseFilter.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.mouseFilter.generic.x = 72;
uiAdvControls.mouseFilter.generic.y = 480;
uiAdvControls.mouseFilter.generic.name = "Mouse filter";
uiAdvControls.mouseFilter.generic.callback = UI_AdvControls_Callback;
uiAdvControls.mouseFilter.generic.statusText = "Average mouse inputs over the last two frames to smooth out movements";
uiAdvControls.autoaim.generic.id = ID_AUTOAIM;
uiAdvControls.autoaim.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.autoaim.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.autoaim.generic.x = 72;
uiAdvControls.autoaim.generic.y = 530;
uiAdvControls.autoaim.generic.name = "Autoaim";
uiAdvControls.autoaim.generic.callback = UI_AdvControls_Callback;
uiAdvControls.autoaim.generic.statusText = "Let game to help you aim at enemies";
uiAdvControls.sensitivity.generic.id = ID_SENSITIVITY;
uiAdvControls.sensitivity.generic.type = QMTYPE_SLIDER;
uiAdvControls.sensitivity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAdvControls.sensitivity.generic.name = "Mouse sensitivity";
uiAdvControls.sensitivity.generic.x = 72;
uiAdvControls.sensitivity.generic.y = 625;
uiAdvControls.sensitivity.generic.callback = UI_AdvControls_Callback;
uiAdvControls.sensitivity.generic.statusText = "Set in-game mouse sensitivity";
uiAdvControls.sensitivity.minValue = 0.0;
uiAdvControls.sensitivity.maxValue = 1.0;
uiAdvControls.sensitivity.range = 0.05f;
UI_AdvControls_GetConfig();
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.background );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.banner );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.done );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.crosshair );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.invertMouse );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.mouseLook );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.lookSpring );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.lookStrafe );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.mouseFilter );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.autoaim );
UI_AddItem( &uiAdvControls.menu, (void *)&uiAdvControls.sensitivity );
}
/*
=================
UI_AdvControls_Precache
=================
*/
void UI_AdvControls_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_AdvControls_Menu
=================
*/
void UI_AdvControls_Menu( void )
{
UI_AdvControls_Precache();
UI_AdvControls_Init();
UI_AdvControls_UpdateConfig();
UI_PushMenu( &uiAdvControls.menu );
}

358
gameui/menu_audio.cpp Normal file
View File

@ -0,0 +1,358 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_audio"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DONE 2
#define ID_APPLY 3
#define ID_SOUNDLIBRARY 4
#define ID_SOUNDVOLUME 5
#define ID_MUSICVOLUME 6
#define ID_EAX 7
#define ID_A3D 8
#define ID_MSGHINT 9
typedef struct
{
int soundLibrary;
float soundVolume;
float musicVolume;
int enableEAX;
int enableA3D;
} uiAudioValues_t;
static uiAudioValues_t uiAudioInitial;
typedef struct
{
char **audioList;
int numSoundDlls;
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s done;
menuAction_s apply;
menuSpinControl_s soundLibrary;
menuSlider_s soundVolume;
menuSlider_s musicVolume;
menuCheckBox_s EAX;
menuCheckBox_s A3D;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiAudio_t;
static uiAudio_t uiAudio;
/*
=================
UI_Audio_GetDeviceList
=================
*/
static void UI_Audio_GetDeviceList( void )
{
uiAudio.audioList = GET_AUDIO_LIST( &uiAudio.numSoundDlls );
for( int i = 0; i < uiAudio.numSoundDlls; i++ )
{
if( !stricmp( uiAudio.audioList[i], CVAR_GET_STRING( "host_audio" )))
uiAudio.soundLibrary.curValue = i;
}
uiAudio.soundLibrary.maxValue = uiAudio.numSoundDlls - 1;
}
/*
=================
UI_Audio_GetConfig
=================
*/
static void UI_Audio_GetConfig( void )
{
UI_Audio_GetDeviceList();
uiAudio.soundVolume.curValue = CVAR_GET_FLOAT( "volume" );
uiAudio.musicVolume.curValue = CVAR_GET_FLOAT( "musicvolume" );
if( CVAR_GET_FLOAT( "s_allowEAX" ))
uiAudio.EAX.enabled = 1;
if( CVAR_GET_FLOAT( "s_allowA3D" ))
uiAudio.A3D.enabled = 1;
// save initial values
uiAudioInitial.soundLibrary = uiAudio.soundLibrary.curValue;
uiAudioInitial.soundVolume = uiAudio.soundVolume.curValue;
uiAudioInitial.musicVolume = uiAudio.musicVolume.curValue;
uiAudioInitial.enableEAX = uiAudio.EAX.enabled;
uiAudioInitial.enableA3D = uiAudio.A3D.enabled;
}
/*
=================
UI_Audio_SetConfig
=================
*/
static void UI_Audio_SetConfig( void )
{
CVAR_SET_FLOAT( "volume", uiAudio.soundVolume.curValue );
CVAR_SET_FLOAT( "musicvolume", uiAudio.musicVolume.curValue );
CVAR_SET_FLOAT( "s_allowEAX", uiAudio.EAX.enabled );
CVAR_SET_FLOAT( "s_allowA3D", uiAudio.A3D.enabled );
CHANGE_AUDIO( uiAudio.audioList[(int)uiAudio.soundLibrary.curValue] );
}
/*
=================
UI_Audio_UpdateConfig
=================
*/
static void UI_Audio_UpdateConfig( void )
{
uiAudio.soundLibrary.generic.name = uiAudio.audioList[(int)uiAudio.soundLibrary.curValue];
CVAR_SET_FLOAT( "volume", uiAudio.soundVolume.curValue );
CVAR_SET_FLOAT( "musicvolume", uiAudio.musicVolume.curValue );
// See if the apply button should be enabled or disabled
uiAudio.apply.generic.flags |= QMF_GRAYED;
if( uiAudioInitial.soundLibrary != uiAudio.soundLibrary.curValue )
{
uiAudio.apply.generic.flags &= ~QMF_GRAYED;
return;
}
if( uiAudioInitial.enableEAX != uiAudio.EAX.enabled )
{
uiAudio.apply.generic.flags &= ~QMF_GRAYED;
return;
}
if( uiAudioInitial.enableA3D != uiAudio.A3D.enabled )
{
uiAudio.apply.generic.flags &= ~QMF_GRAYED;
return;
}
}
/*
=================
UI_Audio_Callback
=================
*/
static void UI_Audio_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_EAX:
case ID_A3D:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_Audio_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
case ID_APPLY:
UI_Audio_SetConfig();
UI_Audio_GetConfig();
UI_Audio_UpdateConfig();
break;
}
}
/*
=================
UI_Audio_Init
=================
*/
static void UI_Audio_Init( void )
{
memset( &uiAudio, 0, sizeof( uiAudio_t ));
strcat( uiAudio.hintText, "Change Xash3D sound engine to get more compatibility\n" );
strcat( uiAudio.hintText, "or enable new features (EAX, Filters etc)" );
uiAudio.background.generic.id = ID_BACKGROUND;
uiAudio.background.generic.type = QMTYPE_BITMAP;
uiAudio.background.generic.flags = QMF_INACTIVE;
uiAudio.background.generic.x = 0;
uiAudio.background.generic.y = 0;
uiAudio.background.generic.width = 1024;
uiAudio.background.generic.height = 768;
uiAudio.background.pic = ART_BACKGROUND;
uiAudio.banner.generic.id = ID_BANNER;
uiAudio.banner.generic.type = QMTYPE_BITMAP;
uiAudio.banner.generic.flags = QMF_INACTIVE;
uiAudio.banner.generic.x = UI_BANNER_POSX;
uiAudio.banner.generic.y = UI_BANNER_POSY;
uiAudio.banner.generic.width = UI_BANNER_WIDTH;
uiAudio.banner.generic.height = UI_BANNER_HEIGHT;
uiAudio.banner.pic = ART_BANNER;
uiAudio.hintMessage.generic.id = ID_MSGHINT;
uiAudio.hintMessage.generic.type = QMTYPE_ACTION;
uiAudio.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiAudio.hintMessage.generic.color = uiColorHelp;
uiAudio.hintMessage.generic.name = uiAudio.hintText;
uiAudio.hintMessage.generic.x = 320;
uiAudio.hintMessage.generic.y = 490;
uiAudio.apply.generic.id = ID_APPLY;
uiAudio.apply.generic.type = QMTYPE_ACTION;
uiAudio.apply.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiAudio.apply.generic.x = 72;
uiAudio.apply.generic.y = 230;
uiAudio.apply.generic.name = "Apply";
uiAudio.apply.generic.statusText = "Apply changes";
uiAudio.apply.generic.callback = UI_Audio_Callback;
uiAudio.done.generic.id = ID_DONE;
uiAudio.done.generic.type = QMTYPE_ACTION;
uiAudio.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiAudio.done.generic.x = 72;
uiAudio.done.generic.y = 280;
uiAudio.done.generic.name = "Done";
uiAudio.done.generic.statusText = "Go back to the Configuration Menu";
uiAudio.done.generic.callback = UI_Audio_Callback;
uiAudio.soundLibrary.generic.id = ID_SOUNDLIBRARY;
uiAudio.soundLibrary.generic.type = QMTYPE_SPINCONTROL;
uiAudio.soundLibrary.generic.flags = QMF_CENTER_JUSTIFY|QMF_SMALLFONT|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiAudio.soundLibrary.generic.x = 360;
uiAudio.soundLibrary.generic.y = 550;
uiAudio.soundLibrary.generic.width = 168;
uiAudio.soundLibrary.generic.height = 26;
uiAudio.soundLibrary.generic.callback = UI_Audio_Callback;
uiAudio.soundLibrary.generic.statusText = "Select audio engine";
uiAudio.soundLibrary.minValue = 0;
uiAudio.soundLibrary.maxValue = 0;
uiAudio.soundLibrary.range = 1;
uiAudio.soundVolume.generic.id = ID_SOUNDVOLUME;
uiAudio.soundVolume.generic.type = QMTYPE_SLIDER;
uiAudio.soundVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.soundVolume.generic.name = "Game sound volume";
uiAudio.soundVolume.generic.x = 320;
uiAudio.soundVolume.generic.y = 280;
uiAudio.soundVolume.generic.callback = UI_Audio_Callback;
uiAudio.soundVolume.generic.statusText = "Set master volume level";
uiAudio.soundVolume.minValue = 0.0;
uiAudio.soundVolume.maxValue = 1.0;
uiAudio.soundVolume.range = 0.05f;
uiAudio.musicVolume.generic.id = ID_MUSICVOLUME;
uiAudio.musicVolume.generic.type = QMTYPE_SLIDER;
uiAudio.musicVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.musicVolume.generic.name = "Game music volume";
uiAudio.musicVolume.generic.x = 320;
uiAudio.musicVolume.generic.y = 340;
uiAudio.musicVolume.generic.callback = UI_Audio_Callback;
uiAudio.musicVolume.generic.statusText = "Set background music volume level";
uiAudio.musicVolume.minValue = 0.0;
uiAudio.musicVolume.maxValue = 1.0;
uiAudio.musicVolume.range = 0.05f;
uiAudio.EAX.generic.id = ID_EAX;
uiAudio.EAX.generic.type = QMTYPE_CHECKBOX;
uiAudio.EAX.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAudio.EAX.generic.name = "Enable EAX 2.0 support";
uiAudio.EAX.generic.x = 320;
uiAudio.EAX.generic.y = 370;
uiAudio.EAX.generic.callback = UI_Audio_Callback;
uiAudio.EAX.generic.statusText = "enable/disable Environmental Audio eXtensions";
uiAudio.A3D.generic.id = ID_A3D;
uiAudio.A3D.generic.type = QMTYPE_CHECKBOX;
uiAudio.A3D.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_GRAYED|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAudio.A3D.generic.name = "Enable A3D 2.0 support";
uiAudio.A3D.generic.x = 320;
uiAudio.A3D.generic.y = 420;
uiAudio.A3D.generic.callback = UI_Audio_Callback;
uiAudio.A3D.generic.statusText = "enable/disable Aureal Audio 3D environment sound";
UI_Audio_GetConfig();
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.background );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.banner );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.done );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.apply );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.hintMessage );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.soundLibrary );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.soundVolume );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.musicVolume );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.EAX );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.A3D );
}
/*
=================
UI_Audio_Precache
=================
*/
void UI_Audio_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_Audio_Menu
=================
*/
void UI_Audio_Menu( void )
{
UI_Audio_Precache();
UI_Audio_Init();
UI_Audio_UpdateConfig();
UI_PushMenu( &uiAudio.menu );
}

View File

@ -0,0 +1,289 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_config"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_CONTROLS 2
#define ID_AUDIO 3
#define ID_VIDEO 4
#define ID_UPDATE 5
#define ID_DONE 6
#define ID_MSGBOX 7
#define ID_MSGTEXT 8
#define ID_YES 9
#define ID_NO 10
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s controls;
menuAction_s audio;
menuAction_s video;
menuAction_s update;
menuAction_s done;
// update dialog
menuAction_s msgBox;
menuAction_s updatePrompt;
menuAction_s yes;
menuAction_s no;
} uiOptions_t;
static uiOptions_t uiOptions;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_CheckUpdatesDialog( void )
{
// toggle configuration menu between active\inactive
// show\hide CheckUpdates dialog
uiOptions.controls.generic.flags ^= QMF_INACTIVE;
uiOptions.audio.generic.flags ^= QMF_INACTIVE;
uiOptions.video.generic.flags ^= QMF_INACTIVE;
uiOptions.update.generic.flags ^= QMF_INACTIVE;
uiOptions.done.generic.flags ^= QMF_INACTIVE;
uiOptions.msgBox.generic.flags ^= QMF_HIDDEN;
uiOptions.updatePrompt.generic.flags ^= QMF_HIDDEN;
uiOptions.no.generic.flags ^= QMF_HIDDEN;
uiOptions.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_Options_KeyFunc
=================
*/
static const char *UI_Options_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiOptions.done.generic.flags & QMF_INACTIVE )
{
UI_CheckUpdatesDialog (); // cancel 'check updates' dialog
return uiSoundNull;
}
return UI_DefaultKey( &uiOptions.menu, key, down );
}
/*
=================
UI_Options_Callback
=================
*/
static void UI_Options_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
case ID_CONTROLS:
UI_Controls_Menu();
break;
case ID_AUDIO:
UI_Audio_Menu();
break;
case ID_VIDEO:
UI_Video_Menu();
break;
case ID_UPDATE:
UI_CheckUpdatesDialog();
break;
case ID_YES:
SHELL_EXECUTE( gMenu.m_gameinfo.update_url, NULL, TRUE );
break;
case ID_NO:
UI_CheckUpdatesDialog();
break;
}
}
/*
=================
UI_Options_Init
=================
*/
static void UI_Options_Init( void )
{
memset( &uiOptions, 0, sizeof( uiOptions_t ));
uiOptions.menu.keyFunc = UI_Options_KeyFunc;
uiOptions.background.generic.id = ID_BACKGROUND;
uiOptions.background.generic.type = QMTYPE_BITMAP;
uiOptions.background.generic.flags = QMF_INACTIVE;
uiOptions.background.generic.x = 0;
uiOptions.background.generic.y = 0;
uiOptions.background.generic.width = 1024;
uiOptions.background.generic.height = 768;
uiOptions.background.pic = ART_BACKGROUND;
uiOptions.banner.generic.id = ID_BANNER;
uiOptions.banner.generic.type = QMTYPE_BITMAP;
uiOptions.banner.generic.flags = QMF_INACTIVE;
uiOptions.banner.generic.x = UI_BANNER_POSX;
uiOptions.banner.generic.y = UI_BANNER_POSY;
uiOptions.banner.generic.width = UI_BANNER_WIDTH;
uiOptions.banner.generic.height = UI_BANNER_HEIGHT;
uiOptions.banner.pic = ART_BANNER;
uiOptions.controls.generic.id = ID_CONTROLS;
uiOptions.controls.generic.type = QMTYPE_ACTION;
uiOptions.controls.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.controls.generic.x = 72;
uiOptions.controls.generic.y = 230;
uiOptions.controls.generic.name = "Controls";
uiOptions.controls.generic.statusText = "Change keyboard and mouse settings";
uiOptions.controls.generic.callback = UI_Options_Callback;
uiOptions.audio.generic.id = ID_AUDIO;
uiOptions.audio.generic.type = QMTYPE_ACTION;
uiOptions.audio.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.audio.generic.x = 72;
uiOptions.audio.generic.y = 280;
uiOptions.audio.generic.name = "Audio";
uiOptions.audio.generic.statusText = "Change sound volume and quality";
uiOptions.audio.generic.callback = UI_Options_Callback;
uiOptions.video.generic.id = ID_VIDEO;
uiOptions.video.generic.type = QMTYPE_ACTION;
uiOptions.video.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.video.generic.x = 72;
uiOptions.video.generic.y = 330;
uiOptions.video.generic.name = "Video";
uiOptions.video.generic.statusText = "Change screen size, video mode and gamma";
uiOptions.video.generic.callback = UI_Options_Callback;
uiOptions.update.generic.id = ID_UPDATE;
uiOptions.update.generic.type = QMTYPE_ACTION;
uiOptions.update.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.update.generic.x = 72;
uiOptions.update.generic.y = 380;
uiOptions.update.generic.name = "Update";
uiOptions.update.generic.statusText = "Donwload the latest version of the Xash3D engine";
uiOptions.update.generic.callback = UI_Options_Callback;
if( !strlen( gMenu.m_gameinfo.update_url ))
uiOptions.update.generic.flags |= QMF_GRAYED;
uiOptions.done.generic.id = ID_DONE;
uiOptions.done.generic.type = QMTYPE_ACTION;
uiOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.done.generic.x = 72;
uiOptions.done.generic.y = 430;
uiOptions.done.generic.name = "Done";
uiOptions.done.generic.statusText = "Go back to the Main Menu";
uiOptions.done.generic.callback = UI_Options_Callback;
uiOptions.msgBox.generic.id = ID_MSGBOX;
uiOptions.msgBox.generic.type = QMTYPE_ACTION;
uiOptions.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiOptions.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiOptions.msgBox.generic.x = 192;
uiOptions.msgBox.generic.y = 256;
uiOptions.msgBox.generic.width = 640;
uiOptions.msgBox.generic.height = 256;
uiOptions.updatePrompt.generic.id = ID_MSGBOX;
uiOptions.updatePrompt.generic.type = QMTYPE_ACTION;
uiOptions.updatePrompt.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiOptions.updatePrompt.generic.name = "Check the Internet for updates?";
uiOptions.updatePrompt.generic.x = 248;
uiOptions.updatePrompt.generic.y = 280;
uiOptions.yes.generic.id = ID_YES;
uiOptions.yes.generic.type = QMTYPE_ACTION;
uiOptions.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiOptions.yes.generic.name = "Ok";
uiOptions.yes.generic.x = 380;
uiOptions.yes.generic.y = 460;
uiOptions.yes.generic.callback = UI_Options_Callback;
uiOptions.no.generic.id = ID_NO;
uiOptions.no.generic.type = QMTYPE_ACTION;
uiOptions.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiOptions.no.generic.name = "Cancel";
uiOptions.no.generic.x = 530;
uiOptions.no.generic.y = 460;
uiOptions.no.generic.callback = UI_Options_Callback;
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.background );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.banner );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.done );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.controls );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.audio );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.video );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.update );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.msgBox );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.updatePrompt );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.no );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.yes );
}
/*
=================
UI_Options_Precache
=================
*/
void UI_Options_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_Options_Menu
=================
*/
void UI_Options_Menu( void )
{
UI_Options_Precache();
UI_Options_Init();
UI_PushMenu( &uiOptions.menu );
}

272
gameui/menu_controls.cpp Normal file
View File

@ -0,0 +1,272 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_controls"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DEFAULTS 2
#define ID_ADVANCED 3
#define ID_DONE 4
#define ID_CANCEL 5
#define ID_KEYLIST 6
#define ID_TABLEHINT 7
#define MAX_KEYS 256
#define CMD_LENGTH 24
#define KEY1_LENGTH 20+CMD_LENGTH
#define KEY2_LENGTH 20+KEY1_LENGTH
typedef struct
{
char keysBind[MAX_KEYS][32];
char firstKey[MAX_KEYS][32];
char secondKey[MAX_KEYS][32];
char keysDescription[MAX_KEYS][80];
char *keysDescriptionPtr[MAX_KEYS];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s defaults;
menuAction_s advanced;
menuAction_s done;
menuAction_s cancel;
menuScrollList_s keysList;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiControls_t;
static uiControls_t uiControls;
/*
=================
UI_Controls_GetKeyBindings
=================
*/
static void UI_Controls_GetKeyBindings( char *command, int *twoKeys )
{
int i, count = 0;
const char *b;
twoKeys[0] = twoKeys[1] = -1;
for( i = 0; i < 256; i++ )
{
b = KEY_GetBinding( i );
if( !b ) continue;
if( !stricmp( command, b ))
{
twoKeys[count] = i;
count++;
if( count == 2 ) break;
}
}
}
/*
=================
UI_Controls_GetKeysList
=================
*/
static void UI_Controls_GetKeysList( void )
{
int i, j;
for( i = j = 0; i < MAX_KEYS; i++ )
{
if( strlen( KEY_GetBinding( i )) == 0 ) continue;
strncpy( uiControls.keysBind[j], KEY_GetBinding( i ), sizeof( uiControls.keysBind[j] ));
strncpy( uiControls.firstKey[j], KEY_KeynumToString( i ), sizeof( uiControls.firstKey[j] ));
strncpy( uiControls.secondKey[j], KEY_KeynumToString( i ), sizeof( uiControls.secondKey[j] ));
strncat( uiControls.keysDescription[j], uiControls.keysBind[j], CMD_LENGTH );
strncat( uiControls.keysDescription[j], uiEmptyString, CMD_LENGTH );
strncat( uiControls.keysDescription[j], uiControls.firstKey[j], KEY1_LENGTH );
strncat( uiControls.keysDescription[j], uiEmptyString, KEY1_LENGTH );
strncat( uiControls.keysDescription[j], uiControls.secondKey[j], KEY2_LENGTH );
strncat( uiControls.keysDescription[j], uiEmptyString, KEY2_LENGTH );
uiControls.keysDescriptionPtr[j] = uiControls.keysDescription[j];
j++;
}
for( ; j < MAX_KEYS; j++ ) uiControls.keysDescriptionPtr[j] = NULL;
uiControls.keysList.itemNames = (const char **)uiControls.keysDescriptionPtr;
}
/*
=================
UI_Controls_Callback
=================
*/
static void UI_Controls_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
case ID_CANCEL:
UI_PopMenu();
break;
case ID_DEFAULTS:
CLIENT_COMMAND( TRUE, "exec keys.def\n" );
UI_Controls_GetKeysList (); // reload all buttons
break;
case ID_ADVANCED:
UI_AdvControls_Menu();
break;
}
}
/*
=================
UI_Controls_Init
=================
*/
static void UI_Controls_Init( void )
{
memset( &uiControls, 0, sizeof( uiControls_t ));
strncat( uiControls.hintText, "Action", CMD_LENGTH );
strncat( uiControls.hintText, uiEmptyString, CMD_LENGTH );
strncat( uiControls.hintText, "Key/Button", KEY1_LENGTH );
strncat( uiControls.hintText, uiEmptyString, KEY1_LENGTH );
strncat( uiControls.hintText, "Alternate", KEY2_LENGTH );
strncat( uiControls.hintText, uiEmptyString, KEY2_LENGTH );
uiControls.background.generic.id = ID_BACKGROUND;
uiControls.background.generic.type = QMTYPE_BITMAP;
uiControls.background.generic.flags = QMF_INACTIVE;
uiControls.background.generic.x = 0;
uiControls.background.generic.y = 0;
uiControls.background.generic.width = 1024;
uiControls.background.generic.height = 768;
uiControls.background.pic = ART_BACKGROUND;
uiControls.banner.generic.id = ID_BANNER;
uiControls.banner.generic.type = QMTYPE_BITMAP;
uiControls.banner.generic.flags = QMF_INACTIVE;
uiControls.banner.generic.x = UI_BANNER_POSX;
uiControls.banner.generic.y = UI_BANNER_POSY;
uiControls.banner.generic.width = UI_BANNER_WIDTH;
uiControls.banner.generic.height = UI_BANNER_HEIGHT;
uiControls.banner.pic = ART_BANNER;
uiControls.defaults.generic.id = ID_DEFAULTS;
uiControls.defaults.generic.type = QMTYPE_ACTION;
uiControls.defaults.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiControls.defaults.generic.x = 72;
uiControls.defaults.generic.y = 230;
uiControls.defaults.generic.name = "Use defaults";
uiControls.defaults.generic.statusText = "Reset all buttons binding to their default values";
uiControls.defaults.generic.callback = UI_Controls_Callback;
uiControls.advanced.generic.id = ID_ADVANCED;
uiControls.advanced.generic.type = QMTYPE_ACTION;
uiControls.advanced.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiControls.advanced.generic.x = 72;
uiControls.advanced.generic.y = 280;
uiControls.advanced.generic.name = "Adv controls";
uiControls.advanced.generic.statusText = "Change mouse sensitivity, enable autoaim, mouselook and crosshair";
uiControls.advanced.generic.callback = UI_Controls_Callback;
uiControls.done.generic.id = ID_DONE;
uiControls.done.generic.type = QMTYPE_ACTION;
uiControls.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiControls.done.generic.x = 72;
uiControls.done.generic.y = 330;
uiControls.done.generic.name = "Ok";
uiControls.done.generic.statusText = "Save changes and return to configuration menu";
uiControls.done.generic.callback = UI_Controls_Callback;
uiControls.cancel.generic.id = ID_CANCEL;
uiControls.cancel.generic.type = QMTYPE_ACTION;
uiControls.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiControls.cancel.generic.x = 72;
uiControls.cancel.generic.y = 380;
uiControls.cancel.generic.name = "Cancel";
uiControls.cancel.generic.statusText = "Discard changes and return to configuration menu";
uiControls.cancel.generic.callback = UI_Controls_Callback;
uiControls.hintMessage.generic.id = ID_TABLEHINT;
uiControls.hintMessage.generic.type = QMTYPE_ACTION;
uiControls.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiControls.hintMessage.generic.color = uiColorHelp;
uiControls.hintMessage.generic.name = uiControls.hintText;
uiControls.hintMessage.generic.x = 360;
uiControls.hintMessage.generic.y = 225;
uiControls.keysList.generic.id = ID_KEYLIST;
uiControls.keysList.generic.type = QMTYPE_SCROLLLIST;
uiControls.keysList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiControls.keysList.generic.x = 360;
uiControls.keysList.generic.y = 255;
uiControls.keysList.generic.width = 640;
uiControls.keysList.generic.height = 440;
uiControls.keysList.generic.callback = UI_Controls_Callback;
UI_Controls_GetKeysList();
UI_AddItem( &uiControls.menu, (void *)&uiControls.background );
UI_AddItem( &uiControls.menu, (void *)&uiControls.banner );
UI_AddItem( &uiControls.menu, (void *)&uiControls.defaults );
UI_AddItem( &uiControls.menu, (void *)&uiControls.advanced );
UI_AddItem( &uiControls.menu, (void *)&uiControls.done );
UI_AddItem( &uiControls.menu, (void *)&uiControls.cancel );
UI_AddItem( &uiControls.menu, (void *)&uiControls.hintMessage );
UI_AddItem( &uiControls.menu, (void *)&uiControls.keysList );
}
/*
=================
UI_Controls_Precache
=================
*/
void UI_Controls_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_Controls_Menu
=================
*/
void UI_Controls_Menu( void )
{
UI_Controls_Precache();
UI_Controls_Init();
UI_PushMenu( &uiControls.menu );
}

431
gameui/menu_creategame.cpp Normal file
View File

@ -0,0 +1,431 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_creategame"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_ADVOPTIONS 2
#define ID_DONE 3
#define ID_CANCEL 4
#define ID_MAPLIST 5
#define ID_TABLEHINT 6
#define ID_MAXCLIENTS 7
#define ID_HOSTNAME 8
#define ID_PASSWORD 9
#define ID_DEDICATED 10
#define ID_MSGBOX 11
#define ID_MSGTEXT 12
#define ID_YES 13
#define ID_NO 14
#define MAPNAME_LENGTH 20
#define TITLE_LENGTH 20+MAPNAME_LENGTH
typedef struct
{
char mapName[UI_MAXGAMES][64];
char mapsDescription[UI_MAXGAMES][256];
char *mapsDescriptionPtr[UI_MAXGAMES];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s advOptions;
menuAction_s done;
menuAction_s cancel;
menuField_s maxClients;
menuField_s hostName;
menuField_s password;
menuCheckBox_s dedicatedServer;
// newgame prompt dialog
menuAction_s msgBox;
menuAction_s dlgMessage1;
menuAction_s dlgMessage2;
menuAction_s yes;
menuAction_s no;
menuScrollList_s mapsList;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiCreateGame_t;
static uiCreateGame_t uiCreateGame;
/*
=================
UI_CreateGame_Begin
=================
*/
static void UI_CreateGame_Begin( void )
{
if( CVAR_GET_FLOAT( "host_serverstate" ))
CLIENT_COMMAND( TRUE, "killserver\n" );
CVAR_SET_FLOAT( "deathmatch", 1.0f ); // FIXME
CVAR_SET_FLOAT( "sv_maxclients", atoi( uiCreateGame.maxClients.buffer ));
CVAR_SET_STRING( "sv_hostname", uiCreateGame.hostName.buffer );
CVAR_SET_STRING( "defaultmap", uiCreateGame.mapName[uiCreateGame.mapsList.curItem] );
HOST_WRITECONFIG ();
// all done, start server
if( uiCreateGame.dedicatedServer.enabled )
{
char cmd[128];
sprintf( cmd, "#%s", gMenu.m_gameinfo.gamefolder );
HOST_CHANGEGAME( cmd, "Starting dedicated server...\n" );
}
else CLIENT_COMMAND( FALSE, "exec server.rc\n" );
}
static void UI_PromptDialog( void )
{
if( !CVAR_GET_FLOAT( "host_serverstate" ))
{
UI_CreateGame_Begin();
return;
}
// toggle main menu between active\inactive
// show\hide quit dialog
uiCreateGame.advOptions.generic.flags ^= QMF_INACTIVE;
uiCreateGame.done.generic.flags ^= QMF_INACTIVE;
uiCreateGame.cancel.generic.flags ^= QMF_INACTIVE;
uiCreateGame.maxClients.generic.flags ^= QMF_INACTIVE;
uiCreateGame.hostName.generic.flags ^= QMF_INACTIVE;
uiCreateGame.password.generic.flags ^= QMF_INACTIVE;
uiCreateGame.dedicatedServer.generic.flags ^= QMF_INACTIVE;
uiCreateGame.mapsList.generic.flags ^= QMF_INACTIVE;
uiCreateGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiCreateGame.dlgMessage1.generic.flags ^= QMF_HIDDEN;
uiCreateGame.dlgMessage2.generic.flags ^= QMF_HIDDEN;
uiCreateGame.no.generic.flags ^= QMF_HIDDEN;
uiCreateGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
/*
=================
UI_CreateGame_GetMapsList
=================
*/
static void UI_CreateGame_GetMapsList( void )
{
char *afile;
// HACKHACK: symbol '†' allow lookup only gamedir not basedir
if( !CHECK_MAP_LIST( FALSE ) || (afile = (char *)LOAD_FILE( "†scripts/maps.lst", NULL )) == NULL )
{
uiCreateGame.done.generic.flags |= QMF_GRAYED;
uiCreateGame.mapsList.itemNames = (const char **)uiCreateGame.mapsDescriptionPtr;
ALERT( at_error, "Cmd_GetMapsList: can't open maps.lst\n" );
return;
}
const char *pfile = afile;
char *token;
int numMaps = 0;
while(( token = COM_ParseToken( &pfile )) != NULL )
{
if( numMaps >= UI_MAXGAMES ) break;
strncat( uiCreateGame.mapName[numMaps], token, sizeof( uiCreateGame.mapName[0] ));
strncat( uiCreateGame.mapsDescription[numMaps], token, MAPNAME_LENGTH );
strncat( uiCreateGame.mapsDescription[numMaps], uiEmptyString, MAPNAME_LENGTH );
if(( token = COM_ParseToken( &pfile )) == NULL ) break; // unexpected end of file
strncat( uiCreateGame.mapsDescription[numMaps], token, TITLE_LENGTH );
strncat( uiCreateGame.mapsDescription[numMaps], uiEmptyString, TITLE_LENGTH );
uiCreateGame.mapsDescriptionPtr[numMaps] = uiCreateGame.mapsDescription[numMaps];
numMaps++;
}
for( ; numMaps < UI_MAXGAMES; numMaps++ ) uiCreateGame.mapsDescriptionPtr[numMaps] = NULL;
uiCreateGame.mapsList.itemNames = (const char **)uiCreateGame.mapsDescriptionPtr;
FREE_FILE( afile );
}
/*
=================
UI_CreateGame_Callback
=================
*/
static void UI_CreateGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_DEDICATED:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_ADVOPTIONS:
// UNDONE: not implemented
break;
case ID_DONE:
UI_PromptDialog();
break;
case ID_CANCEL:
UI_PopMenu();
break;
case ID_YES:
UI_CreateGame_Begin();
break;
case ID_NO:
UI_PromptDialog();
break;
}
}
/*
=================
UI_CreateGame_Init
=================
*/
static void UI_CreateGame_Init( void )
{
memset( &uiCreateGame, 0, sizeof( uiCreateGame_t ));
strncat( uiCreateGame.hintText, "Map", MAPNAME_LENGTH );
strncat( uiCreateGame.hintText, uiEmptyString, MAPNAME_LENGTH );
strncat( uiCreateGame.hintText, "Title", TITLE_LENGTH );
strncat( uiCreateGame.hintText, uiEmptyString, TITLE_LENGTH );
uiCreateGame.background.generic.id = ID_BACKGROUND;
uiCreateGame.background.generic.type = QMTYPE_BITMAP;
uiCreateGame.background.generic.flags = QMF_INACTIVE;
uiCreateGame.background.generic.x = 0;
uiCreateGame.background.generic.y = 0;
uiCreateGame.background.generic.width = 1024;
uiCreateGame.background.generic.height = 768;
uiCreateGame.background.pic = ART_BACKGROUND;
uiCreateGame.banner.generic.id = ID_BANNER;
uiCreateGame.banner.generic.type = QMTYPE_BITMAP;
uiCreateGame.banner.generic.flags = QMF_INACTIVE;
uiCreateGame.banner.generic.x = UI_BANNER_POSX;
uiCreateGame.banner.generic.y = UI_BANNER_POSY;
uiCreateGame.banner.generic.width = UI_BANNER_WIDTH;
uiCreateGame.banner.generic.height = UI_BANNER_HEIGHT;
uiCreateGame.banner.pic = ART_BANNER;
uiCreateGame.advOptions.generic.id = ID_ADVOPTIONS;
uiCreateGame.advOptions.generic.type = QMTYPE_ACTION;
uiCreateGame.advOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_GRAYED;
uiCreateGame.advOptions.generic.x = 72;
uiCreateGame.advOptions.generic.y = 230;
uiCreateGame.advOptions.generic.name = "Adv. Options";
uiCreateGame.advOptions.generic.statusText = "Open the LAN game advanced options menu";
uiCreateGame.advOptions.generic.callback = UI_CreateGame_Callback;
uiCreateGame.done.generic.id = ID_DONE;
uiCreateGame.done.generic.type = QMTYPE_ACTION;
uiCreateGame.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCreateGame.done.generic.x = 72;
uiCreateGame.done.generic.y = 280;
uiCreateGame.done.generic.name = "Ok";
uiCreateGame.done.generic.statusText = "Start the multiplayer game";
uiCreateGame.done.generic.callback = UI_CreateGame_Callback;
uiCreateGame.cancel.generic.id = ID_CANCEL;
uiCreateGame.cancel.generic.type = QMTYPE_ACTION;
uiCreateGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCreateGame.cancel.generic.x = 72;
uiCreateGame.cancel.generic.y = 330;
uiCreateGame.cancel.generic.name = "Cancel";
uiCreateGame.cancel.generic.statusText = "Return to LAN game menu";
uiCreateGame.cancel.generic.callback = UI_CreateGame_Callback;
uiCreateGame.dedicatedServer.generic.id = ID_DEDICATED;
uiCreateGame.dedicatedServer.generic.type = QMTYPE_CHECKBOX;
uiCreateGame.dedicatedServer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiCreateGame.dedicatedServer.generic.name = "Dedicated server";
uiCreateGame.dedicatedServer.generic.x = 72;
uiCreateGame.dedicatedServer.generic.y = 685;
uiCreateGame.dedicatedServer.generic.callback = UI_CreateGame_Callback;
uiCreateGame.dedicatedServer.generic.statusText = "faster, but you can't join the server from this machine";
uiCreateGame.hintMessage.generic.id = ID_TABLEHINT;
uiCreateGame.hintMessage.generic.type = QMTYPE_ACTION;
uiCreateGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiCreateGame.hintMessage.generic.color = uiColorHelp;
uiCreateGame.hintMessage.generic.name = uiCreateGame.hintText;
uiCreateGame.hintMessage.generic.x = 590;
uiCreateGame.hintMessage.generic.y = 215;
uiCreateGame.mapsList.generic.id = ID_MAPLIST;
uiCreateGame.mapsList.generic.type = QMTYPE_SCROLLLIST;
uiCreateGame.mapsList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiCreateGame.mapsList.generic.x = 590;
uiCreateGame.mapsList.generic.y = 245;
uiCreateGame.mapsList.generic.width = 410;
uiCreateGame.mapsList.generic.height = 440;
uiCreateGame.mapsList.generic.callback = UI_CreateGame_Callback;
uiCreateGame.hostName.generic.id = ID_HOSTNAME;
uiCreateGame.hostName.generic.type = QMTYPE_FIELD;
uiCreateGame.hostName.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCreateGame.hostName.generic.name = "Server Name:";
uiCreateGame.hostName.generic.x = 350;
uiCreateGame.hostName.generic.y = 260;
uiCreateGame.hostName.generic.width = 205;
uiCreateGame.hostName.generic.height = 32;
uiCreateGame.hostName.generic.callback = UI_CreateGame_Callback;
uiCreateGame.hostName.maxLength = 16;
strcpy( uiCreateGame.hostName.buffer, CVAR_GET_STRING( "sv_hostname" ));
uiCreateGame.maxClients.generic.id = ID_MAXCLIENTS;
uiCreateGame.maxClients.generic.type = QMTYPE_FIELD;
uiCreateGame.maxClients.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NUMBERSONLY;
uiCreateGame.maxClients.generic.name = "Max Players:";
uiCreateGame.maxClients.generic.x = 350;
uiCreateGame.maxClients.generic.y = 360;
uiCreateGame.maxClients.generic.width = 205;
uiCreateGame.maxClients.generic.height = 32;
uiCreateGame.maxClients.maxLength = 3;
if( CVAR_GET_FLOAT( "sv_maxclients" ) <= 1 )
strcpy( uiCreateGame.maxClients.buffer, "8" );
else sprintf( uiCreateGame.maxClients.buffer, "%i", (int)CVAR_GET_FLOAT( "sv_maxclients" ));
uiCreateGame.password.generic.id = ID_PASSWORD;
uiCreateGame.password.generic.type = QMTYPE_FIELD;
uiCreateGame.password.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCreateGame.password.generic.name = "Password:";
uiCreateGame.password.generic.x = 350;
uiCreateGame.password.generic.y = 460;
uiCreateGame.password.generic.width = 205;
uiCreateGame.password.generic.height = 32;
uiCreateGame.password.generic.callback = UI_CreateGame_Callback;
uiCreateGame.password.maxLength = 16;
uiCreateGame.msgBox.generic.id = ID_MSGBOX;
uiCreateGame.msgBox.generic.type = QMTYPE_ACTION;
uiCreateGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiCreateGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiCreateGame.msgBox.generic.x = 192;
uiCreateGame.msgBox.generic.y = 256;
uiCreateGame.msgBox.generic.width = 640;
uiCreateGame.msgBox.generic.height = 256;
uiCreateGame.dlgMessage1.generic.id = ID_MSGTEXT;
uiCreateGame.dlgMessage1.generic.type = QMTYPE_ACTION;
uiCreateGame.dlgMessage1.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiCreateGame.dlgMessage1.generic.name = "Starting a new game will exit";
uiCreateGame.dlgMessage1.generic.x = 248;
uiCreateGame.dlgMessage1.generic.y = 280;
uiCreateGame.dlgMessage2.generic.id = ID_MSGTEXT;
uiCreateGame.dlgMessage2.generic.type = QMTYPE_ACTION;
uiCreateGame.dlgMessage2.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiCreateGame.dlgMessage2.generic.name = "any current game, OK to exit?";
uiCreateGame.dlgMessage2.generic.x = 248;
uiCreateGame.dlgMessage2.generic.y = 310;
uiCreateGame.yes.generic.id = ID_YES;
uiCreateGame.yes.generic.type = QMTYPE_ACTION;
uiCreateGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiCreateGame.yes.generic.name = "Ok";
uiCreateGame.yes.generic.x = 380;
uiCreateGame.yes.generic.y = 460;
uiCreateGame.yes.generic.callback = UI_CreateGame_Callback;
uiCreateGame.no.generic.id = ID_NO;
uiCreateGame.no.generic.type = QMTYPE_ACTION;
uiCreateGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiCreateGame.no.generic.name = "Cancel";
uiCreateGame.no.generic.x = 530;
uiCreateGame.no.generic.y = 460;
uiCreateGame.no.generic.callback = UI_CreateGame_Callback;
UI_CreateGame_GetMapsList();
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.background );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.banner );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.advOptions );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.done );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.cancel );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.maxClients );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hostName );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.password );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dedicatedServer );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hintMessage );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.mapsList );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.msgBox );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage1 );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage2 );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.no );
UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.yes );
}
/*
=================
UI_CreateGame_Precache
=================
*/
void UI_CreateGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_CreateGame_Menu
=================
*/
void UI_CreateGame_Menu( void )
{
UI_CreateGame_Precache();
UI_CreateGame_Init();
UI_PushMenu( &uiCreateGame.menu );
}

270
gameui/menu_credits.cpp Normal file
View File

@ -0,0 +1,270 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#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
static const char *uiCreditsDefault[] =
{
"^3Xash3D",
"",
"^3PROGRAMMING",
"Uncle Mike",
"",
"^3ART",
"Chorus",
"Small Link",
"The FiEctro",
"",
"^3LEVEL DESIGN",
"Scrama",
"Mitoh",
"",
"",
"^3SPECIAL THANKS",
"Chain Studios et al.",
"",
"",
"",
"",
"",
"",
"^3MUSIC",
"Dj Existence",
"",
"",
"^3THANKS TO",
"ID Software at all",
"Georg Destroy for icon graphics",
"LokiMb for fixed console font",
"",
"",
"",
"",
"",
"",
"",
"^3Xash3D using some parts of:",
"Doom 1 (Id Software)",
"Quake 1 (Id Software)",
"Quake 2 (Id Software)",
"Quake 3 (Id Software)",
"Half-Life (Valve Software)",
"Darkplaces (Darkplaces Team)",
"Quake 2 Evolved (Team Blur)",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Copyright XashXT Group 2010 (C)",
0
};
typedef struct
{
const char **credits;
int startTime;
int showTime;
int fadeTime;
int numLines;
int active;
int finalCredits;
char *index[UI_CREDITS_MAXLINES];
char *buffer;
menuFramework_s menu;
} uiCredits_t;
static uiCredits_t uiCredits;
/*
=================
UI_Credits_DrawFunc
=================
*/
static void UI_Credits_DrawFunc( void )
{
int i, y;
int w = UI_MED_CHAR_WIDTH;
int h = UI_MED_CHAR_HEIGHT;
int color = 0;
// draw the background first
if( !uiCredits.finalCredits )
UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_MAIN_CREDITS );
// otherwise running on cutscene
// now draw the credits
UI_ScaleCoords( NULL, NULL, &w, &h );
y = ActualHeight - (( uiStatic.realTime - uiCredits.startTime ) / 40.0f );
// draw the credits
for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += 20 )
{
// skip not visible lines, but always draw end line
if( y <= -16 && i != uiCredits.numLines - 1 ) continue;
if(( y < ( ActualHeight - h ) / 2 ) && i == uiCredits.numLines - 1 )
{
if( !uiCredits.fadeTime ) uiCredits.fadeTime = uiStatic.realTime;
UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime, color );
if( UnpackAlpha( color ))
UI_DrawString( 0, ( ActualHeight - h ) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true );
}
else UI_DrawString( 0, y, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], uiColorWhite, false, w, h, 1, true );
}
if( y < 0 && UnpackAlpha( color ) == 0 )
{
uiCredits.active = false; // end of credits
UI_PopMenu();
if( uiCredits.finalCredits )
{
HOST_ENDGAME( gMenu.m_gameinfo.title );
}
}
}
/*
=================
UI_Credits_KeyFunc
=================
*/
static const char *UI_Credits_KeyFunc( int key, int down )
{
if( !down ) return uiSoundNull;
// final credits can't be intterupted
if( uiCredits.finalCredits )
return uiSoundNull;
uiCredits.active = false;
UI_PopMenu();
return uiSoundNull;
}
/*
=================
UI_Credits_Init
=================
*/
static void UI_Credits_Init( void )
{
uiCredits.menu.drawFunc = UI_Credits_DrawFunc;
uiCredits.menu.keyFunc = UI_Credits_KeyFunc;
if( !uiCredits.buffer )
{
int count;
char *p;
// load credits if needed
uiCredits.buffer = (char *)LOAD_FILE( UI_CREDITS_PATH, &count );
if( count )
{
p = uiCredits.buffer;
// convert customs credits to 'ideal' strings array
for ( uiCredits.numLines = 0; uiCredits.numLines < UI_CREDITS_MAXLINES; uiCredits.numLines++ )
{
uiCredits.index[uiCredits.numLines] = p;
while ( *p != '\r' && *p != '\n' )
{
p++;
if ( --count == 0 )
break;
}
if ( *p == '\r' )
{
*p++ = 0;
if( --count == 0 ) break;
}
*p++ = 0;
if( --count == 0 ) break;
}
uiCredits.index[++uiCredits.numLines] = 0;
uiCredits.credits = (const char **)uiCredits.index;
}
else
{
// use built-in credits
uiCredits.credits = uiCreditsDefault;
uiCredits.numLines = ( sizeof( uiCreditsDefault ) / sizeof( uiCreditsDefault[0] )) - 1; // skip term
}
}
// run credits
uiCredits.startTime = uiStatic.realTime + 500; // make half-seconds delay
uiCredits.showTime = bound( 100, strlen( uiCredits.credits[uiCredits.numLines - 1]) * 1000, 12000 );
uiCredits.fadeTime = 0; // will be determined later
uiCredits.active = true;
}
int UI_CreditsActive( void )
{
return uiCredits.active;
}
/*
=================
UI_Credits_Precache
=================
*/
void UI_Credits_Precache( void )
{
PIC_Load( ART_MAIN_CREDITS );
}
/*
=================
UI_Credits_Menu
=================
*/
void UI_Credits_Menu( void )
{
UI_Credits_Precache();
UI_Credits_Init();
UI_PushMenu( &uiCredits.menu );
}
void UI_FinalCredits( void )
{
UI_Credits_Menu();
uiCredits.finalCredits = true;
}

366
gameui/menu_customgame.cpp Normal file
View File

@ -0,0 +1,366 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_custom"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_ACTIVATE 2
#define ID_DONE 3
#define ID_GOTOSITE 4
#define ID_MODLIST 5
#define ID_TABLEHINT 6
#define ID_MSGBOX 7
#define ID_MSGTEXT 8
#define ID_YES 9
#define ID_NO 10
#define MAX_MODS 128 // engine limit
#define TYPE_LENGTH 10
#define NAME_LENGTH 32+TYPE_LENGTH
#define VER_LENGTH 10+NAME_LENGTH
#define SIZE_LENGTH 10+VER_LENGTH
typedef struct
{
char modsDir[MAX_MODS][64];
char modsWebSites[MAX_MODS][256];
char modsDescription[MAX_MODS][256];
char *modsDescriptionPtr[MAX_MODS];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s load;
menuAction_s go2url;
menuAction_s done;
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
menuScrollList_s modList;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiCustomGame_t;
static uiCustomGame_t uiCustomGame;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_EndGameDialog( void )
{
// toggle main menu between active\inactive
// show\hide delete dialog
uiCustomGame.load.generic.flags ^= QMF_INACTIVE;
uiCustomGame.go2url.generic.flags ^= QMF_INACTIVE;
uiCustomGame.done.generic.flags ^= QMF_INACTIVE;
uiCustomGame.modList.generic.flags ^= QMF_INACTIVE;
uiCustomGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiCustomGame.promptMessage.generic.flags ^= QMF_HIDDEN;
uiCustomGame.no.generic.flags ^= QMF_HIDDEN;
uiCustomGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_LoadGame_KeyFunc
=================
*/
static const char *UI_CustomGame_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiCustomGame.load.generic.flags & QMF_INACTIVE )
{
UI_EndGameDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiCustomGame.menu, key, down );
}
/*
=================
UI_CustomGame_GetModList
=================
*/
static void UI_CustomGame_GetModList( void )
{
int numGames;
GAMEINFO **games;
games = GET_GAMES_LIST( &numGames );
for( int i = 0; i < numGames; i++ )
{
strncpy( uiCustomGame.modsDir[i], games[i]->gamefolder, sizeof( uiCustomGame.modsDir[i] ));
strncpy( uiCustomGame.modsWebSites[i], games[i]->game_url, sizeof( uiCustomGame.modsWebSites[i] ));
if( strlen( games[i]->type ))
strncat( uiCustomGame.modsDescription[i], games[i]->type, TYPE_LENGTH );
strncat( uiCustomGame.modsDescription[i], uiEmptyString, TYPE_LENGTH );
strncat( uiCustomGame.modsDescription[i], games[i]->title, NAME_LENGTH );
strncat( uiCustomGame.modsDescription[i], uiEmptyString, NAME_LENGTH );
strncat( uiCustomGame.modsDescription[i], games[i]->version, VER_LENGTH );
strncat( uiCustomGame.modsDescription[i], uiEmptyString, VER_LENGTH );
if( strlen( games[i]->size ))
strncat( uiCustomGame.modsDescription[i], games[i]->size, SIZE_LENGTH );
else strncat( uiCustomGame.modsDescription[i], "0.0 Mb", SIZE_LENGTH );
strncat( uiCustomGame.modsDescription[i], uiEmptyString, SIZE_LENGTH );
uiCustomGame.modsDescriptionPtr[i] = uiCustomGame.modsDescription[i];
if( !strcmp( gMenu.m_gameinfo.gamefolder, games[i]->gamefolder ))
uiCustomGame.modList.curItem = i;
}
for( ; i < MAX_MODS; i++ )
uiCustomGame.modsDescriptionPtr[i] = NULL;
uiCustomGame.modList.itemNames = (const char **)uiCustomGame.modsDescriptionPtr;
// see if the load button should be grayed
if( !stricmp( gMenu.m_gameinfo.gamefolder, uiCustomGame.modsDir[uiCustomGame.modList.curItem] ))
uiCustomGame.load.generic.flags |= QMF_GRAYED;
if( strlen( uiCustomGame.modsWebSites[uiCustomGame.modList.curItem] ) == 0 )
uiCustomGame.go2url.generic.flags |= QMF_GRAYED;
}
/*
=================
UI_CustomGame_Callback
=================
*/
static void UI_CustomGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event == QM_CHANGED )
{
// aee if the load button should be grayed
if( !stricmp( gMenu.m_gameinfo.gamefolder, uiCustomGame.modsDir[uiCustomGame.modList.curItem] ))
uiCustomGame.load.generic.flags |= QMF_GRAYED;
else uiCustomGame.load.generic.flags &= ~QMF_GRAYED;
if( strlen( uiCustomGame.modsWebSites[uiCustomGame.modList.curItem] ) == 0 )
uiCustomGame.go2url.generic.flags |= QMF_GRAYED;
else uiCustomGame.go2url.generic.flags &= ~QMF_GRAYED;
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
case ID_GOTOSITE:
if( strlen( uiCustomGame.modsWebSites[uiCustomGame.modList.curItem] ))
SHELL_EXECUTE( uiCustomGame.modsWebSites[uiCustomGame.modList.curItem], NULL, false );
break;
case ID_ACTIVATE:
case ID_NO:
if ( CL_IsActive( ))
{
UI_EndGameDialog();
break; // don't fuck up the game
}
case ID_YES:
// restart all engine systems with new game
char cmd[128];
sprintf( cmd, "game %s\n", uiCustomGame.modsDir[uiCustomGame.modList.curItem] );
CLIENT_COMMAND( FALSE, cmd );
UI_EndGameDialog();
break;
}
}
/*
=================
UI_CustomGame_Init
=================
*/
static void UI_CustomGame_Init( void )
{
memset( &uiCustomGame, 0, sizeof( uiCustomGame_t ));
uiCustomGame.menu.keyFunc = UI_CustomGame_KeyFunc;
strncat( uiCustomGame.hintText, "Type", TYPE_LENGTH );
strncat( uiCustomGame.hintText, uiEmptyString, TYPE_LENGTH );
strncat( uiCustomGame.hintText, "Name", NAME_LENGTH );
strncat( uiCustomGame.hintText, uiEmptyString, NAME_LENGTH );
strncat( uiCustomGame.hintText, "Version", VER_LENGTH );
strncat( uiCustomGame.hintText, uiEmptyString, VER_LENGTH );
strncat( uiCustomGame.hintText, "Size", SIZE_LENGTH );
strncat( uiCustomGame.hintText, uiEmptyString, SIZE_LENGTH );
uiCustomGame.background.generic.id = ID_BACKGROUND;
uiCustomGame.background.generic.type = QMTYPE_BITMAP;
uiCustomGame.background.generic.flags = QMF_INACTIVE;
uiCustomGame.background.generic.x = 0;
uiCustomGame.background.generic.y = 0;
uiCustomGame.background.generic.width = 1024;
uiCustomGame.background.generic.height = 768;
uiCustomGame.background.pic = ART_BACKGROUND;
uiCustomGame.banner.generic.id = ID_BANNER;
uiCustomGame.banner.generic.type = QMTYPE_BITMAP;
uiCustomGame.banner.generic.flags = QMF_INACTIVE;
uiCustomGame.banner.generic.x = UI_BANNER_POSX;
uiCustomGame.banner.generic.y = UI_BANNER_POSY;
uiCustomGame.banner.generic.width = UI_BANNER_WIDTH;
uiCustomGame.banner.generic.height = UI_BANNER_HEIGHT;
uiCustomGame.banner.pic = ART_BANNER;
uiCustomGame.load.generic.id = ID_ACTIVATE;
uiCustomGame.load.generic.type = QMTYPE_ACTION;
uiCustomGame.load.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCustomGame.load.generic.x = 72;
uiCustomGame.load.generic.y = 230;
uiCustomGame.load.generic.name = "Activate";
uiCustomGame.load.generic.statusText = "Activate selected custom game";
uiCustomGame.load.generic.callback = UI_CustomGame_Callback;
uiCustomGame.go2url.generic.id = ID_GOTOSITE;
uiCustomGame.go2url.generic.type = QMTYPE_ACTION;
uiCustomGame.go2url.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCustomGame.go2url.generic.x = 72;
uiCustomGame.go2url.generic.y = 280;
uiCustomGame.go2url.generic.name = "Visit web site";
uiCustomGame.go2url.generic.statusText = "Visit the web site of game developrs";
uiCustomGame.go2url.generic.callback = UI_CustomGame_Callback;
uiCustomGame.done.generic.id = ID_DONE;
uiCustomGame.done.generic.type = QMTYPE_ACTION;
uiCustomGame.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiCustomGame.done.generic.x = 72;
uiCustomGame.done.generic.y = 330;
uiCustomGame.done.generic.name = "Done";
uiCustomGame.done.generic.statusText = "Return to main menu";
uiCustomGame.done.generic.callback = UI_CustomGame_Callback;
uiCustomGame.hintMessage.generic.id = ID_TABLEHINT;
uiCustomGame.hintMessage.generic.type = QMTYPE_ACTION;
uiCustomGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiCustomGame.hintMessage.generic.color = uiColorHelp;
uiCustomGame.hintMessage.generic.name = uiCustomGame.hintText;
uiCustomGame.hintMessage.generic.x = 360;
uiCustomGame.hintMessage.generic.y = 225;
uiCustomGame.modList.generic.id = ID_MODLIST;
uiCustomGame.modList.generic.type = QMTYPE_SCROLLLIST;
uiCustomGame.modList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiCustomGame.modList.generic.x = 360;
uiCustomGame.modList.generic.y = 255;
uiCustomGame.modList.generic.width = 640;
uiCustomGame.modList.generic.height = 440;
uiCustomGame.modList.generic.callback = UI_CustomGame_Callback;
uiCustomGame.msgBox.generic.id = ID_MSGBOX;
uiCustomGame.msgBox.generic.type = QMTYPE_ACTION;
uiCustomGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiCustomGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiCustomGame.msgBox.generic.x = 192;
uiCustomGame.msgBox.generic.y = 256;
uiCustomGame.msgBox.generic.width = 640;
uiCustomGame.msgBox.generic.height = 256;
uiCustomGame.promptMessage.generic.id = ID_MSGBOX;
uiCustomGame.promptMessage.generic.type = QMTYPE_ACTION;
uiCustomGame.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.promptMessage.generic.name = "Leave current game?";
uiCustomGame.promptMessage.generic.x = 315;
uiCustomGame.promptMessage.generic.y = 280;
uiCustomGame.yes.generic.id = ID_YES;
uiCustomGame.yes.generic.type = QMTYPE_ACTION;
uiCustomGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.yes.generic.name = "Ok";
uiCustomGame.yes.generic.x = 380;
uiCustomGame.yes.generic.y = 460;
uiCustomGame.yes.generic.callback = UI_CustomGame_Callback;
uiCustomGame.no.generic.id = ID_NO;
uiCustomGame.no.generic.type = QMTYPE_ACTION;
uiCustomGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.no.generic.name = "Cancel";
uiCustomGame.no.generic.x = 530;
uiCustomGame.no.generic.y = 460;
uiCustomGame.no.generic.callback = UI_CustomGame_Callback;
UI_CustomGame_GetModList();
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.background );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.banner );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.load );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.go2url );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.done );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.hintMessage );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.modList );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.msgBox );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.promptMessage );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.no );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.yes );
}
/*
=================
UI_CustomGame_Precache
=================
*/
void UI_CustomGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_CustomGame_Menu
=================
*/
void UI_CustomGame_Menu( void )
{
UI_CustomGame_Precache();
UI_CustomGame_Init();
UI_PushMenu( &uiCustomGame.menu );
}

304
gameui/menu_gameoptions.cpp Normal file
View File

@ -0,0 +1,304 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_advoptions"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DONE 2
#define ID_CANCEL 3
#define ID_MAXFPS 4
#define ID_MAXFPSMESSAGE 5
#define ID_HAND 6
#define ID_ALLOWDOWNLOAD 7
#define ID_ALWAYSRUN 8
typedef struct
{
float maxFPS;
int hand;
int allowDownload;
int alwaysRun;
} uiGameValues_t;
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s done;
menuAction_s cancel;
menuSpinControl_s maxFPS;
menuAction_s maxFPSmessage;
menuCheckBox_s hand;
menuCheckBox_s allowDownload;
menuCheckBox_s alwaysRun;
} uiGameOptions_t;
static uiGameOptions_t uiGameOptions;
static uiGameValues_t uiGameInitial;
/*
=================
UI_GameOptions_UpdateConfig
=================
*/
static void UI_GameOptions_UpdateConfig( void )
{
static char fpsText[8];
sprintf( fpsText, "%.f", uiGameOptions.maxFPS.curValue );
uiGameOptions.maxFPS.generic.name = fpsText;
CVAR_SET_FLOAT( "hand", uiGameOptions.hand.enabled );
CVAR_SET_FLOAT( "allow_download", uiGameOptions.allowDownload.enabled );
CVAR_SET_FLOAT( "fps_max", uiGameOptions.maxFPS.curValue );
CVAR_SET_FLOAT( "cl_run", uiGameOptions.alwaysRun.enabled );
}
/*
=================
UI_GameOptions_DiscardChanges
=================
*/
static void UI_GameOptions_DiscardChanges( void )
{
CVAR_SET_FLOAT( "hand", uiGameInitial.hand );
CVAR_SET_FLOAT( "allow_download", uiGameInitial.allowDownload );
CVAR_SET_FLOAT( "fps_max", uiGameInitial.maxFPS );
CVAR_SET_FLOAT( "cl_run", uiGameInitial.alwaysRun );
}
/*
=================
UI_GameOptions_KeyFunc
=================
*/
static const char *UI_GameOptions_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE )
UI_GameOptions_DiscardChanges ();
return UI_DefaultKey( &uiGameOptions.menu, key, down );
}
/*
=================
UI_GameOptions_GetConfig
=================
*/
static void UI_GameOptions_GetConfig( void )
{
uiGameInitial.maxFPS = uiGameOptions.maxFPS.curValue = CVAR_GET_FLOAT( "fps_max" );
if( CVAR_GET_FLOAT( "hand" ))
uiGameInitial.hand = uiGameOptions.hand.enabled = 1;
if( CVAR_GET_FLOAT( "cl_run" ))
uiGameInitial.alwaysRun = uiGameOptions.alwaysRun.enabled = 1;
if( CVAR_GET_FLOAT( "allow_download" ))
uiGameInitial.allowDownload = uiGameOptions.allowDownload.enabled = 1;
UI_GameOptions_UpdateConfig ();
}
/*
=================
UI_GameOptions_Callback
=================
*/
static void UI_GameOptions_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_HAND:
case ID_ALLOWDOWNLOAD:
case ID_ALWAYSRUN:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_GameOptions_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
case ID_CANCEL:
UI_GameOptions_DiscardChanges();
UI_PopMenu();
break;
}
}
/*
=================
UI_GameOptions_Init
=================
*/
static void UI_GameOptions_Init( void )
{
memset( &uiGameInitial, 0, sizeof( uiGameValues_t ));
memset( &uiGameOptions, 0, sizeof( uiGameOptions_t ));
uiGameOptions.menu.keyFunc = UI_GameOptions_KeyFunc;
uiGameOptions.background.generic.id = ID_BACKGROUND;
uiGameOptions.background.generic.type = QMTYPE_BITMAP;
uiGameOptions.background.generic.flags = QMF_INACTIVE;
uiGameOptions.background.generic.x = 0;
uiGameOptions.background.generic.y = 0;
uiGameOptions.background.generic.width = 1024;
uiGameOptions.background.generic.height = 768;
uiGameOptions.background.pic = ART_BACKGROUND;
uiGameOptions.banner.generic.id = ID_BANNER;
uiGameOptions.banner.generic.type = QMTYPE_BITMAP;
uiGameOptions.banner.generic.flags = QMF_INACTIVE;
uiGameOptions.banner.generic.x = UI_BANNER_POSX;
uiGameOptions.banner.generic.y = UI_BANNER_POSY;
uiGameOptions.banner.generic.width = UI_BANNER_WIDTH;
uiGameOptions.banner.generic.height = UI_BANNER_HEIGHT;
uiGameOptions.banner.pic = ART_BANNER;
uiGameOptions.done.generic.id = ID_DONE;
uiGameOptions.done.generic.type = QMTYPE_ACTION;
uiGameOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGameOptions.done.generic.x = 72;
uiGameOptions.done.generic.y = 230;
uiGameOptions.done.generic.name = "Done";
uiGameOptions.done.generic.statusText = "Save changes and go back to the Customize Menu";
uiGameOptions.done.generic.callback = UI_GameOptions_Callback;
uiGameOptions.cancel.generic.id = ID_CANCEL;
uiGameOptions.cancel.generic.type = QMTYPE_ACTION;
uiGameOptions.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGameOptions.cancel.generic.x = 72;
uiGameOptions.cancel.generic.y = 280;
uiGameOptions.cancel.generic.name = "Cancel";
uiGameOptions.cancel.generic.statusText = "Go back to the Customize Menu";
uiGameOptions.cancel.generic.callback = UI_GameOptions_Callback;
uiGameOptions.maxFPS.generic.id = ID_MAXFPS;
uiGameOptions.maxFPS.generic.type = QMTYPE_SPINCONTROL;
uiGameOptions.maxFPS.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGameOptions.maxFPS.generic.x = 315;
uiGameOptions.maxFPS.generic.y = 270;
uiGameOptions.maxFPS.generic.width = 168;
uiGameOptions.maxFPS.generic.height = 26;
uiGameOptions.maxFPS.generic.callback = UI_GameOptions_Callback;
uiGameOptions.maxFPS.generic.statusText = "Cap your game frame rate";
uiGameOptions.maxFPS.minValue = 20;
uiGameOptions.maxFPS.maxValue = 500;
uiGameOptions.maxFPS.range = 20;
uiGameOptions.maxFPSmessage.generic.id = ID_MAXFPSMESSAGE;
uiGameOptions.maxFPSmessage.generic.type = QMTYPE_ACTION;
uiGameOptions.maxFPSmessage.generic.flags = QMF_SMALLFONT|QMF_INACTIVE|QMF_DROPSHADOW;
uiGameOptions.maxFPSmessage.generic.x = 280;
uiGameOptions.maxFPSmessage.generic.y = 230;
uiGameOptions.maxFPSmessage.generic.name = "Limit game fps";
uiGameOptions.maxFPSmessage.generic.color = uiColorHelp;
uiGameOptions.hand.generic.id = ID_HAND;
uiGameOptions.hand.generic.type = QMTYPE_CHECKBOX;
uiGameOptions.hand.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiGameOptions.hand.generic.x = 280;
uiGameOptions.hand.generic.y = 330;
uiGameOptions.hand.generic.name = "Use left hand";
uiGameOptions.hand.generic.callback = UI_GameOptions_Callback;
uiGameOptions.hand.generic.statusText = "Draw gun at left side";
uiGameOptions.allowDownload.generic.id = ID_ALLOWDOWNLOAD;
uiGameOptions.allowDownload.generic.type = QMTYPE_CHECKBOX;
uiGameOptions.allowDownload.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiGameOptions.allowDownload.generic.x = 280;
uiGameOptions.allowDownload.generic.y = 390;
uiGameOptions.allowDownload.generic.name = "Allow download";
uiGameOptions.allowDownload.generic.callback = UI_GameOptions_Callback;
uiGameOptions.allowDownload.generic.statusText = "Allow download of files from servers";
uiGameOptions.alwaysRun.generic.id = ID_ALWAYSRUN;
uiGameOptions.alwaysRun.generic.type = QMTYPE_CHECKBOX;
uiGameOptions.alwaysRun.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiGameOptions.alwaysRun.generic.x = 280;
uiGameOptions.alwaysRun.generic.y = 450;
uiGameOptions.alwaysRun.generic.name = "Always run";
uiGameOptions.alwaysRun.generic.callback = UI_GameOptions_Callback;
uiGameOptions.alwaysRun.generic.statusText = "Switch between run/step models when pressed 'run' button";
UI_GameOptions_GetConfig();
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.background );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.banner );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.done );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cancel );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxFPS );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxFPSmessage );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.hand );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.alwaysRun );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.allowDownload );
}
/*
=================
UI_GameOptions_Precache
=================
*/
void UI_GameOptions_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_GameOptions_Menu
=================
*/
void UI_GameOptions_Menu( void )
{
UI_GameOptions_Precache();
UI_GameOptions_Init();
UI_GameOptions_UpdateConfig();
UI_PushMenu( &uiGameOptions.menu );
}

319
gameui/menu_langame.cpp Normal file
View File

@ -0,0 +1,319 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_lan"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_JOINGAME 2
#define ID_CREATEGAME 3
#define ID_GAMEINFO 4
#define ID_REFRESH 5
#define ID_DONE 6
#define ID_SERVERSLIST 7
#define ID_TABLEHINT 8
#define GAME_LENGTH 18
#define MAPNAME_LENGTH 20+GAME_LENGTH
#define TYPE_LENGTH 16+MAPNAME_LENGTH
#define MAXCL_LENGTH 15+TYPE_LENGTH
typedef struct
{
char gameDescription[UI_MAX_SERVERS][256];
char *gameDescriptionPtr[UI_MAX_SERVERS];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s joinGame;
menuAction_s createGame;
menuAction_s gameInfo;
menuAction_s refresh;
menuAction_s done;
menuScrollList_s gameList;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
int refreshTime;
} uiLanGame_t;
static uiLanGame_t uiLanGame;
/*
=================
UI_LanGame_GetGamesList
=================
*/
static void UI_LanGame_GetGamesList( void )
{
int i;
const char *info;
for( i = 0; i < uiStatic.numServers; i++ )
{
if( i >= UI_MAX_SERVERS ) break;
info = uiStatic.serverNames[i];
strncat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "host" ), GAME_LENGTH );
strncat( uiLanGame.gameDescription[i], uiEmptyString, GAME_LENGTH );
strncat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "map" ), MAPNAME_LENGTH );
strncat( uiLanGame.gameDescription[i], uiEmptyString, MAPNAME_LENGTH );
if( !strcmp( Info_ValueForKey( info, "dm" ), "1" ))
strncat( uiLanGame.gameDescription[i], "deathmatch", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "coop" ), "1" ))
strncat( uiLanGame.gameDescription[i], "coop", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "team" ), "1" ))
strncat( uiLanGame.gameDescription[i], "teamplay", TYPE_LENGTH );
strncat( uiLanGame.gameDescription[i], uiEmptyString, TYPE_LENGTH );
strncat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "numcl" ), MAXCL_LENGTH );
strncat( uiLanGame.gameDescription[i], "\\", MAXCL_LENGTH );
strncat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "maxcl" ), MAXCL_LENGTH );
strncat( uiLanGame.gameDescription[i], uiEmptyString, MAXCL_LENGTH );
uiLanGame.gameDescriptionPtr[i] = uiLanGame.gameDescription[i];
}
for( ; i < UI_MAX_SERVERS; i++ )
uiLanGame.gameDescriptionPtr[i] = NULL;
uiLanGame.gameList.itemNames = (const char **)uiLanGame.gameDescriptionPtr;
uiLanGame.gameList.numItems = 0; // reset it
if( !uiLanGame.gameList.generic.charHeight )
return; // to avoid divide integer by zero
// count number of items
while( uiLanGame.gameList.itemNames[uiLanGame.gameList.numItems] )
uiLanGame.gameList.numItems++;
// calculate number of visible rows
uiLanGame.gameList.numRows = (uiLanGame.gameList.generic.height2 / uiLanGame.gameList.generic.charHeight) - 2;
if( uiLanGame.gameList.numRows > uiLanGame.gameList.numItems ) uiLanGame.gameList.numRows = uiLanGame.gameList.numItems;
}
/*
=================
UI_Background_Ownerdraw
=================
*/
static void UI_Background_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic);
if( uiStatic.realTime > uiLanGame.refreshTime )
{
uiLanGame.refreshTime = uiStatic.realTime + 10000; // refresh every 10 secs
UI_RefreshServerList();
}
// serverinfo has been changed update display
if( uiStatic.updateServers )
{
UI_LanGame_GetGamesList ();
uiStatic.updateServers = false;
}
}
/*
=================
UI_LanGame_Callback
=================
*/
static void UI_LanGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_JOINGAME:
if( strlen( uiLanGame.gameDescription[uiLanGame.gameList.curItem] ))
{
CLIENT_JOIN( uiStatic.serverAddresses[uiLanGame.gameList.curItem] );
}
break;
case ID_CREATEGAME:
UI_CreateGame_Menu();
break;
case ID_GAMEINFO:
// UNDONE: not implemented
break;
case ID_REFRESH:
UI_RefreshServerList();
break;
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_LanGame_Init
=================
*/
static void UI_LanGame_Init( void )
{
memset( &uiLanGame, 0, sizeof( uiLanGame_t ));
strncat( uiLanGame.hintText, "Game", GAME_LENGTH );
strncat( uiLanGame.hintText, uiEmptyString, GAME_LENGTH );
strncat( uiLanGame.hintText, "Map", MAPNAME_LENGTH );
strncat( uiLanGame.hintText, uiEmptyString, MAPNAME_LENGTH );
strncat( uiLanGame.hintText, "Type", TYPE_LENGTH );
strncat( uiLanGame.hintText, uiEmptyString, TYPE_LENGTH );
strncat( uiLanGame.hintText, "Num/Max Clients", MAXCL_LENGTH );
strncat( uiLanGame.hintText, uiEmptyString, MAXCL_LENGTH );
uiLanGame.background.generic.id = ID_BACKGROUND;
uiLanGame.background.generic.type = QMTYPE_BITMAP;
uiLanGame.background.generic.flags = QMF_INACTIVE;
uiLanGame.background.generic.x = 0;
uiLanGame.background.generic.y = 0;
uiLanGame.background.generic.width = 1024;
uiLanGame.background.generic.height = 768;
uiLanGame.background.pic = ART_BACKGROUND;
uiLanGame.background.generic.ownerdraw = UI_Background_Ownerdraw;
uiLanGame.banner.generic.id = ID_BANNER;
uiLanGame.banner.generic.type = QMTYPE_BITMAP;
uiLanGame.banner.generic.flags = QMF_INACTIVE;
uiLanGame.banner.generic.x = UI_BANNER_POSX;
uiLanGame.banner.generic.y = UI_BANNER_POSY;
uiLanGame.banner.generic.width = UI_BANNER_WIDTH;
uiLanGame.banner.generic.height = UI_BANNER_HEIGHT;
uiLanGame.banner.pic = ART_BANNER;
uiLanGame.joinGame.generic.id = ID_JOINGAME;
uiLanGame.joinGame.generic.type = QMTYPE_ACTION;
uiLanGame.joinGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLanGame.joinGame.generic.x = 72;
uiLanGame.joinGame.generic.y = 230;
uiLanGame.joinGame.generic.name = "Join game";
uiLanGame.joinGame.generic.statusText = "Join to selected game";
uiLanGame.joinGame.generic.callback = UI_LanGame_Callback;
uiLanGame.createGame.generic.id = ID_CREATEGAME;
uiLanGame.createGame.generic.type = QMTYPE_ACTION;
uiLanGame.createGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLanGame.createGame.generic.x = 72;
uiLanGame.createGame.generic.y = 280;
uiLanGame.createGame.generic.name = "Create game";
uiLanGame.createGame.generic.statusText = "Create new LAN game";
uiLanGame.createGame.generic.callback = UI_LanGame_Callback;
uiLanGame.gameInfo.generic.id = ID_GAMEINFO;
uiLanGame.gameInfo.generic.type = QMTYPE_ACTION;
uiLanGame.gameInfo.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_GRAYED;
uiLanGame.gameInfo.generic.x = 72;
uiLanGame.gameInfo.generic.y = 330;
uiLanGame.gameInfo.generic.name = "View game info";
uiLanGame.gameInfo.generic.statusText = "Get detail game info";
uiLanGame.gameInfo.generic.callback = UI_LanGame_Callback;
uiLanGame.refresh.generic.id = ID_REFRESH;
uiLanGame.refresh.generic.type = QMTYPE_ACTION;
uiLanGame.refresh.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLanGame.refresh.generic.x = 72;
uiLanGame.refresh.generic.y = 380;
uiLanGame.refresh.generic.name = "Refresh";
uiLanGame.refresh.generic.statusText = "Refresh servers list";
uiLanGame.refresh.generic.callback = UI_LanGame_Callback;
uiLanGame.done.generic.id = ID_DONE;
uiLanGame.done.generic.type = QMTYPE_ACTION;
uiLanGame.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLanGame.done.generic.x = 72;
uiLanGame.done.generic.y = 430;
uiLanGame.done.generic.name = "Done";
uiLanGame.done.generic.statusText = "Return to main menu";
uiLanGame.done.generic.callback = UI_LanGame_Callback;
uiLanGame.hintMessage.generic.id = ID_TABLEHINT;
uiLanGame.hintMessage.generic.type = QMTYPE_ACTION;
uiLanGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiLanGame.hintMessage.generic.color = uiColorHelp;
uiLanGame.hintMessage.generic.name = uiLanGame.hintText;
uiLanGame.hintMessage.generic.x = 360;
uiLanGame.hintMessage.generic.y = 225;
uiLanGame.gameList.generic.id = ID_SERVERSLIST;
uiLanGame.gameList.generic.type = QMTYPE_SCROLLLIST;
uiLanGame.gameList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiLanGame.gameList.generic.x = 360;
uiLanGame.gameList.generic.y = 255;
uiLanGame.gameList.generic.width = 640;
uiLanGame.gameList.generic.height = 440;
uiLanGame.gameList.generic.callback = UI_LanGame_Callback;
uiLanGame.gameList.itemNames = (const char **)uiLanGame.gameDescriptionPtr;
char libpath[128];
// server.dll needs for reading savefiles or startup newgame
UI_BuildPath( "server", libpath );
if( !FILE_EXISTS( libpath ))
uiLanGame.createGame.generic.flags |= QMF_GRAYED; // server.dll is missed - remote servers only
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.background );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.banner );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.joinGame );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.createGame );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.gameInfo );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.refresh );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.done );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.hintMessage );
UI_AddItem( &uiLanGame.menu, (void *)&uiLanGame.gameList );
uiLanGame.refreshTime = uiStatic.realTime + 500; // delay before update 0.5 sec
}
/*
=================
UI_LanGame_Precache
=================
*/
void UI_LanGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_LanGame_Menu
=================
*/
void UI_LanGame_Menu( void )
{
UI_LanGame_Precache();
UI_LanGame_Init();
UI_PushMenu( &uiLanGame.menu );
}

456
gameui/menu_loadgame.cpp Normal file
View File

@ -0,0 +1,456 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_load"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_LOAD 2
#define ID_DELETE 3
#define ID_CANCEL 4
#define ID_SAVELIST 5
#define ID_TABLEHINT 6
#define ID_LEVELSHOT 7
#define ID_MSGBOX 8
#define ID_MSGTEXT 9
#define ID_YES 10
#define ID_NO 11
#define LEVELSHOT_X 72
#define LEVELSHOT_Y 400
#define LEVELSHOT_W 192
#define LEVELSHOT_H 160
#define TIME_LENGTH 20
#define NAME_LENGTH 32+TIME_LENGTH
#define GAMETIME_LENGTH 15+NAME_LENGTH
typedef struct
{
char saveName[UI_MAXGAMES][CS_SIZE];
char delName[UI_MAXGAMES][CS_SIZE];
char saveDescription[UI_MAXGAMES][95];
char *saveDescriptionPtr[UI_MAXGAMES];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s load;
menuAction_s remove;
menuAction_s cancel;
menuScrollList_s savesList;
menuBitmap_s levelShot;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
} uiLoadGame_t;
static uiLoadGame_t uiLoadGame;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_DeleteDialog( void )
{
// toggle main menu between active\inactive
// show\hide remove dialog
uiLoadGame.load.generic.flags ^= QMF_INACTIVE;
uiLoadGame.remove.generic.flags ^= QMF_INACTIVE;
uiLoadGame.cancel.generic.flags ^= QMF_INACTIVE;
uiLoadGame.savesList.generic.flags ^= QMF_INACTIVE;
uiLoadGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiLoadGame.promptMessage.generic.flags ^= QMF_HIDDEN;
uiLoadGame.no.generic.flags ^= QMF_HIDDEN;
uiLoadGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_LoadGame_KeyFunc
=================
*/
static const char *UI_LoadGame_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiLoadGame.load.generic.flags & QMF_INACTIVE )
{
UI_DeleteDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiLoadGame.menu, key, down );
}
/*
=================
UI_LoadGame_GetGameList
=================
*/
static void UI_LoadGame_GetGameList( void )
{
char comment[256];
char **filenames;
int i, numFiles;
filenames = FS_SEARCH( "†save/*.sav", &numFiles );
for ( i = 0; i < numFiles; i++ )
{
if( i >= UI_MAXGAMES ) break;
if( !GET_SAVE_COMMENT( filenames[i], comment ))
{
if( strlen( comment ))
{
// get name string even if not found - SV_GetComment can be mark saves
// as <CORRUPTED> <OLD VERSION> etc
strncat( uiLoadGame.saveDescription[i], uiEmptyString, TIME_LENGTH );
strncat( uiLoadGame.saveDescription[i], comment, NAME_LENGTH );
strncat( uiLoadGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
uiLoadGame.saveDescriptionPtr[i] = uiLoadGame.saveDescription[i];
COM_FileBase( filenames[i], uiLoadGame.delName[i] );
}
else uiLoadGame.saveDescriptionPtr[i] = NULL;
continue;
}
// strip path, leave only filename (empty slots doesn't have savename)
COM_FileBase( filenames[i], uiLoadGame.saveName[i] );
COM_FileBase( filenames[i], uiLoadGame.delName[i] );
// fill save desc
strncat( uiLoadGame.saveDescription[i], comment + CS_SIZE, TIME_LENGTH );
strncat( uiLoadGame.saveDescription[i], " ", TIME_LENGTH );
strncat( uiLoadGame.saveDescription[i], comment + CS_SIZE + CS_TIME, TIME_LENGTH );
strncat( uiLoadGame.saveDescription[i], uiEmptyString, TIME_LENGTH ); // fill remaining entries
strncat( uiLoadGame.saveDescription[i], comment, NAME_LENGTH );
strncat( uiLoadGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
strncat( uiLoadGame.saveDescription[i], comment + CS_SIZE + (CS_TIME * 2), GAMETIME_LENGTH );
strncat( uiLoadGame.saveDescription[i], uiEmptyString, GAMETIME_LENGTH );
uiLoadGame.saveDescriptionPtr[i] = uiLoadGame.saveDescription[i];
}
for ( ; i < UI_MAXGAMES; i++ )
uiLoadGame.saveDescriptionPtr[i] = NULL;
uiLoadGame.savesList.itemNames = (const char **)uiLoadGame.saveDescriptionPtr;
if ( strlen( uiLoadGame.saveName[0] ) == 0 )
uiLoadGame.load.generic.flags |= QMF_GRAYED;
else uiLoadGame.load.generic.flags &= ~QMF_GRAYED;
if ( strlen( uiLoadGame.delName[0] ) == 0 )
uiLoadGame.remove.generic.flags |= QMF_GRAYED;
else uiLoadGame.remove.generic.flags &= ~QMF_GRAYED;
}
/*
=================
UI_LoadGame_Callback
=================
*/
static void UI_LoadGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event == QM_CHANGED )
{
if( strlen( uiLoadGame.saveName[uiLoadGame.savesList.curItem] ) == 0 )
uiLoadGame.load.generic.flags |= QMF_GRAYED;
else uiLoadGame.load.generic.flags &= ~QMF_GRAYED;
if( strlen( uiLoadGame.delName[uiLoadGame.savesList.curItem] ) == 0 )
uiLoadGame.remove.generic.flags |= QMF_GRAYED;
else uiLoadGame.remove.generic.flags &= ~QMF_GRAYED;
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CANCEL:
UI_PopMenu();
break;
case ID_LOAD:
if( strlen( uiLoadGame.saveName[uiLoadGame.savesList.curItem] ))
{
char cmd[128];
sprintf( cmd, "load \"%s\"\n", uiLoadGame.saveName[uiLoadGame.savesList.curItem] );
CLIENT_COMMAND( FALSE, cmd );
}
break;
case ID_NO:
case ID_DELETE:
UI_DeleteDialog();
break;
case ID_YES:
if( strlen( uiLoadGame.delName[uiLoadGame.savesList.curItem] ))
{
char cmd[128];
sprintf( cmd, "killsave \"%s\"\n", uiLoadGame.delName[uiLoadGame.savesList.curItem] );
CLIENT_COMMAND( TRUE, cmd );
// FIXME: get saveshot extension from engine
sprintf( cmd, "save/%s.tga", uiLoadGame.delName[uiLoadGame.savesList.curItem] );
PIC_Free( cmd );
UI_LoadGame_GetGameList();
}
UI_DeleteDialog();
break;
}
}
/*
=================
UI_LoadGame_Ownerdraw
=================
*/
static void UI_LoadGame_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( item->type != QMTYPE_ACTION && item->id == ID_LEVELSHOT )
{
int x, y, w, h;
// draw the levelshot
x = LEVELSHOT_X;
y = LEVELSHOT_Y;
w = LEVELSHOT_W;
h = LEVELSHOT_H;
UI_ScaleCoords( &x, &y, &w, &h );
if( strlen( uiLoadGame.saveName[uiLoadGame.savesList.curItem] ))
{
char saveshot[128];
// FIXME: get saveshot extension from engine
sprintf( saveshot, "save/%s.tga", uiLoadGame.saveName[uiLoadGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
}
}
/*
=================
UI_LoadGame_Init
=================
*/
static void UI_LoadGame_Init( void )
{
memset( &uiLoadGame, 0, sizeof( uiLoadGame_t ));
uiLoadGame.menu.keyFunc = UI_LoadGame_KeyFunc;
strncat( uiLoadGame.hintText, "Time", TIME_LENGTH );
strncat( uiLoadGame.hintText, uiEmptyString, TIME_LENGTH );
strncat( uiLoadGame.hintText, "Game", NAME_LENGTH );
strncat( uiLoadGame.hintText, uiEmptyString, NAME_LENGTH );
strncat( uiLoadGame.hintText, "Elapsed time", GAMETIME_LENGTH );
strncat( uiLoadGame.hintText, uiEmptyString, GAMETIME_LENGTH );
uiLoadGame.background.generic.id = ID_BACKGROUND;
uiLoadGame.background.generic.type = QMTYPE_BITMAP;
uiLoadGame.background.generic.flags = QMF_INACTIVE;
uiLoadGame.background.generic.x = 0;
uiLoadGame.background.generic.y = 0;
uiLoadGame.background.generic.width = 1024;
uiLoadGame.background.generic.height = 768;
uiLoadGame.background.pic = ART_BACKGROUND;
uiLoadGame.banner.generic.id = ID_BANNER;
uiLoadGame.banner.generic.type = QMTYPE_BITMAP;
uiLoadGame.banner.generic.flags = QMF_INACTIVE;
uiLoadGame.banner.generic.x = UI_BANNER_POSX;
uiLoadGame.banner.generic.y = UI_BANNER_POSY;
uiLoadGame.banner.generic.width = UI_BANNER_WIDTH;
uiLoadGame.banner.generic.height = UI_BANNER_HEIGHT;
uiLoadGame.banner.pic = ART_BANNER;
uiLoadGame.load.generic.id = ID_LOAD;
uiLoadGame.load.generic.type = QMTYPE_ACTION;
uiLoadGame.load.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLoadGame.load.generic.x = 72;
uiLoadGame.load.generic.y = 230;
uiLoadGame.load.generic.name = "Load";
uiLoadGame.load.generic.statusText = "Load saved game";
uiLoadGame.load.generic.callback = UI_LoadGame_Callback;
uiLoadGame.remove.generic.id = ID_DELETE;
uiLoadGame.remove.generic.type = QMTYPE_ACTION;
uiLoadGame.remove.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLoadGame.remove.generic.x = 72;
uiLoadGame.remove.generic.y = 280;
uiLoadGame.remove.generic.name = "Delete";
uiLoadGame.remove.generic.statusText = "Delete saved game";
uiLoadGame.remove.generic.callback = UI_LoadGame_Callback;
uiLoadGame.cancel.generic.id = ID_CANCEL;
uiLoadGame.cancel.generic.type = QMTYPE_ACTION;
uiLoadGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLoadGame.cancel.generic.x = 72;
uiLoadGame.cancel.generic.y = 330;
uiLoadGame.cancel.generic.name = "Cancel";
uiLoadGame.cancel.generic.statusText = "Return back to main menu";
uiLoadGame.cancel.generic.callback = UI_LoadGame_Callback;
uiLoadGame.hintMessage.generic.id = ID_TABLEHINT;
uiLoadGame.hintMessage.generic.type = QMTYPE_ACTION;
uiLoadGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiLoadGame.hintMessage.generic.color = uiColorHelp;
uiLoadGame.hintMessage.generic.name = uiLoadGame.hintText;
uiLoadGame.hintMessage.generic.x = 360;
uiLoadGame.hintMessage.generic.y = 225;
uiLoadGame.levelShot.generic.id = ID_LEVELSHOT;
uiLoadGame.levelShot.generic.type = QMTYPE_BITMAP;
uiLoadGame.levelShot.generic.flags = QMF_INACTIVE;
uiLoadGame.levelShot.generic.x = LEVELSHOT_X;
uiLoadGame.levelShot.generic.y = LEVELSHOT_Y;
uiLoadGame.levelShot.generic.width = LEVELSHOT_W;
uiLoadGame.levelShot.generic.height = LEVELSHOT_H;
uiLoadGame.levelShot.generic.ownerdraw = UI_LoadGame_Ownerdraw;
uiLoadGame.savesList.generic.id = ID_SAVELIST;
uiLoadGame.savesList.generic.type = QMTYPE_SCROLLLIST;
uiLoadGame.savesList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
uiLoadGame.savesList.generic.x = 360;
uiLoadGame.savesList.generic.y = 255;
uiLoadGame.savesList.generic.width = 640;
uiLoadGame.savesList.generic.height = 440;
uiLoadGame.savesList.generic.callback = UI_LoadGame_Callback;
uiLoadGame.msgBox.generic.id = ID_MSGBOX;
uiLoadGame.msgBox.generic.type = QMTYPE_ACTION;
uiLoadGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiLoadGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiLoadGame.msgBox.generic.x = 192;
uiLoadGame.msgBox.generic.y = 256;
uiLoadGame.msgBox.generic.width = 640;
uiLoadGame.msgBox.generic.height = 256;
uiLoadGame.promptMessage.generic.id = ID_MSGBOX;
uiLoadGame.promptMessage.generic.type = QMTYPE_ACTION;
uiLoadGame.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiLoadGame.promptMessage.generic.name = "Delete selected game?";
uiLoadGame.promptMessage.generic.x = 315;
uiLoadGame.promptMessage.generic.y = 280;
uiLoadGame.yes.generic.id = ID_YES;
uiLoadGame.yes.generic.type = QMTYPE_ACTION;
uiLoadGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiLoadGame.yes.generic.name = "Ok";
uiLoadGame.yes.generic.x = 380;
uiLoadGame.yes.generic.y = 460;
uiLoadGame.yes.generic.callback = UI_LoadGame_Callback;
uiLoadGame.no.generic.id = ID_NO;
uiLoadGame.no.generic.type = QMTYPE_ACTION;
uiLoadGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiLoadGame.no.generic.name = "Cancel";
uiLoadGame.no.generic.x = 530;
uiLoadGame.no.generic.y = 460;
uiLoadGame.no.generic.callback = UI_LoadGame_Callback;
UI_LoadGame_GetGameList();
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.background );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.banner );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.load );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.remove );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.cancel );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.hintMessage );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.levelShot );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.savesList );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.msgBox );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.promptMessage );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.no );
UI_AddItem( &uiLoadGame.menu, (void *)&uiLoadGame.yes );
}
/*
=================
UI_LoadGame_Precache
=================
*/
void UI_LoadGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_LoadGame_Menu
=================
*/
void UI_LoadGame_Menu( void )
{
if( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY )
{
// completely ignore save\load menus for multiplayer_only
UI_PlayDemo_Menu();
return;
}
char libpath[128];
UI_BuildPath( "server", libpath );
if( !FILE_EXISTS( libpath )) return;
UI_LoadGame_Precache();
UI_LoadGame_Init();
UI_PushMenu( &uiLoadGame.menu );
}

582
gameui/menu_main.cpp Normal file
View File

@ -0,0 +1,582 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_MINIMIZE_N "gfx/shell/min_n"
#define ART_MINIMIZE_F "gfx/shell/min_f"
#define ART_MINIMIZE_D "gfx/shell/min_d"
#define ART_CLOSEBTN_N "gfx/shell/cls_n"
#define ART_CLOSEBTN_F "gfx/shell/cls_f"
#define ART_CLOSEBTN_D "gfx/shell/cls_d"
#define ID_BACKGROUND 0
#define ID_CONSOLE 1
#define ID_RESUME 2
#define ID_NEWGAME 3
#define ID_HAZARDCOURSE 4
#define ID_CONFIGURATION 5
#define ID_SAVERESTORE 6
#define ID_PLAYRECORD 7
#define ID_MULTIPLAYER 8
#define ID_CUSTOMGAME 9
#define ID_CREDITS 10
#define ID_QUIT 11
#define ID_QUIT_BUTTON 12
#define ID_MINIMIZE 13
#define ID_MSGBOX 14
#define ID_MSGTEXT 15
#define ID_YES 16
#define ID_NO 17
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuAction_s console;
menuAction_s resumeGame;
menuAction_s newGame;
menuAction_s hazardCourse;
menuAction_s configuration;
menuAction_s saveRestore;
menuAction_s playRecord;
menuAction_s multiPlayer;
menuAction_s customGame;
menuAction_s credits;
menuAction_s quit;
menuBitmap_s minimizeBtn;
menuBitmap_s quitButton;
// quit dialog
menuAction_s msgBox;
menuAction_s quitMessage;
menuAction_s dlgMessage1;
menuAction_s dlgMessage2;
menuAction_s yes;
menuAction_s no;
} uiMain_t;
static uiMain_t uiMain;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_QuitDialog( void )
{
// toggle main menu between active\inactive
// show\hide quit dialog
uiMain.console.generic.flags ^= QMF_INACTIVE;
uiMain.resumeGame.generic.flags ^= QMF_INACTIVE;
uiMain.newGame.generic.flags ^= QMF_INACTIVE;
uiMain.hazardCourse.generic.flags ^= QMF_INACTIVE;
uiMain.saveRestore.generic.flags ^= QMF_INACTIVE;
uiMain.playRecord.generic.flags ^= QMF_INACTIVE;
uiMain.configuration.generic.flags ^= QMF_INACTIVE;
uiMain.multiPlayer.generic.flags ^= QMF_INACTIVE;
uiMain.customGame.generic.flags ^= QMF_INACTIVE;
uiMain.credits.generic.flags ^= QMF_INACTIVE;
uiMain.quit.generic.flags ^= QMF_INACTIVE;
uiMain.minimizeBtn.generic.flags ^= QMF_INACTIVE;
uiMain.quitButton.generic.flags ^= QMF_INACTIVE;
uiMain.msgBox.generic.flags ^= QMF_HIDDEN;
uiMain.quitMessage.generic.flags ^= QMF_HIDDEN;
uiMain.no.generic.flags ^= QMF_HIDDEN;
uiMain.yes.generic.flags ^= QMF_HIDDEN;
}
static void UI_PromptDialog( void )
{
// toggle main menu between active\inactive
// show\hide quit dialog
uiMain.console.generic.flags ^= QMF_INACTIVE;
uiMain.resumeGame.generic.flags ^= QMF_INACTIVE;
uiMain.newGame.generic.flags ^= QMF_INACTIVE;
uiMain.hazardCourse.generic.flags ^= QMF_INACTIVE;
uiMain.saveRestore.generic.flags ^= QMF_INACTIVE;
uiMain.playRecord.generic.flags ^= QMF_INACTIVE;
uiMain.configuration.generic.flags ^= QMF_INACTIVE;
uiMain.multiPlayer.generic.flags ^= QMF_INACTIVE;
uiMain.customGame.generic.flags ^= QMF_INACTIVE;
uiMain.credits.generic.flags ^= QMF_INACTIVE;
uiMain.quit.generic.flags ^= QMF_INACTIVE;
uiMain.minimizeBtn.generic.flags ^= QMF_INACTIVE;
uiMain.quitButton.generic.flags ^= QMF_INACTIVE;
uiMain.msgBox.generic.flags ^= QMF_HIDDEN;
uiMain.dlgMessage1.generic.flags ^= QMF_HIDDEN;
uiMain.dlgMessage2.generic.flags ^= QMF_HIDDEN;
uiMain.no.generic.flags ^= QMF_HIDDEN;
uiMain.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_Main_KeyFunc
=================
*/
static const char *UI_Main_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE )
{
if ( CL_IsActive( ))
UI_CloseMenu();
else UI_QuitDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiMain.menu, key, down );
}
/*
=================
UI_Main_ActivateFunc
=================
*/
static void UI_Main_ActivateFunc( void )
{
if ( !CL_IsActive( ))
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
if( gpGlobals->developer )
{
uiMain.console.generic.y = CL_IsActive() ? 130 : 180;
UI_ScaleCoords( NULL, &uiMain.console.generic.y, NULL, NULL );
}
}
/*
=================
UI_Main_HazardCourse
=================
*/
static void UI_Main_HazardCourse( void )
{
CVAR_SET_FLOAT( "skill", 0.0f );
CVAR_SET_FLOAT( "deathmatch", 0.0f );
CVAR_SET_FLOAT( "gamerules", 0.0f );
CVAR_SET_FLOAT( "teamplay", 0.0f );
CVAR_SET_FLOAT( "pausable", 1.0f ); // singleplayer is always allowing pause
CVAR_SET_FLOAT( "coop", 0.0f );
HOST_NEWGAME( gMenu.m_gameinfo.trainmap );
}
/*
=================
UI_Main_Callback
=================
*/
static void UI_Main_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_QUIT_BUTTON:
if( event == QM_PRESSED )
((menuBitmap_s *)self)->focusPic = ART_CLOSEBTN_D;
else ((menuBitmap_s *)self)->focusPic = ART_CLOSEBTN_F;
break;
case ID_MINIMIZE:
if( event == QM_PRESSED )
((menuBitmap_s *)self)->focusPic = ART_MINIMIZE_D;
else ((menuBitmap_s *)self)->focusPic = ART_MINIMIZE_F;
break;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CONSOLE:
UI_SetActiveMenu( FALSE );
KEY_SetDest( KEY_CONSOLE );
break;
case ID_RESUME:
UI_CloseMenu();
break;
case ID_NEWGAME:
UI_NewGame_Menu();
break;
case ID_HAZARDCOURSE:
if( CL_IsActive( ))
UI_PromptDialog();
else UI_Main_HazardCourse();
break;
case ID_MULTIPLAYER:
UI_MultiPlayer_Menu();
break;
case ID_CONFIGURATION:
UI_Options_Menu();
break;
case ID_SAVERESTORE:
if( CL_IsActive( ))
UI_SaveLoad_Menu();
else UI_LoadGame_Menu();
break;
case ID_PLAYRECORD:
if( CL_IsActive( ) && !gpGlobals->demoplayback )
UI_PlayRec_Menu();
else UI_PlayDemo_Menu();
break;
case ID_CUSTOMGAME:
UI_CustomGame_Menu();
break;
case ID_CREDITS:
UI_Credits_Menu();
break;
case ID_QUIT:
case ID_QUIT_BUTTON:
UI_QuitDialog();
break;
case ID_MINIMIZE:
CLIENT_COMMAND( FALSE, "minimize\n" );
break;
case ID_YES:
if( !( uiMain.quitMessage.generic.flags & QMF_HIDDEN ))
CLIENT_COMMAND( FALSE, "quit\n" );
else UI_Main_HazardCourse();
break;
case ID_NO:
if( !( uiMain.quitMessage.generic.flags & QMF_HIDDEN ))
UI_QuitDialog();
else UI_PromptDialog();
break;
}
}
/*
=================
UI_Main_Init
=================
*/
static void UI_Main_Init( void )
{
memset( &uiMain, 0, sizeof( uiMain_t ));
uiMain.menu.keyFunc = UI_Main_KeyFunc;
uiMain.menu.activateFunc = UI_Main_ActivateFunc;
uiMain.background.generic.id = ID_BACKGROUND;
uiMain.background.generic.type = QMTYPE_BITMAP;
uiMain.background.generic.flags = QMF_INACTIVE;
uiMain.background.generic.x = 0;
uiMain.background.generic.y = 0;
uiMain.background.generic.width = 1024;
uiMain.background.generic.height = 768;
uiMain.background.pic = ART_MAIN_SPLASH;
uiMain.console.generic.id = ID_CONSOLE;
uiMain.console.generic.type = QMTYPE_ACTION;
uiMain.console.generic.name = "Console";
uiMain.console.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiMain.console.generic.x = 72;
uiMain.console.generic.y = CL_IsActive() ? 130 : 180;
uiMain.console.generic.callback = UI_Main_Callback;
uiMain.resumeGame.generic.id = ID_RESUME;
uiMain.resumeGame.generic.type = QMTYPE_ACTION;
uiMain.resumeGame.generic.name = "Resume game";
uiMain.resumeGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.resumeGame.generic.statusText = "Return to game.";
uiMain.resumeGame.generic.x = 72;
uiMain.resumeGame.generic.y = 180;
uiMain.resumeGame.generic.callback = UI_Main_Callback;
uiMain.newGame.generic.id = ID_NEWGAME;
uiMain.newGame.generic.type = QMTYPE_ACTION;
uiMain.newGame.generic.name = "New game";
uiMain.newGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.newGame.generic.statusText = "Start a new game.";
uiMain.newGame.generic.x = 72;
uiMain.newGame.generic.y = 230;
uiMain.newGame.generic.callback = UI_Main_Callback;
if ( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY || !strlen( gMenu.m_gameinfo.startmap ))
uiMain.newGame.generic.flags |= QMF_GRAYED;
uiMain.hazardCourse.generic.id = ID_HAZARDCOURSE;
uiMain.hazardCourse.generic.type = QMTYPE_ACTION;
uiMain.hazardCourse.generic.name = "Hazard course";
uiMain.hazardCourse.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.hazardCourse.generic.statusText = "Learn how to play the game";
uiMain.hazardCourse.generic.x = 72;
uiMain.hazardCourse.generic.y = 280;
uiMain.hazardCourse.generic.callback = UI_Main_Callback;
if ( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY )
{
uiMain.playRecord.generic.id = ID_PLAYRECORD;
uiMain.playRecord.generic.type = QMTYPE_ACTION;
uiMain.playRecord.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
if ( CL_IsActive( ))
{
if ( !gpGlobals->demoplayback )
{
uiMain.playRecord.generic.name = "Play\\Rec Demo";
uiMain.playRecord.generic.statusText = "Play a demo, record the new demo.";
uiMain.resumeGame.generic.name = "Resume Game";
uiMain.resumeGame.generic.statusText = "Return to game.";
}
else
{
uiMain.playRecord.generic.name = "Play Demo";
uiMain.playRecord.generic.statusText = "Play a game demo.";
uiMain.resumeGame.generic.name = "Resume Demo";
uiMain.resumeGame.generic.statusText = "Return to demo.";
}
}
else
{
uiMain.playRecord.generic.name = "Play Demo";
uiMain.playRecord.generic.statusText = "Play a recorded game movie.";
uiMain.resumeGame.generic.name = "Resume Game";
uiMain.resumeGame.generic.statusText = "Return to game.";
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
}
uiMain.playRecord.generic.x = 72;
uiMain.playRecord.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 330 : 280;
uiMain.playRecord.generic.callback = UI_Main_Callback;
}
else
{
uiMain.saveRestore.generic.id = ID_SAVERESTORE;
uiMain.saveRestore.generic.type = QMTYPE_ACTION;
uiMain.saveRestore.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
char libpath[128];
// server.dll needs for reading savefiles or startup newgame
UI_BuildPath( "server", libpath );
if( !FILE_EXISTS( libpath ))
{
uiMain.saveRestore.generic.flags |= QMF_GRAYED;
uiMain.newGame.generic.flags |= QMF_GRAYED;
}
if ( CL_IsActive( ))
{
uiMain.saveRestore.generic.name = "Save\\Load Game";
uiMain.saveRestore.generic.statusText = "Load a saved game, save the current game.";
}
else
{
uiMain.saveRestore.generic.name = "Load Game";
uiMain.saveRestore.generic.statusText = "Load a previously saved game.";
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
}
uiMain.saveRestore.generic.x = 72;
uiMain.saveRestore.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 330 : 280;
uiMain.saveRestore.generic.callback = UI_Main_Callback;
}
uiMain.configuration.generic.id = ID_CONFIGURATION;
uiMain.configuration.generic.type = QMTYPE_ACTION;
uiMain.configuration.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.configuration.generic.name = "Configuration";
uiMain.configuration.generic.statusText = "Change game settings, configure controls";
uiMain.configuration.generic.x = 72;
uiMain.configuration.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 380 : 330;
uiMain.configuration.generic.callback = UI_Main_Callback;
uiMain.multiPlayer.generic.id = ID_MULTIPLAYER;
uiMain.multiPlayer.generic.type = QMTYPE_ACTION;
uiMain.multiPlayer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.multiPlayer.generic.name = "Multiplayer";
uiMain.multiPlayer.generic.statusText = "Search for internet servers, configure character";
uiMain.multiPlayer.generic.x = 72;
uiMain.multiPlayer.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 430 : 380;
uiMain.multiPlayer.generic.callback = UI_Main_Callback;
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
uiMain.multiPlayer.generic.flags |= QMF_GRAYED;
uiMain.customGame.generic.id = ID_CUSTOMGAME;
uiMain.customGame.generic.type = QMTYPE_ACTION;
uiMain.customGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.customGame.generic.name = "Custom Game";
uiMain.customGame.generic.statusText = "Select a custom game";
uiMain.customGame.generic.x = 72;
uiMain.customGame.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 480 : 430;
uiMain.customGame.generic.callback = UI_Main_Callback;
uiMain.credits.generic.id = ID_CREDITS;
uiMain.credits.generic.type = QMTYPE_ACTION;
uiMain.credits.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.credits.generic.name = "About";
uiMain.credits.generic.statusText = "Game credits";
uiMain.credits.generic.x = 72;
uiMain.credits.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 530 : 480;
uiMain.credits.generic.callback = UI_Main_Callback;
uiMain.quit.generic.id = ID_QUIT;
uiMain.quit.generic.type = QMTYPE_ACTION;
uiMain.quit.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.quit.generic.name = "Quit";
uiMain.quit.generic.statusText = "Quit from game";
uiMain.quit.generic.x = 72;
uiMain.quit.generic.y = strlen( gMenu.m_gameinfo.trainmap ) ? 580 : 530;
uiMain.quit.generic.callback = UI_Main_Callback;
uiMain.minimizeBtn.generic.id = ID_MINIMIZE;
uiMain.minimizeBtn.generic.type = QMTYPE_BITMAP;
uiMain.minimizeBtn.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_MOUSEONLY|QMF_ACT_ONRELEASE;
uiMain.minimizeBtn.generic.x = 952;
uiMain.minimizeBtn.generic.y = 13;
uiMain.minimizeBtn.generic.width = 32;
uiMain.minimizeBtn.generic.height = 32;
uiMain.minimizeBtn.generic.callback = UI_Main_Callback;
uiMain.minimizeBtn.pic = ART_MINIMIZE_N;
uiMain.minimizeBtn.focusPic = ART_MINIMIZE_F;
uiMain.quitButton.generic.id = ID_QUIT_BUTTON;
uiMain.quitButton.generic.type = QMTYPE_BITMAP;
uiMain.quitButton.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_MOUSEONLY|QMF_ACT_ONRELEASE;
uiMain.quitButton.generic.x = 984;
uiMain.quitButton.generic.y = 13;
uiMain.quitButton.generic.width = 32;
uiMain.quitButton.generic.height = 32;
uiMain.quitButton.generic.callback = UI_Main_Callback;
uiMain.quitButton.pic = ART_CLOSEBTN_N;
uiMain.quitButton.focusPic = ART_CLOSEBTN_F;
uiMain.msgBox.generic.id = ID_MSGBOX;
uiMain.msgBox.generic.type = QMTYPE_ACTION;
uiMain.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiMain.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiMain.msgBox.generic.x = 192;
uiMain.msgBox.generic.y = 256;
uiMain.msgBox.generic.width = 640;
uiMain.msgBox.generic.height = 256;
uiMain.quitMessage.generic.id = ID_MSGBOX;
uiMain.quitMessage.generic.type = QMTYPE_ACTION;
uiMain.quitMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.quitMessage.generic.name = "Are you sure you want to quit?";
uiMain.quitMessage.generic.x = 248;
uiMain.quitMessage.generic.y = 280;
uiMain.dlgMessage1.generic.id = ID_MSGTEXT;
uiMain.dlgMessage1.generic.type = QMTYPE_ACTION;
uiMain.dlgMessage1.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiMain.dlgMessage1.generic.name = "Starting a Hazard Course will exit";
uiMain.dlgMessage1.generic.x = 212;
uiMain.dlgMessage1.generic.y = 280;
uiMain.dlgMessage2.generic.id = ID_MSGTEXT;
uiMain.dlgMessage2.generic.type = QMTYPE_ACTION;
uiMain.dlgMessage2.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiMain.dlgMessage2.generic.name = "any current game, OK to exit?";
uiMain.dlgMessage2.generic.x = 256;
uiMain.dlgMessage2.generic.y = 310;
uiMain.yes.generic.id = ID_YES;
uiMain.yes.generic.type = QMTYPE_ACTION;
uiMain.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.yes.generic.name = "Ok";
uiMain.yes.generic.x = 380;
uiMain.yes.generic.y = 460;
uiMain.yes.generic.callback = UI_Main_Callback;
uiMain.no.generic.id = ID_NO;
uiMain.no.generic.type = QMTYPE_ACTION;
uiMain.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.no.generic.name = "Cancel";
uiMain.no.generic.x = 530;
uiMain.no.generic.y = 460;
uiMain.no.generic.callback = UI_Main_Callback;
UI_AddItem( &uiMain.menu, (void *)&uiMain.background );
if ( gpGlobals->developer )
UI_AddItem( &uiMain.menu, (void *)&uiMain.console );
UI_AddItem( &uiMain.menu, (void *)&uiMain.resumeGame );
UI_AddItem( &uiMain.menu, (void *)&uiMain.newGame );
if ( strlen( gMenu.m_gameinfo.trainmap ))
UI_AddItem( &uiMain.menu, (void *)&uiMain.hazardCourse );
if ( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY )
UI_AddItem( &uiMain.menu, (void *)&uiMain.playRecord );
else UI_AddItem( &uiMain.menu, (void *)&uiMain.saveRestore );
UI_AddItem( &uiMain.menu, (void *)&uiMain.configuration );
UI_AddItem( &uiMain.menu, (void *)&uiMain.multiPlayer );
UI_AddItem( &uiMain.menu, (void *)&uiMain.customGame );
UI_AddItem( &uiMain.menu, (void *)&uiMain.credits );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quit );
UI_AddItem( &uiMain.menu, (void *)&uiMain.minimizeBtn );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quitButton );
UI_AddItem( &uiMain.menu, (void *)&uiMain.msgBox );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quitMessage );
UI_AddItem( &uiMain.menu, (void *)&uiMain.dlgMessage1 );
UI_AddItem( &uiMain.menu, (void *)&uiMain.dlgMessage2 );
UI_AddItem( &uiMain.menu, (void *)&uiMain.no );
UI_AddItem( &uiMain.menu, (void *)&uiMain.yes );
}
/*
=================
UI_Main_Precache
=================
*/
void UI_Main_Precache( void )
{
PIC_Load( ART_MAIN_SPLASH );
PIC_Load( ART_MINIMIZE_N );
PIC_Load( ART_MINIMIZE_F );
PIC_Load( ART_MINIMIZE_D );
PIC_Load( ART_CLOSEBTN_N );
PIC_Load( ART_CLOSEBTN_F );
PIC_Load( ART_CLOSEBTN_D );
}
/*
=================
UI_Main_Menu
=================
*/
void UI_Main_Menu( void )
{
UI_Main_Precache();
UI_Main_Init();
UI_PushMenu( &uiMain.menu );
}

200
gameui/menu_multiplayer.cpp Normal file
View File

@ -0,0 +1,200 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_multi"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_INTERNETGAMES 2
#define ID_SPECTATEGAMES 3
#define ID_LANGAME 4
#define ID_CUSTOMIZE 5
#define ID_CONTROLS 6
#define ID_DONE 7
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s internetGames;
menuAction_s spectateGames;
menuAction_s LANGame;
menuAction_s Customize; // playersetup
menuAction_s Controls;
menuAction_s done;
} uiMultiPlayer_t;
static uiMultiPlayer_t uiMultiPlayer;
/*
=================
UI_MultiPlayer_Callback
=================
*/
static void UI_MultiPlayer_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_INTERNETGAMES:
case ID_SPECTATEGAMES:
// UNDONE: write menus
break;
case ID_LANGAME:
UI_LanGame_Menu();
break;
case ID_CUSTOMIZE:
UI_PlayerSetup_Menu();
break;
case ID_CONTROLS:
UI_Controls_Menu();
break;
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_MultiPlayer_Init
=================
*/
static void UI_MultiPlayer_Init( void )
{
memset( &uiMultiPlayer, 0, sizeof( uiMultiPlayer_t ));
uiMultiPlayer.background.generic.id = ID_BACKGROUND;
uiMultiPlayer.background.generic.type = QMTYPE_BITMAP;
uiMultiPlayer.background.generic.flags = QMF_INACTIVE;
uiMultiPlayer.background.generic.x = 0;
uiMultiPlayer.background.generic.y = 0;
uiMultiPlayer.background.generic.width = 1024;
uiMultiPlayer.background.generic.height = 768;
uiMultiPlayer.background.pic = ART_BACKGROUND;
uiMultiPlayer.banner.generic.id = ID_BANNER;
uiMultiPlayer.banner.generic.type = QMTYPE_BITMAP;
uiMultiPlayer.banner.generic.flags = QMF_INACTIVE;
uiMultiPlayer.banner.generic.x = UI_BANNER_POSX;
uiMultiPlayer.banner.generic.y = UI_BANNER_POSY;
uiMultiPlayer.banner.generic.width = UI_BANNER_WIDTH;
uiMultiPlayer.banner.generic.height = UI_BANNER_HEIGHT;
uiMultiPlayer.banner.pic = ART_BANNER;
uiMultiPlayer.internetGames.generic.id = ID_INTERNETGAMES;
uiMultiPlayer.internetGames.generic.type = QMTYPE_ACTION;
uiMultiPlayer.internetGames.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED;
uiMultiPlayer.internetGames.generic.x = 72;
uiMultiPlayer.internetGames.generic.y = 230;
uiMultiPlayer.internetGames.generic.name = "Internet games";
uiMultiPlayer.internetGames.generic.statusText = "View list of a game internet servers and join the one of your choise";
uiMultiPlayer.internetGames.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.spectateGames.generic.id = ID_SPECTATEGAMES;
uiMultiPlayer.spectateGames.generic.type = QMTYPE_ACTION;
uiMultiPlayer.spectateGames.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED;
uiMultiPlayer.spectateGames.generic.x = 72;
uiMultiPlayer.spectateGames.generic.y = 280;
uiMultiPlayer.spectateGames.generic.name = "Spectate games";
uiMultiPlayer.spectateGames.generic.statusText = "Spectate internet games";
uiMultiPlayer.spectateGames.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.LANGame.generic.id = ID_LANGAME;
uiMultiPlayer.LANGame.generic.type = QMTYPE_ACTION;
uiMultiPlayer.LANGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.LANGame.generic.x = 72;
uiMultiPlayer.LANGame.generic.y = 330;
uiMultiPlayer.LANGame.generic.name = "LAN game";
uiMultiPlayer.LANGame.generic.statusText = "Set up the game on the local area network";
uiMultiPlayer.LANGame.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.Customize.generic.id = ID_CUSTOMIZE;
uiMultiPlayer.Customize.generic.type = QMTYPE_ACTION;
uiMultiPlayer.Customize.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.Customize.generic.x = 72;
uiMultiPlayer.Customize.generic.y = 380;
uiMultiPlayer.Customize.generic.name = "Customize";
uiMultiPlayer.Customize.generic.statusText = "Choose your player name, and select visual options for your character";
uiMultiPlayer.Customize.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.Controls.generic.id = ID_CONTROLS;
uiMultiPlayer.Controls.generic.type = QMTYPE_ACTION;
uiMultiPlayer.Controls.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.Controls.generic.x = 72;
uiMultiPlayer.Controls.generic.y = 430;
uiMultiPlayer.Controls.generic.name = "Controls";
uiMultiPlayer.Controls.generic.statusText = "Change keyboard and mouse settings";
uiMultiPlayer.Controls.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.done.generic.id = ID_DONE;
uiMultiPlayer.done.generic.type = QMTYPE_ACTION;
uiMultiPlayer.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.done.generic.x = 72;
uiMultiPlayer.done.generic.y = 480;
uiMultiPlayer.done.generic.name = "Done";
uiMultiPlayer.done.generic.statusText = "Go back to the Main Menu";
uiMultiPlayer.done.generic.callback = UI_MultiPlayer_Callback;
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.background );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.banner );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.internetGames );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.spectateGames );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.LANGame );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Customize );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Controls );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.done );
}
/*
=================
UI_MultiPlayer_Precache
=================
*/
void UI_MultiPlayer_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_MultiPlayer_Menu
=================
*/
void UI_MultiPlayer_Menu( void )
{
UI_MultiPlayer_Precache();
UI_MultiPlayer_Init();
UI_PushMenu( &uiMultiPlayer.menu );
}

291
gameui/menu_newgame.cpp Normal file
View File

@ -0,0 +1,291 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_newgame"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_EASY 2
#define ID_MEDIUM 3
#define ID_DIFFICULT 4
#define ID_CANCEL 5
#define ID_MSGBOX 6
#define ID_MSGTEXT 7
#define ID_YES 8
#define ID_NO 9
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s easy;
menuAction_s medium;
menuAction_s hard;
menuAction_s cancel;
// newgame prompt dialog
menuAction_s msgBox;
menuAction_s dlgMessage1;
menuAction_s dlgMessage2;
menuAction_s yes;
menuAction_s no;
float skill;
} uiNewGame_t;
static uiNewGame_t uiNewGame;
/*
=================
UI_NewGame_StartGame
=================
*/
static void UI_NewGame_StartGame( float skill )
{
CVAR_SET_FLOAT( "skill", skill );
CVAR_SET_FLOAT( "deathmatch", 0 );
CVAR_SET_FLOAT( "gamerules", 0 );
CVAR_SET_FLOAT( "teamplay", 0 );
CVAR_SET_FLOAT( "pausable", 1 ); // singleplayer is always allowing pause
CVAR_SET_FLOAT( "coop", 0 );
HOST_NEWGAME( gMenu.m_gameinfo.startmap );
}
static void UI_PromptDialog( float skill )
{
if ( CL_IsActive( ))
{
UI_NewGame_StartGame( skill );
return;
}
uiNewGame.skill = skill;
// toggle main menu between active\inactive
// show\hide quit dialog
uiNewGame.easy.generic.flags ^= QMF_INACTIVE;
uiNewGame.medium.generic.flags ^= QMF_INACTIVE;
uiNewGame.hard.generic.flags ^= QMF_INACTIVE;
uiNewGame.cancel.generic.flags ^= QMF_INACTIVE;
uiNewGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiNewGame.dlgMessage1.generic.flags ^= QMF_HIDDEN;
uiNewGame.dlgMessage2.generic.flags ^= QMF_HIDDEN;
uiNewGame.no.generic.flags ^= QMF_HIDDEN;
uiNewGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_NewGame_Callback
=================
*/
static void UI_NewGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_EASY:
UI_PromptDialog( 0.0f );
break;
case ID_MEDIUM:
UI_PromptDialog( 1.0f );
break;
case ID_DIFFICULT:
UI_PromptDialog( 2.0f );
break;
case ID_CANCEL:
UI_PopMenu();
break;
case ID_YES:
UI_NewGame_StartGame( uiNewGame.skill );
break;
case ID_NO:
UI_PromptDialog( 0.0f ); // clear skill
break;
}
}
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
/*
=================
UI_NewGame_Init
=================
*/
static void UI_NewGame_Init( void )
{
memset( &uiNewGame, 0, sizeof( uiNewGame_t ));
uiNewGame.background.generic.id = ID_BACKGROUND;
uiNewGame.background.generic.type = QMTYPE_BITMAP;
uiNewGame.background.generic.flags = QMF_INACTIVE;
uiNewGame.background.generic.x = 0;
uiNewGame.background.generic.y = 0;
uiNewGame.background.generic.width = 1024;
uiNewGame.background.generic.height = 768;
uiNewGame.background.pic = ART_BACKGROUND;
uiNewGame.banner.generic.id = ID_BANNER;
uiNewGame.banner.generic.type = QMTYPE_BITMAP;
uiNewGame.banner.generic.flags = QMF_INACTIVE;
uiNewGame.banner.generic.x = UI_BANNER_POSX;
uiNewGame.banner.generic.y = UI_BANNER_POSY;
uiNewGame.banner.generic.width = UI_BANNER_WIDTH;
uiNewGame.banner.generic.height = UI_BANNER_HEIGHT;
uiNewGame.banner.pic = ART_BANNER;
uiNewGame.easy.generic.id = ID_EASY;
uiNewGame.easy.generic.type = QMTYPE_ACTION;
uiNewGame.easy.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiNewGame.easy.generic.name = "Easy";
uiNewGame.easy.generic.statusText = "Play the game on the 'easy' skill setting";
uiNewGame.easy.generic.x = 72;
uiNewGame.easy.generic.y = 230;
uiNewGame.easy.generic.callback = UI_NewGame_Callback;
uiNewGame.medium.generic.id = ID_MEDIUM;
uiNewGame.medium.generic.type = QMTYPE_ACTION;
uiNewGame.medium.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiNewGame.medium.generic.name = "Medium";
uiNewGame.medium.generic.statusText = "Play the game on the 'medium' skill setting";
uiNewGame.medium.generic.x = 72;
uiNewGame.medium.generic.y = 280;
uiNewGame.medium.generic.callback = UI_NewGame_Callback;
uiNewGame.hard.generic.id = ID_DIFFICULT;
uiNewGame.hard.generic.type = QMTYPE_ACTION;
uiNewGame.hard.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiNewGame.hard.generic.name = "Difficult";
uiNewGame.hard.generic.statusText = "Play the game on the 'difficult' skill setting";
uiNewGame.hard.generic.x = 72;
uiNewGame.hard.generic.y = 330;
uiNewGame.hard.generic.callback = UI_NewGame_Callback;
uiNewGame.cancel.generic.id = ID_CANCEL;
uiNewGame.cancel.generic.type = QMTYPE_ACTION;
uiNewGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiNewGame.cancel.generic.name = "Cancel";
uiNewGame.cancel.generic.statusText = "Go back to the main Menu";
uiNewGame.cancel.generic.x = 72;
uiNewGame.cancel.generic.y = 380;
uiNewGame.cancel.generic.callback = UI_NewGame_Callback;
uiNewGame.msgBox.generic.id = ID_MSGBOX;
uiNewGame.msgBox.generic.type = QMTYPE_ACTION;
uiNewGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiNewGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiNewGame.msgBox.generic.x = 192;
uiNewGame.msgBox.generic.y = 256;
uiNewGame.msgBox.generic.width = 640;
uiNewGame.msgBox.generic.height = 256;
uiNewGame.dlgMessage1.generic.id = ID_MSGTEXT;
uiNewGame.dlgMessage1.generic.type = QMTYPE_ACTION;
uiNewGame.dlgMessage1.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiNewGame.dlgMessage1.generic.name = "Starting a new game will exit";
uiNewGame.dlgMessage1.generic.x = 248;
uiNewGame.dlgMessage1.generic.y = 280;
uiNewGame.dlgMessage2.generic.id = ID_MSGTEXT;
uiNewGame.dlgMessage2.generic.type = QMTYPE_ACTION;
uiNewGame.dlgMessage2.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiNewGame.dlgMessage2.generic.name = "any current game, OK to exit?";
uiNewGame.dlgMessage2.generic.x = 248;
uiNewGame.dlgMessage2.generic.y = 310;
uiNewGame.yes.generic.id = ID_YES;
uiNewGame.yes.generic.type = QMTYPE_ACTION;
uiNewGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiNewGame.yes.generic.name = "Ok";
uiNewGame.yes.generic.x = 380;
uiNewGame.yes.generic.y = 460;
uiNewGame.yes.generic.callback = UI_NewGame_Callback;
uiNewGame.no.generic.id = ID_NO;
uiNewGame.no.generic.type = QMTYPE_ACTION;
uiNewGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiNewGame.no.generic.name = "Cancel";
uiNewGame.no.generic.x = 530;
uiNewGame.no.generic.y = 460;
uiNewGame.no.generic.callback = UI_NewGame_Callback;
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.background );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.banner );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.easy );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.medium );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.hard );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.cancel );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.msgBox );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.dlgMessage1 );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.dlgMessage2 );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.no );
UI_AddItem( &uiNewGame.menu, (void *)&uiNewGame.yes );
}
/*
=================
UI_NewGame_Precache
=================
*/
void UI_NewGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_NewGame_Menu
=================
*/
void UI_NewGame_Menu( void )
{
UI_NewGame_Precache();
UI_NewGame_Init();
UI_PushMenu( &uiNewGame.menu );
}

462
gameui/menu_playdemo.cpp Normal file
View File

@ -0,0 +1,462 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_play"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_PLAY 2
#define ID_DELETE 3
#define ID_CANCEL 4
#define ID_DEMOLIST 5
#define ID_TABLEHINT 6
#define ID_LEVELSHOT 7
#define ID_MSGBOX 8
#define ID_MSGTEXT 9
#define ID_YES 10
#define ID_NO 11
#define LEVELSHOT_X 72
#define LEVELSHOT_Y 400
#define LEVELSHOT_W 192
#define LEVELSHOT_H 160
#define TITLE_LENGTH 32
#define MAPNAME_LENGTH 24+TITLE_LENGTH
#define MAXCLIENTS_LENGTH 16+MAPNAME_LENGTH
typedef struct
{
char demoName[UI_MAXGAMES][CS_SIZE];
char delName[UI_MAXGAMES][CS_SIZE];
char demoDescription[UI_MAXGAMES][256];
char *demoDescriptionPtr[UI_MAXGAMES];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s play;
menuAction_s remove;
menuAction_s cancel;
menuScrollList_s demosList;
menuBitmap_s levelShot;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
} uiPlayDemo_t;
static uiPlayDemo_t uiPlayDemo;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_DeleteDialog( void )
{
// toggle main menu between active\inactive
// show\hide remove dialog
uiPlayDemo.play.generic.flags ^= QMF_INACTIVE;
uiPlayDemo.remove.generic.flags ^= QMF_INACTIVE;
uiPlayDemo.cancel.generic.flags ^= QMF_INACTIVE;
uiPlayDemo.demosList.generic.flags ^= QMF_INACTIVE;
uiPlayDemo.msgBox.generic.flags ^= QMF_HIDDEN;
uiPlayDemo.promptMessage.generic.flags ^= QMF_HIDDEN;
uiPlayDemo.no.generic.flags ^= QMF_HIDDEN;
uiPlayDemo.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_PlayDemo_KeyFunc
=================
*/
static const char *UI_PlayDemo_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiPlayDemo.play.generic.flags & QMF_INACTIVE )
{
UI_DeleteDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiPlayDemo.menu, key, down );
}
/*
=================
UI_PlayDemo_GetDemoList
=================
*/
static void UI_PlayDemo_GetDemoList( void )
{
char comment[256];
char **filenames;
int i, numFiles;
filenames = FS_SEARCH( "†demos/*.dem", &numFiles );
for( i = 0; i < numFiles; i++ )
{
if( i >= UI_MAXGAMES ) break;
if( !GET_DEMO_COMMENT( filenames[i], comment ))
{
if( strlen( comment ))
{
// get name string even if not found - CL_GetComment can be mark demos
// as <CORRUPTED> <OLD VERSION> etc
strncat( uiPlayDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
strncat( uiPlayDemo.demoDescription[i], comment, MAPNAME_LENGTH );
strncat( uiPlayDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
uiPlayDemo.demoDescriptionPtr[i] = uiPlayDemo.demoDescription[i];
COM_FileBase( filenames[i], uiPlayDemo.delName[i] );
}
else uiPlayDemo.demoDescriptionPtr[i] = NULL;
continue;
}
// strip path, leave only filename (empty slots doesn't have savename)
COM_FileBase( filenames[i], uiPlayDemo.demoName[i] );
COM_FileBase( filenames[i], uiPlayDemo.delName[i] );
// fill demo desc
strncat( uiPlayDemo.demoDescription[i], comment + CS_SIZE, TITLE_LENGTH );
strncat( uiPlayDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
strncat( uiPlayDemo.demoDescription[i], comment, MAPNAME_LENGTH );
strncat( uiPlayDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH ); // fill remaining entries
strncat( uiPlayDemo.demoDescription[i], comment + CS_SIZE * 2, MAXCLIENTS_LENGTH );
strncat( uiPlayDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
uiPlayDemo.demoDescriptionPtr[i] = uiPlayDemo.demoDescription[i];
}
for ( ; i < UI_MAXGAMES; i++ )
uiPlayDemo.demoDescriptionPtr[i] = NULL;
uiPlayDemo.demosList.itemNames = (const char **)uiPlayDemo.demoDescriptionPtr;
if( strlen( uiPlayDemo.demoName[0] ) == 0 )
uiPlayDemo.play.generic.flags |= QMF_GRAYED;
else uiPlayDemo.play.generic.flags &= ~QMF_GRAYED;
if( strlen( uiPlayDemo.delName[0] ) == 0 || !stricmp( gpGlobals->demoname, uiPlayDemo.delName[uiPlayDemo.demosList.curItem] ))
uiPlayDemo.remove.generic.flags |= QMF_GRAYED;
else uiPlayDemo.remove.generic.flags &= ~QMF_GRAYED;
}
/*
=================
UI_PlayDemo_Callback
=================
*/
static void UI_PlayDemo_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event == QM_CHANGED )
{
if( strlen( uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] ) == 0 )
uiPlayDemo.play.generic.flags |= QMF_GRAYED;
else uiPlayDemo.play.generic.flags &= ~QMF_GRAYED;
if( strlen( uiPlayDemo.delName[uiPlayDemo.demosList.curItem] ) == 0 || !stricmp( gpGlobals->demoname, uiPlayDemo.delName[uiPlayDemo.demosList.curItem] ))
uiPlayDemo.remove.generic.flags |= QMF_GRAYED;
else uiPlayDemo.remove.generic.flags &= ~QMF_GRAYED;
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CANCEL:
UI_PopMenu();
break;
case ID_PLAY:
if( gpGlobals->demoplayback || gpGlobals->demorecording )
{
CLIENT_COMMAND( FALSE, "stop" );
uiPlayDemo.play.generic.name = "Play";
uiPlayDemo.play.generic.statusText = "Play a demo";
uiPlayDemo.remove.generic.flags &= ~QMF_GRAYED;
}
else if( strlen( uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] ))
{
char cmd[128];
sprintf( cmd, "playdemo \"%s\"\n", uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] );
CLIENT_COMMAND( FALSE, cmd );
}
break;
case ID_NO:
case ID_DELETE:
UI_DeleteDialog();
break;
case ID_YES:
if( strlen( uiPlayDemo.delName[uiPlayDemo.demosList.curItem] ))
{
char cmd[128];
sprintf( cmd, "killdemo \"%s\"\n", uiPlayDemo.delName[uiPlayDemo.demosList.curItem] );
CLIENT_COMMAND( TRUE, cmd );
// FIXME: get demoshot extension from engine
sprintf( cmd, "demos/%s.tga", uiPlayDemo.delName[uiPlayDemo.demosList.curItem] );
PIC_Free( cmd );
UI_PlayDemo_GetDemoList();
}
UI_DeleteDialog();
break;
}
}
/*
=================
UI_PlayDemo_Ownerdraw
=================
*/
static void UI_PlayDemo_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( item->type != QMTYPE_ACTION && item->id == ID_LEVELSHOT )
{
int x, y, w, h;
// draw the levelshot
x = LEVELSHOT_X;
y = LEVELSHOT_Y;
w = LEVELSHOT_W;
h = LEVELSHOT_H;
UI_ScaleCoords( &x, &y, &w, &h );
if( strlen( uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] ))
{
char demoshot[128];
// FIXME: get demoshot extension from engine
sprintf( demoshot, "demos/%s.tga", uiPlayDemo.demoName[uiPlayDemo.demosList.curItem] );
if( !FILE_EXISTS( demoshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPic( x, y, w, h, uiColorWhite, demoshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
}
}
/*
=================
UI_PlayDemo_Init
=================
*/
static void UI_PlayDemo_Init( void )
{
memset( &uiPlayDemo, 0, sizeof( uiPlayDemo_t ));
uiPlayDemo.menu.keyFunc = UI_PlayDemo_KeyFunc;
strncat( uiPlayDemo.hintText, "Title", TITLE_LENGTH );
strncat( uiPlayDemo.hintText, uiEmptyString, TITLE_LENGTH );
strncat( uiPlayDemo.hintText, "Map", MAPNAME_LENGTH );
strncat( uiPlayDemo.hintText, uiEmptyString, MAPNAME_LENGTH );
strncat( uiPlayDemo.hintText, "Max Clients", MAXCLIENTS_LENGTH );
strncat( uiPlayDemo.hintText, uiEmptyString, MAXCLIENTS_LENGTH );
uiPlayDemo.background.generic.id = ID_BACKGROUND;
uiPlayDemo.background.generic.type = QMTYPE_BITMAP;
uiPlayDemo.background.generic.flags = QMF_INACTIVE;
uiPlayDemo.background.generic.x = 0;
uiPlayDemo.background.generic.y = 0;
uiPlayDemo.background.generic.width = 1024;
uiPlayDemo.background.generic.height = 768;
uiPlayDemo.background.pic = ART_BACKGROUND;
uiPlayDemo.banner.generic.id = ID_BANNER;
uiPlayDemo.banner.generic.type = QMTYPE_BITMAP;
uiPlayDemo.banner.generic.flags = QMF_INACTIVE;
uiPlayDemo.banner.generic.x = UI_BANNER_POSX;
uiPlayDemo.banner.generic.y = UI_BANNER_POSY;
uiPlayDemo.banner.generic.width = UI_BANNER_WIDTH;
uiPlayDemo.banner.generic.height = UI_BANNER_HEIGHT;
uiPlayDemo.banner.pic = ART_BANNER;
uiPlayDemo.play.generic.id = ID_PLAY;
uiPlayDemo.play.generic.type = QMTYPE_ACTION;
uiPlayDemo.play.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayDemo.play.generic.x = 72;
uiPlayDemo.play.generic.y = 230;
if ( gpGlobals->demoplayback )
{
uiPlayDemo.play.generic.name = "Stop";
uiPlayDemo.play.generic.statusText = "Stop a demo playing";
}
else if ( gpGlobals->demorecording )
{
uiPlayDemo.play.generic.name = "Stop";
uiPlayDemo.play.generic.statusText = "Stop a demo recording";
}
else
{
uiPlayDemo.play.generic.name = "Play";
uiPlayDemo.play.generic.statusText = "Play a demo";
}
uiPlayDemo.play.generic.callback = UI_PlayDemo_Callback;
uiPlayDemo.remove.generic.id = ID_DELETE;
uiPlayDemo.remove.generic.type = QMTYPE_ACTION;
uiPlayDemo.remove.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayDemo.remove.generic.x = 72;
uiPlayDemo.remove.generic.y = 280;
uiPlayDemo.remove.generic.name = "Delete";
uiPlayDemo.remove.generic.statusText = "Delete a demo";
uiPlayDemo.remove.generic.callback = UI_PlayDemo_Callback;
uiPlayDemo.cancel.generic.id = ID_CANCEL;
uiPlayDemo.cancel.generic.type = QMTYPE_ACTION;
uiPlayDemo.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayDemo.cancel.generic.x = 72;
uiPlayDemo.cancel.generic.y = 330;
uiPlayDemo.cancel.generic.name = "Cancel";
uiPlayDemo.cancel.generic.statusText = "Return back to main menu";
uiPlayDemo.cancel.generic.callback = UI_PlayDemo_Callback;
uiPlayDemo.hintMessage.generic.id = ID_TABLEHINT;
uiPlayDemo.hintMessage.generic.type = QMTYPE_ACTION;
uiPlayDemo.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiPlayDemo.hintMessage.generic.color = uiColorHelp;
uiPlayDemo.hintMessage.generic.name = uiPlayDemo.hintText;
uiPlayDemo.hintMessage.generic.x = 360;
uiPlayDemo.hintMessage.generic.y = 225;
uiPlayDemo.levelShot.generic.id = ID_LEVELSHOT;
uiPlayDemo.levelShot.generic.type = QMTYPE_BITMAP;
uiPlayDemo.levelShot.generic.flags = QMF_INACTIVE;
uiPlayDemo.levelShot.generic.x = LEVELSHOT_X;
uiPlayDemo.levelShot.generic.y = LEVELSHOT_Y;
uiPlayDemo.levelShot.generic.width = LEVELSHOT_W;
uiPlayDemo.levelShot.generic.height = LEVELSHOT_H;
uiPlayDemo.levelShot.generic.ownerdraw = UI_PlayDemo_Ownerdraw;
uiPlayDemo.demosList.generic.id = ID_DEMOLIST;
uiPlayDemo.demosList.generic.type = QMTYPE_SCROLLLIST;
uiPlayDemo.demosList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
uiPlayDemo.demosList.generic.x = 360;
uiPlayDemo.demosList.generic.y = 255;
uiPlayDemo.demosList.generic.width = 640;
uiPlayDemo.demosList.generic.height = 440;
uiPlayDemo.demosList.generic.callback = UI_PlayDemo_Callback;
uiPlayDemo.msgBox.generic.id = ID_MSGBOX;
uiPlayDemo.msgBox.generic.type = QMTYPE_ACTION;
uiPlayDemo.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiPlayDemo.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiPlayDemo.msgBox.generic.x = 192;
uiPlayDemo.msgBox.generic.y = 256;
uiPlayDemo.msgBox.generic.width = 640;
uiPlayDemo.msgBox.generic.height = 256;
uiPlayDemo.promptMessage.generic.id = ID_MSGBOX;
uiPlayDemo.promptMessage.generic.type = QMTYPE_ACTION;
uiPlayDemo.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiPlayDemo.promptMessage.generic.name = "Delete selected demo?";
uiPlayDemo.promptMessage.generic.x = 315;
uiPlayDemo.promptMessage.generic.y = 280;
uiPlayDemo.yes.generic.id = ID_YES;
uiPlayDemo.yes.generic.type = QMTYPE_ACTION;
uiPlayDemo.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiPlayDemo.yes.generic.name = "Ok";
uiPlayDemo.yes.generic.x = 380;
uiPlayDemo.yes.generic.y = 460;
uiPlayDemo.yes.generic.callback = UI_PlayDemo_Callback;
uiPlayDemo.no.generic.id = ID_NO;
uiPlayDemo.no.generic.type = QMTYPE_ACTION;
uiPlayDemo.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiPlayDemo.no.generic.name = "Cancel";
uiPlayDemo.no.generic.x = 530;
uiPlayDemo.no.generic.y = 460;
uiPlayDemo.no.generic.callback = UI_PlayDemo_Callback;
UI_PlayDemo_GetDemoList();
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.background );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.banner );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.play );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.remove );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.cancel );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.hintMessage );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.levelShot );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.demosList );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.msgBox );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.promptMessage );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.no );
UI_AddItem( &uiPlayDemo.menu, (void *)&uiPlayDemo.yes );
}
/*
=================
UI_PlayDemo_Precache
=================
*/
void UI_PlayDemo_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_PlayDemo_Menu
=================
*/
void UI_PlayDemo_Menu( void )
{
UI_PlayDemo_Precache();
UI_PlayDemo_Init();
UI_PushMenu( &uiPlayDemo.menu );
}

441
gameui/menu_playersetup.cpp Normal file
View File

@ -0,0 +1,441 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#include "ref_params.h"
#include "entity_def.h"
#include "entity_state.h"
#define ART_BANNER "gfx/shell/head_customize"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DONE 2
#define ID_ADVOPTIONS 3
#define ID_VIEW 4
#define ID_NAME 5
#define ID_MODEL 6
#define ID_TOPCOLOR 7
#define ID_BOTTOMCOLOR 8
#define ID_HIMODELS 9
#define MAX_PLAYERMODELS 100
typedef struct
{
char models[MAX_PLAYERMODELS][CS_SIZE];
int num_models;
char currentModel[CS_SIZE];
ref_params_t refdef;
edict_t *ent;
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s done;
menuAction_s AdvOptions;
menuBitmap_s view;
menuCheckBox_s hiModels;
menuSlider_s topColor;
menuSlider_s bottomColor;
menuField_s name;
menuSpinControl_s model;
} uiPlayerSetup_t;
static uiPlayerSetup_t uiPlayerSetup;
/*
=================
UI_PlayerSetup_CalcFov
assume refdef is valid
=================
*/
static void UI_PlayerSetup_CalcFov( ref_params_t *fd )
{
float x = fd->viewport[2] / tan( DEG2RAD( fd->fov_x ) * 0.5f );
float half_fov_y = atan( fd->viewport[3] / x );
fd->fov_y = RAD2DEG( half_fov_y ) * 2;
}
/*
=================
UI_PlayerSetup_FindModels
=================
*/
static void UI_PlayerSetup_FindModels( void )
{
char name[256], path[256];
char **filenames;
int i, numFiles;
uiPlayerSetup.num_models = 0;
// Get file list
filenames = FS_SEARCH( "models/player/*", &numFiles );
// add default singleplayer model
strcpy( uiPlayerSetup.models[uiPlayerSetup.num_models], "player" );
uiPlayerSetup.num_models++;
// build the model list
for( i = 0; i < numFiles; i++ )
{
COM_FileBase( filenames[i], name );
sprintf( path, "models/player/%s/%s.mdl", name, name );
if( !FILE_EXISTS( path )) continue;
strcpy( uiPlayerSetup.models[uiPlayerSetup.num_models], name );
uiPlayerSetup.num_models++;
}
}
/*
=================
UI_PlayerSetup_GetConfig
=================
*/
static void UI_PlayerSetup_GetConfig( void )
{
int i;
strncpy( uiPlayerSetup.name.buffer, CVAR_GET_STRING( "name" ), sizeof( uiPlayerSetup.name.buffer ));
// find models
UI_PlayerSetup_FindModels();
// select current model
for( i = 0; i < uiPlayerSetup.num_models; i++ )
{
if( !stricmp( uiPlayerSetup.models[i], CVAR_GET_STRING( "model" )))
{
uiPlayerSetup.model.curValue = (float)i;
break;
}
}
strcpy( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
uiPlayerSetup.model.maxValue = (float)(uiPlayerSetup.num_models - 1);
uiPlayerSetup.topColor.curValue = CVAR_GET_FLOAT( "topcolor" ) / 255;
uiPlayerSetup.bottomColor.curValue = CVAR_GET_FLOAT( "bottomcolor" ) / 255;
if( CVAR_GET_FLOAT( "cl_himodels" ))
uiPlayerSetup.hiModels.enabled = 1;
}
/*
=================
UI_PlayerSetup_SetConfig
=================
*/
static void UI_PlayerSetup_SetConfig( void )
{
CVAR_SET_STRING( "name", uiPlayerSetup.name.buffer );
CVAR_SET_STRING( "model", uiPlayerSetup.currentModel );
CVAR_SET_FLOAT( "topcolor", uiPlayerSetup.topColor.curValue * 255 );
CVAR_SET_FLOAT( "bottomcolor", uiPlayerSetup.bottomColor.curValue * 255 );
CVAR_SET_FLOAT( "cl_himodels", uiPlayerSetup.hiModels.enabled );
}
/*
=================
UI_PlayerSetup_UpdateConfig
=================
*/
static void UI_PlayerSetup_UpdateConfig( void )
{
char path[256], name[256];
// see if the model has changed
if( stricmp( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] ))
{
strcpy( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
}
uiPlayerSetup.model.generic.name = uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue];
strcpy( name, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
if( !stricmp( name, "player" ))
strcpy( path, "models/player.mdl" );
else sprintf( path, "models/player/%s/%s.mdl", name, name );
if( uiPlayerSetup.ent )
ENGINE_SET_MODEL( uiPlayerSetup.ent, path );
}
/*
=================
UI_PlayerSetup_Callback
=================
*/
static void UI_PlayerSetup_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_HIMODELS:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_PlayerSetup_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PlayerSetup_SetConfig();
UI_PopMenu();
break;
case ID_ADVOPTIONS:
UI_PlayerSetup_SetConfig();
UI_GameOptions_Menu();
break;
}
}
/*
=================
UI_PlayerSetup_Ownerdraw
=================
*/
static void UI_PlayerSetup_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
// draw the background
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
R_ClearScene ();
// update renderer timings
uiPlayerSetup.refdef.time = gpGlobals->time;
uiPlayerSetup.refdef.frametime = gpGlobals->frametime;
// draw the player model
R_AddEntity( uiPlayerSetup.ent, ED_NORMAL, -1 );
R_RenderFrame( &uiPlayerSetup.refdef );
}
/*
=================
UI_PlayerSetup_Init
=================
*/
static void UI_PlayerSetup_Init( void )
{
memset( &uiPlayerSetup, 0, sizeof( uiPlayerSetup_t ));
uiPlayerSetup.background.generic.id = ID_BACKGROUND;
uiPlayerSetup.background.generic.type = QMTYPE_BITMAP;
uiPlayerSetup.background.generic.flags = QMF_INACTIVE;
uiPlayerSetup.background.generic.x = 0;
uiPlayerSetup.background.generic.y = 0;
uiPlayerSetup.background.generic.width = 1024;
uiPlayerSetup.background.generic.height = 768;
uiPlayerSetup.background.pic = ART_BACKGROUND;
uiPlayerSetup.banner.generic.id = ID_BANNER;
uiPlayerSetup.banner.generic.type = QMTYPE_BITMAP;
uiPlayerSetup.banner.generic.flags = QMF_INACTIVE;
uiPlayerSetup.banner.generic.x = UI_BANNER_POSX;
uiPlayerSetup.banner.generic.y = UI_BANNER_POSY;
uiPlayerSetup.banner.generic.width = UI_BANNER_WIDTH;
uiPlayerSetup.banner.generic.height = UI_BANNER_HEIGHT;
uiPlayerSetup.banner.pic = ART_BANNER;
uiPlayerSetup.done.generic.id = ID_DONE;
uiPlayerSetup.done.generic.type = QMTYPE_ACTION;
uiPlayerSetup.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.done.generic.x = 72;
uiPlayerSetup.done.generic.y = 230;
uiPlayerSetup.done.generic.name = "Done";
uiPlayerSetup.done.generic.statusText = "Go back to the Multiplayer Menu";
uiPlayerSetup.done.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.AdvOptions.generic.id = ID_ADVOPTIONS;
uiPlayerSetup.AdvOptions.generic.type = QMTYPE_ACTION;
uiPlayerSetup.AdvOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.AdvOptions.generic.x = 72;
uiPlayerSetup.AdvOptions.generic.y = 280;
uiPlayerSetup.AdvOptions.generic.name = "Adv. Options";
uiPlayerSetup.AdvOptions.generic.statusText = "Configure handness, fov and other advanced options";
uiPlayerSetup.AdvOptions.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.view.generic.id = ID_VIEW;
uiPlayerSetup.view.generic.type = QMTYPE_BITMAP;
uiPlayerSetup.view.generic.flags = QMF_INACTIVE;
uiPlayerSetup.view.generic.x = 660;
uiPlayerSetup.view.generic.y = 260;
uiPlayerSetup.view.generic.width = 260;
uiPlayerSetup.view.generic.height = 320;
uiPlayerSetup.view.generic.ownerdraw = UI_PlayerSetup_Ownerdraw;
uiPlayerSetup.name.generic.id = ID_NAME;
uiPlayerSetup.name.generic.type = QMTYPE_FIELD;
uiPlayerSetup.name.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.name.generic.x = 320;
uiPlayerSetup.name.generic.y = 260;
uiPlayerSetup.name.generic.width = 256;
uiPlayerSetup.name.generic.height = 36;
uiPlayerSetup.name.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.name.generic.statusText = "Enter your multiplayer display name";
uiPlayerSetup.name.maxLength = 32;
uiPlayerSetup.model.generic.id = ID_MODEL;
uiPlayerSetup.model.generic.type = QMTYPE_SPINCONTROL;
uiPlayerSetup.model.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.model.generic.x = 702;
uiPlayerSetup.model.generic.y = 590;
uiPlayerSetup.model.generic.width = 176;
uiPlayerSetup.model.generic.height = 32;
uiPlayerSetup.model.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.model.generic.statusText = "Select a model for representation in multiplayer";
uiPlayerSetup.model.minValue = 0;
uiPlayerSetup.model.maxValue = 1;
uiPlayerSetup.model.range = 1;
uiPlayerSetup.topColor.generic.id = ID_TOPCOLOR;
uiPlayerSetup.topColor.generic.type = QMTYPE_SLIDER;
uiPlayerSetup.topColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.topColor.generic.name = "Top color";
uiPlayerSetup.topColor.generic.x = 350;
uiPlayerSetup.topColor.generic.y = 500;
uiPlayerSetup.topColor.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.topColor.generic.statusText = "Set a player model top color";
uiPlayerSetup.topColor.minValue = 0.0;
uiPlayerSetup.topColor.maxValue = 1.0;
uiPlayerSetup.topColor.range = 0.05f;
uiPlayerSetup.bottomColor.generic.id = ID_BOTTOMCOLOR;
uiPlayerSetup.bottomColor.generic.type = QMTYPE_SLIDER;
uiPlayerSetup.bottomColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiPlayerSetup.bottomColor.generic.name = "Bottom color";
uiPlayerSetup.bottomColor.generic.x = 350;
uiPlayerSetup.bottomColor.generic.y = 570;
uiPlayerSetup.bottomColor.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.bottomColor.generic.statusText = "Set a player model bottom color";
uiPlayerSetup.bottomColor.minValue = 0.0;
uiPlayerSetup.bottomColor.maxValue = 1.0;
uiPlayerSetup.bottomColor.range = 0.05f;
uiPlayerSetup.hiModels.generic.id = ID_HIMODELS;
uiPlayerSetup.hiModels.generic.type = QMTYPE_CHECKBOX;
uiPlayerSetup.hiModels.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiPlayerSetup.hiModels.generic.name = "High quality models";
uiPlayerSetup.hiModels.generic.x = 72;
uiPlayerSetup.hiModels.generic.y = 380;
uiPlayerSetup.hiModels.generic.callback = UI_PlayerSetup_Callback;
uiPlayerSetup.hiModels.generic.statusText = "show hi-res models in multiplayer";
UI_PlayerSetup_GetConfig();
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.background );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.banner );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.done );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.AdvOptions );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.view );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.name );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.model );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.topColor );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.bottomColor );
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.hiModels );
// setup render and actor
uiPlayerSetup.refdef.fov_x = 40;
// NOTE: must be called after UI_AddItem whan we sure what UI_ScaleCoords is done
uiPlayerSetup.refdef.viewport[0] = uiPlayerSetup.view.generic.x + (uiPlayerSetup.view.generic.width / 12);
uiPlayerSetup.refdef.viewport[1] = uiPlayerSetup.view.generic.y + (uiPlayerSetup.view.generic.height / 12);
uiPlayerSetup.refdef.viewport[2] = uiPlayerSetup.view.generic.width-(uiPlayerSetup.view.generic.width / 6);
uiPlayerSetup.refdef.viewport[3] = uiPlayerSetup.view.generic.height-(uiPlayerSetup.view.generic.height / 6);
UI_PlayerSetup_CalcFov( &uiPlayerSetup.refdef );
uiPlayerSetup.refdef.flags = RDF_NOWORLDMODEL;
uiPlayerSetup.ent = GET_MENU_EDICT ();
if( !uiPlayerSetup.ent )
{
ALERT( at_error, "Unable to find player model edict\n" );
return;
}
// adjust entity params
uiPlayerSetup.ent->v.animtime = gpGlobals->time; // start animation
uiPlayerSetup.ent->v.sequence = 1;
uiPlayerSetup.ent->v.scale = 1.0f;
uiPlayerSetup.ent->v.frame = 0.0f;
uiPlayerSetup.ent->v.framerate = 1.0f;
uiPlayerSetup.ent->v.effects |= EF_FULLBRIGHT;
uiPlayerSetup.ent->v.controller[0] = 127;
uiPlayerSetup.ent->v.controller[1] = 127;
uiPlayerSetup.ent->v.controller[2] = 127;
uiPlayerSetup.ent->v.controller[3] = 127;
uiPlayerSetup.ent->v.origin[0] = 92;
uiPlayerSetup.ent->v.origin[2] = 2;
uiPlayerSetup.ent->v.angles[1] = 180;
}
/*
=================
UI_PlayerSetup_Precache
=================
*/
void UI_PlayerSetup_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_PlayerSetup_Menu
=================
*/
void UI_PlayerSetup_Menu( void )
{
UI_PlayerSetup_Precache();
UI_PlayerSetup_Init();
UI_PlayerSetup_UpdateConfig();
UI_PushMenu( &uiPlayerSetup.menu );
}

176
gameui/menu_playrec.cpp Normal file
View File

@ -0,0 +1,176 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_playrec"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_PLAY 2
#define ID_RECORD 3
#define ID_DONE 4
#define ID_MSGHINT 5
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s record;
menuAction_s play;
menuAction_s done;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiPlayRec_t;
static uiPlayRec_t uiPlayRec;
/*
=================
UI_PlayRec_Callback
=================
*/
static void UI_PlayRec_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_PLAY:
UI_PlayDemo_Menu();
break;
case ID_RECORD:
UI_RecDemo_Menu();
break;
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_PlayRec_Init
=================
*/
static void UI_PlayRec_Init( void )
{
memset( &uiPlayRec, 0, sizeof( uiPlayRec_t ));
strcat( uiPlayRec.hintText, "During play or record demo, you can quickly stop\n" );
strcat( uiPlayRec.hintText, "playing/recording demo by pressing " );
strcat( uiPlayRec.hintText, KEY_KeynumToString( KEY_GetKey( "stop" )));
strcat( uiPlayRec.hintText, ".\n" );
uiPlayRec.background.generic.id = ID_BACKGROUND;
uiPlayRec.background.generic.type = QMTYPE_BITMAP;
uiPlayRec.background.generic.flags = QMF_INACTIVE;
uiPlayRec.background.generic.x = 0;
uiPlayRec.background.generic.y = 0;
uiPlayRec.background.generic.width = 1024;
uiPlayRec.background.generic.height = 768;
uiPlayRec.background.pic = ART_BACKGROUND;
uiPlayRec.banner.generic.id = ID_BANNER;
uiPlayRec.banner.generic.type = QMTYPE_BITMAP;
uiPlayRec.banner.generic.flags = QMF_INACTIVE;
uiPlayRec.banner.generic.x = UI_BANNER_POSX;
uiPlayRec.banner.generic.y = UI_BANNER_POSY;
uiPlayRec.banner.generic.width = UI_BANNER_WIDTH;
uiPlayRec.banner.generic.height = UI_BANNER_HEIGHT;
uiPlayRec.banner.pic = ART_BANNER;
uiPlayRec.play.generic.id = ID_PLAY;
uiPlayRec.play.generic.type = QMTYPE_ACTION;
uiPlayRec.play.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiPlayRec.play.generic.name = "Play demo";
uiPlayRec.play.generic.statusText = "Play a specified demo";
uiPlayRec.play.generic.x = 72;
uiPlayRec.play.generic.y = 230;
uiPlayRec.play.generic.callback = UI_PlayRec_Callback;
uiPlayRec.record.generic.id = ID_RECORD;
uiPlayRec.record.generic.type = QMTYPE_ACTION;
uiPlayRec.record.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiPlayRec.record.generic.name = "Record demo";
uiPlayRec.record.generic.statusText = "Record demo at this time";
uiPlayRec.record.generic.x = 72;
uiPlayRec.record.generic.y = 280;
uiPlayRec.record.generic.callback = UI_PlayRec_Callback;
uiPlayRec.done.generic.id = ID_DONE;
uiPlayRec.done.generic.type = QMTYPE_ACTION;
uiPlayRec.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiPlayRec.done.generic.name = "Done";
uiPlayRec.done.generic.statusText = "Go back to the Main Menu";
uiPlayRec.done.generic.x = 72;
uiPlayRec.done.generic.y = 330;
uiPlayRec.done.generic.callback = UI_PlayRec_Callback;
uiPlayRec.hintMessage.generic.id = ID_MSGHINT;
uiPlayRec.hintMessage.generic.type = QMTYPE_ACTION;
uiPlayRec.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiPlayRec.hintMessage.generic.color = uiColorHelp;
uiPlayRec.hintMessage.generic.name = uiPlayRec.hintText;
uiPlayRec.hintMessage.generic.x = 360;
uiPlayRec.hintMessage.generic.y = 480;
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.background );
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.banner );
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.play );
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.record );
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.done );
UI_AddItem( &uiPlayRec.menu, (void *)&uiPlayRec.hintMessage );
}
/*
=================
UI_PlayRec_Precache
=================
*/
void UI_PlayRec_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_PlayRec_Menu
=================
*/
void UI_PlayRec_Menu( void )
{
UI_PlayRec_Precache();
UI_PlayRec_Init();
UI_PushMenu( &uiPlayRec.menu );
}

489
gameui/menu_recdemo.cpp Normal file
View File

@ -0,0 +1,489 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_record"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_RECORD 2
#define ID_DELETE 3
#define ID_CANCEL 4
#define ID_DEMOLIST 5
#define ID_TABLEHINT 6
#define ID_LEVELSHOT 7
#define ID_MSGBOX 8
#define ID_MSGTEXT 9
#define ID_YES 10
#define ID_NO 11
#define LEVELSHOT_X 72
#define LEVELSHOT_Y 400
#define LEVELSHOT_W 192
#define LEVELSHOT_H 160
#define TITLE_LENGTH 32
#define MAPNAME_LENGTH 24+TITLE_LENGTH
#define MAXCLIENTS_LENGTH 16+MAPNAME_LENGTH
typedef struct
{
char demoName[UI_MAXGAMES][CS_SIZE];
char delName[UI_MAXGAMES][CS_SIZE];
char demoDescription[UI_MAXGAMES][256];
char *demoDescriptionPtr[UI_MAXGAMES];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s record;
menuAction_s remove;
menuAction_s cancel;
menuScrollList_s demosList;
menuBitmap_s levelShot;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
} uiRecDemo_t;
static uiRecDemo_t uiRecDemo;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_DeleteDialog( void )
{
// toggle main menu between active\inactive
// show\hide remove dialog
uiRecDemo.record.generic.flags ^= QMF_INACTIVE;
uiRecDemo.remove.generic.flags ^= QMF_INACTIVE;
uiRecDemo.cancel.generic.flags ^= QMF_INACTIVE;
uiRecDemo.demosList.generic.flags ^= QMF_INACTIVE;
uiRecDemo.msgBox.generic.flags ^= QMF_HIDDEN;
uiRecDemo.promptMessage.generic.flags ^= QMF_HIDDEN;
uiRecDemo.no.generic.flags ^= QMF_HIDDEN;
uiRecDemo.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_RecDemo_KeyFunc
=================
*/
static const char *UI_RecDemo_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiRecDemo.record.generic.flags & QMF_INACTIVE )
{
UI_DeleteDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiRecDemo.menu, key, down );
}
/*
=================
UI_RecDemo_GetDemoList
=================
*/
static void UI_RecDemo_GetDemoList( void )
{
char comment[256];
char **filenames;
int i = 0, j, numFiles;
filenames = FS_SEARCH( "†demos/*.dem", &numFiles );
if ( CL_IsActive () && !gpGlobals->demorecording && !gpGlobals->demoplayback )
{
char maxClients[32];
sprintf( maxClients, "%i", gpGlobals->maxClients );
// create new entry for current save game
strncpy( uiRecDemo.demoName[i], "new", CS_SIZE );
strncat( uiRecDemo.demoDescription[i], gpGlobals->maptitle, TITLE_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH ); // fill remaining entries
strncat( uiRecDemo.demoDescription[i], "New Demo", MAPNAME_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH );
strncat( uiRecDemo.demoDescription[i], maxClients, MAXCLIENTS_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
i++;
}
for( j = 0; j < numFiles; i++, j++ )
{
if( i >= UI_MAXGAMES ) break;
if( !GET_DEMO_COMMENT( filenames[j], comment ))
{
if( strlen( comment ))
{
// get name string even if not found - C:_GetComment can be mark demos
// as <CORRUPTED> <OLD VERSION> etc
// get name string even if not found - SV_GetComment can be mark saves
// as <CORRUPTED> <OLD VERSION> etc
strncat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
strncat( uiRecDemo.demoDescription[i], comment, MAPNAME_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
COM_FileBase( filenames[j], uiRecDemo.demoName[i] );
COM_FileBase( filenames[j], uiRecDemo.delName[i] );
}
else uiRecDemo.demoDescriptionPtr[i] = NULL;
continue;
}
// strip path, leave only filename (empty slots doesn't have demoname)
COM_FileBase( filenames[j], uiRecDemo.demoName[i] );
COM_FileBase( filenames[j], uiRecDemo.delName[i] );
// fill demo desc
strncat( uiRecDemo.demoDescription[i], comment + CS_SIZE, TITLE_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
strncat( uiRecDemo.demoDescription[i], comment, MAPNAME_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH ); // fill remaining entries
strncat( uiRecDemo.demoDescription[i], comment + CS_SIZE * 2, MAXCLIENTS_LENGTH );
strncat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
}
for ( ; i < UI_MAXGAMES; i++ )
uiRecDemo.demoDescriptionPtr[i] = NULL;
uiRecDemo.demosList.itemNames = (const char **)uiRecDemo.demoDescriptionPtr;
if( strlen( uiRecDemo.demoName[0] ) == 0 || !CL_IsActive () || gpGlobals->demoplayback )
uiRecDemo.record.generic.flags |= QMF_GRAYED;
else uiRecDemo.record.generic.flags &= ~QMF_GRAYED;
if( strlen( uiRecDemo.delName[0] ) == 0 || !stricmp( gpGlobals->demoname, uiRecDemo.delName[uiRecDemo.demosList.curItem] ))
uiRecDemo.remove.generic.flags |= QMF_GRAYED;
else uiRecDemo.remove.generic.flags &= ~QMF_GRAYED;
}
/*
=================
UI_RecDemo_Callback
=================
*/
static void UI_RecDemo_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event == QM_CHANGED )
{
// never overwrite existing saves, because their names was never get collision
if( strlen( uiRecDemo.demoName[uiRecDemo.demosList.curItem] ) == 0 || !CL_IsActive() || gpGlobals->demoplayback )
uiRecDemo.record.generic.flags |= QMF_GRAYED;
else uiRecDemo.record.generic.flags &= ~QMF_GRAYED;
if( strlen( uiRecDemo.delName[uiRecDemo.demosList.curItem] ) == 0 || !stricmp( gpGlobals->demoname, uiRecDemo.delName[uiRecDemo.demosList.curItem] ))
uiRecDemo.remove.generic.flags |= QMF_GRAYED;
else uiRecDemo.remove.generic.flags &= ~QMF_GRAYED;
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CANCEL:
UI_PopMenu();
break;
case ID_RECORD:
if( gpGlobals->demorecording )
{
CLIENT_COMMAND( FALSE, "stop" );
uiRecDemo.record.generic.name = "Record";
uiRecDemo.record.generic.statusText = "Record a new demo";
uiRecDemo.remove.generic.flags &= ~QMF_GRAYED;
}
else if( strlen( uiRecDemo.demoName[uiRecDemo.demosList.curItem] ))
{
char cmd[128];
// FIXME: get demoshot extension from engine
sprintf( cmd, "demos/%s.tga", uiRecDemo.demoName[uiRecDemo.demosList.curItem] );
PIC_Free( cmd );
sprintf( cmd, "record \"%s\"\n", uiRecDemo.demoName[uiRecDemo.demosList.curItem] );
CLIENT_COMMAND( FALSE, cmd );
UI_CloseMenu();
}
break;
case ID_NO:
case ID_DELETE:
UI_DeleteDialog();
break;
case ID_YES:
if( strlen( uiRecDemo.delName[uiRecDemo.demosList.curItem] ))
{
char cmd[128];
sprintf( cmd, "killdemo \"%s\"\n", uiRecDemo.delName[uiRecDemo.demosList.curItem] );
CLIENT_COMMAND( TRUE, cmd );
// FIXME: get demoshot extension from engine
sprintf( cmd, "demos/%s.tga", uiRecDemo.delName[uiRecDemo.demosList.curItem] );
PIC_Free( cmd );
UI_RecDemo_GetDemoList();
}
UI_DeleteDialog();
break;
}
}
/*
=================
UI_RecDemo_Ownerdraw
=================
*/
static void UI_RecDemo_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( item->type != QMTYPE_ACTION && item->id == ID_LEVELSHOT )
{
int x, y, w, h;
// draw the levelshot
x = LEVELSHOT_X;
y = LEVELSHOT_Y;
w = LEVELSHOT_W;
h = LEVELSHOT_H;
UI_ScaleCoords( &x, &y, &w, &h );
if( strlen( uiRecDemo.demoName[uiRecDemo.demosList.curItem] ))
{
char demoshot[128];
// FIXME: get demoshot extension from engine
sprintf( demoshot, "demos/%s.tga", uiRecDemo.demoName[uiRecDemo.demosList.curItem] );
if( !FILE_EXISTS( demoshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPic( x, y, w, h, uiColorWhite, demoshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
}
}
/*
=================
UI_RecDemo_Init
=================
*/
static void UI_RecDemo_Init( void )
{
memset( &uiRecDemo, 0, sizeof( uiRecDemo_t ));
uiRecDemo.menu.keyFunc = UI_RecDemo_KeyFunc;
strncat( uiRecDemo.hintText, "Title", TITLE_LENGTH );
strncat( uiRecDemo.hintText, uiEmptyString, TITLE_LENGTH );
strncat( uiRecDemo.hintText, "Map", MAPNAME_LENGTH );
strncat( uiRecDemo.hintText, uiEmptyString, MAPNAME_LENGTH );
strncat( uiRecDemo.hintText, "Max Clients", MAXCLIENTS_LENGTH );
strncat( uiRecDemo.hintText, uiEmptyString, MAXCLIENTS_LENGTH );
uiRecDemo.background.generic.id = ID_BACKGROUND;
uiRecDemo.background.generic.type = QMTYPE_BITMAP;
uiRecDemo.background.generic.flags = QMF_INACTIVE;
uiRecDemo.background.generic.x = 0;
uiRecDemo.background.generic.y = 0;
uiRecDemo.background.generic.width = 1024;
uiRecDemo.background.generic.height = 768;
uiRecDemo.background.pic = ART_BACKGROUND;
uiRecDemo.banner.generic.id = ID_BANNER;
uiRecDemo.banner.generic.type = QMTYPE_BITMAP;
uiRecDemo.banner.generic.flags = QMF_INACTIVE;
uiRecDemo.banner.generic.x = UI_BANNER_POSX;
uiRecDemo.banner.generic.y = UI_BANNER_POSY;
uiRecDemo.banner.generic.width = UI_BANNER_WIDTH;
uiRecDemo.banner.generic.height = UI_BANNER_HEIGHT;
uiRecDemo.banner.pic = ART_BANNER;
uiRecDemo.record.generic.id = ID_RECORD;
uiRecDemo.record.generic.type = QMTYPE_ACTION;
uiRecDemo.record.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiRecDemo.record.generic.x = 72;
uiRecDemo.record.generic.y = 230;
if( gpGlobals->demorecording )
{
uiRecDemo.record.generic.name = "Stop";
uiRecDemo.record.generic.statusText = "Stop a demo recording";
}
else
{
uiRecDemo.record.generic.name = "Record";
uiRecDemo.record.generic.statusText = "Record a new demo";
}
uiRecDemo.record.generic.callback = UI_RecDemo_Callback;
uiRecDemo.remove.generic.id = ID_DELETE;
uiRecDemo.remove.generic.type = QMTYPE_ACTION;
uiRecDemo.remove.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiRecDemo.remove.generic.x = 72;
uiRecDemo.remove.generic.y = 280;
uiRecDemo.remove.generic.name = "Delete";
uiRecDemo.remove.generic.statusText = "Delete a demo";
uiRecDemo.remove.generic.callback = UI_RecDemo_Callback;
uiRecDemo.cancel.generic.id = ID_CANCEL;
uiRecDemo.cancel.generic.type = QMTYPE_ACTION;
uiRecDemo.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiRecDemo.cancel.generic.x = 72;
uiRecDemo.cancel.generic.y = 330;
uiRecDemo.cancel.generic.name = "Cancel";
uiRecDemo.cancel.generic.statusText = "Return back to main menu";
uiRecDemo.cancel.generic.callback = UI_RecDemo_Callback;
uiRecDemo.hintMessage.generic.id = ID_TABLEHINT;
uiRecDemo.hintMessage.generic.type = QMTYPE_ACTION;
uiRecDemo.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiRecDemo.hintMessage.generic.color = uiColorHelp;
uiRecDemo.hintMessage.generic.name = uiRecDemo.hintText;
uiRecDemo.hintMessage.generic.x = 360;
uiRecDemo.hintMessage.generic.y = 225;
uiRecDemo.levelShot.generic.id = ID_LEVELSHOT;
uiRecDemo.levelShot.generic.type = QMTYPE_BITMAP;
uiRecDemo.levelShot.generic.flags = QMF_INACTIVE;
uiRecDemo.levelShot.generic.x = LEVELSHOT_X;
uiRecDemo.levelShot.generic.y = LEVELSHOT_Y;
uiRecDemo.levelShot.generic.width = LEVELSHOT_W;
uiRecDemo.levelShot.generic.height = LEVELSHOT_H;
uiRecDemo.levelShot.generic.ownerdraw = UI_RecDemo_Ownerdraw;
uiRecDemo.demosList.generic.id = ID_DEMOLIST;
uiRecDemo.demosList.generic.type = QMTYPE_SCROLLLIST;
uiRecDemo.demosList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
uiRecDemo.demosList.generic.x = 360;
uiRecDemo.demosList.generic.y = 255;
uiRecDemo.demosList.generic.width = 640;
uiRecDemo.demosList.generic.height = 440;
uiRecDemo.demosList.generic.callback = UI_RecDemo_Callback;
uiRecDemo.msgBox.generic.id = ID_MSGBOX;
uiRecDemo.msgBox.generic.type = QMTYPE_ACTION;
uiRecDemo.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiRecDemo.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiRecDemo.msgBox.generic.x = 192;
uiRecDemo.msgBox.generic.y = 256;
uiRecDemo.msgBox.generic.width = 640;
uiRecDemo.msgBox.generic.height = 256;
uiRecDemo.promptMessage.generic.id = ID_MSGBOX;
uiRecDemo.promptMessage.generic.type = QMTYPE_ACTION;
uiRecDemo.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiRecDemo.promptMessage.generic.name = "Delete selected demo?";
uiRecDemo.promptMessage.generic.x = 315;
uiRecDemo.promptMessage.generic.y = 280;
uiRecDemo.yes.generic.id = ID_YES;
uiRecDemo.yes.generic.type = QMTYPE_ACTION;
uiRecDemo.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiRecDemo.yes.generic.name = "Ok";
uiRecDemo.yes.generic.x = 380;
uiRecDemo.yes.generic.y = 460;
uiRecDemo.yes.generic.callback = UI_RecDemo_Callback;
uiRecDemo.no.generic.id = ID_NO;
uiRecDemo.no.generic.type = QMTYPE_ACTION;
uiRecDemo.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiRecDemo.no.generic.name = "Cancel";
uiRecDemo.no.generic.x = 530;
uiRecDemo.no.generic.y = 460;
uiRecDemo.no.generic.callback = UI_RecDemo_Callback;
UI_RecDemo_GetDemoList();
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.background );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.banner );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.record );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.remove );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.cancel );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.hintMessage );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.levelShot );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.demosList );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.msgBox );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.promptMessage );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.no );
UI_AddItem( &uiRecDemo.menu, (void *)&uiRecDemo.yes );
}
/*
=================
UI_RecDemo_Precache
=================
*/
void UI_RecDemo_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_RecDemo_Menu
=================
*/
void UI_RecDemo_Menu( void )
{
char libpath[128];
UI_BuildPath( "server", libpath );
if( !FILE_EXISTS( libpath )) return;
UI_RecDemo_Precache();
UI_RecDemo_Init();
UI_PushMenu( &uiRecDemo.menu );
}

478
gameui/menu_savegame.cpp Normal file
View File

@ -0,0 +1,478 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_save"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_SAVE 2
#define ID_DELETE 3
#define ID_CANCEL 4
#define ID_SAVELIST 5
#define ID_TABLEHINT 6
#define ID_LEVELSHOT 7
#define ID_MSGBOX 8
#define ID_MSGTEXT 9
#define ID_YES 10
#define ID_NO 11
#define LEVELSHOT_X 72
#define LEVELSHOT_Y 400
#define LEVELSHOT_W 192
#define LEVELSHOT_H 160
#define TIME_LENGTH 20
#define NAME_LENGTH 32+TIME_LENGTH
#define GAMETIME_LENGTH 15+NAME_LENGTH
typedef struct
{
char saveName[UI_MAXGAMES][CS_SIZE];
char delName[UI_MAXGAMES][CS_SIZE];
char saveDescription[UI_MAXGAMES][256];
char *saveDescriptionPtr[UI_MAXGAMES];
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s save;
menuAction_s remove;
menuAction_s cancel;
menuScrollList_s savesList;
menuBitmap_s levelShot;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
} uiSaveGame_t;
static uiSaveGame_t uiSaveGame;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_DeleteDialog( void )
{
// toggle main menu between active\inactive
// show\hide remove dialog
uiSaveGame.save.generic.flags ^= QMF_INACTIVE;
uiSaveGame.remove.generic.flags ^= QMF_INACTIVE;
uiSaveGame.cancel.generic.flags ^= QMF_INACTIVE;
uiSaveGame.savesList.generic.flags ^= QMF_INACTIVE;
uiSaveGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiSaveGame.promptMessage.generic.flags ^= QMF_HIDDEN;
uiSaveGame.no.generic.flags ^= QMF_HIDDEN;
uiSaveGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_SaveGame_KeyFunc
=================
*/
static const char *UI_SaveGame_KeyFunc( int key, int down )
{
if( down && key == K_ESCAPE && uiSaveGame.save.generic.flags & QMF_INACTIVE )
{
UI_DeleteDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiSaveGame.menu, key, down );
}
/*
=================
UI_SaveGame_GetGameList
=================
*/
static void UI_SaveGame_GetGameList( void )
{
char comment[256];
char **filenames;
int i = 0, j, numFiles;
filenames = FS_SEARCH( "†save/*.sav", &numFiles );
if ( CL_IsActive() && !gpGlobals->demoplayback )
{
// create new entry for current save game
strncpy( uiSaveGame.saveName[i], "new", CS_SIZE );
strncat( uiSaveGame.saveDescription[i], "Current", TIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, TIME_LENGTH ); // fill remaining entries
strncat( uiSaveGame.saveDescription[i], "New Saved Game", NAME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
strncat( uiSaveGame.saveDescription[i], "New", GAMETIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, GAMETIME_LENGTH );
uiSaveGame.saveDescriptionPtr[i] = uiSaveGame.saveDescription[i];
i++;
}
for ( j = 0; j < numFiles; i++, j++ )
{
if ( i >= UI_MAXGAMES )
break;
if ( !GET_SAVE_COMMENT( filenames[j], comment ))
{
if ( strlen( comment ))
{
// get name string even if not found - SV_GetComment can be mark saves
// as <CORRUPTED> <OLD VERSION> etc
strncat( uiSaveGame.saveDescription[i], uiEmptyString, TIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], comment, NAME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
uiSaveGame.saveDescriptionPtr[i] = uiSaveGame.saveDescription[i];
COM_FileBase( filenames[j], uiSaveGame.saveName[i] );
COM_FileBase( filenames[j], uiSaveGame.delName[i] );
}
else uiSaveGame.saveDescriptionPtr[i] = NULL;
continue;
}
// strip path, leave only filename (empty slots doesn't have savename)
COM_FileBase( filenames[j], uiSaveGame.saveName[i] );
COM_FileBase( filenames[j], uiSaveGame.delName[i] );
// fill save desc
strncat( uiSaveGame.saveDescription[i], comment + CS_SIZE, TIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], " ", TIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], comment + CS_SIZE + CS_TIME, TIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, TIME_LENGTH ); // fill remaining entries
strncat( uiSaveGame.saveDescription[i], comment, NAME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
strncat( uiSaveGame.saveDescription[i], comment + CS_SIZE + (CS_TIME * 2), GAMETIME_LENGTH );
strncat( uiSaveGame.saveDescription[i], uiEmptyString, GAMETIME_LENGTH );
uiSaveGame.saveDescriptionPtr[i] = uiSaveGame.saveDescription[i];
}
for ( ; i < UI_MAXGAMES; i++ )
uiSaveGame.saveDescriptionPtr[i] = NULL;
uiSaveGame.savesList.itemNames = (const char **)uiSaveGame.saveDescriptionPtr;
if ( strlen( uiSaveGame.saveName[0] ) == 0 || CL_IsActive() == FALSE )
uiSaveGame.save.generic.flags |= QMF_GRAYED;
else uiSaveGame.save.generic.flags &= ~QMF_GRAYED;
if ( strlen( uiSaveGame.delName[0] ) == 0 )
uiSaveGame.remove.generic.flags |= QMF_GRAYED;
else uiSaveGame.remove.generic.flags &= ~QMF_GRAYED;
}
/*
=================
UI_SaveGame_Callback
=================
*/
static void UI_SaveGame_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event == QM_CHANGED )
{
// never overwrite existing saves, because their names was never get collision
if ( strlen( uiSaveGame.saveName[uiSaveGame.savesList.curItem] ) == 0 || CL_IsActive() == FALSE )
uiSaveGame.save.generic.flags |= QMF_GRAYED;
else uiSaveGame.save.generic.flags &= ~QMF_GRAYED;
if ( strlen( uiSaveGame.delName[uiSaveGame.savesList.curItem] ) == 0 )
uiSaveGame.remove.generic.flags |= QMF_GRAYED;
else uiSaveGame.remove.generic.flags &= ~QMF_GRAYED;
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CANCEL:
UI_PopMenu();
break;
case ID_SAVE:
if( strlen( uiSaveGame.saveName[uiSaveGame.savesList.curItem] ))
{
char cmd[128];
// FIXME: get saveshot extension from engine
sprintf( cmd, "save/%s.tga", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
PIC_Free( cmd );
sprintf( cmd, "save \"%s\"\n", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
CLIENT_COMMAND( FALSE, cmd );
UI_CloseMenu();
}
break;
case ID_NO:
case ID_DELETE:
UI_DeleteDialog();
break;
case ID_YES:
if( strlen( uiSaveGame.delName[uiSaveGame.savesList.curItem] ))
{
char cmd[128];
sprintf( cmd, "killsave \"%s\"\n", uiSaveGame.delName[uiSaveGame.savesList.curItem] );
CLIENT_COMMAND( TRUE, cmd );
// FIXME: get saveshot extension from engine
sprintf( cmd, "save/%s.tga", uiSaveGame.delName[uiSaveGame.savesList.curItem] );
PIC_Free( cmd );
UI_SaveGame_GetGameList();
}
UI_DeleteDialog();
break;
}
}
/*
=================
UI_SaveGame_Ownerdraw
=================
*/
static void UI_SaveGame_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( item->type != QMTYPE_ACTION && item->id == ID_LEVELSHOT )
{
int x, y, w, h;
// draw the levelshot
x = LEVELSHOT_X;
y = LEVELSHOT_Y;
w = LEVELSHOT_W;
h = LEVELSHOT_H;
UI_ScaleCoords( &x, &y, &w, &h );
if( strlen( uiSaveGame.saveName[uiSaveGame.savesList.curItem] ))
{
char saveshot[128];
// FIXME: get saveshot extension from engine
sprintf( saveshot, "save/%s.tga", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
// draw the rectangle
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
}
}
/*
=================
UI_SaveGame_Init
=================
*/
static void UI_SaveGame_Init( void )
{
memset( &uiSaveGame, 0, sizeof( uiSaveGame_t ));
uiSaveGame.menu.keyFunc = UI_SaveGame_KeyFunc;
strncat( uiSaveGame.hintText, "Time", TIME_LENGTH );
strncat( uiSaveGame.hintText, uiEmptyString, TIME_LENGTH );
strncat( uiSaveGame.hintText, "Game", NAME_LENGTH );
strncat( uiSaveGame.hintText, uiEmptyString, NAME_LENGTH );
strncat( uiSaveGame.hintText, "Elapsed time", GAMETIME_LENGTH );
strncat( uiSaveGame.hintText, uiEmptyString, GAMETIME_LENGTH );
uiSaveGame.background.generic.id = ID_BACKGROUND;
uiSaveGame.background.generic.type = QMTYPE_BITMAP;
uiSaveGame.background.generic.flags = QMF_INACTIVE;
uiSaveGame.background.generic.x = 0;
uiSaveGame.background.generic.y = 0;
uiSaveGame.background.generic.width = 1024;
uiSaveGame.background.generic.height = 768;
uiSaveGame.background.pic = ART_BACKGROUND;
uiSaveGame.banner.generic.id = ID_BANNER;
uiSaveGame.banner.generic.type = QMTYPE_BITMAP;
uiSaveGame.banner.generic.flags = QMF_INACTIVE;
uiSaveGame.banner.generic.x = UI_BANNER_POSX;
uiSaveGame.banner.generic.y = UI_BANNER_POSY;
uiSaveGame.banner.generic.width = UI_BANNER_WIDTH;
uiSaveGame.banner.generic.height = UI_BANNER_HEIGHT;
uiSaveGame.banner.pic = ART_BANNER;
uiSaveGame.save.generic.id = ID_SAVE;
uiSaveGame.save.generic.type = QMTYPE_ACTION;
uiSaveGame.save.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiSaveGame.save.generic.x = 72;
uiSaveGame.save.generic.y = 230;
uiSaveGame.save.generic.name = "Save";
uiSaveGame.save.generic.statusText = "Save current game";
uiSaveGame.save.generic.callback = UI_SaveGame_Callback;
uiSaveGame.remove.generic.id = ID_DELETE;
uiSaveGame.remove.generic.type = QMTYPE_ACTION;
uiSaveGame.remove.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiSaveGame.remove.generic.x = 72;
uiSaveGame.remove.generic.y = 280;
uiSaveGame.remove.generic.name = "Delete";
uiSaveGame.remove.generic.statusText = "Delete saved game";
uiSaveGame.remove.generic.callback = UI_SaveGame_Callback;
uiSaveGame.cancel.generic.id = ID_CANCEL;
uiSaveGame.cancel.generic.type = QMTYPE_ACTION;
uiSaveGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiSaveGame.cancel.generic.x = 72;
uiSaveGame.cancel.generic.y = 330;
uiSaveGame.cancel.generic.name = "Cancel";
uiSaveGame.cancel.generic.statusText = "Return back to main menu";
uiSaveGame.cancel.generic.callback = UI_SaveGame_Callback;
uiSaveGame.hintMessage.generic.id = ID_TABLEHINT;
uiSaveGame.hintMessage.generic.type = QMTYPE_ACTION;
uiSaveGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiSaveGame.hintMessage.generic.color = uiColorHelp;
uiSaveGame.hintMessage.generic.name = uiSaveGame.hintText;
uiSaveGame.hintMessage.generic.x = 360;
uiSaveGame.hintMessage.generic.y = 225;
uiSaveGame.levelShot.generic.id = ID_LEVELSHOT;
uiSaveGame.levelShot.generic.type = QMTYPE_BITMAP;
uiSaveGame.levelShot.generic.flags = QMF_INACTIVE;
uiSaveGame.levelShot.generic.x = LEVELSHOT_X;
uiSaveGame.levelShot.generic.y = LEVELSHOT_Y;
uiSaveGame.levelShot.generic.width = LEVELSHOT_W;
uiSaveGame.levelShot.generic.height = LEVELSHOT_H;
uiSaveGame.levelShot.generic.ownerdraw = UI_SaveGame_Ownerdraw;
uiSaveGame.savesList.generic.id = ID_SAVELIST;
uiSaveGame.savesList.generic.type = QMTYPE_SCROLLLIST;
uiSaveGame.savesList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
uiSaveGame.savesList.generic.x = 360;
uiSaveGame.savesList.generic.y = 255;
uiSaveGame.savesList.generic.width = 640;
uiSaveGame.savesList.generic.height = 440;
uiSaveGame.savesList.generic.callback = UI_SaveGame_Callback;
uiSaveGame.msgBox.generic.id = ID_MSGBOX;
uiSaveGame.msgBox.generic.type = QMTYPE_ACTION;
uiSaveGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiSaveGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiSaveGame.msgBox.generic.x = 192;
uiSaveGame.msgBox.generic.y = 256;
uiSaveGame.msgBox.generic.width = 640;
uiSaveGame.msgBox.generic.height = 256;
uiSaveGame.promptMessage.generic.id = ID_MSGBOX;
uiSaveGame.promptMessage.generic.type = QMTYPE_ACTION;
uiSaveGame.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiSaveGame.promptMessage.generic.name = "Delete selected game?";
uiSaveGame.promptMessage.generic.x = 315;
uiSaveGame.promptMessage.generic.y = 280;
uiSaveGame.yes.generic.id = ID_YES;
uiSaveGame.yes.generic.type = QMTYPE_ACTION;
uiSaveGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiSaveGame.yes.generic.name = "Ok";
uiSaveGame.yes.generic.x = 380;
uiSaveGame.yes.generic.y = 460;
uiSaveGame.yes.generic.callback = UI_SaveGame_Callback;
uiSaveGame.no.generic.id = ID_NO;
uiSaveGame.no.generic.type = QMTYPE_ACTION;
uiSaveGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiSaveGame.no.generic.name = "Cancel";
uiSaveGame.no.generic.x = 530;
uiSaveGame.no.generic.y = 460;
uiSaveGame.no.generic.callback = UI_SaveGame_Callback;
UI_SaveGame_GetGameList();
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.background );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.banner );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.save );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.remove );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.cancel );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.hintMessage );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.levelShot );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.savesList );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.msgBox );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.promptMessage );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.no );
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.yes );
}
/*
=================
UI_SaveGame_Precache
=================
*/
void UI_SaveGame_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_SaveGame_Menu
=================
*/
void UI_SaveGame_Menu( void )
{
if( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY )
{
// completely ignore save\load menus for multiplayer_only
UI_RecDemo_Menu();
return;
}
char libpath[128];
UI_BuildPath( "server", libpath );
if( !FILE_EXISTS( libpath )) return;
UI_SaveGame_Precache();
UI_SaveGame_Init();
UI_PushMenu( &uiSaveGame.menu );
}

184
gameui/menu_saveload.cpp Normal file
View File

@ -0,0 +1,184 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_saveload"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_LOAD 2
#define ID_SAVE 3
#define ID_DONE 4
#define ID_MSGHINT 5
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s save;
menuAction_s load;
menuAction_s done;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiSaveLoad_t;
static uiSaveLoad_t uiSaveLoad;
/*
=================
UI_SaveLoad_Callback
=================
*/
static void UI_SaveLoad_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_LOAD:
UI_LoadGame_Menu();
break;
case ID_SAVE:
UI_SaveGame_Menu();
break;
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_SaveLoad_Init
=================
*/
static void UI_SaveLoad_Init( void )
{
memset( &uiSaveLoad, 0, sizeof( uiSaveLoad_t ));
strcat( uiSaveLoad.hintText, "During play, you can quickly save your game by pressing " );
strcat( uiSaveLoad.hintText, KEY_KeynumToString( KEY_GetKey( "savequick" )));
strcat( uiSaveLoad.hintText, ".\nLoad this game again by pressing " );
strcat( uiSaveLoad.hintText, KEY_KeynumToString( KEY_GetKey( "loadquick" )));
strcat( uiSaveLoad.hintText, ".\n" );
uiSaveLoad.background.generic.id = ID_BACKGROUND;
uiSaveLoad.background.generic.type = QMTYPE_BITMAP;
uiSaveLoad.background.generic.flags = QMF_INACTIVE;
uiSaveLoad.background.generic.x = 0;
uiSaveLoad.background.generic.y = 0;
uiSaveLoad.background.generic.width = 1024;
uiSaveLoad.background.generic.height = 768;
uiSaveLoad.background.pic = ART_BACKGROUND;
uiSaveLoad.banner.generic.id = ID_BANNER;
uiSaveLoad.banner.generic.type = QMTYPE_BITMAP;
uiSaveLoad.banner.generic.flags = QMF_INACTIVE;
uiSaveLoad.banner.generic.x = UI_BANNER_POSX;
uiSaveLoad.banner.generic.y = UI_BANNER_POSY;
uiSaveLoad.banner.generic.width = UI_BANNER_WIDTH;
uiSaveLoad.banner.generic.height = UI_BANNER_HEIGHT;
uiSaveLoad.banner.pic = ART_BANNER;
uiSaveLoad.load.generic.id = ID_LOAD;
uiSaveLoad.load.generic.type = QMTYPE_ACTION;
uiSaveLoad.load.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiSaveLoad.load.generic.name = "Load game";
uiSaveLoad.load.generic.statusText = "Load a previously saved game";
uiSaveLoad.load.generic.x = 72;
uiSaveLoad.load.generic.y = 230;
uiSaveLoad.load.generic.callback = UI_SaveLoad_Callback;
uiSaveLoad.save.generic.id = ID_SAVE;
uiSaveLoad.save.generic.type = QMTYPE_ACTION;
uiSaveLoad.save.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiSaveLoad.save.generic.name = "Save game";
uiSaveLoad.save.generic.statusText = "Save current game";
uiSaveLoad.save.generic.x = 72;
uiSaveLoad.save.generic.y = 280;
uiSaveLoad.save.generic.callback = UI_SaveLoad_Callback;
uiSaveLoad.done.generic.id = ID_DONE;
uiSaveLoad.done.generic.type = QMTYPE_ACTION;
uiSaveLoad.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiSaveLoad.done.generic.name = "Done";
uiSaveLoad.done.generic.statusText = "Go back to the Main Menu";
uiSaveLoad.done.generic.x = 72;
uiSaveLoad.done.generic.y = 330;
uiSaveLoad.done.generic.callback = UI_SaveLoad_Callback;
uiSaveLoad.hintMessage.generic.id = ID_MSGHINT;
uiSaveLoad.hintMessage.generic.type = QMTYPE_ACTION;
uiSaveLoad.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiSaveLoad.hintMessage.generic.color = uiColorHelp;
uiSaveLoad.hintMessage.generic.name = uiSaveLoad.hintText;
uiSaveLoad.hintMessage.generic.x = 360;
uiSaveLoad.hintMessage.generic.y = 480;
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.background );
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.banner );
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.load );
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.save );
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.done );
UI_AddItem( &uiSaveLoad.menu, (void *)&uiSaveLoad.hintMessage );
}
/*
=================
UI_SaveLoad_Precache
=================
*/
void UI_SaveLoad_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_SaveLoad_Menu
=================
*/
void UI_SaveLoad_Menu( void )
{
if( gMenu.m_gameinfo.gamemode == GAME_MULTIPLAYER_ONLY )
{
// completely ignore save\load menus for multiplayer_only
UI_PlayRec_Menu();
return;
}
UI_SaveLoad_Precache();
UI_SaveLoad_Init();
UI_PushMenu( &uiSaveLoad.menu );
}

157
gameui/menu_video.cpp Normal file
View File

@ -0,0 +1,157 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_video"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_VIDOPTIONS 2
#define ID_VIDMODES 3
#define ID_DONE 4
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s vidOptions;
menuAction_s vidModes;
menuAction_s done;
} uiVideo_t;
static uiVideo_t uiVideo;
/*
=================
UI_Video_Callback
=================
*/
static void UI_Video_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_VIDOPTIONS:
UI_VidOptions_Menu();
break;
case ID_VIDMODES:
UI_VidModes_Menu();
break;
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_Video_Init
=================
*/
static void UI_Video_Init( void )
{
memset( &uiVideo, 0, sizeof( uiVideo_t ));
uiVideo.background.generic.id = ID_BACKGROUND;
uiVideo.background.generic.type = QMTYPE_BITMAP;
uiVideo.background.generic.flags = QMF_INACTIVE;
uiVideo.background.generic.x = 0;
uiVideo.background.generic.y = 0;
uiVideo.background.generic.width = 1024;
uiVideo.background.generic.height = 768;
uiVideo.background.pic = ART_BACKGROUND;
uiVideo.banner.generic.id = ID_BANNER;
uiVideo.banner.generic.type = QMTYPE_BITMAP;
uiVideo.banner.generic.flags = QMF_INACTIVE;
uiVideo.banner.generic.x = UI_BANNER_POSX;
uiVideo.banner.generic.y = UI_BANNER_POSY;
uiVideo.banner.generic.width = UI_BANNER_WIDTH;
uiVideo.banner.generic.height = UI_BANNER_HEIGHT;
uiVideo.banner.pic = ART_BANNER;
uiVideo.vidOptions.generic.id = ID_VIDOPTIONS;
uiVideo.vidOptions.generic.type = QMTYPE_ACTION;
uiVideo.vidOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiVideo.vidOptions.generic.name = "Video options";
uiVideo.vidOptions.generic.statusText = "Set video options such as screen size, gamma and image quality.";
uiVideo.vidOptions.generic.x = 72;
uiVideo.vidOptions.generic.y = 230;
uiVideo.vidOptions.generic.callback = UI_Video_Callback;
uiVideo.vidModes.generic.id = ID_VIDMODES;
uiVideo.vidModes.generic.type = QMTYPE_ACTION;
uiVideo.vidModes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiVideo.vidModes.generic.name = "Video modes";
uiVideo.vidModes.generic.statusText = "Set video modes and configure 3D accelerators.";
uiVideo.vidModes.generic.x = 72;
uiVideo.vidModes.generic.y = 280;
uiVideo.vidModes.generic.callback = UI_Video_Callback;
uiVideo.done.generic.id = ID_DONE;
uiVideo.done.generic.type = QMTYPE_ACTION;
uiVideo.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiVideo.done.generic.name = "Done";
uiVideo.done.generic.statusText = "Go back to the previous menu";
uiVideo.done.generic.x = 72;
uiVideo.done.generic.y = 330;
uiVideo.done.generic.callback = UI_Video_Callback;
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.background );
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.banner );
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.vidOptions );
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.vidModes );
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.done );
}
/*
=================
UI_Video_Precache
=================
*/
void UI_Video_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_Video_Menu
=================
*/
void UI_Video_Menu( void )
{
UI_Video_Precache();
UI_Video_Init();
UI_PushMenu( &uiVideo.menu );
}

332
gameui/menu_vidmodes.cpp Normal file
View File

@ -0,0 +1,332 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_vidmodes"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_OK 2
#define ID_CANCEL 3
#define ID_RENDERLIBRARY 4
#define ID_VIDMODELIST 5
#define ID_FULLSCREEN 6
#define ID_SOFTWARE 7
#define ID_TABLEHINT 8
#define ID_MSGHINT 9
#define MAX_VIDMODES (sizeof( uiVideoModes ) / sizeof( uiVideoModes[0] )) + 1
static const char *uiVideoModes[] =
{
"640 x 480",
"800 x 600",
"960 x 720",
"1024 x 768",
"1152 x 864",
"1280 x 800",
"1280 x 960",
"1280 x 1024",
"1600 x 1200",
"2048 x 1536",
"856 x 480 (wide)",
"1024 x 576 (wide)",
"1440 x 900 (wide)",
"1680 x 1050 (wide)",
"1920 x 1200 (wide)",
"2560 x 1600 (wide)",
};
typedef struct
{
const char *videoModesPtr[MAX_VIDMODES];
char **videoList;
int numVideoDlls;
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuAction_s ok;
menuAction_s cancel;
menuCheckBox_s windowed;
menuCheckBox_s software;
menuSpinControl_s videoLibrary;
menuScrollList_s vidList;
menuAction_s listCaption;
menuAction_s vidlibCaption;
menuAction_s hintMessage;
char hintText[MAX_HINT_TEXT];
} uiVidModes_t;
static uiVidModes_t uiVidModes;
/*
=================
UI_VidModes_GetModesList
=================
*/
static void UI_VidModes_GetConfig( void )
{
uiVidModes.videoList = GET_VIDEO_LIST( &uiVidModes.numVideoDlls );
for( int i = 0; i < uiVidModes.numVideoDlls; i++ )
{
if( !stricmp( uiVidModes.videoList[i], CVAR_GET_STRING( "host_video" )))
uiVidModes.videoLibrary.curValue = i;
}
uiVidModes.videoLibrary.maxValue = uiVidModes.numVideoDlls - 1;
uiVidModes.videoLibrary.generic.name = uiVidModes.videoList[(int)uiVidModes.videoLibrary.curValue];
for( i = 0; i < MAX_VIDMODES-1; i++ )
uiVidModes.videoModesPtr[i] = uiVideoModes[i];
uiVidModes.videoModesPtr[i] = NULL; // terminator
uiVidModes.vidList.itemNames = uiVidModes.videoModesPtr;
uiVidModes.vidList.curItem = CVAR_GET_FLOAT( "r_mode" );
if( !CVAR_GET_FLOAT( "fullscreen" ))
uiVidModes.windowed.enabled = 1;
if( CVAR_GET_FLOAT( "r_allow_software" ))
uiVidModes.software.enabled = 1;
}
/*
=================
UI_VidModes_SetConfig
=================
*/
static void UI_VidOptions_SetConfig( void )
{
CVAR_SET_FLOAT( "r_mode", uiVidModes.vidList.curItem );
CVAR_SET_FLOAT( "fullscreen", !uiVidModes.windowed.enabled );
CVAR_SET_FLOAT( "r_allow_software", uiVidModes.software.enabled );
CHANGE_VIDEO( uiVidModes.videoList[(int)uiVidModes.videoLibrary.curValue] );
}
/*
=================
UI_VidModes_UpdateConfig
=================
*/
static void UI_VidOptions_UpdateConfig( void )
{
CVAR_SET_FLOAT( "r_allow_software", uiVidModes.software.enabled );
}
/*
=================
UI_VidModes_Callback
=================
*/
static void UI_VidModes_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_FULLSCREEN:
case ID_SOFTWARE:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_VidOptions_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_CANCEL:
UI_PopMenu();
break;
case ID_OK:
UI_VidOptions_SetConfig ();
break;
}
}
/*
=================
UI_VidModes_Init
=================
*/
static void UI_VidModes_Init( void )
{
memset( &uiVidModes, 0, sizeof( uiVidModes_t ));
strcat( uiVidModes.hintText, "Change Xash3D rendering engine\n" );
strcat( uiVidModes.hintText, "to get more compatibility and\n" );
strcat( uiVidModes.hintText, "optimize FPS.\n" );
strcat( uiVidModes.hintText, "Also enables more hardware\n" );
strcat( uiVidModes.hintText, "features on top-computers." );
uiVidModes.background.generic.id = ID_BACKGROUND;
uiVidModes.background.generic.type = QMTYPE_BITMAP;
uiVidModes.background.generic.flags = QMF_INACTIVE;
uiVidModes.background.generic.x = 0;
uiVidModes.background.generic.y = 0;
uiVidModes.background.generic.width = 1024;
uiVidModes.background.generic.height = 768;
uiVidModes.background.pic = ART_BACKGROUND;
uiVidModes.banner.generic.id = ID_BANNER;
uiVidModes.banner.generic.type = QMTYPE_BITMAP;
uiVidModes.banner.generic.flags = QMF_INACTIVE;
uiVidModes.banner.generic.x = UI_BANNER_POSX;
uiVidModes.banner.generic.y = UI_BANNER_POSY;
uiVidModes.banner.generic.width = UI_BANNER_WIDTH;
uiVidModes.banner.generic.height = UI_BANNER_HEIGHT;
uiVidModes.banner.pic = ART_BANNER;
uiVidModes.ok.generic.id = ID_OK;
uiVidModes.ok.generic.type = QMTYPE_ACTION;
uiVidModes.ok.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiVidModes.ok.generic.x = 72;
uiVidModes.ok.generic.y = 230;
uiVidModes.ok.generic.name = "Ok";
uiVidModes.ok.generic.statusText = "Apply changes and return to the Main Menu";
uiVidModes.ok.generic.callback = UI_VidModes_Callback;
uiVidModes.cancel.generic.id = ID_CANCEL;
uiVidModes.cancel.generic.type = QMTYPE_ACTION;
uiVidModes.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiVidModes.cancel.generic.x = 72;
uiVidModes.cancel.generic.y = 280;
uiVidModes.cancel.generic.name = "Cancel";
uiVidModes.cancel.generic.statusText = "Return back to previous menu";
uiVidModes.cancel.generic.callback = UI_VidModes_Callback;
uiVidModes.videoLibrary.generic.id = ID_RENDERLIBRARY;
uiVidModes.videoLibrary.generic.type = QMTYPE_SPINCONTROL;
uiVidModes.videoLibrary.generic.flags = QMF_CENTER_JUSTIFY|QMF_SMALLFONT|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiVidModes.videoLibrary.generic.x = 112;
uiVidModes.videoLibrary.generic.y = 390;
uiVidModes.videoLibrary.generic.width = 168;
uiVidModes.videoLibrary.generic.height = 26;
uiVidModes.videoLibrary.generic.callback = UI_VidModes_Callback;
uiVidModes.videoLibrary.generic.statusText = "Select renderer";
uiVidModes.videoLibrary.minValue = 0;
uiVidModes.videoLibrary.maxValue = 0;
uiVidModes.videoLibrary.range = 1;
uiVidModes.vidlibCaption.generic.id = ID_TABLEHINT;
uiVidModes.vidlibCaption.generic.type = QMTYPE_ACTION;
uiVidModes.vidlibCaption.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiVidModes.vidlibCaption.generic.color = uiColorHelp;
uiVidModes.vidlibCaption.generic.name = "Rendering module";
uiVidModes.vidlibCaption.generic.x = 72;
uiVidModes.vidlibCaption.generic.y = 350;
uiVidModes.hintMessage.generic.id = ID_TABLEHINT;
uiVidModes.hintMessage.generic.type = QMTYPE_ACTION;
uiVidModes.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiVidModes.hintMessage.generic.color = uiColorHelp;
uiVidModes.hintMessage.generic.name = uiVidModes.hintText;
uiVidModes.hintMessage.generic.x = 72;
uiVidModes.hintMessage.generic.y = 450;
uiVidModes.listCaption.generic.id = ID_TABLEHINT;
uiVidModes.listCaption.generic.type = QMTYPE_ACTION;
uiVidModes.listCaption.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiVidModes.listCaption.generic.color = uiColorHelp;
uiVidModes.listCaption.generic.name = "Display mode";
uiVidModes.listCaption.generic.x = 400;
uiVidModes.listCaption.generic.y = 270;
uiVidModes.vidList.generic.id = ID_VIDMODELIST;
uiVidModes.vidList.generic.type = QMTYPE_SCROLLLIST;
uiVidModes.vidList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiVidModes.vidList.generic.x = 400;
uiVidModes.vidList.generic.y = 300;
uiVidModes.vidList.generic.width = 560;
uiVidModes.vidList.generic.height = 300;
uiVidModes.vidList.generic.callback = UI_VidModes_Callback;
uiVidModes.windowed.generic.id = ID_FULLSCREEN;
uiVidModes.windowed.generic.type = QMTYPE_CHECKBOX;
uiVidModes.windowed.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidModes.windowed.generic.name = "Run in a window";
uiVidModes.windowed.generic.x = 400;
uiVidModes.windowed.generic.y = 620;
uiVidModes.windowed.generic.callback = UI_VidModes_Callback;
uiVidModes.windowed.generic.statusText = "Run game in window mode";
uiVidModes.software.generic.id = ID_SOFTWARE;
uiVidModes.software.generic.type = QMTYPE_CHECKBOX;
uiVidModes.software.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidModes.software.generic.name = "Allow software";
uiVidModes.software.generic.x = 400;
uiVidModes.software.generic.y = 670;
uiVidModes.software.generic.callback = UI_VidModes_Callback;
uiVidModes.software.generic.statusText = "allow software rendering when hardware support is missing";
UI_VidModes_GetConfig();
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.background );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.banner );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.ok );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.cancel );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.windowed );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.software );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.listCaption );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.vidlibCaption );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.hintMessage );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.videoLibrary );
UI_AddItem( &uiVidModes.menu, (void *)&uiVidModes.vidList );
}
/*
=================
UI_VidModes_Precache
=================
*/
void UI_VidModes_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_VidModes_Menu
=================
*/
void UI_VidModes_Menu( void )
{
UI_VidModes_Precache();
UI_VidModes_Init();
UI_PushMenu( &uiVidModes.menu );
}

263
gameui/menu_vidoptions.cpp Normal file
View File

@ -0,0 +1,263 @@
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
#define ART_BANNER "gfx/shell/head_vidoptions"
#define ART_GAMMA "gfx/shell/gamma"
#define ID_BACKGROUND 0
#define ID_BANNER 1
#define ID_DONE 2
#define ID_BLOOM_INTENSITY 3
#define ID_GAMMA 4
#define ID_GLARE_REDUCTION 5
#define ID_SIMPLE_SKY 6
typedef struct
{
int outlineWidth;
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuBitmap_s testImage;
menuAction_s done;
menuSlider_s bloomIntensity;
menuSlider_s gammaIntensity;
menuSlider_s glareReduction;
menuCheckBox_s fastSky;
} uiVidOptions_t;
static uiVidOptions_t uiVidOptions;
/*
=================
UI_VidOptions_GetConfig
=================
*/
static void UI_VidOptions_GetConfig( void )
{
uiVidOptions.bloomIntensity.curValue = CVAR_GET_FLOAT( "r_bloom_intensity" ) / 10.0f;
uiVidOptions.gammaIntensity.curValue = (CVAR_GET_FLOAT( "vid_gamma" ) - 0.5f) / 1.8f;
uiVidOptions.glareReduction.curValue = CVAR_GET_FLOAT( "r_flaresize" ) / 60.0f;
if( CVAR_GET_FLOAT( "r_fastsky" ))
uiVidOptions.fastSky.enabled = 1;
uiVidOptions.outlineWidth = 2;
UI_ScaleCoords( NULL, NULL, &uiVidOptions.outlineWidth, NULL );
}
/*
=================
UI_VidOptions_UpdateConfig
=================
*/
static void UI_VidOptions_UpdateConfig( void )
{
CVAR_SET_FLOAT( "r_bloom_intensity", uiVidOptions.bloomIntensity.curValue * 10.0f );
CVAR_SET_FLOAT( "vid_gamma", (uiVidOptions.gammaIntensity.curValue * 1.8f) + 0.5f );
CVAR_SET_FLOAT( "r_flaresize", uiVidOptions.glareReduction.curValue * 60.0f );
CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled );
}
/*
=================
UI_VidOptions_Ownerdraw
=================
*/
static void UI_VidOptions_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
int color = 0xFFFF0000; // 255, 0, 0, 255
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
UI_DrawRectangleExt( item->x, item->y, item->width, item->height, color, uiVidOptions.outlineWidth );
}
/*
=================
UI_VidOptions_Callback
=================
*/
static void UI_VidOptions_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_SIMPLE_SKY:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_VidOptions_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_VidOptions_Init
=================
*/
static void UI_VidOptions_Init( void )
{
memset( &uiVidOptions, 0, sizeof( uiVidOptions_t ));
uiVidOptions.background.generic.id = ID_BACKGROUND;
uiVidOptions.background.generic.type = QMTYPE_BITMAP;
uiVidOptions.background.generic.flags = QMF_INACTIVE;
uiVidOptions.background.generic.x = 0;
uiVidOptions.background.generic.y = 0;
uiVidOptions.background.generic.width = 1024;
uiVidOptions.background.generic.height = 768;
uiVidOptions.background.pic = ART_BACKGROUND;
uiVidOptions.banner.generic.id = ID_BANNER;
uiVidOptions.banner.generic.type = QMTYPE_BITMAP;
uiVidOptions.banner.generic.flags = QMF_INACTIVE;
uiVidOptions.banner.generic.x = UI_BANNER_POSX;
uiVidOptions.banner.generic.y = UI_BANNER_POSY;
uiVidOptions.banner.generic.width = UI_BANNER_WIDTH;
uiVidOptions.banner.generic.height = UI_BANNER_HEIGHT;
uiVidOptions.banner.pic = ART_BANNER;
uiVidOptions.testImage.generic.id = ID_BANNER;
uiVidOptions.testImage.generic.type = QMTYPE_BITMAP;
uiVidOptions.testImage.generic.flags = QMF_INACTIVE;
uiVidOptions.testImage.generic.x = 390;
uiVidOptions.testImage.generic.y = 225;
uiVidOptions.testImage.generic.width = 460;
uiVidOptions.testImage.generic.height = 450;
uiVidOptions.testImage.pic = ART_GAMMA;
uiVidOptions.testImage.generic.ownerdraw = UI_VidOptions_Ownerdraw;
uiVidOptions.done.generic.id = ID_DONE;
uiVidOptions.done.generic.type = QMTYPE_ACTION;
uiVidOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.done.generic.x = 72;
uiVidOptions.done.generic.y = 435;
uiVidOptions.done.generic.name = "Done";
uiVidOptions.done.generic.statusText = "Go back to the Video Menu";
uiVidOptions.done.generic.callback = UI_VidOptions_Callback;
uiVidOptions.bloomIntensity.generic.id = ID_BLOOM_INTENSITY;
uiVidOptions.bloomIntensity.generic.type = QMTYPE_SLIDER;
uiVidOptions.bloomIntensity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.bloomIntensity.generic.name = "Bloom intensity";
uiVidOptions.bloomIntensity.generic.x = 72;
uiVidOptions.bloomIntensity.generic.y = 280;
uiVidOptions.bloomIntensity.generic.callback = UI_VidOptions_Callback;
uiVidOptions.bloomIntensity.generic.statusText = "Set bloom intensity (0 value disables bloom)";
uiVidOptions.bloomIntensity.minValue = 0.0;
uiVidOptions.bloomIntensity.maxValue = 1.0;
uiVidOptions.bloomIntensity.range = 0.05f;
uiVidOptions.gammaIntensity.generic.id = ID_GAMMA;
uiVidOptions.gammaIntensity.generic.type = QMTYPE_SLIDER;
uiVidOptions.gammaIntensity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.gammaIntensity.generic.name = "Gamma";
uiVidOptions.gammaIntensity.generic.x = 72;
uiVidOptions.gammaIntensity.generic.y = 340;
uiVidOptions.gammaIntensity.generic.callback = UI_VidOptions_Callback;
uiVidOptions.gammaIntensity.generic.statusText = "Set gamma value (0.5 - 2.3)";
uiVidOptions.gammaIntensity.minValue = 0.0;
uiVidOptions.gammaIntensity.maxValue = 1.0;
uiVidOptions.gammaIntensity.range = 0.05f;
uiVidOptions.glareReduction.generic.id = ID_GLARE_REDUCTION;
uiVidOptions.glareReduction.generic.type = QMTYPE_SLIDER;
uiVidOptions.glareReduction.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.glareReduction.generic.name = "Glare reduction";
uiVidOptions.glareReduction.generic.x = 72;
uiVidOptions.glareReduction.generic.y = 400;
uiVidOptions.glareReduction.generic.callback = UI_VidOptions_Callback;
uiVidOptions.glareReduction.generic.statusText = "Set glare reduction level";
uiVidOptions.glareReduction.minValue = 0.0;
uiVidOptions.glareReduction.maxValue = 1.0;
uiVidOptions.glareReduction.range = 0.05f;
uiVidOptions.fastSky.generic.id = ID_SIMPLE_SKY;
uiVidOptions.fastSky.generic.type = QMTYPE_CHECKBOX;
uiVidOptions.fastSky.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.fastSky.generic.name = "Draw simple sky";
uiVidOptions.fastSky.generic.x = 72;
uiVidOptions.fastSky.generic.y = 685;
uiVidOptions.fastSky.generic.callback = UI_VidOptions_Callback;
uiVidOptions.fastSky.generic.statusText = "enable/disable fast sky rendering (for old computers)";
UI_VidOptions_GetConfig();
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.background );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.banner );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.done );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.bloomIntensity );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.gammaIntensity );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.glareReduction );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.fastSky );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.testImage );
}
/*
=================
UI_VidOptions_Precache
=================
*/
void UI_VidOptions_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
PIC_Load( ART_GAMMA );
}
/*
=================
UI_VidOptions_Menu
=================
*/
void UI_VidOptions_Menu( void )
{
UI_VidOptions_Precache();
UI_VidOptions_Init();
UI_VidOptions_UpdateConfig();
UI_PushMenu( &uiVidOptions.menu );
}

57
gameui/udll_int.cpp Normal file
View File

@ -0,0 +1,57 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// dll_int.cpp - dll entry points
//=======================================================================
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
ui_enginefuncs_t g_engfuncs;
ui_globalvars_t *gpGlobals;
CMenu gMenu;
// main DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
return TRUE;
}
static UI_FUNCTIONS gFunctionTable =
{
UI_VidInit,
UI_Init,
UI_Shutdown,
UI_UpdateMenu,
UI_KeyEvent,
UI_MouseMove,
UI_SetActiveMenu,
UI_AddServerToList,
UI_GetCursorPos,
UI_SetCursorPos,
UI_ShowCursor,
UI_CharEvent,
UI_MouseInRect,
UI_IsVisible,
UI_CreditsActive,
UI_FinalCredits
};
//=======================================================================
// GetApi
//=======================================================================
int CreateAPI( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* pEngfuncsFromEngine, ui_globalvars_t *pGlobals )
{
if( !pFunctionTable || !pEngfuncsFromEngine )
{
return FALSE;
}
// copy HUD_FUNCTIONS table to engine, copy engfuncs table from engine
memcpy( pFunctionTable, &gFunctionTable, sizeof( UI_FUNCTIONS ));
memcpy( &g_engfuncs, pEngfuncsFromEngine, sizeof( ui_enginefuncs_t ));
gpGlobals = pGlobals;
return TRUE;
}

1888
gameui/utils.cpp Normal file

File diff suppressed because it is too large Load Diff

112
gameui/utils.h Normal file
View File

@ -0,0 +1,112 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// utils.h - draw helper
//=======================================================================
#ifndef UTILS_H
#define UTILS_H
extern ui_enginefuncs_t g_engfuncs;
#include "enginecallback.h"
#include "gameinfo.h"
#define FILE_GLOBAL static
#define DLL_GLOBAL
#define MAX_INFO_STRING 512 // engine limit
//
// How did I ever live without ASSERT?
//
#ifdef _DEBUG
void DBG_AssertFunction( BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage );
#define ASSERT( f ) DBG_AssertFunction( f, #f, __FILE__, __LINE__, NULL )
#define ASSERTSZ( f, sz ) DBG_AssertFunction( f, #f, __FILE__, __LINE__, sz )
#else
#define ASSERT( f )
#define ASSERTSZ( f, sz )
#endif
extern ui_globalvars_t *gpGlobals;
// exports
extern int UI_VidInit( void );
extern void UI_Init( void );
extern void UI_Shutdown( void );
extern void UI_UpdateMenu( float flTime );
extern void UI_KeyEvent( int key, int down );
extern void UI_MouseMove( int x, int y );
extern void UI_SetActiveMenu( int fActive );
extern void UI_AddServerToList( netadr_t adr, const char *info );
extern void UI_GetCursorPos( int *pos_x, int *pos_y );
extern void UI_SetCursorPos( int pos_x, int pos_y );
extern void UI_ShowCursor( int show );
extern void UI_CharEvent( int key );
extern int UI_MouseInRect( void );
extern int UI_IsVisible( void );
extern int UI_CreditsActive( void );
extern void UI_FinalCredits( void );
typedef void* dllhandle_t;
typedef struct dllfunction_s
{
const char *name;
void **funcvariable;
} dllfunction_t;
#include "cvardef.h"
// ScreenHeight returns the virtual height of the screen, in pixels
#define ScreenHeight (gMenu.m_scrinfo.iHeight)
// ScreenWidth returns the virtual width of the screen, in pixels
#define ScreenWidth (gMenu.m_scrinfo.iWidth)
// ScreenHeight returns the height of the screen, in pixels
#define ActualHeight (gMenu.m_scrinfo.iRealHeight)
// ScreenWidth returns the width of the screen, in pixels
#define ActualWidth (gMenu.m_scrinfo.iRealWidth)
inline dword PackRGB( int r, int g, int b )
{
return ((0xFF)<<24|(r)<<16|(g)<<8|(b));
}
inline dword PackRGBA( int r, int g, int b, int a )
{
return ((a)<<24|(r)<<16|(g)<<8|(b));
}
inline void UnpackRGB( int &r, int &g, int &b, dword ulRGB )
{
r = (ulRGB & 0xFF0000) >> 16;
g = (ulRGB & 0xFF00) >> 8;
b = (ulRGB & 0xFF) >> 0;
}
inline void UnpackRGBA( int &r, int &g, int &b, int &a, dword ulRGBA )
{
a = (ulRGBA & 0xFF000000) >> 24;
r = (ulRGBA & 0xFF0000) >> 16;
g = (ulRGBA & 0xFF00) >> 8;
b = (ulRGBA & 0xFF) >> 0;
}
inline int PackAlpha( dword ulRGB, dword ulAlpha )
{
return (ulRGB)|(ulAlpha<<24);
}
inline int UnpackAlpha( dword ulRGBA )
{
return ((ulRGBA & 0xFF000000) >> 24);
}
extern int ColorStrlen( const char *str ); // returns string length without color symbols
extern const int g_iColorTable[8];
extern void COM_FileBase( const char *in, char *out ); // ripped out from hlsdk 2.3
extern void UI_FadeAlpha( int starttime, int endtime, int &color );
extern char *Info_ValueForKey( const char *s, const char *key );
extern int KEY_GetKey( const char *binding ); // ripped out from engine
#endif//UTILS_H

View File

@ -1124,6 +1124,12 @@ void FS_AddGameDirectory( const char *dir, int flags )
stringlistfreecontents( &list );
if( Sys.app_name == HOST_NORMAL || Sys.app_name == HOST_DEDICATED || Sys.app_name == HOST_BSPLIB )
{
// because we want first add gamedir wads
if(!( flags & FS_GAMEDIR_PATH )) return;
}
// use normal method because we want take access to wad files through pak or pk3 archives
wads = FS_Search( "*.wad", true );
for( i = 0; wads && i < wads->numfilenames; i++ )

128
launch/launch.plg Normal file
View File

@ -0,0 +1,128 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: launch - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D80.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\launch\!release/" /Fd"..\temp\launch\!release/" /FD /c
"D:\Xash3D\src_main\launch\cmd.c"
"D:\Xash3D\src_main\launch\console.c"
"D:\Xash3D\src_main\launch\cpuinfo.c"
"D:\Xash3D\src_main\launch\crclib.c"
"D:\Xash3D\src_main\launch\cvar.c"
"D:\Xash3D\src_main\launch\export.c"
"D:\Xash3D\src_main\launch\filesystem.c"
"D:\Xash3D\src_main\launch\imagelib\img_bmp.c"
"D:\Xash3D\src_main\launch\imagelib\img_dds.c"
"D:\Xash3D\src_main\launch\imagelib\img_jpg.c"
"D:\Xash3D\src_main\launch\imagelib\img_main.c"
"D:\Xash3D\src_main\launch\imagelib\img_pcx.c"
"D:\Xash3D\src_main\launch\imagelib\img_png.c"
"D:\Xash3D\src_main\launch\imagelib\img_tga.c"
"D:\Xash3D\src_main\launch\imagelib\img_utils.c"
"D:\Xash3D\src_main\launch\imagelib\img_vtf.c"
"D:\Xash3D\src_main\launch\imagelib\img_wad.c"
"D:\Xash3D\src_main\launch\library.c"
"D:\Xash3D\src_main\launch\memlib.c"
"D:\Xash3D\src_main\launch\network.c"
"D:\Xash3D\src_main\launch\parselib.c"
"D:\Xash3D\src_main\launch\soundlib\snd_main.c"
"D:\Xash3D\src_main\launch\soundlib\snd_ogg.c"
"D:\Xash3D\src_main\launch\soundlib\snd_raw.c"
"D:\Xash3D\src_main\launch\soundlib\snd_utils.c"
"D:\Xash3D\src_main\launch\soundlib\snd_wav.c"
"D:\Xash3D\src_main\launch\stdlib.c"
"D:\Xash3D\src_main\launch\system.c"
"D:\Xash3D\src_main\launch\utils.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D80.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D81.tmp" with contents
[
zlib.lib png.lib jpg.lib ogg.lib vorbis.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmt" /out:"..\temp\launch\!release/launch.dll" /implib:"..\temp\launch\!release/launch.lib" /libpath:"./imagelib" /libpath:"./soundlib" /opt:nowin98
"\Xash3D\src_main\temp\launch\!release\cmd.obj"
"\Xash3D\src_main\temp\launch\!release\console.obj"
"\Xash3D\src_main\temp\launch\!release\cpuinfo.obj"
"\Xash3D\src_main\temp\launch\!release\crclib.obj"
"\Xash3D\src_main\temp\launch\!release\cvar.obj"
"\Xash3D\src_main\temp\launch\!release\export.obj"
"\Xash3D\src_main\temp\launch\!release\filesystem.obj"
"\Xash3D\src_main\temp\launch\!release\img_bmp.obj"
"\Xash3D\src_main\temp\launch\!release\img_dds.obj"
"\Xash3D\src_main\temp\launch\!release\img_jpg.obj"
"\Xash3D\src_main\temp\launch\!release\img_main.obj"
"\Xash3D\src_main\temp\launch\!release\img_pcx.obj"
"\Xash3D\src_main\temp\launch\!release\img_png.obj"
"\Xash3D\src_main\temp\launch\!release\img_tga.obj"
"\Xash3D\src_main\temp\launch\!release\img_utils.obj"
"\Xash3D\src_main\temp\launch\!release\img_vtf.obj"
"\Xash3D\src_main\temp\launch\!release\img_wad.obj"
"\Xash3D\src_main\temp\launch\!release\library.obj"
"\Xash3D\src_main\temp\launch\!release\memlib.obj"
"\Xash3D\src_main\temp\launch\!release\network.obj"
"\Xash3D\src_main\temp\launch\!release\parselib.obj"
"\Xash3D\src_main\temp\launch\!release\snd_main.obj"
"\Xash3D\src_main\temp\launch\!release\snd_ogg.obj"
"\Xash3D\src_main\temp\launch\!release\snd_raw.obj"
"\Xash3D\src_main\temp\launch\!release\snd_utils.obj"
"\Xash3D\src_main\temp\launch\!release\snd_wav.obj"
"\Xash3D\src_main\temp\launch\!release\stdlib.obj"
"\Xash3D\src_main\temp\launch\!release\system.obj"
"\Xash3D\src_main\temp\launch\!release\utils.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D81.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D82.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\launch\!release\launch.dll "D:\Xash3D\bin\launch.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D82.bat""
Compiling...
cmd.c
console.c
cpuinfo.c
crclib.c
cvar.c
export.c
filesystem.c
img_bmp.c
img_dds.c
img_jpg.c
img_main.c
img_pcx.c
img_png.c
img_tga.c
img_utils.c
img_vtf.c
img_wad.c
library.c
memlib.c
network.c
Generating Code...
Compiling...
parselib.c
snd_main.c
snd_ogg.c
snd_raw.c
snd_utils.c
snd_wav.c
stdlib.c
system.c
utils.c
Generating Code...
Linking...
Creating library ..\temp\launch\!release/launch.lib and object ..\temp\launch\!release/launch.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\launch\!release\launch.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
launch.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1020,6 +1020,7 @@ void Sys_Init( void )
if( FS_CheckParm( "-console" )) Sys.developer = 1;
if( FS_GetParmFromCmdLine( "-dev", dev_level, sizeof( dev_level )))
Sys.developer = com_atoi( dev_level );
if( Sys.log_active && !Sys.developer ) Sys.log_active = false; // nothing to logging :)
FS_UpdateEnvironmentVariables(); // set working directory
SetErrorMode( SEM_FAILCRITICALERRORS ); // no abort/retry/fail errors

63
physic/physic.plg Normal file
View File

@ -0,0 +1,63 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: physic - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D87.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\physic\!release/" /Fd"..\temp\physic\!release/" /FD /c
"D:\Xash3D\src_main\physic\cm_debug.c"
"D:\Xash3D\src_main\physic\cm_light.c"
"D:\Xash3D\src_main\physic\cm_main.c"
"D:\Xash3D\src_main\physic\cm_model.c"
"D:\Xash3D\src_main\physic\cm_portals.c"
"D:\Xash3D\src_main\physic\cm_studio.c"
"D:\Xash3D\src_main\physic\cm_test.c"
"D:\Xash3D\src_main\physic\cm_trace.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D87.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D88.tmp" with contents
[
user32.lib msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\physic\!release/physic.dll" /implib:"..\temp\physic\!release/physic.lib" /libpath:"../public/libs/"
"\Xash3D\src_main\temp\physic\!release\cm_debug.obj"
"\Xash3D\src_main\temp\physic\!release\cm_light.obj"
"\Xash3D\src_main\temp\physic\!release\cm_main.obj"
"\Xash3D\src_main\temp\physic\!release\cm_model.obj"
"\Xash3D\src_main\temp\physic\!release\cm_portals.obj"
"\Xash3D\src_main\temp\physic\!release\cm_studio.obj"
"\Xash3D\src_main\temp\physic\!release\cm_test.obj"
"\Xash3D\src_main\temp\physic\!release\cm_trace.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D88.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D89.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\physic\!release\physic.dll "D:\Xash3D\bin\physic.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D89.bat""
Compiling...
cm_debug.c
cm_light.c
cm_main.c
cm_model.c
cm_portals.c
cm_studio.c
cm_test.c
cm_trace.c
Generating Code...
Linking...
Creating library ..\temp\physic\!release/physic.lib and object ..\temp\physic\!release/physic.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\physic\!release\physic.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
physic.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -12,11 +12,9 @@
#define false 0
#define true 1
#define STRING_COLOR_TAG '^'
#define MAX_STRING 256 // generic string
#define MAX_SYSPATH 1024 // system filepath
#define MAX_MSGLEN 32768 // max length of network message
#define IsColorString( p ) ( p && *(p) == STRING_COLOR_TAG && *((p)+1) && *((p)+1) >= '0' && *((p)+1) <= '9' )
#define bound(min, num, max) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
#define MAX_STRING_TABLES 8 // seperately stringsystems
#define MAX_MODS 128 // environment games that engine can keep visible
@ -119,12 +117,12 @@ typedef enum
CVAR_LATCH_AUDIO = BIT(13),// save changes until vsound restart
} cvar_flags_t;
typedef struct
typedef struct netadr_s
{
netadrtype_t type;
byte ip[4];
word port;
} netadr_t;
};
typedef struct sizebuf_s
{

View File

@ -20,6 +20,9 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% engine/engine.dsp %CONFIG%"engine - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% gameui/gameui.dsp %CONFIG%"gameui - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1
@ -61,6 +64,7 @@ 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
if exist gameui\gameui.plg del /f /q gameui\gameui.plg
if exist launch\launch.plg del /f /q launch\launch.plg
if exist physic\physic.plg del /f /q physic\physic.plg
if exist vid_gl\vid_gl.plg del /f /q vid_gl\vid_gl.plg

69
snd_dx/snd_dx.plg Normal file
View File

@ -0,0 +1,69 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: snd_dx - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9C.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\snd_dx\!release/" /Fd"..\temp\snd_dx\!release/" /FD /c
"D:\Xash3D\src_main\snd_dx\s_backend.c"
"D:\Xash3D\src_main\snd_dx\s_dsp.c"
"D:\Xash3D\src_main\snd_dx\s_export.c"
"D:\Xash3D\src_main\snd_dx\s_load.c"
"D:\Xash3D\src_main\snd_dx\s_main.c"
"D:\Xash3D\src_main\snd_dx\s_mix.c"
"D:\Xash3D\src_main\snd_dx\s_mouth.c"
"D:\Xash3D\src_main\snd_dx\s_stream.c"
"D:\Xash3D\src_main\snd_dx\s_utils.c"
"D:\Xash3D\src_main\snd_dx\s_vox.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9C.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9D.tmp" with contents
[
winmm.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\temp\snd_dx\!release/snd_dx.dll" /implib:"..\temp\snd_dx\!release/snd_dx.lib" /opt:nowin98
"\Xash3D\src_main\temp\snd_dx\!release\s_backend.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_dsp.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_export.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_load.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_main.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_mix.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_mouth.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_stream.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_utils.obj"
"\Xash3D\src_main\temp\snd_dx\!release\s_vox.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9D.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9E.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\snd_dx\!release\snd_dx.dll "D:\Xash3D\bin\snd_dx.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D9E.bat""
Compiling...
s_backend.c
s_dsp.c
s_export.c
s_load.c
s_main.c
s_mix.c
s_mouth.c
s_stream.c
s_utils.c
s_vox.c
Generating Code...
Linking...
Creating library ..\temp\snd_dx\!release/snd_dx.lib and object ..\temp\snd_dx\!release/snd_dx.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\snd_dx\!release\snd_dx.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
snd_dx.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

348
spirit/spirit.plg Normal file
View File

@ -0,0 +1,348 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: spirit - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D95.tmp" with contents
[
/nologo /G5 /MT /W3 /GX /O2 /I "..\spirit" /I "..\common" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fo"..\temp\spirit\!release/" /Fd"..\temp\spirit\!release/" /FD /c
"D:\Xash3D\src_main\spirit\aflock.cpp"
"D:\Xash3D\src_main\spirit\agrunt.cpp"
"D:\Xash3D\src_main\spirit\airtank.cpp"
"D:\Xash3D\src_main\spirit\alias.cpp"
"D:\Xash3D\src_main\spirit\animating.cpp"
"D:\Xash3D\src_main\spirit\animation.cpp"
"D:\Xash3D\src_main\spirit\apache.cpp"
"D:\Xash3D\src_main\spirit\barnacle.cpp"
"D:\Xash3D\src_main\spirit\barney.cpp"
"D:\Xash3D\src_main\spirit\bigmomma.cpp"
"D:\Xash3D\src_main\spirit\bloater.cpp"
"D:\Xash3D\src_main\spirit\bmodels.cpp"
"D:\Xash3D\src_main\spirit\bullsquid.cpp"
"D:\Xash3D\src_main\spirit\buttons.cpp"
"D:\Xash3D\src_main\spirit\cbase.cpp"
"D:\Xash3D\src_main\spirit\client.cpp"
"D:\Xash3D\src_main\spirit\combat.cpp"
"D:\Xash3D\src_main\spirit\controller.cpp"
"D:\Xash3D\src_main\spirit\crossbow.cpp"
"D:\Xash3D\src_main\spirit\crowbar.cpp"
"D:\Xash3D\src_main\spirit\defaultai.cpp"
"D:\Xash3D\src_main\spirit\doors.cpp"
"D:\Xash3D\src_main\spirit\effects.cpp"
"D:\Xash3D\src_main\spirit\egon.cpp"
"D:\Xash3D\src_main\spirit\explode.cpp"
"D:\Xash3D\src_main\spirit\flyingmonster.cpp"
"D:\Xash3D\src_main\spirit\func_break.cpp"
"D:\Xash3D\src_main\spirit\func_tank.cpp"
"D:\Xash3D\src_main\spirit\game.cpp"
"D:\Xash3D\src_main\spirit\gamerules.cpp"
"D:\Xash3D\src_main\spirit\gargantua.cpp"
"D:\Xash3D\src_main\spirit\gauss.cpp"
"D:\Xash3D\src_main\spirit\genericmonster.cpp"
"D:\Xash3D\src_main\spirit\ggrenade.cpp"
"D:\Xash3D\src_main\spirit\globals.cpp"
"D:\Xash3D\src_main\spirit\glock.cpp"
"D:\Xash3D\src_main\spirit\gman.cpp"
"D:\Xash3D\src_main\spirit\h_ai.cpp"
"D:\Xash3D\src_main\spirit\h_battery.cpp"
"D:\Xash3D\src_main\spirit\h_cine.cpp"
"D:\Xash3D\src_main\spirit\h_cycler.cpp"
"D:\Xash3D\src_main\spirit\h_export.cpp"
"D:\Xash3D\src_main\spirit\handgrenade.cpp"
"D:\Xash3D\src_main\spirit\hassassin.cpp"
"D:\Xash3D\src_main\spirit\headcrab.cpp"
"D:\Xash3D\src_main\spirit\healthkit.cpp"
"D:\Xash3D\src_main\spirit\hgrunt.cpp"
"D:\Xash3D\src_main\spirit\hornet.cpp"
"D:\Xash3D\src_main\spirit\hornetgun.cpp"
"D:\Xash3D\src_main\spirit\houndeye.cpp"
"D:\Xash3D\src_main\spirit\ichthyosaur.cpp"
"D:\Xash3D\src_main\spirit\islave.cpp"
"D:\Xash3D\src_main\spirit\items.cpp"
"D:\Xash3D\src_main\spirit\leech.cpp"
"D:\Xash3D\src_main\spirit\lights.cpp"
"D:\Xash3D\src_main\spirit\locus.cpp"
"D:\Xash3D\src_main\spirit\maprules.cpp"
"D:\Xash3D\src_main\spirit\monstermaker.cpp"
"D:\Xash3D\src_main\spirit\monsters.cpp"
"D:\Xash3D\src_main\spirit\monsterstate.cpp"
"D:\Xash3D\src_main\spirit\mortar.cpp"
"D:\Xash3D\src_main\spirit\movewith.cpp"
"D:\Xash3D\src_main\spirit\mp5.cpp"
"D:\Xash3D\src_main\spirit\multiplay_gamerules.cpp"
"D:\Xash3D\src_main\spirit\nihilanth.cpp"
"D:\Xash3D\src_main\spirit\nodes.cpp"
"D:\Xash3D\src_main\spirit\osprey.cpp"
"D:\Xash3D\src_main\spirit\pathcorner.cpp"
"D:\Xash3D\src_main\spirit\plane.cpp"
"D:\Xash3D\src_main\spirit\plats.cpp"
"D:\Xash3D\src_main\spirit\player.cpp"
"D:\Xash3D\src_main\game_shared\pm_shared.cpp"
"D:\Xash3D\src_main\spirit\python.cpp"
"D:\Xash3D\src_main\spirit\rat.cpp"
"D:\Xash3D\src_main\spirit\roach.cpp"
"D:\Xash3D\src_main\spirit\rpg.cpp"
"D:\Xash3D\src_main\spirit\satchel.cpp"
"D:\Xash3D\src_main\spirit\schedule.cpp"
"D:\Xash3D\src_main\spirit\scientist.cpp"
"D:\Xash3D\src_main\spirit\scripted.cpp"
"D:\Xash3D\src_main\spirit\shotgun.cpp"
"D:\Xash3D\src_main\spirit\singleplay_gamerules.cpp"
"D:\Xash3D\src_main\spirit\skill.cpp"
"D:\Xash3D\src_main\spirit\sound.cpp"
"D:\Xash3D\src_main\spirit\soundent.cpp"
"D:\Xash3D\src_main\spirit\spectator.cpp"
"D:\Xash3D\src_main\spirit\squadmonster.cpp"
"D:\Xash3D\src_main\spirit\squeakgrenade.cpp"
"D:\Xash3D\src_main\spirit\subs.cpp"
"D:\Xash3D\src_main\spirit\talkmonster.cpp"
"D:\Xash3D\src_main\spirit\teamplay_gamerules.cpp"
"D:\Xash3D\src_main\spirit\tentacle.cpp"
"D:\Xash3D\src_main\spirit\triggers.cpp"
"D:\Xash3D\src_main\spirit\tripmine.cpp"
"D:\Xash3D\src_main\spirit\turret.cpp"
"D:\Xash3D\src_main\spirit\util.cpp"
"D:\Xash3D\src_main\spirit\weapons.cpp"
"D:\Xash3D\src_main\spirit\world.cpp"
"D:\Xash3D\src_main\spirit\xen.cpp"
"D:\Xash3D\src_main\spirit\zombie.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D95.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D96.tmp" with contents
[
msvcrt.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libcmt.lib" /def:".\spirit.def" /out:"..\temp\spirit\!release/server.dll" /implib:"..\temp\spirit\!release/server.lib"
"\Xash3D\src_main\temp\spirit\!release\aflock.obj"
"\Xash3D\src_main\temp\spirit\!release\agrunt.obj"
"\Xash3D\src_main\temp\spirit\!release\airtank.obj"
"\Xash3D\src_main\temp\spirit\!release\alias.obj"
"\Xash3D\src_main\temp\spirit\!release\animating.obj"
"\Xash3D\src_main\temp\spirit\!release\animation.obj"
"\Xash3D\src_main\temp\spirit\!release\apache.obj"
"\Xash3D\src_main\temp\spirit\!release\barnacle.obj"
"\Xash3D\src_main\temp\spirit\!release\barney.obj"
"\Xash3D\src_main\temp\spirit\!release\bigmomma.obj"
"\Xash3D\src_main\temp\spirit\!release\bloater.obj"
"\Xash3D\src_main\temp\spirit\!release\bmodels.obj"
"\Xash3D\src_main\temp\spirit\!release\bullsquid.obj"
"\Xash3D\src_main\temp\spirit\!release\buttons.obj"
"\Xash3D\src_main\temp\spirit\!release\cbase.obj"
"\Xash3D\src_main\temp\spirit\!release\client.obj"
"\Xash3D\src_main\temp\spirit\!release\combat.obj"
"\Xash3D\src_main\temp\spirit\!release\controller.obj"
"\Xash3D\src_main\temp\spirit\!release\crossbow.obj"
"\Xash3D\src_main\temp\spirit\!release\crowbar.obj"
"\Xash3D\src_main\temp\spirit\!release\defaultai.obj"
"\Xash3D\src_main\temp\spirit\!release\doors.obj"
"\Xash3D\src_main\temp\spirit\!release\effects.obj"
"\Xash3D\src_main\temp\spirit\!release\egon.obj"
"\Xash3D\src_main\temp\spirit\!release\explode.obj"
"\Xash3D\src_main\temp\spirit\!release\flyingmonster.obj"
"\Xash3D\src_main\temp\spirit\!release\func_break.obj"
"\Xash3D\src_main\temp\spirit\!release\func_tank.obj"
"\Xash3D\src_main\temp\spirit\!release\game.obj"
"\Xash3D\src_main\temp\spirit\!release\gamerules.obj"
"\Xash3D\src_main\temp\spirit\!release\gargantua.obj"
"\Xash3D\src_main\temp\spirit\!release\gauss.obj"
"\Xash3D\src_main\temp\spirit\!release\genericmonster.obj"
"\Xash3D\src_main\temp\spirit\!release\ggrenade.obj"
"\Xash3D\src_main\temp\spirit\!release\globals.obj"
"\Xash3D\src_main\temp\spirit\!release\glock.obj"
"\Xash3D\src_main\temp\spirit\!release\gman.obj"
"\Xash3D\src_main\temp\spirit\!release\h_ai.obj"
"\Xash3D\src_main\temp\spirit\!release\h_battery.obj"
"\Xash3D\src_main\temp\spirit\!release\h_cine.obj"
"\Xash3D\src_main\temp\spirit\!release\h_cycler.obj"
"\Xash3D\src_main\temp\spirit\!release\h_export.obj"
"\Xash3D\src_main\temp\spirit\!release\handgrenade.obj"
"\Xash3D\src_main\temp\spirit\!release\hassassin.obj"
"\Xash3D\src_main\temp\spirit\!release\headcrab.obj"
"\Xash3D\src_main\temp\spirit\!release\healthkit.obj"
"\Xash3D\src_main\temp\spirit\!release\hgrunt.obj"
"\Xash3D\src_main\temp\spirit\!release\hornet.obj"
"\Xash3D\src_main\temp\spirit\!release\hornetgun.obj"
"\Xash3D\src_main\temp\spirit\!release\houndeye.obj"
"\Xash3D\src_main\temp\spirit\!release\ichthyosaur.obj"
"\Xash3D\src_main\temp\spirit\!release\islave.obj"
"\Xash3D\src_main\temp\spirit\!release\items.obj"
"\Xash3D\src_main\temp\spirit\!release\leech.obj"
"\Xash3D\src_main\temp\spirit\!release\lights.obj"
"\Xash3D\src_main\temp\spirit\!release\locus.obj"
"\Xash3D\src_main\temp\spirit\!release\maprules.obj"
"\Xash3D\src_main\temp\spirit\!release\monstermaker.obj"
"\Xash3D\src_main\temp\spirit\!release\monsters.obj"
"\Xash3D\src_main\temp\spirit\!release\monsterstate.obj"
"\Xash3D\src_main\temp\spirit\!release\mortar.obj"
"\Xash3D\src_main\temp\spirit\!release\movewith.obj"
"\Xash3D\src_main\temp\spirit\!release\mp5.obj"
"\Xash3D\src_main\temp\spirit\!release\multiplay_gamerules.obj"
"\Xash3D\src_main\temp\spirit\!release\nihilanth.obj"
"\Xash3D\src_main\temp\spirit\!release\nodes.obj"
"\Xash3D\src_main\temp\spirit\!release\osprey.obj"
"\Xash3D\src_main\temp\spirit\!release\pathcorner.obj"
"\Xash3D\src_main\temp\spirit\!release\plane.obj"
"\Xash3D\src_main\temp\spirit\!release\plats.obj"
"\Xash3D\src_main\temp\spirit\!release\player.obj"
"\Xash3D\src_main\temp\spirit\!release\pm_shared.obj"
"\Xash3D\src_main\temp\spirit\!release\python.obj"
"\Xash3D\src_main\temp\spirit\!release\rat.obj"
"\Xash3D\src_main\temp\spirit\!release\roach.obj"
"\Xash3D\src_main\temp\spirit\!release\rpg.obj"
"\Xash3D\src_main\temp\spirit\!release\satchel.obj"
"\Xash3D\src_main\temp\spirit\!release\schedule.obj"
"\Xash3D\src_main\temp\spirit\!release\scientist.obj"
"\Xash3D\src_main\temp\spirit\!release\scripted.obj"
"\Xash3D\src_main\temp\spirit\!release\shotgun.obj"
"\Xash3D\src_main\temp\spirit\!release\singleplay_gamerules.obj"
"\Xash3D\src_main\temp\spirit\!release\skill.obj"
"\Xash3D\src_main\temp\spirit\!release\sound.obj"
"\Xash3D\src_main\temp\spirit\!release\soundent.obj"
"\Xash3D\src_main\temp\spirit\!release\spectator.obj"
"\Xash3D\src_main\temp\spirit\!release\squadmonster.obj"
"\Xash3D\src_main\temp\spirit\!release\squeakgrenade.obj"
"\Xash3D\src_main\temp\spirit\!release\subs.obj"
"\Xash3D\src_main\temp\spirit\!release\talkmonster.obj"
"\Xash3D\src_main\temp\spirit\!release\teamplay_gamerules.obj"
"\Xash3D\src_main\temp\spirit\!release\tempmonster.obj"
"\Xash3D\src_main\temp\spirit\!release\tentacle.obj"
"\Xash3D\src_main\temp\spirit\!release\triggers.obj"
"\Xash3D\src_main\temp\spirit\!release\tripmine.obj"
"\Xash3D\src_main\temp\spirit\!release\turret.obj"
"\Xash3D\src_main\temp\spirit\!release\util.obj"
"\Xash3D\src_main\temp\spirit\!release\weapons.obj"
"\Xash3D\src_main\temp\spirit\!release\world.obj"
"\Xash3D\src_main\temp\spirit\!release\xen.obj"
"\Xash3D\src_main\temp\spirit\!release\zombie.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D96.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D97.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\spirit\!release\server.dll "D:\Xash3D\spirit\bin\server.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D97.bat""
Compiling...
aflock.cpp
agrunt.cpp
airtank.cpp
alias.cpp
animating.cpp
animation.cpp
apache.cpp
barnacle.cpp
barney.cpp
bigmomma.cpp
bloater.cpp
bmodels.cpp
bullsquid.cpp
buttons.cpp
cbase.cpp
client.cpp
combat.cpp
controller.cpp
crossbow.cpp
crowbar.cpp
Generating Code...
Compiling...
defaultai.cpp
doors.cpp
effects.cpp
egon.cpp
explode.cpp
flyingmonster.cpp
func_break.cpp
func_tank.cpp
game.cpp
gamerules.cpp
gargantua.cpp
gauss.cpp
genericmonster.cpp
ggrenade.cpp
globals.cpp
glock.cpp
gman.cpp
h_ai.cpp
h_battery.cpp
h_cine.cpp
Generating Code...
Compiling...
h_cycler.cpp
h_export.cpp
handgrenade.cpp
hassassin.cpp
headcrab.cpp
healthkit.cpp
hgrunt.cpp
hornet.cpp
hornetgun.cpp
houndeye.cpp
ichthyosaur.cpp
islave.cpp
items.cpp
leech.cpp
lights.cpp
locus.cpp
maprules.cpp
monstermaker.cpp
monsters.cpp
monsterstate.cpp
Generating Code...
Compiling...
mortar.cpp
movewith.cpp
mp5.cpp
multiplay_gamerules.cpp
nihilanth.cpp
nodes.cpp
osprey.cpp
pathcorner.cpp
plane.cpp
plats.cpp
player.cpp
pm_shared.cpp
python.cpp
rat.cpp
roach.cpp
rpg.cpp
satchel.cpp
schedule.cpp
scientist.cpp
scripted.cpp
Generating Code...
Compiling...
shotgun.cpp
singleplay_gamerules.cpp
skill.cpp
sound.cpp
soundent.cpp
spectator.cpp
squadmonster.cpp
squeakgrenade.cpp
subs.cpp
talkmonster.cpp
teamplay_gamerules.cpp
tentacle.cpp
triggers.cpp
tripmine.cpp
turret.cpp
util.cpp
weapons.cpp
world.cpp
xen.cpp
zombie.cpp
Generating Code...
Linking...
Creating library ..\temp\spirit\!release/server.lib and object ..\temp\spirit\!release/server.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\spirit\!release\server.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -920,7 +920,7 @@ void GL_InitExtensions( void )
glConfig.max_texture_anisotropy = 0.0f;
GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_ext_anisotropic_filter", R_ANISOTROPY_EXT );
if(GL_Support( R_ANISOTROPY_EXT )) pglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy );
if(GL_Support( R_ANISOTROPY_EXT )) pglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy );
GL_CheckExtension( "GL_EXT_texture_lod_bias", NULL, "gl_ext_texture_lodbias", R_TEXTURE_LODBIAS );
if(GL_Support( R_TEXTURE_LODBIAS )) pglGetFloatv( GL_MAX_TEXTURE_LOD_BIAS_EXT, &glConfig.max_texture_lodbias );

View File

@ -222,9 +222,9 @@ void R_ClearShadowmaps( void )
return;
// clear all possible values, should be called once per scene
memset( r_shadowGroups, 0, sizeof( r_shadowGroups ) );
memset( r_entShadowBits, 0, sizeof( r_entShadowBits ) );
memset( r_shadowGroups_hash, 0, sizeof( r_shadowGroups_hash ) );
Mem_Set( r_shadowGroups, 0, sizeof( r_shadowGroups ));
Mem_Set( r_entShadowBits, 0, sizeof( r_entShadowBits ));
Mem_Set( r_shadowGroups_hash, 0, sizeof( r_shadowGroups_hash ));
}
/*
@ -435,8 +435,9 @@ void R_DrawShadowmaps( void )
if( !( RI.params & RP_WORLDSURFVISIBLE ) )
continue; // we didn't cast any shadows on opaque meshes so discard this group
if( !( prevRI.shadowBits & group->bit ) )
{ // capture results from framebuffer into depth texture
if( !( prevRI.shadowBits & group->bit ))
{
// capture results from framebuffer into depth texture
prevRI.shadowBits |= group->bit;
GL_Bind( 0, group->depthTexture );
pglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, RI.refdef.viewport[0], RI.refdef.viewport[1], textureWidth, textureHeight );

107
vid_gl/vid_gl.plg Normal file
View File

@ -0,0 +1,107 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: vid_gl - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D8E.tmp" with contents
[
/nologo /ML /W3 /GX /O2 /Ob2 /I "../public" /I "../common" /I "../game_shared" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\vid_gl\!release/" /Fd"..\temp\vid_gl\!release/" /FD /c
"D:\Xash3D\src_main\vid_gl\r_backend.c"
"D:\Xash3D\src_main\vid_gl\r_bloom.c"
"D:\Xash3D\src_main\vid_gl\r_cin.c"
"D:\Xash3D\src_main\vid_gl\r_cull.c"
"D:\Xash3D\src_main\vid_gl\r_decals.c"
"D:\Xash3D\src_main\vid_gl\r_draw.c"
"D:\Xash3D\src_main\vid_gl\r_image.c"
"D:\Xash3D\src_main\vid_gl\r_light.c"
"D:\Xash3D\src_main\vid_gl\r_main.c"
"D:\Xash3D\src_main\vid_gl\r_math.c"
"D:\Xash3D\src_main\vid_gl\r_mesh.c"
"D:\Xash3D\src_main\vid_gl\r_model.c"
"D:\Xash3D\src_main\vid_gl\r_opengl.c"
"D:\Xash3D\src_main\vid_gl\r_poly.c"
"D:\Xash3D\src_main\vid_gl\r_program.c"
"D:\Xash3D\src_main\vid_gl\r_register.c"
"D:\Xash3D\src_main\vid_gl\r_shader.c"
"D:\Xash3D\src_main\vid_gl\r_shadow.c"
"D:\Xash3D\src_main\vid_gl\r_sky.c"
"D:\Xash3D\src_main\vid_gl\r_sprite.c"
"D:\Xash3D\src_main\vid_gl\r_studio.c"
"D:\Xash3D\src_main\vid_gl\r_surf.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D8E.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D8F.tmp" with contents
[
msvcrt.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\vid_gl\!release/vid_gl.dll" /implib:"..\temp\vid_gl\!release/vid_gl.lib" /libpath:"../public/libs/"
"\Xash3D\src_main\temp\vid_gl\!release\r_backend.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_bloom.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_cin.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_cull.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_decals.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_draw.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_image.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_light.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_main.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_math.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_mesh.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_model.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_opengl.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_poly.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_program.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_register.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_shader.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_shadow.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_sky.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_sprite.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_studio.obj"
"\Xash3D\src_main\temp\vid_gl\!release\r_surf.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D8F.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D90.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\vid_gl\!release\vid_gl.dll "D:\Xash3D\bin\vid_gl.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2D90.bat""
Compiling...
r_backend.c
r_bloom.c
r_cin.c
r_cull.c
r_decals.c
r_draw.c
r_image.c
r_light.c
r_main.c
r_math.c
r_mesh.c
r_model.c
r_opengl.c
r_poly.c
r_program.c
r_register.c
r_shader.c
r_shadow.c
r_sky.c
r_sprite.c
Generating Code...
Compiling...
r_studio.c
r_surf.c
Generating Code...
Linking...
Creating library ..\temp\vid_gl\!release/vid_gl.lib and object ..\temp\vid_gl\!release/vid_gl.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\vid_gl\!release\vid_gl.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
vid_gl.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -51,6 +51,18 @@ Package=<4>
###############################################################################
Project: "gameui"=".\gameui\gameui.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "xtools"=".\xtools\xtools.dsp" - Package Owner=<4>
Package=<5>

81
xtools/xtools.plg Normal file
View File

@ -0,0 +1,81 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: xtools - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA3.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "bsplib" /I "ripper" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\xtools\!release/" /Fd"..\temp\xtools\!release/" /FD /c
"D:\Xash3D\src_main\xtools\bsplib.c"
"D:\Xash3D\src_main\xtools\ripper\conv_bsplumps.c"
"D:\Xash3D\src_main\xtools\ripper\conv_doom.c"
"D:\Xash3D\src_main\xtools\ripper\conv_image.c"
"D:\Xash3D\src_main\xtools\ripper\conv_main.c"
"D:\Xash3D\src_main\xtools\ripper\conv_shader.c"
"D:\Xash3D\src_main\xtools\ripper\conv_sprite.c"
"D:\Xash3D\src_main\xtools\spritegen.c"
"D:\Xash3D\src_main\xtools\studio.c"
"D:\Xash3D\src_main\xtools\studio_utils.c"
"D:\Xash3D\src_main\xtools\utils.c"
"D:\Xash3D\src_main\xtools\wadlib.c"
"D:\Xash3D\src_main\xtools\ximage.c"
"D:\Xash3D\src_main\xtools\xtools.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA3.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA4.tmp" with contents
[
msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\xtools\!release/xtools.dll" /implib:"..\temp\xtools\!release/xtools.lib" /opt:nowin98
"\Xash3D\src_main\temp\xtools\!release\bsplib.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_bsplumps.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_doom.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_image.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_main.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_shader.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_sprite.obj"
"\Xash3D\src_main\temp\xtools\!release\spritegen.obj"
"\Xash3D\src_main\temp\xtools\!release\studio.obj"
"\Xash3D\src_main\temp\xtools\!release\studio_utils.obj"
"\Xash3D\src_main\temp\xtools\!release\utils.obj"
"\Xash3D\src_main\temp\xtools\!release\wadlib.obj"
"\Xash3D\src_main\temp\xtools\!release\ximage.obj"
"\Xash3D\src_main\temp\xtools\!release\xtools.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA4.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA5.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\xtools\!release\xtools.dll "D:\Xash3D\bin\xtools.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2DA5.bat""
Compiling...
bsplib.c
conv_bsplumps.c
conv_doom.c
conv_image.c
conv_main.c
conv_shader.c
conv_sprite.c
spritegen.c
studio.c
studio_utils.c
utils.c
wadlib.c
ximage.c
xtools.c
Generating Code...
Linking...
Creating library ..\temp\xtools\!release/xtools.lib and object ..\temp\xtools\!release/xtools.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\xtools\!release\xtools.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
xtools.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>