From f54e325b9e712da371df86037939d6f696a40480 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 12 Feb 2019 04:44:48 +0000 Subject: [PATCH 1/3] Removed junk cursor resource files --- res/CURSOR/CURSOR_IKA.png | Bin 400 -> 0 bytes res/CURSOR/CURSOR_NORMAL.png | Bin 338 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 res/CURSOR/CURSOR_IKA.png delete mode 100644 res/CURSOR/CURSOR_NORMAL.png diff --git a/res/CURSOR/CURSOR_IKA.png b/res/CURSOR/CURSOR_IKA.png deleted file mode 100644 index c497cca7c126dae9ebd94eea5bc78d32851fb251..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-G$+Qd;gjJKpuOE zr>`sfBTgX!UB2CKEUy5CW_Y?dhIkx*JH=6~L4m{N`3t$;*%uEfIlClWb&C3#@{eWF z0sE%8`fMAT4iyPcm?+&aO)G(^;oy{C-JbtqmoluExnGpjuNSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fg!5QEa;tHf0{xkgl|KD>b zM;wsNSQ6wH%;50sMjD8d21sKjP%)Ru|yp(SHXNvh;Lu43W5; zoY27NW^tJD7)OJlQ$kMwI`hEN8-m9Y8YFuYI;<8LM@YWlWjIsH@$LNcLnc5&R7+eV zN>UO_QmvAUQh^kMk%6Iwu7Rblp=pSrp_Q?vm7$rgfw`4|fuc-iJ&K0h{FKbJO57R( T94{UQYGCkm^>bP0l+XkKXc<~- From 3a08ad500654024b2c37cd0892ef2cb79960c001 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 12 Feb 2019 14:30:07 +0000 Subject: [PATCH 2/3] Fixed 3x window upscaling SDL's upscaler is stupid, and wound up being off-by one... on an *integer-factor upscale* --- src/Draw.cpp | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/src/Draw.cpp b/src/Draw.cpp index 2a0f41aa..e7db6f51 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -189,21 +189,51 @@ static bool LoadBitmap(SDL_RWops *fp, int surf_no, bool create_surface) { if (create_surface == false || MakeSurface_Generic(surface->w, surface->h, surf_no)) { - SDL_Surface *converted_surface = SDL_ConvertSurface(surface, surf[surf_no].surface->format, 0); - - if (converted_surface == NULL) + if (gWindowScale == 1) { - printf("Couldn't convert bitmap to surface format (surface id %d)\nSDL Error: %s\n", surf_no, SDL_GetError()); - } - else - { - SDL_Rect dst_rect = {0, 0, converted_surface->w * gWindowScale, converted_surface->h * gWindowScale}; - SDL_BlitScaled(converted_surface, NULL, surf[surf_no].surface, &dst_rect); - SDL_FreeSurface(converted_surface); + SDL_Rect dst_rect = {0, 0, surface->w, surface->h}; + SDL_BlitSurface(surface, NULL, surf[surf_no].surface, &dst_rect); surf[surf_no].needs_updating = true; printf(" ^ Successfully loaded\n"); success = true; } + else + { + SDL_Surface *converted_surface = SDL_ConvertSurface(surface, surf[surf_no].surface->format, 0); + + if (converted_surface == NULL) + { + printf("Couldn't convert bitmap to surface format (surface id %d)\nSDL Error: %s\n", surf_no, SDL_GetError()); + } + else + { + // Upscale the bitmap to the game's native resolution (SDL_BlitScaled is buggy, so we have to do it on our own) + const unsigned char (*src_pixels)[converted_surface->pitch] = (unsigned char(*)[converted_surface->pitch])converted_surface->pixels; + unsigned char (*dst_pixels)[surf[surf_no].surface->pitch] = (unsigned char(*)[surf[surf_no].surface->pitch])surf[surf_no].surface->pixels; + + for (int h = 0; h < converted_surface->h; ++h) + { + const unsigned long *src_row = (unsigned long*)src_pixels[h]; + unsigned long *dst_row = (unsigned long*)dst_pixels[h * gWindowScale]; + + for (int w = 0; w < converted_surface->w; ++w) + { + const unsigned long src_pixel = *src_row++; + + for (int i = 0; i < gWindowScale; ++i) + *dst_row++ = src_pixel; + } + + for (int i = 1; i < gWindowScale; ++i) + memcpy(dst_pixels[(h * gWindowScale) + i], dst_pixels[h * gWindowScale], surf[surf_no].surface->w * sizeof(unsigned long)); + } + + SDL_FreeSurface(converted_surface); + surf[surf_no].needs_updating = true; + printf(" ^ Successfully loaded\n"); + success = true; + } + } } SDL_FreeSurface(surface); @@ -329,7 +359,6 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, int surf_no, bool SDL_Rect frameRect = RectToSDLRect(rect); frameRect = {frameRect.x * gWindowScale, frameRect.y * gWindowScale, frameRect.w * gWindowScale, frameRect.h * gWindowScale}; - //Get dest rect SDL_Rect destRect = {x * gWindowScale, y * gWindowScale, frameRect.w, frameRect.h}; From 9dd3eefafbedb4e170912421424505dd54201039 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 12 Feb 2019 14:37:44 +0000 Subject: [PATCH 3/3] Updated README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84ae3f15..0c9adbc3 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,15 @@ This project currently depends on SDL2 and Freetype2. ## Building -Just run 'make' in the base directory, preferably with some of the following optional settings: +The project is currently built 'the Linux way': + +Just run 'make' in the base directory, preferably with some of the following settings: * RELEASE=1 to compile a release build (optimised, stripped, etc.) * STATIC=1 to produce a statically-linked executable (good for Windows builds) * JAPANESE=1 to enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation) * FIX_BUGS=1 to fix certain bugs (see [src/Bug Fixes.txt](https://github.com/cuckydev/Cave-Story-Engine-2/blob/master/src/Bug%20Fixes.txt)) +* WINDOWS=1 to enable Windows-only features like a unique file/taskbar icon, and system font loading (needed for the font setting in Config.dat to do anything) ## Running