Commit Graph

1697 Commits

Author SHA1 Message Date
helixhorned a7ec51e375 Clean up astub.c in a similar fashion to the preceding changes.
git-svn-id: https://svn.eduke32.com/eduke32@2564 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:44:47 +00:00
helixhorned b06ce8456a Make g_grpNamePtr memory-clean, extern clearGrpNamePtr().
git-svn-id: https://svn.eduke32.com/eduke32@2563 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:44:33 +00:00
helixhorned 3deb8d1d99 Clear up handling of g_*NamePtr in the game.
The primary change is that things have been made memory-clean.  Some of these
pointers may point to wildly different places during the course of the program
such as statically or dynamically allocated storage, the buffer returned by
getenv() (which must not be modified according to the docs), or an element of
argv[].  Consequently, we need to strdup, or better, dup_filename them if they
are ever to be passed to a function that modifies their pointed-to data.

Specifically:
 - added statics or consts according to usage
 - 3 new functions clear{Grp,Def,Script}NamePtr, only 'Def' one extern for now
 - in G_CheckCommandLine, don't strip 'const'; use Bstrncpyz where appropriate
 - remove multiple declarations

Also, warn if an application parameter has been ignored (not matched).

git-svn-id: https://svn.eduke32.com/eduke32@2561 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:44:00 +00:00
helixhorned 77918caf9c New helper function "char *dup_filename(const char *fn)" in common.h.
It allocates a buffer of size BMAX_PATH and copies the passed string into it.

git-svn-id: https://svn.eduke32.com/eduke32@2560 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:43:39 +00:00
helixhorned 0e3adea64e Replace various occurences of "Bstrncpy(buf, src, sz); buf[sz-1]=0;" with Bstrncpyz
git-svn-id: https://svn.eduke32.com/eduke32@2559 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:43:21 +00:00
helixhorned 26d2cf7e01 Replace {get,clear}filenames and duplicate autoload code in astub.c/game.c.
This additionally fixes leaks that were caused by traversing the file name
list with the 'findfiles' pointer and not clearing them afterwards (even if
there was a handle to the list head via 'findfileshigh').

git-svn-id: https://svn.eduke32.com/eduke32@2557 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:42:32 +00:00
helixhorned 0c5c58cbbb Replace {get,clear}filenames with fnlist functions in build.c, menus.c and osdcmds.c
git-svn-id: https://svn.eduke32.com/eduke32@2556 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:42:16 +00:00
helixhorned a7f6f3bacc Factor out different {clear,get}filenames definitions into fnlist_t + functions.
Don't actually replace the instances in the code now.
Additions in common.h:
 - fnlist_t, which combines CACHE1D_FIND_REC *finddirs, *findfiles and
   int32_t numdirs, numfiles
 - the FNLIST_INITIALIZER macro, which MUST be used for automatic variables
 - fnlist_clearnames, fnlist_getnames functions
 - G_LoadGroupsInDir, G_DoAutoload, two often-occurring uses of these

git-svn-id: https://svn.eduke32.com/eduke32@2555 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:41:57 +00:00
helixhorned d77e388522 Factor out eleven (!) instances of identical code into check_file_exist().
git-svn-id: https://svn.eduke32.com/eduke32@2554 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-28 19:41:39 +00:00
helixhorned 68f0842b85 Fix a potential sprintf to a buffer passed to it as a string argument.
git-svn-id: https://svn.eduke32.com/eduke32@2552 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:06:05 +00:00
helixhorned af9db8cfa2 Mapster32: fix specifying a custom configuration file with -cfg.
We were writing into a string literal. Ouch!

