Commit Graph

3150 Commits

Author SHA1 Message Date
helixhorned 7305fbbae9 Add macro CON_ERRPRINTF(Fmt, ...) and use that everywhere.
git-svn-id: https://svn.eduke32.com/eduke32@3000 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:47 +00:00
helixhorned 1729f8fa38 Factor out some repeated code into G_{Load,Save}PlayerMaybeMulti.
This currently says that MP saving/loading isn't supported, but doesn't
really work correctly.  Also, properly bound-check the immediate argument
to CON's 'save' command and one more ... -> G_HandleAsync().

git-svn-id: https://svn.eduke32.com/eduke32@2999 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:43 +00:00
helixhorned 0665d961d2 Use Bstrncpyz in 1 place; fix displaying err msg if write-opening savegame fails
git-svn-id: https://svn.eduke32.com/eduke32@2998 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:40 +00:00
helixhorned bb5d3496ee Factor out snprintf'ing a maybe-modDir'd file name into macro G_ModDirSnprintf().
... and use it in three places. In two of these uses,
1) CON {read,write}arrayfromfile and
2) G_SavePlayer,
display an error message if the file name such generated is too long.

In the CON commands of 1), also error out if the file couldn't be opened.

git-svn-id: https://svn.eduke32.com/eduke32@2997 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:37 +00:00
helixhorned e417274c1e Move G_HandleAsync() into game.h as 'static inline' and use everywhere else.
git-svn-id: https://svn.eduke32.com/eduke32@2996 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:34 +00:00
helixhorned 9311432cbf Fix crash when recording demo, stooping it, going to title screen, and exiting.
A macro MAYBE_FCLOSE_AND_NULL(fileptr) is introduced in compat.h that does
what it says.

git-svn-id: https://svn.eduke32.com/eduke32@2995 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:31 +00:00
helixhorned 667de29e01 Demo: rename some functions for new-style conventions, functionize one marco...
git-svn-id: https://svn.eduke32.com/eduke32@2994 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-05 17:25:26 +00:00
terminx a0d993c900 Rename a couple functions local to actors.c, remove IFHITSECT macro. This is mostly a test commit to make sure our CIA.vc script is properly updated now.
git-svn-id: https://svn.eduke32.com/eduke32@2993 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:30:32 +00:00
helixhorned 202d544f14 compat.h: tweak indentation of some preprocessing directives.
git-svn-id: https://svn.eduke32.com/eduke32@2992 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:13:06 +00:00
helixhorned 72b73f6356 Make getangle() a __fastcall function instead of static inline.
This trims four 4k pages of code from the release EDuke32 build and
one page from Mapster32.

git-svn-id: https://svn.eduke32.com/eduke32@2991 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:12:01 +00:00
helixhorned 1fdc464568 In dosetaspect(), bail out calculating radarang2[] instead of failing assertion.
When this happens, parallaxmodes other than 0 will be unavailable and silently
draw as parallaxmode 0.  This usually happens with extremely wide resolutions.

git-svn-id: https://svn.eduke32.com/eduke32@2990 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:10:55 +00:00
helixhorned dd681886c3 Add lunatic/test/tables.lua, which was used to compare the calc'd sin/atan values.
git-svn-id: https://svn.eduke32.com/eduke32@2989 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:09:49 +00:00
helixhorned ee39d713e8 Calculate sine and arctan tables, getting rid of TABLES.DAT dependency.
We're pulling stuff from math.h even in non-GL builds right now, so
adding libc's sin() and atan() doesn't seem like a big deal.  In the
unlikely event that their accuracy is so bad that the calculated tables
don't match the original ones, a warning is issued on little-endian
platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2988 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:08:43 +00:00
helixhorned 5bca5f59ad Move #define PI from to build.h, add bound-checking assertion in dosetaspect().
git-svn-id: https://svn.eduke32.com/eduke32@2987 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:07:36 +00:00
helixhorned 52bb35361b Some [U]INT_MAX --> [U]INT32_MAX.
git-svn-id: https://svn.eduke32.com/eduke32@2986 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:06:30 +00:00
helixhorned 7f74880c96 Move #include <math.h> from polymer.h to polymer.c.
git-svn-id: https://svn.eduke32.com/eduke32@2985 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:05:23 +00:00
helixhorned 6fe5eb2863 Clean up A_FindPlayer(), constify some function args, some 0x7fffffff->INT32_MAX
git-svn-id: https://svn.eduke32.com/eduke32@2984 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:04:16 +00:00
helixhorned 59151dd045 player.c: factor out 7x similar code into GetAutoAimAngle().
This is one of the cases where the duplicated code has minor modifications
at each site. These are handled by function args here.

