Commit graph

4937 commits

Author SHA1 Message Date
ziplantil 4f3b2a1520 make alast_* function-local 2019-07-28 01:41:37 +03:00
ziplantil f446790b03 optimize; abs no longer necessary 2019-07-28 00:49:30 +03:00
ziplantil 4eab54284c change palfx code; special only for all < 0 (cloak) 2019-07-28 00:42:37 +03:00
ziplantil 3753e5942d fix effect (on GL) when picking up cloak 2019-07-27 23:38:34 +03:00
Kp 98ad2402bf Fix Win32 build 2019-07-22 00:51:01 +00:00
Kp 03130aac2c Fix blank player names in multiplayer
Reading from Players[] while not in a game is not well-defined.  Get the
local player's callsign from InterfaceUniqueState instead.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/435>
Fixes: bea95ce1df ("Reset definedness of per-game globals on new game")
2019-07-20 20:08:29 +00:00
Kp a17792c89f Always initialize station_idx on level start
It is reinitialized if the segment is a special segment, but not
reinitialized if the segment is a normal segment.  Most segments are
normal segments.  The absence of this initialization permitted players
to keep the value from a prior level.  For normal segments, this would
normally not be a problem, because the value is only meaningful for
special segments.  However, the netgame synchronization code always
mixes in the value of every station_idx, regardless of whether the
segment is a special segment.  As a result, late-joining guests who
started directly onto the current level could disagree with the host
about the value, causing a synchronization mismatch.  The host would be
wrong, but the guests would be blocked from joining.  For this purpose,
late-joining includes both people who joined the campaign late and
people who left the game and restarted the program, even if they had
previously been in the game.

Reported-by: OldSaltyGamer <https://forum.dxx-rebirth.com/showthread.php?tid=1098&pid=12630#pid12630>
[ Possibly also previously reported by LightWolf, but that report never
had enough information to proceed.  The report from OldSaltyGamer solved
this. ]
Fixes: 596ecbb38d ("Rename segment::value to segment::station_idx")
2019-07-20 18:24:24 +00:00
Kp ff9cff4fea Relax laser_parent_is_player check so that dead players match
Fixes: bfeca84bb8 ("Change object::signature to be a generation counter")
2019-07-18 02:06:45 +00:00
Kp b19149c7b3 Initialize Netgame name from InterfaceUniqueState
Players[] is not defined at this point.
2019-07-16 04:00:50 +00:00
Kp 4a9e027e02 Fix bug that ignored -pilot
Fixes: d03a6c44b8 ("Register new pilots on menu creation, not activation")
2019-07-16 04:00:50 +00:00
Kp 41f4e84261 Move Stolen_item_index into d_thief_unique_state 2019-07-16 04:00:50 +00:00
Kp a2560cdfb5 Move Stolen_items into d_thief_unique_state 2019-07-16 04:00:50 +00:00
Kp d2da218f94 Remove apply_damage_to_robot swapping of Stolen_items
It has always been here, but appears to serve no purpose.
`multi_explode_robot_sub` clears `Stolen_items`, so at first look, this
swap seems to be preserving the prior values.  However,
`multi_send_robot_explode` does not use `Stolen_items`, and after
`multi_send_robot_explode` completes, `Stolen_items` is explicitly wiped
again.  Thus, removing the whole block will let the wipe performed by
`multi_explode_robot_sub` stand, producing the same result with less
code.
2019-07-16 04:00:50 +00:00
Kp 91bb7e533c Move player::hostages_total to d_game_unique_state
The number of hostages in a game is a function of the the game's levels,
not any particular player.  Move it to d_game_unique_state and rename it
to total_hostages.
2019-07-16 04:00:50 +00:00
Kp 8f475021ca Move player::hostages_level to d_level_unique_object_state
The number of hostages on a level is a function of the level, not any
particular player.  Move it to d_level_unique_object_state and rename it
to total_hostages.
2019-07-16 04:00:50 +00:00
Kp 2ca2de6ee7 Move player::num_robots_total to d_game_unique_state
The number of robots accumulated in a game is a function of the the
game's levels, not any particular player.  Move it to
d_game_unique_state and rename it to accumulated_robots.
2019-07-16 04:00:50 +00:00
Kp a24de0c003 Move player::num_robots_level to d_level_unique_object_state
The number of robots accumulated on a level is a function of the level,
not any particular player.  Move it to d_level_unique_object_state and
rename it to accumulated_robots.
2019-07-16 04:00:50 +00:00
Kp 46a327eb35 Move relocated player data to wrapper type 2019-07-16 04:00:50 +00:00
Kp e33aaa7537 Make init_player_stats_level static 2019-07-16 04:00:50 +00:00
Kp c61dee7e6a Move Boss_teleport_interval to d_level_shared_boss_state 2019-07-13 22:28:57 +00:00
Kp 595c3ca086 Move Boss_cloak_interval to d_level_shared_boss_state 2019-07-13 22:28:57 +00:00
Kp b47f84ffd4 Move Gate_interval to d_game_unique_state 2019-07-13 22:28:57 +00:00
Kp 9df482a423 Move Last_gate_time to d_level_unique_boss_state 2019-07-13 22:28:57 +00:00
Kp 46e7f8e3d5 Backport Descent 2 change to ignore objects in AI visibility 2019-07-13 22:28:57 +00:00
Kp a65e461bb6 Restore D1 boss always-teleport in D1 missions
In Descent 1, up until commit 8291391, boss robots teleported without
regard to whether the player was visible or active.  Commit 8291391
changed that in an attempt to make the D2 emulation of D1 boss robots
behave well in levels that relied on the D2 quirk of spawning the boss
in a confined segment, then letting it teleport freely once the player
releases it.  However, that change applied even in D1 missions and in
the D1 engine, where maps were designed with the expectation that boss
robots teleported routinely.  Restrict the new rule to the D2 engine
playing D2 levels.  This enables boss robots to teleport freely on D1
missions, regardless of which engine is used.  It would be better if
there were a level flag explaining whether the author wanted the boss to
teleport freely, but there is no such flag, so this heuristic must
suffice.

