1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00
Commit Graph

1279 Commits

Author SHA1 Message Date
Christoph Heiss
a347c07961 Use memcpy instead of mempcpy as mempcpy is glibc-specific.
This fixes #324 on macOS.
The only difference between memcpy and mempcpy is that mempcpy returns
a pointer one after the last written byte - the return value is unused.
2017-10-13 23:20:23 +01:00
Daniel Evans
8e86786e5b Update Character movement at each physics sub-step 2017-10-13 21:40:40 +01:00
Daniel Evans
c915521436 Use a sliding range within a larger UBO for object data.
Improves performance quite considerably (30%) on Ivy Bridge
2017-10-13 19:58:27 +01:00
Christoph Heiss
6cab5ee31a Fix some warnings
openrw/rwengine/src/engine/GameData.cpp:358:26: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    textureslots[slot] = std::move(loadTextureArchive(name));
                         ^
openrw/rwengine/src/engine/GameData.cpp:358:26: note: remove std::move call here
    textureslots[slot] = std::move(loadTextureArchive(name));
                         ^~~~~~~~~~                        ~

openrw/rwengine/src/objects/CharacterObject.cpp:16:18: warning: unused variable 'enter_offset' [-Wunused-variable]
static glm::vec3 enter_offset(0.81756252f, 0.34800607f, -0.486281008f);
                 ^

In file included from openrw/rwgame/RWGame.cpp:5:
openrw/rwgame/states/BenchmarkState.hpp:33:23: warning: 'BenchmarkState::getCamera' hides overloaded virtual function
      [-Woverloaded-virtual]
    const ViewCamera& getCamera();
                      ^
openrw/rwgame/State.hpp:51:31: note: hidden overloaded virtual function 'State::getCamera' declared here: different number of
      parameters (1 vs 0)
    virtual const ViewCamera& getCamera(float alpha);
                              ^
In file included from openrw/rwgame/RWGame.cpp:6:
openrw/rwgame/states/IngameState.hpp:53:18: warning: 'draw' overrides a member function but is not marked 'override'
      [-Winconsistent-missing-override]
    virtual void draw(GameRenderer* r);
                 ^
