Initial commit.

This commit is contained in:
Jim Gray
2013-04-04 14:32:05 -07:00
parent ba5c81da32
commit d71d53e8ec
2180 changed files with 1393544 additions and 1 deletions

349
codemp/ui/keycodes.h Normal file
View File

@@ -0,0 +1,349 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#ifndef __KEYCODES_H__
#define __KEYCODES_H__
// these are the key numbers that should be passed to KeyEvent
typedef enum
{
A_NULL = 0,
A_SHIFT,
A_CTRL,
A_ALT,
A_CAPSLOCK,
A_NUMLOCK,
A_SCROLLLOCK,
A_PAUSE,
A_BACKSPACE,
A_TAB,
A_ENTER,
A_KP_PLUS,
A_KP_MINUS,
A_KP_ENTER,
A_KP_PERIOD,
A_PRINTSCREEN,
A_KP_0,
A_KP_1,
A_KP_2,
A_KP_3,
A_KP_4,
A_KP_5,
A_KP_6,
A_KP_7,
A_KP_8,
A_KP_9,
A_CONSOLE,
A_ESCAPE,
A_F1,
A_F2,
A_F3,
A_F4,
A_SPACE,
A_PLING,
A_DOUBLE_QUOTE,
A_HASH,
A_STRING,
A_PERCENT,
A_AND,
A_SINGLE_QUOTE,
A_OPEN_BRACKET,
A_CLOSE_BRACKET,
A_STAR,
A_PLUS,
A_COMMA,
A_MINUS,
A_PERIOD,
A_FORWARD_SLASH,
A_0,
A_1,
A_2,
A_3,
A_4,
A_5,
A_6,
A_7,
A_8,
A_9,
A_COLON,
A_SEMICOLON,
A_LESSTHAN,
A_EQUALS,
A_GREATERTHAN,
A_QUESTION,
A_AT,
A_CAP_A,
A_CAP_B,
A_CAP_C,
A_CAP_D,
A_CAP_E,
A_CAP_F,
A_CAP_G,
A_CAP_H,
A_CAP_I,
A_CAP_J,
A_CAP_K,
A_CAP_L,
A_CAP_M,
A_CAP_N,
A_CAP_O,
A_CAP_P,
A_CAP_Q,
A_CAP_R,
A_CAP_S,
A_CAP_T,
A_CAP_U,
A_CAP_V,
A_CAP_W,
A_CAP_X,
A_CAP_Y,
A_CAP_Z,
A_OPEN_SQUARE,
A_BACKSLASH,
A_CLOSE_SQUARE,
A_CARET,
A_UNDERSCORE,
A_LEFT_SINGLE_QUOTE,
A_LOW_A,
A_LOW_B,
A_LOW_C,
A_LOW_D,
A_LOW_E,
A_LOW_F,
A_LOW_G,
A_LOW_H,
A_LOW_I,
A_LOW_J,
A_LOW_K,
A_LOW_L,
A_LOW_M,
A_LOW_N,
A_LOW_O,
A_LOW_P,
A_LOW_Q,
A_LOW_R,
A_LOW_S,
A_LOW_T,
A_LOW_U,
A_LOW_V,
A_LOW_W,
A_LOW_X,
A_LOW_Y,
A_LOW_Z,
A_OPEN_BRACE,
A_BAR,
A_CLOSE_BRACE,
A_TILDE,
A_DELETE,
A_EURO,
A_SHIFT2,
A_CTRL2,
A_ALT2,
A_F5,
A_F6,
A_F7,
A_F8,
A_CIRCUMFLEX,
A_MWHEELUP,
A_CAP_SCARON,
A_MWHEELDOWN,
A_CAP_OE,
A_MOUSE1,
A_MOUSE2,
A_INSERT,
A_HOME,
A_PAGE_UP,
A_RIGHT_SINGLE_QUOTE,
A_LEFT_DOUBLE_QUOTE,
A_RIGHT_DOUBLE_QUOTE,
A_F9,
A_F10,
A_F11,
A_F12,
A_TRADEMARK,
A_LOW_SCARON,
A_SHIFT_ENTER,
A_LOW_OE,
A_END,
A_PAGE_DOWN,
A_CAP_YDIERESIS,
A_SHIFT_SPACE,
A_EXCLAMDOWN,
A_CENT,
A_POUND,
A_SHIFT_KP_ENTER,
A_YEN,
A_MOUSE3,
A_MOUSE4,
A_MOUSE5,
A_COPYRIGHT,
A_CURSOR_UP,
A_CURSOR_DOWN,
A_CURSOR_LEFT,
A_CURSOR_RIGHT,
A_REGISTERED,
A_UNDEFINED_7,
A_UNDEFINED_8,
A_UNDEFINED_9,
A_UNDEFINED_10,
A_UNDEFINED_11,
A_UNDEFINED_12,
A_UNDEFINED_13,
A_UNDEFINED_14,
A_UNDEFINED_15,
A_UNDEFINED_16,
A_UNDEFINED_17,
A_UNDEFINED_18,
A_UNDEFINED_19,
A_UNDEFINED_20,
A_UNDEFINED_21,
A_UNDEFINED_22,
A_QUESTION_DOWN,
A_CAP_AGRAVE,
A_CAP_AACUTE,
A_CAP_ACIRCUMFLEX,
A_CAP_ATILDE,
A_CAP_ADIERESIS,
A_CAP_ARING,
A_CAP_AE,
A_CAP_CCEDILLA,
A_CAP_EGRAVE,
A_CAP_EACUTE,
A_CAP_ECIRCUMFLEX,
A_CAP_EDIERESIS,
A_CAP_IGRAVE,
A_CAP_IACUTE,
A_CAP_ICIRCUMFLEX,
A_CAP_IDIERESIS,
A_CAP_ETH,
A_CAP_NTILDE,
A_CAP_OGRAVE,
A_CAP_OACUTE,
A_CAP_OCIRCUMFLEX,
A_CAP_OTILDE,
A_CAP_ODIERESIS,
A_MULTIPLY,
A_CAP_OSLASH,
A_CAP_UGRAVE,
A_CAP_UACUTE,
A_CAP_UCIRCUMFLEX,
A_CAP_UDIERESIS,
A_CAP_YACUTE,
A_CAP_THORN,
A_GERMANDBLS,
A_LOW_AGRAVE,
A_LOW_AACUTE,
A_LOW_ACIRCUMFLEX,
A_LOW_ATILDE,
A_LOW_ADIERESIS,
A_LOW_ARING,
A_LOW_AE,
A_LOW_CCEDILLA,
A_LOW_EGRAVE,
A_LOW_EACUTE,
A_LOW_ECIRCUMFLEX,
A_LOW_EDIERESIS,
A_LOW_IGRAVE,
A_LOW_IACUTE,
A_LOW_ICIRCUMFLEX,
A_LOW_IDIERESIS,
A_LOW_ETH,
A_LOW_NTILDE,
A_LOW_OGRAVE,
A_LOW_OACUTE,
A_LOW_OCIRCUMFLEX,
A_LOW_OTILDE,
A_LOW_ODIERESIS,
A_DIVIDE,
A_LOW_OSLASH,
A_LOW_UGRAVE,
A_LOW_UACUTE,
A_LOW_UCIRCUMFLEX,
A_LOW_UDIERESIS,
A_LOW_YACUTE,
A_LOW_THORN,
A_LOW_YDIERESIS,
A_JOY0,
A_JOY1,
A_JOY2,
A_JOY3,
A_JOY4,
A_JOY5,
A_JOY6,
A_JOY7,
A_JOY8,
A_JOY9,
A_JOY10,
A_JOY11,
A_JOY12,
A_JOY13,
A_JOY14,
A_JOY15,
A_JOY16,
A_JOY17,
A_JOY18,
A_JOY19,
A_JOY20,
A_JOY21,
A_JOY22,
A_JOY23,
A_JOY24,
A_JOY25,
A_JOY26,
A_JOY27,
A_JOY28,
A_JOY29,
A_JOY30,
A_JOY31,
A_AUX0,
A_AUX1,
A_AUX2,
A_AUX3,
A_AUX4,
A_AUX5,
A_AUX6,
A_AUX7,
A_AUX8,
A_AUX9,
A_AUX10,
A_AUX11,
A_AUX12,
A_AUX13,
A_AUX14,
A_AUX15,
A_AUX16,
A_AUX17,
A_AUX18,
A_AUX19,
A_AUX20,
A_AUX21,
A_AUX22,
A_AUX23,
A_AUX24,
A_AUX25,
A_AUX26,
A_AUX27,
A_AUX28,
A_AUX29,
A_AUX30,
A_AUX31,
MAX_KEYS
} fakeAscii_t;
// The menu code needs to get both key and char events, but
// to avoid duplicating the paths, the char events are just
// distinguished by or'ing in K_CHAR_FLAG (ugly)
#define K_CHAR_FLAG 1024
#endif

19
codemp/ui/ui.bat Normal file
View File

@@ -0,0 +1,19 @@
echo off
REM del /q vm
REM rww - removed this.. point of makefile is not have to rebuild all of it
mkdir vm
del vm\bg_lib.asm
asm2mak ui makefile
make ui
cd vm
mkdir "..\..\base\vm"
copy *.map "..\..\base\vm"
copy *.qvm "..\..\base\vm"
:quit
cd ..

3
codemp/ui/ui.def Normal file
View File

@@ -0,0 +1,3 @@
EXPORTS
vmMain
dllEntry

267
codemp/ui/ui.dsp Normal file
View File

@@ -0,0 +1,267 @@
# Microsoft Developer Studio Project File - Name="ui" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=ui - Win32 Release JK2
!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 "ui.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 "ui.mak" CFG="ui - Win32 Release JK2"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ui - Win32 Release JK2" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ui - Win32 Debug JK2" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ui - Win32 Final JK2" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/jedi/codemp/ui", YSAAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ui - Win32 Release JK2"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ui___Win32_Release_TA"
# PROP BASE Intermediate_Dir "ui___Win32_Release_TA"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Release"
# PROP Intermediate_Dir "../Release/ui"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /YX /FD /c
# ADD CPP /nologo /G6 /W4 /GX /Zi /O2 /D "NDEBUG" /D "_USRDL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "UI_EXPORTS" /D "MISSIONPACK" /D "_JK2" /YX /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDebug" /mktyplib203 /win32
# ADD MTL /nologo /D "NDebug" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDebug"
# ADD RSC /l 0x409 /d "NDebug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /base:"0x40000000" /dll /map /machine:I386 /out:"../Release/uix86.dll"
# ADD LINK32 /nologo /base:"0x40000000" /dll /map /debug /machine:I386 /out:"../Release/uix86.dll"
!ELSEIF "$(CFG)" == "ui - Win32 Debug JK2"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "ui___Win32_Debug_TA"
# PROP BASE Intermediate_Dir "ui___Win32_Debug_TA"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Debug"
# PROP Intermediate_Dir "../Debug/ui"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /FR /YX /FD /GZ /c
# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "_USRDLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "UI_EXPORTS" /D "MISSIONPACK" /D "_JK2" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_Debug" /mktyplib203 /win32
# ADD MTL /nologo /D "_Debug" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_Debug"
# ADD RSC /l 0x409 /d "_Debug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /base:"0x40000000" /dll /pdb:"../Debug/ui.pdb" /map /debug /machine:I386 /out:"../Debug/uix86_new.dll" /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /base:"0x40000000" /dll /map /debug /machine:I386 /out:"../Debug/uix86.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "ui - Win32 Final JK2"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ui___Win32_Final_JK2"
# PROP BASE Intermediate_Dir "ui___Win32_Final_JK2"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Final"
# PROP Intermediate_Dir "../Final/ui"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /W4 /GX /Zi /O2 /I "../jk2/game" /I "." /D "NDebug" /D "_USRDL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "UI_EXPORTS" /D "MISSIONPACK" /D "_JK2" /YX /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G6 /W4 /GX /O2 /D "NDEBUG" /D "_USRDL" /D "_WINDOWS" /D "_MBCS" /D "UI_EXPORTS" /D "MISSIONPACK" /D "WIN32" /D "_JK2" /D "FINAL_BUILD" /YX /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDebug" /mktyplib203 /win32
# ADD MTL /nologo /D "NDebug" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDebug"
# ADD RSC /l 0x409 /d "NDebug"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /base:"0x40000000" /dll /map /debug /machine:I386 /out:"../Release/uix86.dll"
# ADD LINK32 /nologo /base:"0x40000000" /dll /map /debug /machine:I386 /out:"../Final/uix86.dll"
!ENDIF
# Begin Target
# Name "ui - Win32 Release JK2"
# Name "ui - Win32 Debug JK2"
# Name "ui - Win32 Final JK2"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\game\bg_lib.c
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\game\bg_misc.c
# End Source File
# Begin Source File
SOURCE=..\game\bg_weapons.c
# End Source File
# Begin Source File
SOURCE=..\game\q_math.c
# End Source File
# Begin Source File
SOURCE=..\game\q_shared.c
# End Source File
# Begin Source File
SOURCE=.\ui_atoms.c
# End Source File
# Begin Source File
SOURCE=.\ui_force.c
# End Source File
# Begin Source File
SOURCE=.\ui_gameinfo.c
# End Source File
# Begin Source File
SOURCE=.\ui_main.c
# End Source File
# Begin Source File
SOURCE=.\ui_shared.c
# End Source File
# Begin Source File
SOURCE=.\ui_syscalls.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\game\anims.h
# End Source File
# Begin Source File
SOURCE=..\game\bg_local.h
# End Source File
# Begin Source File
SOURCE=..\game\bg_public.h
# End Source File
# Begin Source File
SOURCE=..\game\bg_strap.h
# End Source File
# Begin Source File
SOURCE=..\game\bg_weapons.h
# End Source File
# Begin Source File
SOURCE=..\qcommon\disablewarnings.h
# End Source File
# Begin Source File
SOURCE=..\qcommon\game_version.h
# End Source File
# Begin Source File
SOURCE=.\keycodes.h
# End Source File
# Begin Source File
SOURCE=..\..\ui\menudef.h
# End Source File
# Begin Source File
SOURCE=..\game\q_shared.h
# End Source File
# Begin Source File
SOURCE=..\qcommon\qfiles.h
# End Source File
# Begin Source File
SOURCE=..\game\surfaceflags.h
# End Source File
# Begin Source File
SOURCE=..\qcommon\tags.h
# End Source File
# Begin Source File
SOURCE=..\cgame\tr_types.h
# End Source File
# Begin Source File
SOURCE=.\ui.def
# End Source File
# Begin Source File
SOURCE=.\ui_force.h
# End Source File
# Begin Source File
SOURCE=.\ui_local.h
# End Source File
# Begin Source File
SOURCE=.\ui_public.h
# End Source File
# Begin Source File
SOURCE=.\ui_shared.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\ui.bat
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\ui.q3asm
# PROP Exclude_From_Build 1
# End Source File
# End Target
# End Project

