Commit Graph
99 Commits
Author SHA1 Message Date
ac-stef 7016cc81c8 fix display bug for texture previews
thx Robtics
2016-07-21 14:04:41 +02:00
ac-stef 98d01d1f34 fix some errors and warnings for GCC 6
* do not use std::abs() because math.h includes one, that converts ints
  to double. Use own iabs(), which directly uses labs() instead.
* don't use the word "gamma" as name for variables
* don't use a homebrew round() function
2016-02-27 22:50:06 +01:00
Frank LENORMANDandac-stef 3ec0b1218d abide by the rules for reference objects 2015-07-18 00:51:00 +02:00
ac-stef bdf53a5ab8 show preview of textures during editing
When textures of the map geometry are changed, five textures around the
current pick from the "last used" stack are shown. The texture assigned
to the "sky" slot is not shown. Instead, a plain blue rectangle is used.

hudtexttl
  Time to show texture preview (in milliseconds).

DOCREF hudtexttl
2015-06-10 14:22:11 +02:00
ac-stef 1b2e944754 add script commands to support texture and sound config menus
textureslotusagelist <what>
  Return a list of 256 numbers representing the number of uses for every
  texture slot. If <what> is "onlygeometry", uses as map model skin do
  not count. If <what> is "onlymodels", the uses in map geometry do not
  count.

gettextureorigin <path>
  Returns the location where the texture actually can be found. The
  possibilities are:
    "official": texture was found in the working directory, which
                indicates an official texture.
    "custom":   texture was found in the profile directory, which means,
                the texture is either manually installed or downloaded.
    "package dir #x": texture was found in a mod directory.
    "<file not found>": that.

textureslotbyname <texture path>
  Returns the list of numbers of all texture slots which use that texture
  file.

edittexturestack <floor|wall|ceiling> <texture slot number>
  Puts a texture slot in a "last used" list up front. The first
  parameter picks the list, the second parameter is the texture
  slot number to be used for the next edit

getautomapconfig
  Returns "1" if automapconfig is already enabled, "0" otherwise.

getmapsoundorigin <path>
  Returns the location where the map sound file actually can be found. The
  possibilities are:
    "official": the sound file was found in the working directory, which
                indicates an official mapsound.
    "custom":   the file was found in the profile directory, which means,
                the mapsound is either manually installed or downloaded.
    "package dir #x": mapsound was found in a mod directory.
    "<file not found>": that.

mapsoundslotbyname <mapsound path>
  Returns the list of numbers of all mapsound slots which use that texture
  file.

getmapsoundlist
  Returns a list of all *.wav and *.ogg files below packages/audio/ambient.

DOCREF textureslotusagelist gettextureorigin textureslotbyname
DOCREF edittexturestack getautomapconfig
DOCREF getmapsoundorigin mapsoundslotbyname getmapsoundlist
2015-06-05 16:00:02 +02:00
ac-stef 107a563e99 pin selection of closest entity in map editor
Pressing the middle mouse button toggles a pin on the "closest entity"
selector. The HUD will indicate the lock by showing "pinned" instead of
"closest" entity. All actions, that would otherwise affect the closest
entity, will affect the pinned entity instead. Deleting the locked entity
will unlock it.

toggleclosestentpin
  Toggles the pin on the "closest ent" selector. Bound to MOUSE3
  by default.

DOCREF togglelockclosestent
2015-06-05 16:00:01 +02:00
ac-stef 3bdd199ad2 include and translate texture slots during copy&paste
When blocks of map geometry are copy-pasted between maps (or xmaps), this
commit translates the texture slot numbers between different texture
config sets. Missing textures are assigned a slot in the target map.

When texture slots are added, automapconfig gets enabled.

If the paste gets removed by the undo function, the newly assigned texture
slots will NOT be removed. This is by design.
2015-06-05 16:00:01 +02:00
ac-stef 2f1fc1c9c8 cleanup formatted output of entity attributes 2015-05-27 15:47:05 +02:00
ac-stef 95680b699c add undelete for entities
BACKSPACE in combination with editmeta (LCTRL) now undeletes the last
deleted entity. BACKSPACE in combination with editmeta2 (LSHIFT) brings
up the menu "deleted entities".

The edit menu now has a submenu "deleted entities" which lists all
deleted entities and undeletes the selected one.

undelent [<index>]
  If no index is specified, the last deleted entity is restored. If an
  index is given, the specified entity from the list of deleted entities
  is restored.

getdeletedentities
  Returns a list of deleted entities. Each line contains the entity type,
  the position and all seven attributes.