git-svn-id: https://svn.eduke32.com/eduke32@2551 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:05:51 +00:00
helixhorned e7f091cd90 Factor out various instances of getatoken() into common.c.
Alongside, these make into into the header:
 - the 'tokenlist' type (a typedef'd struct)
 - the T_EOF and T_ERROR enumeration values

git-svn-id: https://svn.eduke32.com/eduke32@2549 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:05:23 +00:00
helixhorned e74f8cada1 Replace all occurences of assert in our code with Bassert.
git-svn-id: https://svn.eduke32.com/eduke32@2547 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:04:44 +00:00
helixhorned f0885f665b Capitalize numgrpfiles macro to NUMGRPFILES.
git-svn-id: https://svn.eduke32.com/eduke32@2543 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:03:40 +00:00
helixhorned ee5dd2cf32 Add common.[ch] which should be used for common non-engine types/functions/data.
As inauguration, move G_AddGroup, G_AddPath and struct strllist there.
The header is located in build/include, because in the future, code that resides
closer to (but is not strictly part of) the engine might need to be factored
into here.  The source file, however, is in the source/ directory.

git-svn-id: https://svn.eduke32.com/eduke32@2542 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 22:03:20 +00:00
hendricks266 efb440ada0 All string literals sent as normal messages to the player in-game written in ALL CAPS have been converted by hand to more proper capitalization. (Critical errors have been left as-is, and the editor did not need changes.)
git-svn-id: https://svn.eduke32.com/eduke32@2540 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:07:12 +00:00
hendricks266 9f61e6e2d5 Superficial text changes:
- Help window text cleaned and made more consistent between game and editor
 - Added help entry for "-clipmap"
 - Log text for using CON, DEF, and RTS files has been made consistent
 - All instances of '%s' have been replaced with \"%s\" because ' is a valid filename character. (At least on Windows.)

git-svn-id: https://svn.eduke32.com/eduke32@2538 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-26 05:05:57 +00:00
helixhorned ef7ad7b554 Lunatic: more complex gamevar-decl code.
git-svn-id: https://svn.eduke32.com/eduke32@2534 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:01:36 +00:00
helixhorned b897a59d82 Bound-check the 'picnum' argument to rotatesprite; tweak CON digitalnumber check.
There are instances where oob picnums may propagate to that function, so
protect it.  The digitanumber[z] bound check is actually made more permissive,
but could also just as well be removed now.

git-svn-id: https://svn.eduke32.com/eduke32@2533 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:01:21 +00:00
helixhorned 6cd11d0468 Accumulated trivia.
- engine.c: move some variables into a lower block
- premap.c: clearbufbyte --> Bmemset

git-svn-id: https://svn.eduke32.com/eduke32@2532 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:01:03 +00:00
helixhorned c4efd9b1fa Take over more correct G_AddGroup from game.c to astub.c.
The code in the editor was potentially doing a strcat on a strdup'd string.
Also, rename AddGamePath to G_AddPath in astub.c and add CODEDUP markers
because shared stuff like this ought to be factored out into a separate
source file some time.

git-svn-id: https://svn.eduke32.com/eduke32@2531 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:00:42 +00:00
helixhorned 694acef9fe Allow up to 7 skills, coded by M210 and taken over with modifications.
Skill names are defined via 'defineskillname' as before, but the index
of the last non-empty skill name (plus one) is taken as the skill count.
So, if you only define the 6th, there will be no effect.
Note that currently, there is no way to specify less than four skills
because the CON parser doesn't allow the empty string for the name (it'll
go beyond the line) and because the default skill names are initialized in
EDuke32 too, in addition to the CONs.

git-svn-id: https://svn.eduke32.com/eduke32@2530 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 22:00:27 +00:00
helixhorned 386d34e3b4 Fix static-main-arrays debug build, which is without the clipshape feature.
git-svn-id: https://svn.eduke32.com/eduke32@2528 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-25 13:54:46 +00:00
helixhorned cd3947f3f4 Correct 'nofloorpalrange' range clamping, move one get_hud_pal() farther down.
The nofloorpalrange beginning and end indices are silently clamped to 1 .. 255.

git-svn-id: https://svn.eduke32.com/eduke32@2524 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-24 15:59:39 +00:00
hendricks266 62dd05a2e5 Update credits in menus.c with people from the Credits wiki page. Also, fix the text and order of other entries.
git-svn-id: https://svn.eduke32.com/eduke32@2522 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-23 20:24:30 +00:00
hendricks266 64595adfb2 Makefiles:
- Properly handle the architecture definition when BUILD32_ON_64=1
 - Add proper $(*LDFLAGS) to which LTO and ARCH are correctly passed.
 - Cleanup of compiler flag variables.

This should fix to some degree building of the Build tools on OS X, and it may possibly fix the crashing of the OS X x86 32-bit build.

git-svn-id: https://svn.eduke32.com/eduke32@2520 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-23 20:22:10 +00:00
helixhorned b5894eb7e0 Make 'nofloorpalrange' def token affect HUD weapons.
git-svn-id: https://svn.eduke32.com/eduke32@2518 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:47:47 +00:00
helixhorned 5944a9ab0f New game def token "nofloorpal <pbeg> <pend>", disabling sprites taking on floor pals.
It has always annoyed me how floors with "shirt-color" type palookups like 21
affected the color of its containing sprites and HUD-drawn stuff.  This commit
allows one to specify an inclusive range of pals for which this should be
disabled for sprites (but not for HUD stuff, yet).

git-svn-id: https://svn.eduke32.com/eduke32@2517 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:47:29 +00:00
helixhorned 85ab7d2e39 Remove global 'uint8_t *anim_pal' which was only used once as a temporary.
git-svn-id: https://svn.eduke32.com/eduke32@2516 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:47:13 +00:00
helixhorned 3e1a8c523d In Mapster32, remove ReadGamePalette() and GAMEpalette[] and use engine's palette[].
git-svn-id: https://svn.eduke32.com/eduke32@2515 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:46:56 +00:00
helixhorned 46246b8ab7 Comment out computergetinput() and children, which are unused since ng netcode.
git-svn-id: https://svn.eduke32.com/eduke32@2512 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-22 22:46:07 +00:00
hendricks266 270342463f More "malloc + strlen + strcpy --> strdup" in module parameter code.
git-svn-id: https://svn.eduke32.com/eduke32@2506 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 19:28:22 +00:00
helixhorned 8a50b75de2 Weirdness removal in G_LoadExtraPalettes (which reads lookup.dat).
- replace bit tweaking for big endian archs with clear code
- allow palette lookups >= 128, previously we read into a signed byte