433
codemp/ui/ui.vcproj Normal file
View File

@@ -0,0 +1,433 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="ui"
SccProjectName="&quot;$/jedi/codemp/ui&quot;, YSAAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:Microsoft Visual SourceSafe">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Final|Win32"
OutputDirectory=".\../Final"
IntermediateDirectory=".\../Final/ui"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="0">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
ImproveFloatingPointConsistency="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE"
PreprocessorDefinitions="NDEBUG;_USRDL;_WINDOWS;UI_EXPORTS;MISSIONPACK;WIN32;_JK2;FINAL_BUILD"
StringPooling="TRUE"
RuntimeLibrary="4"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\../Final/ui/ui.pch"
AssemblerListingLocation=".\../Final/ui/"
ObjectFile=".\../Final/ui/"
ProgramDataBaseFileName=".\../Final/ui/"
WarningLevel="4"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile="../Final/uix86.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\ui.def"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
GenerateMapFile="TRUE"
MapFileName=".\../Final/uix86.map"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="TRUE"
BaseAddress="0x40000000"
ImportLibrary=".\../Final/uix86.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDebug"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Final/ui.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDebug"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../Debug"
IntermediateDirectory=".\../Debug/ui"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="0">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="2"
PreprocessorDefinitions="_DEBUG;_USRDLL;WIN32;_WINDOWS;UI_EXPORTS;MISSIONPACK;_JK2"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\../Debug/ui/ui.pch"
AssemblerListingLocation=".\../Debug/ui/"
ObjectFile=".\../Debug/ui/"
ProgramDataBaseFileName=".\../Debug/ui/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile="../Debug/uix86.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\ui.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/uix86.pdb"
GenerateMapFile="TRUE"
MapFileName=".\../Debug/uix86.map"
BaseAddress="0x40000000"
ImportLibrary=".\../Debug/uix86.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_Debug"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/ui.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_Debug"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\../Release"
IntermediateDirectory=".\../Release/ui"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="0">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
ImproveFloatingPointConsistency="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE"
PreprocessorDefinitions="NDEBUG;_USRDL;WIN32;_WINDOWS;UI_EXPORTS;MISSIONPACK;_JK2"
StringPooling="TRUE"
MinimalRebuild="TRUE"
RuntimeLibrary="4"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\../Release/ui/ui.pch"
AssemblerListingLocation=".\../Release/ui/"
ObjectFile=".\../Release/ui/"
ProgramDataBaseFileName=".\../Release/ui/"
WarningLevel="4"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile="../Release/uix86.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\ui.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Release/uix86.pdb"
GenerateMapFile="TRUE"
MapFileName=".\../Release/uix86.map"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="TRUE"
BaseAddress="0x40000000"
ImportLibrary=".\../Release/uix86.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDebug"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Release/ui.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDebug"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Debug(SH)|Win32"
OutputDirectory="Debug(SH)"
IntermediateDirectory="Debug(SH)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="0">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="2"
PreprocessorDefinitions="_DEBUG;_USRDLL;WIN32;_WINDOWS;UI_EXPORTS;MISSIONPACK;_JK2"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\../Debug/ui/ui.pch"
AssemblerListingLocation=".\../Debug/ui/"
ObjectFile=".\../Debug/ui/"
ProgramDataBaseFileName=".\../Debug/ui/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile="../Debug/uix86.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\ui.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/uix86.pdb"
GenerateMapFile="TRUE"
MapFileName=".\../Debug/uix86.map"
BaseAddress="0x40000000"
ImportLibrary=".\../Debug/uix86.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_Debug"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/ui.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_Debug"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\game\bg_lib.c">
<FileConfiguration
Name="Final|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="Debug(SH)|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath="..\game\bg_misc.c">
</File>
<File
RelativePath="..\game\bg_saga.c">
</File>
<File
RelativePath="..\game\bg_vehicleLoad.c">
</File>
<File
RelativePath="..\game\bg_weapons.c">
</File>
<File
RelativePath="..\game\q_math.c">
</File>
<File
RelativePath="..\game\q_shared.c">
</File>
<File
RelativePath=".\ui_atoms.c">
</File>
<File
RelativePath=".\ui_force.c">
</File>
<File
RelativePath=".\ui_gameinfo.c">
</File>
<File
RelativePath=".\ui_main.c">
</File>
<File
RelativePath="ui_saber.c">
</File>
<File
RelativePath=".\ui_shared.c">
</File>
<File
RelativePath=".\ui_syscalls.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\game\anims.h">
</File>
<File
RelativePath="..\game\bg_local.h">
</File>
<File
RelativePath="..\game\bg_public.h">
</File>
<File
RelativePath="..\game\bg_saga.h">
</File>
<File
RelativePath="..\game\bg_strap.h">
</File>
<File
RelativePath="..\game\bg_weapons.h">
</File>
<File
RelativePath="..\qcommon\disablewarnings.h">
</File>
<File
RelativePath="..\qcommon\game_version.h">
</File>
<File
RelativePath=".\keycodes.h">
</File>
<File
RelativePath="..\..\ui\menudef.h">
</File>
<File
RelativePath="..\game\q_shared.h">
</File>
<File
RelativePath="..\qcommon\qfiles.h">
</File>
<File
RelativePath="..\game\surfaceflags.h">
</File>
<File
RelativePath="..\qcommon\tags.h">
</File>
<File
RelativePath="..\cgame\tr_types.h">
</File>
<File
RelativePath=".\ui.def">
</File>
<File
RelativePath=".\ui_force.h">
</File>
<File
RelativePath=".\ui_local.h">
</File>
<File
RelativePath=".\ui_public.h">
</File>
<File
RelativePath=".\ui_shared.h">
</File>
</Filter>
<Filter
Name="win32"
Filter="">
<File
RelativePath="..\win32\ui.rc">
</File>
</Filter>
<File
RelativePath=".\ui.bat">
</File>
<File
RelativePath=".\ui.q3asm">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

496
codemp/ui/ui_atoms.c Normal file
View File