unlistdeletedentity [<which>]
  If <which> is a number, the specified entry from the list of deleted
  entities gets removed. If <which> is "all", the whole list of deleted
  entities gets deleted. If <which> is "last" the last deleted entity is
  removed from the list of deleted entities.
  Returns the number of entities on the list of deleted entities (even if
  the parameter <which> was unknown or not specified).

DOCREF undelent getdeletedentities unlistdeletedentity
2015-05-27 15:47:05 +02:00
ac-stef c9ef46062f finish attr5..7 and highres entity attributes
* some cleanups in editing.cpp (putting COMMAND to the function, removing
  unnecessary COMMANDF)
* upgrade transformclipentities for floating point clip entities
* changed some entity commands to float attributes

entproperty <attribute index> <attribute increment> [<unscaled flag>]
  index and increment work like before, but increment is now a float for
  some attributes. If unscaled is "1", increment is applied as unscaled
  integer, which means, it will change float attributes at their highest
  resolution.

getentattr <attribute index> [<unscaled flag>]
  Works like before, but returns float values for some attributes. If
  unscaled is "1", raw integer values (representing the highest resolution)
  are returned.

entset <type> <attr1> <attr2> <attr3> <attr4>
  Works like before, but some attributes may be specified as floats.

editentity <...>
  Now uses float values for some attributes. Return values also may be
  float.

DOCREF newent entproperty getentattr entset editentity
2015-05-27 15:47:05 +02:00
ac-stef 6eb6407684 more details for editinfo
also: break it into two lines
2015-05-27 15:47:04 +02:00
ac-stef f774e4d841 higher resolution for entity attributes
Interpret the values for entity yaw angles and clip entity sizes as
fifths or tenths of cubes or degree.

This makes some entity attributes appear as float values to the user.
The map file still only keeps integer values - but now they are
interpreted differently - for example, a health pack elevation value of 6
now means 0.6 cubes instead of 6.

Note: the scaling factors are hardcoded - use ENTSCALE5 or ENTSCALE10
whereever possible. For generic entity editing, the scaling values are
also stored in entscale[] - but that table can not be changed without
breaking the map format! This scaling is similar to the treatment of the
vdelta values of map cubes.
2015-05-27 15:47:04 +02:00
ac-stef ea480a7b0c higher resolution for waterlevel
Interpret the waterlevel value as tenths of a cube.

This makes the waterlevel variable a float value to the user, while the
map file still stores an integer value - but now it is interpreted
differently - for example, a waterlevel value of 123 now means 12.3 cubes
instead of 123. Old map files are converted during loading.

Note: the values of waterlevel and hdr.waterlevel need to be in sync.

DOCREF waterlevel
2015-05-18 14:59:41 +02:00
ac-stef ae82b6b22e add attr5..7, add mapmodel pitch and roll
Keys 5, 6 and 7 (in combination with the scrollwheel) can be used to alter
the new entity attributes.

Pressing editmeta (LCTRL by default) speeds up the scrolling.

(Parts of the roll code are borrowed from Alejandro V. Garcia's commit
"Model rotations, experimental" from January 2013)

Note: coop edit is now broken between "next" and older clients, but I
  don't want to bump the protocol just yet.
2015-05-18 14:59:41 +02:00
ac-stef b0227a1e19 new command gotoposition
Only in edit mode: get and set camera position. Returns x, y, z, yaw and
pitch. Sets x, y, z, yaw and pitch, if the parameter is not an empty
string.

example:
  echo (gotoposition)
    "67.7 78.6 5.5 8 0"
  gotoposition "" "" "" 180 0
    change yaw and pitch to look straight in +y direction

DOCREF gotoposition
2015-05-18 14:59:41 +02:00
ac-stef e3fc073742 add "gotoentity" command
jump to the location of a map entity

DOCREF gotoentity
2015-05-18 14:46:02 +02:00
aurhatandac-stef 8b2b7e0ac7 Change switching between spectate and edit mode
1. In multiplayer this switching isn't allowed, because it was broken
   and messed up, for example other players didn't see concurrently
   spectating and editing player.
2. In demo mode switching from spectate to edit mode is improved.
3. Several years broken code for edit mode is reverted.
2015-05-03 22:42:06 +02:00
ac-stef 400e7eb9a6 fix glitch in map editor that allowed to violate map borders
Also, provide a more detailed error message in case of client fatal due
 to bad map (with non-solid borders).
2015-01-29 15:09:54 +01:00
ac-stef e2ac8efadd remove restrictions on mapmodel rotation
Until now, the angles of mapmodels (and ctf-flags) were rounded to the
nearest 15-degree-step during rendering. This patch moves the rounding
to the time of placement of the model. Now the angle can be changed freely
after the model has been placed.

