Commit Graph

59 Commits

Author SHA1 Message Date
hendricks266 c1bbf25700 Fix the long-standing trivial warnings in net.c.
Cognitively, so much time has passed that these unused variables would offer little help indicating the roadmap for networking. In any case, I have taken care only to comment rather than remove anything that is more than just a throwaway loop counter.

If this commit inconveniences anyone in any way, please contact me personally and I will make it right.

git-svn-id: https://svn.eduke32.com/eduke32@4079 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-07 10:03:23 +00:00
helixhorned 514a3bfd64 Prevent calling function pointers cast to an incompatible type.
Most often, this had happened when casting comparison functions for qsort()
like these: "int yax_cmpbunches(const int16_t *b1, const int16_t *b2)"
to a function pointer type expecting "const void *". Alas, this is undefined
behavior: see
http://blog.frama-c.com/index.php?post/2013/08/24/Function-pointers-in-C
and posts linked from it.

At least two cases have not been fixed:
- The savegame system maintains pointers which are either to data or a function in
  the generic "void *". This ought to be made into a union.
- Probably also:
  #define OSD_ALIAS     (int32_t (*)(const osdfuncparm_t*))0x1337

git-svn-id: https://svn.eduke32.com/eduke32@4068 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-21 13:38:44 +00:00
helixhorned d095ebf9b2 net.c: move a necessary bound check to BEFORE the oob access happening.
Fixes the undefined behavior discussed here:
http://forums.duke4.net/topic/3857-the-crash-thread/page__view__findpost__p__152612

git-svn-id: https://svn.eduke32.com/eduke32@4008 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:10 +00:00
terminx 67d786f48f Factor some duplicate code into Net_SpawnPlayer(), adjust Net_ExtractPlayerUpdate() a bit.
git-svn-id: https://svn.eduke32.com/eduke32@3994 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:54:09 +00:00
terminx 3391de39be Implement a master volume control that functions separately from the sound effect and music volume controls. This is important because it allows waveform based music (like the SC-55 music pack, etc.) to play back at a louder volume than the sound effects if the end user so desires.
git-svn-id: https://svn.eduke32.com/eduke32@3993 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:53:55 +00:00
helixhorned 73b5d064da Retire actor[].shootzvel, as it was only ever used in local scope.
That is, its value was only referenced during the duration of a function call
that had previously set it. It was also never accessible from CON.

git-svn-id: https://svn.eduke32.com/eduke32@3921 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:50 +00:00
helixhorned a6a4e30bbc Fix playing ambient sounds at max volume for split sec on entering their range.
This is done by always calling FX_PlayAuto3D() to play such sounds. It now
additionally takes a third argument 'loophow', permissible values being
FX_ONESHOT and FX_LOOP.