@@ -0,0 +1,496 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
/**********************************************************************
UI_ATOMS.C
User interface building blocks and support functions.
**********************************************************************/
#include "ui_local.h"
qboolean m_entersound; // after a frame, so caching won't disrupt the sound
// these are here so the functions in q_shared.c can link
#ifndef UI_HARD_LINKED
void QDECL Com_Error( int level, const char *error, ... ) {
va_list argptr;
char text[1024];
va_start (argptr, error);
vsprintf (text, error, argptr);
va_end (argptr);
trap_Error( va("%s", text) );
}
void QDECL Com_Printf( const char *msg, ... ) {
va_list argptr;
char text[1024];
va_start (argptr, msg);
vsprintf (text, msg, argptr);
va_end (argptr);
trap_Print( va("%s", text) );
}
#endif
qboolean newUI = qfalse;
/*
=================
UI_ClampCvar
=================
*/
float UI_ClampCvar( float min, float max, float value )
{
if ( value < min ) return min;
if ( value > max ) return max;
return value;
}
/*
=================
UI_StartDemoLoop
=================
*/
void UI_StartDemoLoop( void ) {
trap_Cmd_ExecuteText( EXEC_APPEND, "d1\n" );
}
char *UI_Argv( int arg ) {
static char buffer[MAX_STRING_CHARS];
trap_Argv( arg, buffer, sizeof( buffer ) );
return buffer;
}
char *UI_Cvar_VariableString( const char *var_name ) {
static char buffer[MAX_STRING_CHARS];
trap_Cvar_VariableStringBuffer( var_name, buffer, sizeof( buffer ) );
return buffer;
}
void UI_SetBestScores(postGameInfo_t *newInfo, qboolean postGame) {
trap_Cvar_Set("ui_scoreAccuracy", va("%i%%", newInfo->accuracy));
trap_Cvar_Set("ui_scoreImpressives", va("%i", newInfo->impressives));
trap_Cvar_Set("ui_scoreExcellents", va("%i", newInfo->excellents));
trap_Cvar_Set("ui_scoreDefends", va("%i", newInfo->defends));
trap_Cvar_Set("ui_scoreAssists", va("%i", newInfo->assists));
trap_Cvar_Set("ui_scoreGauntlets", va("%i", newInfo->gauntlets));
trap_Cvar_Set("ui_scoreScore", va("%i", newInfo->score));
trap_Cvar_Set("ui_scorePerfect", va("%i", newInfo->perfects));
trap_Cvar_Set("ui_scoreTeam", va("%i to %i", newInfo->redScore, newInfo->blueScore));
trap_Cvar_Set("ui_scoreBase", va("%i", newInfo->baseScore));
trap_Cvar_Set("ui_scoreTimeBonus", va("%i", newInfo->timeBonus));
trap_Cvar_Set("ui_scoreSkillBonus", va("%i", newInfo->skillBonus));
trap_Cvar_Set("ui_scoreShutoutBonus", va("%i", newInfo->shutoutBonus));
trap_Cvar_Set("ui_scoreTime", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
trap_Cvar_Set("ui_scoreCaptures", va("%i", newInfo->captures));
if (postGame) {
trap_Cvar_Set("ui_scoreAccuracy2", va("%i%%", newInfo->accuracy));
trap_Cvar_Set("ui_scoreImpressives2", va("%i", newInfo->impressives));
trap_Cvar_Set("ui_scoreExcellents2", va("%i", newInfo->excellents));
trap_Cvar_Set("ui_scoreDefends2", va("%i", newInfo->defends));
trap_Cvar_Set("ui_scoreAssists2", va("%i", newInfo->assists));
trap_Cvar_Set("ui_scoreGauntlets2", va("%i", newInfo->gauntlets));
trap_Cvar_Set("ui_scoreScore2", va("%i", newInfo->score));
trap_Cvar_Set("ui_scorePerfect2", va("%i", newInfo->perfects));
trap_Cvar_Set("ui_scoreTeam2", va("%i to %i", newInfo->redScore, newInfo->blueScore));
trap_Cvar_Set("ui_scoreBase2", va("%i", newInfo->baseScore));
trap_Cvar_Set("ui_scoreTimeBonus2", va("%i", newInfo->timeBonus));
trap_Cvar_Set("ui_scoreSkillBonus2", va("%i", newInfo->skillBonus));
trap_Cvar_Set("ui_scoreShutoutBonus2", va("%i", newInfo->shutoutBonus));
trap_Cvar_Set("ui_scoreTime2", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60));
trap_Cvar_Set("ui_scoreCaptures2", va("%i", newInfo->captures));
}
}
void UI_LoadBestScores(const char *map, int game) {
#ifndef _XBOX
char fileName[MAX_QPATH];
fileHandle_t f;
postGameInfo_t newInfo;
memset(&newInfo, 0, sizeof(postGameInfo_t));
Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
int size = 0;
trap_FS_Read(&size, sizeof(int), f);
if (size == sizeof(postGameInfo_t)) {
trap_FS_Read(&newInfo, sizeof(postGameInfo_t), f);
}
trap_FS_FCloseFile(f);
}
UI_SetBestScores(&newInfo, qfalse);
Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.dm_%d", map, game, (int)trap_Cvar_VariableValue("protocol"));
uiInfo.demoAvailable = qfalse;
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
uiInfo.demoAvailable = qtrue;
trap_FS_FCloseFile(f);
}
#endif
}
/*
===============
UI_ClearScores
===============
*/
#ifndef _XBOX
void UI_ClearScores() {
char gameList[4096];
char *gameFile;
int i, len, count, size;
fileHandle_t f;
postGameInfo_t newInfo;
count = trap_FS_GetFileList( "games", "game", gameList, sizeof(gameList) );
size = sizeof(postGameInfo_t);
memset(&newInfo, 0, size);
if (count > 0) {
gameFile = gameList;
for ( i = 0; i < count; i++ ) {
len = strlen(gameFile);
if (trap_FS_FOpenFile(va("games/%s",gameFile), &f, FS_WRITE) >= 0) {
trap_FS_Write(&size, sizeof(int), f);
trap_FS_Write(&newInfo, size, f);
trap_FS_FCloseFile(f);
}
gameFile += len + 1;
}
}
UI_SetBestScores(&newInfo, qfalse);
}
#endif // _XBOX
static void UI_Cache_f() {
int i;
Display_CacheAll();
if (trap_Argc() == 2) {
for (i = 0; i < uiInfo.q3HeadCount; i++)
{
trap_Print( va("model %s\n", uiInfo.q3HeadNames[i]) );
}
}
}
/*
=======================
UI_CalcPostGameStats
=======================
*/
static void UI_CalcPostGameStats() {
char map[MAX_QPATH];
char fileName[MAX_QPATH];
char info[MAX_INFO_STRING];
fileHandle_t f;
int size, game, time, adjustedTime;
postGameInfo_t oldInfo;
postGameInfo_t newInfo;
qboolean newHigh = qfalse;
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
game = atoi(Info_ValueForKey(info, "g_gametype"));
// compose file name
Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
// see if we have one already
memset(&oldInfo, 0, sizeof(postGameInfo_t));
if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
// if so load it
size = 0;
trap_FS_Read(&size, sizeof(int), f);
if (size == sizeof(postGameInfo_t)) {
trap_FS_Read(&oldInfo, sizeof(postGameInfo_t), f);
}
trap_FS_FCloseFile(f);
}
newInfo.accuracy = atoi(UI_Argv(3));
newInfo.impressives = atoi(UI_Argv(4));
newInfo.excellents = atoi(UI_Argv(5));
newInfo.defends = atoi(UI_Argv(6));
newInfo.assists = atoi(UI_Argv(7));
newInfo.gauntlets = atoi(UI_Argv(8));
newInfo.baseScore = atoi(UI_Argv(9));
newInfo.perfects = atoi(UI_Argv(10));
newInfo.redScore = atoi(UI_Argv(11));
newInfo.blueScore = atoi(UI_Argv(12));
time = atoi(UI_Argv(13));
newInfo.captures = atoi(UI_Argv(14));
newInfo.time = (time - trap_Cvar_VariableValue("ui_matchStartTime")) / 1000;
adjustedTime = uiInfo.mapList[ui_currentMap.integer].timeToBeat[game];
if (newInfo.time < adjustedTime) {
newInfo.timeBonus = (adjustedTime - newInfo.time) * 10;
} else {
newInfo.timeBonus = 0;
}
if (newInfo.redScore > newInfo.blueScore && newInfo.blueScore <= 0) {
newInfo.shutoutBonus = 100;
} else {
newInfo.shutoutBonus = 0;
}
newInfo.skillBonus = trap_Cvar_VariableValue("g_spSkill");
if (newInfo.skillBonus <= 0) {
newInfo.skillBonus = 1;
}
newInfo.score = newInfo.baseScore + newInfo.shutoutBonus + newInfo.timeBonus;
newInfo.score *= newInfo.skillBonus;
// see if the score is higher for this one
newHigh = (newInfo.redScore > newInfo.blueScore && newInfo.score > oldInfo.score);
if (newHigh) {
// if so write out the new one
uiInfo.newHighScoreTime = uiInfo.uiDC.realTime + 20000;
if (trap_FS_FOpenFile(fileName, &f, FS_WRITE) >= 0) {
size = sizeof(postGameInfo_t);
trap_FS_Write(&size, sizeof(int), f);
trap_FS_Write(&newInfo, sizeof(postGameInfo_t), f);
trap_FS_FCloseFile(f);
}
}
if (newInfo.time < oldInfo.time) {
uiInfo.newBestTime = uiInfo.uiDC.realTime + 20000;
}
// put back all the ui overrides
trap_Cvar_Set("capturelimit", UI_Cvar_VariableString("ui_saveCaptureLimit"));
trap_Cvar_Set("fraglimit", UI_Cvar_VariableString("ui_saveFragLimit"));
trap_Cvar_Set("duel_fraglimit", UI_Cvar_VariableString("ui_saveDuelLimit"));
trap_Cvar_Set("cg_drawTimer", UI_Cvar_VariableString("ui_drawTimer"));
trap_Cvar_Set("g_doWarmup", UI_Cvar_VariableString("ui_doWarmup"));
trap_Cvar_Set("g_Warmup", UI_Cvar_VariableString("ui_Warmup"));
trap_Cvar_Set("sv_pure", UI_Cvar_VariableString("ui_pure"));
trap_Cvar_Set("g_friendlyFire", UI_Cvar_VariableString("ui_friendlyFire"));
UI_SetBestScores(&newInfo, qtrue);
UI_ShowPostGame(newHigh);
}
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
char *cmd;
uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
uiInfo.uiDC.realTime = realTime;
cmd = UI_Argv( 0 );
// ensure minimum menu data is available
//Menu_Cache();
if ( Q_stricmp (cmd, "ui_test") == 0 ) {
UI_ShowPostGame(qtrue);
}
if ( Q_stricmp (cmd, "ui_report") == 0 ) {
UI_Report();
return qtrue;
}
if ( Q_stricmp (cmd, "ui_load") == 0 ) {
UI_Load();
return qtrue;
}
if ( Q_stricmp (cmd, "ui_opensiegemenu" ) == 0 )
{
if ( trap_Cvar_VariableValue ( "g_gametype" ) == GT_SIEGE )
{
Menus_CloseAll();
if (Menus_ActivateByName(UI_Argv(1)))
{
trap_Key_SetCatcher( KEYCATCH_UI );
}
}
return qtrue;
}
if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 )
{
//if ( trap_Cvar_VariableValue ( "developer" ) )
{
Menus_CloseAll();
if (Menus_ActivateByName(UI_Argv(1)))
{
trap_Key_SetCatcher( KEYCATCH_UI );
}
return qtrue;
}
}
/*
if ( Q_stricmp (cmd, "remapShader") == 0 ) {
if (trap_Argc() == 4) {
char shader1[MAX_QPATH];
char shader2[MAX_QPATH];
Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
trap_R_RemapShader(shader1, shader2, UI_Argv(3));
return qtrue;
}
}
*/
if ( Q_stricmp (cmd, "postgame") == 0 ) {
UI_CalcPostGameStats();
return qtrue;
}
if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
UI_Cache_f();
return qtrue;
}
if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
//UI_TeamOrdersMenu_f();
return qtrue;
}
if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) {
//UI_CDKeyMenu_f();
return qtrue;
}
return qfalse;
}
/*
=================
UI_Shutdown
=================
*/
void UI_Shutdown( void ) {
}
void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
qhandle_t hShader;
hShader = trap_R_RegisterShaderNoMip( picname );
trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
}
void UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader ) {
float s0;
float s1;
float t0;
float t1;
if( w < 0 ) { // flip about vertical
w = -w;
s0 = 1;
s1 = 0;
}
else {
s0 = 0;
s1 = 1;
}
if( h < 0 ) { // flip about horizontal
h = -h;
t0 = 1;
t1 = 0;
}
else {
t0 = 0;
t1 = 1;
}
trap_R_DrawStretchPic( x, y, w, h, s0, t0, s1, t1, hShader );
}
/*
================
UI_FillRect
Coordinates are 640*480 virtual values
=================
*/
void UI_FillRect( float x, float y, float width, float height, const float *color ) {
trap_R_SetColor( color );
trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
trap_R_SetColor( NULL );
}
void UI_DrawSides(float x, float y, float w, float h) {
trap_R_DrawStretchPic( x, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
trap_R_DrawStretchPic( x + w - 1, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
}
void UI_DrawTopBottom(float x, float y, float w, float h) {
trap_R_DrawStretchPic( x, y, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
trap_R_DrawStretchPic( x, y + h - 1, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
}
/*
================
UI_DrawRect
Coordinates are 640*480 virtual values
=================
*/
void UI_DrawRect( float x, float y, float width, float height, const float *color ) {
trap_R_SetColor( color );
UI_DrawTopBottom(x, y, width, height);
UI_DrawSides(x, y, width, height);
trap_R_SetColor( NULL );
}
void UI_SetColor( const float *rgba ) {
trap_R_SetColor( rgba );
}
void UI_UpdateScreen( void ) {
trap_UpdateScreen();
}
void UI_DrawTextBox (int x, int y, int width, int lines)
{
UI_FillRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorBlack );
UI_DrawRect( x + BIGCHAR_WIDTH/2, y + BIGCHAR_HEIGHT/2, ( width + 1 ) * BIGCHAR_WIDTH, ( lines + 1 ) * BIGCHAR_HEIGHT, colorWhite );
}
qboolean UI_CursorInRect (int x, int y, int width, int height)
{
if (uiInfo.uiDC.cursorx < x ||
uiInfo.uiDC.cursory < y ||
uiInfo.uiDC.cursorx > x+width ||
uiInfo.uiDC.cursory > y+height)
return qfalse;
return qtrue;
}

1576
codemp/ui/ui_force.c Normal file

File diff suppressed because it is too large Load Diff

45
codemp/ui/ui_force.h Normal file
View File

@@ -0,0 +1,45 @@
#include "../qcommon/qfiles.h"
#define NUM_FORCE_STAR_IMAGES 9
#define FORCE_NONJEDI 0
#define FORCE_JEDI 1
extern int uiForceSide;
extern int uiJediNonJedi;
extern int uiForceRank;
extern int uiMaxRank;
extern int uiForceUsed;
extern int uiForceAvailable;
#ifdef _XBOX
extern qboolean gTouchedForce[2];
#else
extern qboolean gTouchedForce;
#endif
extern qboolean uiForcePowersDisabled[NUM_FORCE_POWERS];
extern int uiForcePowersRank[NUM_FORCE_POWERS];
//JLF
#ifdef _XBOX
extern int gCustRank[2];
extern int gCustSide[2];
extern int gCustPowersRank[2][NUM_FORCE_POWERS];
#endif
extern int uiForcePowerDarkLight[NUM_FORCE_POWERS];
extern int uiSaberColorShaders[NUM_SABER_COLORS];
// Dots above or equal to a given rank carry a certain color.
extern vmCvar_t ui_freeSaber, ui_forcePowerDisable;
void UI_InitForceShaders(void);
void UI_ReadLegalForce(void);
void UI_DrawTotalForceStars(rectDef_t *rect, float scale, vec4_t color, int textStyle);
void UI_DrawForceStars(rectDef_t *rect, float scale, vec4_t color, int textStyle, int findex, int val, int min, int max) ;
void UI_UpdateClientForcePowers(const char *teamArg);
void UI_SaveForceTemplate();
void UI_UpdateForcePowers();
qboolean UI_SkinColor_HandleKey(int flags, float *special, int key, int num, int min, int max, int type);
qboolean UI_ForceSide_HandleKey(int flags, float *special, int key, int num, int min, int max, int type);
qboolean UI_JediNonJedi_HandleKey(int flags, float *special, int key, int num, int min, int max, int type);
qboolean UI_ForceMaxRank_HandleKey(int flags, float *special, int key, int num, int min, int max, int type);
qboolean UI_ForcePowerRank_HandleKey(int flags, float *special, int key, int num, int min, int max, int type);
extern void UI_ForceConfigHandle( int oldindex, int newindex );

333
codemp/ui/ui_gameinfo.c Normal file
View File

@@ -0,0 +1,333 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
//
// gameinfo.c
//
#include "ui_local.h"
//
// arena and bot info
//
int ui_numBots;
static char *ui_botInfos[MAX_BOTS];
static int ui_numArenas;
static char *ui_arenaInfos[MAX_ARENAS];
/*
===============
UI_ParseInfos
===============
*/
int UI_ParseInfos( char *buf, int max, char *infos[] ) {
char *token;
int count;
char key[MAX_TOKEN_CHARS];
char info[MAX_INFO_STRING];
count = 0;
while ( 1 ) {
token = COM_Parse( (const char **)&buf );
if ( !token[0] ) {
break;
}
if ( strcmp( token, "{" ) ) {
Com_Printf( "Missing { in info file\n" );
break;
}
if ( count == max ) {
Com_Printf( "Max infos exceeded\n" );
break;
}
info[0] = '\0';
while ( 1 ) {
token = COM_ParseExt( (const char **)&buf, qtrue );
if ( !token[0] ) {
Com_Printf( "Unexpected end of info file\n" );
break;
}
if ( !strcmp( token, "}" ) ) {
break;
}
Q_strncpyz( key, token, sizeof( key ) );
token = COM_ParseExt( (const char **)&buf, qfalse );
if ( !token[0] ) {
strcpy( token, "<NULL>" );
}
Info_SetValueForKey( info, key, token );
}
//NOTE: extra space for arena number
infos[count] = (char *) UI_Alloc(strlen(info) + strlen("\\num\\") + strlen(va("%d", MAX_ARENAS)) + 1);
if (infos[count]) {
strcpy(infos[count], info);
#ifndef FINAL_BUILD
if (trap_Cvar_VariableValue("com_buildScript"))
{
char *botFile = Info_ValueForKey(info, "personality");
if (botFile && botFile[0])
{
int fh = 0;
trap_FS_FOpenFile(botFile, &fh, FS_READ);
if (fh)
{
trap_FS_FCloseFile(fh);
}
}
}
#endif
count++;
}
}
return count;
}
/*
===============
UI_LoadArenasFromFile
===============
*/
static void UI_LoadArenasFromFile( char *filename ) {
int len;
fileHandle_t f;
char buf[MAX_ARENAS_TEXT];
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f ) {
trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
return;
}
if ( len >= MAX_ARENAS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) );
trap_FS_FCloseFile( f );
return;
}
trap_FS_Read( buf, len, f );
buf[len] = 0;
trap_FS_FCloseFile( f );
ui_numArenas += UI_ParseInfos( buf, MAX_ARENAS - ui_numArenas, &ui_arenaInfos[ui_numArenas] );
}
/*
===============
UI_LoadArenas
===============
*/
void UI_LoadArenas( void ) {
int numdirs;
char filename[128];
char dirlist[1024];
char* dirptr;
int i, n;
int dirlen;
char *type;
ui_numArenas = 0;
uiInfo.mapCount = 0;
// get all arenas from .arena files
numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 );
dirptr = dirlist;
for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
dirlen = strlen(dirptr);
strcpy(filename, "scripts/");
strcat(filename, dirptr);
UI_LoadArenasFromFile(filename);
}
// trap_Print( va( "%i arenas parsed\n", ui_numArenas ) );
if (UI_OutOfMemory()) {
trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n");
}
for( n = 0; n < ui_numArenas; n++ ) {
// determine type
uiInfo.mapList[uiInfo.mapCount].cinematic = -1;
uiInfo.mapList[uiInfo.mapCount].mapLoadName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "map"));
uiInfo.mapList[uiInfo.mapCount].mapName = String_Alloc(Info_ValueForKey(ui_arenaInfos[n], "longname"));
uiInfo.mapList[uiInfo.mapCount].levelShot = -1;
uiInfo.mapList[uiInfo.mapCount].imageName = String_Alloc(va("levelshots/%s", uiInfo.mapList[uiInfo.mapCount].mapLoadName));
uiInfo.mapList[uiInfo.mapCount].typeBits = 0;
type = Info_ValueForKey( ui_arenaInfos[n], "type" );
// if no type specified, it will be treated as "ffa"
if( *type ) {
if( strstr( type, "ffa" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA);
}
if( strstr( type, "holocron" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_HOLOCRON);
}
if( strstr( type, "jedimaster" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_JEDIMASTER);
}
if( strstr( type, "duel" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_DUEL);
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_POWERDUEL);
}
if( strstr( type, "powerduel" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_DUEL);
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_POWERDUEL);
}
if( strstr( type, "siege" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SIEGE);
}
if( strstr( type, "ctf" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTF);
}
if( strstr( type, "cty" ) ) {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_CTY);
}
} else {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_FFA);
}
uiInfo.mapCount++;
if (uiInfo.mapCount >= MAX_MAPS) {
break;
}
}
}
/*
===============
UI_LoadBotsFromFile
===============
*/
static void UI_LoadBotsFromFile( char *filename ) {
int len;
fileHandle_t f;
char buf[MAX_BOTS_TEXT];
char *stopMark;
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f ) {
trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
return;
}
if ( len >= MAX_BOTS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) );
trap_FS_FCloseFile( f );
return;
}
trap_FS_Read( buf, len, f );
buf[len] = 0;
stopMark = strstr(buf, "@STOPHERE");
//This bot is in place as a mark for modview's bot viewer.
//If we hit it just stop and trace back to the beginning of the bot define and cut the string off.
//This is only done in the UI and not the game so that "test" bots can be added manually and still
//not show up in the menu.
if (stopMark)
{
int startPoint = stopMark - buf;
while (buf[startPoint] != '{')
{
startPoint--;
}
buf[startPoint] = 0;
}
trap_FS_FCloseFile( f );
COM_Compress(buf);
ui_numBots += UI_ParseInfos( buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots] );
}
/*
===============
UI_LoadBots
===============
*/
void UI_LoadBots( void ) {
vmCvar_t botsFile;
int numdirs;
char filename[128];
char dirlist[1024];
char* dirptr;
int i;
int dirlen;
ui_numBots = 0;
trap_Cvar_Register( &botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM );
if( *botsFile.string ) {
UI_LoadBotsFromFile(botsFile.string);
}
else {
UI_LoadBotsFromFile("botfiles/bots.txt");
}
// get all bots from .bot files
numdirs = trap_FS_GetFileList("scripts", ".bot", dirlist, 1024 );
dirptr = dirlist;
for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
dirlen = strlen(dirptr);
strcpy(filename, "scripts/");
strcat(filename, dirptr);
UI_LoadBotsFromFile(filename);
}
// trap_Print( va( "%i bots parsed\n", ui_numBots ) );
}
/*
===============
UI_GetBotInfoByNumber
===============
*/
char *UI_GetBotInfoByNumber( int num ) {
if( num < 0 || num >= ui_numBots ) {
trap_Print( va( S_COLOR_RED "Invalid bot number: %i\n", num ) );
return NULL;
}
return ui_botInfos[num];
}
/*
===============
UI_GetBotInfoByName
===============
*/
char *UI_GetBotInfoByName( const char *name ) {
int n;
char *value;
for ( n = 0; n < ui_numBots ; n++ ) {
value = Info_ValueForKey( ui_botInfos[n], "name" );
if ( !Q_stricmp( value, name ) ) {
return ui_botInfos[n];
}
}
return NULL;
}
int UI_GetNumBots() {
return ui_numBots;
}
char *UI_GetBotNameByNumber( int num ) {
char *info = UI_GetBotInfoByNumber(num);
if (info) {
return Info_ValueForKey( info, "name" );
}
return "Kyle";
}

