lemon32767 / ccleste

Celeste Classic C source port for 3DS and PC.
206 stars 38 forks source link

Fix minor bugs with hair and SFX #5

Closed ayuusweetfish closed 3 years ago

ayuusweetfish commented 3 years ago

Hi! I am porting ccleste to other platforms with raylib, and have spotted issues with simple fixes. Details are as follows.

(1) SFX 9 should be played on triggering an invalid dash

This is caused by mistranslation of a block at line 279 of the original code.

    if this.spd.x!=0 then
     this.dash_accel.y*=0.70710678118
    end
   elseif dash and this.djump<=0 then
    psfx(9)
    init_object(smoke,this.x,this.y)
   end

The elseif is not paired with the if (as there is already an end); it is for the outer one. This can be very misleading if tabstop is set to 2 :rofl:

(2) The last circle for the character's hair is not drawn

The original game draws 5 circles, but ccleste draws only 4.

There are similar structures (looping with while (!isLast) to emulate foreach in the original Lua code) for clouds and particles. This issue does not affect clouds, as only the 25th cloud in the stage will disappear, and there are not as many clouds in-game; but for particles I have not looked into more details. Maybe I will update the commit later.

lemon32767 commented 3 years ago

Thanks for the contribution! Admittedly, the code isn't well formatted, so I completely missed that misleading elseif, and I took a very lazy approach to translating those foreach loops, which naturally ended up being error prone 😅.

As for the other effects, the game uses 17 clouds and 25 particles, and I believe I'm making the same off-by-one error and processing only 16 and 24 respectively, looking at it now. I'll correct all of the while (!isLast) to ensure correctness.

lemon32767 commented 3 years ago

Commit ffe6229b95e7af0a055d86f505ff67c13523cc5c should ensure clouds and particles don't have the same issue. Thanks again for the pull request!