Commit Graph

3543 Commits (19caa65b7b6432605e2ee12cf508680ed2688ca3)

Author SHA1 Message Date
Lukas Werling 19caa65b7b Merge branch 'sdl-gamecontroller' (pull request GH-17) 2016-03-21 16:39:28 +01:00
Lukas Werling 21fd0805d0 Merge branch 'gtk-mousegrab' (pull request #18) 2016-03-21 16:27:24 +01:00
ckanibal 8f31ae22bf Make Windows build great again! 2016-03-07 00:58:23 +01:00
Maikel de Vries 5acf34c2ba allow larger font sizes for exotic monitor configurations (#1695)
This can be still improved depending on the monitors dpi and select automatically a font that fits best to the dpi.
2016-03-04 21:07:42 +01:00
Günther Brammer b54ddc7663 Merge branch script 2016-03-01 03:04:17 +01:00
David Dormagen 3d71dfbfa9 Particles: added a "seed" parameter to PV_Random (#1198) 2016-02-27 12:24:15 +01:00
David Dormagen bc5fededaf particles: added PV_Cos 2016-02-27 11:45:13 +01:00
David Dormagen 4c6d347c4d C4ValueArraySortStringscomp: silenced string-to-bool-conversion warning
VisualStudio gave a "performance warning" about this implicit cast. I actually don't know why, but this change makes the intention clearer anyway (since we are not returning the string contents but just whether they exist). So it's probably not bad regardless of whether the warning is weird.

http://stackoverflow.com/questions/1847860/why-is-there-a-performance-warning-on-cast-pointer-to-bool
2016-02-27 11:42:37 +01:00
Lukas Werling 2d4747029d Make analog axis strength symmetrical (0 to 2^15 - 1) 2016-02-26 20:40:07 +01:00
Lukas Werling 3a4e667f4d Implement mouse grabbing for GTK on X11 (#1637)
The same thing should somehow also be possible using gdk_device_grab(),
but I couldn't get it to work properly.
2016-02-25 18:21:53 +01:00
Nicolas Hake 48ccc5f983 Render objects in front of landscape only once
The plane limits in C4ObjectList::Draw were not properly checked,
leading to objects in front of the landscape being drawn twice (once
before the landscape was rendered, and once after).
2016-02-25 01:09:48 +01:00
Nicolas Hake bfd9989fc6 Landscape Renderer: Create and bind 1D mat map texture before using
The landscape renderer used to store texture data into the default 1D
texture, which works but is a bad idea for several reasons (and would
have broken if we had a reason to use another 1D texture anywhere else).
2016-02-24 19:18:27 +01:00
Nicolas Hake f64f131f1b StdMesh*: Explicitly delete copy ctors/assignment ops 2016-02-24 01:46:58 +01:00
Nicolas Hake 72dc205582 GL: Add an object label to mesh IBOs 2016-02-24 01:46:58 +01:00
Lukas Werling e52bf6962b Fix gamepads only working after game start
This affected all platforms other than SDL.
2016-02-23 20:20:41 +01:00
Lukas Werling 8811356141 Make C4GamePadControl manage all controllers
The available gamepads are distributed automatically among players.

This also implements controller hot-plugging: It is possible to start a
game without a controller and plug it in later, and to reconnect a
controller after plugging it out.
2016-02-23 17:06:59 +01:00
Lukas Werling 9e0143b998 Remove gamepad ids from key codes
We want one gamepad key mapping to work with multiple gamepads, so
including the id there doesn't make sense.

Additionally, the gamepad id may change during the game (controller
hot-plugging).
2016-02-21 18:27:02 +01:00
Lukas Werling 9f69c650d6 Use icons for all controller buttons
The icons currently only show Xbox 360 controller labeling. The icon set
also includes icons for PlayStation controllers, so we could extend this
in the future.
2016-02-21 18:27:02 +01:00
Lukas Werling 7155ff90eb Implement controller rumbling
New script functions:
 - PlayRumble(int plr, int strength, int length)
 - StopRumble(int plr)
2016-02-21 18:27:01 +01:00
Lukas Werling 046cacc26c Remove unused and unimplemented gamepad functions
- GamePadControl::AnyButtonDown
 - GamePadOpener::SetGamePad
2016-02-21 18:27:01 +01:00
Lukas Werling aa42d1deb7 Make controller button strings nicer
This also removes the controller id from the control definitions,
instead defaulting to 0. This doesn't change anything for now as we only
had definitions for controller 0 anyways.
2016-02-21 18:27:01 +01:00
Lukas Werling 24622f3a9c Update main menu GUI gamepad control bindings
It is now possible to control all GUI menus using the left stick or the
dpad, along with the A and B buttons on the controller.

This also doubles the button emulation dead zone to make navigating the
menus with the stick easier.
2016-02-21 18:26:44 +01:00
Lukas Werling 985f1b99e5 Make GetPlayerControlState() query the current controller state
To keep compatibility with scripts which expect only binary buttons,
this adds a third parameter to the function which enables the new
functionality.

Bonus /script to test the controller stick x axis:

    Schedule(GetCursor(), "Message(\"%d / %d\", GetPlayerControlState(0, CON_Left, true), GetPlayerControlState(0, CON_Right, true))", 10, 100000000)

Note that the values will be inconsistent if multiple analog sticks are
bound to the same control, as values from one stick will overwrite those
from the other one. This can happen even if you move only one stick.
2016-02-21 18:26:44 +01:00
Lukas Werling 8dd1450e94 Implement "gamepad stick moved" events for analog input
Analog moved events are only sent once per control frame.
2016-02-21 18:26:18 +01:00
Armin Schäfer 9dca94a6b8 New Title image overlay. 2016-02-20 17:26:43 +01:00
Armin Schäfer 1ab375488f Fix AppendCommand(Jump) without target. 2016-02-20 17:21:31 +01:00
Nicolas Hake 25deef7857 Merge fix for AnimationNode deserialization crash 2016-02-13 23:28:09 +01:00
Lukas Werling 937ddaf722 Update key code strings for game controllers
With the SDL_GameController interface, buttons and axes have actual
names we can refer to. This also allows for advanced mappings using both
sticks (this probably needs script changes) as well as the triggers.
2016-02-13 23:28:00 +01:00
Nicolas Hake ad01c2e48f Fix NULL deref when deserializing CustomNode AnimationNodes (GH #13) 2016-02-13 23:22:21 +01:00
Günther Brammer c9c8b0c408 Move modifier key masks to the keycode definitions 2016-02-13 22:36:41 +01:00
Lukas Werling bd3f020068 Replace Joystick controls with SDL GameController 2016-02-13 21:03:19 +01:00
Lukas Werling 9c840724f2 Re-enable gamepad controls 2016-02-13 18:42:23 +01:00
Lukas Werling 97f06fd0cd Fix openclonk-server build 2016-02-12 22:40:55 +01:00
Günther Brammer c332fe940b Merge branch 'sdl-mouse' 2016-02-12 21:11:21 +01:00
Lukas Werling 24ef8b43af Grab the mouse while in-game (#1637)
This only implements this for the SDL port for now.
2016-02-12 21:09:40 +01:00
Günther Brammer 92217e51e0 GLX: Use gdk instead of XLib to make glXCreateContextAttribsARB not exit 2016-02-12 20:39:39 +01:00
Günther Brammer 0c0c64642a Remove unused #define in C4AulParse 2016-02-12 17:15:46 +01:00
Lukas Werling f505b31032 SDL: Fix mouse button handling
- The right mouse button didn't work at all.

 - The left mouse button stopped working when clicking multiple times
   without moving the cursor.
2016-02-11 22:29:10 +01:00
Lukas Werling 392b7bab72 SDL: Add support for the mouse wheel
Fixes #0001682
2016-02-11 22:17:42 +01:00
Nicolas Hake 5f895c14fc Materials: Fix misspelling of "Incendiary" (#1680)
The wrong spelling will still be accepted as a material value, as long
as no value with the correct spelling exists.
2016-02-09 23:45:02 +01:00
David Dormagen 91391c64af draw global particles on plane 900
Previously, global particles would be drawn even in front of Plane 1000+ (GUI) objects. Additionally, it was impossible to specify particles that were supposed to always be in front of all other particles (e.g. fog, clouds, emulated FoW, ...).
Now, you can attach particles to an object on plane 901+ and have them be in front of everything else.
2016-02-09 20:43:23 +01:00
Armin Burgmeier 582cba01ed Build Fix 2016-02-08 21:28:44 -08:00
Nicolas Hake 43aa11623a Fix off-by-one error in FoW renderer (#1678)
The FoW renderer would try drawing to texture coordinates one pixel
too high (i.e. if the texture was 256 pixels high, it would draw to
pixels with 1 <= y <= 256 instead of 0..255).
2016-02-08 22:58:18 +01:00
Nicolas Hake a204439f80 C4FontLoader: Stop manually managing memory
Instead of implementing a dynamically growable array with new and delete
and memcpy like cavemen, we'll use a vector of smart pointers.
2016-02-08 22:58:17 +01:00
Maikel de Vries 159dbf071f make ContactCalls a property instead of DefCore entry
This allows for useful runtime changes, like disabling contact calls when an animal dies.
2016-02-08 21:25:43 +01:00
Nicolas Hake 142b7ea7c3 RegCreateKeyEx: Pass NULL as lpClass
The lpClass parameter isn't used, and it is valid to pass NULL for it.
It is, however, not valid to pass a string literal, because the
conversion to nonconst char* has been deprecated in C++ for a long time
and doesn't exist anymore in C++11.
2016-02-08 17:36:50 +01:00
Nicolas Hake d5dbcb71da ShowGfxErrorDialog: Fix handle leak
CreateProcessW will return a handle the main thread and a process handle
to the child process. These handles must be closed to avoid a resource
leak.
2016-02-08 17:36:50 +01:00
Nicolas Hake 3d9b322f51 Fix incorrect CreateProcessW call
Quoth MSDN: "The Unicode version of this function, CreateProcessW, can
modify the contents of this string. Therefore, this parameter cannot be
a pointer to read-only memory (such as a const variable or a literal
string). If this parameter is a constant string, the function may cause
an access violation."

It can, however, be NULL, which does the right thing automatically.
2016-02-08 17:36:50 +01:00
Nicolas Hake 64a5388d4d C4Surface: Remove broken "support" for split textures
Most code already didn't handle textures larger than GL_MAX_TEXTURE_SIZE
and only used the first one in case of a split texture.
2016-02-08 17:36:50 +01:00
Nicolas Hake 7b04914fc4 C4Surface: Make dbg_index unsigned int instead of int*
It seems like an odd decision to add a layer of indirection to this,
especially since it's just a pointer to int instead of a pointer to a
larger structure.
2016-02-08 17:36:50 +01:00