Holger Schemel [Fri, 31 Aug 2018 06:46:03 +0000 (08:46 +0200)]
added checking for invalid/malicious packet size in network protocol
Holger Schemel [Fri, 31 Aug 2018 06:13:05 +0000 (08:13 +0200)]
added checking for invalid/malicious filenames in network protocol
Holger Schemel [Thu, 30 Aug 2018 19:51:16 +0000 (21:51 +0200)]
added using global levelset identifier and level number for network games
This change/addition was required for correctly handling identifiers
and level numbers when playing network games (for which the related
levelset possibly does not exist locally, but was sent by the network
server). This includes showing the correct level number for the level
that is played over the network, and saving the resulting high scores
for the correct level in the correct levelset score directory (again,
even if this levelset or level number does not exist locally).
Holger Schemel [Thu, 30 Aug 2018 19:46:11 +0000 (21:46 +0200)]
added (and set) identifier and level number to global levelset structure
Holger Schemel [Thu, 30 Aug 2018 18:11:08 +0000 (20:11 +0200)]
fixed bug with accessing string buffer that was already free()'ed
The function "getNetworkLevelDir()" returns a reference to a string
buffer that will be invalidated by each following invocation. As
"InitNetworkLevelDirectory()" also calls this function, it must be
called before "getNetworkLevelDir()".
Holger Schemel [Tue, 28 Aug 2018 02:20:15 +0000 (04:20 +0200)]
moved level set info structure to game library layer
Holger Schemel [Mon, 27 Aug 2018 20:45:46 +0000 (22:45 +0200)]
added loading custom artwork for network games
Holger Schemel [Sat, 25 Aug 2018 17:51:10 +0000 (19:51 +0200)]
added always playing network games in team mode with the EM engine
When playing levels using the Emerald Mine (EM) game engine in network
mode with setup option "team mode" disabled, assume that multi-player
mode should be enabled anyway (just as it is handled with levels using
the R'n'D game engine).
Holger Schemel [Sat, 25 Aug 2018 13:05:31 +0000 (15:05 +0200)]
disabled auto-incrementing level number when playing in network mode
Holger Schemel [Sat, 25 Aug 2018 13:04:08 +0000 (15:04 +0200)]
disabled auto-playing next level when playing in network mode
Holger Schemel [Sat, 25 Aug 2018 12:58:44 +0000 (14:58 +0200)]
swapped condition logic for better readability
Holger Schemel [Fri, 24 Aug 2018 22:42:10 +0000 (00:42 +0200)]
added sending level file (and level template) for network games
As the level to play may not exist on the receiving side (but only on
the sending side -- the client who initiates the network game), this
change adds sending the level file (and the level template, if needed)
to all receiving network clients, so all clients always play the exact
same level (and do not have to worry about having the same level sets).
Holger Schemel [Fri, 24 Aug 2018 21:09:07 +0000 (23:09 +0200)]
prepared level number in game panel for network games
Holger Schemel [Fri, 24 Aug 2018 10:45:38 +0000 (12:45 +0200)]
removed storing two strings in function for level filenames
Before, the function "getLevelFilenameFromBasename()" stored two
filenames in static string pointers, one for the level filename, and one
for the corresponding level template filename, because the results were
only used as references before. As they are now stored as string copies
outside if this function, it is sufficient to only store the last result.
This change is directly related to commit
759e0bea.
Holger Schemel [Fri, 24 Aug 2018 10:31:53 +0000 (12:31 +0200)]
changed filename string handling for level file info structure
Before, level filenames in the level file info structure (members for
"basename" and "filename") were only handled as references to the
basename/filename strings allocated elsewhere, so if those strings
changed, the references in the level file info structure also pointed
to those changed strings. When determining filenames for both level
files and corresponding level templates, references to level filenames
were replaced by references to template filenames, which resulted in
unexpected/wrong behaviour.
Now, these level filenames are handled as copies of the strings, so if
the strings change, the string copies still stay the same.
Holger Schemel [Thu, 23 Aug 2018 19:53:59 +0000 (21:53 +0200)]
added missing check for changed level in editor ("use template for CEs")
Holger Schemel [Thu, 23 Aug 2018 16:49:30 +0000 (18:49 +0200)]
fixed extremely nasty bug when using level template in level editor
When checking the checkbox "use template for custom elements" on the
"editor" tab on the level properties page, the playfield area was
replaced with a "broken" level, caused by horrible bugs in the level
initialization function "setLevelInfoToDefaults_MM()". Fixed now.
This bug was introduced with the MM game engine in version 4.1.0.0.
Holger Schemel [Wed, 22 Aug 2018 09:27:00 +0000 (11:27 +0200)]
added functions to network code for sending files
Holger Schemel [Wed, 22 Aug 2018 09:23:19 +0000 (11:23 +0200)]
added functions to handle network level directories
Holger Schemel [Wed, 22 Aug 2018 09:22:47 +0000 (11:22 +0200)]
added function to dump network message buffer (for debugging)
Holger Schemel [Tue, 21 Aug 2018 21:51:09 +0000 (23:51 +0200)]
fixed bug which caused wrong level number in "hall of fame" after playing
This bug is related to commit
e2260726, which forced displaying the
high score values for the correct level number, but refused to show
the correct level number in the headline of the "hall of fame" (but
displayed the number of the next level to play). This is fixed now.
Holger Schemel [Tue, 21 Aug 2018 09:32:51 +0000 (11:32 +0200)]
completely refactored client and server side network protocol code
Holger Schemel [Mon, 20 Aug 2018 09:30:59 +0000 (11:30 +0200)]
improved handling network protocol version mismatch
In case of different network protocol versions at network client and
server, show an error message and disable networking instead of
aborting the program with a "fatal error" style message.
Holger Schemel [Mon, 20 Aug 2018 09:14:20 +0000 (11:14 +0200)]
changed using network protocol by starting with protocol version check
Holger Schemel [Mon, 20 Aug 2018 09:13:46 +0000 (11:13 +0200)]
added support for protocol version check as first protocol command
Holger Schemel [Mon, 20 Aug 2018 09:11:12 +0000 (11:11 +0200)]
changed network protocol version from 1.2.0 to 2.0.0
Holger Schemel [Sat, 18 Aug 2018 13:12:44 +0000 (15:12 +0200)]
removed unused variables
Holger Schemel [Sat, 18 Aug 2018 13:05:07 +0000 (15:05 +0200)]
fixed bug in network mode with pausing game on errors when not playing
Holger Schemel [Fri, 17 Aug 2018 13:11:19 +0000 (15:11 +0200)]
fixed warning for missing level template when loading level
Holger Schemel [Fri, 17 Aug 2018 12:30:27 +0000 (14:30 +0200)]
added disabling networking when executing command line functionality
Auto-testing solution tapes could cause crashes if network was enabled.
Holger Schemel [Fri, 17 Aug 2018 11:02:53 +0000 (13:02 +0200)]
added using counter of players that still have to enter an exit
Holger Schemel [Fri, 17 Aug 2018 11:00:04 +0000 (13:00 +0200)]
added counter of players that still have to enter an exit (not used yet)
Holger Schemel [Fri, 17 Aug 2018 10:40:26 +0000 (12:40 +0200)]
renamed function
Holger Schemel [Fri, 17 Aug 2018 10:16:20 +0000 (12:16 +0200)]
fixed pausing network games if the game already ended
Holger Schemel [Fri, 17 Aug 2018 09:30:02 +0000 (11:30 +0200)]
fixed exiting players with custom elements when playing multi-player games
Before, exiting a player using custom element actions only worked in
single-player mode. (In multi-player mode, the level was either
immediately solved if the exited player was the "local player"
(ignoring other players still existing on the playfield), or the
exited player was not removed from the playfield, if it was not the
"local player".)
Now it works correctly also in multi-player games.
Holger Schemel [Fri, 17 Aug 2018 09:08:37 +0000 (11:08 +0200)]
fixed solving level when playing multi-player games
Before, solving a level was broken in both local and network
multi-player games:
In local multi-player games, the level was only solved if the player
marked as "local player" (which is only one of all players in a level)
entered the exit (but not if any other player entered the exit). As an
additional bug, the level was *always* solved as soon as the "local
player" entered the exit, regardless if any other player was still on
the playfield.
In network multi-player games, the level was always solved for the
first player entering the exit (as this player is always the "local
player" in one of the participating network clients), while the game
was frozen on all other network clients (and had to be manually ended
by using the Escape key or stop button).
With this fix, multi-player games will always be solved (locally or on
all network clients) if the last player on the playfield has entered
the exit.
Holger Schemel [Fri, 17 Aug 2018 09:04:25 +0000 (11:04 +0200)]
added function to remove player and cleanup last player field
Holger Schemel [Tue, 14 Aug 2018 21:37:44 +0000 (23:37 +0200)]
fixed ignoring mouse actions with MM engine using virtual buttons
As virtual buttons do not make much sense when playing games using the
Mirror Magic game engine, mouse clicks should be handled as usual even
when touch input is set to "virtual buttons" (causing mouse clicks to
be ignored before this change).
Holger Schemel [Sat, 14 Jul 2018 11:47:17 +0000 (13:47 +0200)]
added clearing event queue after fading and after door/envelope requests
Holger Schemel [Thu, 12 Jul 2018 19:32:31 +0000 (21:32 +0200)]
fixed using private level set if network game level set not found
Before, if a network client started playing a level from a level set
that is not installed for some other network client, that client did
a fallback to playing the default private level set. This caused the
network clients effectively playing completely different levels with
the input actions of the other clients, which does not make any sense.
Now, the network game is stopped for all clients in such a case.
Holger Schemel [Wed, 4 Jul 2018 22:43:39 +0000 (00:43 +0200)]
added configurable border size also for drawing network players
Holger Schemel [Wed, 4 Jul 2018 22:35:27 +0000 (00:35 +0200)]
added drawing players with level preview when using network or team mode
Holger Schemel [Tue, 3 Jul 2018 21:57:33 +0000 (23:57 +0200)]
fixed setting player network flag without being connected to network server
Holger Schemel [Tue, 3 Jul 2018 21:44:46 +0000 (23:44 +0200)]
added being able to reconnect after network server was restarted
Holger Schemel [Tue, 3 Jul 2018 06:44:05 +0000 (08:44 +0200)]
added clearing network players from main menu screen if server disconnects
Holger Schemel [Sun, 1 Jul 2018 23:12:57 +0000 (01:12 +0200)]
added drawing network players (graphics and names) to main menu screen
Holger Schemel [Sun, 1 Jul 2018 11:20:14 +0000 (13:20 +0200)]
fixed changing to main menu after stopping network game only when playing
Holger Schemel [Sun, 1 Jul 2018 11:18:43 +0000 (13:18 +0200)]
added showing player number if network game was stopped by remote player
Holger Schemel [Sun, 1 Jul 2018 11:04:25 +0000 (13:04 +0200)]
added stopping game (with request dialog) if network player disconnected
Holger Schemel [Wed, 27 Jun 2018 21:20:11 +0000 (23:20 +0200)]
replaced delay functions with new one that continues updating toons
Holger Schemel [Wed, 27 Jun 2018 21:16:24 +0000 (23:16 +0200)]
added delay function that regularly updates the screen (to redraw toons)
Holger Schemel [Wed, 27 Jun 2018 19:16:37 +0000 (21:16 +0200)]
changed drawing to playfield when changing network mode setup options
Holger Schemel [Wed, 27 Jun 2018 06:40:47 +0000 (08:40 +0200)]
reduced time to wait for UDP broadcast answer to auto-detect network server
Holger Schemel [Wed, 27 Jun 2018 06:37:34 +0000 (08:37 +0200)]
improved connecting to local network server
Holger Schemel [Tue, 26 Jun 2018 22:02:22 +0000 (00:02 +0200)]
added disconnecting from network server from setup menu
Holger Schemel [Tue, 26 Jun 2018 20:10:04 +0000 (22:10 +0200)]
added connecting to network server from setup menu without program restart
Holger Schemel [Mon, 25 Jun 2018 21:17:38 +0000 (23:17 +0200)]
added displaying screen messages when connecting to network server
Holger Schemel [Fri, 22 Jun 2018 19:29:50 +0000 (21:29 +0200)]
added setting network connection flag for network games
Holger Schemel [Fri, 22 Jun 2018 19:25:22 +0000 (21:25 +0200)]
improved handling network errors (show message instead of stopping program)
Holger Schemel [Thu, 21 Jun 2018 06:50:12 +0000 (08:50 +0200)]
added setup option to skip displaying the high scores after solving a level
Holger Schemel [Thu, 21 Jun 2018 06:41:31 +0000 (08:41 +0200)]
added setup option to directly play the next level after solving a level
Before, the program returned to the main menu after the player solved
a level (and the high score table was displayed). From there, the next
level could be played by starting the game with the incremented level.
Now, the program automatically starts playing the next level after the
previous level was successfully solved.
This new setup option is enabled by default now, changing the previous
default behaviour of the program.
Holger Schemel [Thu, 21 Jun 2018 06:26:16 +0000 (08:26 +0200)]
removed duplicate code
Holger Schemel [Thu, 21 Jun 2018 05:19:03 +0000 (07:19 +0200)]
added explicit level number parameter to high-score handling functions
Holger Schemel [Mon, 18 Jun 2018 21:13:12 +0000 (23:13 +0200)]
deactivated some debug messages
Holger Schemel [Mon, 18 Jun 2018 20:47:58 +0000 (22:47 +0200)]
replaced constants using #define with enum values
Holger Schemel [Mon, 18 Jun 2018 18:11:33 +0000 (20:11 +0200)]
moved debug output for player status to separate function
Holger Schemel [Sun, 17 Jun 2018 10:26:02 +0000 (12:26 +0200)]
fixed showing message request if local player stopped network game (finally)
With the previous fix (see commit with same commit message) for this
problem, the message request was still shown if the local player was
remapped to a different player in the actual level.
Holger Schemel [Sun, 17 Jun 2018 09:23:55 +0000 (11:23 +0200)]
fixed selecting correct player in single player mode (after network gaming)
When playing levels that contain more than one player in single player
mode, selecting the actual player when starting the level worked
correctly before only if the game was always played in single player
mode since it was started. It did not work correctly in the following
special case: There was a network multi-player game played before, but
the other (remote) client has disconnected (quit the game), leaving the
other client with a local player that might not be the first player.
In this case, using the first active player (which could be the first
player in the level) for the local player (which could be the second
player, because the network client was started after the now
disconnected client) would result in a broken player mapping, so the
player in the game cannot be moved.
This bugfix solves the problem by not using the first active player,
but the local player.
Holger Schemel [Thu, 14 Jun 2018 22:01:30 +0000 (00:01 +0200)]
improved handling network errors (show message instead of stopping program)
Holger Schemel [Thu, 14 Jun 2018 17:43:19 +0000 (19:43 +0200)]
removed preprocessor definition for network mode that is always true now
Holger Schemel [Thu, 14 Jun 2018 06:38:19 +0000 (08:38 +0200)]
added separate network info structure for network options and setup values
Holger Schemel [Wed, 6 Jun 2018 22:12:28 +0000 (00:12 +0200)]
added support for cursor keys and joystick to network player request dialog
Holger Schemel [Wed, 6 Jun 2018 21:37:27 +0000 (23:37 +0200)]
re-arranged buttons to select network player in request dialog
Holger Schemel [Wed, 6 Jun 2018 21:07:18 +0000 (23:07 +0200)]
added support for keys 1 to 4 to select network player in request dialog
Holger Schemel [Wed, 6 Jun 2018 06:43:28 +0000 (08:43 +0200)]
fixed showing message request if local player stopped network game
Holger Schemel [Wed, 6 Jun 2018 06:28:10 +0000 (08:28 +0200)]
fixed re-opening request door after stopping network game
Holger Schemel [Tue, 5 Jun 2018 22:32:37 +0000 (00:32 +0200)]
moved setting preferred network player from game start to setup menu
When running the game in network game mode (via setup menu option or
command line option), do not ask for the preferred network player on
each start of the game, but use the player that can be configured in
the setup menu now.
Holger Schemel [Fri, 1 Jun 2018 17:03:58 +0000 (19:03 +0200)]
added setup option to enable network multi-player games
This is a work-in-progress change: The new setup option to enable
network mode just sets the same flag as using the command-line option
"--network" (without specifying a hostname or a port).
For local network games, and if UDP broadcasting works as it should
to auto-detect a local network server that is already running, this is
already sufficient to play network multi-player games.
What's still missing is a way to explicitly specify a network server
to also be able to play network games with hosts outside of the local
network (or if UDP broadcasting does not work correctly).
Holger Schemel [Fri, 1 Jun 2018 16:06:38 +0000 (18:06 +0200)]
added UDP broadcast to auto-detect network server in local network
Holger Schemel [Thu, 31 May 2018 11:26:51 +0000 (13:26 +0200)]
added some missing error handling and more detailed error messages
Holger Schemel [Thu, 31 May 2018 11:15:57 +0000 (13:15 +0200)]
code cleanup (handling of network socket activity)
Holger Schemel [Thu, 31 May 2018 11:04:13 +0000 (13:04 +0200)]
added handling SIGINT (Ctrl-C) to exit standalone network server
Holger Schemel [Wed, 13 Jun 2018 22:57:40 +0000 (00:57 +0200)]
added (optional) main menu buttons to insert or play solution tape
There is a difference to the already existing tape buttons to insert
or play a solution tape in that the main menu buttons are only drawn
if the current level really has a solution tape, while the tape buttons
are always drawn, regardless if the level has a solution tape or not.
Holger Schemel [Tue, 12 Jun 2018 20:25:52 +0000 (22:25 +0200)]
added the "return" and "escape" key to be simulated by global animations
Holger Schemel [Tue, 12 Jun 2018 20:03:51 +0000 (22:03 +0200)]
added event actions (by simulating keyboard input) for global animations
This change adds more event actions to the "anim_event_action" option
for clickable global animations, this time adding simulated keyboard
input by specifying a key symbol for the key to be simulated.
For example, you can now use:
global.anim_1.part_1.MAIN.anim_event: click
global.anim_1.part_1.MAIN.anim_event_action: XK_Return
When clicking this global animation (on the main menu screen), the
currently selected/highlighted menu item will be chosen/executed.
To get the key symbol/name for the key to be simulated, just choose
the desired key as a keyboard shortcut in the setup menu (temporarily
only) and look at the resulting entry in the file "setup.conf" in the
game's configuration and personal data directory.
Holger Schemel [Mon, 11 Jun 2018 20:02:30 +0000 (22:02 +0200)]
fixed compiler warning due to missing function declaration
Holger Schemel [Mon, 11 Jun 2018 19:48:30 +0000 (21:48 +0200)]
added being able to generally set global animations to passthrough clicks
Before, the "passthrough_clicks" option was limited to allow mouse
clicks on global animations to be passed through to the mouse sensitive
screen controls, but not to other global animations.
Now, stacked global animations can all receive mouse clicks if those
global animations overlapping them are set to "passthrough_clicks".
Holger Schemel [Mon, 11 Jun 2018 19:10:05 +0000 (21:10 +0200)]
added "multiple_actions" option for clickable global animations
This change adds a new option for the "graphicsinfo.conf" file to be
able to explicitly allow multiple event actions for clickable global
animations, which is deactivated by default to prevent unwanted side
effects. This would make it possible to trigger two actions that make
sense when executed at the same time, like triggering the "play" and
"pause" buttons of the tape recorder together, for example.)
The new option works like this (with "global.anim_1.part_1.MAIN" also
being defined):
global.anim_2.part_1.MAIN.anim_event: click:anim_1.part_1
global.anim_2.part_1.MAIN.anim_event_action: some.action
global.anim_2.part_1.MAIN.style: multiple_actions
global.anim_3.part_1.MAIN.anim_event: click:anim_1.part_1
global.anim_3.part_1.MAIN.anim_event_action: another.action
When clicking the first global animation (on the main menu screen),
there might be two or more other global animation which are triggered
by clicking the first animation and which each execute their own event
action when triggered. (The style "multiple_actions" must be defined
for all animations that should *not* stop the chain of event actions
to be executed, so it's easiest to just define it for all animations
that should execute their event actions together when triggered.)
This option can be combined with "passthrough_clicks".
Holger Schemel [Mon, 11 Jun 2018 18:11:51 +0000 (20:11 +0200)]
added ignoring gadgets if click already caused animation event action
Before, even though executing more than one event action triggered by
clickable global animations was already prevented, further processing
of mouse clicks by gadgets at the same position was still performed if
the global animation style was set to "passthrough_clicks", which could
lead to more than one gadgets being triggered at the same time by a
single click on a clickable global animation, with potentially unwanted
side effects.
Now, mouse clicks that already triggered an event action (which could
be a gadget) are not processed by the standard gadget handling anymore.
Holger Schemel [Mon, 11 Jun 2018 18:03:07 +0000 (20:03 +0200)]
fixed order of handling mouse clicks on gadgets and on global animations
Before, gadgets were checked for clicks before global animations, which
caused clickable global animations to not be clicked if a gadget at the
same position was successfully clicked (because mouse events are forced
to be off-screen afterwards).
Now, clickable global animations are checked for mouse clicks before
gadgets, and they either consume the mouse click (so a gadget at the
same position will not receive the mouse click anymore), or they are
set to "passthrough_clicks" style (so a gadget at the same position
will still receive the mouse click).
Holger Schemel [Mon, 11 Jun 2018 17:33:59 +0000 (19:33 +0200)]
fixed potential bug with default step size when increasing/decreasing level
Holger Schemel [Sun, 10 Jun 2018 21:21:00 +0000 (23:21 +0200)]
added event actions (active screen elements) for global animations
This change adds more event actions to the "anim_event_action" option
for clickable global animations, this time adding active screen elements
(currently limited to a selection of screen elements in the main menu).
For example, you can now use:
global.anim_1.part_1.MAIN.anim_event: click
global.anim_1.part_1.MAIN.anim_event_action: menu.button_game
When clicking this global animation (on the main menu screen), the
game will be started (by triggering the "start game" menu button).
To dump a list of all available event actions for global animations,
blindly type the "cheat mode" style shortcut ":dump-event-actions" or
":dea" in the main menu.
Holger Schemel [Sun, 10 Jun 2018 13:52:16 +0000 (15:52 +0200)]
fixed handling passthrough option for clickable global animations
Holger Schemel [Sun, 10 Jun 2018 13:26:36 +0000 (15:26 +0200)]
fixed ignoring clicks on global animations after executing event actions
Holger Schemel [Sun, 10 Jun 2018 12:01:50 +0000 (14:01 +0200)]
improved function to dump identifiers for all gadgets on current screen
Holger Schemel [Fri, 8 Jun 2018 22:23:48 +0000 (00:23 +0200)]
added "passthrough" option for clickable global animations
This change adds a new option for the "graphicsinfo.conf" file for
defining a "passthrough" option for global animations that causes
clicks on clickable global animations not to be consumed, but to
be passed-through to the underlying screen controls (or other global
animations under the clicked global animation). The new option works
like this:
global.anim_1.part_1.MAIN.anim_event: click
global.anim_1.part_1.MAIN.style: passthrough_clicks
The second option is the new one (the first one already existed).
When clicking this global animation (on the main menu screen), the
click will passed-through to the main menu screen to be further
processed by screen controls like gadgets or menu buttons.
Holger Schemel [Fri, 8 Jun 2018 22:01:48 +0000 (00:01 +0200)]
added event actions (by triggering gadgets) for global animations
This change adds a new option for the "graphicsinfo.conf" file for
defining clickable global animations that trigger other actions
(currently limited to triggering active gadget buttons on the same
screen as the global animations). The new option works like this:
global.anim_1.part_1.MAIN.anim_event: click
global.anim_1.part_1.MAIN.anim_event_action: tape.button.record
The second option is the new one (the first one already existed).
When clicking this global animation (on the main menu screen), the
game will be started (by triggering the "record" button on the tape
recorder, which effectively starts playing the current level).
Holger Schemel [Fri, 8 Jun 2018 21:35:07 +0000 (23:35 +0200)]
added key shortcut to dump identifiers for all gadgets on current screen
Holger Schemel [Fri, 8 Jun 2018 21:27:20 +0000 (23:27 +0200)]
fixed state of inactive parts of global animations
Holger Schemel [Fri, 8 Jun 2018 21:22:32 +0000 (23:22 +0200)]
code cleanup