Commit graph

4177 commits

Author SHA1 Message Date
Kp 10aa2e5106 Move some kconfig symbols into namespace dsx 2016-12-22 05:21:16 +00:00
Kp 0109355ae0 Switch kconfig_handler to D2 mouse button semantics
Presumably, D2 switched to EVENT_MOUSE_BUTTON_UP for a good reason.
Switch D1 to that rule too.
2016-12-22 05:21:16 +00:00
Kp bb6b548540 Remove unused listbox_get_window 2016-12-22 05:21:16 +00:00
Kp 44d1536969 Narrow scope of state_restore_all_sub variables
The previous attempt to assign defaults for values that the savegame
lacks was ignored because it overwrote a variable after the last read.
An early draft of that patch worked, but a last minute reorganization to
keep similar purpose code together made the change ineffective.

Narrow the scope of that variable and write to the correct variable.

Fixes: f62ed80205 ("Reset values that should have been in the savegame, but are not")
2016-12-21 03:54:18 +00:00
Kp 76c44b3a64 Mark DemoWBUType constexpr 2016-12-20 05:17:33 +00:00
Kp f62ed80205 Reset values that should have been in the savegame, but are not 2016-12-17 18:39:18 +00:00
Kp 171e87a1e7 Fix failure to unmap custom hogs 2016-12-17 18:39:18 +00:00
Kp 8eb295beeb Factor out get_console_color_by_priority gr_find_closest_color calls 2016-12-17 18:39:17 +00:00
Kp 4a01fab66d Fix failure to remove expired walls
std::remove_if can be called on an iterator that returns a proxy object,
but the results of that call are not generally useful.  When remove_if
attempts to move-assign over removed elements, it instead assigns over
the temporary proxy object.  If the proxy object has typical move
semantics, move-assigning over it has no effect on the underlying
container.

Revert to using partial_range on the underlying container.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/283>
Fixes: 1f434f98ad ("Use valptridx for ActiveDoors")
2016-12-11 23:47:40 +00:00
Kp b3809266a3 Use enumerate in more loops 2016-12-11 01:56:44 +00:00
Kp 17a50272f0 Pass player_info to more gauges functions 2016-12-11 01:56:43 +00:00
Kp 2cd4fdc70b Fold show_homing_warning call to hud_gauge_bitblt 2016-12-11 01:56:43 +00:00
Kp 06034a53f9 Print key kill goal statistics to console
When the reactor is forcibly destroyed by the kill goal code, print to
the console and the game log the data that players could otherwise
capture with a screenshot of the network player information.
2016-12-10 17:51:11 +00:00
Kp 3e2150c470 Remove some of the weirder quirks of timeout killgoal handling
Require that at least one player have at least one kill.  If all players
have at most zero kills, return without declaring a winner.
2016-12-10 17:51:11 +00:00
Kp 87be333d29 Fold automap pause_game setup 2016-12-10 17:51:11 +00:00
Kp 0169f10728 Pass player_info to gauge functions 2016-12-10 17:51:10 +00:00
Kp 6fbcef75b1 Pass player object to draw_hud 2016-12-10 17:51:10 +00:00
Kp 83043ebd72 Pass player_info to compute_vis_and_vec 2016-12-10 17:51:10 +00:00
Kp e669e71dda Pass player_info to ai_fire_laser_at_player 2016-12-10 17:51:10 +00:00
Kp 442af298cb Pass player_info to allowed_to_fire_missile 2016-12-10 17:51:10 +00:00
Kp 7e6c9fb172 Pass player_info to allowed_to_fire_flare 2016-12-10 17:51:10 +00:00
Kp ad055dc60e Fold calls to hud_printf_vulcan_ammo
The conditional is a bit ugly due to the D1 test.

--------

    #include <cstdio>

    void hud_printf_vulcan_ammo(int mline, int x, int y, int line = __builtin_LINE())
    {
	    printf("mline=%2i line=%2i x=%2i y=%2i\n", mline, line, x, y);
    }

    void expanded_form(int full, int vertical, int mline = __builtin_LINE())
    {
	    const int x = 10, y = 20, line_spacing = 5;
	    if (full)
	    {
		    if (!vertical)
			    hud_printf_vulcan_ammo(mline, x, y - line_spacing);
    #if defined(DXX_BUILD_DESCENT_I)
		    else
			    hud_printf_vulcan_ammo(mline, x, y);
    #endif
	    }
	    else
		    hud_printf_vulcan_ammo(mline, x - 2, y - 3);
    }

    void folded_form(int full, int vertical, int mline = __builtin_LINE())
    {
	    const int x = 10, y = 20, line_spacing = 5;
	    int vx, vy;
	    if (full ? (
		    vertical ?
    #if defined(DXX_BUILD_DESCENT_I)
		    (vx = x, vy = y, true)
    #else
		    false
    #endif
		    : (vx = x, vy = y - line_spacing, true)
		    ) : (vx = x - 2, vy = y - 3, true))
		    hud_printf_vulcan_ammo(mline, vx, vy);
    }

    int main()
    {
    #define run(f)	\
	    f(0, 0);	\
	    f(1, 0);	\
	    f(0, 1);	\
	    f(1, 1)
	    run(expanded_form);
	    run(folded_form);
    }

