1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00
VVVVVV/desktop_version/src
Misa 4570140a6a Fix teleporter sprites sometimes being solid colors
This commit fixes a bug that also sometimes occurred in 2.2, where the
teleporter sprite would randomly turn into a solid color and just be a
solid circle with no detail.

Why did this happen? The short answer is an incorrect lower bound when
clamping the teleporter sprite index in `Graphics::drawtele()`. The long
answer is bad RNG with the teleporter animation code. This commit fixes
the short answer, because I do not want to mess with the long answer.

So, here is what would happen: the teleporter's `tile` would be 6. The
teleporter code decrements its `framedelay` each frame. Then when it
reached a `framedelay` of 0, it would call `fRandom()` and essentially
ask for a random number between 0 and 6. If the RNG ended up being
greater than or equal to 4, then it would set its `walkingframe` to -5.
At the end of the routine, the teleporter's `drawframe` ends up being
its `tile` plus its `walkingframe`. So having a `walkingframe` of -5
here is fine, because its `tile` is 6.

Until it isn't. When its `tile` becomes 2, it still keeps its
`walkingframe` around. The code that runs when its `tile` is 2 does have
the possibility of completely resetting its `walkingframe` to be in
bounds (in bounds after its `tile` is added), but that only runs when
its `framedelay` is 0, and in the meantime it'll just use the previous
`walkingframe`.

So you could have a `walkingframe` of -5, plus a `tile` of 2, which
produces a `drawframe` of -3. Then `Graphics::drawtele()` will clamp
that to 0, which just means it'll draw the teleporter backing, and the
teleporter backing is a simple solid color, so the teleporter will end
up being completely and fully solid.

To fix this, I just made `Graphics::drawtele()` clamp to 1 on the lower
bound, instead of 0. So if it ever gets passed a negative teleporter
index, it'll just draw the normal teleporter sprite instead, which is
better.
2020-11-03 19:12:31 -05:00
..
BinaryBlob.cpp Use SDL stdlib funcs for free/malloc/strcmp 2020-08-14 09:51:19 -04:00
BinaryBlob.h Check index of tracks in musicclass::init() 2020-08-14 09:51:19 -04:00
BlockV.cpp Remove unnecessary string initializations from constructors 2020-07-08 19:14:21 -04:00
BlockV.h Consistently use angle brackets for SDL.h includes 2020-07-19 21:37:40 -04:00
Credits.h Fix entities in the Warp Zone's gray tileset not being gray in the editor (#480) 2020-09-25 13:35:03 -04:00
editor.cpp Remember loaded custom level and read from it when saving 2020-11-03 13:30:53 -05:00
editor.h Remember loaded custom level and read from it when saving 2020-11-03 13:30:53 -05:00
Ent.cpp Add entclass::ishumanoid() 2020-11-03 13:31:56 -05:00
Ent.h Add entclass::ishumanoid() 2020-11-03 13:31:56 -05:00
Entity.cpp Disable hardcoded (10,5) no-follow rule in custom levels 2020-11-01 23:15:00 -05:00
Entity.h Remove now-unused entityclass::hormovingplatformfix() 2020-10-11 16:18:30 -04:00
Enums.h Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00
FileSystemUtils.cpp Fix other array decay too 2020-08-09 13:39:12 -04:00
FileSystemUtils.h Only re-color one-ways if assets are not mounted 2020-06-30 18:06:14 -04:00
Finalclass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Finalclass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Game.cpp Axe BoolToString() in favor of int casts 2020-11-03 13:30:53 -05:00
Game.h Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
GOGNetwork.c Ifdef out network code for M&P 2020-08-02 23:43:55 -04:00
Graphics.cpp Fix teleporter sprites sometimes being solid colors 2020-11-03 19:12:31 -05:00
Graphics.h Factor out entity drawing to separate function 2020-11-03 13:31:56 -05:00
GraphicsResources.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
GraphicsResources.h Consistently use angle brackets for SDL.h includes 2020-07-19 21:37:40 -04:00
GraphicsUtil.cpp Don't hardcode SDL_CreateRGBSurface BitsPerPixel/mask args 2020-09-08 16:16:40 -04:00
GraphicsUtil.h Axe endian_swap() function and template 2020-09-08 16:16:40 -04:00
Input.cpp Remove kludge_to_bg() and bg_to_kludge() 2020-11-03 13:25:03 -05:00
Input.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
KeyPoll.cpp Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
KeyPoll.h Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
Labclass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Labclass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Logic.cpp Move title usages of towerbg to titlebg 2020-11-03 13:25:03 -05:00
Logic.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
main.cpp Move horizontal/vertical warp backgrounds to separate buffers 2020-11-03 13:25:03 -05:00
MakeAndPlay.h Re-comment out #define MAKEANDPLAY 2020-02-09 10:42:03 -05:00
Map.cpp Remove kludge_to_bg() and bg_to_kludge() 2020-11-03 13:25:03 -05:00
Map.h Remove kludge_to_bg() and bg_to_kludge() 2020-11-03 13:25:03 -05:00
Maths.h Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00
Music.cpp Clean up music handling to one place 2020-10-11 16:16:57 -04:00
Music.h Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
Network.c Remove unnecessary externs from network func forward decls 2020-08-02 23:43:55 -04:00
Network.h Add support for multiple Network backends, stub in GOGNetwork 2020-01-13 11:15:22 -05:00
Otherlevel.cpp Bounds check all entity getters that can return 0 2020-09-25 13:51:47 -04:00
Otherlevel.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
preloader.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
preloader.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Render.cpp Move title usages of towerbg to titlebg 2020-11-03 13:25:03 -05:00
Render.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Screen.cpp Factor out icon loading to Screen::LoadIcon() 2020-11-01 13:59:13 -05:00
Screen.h Factor out icon loading to Screen::LoadIcon() 2020-11-01 13:59:13 -05:00
Script.cpp Move title usages of towerbg to titlebg 2020-11-03 13:25:03 -05:00
Script.h Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
Scripts.cpp Make 'custom_' check more readable 2020-09-27 16:31:40 -04:00
SoundSystem.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
SoundSystem.h Revert "Add destructor for SoundTrack/MusicTrack (and explicitly define move constructor to prevent double-free)" 2020-06-07 22:40:03 -04:00
Spacestation2.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Spacestation2.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
SteamNetwork.c Ifdef out network code for M&P 2020-08-02 23:43:55 -04:00
TerminalScripts.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Textbox.cpp Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
Textbox.h Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
Tower.cpp Remove zeroed arrays from tower functions in M&P 2020-08-03 00:29:15 -04:00
Tower.h Change all tilemaps to be short[1200] instead of int[1200] 2020-07-19 16:25:53 -04:00
TowerBG.h Refactor tower background to use a separate object instead 2020-11-03 13:25:03 -05:00
UtilityClass.cpp Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
UtilityClass.h Clean up and prevent unnecessary qualifiers to self 2020-09-28 01:34:40 -04:00
WarpClass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
WarpClass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
XMLUtils.cpp Add XMLUtils.cpp and XMLUtils.h 2020-11-03 13:30:53 -05:00
XMLUtils.h Add XMLUtils.cpp and XMLUtils.h 2020-11-03 13:30:53 -05:00