This commit also changes the angle resolution to 0.25 degree.

When changing the angle (press "1" + scrollwheel), additionally pressing
editmeta (a.k.a. LCTRL) changes the increments of the wheel from 1 to 10.

During a savemap with format 9, the angle resolution is reduced again, to
keep compatibility. Therefore, this features is only for testing right now.
It won't be preserved during a save (at least, as long as format 9 is used)
2014-10-22 12:08:42 +02:00
aurhatandac-stef 38d88602aa Drop activated grenade, when player switches to edit mode 2014-07-19 14:38:33 +02:00
ac-stef b3ee85fd6d fix failed assertion on making selections in editmode
last() may not be used on an empty vector

also, the FIXME was obsolete, since addselection() does call correctsel()
2014-06-07 00:30:50 +02:00
ac-stef bca1e7a3cc play drop sound when exiting edit mode
...and the player "drops" back into the map
(fixes issue #55)
2014-05-24 16:47:07 +02:00
ac-stef 493aefd34b fix: convert xmap path names for windows
* make sure, unsaved edits only count in editmode (otherwise "watercolour"
  in map configs would already be "edits")

* nicer filenames for backup-xmaps

* catch failed xmap file write access

* unsavededits is now flag (!= 0) and counter - to enable scripts to
  detect "new edits".

new commands:

xmap_delete_backup    deletes the backup xmap

xmap_keep_backup    moves the backup xmap to a regular named spot

xmap_rename    changes the nickname of an xmap
2014-05-19 12:31:26 +02:00
ac-stef af92c3cf22 substitute ffs()
windows libraries seem to lack this nice function
2014-05-16 18:38:51 +02:00
ac-stef b0649b5ea5 multiple map buffers for map editing: "xmaps"
An xmap holds everything related to map editing at a certain moment: it is
a map editing snapshot. It contains the name, the header, the geometry,
the entities, the extra headers, the undo/redo data and the cameraposition
from the moment, the snapshot was taken.

Xmaps are held in memory and, if persistentxmaps is set to "1", are saved
at game end and restored at game start.

xmap_list
  lists all xmaps currently in memory

xmap_store <nickname>
  create a snapshot and store it under the given nickname
  (nicknames have to qualify as valid filenames)

xmap_restore <nickname>
  restores the named snapshot. Also creates a backup snapshot of the
  current editing data.

xmap_restore
  restores the last automatic backup snapshot. Automatic snapshots are
  taken, a) before a snapshot is restored, b) before a new map is loaded
  (if there were unsaved edits on the map) and c) when the game ends (if
  there were unsaved edits).

xmap_delete <nickname>
  deletes the named snapshot.

Unsaved edits are flagged in the HUD with an "U" in the lower right
corner of the screen.

The files with the persistent xmaps are stored in mapediting/xmaps. After
they were restored at game start, the files are moved to
mapediting/xmaps/backups. Xmap files are cubescript files.
2014-05-15 17:34:25 +02:00
ac-stef d3bda71212 map file addons: embedded config file; persistent undo/redo data
This commit establishes an extensible way of storing additional data in
map file headers. Those header extras can be permanent, like the embedded
config file or be used only once after map load like the undo/redo data.

Additional extra data can be easily added and will not break backward
compatibility, so this map format should hold up for quite some time.

To make things easier for mappers, maps can now be saved without invoking
the various optimisations. That, in combination with the stored undo data,
means, that editing a map can be picked up at exactly the same state, as
the map was saved in.

Maps will automatically be written in the appropriate fashion, depending
on the situation:
 1) for sendmap: no optimisation, no undo data
 2) savemap during editing: no optimisation, with undo data
 3) savemap when not editing: optimised, no undo data
 4) savemapoptimised: optimised, no undo data
(For savemap to save different maps during editing, the variable
 preserveundosonsave has to be "1". It is "0" by default.)

All of the above map files can be played without problems - they only
differ in file size. (However, maps with undo data may be too big to send)

The new command "embedconfigfile" will load the config file, include it in
the map header and rename the original text file.

"extractconfigfile" will write an embedded config file to a separate file
and remove it from the map header.

Embedded config files take precedence over regular config files and
therefore make it harder for cheaters to play with modified config files.

further changes: cleaned up some debugging code; more ASSERTs
2014-05-15 16:07:52 +02:00
ac-stef 832e46141b undo/redo with editmeta pressed also restores player position
also selects the affected area
(less useful in coopedit because always the own position is restored)

