2013-03-13 22:54:47 +00:00
//file for builtin implementations relevent to only clientside VMs (menu+csqc).
# include "quakedef.h"
# include "pr_common.h"
# include "shader.h"
# if defined(CSQC_DAT) || defined(MENU_DAT)
2013-08-27 13:18:09 +00:00
//these two global qcinput variables are the current scan code being passed to qc, if valid. this protects against protected apis where the qc just passes stuff through.
int qcinput_scan ;
int qcinput_unicode ;
2014-02-11 17:51:29 +00:00
//QC key codes are based upon DP's keycode constants. This is on account of menu.dat coming first.
2013-05-03 04:28:08 +00:00
int MP_TranslateFTEtoQCCodes ( int code )
2013-03-13 22:54:47 +00:00
{
switch ( code )
{
case K_TAB : return 9 ;
case K_ENTER : return 13 ;
case K_ESCAPE : return 27 ;
case K_SPACE : return 32 ;
case K_BACKSPACE : return 127 ;
case K_UPARROW : return 128 ;
case K_DOWNARROW : return 129 ;
case K_LEFTARROW : return 130 ;
case K_RIGHTARROW : return 131 ;
2013-04-13 08:15:18 +00:00
case K_LALT : return 132 ;
2014-02-11 17:51:29 +00:00
case K_RALT : return - K_RALT ;
2013-05-11 14:02:55 +00:00
case K_LCTRL : return 133 ;
2014-02-11 17:51:29 +00:00
case K_RCTRL : return - K_RCTRL ;
2013-05-11 14:02:55 +00:00
case K_LSHIFT : return 134 ;
2014-02-11 17:51:29 +00:00
case K_RSHIFT : return - K_RSHIFT ;
2013-03-13 22:54:47 +00:00
case K_F1 : return 135 ;
case K_F2 : return 136 ;
case K_F3 : return 137 ;
case K_F4 : return 138 ;
case K_F5 : return 139 ;
case K_F6 : return 140 ;
case K_F7 : return 141 ;
case K_F8 : return 142 ;
case K_F9 : return 143 ;
case K_F10 : return 144 ;
case K_F11 : return 145 ;
case K_F12 : return 146 ;
case K_INS : return 147 ;
case K_DEL : return 148 ;
case K_PGDN : return 149 ;
case K_PGUP : return 150 ;
case K_HOME : return 151 ;
case K_END : return 152 ;
2014-02-11 17:51:29 +00:00
case K_PAUSE : return 153 ;
case K_KP_NUMLOCK : return 154 ;
case K_CAPSLOCK : return 155 ;
case K_SCRLCK : return 156 ;
case K_KP_INS : return 157 ;
case K_KP_END : return 158 ;
case K_KP_DOWNARROW : return 159 ;
case K_KP_PGDN : return 160 ;
case K_KP_LEFTARROW : return 161 ;
case K_KP_5 : return 162 ;
case K_KP_RIGHTARROW : return 163 ;
case K_KP_HOME : return 164 ;
case K_KP_UPARROW : return 165 ;
case K_KP_PGUP : return 166 ;
case K_KP_DEL : return 167 ;
case K_KP_SLASH : return 168 ;
case K_KP_STAR : return 169 ;
case K_KP_MINUS : return 170 ;
case K_KP_PLUS : return 171 ;
case K_KP_ENTER : return 172 ;
case K_KP_EQUALS : return 173 ;
case K_PRINTSCREEN : return 174 ;
2013-03-13 22:54:47 +00:00
case K_MOUSE1 : return 512 ;
case K_MOUSE2 : return 513 ;
case K_MOUSE3 : return 514 ;
2014-02-11 17:51:29 +00:00
case K_MWHEELUP : return 515 ;
case K_MWHEELDOWN : return 516 ;
2013-03-13 22:54:47 +00:00
case K_MOUSE4 : return 517 ;
case K_MOUSE5 : return 518 ;
case K_MOUSE6 : return 519 ;
case K_MOUSE7 : return 520 ;
case K_MOUSE8 : return 521 ;
case K_MOUSE9 : return 522 ;
case K_MOUSE10 : return 523 ;
2014-02-11 17:51:29 +00:00
// case K_MOUSE11: return 524;
// case K_MOUSE12: return 525;
// case K_MOUSE13: return 526;
// case K_MOUSE14: return 527;
// case K_MOUSE15: return 528;
// case K_MOUSE16: return 529;
case K_JOY1 : return 768 ;
case K_JOY2 : return 769 ;
case K_JOY3 : return 770 ;
case K_JOY4 : return 771 ;
// case K_JOY5: return 772;
// case K_JOY6: return 773;
// case K_JOY7: return 774;
// case K_JOY8: return 775;
// case K_JOY9: return 776;
// case K_JOY10: return 777;
// case K_JOY11: return 778;
// case K_JOY12: return 779;
// case K_JOY13: return 780;
// case K_JOY14: return 781;
// case K_JOY15: return 782;
// case K_JOY16: return 783;
case K_AUX1 : return 784 ;
case K_AUX2 : return 785 ;
case K_AUX3 : return 786 ;
case K_AUX4 : return 787 ;
case K_AUX5 : return 788 ;
case K_AUX6 : return 789 ;
case K_AUX7 : return 790 ;
case K_AUX8 : return 791 ;
case K_AUX9 : return 792 ;
case K_AUX10 : return 793 ;
case K_AUX11 : return 794 ;
case K_AUX12 : return 795 ;
case K_AUX13 : return 796 ;
case K_AUX14 : return 797 ;
case K_AUX15 : return 798 ;
case K_AUX16 : return 799 ;
case K_AUX17 : return 800 ;
case K_AUX18 : return 801 ;
case K_AUX19 : return 802 ;
case K_AUX20 : return 803 ;
case K_AUX21 : return 804 ;
case K_AUX22 : return 805 ;
case K_AUX23 : return 806 ;
case K_AUX24 : return 807 ;
case K_AUX25 : return 808 ;
case K_AUX26 : return 809 ;
case K_AUX27 : return 810 ;
case K_AUX28 : return 811 ;
case K_AUX29 : return 812 ;
case K_AUX30 : return 813 ;
case K_AUX31 : return 814 ;
case K_AUX32 : return 815 ;
case K_VOLUP : return - code ;
case K_VOLDOWN : return - code ;
case K_APP : return - code ;
case K_SEARCH : return - code ;
2013-03-13 22:54:47 +00:00
default : return code ;
}
}
2013-05-03 04:28:08 +00:00
int MP_TranslateQCtoFTECodes ( int code )
2013-03-13 22:54:47 +00:00
{
switch ( code )
{
case 9 : return K_TAB ;
case 13 : return K_ENTER ;
case 27 : return K_ESCAPE ;
case 32 : return K_SPACE ;
case 127 : return K_BACKSPACE ;
case 128 : return K_UPARROW ;
case 129 : return K_DOWNARROW ;
case 130 : return K_LEFTARROW ;
case 131 : return K_RIGHTARROW ;
2013-04-13 08:15:18 +00:00
case 132 : return K_LALT ;
2013-05-11 14:02:55 +00:00
case 133 : return K_LCTRL ;
case 134 : return K_LSHIFT ;
2013-03-13 22:54:47 +00:00
case 135 : return K_F1 ;
case 136 : return K_F2 ;
case 137 : return K_F3 ;
case 138 : return K_F4 ;
case 139 : return K_F5 ;
case 140 : return K_F6 ;
case 141 : return K_F7 ;
case 142 : return K_F8 ;
case 143 : return K_F9 ;
case 144 : return K_F10 ;
case 145 : return K_F11 ;
case 146 : return K_F12 ;
case 147 : return K_INS ;
case 148 : return K_DEL ;
case 149 : return K_PGDN ;
case 150 : return K_PGUP ;
case 151 : return K_HOME ;
case 152 : return K_END ;
2014-02-11 17:51:29 +00:00
case 153 : return K_PAUSE ;
case 154 : return K_KP_NUMLOCK ;
case 155 : return K_CAPSLOCK ;
case 156 : return K_SCRLCK ;
case 157 : return K_KP_INS ;
case 158 : return K_KP_END ;
case 159 : return K_KP_DOWNARROW ;
case 160 : return K_KP_PGDN ;
case 161 : return K_KP_LEFTARROW ;
case 162 : return K_KP_5 ;
case 163 : return K_KP_RIGHTARROW ;
case 164 : return K_KP_HOME ;
case 165 : return K_KP_UPARROW ;
case 166 : return K_KP_PGUP ;
case 167 : return K_KP_DEL ;
case 168 : return K_KP_SLASH ;
case 169 : return K_KP_STAR ;
case 170 : return K_KP_MINUS ;
case 171 : return K_KP_PLUS ;
case 172 : return K_KP_ENTER ;
case 173 : return K_KP_EQUALS ;
case 174 : return K_PRINTSCREEN ;
2013-03-13 22:54:47 +00:00
case 512 : return K_MOUSE1 ;
case 513 : return K_MOUSE2 ;
case 514 : return K_MOUSE3 ;
2014-02-11 17:51:29 +00:00
case 515 : return K_MWHEELUP ;
case 516 : return K_MWHEELDOWN ;
2013-03-13 22:54:47 +00:00
case 517 : return K_MOUSE4 ;
case 518 : return K_MOUSE5 ;
case 519 : return K_MOUSE6 ;
case 520 : return K_MOUSE7 ;
case 521 : return K_MOUSE8 ;
case 522 : return K_MOUSE9 ;
case 523 : return K_MOUSE10 ;
2014-02-11 17:51:29 +00:00
// case 524: return K_MOUSE11;
// case 525: return K_MOUSE12;
// case 526: return K_MOUSE13;
// case 527: return K_MOUSE14;
// case 528: return K_MOUSE15;
// case 529: return K_MOUSE16;
case 768 : return K_JOY1 ;
case 769 : return K_JOY2 ;
case 770 : return K_JOY3 ;
case 771 : return K_JOY4 ;
// case 772: return K_JOY5;
// case 773: return K_JOY6;
// case 774: return K_JOY7;
// case 775: return K_JOY8;
// case 776: return K_JOY9;
// case 777: return K_JOY10;
// case 778: return K_JOY11;
// case 779: return K_JOY12;
// case 780: return K_JOY13;
// case 781: return K_JOY14;
// case 782: return K_JOY15;
// case 783: return K_JOY16;
case 784 : return K_AUX1 ;
case 785 : return K_AUX2 ;
case 786 : return K_AUX3 ;
case 787 : return K_AUX4 ;
case 788 : return K_AUX5 ;
case 789 : return K_AUX6 ;
case 790 : return K_AUX7 ;
case 791 : return K_AUX8 ;
case 792 : return K_AUX9 ;
case 793 : return K_AUX10 ;
case 794 : return K_AUX11 ;
case 795 : return K_AUX12 ;
case 796 : return K_AUX13 ;
case 797 : return K_AUX14 ;
case 798 : return K_AUX15 ;
case 799 : return K_AUX16 ;
case 800 : return K_AUX17 ;
case 801 : return K_AUX18 ;
case 802 : return K_AUX19 ;
case 803 : return K_AUX20 ;
case 804 : return K_AUX21 ;
case 805 : return K_AUX22 ;
case 806 : return K_AUX23 ;
case 807 : return K_AUX24 ;
case 808 : return K_AUX25 ;
case 809 : return K_AUX26 ;
case 810 : return K_AUX27 ;
case 811 : return K_AUX28 ;
case 812 : return K_AUX29 ;
case 813 : return K_AUX30 ;
case 814 : return K_AUX31 ;
case 815 : return K_AUX32 ;
default :
if ( code < 0 ) //negative values are 'fte-native' keys, for stuff that the api lacks.
return - code ;
return code ;
2013-03-13 22:54:47 +00:00
}
}
//string findkeysforcommand(string command) = #610;
void QCBUILTIN PF_cl_findkeysforcommand ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
2014-03-30 08:55:06 +00:00
const char * cmdname = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int bindmap = G_FLOAT ( OFS_PARM1 ) ;
2013-03-13 22:54:47 +00:00
int keynums [ 2 ] ;
char keyname [ 512 ] ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
M_FindKeysForCommand ( bindmap , 0 , cmdname , keynums , NULL , countof ( keynums ) ) ;
2013-03-13 22:54:47 +00:00
keyname [ 0 ] = ' \0 ' ;
2013-05-03 04:28:08 +00:00
Q_strncatz ( keyname , va ( " \' %i \' " , MP_TranslateFTEtoQCCodes ( keynums [ 0 ] ) ) , sizeof ( keyname ) ) ;
Q_strncatz ( keyname , va ( " \' %i \' " , MP_TranslateFTEtoQCCodes ( keynums [ 1 ] ) ) , sizeof ( keyname ) ) ;
2013-03-13 22:54:47 +00:00
RETURN_TSTRING ( keyname ) ;
}
2015-06-04 06:15:14 +00:00
void QCBUILTIN PF_cl_findkeysforcommandex ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
const char * cmdname = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int bindmap = G_FLOAT ( OFS_PARM1 ) ;
2015-06-04 06:15:14 +00:00
int keynums [ 256 ] ;
int keymods [ countof ( keynums ) ] ;
char keyname [ 512 ] ;
int i , count ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
count = M_FindKeysForBind ( bindmap , cmdname , keynums , keymods , countof ( keynums ) ) ;
2015-06-04 06:15:14 +00:00
keyname [ 0 ] = ' \0 ' ;
for ( i = 0 ; i < count ; i + + )
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Q_strncatz ( keyname , Key_KeynumToString ( keynums [ i ] , keymods [ i ] ) , sizeof ( keyname ) ) ;
2015-06-04 06:15:14 +00:00
}
RETURN_TSTRING ( keyname ) ;
}
2013-03-13 22:54:47 +00:00
void QCBUILTIN PF_cl_getkeybind ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int keymap = ( prinst - > callargc > 1 ) ? G_FLOAT ( OFS_PARM1 ) : 0 ;
int modifier = ( prinst - > callargc > 2 ) ? G_FLOAT ( OFS_PARM2 ) : 0 ;
char * binding = Key_GetBinding ( MP_TranslateQCtoFTECodes ( G_FLOAT ( OFS_PARM0 ) ) , keymap , modifier ) ;
2013-03-13 22:54:47 +00:00
RETURN_TSTRING ( binding ) ;
}
void QCBUILTIN PF_cl_stringtokeynum ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
int i ;
int modifier ;
2014-03-30 08:55:06 +00:00
const char * s ;
2013-03-13 22:54:47 +00:00
s = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
i = Key_StringToKeynum ( s , & modifier ) ;
if ( i < 0 | | modifier ! = ~ 0 )
{
G_FLOAT ( OFS_RETURN ) = - 1 ;
return ;
}
2013-05-03 04:28:08 +00:00
i = MP_TranslateFTEtoQCCodes ( i ) ;
2013-03-13 22:54:47 +00:00
G_FLOAT ( OFS_RETURN ) = i ;
}
//string keynumtostring(float keynum) = #609;
void QCBUILTIN PF_cl_keynumtostring ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
int code = G_FLOAT ( OFS_PARM0 ) ;
2013-05-03 04:28:08 +00:00
code = MP_TranslateQCtoFTECodes ( code ) ;
2013-03-13 22:54:47 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
RETURN_TSTRING ( Key_KeynumToString ( code , 0 ) ) ;
2013-03-13 22:54:47 +00:00
}
2015-07-31 13:23:32 +00:00
//#343
void QCBUILTIN PF_cl_setcursormode ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
world_t * world = prinst - > parms - > user ;
if ( G_FLOAT ( OFS_PARM0 ) )
key_dest_absolutemouse | = world - > keydestmask ;
else
key_dest_absolutemouse & = ~ world - > keydestmask ;
if ( prinst - > callargc > 1 )
{
struct key_cursor_s * m = & key_customcursor [ ( world - > keydestmask = = kdm_game ) ? kc_game : kc_menu ] ;
Q_strncpyz ( m - > name , PR_GetStringOfs ( prinst , OFS_PARM1 ) , sizeof ( m - > name ) ) ;
m - > hotspot [ 0 ] = ( prinst - > callargc > 2 ) ? G_FLOAT ( OFS_PARM2 + 0 ) : 0 ;
m - > hotspot [ 1 ] = ( prinst - > callargc > 2 ) ? G_FLOAT ( OFS_PARM2 + 1 ) : 0 ;
m - > scale = ( prinst - > callargc > 2 ) ? G_FLOAT ( OFS_PARM2 + 2 ) : 0 ;
if ( m - > scale < = 0 )
m - > scale = 1 ;
m - > dirty = true ;
}
}
void QCBUILTIN PF_cl_getcursormode ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
world_t * world = prinst - > parms - > user ;
if ( G_FLOAT ( OFS_PARM0 ) )
G_FLOAT ( OFS_RETURN ) = Key_MouseShouldBeFree ( ) ;
else if ( key_dest_absolutemouse & world - > keydestmask )
G_FLOAT ( OFS_RETURN ) = true ;
else
G_FLOAT ( OFS_RETURN ) = false ;
}
2013-03-13 22:54:47 +00:00
void QCBUILTIN PF_cl_playingdemo ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
G_FLOAT ( OFS_RETURN ) = ! ! cls . demoplayback ;
}
void QCBUILTIN PF_cl_runningserver ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
# ifdef CLIENTONLY
G_FLOAT ( OFS_RETURN ) = false ;
# else
2014-05-20 02:23:37 +00:00
if ( sv . state ! = ss_dead )
{
if ( sv . allocated_client_slots > 1 )
G_FLOAT ( OFS_RETURN ) = true ;
else
G_FLOAT ( OFS_RETURN ) = 0.5 ; //give some half-way value if we're singleplayer. NOTE: DP returns 0 in this case, which is kinda useless for things like deciding whether a 'save' menu option can be used.
}
else
G_FLOAT ( OFS_RETURN ) = false ;
2013-03-13 22:54:47 +00:00
# endif
}
# ifndef NOMEDIA
2014-05-23 02:02:51 +00:00
// #487 float(string name) gecko_create
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_create_http ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shadername = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
cin_t * cin ;
2013-08-21 07:14:39 +00:00
cin = R_ShaderGetCinematic ( R_RegisterShader ( shadername , SUF_2D ,
2013-03-13 22:54:47 +00:00
" { \n "
2014-05-23 02:02:51 +00:00
" program default2d \n "
2013-03-13 22:54:47 +00:00
" { \n "
" videomap http: \n "
2014-05-23 02:02:51 +00:00
" rgbgen vertex \n "
" alphagen vertex \n "
" blendfunc blend \n "
" nodepth \n "
2013-03-13 22:54:47 +00:00
" } \n "
" } \n "
) ) ;
2014-05-23 02:02:51 +00:00
if ( cin )
{
2013-03-13 22:54:47 +00:00
G_FLOAT ( OFS_RETURN ) = 1 ;
2014-05-23 02:02:51 +00:00
Media_Send_Reset ( cin ) ;
}
else
G_FLOAT ( OFS_RETURN ) = 0 ;
2013-03-13 22:54:47 +00:00
}
2014-05-23 02:02:51 +00:00
// #488 void(string name) gecko_destroy
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_destroy ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-05-23 02:02:51 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( ! cin )
return ;
2015-02-02 08:01:53 +00:00
Media_Send_Reset ( cin ) ; //FIXME. unloading shaders can be dangerous
2013-03-13 22:54:47 +00:00
}
2014-05-23 02:02:51 +00:00
// #489 void(string name, string URI) gecko_navigate
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_command ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
const char * command = PR_GetStringOfs ( prinst , OFS_PARM1 ) ;
2013-03-13 22:54:47 +00:00
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( ! cin )
return ;
Media_Send_Command ( cin , command ) ;
}
2014-05-23 02:02:51 +00:00
// #490 float(string name, float key, float eventtype) gecko_keyevent
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_keyevent ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
int key = G_FLOAT ( OFS_PARM1 ) ;
int eventtype = G_FLOAT ( OFS_PARM2 ) ;
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( ! cin )
return ;
2013-05-03 04:28:08 +00:00
Media_Send_KeyEvent ( cin , MP_TranslateQCtoFTECodes ( key ) , ( key > 127 ) ? 0 : key , eventtype ) ;
2013-03-13 22:54:47 +00:00
}
2014-05-23 02:02:51 +00:00
// #491 void(string name, float x, float y) gecko_mousemove
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_mousemove ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
float posx = G_FLOAT ( OFS_PARM1 ) ;
float posy = G_FLOAT ( OFS_PARM2 ) ;
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( ! cin )
return ;
Media_Send_MouseMove ( cin , posx , posy ) ;
}
2014-05-23 02:02:51 +00:00
// #492 void(string name, float w, float h) gecko_resize
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_resize ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
float sizex = G_FLOAT ( OFS_PARM1 ) ;
float sizey = G_FLOAT ( OFS_PARM2 ) ;
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( ! cin )
return ;
Media_Send_Resize ( cin , sizex , sizey ) ;
}
2014-05-23 02:02:51 +00:00
// #493 vector(string name) gecko_get_texture_extent
2015-02-02 08:01:53 +00:00
void QCBUILTIN PF_cs_media_get_texture_extent ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
2013-03-13 22:54:47 +00:00
{
2014-03-30 08:55:06 +00:00
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
float * ret = G_VECTOR ( OFS_RETURN ) ;
2015-02-02 08:01:53 +00:00
int sx = 0 , sy = 0 ;
float aspect = 0 ;
2013-03-13 22:54:47 +00:00
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( cin )
2015-02-02 08:01:53 +00:00
Media_Send_GetSize ( cin , & sx , & sy , & aspect ) ;
2013-03-13 22:54:47 +00:00
ret [ 0 ] = sx ;
ret [ 1 ] = sy ;
2015-02-02 08:01:53 +00:00
ret [ 2 ] = aspect ;
}
void QCBUILTIN PF_cs_media_getposition ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
const char * shader = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
float * ret = G_VECTOR ( OFS_RETURN ) ;
qboolean active = false ;
float curtime = 0 ;
float duration = 0 ;
cin_t * cin ;
cin = R_ShaderFindCinematic ( shader ) ;
if ( cin )
Media_Send_GetPositions ( cin , & active , & curtime , & duration ) ;
ret [ 0 ] = active ;
ret [ 1 ] = curtime ;
ret [ 2 ] = duration ;
2013-03-13 22:54:47 +00:00
}
# endif
void QCBUILTIN PF_soundlength ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
2014-03-30 08:55:06 +00:00
const char * sample = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
sfx_t * sfx = S_PrecacheSound ( sample ) ;
2014-10-05 20:04:11 +00:00
if ( ! sfx | | sfx - > loadstate ! = SLS_LOADED )
2013-03-13 22:54:47 +00:00
G_FLOAT ( OFS_RETURN ) = 0 ;
else
{
sfxcache_t cachebuf , * cache ;
if ( sfx - > decoder . decodedata )
cache = sfx - > decoder . decodedata ( sfx , & cachebuf , 0x7ffffffe , 0 ) ;
else
cache = sfx - > decoder . buf ;
G_FLOAT ( OFS_RETURN ) = ( cache - > soundoffset + cache - > length ) / ( float ) snd_speed ;
}
}
2014-05-16 17:45:37 +00:00
qboolean M_Vid_GetMode ( int num , int * w , int * h ) ;
//a bit pointless really
void QCBUILTIN PF_cl_getresolution ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
float mode = G_FLOAT ( OFS_PARM0 ) ;
2014-08-15 02:20:41 +00:00
// qboolean fixedmodes = (prinst->callargc >= 2)?!G_FLOAT(OFS_PARM1):false; //if true, we should return sane-sized modes suitable for a window... or the mod could make up its own, but whatever.
2014-05-16 17:45:37 +00:00
float * ret = G_VECTOR ( OFS_RETURN ) ;
int w , h ;
w = h = 0 ;
if ( mode = = - 1 )
{
int bpp , rate ;
Sys_GetDesktopParameters ( & w , & h , & bpp , & rate ) ;
}
else
M_Vid_GetMode ( mode , & w , & h ) ;
ret [ 0 ] = w ;
ret [ 1 ] = h ;
ret [ 2 ] = ( w & & h ) ? 1 : 0 ;
}
2013-03-13 22:54:47 +00:00
# ifdef CL_MASTER
# include "cl_master.h"
void QCBUILTIN PF_cl_gethostcachevalue ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
hostcacheglobal_t hcg = G_FLOAT ( OFS_PARM0 ) ;
G_FLOAT ( OFS_RETURN ) = 0 ;
switch ( hcg )
{
case SLIST_HOSTCACHEVIEWCOUNT :
CL_QueryServers ( ) ;
Master_CheckPollSockets ( ) ;
G_FLOAT ( OFS_RETURN ) = Master_NumSorted ( ) ;
return ;
case SLIST_HOSTCACHETOTALCOUNT :
CL_QueryServers ( ) ;
Master_CheckPollSockets ( ) ;
G_FLOAT ( OFS_RETURN ) = Master_TotalCount ( ) ;
return ;
case SLIST_MASTERQUERYCOUNT :
case SLIST_MASTERREPLYCOUNT :
case SLIST_SERVERQUERYCOUNT :
case SLIST_SERVERREPLYCOUNT :
G_FLOAT ( OFS_RETURN ) = 0 ;
return ;
case SLIST_SORTFIELD :
G_FLOAT ( OFS_RETURN ) = Master_GetSortField ( ) ;
return ;
case SLIST_SORTDESCENDING :
G_FLOAT ( OFS_RETURN ) = Master_GetSortDescending ( ) ;
return ;
default :
return ;
}
}
//void resethostcachemasks(void) = #615;
void QCBUILTIN PF_cl_resethostcachemasks ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Master_ClearMasks ( ) ;
}
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
void QCBUILTIN PF_cl_sethostcachemaskstring ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
int mask = G_FLOAT ( OFS_PARM0 ) ;
int field = G_FLOAT ( OFS_PARM1 ) ;
2014-03-30 08:55:06 +00:00
const char * str = PR_GetStringOfs ( prinst , OFS_PARM2 ) ;
2013-03-13 22:54:47 +00:00
int op = G_FLOAT ( OFS_PARM3 ) ;
Master_SetMaskString ( mask , field , str , op ) ;
}
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
void QCBUILTIN PF_cl_sethostcachemasknumber ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
int mask = G_FLOAT ( OFS_PARM0 ) ;
int field = G_FLOAT ( OFS_PARM1 ) ;
int str = G_FLOAT ( OFS_PARM2 ) ;
int op = G_FLOAT ( OFS_PARM3 ) ;
Master_SetMaskInteger ( mask , field , str , op ) ;
}
//void resorthostcache(void) = #618;
void QCBUILTIN PF_cl_resorthostcache ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Master_SortServers ( ) ;
}
//void sethostcachesort(float fld, float descending) = #619;
void QCBUILTIN PF_cl_sethostcachesort ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Master_SetSortField ( G_FLOAT ( OFS_PARM0 ) , G_FLOAT ( OFS_PARM1 ) ) ;
}
//void refreshhostcache(void) = #620;
void QCBUILTIN PF_cl_refreshhostcache ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
MasterInfo_Refresh ( ) ;
}
//float gethostcachenumber(float fld, float hostnr) = #621;
void QCBUILTIN PF_cl_gethostcachenumber ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
float ret = 0 ;
int keynum = G_FLOAT ( OFS_PARM0 ) ;
int svnum = G_FLOAT ( OFS_PARM1 ) ;
serverinfo_t * sv ;
sv = Master_SortedServer ( svnum ) ;
ret = Master_ReadKeyFloat ( sv , keynum ) ;
G_FLOAT ( OFS_RETURN ) = ret ;
}
void QCBUILTIN PF_cl_gethostcachestring ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
char * ret ;
int keynum = G_FLOAT ( OFS_PARM0 ) ;
int svnum = G_FLOAT ( OFS_PARM1 ) ;
serverinfo_t * sv ;
sv = Master_SortedServer ( svnum ) ;
ret = Master_ReadKeyString ( sv , keynum ) ;
RETURN_TSTRING ( ret ) ;
}
//float gethostcacheindexforkey(string key) = #622;
void QCBUILTIN PF_cl_gethostcacheindexforkey ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
2014-03-30 08:55:06 +00:00
const char * keyname = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
2013-03-13 22:54:47 +00:00
G_FLOAT ( OFS_RETURN ) = Master_KeyForName ( keyname ) ;
}
//void addwantedhostcachekey(string key) = #623;
void QCBUILTIN PF_cl_addwantedhostcachekey ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
PF_cl_gethostcacheindexforkey ( prinst , pr_globals ) ;
}
void QCBUILTIN PF_cl_getextresponse ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
//this does something weird
G_INT ( OFS_RETURN ) = 0 ;
}
# else
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_gethostcachevalue ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { G_FLOAT ( OFS_RETURN ) = 0 ; }
void QCBUILTIN PF_cl_gethostcachestring ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { G_INT ( OFS_RETURN ) = 0 ; }
2013-03-13 22:54:47 +00:00
//void resethostcachemasks(void) = #615;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_resethostcachemasks ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_sethostcachemaskstring ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_sethostcachemasknumber ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//void resorthostcache(void) = #618;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_resorthostcache ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//void sethostcachesort(float fld, float descending) = #619;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_sethostcachesort ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//void refreshhostcache(void) = #620;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_refreshhostcache ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
//float gethostcachenumber(float fld, float hostnr) = #621;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_gethostcachenumber ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { G_FLOAT ( OFS_RETURN ) = 0 ; }
2013-03-13 22:54:47 +00:00
//float gethostcacheindexforkey(string key) = #622;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_gethostcacheindexforkey ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { G_FLOAT ( OFS_RETURN ) = 0 ; }
2013-03-13 22:54:47 +00:00
//void addwantedhostcachekey(string key) = #623;
2014-08-25 07:35:41 +00:00
void QCBUILTIN PF_cl_addwantedhostcachekey ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals ) { }
2013-03-13 22:54:47 +00:00
# endif
void QCBUILTIN PF_shaderforname ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
2014-03-30 08:55:06 +00:00
const char * str = PR_GetStringOfs ( prinst , OFS_PARM0 ) ;
const char * defaultbody = PF_VarString ( prinst , 1 , pr_globals ) ;
2013-03-13 22:54:47 +00:00
shader_t * shad ;
if ( * defaultbody )
2013-08-21 07:14:39 +00:00
shad = R_RegisterShader ( str , SUF_NONE , defaultbody ) ;
2013-03-13 22:54:47 +00:00
else
shad = R_RegisterSkin ( str , NULL ) ;
if ( shad )
2013-10-29 17:38:22 +00:00
G_FLOAT ( OFS_RETURN ) = shad - > id + 1 ;
2013-03-13 22:54:47 +00:00
else
G_FLOAT ( OFS_RETURN ) = 0 ;
}
void QCBUILTIN PF_cl_GetBindMap ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int bm [ 2 ] ;
Key_GetBindMap ( bm ) ;
G_VECTOR ( OFS_RETURN ) [ 0 ] = bm [ 0 ] ;
G_VECTOR ( OFS_RETURN ) [ 1 ] = bm [ 1 ] ;
2013-03-13 22:54:47 +00:00
G_VECTOR ( OFS_RETURN ) [ 2 ] = 0 ;
}
void QCBUILTIN PF_cl_SetBindMap ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int bm [ 2 ] =
{
G_FLOAT ( OFS_PARM0 + 0 ) ,
G_FLOAT ( OFS_PARM0 + 1 )
} ;
Key_SetBindMap ( bm ) ;
G_FLOAT ( OFS_RETURN ) = 1 ;
2013-03-13 22:54:47 +00:00
}
2015-02-02 08:01:53 +00:00
//evil builtins to pretend to be a server.
void QCBUILTIN PF_cl_sprint ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
//this is a bit pointless for menus as it doesn't know player names or anything.
# ifndef CLIENTONLY
int clientnum = G_FLOAT ( OFS_PARM0 ) ;
char * str = PF_VarString ( prinst , 1 , pr_globals ) ;
if ( sv . active & & clientnum < sv . allocated_client_slots & & svs . clients [ clientnum ] . state > = cs_connected )
SV_PrintToClient ( & svs . clients [ clientnum ] , PRINT_HIGH , str ) ;
# endif
}
void QCBUILTIN PF_cl_bprint ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
# ifndef CLIENTONLY
char * str = PF_VarString ( prinst , 0 , pr_globals ) ;
if ( sv . active )
SV_BroadcastPrintf ( PRINT_HIGH , " %s " , str ) ;
# endif
}
void QCBUILTIN PF_cl_clientcount ( pubprogfuncs_t * prinst , struct globalvars_s * pr_globals )
{
# ifndef CLIENTONLY
if ( sv . active )
G_FLOAT ( OFS_RETURN ) = sv . allocated_client_slots ;
else
G_FLOAT ( OFS_RETURN ) = 0 ;
# endif
}
2013-03-13 22:54:47 +00:00
# endif