Big ugly rework of WindowsWrapper.h
Okay so WindowsWrapper.h now just includes Windows.h if it wants non-portability. This meant I had to split the custom RECT struct back to the original RECT and unknown nameless struct (one uses left/right, while the other uses front/back).
This commit is contained in:
parent
765beff57a
commit
44f142d8e7
15 changed files with 110 additions and 80 deletions
16
src/Bullet.h
16
src/Bullet.h
|
@ -29,7 +29,13 @@ struct BULLET
|
||||||
int enemyYL;
|
int enemyYL;
|
||||||
int blockXL;
|
int blockXL;
|
||||||
int blockYL;
|
int blockYL;
|
||||||
RECT view;
|
struct
|
||||||
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} view;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BULLET_TABLE
|
struct BULLET_TABLE
|
||||||
|
@ -42,7 +48,13 @@ struct BULLET_TABLE
|
||||||
int enemyYL;
|
int enemyYL;
|
||||||
int blockXL;
|
int blockXL;
|
||||||
int blockYL;
|
int blockYL;
|
||||||
RECT view;
|
struct
|
||||||
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} view;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BULLET_MAX 0x40
|
#define BULLET_MAX 0x40
|
||||||
|
|
14
src/Draw.cpp
14
src/Draw.cpp
|
@ -5,18 +5,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#define RECT WINRECT
|
|
||||||
#define FindResource WinFindResource // All these damn name collisions...
|
|
||||||
#define DrawText WinDrawText
|
|
||||||
#define LoadFont WinLoadFont
|
|
||||||
#include <windows.h>
|
|
||||||
#undef LoadFont
|
|
||||||
#undef DrawText
|
|
||||||
#undef FindResource
|
|
||||||
#undef RECT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
@ -50,7 +38,7 @@ FontObject *gFont;
|
||||||
|
|
||||||
#define FRAMERATE 20
|
#define FRAMERATE 20
|
||||||
|
|
||||||
BOOL Flip_SystemTask(int hWnd)
|
BOOL Flip_SystemTask(HWND hWnd)
|
||||||
{
|
{
|
||||||
(void)hWnd;
|
(void)hWnd;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct SURFACE;
|
||||||
|
|
||||||
extern SURFACE surf[SURFACE_ID_MAX];
|
extern SURFACE surf[SURFACE_ID_MAX];
|
||||||
|
|
||||||
BOOL Flip_SystemTask(int hWnd);
|
BOOL Flip_SystemTask(HWND hWnd);
|
||||||
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
|
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
|
||||||
void EndDirectDraw();
|
void EndDirectDraw();
|
||||||
void ReleaseSurface(int s);
|
void ReleaseSurface(int s);
|
||||||
|
|
|
@ -434,7 +434,7 @@ void CutCreditIllust()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scene of the island falling
|
// Scene of the island falling
|
||||||
int Scene_DownIsland(int hWnd, int mode)
|
int Scene_DownIsland(HWND hWnd, int mode)
|
||||||
{
|
{
|
||||||
// Setup background
|
// Setup background
|
||||||
RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
|
RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
|
||||||
|
|
|
@ -50,4 +50,4 @@ BOOL StartCreditScript();
|
||||||
void ActionCredit();
|
void ActionCredit();
|
||||||
void SetCreditIllust(int a);
|
void SetCreditIllust(int a);
|
||||||
void CutCreditIllust();
|
void CutCreditIllust();
|
||||||
int Scene_DownIsland(int hWnd, int mode);
|
int Scene_DownIsland(HWND hWnd, int mode);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "KeyControl.h"
|
#include "KeyControl.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
|
||||||
int Call_Escape(int hWnd)
|
int Call_Escape(HWND hWnd)
|
||||||
{
|
{
|
||||||
RECT rc = {0, 128, 208, 144};
|
RECT rc = {0, 128, 208, 144};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
int Call_Escape(int hWnd);
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
int Call_Escape(HWND hWnd);
|
||||||
|
|
|
@ -31,7 +31,7 @@ char gDataPath[PATH_LENGTH];
|
||||||
|
|
||||||
int gJoystickButtonTable[8];
|
int gJoystickButtonTable[8];
|
||||||
|
|
||||||
int ghWnd; // Placeholder until we restore the WinAPI code
|
HWND ghWnd; // Placeholder until we restore the WinAPI code
|
||||||
BOOL gbUseJoystick = FALSE;
|
BOOL gbUseJoystick = FALSE;
|
||||||
BOOL bFps = FALSE;
|
BOOL bFps = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern int ghWnd;
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
extern HWND ghWnd;
|
||||||
|
|
||||||
void PutFramePerSecound();
|
void PutFramePerSecound();
|
||||||
int GetFramePerSecound();
|
int GetFramePerSecound();
|
||||||
|
|
|
@ -201,14 +201,14 @@ void PutMyChar(int fx, int fy)
|
||||||
if (gMC.direct == 0)
|
if (gMC.direct == 0)
|
||||||
PutBitmap3(
|
PutBitmap3(
|
||||||
&grcGame,
|
&grcGame,
|
||||||
(gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8,
|
(gMC.x - gMC.view.front) / 0x200 - fx / 0x200 - 8,
|
||||||
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
||||||
&gMC.rect_arms,
|
&gMC.rect_arms,
|
||||||
SURFACE_ID_ARMS);
|
SURFACE_ID_ARMS);
|
||||||
else
|
else
|
||||||
PutBitmap3(
|
PutBitmap3(
|
||||||
&grcGame,
|
&grcGame,
|
||||||
(gMC.x - gMC.view.left) / 0x200 - fx / 0x200,
|
(gMC.x - gMC.view.front) / 0x200 - fx / 0x200,
|
||||||
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
(gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
|
||||||
&gMC.rect_arms,
|
&gMC.rect_arms,
|
||||||
SURFACE_ID_ARMS);
|
SURFACE_ID_ARMS);
|
||||||
|
@ -224,7 +224,7 @@ void PutMyChar(int fx, int fy)
|
||||||
rect.bottom += 32;
|
rect.bottom += 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
|
PutBitmap3(&grcGame, (gMC.x - gMC.view.front) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
|
||||||
|
|
||||||
// Draw air tank
|
// Draw air tank
|
||||||
RECT rcBubble[2] = {
|
RECT rcBubble[2] = {
|
||||||
|
|
16
src/MyChar.h
16
src/MyChar.h
|
@ -21,8 +21,20 @@ struct MYCHAR
|
||||||
int ym;
|
int ym;
|
||||||
int ani_wait;
|
int ani_wait;
|
||||||
int ani_no;
|
int ani_no;
|
||||||
RECT hit;
|
struct
|
||||||
RECT view;
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} hit;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} view;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
RECT rect_arms;
|
RECT rect_arms;
|
||||||
int level;
|
int level;
|
||||||
|
|
|
@ -36,11 +36,11 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
// Left wall
|
// Left wall
|
||||||
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
||||||
&& gMC.x - gMC.hit.left < (x * 0x10 + 8) * 0x200
|
&& gMC.x - gMC.hit.back < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x - gMC.hit.left > x * 0x10 * 0x200)
|
&& gMC.x - gMC.hit.back > x * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.x = ((x * 0x10 + 8) * 0x200) + gMC.hit.left;
|
gMC.x = ((x * 0x10 + 8) * 0x200) + gMC.hit.back;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.xm < -0x180)
|
if (gMC.xm < -0x180)
|
||||||
|
@ -55,11 +55,11 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
// Right wall
|
// Right wall
|
||||||
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 8) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.x + gMC.hit.left < x * 0x10 * 0x200)
|
&& gMC.x + gMC.hit.back < x * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.x = ((x * 0x10 - 8) * 0x200) - gMC.hit.right;
|
gMC.x = ((x * 0x10 - 8) * 0x200) - gMC.hit.back;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.xm > 0x180)
|
if (gMC.xm > 0x180)
|
||||||
|
@ -72,8 +72,8 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ceiling
|
// Ceiling
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 5) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 5) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top > y * 0x10 * 0x200)
|
&& gMC.y - gMC.hit.top > y * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
|
@ -91,8 +91,8 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Floor
|
// Floor
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
|
&& gMC.x + gMC.hit.back > ((x * 0x10 - 5) * 0x200)
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom < y * 0x10 * 0x200)
|
&& gMC.y + gMC.hit.bottom < y * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
|
@ -324,8 +324,8 @@ int JudgeHitMyCharWater(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
|
&& gMC.x + gMC.hit.back > ((x * 0x10 - 5) * 0x200)
|
||||||
&& gMC.y - gMC.hit.top < ((y * 0x10 + 5) * 0x200)
|
&& gMC.y - gMC.hit.top < ((y * 0x10 + 5) * 0x200)
|
||||||
&& gMC.y + gMC.hit.bottom > y * 0x10 * 0x200)
|
&& gMC.y + gMC.hit.bottom > y * 0x10 * 0x200)
|
||||||
hit |= 0x100;
|
hit |= 0x100;
|
||||||
|
@ -362,8 +362,8 @@ int JudgeHitMyCharDamageW(int x, int y)
|
||||||
int JudgeHitMyCharVectLeft(int x, int y)
|
int JudgeHitMyCharVectLeft(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit |= 0x1000;
|
hit |= 0x1000;
|
||||||
|
@ -374,8 +374,8 @@ int JudgeHitMyCharVectLeft(int x, int y)
|
||||||
int JudgeHitMyCharVectUp(int x, int y)
|
int JudgeHitMyCharVectUp(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit |= 0x2000;
|
hit |= 0x2000;
|
||||||
|
@ -386,8 +386,8 @@ int JudgeHitMyCharVectUp(int x, int y)
|
||||||
int JudgeHitMyCharVectRight(int x, int y)
|
int JudgeHitMyCharVectRight(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit |= 0x4000;
|
hit |= 0x4000;
|
||||||
|
@ -398,8 +398,8 @@ int JudgeHitMyCharVectRight(int x, int y)
|
||||||
int JudgeHitMyCharVectDown(int x, int y)
|
int JudgeHitMyCharVectDown(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
if (gMC.x - gMC.hit.back < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
&& gMC.x + gMC.hit.back > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit |= 0x8000;
|
hit |= 0x8000;
|
||||||
|
@ -591,8 +591,8 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
||||||
|
|
||||||
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
||||||
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
||||||
&& gMC.x - gMC.hit.right < npc->x + npc->hit.back
|
&& gMC.x - gMC.hit.back < npc->x + npc->hit.back
|
||||||
&& gMC.x - gMC.hit.right > npc->x)
|
&& gMC.x - gMC.hit.back > npc->x)
|
||||||
{
|
{
|
||||||
if (gMC.xm < 0x200)
|
if (gMC.xm < 0x200)
|
||||||
gMC.xm += 0x200;
|
gMC.xm += 0x200;
|
||||||
|
@ -601,16 +601,16 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
||||||
|
|
||||||
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom - 0x600
|
||||||
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top + 0x600
|
||||||
&& gMC.x + gMC.hit.right - 0x200 > npc->x - npc->hit.back
|
&& gMC.x + gMC.hit.back - 0x200 > npc->x - npc->hit.back
|
||||||
&& gMC.x + gMC.hit.right - 0x200 < npc->x)
|
&& gMC.x + gMC.hit.back - 0x200 < npc->x)
|
||||||
{
|
{
|
||||||
if (gMC.xm > -0x200)
|
if (gMC.xm > -0x200)
|
||||||
gMC.xm -= 0x200;
|
gMC.xm -= 0x200;
|
||||||
hit |= 4;
|
hit |= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back - 0x600
|
if (gMC.x - gMC.hit.back < npc->x + npc->hit.back - 0x600
|
||||||
&& gMC.x + gMC.hit.right > npc->x - npc->hit.back + 0x600
|
&& gMC.x + gMC.hit.back > npc->x - npc->hit.back + 0x600
|
||||||
&& gMC.y - gMC.hit.top < npc->y + npc->hit.bottom
|
&& gMC.y - gMC.hit.top < npc->y + npc->hit.bottom
|
||||||
&& gMC.y - gMC.hit.top > npc->y)
|
&& gMC.y - gMC.hit.top > npc->y)
|
||||||
{
|
{
|
||||||
|
@ -619,8 +619,8 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back - 0x600
|
if (gMC.x - gMC.hit.back < npc->x + npc->hit.back - 0x600
|
||||||
&& gMC.x + gMC.hit.right > npc->x - npc->hit.back + 0x600
|
&& gMC.x + gMC.hit.back > npc->x - npc->hit.back + 0x600
|
||||||
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top
|
&& gMC.y + gMC.hit.bottom > npc->y - npc->hit.top
|
||||||
&& gMC.hit.bottom + gMC.y < npc->y + 0x600)
|
&& gMC.hit.bottom + gMC.y < npc->y + 0x600)
|
||||||
{
|
{
|
||||||
|
@ -692,7 +692,7 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
||||||
|
|
||||||
if (fy1 / fx1 > fy2 / fx2)
|
if (fy1 / fx1 > fy2 / fx2)
|
||||||
{
|
{
|
||||||
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x + gMC.hit.right > npc->x - npc->hit.back)
|
if (gMC.x - gMC.hit.back < npc->x + npc->hit.back && gMC.x + gMC.hit.back > npc->x - npc->hit.back)
|
||||||
{
|
{
|
||||||
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y - gMC.hit.top > npc->y)
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y - gMC.hit.top > npc->y)
|
||||||
{
|
{
|
||||||
|
@ -739,22 +739,22 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top)
|
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top)
|
||||||
{
|
{
|
||||||
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x - gMC.hit.right > npc->x)
|
if (gMC.x - gMC.hit.back < npc->x + npc->hit.back && gMC.x - gMC.hit.back > npc->x)
|
||||||
{
|
{
|
||||||
if (gMC.xm < npc->xm)
|
if (gMC.xm < npc->xm)
|
||||||
gMC.xm = npc->xm;
|
gMC.xm = npc->xm;
|
||||||
|
|
||||||
gMC.x = npc->hit.back + npc->x + gMC.hit.right;
|
gMC.x = npc->hit.back + npc->x + gMC.hit.back;
|
||||||
|
|
||||||
hit |= 1;
|
hit |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMC.x + gMC.hit.right > npc->x - npc->hit.back && gMC.hit.right + gMC.x < npc->x)
|
if (gMC.x + gMC.hit.back > npc->x - npc->hit.back && gMC.hit.back + gMC.x < npc->x)
|
||||||
{
|
{
|
||||||
if (gMC.xm > npc->xm)
|
if (gMC.xm > npc->xm)
|
||||||
gMC.xm = npc->xm;
|
gMC.xm = npc->xm;
|
||||||
|
|
||||||
gMC.x = npc->x - npc->hit.back - gMC.hit.right;
|
gMC.x = npc->x - npc->hit.back - gMC.hit.back;
|
||||||
|
|
||||||
hit |= 4;
|
hit |= 4;
|
||||||
}
|
}
|
||||||
|
|
16
src/NpChar.h
16
src/NpChar.h
|
@ -55,8 +55,20 @@ struct NPCHAR
|
||||||
int count2;
|
int count2;
|
||||||
int act_no;
|
int act_no;
|
||||||
int act_wait;
|
int act_wait;
|
||||||
RECT hit;
|
struct
|
||||||
RECT view;
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} hit;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int front;
|
||||||
|
int top;
|
||||||
|
int back;
|
||||||
|
int bottom;
|
||||||
|
} view;
|
||||||
unsigned char shock;
|
unsigned char shock;
|
||||||
int damage_view;
|
int damage_view;
|
||||||
int damage;
|
int damage;
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ int TextScriptProc()
|
||||||
char str_0[0x40];
|
char str_0[0x40];
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
||||||
MessageBoxA(0, str_0, "エラー", 0);
|
MessageBoxA(ghWnd, str_0, "エラー", 0);
|
||||||
#else
|
#else
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
int rep_rand();
|
#ifdef NONPORTABLE
|
||||||
void rep_srand(unsigned int seed);
|
#include <Windows.h>
|
||||||
|
// Avoid name collisions
|
||||||
|
#undef DrawText
|
||||||
|
#undef FindResource
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef int HWND;
|
||||||
|
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
|
|
||||||
|
@ -13,26 +19,22 @@ typedef int BOOL;
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct RECT
|
||||||
|
{
|
||||||
|
long left;
|
||||||
|
long top;
|
||||||
|
long right;
|
||||||
|
long bottom;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SET_RECT(rect, l, t, r, b) \
|
#define SET_RECT(rect, l, t, r, b) \
|
||||||
rect.left = l; \
|
rect.left = l; \
|
||||||
rect.top = t; \
|
rect.top = t; \
|
||||||
rect.right = r; \
|
rect.right = r; \
|
||||||
rect.bottom = b;
|
rect.bottom = b;
|
||||||
|
|
||||||
struct RECT
|
int rep_rand();
|
||||||
{
|
void rep_srand(unsigned int seed);
|
||||||
union
|
|
||||||
{
|
|
||||||
int left;
|
|
||||||
int front;
|
|
||||||
};
|
|
||||||
int top;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
int right;
|
|
||||||
int back;
|
|
||||||
};
|
|
||||||
int bottom;
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL SystemTask();
|
BOOL SystemTask();
|
||||||
|
|
Loading…
Add table
Reference in a new issue