Commit Graph

303 Commits

Author SHA1 Message Date
Dethrace Labs dc9e312b4d close window when falling back to opengles 2023-12-15 08:26:18 +13:00
Dethrace Labs ca22e52327 wip 2023-12-14 16:21:00 +13:00
Dethrace Labs c1ee21db75 wip 2023-12-14 16:17:36 +13:00
Dethrace Labs 52fe471ff2 wip 2023-12-14 16:14:43 +13:00
Jeff Harris d812e6364a opengles support 2023-12-03 20:41:59 +13:00
Anonymous Maarten 07d517307a
Only use KEYBOARD.COK when it is available, otherwise use embedded table (#322)
* Some executables accept a -german command line option for a 'safe' environment

* Add ascii table for carmageddon, and use it when KEYBOARD.COK is not available

* Remove unneeded braces in input.c

* Use KEY_SHIFT_ANY instead of KEY_LSHIFT

* Remove empty line

* Move ascii tables to external header

* Make sure to treat extended ASCII as unsigned: they must be positive to avoid out-of-bounds texture access
2023-05-04 11:27:06 +00:00
Dethrace Engineering Department 99473ffdf5
adds (void) to all functions taking no args (#318) 2023-05-02 23:07:01 +12:00
Dethrace Engineering Department c90f24d2e0
Fixes missing fatal error messages (#316)
* fixes missing fatal error messages
2023-05-02 13:01:28 +12:00
Dethrace Engineering Department 33f682ce82
only render scene once in map mode (#317) 2023-05-02 11:41:27 +12:00
Anonymous Maarten 597de52fd3
Build dethrace with -Wstrict-prototypes (#314)
* Add HOOK_NORETURN to certain function declarations

This fixes the following warning:
warning: ‘noreturn’ function does return

* Fix -Wstrict-prototypes warnings

* Fix -Wstrict-prototypes warnings in S3

* harness: split null.h in null.h and null.c

* Move GLRenderer_ClearBuffers to previous location

* Whitespace fixes
2023-05-01 23:21:02 +00:00
Dethrace Engineering Department 34a22f2516
Provide an argument to GLRenderer_FlushBuffer (#313)
* fix flush by correctly providing an argument
2023-04-30 22:15:40 +12:00
Dethrace Engineering Department 33000e4623
Remove references to `u_material_index_range` (#311)
* fixes issue 304
2023-04-26 21:48:50 +12:00
Dethrace Engineering Department 35a4ce83df
implements brender environment mapping (#309) 2023-04-25 10:36:52 +12:00
Dethrace Labs d3fe4ed5d9 fix hires mode in menus and smack videos 2023-04-21 12:56:44 +12:00
Dethrace Engineering Department 6c0b26cc8d
Update README.md 2023-04-19 13:15:18 +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