OpenDR icon indicating copy to clipboard operation
OpenDR copied to clipboard

Shooting in the 1 o'clock direction causes a crash in DefaultSpriteSequence

Open drogoganor opened this issue 7 years ago • 1 comments

When shooting in the 1 o'clock direction (or north north-east), an exception occurs due to a large facing value. This only seems to happen for sprites with 24 facings and multiple animation frames.

firingangle

Culprit sequences are: eolaspr2.spr, eorgnpr0.spr, eorgnpr1.spr. The default laser weapon used by the base troop Raider (FG) or Guardian (Imperium) will do it.

Currently I'm addressing this with a copy of DefaultSpriteSequence: HackySpriteSequence. Line 345 contains a hack to always choose a valid facing.

// TODO: DR hack!
int newIndex = start + i;
if (newIndex >= sprites.Length)
	newIndex = sprites.Length - 1;

To reproduce, place a breakpoint in the block above (line 345, HackySpriteSequence.cs), start the game, go to Single Player, Missions, Mission Test, select a Raider, and force fire in the 1 o'clock direction.

drogoganor avatar Apr 10 '18 10:04 drogoganor

This can be reproduced in RA by doing the following:

  1. Download buggedprojectile.zip and extract the .shp file into the bits folder.
  2. Add the following lines to sequences/misc.yaml:
buggedprojectile:
	idle:
		Length: 3
		Facings: 24
  1. Edit weapons/ballistics.yaml and alter 25mm like so:
25mm:
	[...]
	Projectile: Bullet
		[...]
		Image: BUGGEDPROJECTILE
  1. Play a skirmish and build a light tank. Shoot in the 1 o'clock direction.

drogoganor avatar Jul 31 '18 04:07 drogoganor