Commit Graph

351 Commits

Author SHA1 Message Date
ptitSeb
e37a80ef83 Some warning solved 2016-09-21 19:25:13 +02:00
ptitSeb
cf7056b4d6 Missing a const 2016-09-21 17:20:37 +02:00
ptitSeb
1984179657 Fixed a missing #endif issue 2016-09-21 17:14:06 +02:00
ptitSeb
ad57104c22 Merge work with remote 2016-09-09 14:11:53 +02:00
ptitSeb
57cd734dbc Don't regulate Framerate on Pandora
Restrict the Eps precision change only to Pandora platform
fix Inverted Right and Middle button on certain case with SDL
Added some Failsafe. Fixed a crash in the new game intro cinematic (when Boss of TFE die and Sam goes to the UFO) on the Pandora
Some Pandora fine-tunning
Tried some asynchronus input method, but doesn't seems to works
2016-09-09 13:39:28 +02:00
Ryan C. Gordon
570f166b26 Merge pull request #56 from DanielGibson/fix-null-crashes
Fix crashes from this!=NULL removal
2016-07-03 01:19:00 -04:00
comicfans44
e70a5bb92b fix sscanf stack buffer overflow. string should have '\0' 2016-07-03 04:34:17 -04:00
Daniel Gibson
1b895d7478 Support both ModExt.txt and ModEXT.txt 2016-06-06 04:28:42 +02:00
Daniel Gibson
882c7773b5 Game can be executed and quit without crashes
mostly checks before calling AddReference()/RemReference()
2016-06-06 03:53:57 +02:00
Ryan C. Gordon
d723153576 Merge pull request #49 from yamgent/mod-ext-fix
Fix ModEXT.txt issues
2016-06-05 01:20:24 -04:00
Daniel Gibson
b30d3d86d8 Fix compilation from changes for GCC 6.1.1
At least on my system floor() and log10() return double, so the other
arguments to Clamp() and ClampDn() didn't match anymore, now being float
instead of double.
I replaced the calls to log10f() and floorf() to avoid any ambiguities.
2016-05-30 01:06:10 +02:00
Emil Laine
4b0e01145e Fix warning -Wtautological-undefined-compare
Quoting Clang:
"reference cannot be bound to dereferenced null pointer in well-defined
C++ code; comparison may be assumed to always evaluate to false"

Conflicts:
	Sources/CMakeLists.txt
