settex command

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6303 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-04-23 09:35:18 +00:00
parent fe205a2e23
commit b339831354
3 changed files with 35 additions and 4 deletions
+23
View File
@@ -323,6 +323,8 @@ void editheight(int flr, int amount)
COMMAND(editheight, ARG_2INT);
// texture type : 0 floor, 1 wall, 2 ceil, 3 upper wall
void edittexxy(int type, int t, block &sel)
{
loopselxy(switch(type)
@@ -348,6 +350,26 @@ void edittex(int type, int dir)
addmsg(SV_EDITT, "ri6", sel.x, sel.y, sel.xs, sel.ys, type, t);
}
void settex(int texture, int type)
{
EDITSEL;
if(type<0 || type>3) return;
int atype = type==3 ? 1 : type;
int t = -1;
loopi(256) if(texture == (int)hdr.texlists[atype][i])
{
t = (int)hdr.texlists[atype][i];
break;
}
if(t<0)
{
conoutf("invalid/unavaible texture");
return;
}
edittexxy(type, t, sel);
addmsg(SV_EDITT, "ri6", sel.x, sel.y, sel.xs, sel.ys, type, t);
}
void replace()
{
EDITSELMP;
@@ -610,3 +632,4 @@ COMMAND(movemap, ARG_3INT);
COMMAND(selectionrotate, ARG_1INT);
COMMAND(selectionflip, ARG_1STR);
COMMAND(countwalls, ARG_1EXP);
COMMAND(settex, ARG_2INT);