--------
2016-12-10 17:51:09 +00:00
Kp fe0c97ebb9 Move Player_eggs_dropped to player_info 2016-12-10 17:51:09 +00:00
Kp c7634a1923 Move Auto_fire_fusion_cannon_time to player_info 2016-12-10 17:51:09 +00:00
Kp 51b06f6cdc Move Fusion_charge to player_info
This eliminates some ugly hacks regarding remotely generated fusion
shots.
2016-12-10 17:51:09 +00:00
Kp 117e205ff0 Fold spreadfire calls to Laser_player_fire_spread 2016-12-10 17:51:09 +00:00
Kp 2646bfe005 Fold Fusion_charge PALETTE_FLASH_ADD calls 2016-12-10 17:51:08 +00:00
Kp ccd71dd579 Remove unnecessary scores_maybe_add_player close of Game_wind
scores_maybe_add_player might close Game_wind, if it does not return
early.  All two callers unconditionally close Game_wind.  Remove the
unnecessary closure in scores_maybe_add_player.
2016-12-10 17:51:08 +00:00
Kp 4cec1910e2 Propagate scores_maybe_add_player argument 2016-12-10 17:51:08 +00:00
Kp a88eb5867d Fold score saying copy 2016-12-10 17:51:08 +00:00
Kp 1f434f98ad Use valptridx for ActiveDoors 2016-12-10 17:51:08 +00:00
Kp 6c85086a43 Pass vcsegptridx to multi_send_light_specific 2016-12-10 17:51:07 +00:00
kreatordxx 62abd810a4 Merge pull request #282 from dxx-rebirth/demo_fix
Fix freeze when aborting game while demo is recording
2016-12-08 13:22:24 +08:00
Kp 6e03e6b4c1 Add hack to compensate for memdebug premature scan 2016-12-08 03:32:06 +00:00
Chris Taylor 17ca665ed5 Only return window_event_result::deleted from game_handler when Game_wind was deleted in that call of game_handler
Fixes freeze when aborting game while demo is recording
2016-12-07 09:38:03 +08:00
Kp 515476f02b Propagate constant third parameter of call_object_create_egg 2016-12-05 00:26:11 +00:00
Kp 0fb59c225c Move add_points_to_score into namespace dsx 2016-12-05 00:26:10 +00:00
Kp e0f6077afa Pass vcsegidx to render_mine 2016-12-05 00:26:10 +00:00
Kp d7ea84aa36 Pass vcsegidx to multi_send_boss_teleport 2016-12-05 00:26:10 +00:00
Kp 31f330c0ff Pass vcsegidx to multi_send_door_open_specific 2016-12-05 00:26:10 +00:00
Kp fe44705d2d Pass vcsegidx to multi_send_effect_blowup 2016-12-05 00:26:10 +00:00
Kp 6bffe9949e Pass vcsegidx to multi_send_create_powerup 2016-12-05 00:26:09 +00:00
Kp 82b068bf9c Pass vsegidx to multi_send_door_open 2016-12-05 00:26:09 +00:00
Kp 67afde75e3 Fold net_udp_send_door_updates calls to multi_send_door_open 2016-12-05 00:26:09 +00:00
Kp b5be5f2099 Pass vcwallptridx to multi_send_hostage_door_status
Avoid recomputing the wall pointer that the caller already had.
2016-12-05 00:26:09 +00:00
Kp 3fc128607c Pass vsegidx_t to disable_flicker 2016-12-05 00:26:09 +00:00
Kp c035f5e93f Pass segidx_t to create_path_points 2016-12-05 00:26:09 +00:00
Kp c60d93326c Propagate constant third parameter of create_n_segment_path_to_door 2016-12-05 00:26:08 +00:00
Kp b696d8cf22 Pass segidx_t to create_n_segment_path 2016-12-05 00:26:08 +00:00
Kp d8a1428f13 Pass segidx_t to init_ai_object 2016-12-05 00:26:08 +00:00
zico bfe6149cdb Fixed regression from 6e20d86941 in which flag OF_PLAYER_DROPPED in drop_powerup would only be set for OBJ_ROBOT but not OBJ_POWERUP, making the Guidebot unable to locate player spew 2016-12-04 21:39:03 +01:00
zico 34b24c0d69 Fixed regression from d1x-rebirth 0.57.3: Properly read out flat poly color for morph models from model data 2016-12-04 21:21:49 +01:00
zico ffb68756e3 Changed handling of scrape_player_on_wall(), preventing it to occur multiple times per frame. 2016-12-02 13:37:08 +01:00
Kp f8cc32a4af Merge pull #272 into master 2016-11-26 22:51:49 +00:00
Kp 6153fc6f8d Recharge omega cannon on entering new level 2016-11-26 22:51:49 +00:00
Kp 329ff67718 Raise D1 MAX_DOORS to match D2 2016-11-26 22:51:49 +00:00
Kp 66d946f5f7 Use std::find_if in wall_close_door to search ActiveDoors 2016-11-26 22:51:48 +00:00
Kp ecdefd93ad Use std::find_if in wall_open_door to search ActiveDoors 2016-11-26 22:51:48 +00:00
Kp ad806a8251 Reorder newmenu length test to skip key_ascii() call 2016-11-26 22:51:48 +00:00
Kp 46ffb9d3f8 Use remove_if to remove obsolete open doors 2016-11-26 22:51:48 +00:00
Kp ac5ccf0c08 Pass active_door &to wall_close_door_num 2016-11-26 22:51:48 +00:00
Kp 1acee2d4f4 Remove unused wall_close_door 2016-11-26 22:51:48 +00:00
Kp 5c62f63606 Factor out active_door removal 2016-11-26 22:51:47 +00:00
Kp be706e190e Move wall_close_door_num copy loop up
There are two callers for wall_close_door_num.  The editor calls it in a
loop for all doors, so copying each active_door is wasteful since none
will survive the end of the loop.  Move the copy loop into the caller
that removes elements selectively.