git-svn-id: https://svn.eduke32.com/eduke32@3631 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-31 18:58:17 +00:00
hendricks266 d7e30a65dd Relax CAPITALIZATION restrictions.
git-svn-id: https://svn.eduke32.com/eduke32@3606 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-25 04:31:09 +00:00
helixhorned b6fafd8d13 Factor out player[].* allocation into G_MaybeAllocPlayer(), rename 2 functions.
git-svn-id: https://svn.eduke32.com/eduke32@3476 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:24:38 +00:00
terminx 8d64c001a0 Additional networking patch from Jasper Foreman, sadly sitting untested for almost a month because everyone here has been too sick to do anything with it. :(
git-svn-id: https://svn.eduke32.com/eduke32@3443 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-28 22:00:37 +00:00
terminx 977764e57a Fix building as C instead of C++
git-svn-id: https://svn.eduke32.com/eduke32@3271 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-12 02:53:15 +00:00
terminx fbdbca2952 Networking patch from Jasper Foreman
git-svn-id: https://svn.eduke32.com/eduke32@3270 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-12 02:53:13 +00:00
helixhorned fc048658dc Experimental NETCODE Makefile variable, enabled by default.
Disabling netcode compilation can be interesting on memory-constrained
systems, or those that have no means of accessing the network anyway.
Note: I'm OK with maintaining this myself, i.e. it's fine if netcode dev
breaks compilation with NETCODE=0.

git-svn-id: https://svn.eduke32.com/eduke32@3260 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-09 13:24:44 +00:00
terminx 2ab811cd9b Remove xdelta3 since it doesn't fit in with our current networking plans anymore
git-svn-id: https://svn.eduke32.com/eduke32@3193 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-16 15:40:28 +00:00
helixhorned 7c07fee1b3 Split r3159..r3161, part 7: code touching networking.
git-svn-id: https://svn.eduke32.com/eduke32@3173 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:28:14 +00:00
helixhorned 1cd11d06ef Revert "Fix the warnings when building with C++, add MSVC C++ build support."
This reverts r3159..r3161.

Conflicts:
	eduke32/build/include/compat.h
(Handled so that r3163's changes are kept applied.)

git-svn-id: https://svn.eduke32.com/eduke32@3165 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-15 14:27:45 +00:00
terminx 3ff46c02b2 Fix the warnings when building with C++, add MSVC C++ build support. This also changes the internal type of lotags, hitags and cstat type fields to uint16_t instead of int16_t to clean up some dubious behavior wherein the code was using a value of 32768 as a flag in these fields for certain types of things, like invisible sprites (using the value as if it was uint16_t) where it was elsewhere checking if the value was < 0 (using the value as if it was int16_t). This change may break a few specific effects if any part of the relevant code was missed when looking for areas that needed to be addressed.
I think there's also a fix for the CON precache system breakage in here (lost it in my local tree when I started getting the C++ build working in MSVC, sorry!)


git-svn-id: https://svn.eduke32.com/eduke32@3159 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-14 23:32:43 +00:00
terminx 2cea43f150 Fix r3155 fuckup :)
git-svn-id: https://svn.eduke32.com/eduke32@3158 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-13 15:08:10 +00:00
terminx 00084e9e22 Update Net_SendVersion() and Net_ReceiveVersion() to use a 16-bit representation of BYTEVERSION
git-svn-id: https://svn.eduke32.com/eduke32@3155 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-12 15:47:52 +00:00
hendricks266 fcf9beae6a Work-in-progress adjustment to the C code to compile under C++. It builds for me without errors using Win32 MinGW-GCC, but it still generates warning soup. No guarantees about MSVC or anything using SDL. Enable C++ by building with CPLUSPLUS=1. C remains the default and should compile with no change in setup.
Credit to Plagman for the idea and doing the work on the game side, which is included in this commit.

(Building as C++ will give us features with which we can make improvements and optimizations on the multiplayer code and Polymer.)

git-svn-id: https://svn.eduke32.com/eduke32@3116 1a8010ca-5511-0410-912e-c29ae57300e0
2012-11-05 02:49:08 +00:00
terminx a3fe057c0a WIP networking updates from Jasper Foreman
git-svn-id: https://svn.eduke32.com/eduke32@3095 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-28 22:27:53 +00:00
terminx 901b1bff0f Networking updates. Don't bother testing this to see if things are any better, because they aren't. :p
git-svn-id: https://svn.eduke32.com/eduke32@3079 1a8010ca-5511-0410-912e-c29ae57300e0
2012-10-14 21:52:51 +00:00
helixhorned 94ebe8211b Revert r2223's removing of bit 1 making it to setbrightness(), now a noop.
Hendricks found a bug caused by that commit, so this one enables exprimentation
with setbrightness() bit 1 behavior.

git-svn-id: https://svn.eduke32.com/eduke32@3025 1a8010ca-5511-0410-912e-c29ae57300e0
2012-09-24 21:09:31 +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 3fbf46ce3a net: do strtok on a duplicated string containing the address in Net_Connect().
Also,
 - don't strip const when passing the char ptr to it and a couple more
   instances in game.c
 - use g_netPort when -connect parameter doesn't have a port suffix (":XXXX"),
   so that e.g.
    eduke32 -port 1700 -connect localhost
   is the same as
    eduke32 -connect localhost:1700
   (-port must come before -connect, unfortunately.)

git-svn-id: https://svn.eduke32.com/eduke32@2737 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 19:20:41 +00:00
helixhorned 9b40534c8f net: second part of buffer overflow check correction.
This was supposed to go into the last commit, but I did
 git commit --amend
without adding the changes to the index. Now I'm too lazy to sort
things out.

git-svn-id: https://svn.eduke32.com/eduke32@2736 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 19:20:39 +00:00
helixhorned 18eba11657 net: correct packet buffer overflow checks.
The GAMESTATE one has to be carried out twice, first on the data from
xd3_encode_memory, and then with the compressed data (because it might have
increased in size, though this is very unlikely).  The MOVE check is
similar, though there, failure of the first check implies corrupt memory
(which is why we're Bassert'ing that condition).

Currently, the overflow on GAMESTATE sending happens when switching to a
different map.

git-svn-id: https://svn.eduke32.com/eduke32@2735 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 19:20:36 +00:00
helixhorned 8ffb35add0 net: remove (char *) casts where they amount to no-ops.
git-svn-id: https://svn.eduke32.com/eduke32@2734 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 19:20:34 +00:00
helixhorned 56114a608d net: eliminate ptr->byte idx conversion of action/move/ai in t_data.
These are element indices for a while now.  Also eliminate some dead
code afterwards.

git-svn-id: https://svn.eduke32.com/eduke32@2731 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 19:20:26 +00:00
hendricks266 d3a3c74112 Massive menu input control revamp/cleanup/factor. (added: input.[ch])
New Wii control defaults for the Wii Remote + Nunchuk and the Classic Controller. This includes new code added just so that the Home key brings up the menu in-game, reducing the need for a USB keyboard.

On the technical side, raw joystick access (comparable to what is available for keyboard and mouse) is now present in jmact, on the game side. (added: joystick.[ch])

Using this new raw joystick access, I replaced tueidj's hack to map A and B to LMB/RMB and D-Pad Up/Down to the scrollwheel.

I made the menus more friendly to mouse and joystick browsing by adding and unifying checks and clears for various buttons and gamefuncs. In fact, the majority of the time spent on this commit was tracking down problems that appeared with the factoring and trying to understand the menu system and the way input checks are precariously executed.

In addition, "Press any key or button to continue" now truly means what it says.

As a result of incorporating proper raw access into control.c instead of it directly accessing the implementaiton, the program *may* no longer be affected by joystick input when it is out of focus. This follows the pattern set by the mouse, and I think this is a positive change.

A small bonus: In the classic/old keyboard preset, the key for Show_Console has been changed from '`' to 'C' because '`' is taken by Quick_Kick.

git-svn-id: https://svn.eduke32.com/eduke32@2728 1a8010ca-5511-0410-912e-c29ae57300e0
2012-06-03 16:11:22 +00:00
helixhorned a485ee8ca0 Fix harmless "cast to pointer from integer of different size" warning with x64.
git-svn-id: https://svn.eduke32.com/eduke32@2696 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 18:39:25 +00:00
helixhorned f69d9f241d Fix some *printf format-char/vararg mismatches on x86_64 in net.c.
git-svn-id: https://svn.eduke32.com/eduke32@2691 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-25 15:23:53 +00:00
hendricks266 9df8c00bdc Fix warnings in net.c and xdelta3.
git-svn-id: https://svn.eduke32.com/eduke32@2683 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-20 07:23:56 +00:00
helixhorned 341f8e7432 net: less-trivial, but not non-trivial changes
git-svn-id: https://svn.eduke32.com/eduke32@2679 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-19 16:25:52 +00:00
helixhorned a59e5f40fe net: trivial changes
git-svn-id: https://svn.eduke32.com/eduke32@2678 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-19 16:25:38 +00:00
helixhorned 4f72e0b7f5 net: factor out common packet handling code
git-svn-id: https://svn.eduke32.com/eduke32@2677 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-19 16:25:22 +00:00
plagman c8b4894975 netcode: unblock stuff
git-svn-id: https://svn.eduke32.com/eduke32@2676 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-19 15:12:08 +00:00
helixhorned 5e60b989ab net.c tweaks, just for the sake of pushing them to SVN.
- alloc_multimapstate() helper
- make g_netMapRevision a uint32 and store save->revision in sequence order
  (without &(NET_REVISIONS-1))
- one assert, one XXX comment, stylistic changes

git-svn-id: https://svn.eduke32.com/eduke32@2674 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-18 21:41:08 +00:00
terminx 1c1da97378 WIP multiplayer changes, still completely broken.
git-svn-id: https://svn.eduke32.com/eduke32@2664 1a8010ca-5511-0410-912e-c29ae57300e0
2012-05-17 23:54:43 +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
helixhorned bdc02d36d9 Explicitly call A_DeleteSprite() from game code instead of relying on macro expansion.
git-svn-id: https://svn.eduke32.com/eduke32@2452 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:38:13 +00:00
helixhorned 3917e05c1e Remove non-SAMESIZE_ACTOR_T code and remaining #defines.
We've been running with same-sized actor_t for a while without problems now.
In the unlikely event (famous last words) that an issue should pop up later,
this revision should be consulted for the differences between the two versions.

git-svn-id: https://svn.eduke32.com/eduke32@2451 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-11 17:37:50 +00:00
helixhorned 0919c186ba Pull the 'for (' ... ')' out of the TRAVERSE_{CONNECT,SPRITE_*} macros.
This plays more nicely with automatic formatters.  Also indent accordingly.

git-svn-id: https://svn.eduke32.com/eduke32@2379 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-21 19:33:33 +00:00
helixhorned 8b7a4dab9b Define Batoi/Batol to strtol(...) in compat.h and use these when necessary.
That is, everyplace a user input is to be converted.  The only remaining
instance of atoi() is now atoi(s_buildDate).

git-svn-id: https://svn.eduke32.com/eduke32@2374 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-20 21:17:39 +00:00
helixhorned 99e08bf441 legibility improvements: rotatesprite(..., 0,0,xdim-1,ydim-1) -> rotatesprite_fs
git-svn-id: https://svn.eduke32.com/eduke32@2308 1a8010ca-5511-0410-912e-c29ae57300e0
2012-02-02 17:35:05 +00:00
helixhorned 65deeda53a The earlier changes introduced bugs when palettes were not set correctly in
certain situations (mostly cutscenes etc). This commit removes bit 1 from all
flags that make it to setbrightness, the meaning of which is "don't actually
update the palette". I have no idea what it was for and since the corresponding
P_SetGamePalette() calls were from places like the mentioned cutscenes, I don't
think it matters performance-wise.

git-svn-id: https://svn.eduke32.com/eduke32@2223 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-28 20:35:23 +00:00
helixhorned 51e3bc0148 net: fix bug in Net_ParseServerPacket introduced with SAMESIZE_ACTOR_T.
git-svn-id: https://svn.eduke32.com/eduke32@2215 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-27 14:22:28 +00:00
helixhorned a3a80467a7 net: send BYTEVERSION as two bytes, high byte first.
Now we don't need to worry about the numbers running out soon.
Bump BYTEVERSION by three to celebrate this, too.

git-svn-id: https://svn.eduke32.com/eduke32@2209 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:34:37 +00:00
helixhorned 41db6bc512 Remove 'projectile' field from actor_t because it was entirely unused.
WARNING: This silently breaks savegames on 64-bit platforms.

git-svn-id: https://svn.eduke32.com/eduke32@2197 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-25 15:31:14 +00:00
helixhorned 8e54a3febf Preliminary commoning of actor[].t_data[10] to an array of int32's on both
32- and 64-bit platforms. Also, make struct type actor_t also have a common
size of 128 bytes. New code currently disabled and #ifdef'd for comparison.

This requires certain t_data[] entries ([1]: move ptr, [4]: action ptr and
[5]: ai ptr with actors) to be converted to script offsets instead of pointers,
breaking savegame and net packet compatibility (we could in theory try hard not
to, but it would be too much trouble).

git-svn-id: https://svn.eduke32.com/eduke32@2185 1a8010ca-5511-0410-912e-c29ae57300e0
2011-12-21 18:40:47 +00:00