Commit Graph

201 Commits

Author SHA1 Message Date
Dethrace Labs d3fe4ed5d9 fix hires mode in menus and smack videos 2023-04-21 12:56:44 +12:00
Dethrace Engineering Department f3515d5f64
SmackerLib API (#303)
* adds better smack support

* more docs
2023-04-19 13:11:56 +12:00
Dethrace Engineering Department ef9e4d668d
Implements win95sys.c (#301)
* refactor to use win95sys instead of dossys

* added underscore to avoid conflict with windows functions
2023-04-18 22:50:05 +12:00
Dethrace Engineering Department d4fb64029a
Implements drugs powerup (#302)
* implements drugs powerup
2023-04-18 18:23:53 +12:00
Dethrace Engineering Department 1a0301b6ee
Smudged vertices (#300)
* implements vertex shading and smudging

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2023-04-14 21:58:15 +12:00
Anonymous Maarten dd6a7cbc6f
Fix for running with -robots + implement DOS gore password check (#249)
* Fix SIGSEGV when running with -robots

We cannot write to read-only memory.

* Add --dos-mode argument to require entering password
2023-04-01 15:42:28 +13:00
Dethrace Engineering Department 3a91a526c8
Implements quitgame function (#294)
* implements quitgame function

* updates IOPlatform_* function names
2023-04-01 15:40:40 +13:00
Anonymous Maarten 2bdfa07550
utility: fix filename of generated shade table (#298) 2023-03-08 20:47:33 +01:00
Artur Rojek 12e941081a Fix buffer under/overflows in `SmokeLine` (#132)
When `SmokeLine` is called through `DrawTheGlow`, the calculated shade
table offset might result in a negative value. Subject to usual
arithmetic conversions, it is then treated as a large unsigned array
index. On 32-bit systems (e.g. OG builds for DOS, Windows 95), the
pointer arithmetic overflows and produces a negative index access,
simply grabbing game data a few bytes before the start of the table. On
64-bit platforms this instead results in page fault.

1. Keep table offset in a signed integer, making the negative values
   explicit. This provides OG behavior for 64-bit builds.
2. Optionally, cap all negative values at 0, preventing underflows.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2023-02-27 00:51:25 +01:00
Artur Rojek 48b70bb8ff Fix NULL pointer dereference in S3CalculateRandomizedFields (#284)
If the sound has been muted (!gS3_enabled) during game data loading, it
is then possible to unmute it during gameplay and request a sound effect
which doesn't have a sample loaded (most prominent for pratcam sfx).
While logic in `S3StartSound` accommodates for such a case by loading
the missing sample, it first calls `S3CalculateRandomizedFields`, which
triggers a NULL pointer dereference on platforms with memory protection.
This bug is most likely an overlook from the DOS era.

Fix this by checking for NULL pointer before use.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2023-02-22 11:11:59 +01:00
Dethrace Engineering Department 41d45f9563
cannot reproduce the original crash anymore (#292) 2023-02-21 20:44:00 +13:00
Dethrace Engineering Department 256ab39925
Reset OPPONENT_COUNT to 5 2023-02-20 21:36:54 +13:00
Dethrace Engineering Department 81f8edc803
Implements camera wobble and concussion (#289)
* implements wobble and concussion

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2023-02-20 21:34:34 +13:00
Dethrace Engineering Department 7f44f7f962
fixes toshibas blend test map (#291) 2023-02-20 21:29:19 +13:00
Dethrace Engineering Department e56790388b
Implement cockpit view (#279)
* Cockpit camera position now correctly follows parent actor

* Fixes MungeSkyModel, updates BR_MODU enum

* fixes incorrect blending in cockpit view

* Tidy naming, adds unsigned

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2023-02-19 12:56:43 +13:00
Anonymous Maarten 83ba373426
Use BRender macro's + floats + move around code blocks (#250) 2023-01-19 18:00:50 +01:00
Dethrace Engineering Department acd403f183
Implement transparency (blend tables) (#280)
* support for index_blend materials

* blended materials should not write to zbuffer

* remove reliance on glsl layout qualifiers

* tidy StripBlendedFaces
2023-01-16 16:17:52 +13:00
Artur Rojek 716b98c25a
Fix hires cockpit image display (#271) (#272)
Strip map height is a 16 bit value. Cast to `br_uint_16 *`, so that the
upper 8 bits don't get lost.

This fixes cockpit image rendering for -hires mode, where said images
have heights exceeding 255px.
2022-12-15 22:48:01 -08:00
Artur Rojek 578a976ae8
Fix skidmark rendering in tracks lacking skidmark metadata (#259) (#260)
Tracks such as "Ramp Rampage" or "Acid Reign" don't provide any skidmark
material information. In such cases, use default skidmark pixelmap.
2022-12-11 18:08:11 -08:00
Artur Rojek de6d6a02bb
Fix gear rendering for standard resolution mode (#269)
A different gear mask is being used for standard and hi-res modes.
Supply a hardcoded mask value for standard resolution and detect the
graphics mode.
2022-12-11 18:06:32 -08:00
Artur Rojek 1531f4a9d6
Fix headup hole lookup (#267) (#268)
When searching for a particular headup slot, don't return on the first
empty hole, but rather try to find if the matching slot is in use.

This resolves a bug where two headups of the same type could end up
displayed on top of each other.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-11 14:44:38 -08:00
Artur Rojek f4eb9a8607
Prevent clicking on racer scroll buttons when hidden (#263)
* Prevent clicking on racer scroll buttons when hidden (#262)

Fix a bug where racers could be scrolled in other view modes, messing up
the screen.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
2022-12-11 14:41:54 -08:00
Artur Rojek 8070edc9ec
Fix rendering of fancy headups (#251) (#254)
Resolve a bug in DRPixelmapRectangleShearedCopy, where source pixelmap
gets clipped along the shear, rather than vertically, at right-most edge
of the destination pixelmap.

While at it, also eliminate duplicate code - this part introduces no
logic changes.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-11 14:35:14 -08:00
Artur Rojek addaa7294b
Fix framebuffer effects (#214) (#255)
Flush framebuffer/depthbuffer after rendering the 3d scene. This allows
screen effects such as smoke, sparks or electro-bastard ray to display
correctly.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-11 14:30:56 -08:00
Artur Rojek 676d26d3f9 Fix time credit headup (#182)
Store the previous time credit in `gLast_time_credit_amount` instead of
`gLast_time_credit_headup`. The latter is supposed to hold the headup
slot number and gets overwritten with time unrelated values.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-07 00:20:30 +01:00
Artur Rojek 0343e53b07 Fix fd memory leak on Linux (#264)
The Linux implementation of `OS_fopen` fails to close directories after
use, leaking the underlying file descriptors. Eventually, the limit of
allowed file descriptors per process is reached, causing subsequent
`opendir` failures, and leading to random game crashes.

Fix this issue by calling `closedir` once the directory can be disposed.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-04 17:26:50 +01:00
Artur Rojek 49d8e963f4
Fix gear rendering for Suppressor (#256) (#257)
Fix misaligned gear mask and a buffer overflow for cars which use more
than 8 gears, and thus pixelmaps other than HGEARS.PIX.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-04 09:49:47 +13:00
Artur Rojek 39e34e2cfd Hide mouse cursor when scrolling driver info (#121)
Mouse cursor is supposed to be hidden for a moment when scrolling
through the driver info screen.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-12-03 20:16:13 +01:00
Dethrace Engineering Department 7bbf6df39a
Fix vehicle suspension so that it actually works (#252)
* fixes suspension travel (#221)

* tidy floats

* Extra fixes (#253)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2022-12-03 14:14:28 +13:00
Anonymous Maarten 3f440a5e16
Implement SmudgeCar (#242) 2022-11-21 22:47:35 +01:00
Anonymous Maarten 5eebedfdc9
Add action replay (#230)
* Add replay

* Hide action replay behind --enable-replay

* Update src/DETHRACE/dr_types.h

* Compy OS_ALlocateACtionReplayBuffer from linux to macos

* Add missing macro

* Fix LengthOfSession for smudges

* Implement PipeInstantUnSmudge
2022-11-21 22:44:37 +01:00
Anonymous Maarten e1cbc20465
cmake: inner loop of DoWheelDamage needs to be executed 4 times (#248) 2022-11-21 21:15:18 +01:00
Anonymous Maarten 2c6f69976f
When respawning pedestrians, only animate nearby pedestrians (#244)
* Use Brender macro's in MungeClipPlane

* gNet_mode is an enum

* Create macro defining the area where pedestrians are considered active

* When respawning pedestrians, only animate the pedestrians that are in view
2022-11-17 23:15:56 +01:00
Dethrace Engineering Department a15d62f85f
Implements DoSpecialCameraEffect (#246)
* implements DoSpecialCameraEffect
2022-11-18 05:31:08 +13:00
Artur Rojek a1504075cc
Fix oil spill rendering (#240)
* Make the gl renderer aware of BR_MATF_TWO_SIDED and BR_MATF_ALWAYS_VISIBLE

Prevent the gl renderer from culling back-faced textures if the material
is two-sided or always visible.

Due to the wrong order of vertices in the model, oil spill object is
subject to back face culling, preventing it from being rendered. Set
the oil spill material as two-sided, allowing it to be displayed.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-11-17 17:25:32 +13:00
Dethrace Engineering Department 6c55ba2827
Fix funk texture UV animation (#234)
* fix clock_time to float precision loss
2022-11-13 08:17:06 +13:00
Anonymous Maarten 4c9795a37b
Implement TestAutoSpecialVolume + fix IWANTTOFIDDLE (#237)
* Add enum for splatpack xmas: they have a different demo screen (splatpack demo has smk, xmas demo has a flic)

* Simplify sign

* Fix DecodeLine2 + decode_datatxt.py

* Compare against pointers

* Use float cos and sin functions

* Implement StopGroovidelic

* Implement TestAutoSpecialVolume

* Use floats in SmokeCircle related functions

* gOffset is initialized to 0

* Don't stub DrawTheGlow: every crash is an opportunity to find a bug

* Decrease indentation of LineBoxColl (no functional change)

* Use BrVector3XXX macro's in GetBoundsEdge (no functional change)

* Fix address sanitzier warning when using APC

* Use BrVector3XXX macro in GetPlaneNormal (no functional change)

* Get rid of global is_full_screen variable

* Add command line argument to start DethRace in full screen mode

* cmake: move DETHRACE_FIX_BUGS cmake option to top cmake script

* Add DETHRACE_FIX_BUGS macro when DETHRACE_FIX_BUGS cmake variable is defined

* harness: prescale mouse pointer so it works seamlessly with hires

* Fix IWANTTOFIDDLE

* Add comments for the fixes

* Revert "Don't stub DrawTheGlow: every crash is an opportunity to find a bug"

This reverts commit 3345649201.
2022-11-11 19:57:37 +01:00
Dethrace Engineering Department 4246f66384
Embed GLSL files during build (#238)
* Embed GLSL files during build
2022-11-11 13:18:07 +13:00
Artur Rojek 73d924891e
Show Squad Car in the wreck gallery (#208) (#235)
Fix OG bug, where APC car would have its vertices and faces removed,
preventing it from being rendered in the wreck gallery.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-11-10 06:33:05 +13:00
Anonymous Maarten 889e7ba410
Fix ci warnings (#231)
* Fix CI warnings

* Use brender macro's

* Fix conditional in CollideCamera2

* ci: set-output comand is deprecated

* Fix bug in RebuildOppoPathModel
2022-11-07 11:59:14 +13:00
Artur Rojek ff431b7955
Fix skidmark orientation (#220) (#233)
Don't reset skidmark normal to the horizontal plane, but rather use the
one received from the wheel.

This fixes incorrect rendering of skidmarks on sloped surfaces.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
2022-11-07 11:02:09 +13:00
Anonymous Maarten 8a24f85e7b
Implement funkotronics (#145) 2022-11-04 16:13:10 +13:00
Anonymous Maarten 0dc0c55dc8
Various formatting fixes (#225)
* Remove magic numbers from CalculateFrameRate

* Move conditionals in MungeCarGraphics a bit

* Move code around in LoadCar + less magic numbers

* Tweak conditionals of ReallocExtraPathSections

* Use BrVector3Copy in PointVisibleFromHere

* tCar_spec->gear is an int

* Re-use variable in SearchForSection

* Use floats in CalcGetNearPlayerRoute

* Use floats in ControlBoundFunkGroovePlus

* Align pointers to multiple of pointer size in ShiftBoundGrooveFunks

* Change conditionals in AddProximities + assign the_face at start of iteration

* Move conditionals around in AddGroovidelics

* Move code around in GrooveThisDelic

* Assign the_groove each loop iteration in GrooveThoseDelics

* Compare against NULL in MungeWindscreen

* No need to check for pCount <= 0 in GetALineAndInterpretCommand
2022-11-03 21:28:36 +13:00
Anonymous Maarten 531403a18a
Disable invalid groove bindings at end of LoadCar() (#226)
* Disable invalid groove bindings at end of LoadCar()

* A groove bindings index >= the size of the bindings array is invalid as well
2022-11-02 05:38:31 +13:00
Dethrace Engineering Department 1208a5061a
Fix sounds (#228)
* fixes sound volume and cutoff when too far away

* adds volume-multipler command line arg
2022-11-02 05:36:09 +13:00
Dethrace Engineering Department a86a04fcd0
fixes #187 (#222) 2022-11-01 20:42:57 +13:00
Anonymous Maarten 9f8ff0ddd7
Implement opponent edit functions (#227)
* sdl: print SDL error when failed to create window

* Implement all opponent (edit) functions
2022-11-01 20:42:40 +13:00
Anonymous Maarten 1388e43123
Splatpack x-mas demo eecutes ToggleArrow when the race finished (#224) 2022-11-01 20:32:19 +13:00
Anonymous Maarten e7a17cf13f
Fix of 3 little issues found with the undefined behavior sanitizer (#219)
* racestrt.c: fix out-of-bounds write in DrawGrid

Catched by undefined behavior sanitizer

* opponent.c: use cops array to access 'finished_for_this_race' property

* displays.c: Fix left shift of negative value in DoHeadups

Found by using he undefined behavior sanitizer

* Switch variable names in DoDamageScreen
2022-11-01 20:31:23 +13:00
Anonymous Maarten 97c04789a6
macos: mark junk as 'used' to fix -Wunused-but-set-variable warning (#229) 2022-11-01 20:30:00 +13:00