This makes no attempt to fix the bugs associated with changing
Num_open_doors while iterating with Num_open_doors as an upper bound.
2016-11-26 22:51:47 +00:00
Kp 64ac7028e6 Pass active_door &to do_door_{open,close} 2016-11-26 22:51:47 +00:00
Kp 8bd9ec6360 Use range_for in do_door_close 2016-11-26 22:51:47 +00:00
Kp a129a0d570 Add ID for robot earthshaker secondary missile
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/273>
2016-11-26 22:51:47 +00:00
Kp bf662e0bcc Initialize track_goal for homing weapons
Kreator reported an uninitialized value crash when robots fired homing
weapons.  No path assigned a value for track_goal, so it had a default
value of 0 (non-poison builds) or 0xfdfd (poison builds).  Assign it a
value of object_none when the created weapon is a homing weapon.  Leave
it unassigned for non-homing weapons, since those should never examine
track_goal.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/274>
2016-11-26 22:51:46 +00:00
Kp e56160a021 Print warning for unhandled weapon types 2016-11-26 22:51:46 +00:00
Kp 48ac006c59 Remove obsolete and broken DOOR_DEBUGGING code
This code has been #ifdef'd out since 2002, relied on implicit-int in
its declaration (deprecated in C, forbidden in C++), and has been broken
for years due to vms_vector changes.  Remove it.
2016-11-26 22:51:46 +00:00
Chris Taylor bf6eb99d7a When switching to the editor in a game, use a proper saved game
This preserves virtually all game information, including active fire. The saved game 'gamesave.sge' can also be loaded with File->Restore Game State. The level can still be saved as usual (but it warns the user if there's an unsaved game state). This functionality may be useful for testing (or cheating! ;) )
2016-11-21 15:22:11 +08:00
Chris Taylor 2995cb628c Never set Current_level_num to 0
This will be required when proper game state editing is implemented. Also remove hacks that check Current_level_num == 0.
2016-11-21 15:22:11 +08:00
Kp 8817307f23 Create duplicate powerups with movement MT_NONE
zicodxx reported an assertion failure when powerup duplication was
enabled.  Local debugging shows that some levels give preplaced powerups
a movement type of MT_NONE rather than MT_PHYSICS.  Such powerups have
undefined data in their mtype.phys_info branch, which confuses the
physics simulation code.  Powerups only need MT_PHYSICS to bounce away
from their spawn site.  Preplaced powerups never move.

Add assertions that preplaced powerups are MT_NONE.  Change the
duplication call to create the duplicates with movement MT_NONE.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/268>
2016-11-20 23:12:01 +00:00
Kp 0c219e596e Use enum for object movement type 2016-11-20 23:12:00 +00:00
Kp 4497812674 Use enum for object type 2016-11-20 23:12:00 +00:00
Kp e4afb78124 Fix undefined access to ai_info of non-robots
Only robots have ctype.ai_info.  Skip the sniper special case for
objects that are not robots.
2016-11-19 18:09:26 +00:00
Kp 118ba7698a Always initialize Omega_charge in init_player_stats_new_ship
Some gauges views show the current Omega_charge even when the player
does not have an Omega cannon.  Initialize Omega_charge to 0 if the
Omega cannon is not granted.
2016-11-19 18:09:26 +00:00
Kp a70d1ac646 Pass player_info &to omega_charge_frame 2016-11-19 18:09:26 +00:00
Kp 85338cba5e Fix memory corruption starting multiplayer game
Various points in the game code call `hide_menus()`, then later use
`show_menus()` to reverse the effect.  If the forcibly hidden window is
deleted before `show_menus()` is called, the attempt to show it would
write to freed memory.  Add a hook to forget those windows when they are
deleted, so that `show_menus()` does not try to make them visible later.
2016-11-19 18:09:26 +00:00
Kp dc881ec12d Merge pull #266 into master 2016-11-19 18:09:26 +00:00
Kp cb1410dd95 Use valptridx for CloakingWalls 2016-11-19 17:24:54 +00:00
Kp a9d82352b8 Use find_if to search CloakingWalls in start_wall_decloak 2016-11-19 17:24:54 +00:00
Kp 1cebed13e3 Use find_if to search CloakingWalls in start_wall_cloak 2016-11-19 17:24:54 +00:00
Kp ea837408d6 Use remove_if to remove obsolete cloaked walls 2016-11-19 17:24:54 +00:00
Kp 495bf624d2 Shorten collide_weapon_and_controlcen hitobj test 2016-11-19 17:24:54 +00:00
Kp a4edf4817c Cache properties_init bitmap width 2016-11-19 17:24:53 +00:00
Kp 1f929796c3 Fix excess fusion reflection 2016-11-19 17:24:53 +00:00
Kp 8c4d24ea6f Shorten collide_robot_and_weapon hitobj test 2016-11-19 17:24:53 +00:00
Kp e0d24f242b Fix uninitialized signature access
`obj_get_signature()` examines all objects with a type other than
`OBJ_NONE` to find an unused signature.
`load_game_data()`->`read_object()` set an object's type before calling
`obj_get_signature()`, so `obj_get_signature()` would consider the
uninitialized signature of the newly loaded object for exclusion.
Reorder the initialization to compute the signature before the object is
given a type, then store the signature on the object after the poison
bytes (if any) are written.
2016-11-19 17:24:53 +00:00
Kp 382d337118 Switch obj_get_signature to std::any_of
Also, split the predicate into separate statements to improve the output
of analysis tools.
2016-11-19 17:24:53 +00:00
Kp 223a9dfd56 Pass grs_bitmap &to piggy_register_bitmap 2016-11-19 17:24:53 +00:00
Kp 47de4e2906 Pass grs_bitmap &to swap_0_255 2016-11-19 17:24:52 +00:00
Kp 7f9d54a241 Combine multi_endlevel_score player flags updates 2016-11-19 17:24:52 +00:00
Kp 716b320c34 Use utility d_enumerate for do_cloak_stuff 2016-11-19 17:24:52 +00:00
Kp bb135e546e Set Descent 1 paged out bitmaps to nullptr
Descent 2 sets nullptr in the bitmap data field.  Do the same in Descent
1 for consistency.
2016-11-19 17:24:52 +00:00
Kp 53edbee901 Propagate constant texmerge_init argument 2016-11-19 17:24:52 +00:00
Kp b43dcc1a52 Revert "Disable piggy_bitmap_page_out_all"
This reverts commit 3c20c24ac0.

Rebirth no longer contains the Descent memory manager, but Rebirth still
has many traces of the paging support used in the DOS version.  One of
the unfortunate and subtle traces of this support is that it allocates a
contiguous buffer for game data and loads many of the games bitmaps into
that buffer.  The buffer is large enough for most workloads, but not
all.  When the buffer is too small, it is discarded by
piggy_bitmap_page_out_all and rebuilt piecemeal to contain only what it
needs.  Fixing this would be nice, but the memory ownership rules are
messy.  The performance consequences of the legacy approach are not
sufficient to justify the effort to fix this properly.  Instead, revert
to the legacy design.
2016-11-19 17:24:51 +00:00
Chris Taylor a06316f11e Fix crash when pressing Meta key (or Command key for Macs) in editor 2016-11-15 17:20:35 +08:00
Chris Taylor 6df1b85b87 Fix error due to -Werror -Wmissing-declarations in write_mission
This error was reported for gcc. Also set file extension correctly for 'enhanced' missions (though currently unused). Also some tidying up in response to feedback.
2016-11-15 15:03:34 +08:00
Chris Taylor 0e0bc755be Write mission file when calling create_new_mission
This removes an ambiguity when loading a saved game - we need to know the mission descent version **before** calling LoadLevel in state_restore_all_sub (a chicken and egg situation if we go down the fake dummy mission path). This also creates a fully playable mission (albeit simple).
2016-11-14 21:42:35 +08:00
Kp 117d2f73e0 Merge branch github/master into master 2016-11-13 19:56:52 +00:00
Chris Taylor c6f5e91f4a Saved games from editor generated levels now work
Editor generated levels use the dummy mission created by create_new_mission.
2016-11-13 17:21:45 +08:00
Chris Taylor cf0065da34 More efficiently check if editor loaded properly from within a game 2016-11-13 13:34:13 +08:00
Chris Taylor cc3f35649f Change all occurrences of "Couldn't" to "Could not" for consistency ("Could not" is more common and wins).
Not touching TXT_COULDNT because it's stored separately in hog file.
2016-11-13 13:27:18 +08:00
Chris Taylor 9183bba508 Change pads local var in init_editor to static to save on space for 64 bit systems 2016-11-13 13:09:31 +08:00
Chris Taylor 7dd21e7564 Use wallptridx in wall_dialog_handler, removing need for separate index variable 'wd' 2016-11-13 13:04:00 +08:00
Chris Taylor 5f19a3cba9 Remove redundant checks and initialisations recently added for editor 2016-11-13 12:44:53 +08:00
Chris Taylor c075d9641c Merge branch 'master' into editor_fixes 2016-11-13 12:31:27 +08:00
zico 336df21d2c Change/Addition to dafd4a69be, adopting vKp's proposed solution (which I was too blind to notice): Instead of initializing segnum for object syncing, test for object type instead of segnum for obj_unlink() 2016-11-13 03:42:11 +01:00
Kp 73d014c048 Tighten getaddrinfo test
To recognize getaddrinfo as supported, require that the AI_* flags
passed to it be usable:
- AI_NUMERICSERV must be defined as a number or be undefined
- If ipv6=1, then AI_V4MAPPED and AI_ALL must be defined as numbers

When getaddrinfo is used, raise _WIN32_WINNT from 0x501 to 0x600.
Otherwise, lower it to 0x500.
2016-11-12 20:58:16 +00:00
Kp fd39a752dd Factor out cloaking wall utility loops 2016-11-12 18:10:10 +00:00
Kp 38fb4c9c9e Pass cloaking_wall &to do_{,de}cloaking_wall_frame 2016-11-12 18:10:10 +00:00
Kp e8f9f22635 Factor out do_{,de}cloaking_wall_frame common head/tail 2016-11-12 18:10:10 +00:00
Kp b4b0de8801 Cache uvl pointers in do_decloaking_wall_frame 2016-11-12 18:10:10 +00:00
Kp c4a20b019e Simplify test for cloak_value change 2016-11-12 18:10:09 +00:00
Kp be08b119e6 Prepare do_cloaking_wall_frame for future work
Move the wall reference member into a structure, so that future work can
initialize front/back data in a cleaner way.
2016-11-12 18:10:09 +00:00
Kp c54948f916 Eliminate some wback tests in cloaking wall code 2016-11-12 18:10:09 +00:00
Kp f208a8490f Move do_cloaking_wall_frame demo test up 2016-11-12 18:10:09 +00:00
Kp fdc0575133 Cache goal textures
Find the index of the red/blue/hoard goal textures once when
multi_apply_goal_textures starts, instead of each time a goal segment is
found.
2016-11-12 18:10:09 +00:00
Kp 36f23e8d60 Use enum class for multi_send_endlevel_start 2016-11-12 18:10:09 +00:00
Kp 7a0a20d455 Remove secret-level flag in D2 MP message
It is always zero.
2016-11-12 18:10:08 +00:00
Kp f6ca0abf5f Fold multi_do_escape flag handling 2016-11-12 18:10:08 +00:00
Kp 6838ffaa95 Move Omega_recharge_delay to player_info 2016-11-12 18:10:08 +00:00
Kp 7064a56788 Track omega recharge delay as relative time
This fixes two problems on systems where sizeof(int) < sizeof(fix64)
(which applies on most systems).

Normally, the omega cannon does not charge for ~1/3 of a
second after firing stops.

The first problem is that, if (Last_omega_fire_time + 1/3 second)
exceeds 0x80000000 (about 9.1 hours), truncation issues confuse this
rule into not applying, thus allowing the omega cannon to charge
whenever energy is available, even while firing.

The second problem is that, if GameTime64 exceeds 0x8000000000000000
(about 4459701.8 years), a sanity check that attempted to compensate for
the incorrect tracking of Last_omega_fire_time would confuse the
recharge rule into deciding that the user had always fired recently,
which would prevent the omega cannon from ever recharging.  The sanity
check would reset Last_omega_fire_time when Last_omega_fire_time was in
the future relative to GameTime64.  Unfortunately, Last_omega_fire_time
was only an int, so the reset truncates off the high bits of GameTime64.
This truncation is harmless when GameTime64 is less than 0x80000000,
causes the first problem when GameTime64 is not less than 0x80000000,
but is positive, and causes the second problem when GameTime64 is
negative.

These problems were mitigated in prior releases by three factors.  First,
a hack resets GameTime64 when restoring from a saved game, so the
affected game needs to run for ~9.1 hours (or ~4459701.8 years) without
reloading.  Second, starting a new level resets GameTime64, so the game
needs to stay on a single level for ~9.1 hours (or ~4459701.8 years).
Third, the omega cannon discharges faster than it can recharge, so even
when the first bug allowed it to charge while firing, a player could
still drain Omega_charge to zero by continuous firing.  However, it
would take longer to drain due to the bug-induced concurrent recharge,
and would not be subject to the 1/3 second wait normally imposed between
depleting Omega_charge and recharge beginning.

Fix these problems by replacing Last_omega_fire_time with
Omega_recharge_delay, which is 0 when recharging is allowed or a
positive amount of frame time if recharging is disallowed due to recent
firing.  Set Omega_recharge_delay to 1/3 second when the user fires.
Decrease it by up to FrameTime when omega_recharge_frame runs.

This does not fix the preexisting problem that reloading a savegame does
not update the recharge delay, which manifests two related problems.
First, firing the omega cannon and then loading a game will bring the
delay through into the save, whether or not the user had been firing
just before saving.  Second, not firing the omega cannon and then
loading a game will allow the user to fire immediately on load, even if
the user had been firing when the game was saved.  Future work can
address the first problem by clearing the delay, but a savegame file
modification is required to address the second problem.

------------->8-------------

    #include <cstdio>

    int last_fire;
    long t64;
    /* The test program only shows the bug on 64-bit systems */
    static_assert(sizeof(last_fire) == 4, "sizeof(int) != 4");
    static_assert(sizeof(t64) == 8, "sizeof(long) != 8");

    void frame(bool expect_recharge, const unsigned line)
    /* clang does not support __builtin_LINE, so fake it with a macro
     */
    #define frame(E)    frame(E, __LINE__)
    {
	    if (last_fire > t64)
	    {
		    printf(__FILE__ ":%u:%u:                        last_fire=%8x t64=%16lx: last_fire > t64, resetting\n", __LINE__, line, last_fire, t64);
		    last_fire = t64;
	    }
	    const int time_bias = 0x5555;
	    if (last_fire + time_bias > t64)
	    {
		    printf(__FILE__ ":%u:%u: %5sexpect_recharge=%i last_fire=%8x t64=%16lx: last_fire recent (%16lx), refusing to recharge\n", __LINE__, line, expect_recharge ? "BUG: " : "", expect_recharge, last_fire, t64, static_cast<long>(last_fire + time_bias));
		    return;
	    }
	    printf(__FILE__ ":%u:%u: %5sexpect_recharge=%i last_fire=%8x t64=%16lx: last_fire old    (%16lx), recharging\n", __LINE__, line, expect_recharge ? "" : "BUG: ", expect_recharge, last_fire, t64, static_cast<long>(last_fire + time_bias));
    }

    int main(int, char **)
    {
	    frame(false);
	    t64 = 0x7fff;
	    frame(true);
	    last_fire = t64 - 4;
	    frame(false);
	    t64 = 0x7fffaaab;
	    frame(true);
	    last_fire = t64;
	    ++t64;
	    frame(false);
	    t64 = 0x7ffffffffd;
	    frame(true);
	    last_fire = t64;
	    ++t64;
	    frame(false);
	    t64 += 0x10000;
	    frame(true);
	    t64 = 0x7fffffffffffff00;
	    frame(true);
	    last_fire = t64;
	    frame(false);
	    t64 = 0x8000000000000000;
	    frame(true);
	    t64 += 0x800000000;
	    frame(true);
    }
2016-11-12 18:10:08 +00:00
Kp 72c13d101c Fold omega Next_laser_firing_time handling into do_laser_firing_player
Previously, do_laser_firing_player would update Next_laser_firing_time,
then do_omega_stuff would update it again.  OMEGA_BASE_TIME is smaller
than Weapon_info[OMEGA_ID].fire_wait, so the first store was overridden
by the second.  As a quirk, the override was skipped if the omega cannon
was unable to fire due to object limits or due to insufficient energy,
causing those rare cases to use the longer
Weapon_info[OMEGA_ID].fire_wait delay.

Fold the omega cannon handling of Next_laser_firing_time into
do_laser_firing_player to eliminate that quirk, simplify the code, and
remove the need to recompute fire_frame_overhead from
Last_omega_fire_time.
2016-11-12 18:10:08 +00:00
Kp 44867c637d Flatten creation of invalid valptridx
Constructing valptridx::basic_ptr with a known-invalid magic index does
not require an array.  Simplify the static_assert to reject uses of
factory functions with known-invalid magic index values.  Fix the two
sites that fail with the stricter static_assert.
2016-11-12 18:10:08 +00:00
Kp 61567eeed0 Move player::KillGoalCount to player_info 2016-11-12 18:10:07 +00:00
Kp 1060c8fabb Move player::net_kills_total to player_info 2016-11-12 18:10:07 +00:00
Kp 411b623aa7 Move player::net_killed_total to player_info 2016-11-12 18:10:07 +00:00
zico 8258532693 Do not process tracker timeout if we're a client (which doesn't get any ACKs) 2016-11-12 15:56:49 +01:00
zico b508e2a294 Restrict powerup repopulation for Multiplayer as well as sending and processing of inventory packets to NETSTAT_PLAYING consistently. 2016-11-12 15:55:37 +01:00
zico dafd4a69be Fixed and revamped 30f9233b36e9e546a7479fd152331b7b0d689d47: initialize segnum for objects during object syncing only. Should only be required for OBJ_NONE but since net_udp_read_object_packet() does only process changed objects and setting segnum in init_objects() isn't desired, this initialization is applied to all objects (except the host player object) before the sync process. 2016-11-12 15:52:16 +01:00
Chris Taylor 6757d89238 Fix crash in editor when trying to unlink a door that isn't linked 2016-11-12 17:30:36 +08:00
Chris Taylor eeb3303b95 Fix crash in editor when trying to link wall with no Markedsegp 2016-11-12 17:28:26 +08:00
Chris Taylor 95fcee9474 Fix crash when removing a wall in the editor
Only update wall_num if != wall_none.
2016-11-12 17:19:38 +08:00
Chris Taylor 4568bbae11 Don't crash when building segment bridge in editor the wrong way
Check if there is Markedsegp and replacing an Assert with a LevelError.
2016-11-12 16:41:54 +08:00
Chris Taylor ac52a30214 Fix spurious exploding wall and crash when playing a level loaded with the editor
When File->'Play in 320x200' is chosen, use StartNewGame(Current_level_num). For now use create_new_mission and Current_level_num = 1 every time. Also remove the now redundant hacks GM_EDITOR and editor_reset_stuff_on_level.
2016-11-12 15:38:38 +08:00
Chris Taylor bae558b2e1 Fix selection in the game view for the editor
build_segment_list and build_object_lists are now required for _search_mode as well (i.e. required for every frame), as the segment list is no longer a set of global variables.
2016-11-11 16:09:57 +08:00
Chris Taylor ac438f4cc2 Allow the user to carry on as usual if any of the editor files are missing (i.e. before editor was loaded).
If a game was playing, continue playing. If it was in the main menu, return to the main menu. (If all files are put in place the editor can load again.)
2016-11-11 16:09:57 +08:00
Chris Taylor 46abf5f31f Set Game_wind to nullptr at the start of responding to EVENT_WINDOW_CLOSE in game_handler
This prevents newdemo_stop_playback from attempting to close Game_wind, which results in it being freed twice - in particular when switching to the editor (via delete-E) when playing a demo.
2016-11-11 16:09:57 +08:00
Chris Taylor b8b19baa92 Make sure wall dialog and hostage dialog close properly
When responding to EVENT_WINDOW_CLOSE, set MainWindow to nullptr - fixing multiple issues with these dialogs including the inability to re-open them and a crash on exiting the editor.
2016-11-11 16:09:57 +08:00
Chris Taylor 396f1e47f0 Do Wall Dialog now works with no wall selected 2016-11-11 16:09:57 +08:00
Chris Taylor d41146bcbd Set default object index for object dialog
This prevents the Object Editor from crashing when no object is selected (Cur_object_index == object_none).
2016-11-11 16:09:57 +08:00
Kp b19e93cc04 Skip tracking idx in obj_get_signature 2016-11-10 04:22:19 +00:00
Kp 930c4c6a99 Remove write-only variable multi_goto_secret
multi_goto_secret is read only to decide whether to write a new value to
it, but never to change other control flow.
2016-11-10 04:22:19 +00:00
Kp ce193812d8 Reset Omega_charge when loading save games
If loading an pre-v22 save game, or loading any save where the player
died on the secret level, clear Omega_charge instead of retaining
whatever value the prior game used.
2016-11-10 04:22:18 +00:00
Kp 188ef99536 Assert that newly allocated objects are type OBJ_NONE 2016-11-10 04:22:18 +00:00
zico 30f9233b36 Reverted 2e6aa0f081 and partially reverted 7064fcccba to still allow segnum and signature init for multiplayer games, keeping consistency during object sync. 2016-11-08 14:16:26 +01:00
zico 5f21bdd71f In net_udp_game_connect, moved test for dl->gameid above test for timer. In udp_tracker_process_game removed redundant location of IP/Port delimiter, added another byte for termination of sIP, added size checks for sIP and sPort before actully copying them and added failsafe check for reading TrackerGameID. 2016-11-08 13:18:51 +01:00
Kp 1cb04cb64b Merge branch derhass:patches/GLES_GL_extension_unification into master 2016-11-06 19:24:52 +00:00
Kp a59de2860e Poison more undefined variables 2016-11-06 17:12:03 +00:00
Kp 7ccd537362 Fix build break from 30f9233
Commit 30f9233b36 introduced a test for
Game_Mode, which does not exist, rather than Game_mode, which does
exist.  However, the test for game mode is unnecessary.  Objects of type
OBJ_NONE are always in segment_none and no object of any other type
should be in segment_none.  Use that fact to test obj->type instead of
obj->segnum during multiplayer object clobber, so that multiplayer can
overwrite unallocated objects without accessing any undefined fields and
without making object::segnum a defined field.

