guidetoggle command

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7369 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2013-03-19 15:33:24 +00:00
parent 1bf129abe6
commit bbdce85866
2 changed files with 55 additions and 1 deletions
+4 -1
View File
@@ -721,7 +721,7 @@ docargument [X2] [X-coordinate - bottom-right corner] [] [0];
docargument [Y1] [Y-coordinate - top-left corner] [] [0];
docargument [Y2] [Y-coordinate - bottom-right corner] [] [0];
docargument [C] [a color for the zone, in hexadecimal notation] [default: 0x00FF00 (green)] [0];
docremark [Only a single zone can be drawn at a time, and it will be reset (i.e. removed) once a new game starts.];
docremark [You can draw a few zones at a time. They will be reset (i.e. removed) once a new game starts.];
docremark [Note that the coordinates must be specified as integers, not as floating-point values.];
docident [dropflag] [Drops the enemy flag.];
docident [footstepalign] [Maximum time span between player animation and the playback of the footstep sound];
@@ -930,6 +930,7 @@ docident [reconnect] [Disconnects then reconnects you to the current server.];
docargument [P] [the server password] [] [0];
docident [reload] [Reloads the weapon.];
docargument [A] [] [value] [0];
docident [resetzones] [Reset all drawn zones.];
docident [rewind] [Rewind the current demo to S seconds ago.];
docargument [S] [the number of seconds to rewind] [] [0];
docremark [Note: you can use a negative value to forward.];
@@ -1118,6 +1119,8 @@ docremark [Will be reset when you issue a 'recalc'. Only works in edit mode.];
docident [getentattr] [];
docident [getenttype] [];
docident [getmapmsg] [Returns the map message of the current map.];
docident [guidetoggle] [Enables or disables a special set of default textures while editing.];
docremark [The textures in "packages/textures/map_editor" are used.];
docident [heightfield] [Marks the current selection as a heightfield.];
docargument [T] [an integer denoting the type] [0 (floor), 2 (ceiling)] [0];
docremark [marks the current selection as a heightfield, with T being floor or ceiling, as above. A surface marked as heightfield will use the vdelta values (see below) of its 4 corners to create a sloped surface. To mark a heightfield as normal again (ignoring vdelta values, set or not) use "solid 0". Default keys are h (floor) and i (ceiling).];
+51
View File
@@ -816,3 +816,54 @@ void blitsurface(SDL_Surface *dst, SDL_Surface *src, int x, int y)
}
}
Texture *e_wall, *e_floor, *e_ceil;
void guidetoggle()
{
if(player1->state == CS_EDITING)
{
Slot *sw = &slots[DEFAULT_WALL];
Slot *sf = &slots[DEFAULT_FLOOR];
Slot *sc = &slots[DEFAULT_CEIL];
char swn[256] = "packages/textures/"; swn[255] = '\0';
char sfn[256] = "packages/textures/"; swn[255] = '\0';
char scn[256] = "packages/textures/"; swn[255] = '\0';
strncat(swn, sw->name, 254);
strncat(sfn, sf->name, 254);
strncat(scn, sc->name, 254);
if( 0 //if textures match original texture name saved in Slot.name
== strcmp(sw->tex->name, path(swn))
== strcmp(sf->tex->name, path(sfn))
== strcmp(sc->tex->name, path(scn)) )
{
//replace defaults with grid texures
e_wall = sw->tex;
e_floor = sf->tex;
e_ceil = sc->tex;
sw->tex = textureload("packages/textures/map_editor/wall.jpg");
sf->tex = textureload("packages/textures/map_editor/floor.jpg");
sc->tex = textureload("packages/textures/map_editor/ceil.jpg");
conoutf("Grid: \f0on");
}
else
{
// restore textures
if(e_wall) sw->tex = e_wall;
if(e_floor) sf->tex = e_floor;
if(e_ceil) sc->tex = e_ceil;
e_wall = NULL;
e_floor = NULL;
e_ceil = NULL;
conoutf("Grid: \fBoff");
}
}
else
{
conoutf("\fBGrid view is only avaiable when editing.");
}
}
COMMAND(guidetoggle, "");