git-svn-id: https://svn.eduke32.com/eduke32@2503 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-20 18:31:37 +00:00
helixhorned 97020caf73 Clear up after r2495. (Because I'm a pedantic asshole.)
- in Mapster, pre-form the default 10 clip map names before returning from
  G_CheckCommandLine() so it gets loaded even if we passed no cmdline args.
- malloc + strlen + strcpy --> strdup
- don't need to spank dead variables ;)
- we may call calloc with zero size, which isn't bad by itself, but asserting
  for non-null afterwards is.  Allocs of 0 are implementation-defined, and may
  well return a null pointer (C99 7.20.3).

git-svn-id: https://svn.eduke32.com/eduke32@2502 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:18:32 +00:00
helixhorned 9628041766 Assorted trivia.
Make some computer Duke opponent variables in player.c static.

git-svn-id: https://svn.eduke32.com/eduke32@2501 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:18:12 +00:00
helixhorned 68603b0a28 Mapster32 tag-label system: don't consider 'switch' walls with an upwall as linking.
git-svn-id: https://svn.eduke32.com/eduke32@2496 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 23:16:37 +00:00
hendricks266 cf2b9ec940 New "-clipmap" command-line switch to specify sector collision clip maps. This switch works in an additive fashion like -mx and -mh. _clipshape0.map through _clipshape9.map remain loaded by default.
Also, a very minor change in the con/def module code. (int --> int32_t)

git-svn-id: https://svn.eduke32.com/eduke32@2495 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-18 08:50:41 +00:00
helixhorned 0f7615daf7 Remix undo/redo system, fixing potential access of freed memory.
A run of consecutive mapstates may share sector/wall/sprite blocks, but
the code was deciding whether to free them solely on local properties.
Now, save a reference count at the beginning of each such allocated block
and free it only if it reaches zero.

git-svn-id: https://svn.eduke32.com/eduke32@2492 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 11:35:35 +00:00
helixhorned 4412d5729e In undo/redo, always print the revision that got _restored_.
git-svn-id: https://svn.eduke32.com/eduke32@2491 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 11:35:16 +00:00
helixhorned 5246f17169 "Promote" oob sectnum/statnum sprites to corruption level 4.
Also, always print at least level 5 corruptions (that is, have no instances
of completely silent corruptcheck).

git-svn-id: https://svn.eduke32.com/eduke32@2490 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 11:34:54 +00:00
helixhorned 4042fa90c4 Mapster32: sprite list consistency checker in corruptcheck.
This checks for about every possible type of sprite list corruption and
reports back with a corruption level 5 if one of the 14 validations fail.

git-svn-id: https://svn.eduke32.com/eduke32@2489 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 11:34:32 +00:00
helixhorned d1538d5dfd Tweak Mapster32's sound index (F2).
- start scrolling from about half of the visible page
- PGUP/DGDN moves the cursor by 1/4 of the page
- code cleanup (we only need one displine[80], use clearkeys())

git-svn-id: https://svn.eduke32.com/eduke32@2488 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-17 11:34:09 +00:00
helixhorned 5e1b3bd44b Re-enable Mapster32's undo/redo functionality.
git-svn-id: https://svn.eduke32.com/eduke32@2486 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-15 18:12:17 +00:00
helixhorned 65fe7ce3bd This should fix the assertion failure with undo/redo, my failure in r2478.
git-svn-id: https://svn.eduke32.com/eduke32@2485 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 23:17:54 +00:00
helixhorned cf56956dff Make 'Numsprites' also accessible from CON (read-only) under the same name.
Note the capitalization. I hope that this makes clashes with user variable
names less likely.

git-svn-id: https://svn.eduke32.com/eduke32@2484 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:32:04 +00:00
helixhorned acc2a2f70e Save 'Numsprites' into savegames and mapstates. Bump savegame minor version.
git-svn-id: https://svn.eduke32.com/eduke32@2483 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:31:49 +00:00
helixhorned 76de780d8b Fix (still not enabled) undo/redo code compilation.
Also include one comment about a currently failing assertion there.

git-svn-id: https://svn.eduke32.com/eduke32@2482 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:31:32 +00:00
helixhorned fbf0b9ea4f Include <assert.h> in compat.h.
git-svn-id: https://svn.eduke32.com/eduke32@2481 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:31:19 +00:00
helixhorned 4d4221d71f Continuously keep track of the number of sprites in the world.
New engine variable 'int32_t Numsprites', not yet saved into savegames
or mapstates. (The capitalization is to distinguish it from the often-used
'numsprites' locals or structure member names.
In the editor, get rid of updatenumsprites().

git-svn-id: https://svn.eduke32.com/eduke32@2478 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-14 22:30:24 +00:00
helixhorned 26dfddfaf0 Trivial stuff that got accumulated and not committed.
git-svn-id: https://svn.eduke32.com/eduke32@2471 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-13 20:07:40 +00:00