Reported-by: TheMiracleMatter <https://github.com/dxx-rebirth/dxx-rebirth/issues/434>
Fixes: 8291391b7f ("Fix D2 emulation of D1 boss teleport handling")
2019-07-13 22:28:57 +00:00
Kp 7bd861e374 Only death-spew armed proximity bombs in multiplayer
Commit 829e95b6 meant to remove the restriction that the game not be
hoard mode, but incorrectly also removed the restriction that the game
be multiplayer.  Restore the multiplayer restriction.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/433>
Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
2019-07-12 02:01:53 +00:00
Kp d413a5da13 Initialize powerup flags at level load 2019-07-07 22:00:02 +00:00
Kp a10077f2ec Skip setting contains_type/contains_id on objects that contain nothing
If the count is zero, then the type and id should be undefined.
2019-07-07 22:00:02 +00:00
Kp 01eb585c7a Set matcen_creator on loaded robots
This avoids a Valgrind warning for use of an uninitialized field.
2019-07-07 22:00:02 +00:00
Kp eeb310467b Fix SDL-only link failure 2019-07-07 22:00:02 +00:00
Kp fcd2ce1b47 Fix SDL-only build of render.cpp 2019-07-07 22:00:02 +00:00
Kp 86053852dc Fix build of SDL-only gr.cpp 2019-07-07 22:00:02 +00:00
Kp 8d349dd0c1 Include pilot name in window caption 2019-07-07 22:00:02 +00:00
Kp 0c7de10512 Track chosen pilot name outside Players[]
Players need not be defined outside a game, but the pilot's name needs
to be available outside a game.  Therefore, track it outside Players[].
2019-07-07 22:00:02 +00:00
Kp bfeca84bb8 Change object::signature to be a generation counter
This removes the need to walk all objects when creating a new one, since
each object can have a private generation counter, unaware of other
objects.  For compatibility with demos, mix in the object's index when
writing the signature value.
2019-07-07 22:00:02 +00:00
Kp efc071e830 Make init_player_stats_ship static 2019-07-07 22:00:02 +00:00
Kp d750b25073 Avoid copying background to itself
`init_new_page` calls `load_briefing_screen` with the a pointer to
`br->background_name`, which causes a strncpy of the form

```
	strncpy(X, X, N);
```

Valgrind warns for this overlap.  The copy is useless in that case, so
skip it.
2019-07-07 22:00:02 +00:00
Kp 597cb41717 Downgrade PCX failures from Error to CON_URGENT
There is no need to kill the program due to a missing or malformed PCX file.
2019-07-07 22:00:02 +00:00
Kp 3a0cca001f Limit size of PCX files 2019-07-07 22:00:02 +00:00
Kp 75de1c23c1 Reduce ship rocking during countdown
A prior change switched to using the greater, rather than the lesser, of
`16` or `Countdown_seconds_left`, which increased the rotation from the
ship rocking effect.  Switch back to use the lesser value.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/431>
Fixes: 644d6fa513 ("Simplify do_countdown_frame ship rocking effect")
2019-06-28 01:14:36 +00:00
Kp 1eaaff3016 Move Difficulty_level to GameUniqueState 2019-06-27 03:26:20 +00:00
Kp 61755f4d68 Factor out difficulty adjustment to energy usage 2019-06-27 03:26:20 +00:00
Kp ba3d3107bc Backport auto-select of vulcan when energy exhausted
This was added to D2, but is useful in both games.  Apply it in D1, too.
2019-06-27 03:26:20 +00:00
Kp a4f06f1f51 Backport MK's mega/lava fix to D1 2019-06-27 03:26:20 +00:00
Kp cfb481c74a Add experimental support for guidebot in multiplayer
This was requested by a user in early 2018.  However, the proposed
prototype was susceptible to various forms of desynchronization, and was
unsuitable for merging.  No further revisions were proposed, and the
feature languished.  This commit enables the guidebot in cooperative
games and addresses the known synchronization problems, as well as some
other bugs that were uncovered during light testing.  This is classified
as an experimental feature because it has not been heavily tested in
complicated games.

Requested-by: cfeuersaenger <https://github.com/dxx-rebirth/dxx-rebirth/issues/364>
2019-06-27 03:26:20 +00:00
Kp bea95ce1df Reset definedness of per-game globals on new game 2019-06-27 03:26:20 +00:00
Kp 644d6fa513 Simplify do_countdown_frame ship rocking effect 2019-06-27 03:26:20 +00:00
Kp 171ad60262 Fix some type mismatches using player_path_set_orient_and_vel 2019-06-27 03:26:20 +00:00
Kp d03a6c44b8 Register new pilots on menu creation, not activation 2019-06-27 03:26:20 +00:00
Kp f1878254df Simplify automap drawing of other players 2019-06-27 03:26:20 +00:00