1085
codemp/ui/ui_local.h Normal file

File diff suppressed because it is too large Load Diff

13881
codemp/ui/ui_main.c Normal file

File diff suppressed because it is too large Load Diff

1351
codemp/ui/ui_players.c Normal file

File diff suppressed because it is too large Load Diff

260
codemp/ui/ui_public.h Normal file
View File

@@ -0,0 +1,260 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#ifndef __UI_PUBLIC_H__
#define __UI_PUBLIC_H__
#define UI_API_VERSION 7
typedef struct {
connstate_t connState;
int connectPacketCount;
int clientNum;
char servername[MAX_STRING_CHARS];
char messageString[MAX_STRING_CHARS];
} uiClientState_t;
typedef enum {
UI_ERROR,
UI_PRINT,
UI_MILLISECONDS,
UI_CVAR_SET,
UI_CVAR_VARIABLEVALUE,
UI_CVAR_VARIABLESTRINGBUFFER,
UI_CVAR_SETVALUE,
UI_CVAR_RESET,
UI_CVAR_CREATE,
UI_CVAR_INFOSTRINGBUFFER,
UI_ARGC,
UI_ARGV,
UI_CMD_EXECUTETEXT,
UI_FS_FOPENFILE,
UI_FS_READ,
UI_FS_WRITE,
UI_FS_FCLOSEFILE,
UI_FS_GETFILELIST,
UI_R_REGISTERMODEL,
UI_R_REGISTERSKIN,
UI_R_REGISTERSHADERNOMIP,
UI_R_SHADERNAMEFROMINDEX,
UI_R_CLEARSCENE,
UI_R_ADDREFENTITYTOSCENE,
UI_R_ADDPOLYTOSCENE,
UI_R_ADDLIGHTTOSCENE,
UI_R_RENDERSCENE,
UI_R_SETCOLOR,
UI_R_DRAWSTRETCHPIC,
UI_UPDATESCREEN,
UI_CM_LERPTAG,
UI_CM_LOADMODEL,
UI_S_REGISTERSOUND,
UI_S_STARTLOCALSOUND,
UI_KEY_KEYNUMTOSTRINGBUF,
UI_KEY_GETBINDINGBUF,
UI_KEY_SETBINDING,
UI_KEY_ISDOWN,
UI_KEY_GETOVERSTRIKEMODE,
UI_KEY_SETOVERSTRIKEMODE,
UI_KEY_CLEARSTATES,
UI_KEY_GETCATCHER,
UI_KEY_SETCATCHER,
UI_GETCLIPBOARDDATA,
UI_GETGLCONFIG,
UI_GETCLIENTSTATE,
UI_GETCONFIGSTRING,
/*
UI_LAN_GETPINGQUEUECOUNT,
UI_LAN_CLEARPING,
UI_LAN_GETPING,
UI_LAN_GETPINGINFO,
*/
UI_CVAR_REGISTER,
UI_CVAR_UPDATE,
UI_MEMORY_REMAINING,
UI_GET_CDKEY,
UI_SET_CDKEY,
UI_VERIFY_CDKEY,
UI_R_REGISTERFONT,
UI_R_FONT_STRLENPIXELS,
UI_R_FONT_STRLENCHARS,
UI_R_FONT_STRHEIGHTPIXELS,
UI_R_FONT_DRAWSTRING,
UI_LANGUAGE_ISASIAN,
UI_LANGUAGE_USESSPACES,
UI_ANYLANGUAGE_READCHARFROMSTRING,
UI_R_MODELBOUNDS,
UI_PC_ADD_GLOBAL_DEFINE,
UI_PC_LOAD_SOURCE,
UI_PC_FREE_SOURCE,
UI_PC_READ_TOKEN,
UI_PC_SOURCE_FILE_AND_LINE,
UI_PC_LOAD_GLOBAL_DEFINES,
UI_PC_REMOVE_ALL_GLOBAL_DEFINES,
UI_S_STOPBACKGROUNDTRACK,
UI_S_STARTBACKGROUNDTRACK,
UI_REAL_TIME,
/*
UI_LAN_GETSERVERCOUNT,
UI_LAN_GETSERVERADDRESSSTRING,
UI_LAN_GETSERVERINFO,
UI_LAN_MARKSERVERVISIBLE,
UI_LAN_UPDATEVISIBLEPINGS,
UI_LAN_RESETPINGS,
UI_LAN_LOADCACHEDSERVERS,
UI_LAN_SAVECACHEDSERVERS,
UI_LAN_ADDSERVER,
UI_LAN_REMOVESERVER,
UI_CIN_PLAYCINEMATIC,
UI_CIN_STOPCINEMATIC,
UI_CIN_RUNCINEMATIC,
UI_CIN_DRAWCINEMATIC,
UI_CIN_SETEXTENTS,
*/
UI_R_REMAP_SHADER,
/*
UI_LAN_SERVERSTATUS,
UI_LAN_GETSERVERPING,
UI_LAN_SERVERISVISIBLE,
UI_LAN_COMPARESERVERS,
*/
UI_MEMSET = 100,
UI_MEMCPY,
UI_STRNCPY,
UI_SIN,
UI_COS,
UI_ATAN2,
UI_SQRT,
UI_MATRIXMULTIPLY,
UI_ANGLEVECTORS,
UI_PERPENDICULARVECTOR,
UI_FLOOR,
UI_CEIL,
UI_TESTPRINTINT,
UI_TESTPRINTFLOAT,
UI_ACOS,
UI_ASIN,
UI_SP_GETNUMLANGUAGES,
UI_SP_GETLANGUAGENAME,
UI_SP_GETSTRINGTEXTSTRING = 200,
/*
Ghoul2 Insert Start
*/
UI_G2_LISTSURFACES,
UI_G2_LISTBONES,
UI_G2_SETMODELS,
UI_G2_HAVEWEGHOULMODELS,
UI_G2_GETBOLT,
UI_G2_GETBOLT_NOREC,
UI_G2_GETBOLT_NOREC_NOROT,
UI_G2_INITGHOUL2MODEL,
UI_G2_COLLISIONDETECT,
UI_G2_CLEANMODELS,
UI_G2_ANGLEOVERRIDE,
UI_G2_PLAYANIM,
UI_G2_GETBONEANIM,
UI_G2_GETBONEFRAME, //trimmed down version of GBA, so I don't have to pass all those unused args across the VM-exe border
UI_G2_GETGLANAME,
UI_G2_COPYGHOUL2INSTANCE,
UI_G2_COPYSPECIFICGHOUL2MODEL,
UI_G2_DUPLICATEGHOUL2INSTANCE,
UI_G2_HASGHOUL2MODELONINDEX,
UI_G2_REMOVEGHOUL2MODEL,
UI_G2_ADDBOLT,
UI_G2_SETBOLTON,
UI_G2_SETROOTSURFACE,
UI_G2_SETSURFACEONOFF,
UI_G2_SETNEWORIGIN,
UI_G2_GETTIME,
UI_G2_SETTIME,
/*
//rww - RAGDOLL_BEGIN
*/
UI_G2_SETRAGDOLL,
UI_G2_ANIMATEG2MODELS,
/*
//rww - RAGDOLL_END
*/
//rww - ik move method, allows you to specify a bone and move it to a world point (within joint constraints)
//by using the majority of gil's existing bone angling stuff from the ragdoll code.
UI_G2_SETBONEIKSTATE,
UI_G2_IKMOVE,
UI_G2_GETSURFACENAME,
UI_G2_SETSKIN,
UI_G2_ATTACHG2MODEL,
/*
Ghoul2 Insert End
*/
} uiImport_t;
typedef enum {
UIMENU_NONE,
UIMENU_MAIN,
UIMENU_INGAME,
UIMENU_PLAYERCONFIG,
UIMENU_TEAM,
UIMENU_POSTGAME,
UIMENU_PLAYERFORCE,
UIMENU_SIEGEMESSAGE,
UIMENU_SIEGEOBJECTIVES,
UIMENU_VOICECHAT,
UIMENU_CLOSEALL,
UIMENU_CLASSSEL,
UIMENU_DEDICATED,
//JLF
UIMENU_NOCONTROLLERINGAME,
UIMENU_NOCONTROLLER
};
typedef int uiMenuCommand_t;
#define SORT_HOST 0
#define SORT_MAP 1
#define SORT_CLIENTS 2
#define SORT_GAME 3
#define SORT_PING 4
typedef enum {
UI_GETAPIVERSION = 0, // system reserved
UI_INIT,
// void UI_Init( void );
UI_SHUTDOWN,
// void UI_Shutdown( void );
UI_KEY_EVENT,
// void UI_KeyEvent( int key );
UI_MOUSE_EVENT,
// void UI_MouseEvent( int dx, int dy );
UI_REFRESH,
// void UI_Refresh( int time );
UI_IS_FULLSCREEN,
// qboolean UI_IsFullscreen( void );
UI_SET_ACTIVE_MENU,
// void UI_SetActiveMenu( uiMenuCommand_t menu );
UI_CONSOLE_COMMAND,
// qboolean UI_ConsoleCommand( int realTime );
UI_DRAW_CONNECT_SCREEN,
// void UI_DrawConnectScreen( qboolean overlay );
UI_HASUNIQUECDKEY,
// if !overlay, the background will be drawn, otherwise it will be
// overlayed over whatever the cgame has drawn.
// a GetClientState syscall will be made to get the current strings
UI_MENU_RESET
} uiExport_t;
#endif

