Commit Graph

1371 Commits

Author SHA1 Message Date
Sebastian Holtermann
0e8980ea13 2dlib: Fix set but not used compiler warning in font.cpp
This fixes a set but not used compiler warning in Release builds in
2dlib/font.cpp.
2024-11-27 16:13:00 +01:00
Sebastian Holtermann
b43a5bb039 2dlib: Fix unused variable compiler warning in memsurf.cpp
This fixes an unused variable compiler warning in Release builds in
2dlib/memsurf.cpp.
2024-11-27 16:13:00 +01:00
Sebastian Holtermann
3ac2cb8382 2dlib: Fix uninitialized bool compiler warning in surface.cpp 2024-11-27 15:56:33 +01:00
Sebastian Holtermann
987a51d38d 2dlib: Fix another set but not used variable compiler warning in surface.cpp 2024-11-27 15:56:33 +01:00
Sebastian Holtermann
d49691143c 2dlib: Fix another set but not used variable compiler warning in surface.cpp 2024-11-27 15:56:33 +01:00
Sebastian Holtermann
a97416fc28 2dlib: Fix set but not used variable compiler warning in surface.cpp 2024-11-27 15:56:33 +01:00
Sebastian Holtermann
e122a16804 2dlib: Fix integer signedness missmatch in comparison in font.cpp 2024-11-27 15:56:33 +01:00
Sebastian Holtermann
10dae4d65b 2dlib: Fix an integer signedness compiler warning in pentext.cpp
This fixes an integer signedness compiler warning and cleans up the
grViewport::draw_text_line method in 2dlib/pentext.cpp.
2024-11-27 15:56:13 +01:00
Sebastian Holtermann
9af8c16b6b 2dlib: Fix unused variable compiler warning in pen.cpp
This removes some unused variables in 2dlib/pen.cpp.
2024-11-27 15:56:13 +01:00
Louis Gombert
836dd4d382
Merge pull request #645 from jengelh/master
Resolve 3301 compiler warnings
2024-11-26 22:24:13 +00:00
Louis Gombert
1803f66f75
Merge pull request #651 from Lgt2x/macos-13
MacOS CI builds: use MacOS-13 instead of the deprecated MacOS-12
2024-11-26 19:23:29 +00:00
Louis Gombert
d77383f8ab MacOS CI builds: use MacOS-13 instead of the deprecated MacOS-12 2024-11-26 20:44:29 +01:00
Louis Gombert
f7efa4b8dc
Merge pull request #648 from jengelh/lv12
d3: fix game crash in Retribution level 12's big matcen room
2024-11-25 21:37:00 +00:00
Louis Gombert
238aead057
Merge pull request #646 from jengelh/spello
Fix spellos in comments/strings
2024-11-25 21:26:54 +00:00
Louis Gombert
f7e6dd92fd
Merge pull request #647 from jengelh/inventory
Resolve crash on inventory pickup
2024-11-25 21:25:17 +00:00
Louis Gombert
1b2f51400a
Merge pull request #649 from halprin/patch-1
Update macOS Usage Documentation
2024-11-25 20:57:25 +00:00
halprin
d26cedf8c2
Add macOS step to xattr the netgames folder 2024-11-10 09:07:33 -07:00
Jan Engelhardt
0b7989b65a d3: fix game crash in Retribution level 12's big matcen room
When activating switches in the room with 6 matcens,
this happens after a short while:

```
Assertion failure at TERRAIN_REGION (Descent3/terrain.h:218), triggered 1 time:
  'x != -1 && "invalid/unset room number (-1)!"'

f0  TERRAIN_REGION (x=-1) at Descent3/terrain.h:222
f1  AIPathAllocPath (obj=0x3d304b0 <Objects+150000>, ai_info=0x520000444080, goal_ptr=0x520000444250, start_room=0x3d304cc <Objects+150028>, start_pos=0x3d304d0 <Objects+150032>, end_room=0x7fb115dbe830, end_pos=0x52000044427c, rad=0, flags=0, handle=28822, ignore_obj=-1) at Descent3/aipath.cpp:1066
f2  GoalDoFrame (obj=0x3d304b0 <Objects+150000>) at Descent3/AIGoal.cpp:823
f3  AIDoFrame (obj=0x3d304b0 <Objects+150000>) at Descent3/AImain.cpp:6214
f4  ObjDoFrame (obj=0x3d304b0 <Objects+150000>) at Descent3/object.cpp:2674
f5  ObjDoFrameAll () at Descent3/object.cpp:2988
f6  GameFrame () at Descent3/GameLoop.cpp:2981
f7  GameSequencer () at Descent3/gamesequence.cpp:1221
f8  PlayGame () at Descent3/game.cpp:834
f9  MainLoop () at Descent3/descent.cpp:550
f10 Descent3 () at Descent3/descent.cpp:508
f11 oeD3LnxApp::run (this=0x7fb115a0db50) at Descent3/sdlmain.cpp:151

(gdb) up
    start_room=0x3d304cc <Objects+150028>, start_pos=0x3d304d0 <Objects+150032>, end_room=0x7fb115dbe830, end_pos=0x52000044427c, rad=0, flags=0,
    handle=28822, ignore_obj=-1) at Descent3/aipath.cpp:1066
1066          } else if (BOA_Array[BOA_INDEX(*start_room)][BOA_INDEX(*end_room)] & BOAF_TOO_SMALL_FOR_ROBOT) {
(gdb) p *start_room
$2 = 171
(gdb) p *end_room
$3 = -1
```

