Commit graph

9928 commits

Author SHA1 Message Date
Kp ad8fd0f871 Pass valptridx factories to obj_relink 2018-03-12 03:43:46 +00:00
Kp e2b24b37d5 Pass d_level_object_state to reset_objects 2018-03-12 03:43:46 +00:00
Kp 44bba9d2a2 Pass valptridx object factory to obj_link 2018-03-12 03:43:46 +00:00
Kp daf87ac23a Pass valptridx object factory to obj_link_unchecked 2018-03-12 03:43:46 +00:00
Kp 0db5a2104e Pass valptridx factories to obj_unlink 2018-03-12 03:43:46 +00:00
Kp d2bad9845c Pass weapon_info_array to object_is_clearable_weapon 2018-03-12 03:43:46 +00:00
Kp 15b59a4b44 Pass d_level_object_state to obj_free 2018-03-12 03:43:46 +00:00
Kp 652b69f2a8 Pass Objects to obj_detach_all 2018-03-12 03:43:46 +00:00
Kp b00317bb1f Pass Objects to obj_detach_one 2018-03-12 03:43:46 +00:00
Kp d09478d88c Pass Objects to obj_attach 2018-03-12 03:43:46 +00:00
Kp 0067e33a8c Pass ObjectState to special_reset_objects 2018-03-12 03:43:46 +00:00
Kp a6b169afcc Move free_obj_list into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp b63633db51 Move num_objects into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp 1c92b448c8 Add d_level_object_state to wrap Objects and related data 2018-03-12 03:43:46 +00:00
Kp 2cac55d6c7 Raise max marker limit to 4 for cooperative games 2018-03-10 22:45:04 +00:00
Kp 49a4ac1c0e Move more marker state to d_marker_state 2018-03-10 22:45:04 +00:00
Kp 4d6b796874 Store MarkerObject as imobjidx, not objnum 2018-03-10 18:32:02 +00:00
Kp 7dee4ca49f Move MarkerMessage[] into wrapper d_marker_state
Also, fix an ancient bug with the automap handling of markers caused by
WET anti-pattern.
2018-03-10 18:32:02 +00:00
Kp ca2b1e0cf0 Remove build_colormap_good parameter used
`build_colormap_good` only took `used` to clear it.  Only one caller
needed it cleared.  Move the clear into that caller.  Remove the
parameter from all calls.
2018-03-08 04:21:18 +00:00
Kp b6e2205b9f Simplify palette color tracking
Callers only care whether a color is used, not how often it is used.
2018-03-08 04:21:18 +00:00
Kp fa5d8b0be0 Move fvi.cpp fvi_hit_object out of global scope 2018-03-05 01:40:44 +00:00
Kp ba81e0becb Move fvi.cpp fvi_hit_side_seg out of global scope 2018-03-05 01:40:44 +00:00
Kp 2686bdc32b Move fvi.cpp fvi_hit_seg2 out of global scope
Rename to fvi_hit_pt_seg based on comment explaining its purpose.
2018-03-05 01:40:44 +00:00
Kp 7ffd54377c Move fvi.cpp fvi_hit_side out of global scope 2018-03-05 01:40:44 +00:00
Kp f640917052 Move fvi.cpp wall_norm out of global scope 2018-03-05 01:40:44 +00:00
Kp ad654648a6 Move fvi.cpp fvi_nest_count out of global scope 2018-03-05 01:40:44 +00:00
Kp 852ab312d5 Remove global Network_laser_track 2018-03-05 01:40:44 +00:00
Kp 5c2408faaa In SDL2 mode, exclude test for SDL1-only feature (Redbook) 2018-03-03 18:47:23 +00:00
Kp 007ba90817 Support SDL2 style version lookup
The results are the same, but the way to obtain them was changed.
2018-03-03 18:47:23 +00:00
Kp 553c9d4ab6 Add #if test to support SDL2 RWops prototypes 2018-03-02 03:19:02 +00:00
Kp 869fea9498 Make SDL-only SDL_Surface pointers static 2018-03-02 03:19:02 +00:00
Kp 4d318b9177 Clarify SDL1 vs SDL2 SConf messages 2018-03-02 03:19:02 +00:00
Kp b16cf4e60a Fix Windows build
The Windows build did not explicitly include <time.h> or equivalent, but
used `time` and `gmtime`, which are only available when <time.h> is
included.  Other platforms include <time.h> incidentally.