git-svn-id: https://svn.eduke32.com/eduke32@2983 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:03:10 +00:00
helixhorned a9d3103373 Remove commented out AI Duke opponent code.
git-svn-id: https://svn.eduke32.com/eduke32@2982 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:02:04 +00:00
helixhorned b8ed142c6b Remove some #if 0 blocks that are probably of no interest any more.
For reference, they are the following:
 - cache1d.c: suckcache()
 - build.c: compare_wall_coords()
 - make switch-invisible heuristic
 - Mapster32: old sprite search
 - Mapster32: manual z range
 - m32script: read/writearray, qgetsysstr
 - menus.c: savetemp()

git-svn-id: https://svn.eduke32.com/eduke32@2981 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 14:00:58 +00:00
helixhorned e4bb83cd39 player.c: factor out inline checks for shootable switch picnums.
git-svn-id: https://svn.eduke32.com/eduke32@2980 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 13:59:50 +00:00
helixhorned 08a19e19f3 player.c: factor out multiple instances of a 3-liner into A_SetHitData().
Playing around with Coccinelle's semantic patches... be prepared for more.

git-svn-id: https://svn.eduke32.com/eduke32@2979 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 13:58:45 +00:00
helixhorned 8efcc81096 Remove some unneeded NULL checks.
Found by http://coccinelle.lip6.fr/rules/notnull.cocci

git-svn-id: https://svn.eduke32.com/eduke32@2978 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-02 13:57:39 +00:00
helixhorned 26c540e736 Fix "shooting" tripbombs from non-players such as the SE shooter.
Well, this never worked anyway, but invoking demons flying out of your
nose is never a good idea.

git-svn-id: https://svn.eduke32.com/eduke32@2977 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-28 21:42:49 +00:00
hendricks266 3c5aeae341 Modify EVENT_CHANGEWEAPON so that it actually serves a purpose. Instead of being triggered before curr_weapon is changed, with nothing used for input or output with RETURN (meaning you could not cancel), now RETURN is set to the prospective new weapon ID and you can change it or cancel it in the event.
Note that since setting RETURN did nothing before, there is no backwards compatibility to uphold. Therefore, setting RETURN to 1 will cause the pistol to be selected, not disable the event. Set RETURN to -1 to cancel switching.

git-svn-id: https://svn.eduke32.com/eduke32@2976 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:53:59 +00:00
hendricks266 a0dc378eda Expand "Switch weapons on pickup" to three options: "Off", "All weapons", and a new one, "Fav priority". It switches to the weapon you have just picked up only if it is ranked higher in the favorite weapon hierarchy using the "-u" parameter.
Suggested at: http://forums.duke4.net/topic/5667-tiny-request/

git-svn-id: https://svn.eduke32.com/eduke32@2975 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:52:38 +00:00
hendricks266 574f83dc76 The Build tools no longer link with SDL or SDL_mixer because they don't need to.
Fix for: http://forums.duke4.net/topic/5392-mkpalette-fails-to-build/page__view__findpost__p__132791

git-svn-id: https://svn.eduke32.com/eduke32@2974 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:51:17 +00:00
hendricks266 2620738eb9 Add EVENT_PREGAME. Now all sprites are processed in the following fashion:
1. EVENT_PREGAME
2. hardcoded stuff
3. EVENT_GAME

One potential use is to examine values which are clobbered by commands such as ifhitweapon/ifwasweapon.

git-svn-id: https://svn.eduke32.com/eduke32@2973 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:49:55 +00:00
hendricks266 6650f34105 Disable questionable lines from Makefile.common that were causing my build system to deep crash.
git-svn-id: https://svn.eduke32.com/eduke32@2972 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-27 03:48:27 +00:00
helixhorned ffa4e8ebb3 Quit the game if SE17 (warp elevator) setup fails.
The spawn-time SE 17 setup uses nextsectorneighborz() which can fail
(return -1) on some circumstances and would cause an OOB sector[] access.

git-svn-id: https://svn.eduke32.com/eduke32@2971 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:17:14 +00:00
helixhorned 2b58c6de4c Replace some literal numbers denoting SEs/STs by symbolic enumeration values.
git-svn-id: https://svn.eduke32.com/eduke32@2970 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:16:08 +00:00
helixhorned 41f2535e91 engine.c: rewrite nextsectorneighborz() for clarity.
git-svn-id: https://svn.eduke32.com/eduke32@2969 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:15:02 +00:00
helixhorned 948b4f82fc build.lua map loader: add the option of canonicalizing sprite order.
This is mostly for debugging, since currently, Mapster32 restores sprites
not in the same order as the original sprite index order.  Also, expose
this option from map2text.lua and mapdiff.sh.