The return type of ``BOA_GetNextPath`` is int; but inside the
function, ``false`` is returned, which does not fit the scheme.
Judging from callsites, ``BOA_NO_PATH`` is expected instead.

In some functions related to AI pathfinding, add handling or
assertions for invalid room numbers.
2024-11-06 19:03:53 +01:00
Jan Engelhardt
61439b379d net: resolve 1 instance of -Wdelete-incomplete
Descent3/multi_dll_mgr.cpp:974:43: warning: deleting "void*" is
undefined [-Wdelete-incomplete]

(``delete`` requires that types are _complete_, so as to find the
right destructor to call; ``void`` is incomplete by definition.)
2024-11-06 18:19:08 +01:00
Jan Engelhardt
48953868df build: resolve 101 instances of -Wunused-variable 2024-11-04 22:20:18 +01:00
Jan Engelhardt
8d4addecfa d3: resolve 175 instances of -Wunused-variable 2024-11-04 22:20:17 +01:00
Jan Engelhardt
8e30eea951 Resolve crash on inventory pickup
Commit d185ab9514 broke the
pointer-moving logic. When the allweapons cheat is executed or when
e.g. the afterburner is picked up, ASAN terminates the program with:

```
==8330==ERROR: AddressSanitizer: heap-use-after-free on address 0x50f00007ab60
at pc 0x7f23334f6843 bp 0x7ffe724d2b10 sp 0x7ffe724d22d0
READ of size 3 at 0x50f00007ab60 thread T0
    f0 strdup
    f1 Inventory::AddCounterMeasure(int, int, int, int, char const*) Descent3/Inventory.cpp:575
    f2 Inventory::Add(int, int, object*, int, int, int, char const*) Descent3/Inventory.cpp:520
    f3 DemoCheats(int) Descent3/GameCheat.cpp:606
    f4 ProcessKeys() Descent3/GameLoop.cpp:2420
    f5 GameFrame() Descent3/GameLoop.cpp:2956
    f6 GameSequencer() Descent3/gamesequence.cpp:1212
    f7 PlayGame() Descent3/game.cpp:826
    f8 MainLoop() Descent3/descent.cpp:554
    f9 Descent3() Descent3/descent.cpp:507
    f10 oeD3LnxApp::run() Descent3/sdlmain.cpp:142
    f11 main Descent3/sdlmain.cpp:323

0x50f00007ab60 is located 0 bytes inside of 175-byte region [0x50f00007ab60,0x50f00007ac0f)
freed by thread T0 here:
    f1 mng_LoadNetGenericPage(CFILE*, bool) manage/generic.cpp:2216
    f2 mng_LoadNetPages(int) manage/manage.cpp:1281
    f3 mng_LoadTableFiles(int) manage/manage.cpp:648
    f4 InitD3Systems2(bool) Descent3/init.cpp:1891
    f5 Descent3() Descent3/descent.cpp:503
    f6 oeD3LnxApp::run() Descent3/sdlmain.cpp:142
    f7 main Descent3/sdlmain.cpp:323

previously allocated by thread T0 here:
    f0 malloc
    f1 mem_rmalloc<char> mem/mem.h:138
    f2 mng_ReadNewGenericPage(CFILE*, mngs_generic_page*) manage/generic.cpp:1145
    f3 mng_LoadNetGenericPage(CFILE*, bool) manage/generic.cpp:2196
    f4 mng_LoadNetPages(int) manage/manage.cpp:1281
    f5 mng_LoadTableFiles(int) manage/manage.cpp:648
    f6 InitD3Systems2(bool) Descent3/init.cpp:1891
    f7 Descent3() Descent3/descent.cpp:503
    f8 oeD3LnxApp::run() Descent3/sdlmain.cpp:142
    f9 main Descent3/sdlmain.cpp:323
```

The pointer value of mngs_generic_page::description was copied to
object_info::description (by function
``mng_AssignGenericPageToObjInfo``) and then the page was freed in
``mng_LoadNetGenericPage``, leaving object_info::description non-NULL
and dangling.