Fixes: 30f9233b36 ("Reverted 2e6aa0f081 and partially reverted 7064fcccba to still allow segnum and signature init for multiplayer games, keeping consistency during object sync.")
2016-11-06 17:12:03 +00:00
Kp e231fb7d3a Restructure object linkage checks
Move the main part of obj_link into obj_link_unchecked.  Implement
obj_link as sanity check assertions followed by a call to
obj_link_unchecked.  Remove caller-side writes that were present solely
to bypass the assertions, since the assertions can now be bypassed by
calling obj_link_unchecked directly.
2016-11-06 17:12:03 +00:00
Chris Taylor 143ed30fee Merging in unification/master, resolving conflict in similar/main/kmatrix.cpp 2016-11-06 14:20:18 +08:00
Kp 46b1ea8fd5 Give full Omega_charge when omega cannon is granted 2016-11-05 21:22:44 +00:00
Kp 5f6d60bb7c Fix menu.cpp build when max_joysticks=0
menu.cpp always needs SDL.h, but included it only as a side effect of
joy.h including SDL.h.  joy.h only includes SDL.h when max_joysticks!=0.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/258>
2016-11-05 21:22:43 +00:00
derhass 551570d29b Unify OpenGL extension handling between OpenGL and OpenGL ES code paths.
Split ogl_get_verinfo() into ogl_tune_for_current() and
ogl_extensions_init(), and consolidate all the OpenGL extension handling
into ogl_extensions.cpp. Unify the code paths for texture anisotropy and
GPU synchronization for OpenGL and OpenGL ES.

