add hardcoded stairs command for coop

stairs xs ys

  Places stairs in all selections. xs and ys determine the step width
  in x- and y-direction.

DOCREF stairs
This commit is contained in:
ac-stef
2016-09-16 14:06:27 +02:00
parent 4dc54e22b5
commit fc3c77868f
5 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ menuitem "Undo last placed arch or slope" [ __undoarch ; -1 ]
menuitem "" -1
menuitemslider "Stairs axis: " 0 1 "$__stairaxis" 1 ["West to East (X)" "North to South (Y)"] [ __stairaxis = $arg1 ]
menuitemslider "Step width: " 0 5 "$__stairwidth" 1 ["downwards 3" "downwards 2" "downwards 1" "upwards 1" "upwards 2" "upwards 3"] [ __stairwidth = $arg1 ]
menuitem "\t[ Place stairs ]" [ selectionwalk [ += sw_floor (div (if $__stairaxis $sw_rel_y $sw_rel_x) (at "-3 -2 -1 1 2 3" $__stairwidth)) ] ]
menuitem "\t[ Place stairs ]" [ push i (at "-3 -2 -1 1 2 3" $__stairwidth) ; stairs (if $__stairaxis 0 $i) (if $__stairaxis $i 0) ; pop i ; 0]
newmenu skymaps
menuinit [
+1
View File
@@ -932,6 +932,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
case EDITXY_EQUALISE: editequalisexy(a1 != 0, b); break;
case EDITXY_TAG: edittagxy(a1, a2, b); break;
case EDITXY_SLOPE: slopexy(a1, a2, b); break;
case EDITXY_STAIRS: stairsxy(a1, a2, b); break;
case EDITXY_FLIPROT: selfliprotate(b, a1); break;
}
}
+19
View File
@@ -956,6 +956,25 @@ void slope(int *xd, int *yd)
}
COMMAND(slope, "ii");
void stairsxy(int xd, int yd, block &sel)
{
int off = xd || yd ? 1 : 0, xo = xd < 0 ? 1 - sel.xs : 0, yo = yd < 0 ? 1 - sel.ys : 0;
loopselxy(sel, s->floor += (xd ? (x + xo) / xd : 0) + (yd ? (y + yo) / yd : 0) + off);
remipmore(sel);
}
void stairs(int *xd, int *yd)
{
EDITSEL;
loopv(sels)
{
block &sel = sels[i];
addmsg(SV_EDITXY, "ri7", EDITXY_STAIRS, sel.x, sel.y, sel.xs, sel.ys, *xd, *yd);
stairsxy(*xd, *yd, sel);
}
}
COMMAND(stairs, "ii");
void perlin(int *scale, int *seed, int *psize)
{
EDITSELMP;
+1 -1
View File
@@ -66,7 +66,7 @@ enum { FTR_INFO = 0, FTR_PLAYERWISH, FTR_AUTOTEAM, FTR_SILENTFORCE, FTR_NUM }; /
enum { SP_OK = 0, SP_REFILLMATCH, SP_OK_NUM, SP_WRONGMAP, SP_SPECT, SP_NUM }; // spawn permission (<OK_NUM && isspect: change to active team allowed)
enum { HE_COMBO, HE_COMBO2, HE_COMBO3, HE_COMBO4, HE_COMBO5, HE_TEAMWORK, HE_FLAGDEFENDED, HE_FLAGCOVERED, HE_COVER, HE_NUM };
enum { HX_UNUSED = 0, HX_MAPINFO, HX_MODEINFO, HX_ARTIST, HX_EDITUNDO, HX_CONFIG, HX_VANTAGEPOINT, HX_NUM, HX_TYPEMASK = 0x3f, HX_FLAG_PERSIST = 0x40 };
enum { EDITXY_HEIGHT = 0, EDITXY_TEX, EDITXY_TYPE, EDITXY_VDELTA, EDITXY_EQUALISE, EDITXY_TAG, EDITXY_SLOPE, EDITXY_FLIPROT, EDITXY_NUM };
enum { EDITXY_HEIGHT = 0, EDITXY_TEX, EDITXY_TYPE, EDITXY_VDELTA, EDITXY_EQUALISE, EDITXY_TAG, EDITXY_SLOPE, EDITXY_STAIRS, EDITXY_FLIPROT, EDITXY_NUM };
#define DMF 16.0f
#define DNF 100.0f
+1
View File
@@ -726,6 +726,7 @@ extern void edittexxy(int type, int t, block &sel);
extern void editheightxy(bool isfloor, int amount, block &sel);
extern void archxy(int sidedelta, int *averts, block &sel);
extern void slopexy(int xd, int yd, block &sel);
extern void stairsxy(int xd, int yd, block &sel);
extern void edittagxy(int orv, int andv, block &sel);
extern void selfliprotate(block &sel, int dir);
extern bool noteditmode(const char* func = NULL);