diff --git a/config/docs.cfg b/config/docs.cfg
new file mode 100644
index 00000000..2ccb75a8
--- /dev/null
+++ b/config/docs.cfg
@@ -0,0 +1,25 @@
+// auto generated script to make the command reference readable for ActionCube
+// section: Editing Reference
+
+doccommand [edittoggle] [switches between map edit mode and normal.] [(default key = e). In map edit mode you can select bits of the map by clicking or dragging your crosshair on the floor or ceiling (using the "attack" command, normally MOUSE1), then use the commands below to modify the selection. While in edit mode, physics & collision don't apply (noclip), and key repeat is ON. Note that if you fly outside the map, cube still renders the world as if you were standing on the floor directly below the camera.];
+
+doccommand [edittex] [Changes the texture on current selection by browsing through a list of textures directly shown on the cubes. ] [Default keys are the six keys above the cursor keys, which each 2 of them cycle one type (and numpad 7/4 for upper). The way this works is slightly strange at first, but allows for very fast texture assignment. All textures are in 3 individual lists for each type (both wall kinds treated the same), and each time a texture is used, it is moved to the top of the list. So after a bit of editing, all your most frequently used textures will come first when pressing these keys, and the most recently used texture is set immediately when you press the forward key for the type. These lists are saved with the map. make a selection (including wall bits) and press these keys to get a feel for what they do.];
+docargument [T] [an integer denoting the type] [floor = 0, lower or wall = 1, ceiling = 2, upper wall = 3];
+docargument [D] [D is the direction you want to cycle the textures in] [1 = forwards, -1 = backwards];
+
+doccommand [editheight] [Changes the height of the current selection.] [Default keys are [ and ] for floor level, and o/p for ceiling.];
+docargument [T] [an integer denoting the type] [floor = 0, lower or wall = 1, ceiling = 2];
+docargument [D] [the delta value to move it in] [1 = forwards, -1 = backwards];
+
+doccommand [newent] [adds a new entity] [(x,y) is determined by the current selection (the red dot corner) and z by the camera height, of said type. Type is a string giving the type of entity, such as "light", and may optionally take values (depending on the entity).];
+docargument [type] [the entity type] [light,playerstart,shells,bullets,rockets,health,ammo,clips,mapmodel,ctf-flag,ladder];
+docargument [value1] [see documentation: newent 'type'] [];
+docargument [value2] [see documentation: newent 'type'] [];
+docargument [value3] [see documentation: newent 'type'] [];
+docargument [value4] [see documentation: newent 'type'] [];
+
+doccommand [newent light] [adds a new light entity] [if only argument R is specified, it is interpreted as brightness for white light];
+docargument [radius] [the light radius] [1..32];
+docargument [R] [red colour component. see remarks below.] [1..255];
+docargument [G] [green colour component] [1..255];
+docargument [B] [blue colour component] [1..255];
\ No newline at end of file
diff --git a/docs/cubescriptreference.xsd b/docs/cubescriptreference.xsd
index 875a770c..4c2fd4d3 100644
--- a/docs/cubescriptreference.xsd
+++ b/docs/cubescriptreference.xsd
@@ -9,21 +9,59 @@
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
diff --git a/docs/editref.xml b/docs/editref.xml
index 7dac566d..c761cd54 100644
--- a/docs/editref.xml
+++ b/docs/editref.xml
@@ -5,21 +5,45 @@
-
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
+
+
+ adds a new entity
+
+
+
+
+
+
+
+ (x,y) is determined by the current selection (the red dot corner) and z by the camera height, of said type. Type is a string giving the type of entity, such as "light", and may optionally take values (depending on the entity).
+
+
+ adds a new light entity
+
+
+
+
+
+
+ if only argument R is specified, it is interpreted as brightness for white light
\ No newline at end of file
diff --git a/docs/transformcubescript.xslt b/docs/transformcubescript.xslt
index 0effe594..cb4ac6f0 100644
--- a/docs/transformcubescript.xslt
+++ b/docs/transformcubescript.xslt
@@ -21,15 +21,20 @@
] [
- ];
+ ] [
+
+ ];
- docattribute
+ docargument
[
] [
+ ] [
+
+ ];
diff --git a/source/src/main.cpp b/source/src/main.cpp
index 5b452a81..72903c4e 100644
--- a/source/src/main.cpp
+++ b/source/src/main.cpp
@@ -278,6 +278,9 @@ int main(int argc, char **argv)
preload_hudguns();
preload_entmodels();
+ initlog("docs");
+ execfile("config/docs.cfg");
+
execute("start_game");
initlog("localconnect");
diff --git a/source/src/menus.cpp b/source/src/menus.cpp
index c5f02aa4..7a03c8f3 100644
--- a/source/src/menus.cpp
+++ b/source/src/menus.cpp
@@ -62,6 +62,13 @@ void drawarrow(int dir, int x, int y, int size, float r = 1.0f, float g = 1.0f,
glEnable(GL_BLEND);
}
+void drawmenubg(int x1, int y1, int x2, int y2, bool border)
+{
+ static Texture *tex = NULL;
+ if(!tex) tex = textureload("packages/textures/makke/menu.jpg");
+ blendbox(x1, y1, x2, y2, border, tex->id);
+};
+
#define MAXMENU 17
bool rendermenu()
@@ -93,9 +100,7 @@ bool rendermenu()
int h = (mdisp+2)*step;
int y = (VIRTH-h)/2;
int x = (VIRTW-w)/2;
- static Texture *menutex = NULL;
- if(!menutex) menutex = textureload("packages/textures/makke/menu.jpg");
- blendbox(x-FONTH*3/2, y-FONTH, x+w+FONTH*3/2, y+h+FONTH, true, menutex->id);
+ drawmenubg(x-FONTH*3/2, y-FONTH, x+w+FONTH*3/2, y+h+FONTH, true);
if(offset>0) drawarrow(1, x+w+FONTH*3/2-FONTH*5/6, y-FONTH*5/6, FONTH*2/3);
if(offset+MAXMENU=0) glDisable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_POLYGON);
- glColor3f(0.6f, 0.6f, 0.6f); //glColor3d(0.2, 0.7, 0.4);
+ glColor3f(0.6f, 0.6f, 0.6f); //glColor3d(0.2, 0.7, 0.4);
glVertex2i(x1, y1);
glVertex2i(x2, y1);
glVertex2i(x2, y2);
diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp
index 06c4db20..c0ade773 100644
--- a/source/src/renderhud.cpp
+++ b/source/src/renderhud.cpp
@@ -280,7 +280,8 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
}
char *infostr = editinfo();
- if(getcurcommand()) rendercommand(20, 1570);
+ bool command = getcurcommand() ? true : false;
+ if(command) rendercommand(20, 1570);
else if(infostr) draw_text(infostr, 20, 1570);
else if(targetplayer) draw_text(targetplayer->name, 20, 1570);
@@ -288,6 +289,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glOrtho(0, VIRTW*2, VIRTH*2, 0, -1, 1);
renderconsole();
+ if(command) renderdoc(40, VIRTH);
if(!hidestats)
{
const int left = (VIRTW-225-10)*2, top = (VIRTH*7/8)*2;
@@ -452,5 +454,4 @@ void show_out_of_renderloop_progress(float bar1, const char *text1, float bar2,
glEnable(GL_DEPTH_TEST);
SDL_GL_SwapBuffers();
-}
-
+}
\ No newline at end of file
diff --git a/source/src/rendertext.cpp b/source/src/rendertext.cpp
index 2c92320a..5b0a83ba 100644
--- a/source/src/rendertext.cpp
+++ b/source/src/rendertext.cpp
@@ -210,7 +210,8 @@ void draw_text(const char *str, int left, int top)
case '2': glColor3ub(255, 192, 64); i++; continue; // yellow: gameplay action messages, only actions done by players
case '3': glColor3ub(255, 64, 64); i++; continue; // red: important errors
case '4': glColor3ub(128, 128, 128); i++; continue; // gray
- default: glColor3ub(255, 255, 255); i++; continue; // white: everything else
+ case '5': glColor3ub(255, 255, 255); i++; continue; // white: everything else
+ default: i++; continue;
}
case ' ':
@@ -241,3 +242,24 @@ void draw_text(const char *str, int left, int top)
}
}
+// draw text block using a fixed width and dynamic height, cheap word wrapping based on char number
+int draw_textblock(char *text, int x, int y, uint width)
+{
+ uint numlines = 0;
+ char *lastline = text;
+ for(char *t = text; *t; t++)
+ {
+ size_t len = t-lastline+1;
+ if(len >= width || !*(t+1)) // EOL or EOS
+ {
+ if(len == width && *(t+1) && *(t+1) != ' ') while(*t && *t != ' ') if((len = --t-lastline) <= 0) { t = lastline+width; break; } // wrap word
+ char *s = new char[len+1];
+ s_strncpy(s, lastline, len+1);
+ draw_textf("%s", x, y+FONTH*numlines, *s == ' ' ? s+1 : s);
+ delete s;
+ lastline = t;
+ numlines++;
+ }
+ }
+ return numlines;
+}
\ No newline at end of file