Currently, our renderer only uses GLES 1.0, so no real world implementation
will support sync objects for such an old context, but the logic is valid,
and this way, the GLES specific code paths are reduced.

This patch also fixes an issue where the old ogl_get_verinfo() did modify
the texture filtering mode if no anisotropic filter was available. This
was some leftover from the time when the anisotropic filter was a just
a specific CGameConfig.TexFilt mode, and not a separate, orthogonal setting
CGameCfg.TexAnisotropy that it is now.
2016-11-03 21:59:11 +01:00
Kp a0cd8360bc Request v4-mapped v6 addresses instead of native v4 addresses 2016-11-02 03:58:25 +00:00
zico 730879d733 Updated handling of data sent by tracker. Added support for handling ACKs from tracker and Hole punching between game clients via tracker. Changed udp_dns_filladdr to not perform DNS lookup if requested which is used for broadcasts and IPs sent by tracker. Added text display on NETGAMES menu to indicating if a connection is in progress. Fixed issue allowing to select an invalid game on NETGAMES list. Upon cancelling a forming netgame, made sure tracke runregister packet is sent. Added function to verify tracker address to make sure incoming packets originate from expected trtacker address (and port). Slightly improved handling game data from tracker to be less prone to crash if receiving unexpected data. 2016-11-02 04:20:41 +01:00
zico 8bd3eaad4c Fixed misleading indentations. 2016-10-31 11:36:48 +01:00
zico 78ad83a134 Fixed compile-time errors when using use_udp=0. Still some warnings but it builds. 2016-10-31 11:21:59 +01:00
Chris Taylor 9511f65a90 Declare some local window_event_result vars later (clarity) 2016-10-31 14:58:34 +08:00
Chris Taylor 21e41b15a9 Use listbox_subfunction_t template for listbox_callback member (for convenience of possible future modification) 2016-10-31 14:35:29 +08:00
Kp 52667fae6c Merge branch derhass/patches/ogles-warning-cleanup
derhass reports that OpenGL ES builds warn for unused parameter
`texanis`.  This parameter controls a feature that is not available in
current Rebirth OpenGL ES builds.  Cast the parameter to void to silence
the warning.  Long term, the code ought to be changed to advise the user
when their platform lacks this feature.  In the short term, merge this
fix so that the build will succeed.

