Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Maintenance & Feedback » JJ2+ Issue Tracker

Bug Report Divide by zero crash when using 3D spiked balls

happygreenfrog

JCF Member

Joined: Jan 1970

Posts: 23

happygreenfrog has disabled reputation

Jan 19, 2018, 06:43 PM
happygreenfrog is offline
Reply With Quote
Divide by zero crash when using 3D spiked balls

Using a 3D Spiked Ball with a length of 15 and fast enough speed (I haven't figured out the minimum speed that causes all of the effects mentioned below, but it definitely happens at speed 31) causes the game to crash with a divide by zero error. However, an oddity of this is that if the level is short enough, the 3D spike ball instead simply falls down instead of crashing the game. Note that, in my testing, the crash also only happens for pendulum 3D Spike Balls, though due to the nature of the crash it's possible that was simply due to the exact level layout used to test it. Shading doesn't appear to change whether or not the crash happens however.

This ZIP file includes two levels: A level demonstrating the divide by zero crash, and a level demonstrating a lack of the divide by zero crash under similar settings (the only change is the level height). https://drive.google.com/file/d/1yuM...ew?usp=sharing
__________________
Words. More words. Line. Insert text here. Placeholder. Lorem ipsum dolor sit amet. Uh... I guess I should put something proper here one day.
¯\_(?)_/¯
Violet CLM

Administrator

Joined: Mar 2001

Posts: 11,302

Violet CLM has disabled reputation

Apr 17, 2026, 03:18 PM
Violet CLM is offline
Reply With Quote
I looked into this at the time but neglected to report my findings. These function/variable names are from g_Ai.c:
Quote:
From what I can tell, the dividing by zero is because there's one or more AddRotSprite calls in Swinger3D getting passed (a multiple of) 256 for the a6 (scale) argument, but it's an 8-bit argument and is getting reduced to 0. Basically, length 15 for 3D spike bolls tries to draw sprites larger than the game is capable of handling. The only reason this doesn't happen in the NEGATED level is that the object gets sufficiently far outside the bounds of the level to be deactivated before it can try to be drawn at the offending size.
So maybe the spike bolls shouldn't be allowed to be 15 long to begin with.
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 02:21 AM.