Merge branch 'master' of https://github.com/cuckydev/Cave-Story-Engine-2
This commit is contained in:
commit
abf51970df
13 changed files with 134 additions and 61 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
48
src/Back.cpp
48
src/Back.cpp
|
@ -3,7 +3,11 @@
|
||||||
|
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
#include "Back.h"
|
#include "Back.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
#include "Game.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
|
#include "Stage.h"
|
||||||
|
#include "Map.h"
|
||||||
|
|
||||||
BACK gBack;
|
BACK gBack;
|
||||||
int gWaterY;
|
int gWaterY;
|
||||||
|
@ -157,4 +161,48 @@ void PutFront(int fx, int fy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "BossLife.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
#include "CommonDefines.h"
|
||||||
|
#include "BossLife.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "NpChar.h"
|
#include "NpChar.h"
|
||||||
#include "Boss.h"
|
#include "Boss.h"
|
||||||
#include "WindowsWrapper.h"
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
@ -70,11 +71,11 @@ void PutBossLife(void)
|
||||||
|
|
||||||
rcBr.right = 198 * gBL.br / gBL.max;
|
rcBr.right = 198 * gBL.br / gBL.max;
|
||||||
|
|
||||||
PutBitmap3(&grcGame, 32, 220, &rcBox1, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 256) / 2, WINDOW_HEIGHT - 20, &rcBox1, SURFACE_ID_TEXT_BOX);
|
||||||
PutBitmap3(&grcGame, 32, 228, &rcBox2, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 256) / 2, WINDOW_HEIGHT - 12, &rcBox2, SURFACE_ID_TEXT_BOX);
|
||||||
PutBitmap3(&grcGame, 72, 224, &rcBr, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcBr, SURFACE_ID_TEXT_BOX);
|
||||||
PutBitmap3(&grcGame, 72, 224, &rcLife, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 176) / 2, WINDOW_HEIGHT - 16, &rcLife, SURFACE_ID_TEXT_BOX);
|
||||||
PutBitmap3(&grcGame, 40, 224, &rcText, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 240) / 2, WINDOW_HEIGHT - 16, &rcText, SURFACE_ID_TEXT_BOX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Escape.h"
|
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
#include "CommonDefines.h"
|
||||||
|
#include "Escape.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "KeyControl.h"
|
#include "KeyControl.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
@ -9,7 +10,7 @@ int Call_Escape()
|
||||||
{
|
{
|
||||||
RECT rc = {0, 128, 208, 144};
|
RECT rc = {0, 128, 208, 144};
|
||||||
|
|
||||||
do
|
while (Flip_SystemTask())
|
||||||
{
|
{
|
||||||
//Get pressed keys
|
//Get pressed keys
|
||||||
GetTrg();
|
GetTrg();
|
||||||
|
@ -32,10 +33,9 @@ int Call_Escape()
|
||||||
|
|
||||||
//Draw screen
|
//Draw screen
|
||||||
CortBox(&grcFull, 0x000000);
|
CortBox(&grcFull, 0x000000);
|
||||||
PutBitmap3(&grcFull, 56, 112, &rc, 26);
|
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, 26);
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
}
|
}
|
||||||
while (Flip_SystemTask());
|
|
||||||
|
|
||||||
//Quit if window is closed
|
//Quit if window is closed
|
||||||
gKeyTrg = 0;
|
gKeyTrg = 0;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "Flash.h"
|
|
||||||
|
|
||||||
#include "Draw.h"
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
#include "Flash.h"
|
||||||
|
#include "Draw.h"
|
||||||
|
#include "CommonDefines.h"
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -50,26 +51,26 @@ void ActFlash_Explosion(int flx, int fly)
|
||||||
right = 0;
|
right = 0;
|
||||||
if (left < 0)
|
if (left < 0)
|
||||||
left = 0;
|
left = 0;
|
||||||
if (top > 320)
|
if (top > WINDOW_WIDTH)
|
||||||
top = 320;
|
top = WINDOW_WIDTH;
|
||||||
if (bottom > 240)
|
if (bottom > WINDOW_HEIGHT)
|
||||||
bottom = 240;
|
bottom = WINDOW_HEIGHT;
|
||||||
|
|
||||||
flash.rect1.left = right;
|
flash.rect1.left = right;
|
||||||
flash.rect1.right = top;
|
flash.rect1.right = top;
|
||||||
flash.rect1.top = 0;
|
flash.rect1.top = 0;
|
||||||
flash.rect1.bottom = 240;
|
flash.rect1.bottom = WINDOW_HEIGHT;
|
||||||
|
|
||||||
flash.rect2.left = 0;
|
flash.rect2.left = 0;
|
||||||
flash.rect2.right = 320;
|
flash.rect2.right = WINDOW_WIDTH;
|
||||||
flash.rect2.top = left;
|
flash.rect2.top = left;
|
||||||
flash.rect2.bottom = bottom;
|
flash.rect2.bottom = bottom;
|
||||||
|
|
||||||
if (flash.width > 0xA0000)
|
if (flash.width > (WINDOW_WIDTH << 11))
|
||||||
{
|
{
|
||||||
flash.act_no = 1;
|
flash.act_no = 1;
|
||||||
flash.cnt = 0;
|
flash.cnt = 0;
|
||||||
flash.width = 0x1E000;
|
flash.width = (WINDOW_HEIGHT << 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (flash.act_no == 1)
|
else if (flash.act_no == 1)
|
||||||
|
@ -84,8 +85,8 @@ void ActFlash_Explosion(int flx, int fly)
|
||||||
top = 0;
|
top = 0;
|
||||||
|
|
||||||
int bottom = (flash.width + flash.y - fly) / 0x200;
|
int bottom = (flash.width + flash.y - fly) / 0x200;
|
||||||
if (bottom > 240)
|
if (bottom > WINDOW_HEIGHT)
|
||||||
bottom = 240;
|
bottom = WINDOW_HEIGHT;
|
||||||
|
|
||||||
flash.rect1.left = 0;
|
flash.rect1.left = 0;
|
||||||
flash.rect1.right = 0;
|
flash.rect1.right = 0;
|
||||||
|
@ -95,7 +96,7 @@ void ActFlash_Explosion(int flx, int fly)
|
||||||
flash.rect2.top = top;
|
flash.rect2.top = top;
|
||||||
flash.rect2.bottom = bottom;
|
flash.rect2.bottom = bottom;
|
||||||
flash.rect2.left = 0;
|
flash.rect2.left = 0;
|
||||||
flash.rect2.right = 320;
|
flash.rect2.right = WINDOW_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,9 +112,9 @@ void ActFlash_Flash(void)
|
||||||
if (flash.cnt / 2 % 2)
|
if (flash.cnt / 2 % 2)
|
||||||
{
|
{
|
||||||
flash.rect2.top = 0;
|
flash.rect2.top = 0;
|
||||||
flash.rect2.bottom = 240;
|
flash.rect2.bottom = WINDOW_HEIGHT;
|
||||||
flash.rect2.left = 0;
|
flash.rect2.left = 0;
|
||||||
flash.rect2.right = 320;
|
flash.rect2.right = WINDOW_WIDTH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,15 +19,33 @@ void MoveFrame3()
|
||||||
gFrame.y += (*gFrame.tgt_y - (WINDOW_HEIGHT << 8) - gFrame.y) / gFrame.wait;
|
gFrame.y += (*gFrame.tgt_y - (WINDOW_HEIGHT << 8) - gFrame.y) / gFrame.wait;
|
||||||
|
|
||||||
//Keep in bounds
|
//Keep in bounds
|
||||||
if (gFrame.x <= -0x200)
|
const int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
|
||||||
gFrame.x = 0;
|
const int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
|
||||||
if (gFrame.y <= -0x200)
|
|
||||||
gFrame.y = 0;
|
|
||||||
|
|
||||||
if (gFrame.x > ((((map_w - 1) << 4) - WINDOW_WIDTH)) << 9)
|
if (map_w >= num_x)
|
||||||
gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 9;
|
{
|
||||||
if (gFrame.y > ((((map_l - 1) << 4) - WINDOW_HEIGHT)) << 9)
|
if (gFrame.x <= -0x200)
|
||||||
gFrame.y = (((map_l - 1) << 4) - WINDOW_HEIGHT) << 9;
|
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
|
//Quake
|
||||||
if (gFrame.quake2)
|
if (gFrame.quake2)
|
||||||
|
@ -44,10 +62,13 @@ void MoveFrame3()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Keep in bounds
|
//Keep in bounds
|
||||||
if (gFrame.x <= -0x200)
|
if (map_w >= num_x && map_l >= num_y)
|
||||||
gFrame.x = 0;
|
{
|
||||||
if (gFrame.y <= -0x200)
|
if (gFrame.x <= -0x200)
|
||||||
gFrame.y = 0;
|
gFrame.x = 0;
|
||||||
|
if (gFrame.y <= -0x200)
|
||||||
|
gFrame.y = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetFramePosition(int *fx, int *fy)
|
void GetFramePosition(int *fx, int *fy)
|
||||||
|
|
|
@ -10,6 +10,8 @@ struct FRAME
|
||||||
int quake2;
|
int quake2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern FRAME gFrame;
|
||||||
|
|
||||||
void MoveFrame3();
|
void MoveFrame3();
|
||||||
void GetFramePosition(int *fx, int *fy);
|
void GetFramePosition(int *fx, int *fy);
|
||||||
void SetFramePosition(int fx, int fy);
|
void SetFramePosition(int fx, int fy);
|
||||||
|
|
26
src/Game.cpp
26
src/Game.cpp
|
@ -340,21 +340,21 @@ int ModeTitle()
|
||||||
CortBox(&grcGame, 0x202020);
|
CortBox(&grcGame, 0x202020);
|
||||||
|
|
||||||
//Draw version
|
//Draw version
|
||||||
PutBitmap3(&grcGame, 100, 216, &rcVersion, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
|
||||||
PutBitmap3(&grcGame, 156, 216, &rcPeriod, SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
|
||||||
|
|
||||||
int v1, v2, v3, v4;
|
int v1, v2, v3, v4;
|
||||||
GetCompileVersion(&v1, &v2, &v3, &v4);
|
GetCompileVersion(&v1, &v2, &v3, &v4);
|
||||||
PutNumber4(140, 216, v1, 0);
|
PutNumber4((WINDOW_WIDTH - 40) / 2, WINDOW_HEIGHT - 24, v1, 0);
|
||||||
PutNumber4(156, 216, v2, 0);
|
PutNumber4((WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, v2, 0);
|
||||||
PutNumber4(172, 216, v3, 0);
|
PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0);
|
||||||
PutNumber4(188, 216, v4, 0);
|
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
|
||||||
|
|
||||||
//Draw main title
|
//Draw main title
|
||||||
PutBitmap3(&grcGame, 88, 40, &rcTitle, 0);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, 0);
|
||||||
PutBitmap3(&grcGame, 136, 128, &rcNew, 0);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, 0);
|
||||||
PutBitmap3(&grcGame, 136, 148, &rcContinue, 0);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, 0);
|
||||||
PutBitmap3(&grcGame, 80, 192, &rcPixel, 1);
|
PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, 1);
|
||||||
|
|
||||||
//Draw character cursor
|
//Draw character cursor
|
||||||
RECT char_rc;
|
RECT char_rc;
|
||||||
|
@ -386,11 +386,11 @@ int ModeTitle()
|
||||||
|
|
||||||
int char_y;
|
int char_y;
|
||||||
if (bContinue == 1)
|
if (bContinue == 1)
|
||||||
char_y = 147;
|
char_y = (WINDOW_HEIGHT + 54) / 2;
|
||||||
else
|
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
|
//Draw carets
|
||||||
PutCaret(0, 0);
|
PutCaret(0, 0);
|
||||||
|
|
12
src/Map.cpp
12
src/Map.cpp
|
@ -133,8 +133,8 @@ bool ChangeMapParts(int x, int y, uint8_t no)
|
||||||
void PutStage_Back(int fx, int fy)
|
void PutStage_Back(int fx, int fy)
|
||||||
{
|
{
|
||||||
//Get range to draw
|
//Get range to draw
|
||||||
int num_x = (WINDOW_WIDTH >> 4) + 1;
|
int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
|
||||||
int num_y = (WINDOW_HEIGHT >> 4) + 1;
|
int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
|
||||||
int put_x = (fx / 0x200 + 8) / 16;
|
int put_x = (fx / 0x200 + 8) / 16;
|
||||||
int put_y = (fy / 0x200 + 8) / 16;
|
int put_y = (fy / 0x200 + 8) / 16;
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ void PutStage_Front(int fx, int fy)
|
||||||
RECT rcSnack = {256, 48, 272, 64};
|
RECT rcSnack = {256, 48, 272, 64};
|
||||||
|
|
||||||
//Get range to draw
|
//Get range to draw
|
||||||
int num_x = (WINDOW_WIDTH >> 4) + 1;
|
int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
|
||||||
int num_y = (WINDOW_HEIGHT >> 4) + 1;
|
int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
|
||||||
int put_x = (fx / 0x200 + 8) / 16;
|
int put_x = (fx / 0x200 + 8) / 16;
|
||||||
int put_y = (fy / 0x200 + 8) / 16;
|
int put_y = (fy / 0x200 + 8) / 16;
|
||||||
|
|
||||||
|
@ -200,8 +200,8 @@ void PutStage_Front(int fx, int fy)
|
||||||
void PutMapDataVector(int fx, int fy)
|
void PutMapDataVector(int fx, int fy)
|
||||||
{
|
{
|
||||||
//Get range to draw
|
//Get range to draw
|
||||||
int num_x = (WINDOW_WIDTH >> 4) + 1;
|
int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
|
||||||
int num_y = (WINDOW_HEIGHT >> 4) + 1;
|
int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
|
||||||
int put_x = (fx / 0x200 + 8) / 16;
|
int put_x = (fx / 0x200 + 8) / 16;
|
||||||
int put_y = (fy / 0x200 + 8) / 16;
|
int put_y = (fy / 0x200 + 8) / 16;
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,12 @@ void PutMapName(bool bMini)
|
||||||
//Map system
|
//Map system
|
||||||
RECT rcBack = {0, 7, WINDOW_WIDTH, 24};
|
RECT rcBack = {0, 7, WINDOW_WIDTH, 24};
|
||||||
CortBox(&rcBack, 0x000000);
|
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)
|
else if (gMapName.flag)
|
||||||
{
|
{
|
||||||
//MNA
|
//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)
|
if (++gMapName.wait > 160)
|
||||||
gMapName.flag = 0;
|
gMapName.flag = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue