]> git.xonotic.org Git - xonotic/xonotic.wiki.git/blobdiff - Programming-Tips.md
fix cscope instructions
[xonotic/xonotic.wiki.git] / Programming-Tips.md
index 045ac4a9d61ce144a3946b78b30a063c0ef743c1..afef0e7411c3b3f1c698a31e2f85e3431b6efd6d 100644 (file)
@@ -36,6 +36,12 @@ prvm_globalwatchpoint : marks a global as watchpoint (when this is executed, a s
 ```
 
 Examples:  
+Print to console origin of entity number 1: `prvm_edictget server 1 origin`  
+Save to a cvar origin of entity number 1: `prvm_edictget server 1 origin my_cvar`  
+Set a custom origin for entity number 1: `prvm_edictset server 1 origin "100 200 0"`  
+
+Print to console vid_conheight client global: `prvm_edictget client vid_conheight`
+
 "Break" on statement: `prvm_breakpoint server 12345`  
 "Break" on function: `prvm_breakpoint server ClientConnect`  
 Watch for global change: `prvm_globalwatchpoint server time`  
@@ -47,3 +53,21 @@ prvm_breakpoint server
 prvm_globalwatchpoint server
 prvm_edictwatchpoint server
 ```
+
+### Tool to find C symbols, functions, declarations and definitions inside source code
+
+For this purpose it's possible to use a text-based tool called [Cscope](https://en.wikipedia.org/wiki/Cscope) together with a GUI (it can be either an application or a plugin for a text editor).
+
+#### Download / Installation
+
+* Download and install cscope with `pacman -S cscope`  
+Windows users must download the Windows version of cscope from https://code.google.com/archive/p/cscope-win32/downloads since the mingw version generates broken indices and put it into the main xonotic repo directory.
+
+* Download and install a cscope GUI or a plugin for your text editor / IDE. For example for jEdit there is a plugin called [CscopeFinder](http://plugins.jedit.org/plugins/?CscopeFinder).
+
+* Copy [cscope_createindex.sh](uploads/17c725e19be8f4935c30c2506e168405/cscope_createindex.sh) into the main xonotic repo directory.  
+
+#### Usage
+
+* Run `cscope_createindex.sh` to build cscope indices for both game (QC code) and Darkplaces (C code). This step must be repeated every time you do some code changes.  
+The indices can now be used to browse code confortably with the cscope GUI of your choice.
\ No newline at end of file