Commit Graph

69 Commits

Author SHA1 Message Date
Emil Laine
24d61d1ccc Use ASSERTALWAYS(msg) instead of ASSERT(false && msg)
Thanks @SLAwww

(The first parameter to _assert is actually the message, not the
expression to evaluate, so "false &&" doesn't belong in there.)

Conflicts:
	Sources/EntitiesMP/Summoner.es
2016-05-30 00:46:35 +02:00
Emil Laine
fe23b05aa2 Fix ASSERT(<string_literal>)
That would never trigger the ASSERT. Now they always do.

Conflicts:
	Sources/EntitiesMP/Summoner.es
2016-05-30 00:44:05 +02:00
Daniel Gibson
b64df456b6 Fix TFE warnings and lots of unused variable warnings
.. still, didn't look at unused variable warnings from *.es because
so many are generated.
2016-05-09 18:51:04 +02:00
Daniel Gibson
1bfc6d5d81 Fix "unused but set variable" warnings from GCC 2016-05-09 18:51:03 +02:00
Daniel Gibson
dbe524f0b2 Fix more warnings, mostly about logical op parenthesis (TSE only)
except for EntitiesMP/Fish.es which I'm not sure about, and in
Computer.cpp the weird "if (_iActiveMessage < _acmMessages.Count()==0)"
construct whichs intention I didn't fully grasp, either.
2016-05-09 18:51:03 +02:00
Daniel Gibson
72edf1c720 Commented out unused functions and variables
many unused functions and variables are now commented out

You'll still get tons of warnings, which should mostly fall in one of
the following categories:
1. Unnecessary variables or values generated from .es scripts
2. Pointers assigned to from functions with side-effects: DO NOT REMOVE!
   Like CEntity *penNew = CreateEntity_t(...); - even if penNew isn't
   used, CreateEntity() must be called there!
2016-05-09 18:51:03 +02:00
Daniel Gibson
46353ffc5d make BYTESWAP*_unsigned() macros inline functions, use GCC builtins
the builtins are only used when using GCC or clang, of course, otherwise
the usual shifting is done.

Them being inline functions instead of macros increases type safety
and gets rid of problems with signed shifts.

Changed two places in the code that swapped bytes in 32bit ints to use
BYTESWAP32_unsigned() instead - in case of PrepareTexture() this has
probably even fixed issues with signed shifts
2016-05-09 18:48:39 +02:00
notaz
ce46bd1e99 make cpuid work on x86_64
not that it's used for anything, just for the logs
2016-04-25 00:14:30 +03:00
notaz
1f70d4e242 rework asm to always fall back to portable C code
with this there is no need to worry about x86 asm switch for other
platforms.
2016-04-25 00:14:29 +03:00
notaz
78b26698ac only enable __GNU_INLINE_X86_32__ for x86/IA32
also don't error out if both __MSVC_INLINE__ and __GNU_INLINE_X86_32__
are not set, we have C fallbacks now
2016-04-25 00:14:10 +03:00
notaz
4b5cc03bf0 rename __GNU_INLINE__ to __GNU_INLINE_X86_32__
There is not only x86 in this world.
Simple sed job.
2016-04-25 00:13:37 +03:00
Joshua Scoggins
056d77f479 Assume OSX if we have defined __APPLE__ (#46) 2016-04-23 20:04:45 -04:00
Tan Wang Leng
65d8d44f0e Fix mouse wheel for switching weapons
This fixes #32. Strictly follows the Win32 version.
2016-04-23 10:49:07 -04:00
Joshua Scoggins
88a0ec269b Use stdint.h everywhere since Serious Engine requires MSVC 2013 or greater (#40) 2016-04-22 13:57:32 -04:00
notaz
cb69bd3cdd add some asm helpers 2016-04-22 02:28:41 +03:00
Ryan C. Gordon
fd52a044d4 Merge pull request #36 from DrItanium/abstraction-layer
Abstraction layer
2016-04-21 12:40:44 -04:00
Daniel Gibson
a28a7bb00f now TFE builds on OSX, too 2016-04-21 17:46:44 +02:00
Daniel Gibson
23b6374e9a Add ULONG PointerToID(void*) and IntPtrToID(size_t) that CRC 64bit pointers
Sometimes pointers are casted to ULONG just to get an ID or tag - this
is fine for 32bit pointers, but 64bit pointers will truncate which might
result in not being so unique after all.
CRC-ing the pointer should yield a more likely to be unique 32bit value.
NULL is a special case that yields 0 instead of the CRC, so code that
handles IDs/Tags with value 0 differently will continue to work.
For 32bit builds, it just returns the pointer as ULONG.
2016-04-21 16:21:47 +02:00
Daniel Gibson
e642cbcd20 Change PLATFORM_32/64BIT detection
turns out that using UINTPTR_MAX is a pain on several systems like
FreeBSD or even older Linux/glibc systems, so maybe let's not do that
anymore.
Now I check for known CPU-architectures instead.

I also added some sanity checks to make sure the detection was
correct.
2016-04-21 16:21:47 +02:00
Joshua Scoggins
7f682180f3 Use SERIOUS_MHZ envvar for the time being 2016-04-20 19:24:51 -07:00
Joshua Scoggins
dbd896b58d Use the platform independent version of ReadTSC
- If I use the gnu inline version, the game runs way too fast on my cpu due to
  frequency scaling (I think).
2016-04-20 19:06:02 -07:00
Joshua Scoggins
1b873d3ab4 Bool's must be 32-bits wide 2016-04-20 18:50:36 -07:00
Daniel Gibson
5f5106e363 CShell::[SG]etCurrentWorld() instead of putting it in INDEX console var
The code used to store the world pointer as a console variable
"pwoCurrentWorld" of type INDEX (int32) - that won't work for 64bit, so
I added CShell::SetCurrentWorld() and CShell::GetCurrentWorld() and
store it as a pointer.
2016-04-18 18:52:52 +02:00
Joshua Scoggins
2d8a4df68c Add the system specific include file 2016-04-17 23:49:02 -07:00
Joshua Scoggins
0c847ab479 Move system specific includes out to a separate file 2016-04-17 23:48:44 -07:00
Joshua Scoggins
8b8ec1f39a Add some C++11 features into Types.h since C++11 is so cool :D 2016-04-17 23:30:48 -07:00
Joshua Scoggins
c8ab519b77 More big endian targets to detect 2016-04-17 23:26:33 -07:00
Joshua Scoggins
42b2822414 More todo's 2016-04-17 23:20:59 -07:00
Joshua Scoggins
35955d20ba use stdint.h instead of courage in Types.h 2016-04-17 23:18:23 -07:00
Joshua Scoggins
5b2933e217 Defined USE_PORTABLE_C when we can't figure out the platform 2016-04-17 23:06:49 -07:00
Joshua Scoggins
e5c0e4f3f4 Add better platform detection abilities 2016-04-17 23:02:49 -07:00
Daniel Gibson
599f644328 Resolved some 64bit issues, marked/commented some others
introduced PLATFORM_32BIT and PLATFORM_64BIT macros, so you can do
#ifdef PLATFORM_64BIT if you need to.
I needed that for CDrawPort::GetID() to properly CRC a pointer.
Also added a sanity check in Engine/Base/Types.h that makes sure that
uintprt_t and size_t have the same size, as the code uses size_t to
store pointers (or cast from pointer to int) all over the place.

Made some "tags" from Engine/Templates/BSP_internal.h size_t instead of
ULONG - they're used to store pointers to identify vertices and such,
so they'd better be big enough to actually store a pointer.
Some more are still missing.
2016-04-17 23:35:04 +02:00
Daniel Gibson
8d26863a51 Improve some portable C implementations of math functions
* FloatToInt() should now  round correctly ot nearest, even for
  negative numbers
* Log2() now calls log2f() instead of log10()*3.321 - no idea what the
  previous code was about, I doubt it's faster (and the ASM code uses
  something like log2, too).
* FastLog2() (for integers) now uses __builtin_clz() when building with
  GCC/clang - the resulting ASM should be pretty similar to the inline
  ASM below. I wonder why that function takes signed ints, log2(-1) in
  reality is an irrational number (but the function returns 31)..
  Also, both the inline ASM and my version return 0 for Log2(0), but
  INT_MIN would be closer to the truth
* commented out FastMaxLog2(), it's unused.
* implemented _rotl() using a fast(er) trick from
  http://blog.regehr.org/archives/1063
2016-04-17 23:15:56 +02:00
Ryan C. Gordon
dc2c869cfc Merge pull request #24 from ptitSeb/master
More OpenPandora support (special keymap) and optionnal Multi-Threading.
2016-04-15 14:52:56 -04:00
Yamagi Burmeister
0e672b866e Determine CPU speed on FreeBSD 2016-04-13 19:24:51 +02:00
ptitSeb
cd2a586a9e Better #if condition, and add a warning to be better checked latter 2016-04-13 08:21:50 +02:00
ptitSeb
9678ec3e58 Enabled Multi-Threading (as an option) + OpenPandora specific changes (for Shoulder As Mouse Buttons) 2016-04-12 22:29:39 +02:00
Ryan C. Gordon
df6199de70 Merge pull request #19 from rcgordon/sdl2-port
Sdl2 port
2016-04-12 01:38:05 -04:00
ptitSeb
dfe262b619 Don't pump SDL Event in GetInput, or they will be missing in SeriousSam.cpp:SubMain(...) 2016-04-11 08:32:38 +02:00
ptitSeb
98ebac941a Change CTString.Match to treat backslashes as slash (fixes Netrisca categories for new messages) 2016-04-09 14:15:33 +02:00
Ryan C. Gordon
6ce0b9b27e First attempt at a port to SDL2. Untested! 2016-04-09 02:18:57 -04:00
ptitSeb
f37df71029 Float fest\! 2016-04-07 18:13:50 +02:00
ptitSeb
19bd3f733b Use SDL constants for mouse buttons 2016-04-07 10:45:45 +02:00
ptitSeb
3ec4d484e2 Fix for 64bits build 2016-04-07 09:09:51 +02:00
Ryan C. Gordon
9820436fbe First pass at cleaning out 64-bit issues.
Touches a lot of code to remove long constants like "1L", so this patch is
large and ugly, but I think it makes all those Clamp() calls look nicer in
the long run.

Most of the game is 64-bit clean, since we can build without assembly code
now. I've marked the things that are obviously still wrong with STUBBED lines.

That being said: a 64-bit build can already run the demos mostly correctly,
so we're actually almost there!

There are a few obvious things that are obviously wrong, to be fixed.
2016-04-06 23:20:29 -04:00
Ryan C. Gordon
6b248af4d0 Moved STUBBED where all platforms can see it, made it more robust. 2016-04-06 15:35:12 -04:00
Ryan C. Gordon
b42025bc9f Unix basedir: Don't read past start of array if $PATH has an empty item. 2016-04-06 15:01:09 -04:00
Ryan C. Gordon
91827e7d2a Define PLATFORM_PANDORA instead of PANDORA, to match other targets. 2016-04-06 13:40:08 -04:00
ptitSeb
4bfca131b8 gettimeofday is not reliable on PANDORA, so use clock_gettime instead 2016-04-06 13:56:26 +02:00
ptitSeb
73ea5ca7d4 Case fixing of an include 2016-04-06 13:38:09 +02:00