Commit Graph
4056 Commits
Author SHA1 Message Date
ac-stef cf2ae06de6 remove lightscale variable
DOCREF lightscale
2015-06-05 16:01:03 +02:00
ac-stef 11dc8202fa cleanup 2015-06-05 16:01:03 +02:00
ac-stef 6be832db4f better map model rotation
Create the rotation matrix with quaternions to avoid gimbal lock. The
matrix is created in a way, which has pitch and yaw behave as before.

Some of the quaternion code is borrowed from sauer, some from Q47 of the
Quaternions FAQ at http://vamos.sourceforge.net/matrixfaq.htm.
2015-06-05 16:00:03 +02:00
ac-stef 3d1f7d9b95 fix mapmodel occlusion when using pitch and roll
may need a bit more work, though
2015-06-05 16:00:03 +02:00
ac-stef fc0c6347f9 add lighting info to the cube inspector 2015-06-05 16:00:03 +02:00
ac-stef 7a7a8da310 experimental: add per-slot mapmodel scale factors
4th parameter of the "mapmodel" command is now a scale factor between
0.25 and 4.0. Values outside that range (like the dummy zero from old
map config files) are interpreted as 1.0
Scaling does not affect the clipping, which has to be adjusted manually.

DOCREF mapmodel editmapmodelslot
2015-06-05 16:00:02 +02:00
ac-stef 4fc8321330 set packages/audio/ambient as base directory for map sounds
Once a map uses automapcfg, only mapsounds in ambient/ will be played.
This is to keep menus and scripts clean of the prefix "ambient/".
2015-06-05 16:00:02 +02:00
ac-stef b54d9876a8 ask for replacement texture when deleting used texture slot
deletetextureslot <texture slot number> <"purge"> <replacement slot>
  Deletes an unused texture slot. If "purge" is specified as second
  argument, it also deletes an used slot. All mapmodels that use that
  texture as skin are changed to default skin. All world geometry, which
  uses the texture, is instead set to use slot #255 or a specified
  replacement slot. Slots below #5 always require "purge", no matter if
  they are in use (default slots). Also enables automapconfig.

DOCREF deletetextureslot
2015-06-05 16:00:02 +02:00
ac-stef b5187531a3 fix memory leak in gettexturelist 2015-06-05 16:00:02 +02:00
ac-stef d78002e167 texture preview display for menus
chmenutexture <menu name> <texture path>
  Displays a texture on the right side of a menu.

menutexturesize <size factor>
  Changes the size of textures displayed in menus. Mostly for testing
  purposes.

DOCREF chmenutexture menutexturesize
2015-06-05 16:00:02 +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 fb3a04d5da add access to location where findfile() found the file
"findfilelocation" contains the location, where the file was found.
Not a nice solution, but nice enough :)

Note: if the location is FFL_WORKDIR, the existence of the file has not
actually been checked yet.
2015-06-05 16:00:02 +02:00
ac-stef 00fab48b94 change names of map model attribute commands
The command mapmodelattributes is now more appropriately named
"getmapmodelattributes", and the former "getmapmodelattributes" is now
named "listallmapmodelattributes".

DOCREF listallmapmodelattributes getmapmodelattributes
2015-06-05 16:00:02 +02:00
ac-stef 4b1c4f466f new command menurenderoffset
Moves a menu away from the middle of the screen. Values of "100" represent
half the screen width and height.

  menurenderoffset x-offset y-offset

DOCREF menurenderoffset
2015-06-05 16:00:02 +02:00
ac-stef ca7fbe9f19 minor fix 2015-06-05 16:00:02 +02:00
ac-stef 4c148b8f0b fix rendering of mapmodel clips 2015-06-05 16:00:01 +02:00
ac-stef acb26e23a0 cleanup menus.cpp
Place the command macro near the function body. Makes it easier to keep
command signature and function prototype in sync.
2015-06-05 16:00:01 +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 d74296a6df experimental: allow factors up to 4 for hires textures
The performance drop is quite small and can completely be disabled by
"hirestextures 0", if needed.

May be revoked, if mappers have no use for it. Just assume this feature to
stay, if textures emerge, which benefit from factor 4 over factor 2.

DOCREF texture
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 779df670fe fix scaled world textures (a.k.a hires textures)
Until now, every texture file was only loaded once after game start. When
a subsequent use of an already in use texture required a different
scaling factor, the texture was not reloaded. Simultaneous use of one
texture file with different scaling factors was completely impossible.

Now, the scaling factor is treated as part of the file name. Therefore, a
texture will be loaded again, if it is needed in a different scaling
factor.

Also: using out of range scaling factors with the "texture" command now
results in an error message. Some map config authors don't use the command
properly...

