2004-08-23 00:15:46 +00:00
//DMW
/*
F1 will return to progs . src
F2 will try to open a file with the name of which is on that line . ( excluding comments / tabs ) . Needs conditions .
F3 will give a prompt for typing in a value name to see the value .
F4 will save
F5 will run ( unbreak ) .
F6 will list the stack .
F7 will compile .
F8 will move execution
F9 will set a break point .
2015-02-02 08:01:53 +00:00
F10 will step over .
F11 will step into .
2004-08-23 00:15:46 +00:00
*/
# include "quakedef.h"
# ifdef TEXTEDITOR
2014-10-05 20:04:11 +00:00
# include "pr_common.h"
2012-11-27 03:23:19 +00:00
2016-07-12 00:40:13 +00:00
# include "shader.h"
2014-05-16 17:45:37 +00:00
//#if defined(ANDROID) || defined(SERVERONLY)
2012-11-27 03:23:19 +00:00
# define debugger_default "0"
2014-05-16 17:45:37 +00:00
//#else
//#define debugger_default "1"
//#endif
2012-11-27 03:23:19 +00:00
static cvar_t editstripcr = CVARD ( " edit_stripcr " , " 1 " , " remove \\ r from eols (on load) " ) ;
2016-07-12 00:40:13 +00:00
static cvar_t editaddcr = CVARD ( " edit_addcr " , " " , " make sure that each line ends with a \\ r (on save). Empty will be assumed to be 1 on windows and 0 otherwise. " ) ;
//static cvar_t edittabspacing = CVARD("edit_tabsize", "4", "How wide tab alignment is");
2014-05-16 17:45:37 +00:00
cvar_t pr_debugger = CVARAFD ( " pr_debugger " , debugger_default , " debugger " , CVAR_SAVE , " When enabled, QC errors and debug events will enable step-by-step tracing. " ) ;
2013-03-12 22:53:23 +00:00
extern cvar_t pr_sourcedir ;
2004-08-23 00:15:46 +00:00
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
static pubprogfuncs_t * editprogfuncs ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
qboolean editoractive ; //(export)
console_t * editormodal ; //doesn't return. (export)
int editorstep ; //execution resumption type
static qboolean stepasm ; //debugging with (generated) asm.
static int executionlinenum ; //debugging execution line.
# if defined(CSQC_DAT) && !defined(SERVERONLY)
extern world_t csqc_world ;
# endif
# if defined(MENU_DAT) && !defined(SERVERONLY)
extern world_t menu_world ;
# endif
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
void Editor_Draw ( void )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
R2D_EditorBackground ( ) ;
Key_Dest_Add ( kdm_cwindows ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
qboolean Editor_Key ( int key , int unicode )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( editormodal )
{
if ( key > = K_F1 & & key < = K_F12 )
return editormodal - > redirect ( editormodal , unicode , key ) ;
}
return false ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
void Editor_Demodalize ( void )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
if ( editormodal & & editormodal - > highlightline )
{
editormodal - > highlightline - > flags & = ~ CONL_EXECUTION ;
editormodal - > highlightline = NULL ;
}
editormodal = NULL ;
2012-11-27 03:23:19 +00:00
}
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
int Con_Editor_GetLine ( console_t * con , conline_t * line )
2005-12-21 03:07:33 +00:00
{
2016-07-12 00:40:13 +00:00
int linenum = 1 ;
conline_t * l ;
for ( l = con - > oldest ; l ; l = l - > newer , linenum + + )
{
if ( l = = line )
return linenum ;
}
return 0 ;
2005-12-21 03:07:33 +00:00
}
2016-07-12 00:40:13 +00:00
conline_t * Con_Editor_FindLine ( console_t * con , int line )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
conline_t * l ;
for ( l = con - > oldest ; l ; l = l - > newer )
{
if ( - - line = = 0 )
return l ;
}
return NULL ;
2004-08-23 00:15:46 +00:00
}
2018-11-27 16:48:19 +00:00
int Con_Editor_Evaluate ( console_t * con , const char * evalstring )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
char * eq , * term ;
eq = strchr ( evalstring , ' = ' ) ;
if ( eq )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
term = strchr ( eq , ' ; ' ) ;
if ( ! term )
term = strchr ( eq , ' \n ' ) ;
if ( ! term )
term = strchr ( eq , ' \r ' ) ;
if ( term )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
* term = ' \0 ' ;
eq = NULL ;
2004-08-23 00:15:46 +00:00
}
else
2016-07-12 00:40:13 +00:00
* eq = ' \0 ' ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
Con_Footerf ( con , false , " %s " , evalstring ) ;
if ( eq )
2005-12-21 03:07:33 +00:00
{
2016-07-12 00:40:13 +00:00
* eq = ' = ' ;
Con_Footerf ( con , true , " = %s " , editprogfuncs - > EvaluateDebugString ( editprogfuncs , evalstring ) ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
else
Con_Footerf ( con , true , " == %s " , editprogfuncs - > EvaluateDebugString ( editprogfuncs , evalstring ) ) ;
con - > linebuffered = NULL ;
return true ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
//creates a new line following an existing line by splitting the previous
conline_t * Con_EditorSplit ( console_t * con , conline_t * orig , int offset )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
conline_t * l ;
l = BZ_Malloc ( sizeof ( * l ) + ( orig - > length - offset ) * sizeof ( conchar_t ) ) ;
* l = * orig ;
l - > length = l - > maxlength = orig - > length - con - > useroffset ;
memcpy ( l + 1 , ( conchar_t * ) ( orig + 1 ) + offset , l - > length * sizeof ( conchar_t ) ) ;
orig - > length = offset ; //truncate the old line
l - > older = orig ;
l - > flags & = ~ ( CONL_EXECUTION | CONL_BREAKPOINT ) ;
orig - > newer = l ;
if ( con - > current = = orig )
con - > current = l ;
else
l - > newer - > older = l ;
if ( con - > display = = orig )
con - > display = l ;
con - > linecount + + ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
con - > selendline = con - > selstartline = NULL ;
return l ;
}
conline_t * Con_EditorMerge ( console_t * con , conline_t * first , conline_t * second )
{
conline_t * l ;
l = Con_ResizeLineBuffer ( con , first , first - > length + second - > length ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//unlink the second line
l - > newer = second - > newer ;
if ( l - > newer )
l - > newer - > older = l ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//heal references to the second to point to the first
if ( con - > selstartline = = second )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con - > selstartline = l ;
con - > selstartoffset + = l - > length ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
if ( con - > selendline = = second )
{
con - > selendline = l ;
con - > selendoffset + = l - > length ;
}
if ( con - > display = = second )
con - > display = l ;
if ( con - > oldest = = second )
con - > oldest = l ;
if ( con - > current = = second )
con - > current = l ;
if ( con - > userline = = second )
{
con - > userline = l ;
con - > useroffset + = l - > length ;
}
if ( con - > highlightline = = second )
{
con - > highlightline = l ;
con - > highlightline - > flags | = CONL_EXECUTION ;
}
//copy over the chars
memcpy ( ( conchar_t * ) ( l + 1 ) + l - > length , ( conchar_t * ) ( second + 1 ) , second - > length * sizeof ( conchar_t ) ) ;
l - > length + = second - > length ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//and that line is now dead.
con - > linecount - - ;
BZ_Free ( second ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
return l ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
static void Con_Editor_DeleteSelection ( console_t * con )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
conline_t * n ;
con - > flags & = ~ CONF_KEEPSELECTION ;
2018-09-23 19:35:24 +00:00
if ( con - > selstartline )
2004-08-23 00:15:46 +00:00
{
2018-09-23 19:35:24 +00:00
if ( con - > selstartline = = con - > selendline )
2004-08-23 00:15:46 +00:00
{
2018-09-23 19:35:24 +00:00
memmove ( ( conchar_t * ) ( con - > selstartline + 1 ) + con - > selstartoffset , ( conchar_t * ) ( con - > selendline + 1 ) + con - > selendoffset , sizeof ( conchar_t ) * ( con - > selendline - > length - con - > selendoffset ) ) ;
con - > selendline - > length = con - > selstartoffset + ( con - > selendline - > length - con - > selendoffset ) ;
}
else
{
con - > selstartline - > length = con - > selstartoffset ;
for ( n = con - > selstartline ; ; )
2016-07-12 00:40:13 +00:00
{
2018-09-23 19:35:24 +00:00
n = n - > newer ;
if ( ! n )
break ; //shouldn't happen
if ( n = = con - > selendline )
{
//this is the last line, we need to keep the end of the string but not the start.
memmove ( n + 1 , ( conchar_t * ) ( n + 1 ) + con - > selendoffset , sizeof ( conchar_t ) * ( n - > length - con - > selendoffset ) ) ;
n - > length = n - > length - con - > selendoffset ;
n = Con_EditorMerge ( con , con - > selstartline , n ) ;
break ;
}
//truncate and merge
n - > length = 0 ;
2016-07-12 00:40:13 +00:00
n = Con_EditorMerge ( con , con - > selstartline , n ) ;
}
2004-08-23 00:15:46 +00:00
}
2019-09-04 07:59:40 +00:00
con - > userline = con - > selstartline ;
con - > useroffset = con - > selstartoffset ;
2004-08-23 00:15:46 +00:00
}
}
2020-07-14 00:48:56 +00:00
static void Con_Editor_DoPaste ( void * ctx , const char * utf8 )
2004-08-23 00:15:46 +00:00
{
2018-10-11 10:31:23 +00:00
console_t * con = ctx ;
if ( utf8 )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
conchar_t buffer [ 8192 ] , * end ;
2020-07-14 00:48:56 +00:00
const char * s ;
char * nl ;
2018-10-11 10:31:23 +00:00
if ( * utf8 & & ( con - > flags & CONF_KEEPSELECTION ) )
2016-07-12 00:40:13 +00:00
Con_Editor_DeleteSelection ( con ) ;
2018-10-11 10:31:23 +00:00
for ( s = utf8 ; ; )
2016-07-12 00:40:13 +00:00
{
nl = strchr ( s , ' \n ' ) ;
if ( nl )
* nl = 0 ;
end = COM_ParseFunString ( CON_WHITEMASK , s , buffer , sizeof ( buffer ) , PFS_FORCEUTF8 ) ;
if ( Con_InsertConChars ( con , con - > userline , con - > useroffset , buffer , end - buffer ) )
con - > useroffset + = end - buffer ;
if ( nl )
{
con - > userline = Con_EditorSplit ( con , con - > userline , con - > useroffset ) ;
con - > useroffset = 0 ;
s = nl + 1 ;
}
else
break ;
}
2012-11-27 03:23:19 +00:00
}
2004-08-23 00:15:46 +00:00
}
2018-10-11 10:31:23 +00:00
static void Con_Editor_Paste ( console_t * con )
{
Sys_Clipboard_PasteText ( CBT_CLIPBOARD , Con_Editor_DoPaste , con ) ;
}
2016-07-12 00:40:13 +00:00
static void Con_Editor_Save ( console_t * con )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
vfsfile_t * file ;
conline_t * line ;
FS_CreatePath ( con - > name , FS_GAMEONLY ) ;
file = FS_OpenVFS ( con - > name , " wb " , FS_GAMEONLY ) ;
if ( file )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
for ( line = con - > oldest ; line ; line = line - > newer )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
conchar_t * cl = ( conchar_t * ) ( line + 1 ) ;
conchar_t * el = cl + line - > length ;
char buffer [ 65536 ] ;
char * bend = COM_DeFunString ( cl , el , buffer , sizeof ( buffer ) - 2 , true , ! ! ( con - > parseflags & PFS_FORCEUTF8 ) ) ;
if ( editaddcr . ival
# ifdef _WIN32
| | ! * editaddcr . string
# endif
)
* bend + + = ' \r ' ;
* bend + + = ' \n ' ;
VFS_WRITE ( file , buffer , bend - buffer ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
VFS_CLOSE ( file ) ;
2005-12-21 03:07:33 +00:00
2016-07-12 00:40:13 +00:00
Q_snprintfz ( con - > title , sizeof ( con - > title ) , " SAVED: %s " , con - > name ) ;
2013-03-12 23:24:15 +00:00
2016-07-12 00:40:13 +00:00
if ( ! Q_strncasecmp ( con - > name , " scripts/ " , 8 ) )
Shader_NeedReload ( true ) ;
}
}
qboolean Con_Editor_MouseOver ( struct console_s * con , char * * out_tiptext , shader_t * * out_shader )
{
2018-11-27 16:48:19 +00:00
char * mouseover = Con_CopyConsole ( con , true , false , false ) ;
2005-12-21 03:07:33 +00:00
2016-07-12 00:40:13 +00:00
if ( mouseover )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( editprogfuncs & & editprogfuncs - > EvaluateDebugString )
* out_tiptext = editprogfuncs - > EvaluateDebugString ( editprogfuncs , mouseover ) ;
else
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
# ifndef SERVERONLY
# ifdef CSQC_DAT
if ( csqc_world . progs & & csqc_world . progs - > EvaluateDebugString & & ! * out_tiptext )
* out_tiptext = csqc_world . progs - > EvaluateDebugString ( csqc_world . progs , mouseover ) ;
# endif
# ifdef MENU_DAT
if ( menu_world . progs & & menu_world . progs - > EvaluateDebugString & & ! * out_tiptext )
* out_tiptext = menu_world . progs - > EvaluateDebugString ( menu_world . progs , mouseover ) ;
# endif
# endif
# ifndef CLIENTONLY
if ( sv . world . progs & & sv . world . progs - > EvaluateDebugString & & ! * out_tiptext )
* out_tiptext = sv . world . progs - > EvaluateDebugString ( sv . world . progs , mouseover ) ;
# endif
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
Z_Free ( mouseover ) ;
}
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
return true ;
}
void Con_EditorMoveCursor ( console_t * con , conline_t * newline , int newoffset , qboolean shiftheld , qboolean moveprior )
{
if ( ! shiftheld )
con - > flags & = ~ CONF_KEEPSELECTION ;
else
{
if ( ! ( con - > flags & CONF_KEEPSELECTION ) | | ( con - > selendline = = con - > selstartline & & con - > selendoffset = = con - > selstartoffset ) )
2005-08-03 23:14:59 +00:00
{
2016-07-12 00:40:13 +00:00
con - > flags | = CONF_KEEPSELECTION ;
if ( moveprior )
2005-08-03 23:14:59 +00:00
{
2016-07-12 00:40:13 +00:00
con - > selstartline = newline ;
con - > selstartoffset = newoffset ;
con - > selendline = con - > userline ;
con - > selendoffset = con - > useroffset ;
}
else
{
con - > selstartline = con - > userline ;
con - > selstartoffset = con - > useroffset ;
con - > selendline = newline ;
con - > selendoffset = newoffset ;
2005-08-03 23:14:59 +00:00
}
}
else
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > selendline = = con - > userline & & con - > selendoffset = = con - > useroffset )
2005-08-03 23:14:59 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > selstartline ! = con - > selendline & & con - > selstartline = = newline & & moveprior )
{ //inverted
con - > selendline = con - > selstartline ;
con - > selendoffset = con - > selstartoffset ;
con - > selstartline = newline ;
con - > selstartoffset = newoffset ;
}
else
2005-08-03 23:14:59 +00:00
{
2016-07-12 00:40:13 +00:00
con - > selendline = newline ;
con - > selendoffset = newoffset ;
2005-08-03 23:14:59 +00:00
}
}
2016-07-12 00:40:13 +00:00
else if ( con - > selstartline = = con - > userline & & con - > selstartoffset = = con - > useroffset )
{
if ( con - > selstartline = = con - > selendline & & con - > selstartline ! = newline & & ! moveprior )
{ //inverted
con - > selstartline = con - > selendline ;
con - > selstartoffset = con - > selendoffset ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
con - > selendline = newline ;
con - > selendoffset = newoffset ;
}
else
{
con - > selstartline = newline ;
con - > selstartoffset = newoffset ;
}
}
}
2005-12-21 03:07:33 +00:00
}
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( con - > userline = = con - > display & & ! moveprior )
con - > display = newline ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
con - > userline = newline ;
con - > useroffset = newoffset ;
2004-08-23 00:15:46 +00:00
}
2018-07-05 16:21:44 +00:00
static conchar_t * Con_Editor_Equals ( conchar_t * start , conchar_t * end , const char * match )
{
conchar_t * n ;
unsigned int ccode , flags ;
for ( ; start < end ; start = n )
{
n = Font_Decode ( start , & flags , & ccode ) ;
if ( * match )
{
if ( ccode ! = * ( unsigned char * ) match + + )
return NULL ;
}
else if ( ccode = = ' ' | | ccode = = ' \t ' )
break ; //found whitespace after the token, its complete.
else
return NULL ;
}
if ( * match )
return NULL ; //truncated
//and skip any trailing whitespace, because we can.
for ( ; start < end ; start = n )
{
n = Font_Decode ( start , & flags , & ccode ) ;
if ( ccode = = ' ' | | ccode = = ' \t ' )
continue ;
else
break ;
}
return start ;
}
static conchar_t * Con_Editor_SkipWhite ( conchar_t * start , conchar_t * end )
{
conchar_t * n ;
unsigned int ccode , flags ;
for ( ; start < end ; start = n )
{
n = Font_Decode ( start , & flags , & ccode ) ;
if ( ccode = = ' ' | | ccode = = ' \t ' )
continue ;
else
break ;
}
return start ;
}
static void Con_Editor_LineChanged_Shader ( conline_t * line )
{
static const char * maplines [ ] = { " map " , " clampmap " } ;
size_t i ;
conchar_t * start = ( conchar_t * ) ( line + 1 ) , * end = start + line - > length , * n ;
start = Con_Editor_SkipWhite ( start , end ) ;
line - > flags & = ~ ( CONL_BREAKPOINT | CONL_EXECUTION ) ;
for ( i = 0 ; i < countof ( maplines ) ; i + + )
{
n = Con_Editor_Equals ( start , end , maplines [ i ] ) ;
if ( n )
{
char mapname [ 8192 ] ;
char fname [ MAX_QPATH ] ;
flocation_t loc ;
unsigned int flags ;
image_t img ;
2018-10-27 04:32:18 +00:00
2018-07-05 16:21:44 +00:00
memset ( & img , 0 , sizeof ( img ) ) ;
img . ident = mapname ;
COM_DeFunString ( n , end , mapname , sizeof ( mapname ) , true , true ) ;
2018-10-27 04:32:18 +00:00
while ( * img . ident = = ' $ ' )
{
if ( ! Q_strncasecmp ( img . ident , " $lightmap " , 9 ) )
return ; //lightmaps don't need to load from disk
if ( ! Q_strncasecmp ( img . ident , " $rt: " , 4 ) )
return ; //render targets never come from disk
if ( ! Q_strncasecmp ( img . ident , " $clamp: " , 7 ) | | ! Q_strncasecmp ( img . ident , " $3d: " , 4 ) | | ! Q_strncasecmp ( img . ident , " $cube: " , 6 ) | | ! Q_strncasecmp ( img . ident , " $nearest: " , 9 ) | | ! Q_strncasecmp ( img . ident , " $linear: " , 8 ) )
img . ident = strchr ( img . ident , ' : ' ) + 1 ;
else
break ;
}
2018-07-05 16:21:44 +00:00
if ( ! Image_LocateHighResTexture ( & img , & loc , fname , sizeof ( fname ) , & flags ) )
line - > flags | = CONL_BREAKPOINT ;
return ;
}
}
}
static void Con_Editor_LineChanged ( console_t * con , conline_t * line )
{
if ( ! Q_strncasecmp ( con - > name , " scripts/ " , 8 ) )
Con_Editor_LineChanged_Shader ( line ) ;
}
2016-07-12 00:40:13 +00:00
qboolean Con_Editor_Key ( console_t * con , unsigned int unicode , int key )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
qboolean altdown = keydown [ K_LALT ] | | keydown [ K_RALT ] ;
qboolean ctrldown = keydown [ K_LCTRL ] | | keydown [ K_RCTRL ] ;
qboolean shiftdown = keydown [ K_LSHIFT ] | | keydown [ K_RSHIFT ] ;
if ( key = = K_MOUSE1 )
{
con - > flags & = ~ CONF_KEEPSELECTION ;
con - > buttonsdown = CB_SELECT ;
return true ;
}
if ( key = = K_MOUSE2 )
{
con - > flags & = ~ CONF_KEEPSELECTION ;
con - > buttonsdown = CB_SCROLL ;
return true ;
}
if ( ! con - > userline )
return false ;
if ( con - > linebuffered )
return false ;
switch ( key )
{
case K_BACKSPACE :
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
else if ( con - > useroffset = = 0 )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > userline - > older )
Con_EditorMerge ( con , con - > userline - > older , con - > userline ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
else
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con - > useroffset - - ;
memmove ( ( conchar_t * ) ( con - > userline + 1 ) + con - > useroffset , ( conchar_t * ) ( con - > userline + 1 ) + con - > useroffset + 1 , ( con - > userline - > length - con - > useroffset ) * sizeof ( conchar_t ) ) ;
con - > userline - > length - = 1 ;
2018-07-05 16:21:44 +00:00
Con_Editor_LineChanged ( con , con - > userline ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
case K_DEL :
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
else if ( con - > useroffset = = con - > userline - > length )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > userline - > newer )
Con_EditorMerge ( con , con - > userline , con - > userline - > newer ) ;
}
else
{
memmove ( ( conchar_t * ) ( con - > userline + 1 ) + con - > useroffset , ( conchar_t * ) ( con - > userline + 1 ) + con - > useroffset + 1 , ( con - > userline - > length - con - > useroffset ) * sizeof ( conchar_t ) ) ;
con - > userline - > length - = 1 ;
2018-07-05 16:21:44 +00:00
Con_Editor_LineChanged ( con , con - > userline ) ;
2004-08-23 00:15:46 +00:00
}
break ;
2016-07-12 00:40:13 +00:00
case K_ENTER : /*split the line into two, selecting the new line*/
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
con - > userline = Con_EditorSplit ( con , con - > userline , con - > useroffset ) ;
con - > useroffset = 0 ;
2004-08-23 00:15:46 +00:00
break ;
2016-07-12 00:40:13 +00:00
case K_HOME :
if ( ctrldown )
con - > display = con - > oldest ;
else
Con_EditorMoveCursor ( con , con - > userline , 0 , shiftdown , true ) ;
return true ;
case K_END :
if ( ctrldown )
con - > display = con - > current ;
else
Con_EditorMoveCursor ( con , con - > userline , con - > userline - > length , shiftdown , false ) ;
return true ;
2011-05-20 04:10:46 +00:00
case K_UPARROW :
2017-08-16 02:14:07 +00:00
case K_KP_UPARROW :
case K_GP_DPAD_UP :
2016-07-12 00:40:13 +00:00
if ( con - > userline - > older )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > useroffset > con - > userline - > older - > length )
Con_EditorMoveCursor ( con , con - > userline - > older , con - > userline - > older - > length , shiftdown , true ) ;
2011-05-20 04:10:46 +00:00
else
2016-07-12 00:40:13 +00:00
Con_EditorMoveCursor ( con , con - > userline - > older , con - > useroffset , shiftdown , true ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
2011-05-20 04:10:46 +00:00
case K_DOWNARROW :
2017-08-16 02:14:07 +00:00
case K_KP_DOWNARROW :
case K_GP_DPAD_DOWN :
2016-07-12 00:40:13 +00:00
if ( con - > userline - > newer )
2011-05-20 04:10:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > useroffset > con - > userline - > newer - > length )
Con_EditorMoveCursor ( con , con - > userline - > newer , con - > userline - > newer - > length , shiftdown , false ) ;
2011-05-20 04:10:46 +00:00
else
2016-07-12 00:40:13 +00:00
Con_EditorMoveCursor ( con , con - > userline - > newer , con - > useroffset , shiftdown , false ) ;
}
return true ;
case K_LEFTARROW :
2017-08-16 02:14:07 +00:00
case K_KP_LEFTARROW :
case K_GP_DPAD_LEFT :
2016-07-12 00:40:13 +00:00
if ( con - > useroffset = = 0 )
{
if ( con - > userline - > older )
Con_EditorMoveCursor ( con , con - > userline - > older , con - > userline - > older - > length , shiftdown , true ) ;
}
else
Con_EditorMoveCursor ( con , con - > userline , con - > useroffset - 1 , shiftdown , true ) ;
return true ;
case K_RIGHTARROW :
2017-08-16 02:14:07 +00:00
case K_KP_RIGHTARROW :
case K_GP_DPAD_RIGHT :
2016-07-12 00:40:13 +00:00
if ( con - > useroffset = = con - > userline - > length )
{
if ( con - > userline - > newer )
Con_EditorMoveCursor ( con , con - > userline - > newer , 0 , shiftdown , false ) ;
}
else
Con_EditorMoveCursor ( con , con - > userline , con - > useroffset + 1 , shiftdown , false ) ;
return true ;
case K_INS :
if ( shiftdown )
{
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
Con_Editor_Paste ( con ) ;
break ;
}
if ( ctrldown & & ( con - > flags & CONF_KEEPSELECTION ) )
{
2018-11-27 16:48:19 +00:00
char * buffer = Con_CopyConsole ( con , true , false , true ) ; //don't keep markup if we're copying to the clipboard
2016-07-12 00:40:13 +00:00
if ( buffer )
2004-08-23 00:15:46 +00:00
{
2018-10-11 10:31:23 +00:00
Sys_SaveClipboard ( CBT_CLIPBOARD , buffer ) ;
2016-07-12 00:40:13 +00:00
Z_Free ( buffer ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
break ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return false ;
case K_LSHIFT :
case K_RSHIFT :
case K_LCTRL :
case K_RCTRL :
case K_LALT :
case K_RALT :
return true ; //these non-printable chars generally should not be allowed to trigger bindings.
2004-08-23 00:15:46 +00:00
case K_F1 :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
Con_Printf (
" Editor help: \n "
" F1: Show help \n "
" F2: Open file named on cursor line \n "
" F3: Toggle expression evaluator \n "
2016-07-12 00:40:13 +00:00
" CTRL+S: Save file \n "
" F5: Stop tracing (continue running) \n "
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
" F6: Print stack trace \n "
" F8: Change current point of execution \n "
" F9: Set breakpoint \n "
2016-07-12 00:40:13 +00:00
" ALT+F10: save+recompile \n "
" F10: Step Over (skipping children) \n "
" SHIFT+F11: Step Out \n "
" F11: Step Into \n "
// "F12: Go to definition\n"
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
) ;
Cbuf_AddText ( " toggleconsole \n " , RESTRICT_LOCAL ) ;
2018-07-05 16:21:44 +00:00
return true ;
2004-08-23 00:15:46 +00:00
case K_F2 :
2016-07-12 00:40:13 +00:00
/*{
2004-08-23 00:15:46 +00:00
char file [ 1024 ] ;
char * s ;
Q_strncpyz ( file , cursorblock - > data , sizeof ( file ) ) ;
s = file ;
while ( * s )
{
if ( ( * s = = ' / ' & & s [ 1 ] = = ' / ' ) | | ( * s = = ' \t ' ) )
{
* s = ' \0 ' ;
break ;
2005-12-21 03:07:33 +00:00
}
2004-08-23 00:15:46 +00:00
s + + ;
}
if ( * file )
2012-11-27 03:23:19 +00:00
EditorOpenFile ( file , false ) ;
2016-07-12 00:40:13 +00:00
} */
return true ;
2004-08-23 00:15:46 +00:00
case K_F3 :
2006-03-10 03:50:23 +00:00
if ( editprogfuncs )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con - > linebuffered = Con_Editor_Evaluate ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
case K_F5 : //stop debugging
if ( editormodal )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
editorstep = DEBUG_TRACE_OFF ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
case K_F6 :
if ( editprogfuncs )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
PR_StackTrace ( editprogfuncs , 2 ) ;
Key_Dest_Add ( kdm_console ) ;
return true ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return false ;
case K_F8 : //move execution point to here - I hope you move to the same function!
if ( editprogfuncs & & con - > userline )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
int l = Con_Editor_GetLine ( con , con - > userline ) ;
if ( l )
2005-12-21 03:07:33 +00:00
{
2016-07-12 00:40:13 +00:00
conline_t * n = Con_Editor_FindLine ( con , l ) ;
if ( n )
{
if ( con - > highlightline )
{
con - > highlightline - > flags & = ~ CONL_EXECUTION ;
con - > highlightline = NULL ;
}
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
executionlinenum = l ;
con - > highlightline = n ;
n - > flags | = CONL_EXECUTION ;
}
2004-08-23 00:15:46 +00:00
}
}
2016-07-12 00:40:13 +00:00
return true ;
case K_F9 : /*set breakpoint*/
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
conline_t * cl ;
char * fname = con - > name ;
int mode ;
int line ;
if ( ! strncmp ( fname , pr_sourcedir . string , strlen ( pr_sourcedir . string ) ) & & fname [ strlen ( pr_sourcedir . string ) ] = = ' / ' )
fname + = strlen ( pr_sourcedir . string ) + 1 ;
else if ( ! strncmp ( fname , " src/ " , 4 ) )
fname + = 4 ;
else if ( ! strncmp ( fname , " source/ " , 7 ) )
fname + = 7 ;
2017-08-29 02:29:06 +00:00
else if ( ! strncmp ( fname , " qcsrc/ " , 6 ) )
fname + = 6 ;
else if ( ! strncmp ( fname , " progs/ " , 6 ) )
fname + = 6 ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
cl = con - > userline ;
line = Con_Editor_GetLine ( con , cl ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( cl - > flags & CONL_BREAKPOINT )
mode = 0 ;
else
mode = 1 ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
# ifndef SERVERONLY
# ifdef CSQC_DAT
if ( csqc_world . progs & & csqc_world . progs - > ToggleBreak )
csqc_world . progs - > ToggleBreak ( csqc_world . progs , fname , line , mode ) ;
# endif
# ifdef MENU_DAT
if ( menu_world . progs & & menu_world . progs - > ToggleBreak )
menu_world . progs - > ToggleBreak ( menu_world . progs , fname , line , mode ) ;
# endif
# endif
# ifndef CLIENTONLY
if ( sv . world . progs & & sv . world . progs - > ToggleBreak )
sv . world . progs - > ToggleBreak ( sv . world . progs , fname , line , mode ) ;
# endif
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( mode )
cl - > flags | = CONL_BREAKPOINT ;
else
cl - > flags & = ~ CONL_BREAKPOINT ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
case K_F10 :
if ( altdown )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Con_Editor_Save ( con ) ;
if ( ! editprogfuncs )
Cbuf_AddText ( " compile; toggleconsole \n " , RESTRICT_LOCAL ) ;
return true ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
//if (editormodal) //careful of autorepeat
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
editorstep = DEBUG_TRACE_OVER ;
return true ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return false ;
case K_F11 : //single step
//if (editormodal) //careful of auto-repeat
2005-12-21 03:07:33 +00:00
{
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
editorstep = shiftdown ? DEBUG_TRACE_OUT : DEBUG_TRACE_INTO ;
return true ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return false ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
default :
if ( ctrldown & & key = = ' s ' )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Con_Editor_Save ( con ) ;
return true ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
if ( ctrldown & & key = = ' v ' )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
Con_Editor_Paste ( con ) ;
break ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
if ( ctrldown & & key = = ' c ' & & ( con - > flags & CONF_KEEPSELECTION ) )
2012-11-27 03:23:19 +00:00
{
2018-11-27 16:48:19 +00:00
char * buffer = Con_CopyConsole ( con , true , false , true ) ; //don't keep markup if we're copying to the clipboard
2016-07-12 00:40:13 +00:00
if ( buffer )
2012-11-27 03:23:19 +00:00
{
2018-10-11 10:31:23 +00:00
Sys_SaveClipboard ( CBT_CLIPBOARD , buffer ) ;
2016-07-12 00:40:13 +00:00
Z_Free ( buffer ) ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
break ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
if ( unicode )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
conchar_t c [ 2 ] ;
int l = 0 ;
if ( unicode > 0xffff )
c [ l + + ] = CON_LONGCHAR | ( unicode > > 16 ) ;
c [ l + + ] = CON_WHITEMASK | ( unicode & 0xffff ) ;
if ( con - > flags & CONF_KEEPSELECTION )
Con_Editor_DeleteSelection ( con ) ;
2018-11-27 16:48:19 +00:00
if ( con - > userline & & Con_InsertConChars ( con , con - > userline , con - > useroffset , c , l ) )
2018-07-05 16:21:44 +00:00
{
2016-07-12 00:40:13 +00:00
con - > useroffset + = l ;
2018-07-05 16:21:44 +00:00
Con_Editor_LineChanged ( con , con - > userline ) ;
}
2016-07-12 00:40:13 +00:00
break ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
return false ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
Q_snprintfz ( con - > title , sizeof ( con - > title ) , " MODIFIED: %s " , con - > name ) ;
return true ;
}
2020-04-19 01:23:32 +00:00
void Con_Editor_CloseCallback ( void * ctx , promptbutton_t op )
2016-07-12 00:40:13 +00:00
{
console_t * con = ctx ;
2011-05-20 04:10:46 +00:00
2016-07-12 00:40:13 +00:00
if ( con ! = con_curwindow ) //ensure that it still exists (lame only-active-window check)
return ;
2020-04-19 01:23:32 +00:00
if ( op = = PROMPT_YES )
2016-07-12 00:40:13 +00:00
Con_Editor_Save ( con ) ;
2020-04-19 01:23:32 +00:00
if ( op ! = PROMPT_CANCEL )
2016-07-12 00:40:13 +00:00
Con_Destroy ( con ) ;
}
qboolean Con_Editor_Close ( console_t * con , qboolean force )
{
if ( ! force )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ! strncmp ( con - > title , " MODIFIED: " , 10 ) )
2012-11-27 03:23:19 +00:00
{
2022-03-08 05:31:34 +00:00
Menu_Prompt ( Con_Editor_CloseCallback , con , va ( " Save changes? \n %s \n " , con - > name ) , " Yes " , " No " , " Cancel " , true ) ;
2016-07-12 00:40:13 +00:00
return false ;
2012-11-27 03:23:19 +00:00
}
}
2016-07-12 00:40:13 +00:00
if ( con = = editormodal )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
editorstep = DEBUG_TRACE_OFF ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return true ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
void Con_Editor_GoToLine ( console_t * con , int line )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con - > userline = con - > oldest ;
while ( line - - > 1 )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ! con - > userline - > newer )
break ;
con - > userline = con - > userline - > newer ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
con - > useroffset = 0 ;
con - > display = con - > userline ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//FIXME: we REALLY need to support top-down style consoles.
line = con - > wnd_h / 8 ;
line / = 2 ;
while ( con - > display - > newer & & line - - > 0 )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con - > display = con - > display - > newer ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
}
2019-01-29 07:18:07 +00:00
console_t * Con_TextEditor ( const char * fname , const char * line , pubprogfuncs_t * disasmfuncs )
2016-07-12 00:40:13 +00:00
{
static int editorcascade ;
console_t * con ;
2018-07-05 16:21:44 +00:00
conline_t * l ;
2016-07-12 00:40:13 +00:00
con = Con_FindConsole ( fname ) ;
if ( con )
{
Con_SetActive ( con ) ;
if ( line & & con - > redirect = = Con_Editor_Key )
Con_Editor_GoToLine ( con , atoi ( line ) ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( con - > close ! = Con_Editor_Close )
con = NULL ;
}
else
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
con = Con_Create ( fname , 0 ) ;
if ( con )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
vfsfile_t * file ;
Q_snprintfz ( con - > title , sizeof ( con - > title ) , " EDIT: %s " , con - > name ) ;
/*make it a console window thing*/
con - > flags | = CONF_ISWINDOW ;
con - > wnd_x = ( editorcascade & 1 ) ? vid . width / 2 : 0 ;
# ifdef ANDROID
con - > wnd_y = 0 ;
# else
con - > wnd_y = ( editorcascade & 2 ) ? vid . height / 2 : 0 ;
# endif
con - > wnd_w = vid . width / 2 ;
con - > wnd_h = vid . height / 2 ;
editorcascade + + ;
con - > flags | = CONF_NOWRAP ; //disable line wrapping. yay editors.
con - > flags | = CONF_KEEPSELECTION ; //only change the selection if we ask for it.
con - > parseflags = PFS_FORCEUTF8 ;
con - > userdata = NULL ;
con - > linebuffered = NULL ;
con - > redirect = Con_Editor_Key ;
con - > mouseover = Con_Editor_MouseOver ;
con - > close = Con_Editor_Close ;
2018-07-05 16:21:44 +00:00
con - > maxlines = 0x7fffffff ; //line limit is effectively unbounded, for a 31-bit process.
2016-07-12 00:40:13 +00:00
2019-01-29 07:18:07 +00:00
if ( disasmfuncs )
{
int i ;
char buffer [ 65536 ] ;
int start = 1 ;
2019-01-29 20:38:12 +00:00
int end = 0x7fffffff ;
2019-01-29 07:18:07 +00:00
char * colon = strchr ( con - > name , ' : ' ) ;
if ( colon & & * colon = = ' : ' )
start = strtol ( colon + 1 , & colon , 0 ) ;
if ( colon & & * colon = = ' : ' )
end = strtol ( colon + 1 , & colon , 0 ) ;
for ( i = start ; ! end | | i < end ; i + + )
{
disasmfuncs - > GenerateStatementString ( disasmfuncs , i , buffer , sizeof ( buffer ) ) ;
if ( ! * buffer )
break ;
Con_PrintCon ( con , buffer , PFS_FORCEUTF8 | PFS_KEEPMARKUP | PFS_NONOTIFY ) ;
}
}
else
2006-09-18 22:52:33 +00:00
{
2016-07-12 00:40:13 +00:00
file = FS_OpenVFS ( fname , " rb " , FS_GAME ) ;
if ( file )
2006-09-18 22:52:33 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
unsigned char buffer [ 65536 ] ;
# ifdef HAVE_LEGACY
if ( ! strcmp ( " .bin " , COM_GetFileExtension ( fname , NULL ) ) & & VFS_GETLEN ( file ) = = 80 * 25 * 2 )
2016-07-12 00:40:13 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
static unsigned short ibmtounicode [ 256 ] =
{
0x0000 , 0x263A , 0x263B , 0x2665 , 0x2666 , 0x2663 , 0x2660 , 0x2022 , 0x25D8 , 0x25CB , 0x25D9 , 0x2642 , 0x2640 , 0x266A , 0x266B , 0x263C , //0x00(non-ascii, display-only)
0x25BA , 0x25C4 , 0x2195 , 0x203C , 0x00B6 , 0x00A7 , 0x25AC , 0x21A8 , 0x2191 , 0x2193 , 0x2192 , 0x2190 , 0x221F , 0x2194 , 0x25B2 , 0x25BC , //0x10(non-ascii, display-only)
0x0020 , 0x0021 , 0x0022 , 0x0023 , 0x0024 , 0x0025 , 0x0026 , 0x0027 , 0x0028 , 0x0029 , 0x002A , 0x002B , 0x002C , 0x002D , 0x002E , 0x002F , //0x20(ascii)
0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 , 0x003A , 0x003B , 0x003C , 0x003D , 0x003E , 0x003F , //0x30(ascii)
0x0040 , 0x0041 , 0x0042 , 0x0043 , 0x0044 , 0x0045 , 0x0046 , 0x0047 , 0x0048 , 0x0049 , 0x004A , 0x004B , 0x004C , 0x004D , 0x004E , 0x004F , //0x40(ascii)
0x0050 , 0x0051 , 0x0052 , 0x0053 , 0x0054 , 0x0055 , 0x0056 , 0x0057 , 0x0058 , 0x0059 , 0x005A , 0x005B , 0x005C , 0x005D , 0x005E , 0x005F , //0x50(ascii)
0x0060 , 0x0061 , 0x0062 , 0x0063 , 0x0064 , 0x0065 , 0x0066 , 0x0067 , 0x0068 , 0x0069 , 0x006A , 0x006B , 0x006C , 0x006D , 0x006E , 0x006F , //0x60(ascii)
0x0070 , 0x0071 , 0x0072 , 0x0073 , 0x0074 , 0x0075 , 0x0076 , 0x0077 , 0x0078 , 0x0079 , 0x007A , 0x007B , 0x007C , 0x007D , 0x007E , 0x2302 , //0x70(mostly ascii, one display-only)
0x00C7 , 0x00FC , 0x00E9 , 0x00E2 , 0x00E4 , 0x00E0 , 0x00E5 , 0x00E7 , 0x00EA , 0x00EB , 0x00E8 , 0x00EF , 0x00EE , 0x00EC , 0x00C4 , 0x00C5 , //0x80(non-ascii, printable)
0x00C9 , 0x00E6 , 0x00C6 , 0x00F4 , 0x00F6 , 0x00F2 , 0x00FB , 0x00F9 , 0x00FF , 0x00D6 , 0x00DC , 0x00A2 , 0x00A3 , 0x00A5 , 0x20A7 , 0x0192 , //0x90(non-ascii, printable)
0x00E1 , 0x00ED , 0x00F3 , 0x00FA , 0x00F1 , 0x00D1 , 0x00AA , 0x00BA , 0x00BF , 0x2310 , 0x00AC , 0x00BD , 0x00BC , 0x00A1 , 0x00AB , 0x00BB , //0xa0(non-ascii, printable)
0x2591 , 0x2592 , 0x2593 , 0x2502 , 0x2524 , 0x2561 , 0x2562 , 0x2556 , 0x2555 , 0x2563 , 0x2551 , 0x2557 , 0x255D , 0x255C , 0x255B , 0x2510 , //0xb0(box-drawing, printable)
0x2514 , 0x2534 , 0x252C , 0x251C , 0x2500 , 0x253C , 0x255E , 0x255F , 0x255A , 0x2554 , 0x2569 , 0x2566 , 0x2560 , 0x2550 , 0x256C , 0x2567 , //0xc0(box-drawing, printable)
0x2568 , 0x2564 , 0x2565 , 0x2559 , 0x2558 , 0x2552 , 0x2553 , 0x256B , 0x256A , 0x2518 , 0x250C , 0x2588 , 0x2584 , 0x258C , 0x2590 , 0x2580 , //0xd0(box-drawing, printable)
0x03B1 , 0x00DF , 0x0393 , 0x03C0 , 0x03A3 , 0x03C3 , 0x00B5 , 0x03C4 , 0x03A6 , 0x0398 , 0x03A9 , 0x03B4 , 0x221E , 0x03C6 , 0x03B5 , 0x2229 , //0xe0(maths(greek), printable)
0x2261 , 0x00B1 , 0x2265 , 0x2264 , 0x2320 , 0x2321 , 0x00F7 , 0x2248 , 0x00B0 , 0x2219 , 0x00B7 , 0x221A , 0x207F , 0x00B2 , 0x25A0 , 0x00A0 , //0xf0(maths, printable)
} ;
int c , l , len ;
unsigned int u , code , oldcode ;
char line [ 7 * 80 + 2 ] ;
char tohex [ ] = " 0123456789ABCDEF " ;
VFS_READ ( file , buffer , 80 * 25 * 2 ) ;
VFS_CLOSE ( file ) ;
for ( l = 0 ; l < 25 * ( 80 * 2 ) ; l + = 80 * 2 )
{
for ( c = 0 , len = 0 , oldcode = ~ 0 ; c < 80 ; c + + )
{
u = buffer [ l + c * 2 ] ;
code = buffer [ l + c * 2 + 1 ] ;
if ( oldcode ! = code )
{
oldcode = code ;
line [ len + + ] = ' ^ ' ;
line [ len + + ] = ' & ' ;
line [ len + + ] = tohex [ ( code & 0xf ) > > 0 ] ;
line [ len + + ] = tohex [ ( code & 0x70 ) > > 4 ] ;
}
u = ibmtounicode [ u ] ; //convert from dos's IBM437 codepage to unicode.
if ( u = = 0 | | u = = ' \t ' | | u = = ' \n ' | | u = = ' \r ' )
line [ len + + ] = ' ' ;
else if ( u = = ' ^ ' )
{
line [ len + + ] = ' ^ ' ;
line [ len + + ] = ' ^ ' ;
}
else
len + = utf8_encode ( & line [ len ] , u , 3 ) ;
}
line [ len + + ] = ' \n ' ;
line [ len ] = 0 ;
Con_PrintCon ( con , line , PFS_FORCEUTF8 | PFS_NONOTIFY ) ;
}
}
else
# endif
{
while ( VFS_GETS ( file , buffer , sizeof ( buffer ) ) )
{
Con_PrintCon ( con , buffer , PFS_FORCEUTF8 | PFS_KEEPMARKUP | PFS_NONOTIFY ) ;
Con_PrintCon ( con , " \n " , PFS_FORCEUTF8 | PFS_KEEPMARKUP | PFS_NONOTIFY ) ;
}
VFS_CLOSE ( file ) ;
2016-07-12 00:40:13 +00:00
}
2006-09-18 22:52:33 +00:00
}
}
2019-01-29 07:18:07 +00:00
for ( l = con - > oldest ; l ; l = l - > newer )
Con_Editor_LineChanged ( con , l ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
con - > display = con - > oldest ;
con - > selstartline = con - > selendline = con - > oldest ; //put the cursor at the start of the file
con - > selstartoffset = con - > selendoffset = 0 ;
if ( line )
Con_Editor_GoToLine ( con , atoi ( line ) ) ;
2017-08-10 19:40:47 +00:00
else
Con_Editor_GoToLine ( con , 1 ) ;
2016-07-12 00:40:13 +00:00
Con_Footerf ( con , false , " ^2%i lines " , con - > linecount ) ;
Con_SetActive ( con ) ;
}
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
return con ;
}
2005-12-21 03:07:33 +00:00
2016-07-12 00:40:13 +00:00
void Con_TextEditor_f ( void )
{
char * fname = Cmd_Argv ( 1 ) ;
char * line = strrchr ( fname , ' : ' ) ;
2023-01-09 05:12:39 +00:00
char * lineend = NULL ;
if ( line & & strtol ( line + 1 , & lineend , 0 ) & & ! lineend )
2016-07-12 00:40:13 +00:00
* line + + = 0 ;
if ( ! * fname )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
Con_Printf ( " %s [filename[:line]]: edit a file \n " , Cmd_Argv ( 0 ) ) ;
return ;
2004-08-23 00:15:46 +00:00
}
2019-01-29 07:18:07 +00:00
Con_TextEditor ( fname , line , NULL ) ;
2004-08-23 00:15:46 +00:00
}
2019-01-29 07:18:07 +00:00
int QCLibEditor ( pubprogfuncs_t * prfncs , const char * filename , int * line , int * statement , int firststatement , char * reason , pbool fatal )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
char newname [ MAX_QPATH ] ;
console_t * edit ;
2017-08-29 02:29:06 +00:00
if ( ! strncmp ( filename , " ./ " , 2 ) )
filename + = 2 ;
2019-01-29 07:18:07 +00:00
stepasm = ! line | | * line < 0 | | pr_debugger . ival = = 2 ;
2017-12-28 16:24:50 +00:00
2015-02-02 08:01:53 +00:00
//we can cope with no line info by displaying asm
2017-12-28 16:24:50 +00:00
if ( editormodal | | ( stepasm & & ! statement ) )
2015-09-06 03:30:28 +00:00
{
if ( fatal )
2020-01-09 15:35:40 +00:00
return DEBUG_TRACE_ABORTERROR ;
2015-02-02 08:01:53 +00:00
return DEBUG_TRACE_OFF ; //whoops
2015-09-06 03:30:28 +00:00
}
2004-08-23 00:15:46 +00:00
2019-03-12 05:04:27 +00:00
if ( reason )
Con_Printf ( " QC Exception: %s \n " , reason ) ;
2017-12-28 16:24:50 +00:00
if ( ! pr_debugger . ival )
{
2019-03-12 05:04:27 +00:00
if ( ! stepasm & & * filename )
Con_Printf ( " Set %s to trace \n " , pr_debugger . name ) ;
2017-12-28 16:24:50 +00:00
if ( fatal )
2020-01-09 15:35:40 +00:00
return DEBUG_TRACE_ABORTERROR ;
2017-12-28 16:24:50 +00:00
return DEBUG_TRACE_OFF ; //get lost
}
2019-01-29 07:18:07 +00:00
if ( qrenderer = = QR_NONE ) // || stepasm)
2016-07-12 00:40:13 +00:00
{ //just dump the line of code that's being execed onto the console.
2004-10-01 22:16:01 +00:00
int i ;
char buffer [ 8192 ] ;
char * r ;
2005-12-21 03:07:33 +00:00
vfsfile_t * f ;
2004-10-01 22:16:01 +00:00
2017-12-28 16:24:50 +00:00
if ( stepasm )
{
prfncs - > GenerateStatementString ( prfncs , * statement , buffer , sizeof ( buffer ) ) ;
Con_Printf ( " %s " , buffer ) ;
return DEBUG_TRACE_INTO ;
}
2016-07-12 00:40:13 +00:00
if ( ! line )
{ //please don't crash
if ( fatal )
2020-01-09 15:35:40 +00:00
return DEBUG_TRACE_ABORTERROR ;
2016-07-12 00:40:13 +00:00
return DEBUG_TRACE_OFF ; //whoops
}
2005-12-21 03:07:33 +00:00
f = FS_OpenVFS ( filename , " rb " , FS_GAME ) ;
2004-10-01 22:16:01 +00:00
if ( ! f )
2015-02-02 08:01:53 +00:00
Con_Printf ( " %s - %i \n " , filename , * line ) ;
2004-10-01 22:16:01 +00:00
else
{
2015-02-02 08:01:53 +00:00
for ( i = 0 ; i < * line ; i + + )
2004-10-01 22:16:01 +00:00
{
2005-12-21 03:07:33 +00:00
VFS_GETS ( f , buffer , sizeof ( buffer ) ) ;
2004-10-01 22:16:01 +00:00
}
if ( ( r = strchr ( buffer , ' \r ' ) ) )
{ r [ 0 ] = ' \n ' ; r [ 1 ] = ' \0 ' ; }
Con_Printf ( " %s " , buffer ) ;
2005-12-21 03:07:33 +00:00
VFS_CLOSE ( f ) ;
2004-10-01 22:16:01 +00:00
}
2016-07-12 00:40:13 +00:00
return DEBUG_TRACE_OUT ; //only display the line itself.
2004-10-01 22:16:01 +00:00
}
2016-07-12 00:40:13 +00:00
editprogfuncs = prfncs ;
2012-11-27 03:23:19 +00:00
2017-12-28 16:24:50 +00:00
if ( ! stepasm & & * filename & & ! COM_FCheckExists ( filename ) )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
//people generally run their qcc from $mod/src/ or so, so paths are usually relative to that instead of the mod directory.
//this means we now need to try and guess what the user used.
if ( filename ! = newname & & * pr_sourcedir . string )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Q_snprintfz ( newname , sizeof ( newname ) , " %s/%s " , pr_sourcedir . string , filename ) ;
if ( COM_FCheckExists ( newname ) )
filename = newname ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
if ( filename ! = newname )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Q_snprintfz ( newname , sizeof ( newname ) , " src/%s " , filename ) ;
if ( COM_FCheckExists ( newname ) )
filename = newname ;
2012-11-27 03:23:19 +00:00
}
2016-07-12 00:40:13 +00:00
if ( filename ! = newname )
2012-11-27 03:23:19 +00:00
{
2016-07-12 00:40:13 +00:00
Q_snprintfz ( newname , sizeof ( newname ) , " source/%s " , filename ) ;
if ( COM_FCheckExists ( newname ) )
filename = newname ;
}
if ( filename ! = newname )
{
Q_snprintfz ( newname , sizeof ( newname ) , " qcsrc/%s " , filename ) ;
if ( COM_FCheckExists ( newname ) )
filename = newname ;
}
if ( filename ! = newname )
{ //some people are fucked in the head
Q_snprintfz ( newname , sizeof ( newname ) , " progs/%s " , filename ) ;
if ( COM_FCheckExists ( newname ) )
filename = newname ;
}
if ( filename ! = newname )
{
2017-12-28 16:24:50 +00:00
stepasm = true ;
2016-07-12 00:40:13 +00:00
if ( fatal )
2017-08-29 02:29:06 +00:00
Con_Printf ( CON_ERROR " Unable to find file \" %s \" \n " , filename ) ;
2017-12-28 16:24:50 +00:00
else
Con_Printf ( CON_WARNING " Unable to find file \" %s \" \n " , filename ) ;
2012-11-27 03:23:19 +00:00
}
}
2016-07-12 00:40:13 +00:00
if ( stepasm )
{
2019-01-29 07:18:07 +00:00
if ( * statement )
{
char * fname = va ( " :%#x:%#x " , firststatement , firststatement + 300 ) ;
edit = Con_TextEditor ( fname , NULL , prfncs ) ;
if ( ! edit )
return DEBUG_TRACE_OFF ;
firststatement - - ; //displayed statements are +1
executionlinenum = * statement - firststatement ;
Con_Editor_GoToLine ( edit , executionlinenum ) ;
}
else
{
if ( fatal )
2020-01-09 15:35:40 +00:00
return DEBUG_TRACE_ABORTERROR ;
2019-01-29 07:18:07 +00:00
return DEBUG_TRACE_OFF ; //whoops
}
2016-07-12 00:40:13 +00:00
}
else
{
2019-01-29 07:18:07 +00:00
edit = Con_TextEditor ( filename , NULL , NULL ) ;
2016-07-12 00:40:13 +00:00
if ( ! edit )
return DEBUG_TRACE_OFF ;
Con_Editor_GoToLine ( edit , * line ) ;
2019-01-29 07:18:07 +00:00
executionlinenum = * line ;
2016-07-12 00:40:13 +00:00
}
2004-08-23 00:15:46 +00:00
{
2012-11-27 03:23:19 +00:00
double oldrealtime = realtime ;
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
editormodal = edit ;
2015-02-02 08:01:53 +00:00
editorstep = DEBUG_TRACE_OFF ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( edit - > userline )
{
edit - > highlightline = edit - > userline ;
edit - > highlightline - > flags | = CONL_EXECUTION ;
}
while ( editormodal & & editprogfuncs )
2004-08-23 00:15:46 +00:00
{
2012-11-27 03:23:19 +00:00
realtime = Sys_DoubleTime ( ) ;
2004-08-23 00:15:46 +00:00
scr_disabled_for_loading = false ;
SCR_UpdateScreen ( ) ;
Sys_SendKeyEvents ( ) ;
2012-11-27 03:23:19 +00:00
IN_Commands ( ) ;
2006-09-18 22:52:33 +00:00
S_ExtraUpdate ( ) ;
2004-08-23 00:15:46 +00:00
2018-03-24 04:02:09 +00:00
# ifdef CLIENTONLY
Sys_Sleep ( 20 / 1000.0 ) ;
# else
2014-07-02 03:20:40 +00:00
NET_Sleep ( 20 / 1000.0 , false ) ; //any os.
2018-03-24 04:02:09 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2012-11-27 03:23:19 +00:00
realtime = oldrealtime ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
2004-08-23 00:15:46 +00:00
}
2012-11-27 03:23:19 +00:00
if ( stepasm )
2015-02-02 08:01:53 +00:00
{
2015-03-03 00:14:43 +00:00
if ( line )
* line = 0 ;
2019-01-29 07:18:07 +00:00
* statement = executionlinenum + firststatement ;
2015-02-02 08:01:53 +00:00
}
2015-03-03 00:14:43 +00:00
else if ( line )
2015-02-02 08:01:53 +00:00
* line = executionlinenum ;
return editorstep ;
2004-08-23 00:15:46 +00:00
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
void Editor_ProgsKilled ( pubprogfuncs_t * dead )
2011-05-20 04:10:46 +00:00
{
if ( editprogfuncs = = dead )
{
editprogfuncs = NULL ;
2016-07-12 00:40:13 +00:00
Editor_Demodalize ( ) ;
2015-02-02 08:01:53 +00:00
editorstep = DEBUG_TRACE_OFF ;
2011-05-20 04:10:46 +00:00
}
}
2005-08-14 03:55:08 +00:00
2006-03-10 03:50:23 +00:00
2004-08-23 00:15:46 +00:00
void Editor_Init ( void )
{
2016-07-12 00:40:13 +00:00
Cmd_AddCommand ( " edit " , Con_TextEditor_f ) ;
2005-12-21 03:07:33 +00:00
2004-08-23 00:15:46 +00:00
Cvar_Register ( & editstripcr , " Text editor " ) ;
Cvar_Register ( & editaddcr , " Text editor " ) ;
2016-07-12 00:40:13 +00:00
// Cvar_Register(&edittabspacing, "Text editor");
2014-05-10 13:42:13 +00:00
Cvar_Register ( & pr_debugger , " Text editor " ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
2004-08-23 00:15:46 +00:00
# endif