2016-05-30 00:55:15 +02:00
Emil Laine
16a2048a2c Fix warning -Wchar-subscripts 2016-05-30 00:50:11 +02:00
Emil Laine
13ba79ea5f Remove unneeded -Wno-sign-compare
(I didn't receive any warnings after enabling -Wsign-compare.)

Conflicts:
	Sources/CMakeLists.txt
2016-05-30 00:49:57 +02:00
Emil Laine
5badefaf90 Change remaining "if (this!=NULL)" to "ASSERT(this!=NULL)"
Also changed all "if (this==NULL) return;"s.

Fixes some -Wtautological-undefined-compare warnings.

Quoting Clang:
"'this' pointer cannot be null in well-defined C++ code; comparison may
be assumed to always evaluate to false"
2016-05-30 00:48:47 +02:00
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
Ryan C. Gordon
0b24c2f06c Merge pull request #50 from Manuel-K/gcc-6.1.1-fix
fix compilation errors with gcc 6.1.1 on Arch Linux
2016-05-24 00:55:35 -04:00
Manuel K
ba8d82efaf fix compilation errors with gcc 6.1.1 on Arch Linux 2016-05-22 01:17:19 +02:00
Daniel Gibson
7b470d30ab Elemental.es/Computer.cpp changes according to @SLAwww's suggestions 2016-05-11 19:04:01 +02:00
Daniel Gibson
7e7ab3e70e remove FIXMEs in GameMP/Computer.cpp
and replace the corresponding conditions with more readable (but
equivalent) ones.
2016-05-09 18:51:04 +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
de4f96d208 Remove FIXMEs/silence Fish.es warnings
Thanks to @SLAwww's explanations it's clear now :)
2016-05-09 18:51:04 +02:00
Daniel Gibson
8106aedd9f Use at least 16bit for Depth-Buffer (fixes #37)
Seems like on Windows 0 bits is handled as "Let Windows/Driver decide",
so handle that case by setting a reasonable value of 16.
2016-05-09 18:51:03 +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
bee4102374 Fix several warnings, warn if not using depth buffer
Fixed -Wreorder warnings (hopefully the last?), also several potentially
uninitialized variables.

In SetupPixelFormat_OGL() Assert if gap_iDepthBits ends up being 0.

Small adjustments to cmake warning settings for gcc/clang
2016-05-09 18:48:39 +02:00
Daniel Gibson
c58328d881 RSBinToGroups() use __builtin_clz() instead of manual bsr if available
should be faster.
2016-05-09 18:48:39 +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
Tan Wang Leng
577373f91e Fix casing for ModExt.txt
Some file systems are case-sensitive, so use proper casing.
2016-05-05 13:47:02 +08: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
ff57a29e0f make separate option for using nasm asm
Other asm is now enabled by default again, since asm blocks are now
smarter and won't fail to compile on non-i386 platforms.
2016-04-25 00:14:29 +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
ptitSeb
dca5b7a6ac Merge branch 'master' of https://github.com/ptitSeb/Serious-Engine
Conflicts:
	Sources/Engine/Base/Types.h
	Sources/Engine/Engine.h
2016-04-22 23:04:19 +02:00
ptitSeb
bbb184aad7 More macro for UNIPTR_MAX 2016-04-22 22:03:07 +02:00
ptitSeb
df3592c88c Need __STDC_LIMIT_MACROS macro here too 2016-04-22 22:03:06 +02:00
ptitSeb
c15a2ce2b3 Nedd __STDC_LIMIT_MACROS for *_MAX constant to be defined 2016-04-22 22:03:06 +02:00
ptitSeb
c6415f84b5 Don't regulate Framerate on Pandora 2016-04-22 22:03:05 +02:00
ptitSeb
e1921174d4 Restrict the Eps precision change only to Pandora platform 2016-04-22 22:03:05 +02:00
ptitSeb
c32b7cc829 fix Inverted Right and Middle button on certain case with SDL 2016-04-22 22:03:04 +02:00
ptitSeb
b4e43fac95 Lower Epsilonon Pandora 2016-04-22 22:03:03 +02: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
Rohit Nirmal
cb3f3bf521 Use those other averages. (#41) 2016-04-22 13:57:04 -04:00
Ryan C. Gordon
7213794459 Merge pull request #38 from DanielGibson/fix-FloatToInt
Fix for FloatToInt
2016-04-21 23:00:03 -04:00
Daniel Gibson
1f23f37b36 CMakeLists.txt: suppress some warnings also for gcc, not only clang
also, check for AppleClang, not only Clang.
2016-04-22 04:27:29 +02:00
Daniel Gibson
c74fa69bf6 gcc told me copysignf() in FloatToInt() didn't do anything. oops.
sometimes using GCC *does* find problems clang didn't :)
2016-04-22 04:27:29 +02:00
notaz
52c178718c fix SoundMixer asm
SoundMixer386.asm forgot to save some callee-save registers too
2016-04-22 02:29:47 +03:00
notaz
b1837c2e58 fix Graphics asm
same stuff as in previous commit
2016-04-22 02:29:30 +03:00
notaz
a1b84b3ba0 Revert "fix build on gcc 4.8"
This reverts commit 8bbe4c1d5e.
Going to fix it properly.
2016-04-22 02:29:30 +03:00
notaz
fd045e5025 fix LayerMixer asm
- clobber the whole x87 state for mmx (emms alone requires this)
- add all modified registers to clobber list
  (in some cases use dummy output vars instead)
- use symbolic names
- use more relaxed constraints where possible
- allow gcc to allocate ebx replacement reg
2016-04-22 02:28:42 +03: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
2a58209487 Some cmake fixes, fixing OSX build (incl 64bit) + disable i386ASM by default
OSX build was a bit broken, it needs to be linked against zlib.
Furthermore it now uses the systems libSDL2 framework, unless you use
-DUSE_SYSTEM_SDL2=FALSE

i386 ASM is now disabled by default, we have plain C fallbacks for
everything that seems to work well enough (and if not they need more
testing which is likely to happen this way)
2016-04-21 17:40:42 +02:00
Daniel Gibson
64e6b915b7 Fix out of bounds access of afStarsPositions in TFE Particles.cpp
same as before for EntitiesMP/Common/Particles.cpp, this time for
the first encounter.
2016-04-21 16:21:47 +02:00
Daniel Gibson
72bd84edb8 Fix 64-bit build of Entities/Player.es (of First Encounter) 2016-04-21 16:21:47 +02:00
Daniel Gibson
430e0c8a95 Remove "64-bit issue" STUBBED() in Model.cpp, as it only looks fishy
.. but is really fine (most probably).

I added comments instead; see them for explanation why it's fine ;-)
2016-04-21 16:21:47 +02:00
Daniel Gibson
d228b6a7a7 make all BSP-related tags size_t so they can store pointers
The tags are often initially assigned from pointers and then copied
around, even from one tag type to the other.
As BSPTree::MoveSubTreeToArray() uses them to get the original pointer,
we need the pointers anyway, so just CRC-ing the pointers doesn't seem
like a good option. As the tags are assigned from other tag-types
sometimes, I probably would have needed to add Pointers for the same
values in addition to the ULONG tags, that are also copied around along
the tags, to keep the tags ULONG - that seemed like a worse alternative.

However, when writing (via BSPTree::Write_t()) the bn_ulPlaneTag tag
needs to be ULONG, so there I actually use CRC for 64bit pointers (via
IntPtrToID()) - when restoring (in Read_t()), the pointers aren't valid
anymore anyway, so that all should somehow be fine.
I assume that Write_t() is only used by the Editor, anyway, so I fear I
won't be able to test that part of the code on Linux anytime soon.
2016-04-21 16:21:47 +02:00
Daniel Gibson
b437abf10d Use PointerToID() for sound-event ID in CSoundObject::Play()/Stop()
so that code should be 64bit-clean now.
2016-04-21 16:21:47 +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
Rohit Nirmal
e166958881 Silence -Wreorder warnings. 2016-04-20 13:31:49 -05:00
Ryan C. Gordon
3e84eafe15 Merge pull request #28 from salamanderrake/icculus-master-cmake-bms
CMakeLists.txt changes plus install.
2016-04-19 22:53:41 -04:00
Salamanderrake
9477af7bfa CMakeLists.txt: Applied some changes Ryan wanted with the c/cxx flags. 2016-04-19 18:16:45 -04:00
ptitSeb
c8291e6d37 More macro for UNIPTR_MAX 2016-04-19 22:00:29 +02:00
ptitSeb
e077fd664d Need __STDC_LIMIT_MACROS macro here too 2016-04-19 22:00:28 +02:00
ptitSeb
4b47c278bb Nedd __STDC_LIMIT_MACROS for *_MAX constant to be defined 2016-04-19 22:00:27 +02:00
ptitSeb
b9bb24e608 Don't regulate Framerate on Pandora 2016-04-19 22:00:27 +02:00
ptitSeb
484d49434b Restrict the Eps precision change only to Pandora platform 2016-04-19 21:54:46 +02:00
ptitSeb
9288c42268 fix Inverted Right and Middle button on certain case with SDL 2016-04-19 21:54:43 +02:00
ptitSeb
7c1cc68d6f Lower Epsilonon Pandora 2016-04-19 21:54:43 +02:00
Yamagi Burmeister
794180c598 bswap_32() is a linuxism, use inline code instead.
bswap_32() is a function specific to Linux, unavailable on FreeBSD and
OS X. Instead of messing with other platform specific functions, #ifdef
and so on provide a fast inline implementation.
2016-04-19 19:09:20 +02:00
Daniel Gibson
8de421dc9d Textures.cpp: improved td_pulObjects/td_ulObject fix
* td_pulObjects is explicitly set to NULL in the constructor - before
  only td_ulObject was set to NONE (0), so on 64bit half of
  td_pulObjects bytes would remain garbage
* only check td_ulObject for NONE if td_ctFrames <= 1 (until now it
  would frequently check it for NONE even if td_ctFrames > 1, if
  td_pulObjects was != NULL)
2016-04-19 14:38:25 +02:00
Salamanderrake
380bade7c0 CMakeLists.txt: BMS, Added a small explanation about the default CMAKE_INSTALL_PREFIX 2016-04-19 04:43:59 -04:00
Salamanderrake
90a614b03c CMakeLists.txt: Added an install section and fixed permissions issues with libraries. 2016-04-19 04:41:55 -04:00
Salamanderrake
b7c49d4e51 CMakeLists.txt: Some cleanup and removing redundent lines from the CMakeLists.txt file. 2016-04-19 04:41:55 -04:00
Salamanderrake
ec1448c4d4 build-linux32.sh: Renamed build-linux.sh build script to show which arch it is compiling
build-linux64.sh: for use build native 64bit linux binaries.
2016-04-19 04:41:55 -04:00
Salamanderrake
86b487df9e CMakelists.txt: Removed my attempt at making Engine a static lib again. plus other small cmake fixes 2016-04-19 04:41:55 -04:00
Salamanderrake
836a4abc43 CMakeLists.txt: Redid the section on c/cxx flags to sepereate them
so you can have c++ only flags along with c only flags
	fore their respective .c/.cpp builds without conflict.
2016-04-19 04:38:55 -04:00
Ryan C. Gordon
1f7bb24a4d Merge pull request #26 from DanielGibson/64bit-stuff
Some 64bit improvements, lots of 64bit TODOs/STUBBED()
2016-04-18 22:33:58 -04:00
notaz
8bbe4c1d5e fix build on gcc 4.8
some versions of gcc want to inline DitherBitmap(), and this leads to trouble:
Sources/Engine/Graphics/Graphics.cpp:1167: Error: symbol `rowLoopE' is already defined
Sources/Engine/Graphics/Graphics.cpp:1170: Error: symbol `pixLoopEL' is already defined
...
2016-04-18 23:55:41 +03:00
Daniel Gibson
ab5d0a584f Make Engine/Graphics/Texture.cpp 64bit-clean (hopefully!)
((ULONG*)td_ulObject)[iFr] is fishy - and ULONG td_ulObject already is
in an union with ULONG* td_pulObjects, so use td_pulObjects when
appropriate (i.e. if td_ctFrames>1)
Also fixed some checks accordingly.
2016-04-18 20:10:24 +02:00
Daniel Gibson
93daf905f1 EntitiesMP/Common/Particles.cpp: Don't access afStarsPositions[i][3]
fix out of bounds accesses of that array.
I guess the same will have to be done for Entities/Common/Particles.cpp
2016-04-18 19:37:02 +02:00
Daniel Gibson
80990f2317 Fix some more warnings, Warning about supressed warnings in cmake 2016-04-18 19:10:52 +02: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
a4ca331de9 Added some more todos 2016-04-18 00:13:30 -07:00
Joshua Scoggins
f8cb52f8ad Delete an unused include 2016-04-17 23:50:00 -07:00
Joshua Scoggins
a8c22df784 Forgot to write Engine to disk :( 2016-04-17 23:49:18 -07: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