openrw/rwgame/State.hpp:28:18: note: overridden virtual function is here
    virtual void draw(GameRenderer* r) {
                 ^
In file included from openrw/rwgame/RWGame.cpp:6:
openrw/rwgame/states/IngameState.hpp:60:23: warning: 'getCamera' overrides a member function but is not marked 'override'
      [-Winconsistent-missing-override]
    const ViewCamera& getCamera(float alpha);
                      ^
openrw/rwgame/State.hpp:51:31: note: overridden virtual function is here
    virtual const ViewCamera& getCamera(float alpha);
                              ^
openrw/rwgame/RWGame.cpp:242:22: warning: unused variable 'vehicleModel' [-Wunused-variable]
            uint16_t vehicleModel = 110;  // @todo Which cars are spawned?!
                     ^

In file included from openrw/rwengine/src/script/modules/GTA3Module.cpp:1:
In file included from openrw/rwengine/src/engine/GameState.hpp:7:
openrw/rwengine/src/engine/ScreenText.hpp:140:63: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        const std::array<GameString, sizeof...(args)> vals = {args...};
                                                              ^~~~
                                                              {   }
openrw/rwengine/src/script/modules/GTA3ModuleImpl.inl:5669:16: note: in instantiation of function template specialization
      'ScreenText::format<std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> > >'
      requested here
                        ScreenText::format(
                                    ^
In file included from openrw/rwengine/src/script/modules/GTA3Module.cpp:1:
In file included from openrw/rwengine/src/engine/GameState.hpp:7:
openrw/rwengine/src/engine/ScreenText.hpp:140:63: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        const std::array<GameString, sizeof...(args)> vals = {args...};
                                                              ^~~~
                                                              {   }
openrw/rwengine/src/script/modules/GTA3ModuleImpl.inl:10214:18: note: in instantiation of function template specialization
      'ScreenText::format<std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> >,
      std::__1::basic_string<unsigned short, std::__1::char_traits<unsigned short>, std::__1::allocator<unsigned short> > >' requested here
            ScreenText::format(script::gxt(args, gxtEntry),
                        ^

openrw/rwgame/State.cpp:40:42: warning: unused parameter 'alpha' [-Wunused-parameter]
const ViewCamera& State::getCamera(float alpha) {
                                         ^

openrw/rwengine/src/render/ObjectRenderer.cpp:20:17: warning: unused variable 'kWorldDrawDistanceFactor'
      [-Wunused-const-variable]
constexpr float kWorldDrawDistanceFactor = kDrawDistanceFactor;
                ^
2017-10-13 19:54:10 +01:00
Christoph Heiss
fab9047ef9 Update OpenGL loader files.
Generated using:
lua LoadGen.lua -style=noload_c -spec=gl -version=3.3 -profile=core core_3_3 -stdext=gl_ubiquitous.txt -stdext=gl_core_post_3_3.txt
2017-10-13 19:54:10 +01:00
Christoph Heiss
67482135bc Add .DS_Store to ignored files 2017-10-13 19:54:10 +01:00
Filip Gawin
7b706e11d4 Fix text colors
On gtamodding.com is list
https://www.gtamodding.com/wiki/GXT#Tokens
2017-10-13 19:48:12 +01:00
Waritnan Sookbuntherng
c4f532fd56 Pause chase when the game paused 2017-10-13 19:12:30 +01:00
Aldoxtor
7b0b82c502 implement isPlayer() 2017-10-08 18:29:14 +01:00
Daniel Evans
7f2c512f50 Use Renderer in place of raw GL calls in more places
Additionally, fix setBlend() enabling blending on every draw
2017-10-08 18:18:28 +01:00
Filip Gawin
6d67728b4f Fix opcode 00bc
After some researches I found that,
script with opcode 03d5 removes only short
connected with sound, not cutscene's text.

Example:
aa12022061/19_8ball.sc (L164)

But in case of cutscenes, script doesn't do anything,
so logically suspecting, all opcodes connected with key word NOW,
are flushing currently used text.

aa12022061/19_8ball.sc (L862)
2017-10-08 14:37:16 +01:00
Filip Gawin
26e7d57905 Fix opcode 03d5
As you can see in script:
https://github.com/Lighnat0r/GTA-III-SCM-Converted/search?utf8=%E2%9C%93&q=03d5&type=
Opcode 03d5 is cleaning only after 00BC.

00BC is using HighPriority, not Big.
2017-10-08 14:37:16 +01:00
Filip Gawin
cc61d3858d Implement opcodes arg = abs(arg)
Commit implements 0094, 0095,
0096, 0097
2017-09-28 22:21:53 +01:00
Filip Gawin
ca819e9ddc Implement opcodes feet --> meters
Implement 0425, 042D.
2017-09-28 22:21:53 +01:00
Filip Gawin
a6d153b163 Implement opcodes int <--> float
Implements 008c, 008d, 008e, 008f,
0090, 0091, 0092, 0093.
2017-09-28 22:21:53 +01:00
Filip Gawin
c16f565136 Implement 02f6 02f7 2017-09-28 22:21:53 +01:00
Filip Gawin
11e90c61e5 Simplify condition
Like suggested in #293.
2017-09-19 14:23:31 +01:00
Filip Gawin
391e993d1f Simplify condition and increase readability 2017-09-19 14:23:31 +01:00
Filip Gawin
27113e540f Deleting "empty", duplicated variables in CharacterState
All objects inherites variables: rotation and position from GameObject,
CharacterObject contains also CharacterState with empty,
never used position and rotation. They are not even initialized.

https://github.com/rwengine/openrw/search?utf8=%E2%9C%93&q=currentState&type=
https://github.com/rwengine/openrw/search?p=1&q=getCurrentState&type=&utf8=%E2%9C%93
2017-09-19 14:23:31 +01:00
Filip Gawin
2890280934 Convert default initialization to value initialization
Default initialization has a problem,
it doesn't initialize POD class,
so it's safer to use value initialization,
especially for "outside" class (like bullet).
2017-09-19 14:23:31 +01:00
Filip
ed52d9acb9 Update Readme.md (FFmpeg)
Replace mad with ffmpeg.
2017-09-17 00:49:43 +01:00
Daniel Evans
887e0333c8 Improve state access to always get the current scene
Prevents events being recieved by states that are no-longer in effect

Fixes #292
2017-09-17 00:45:58 +01:00
Anonymous Maarten
02c60311ee rwlib/rwengine: make use of RW_ASSERT instead of assert 2017-09-16 22:19:39 +01:00
Anonymous Maarten
a1333360c5 rwlib: Add option to abort/break on failed checks or at request
- RW_ABORT/RW_ASSERT/RW_BREAKPOINT are only defined in debug mode
- the callback is needed to unlock the mouse when entering
    the debugger
2017-09-16 22:19:39 +01:00
darkf
afe4928678 SoundManager: use av_frame_free, not av_free 2017-09-16 19:50:51 +01:00
darkf
1bca493dfa Remove last mman reference 2017-09-16 19:50:51 +01:00
darkf
8fd6d2f125 SoundManager: Set log level to error on release, warning on debug 2017-09-16 19:50:51 +01:00
darkf
f4f0f28a14 Support older libavcodec versions and update .travis.yml for new dependencies 2017-09-16 19:50:51 +01:00
darkf
727dbbd218 Remove unnecessary CMake modules 2017-09-16 19:50:51 +01:00
darkf
ec2e940924 Remove libsndfile dependency 2017-09-16 19:50:51 +01:00
darkf
d69fdffdd1 Remove mman-win32 dependency 2017-09-16 19:50:51 +01:00
darkf
8e26431665 Remove dependency on libMAD (hurrah!) 2017-09-16 19:50:51 +01:00
darkf
4f60dcb663 Replace Music with Sound 2017-09-16 19:50:51 +01:00
darkf
c474bbe280 Implement FFmpeg audio decoder 2017-09-16 19:50:51 +01:00
darkf
6493908d5c Link FFmpeg 2017-09-16 19:50:51 +01:00
darkf
c08342f1f7 Add FindFFmpeg.cmake 2017-09-16 19:50:51 +01:00
Filip
8b067f4f69 Replacing "new" operators with make_unique/shared (#306)
* Replace "new" operator with std::make_unique for BS in BinaryStream.cpp

* Replace "new" operator with std::make_unique for textureArchive in TextureArchive.cpp

* Replace "new" operator with std::make_unique for variables in LoaderIDE.cpp

* Addition constructor for InstanceData

* Replace "new" operator with std::make_shared for instance  in LoaderIPL.cpp
2017-09-12 02:00:03 +01:00
Daniel Evans
b7ae0a54e4 Fix unused variable warning in rwengine 2017-09-12 01:44:22 +01:00
Aldoxtor
7a8c602c75 add missing override 2017-09-12 01:40:31 +01:00
Aldoxtor
fd5acc2be2 fixing magic numbers in playAnimation() 2017-09-12 01:35:24 +01:00
Anonymous Maarten
17bfa2cf74 rwengine: check for valid reads in DAT readers (in debug mode) 2017-09-12 00:55:41 +01:00
Anonymous Maarten
2e62a115bd rwengine: Ignore lines in DAT files starting with '*'
Last line starts with asterisk and would cause an uninitialized
DynamicsObjectDataPtr object to be inserted.
2017-09-12 00:55:41 +01:00
Anonymous Maarten
3488baae18 rwengine: Do not copy EndOfArgList to locals of created thread
integerValue RW_ERRORs for non-integer types
2017-09-12 00:55:41 +01:00
Anonymous Maarten
4700adb8c0 rwengine: std::map::end returns an iterator to the past-the-end element
Use std::map::rbegin instead
2017-09-12 00:55:41 +01:00
Anonymous Maarten
692ba92167 rwengine: extracting a float from a stream does not extract the f suffix
On Visual Studio 2017

std::istringstream ss("0.4f,0.8f,");
float f1, f2;
ss >> f1;          /* Will leave the f suffix available on the stream. */
ss.ignore(2, ','); /* Ignore until the comma. */
ss >> f2;
...
2017-09-12 00:55:41 +01:00
Anonymous Maarten
06c0f58ae8 config: add test about non-existing configuration directory 2017-08-15 15:58:01 +01:00
Anonymous Maarten
0308f809d6 config: Add the unknown keys to the what() message 2017-08-15 15:58:01 +01:00
Anonymous Maarten
a92f24cbb4 config: unknown data will be kept in memory and saved onto disk 2017-08-15 15:58:01 +01:00
Anonymous Maarten
7a86c199b0 tests: only include GameConfig.hpp in source file (no header file)
This reduces compile time from 1m19s to 9s when touching GameConfig.hpp.

(Executed from rwgame/build/tests)
before:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null

real	1m18.643s
user	1m13.069s
sys	0m5.266s

after:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null

real	0m9.247s
user	0m8.374s
sys	0m0.836s
2017-08-15 15:58:01 +01:00
Anonymous Maarten
b1976fbcf2 tests: test_globals.hpp has a dependency on boost/test/unit_test.hpp 2017-08-15 15:58:01 +01:00