https://github.com/dxx-rebirth/dxx-rebirth/pull/256
2016-10-30 18:30:48 +00:00
Kp c73fd378c2 Merge branch derhass/patches/ogles-cast-cleanup
derhass reports that some OpenGL ES code was missed during the
conversion from old-style casts to C++ casts.  Merge the fixes for those
sites.

https://github.com/dxx-rebirth/dxx-rebirth/pull/255
2016-10-30 17:32:01 +00:00
zico 155e054f68 Merge branch 'unification/master' of github.com:dxx-rebirth/dxx-rebirth into unification/master 2016-10-30 03:18:39 +01:00
zico 3db9a8d999 Fixed ping display on HUD (no idea why it was multiplied by 44 - probably copy/paste mistake) 2016-10-30 03:18:15 +01:00
derhass b144badb11 fix old-style casts in the DXX_USE_OGLES code paths 2016-10-29 23:58:28 +00:00
derhass 1c756316cb fix a -Wunused-parameter warning in the DXX_USE_OGLES code path
The `texanis` parameter is not used in OpenGL ES, but in desktop GL.
2016-10-29 23:57:03 +00:00
Kp 8a2e15e20a Add message for when user disables full map cheat 2016-10-29 23:16:18 +00:00
Kp b75a2e4a68 Pass object &to obj_create_copy 2016-10-29 23:16:18 +00:00
Kp d8d7980a00 Simplify load_mine_data_compiled fuelcen iteration 2016-10-29 23:16:18 +00:00
Kp 5a69c09ec2 Move fuelcen_activate special assignment up
One caller uses fuelcen_activate when segp->special != station_type.
Every other caller passes the type that was already on the segment.
Move the assignment into the one caller that needs it, then remove the
argument.
2016-10-29 23:16:17 +00:00
Kp 65f9fd54f8 Use vcsegptr for build_object_lists 2016-10-29 23:16:17 +00:00
Kp e95db4c269 Fold move_away_from_player switch cases 2016-10-29 23:16:17 +00:00
Kp 33bba1fa61 Map boss-gated robots across players 2016-10-29 23:16:16 +00:00
Kp 2b9a86abe3 Factor out buddy hints about invulnerable boss 2016-10-29 23:16:16 +00:00
Kp 57196e8f9f Look up robot type in multi_send_boss_create_robot 2016-10-29 23:16:16 +00:00
Kp c45e441ecd Move map_objnum... into multi_send_boss_create_robot
Whenever a robot is sent to peers, it needs to be added to the local
mapping also.  Move the one use so far into multi_send_boss_create_robot
to simplify maintenance.
2016-10-29 23:16:16 +00:00
Kp c4cfe54010 Return literal object_none on object_none error path
gcc generates better code for:

	if (variable == magic_constant)
		return magic_constant;

