Commit Graph

50 Commits

Author SHA1 Message Date
Anonymous Maarten a2cdd1f061
Support multiple platform drivers (#444)
* Start of supporting multiple platform drivers

* Remove dependency of null platform on SDL2

* cmake: support loading SDL2 dynamically

* Move CMake options to project root for SDL2::SDL2 access

* Don't link to OpenGL

* Move common dynamic loading to header

* Add SDL 1.2 platform

* Add SDL1 platform backend

* Remove accidental addition

* Try multiple platform drivers until we find a good one

* Fix sdl1 mouse

* Use my BRender fork FIXME FIXME FIXME REMOVEME REMOVEME REMOVEME

* Build dethrace supporting SDL1 on ci

* use dethrace-labs BRender fork
2025-05-03 23:44:46 +02: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
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 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
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 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
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
Anonymous Maarten b5ccfe7dd2
No more gcc/clang warnings (#169)
* Change type of DRPixelmapCleverText2 to char*

* Fix warnings emitted due to -Wreturn-type

* Fix BR_ONE_LS redefinition warning

* Fix warnings emitted by -Wparentheses

* Tag FatalError and PDFatalError with noreturn attribute, fixing -Wreturn-type warnings

* Fix string type of TransBrPixelmapText~

* Fix a few -Wmaybe-uninitialized warnings

* Fix -Wformat and -Wpointer-sign warnings in test_datafile.c

* Fix -Wshift-negative-value warning

* Fix -Wpointer-sign warning

* chdir is declared with attribute 'warn_unused_result'

* Fix -Wmaybe-uninitialized warning

* Fix -Warray-bounds warning

* Fix -Wmaybe-unitialized warning

* Fix -Wmaybe-unitialized warning

* Fix -Wmaybe-unitialized warning

* Fix -Wmaybe-unitialized warnings

* Fix a few -Wmaybe-uninitialized warnings

* cmake: unify warnings amongst gcc and clang

* fatalerror_fixup

* Fix -Wabsolute-value warning

* Fix all warnings when building with MinGW on Windows

* Fix warning caused by -Wimplicit-fallthrough

* Fix warnings caused by -Wcast-function-type

Fixes these types of warnings:
cast between incompatible function types from ‘br_uint_32 (*)(br_actor *, void *)’ {aka ‘unsigned int (*)(struct br_actor *, void *)’} to ‘intptr_t (*)(br_actor *, void *)’ {aka ‘long int (*)(struct br_actor *, void *)’} [-Wcast-function-type]

* Fix warning caused by -Wmissing-field-initializers

* Normalize direction_v vector and store in displacement
2022-09-24 17:42:58 +12:00
Anonymous Maarten b7da8770b4
Fix IRandomBetween returning out-of-range numbers (#173) 2022-09-23 08:39:52 +12:00
Anonymous Maarten e97bc083d9
Add pedestrians + power-ups (#118)
* Add pedestrians

* Pedestrian tweaks

* glrenderer: add texture tranformation support for animated pedestrians

* Use Brender functions in more locations

* Implement CheckPileDriverBonus

* revert changes to CollideCamera2 except bugfix

* fix uninitialized variable

Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
Co-authored-by: Dethrace Labs <carmageddon.reversing@gmail.com>
2022-05-10 23:39:55 +12:00
Dethrace Engineering Department 7e14a97692
Easier platform porting (#108)
* Create PORTING.md

* Creates io_platform abstraction

* removes miniposix

* remove unistd refs

* removes watcom functions

* fixes shadow rendering memory leak
2022-03-21 12:10:49 +13:00
Anonymous Maarten d3ebbb6f1f
Visual Studio Fixes (#106)
* Visual Studio Fixes

* Disable flooring the frame period to 10ms

* Don't build with mingw on gha
2022-03-17 10:30:38 +13:00
Anonymous Maarten 6568a15103
Truckload of updates (#96)
* dethrace: implement all missing brucetrk functions

* brender: use sqrtf in macros to avoid double->float conversion

* dethrace: implement a few key callbacks (will crash further along the line)

* dethrace: start earning some money (display credits message)

* dethrace: create spark/shrapnel objects (no render yet)

* ALL IN ONE

* brender: implement 'easy' euler functions

* brender: implement BrMatrix4PreTransform and BrTransformToTransform

* brender: add TAU constand (=2*pi)

* brender: add FIXME/STUB to render function (+ implement it)

* brender: add a few functions to the global brender header

* Add DETHRACE_FIX_BUGS macro to the cmake build system to optionally fix bugs/compiler warnings

* dethrace: implement 2 crush functions

* dethrace: use floats in FindFace + re-use local stack variable

* tNet_contents is an enum: the header aliases the start of the other messages

* dethrace: stub PDMouseButtons

* dethrace: implement a few utility functions

* dethrace: implement ChangeSelectionTo + de-inline ResetInterfaceTimeout

* dethrace: use chars instead of magic values + add fix for compiler warning about number formatting

* dethrace: compare a pointer against a NULL pointer

* dethrace: implement a lot of powerup functions

* dethrace: implement a few piping functions

* dethrace: implement a few opponent functions

* dethrace: completely implement load/save (or so I hope :D)

* dethrace: implement a few oily functions

* dethrace: implement got/lose/periodic powerup proc array

* brender: add BrXXXFindHook functions to brender header

* dethrace: register callback functions on missing material/model/map/tables

* dethrace: compare pointers with pointers and ints with ints

* Hide powercallback typedefs behind #ifdef

* dethrace: implement Del/End/PgDn APO buy buttons logic

* Add BrDiagHandlerSet to brender.h

* dethrace: SwithToRealResolution/SwitchToLoresMode call PD functions

* Use correct type when comparing against characters.

* dethrace: implement writing out and disposing crush data

* dethrace: add NonFatalError + fix entry in gError_messages

* dethrace: implement StopCarSmoking and StopCarSmokingInstantly

* dethrace: implement SkidNoise + ScrapeNoise + DamageUnitWithSmoke + DamageUnit

* dethrace: InitCarSkidStuff -> use floats instead of doubles

* Add BrPixelmapCopy + BrPixelmapPixelSet to brender header

* dethrace: implement DisableCar

* dethrace: stub out a lot of functions in sound.c

* dethrace: load and dispose pratcam data

* dethrace: minor additions to flicplay.c

* skidmark: compare floats with floats

* dethrace: implement some functions to convert face materials for different wall texturing levels

* add stub BrPixelmapCopy function + add STUB_ONCE calls in other methods

* MungeForwardSky does nothing, I think

* Use macros to initialize variables in AllocateCamera

* Implement AdjustSkid + use floats

* DRStdioOpenRead: Compare pointer against NULL

* dethrace: Implement IncrementLap

* dethrace: implement ChangeAmbientPratcam

* Implement SortOutRecover

* Implement CheckHornLocal

* Use COUNT_OF in dethrace

* Draw arrow blip on map

* Implement DRPixelmapCopy

* Fix error code value

* Stub GotPowerupX

* Add ability to run the game/tests without signal handler, this allows a debugger to attach

* Don't save a game in PDFatalError

* Fix loadsave recopy arrays

Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
2022-03-02 17:15:59 +13:00
Anonymous Maarten 26fd105889
Various work for upstream (#93)
* dethrace: right align numbers in columns

* tools/progress.py: allow sorting on different keys

* brender: add BrPixelmapSave(Many)? to brender.h

* brender: add BrActorLoadMany and BrModelAddMany to brender.h

* brender: add BrWriteModeSet to brender.h header

* brender: define br_size_t as size_t

* brender: expose default order_table through header

* brender: sort tokens by value (and add _BRT_LAST_BUILTIN_TOKEN value)

* brender: diffusion factor of default material is 0.7

* brender; br_value_tag and br_lexer_token.v are unions

* brender: add all genclip functions

* brender: add all token functions

* brender: add assocarr functions

* brender: add lexer functions

* brender: add default model

* brender: add resource functions

* brender: fix BrMaterialAllocate

* brender: add logwrite functions

* brender: add brprintf functions

* brender: add missing file function (BrFileAttributes)

* brender: add BrAngleToDegrees define in br_defs.h

* brender: add image functions

* brender: implement all resreg functions

* brender: implement all pmnull methods

* dethrace: fix brender init string + other params

* brender: use BR_ASIZE when using pm_resourceClasses

* brender: implement all dbsetup functions

* dethrace: implement all input functions

* dethrace: implement various depth edit mode functions

* infra: add WARN_ONCE macro to avoid spamming the console

* dethrace: add enable/disable plingmaterials + add log message

* dethrace: Implement a few loading functions

* dethrace: implement PrintScreenFile + PrintScreen to write screen to BMP

* brender: 8 directories for image is a better default

* brender: Implement makeMeshFromBounds + add typedef for render callbacks

* brender: implement all functions in enables.c

* brender: implement all fwsetup functions

* brender: implement some prepmesh functions

* brender: implement all modsupt.c functions

* brender: use correct types in comparisons

* brender: add whitespace in brlists.c

* brender: actually return something in BrBoundsToMatrix34

* brender: implement all bswap functions

* brender: implement all brerxcept functions

* brender: Implement BrActorSearch + fix RenumberActor

'd' is the depth, it should be the same for all children

* dethrace: gMem_names contains empty strings instead of NULL

* dethrace: ServiceTheGame also does CheckMemory

* dethrace: implement DisposeActorMatrix + DisposeColumns

* dethrace: Implement TogglePedestrians + GetPedCount + GetPedPosition

* dethrace: implement a few superficial powerup functions

* dethrace: implement a few shading helper functions

* dethrace: implement a few world actor helper functions

* dethrace: InitNetGameplayStuff has empty implementation

* dethrace: implement + use DRPixelmapCentredText

* dethrace: display APO bars on HUD

* dethrace: do DoNewGameAnimation when starting a new race (=empty)

* dethrace: (Open|Close)Diagnostics are the first/last functions to run

* dethrace: implement RestoreCameraPosition

* dethrace: LoadOpponentMugShot does a MAMSLock

* dethrace: use enum value for gRace_over_reason

* dethrace: add withespace after LOG_TRACE

* dethrace: implement SetSmokeLastDamageLEvel + StealCar

* dethrace: implement ResetOilSpills

* dethrace: InitRace calls InitNetGameplayStuff

* dethrace: use COUNT_OF instead of magic number

* brender; br_value_tag and br_lexer_token.v are unions

* dethrace: implement options menu (missing graphics/controller/sound menu)

* dethrace: implement DrawRectangle + DrawRRectangle

* dethrace: implement (Set|Reset)NonFatalALlocationErrors + MAMSInitMem

* dethrace: Call MAMSInitMem() in InitialiseApplication

* dethrace: implement some flic accessor methods

* dethrace: implement getters to initialize the graphics options menu

* dethrace: implement graphics options menu

* dethrace: support saving options to file

* dethrace: implement AwardTime

* Add utility script to decode encrypted text file

* dethrace: implement Log2 + LoadDepthTable

* dethrace: replace number with their character equivalent

* dethrace: implement DimRectangle

Dimming the rectangles for the HUD is not working, because the renderer needs to write back to the back screen.

* dethrace: implement KillOldestQueuedHeadup

* resource: remove debug fflush

* modrend: fix comment

* depth: fix factor 2 bug

* loading: undefine BAIL_IF_NEGATIVE

* dbsetup: use macros for enabled types

* input: remove outdated comment
2022-02-23 13:58:24 +13:00
Dethrace Engineering Department 0f4957064f
Vehicle shadows (#92)
* solid black shadow polygons rendering, no clip planes yet

* 8 bit colors, full color framebuffer

* fancy shadows, full 8 bit color pipeline

* fix shadows disappearing sometimes
2022-02-23 08:14:15 +13:00
Anonymous Maarten 5260839fbe
Serialize pixelmap/material/model/actor structs to file (#80)
* regsupt: Implement all regsupt functions

* test: fix regsupt tests to cope with 'polluted' brender state

* tests: Re-order tests + fix temp file

* tests: Move binary/test file contents test to shared file+header

* Add euler defines to angles header

* Stub BrPixelmapDirectLock and BrPixelmapDirectUnlock (FIXME: add TODO/FIXME)

* math: Implement BrVectorX functions

* Fix BRender duplicate material struct name + bug in datafile

* Add missing brstddiag functions

* BrStdioOpenRead: use brender types

* Implement all functions in v1dbfile + genfile (=BRender resource loading)

* tests: Fix test_loading_ConvertPixToStripMap

* Fix tests on Windows

* Use array indices as argument to offset
2022-02-06 16:23:10 +13:00
Anonymous Maarten ba4b7630fb
Add all datafile functions (+needed dependent functions) (#73)
* brender: add fixed functions + tests

* brender: re-order assignment of variables

Little nitpick patch, sorry :^)

* brender: implement all scratch functions + tests

* tests: Actually build and run math test functions

* brender: implement BrFilePrintf

* brender: BrVsprintfN returns number of characers written

* tests: add ability to create temporary file in temporary folder

* brender: add binary/text store+load of datafile + tests
2022-01-26 11:54:30 +13:00
Anonymous Maarten ee032df264
Fix MSVC tests + add mingw support (#65)
* Include windows.h before imagehlp.h

This fixes a long list of undefined type errors when building with mingw (on Linux).

* Remove matherr function

This function is provided by the c library.

* Use GetFileAttributesA to filter files

dirent->d_type is not available in all implementation.
Posix only mandates the fields d_name and d_ino.

* Use FindOpenGL.cmake to get the opengl library

Mingw has no libGL.so, but has libopengl32.a. Use the CMake module to abstract this away.

* harness needs to link to dbghelp

This fixes undefined references to:
__imp_SymInitialize, __imp_SymGetModuleBase64,
__imp_SymFunctionTableAccess64, __imp_StackWalk64 and __imp_SymCleanup.

* Don't add -g to compile options.

CMAKE_BUILD_TYPE=(Debug|RelWithDebInfo) takes care of this

* Set test file name before running tests in suite.

This causes the message to contain the correct file name where an assertion failed/succeeded.

* Use wrapper to sleep for number on seconds in tests

sleep on Windows expects milliseconds.
sleep on Posix expects seconds.

* Use char* instead of void*

MSVC complained that it couldn't determine the size of void

* Don't test state of removed resource after deletion when building Debug

When building in Debug configuration, the compiler may mark deleted memory ranges with some value.
Therefore, we cannot expect deleted memory to remain unchanged.
(MSVC in Debug mode does this)

* Use helper to get system temporary folder.

Using /tmp on Windows failed hard.

* Header containing sse3 intrinsics is pmmintrin.h

See https://github.com/recp/cglm/pull/234

* Add errno.h include for ENOTSUP

* Fix test_utility_GetALineWithNoPossibleService: avoid strcpy of uninitialized s

Found by running the tests with CMAKE_BUILD_TYPE=Debug with MSVC

* Add mingw@Linux and mingw@Windows jobs to github workflow

* Rename build-windows.ps1 script to build-msvc.ps1.

Also bump the versions of SDL2 and ninja, used in this script.

* Run tests in github jobs running on Windows

Co-authored-by: Dethrace Engineering Laboratory <78985374+dethrace-labs@users.noreply.github.com>
2022-01-20 13:17:10 +13:00
Anonymous Maarten e8f3b6f95b
Implement all brender matrix functions (#66)
* Add macro to test float array with precision

* Implement all matrix4 functions + add tests

* Implement all matrix23 functions + add tests

* Implement all matrix34 functions + add tests

* Implement all quat functions + add tests
2022-01-20 13:13:25 +13:00
Anonymous Maarten 991a9226fb
Implement all functions related to lists + registries (#67)
* Implement all br_list + br_simple_lists operations + tests

* Implement all br_register operations + tests

* Also fix BrRegistryFind/BrRegistryRemove with empty registers
2022-01-20 13:10:19 +13:00
Dethrace Engineering Laboratory 6d21a1c480
BRender inline functions (#64)
* convert CollCheck to use inline BR functions

* convert CalcForce to use inline BR functions

* partial support for demo content

* harness interface tidy up

* cleaner platform handing
2021-10-04 12:37:23 +13:00
Jeff Harris d3874216c0 fix tests build 2021-09-10 13:44:52 +12:00
Jeff Harris 6cc2db6201
Rendering our first 3d scene! (#52)
* 3d rendering working slightly

* lighting working but looks funny

* camera swoop working somehow

* 3d rendering working down to camera

* fix linux build
2021-07-17 07:08:06 +12:00
Jeff Harris 1ce611e9d8
Implements load race screen and grid selection screens! (#45)
* Load Race screen
* Grid Selection screen
* Loads race objects into memory
2021-03-25 06:51:35 +13:00
OmniBlade d1232abceb Refactors CMake to allow buildings tests.
Adds running of tests to the linux and macos workflows.
Tests themselves need some refactoring to pass on windows.
2021-03-12 15:49:29 +00:00
Jeff Harris 6bc804710e
Feature/loadcar (#42)
* LoadCar
2021-01-26 21:49:35 +13:00
Jeff Harris f665dbf6cf
Implements Select Driver screen (#39)
* Adds driver select interface screen
2020-09-23 00:30:16 -07:00
Jeff Harris a7e588d1f8
Adds VerifyQuit screen, tidies up memory alloc/free tracing (#37)
* Adds VerifyQuit screen, tidies up very verbose memory alloc/free tracing, extra error checks on SDL calls
2020-09-09 07:41:12 -07:00
Jeff Harris 185fb8a2dc
Feature/mainmenu (#35)
* rendering main menu
2020-09-03 00:35:15 -07:00
Jeff Harris ecc435ef8e
Feature/keyboard input (#33)
* Adds basic keyboard handling, palette fading
2020-07-24 18:49:35 -07:00
Jeff Harris 716c65807d
plays intro smack files (#32)
* plays intro smack files
2020-07-19 23:42:03 -07:00
Jeff Harris e54cf25a74
Feature/load races (#31)
* loading races, powerups, opponents
* runs all the way to end of initialization
2020-07-15 22:02:11 -07:00
Jeff Harris 77e404f141
Adds font rendering, makes low memory screen work (#30)
* Adds font rendering, makes low memory screen work
* fix tests without data directory
2020-07-08 21:08:55 -07:00
Jeff Harris 0246c1de7f
Feature/renderer (#29)
* Adds first cut of GL renderer
* Adds harness: where we add modern code to interface with the original game code
2020-07-06 00:45:08 -07:00
Jeff Harris 60309ba905
Load fonts, pixelmaps, materials (#28)
* load fonts, pixelmaps, shadetables, materials
2020-06-29 21:20:03 -07:00
Jeff Harris 12da0ed779
LoadActor (#25)
* Implements LoadActor call tree
* Added defines for df_* constants that we don’t have symbols for
2020-05-22 19:05:22 -07:00
Jeff Harris 4995fe4979
Implements LoadModel (#24)
* cpoint.dat model loading working
* Simplify resource_header padding, fixes resource free callback to close files correctly
2020-05-17 14:59:41 -07:00
Jeff Harris 92d549520e
Actor, pixelmap allocation etc (#23)
* Adds screen init, camera allocation
* Implements missing BrActorAdd
2020-02-01 09:15:06 -08:00
Jeff Harris f52f394675 merge 2020-01-11 09:27:00 -08:00
Jeff Harris efe0a8dbdc
clang format all files (#21) 2020-01-11 09:23:28 -08:00
Jeff Harris 8648891d4a merge 2020-01-10 15:03:27 -08:00
Jeff Harris 1a5715dc81
BrV1dbBeginWrapper_Float call tree (#19)
* Implements BrV1dbBeginWrapper_Float tree calls
2020-01-10 14:59:43 -08:00
Jeff Harris 7d1789a6ef Adds LoadGeneralParameters function 2020-01-10 14:56:03 -08:00
Jeff Harris 2ae8c4bc8d Implements BrV1dbBeginWrapper_Float tree calls 2020-01-02 21:40:49 -08:00
Jeff Harris 53de41f556 tests pass with *prev 2019-12-30 12:52:18 -08:00
Jeff Harris 25eeef2010 wip 2019-12-17 23:04:46 -08:00
Jeff Harris f42242306a
Implements GameMain initialization (#17)
* GameMain methods
* Adds tests for PDInitialise, CD checks
2019-12-06 09:50:11 -08:00
Jeff Harris 66fe07e9a2
implements main method (#16)
* Implements: main, Usage
2019-12-02 11:24:18 -08:00
OmniBlade cee44698b2 Implements BrFloat* functions. (#15) 2019-11-26 16:21:18 -08:00
Jeff Harris b04c31139f
Adds unit tests, some more implementations (#14)
* unit tests, some implementations
2019-11-24 21:19:15 -08:00