Commit Graph
3403 Commits
Author SHA1 Message Date
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 f4a4b843de engine tweak: quadrupling occlusion resolution without much computing effort
this patch gives the same occlusion resolution as NUMRAYS 2048, but still
maintains a table with only 512 entries
also, the 1536 additional rays start their search at the nearest already
found solid
2014-05-15 13:48:31 +02:00
ac-stef 5f484a45a5 engine tweak: fixing lighting postfilter
no longer directional IIR filtering, now it's (mostly) pure FIR
also, huge speedup (for example, ac_iceroad recalcs 80% faster)
2014-05-15 13:48:31 +02:00
ac-stef 9eceef38df engine tweak: cleaning up calclight 2014-05-15 13:48:31 +02:00
ac-stef 34b99ca713 engine tweak: static seed for random light calculation
repeated recalcs now produce the same lighting - also, every player
gets to see the same map
2014-05-15 13:48:31 +02:00
ac-stef b38fd1b57b engine tweak: speeding up blockcopy/blockpaste
used for dynlight, and that's realtime...
2014-05-15 13:48:31 +02:00
ac-stef 0dbaddd344 engine tweak: cleaned up worldrender 2014-05-15 13:48:31 +02:00
ac-stef 84da079bc0 engine tweak: double the speed of remip 2014-05-15 13:48:31 +02:00
ac-stef edc7f48f33 revert (hack style) fix to clean up invisible cubes
This fix is no longer needed, because the new corner handling in the
physics engine does no longer care about those cubes. Also, they can
now be cleaned up by mapmrproper.
2014-05-15 13:48:31 +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 859df26089 refactored load_world and save_world
* separated "loading the map" from "collecting map statistics"
* replaced the buggy toptimize with mapmrproper as default
  pre-save optimiser
* add timestamps to loadmap-stats
2014-05-15 13:48:30 +02:00
ac-stef 24c5fada62 new cleanup tool for hidden map attributes
"mapmrproper" tries to optimize hidden attributes of maps in a way, that
the map can be handled in bigger chunks by the renderer.

The mipmapping routine does not take into account, if certain textures
of a cube are visible at all, when it collects otherwise identical cubes
to be handled en-bloc. "mapmrproper" changes invisible textures in a way,
that the cubes are in fact identical - so, that the mipmapper is satisfied.

This optimization is a bit too huge for now, to be used by savemap by
default (instead of toptimize()) - even though mapmrproper is far superior
to toptimize(). Since mapmrproper potentially changes a lot of textures,
it may be too annoying during the creation of a map anyway. It is a tool
to optimize the map, as soon as the geometry (and texturing) is done.

The optimizer does not change any map properties that are visible in any
way. The optical effect of slightly changing lighting of the map is caused
by the (light-) recalc() function at the end of the optimization run.
Every run of recalc() seems to have that effect (check for yourself, by
typing /recalc several times).

Before any changes are made, mapmrproper creates a backup, which can be
restored by "undo" (press "U"). Enable mipstats (F6), to see, what has
been done.

The command "calcmipstats" just counts all the mips in the current map,
and prints their numbers as 1x1/2x2/4x4/8x8/16x16/32x32/64x64.

Keep in mind, that map geometry /and/ lighting affects the mipmapping.
(To get a better idea of this, try changing the "lighterror" parameter)
2014-05-15 13:48:30 +02:00
ac-stef 2a9d4a98c5 check texlists at map load
if by some freak accident the list gets corrupted, the textures are no
longer accessible from the map editor

this check makes sure, that nothing is missing
2014-05-15 13:48:30 +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 a37d437a2f nicer mipstat display
* display mistats in the hud instead of having them flood the console
* added display of 8x8 mips, just to show that they are possible

press F6 in editmode to see the difference
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 5058172a06 fix empty map name after /newmap and fix voting for nonexistent maps
now /savemap after /newmap saves to "newmap.cgz" instead of ".cgz"

also, voting for a nonexistent map in singleplayer leaves the client in
some sort of a broken state. this fix blocks the vote.

and: newmap is blocked in bot modes, since that isn't working stable.
2014-05-14 22:39:57 +02:00
ac-stef 23d04ffec6 fix access to uninitialized memory
thx, valgrind
2014-05-14 22:39:57 +02:00
ac-stef 13c432229b reverting integer overflow which floods the log every 50 days
this may have been borons second most stupid commit
2014-05-14 22:39:57 +02:00
ac-stef dcd46bbec9 fix modifyvar
give a proper error message when trying to edit read-only vars
2014-05-14 22:38:29 +02:00
ac-stef c276c508da fix prompt cursor position
no more 1-char limit on inputcommand prompts
2014-05-14 22:38:29 +02:00
ac-stef d0722dbc27 fix seedlen 2014-05-14 22:38:29 +02:00
ac-stef ac54bdbb5a substitute non-portable printf format string
the printf format "llx" can not be used on all platforms (for example,
mingw uses a different name for it)

this patch provides a function, that manually converts a 64-bit integer
to a hex string

Thx, Jpablon
2014-05-14 22:17:21 +02:00
ac-stef 8a091430c7 filter reserved windows filenames
this patch prevents the use of map names like COM1 and PRN for all clients,
so that windows clients wouldn't hang because of the map name