than it does for:

	if (variable == magic_constant)
	    return variable;

even though the two have the same result.  Switch to the form which
generates slightly better code.
2016-10-29 23:16:15 +00:00
Kp 3081e69536 Pass grs_main_bitmap to gr_init_bitmap_alloc 2016-10-29 23:16:15 +00:00
Kp 19fd79d8ae Shrink cockpit_decode_alpha::cockpitbuf 2016-10-29 23:16:15 +00:00
Kp 499d0fbe6c Remove excess Players elements
This was present in the Descent 2 source release with no explanation and
no apparent purpose.  Its presence complicates various loops, so remove
it.
2016-10-29 23:16:14 +00:00
Chris Taylor 7ac820248c Use new event_process_all() for event loops that check for window_event_result::deleted (which is most of them) 2016-10-29 20:06:01 +08:00
Chris Taylor a62ca93498 Use a tracking variable for newmenu_do2 (and simpler) polling loop
Add 'track' method to dcx::window, which takes a bool and will set it to 'false' when the window closes. Use for newmenu_do2 and simpler newmenu_do's, since there's the possibility of another window without its own polling loop opening on top - meaning window_event_result::deleted would be returned for that window, not the one we're polling on.
2016-10-28 16:49:53 +08:00
Chris Taylor 54dbe586ee Check for window_event_result::deleted for do_briefing_screens polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:45:40 +08:00
Chris Taylor f1548e075e Check for window_event_result::deleted for show_title_screen polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:40:50 +08:00
Chris Taylor 49ce8dbb99 Check for window_event_result::deleted for gamebitmaps_viewer polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:30:58 +08:00
Chris Taylor 731777476f Check for window_event_result::deleted for polygon_models_viewer polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:29:14 +08:00
Chris Taylor b2513ab9a0 Check for window_event_result::deleted for kmatrix_view polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:27:45 +08:00
Chris Taylor 7f7047063a Check for window_event_result::deleted for credits polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:23:36 +08:00
Kp 4faca3012c Pass player_info to do_cloak_invul_secret_stuff 2016-10-28 03:39:42 +00:00
Kp adaa596672 Cache player object in DoEndLevelScoreGlitz 2016-10-28 03:39:42 +00:00
Kp d5d4517712 Pass player object to init_ammo_and_energy 2016-10-28 03:39:42 +00:00
Kp df8f93d63e Cache player object in FinalCheats 2016-10-28 03:39:41 +00:00
Kp c8dda073ca Pass player object to transfer_energy_to_shield 2016-10-28 03:39:41 +00:00
Kp 98839d1af6 Pass player position to automap_apply_input 2016-10-28 03:39:41 +00:00
Kp 65b649bc75 Pass player_info to ai_do_actual_firing_stuff 2016-10-28 03:39:41 +00:00
Kp ca8fa9c3b6 Pass player_info to ai_move_relative_to_player 2016-10-28 03:39:41 +00:00
Kp c31424dd3b Pass player_info to do_invulnerable_stuff 2016-10-28 03:39:41 +00:00
Kp c8801f73ad Fold piggy_new_pigfile calls to gr_remap_bitmap_good 2016-10-28 03:39:40 +00:00
Kp 1c5718ba11 Fold read_extra_bitmap_iff call to gr_remap_bitmap_good 2016-10-28 03:39:40 +00:00
Kp 902e242194 Remove redundant store in kconfig_read_controls
Adjust the value as a local, then write it back when finished.
2016-10-28 03:39:40 +00:00
Chris Taylor e44013ebcf Kill window_exists call in show_menus
Hidden windows don't receive events, so the only way to close is outside its handler, which there should be no cases of here. The function window_exists could return a false positive if a new window was created with the same pointer value as a deleted one. Will later disable window_exists function.
2016-10-28 08:58:47 +08:00
Chris Taylor c351588bba Remove use of window_exists in newmenu_handler
Replace with a disabled check for window_event_result::deleted, which will be enabled when all newmenu subfunctions return a window_event_result. There are currently no instances of a subfunction closing the window itself (which is preferred).
2016-10-28 08:22:36 +08:00
Chris Taylor bd3078b672 Make wall_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on. Also remove the 'likely' branch prediction macro from close_wall_window because close_wall_window will only be called outside of the wall dialog's handler (to open a different dialog or close the editor).
2016-10-27 18:07:57 +08:00
Chris Taylor fd3e60be54 Make object_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:52:50 +08:00
Chris Taylor acc595ba16 Make robot_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:51:00 +08:00
Chris Taylor 5322ce4a0f Make editor_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:48:23 +08:00
Chris Taylor dc7a288539 Make trigger_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:34:41 +08:00
Chris Taylor 06632e73e8 Make centers_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:15:31 +08:00
Chris Taylor 2d587de8dc Make call_default_handler return a window_event_result
Make call_default_handler return a window_event_result to inform the event system in future, particularly if a window was closed.
2016-10-27 16:36:24 +08:00
Chris Taylor 48e9061960 Make the listbox handlers return a window_event_result
Make the listbox handlers and all sub-handlers (when_selected callbacks) return a window_event_result. Makes code more readable and removes one use of window_close, making it easier to inform event system if a window closes in future.
2016-10-27 15:22:41 +08:00
Chris Taylor 2613545712 Return window_event_result::deleted if Game_wind closed
Return window_event_result::deleted if Game_wind was closed somewhere in response to an event handled by game_handler, so in future the event code can use that instead of window_exists to avoid tripping up.
2016-10-27 12:24:02 +08:00
Kp 8b62870245 Fix clang build of udp_tracker_reqgames
gcc permits strlen("") in a constexpr context, but clang prohibits it.
Kreator reports that this broke the OS X build.  Use sizeof(), which
produces approximately the same result and works in both compilers.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/251>
Fixes: 63ca86698e ("Added communication for tracker written by A Future Pilot")
2016-10-26 01:58:05 +00:00
Kp c21e1e22e0 Refactor write_key_text
Kreator reports that clang warns that `i` may be uninitialized in
write_key_text.  This is a valid warning, but gcc does not generate it.
Refactor write_key_text to eliminate the warning and simplify the code.

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/252>
Fixes: 20776fcfbc ("Use range_for/vcwallptr for write_key_text")
2016-10-26 01:58:04 +00:00
Kp 791af89351 Use return type auto-deduction in socket call wrappers 2016-10-25 01:44:35 +00:00
Kp a3aa3da3d5 Switch socket_array_dispatch_t to match only array<uint8_t, N> 2016-10-25 01:44:35 +00:00
Kp 692dfffe58 Use array<> for net_udp_noloss_validate_mdata buf 2016-10-25 01:44:35 +00:00
Kp d7087cc59d Convert net_udp_send_pdata to array<> 2016-10-23 20:33:14 +00:00
Kp f14cbd1c00 Use minimal size buffer for net_udp_send_endlevel_packet guest buffer 2016-10-23 20:33:14 +00:00
Kp 4b539c0545 Use minimal size buffer for net_udp_send_endlevel_packet host buffer 2016-10-23 20:33:14 +00:00
Kp ffa53eb3c4 Page in textures before caching them
Some custom levels attempt to use texture overrides that reference
textures that are not yet paged in.  It is not legal to access the data
of a paged-out texture, but ogl_loadbmtexture_f attempted to access it
anyway, causing a crash.  Page in the texture before calling
ogl_loadbmtexture_f.  Old versions of the engine would have cached
garbage data when this happened.