1109
codemp/ui/ui_saber.c Normal file

File diff suppressed because it is too large Load Diff

9635
codemp/ui/ui_shared.c Normal file

File diff suppressed because it is too large Load Diff

630
codemp/ui/ui_shared.h Normal file
View File

@@ -0,0 +1,630 @@
#ifndef __UI_SHARED_H
#define __UI_SHARED_H
#include "../game/q_shared.h"
#include "../cgame/tr_types.h"
#include "keycodes.h"
#include "../../ui/menudef.h"
#define MAX_MENUNAME 32
#define MAX_ITEMTEXT 64
#define MAX_ITEMACTION 64
#define MAX_MENUDEFFILE 4096
#define MAX_MENUFILE 32768
#ifdef CGAME
#define MAX_MENUS 16
#else
#define MAX_MENUS 64
#endif
#define MAX_MENUITEMS 256
#define MAX_COLOR_RANGES 10
#define MAX_OPEN_MENUS 16
#define MAX_TEXTSCROLL_LINES 256
#define WINDOW_MOUSEOVER 0x00000001 // mouse is over it, non exclusive
#define WINDOW_HASFOCUS 0x00000002 // has cursor focus, exclusive
#define WINDOW_VISIBLE 0x00000004 // is visible
#define WINDOW_INACTIVE 0x00000008 // is visible but grey ( non-active )
#define WINDOW_DECORATION 0x00000010 // for decoration only, no mouse, keyboard, etc..
#define WINDOW_FADINGOUT 0x00000020 // fading out, non-active
#define WINDOW_FADINGIN 0x00000040 // fading in
#define WINDOW_MOUSEOVERTEXT 0x00000080 // mouse is over it, non exclusive
#define WINDOW_INTRANSITION 0x00000100 // window is in transition
#define WINDOW_FORECOLORSET 0x00000200 // forecolor was explicitly set ( used to color alpha images or not )
#define WINDOW_HORIZONTAL 0x00000400 // for list boxes and sliders, vertical is default this is set of horizontal
#define WINDOW_LB_LEFTARROW 0x00000800 // mouse is over left/up arrow
#define WINDOW_LB_RIGHTARROW 0x00001000 // mouse is over right/down arrow
#define WINDOW_LB_THUMB 0x00002000 // mouse is over thumb
#define WINDOW_LB_PGUP 0x00004000 // mouse is over page up
#define WINDOW_LB_PGDN 0x00008000 // mouse is over page down
#define WINDOW_ORBITING 0x00010000 // item is in orbit
#define WINDOW_OOB_CLICK 0x00020000 // close on out of bounds click
#define WINDOW_WRAPPED 0x00040000 // manually wrap text
#define WINDOW_AUTOWRAPPED 0x00080000 // auto wrap text
#define WINDOW_FORCED 0x00100000 // forced open
#define WINDOW_POPUP 0x00200000 // popup
#define WINDOW_BACKCOLORSET 0x00400000 // backcolor was explicitly set
#define WINDOW_TIMEDVISIBLE 0x00800000 // visibility timing ( NOT implemented )
#define WINDOW_PLAYERCOLOR 0x01000000 // hack the forecolor to match ui_char_color_*
//JLF
#define WINDOW_INTRANSITIONMODEL 0x04000000
#define WINDOW_SCRIPTWAITING 0x08000000 // delayed script waiting to run
// CGAME cursor type bits
#define CURSOR_NONE 0x00000001
#define CURSOR_ARROW 0x00000002
#define CURSOR_SIZER 0x00000004
#ifdef _XBOX
#ifdef CGAME
#define STRING_POOL_SIZE 32*1024
#else
#define STRING_POOL_SIZE 128*1024
#endif
#else
#ifdef CGAME
#define STRING_POOL_SIZE 128*1024
#else
#define STRING_POOL_SIZE 384*1024
#endif
#endif
#define MAX_STRING_HANDLES 4096
#define MAX_SCRIPT_ARGS 12
#define MAX_EDITFIELD 256
//#define ASSET_GRADIENTBAR "ui/assets/gradientbar2.tga"
#define ASSET_SCROLLBAR "gfx/menus/scrollbar.tga"
#define ASSET_SCROLLBAR_ARROWDOWN "gfx/menus/scrollbar_arrow_dwn_a.tga"
#define ASSET_SCROLLBAR_ARROWUP "gfx/menus/scrollbar_arrow_up_a.tga"
#define ASSET_SCROLLBAR_ARROWLEFT "gfx/menus/scrollbar_arrow_left.tga"
#define ASSET_SCROLLBAR_ARROWRIGHT "gfx/menus/scrollbar_arrow_right.tga"
#define ASSET_SCROLL_THUMB "gfx/menus/scrollbar_thumb.tga"
#define ASSET_SLIDER_BAR "gfx/menus/newFront/slider"
//#define ASSET_SLIDER_THUMB "menu/new/sliderthumb"
#define SCROLLBAR_SIZE 16.0
#define SLIDER_WIDTH 128.0
#define SLIDER_HEIGHT 16.0
//#define SLIDER_THUMB_WIDTH 12.0
//#define SLIDER_THUMB_HEIGHT 20.0
#define NUM_CROSSHAIRS 1
typedef struct {
const char *command;
const char *args[MAX_SCRIPT_ARGS];
} scriptDef_t;
typedef struct {
float x; // horiz position
float y; // vert position
float w; // width
float h; // height;
} rectDef_t;
typedef rectDef_t Rectangle;
// FIXME: do something to separate text vs window stuff
typedef struct {
Rectangle rect; // client coord rectangle
Rectangle rectClient; // screen coord rectangle
const char *name; //
const char *group; // if it belongs to a group
// const char *cinematicName; // cinematic name
// int cinematic; // cinematic handle
int style; //
int border; //
int ownerDraw; // ownerDraw style
int ownerDrawFlags; // show flags for ownerdraw items
float borderSize; //
int flags; // visible, focus, mouseover, cursor
Rectangle rectEffects; // for various effects
Rectangle rectEffects2; // for various effects
int offsetTime; // time based value for various effects
int nextTime; // time next effect should cycle
int delayTime; // time when delay expires
vec4_t foreColor; // text color
vec4_t backColor; // border color
vec4_t borderColor; // border color
vec4_t outlineColor; // border color
qhandle_t background; // background asset
} windowDef_t;
typedef windowDef_t Window;
typedef struct {
vec4_t color;
float low;
float high;
} colorRangeDef_t;
// FIXME: combine flags into bitfields to save space
// FIXME: consolidate all of the common stuff in one structure for menus and items
// THINKABOUTME: is there any compelling reason not to have items contain items
// and do away with a menu per say.. major issue is not being able to dynamically allocate
// and destroy stuff.. Another point to consider is adding an alloc free call for vm's and have
// the engine just allocate the pool for it based on a cvar
// many of the vars are re-used for different item types, as such they are not always named appropriately
// the benefits of c++ in DOOM will greatly help crap like this
// FIXME: need to put a type ptr that points to specific type info per type
//
#define MAX_LB_COLUMNS 16
typedef struct columnInfo_s {
int pos;
int width;
int maxChars;
} columnInfo_t;
typedef struct listBoxDef_s {
int startPos;
int endPos;
int drawPadding;
int cursorPos;
float elementWidth;
float elementHeight;
int elementStyle;
int numColumns;
columnInfo_t columnInfo[MAX_LB_COLUMNS];
const char *doubleClick;
qboolean notselectable;
//JLF MPMOVED
qboolean scrollhidden;
qhandle_t selectionShader;
} listBoxDef_t;
typedef struct editFieldDef_s {
float minVal; // edit field limits
float maxVal; //
float defVal; //
float range; //
int maxChars; // for edit fields
int maxPaintChars; // for edit fields
int paintOffset; //
} editFieldDef_t;
#ifdef _XBOX
#define MAX_MULTI_CVARS 44
#else
#define MAX_MULTI_CVARS 32
#endif
typedef struct multiDef_s {
const char *cvarList[MAX_MULTI_CVARS];
const char *cvarStr[MAX_MULTI_CVARS];
float cvarValue[MAX_MULTI_CVARS];
int count;
qboolean strDef;
} multiDef_t;
typedef struct modelDef_s {
int angle;
vec3_t origin;
float fov_x;
float fov_y;
int rotationSpeed;
vec3_t g2mins; //required
vec3_t g2maxs; //required
vec3_t g2scale; //optional
int g2skin; //optional
int g2anim; //optional
//JLF
//Transition extras
vec3_t g2mins2, g2maxs2, g2minsEffect, g2maxsEffect;
float fov_x2, fov_y2, fov_Effectx, fov_Effecty;
// BTO - This is disgusting, but when I'm writing out the UIC files, I need
// to know if the ghoul2 model was originally created using "ui_char_model"
bool g2IsPlayer;
} modelDef_t;
typedef struct textScrollDef_s
{
int startPos;
int endPos;
float lineHeight;
int maxLineChars;
int drawPadding;
// changed spelling to make them fall out during compile while I made them asian-aware -Ste
//
int iLineCount;
const char* pLines[MAX_TEXTSCROLL_LINES]; // can contain NULL ptrs that you should skip over during paint.
} textScrollDef_t;
#define ITEM_ALIGN_LEFT 0 // left alignment
#define ITEM_ALIGN_CENTER 1 // center alignment
#define ITEM_ALIGN_RIGHT 2 // right alignment
#define CVAR_ENABLE 0x00000001
#define CVAR_DISABLE 0x00000002
#define CVAR_SHOW 0x00000004
#define CVAR_HIDE 0x00000008
#define ITF_G2VALID 0x0001 // indicates whether or not g2 instance is valid.
#define ITF_ISCHARACTER 0x0002 // a character item, uses customRGBA
#define ITF_ISSABER 0x0004 // first saber item, draws blade
#define ITF_ISSABER2 0x0008 // second saber item, draws blade
#define ITF_ISANYSABER (ITF_ISSABER|ITF_ISSABER2) //either saber
typedef struct itemDef_s {
Window window; // common positional, border, style, layout info
Rectangle textRect; // rectangle the text ( if any ) consumes
int type; // text, button, radiobutton, checkbox, textfield, listbox, combo
int alignment; // left center right
int textalignment; // ( optional ) alignment for text within rect based on text width
float textalignx; // ( optional ) text alignment x coord
float textaligny; // ( optional ) text alignment x coord
float textscale; // scale percentage from 72pts
int textStyle; // ( optional ) style, normal and shadowed are it for now
const char *text; // display text
// const char *text2; // display text, 2nd line
// float text2alignx; // ( optional ) text2 alignment x coord
// float text2aligny; // ( optional ) text2 alignment y coord
void *parent; // menu owner
qhandle_t asset; // handle to asset
void *ghoul2; // ghoul2 instance if available instead of a model.
int flags; // flags like g2valid, character, saber, saber2, etc.
// const char *mouseEnterText; // mouse enter script
// const char *mouseExitText; // mouse exit script
// const char *mouseEnter; // mouse enter script
// const char *mouseExit; // mouse exit script
const char *action; // select script
//JLFACCEPT MPMOVED
// const char *accept;
//JLFDPADSCRIPT
const char * selectionNext;
const char * selectionPrev;
const char *onFocus; // select script
const char *leaveFocus; // select script
const char *cvar; // associated cvar
const char *cvarTest; // associated cvar for enable actions
const char *enableCvar; // enable, disable, show, or hide based on value, this can contain a list
int cvarFlags; // what type of action to take on cvarenables
// sfxHandle_t focusSound;
// int numColors; // number of color ranges
// colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
float special; // used for feeder id's etc.. diff per type
int cursorPos; // cursor position in characters
void *typeData; // type specific data ptr's
const char *descText; // Description text
int appearanceSlot; // order of appearance
int iMenuFont; // FONT_SMALL,FONT_MEDIUM,FONT_LARGE // changed from 'font' so I could see what didn't compile, and differentiate between font handles returned from RegisterFont -ste
qboolean disabled; // Does this item ignore mouse and keyboard focus
int invertYesNo;
int xoffset;
} itemDef_t;
typedef struct {
Window window;
const char *font; // font
qboolean fullScreen; // covers entire screen
int itemCount; // number of items;
int fontIndex; //
int cursorItem; // which item as the cursor
int fadeCycle; //
float fadeClamp; //
float fadeAmount; //
const char *onOpen; // run when the menu is first opened
const char *onClose; // run when the menu is closed
//JLFACCEPT
const char *onAccept; // run when menu is closed with acceptance
const char *onESC; // run when the menu is closed
const char *xScript; // run when the X button is pressed
const char *yScript; // run when the Y button is pressed
const char *whiteScript; // run when the White button is pressed
const char *soundName; // background loop sound for menu
vec4_t focusColor; // focus color for items
vec4_t disableColor; // focus color for items
itemDef_t *items[MAX_MENUITEMS]; // items this menu contains
int descX; // X position of description
int descY; // X position of description
vec4_t descColor; // description text color for items
int descAlignment; // Description of alignment
float descScale; // Description scale
float appearanceTime; // when next item should appear
int appearanceCnt; // current item displayed
float appearanceIncrement; //
} menuDef_t;
typedef struct {
const char *fontStr;
const char *cursorStr;
const char *gradientStr;
qhandle_t qhSmallFont;
qhandle_t qhSmall2Font;
qhandle_t qhMediumFont;
qhandle_t qhBigFont;
// qhandle_t cursor;
// qhandle_t gradientBar;
qhandle_t scrollBarArrowUp;
qhandle_t scrollBarArrowDown;
qhandle_t scrollBarArrowLeft;
qhandle_t scrollBarArrowRight;
qhandle_t scrollBar;
qhandle_t scrollBarThumb;
// qhandle_t buttonMiddle;
// qhandle_t buttonInside;
// qhandle_t solidBox;
qhandle_t sliderBar;
// qhandle_t sliderThumb;
sfxHandle_t menuEnterSound;
sfxHandle_t menuExitSound;
sfxHandle_t menuBuzzSound;
sfxHandle_t itemFocusSound;
float fadeClamp;
int fadeCycle;
float fadeAmount;
float shadowX;
float shadowY;
vec4_t shadowColor;
float shadowFadeClamp;
qboolean fontRegistered;
// qhandle_t needPass;
// qhandle_t noForce;
// qhandle_t forceRestrict;
// qhandle_t saberOnly;
// qhandle_t trueJedi;
sfxHandle_t moveRollSound;
sfxHandle_t moveJumpSound;
sfxHandle_t datapadmoveSaberSound1;
sfxHandle_t datapadmoveSaberSound2;
sfxHandle_t datapadmoveSaberSound3;
sfxHandle_t datapadmoveSaberSound4;
sfxHandle_t datapadmoveSaberSound5;
sfxHandle_t datapadmoveSaberSound6;
// player settings
qhandle_t crosshairShader[NUM_CROSSHAIRS];
} cachedAssets_t;
typedef struct
{
const char *name;
qboolean (*handler) (itemDef_t *item, char** args);
} commandDef_t;
typedef struct {
qhandle_t (*registerShaderNoMip) (const char *p);
void (*setColor) (const vec4_t v);
void (*drawHandlePic) (float x, float y, float w, float h, qhandle_t asset);
void (*drawStretchPic) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
void (*drawText) (float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont);
int (*textWidth) (const char *text, float scale, int iMenuFont);
int (*textHeight) (const char *text, float scale, int iMenuFont);
qhandle_t (*registerModel) (const char *p);
void (*modelBounds) (qhandle_t model, vec3_t min, vec3_t max);
void (*fillRect) ( float x, float y, float w, float h, const vec4_t color);
void (*drawRect) ( float x, float y, float w, float h, float size, const vec4_t color);
void (*drawSides) (float x, float y, float w, float h, float size);
void (*drawTopBottom) (float x, float y, float w, float h, float size);
void (*clearScene) ();
void (*addRefEntityToScene) (const refEntity_t *re );
void (*renderScene) ( const refdef_t *fd );
qhandle_t (*RegisterFont)( const char *fontName );
int (*Font_StrLenPixels) (const char *text, const int iFontIndex, const float scale);
int (*Font_StrLenChars) (const char *text);
int (*Font_HeightPixels)(const int iFontIndex, const float scale);
void (*Font_DrawString)(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
qboolean (*Language_IsAsian)(void);
qboolean (*Language_UsesSpaces)(void);
unsigned int (*AnyLanguage_ReadCharFromString)( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation/* = NULL*/ );
void (*ownerDrawItem) (float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle,int iMenuFont);
float (*getValue) (int ownerDraw);
qboolean (*ownerDrawVisible) (int flags);
void (*runScript)(char **p);
qboolean (*deferScript)(char **p);
void (*getTeamColor)(vec4_t *color);
void (*getCVarString)(const char *cvar, char *buffer, int bufsize);
float (*getCVarValue)(const char *cvar);
void (*setCVar)(const char *cvar, const char *value);
void (*drawTextWithCursor)(float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int limit, int style, int iFontIndex);
void (*setOverstrikeMode)(qboolean b);
qboolean (*getOverstrikeMode)();
void (*startLocalSound)( sfxHandle_t sfx, int channelNum );
qboolean (*ownerDrawHandleKey)(int ownerDraw, int flags, float *special, int key);
int (*feederCount)(float feederID);
const char *(*feederItemText)(float feederID, int index, int column, qhandle_t *handle1, qhandle_t *handle2, qhandle_t *handle3);
qhandle_t (*feederItemImage)(float feederID, int index);
qboolean (*feederSelection)(float feederID, int index, itemDef_t *item);
void (*keynumToStringBuf)( int keynum, char *buf, int buflen );
void (*getBindingBuf)( int keynum, char *buf, int buflen );
void (*setBinding)( int keynum, const char *binding );
void (*executeText)(int exec_when, const char *text );
void (*Error)(int level, const char *error, ...);
void (*Print)(const char *msg, ...);
void (*Pause)(qboolean b);
int (*ownerDrawWidth)(int ownerDraw, float scale);
sfxHandle_t (*registerSound)(const char *name);
void (*startBackgroundTrack)( const char *intro, const char *loop, qboolean bReturnWithoutStarting);
void (*stopBackgroundTrack)();
// int (*playCinematic)(const char *name, float x, float y, float w, float h);
// void (*stopCinematic)(int handle);
// void (*drawCinematic)(int handle, float x, float y, float w, float h);
// void (*runCinematicFrame)(int handle);
float yscale;
float xscale;
float bias;
int realTime;
int frameTime;
int cursorx;
int cursory;
qboolean debug;
cachedAssets_t Assets;
glconfig_t glconfig;
qhandle_t whiteShader;
qhandle_t gradientImage;
// qhandle_t cursor;
float FPS;
} displayContextDef_t;
#include "../namespace_begin.h"
const char *String_Alloc(const char *p);
void String_Init();
void String_Report();
void Init_Display(displayContextDef_t *dc);
void Display_ExpandMacros(char * buff);
void Menu_Init(menuDef_t *menu);
void Item_Init(itemDef_t *item);
void Menu_PostParse(menuDef_t *menu);
menuDef_t *Menu_GetFocused();
void Menu_HandleKey(menuDef_t *menu, int key, qboolean down);
void Menu_HandleMouseMove(menuDef_t *menu, float x, float y);
void Menu_ScrollFeeder(menuDef_t *menu, int feeder, qboolean down);
qboolean Float_Parse(char **p, float *f);
qboolean Color_Parse(char **p, vec4_t *c);
qboolean Int_Parse(char **p, int *i);
qboolean Rect_Parse(char **p, rectDef_t *r);
qboolean String_Parse(char **p, const char **out);
qboolean Script_Parse(char **p, const char **out);
qboolean PC_Float_Parse(int handle, float *f);
qboolean PC_Color_Parse(int handle, vec4_t *c);
qboolean PC_Int_Parse(int handle, int *i);
qboolean PC_Rect_Parse(int handle, rectDef_t *r);
qboolean PC_String_Parse(int handle, const char **out);
qboolean PC_Script_Parse(int handle, const char **out);
int Menu_Count();
void Menu_New(int handle);
void Menu_PaintAll();
menuDef_t *Menus_ActivateByName(const char *p);
void Menu_Reset();
qboolean Menus_AnyFullScreenVisible();
void Menus_Activate(menuDef_t *menu);
itemDef_t *Menu_FindItemByName(menuDef_t *menu, const char *p);
itemDef_t *Menu_GetFocusedItem(menuDef_t *menu);
itemDef_t *Menu_SetPrevCursorItem(menuDef_t *menu);
void Item_RunScript(itemDef_t *item, const char *s) ;
void AddDeferedCommand(char * command);
displayContextDef_t *Display_GetContext();
void *Display_CaptureItem(int x, int y);
qboolean Display_MouseMove(void *p, int x, int y);
int Display_CursorType(int x, int y);
void Menus_OpenByName(const char *p);
menuDef_t *Menus_FindByName(const char *p);
void Menus_ShowByName(const char *p);
void Menus_CloseByName(const char *p);
void Display_HandleKey(int key, qboolean down, int x, int y);
void LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
void Menus_CloseAll();
void Menu_Paint(menuDef_t *menu, qboolean forcePaint);
void Menu_SetFeederSelection(menuDef_t *menu, int feeder, int index, const char *name);
void Display_CacheAll();
void Menu_SetItemBackground(const menuDef_t *menu,const char *itemName, const char *background);
void *UI_Alloc( int size );
void UI_InitMemory( void );
qboolean UI_OutOfMemory();
void Controls_GetConfig( void );
void Controls_SetConfig(qboolean restart);
int trap_PC_AddGlobalDefine ( char *define );
int trap_PC_LoadSource ( const char *filename );
int trap_PC_FreeSource ( int handle );
int trap_PC_ReadToken ( int handle, pc_token_t *pc_token );
int trap_PC_SourceFileAndLine ( int handle, char *filename, int *line );
int trap_PC_LoadGlobalDefines ( const char* filename );
void trap_PC_RemoveAllGlobalDefines ( void );
int trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale);
int trap_R_Font_StrLenChars(const char *text);
int trap_R_Font_HeightPixels(const int iFontIndex, const float scale);
void trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
qboolean trap_Language_IsAsian(void);
qboolean trap_Language_UsesSpaces(void);
unsigned int trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation );
int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength);
int trap_SP_GetNumLanguages( void );
void trap_GetLanguageName( const int languageIndex, char *buffer );
//these traps must exist both on the cgame and ui
/*
Ghoul2 Insert Start
*/
// UI specific API access
void trap_G2API_CollisionDetect ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius );
void trap_G2_ListModelSurfaces(void *ghlInfo);
void trap_G2_ListModelBones(void *ghlInfo, int frame);
void trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
qboolean trap_G2_HaveWeGhoul2Models(void *ghoul2);
qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
qboolean trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
qboolean trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
int trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
qhandle_t customShader, int modelFlags, int lodBias);
qboolean trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
qboolean trap_G2API_AttachG2Model(void *ghoul2From, int modelIndexFrom, void *ghoul2To, int toBoltIndex, int toModel);
int trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
void trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
void trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex);
qboolean trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex);
int trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName);
//qboolean trap_G2API_RemoveBolt(void *ghoul2, int index);
void trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
void trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
qboolean trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
const int up, const int right, const int forward, qhandle_t *modelList,
int blendTime , int currentTime );
void trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf);
qboolean trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
qboolean trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame,
int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex);
qboolean trap_G2API_GetBoneFrame(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex);
qboolean trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName);
qboolean trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags);
qboolean trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex);
int trap_G2API_GetTime(void);
void trap_G2API_SetTime(int time, int clock);
void trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params);
void trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params);
qboolean trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
qboolean trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params);
void trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf);
#include "../namespace_end.h"
/*
Ghoul2 Insert End
*/
#endif

