Commit Graph

28 Commits

Author SHA1 Message Date
Muzychenko Andrey 350651dae6 Fixed MSVC warnings, added Windows build script. 2023-09-05 10:51:19 +03:00
Muzychenko Andrey 4b86fe2aa7 FT collision part3: cleanup. 2023-03-05 14:16:07 +03:00
Muzychenko Andrey ba470e8727 FT collision part2: added most of the FT collision system.
Aka "World's most expensive flippers".
This is an aggregate of collision-related changes made during 3DPB->FT transition.
The most important part is in flipper collision - a shift from monolithic iterative solver in TFlipperEdge::EdgeCollision to a distributed non-iterative solver.
Both 3DPB and FT data sets use FT collision, keeping two collision systems does not make much sense.
From user perspective, FT/3DPB systems should not have any major differences.
2023-03-04 17:31:23 +03:00
Muzychenko Andrey 2d6f2c14e5 FT collision part1: AABB. 2022-12-28 08:47:44 +03:00
Muzychenko Andrey 7003b01e5d Render tweaks part 2: sprite set by index. 2022-09-22 17:46:00 +03:00
Muzychenko Andrey 9f0ae0434e Render tweaks part 1: refactored sprite struct.
Optimized sprite handling in render.
Fixed switch warning in control.
2022-09-21 16:43:45 +03:00
Muzychenko Andrey 40672845e4 Message code enum part 6: final touches + control light cleanup.
MessageField is often used as int, so it stays unchanged.
2022-09-08 10:51:33 +03:00
Muzychenko Andrey 22603aa126 Message code enum part 5: control codes. 2022-09-07 16:01:38 +03:00
Muzychenko Andrey dfe1665ba1 Message code enum part 4: finalized transition of Message to enum class. 2022-09-06 16:57:56 +03:00
Muzychenko Andrey 44d5fd5097 Message code enum part 1: global messages and some hacks. 2022-09-05 10:17:37 +03:00
Muzychenko Andrey acd1ad34b2 Code from FT: simplified TFlipper sprite update.
TFlipperEdge moving geometry stored in object.
2022-08-23 08:14:28 +03:00
Alexis Murzeau a2567c1fea
Fix flipper animation and angle calculation (#150)
Checked with a slowed down flipper (reduced retractTime and extendTime)
to ensure the flipper position is correct even when not finished while
pressing the flipper control.
2022-08-09 10:04:51 +03:00
Patrice Levesque a4c6165094
Implement stereo sound. (#138)
* Implement stereo sound.

Original Space Cadet has mono sound.  To achieve stereo, the following
steps were accomplished:

- Add a game option to turn on/off stereo sound.  Default is on.

- TPinballComponent objects were extended with a method called
  get_coordinates() that returns a single 2D point, approximating the
  on-screen position of the object, re-mapped between 0 and 1 vertically
  and horizontally, {0, 0} being at the top-left.

    - For static objects like bumpers and lights, the coordinate refers
      to the geometric center of the corresponding graphic sprite, and
      is precalculated at initialization.

    - For ball objects, the coordinate refers to the geometric center of
      the ball, calculated during play when requested.

- Extend all calls to sound-playing methods so that they include a
  TPinballComponent* argument that refers to the sound source, e.g.
  where the sound comes from.  For instance, when a flipper is
  activated, its method call to emit a sound now includes a reference to
  the flipper object; when a ball goes under a SkillShotGate, its method
  call to emit a sound now includes a reference to the corresponding
  light; and so on.

  For some cases, like light rollovers, the sound source is taken from
  the ball that triggered the light rollover.

  For other cases, like holes, flags and targets, the sound source is
  taken from the object itself.

  For some special cases like ramp activation, sound source is
  taken from the nearest light position that makes sense.

  For all game-progress sounds, like mission completion sounds or ball
  drain sounds, the sound source is undefined (set to nullptr), and the
  Sound::PlaySound() method takes care of positioning them at a default
  location, where speakers on a pinball machine normally are.

- Make the Sound::PlaySound() method accept a new argument, a
  TPinballComponent reference, as described above.

  If the stereo option is turned on, the Sound::PlaySound() method calls
  the get_coordinates() method of the TPinballComponent reference to get
  the sound position.

  This project uses SDL_mixer and there is a function called
  Mix_SetPosition() that allows placing a sound in the stereo field, by
  giving it a distance and an angle.

  We arbitrarily place the player's ears at the bottom of the table; we
  set the ears' height to half a table's length.  Intensity of the
  stereo effect is directly related to this value; the farther the
  player's ears from the table, the narrowest the stereo picture gets,
  and vice-versa.

  From there we have all we need to calculate distance and angle; we do
  just that and position all the sounds.

* Copy-paste typo fix.
2022-05-30 10:35:29 +03:00
Muzychenko Andrey 97aea20586 Renamed some collision variables. 2022-05-20 11:51:00 +03:00
Muzychenko Andrey 2d0da712e3 Cleaning up maths: part 2.
Renamed vector2.
2022-05-11 16:47:13 +03:00
Muzychenko Andrey d23444b983 Cleaning up maths: part 1.
Vector3 inherited from vector2.
2022-05-11 16:42:45 +03:00
toxie 57af3af800
Increase precision of mode_countdown_ handling (#52)
* fix harmless warnings and properly try/catch allocations via new

otherwise the error handling will never be triggered

* increase precision of mode_countdown_ handling

potentially there could be modes running a bit too long, depending on passed in ms (which were implicitly truncated before when passing in)

also fix some harmless warnings

* document warnings that i cannot handle on my own

* revert changes to have a new cleaner PR after review/cherry picks

* increase precision of mode_countdown_ handling

potentially there could be modes running a bit too long, depending on passed in ms (which were implicitly truncated before when passing in)

also fix some harmless warnings and add comments where original code is 'correct' but weird
2021-10-23 07:33:04 +03:00
Muzychenko Andrey 48721e5811 Fixed flipper animation frame skip bug.
It is from original 3DPB, not present in FT.
2021-10-07 08:01:34 +03:00
Muzychenko Andrey 81c2034a16 Replaced objlist_class with std::vector.
Fixed minor bug in TLightGroup.
Cleaned up some warnings.
2021-10-01 18:55:44 +03:00
Muzychenko Andrey c63c6701ac gdrv: RGBA buffers, pre-applied palettes, SDL bitmap origin.
Refactored partman.
Added sprite viewer.
2021-09-21 13:14:39 +03:00
Muzychenko Andrey 98f234fce3 Replaced GlobalAlloc with malloc.
WaveMix keeps GlobalAlloc for authenticity.
Fixed float to double casts.
Some cleanup.
2021-02-18 12:53:25 +03:00
Muzychenko Andrey 1c5256a4c6 Added table resolution support.
Only works with FT .dat file.
FT music does not work - different format.
2021-02-06 16:53:47 +03:00
Muzychenko Andrey 49f6132d23 Added loader for Full Tilt .dat files, v1.
Works with some data hacks in lowest resolution.
Seems to work ok, even though BL is still 3DPB.
2021-01-31 17:29:53 +03:00
Muzychenko Andrey 6ff457eb68 Cleaned up objlist_class. 2021-01-30 14:19:25 +03:00
oz 262b098610 Some renames, cleanup partman, loader. 2021-01-28 18:01:26 +03:00
oz 7d15427dd9 midi ready, TCollision cleanup. 2021-01-23 13:33:30 +03:00
oz 61fe0410b0 TFlipper, TFlipperEdge ready. 2021-01-10 15:22:06 +03:00
oz 5e94b5b513 Score, PinbalTable, PinballComponent v1
Placeholders for T piball component classes.
2020-11-01 18:45:29 +03:00