git-svn-id: https://svn.eduke32.com/eduke32@2968 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:13:57 +00:00
helixhorned b73d16b8cc foreachmap.lua: add -e"some code..." switch to execute code from the cmdline.
git-svn-id: https://svn.eduke32.com/eduke32@2967 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:12:51 +00:00
helixhorned a7eaac1add build.lua: add 'numbunches' field to map loader.
git-svn-id: https://svn.eduke32.com/eduke32@2966 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:11:46 +00:00
helixhorned 948a716229 Mapster32: for c&p-ing map portions w/o TROR, fix wrongly resetting wall lotag/extra
git-svn-id: https://svn.eduke32.com/eduke32@2965 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:10:40 +00:00
helixhorned f133be4ae8 Add map2text.lua and helper script mapdiff.sh.
git-svn-id: https://svn.eduke32.com/eduke32@2964 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:09:34 +00:00
helixhorned acdb7c139c Mapster32: for copy-pasting map portions without TROR, fix wrongly resetting xpanning.
This is really an artifact of overloading the sector fields for different uses.
For copy-pasting TROR'd portions, the bug still persists.

git-svn-id: https://svn.eduke32.com/eduke32@2963 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-26 22:08:27 +00:00
helixhorned 4724f5d18c On Linux build without startup GUI, don't save ModDir to config.
git-svn-id: https://svn.eduke32.com/eduke32@2962 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:55:06 +00:00
helixhorned 9abc415a24 A couple of trivial changes.
git-svn-id: https://svn.eduke32.com/eduke32@2961 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:54:01 +00:00
helixhorned a8af22ba9a Fix stack corruption when demo was attempted to be written with non-empty mod dir.
git-svn-id: https://svn.eduke32.com/eduke32@2960 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:52:55 +00:00
helixhorned 1f5971a4db If r_screenaspect is 0 (or any other invalid value), assume square pixel aspect.
git-svn-id: https://svn.eduke32.com/eduke32@2959 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:51:49 +00:00
helixhorned de199a4741 osxbuild.sh: add 'debughelix' preset, building only x64 debug packages.
git-svn-id: https://svn.eduke32.com/eduke32@2958 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-24 18:49:13 +00:00
helixhorned 772778205b Pack how many players fake multi was started with into g_fakeMultiMode.
git-svn-id: https://svn.eduke32.com/eduke32@2957 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:51:38 +00:00
helixhorned 95de2abb3a splitscreen: don't wrongly change pitch for sounds originating from 2nd player.
For example, if the first one is underwater.

git-svn-id: https://svn.eduke32.com/eduke32@2956 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:50:32 +00:00
helixhorned 481a986a30 splitscreen: tweak base palette application, remove resp. code from splitscr.con.
Basically, base palettes with lower indices trump higher ones.  For example,
when one player is underwater and the other above, the normal palette takes
precedence.

git-svn-id: https://svn.eduke32.com/eduke32@2955 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:49:27 +00:00
helixhorned 96acc3dc52 Generalize fullscreen tint application to more than one tint.
Currently, the only kinds of tint that can be applied simultaneously are
one "palfrom" per player, plus one loogie tint per player.  Each palfrom
still overrides the preceding one.  However, this is not a big problem IMO
since palfroms decrease at the same rate (loogie tint decreases at half the
speed).  This change is especially good for the splitscreen mod, since now
the tints of the two players won't compete with each other.  See the comment
in the source for some properties of the blending formula.

git-svn-id: https://svn.eduke32.com/eduke32@2954 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:48:21 +00:00
helixhorned ef8adcc51f Don't clear loogie tint transiently on changing palette.
git-svn-id: https://svn.eduke32.com/eduke32@2953 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:47:16 +00:00
helixhorned a53e9b60d8 Keep full-screen tints through palette changes again.
A debug macro to test tints being stuck at the least intense non-zero value
is provided in engine.c.

git-svn-id: https://svn.eduke32.com/eduke32@2952 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-22 22:46:09 +00:00
helixhorned 19c2c57ffb Make a colored REACTOR/REACTOR2 sprite disappear in single player again.
Noted by Nukey.  See Duke3D 1.5 GAME.C line 4220.

git-svn-id: https://svn.eduke32.com/eduke32@2951 1a8010ca-5511-0410-912e-c29ae57300e0
2012-08-21 17:40:05 +00:00