Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
806 stars 65 forks source link

Fix motion cursor color for weapon #218

Closed donnierussellii closed 5 years ago

donnierussellii commented 5 years ago

Also fix cursor-related crashes when changing screen resolution combined with entering/exiting cyberspace.

donnierussellii commented 5 years ago

Added general-use CalcMotionCurOffset() that functions call.

Interrupt commented 5 years ago

Ran into a crash testing this. Steps to reproduce:

12:30:23 WARN  resfile.c:217: ResCloseFile: filenum 7 not in use
Segmentation fault: 11
donnierussellii commented 5 years ago

I pick up the pipe and try to put it in the first slot, which should put slot one weapon on cursor. I think something wrong is going on in push_cursor_object().

This crash happens in the 0.6 release version as well, so I think it's unrelated to this PR.

I'll try to fix the crash with commits to this PR.

donnierussellii commented 5 years ago

The ctrl+2 cheat command adds weapons to an array, but does not actually create real obj's that can be dropped. When the game tries to put one of these "fake" objects on the cursor, it has nothing to work with.

Adding a null bmp check in push_cursor_object() to prevent the crash...

With a new game and the weapon slots all empty, when I ctrl+2 I can't drop any of the weapons.

But, starting with a new game, if I pick up the pipe, then ctrl+2, then right click the first weapon slot, the slot weapon disappears but nothing appears on the cursor.

The cheat commands in general are very hacky. For example, weapons are added without filling in all of the struct members, which can cause a crash if the ammo type is out of range.