From 46049705f44a6427fea163547631fee933329c31 Mon Sep 17 00:00:00 2001 From: Ally Date: Fri, 25 Sep 2020 14:35:03 -0300 Subject: [PATCH] Fix entities in the Warp Zone's gray tileset not being gray in the editor (#480) In-level, they were made to be gray in #323. The editor does not reflect this however; they're still shown as green. For the same reasons in #323, this adds special cases to draw the entities as gray. Closes #372. Also, I changed my name in contributors.txt to be my username as I didn't feel comfortable with it being my name. Co-authored-by: Misa --- desktop_version/CONTRIBUTORS.txt | 2 +- desktop_version/src/Credits.h | 2 +- desktop_version/src/editor.cpp | 48 +++++++++++++++++--------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/desktop_version/CONTRIBUTORS.txt b/desktop_version/CONTRIBUTORS.txt index 46631819..d54460de 100644 --- a/desktop_version/CONTRIBUTORS.txt +++ b/desktop_version/CONTRIBUTORS.txt @@ -5,6 +5,7 @@ Contributors * Matt "Fußmatte" Aaldenberg * AlexApps99 (@AlexApps99) +* AllyTally (@AllyTally) * Christoph Böhmwalder (@chrboe) * Charlie Bruce (@charliebruce) * Brian Callahan (@ibara) @@ -22,7 +23,6 @@ Contributors * Elijah Stone * Thomas Sänger (@HorayNarea) * Info Teddy (@InfoTeddy) -* Alexandra Tildea (@AllyTally) * Pierre-Alain TORET (@daftaupe) * leo60228 (@leo60228) * Emmanuel Vadot (@evadot) diff --git a/desktop_version/src/Credits.h b/desktop_version/src/Credits.h index 938e8662..38f1769f 100644 --- a/desktop_version/src/Credits.h +++ b/desktop_version/src/Credits.h @@ -86,6 +86,7 @@ static const char* patrons[] = { static const char* githubfriends[] = { "Matt \"Fussmatte\" Aaldenberg", // TODO: Change to "Fußmatte" if/when UTF-8 support is added "AlexApps99", + "AllyTally", "Christoph B{hmwalder", "Charlie Bruce", "Brian Callahan", @@ -103,7 +104,6 @@ static const char* githubfriends[] = { "Elijah Stone", "Thomas S|nger", "Info Teddy", - "Alexandra Tildea", "leo60228", "Emmanuel Vadot", "Remi Verschelde", // TODO: Change to "Rémi" if/when UTF-8 support is added diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index ebddba2a..b92fc295 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -2642,6 +2642,13 @@ void editorrender() int temp2=edentat(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30)); + // Special case for drawing gray entities + int current_room = (ed.levx+(ed.levy*ed.maxwidth)); + bool custom_gray = INBOUNDS_ARR(current_room, ed.level) + && ed.level[current_room].tileset == 3 && ed.level[current_room].tilecol == 6; + colourTransform gray_ct; + gray_ct.colour = 0xFFFFFFFF; + // Draw entities backward to remain accurate with ingame for (int i = edentity.size() - 1; i >= 0; i--) { @@ -2657,6 +2664,10 @@ void editorrender() switch(edentity[i].t) { case 1: //Entities + if (custom_gray) { + graphics.setcol(18); + ed.entcolreal = graphics.ct.colour; + } graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),ed.getenemyframe(ed.level[ed.levx+(ed.levy*ed.maxwidth)].enemytype),ed.entcolreal); if(edentity[i].p1==0) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "V", 255, 255, 255 - help.glow, false); if(edentity[i].p1==1) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "^", 255, 255, 255 - help.glow, false); @@ -2670,13 +2681,11 @@ void editorrender() drawRect = graphics.tiles_rect; drawRect.x += tpoint.x; drawRect.y += tpoint.y; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL,graphics.backBuffer, &drawRect); + for (int i = 0; i < 4; i++) { + if (custom_gray) BlitSurfaceTinted(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect, gray_ct); + else BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); + drawRect.x += 8; + } if(edentity[i].p1<=4) { @@ -2705,14 +2714,11 @@ void editorrender() drawRect = graphics.tiles_rect; drawRect.x += tpoint.x; drawRect.y += tpoint.y; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL,graphics.backBuffer, &drawRect); - + for (int i = 0; i < 4; i++) { + if (custom_gray) BlitSurfaceTinted(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect, gray_ct); + else BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); + drawRect.x += 8; + } } if(edentity[i].p1==7) @@ -2732,13 +2738,11 @@ void editorrender() drawRect = graphics.tiles_rect; drawRect.x += tpoint.x; drawRect.y += tpoint.y; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); - drawRect.x += 8; - BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL,graphics.backBuffer, &drawRect); + for (int i = 0; i < 4; i++) { + if (custom_gray) BlitSurfaceTinted(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect, gray_ct); + else BlitSurfaceStandard(graphics.entcolours[obj.customplatformtile],NULL, graphics.backBuffer, &drawRect); + drawRect.x += 8; + } graphics.Print((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8), "////", 255 - help.glow, 255 - help.glow, 255 - help.glow, false); fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));