This commit is contained in:
Clownacy 2019-02-06 12:10:32 +00:00
commit abf51970df
13 changed files with 134 additions and 61 deletions

Binary file not shown.

View file

Binary file not shown.

View file

@ -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;
@ -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);
}
}

View file

@ -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 @@ void PutBossLife(void)
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
{

View file

@ -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 @@ int Call_Escape()
{
RECT rc = {0, 128, 208, 144};
do
while (Flip_SystemTask())
{
//Get pressed keys
GetTrg();
@ -32,10 +33,9 @@ int Call_Escape()
//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;

View file

@ -1,8 +1,9 @@
#include "Flash.h"
#include "Draw.h"
#include "WindowsWrapper.h"
#include "Flash.h"
#include "Draw.h"
#include "CommonDefines.h"
static struct
{
int mode;
@ -50,26 +51,26 @@ void ActFlash_Explosion(int flx, int fly)
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 @@ void ActFlash_Explosion(int flx, int fly)
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 @@ void ActFlash_Explosion(int flx, int fly)
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 @@ void ActFlash_Flash(void)
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
{

View file

@ -19,15 +19,33 @@ void MoveFrame3()
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 @@ void MoveFrame3()
}
//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)

View file

@ -10,6 +10,8 @@ struct FRAME
int quake2;
};
extern FRAME gFrame;
void MoveFrame3();
void GetFramePosition(int *fx, int *fy);
void SetFramePosition(int fx, int fy);

View file

@ -340,21 +340,21 @@ int ModeTitle()
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 ModeTitle()
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);

View file

@ -133,8 +133,8 @@ bool ChangeMapParts(int x, int y, uint8_t no)
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 @@ void PutStage_Front(int fx, int fy)
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 PutStage_Front(int fx, int fy)
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;

View file

@ -46,12 +46,12 @@ void PutMapName(bool bMini)
//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;
}