for testers: editmeta still defaults to LCTRL
2014-05-15 13:48:31 +02:00
ac-stef aaf01e8b2a redo for the editor
an undo for undos :)
2014-05-15 13:48:31 +02:00
ac-stef 50b3f6867c show detailed data of the cube inside editing focus
* shows all geometry data of the cube in editing focus in the hud
* can be toggled by F8 in editmode
* shows cuby type, floor and ceiling heights, vdelta and all textures

(if mipstats *and* edit focus details are requested: show focus detail)
2014-05-15 13:48:30 +02:00
ac-stef 2c2395d97a have the waterlevel variable reflect the actual value of the map 2014-05-15 11:43:37 +02:00
ac-stef ff8aea940d some edit fixes
* fixing edit paste
* fix power of 2 check for corner selection
* fix pasting multiple selections changed target selections
* fixing editdrag: plugging memory leak
* fixing editdrag: proper binding of keys
* fixing editdrag: allow deselecting (by selecting a second time)
* make a little more room for undos (RAM is cheap and maps are big)
* some cleanups
2014-05-15 11:42:54 +02:00
ac-stef eb60302e67 cleanup
- fix possible crash in conc (but it's still an ugly hack)
- fix noob usage of strcmp
- flag some memory leaks (it would be nice, if the author(s) would clean
   up the mess himself)
- fix crash in substr
- whitespace cleanup

there are plenty more memory leaks in command.cpp - for example, every
goto in cubescript does not clean up anything
2014-05-14 22:54:37 +02:00
ac-stef e69a94cdd8 loop optimizations
also cut some overshooting lines
2014-01-31 00:53:12 +01:00
ac-stef d258b7c186 less annoying visualisation for tagclips
- press B to get the former filled volume view
- raise the value of tagnumfull to get both views simultaneously
- cubescript parameters should be cleaned up before release
2014-01-30 19:38:41 +01:00
ac-stef a8d2ab1c65 transformclipentities improved
The function will now also take care of obsolete clip entities, which
gives the mapper the opportunity to tag clip areas manually and then
have the envelopped (and therefore obsolete) clip entities removed.

When done, the map will be cleaned of "clip & plclip" tags, since clip
already includes the properties of plclip.
2014-01-29 13:03:37 +01:00
ac-stef 7f12ef4131 command to automatically convert all suitable clip entities into tag clips
also: fix sparklies in heightfields
2014-01-29 00:03:50 +01:00
ac-stef 0ff8fafb5f limit particle emission to 50 fps 2014-01-28 16:01:21 +01:00
ac-stef 6f5635917f visualisation for tagclips
To keep things cheap, only tagged areas inside the editing grid are shown.
I added two variables, tagnum and taglife, to allow playing with the
parameters of the sparklies. Those should be removed later. The default
values work quite well on my really crappy onboard graphics card. Higher
values start dropping fps.

Also, the edit status line now shows the tag value of the cube pointed at.

The patch also fixes the bug, that the edit status line did not show
details about the selection, unless there was at least one entity in the
map.
2014-01-28 14:28:43 +01:00
Lucas GAUTHERON 31c0d29bc2 minor code "fixes"
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7276 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-03-02 15:04:23 +00:00
Bukz f353141284 alias newselkeys - "binds" a list of keys to make new (multiple) selections in editmode (left CTRL is default)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7221 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-02-17 02:21:07 +00:00
Ronald Reagan ca838cd760 Two bug fixes, Mouse1+E crash, and setnext in SP crash
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6969 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-12-11 20:52:57 +00:00
sireus b2daa778b7 use the right function (thanks, Felix)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6936 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-11-20 16:10:30 +00:00
sireus b33116712c sane(r) command signatures (warning: huge commit)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6908 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-10-06 22:49:49 +00:00
Bukz 0a0d09e73a /paste fix, use light data from destination not the source
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6804 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-05-23 15:21:24 +00:00
Bukz be0f32d2c7 /paste remip fix
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6803 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-05-23 15:08:01 +00:00
Lucas GAUTHERON 37efdcdb3e registersound fix, + new "showgrid" variable
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6729 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-12-10 18:03:04 +00:00
Lucas GAUTHERON b8fd22b476 lil' fix
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6707 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-11-22 19:16:54 +00:00
flowtron 5f3fb3ef67 keep SPECT state across spawns
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6665 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-10-15 23:57:27 +00:00
Lucas GAUTHERON f1ff34db9c small fix
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6662 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-10-02 15:20:18 +00:00
Lucas GAUTHERON 4c3fdd16ef cubescript commands (addselection/resetselections) + win32 binaries
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6661 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-09-30 18:54:18 +00:00