Fixes: d185ab9514
2024-11-04 11:02:57 +01:00
Jan Engelhardt
6fb7684a85 Fix spello "rturns" 2024-11-04 10:20:54 +01:00
Jan Engelhardt
9b2675b1f7 Fix spello "~full" 2024-11-04 10:20:15 +01:00
Jan Engelhardt
0e6110e78b scripts: resolve 917 instances of -Wunused-variable
scripts/LEVEL0.cpp:1036:27: warning: unused variable "event_data" [-Wunused-variable]
and a lot more.
2024-11-03 23:39:38 +01:00
Jan Engelhardt
c9bf214ede d3: delete empty function bodies 2024-11-03 23:39:38 +01:00
Jan Engelhardt
9687cd5e27 ui: delete empty function bodies 2024-11-03 23:39:38 +01:00
Jan Engelhardt
ab0e1c7f5b scripts: delete empty function bodies 2024-11-03 23:39:38 +01:00
Jan Engelhardt
7fa31b3aa3 scripts: consistent initialization of memory member
Some classes did set it to nullptr and others did not.
For the sake of consistency, initialize it explicitly everywhere.
2024-11-03 23:39:38 +01:00
Jan Engelhardt
46fcae00a2 d3: replace in-constructor assignments by initializations 2024-11-03 23:39:38 +01:00
Jan Engelhardt
a6d37b68e5 ui: replace in-constructor assignments by initializations 2024-11-03 23:39:37 +01:00
Jan Engelhardt
b7838c1a85 scripts: replace in-constructor assignments by initializations 2024-11-03 23:39:37 +01:00
Jan Engelhardt
71772b9c9c Add "final" marker to a number of classes
Devirtualization is an optimization in the generated assembly: when a
class C is polymorphic but also final, ``((C *)ptr)->func()`` can be
turned from an indirect into a static call.
2024-11-03 23:39:37 +01:00
Jan Engelhardt
a58c2752e5 build: resolve 2107 instances of -Wdelete-non-virtual-dtor
scripts/Y2K.cpp:467:5: warning: deleting object of polymorphic class type
"LevelScript_0000" which has non-virtual destructor might cause undefined
behavior [-Wdelete-non-virtual-dtor]
  467 |     delete ((LevelScript_0000 *)ptr);
2024-11-03 23:39:37 +01:00
Louis Gombert
d51ce964c7
Merge pull request #640 from pzychotic/fix-win-x86-build
Fix Windows x86 build
2024-10-29 20:20:07 +00:00
Louis Gombert
b0b7eee859
Merge pull request #641 from pzychotic/log-to-vs-output
Enable logging to VS output window
2024-10-29 20:15:52 +00:00
Louis Gombert
f6faeaacb7
Merge pull request #637 from winterheart/cmake-makehogs
Optimize making HOG files
2024-10-29 20:05:57 +00:00
Azamat H. Hackimov
44806e77f0 Restore proper module names for netgames
Using names as defined in Steam installation.
2024-10-27 22:04:00 +03:00
Azamat H. Hackimov
72e8347fe1 Move Descent3 built targets into "${CMAKE_BINARY_DIR}/build" directory
This solves problem of inability determine generated output directory of libraries targets. Now `add_custom_command()`, used on HOG generation, correctly locates all needed paths and not depends on generated variables.
2024-10-27 22:04:00 +03:00
Thomas Roß
09a961988d [Renderer] Added missing calling convention in FnPtr template declaration
This fixes compilation of Windows x86 builds when creating template instantiations of FnPtr with functions using __stdcall.
2024-10-27 16:28:50 +01:00
Thomas Roß
e88fe1845a [Logger] Enable logging to VS output window 2024-10-27 16:09:06 +01:00
Azamat H. Hackimov
73d2764573
Merge pull request #639 from Lgt2x/audio-messages
Do no try opening audio streams when the '-nosound' option is specified
2024-10-27 12:52:39 +03:00
Louis Gombert
a8e88b624d Do no try opening audio streams when the '-nosound' option is specified
When the option was specified, many messages were spamming the console in debug mode "Error opening stream X.osf on channel Y."
2024-10-26 18:46:41 +02:00
Azamat H. Hackimov
cc7fbd46ed Don't rebuild HogMaker on each commit
Remove configure-time dependency get_git_hash that cause to rebuild whole graph of dependencies (like HOG files).
2024-10-21 18:20:32 +03:00
Azamat H. Hackimov
46c6b55f5c Enable cross-compile environment for HogMaker
Add CMAKE_CROSSCOMPILING conditional for HogMaker that makes it "external" tool in cross-compile environment, so we can use native HogMaker for cross-compiled targets.
2024-10-21 18:13:49 +03:00
Azamat H. Hackimov
39b205b957 Optimize building of HOG files and netgames libraries
Don't force building HOG files if dependency files are up-to-date.
Simplify building libraries by copying them into Descent3 directory.
2024-10-21 16:56:40 +03:00
Louis Gombert
496b2ed7c9
Merge pull request #613 from winterheart/mission-list
Enhance mission levels select window
2024-10-20 21:00:03 +02:00
Louis Gombert
33edddde80
Merge pull request #636 from sebholt/renderer_fixes
Fix some compiler warnings in the renderer
2024-10-20 19:49:09 +02:00
Sebastian Holtermann
9a536021aa renderer/HardwareBaseGPU: Fix compiler warnings 2024-10-20 00:04:13 +02:00
Sebastian Holtermann
19c7611ce5 renderer/HardwareOpenGL: Use mem_rmalloc instead of mem_malloc 2024-10-19 23:23:19 +02:00