From 25d00b9ba6ca884486668bb86e0b1f9eaa6de559 Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 31 Oct 2020 23:23:40 -0700 Subject: [PATCH] Fix crewmates being drawn behind other entities This fixes the draw order by drawing all other entities first, before then drawing all humanoids[1] after, including the player afterwards. This is actually a regression fix from #191. When I was testing this, I was thinking about where get a crewmate in front of another entity in the main game, other than the checkpoints in Intermission 1. And then I thought about the teleporters, because I remember the pre-Deep Space cutscene in Dimension Open looking funny because Vita ended up being behind the teleporter. (Actually, a lot of the cutscenes of Dimension Open look funny because of crewmates standing behind terminals.) So then I tried to get crewmates in front of teleporters. It actually turns out that you can't do it for most of them... except for Verdigris. And then that's what I realized why there was an oddity in WarpClass.cpp when I was removing the `active` system from the game - for some reason, the game put a hole in `obj.entities` between the teleporter and the player when loading the room Murdering Twinmaker. In a violation of Chesterton's Fence (the principle that you should understand something before removing it), I shrugged it off and decided "there's no way to support having holes with my new system, and having holes is probably bad anyway, so I'm going to remove this and move on". The fact that there wasn't any comments clarifying the mysterious code didn't help (but, this *was* 2.2 code after all; have you *seen* 2.2 code?!). And it turns out that this maneuver was done so Verdigris would fill that hole when he got created, and Verdigris being first before the teleporter would mean he would be drawn in front of the teleporter, instead of being behind it. So ever since b1b1474b7bbc3ceddea24f689a7ddb050cfe4490 got merged, there has actually been a regression from 2.2 where Verdigris got drawn behind the teleporter in Murdering Twinmaker, instead of properly being in front of it like in 2.2 and previous. This patch fixes that regression, but it actually properly fixes it instead of hacking around with the `active` system. Closes #426. [1]: I'm going to go on a rant here, so hear me out. It's not explicitly stated that the characters in VVVVVV are human. So, given this information, what do we call them? Well, the VVVVVV community (at least the custom levels one, I don't think the speedrunning community does this or is preoccupied with lore in the first place) decided to call them "villis", because of the roomname "The Villi People" - which is only one blunder in a series of awful headcanons based off of the assumption that the intent of Bennett Foddy (who named the roomnames) was to decree some sort of lore to the game. Another one being "Verdigris can't flip" because of "Green Dudes Can't Flip". Then an OC (original character) got named based off of "The Voon Show" too. And so on and so forth. --- desktop_version/src/Graphics.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 11b01261..bf913c18 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1595,9 +1595,30 @@ void Graphics::drawentities() { const int yoff = map.towermode ? lerp(map.oldypos, map.ypos) : 0; - for (int i = obj.entities.size() - 1; i >= 0; i--) + if (!map.custommode) { - drawentity(i, yoff); + for (int i = obj.entities.size() - 1; i >= 0; i--) + { + if (!obj.entities[i].ishumanoid()) + { + drawentity(i, yoff); + } + } + + for (int i = obj.entities.size() - 1; i >= 0; i--) + { + if (obj.entities[i].ishumanoid()) + { + drawentity(i, yoff); + } + } + } + else + { + for (int i = obj.entities.size() - 1; i >= 0; i--) + { + drawentity(i, yoff); + } } }