Fixes: 131c1b9f4d ("Add support for PNG screenshots")
2018-02-18 18:52:22 +00:00
Kp fab7eb39c3 Flatten GL lists in SConstruct
This is a longstanding cosmetic issue.  Appending a tuple to a list
retains the tuple structure, which is then printed later.  Append it as
a list so that it is flattened.
2018-02-18 18:52:22 +00:00
Kp f904f76c99 Add tool version suboptions show_assembler_version, show_linker_version
OpenBSD clang does not handle `-print-prog-name=as` in a useful manner.
Since this query is purely diagnostic, add an undocumented knob to
suppress the query.
2018-02-18 18:52:22 +00:00
Kp 131c1b9f4d Add support for PNG screenshots 2018-02-18 00:42:42 +00:00
Kp 754d34f750 Fix PCH build 2018-02-18 00:42:42 +00:00
Kp d469bcbe24 Guard event_get_idle_seconds in #if DXX_USE_EDITOR
Only editor code accesses this variable.  Skip tracking it in non-EDITOR
builds.
2018-02-10 22:23:36 +00:00
Kp b1d9c2dd51 Document valptridx error reporting dispatch macro 2018-02-04 01:56:40 +00:00
Kp 2571081962 Rewrite UI table to use symbolic constants for positioning 2018-02-01 05:38:47 +00:00
Kp 36f5e6103b Remove incorrect text "warning: " on generate-kconfig-udlr.py exception
This is not a warning.  It is a fatal error.
2018-02-01 05:38:47 +00:00
Kp 6e5c5f5c49 Mark some ogl parameters const 2018-02-01 05:38:47 +00:00
Kp 1ba2550b7e Defer restoring player ID to after object type is restored
`set_player_id` warns for setting the ID on non-players, including
ghosts.  Move the `set_player_id` call below the assignment to ->type,
so that `set_player_id` does not warn.

Reported-by: cfeuersaenger <https://github.com/dxx-rebirth/dxx-rebirth/issues/364#issuecomment-361096800>
2018-01-29 01:56:40 +00:00
Kp 5c5ee068ae Allow non-players to use OMEGA_ID weapon
User TRUEpiiiicness reports that valptridx<player>::check_index_range
traps when "The Apocalyptic Factor"[1] level 14 boss fires its Omega-based
weapon.  Code inspection shows that this is expected, since the original
designers assumed OMEGA_ID would only ever be used by players, and coded
various shortcuts accordingly.  No one told the level author this.  The
boss is an interesting concept and not difficult to support, so adjust
the code to handle this situation correctly:

- Check that the shooter is a player before checking its player ID.
  Without this, a robot that happened to have the same ID as the player
  would interpret robot data as player data, likely causing corruption
  when it tried to update the omega cannon charge.  Even if the robot ID
  does not match, this step causes a diagnostic[2] reporting that a
  robot ID is being misused as a player ID.
- Remove the shortcut that assumes the shooter is a player.  Store the
  shooter's actual type.
- Remove the unnecessary and counterproductive path that:
  1. Uses the object pointer to get the player's ID
  2. Uses that player ID to get a player pointer
  3. Uses that player pointer to get an object number
  4. Uses that object number to get an object pointer
  When invariants are maintained, the pointer derived in step 4 is equal
  to the pointer used at the start of step 1.  Use that pointer directly
  instead of rederiving it.  The reported exception was due to step 2,
  which requires that the player ID is in range.  When the shooter is a
  player, this is true.  When the shooter is not a player, it may not
  be true.