Also: removed the unneeded createtexturefromsurface()
2015-06-05 16:00:01 +02:00
aurhat e64c2350d0 Increase speed of rewind
The commit increases very much speed of demo rewind and also prevents
AC freeze for gamespeed = 1000.
It may degrade physics for gamespeed = 1000 on very low end machines.
2015-06-05 13:37:25 +02:00
ac-stef 2f1fc1c9c8 cleanup formatted output of entity attributes 2015-05-27 15:47:05 +02:00
ac-stef aa4e6e837c add deleted entities to xmaps 2015-05-27 15:47:05 +02:00
ac-stef 79f78711bd automatically reduce showstats when dbgpos is set
Reduces "showstats 2" to "showstats 1" when dbgpos is set to "1".

DOCREF showstats dbgpos
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 edd94fb931 tilted and rotated clip entities
Attribute 7 of clip- and plclip-entities now allows four different shapes
for the clips:

  0: basic rectangular (like in older AC versions)
  1: tilted in direction of x-axis
  2: tilted in direction of y-axis
  3: rotated by 45 degrees

The shapes 1 and 2 use the value of attr6 as slope angle.

The player only can walk upwards a tilted clip, if the height (attr4) is
at least 0.6 cubes. Slopes steeper than 5.0 can not be walked up (same
maximum step size as for sloped map geometry).

Mappers, please keep in mind: especially tilted clips are more expensive
than regular clips, but they are much cheaper than stairs built from a
bunch of regular clips. Large and small clips cost exactly the same, so
try to combine clips to keep the total number down.
2015-05-27 15:47:05 +02:00
ac-stef 8fa90bef67 clarify clamp() 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 4117ff73d7 output warning for problematic map model config parameters 2015-05-27 15:47:05 +02:00
ac-stef 84871a13f1 option to show all playerstarts in edit mode
Set showplayerstarts to "1" to see a playermodel rendered at all
playerstart entities.

DOCREF showplayerstarts
2015-05-27 15:47:05 +02:00
ac-stef f3904724d7 limit the range of certain entity attributes
For example, direction angle values can be reduced to +- 360 degree.
(0..360 would be sufficient, but some people like their angles negative)

This is not a reduction of functionality or a security measure - it's for
convenience only: values now wrap around at the borders of their useful
ranges.
2015-05-27 15:47:05 +02:00
ac-stef 2349c7e508 fix ".." handling and add more strict path filtering
Enable path() to collapse multiple levels of "../" (sauer backport). Clean
up multiple consecutive path delimiters. Remove feature to concat several
paths with '&' delimiters (unused in AC).

Filter paths in findfile() to disallow access to files below the AC root
directory.

This commit fixes the problem which prevented downloaded map models from
using stock textures.
2015-05-27 15:47:04 +02:00
ac-stef a067ea2a0b add timestamp to map files 2015-05-27 15:47:04 +02:00
ac-stef 010a7579be remove ability to write map file format 9
didn't work properly anymore anyway
2015-05-27 15:47:04 +02:00
ac-stef 53f169274a fix end of string for the autogenerated embedded map config 2015-05-27 15:47:04 +02:00
ac-stef 7dc9dd54c9 reload map sound config when sound volume is changed from zero
It's a crowbar fix for a very stupid bug, but anything else would involve
debugging audio code. Sue me.
2015-05-27 15:47:04 +02:00
ac-stef d09ec395ec fix: avoid division by zero from faulty model config files 2015-05-27 15:47:04 +02:00
ac-stef 07facdfcc2 fix: no snprintf on VS 2015-05-27 15:47:04 +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 b1b789eefc rename transformoldentities
now that old entities also get re-scaled, "transformoldentitytypes" is
more appropriate
2015-05-18 14:59:41 +02:00
ac-stef c6ac0f55f8 fix tracking of unsaved edits for automapcfg
don't flag changes read from config files
2015-05-18 14:59:41 +02:00
ac-stef c4e1155dcc option to write floats as ints when possible
omit the ".0" in values like "3.0"
2015-05-18 14:59:41 +02:00
ac-stef e5fc8b35a2 be extremely pedantic with setvar and getvar in debug mode
This will exit the program, if code tries to access a non-existing
variable or an existing variable of the wrong type.
2015-05-18 14:59:41 +02:00
ac-stef 47367c3e61 new command to list entities of a certain type
enumentities <entity type name>
  Returns a list of the numbers of all entities of that type. If no such
  entities exist or the entity type could not be recognised, the list is
  empty.

DOCREF enumentities
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 f6f2216f85 keep menu selection during menu rebuild
Not clearing the menu selection in a followup "newmenu" command does not
seem to have negative effects - and keeps the selection.

Initaction ("menuinit") is now executed before the selction focus is set
during menu->open. This avoids old hover commands to be executed before
the menu gets deleted during rebuild.
2015-05-18 14:59:41 +02:00
ac-stef 225f3faa22 add automapconfig support to xmaps 2015-05-18 14:59:41 +02:00