148
codemp/ui/ui_syscalls.asm Normal file
View File

@@ -0,0 +1,148 @@
code
equ trap_Print -2 ; UI_PRINT
equ trap_Error -1 ; UI_ERROR
equ trap_Milliseconds -3 ; UI_MILLISECONDS
equ trap_Cvar_Register -51 ; UI_CVAR_REGISTER
equ trap_Cvar_Update -52 ; UI_CVAR_UPDATE
equ trap_Cvar_Set -4 ; UI_CVAR_SET
equ trap_Cvar_VariableValue -5 ; UI_CVAR_VARIABLEVALUE
equ trap_Cvar_VariableStringBuffer -6 ; UI_CVAR_VARIABLESTRINGBUFFER
equ trap_Cvar_SetValue -7 ; UI_CVAR_SETVALUE
equ trap_Cvar_Reset -8 ; UI_CVAR_RESET
equ trap_Cvar_Create -9 ; UI_CVAR_CREATE
equ trap_Cvar_InfoStringBuffer -10 ; UI_CVAR_INFOSTRINGBUFFER
equ trap_Argc -11 ; UI_ARGC
equ trap_Argv -12 ; UI_ARGV
equ trap_Cmd_ExecuteText -13 ; UI_CMD_EXECUTETEXT
equ trap_FS_FOpenFile -14 ; UI_FS_FOPENFILE
equ trap_FS_Read -15 ; UI_FS_READ
equ trap_FS_Write -16 ; UI_FS_WRITE
equ trap_FS_FCloseFile -17 ; UI_FS_FCLOSEFILE
equ trap_FS_GetFileList -18 ; UI_FS_GETFILELIST
equ trap_R_RegisterModel -19 ; UI_R_REGISTERMODEL
equ trap_R_RegisterSkin -20 ; UI_R_REGISTERSKIN
equ trap_R_RegisterFont -57 ; UI_R_REGISTERFONT
equ trap_R_Font_StrLenPixels -58 ; UI_R_FONT_STRLENPIXELS
equ trap_R_Font_StrLenChars -59 ; UI_R_FONT_STRLENCHARS
equ trap_R_Font_HeightPixels -60 ; UI_R_FONT_STRHEIGHTPIXELS
equ trap_R_Font_DrawString -61 ; UI_R_FONT_DRAWSTRING
equ trap_Language_IsAsian -62 ; UI_LANGUAGE_ISASIAN
equ trap_Language_UsesSpaces -63 ; UI_LANGUAGE_USESSPACES
equ trap_AnyLanguage_ReadCharFromString -64 ; UI_ANYLANGUAGE_READCHARFROMSTRING
equ trap_R_RegisterShaderNoMip -21 ; UI_R_REGISTERSHADERNOMIP
equ trap_R_ClearScene -22 ; UI_R_CLEARSCENE
equ trap_R_AddRefEntityToScene -23 ; UI_R_ADDREFENTITYTOSCENE
equ trap_R_AddPolyToScene -24 ; UI_R_ADDPOLYTOSCENE
equ trap_R_AddLightToScene -25 ; UI_R_ADDLIGHTTOSCENE
equ trap_R_RenderScene -26 ; UI_R_RENDERSCENE
equ trap_R_SetColor -27 ; UI_R_SETCOLOR
equ trap_R_DrawStretchPic -28 ; UI_R_DRAWSTRETCHPIC
equ trap_R_ModelBounds -65 ; UI_R_MODELBOUNDS
equ trap_UpdateScreen -29 ; UI_UPDATESCREEN
equ trap_CM_LerpTag -30 ; UI_CM_LERPTAG
equ trap_S_StartLocalSound -33 ; UI_S_STARTLOCALSOUND
equ trap_S_RegisterSound -32 ; UI_S_REGISTERSOUND
equ trap_Key_KeynumToStringBuf -34 ; UI_KEY_KEYNUMTOSTRINGBUF
equ trap_Key_GetBindingBuf -35 ; UI_KEY_GETBINDINGBUF
equ trap_Key_SetBinding -36 ; UI_KEY_SETBINDING
equ trap_Key_IsDown -37 ; UI_KEY_ISDOWN
equ trap_Key_GetOverstrikeMode -38 ; UI_KEY_GETOVERSTRIKEMODE
equ trap_Key_SetOverstrikeMode -39 ; UI_KEY_SETOVERSTRIKEMODE
equ trap_Key_ClearStates -40 ; UI_KEY_CLEARSTATES
equ trap_Key_GetCatcher -41 ; UI_KEY_GETCATCHER
equ trap_Key_SetCatcher -42 ; UI_KEY_SETCATCHER
equ trap_GetClipboardData -43 ; UI_GETCLIPBOARDDATA
equ trap_GetClientState -45 ; UI_GETCLIENTSTATE
equ trap_GetGlconfig -44 ; UI_GETGLCONFIG
equ trap_GetConfigString -46 ; UI_GETCONFIGSTRING
equ trap_LAN_GetServerCount -76 ; UI_LAN_GETSERVERCOUNT
equ trap_LAN_GetServerAddressString -77 ; UI_LAN_GETSERVERADDRESSSTRING
equ trap_LAN_GetServerInfo -78 ; UI_LAN_GETSERVERINFO
equ trap_LAN_GetServerPing -93 ; UI_LAN_GETSERVERPING
equ trap_LAN_GetPingQueueCount -47 ; UI_LAN_GETPINGQUEUECOUNT
equ trap_LAN_ServerStatus -92 ; UI_LAN_SERVERSTATUS
equ trap_LAN_SaveCachedServers -83 ; UI_LAN_SAVECACHEDSERVERS
equ trap_LAN_LoadCachedServers -82 ; UI_LAN_LOADCACHEDSERVERS
equ trap_LAN_ResetPings -81 ; UI_LAN_RESETPINGS
equ trap_LAN_ClearPing -48 ; UI_LAN_CLEARPING
equ trap_LAN_GetPing -49 ; UI_LAN_GETPING
equ trap_LAN_GetPingInfo -50 ; UI_LAN_GETPINGINFO
equ trap_LAN_MarkServerVisible -79 ; UI_LAN_MARKSERVERVISIBLE
equ trap_LAN_ServerIsVisible -94 ; UI_LAN_SERVERISVISIBLE
equ trap_LAN_UpdateVisiblePings -80 ; UI_LAN_UPDATEVISIBLEPINGS
equ trap_LAN_AddServer -84 ; UI_LAN_ADDSERVER
equ trap_LAN_RemoveServer -85 ; UI_LAN_REMOVESERVER
equ trap_LAN_CompareServers -95 ; UI_LAN_COMPARESERVERS
equ trap_MemoryRemaining -53 ; UI_MEMORY_REMAINING
equ trap_GetCDKey -54 ; UI_GET_CDKEY
equ trap_SetCDKey -55 ; UI_SET_CDKEY
equ trap_VerifyCDKey -56 ; UI_VERIFY_CDKEY
equ trap_PC_AddGlobalDefine -66 ; UI_PC_ADD_GLOBAL_DEFINE
equ trap_PC_LoadSource -67 ; UI_PC_LOAD_SOURCE
equ trap_PC_FreeSource -68 ; UI_PC_FREE_SOURCE
equ trap_PC_ReadToken -69 ; UI_PC_READ_TOKEN
equ trap_PC_SourceFileAndLine -70 ; UI_PC_SOURCE_FILE_AND_LINE
equ trap_PC_LoadGlobalDefines -71 ; UI_PC_LOAD_GLOBAL_DEFINES
equ trap_PC_RemoveAllGlobalDefines -72 ; UI_PC_REMOVE_ALL_GLOBAL_DEFINES
equ trap_S_StopBackgroundTrack -73 ; UI_S_STOPBACKGROUNDTRACK
equ trap_S_StartBackgroundTrack -74 ; UI_S_STARTBACKGROUNDTRACK
equ trap_RealTime -75 ; UI_REAL_TIME
equ trap_CIN_PlayCinematic -86 ; UI_CIN_PLAYCINEMATIC
equ trap_CIN_StopCinematic -87 ; UI_CIN_STOPCINEMATIC
equ trap_CIN_RunCinematic -88 ; UI_CIN_RUNCINEMATIC
equ trap_CIN_DrawCinematic -89 ; UI_CIN_DRAWCINEMATIC
equ trap_CIN_SetExtents -90 ; UI_CIN_SETEXTENTS
equ trap_R_RemapShader -91 ; UI_R_REMAP_SHADER
equ trap_SP_Register -201 ; UI_SP_REGISTER
equ trap_SP_GetStringTextString -202 ; UI_SP_GETSTRINGTEXTSTRING
equ trap_G2_ListModelSurfaces -203 ; UI_G2_LISTSURFACES
equ trap_G2_ListModelBones -204 ; UI_G2_LISTBONES
equ trap_G2_SetGhoul2ModelIndexes -205 ; UI_G2_SETMODELS
equ trap_G2_HaveWeGhoul2Models -206 ; UI_G2_HAVEWEGHOULMODELS
equ trap_G2API_GiveMeVectorFromMatrix -207 ; UI_G2_GIVEMEVECTORFROMMATRIX
equ trap_G2API_GetBoltMatrix -208 ; UI_G2_GETBOLT
equ trap_G2API_GetBoltMatrix_NoReconstruct -209 ; UI_G2_GETBOLT_NOREC
equ trap_G2API_GetBoltMatrix_NoRecNoRot -210 ; UI_G2_GETBOLT_NOREC_NOROT
equ trap_G2API_InitGhoul2Model -211 ; UI_G2_INITGHOUL2MODEL
equ trap_G2API_CollisionDetect -212 ; UI_G2_COLLISIONDETECT
equ trap_G2API_CleanGhoul2Models -213 ; UI_G2_CLEANMODELS
equ trap_G2API_SetBoneAngles -214 ; UI_G2_ANGLEOVERRIDE
equ trap_G2API_SetBoneAnim -215 ; UI_G2_PLAYANIM
equ trap_G2API_GetBoneAnim -216 ; UI_G2_GETBONEANIM
equ trap_G2API_GetBoneFrame -217 ; UI_G2_GETBONEFRAME
equ trap_G2API_GetGLAName -218 ; UI_G2_GETGLANAME
equ trap_G2API_CopyGhoul2Instance -219 ; UI_G2_COPYGHOUL2INSTANCE
equ trap_G2API_CopySpecificGhoul2Model -220 ; UI_G2_COPYSPECIFICGHOUL2MODEL
equ trap_G2API_DuplicateGhoul2Instance -221 ; UI_G2_DUPLICATEGHOUL2INSTANCE
equ trap_G2API_HasGhoul2ModelOnIndex -222 ; UI_G2_HASGHOUL2MODELONINDEX
equ trap_G2API_RemoveGhoul2Model -223 ; UI_G2_REMOVEGHOUL2MODEL
equ trap_G2API_AddBolt -224 ; UI_G2_ADDBOLT
equ trap_G2API_SetBoltInfo -225 ; UI_G2_SETBOLTON
equ trap_G2API_SetRootSurface -226 ; UI_G2_SETROOTSURFACE
equ trap_G2API_SetSurfaceOnOff -227 ; UI_G2_SETSURFACEONOFF
equ trap_G2API_SetNewOrigin -228 ; UI_G2_SETNEWORIGIN
equ trap_G2API_GetTime -229 ; UI_G2_GETTIME
equ trap_G2API_SetTime -230 ; UI_G2_SETTIME
equ trap_G2API_SetRagDoll -231 ; UI_G2_SETRAGDOLL
equ trap_G2API_AnimateG2Models -232 ; UI_G2_ANIMATEG2MODELS
equ trap_G2API_SetBoneIKState -233 ; UI_G2_SETBONEIKSTATE
equ trap_G2API_IKMove -234 ; UI_G2_IKMOVE
equ trap_G2API_GetSurfaceName -235 ; UI_G2_GETSURFACENAME
; hardcoded functions
equ memset -101 ; UI_MEMSET
equ memcpy -102 ; UI_MEMCPY
equ strncpy -103 ; UI_STRNCPY
equ sin -104 ; UI_SIN
equ cos -105 ; UI_COS
equ atan2 -106 ; UI_ATAN2
equ sqrt -107 ; UI_SQRT
equ matrixmultiply -108 ; UI_MATRIXMULTIPLY
equ anglevectors -109 ; UI_ANGLEVECTORS
equ perpendicularvector -110 ; UI_PERPENDICULARVECTOR
equ floor -111 ; UI_FLOOR
equ ceil -112 ; UI_CEIL
equ acos -115 ; UI_ACOS
equ asin -116 ; UI_ASIN