[1] http://www.enspiar.com/dmdb/viewMission.php?id=418
```
sha1sum af.hog af.mn2
133c52fb4b4e5fd40bf7b2321789841b727d1d0b  af.hog
0bb5f0dd1803b0fc1aac7c2023eacc97e9ab872b  af.mn2

stat -c '%s %Y %n' af.hog af.mn2
4024838 1094445016 af.hog
566 1013524628 af.mn2
```
[2] `similar/main/laser.cpp:560: BUG: object 0x555556078958 has type 2, expected 4`

Reported-by: TRUEpiiiicness <https://forum.dxx-rebirth.com/showthread.php?tid=1038>
2018-01-29 01:56:40 +00:00
Kp 22fe81666a Unify some control_info fields 2018-01-29 01:56:40 +00:00
Kp 1ffefa3029 Use partial_range for robot_get_anim_state 2018-01-29 01:56:40 +00:00
Kp f175949412 Add DXX_ptrdiff_cast_int,DXX_WORDS_BIGENDIAN to VS2017 dxxsconf.h 2018-01-22 04:50:10 +00:00
Kp 4d155527b1 Remove mve_main.c from project builds
It is a test remnant not used as part of the regular game.
2018-01-22 04:50:10 +00:00
Kp 3f9b670fa3 Default to full template instantiation for AddressSanitizer builds
AddressSanitizer in gcc-7 inhibits deletion of certain otherwise
unnecessary nullptr checks, causing otherwise absent references to
class null_pointer_exception.  As a convenience to AddressSanitizer
users, instantiate all valptridx templates when AddressSanitizer is
enabled.  This is slightly excessive, but users building for
sanitization are not aiming for a minimal size build anyway.
2017-12-31 21:11:25 +00:00
Kp c179b2f783 Load robot customizations before use
AlexanderBorisov reported[1] a broken demo that ultimately traced to
incorrect reuse of stale data.  The campaign[2] includes per-level robot
definitions for level 3.  Descent incorrectly accessed Robot_info before
reloading it for the new level, so it used the level 3 data on level 4
robots during a warm start of level 4 for regular play, but used only
the level 4 data for a cold start of level 4 for regular play and for
playback of a demo recorded solely on level 4.  The particular
customizations applied on level 3 caused a level 4 demo recorded with
level 3 robot customizations to use different record lengths than a
level 4 demo recorded with level 4 robot customizations.  Since demos do
not record their record lengths, mismatched record lengths lead to
effectively corrupt demos.  In this case, it manifested as writing 8
anim_angles (per model_num 108, the model incorrectly inherited from
level 3) instead of 1 anim_angles (per model_num 37, used only on cold
starts).  The extra anim_angles were then misinterpreted as a run of 42
ND_EVENT_EOF, because the extra angles were unused and the newdemo code
defines the null byte as EOF (separate from receiving an actual EOF
indicator from the file I/O library).  That run of spurious EOF caused
the demo playback code to refuse to play past the spurious EOF,
resulting in a seemingly broken demo.

As an unfortunate, but unavoidable, consequence, this change modifies
the common path (warm playthrough of every level in the campaign) to
work like the uncommon path (cold start of each level).  Further, the
affected robot triggers a trap in d2x::do_silly_animation[3] when using
the correct model_num, because that polygon model has too few models for
the joints used by the robot.  When using the incorrect level 3 data,
the robot animates without trapping.

[1] https://forum.dxx-rebirth.com/showthread.php?tid=1023
[2] http://www.enspiar.com/dmdb/viewMission.php?id=212
```
sha1sum ENTROPY.HOG ENTROPY.MN2
7bc7a12d00a1ddd3ae92ce90eb67d581ecab004a  ENTROPY.HOG
f2688a634f22b30a02c43d8fa1a049deb5a03f70  ENTROPY.MN2

stat -c '%s %Y %n' ENTROPY.HOG ENTROPY.MN2
2402638 875757712 ENTROPY.HOG
511 875757164 ENTROPY.MN2
```
[3]
```
   799				if (jointnum >= Polygon_models[objp.rtype.pobj_info.model_num].n_models) {
   800					Int3();		// Contact Mike: incompatible data, illegal jointnum, problem in pof file?
   801					continue;
   802				}
```
2017-12-31 21:11:25 +00:00