Commit Graph
61 Commits
Author SHA1 Message Date
Goober5000 0c5b04c427 additional null checks
Found a null pointer CTD in modelanim that slipped through initial testing.  Also added some defense-in-depth null checks to scripting.
2020-12-22 04:22:10 -05:00
Goober5000 88c1d8a02a consolidate model instance code 2020-12-18 01:32:43 -05:00
Goober5000 3fdc5a3784 cur_turn_rate -> current_turn_rate 2020-12-08 12:33:29 -05:00
Baezon d4c5693e97 fix animation 2020-11-13 14:22:49 -05:00
Fabian Woltermann 7487fc3042 Address review comments 2020-06-23 17:44:52 +02:00
Fabian Woltermann 3d76c5dde0 Use modern loops to make travis happy 2020-06-22 11:07:13 +02:00
Fabian Woltermann 3bc5e7a729 Correct a casting error 2020-06-21 21:12:52 +02:00
Fabian Woltermann 74c87e2304 Trigger turret firing and turret fired anims 2020-06-21 19:25:50 +02:00
Fabian Woltermann ec494f0229 Change the model anim type enums to a enum class 2020-06-21 14:51:43 +02:00
Goober5000 cacee6e5b8 a few more 2020-03-02 01:07:17 -05:00
Goober5000 a069eb62f9 apply fix for model_anim_get_time_type (Mantis 2542)
This patch was posted in 2011 but never applied.  Here's a PR to remedy that.

Mantis ticket:
http://scp.indiegames.us/mantis/view.php?id=2542

Original thread:
http://www.hard-light.net/forums/index.php?topic=79068.0
2019-12-14 00:39:58 -05:00
asarium 8f4d51b14a Convert ade_get_args to variadic template based solution
This maintains the type information which can be used for enforce
const-correctness and also for implementing more advanced ways of
handling the type information.
2018-09-26 19:15:42 +02:00
asarium 8f06e338a4 Add typesafe handle types and use it in game sound system
This adds a new class which allows to create type safe resource handle
types. At the moment, the engine uses ints pretty much everywhere for
providing handles to resources created by the specific subsystems. Since
all ints are the same to the C/C++ typesystem it is perfectly legal to
pass a sound handle to the graphics API as a buffer handle which will
obviously cause issues.

This adds a new type called "ID" which is a wrapper class for a generic
handle but with added type safety. An instance of this class cannot be
passed to a function expecting another type of handle which provided
compile-time type safety for these APIs.