652
codemp/ui/ui_syscalls.c Normal file
View File

@@ -0,0 +1,652 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
// this file is only included when building a dll
// syscalls.asm is included instead when building a qvm
static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
#include "../namespace_begin.h"
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
syscall = syscallptr;
}
int PASSFLOAT( float x ) {
float floatTemp;
floatTemp = x;
return *(int *)&floatTemp;
}
void trap_Print( const char *string ) {
syscall( UI_PRINT, string );
}
void trap_Error( const char *string ) {
syscall( UI_ERROR, string );
}
int trap_Milliseconds( void ) {
return syscall( UI_MILLISECONDS );
}
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
}
void trap_Cvar_Update( vmCvar_t *cvar ) {
syscall( UI_CVAR_UPDATE, cvar );
}
void trap_Cvar_Set( const char *var_name, const char *value ) {
syscall( UI_CVAR_SET, var_name, value );
}
float trap_Cvar_VariableValue( const char *var_name ) {
int temp;
temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
return (*(float*)&temp);
}
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
}
void trap_Cvar_SetValue( const char *var_name, float value ) {
syscall( UI_CVAR_SETVALUE, var_name, PASSFLOAT( value ) );
}
void trap_Cvar_Reset( const char *name ) {
syscall( UI_CVAR_RESET, name );
}
void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
syscall( UI_CVAR_CREATE, var_name, var_value, flags );
}
void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) {
syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
}
int trap_Argc( void ) {
return syscall( UI_ARGC );
}
void trap_Argv( int n, char *buffer, int bufferLength ) {
syscall( UI_ARGV, n, buffer, bufferLength );
}
void trap_Cmd_ExecuteText( int exec_when, const char *text ) {
syscall( UI_CMD_EXECUTETEXT, exec_when, text );
}
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
return syscall( UI_FS_FOPENFILE, qpath, f, mode );
}
void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
syscall( UI_FS_READ, buffer, len, f );
}
void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
syscall( UI_FS_WRITE, buffer, len, f );
}
void trap_FS_FCloseFile( fileHandle_t f ) {
syscall( UI_FS_FCLOSEFILE, f );
}
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) {
return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
}
qhandle_t trap_R_RegisterModel( const char *name ) {
return syscall( UI_R_REGISTERMODEL, name );
}
qhandle_t trap_R_RegisterSkin( const char *name ) {
return syscall( UI_R_REGISTERSKIN, name );
}
qhandle_t trap_R_RegisterFont( const char *fontName )
{
return syscall( UI_R_REGISTERFONT, fontName);
}
int trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale)
{
return syscall( UI_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(scale));
}
int trap_R_Font_StrLenChars(const char *text)
{
return syscall( UI_R_FONT_STRLENCHARS, text);
}
int trap_R_Font_HeightPixels(const int iFontIndex, const float scale)
{
return syscall( UI_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT(scale));
}
void trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale)
{
syscall( UI_R_FONT_DRAWSTRING, ox, oy, text, rgba, setIndex, iCharLimit, PASSFLOAT(scale));
}
qboolean trap_Language_IsAsian(void)
{
return syscall( UI_LANGUAGE_ISASIAN );
}
qboolean trap_Language_UsesSpaces(void)
{
return syscall( UI_LANGUAGE_USESSPACES );
}
unsigned int trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation )
{
return syscall( UI_ANYLANGUAGE_READCHARFROMSTRING, psText, piAdvanceCount, pbIsTrailingPunctuation);
}
qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {
char buf[1024];
if (name[0] == '*') {
trap_Cvar_VariableStringBuffer(name+1, buf, sizeof(buf));
if (buf[0]) {
return syscall( UI_R_REGISTERSHADERNOMIP, &buf );
}
}
return syscall( UI_R_REGISTERSHADERNOMIP, name );
}
//added so I don't have to store a string containing the path of
//the shader icon for a class -rww
void trap_R_ShaderNameFromIndex(char *name, int index)
{
syscall( UI_R_SHADERNAMEFROMINDEX, name, index );
}
void trap_R_ClearScene( void ) {
syscall( UI_R_CLEARSCENE );
}
void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
syscall( UI_R_ADDREFENTITYTOSCENE, re );
}
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
}
void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
syscall( UI_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
}
void trap_R_RenderScene( const refdef_t *fd ) {
syscall( UI_R_RENDERSCENE, fd );
}
void trap_R_SetColor( const float *rgba ) {
syscall( UI_R_SETCOLOR, rgba );
}
void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) {
syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
}
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
syscall( UI_R_MODELBOUNDS, model, mins, maxs );
}
void trap_UpdateScreen( void ) {
syscall( UI_UPDATESCREEN );
}
int trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) {
return syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
}
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
}
sfxHandle_t trap_S_RegisterSound( const char *sample ) {
return syscall( UI_S_REGISTERSOUND, sample );
}
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
}
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
}
void trap_Key_SetBinding( int keynum, const char *binding ) {
syscall( UI_KEY_SETBINDING, keynum, binding );
}
qboolean trap_Key_IsDown( int keynum ) {
return syscall( UI_KEY_ISDOWN, keynum );
}
qboolean trap_Key_GetOverstrikeMode( void ) {
return syscall( UI_KEY_GETOVERSTRIKEMODE );
}
void trap_Key_SetOverstrikeMode( qboolean state ) {
syscall( UI_KEY_SETOVERSTRIKEMODE, state );
}
void trap_Key_ClearStates( void ) {
syscall( UI_KEY_CLEARSTATES );
}
int trap_Key_GetCatcher( void ) {
return syscall( UI_KEY_GETCATCHER );
}
void trap_Key_SetCatcher( int catcher ) {
syscall( UI_KEY_SETCATCHER, catcher );
}
void trap_GetClipboardData( char *buf, int bufsize ) {
syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
}
void trap_GetClientState( uiClientState_t *state ) {
syscall( UI_GETCLIENTSTATE, state );
}
void trap_GetGlconfig( glconfig_t *glconfig ) {
syscall( UI_GETGLCONFIG, glconfig );
}
int trap_GetConfigString( int index, char* buff, int buffsize ) {
return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
}
/*
int trap_LAN_GetServerCount( int source ) {
return syscall( UI_LAN_GETSERVERCOUNT, source );
}
void trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) {
syscall( UI_LAN_GETSERVERADDRESSSTRING, source, n, buf, buflen );
}
void trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
syscall( UI_LAN_GETSERVERINFO, source, n, buf, buflen );
}
int trap_LAN_GetServerPing( int source, int n ) {
return syscall( UI_LAN_GETSERVERPING, source, n );
}
int trap_LAN_GetPingQueueCount( void ) {
return syscall( UI_LAN_GETPINGQUEUECOUNT );
}
int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen ) {
return syscall( UI_LAN_SERVERSTATUS, serverAddress, serverStatus, maxLen );
}
void trap_LAN_SaveCachedServers() {
syscall( UI_LAN_SAVECACHEDSERVERS );
}
void trap_LAN_LoadCachedServers() {
syscall( UI_LAN_LOADCACHEDSERVERS );
}
void trap_LAN_ResetPings(int n) {
syscall( UI_LAN_RESETPINGS, n );
}
void trap_LAN_ClearPing( int n ) {
syscall( UI_LAN_CLEARPING, n );
}
void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
}
void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) {
syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
}
void trap_LAN_MarkServerVisible( int source, int n, qboolean visible ) {
syscall( UI_LAN_MARKSERVERVISIBLE, source, n, visible );
}
int trap_LAN_ServerIsVisible( int source, int n) {
return syscall( UI_LAN_SERVERISVISIBLE, source, n );
}
qboolean trap_LAN_UpdateVisiblePings( int source ) {
return syscall( UI_LAN_UPDATEVISIBLEPINGS, source );
}
int trap_LAN_AddServer(int source, const char *name, const char *addr) {
return syscall( UI_LAN_ADDSERVER, source, name, addr );
}
void trap_LAN_RemoveServer(int source, const char *addr) {
syscall( UI_LAN_REMOVESERVER, source, addr );
}
int trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) {
return syscall( UI_LAN_COMPARESERVERS, source, sortKey, sortDir, s1, s2 );
}
*/
int trap_MemoryRemaining( void ) {
return syscall( UI_MEMORY_REMAINING );
}
#ifdef USE_CD_KEY
void trap_GetCDKey( char *buf, int buflen ) {
syscall( UI_GET_CDKEY, buf, buflen );
}
void trap_SetCDKey( char *buf ) {
syscall( UI_SET_CDKEY, buf );
}
qboolean trap_VerifyCDKey( const char *key, const char *chksum) {
return syscall( UI_VERIFY_CDKEY, key, chksum);
}
#endif // USE_CD_KEY
int trap_PC_AddGlobalDefine( char *define ) {
return syscall( UI_PC_ADD_GLOBAL_DEFINE, define );
}
int trap_PC_LoadSource( const char *filename ) {
return syscall( UI_PC_LOAD_SOURCE, filename );
}
int trap_PC_FreeSource( int handle ) {
return syscall( UI_PC_FREE_SOURCE, handle );
}
int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
return syscall( UI_PC_READ_TOKEN, handle, pc_token );
}
int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
}
int trap_PC_LoadGlobalDefines ( const char* filename )
{
return syscall ( UI_PC_LOAD_GLOBAL_DEFINES, filename );
}
void trap_PC_RemoveAllGlobalDefines ( void )
{
syscall ( UI_PC_REMOVE_ALL_GLOBAL_DEFINES );
}
void trap_S_StopBackgroundTrack( void ) {
syscall( UI_S_STOPBACKGROUNDTRACK );
}
void trap_S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bReturnWithoutStarting) {
syscall( UI_S_STARTBACKGROUNDTRACK, intro, loop, bReturnWithoutStarting );
}
int trap_RealTime(qtime_t *qtime) {
return syscall( UI_REAL_TIME, qtime );
}
// this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
/*
int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) {
return syscall(UI_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits);
}
// stops playing the cinematic and ends it. should always return FMV_EOF
// cinematics must be stopped in reverse order of when they are started
e_status trap_CIN_StopCinematic(int handle) {
return syscall(UI_CIN_STOPCINEMATIC, handle);
}
// will run a frame of the cinematic but will not draw it. Will return FMV_EOF if the end of the cinematic has been reached.
e_status trap_CIN_RunCinematic (int handle) {
return syscall(UI_CIN_RUNCINEMATIC, handle);
}
// draws the current frame
void trap_CIN_DrawCinematic (int handle) {
syscall(UI_CIN_DRAWCINEMATIC, handle);
}
// allows you to resize the animation dynamically
void trap_CIN_SetExtents (int handle, int x, int y, int w, int h) {
syscall(UI_CIN_SETEXTENTS, handle, x, y, w, h);
}
*/
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset ) {
syscall( UI_R_REMAP_SHADER, oldShader, newShader, timeOffset );
}
int trap_SP_GetNumLanguages( void )
{
return syscall( UI_SP_GETNUMLANGUAGES );
}
void trap_GetLanguageName( const int languageIndex, char *buffer )
{
syscall( UI_SP_GETLANGUAGENAME, languageIndex, buffer);
}
int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength)
{
return syscall( UI_SP_GETSTRINGTEXTSTRING, text, buffer, bufferLength );
}
/*
Ghoul2 Insert Start
*/
void trap_G2_ListModelSurfaces(void *ghlInfo)
{
syscall( UI_G2_LISTSURFACES, ghlInfo);
}
void trap_G2_ListModelBones(void *ghlInfo, int frame)
{
syscall( UI_G2_LISTBONES, ghlInfo, frame);
}
void trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList)
{
syscall( UI_G2_SETMODELS, ghoul2, modelList, skinList);
}
qboolean trap_G2_HaveWeGhoul2Models(void *ghoul2)
{
return (qboolean)(syscall(UI_G2_HAVEWEGHOULMODELS, ghoul2));
}
qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
{
return (qboolean)(syscall(UI_G2_GETBOLT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
}
qboolean trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
{ //Same as above but force it to not reconstruct the skeleton before getting the bolt position
return (qboolean)(syscall(UI_G2_GETBOLT_NOREC, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
}
qboolean trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
{ //Same as above but force it to not reconstruct the skeleton before getting the bolt position
return (qboolean)(syscall(UI_G2_GETBOLT_NOREC_NOROT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
}
int trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
qhandle_t customShader, int modelFlags, int lodBias)
{
return syscall(UI_G2_INITGHOUL2MODEL, ghoul2Ptr, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
}
qboolean trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin)
{
return syscall(UI_G2_SETSKIN, ghoul2, modelIndex, customSkin, renderSkin);
}
void trap_G2API_CollisionDetect (
CollisionRecord_t *collRecMap,
void* ghoul2,
const vec3_t angles,
const vec3_t position,
int frameNumber,
int entNum,
const vec3_t rayStart,
const vec3_t rayEnd,
const vec3_t scale,
int traceFlags,
int useLod,
float fRadius
)
{
syscall ( UI_G2_COLLISIONDETECT, collRecMap, ghoul2, angles, position, frameNumber, entNum, rayStart, rayEnd, scale, traceFlags, useLod, PASSFLOAT(fRadius) );
}
void trap_G2API_CleanGhoul2Models(void **ghoul2Ptr)
{
syscall(UI_G2_CLEANMODELS, ghoul2Ptr);
}
qboolean trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
const int up, const int right, const int forward, qhandle_t *modelList,
int blendTime , int currentTime )
{
return (syscall(UI_G2_ANGLEOVERRIDE, ghoul2, modelIndex, boneName, angles, flags, up, right, forward, modelList, blendTime, currentTime));
}
qboolean trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime )
{
return syscall(UI_G2_PLAYANIM, ghoul2, modelIndex, boneName, startFrame, endFrame, flags, PASSFLOAT(animSpeed), currentTime, PASSFLOAT(setFrame), blendTime);
}
qboolean trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame,
int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex)
{
return syscall(UI_G2_GETBONEANIM, ghoul2, boneName, currentTime, currentFrame, startFrame, endFrame, flags, animSpeed, modelList, modelIndex);
}
qboolean trap_G2API_GetBoneFrame(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex)
{
return syscall(UI_G2_GETBONEFRAME, ghoul2, boneName, currentTime, currentFrame, modelList, modelIndex);
}
void trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf)
{
syscall(UI_G2_GETGLANAME, ghoul2, modelIndex, fillBuf);
}
int trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex)
{
return syscall(UI_G2_COPYGHOUL2INSTANCE, g2From, g2To, modelIndex);
}
void trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo)
{
syscall(UI_G2_COPYSPECIFICGHOUL2MODEL, g2From, modelFrom, g2To, modelTo);
}
void trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To)
{
syscall(UI_G2_DUPLICATEGHOUL2INSTANCE, g2From, g2To);
}
qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex)
{
return syscall(UI_G2_HASGHOUL2MODELONINDEX, ghlInfo, modelIndex);
}
qboolean trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex)
{
return syscall(UI_G2_REMOVEGHOUL2MODEL, ghlInfo, modelIndex);
}
int trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName)
{
return syscall(UI_G2_ADDBOLT, ghoul2, modelIndex, boneName);
}
void trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo)
{
syscall(UI_G2_SETBOLTON, ghoul2, modelIndex, boltInfo);
}
qboolean trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName)
{
return syscall(UI_G2_SETROOTSURFACE, ghoul2, modelIndex, surfaceName);
}
qboolean trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags)
{
return syscall(UI_G2_SETSURFACEONOFF, ghoul2, surfaceName, flags);
}
qboolean trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex)
{
return syscall(UI_G2_SETNEWORIGIN, ghoul2, boltIndex);
}
int trap_G2API_GetTime(void)
{
return syscall(UI_G2_GETTIME);
}
void trap_G2API_SetTime(int time, int clock)
{
syscall(UI_G2_SETTIME, time, clock);
}
//rww - RAGDOLL_BEGIN
void trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params)
{
syscall(UI_G2_SETRAGDOLL, ghoul2, params);
}
void trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params)
{
syscall(UI_G2_ANIMATEG2MODELS, ghoul2, time, params);
}
//rww - RAGDOLL_END
qboolean trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params)
{
return syscall(UI_G2_SETBONEIKSTATE, ghoul2, time, boneName, ikState, params);
}
qboolean trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params)
{
return syscall(UI_G2_IKMOVE, ghoul2, time, params);
}
void trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf)
{
syscall(UI_G2_GETSURFACENAME, ghoul2, surfNumber, modelIndex, fillBuf);
}
qboolean trap_G2API_AttachG2Model(void *ghoul2From, int modelIndexFrom, void *ghoul2To, int toBoltIndex, int toModel)
{
return syscall(UI_G2_ATTACHG2MODEL, ghoul2From, modelIndexFrom, ghoul2To, toBoltIndex, toModel);
}
/*
Ghoul2 Insert End
*/
#include "../namespace_end.h"

11
codemp/ui/ui_util.c Normal file
View File

@@ -0,0 +1,11 @@
// ui_util.c
//
// origin: rad
// new ui support stuff
//
// memory, string alloc
void RichIsGettingTiredOfEmptyFileVMCompilerWarnings()
{
int andUnderstandablySo = 0;
}