ref: abf51970df1d3459104f7c993ef92e1e4680b3e4
parent: acc12ea5ed36962e2823c7d50896e2a55a5036de
parent: d6da832f889ded238c01c0fde56adcfa153c35d2
author: Clownacy <[email protected]>
date: Wed Feb 6 07:10:32 EST 2019
Merge branch 'master' of https://github.com/cuckydev/Cave-Story-Engine-2
binary files a/build/Profile - Copy.dat /dev/null differ
binary files a/build/Save Curly Booster v2 Spur Whimsical Star.dat /dev/null differ
binary files a/build/pre-omega Profile.dat /dev/null differ
--- a/src/Back.cpp
+++ b/src/Back.cpp
@@ -3,7 +3,11 @@
#include "Tags.h"
#include "Back.h"
+#include "Frame.h"
+#include "Game.h"
#include "Draw.h"
+#include "Stage.h"
+#include "Map.h"
BACK gBack;
int gWaterY;
@@ -156,5 +160,49 @@
}
}
}
+ }
+
+ //Draw black bars
+ if (!(g_GameFlags & 8)) //Detect if credits are running
+ {
+ const bool fromFocus = (gStageNo == 31); //Get if we should only draw around a 320x240 area of the focus point
+
+ //Get borders
+ const int barLeft = fromFocus ? (*gFrame.tgt_x - (320 << 8)) : -0x1000;
+ const int barTop = fromFocus ? (*gFrame.tgt_y - (240 << 8)) : -0x1000;
+
+ const int barRight = fromFocus ? (*gFrame.tgt_x + (320 << 8)) : (gMap.width << 13) - 0x1000;
+ const int barBottom = fromFocus ? (*gFrame.tgt_y + (240 << 8)) : (gMap.length << 13) - 0x1000;
+
+ //Draw bars
+ RECT barRect;
+
+ //Left
+ barRect.left = 0;
+ barRect.top = 0;
+ barRect.right = (barLeft - gFrame.x) >> 9;
+ barRect.bottom = WINDOW_HEIGHT;
+ CortBox(&barRect, 0x000000);
+
+ //Top
+ barRect.left = 0;
+ barRect.top = 0;
+ barRect.right = WINDOW_WIDTH;
+ barRect.bottom = (barTop - gFrame.y) >> 9;
+ CortBox(&barRect, 0x000000);
+
+ //Right
+ barRect.left = (barRight - gFrame.x) >> 9;
+ barRect.top = 0;
+ barRect.right = WINDOW_WIDTH;
+ barRect.bottom = WINDOW_HEIGHT;
+ CortBox(&barRect, 0x000000);
+
+ //Bottom
+ barRect.left = 0;
+ barRect.top = (barBottom - gFrame.y) >> 9;
+ barRect.right = WINDOW_WIDTH;
+ barRect.bottom = WINDOW_HEIGHT;
+ CortBox(&barRect, 0x000000);
}
}
--- a/src/BossLife.cpp
+++ b/src/BossLife.cpp
@@ -1,9 +1,10 @@
-#include "BossLife.h"
+#include "WindowsWrapper.h"
+#include "CommonDefines.h"
+#include "BossLife.h"
#include "Draw.h"
#include "NpChar.h"
#include "Boss.h"
-#include "WindowsWrapper.h"
static struct
{
@@ -70,11 +71,11 @@
rcBr.right = 198 * gBL.br / gBL.max;
- PutBitmap3(&grcGame, 32, 220, &rcBox1, SURFACE_ID_TEXT_BOX);
- PutBitmap3(&grcGame, 32, 228, &rcBox2, SURFACE_ID_TEXT_BOX);
- PutBitmap3(&grcGame, 72, 224, &rcBr, SURFACE_ID_TEXT_BOX);
- PutBitmap3(&grcGame, 72, 224, &rcLife, SURFACE_ID_TEXT_BOX);
- PutBitmap3(&grcGame, 40, 224, &rcText, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 256) / 2, WINDOW_HEIGHT - 20, &rcBox1, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 256) / 2, WINDOW_HEIGHT - 12, &rcBox2, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcBr, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcLife, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 240) / 2, WINDOW_HEIGHT - 16, &rcText, SURFACE_ID_TEXT_BOX);
}
else
{
--- a/src/Escape.cpp
+++ b/src/Escape.cpp
@@ -1,6 +1,7 @@
-#include "Escape.h"
-
#include "WindowsWrapper.h"
+
+#include "CommonDefines.h"
+#include "Escape.h"
#include "Draw.h"
#include "KeyControl.h"
#include "Main.h"
@@ -9,7 +10,7 @@
{
RECT rc = {0, 128, 208, 144};
- do
+ while (Flip_SystemTask())
{
//Get pressed keys
GetTrg();
@@ -32,10 +33,9 @@
//Draw screen
CortBox(&grcFull, 0x000000);
- PutBitmap3(&grcFull, 56, 112, &rc, 26);
+ PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, 26);
PutFramePerSecound();
}
- while (Flip_SystemTask());
//Quit if window is closed
gKeyTrg = 0;
--- a/src/Flash.cpp
+++ b/src/Flash.cpp
@@ -1,7 +1,8 @@
-#include "Flash.h"
+#include "WindowsWrapper.h"
+#include "Flash.h"
#include "Draw.h"
-#include "WindowsWrapper.h"
+#include "CommonDefines.h"
static struct
{
@@ -50,26 +51,26 @@
right = 0;
if (left < 0)
left = 0;
- if (top > 320)
- top = 320;
- if (bottom > 240)
- bottom = 240;
+ if (top > WINDOW_WIDTH)
+ top = WINDOW_WIDTH;
+ if (bottom > WINDOW_HEIGHT)
+ bottom = WINDOW_HEIGHT;
flash.rect1.left = right;
flash.rect1.right = top;
flash.rect1.top = 0;
- flash.rect1.bottom = 240;
+ flash.rect1.bottom = WINDOW_HEIGHT;
flash.rect2.left = 0;
- flash.rect2.right = 320;
+ flash.rect2.right = WINDOW_WIDTH;
flash.rect2.top = left;
flash.rect2.bottom = bottom;
- if (flash.width > 0xA0000)
+ if (flash.width > (WINDOW_WIDTH << 11))
{
flash.act_no = 1;
flash.cnt = 0;
- flash.width = 0x1E000;
+ flash.width = (WINDOW_HEIGHT << 9);
}
}
else if (flash.act_no == 1)
@@ -84,8 +85,8 @@
top = 0;
int bottom = (flash.width + flash.y - fly) / 0x200;
- if (bottom > 240)
- bottom = 240;
+ if (bottom > WINDOW_HEIGHT)
+ bottom = WINDOW_HEIGHT;
flash.rect1.left = 0;
flash.rect1.right = 0;
@@ -95,7 +96,7 @@
flash.rect2.top = top;
flash.rect2.bottom = bottom;
flash.rect2.left = 0;
- flash.rect2.right = 320;
+ flash.rect2.right = WINDOW_WIDTH;
}
}
@@ -111,9 +112,9 @@
if (flash.cnt / 2 % 2)
{
flash.rect2.top = 0;
- flash.rect2.bottom = 240;
+ flash.rect2.bottom = WINDOW_HEIGHT;
flash.rect2.left = 0;
- flash.rect2.right = 320;
+ flash.rect2.right = WINDOW_WIDTH;
}
else
{
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -19,15 +19,33 @@
gFrame.y += (*gFrame.tgt_y - (WINDOW_HEIGHT << 8) - gFrame.y) / gFrame.wait;
//Keep in bounds
- if (gFrame.x <= -0x200)
- gFrame.x = 0;
- if (gFrame.y <= -0x200)
- gFrame.y = 0;
+ const int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
+ const int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
- if (gFrame.x > ((((map_w - 1) << 4) - WINDOW_WIDTH)) << 9)
- gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 9;
- if (gFrame.y > ((((map_l - 1) << 4) - WINDOW_HEIGHT)) << 9)
- gFrame.y = (((map_l - 1) << 4) - WINDOW_HEIGHT) << 9;
+ if (map_w >= num_x)
+ {
+ if (gFrame.x <= -0x200)
+ gFrame.x = 0;
+ if (gFrame.x > ((((map_w - 1) << 4) - WINDOW_WIDTH)) << 9)
+ gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 9;
+ }
+ else
+ {
+ gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 8;
+ }
+
+ if (map_l >= num_y)
+ {
+ if (gFrame.y <= -0x200)
+ gFrame.y = 0;
+ if (gFrame.y > ((((map_l - 1) << 4) - WINDOW_HEIGHT)) << 9)
+ gFrame.y = (((map_l - 1) << 4) - WINDOW_HEIGHT) << 9;
+ }
+ else
+ {
+
+ gFrame.y = (((map_l - 1) << 4) - WINDOW_HEIGHT) << 8;
+ }
//Quake
if (gFrame.quake2)
@@ -44,10 +62,13 @@
}
//Keep in bounds
- if (gFrame.x <= -0x200)
- gFrame.x = 0;
- if (gFrame.y <= -0x200)
- gFrame.y = 0;
+ if (map_w >= num_x && map_l >= num_y)
+ {
+ if (gFrame.x <= -0x200)
+ gFrame.x = 0;
+ if (gFrame.y <= -0x200)
+ gFrame.y = 0;
+ }
}
void GetFramePosition(int *fx, int *fy)
--- a/src/Frame.h
+++ b/src/Frame.h
@@ -10,6 +10,8 @@
int quake2;
};
+extern FRAME gFrame;
+
void MoveFrame3();
void GetFramePosition(int *fx, int *fy);
void SetFramePosition(int fx, int fy);
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -340,21 +340,21 @@
CortBox(&grcGame, 0x202020);
//Draw version
- PutBitmap3(&grcGame, 100, 216, &rcVersion, SURFACE_ID_TEXT_BOX);
- PutBitmap3(&grcGame, 156, 216, &rcPeriod, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
int v1, v2, v3, v4;
GetCompileVersion(&v1, &v2, &v3, &v4);
- PutNumber4(140, 216, v1, 0);
- PutNumber4(156, 216, v2, 0);
- PutNumber4(172, 216, v3, 0);
- PutNumber4(188, 216, v4, 0);
+ PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, 0);
+ PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, 0);
+ PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0);
+ PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
//Draw main title
- PutBitmap3(&grcGame, 88, 40, &rcTitle, 0);
- PutBitmap3(&grcGame, 136, 128, &rcNew, 0);
- PutBitmap3(&grcGame, 136, 148, &rcContinue, 0);
- PutBitmap3(&grcGame, 80, 192, &rcPixel, 1);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, 0);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, 0);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, 0);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, 1);
//Draw character cursor
RECT char_rc;
@@ -386,11 +386,11 @@
int char_y;
if (bContinue == 1)
- char_y = 147;
+ char_y = (WINDOW_HEIGHT + 54) / 2;
else
- char_y = 127;
+ char_y = (WINDOW_HEIGHT + 14) / 2;
- PutBitmap3(&grcGame, 116, char_y, &char_rc, char_surf);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
//Draw carets
PutCaret(0, 0);
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -133,8 +133,8 @@
void PutStage_Back(int fx, int fy)
{
//Get range to draw
- int num_x = (WINDOW_WIDTH >> 4) + 1;
- int num_y = (WINDOW_HEIGHT >> 4) + 1;
+ int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
+ int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
int put_x = (fx / 0x200 + 8) / 16;
int put_y = (fy / 0x200 + 8) / 16;
@@ -166,8 +166,8 @@
RECT rcSnack = {256, 48, 272, 64};
//Get range to draw
- int num_x = (WINDOW_WIDTH >> 4) + 1;
- int num_y = (WINDOW_HEIGHT >> 4) + 1;
+ int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
+ int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
int put_x = (fx / 0x200 + 8) / 16;
int put_y = (fy / 0x200 + 8) / 16;
@@ -200,8 +200,8 @@
void PutMapDataVector(int fx, int fy)
{
//Get range to draw
- int num_x = (WINDOW_WIDTH >> 4) + 1;
- int num_y = (WINDOW_HEIGHT >> 4) + 1;
+ int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
+ int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
int put_x = (fx / 0x200 + 8) / 16;
int put_y = (fy / 0x200 + 8) / 16;
--- a/src/MapName.cpp
+++ b/src/MapName.cpp
@@ -46,12 +46,12 @@
//Map system
RECT rcBack = {0, 7, WINDOW_WIDTH, 24};
CortBox(&rcBack, 0x000000);
- PutBitmap3(&grcGame, 74, 10, &rc, SURFACE_ID_ROOM_NAME);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME);
}
else if (gMapName.flag)
{
//MNA
- PutBitmap3(&grcGame, 74, 80, &rc, SURFACE_ID_ROOM_NAME);
+ PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, (WINDOW_HEIGHT - 80) / 2, &rc, SURFACE_ID_ROOM_NAME);
if (++gMapName.wait > 160)
gMapName.flag = 0;
}