As an initial test I converted the game sound handles to this new type.
I already found a bug in the mainhall system thanks to this new type.
The mainhall used the game sound handles as sound instance handles which
probably meant that that specific code never really worked right. I
removed the code since there was no better alternative for fixing it.
2018-04-22 16:22:45 +02:00
Fabian Woltermann 512887482a use correct array lookups (how did VS not find these....?) 2018-03-10 18:00:30 +01:00
Fabian Woltermann 04fd9679bd Fix mprintf calls 2018-03-10 14:06:12 +01:00
Fabian Woltermann 85874105e3 Remove unnecessary early exit 2018-03-10 12:17:17 +01:00
Fabian Woltermann 248b70b780 Replace this assert with a proper exit path + debug log print 2018-03-10 12:11:17 +01:00
asarium f819db3ac5 More string const correctness fixes 2017-01-04 00:12:41 +01:00
Fabian Woltermann 1acfaa8157 Converts model subsystem flags 2016-08-19 14:59:15 +02:00
niffiwan 0a041aade1 Fix issue with memcpy on overlapping memory
Triggered animations (e.g. models with rotating afterburner flaps)
could trigger a memcpy on overlapping memory. This may not have caused
issues, but is undefined behaviour according to the spec
Also see #574
2016-04-06 20:26:34 +10:00
Goober5000 bd3cd7eb18 Merge pull request #195 from Echelon9/fix/sort-uniq-includes
Review and refactor #include's
2015-08-19 00:05:02 -04:00
The E 0450ce7621 Make this assertion in modelanim a bit more useful. 2015-07-31 22:25:25 +02:00
Echelon9 85a0bda946 Fix: model/modelanim.cpp:536:78: warning: declaration of ‘anim’ shadows a global declaration [-Wshadow] 2015-07-06 20:54:14 +10:00
Echelon9 c5493bb480 Scripted sort and uniq on (internal) project includes. Improves search time and as a by product removed a number of duplicative includes. 2015-06-22 20:24:30 +10:00
The_E 971192ab30 From MageKing17: Patch for Mantis 3061 (Turrets can't have an initial rotation defined)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10822 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
Echelon9 7241a6b686 Fix Coverity 1093669 Out-of-bounds access: In triggered_rotation::add_queue(queued_animation *, int): Out-of-bounds access to a buffer (CWE-119). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10381 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Goober5000 2c34ca0218 fix Mantis #2994: a model can have initial animation states even if it doesn't have animations
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10277 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
zookeeper 7ff59d0559 Enabled fighterbay door animations to better define which bay path must be used or not used for the animation to trigger using +sub_type. Fixes the (undocumented) current numbering of fighterbay +sub_types to be 1-based instead of 0-based. Turns the SUBTYPE_CHECK macro to a proper function.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10194 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Goober5000 ed06a01897 restore r10051, this time allocating triggered_rotation instances when we need them
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10057 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
The_E c0a3d69ed2 Revert revision 10051: If we're going to use a global vector to store animation info, we need to fill it (and the references to it) too.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10054 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 d11c7ccc2f ship subsystems should reference an index in a global Triggered_rotations vector rather than maintaining their own class object, which wastes space
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10051 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 6836199eeb ship_subsys is now a class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10021 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
niffiwan 24e7810b24 Coverity fixes from Flaming_Sword
Uninitialized scalar field 1093859 1093917 1093810
Out-of-bounds read/access 1093669 1093670
Logically dead code 1093413 1093396 1093407 1093408 1093409 1093410 1093423 1093427 1093390
Allocation size mismatch 1093729 1093728
Unused pointer value 1093921 1093922
Wrong sizeof argument 1093732 1093731
Operands don't affect result 1093365
Dereference after null check/return value 1093475 1093455 1093627

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9979 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:50 +10:00
Goober5000 2ee1b24b65 queued_animation uses a mess of memcpy and memset, so make sure it's a plain struct!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9818 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
The_E 9cec60f23d Fix for Mantis 1596: Adds "turret-fired" animation trigger 2012-11-28 20:08:07 +00:00
chief1983 4e5d3e2e57 Fix all the 'no newline at end of file' warnings I saw thrown by gcc on FreeBSD. 2012-11-02 17:30:17 +00:00
Echelon9 791146c9ac GCC warnings: first pass of warning: variable is set but not used 2012-06-12 15:32:47 +00:00
The_E d1c6d894eb Forgot newlines 2012-02-24 23:51:03 +00:00
The_E 5287c93dfe Deprecating stuff: Good. Printing messages to the log: Good. Using Warning() instead of mprintf(): Bad. 2012-02-24 23:25:00 +00:00
Goober5000 5e2d53fba5 coded for Mantis #2587 but not actually used... this can allow a series of animations to be pushed and then popped 2012-01-29 09:19:40 +00:00
Goober5000 0b8089d07f Vasudan Admiral's fix for the modelanim code 2012-01-29 05:05:59 +00:00
Goober5000 c84812fbda herp a big derp 2012-01-29 02:58:29 +00:00
Goober5000 ceb53cbb30 derp 2012-01-29 02:32:19 +00:00
Goober5000 f8c5a31a6a VA says this might work? 2012-01-29 02:26:26 +00:00
Zacam a3c0ed6880 Fix to Trunk r8379, for want of a ; a compile was lost. 2012-01-28 07:07:07 +00:00
Goober5000 7d99d1016a update docking code some more
add code logic to (theoretically) set submodels instantly to initial or final positions
2012-01-28 02:51:42 +00:00
Goober5000 e4c749ed2c enhancement for bug 2582: trigger animations on BOTH ships undergoing docking 2012-01-27 07:42:13 +00:00
Goober5000 a54cfd15de partial fix for Mantis #2582:
--add Vasudan Admiral's fix for setting submodels to their initial positions
--add trigger for moving submodels to their docked positions when an initially-docked ship arrives
2012-01-26 03:57:23 +00:00
Goober5000 de6eb9460d upgrades to the docking system to incorporate docking animations -- incidentally, fixes Mantis #2581
also, remove DOCK_BACKUP_RETURN_VAL which never did anything even in retail
2012-01-23 23:27:06 +00:00
The_E e3039d3ea4 PVS Studio fix: V570 The 'end_angle.a1d [axis]' variable is assigned to itself. 2011-08-30 13:55:36 +00:00