Commit Graph

237 Commits

Author SHA1 Message Date
Anonymous Maarten e3a50e34d1
Fix Windows arm64 build (#371)
* Build arm64 Windows executable

* Use dbghelp to print a stacktrace and use addr2line as last resort

* Print stack depth

* Cleanup windows.c includes + use OS_Basename + define [RX]_OK ourselves

* Cannot do _access(X_OK) on Windows

* SymInitialize: don't invade process

* Use _access_s

* Ignore failure to get symbol line and line number

* Only consider using addr2line when ADDR2LINE is set
2024-07-09 02:28:40 +02:00
Anonymous Maarten 3d67fd730d
Run QuitGame instead of DoSaveGame when quitting a game after pressing CTRL+Q (#388) 2024-07-09 02:27:47 +02:00
Dethrace Engineering Department f9346d8b59
bump miniaudio to fix playback on recent macos (#382) 2024-07-05 12:53:41 +12:00
Dethrace Engineering Department 68360350e5
Adds proper MacOS bundle and icons for Windows builds (#381)
* macos bundle

* windows icons

* MacOS bundle works when placed inside a carmageddon directory
2024-07-05 09:12:19 +12:00
Anonymous Maarten fdc37eff8f
Show 'Completion Bonus' message at end of race (#380) 2024-07-03 14:12:03 +12:00
Anonymous Maarten 673244bb8c
Implement network (#366)
* SendCarData, ReceivedStartRace

* fixes heap overflow during join

* fixes access on possibly-null pDetails

* DoNetScores

* Fix cast warning of comparefn of qsort

* DisplayUserMessage

* Pack tNet_contents on 4 byte boundary so 32-bit and 64-bit Intel cpu get same struct lay-out

* Add a few static assertions to verify net message offsets

* Add dethrace Wireshark dissector (WIP)

* add dissector installation instructions

* Set wireshark info column

* Fix various typo's

* 4-byte align tNet_message_join as well + more dethrace.lua

* Add more assertions

* Fix network car choose loop

* player scores

* tidy

* mechanics

* Implement SortNetHeadAscending for 'Terminal Tag'

* Update WireShark dissector

* start of tNet_message_pedestrian dissector

* network player cars can see each other move

* netmsgid tidy ups

* dissector: print HOST/CLIENT in info column

* Don't allow hosting a game when starting dethrace with --no-bind

* fix oldd copy

* time_step is integer, fixes client car out of sync

* wasted, recover, kick player out

* NetSendPointCrush

* crushpoint, declarewinner

* network race summary wip

* Start and finish a game of tag/fox

* network fixes

* Players can now send love letters to each other

* Rewrite if's a bit

* Use enum values for GetMiscString and DoFancyHeadup

* Fix fox effect

* Fix fox/it effect at start of race

* Use KEYMAP_ enum values

* Disable address sanitizer and dr_dprintf logging

---------

Co-authored-by: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com>
2024-06-20 22:35:48 +02:00
Anonymous Maarten 1d5f6f1634
Add '--verbose' cli argument (#370) 2024-06-20 00:24:56 +02:00
Anonymous Maarten a74ee0ac82
Don't leak file descriptors in GetFileAttributesA polyfill (#372) 2024-06-20 10:22:34 +12:00
Dethrace Engineering Department 6222f6994f
Software renderer (#363)
* BRender software rendering initial commit

* changes required for brender v1.3.2

* fixes missing selection rectangle in race summary screen

* fix track rendering, remove opengl bits

* adding BRender submodule

* enables mirror, bumps brender

* enable linux arm64 builds

* clang-format on all files

---------

Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
2024-06-14 19:52:09 +12:00
Dethrace Engineering Department 3870bf8c8a
Fix windows chdir behavior (#365)
* fix windows chdir behavior

* log panics to file and check for gl shading language

---------

Co-authored-by: Jeff Harris <jeff@1amstudios.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-06-14 10:31:54 +12:00
Anonymous Maarten 62bbf66deb
Fixes for Portuguese Carmageddon (#353)
* Fix bugs exposed by Portuguese Carmageddon

* Fixes for warnings/errors found in rec2

* Macos says "no"

* Last argument of _partSet can be a pointer

* feof is a macro dereferencing f on some systems

* Allow longer program_name in addr2ine

* Fix casing issue with sounds

French Carmageddon provides DATA/SOUND/fyeah1.WAV where it expects DATA/SOUND/FYEAH1.WAV

* tools: add encode capability to decode script

* Replace font id integers with enum

* Result of BrFileGetLine is not used

* Document the StripControls fix

Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>

---------

Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
2024-05-28 12:59:37 +00:00
Anonymous Maarten e07b7114a3
Implement sound options menu (hidden behind --sound-options) (#359)
* Implement sound options menu (hidden behind --sound-options

* Don't use M_PI*

* DoInterfaceScreen uses gEffects_outlet instead of gIndexed_outlets[0]
2024-05-28 10:10:23 +00:00
Anonymous Maarten c76b766ce7
ci: use libsdl-org/setup for SDL + package with CPack (#362)
* Fix unittests with null renderer

* cmake: fix configuration when building from a non-git/non-release archive

* test: don't access freed memory

* cmake+ci: use libsdl-org/setup-sdl for SDL2 + create package with CMake

* Install all files to root + SDL2.dll
2024-05-28 10:02:39 +00:00
Anonymous Maarten 9054ba9b81
Little touches to windows platform code (#331)
* windows: print strerror message on failure to open file

* Remove leading _ from _program_name

* A few windows functions can be static

* ci: Always upload artifact

* linux+macos: Print message on stderr when fopen fails

* Remove merge artifacts

* Remove stray '#include <stdio.h>'
2024-05-25 21:14:29 +00:00
Anonymous Maarten 7e98d3b887 Implement -noreplay from Carmageddon DOS version 2024-05-15 20:34:33 +02:00
Dethrace Engineering Department d67f04e6c6
Fixes #357 (#358)
* fixes #357
2024-01-17 07:20:16 +13:00
Dethrace Engineering Department 8051ca2b6d
Fixes #319 (#346)
* fixes #319

* adds -Wno-deprecated-declarations to miniaudio on clang
2023-08-09 20:20:11 +12:00
Dethrace Engineering Department 511d827e7e
chdir to exe path (#345)
* using OS_Basename to get root directory from argv[0]

* remove call to old GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS since opengl guarantees at least 16
2023-08-09 12:56:09 +12:00
Dethrace Engineering Department dc135e46ec
fixes initial value of gOld_sound_detail_level (#347) 2023-08-09 12:53:32 +12:00
Anonymous Maarten 4200cfab6c
Replace magic numbers with enum (#341)
* Replace magic string numbers with enum

* Fix enum FatalError enum item
2023-07-22 00:05:07 +00:00
Anonymous Maarten c5163f2d9a
input: use PDKeyDown3 in PDGetASCIIFromKey (#323)
* input: use PDKeyDown3 in PDGetASCIIFromKey

PDKeyDown3 does not modify last_key_down and last_key_down_time
2023-07-07 05:48:04 +12:00
Anonymous Maarten 36cd6c9f71
Fix Car icons in menus
The DOS version loads both low and high-res car icons: one is used for in-game icons, the other for use in the menus.
On Windows, only the high res car icons are used. This causes artifacts.
2023-07-06 01:13:53 +00:00
Dethrace Engineering Department 80f1a8876c
fixes stack traces on osx (#337) 2023-07-06 12:55:50 +12:00
Dethrace Engineering Department 1c10b74141
Networking #1 - Lobby implemented (#335)
* Basic networking functions implemented to get the lobby functional

* Apply suggestions from code review

* PDNetObtainSystemUserName gets local system name

---------

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2023-07-05 14:18:52 +12:00
Dethrace Engineering Department 7d475fc117
Fixes player engine stumbling sound (#332)
* audio backend

* fixes stumbing sound at speed

* implements missing S3ChangePitchSpeed, tidies error codes

---------

Co-authored-by: Jeff Harris <jeff@1amstudios.com>
2023-07-04 07:40:44 +12:00
Anonymous Maarten 3f61e9b479
Fix damaged cars in action replay (#333)
* misc: use appropriate types

* Fix buffer overflow read when the_angle == DR_PI_OVER_2

Yes, this happened on my system.

* piping: extra debug

* appropriate type

* piping: read number of chunks correctly

* Always enable replay
2023-06-01 03:13:02 +00:00
Dethrace Engineering Department db5a953edc
fixes slow reverse playback (#334) 2023-06-01 14:55:43 +12:00
Dethrace Engineering Department 3b0f32284a
Per-channel audio buffers from DOS executable (#329)
* implements DOS-style per channel audio
2023-05-19 11:58:41 +12: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 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