Reported-by: kreator <https://github.com/dxx-rebirth/dxx-rebirth/issues/228>
Fixes: 3c20c24ac0 ("Disable piggy_bitmap_page_out_all")
2016-10-23 20:33:14 +00:00
Kp 49ff176e12 Protect RAIIsocket::s 2016-10-23 20:33:14 +00:00
Kp a0d614e6b0 Use clamp_symmetric_value in kconfig_read_controls
Avoid open-coding the test.
2016-10-21 02:16:48 +00:00
Kp a8a41aa2ff Move git version into Python class 2016-10-21 02:16:47 +00:00
Kp ddc16dac8b Use range_for in multi_check_for_killgoal_winner 2016-10-21 02:16:47 +00:00
Kp 5c872830a1 Remove unused message MULTI_KILL 2016-10-21 02:16:47 +00:00
Kp cca7fc7848 Revert high-score cool_saying size
Mako88 reports that e335cdacb3 broke
reading historical high score files.

Code analysis shows that the size of the high score file must match the
size of struct all_scores, but this was not enforced anywhere.  Commit
e335cdacb3 changed the size of struct
all_scores.  Restore it to its previous size, and add a static_assert to
break the build if anyone tries to change it again.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/241>
Fixes: e335cdacb3 ("Reverted 81d7db279b and rather removed the terminator byte from string length in nm_set_item_input(). This also fixes possible 9 character length for pilot callsigns. Had to fix up COOL_SAYING_LEN as it was not considering the termintor but considering the original D2 source, this was a mess to begin with (def = 50, text string = 60, input field len = 45). Made score saying 50 characters as this seems to be the maximum witdth without overlapping.")
2016-10-20 02:11:39 +00:00
Kp 8341c88300 Move move_towards_vector division into helper
Mako88 reports that 2a19da88d4 changed
robot movement.  That commit reordered the operations in a way that
tends to truncate small values prematurely.  Restore the original order
of operations.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/247>
Fixes: 2a19da88d4 ("Pass object_base &to move_towards_vector")
2016-10-20 02:11:39 +00:00
Kp d955eda96f Fix fullscreen checkbox handling
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/224>
Fixes: 7128141c55 ("Use enum for newmenu item type")
2016-10-18 02:26:30 +00:00
Kp 27d0a79acd Factor out reporting errors caused by bad levels 2016-10-17 03:49:32 +00:00
Kp c006d068d8 Restructure PHYSFSX read helpers into template function 2016-10-17 03:49:31 +00:00
Kp 779738fa80 Add special handling for multi_do_reappear get_ghost_id
multi_do_reappear is overloaded to be used both on ghosts and on live
players.  This causes a diagnostic because the *_id checks expect
exactly one type: either test for ghost or test for player, but not test
for and accept both.  Open code the type check to support both.
2016-10-15 21:17:02 +00:00
Kp e4e74fe09c Pass vcsegptridx to pae_aux 2016-10-15 21:17:02 +00:00
Kp 2d54a0c57d Fix infinite recursion when newmenu_scroll has only one valid item 2016-10-15 17:51:47 +00:00
Kp aae5279bfd Initialize Stuck_objects for D1 2016-10-15 00:53:22 +00:00
Kp f46b5a0210 Pass player_info to hud_show_cloak_invuln 2016-10-15 00:53:22 +00:00
Kp 2d4936b6ef Pass player_info to hud_show_keys 2016-10-15 00:53:22 +00:00
Kp bf11f9f63f Pass player_info to hud_get_primary_weapon_fontcolor 2016-10-15 00:53:21 +00:00
Kp 1a3939469b Pass player_info to hud_show_weapons 2016-10-15 00:53:21 +00:00
Kp 11754d6163 Pass player_info to hud_show_afterburner 2016-10-15 00:53:21 +00:00
Kp 3a52fe0952 Pass player_info to hud_show_energy 2016-10-15 00:53:21 +00:00
Kp 6a885069b0 Remove spurious resets of player::net_killed_total 2016-10-15 00:53:21 +00:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Kp ad35460eb0 Pass player_info to add_bonus_points_to_score 2016-10-15 00:53:20 +00:00
Kp 25f5fc231a Pass player_info to add_points_to_score 2016-10-15 00:53:19 +00:00
Kp 248dd5c309 Move player::hostages_rescued_total to player_info 2016-10-15 00:53:19 +00:00
Kp f21abc94cb Move player::hostages_on_board to player_info 2016-10-15 00:53:19 +00:00
Kp e721fc56da Move player::last_score to player_info 2016-10-15 00:53:19 +00:00