Thx, Jpablon
2014-05-14 22:17:21 +02:00
ac-stef de5deae8e3 fix: gcc crashing the client
This workaround lowers the optimisation level for those parts of the code,
that gcc 4.7 (and probably other versions) would compile to a binary that
crashes after a while. The previous solution for this so-called "linux bug"
was to use clang instead of gcc.

Thx, Jpablon, for doing all the work on this.
2014-05-14 22:17:20 +02:00
ac-stef ec97e75b51 makefile with easier customisation
This makefile allows changing the compiler to g++ or requesting debug
binaries without editing the makefile.

The makefile sets default values for CXX and ACDEBUG, then reads values
from the file Makefile_local (if it exists). A commandline parameter
overrules both.

Makefile_local is not part of the repository, so it can be changed without
git caring (or nagging) about it. It is listed in .gitignore.

To switch to g++, create a file "Makefile_local" with the content
"CXX=g++".

To compile debug binaries, type "make clean install ACDEBUG=yes".

When g++ is used, "fast-math" is now enabled.
2014-05-14 16:31:14 +02:00
Lucas GAUTHERONandac-stef 8e0796a6ae transparency options for console and votes (resolves #45) 2014-05-14 14:28:54 +02:00
Lucas GAUTHERONandac-stef 4fd4e09f43 Added AC icon to SDL window (fixes #29)
As zeSKB reported, there was no icon for the game window.
This should now be fixed. We might want to make it transparent in the future,
but we would have to make sure it will be supported by any system.
2014-05-14 14:28:54 +02:00
ac-stef 6306a75e6e report openal errors with more detail
(to make debugging further sound issues easier)
position checking may be reduced again in a while...
2014-05-14 14:28:45 +02:00
ac-stef c9db8143f4 fix some sound bug
in some cases, TraceLine may shorten the shotline to length zero, which
causes addshotline() to produces illegal coordinates for sound effects
2014-05-14 14:27:00 +02:00
aurhat 88f9448238 Fix of the bug, which causes crash on Windows because of missing "history" file.
After first run of git AC version "config/history" file doesn't exist, what causes crash of  Windows AC version,  which can't find this file.
Commit just adds checking, whether this file exists - "if(!histbuf) return;" in loadhistory() .
Commit fixes also location of some brackets and spaces, in order to keep proper AC style.
2014-04-08 22:23:58 +02:00
aurhat 5b94bab21f Fix of wrong "alive" status in scoreboard.
This commit fixes the issue: https://github.com/assaultcube/AC/issues/21
Player in spectate mode isn't dead, so when he switches from spectate to active mode, he is still non-dead.
Therefore d->state=="CS_DEAD" doesn't work in such cases.
This commit removes also some aimless line.
2014-04-05 13:52:41 +02:00
aurhat 599e62336a Patch adds flags reset in ctf/htf mode after "shuffleteams".
Nowadays after teams rearrangemend flags are only dropped and don't return to base.
2014-03-30 15:38:29 +02:00
RandumKiwi 44524424b8 Merge pull request #35 from pmjdebruijn/master
main: guard against rnd(0) in rndmapname - thanks pmjdebruijn
2014-03-28 08:13:49 +13:00
Pascal de BruijnandPascal de Bruijn 7482f259cf main: guard against rnd(0) in rndmapname
starting ac_client from the wrong working directory, where
packages/maps/official/*.cgz globs to an empty list, we
trigger a SIGFPE because of rnd(0):

Program received signal SIGFPE, Arithmetic exception.
0x000000000044d37d in rndmapname () at main.cpp:897
897	        char *map = newstring(maps[rnd(maps.length())]);
2014-03-27 18:20:21 +01:00
aurhat 1bb7a5d7ac Restoring previous conditions in setfollowplayer().
Current conditions appeared with commit: https://github.com/assaultcube/AC/commit/8f39911eb0725b22bb4dc3a50d3e89702afcc49c
The problem with its is, that when player is SPECTATOR,  then "/setfollowplayer CN" command works only on players in CLA team, and should work on all, like "changefollowplayer".
This commit fixes that. Thread related to this bug: http://forum.cubers.net/thread-7495.html
2014-02-16 13:50:06 +01:00
aurhat ef165773b8 This commit fixes removing sleeps in "resetsleep" function.
To test this bug make, for example, 3 long-standing sleeps, add checking of number of sleeps before and after existing "loopv(sleep)",
and later  type "/resetsleeps" command in AC - result: 3 sleeps "before" and 1 remains "after".

Explanation by stef: after deleting elements from vectors there are no holes,
so if there were sleeps[0], sleeps[1] and sleeps[2], then after removing sleeps[0] there left
sleeps[0] and sleeps[1], so during next loop cycle this sleeps[0] is neglected (because i=1).

Commit just changes loopv to loopvrev (loop from end to begin).
2014-02-15 10:55:07 +01:00
RonaldReagan 8558db7508 Merge pull request #27 from ac-stef/pit
Fixing map header, adding tagclips. yay!
2014-01-30 17:32:35 -08:00
Ronald Reagan c64d1e855b Console history save fixes 2014-01-30 17:21:35 -08: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 3add3a4876 fix: clip all types of players
i hardly believe, anyone can throw a flag in a tagged area, but who knows...
2014-01-28 17:21:07 +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