Made MycHit.cpp ASM-accurate
This commit is contained in:
parent
3bccba6236
commit
d4d82d0ba8
2 changed files with 450 additions and 330 deletions
|
@ -515,6 +515,102 @@ addr = 0x414B20
|
||||||
name = "SetMapping"
|
name = "SetMapping"
|
||||||
addr = 0x414B40
|
addr = 0x414B40
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ResetMyCharFlag"
|
||||||
|
addr = 0x416E20
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharBlock"
|
||||||
|
addr = 0x416E30
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "PutlittleStar"
|
||||||
|
addr = 0x417160
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleA"
|
||||||
|
addr = 0x4171D0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleB"
|
||||||
|
addr = 0x4172E0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleC"
|
||||||
|
addr = 0x4173F0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleD"
|
||||||
|
addr = 0x417500
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleE"
|
||||||
|
addr = 0x417610
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleF"
|
||||||
|
addr = 0x417720
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleG"
|
||||||
|
addr = 0x417830
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharTriangleH"
|
||||||
|
addr = 0x417940
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharWater"
|
||||||
|
addr = 0x417A50
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharDamage"
|
||||||
|
addr = 0x417AE0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharDamageW"
|
||||||
|
addr = 0x417B70
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharVectLeft"
|
||||||
|
addr = 0x417C00
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharVectUp"
|
||||||
|
addr = 0x417C90
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharVectRight"
|
||||||
|
addr = 0x417D20
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharVectDown"
|
||||||
|
addr = 0x417DB0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "HitMyCharMap"
|
||||||
|
addr = 0x417E40
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharNPC"
|
||||||
|
addr = 0x4187F0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharNPC3"
|
||||||
|
addr = 0x418B10
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "JudgeHitMyCharNPC4"
|
||||||
|
addr = 0x418C20
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "HitMyCharNpChar"
|
||||||
|
addr = 0x419030
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "HitMyCharBoss"
|
||||||
|
addr = 0x419450
|
||||||
|
|
||||||
[[func]]
|
[[func]]
|
||||||
name = "AddExpMyChar"
|
name = "AddExpMyChar"
|
||||||
addr = 0x4196F0
|
addr = 0x4196F0
|
||||||
|
|
444
src/MycHit.cpp
444
src/MycHit.cpp
|
@ -36,13 +36,13 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
// Left wall
|
// Left wall
|
||||||
if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
|
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
||||||
&& gMC.x - gMC.hit.left < (2 * x + 1) << 12
|
&& gMC.x - gMC.hit.left < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x - gMC.hit.left > x << 13)
|
&& gMC.x - gMC.hit.left > x * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.x = ((2 * x + 1) << 12) + gMC.hit.left;
|
gMC.x = ((x * 0x10 + 8) * 0x200) + gMC.hit.left;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.xm < -0x180)
|
if (gMC.xm < -0x180)
|
||||||
|
@ -55,13 +55,13 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right wall
|
// Right wall
|
||||||
if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
|
if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (2 * x - 1) << 12
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.x + gMC.hit.left < x << 13)
|
&& gMC.x + gMC.hit.left < x * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.x = ((2 * x - 1) << 12) - gMC.hit.right;
|
gMC.x = ((x * 0x10 - 8) * 0x200) - gMC.hit.right;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.xm > 0x180)
|
if (gMC.xm > 0x180)
|
||||||
|
@ -74,13 +74,13 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ceiling
|
// Ceiling
|
||||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 5) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (2 * y + 1) << 12
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top > y << 13)
|
&& gMC.y - gMC.hit.top > y * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = ((2 * y + 1) << 12) + gMC.hit.top;
|
gMC.y = ((y * 0x10 + 8) * 0x200) + gMC.hit.top;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||||
|
@ -93,13 +93,13 @@ int JudgeHitMyCharBlock(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Floor
|
// Floor
|
||||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
&& gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * y - 1) << 12
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom < y << 13)
|
&& gMC.y + gMC.hit.bottom < y * 0x10 * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = ((2 * y - 1) << 12) - gMC.hit.bottom;
|
gMC.y = ((y * 0x10 - 8) * 0x200) - gMC.hit.bottom;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.ym > 0x400)
|
if (gMC.ym > 0x400)
|
||||||
|
@ -118,13 +118,13 @@ int JudgeHitMyCharTriangleA(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
|
&& gMC.y - gMC.hit.top < (y * 0x10 * 0x200) - (gMC.x - x * 0x10 * 0x200) / 2 + 0x800
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
|
gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 + gMC.hit.top;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||||
|
@ -143,13 +143,13 @@ int JudgeHitMyCharTriangleB(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
|
&& gMC.y - gMC.hit.top < (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
|
gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 + gMC.hit.top;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||||
|
@ -168,13 +168,13 @@ int JudgeHitMyCharTriangleC(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
|
&& gMC.y - gMC.hit.top < (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
|
gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 + gMC.hit.top;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||||
|
@ -193,13 +193,13 @@ int JudgeHitMyCharTriangleD(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
|
&& gMC.y - gMC.hit.top < (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
|
||||||
&& gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
|
gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 + gMC.hit.top;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
if (!(gMC.cond & 2) && gMC.ym < -0x200)
|
||||||
|
@ -216,15 +216,17 @@ int JudgeHitMyCharTriangleD(int x, int y)
|
||||||
|
|
||||||
int JudgeHitMyCharTriangleE(int x, int y)
|
int JudgeHitMyCharTriangleE(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0x10000;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
hit |= 0x10000;
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
|
||||||
&& gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (2 * y + 1) << 12)
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
|
||||||
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
|
gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 - gMC.hit.bottom;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.ym > 0x400)
|
if (gMC.ym > 0x400)
|
||||||
|
@ -233,7 +235,7 @@ int JudgeHitMyCharTriangleE(int x, int y)
|
||||||
gMC.ym = 0;
|
gMC.ym = 0;
|
||||||
|
|
||||||
// Set that hit this slope
|
// Set that hit this slope
|
||||||
hit = 0x10028;
|
hit |= 0x28;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
|
@ -241,15 +243,17 @@ int JudgeHitMyCharTriangleE(int x, int y)
|
||||||
|
|
||||||
int JudgeHitMyCharTriangleF(int x, int y)
|
int JudgeHitMyCharTriangleF(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0x20000;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
hit |= 0x20000;
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
|
||||||
&& gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (2 * y + 1) << 12)
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
|
||||||
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
|
gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 - gMC.hit.bottom;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.ym > 0x400)
|
if (gMC.ym > 0x400)
|
||||||
|
@ -258,7 +262,7 @@ int JudgeHitMyCharTriangleF(int x, int y)
|
||||||
gMC.ym = 0;
|
gMC.ym = 0;
|
||||||
|
|
||||||
// Set that hit this slope
|
// Set that hit this slope
|
||||||
hit = 0x20028;
|
hit |= 0x28;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
|
@ -266,15 +270,17 @@ int JudgeHitMyCharTriangleF(int x, int y)
|
||||||
|
|
||||||
int JudgeHitMyCharTriangleG(int x, int y)
|
int JudgeHitMyCharTriangleG(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0x40000;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
hit |= 0x40000;
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
|
||||||
&& gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (2 * y + 1) << 12)
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
|
||||||
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
|
gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 - gMC.hit.bottom;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.ym > 0x400)
|
if (gMC.ym > 0x400)
|
||||||
|
@ -283,7 +289,7 @@ int JudgeHitMyCharTriangleG(int x, int y)
|
||||||
gMC.ym = 0;
|
gMC.ym = 0;
|
||||||
|
|
||||||
// Set that hit this slope
|
// Set that hit this slope
|
||||||
hit = 0x40018;
|
hit |= 0x18;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
|
@ -291,15 +297,17 @@ int JudgeHitMyCharTriangleG(int x, int y)
|
||||||
|
|
||||||
int JudgeHitMyCharTriangleH(int x, int y)
|
int JudgeHitMyCharTriangleH(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0x80000;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x < (2 * x + 1) << 12
|
hit |= 0x80000;
|
||||||
&& gMC.x > (2 * x - 1) << 12
|
|
||||||
&& gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
|
if (gMC.x < (x * 0x10 + 8) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (2 * y + 1) << 12)
|
&& gMC.x > (x * 0x10 - 8) * 0x200
|
||||||
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
|
||||||
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
// Clip
|
// Clip
|
||||||
gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
|
gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 - gMC.hit.bottom;
|
||||||
|
|
||||||
// Halt momentum
|
// Halt momentum
|
||||||
if (gMC.ym > 0x400)
|
if (gMC.ym > 0x400)
|
||||||
|
@ -308,7 +316,7 @@ int JudgeHitMyCharTriangleH(int x, int y)
|
||||||
gMC.ym = 0;
|
gMC.ym = 0;
|
||||||
|
|
||||||
// Set that hit this slope
|
// Set that hit this slope
|
||||||
hit = 0x80018;
|
hit |= 0x18;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
|
@ -318,11 +326,11 @@ int JudgeHitMyCharWater(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
|
&& gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
|
||||||
&& gMC.y - gMC.hit.top < ((2 * y + 1) << 12) - 0x600
|
&& gMC.y - gMC.hit.top < ((y * 0x10 + 5) * 0x200)
|
||||||
&& gMC.y + gMC.hit.bottom > y << 13)
|
&& gMC.y + gMC.hit.bottom > y * 0x10 * 0x200)
|
||||||
hit = 0x100;
|
hit |= 0x100;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -331,11 +339,11 @@ int JudgeHitMyCharDamage(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x - 0x800 < (4 * x + 1) << 11
|
if (gMC.x - 0x800 < (x * 0x10 + 4) * 0x200
|
||||||
&& gMC.x + 0x800 > (4 * x - 1) << 11
|
&& gMC.x + 0x800 > (x * 0x10 - 4) * 0x200
|
||||||
&& gMC.y - 0x800 < (y << 13) + 0x600
|
&& gMC.y - 0x800 < (y * 0x10 + 3) * 0x200
|
||||||
&& gMC.y + 0x800 > (y << 13) - 0x600)
|
&& gMC.y + 0x800 > (y * 0x10 - 3) * 0x200)
|
||||||
hit = 0x400;
|
hit |= 0x400;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -344,11 +352,11 @@ int JudgeHitMyCharDamageW(int x, int y)
|
||||||
{
|
{
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
|
|
||||||
if (gMC.x - 0x800 < (4 * x + 1) << 11
|
if (gMC.x - 0x800 < (x * 0x10 + 4) * 0x200
|
||||||
&& gMC.x + 0x800 > (4 * x - 1) << 11
|
&& gMC.x + 0x800 > (x * 0x10 - 4) * 0x200
|
||||||
&& gMC.y - 0x800 < (y << 13) + 0x600
|
&& gMC.y - 0x800 < (y * 0x10 + 3) * 0x200
|
||||||
&& gMC.y + 0x800 > (y << 13) - 0x600)
|
&& gMC.y + 0x800 > (y * 0x10 - 3) * 0x200)
|
||||||
hit = 0xD00;
|
hit |= 0xD00;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -356,11 +364,11 @@ 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 < (4 * (2 * x + 1) - 1) << 10
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit = 0x1000;
|
hit |= 0x1000;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -368,11 +376,11 @@ 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 < (4 * (2 * x + 1) - 1) << 10
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit = 0x2000;
|
hit |= 0x2000;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -380,11 +388,11 @@ 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 < (4 * (2 * x + 1) - 1) << 10
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit = 0x4000;
|
hit |= 0x4000;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
@ -392,43 +400,42 @@ 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 < (4 * (2 * x + 1) - 1) << 10
|
if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
|
||||||
&& gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
|
&& gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
|
||||||
&& gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
|
&& gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
|
||||||
&& gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
|
&& gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
|
||||||
hit = 0x8000;
|
hit |= 0x8000;
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HitMyCharMap()
|
void HitMyCharMap()
|
||||||
{
|
{
|
||||||
int x = gMC.x / 0x2000;
|
int i;
|
||||||
int y = gMC.y / 0x2000;
|
|
||||||
|
int x = gMC.x / 0x10 / 0x200;
|
||||||
|
int y = gMC.y / 0x10 / 0x200;
|
||||||
|
|
||||||
int offy[4];
|
|
||||||
int offx[4];
|
int offx[4];
|
||||||
|
int offy[4];
|
||||||
|
|
||||||
offx[0] = 0;
|
offx[0] = 0;
|
||||||
offx[1] = 1;
|
offx[1] = 1;
|
||||||
offx[2] = 0;
|
offx[2] = 0;
|
||||||
offx[3] = 1;
|
offx[3] = 1;
|
||||||
|
|
||||||
offy[0] = 0;
|
offy[0] = 0;
|
||||||
offy[1] = 0;
|
offy[1] = 0;
|
||||||
offy[2] = 1;
|
offy[2] = 1;
|
||||||
offy[3] = 1;
|
offy[3] = 1;
|
||||||
|
|
||||||
uint8_t atrb[4];
|
unsigned char atrb[4];
|
||||||
for (int i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
atrb[i] = GetAttribute(x + offx[i], y + offy[i]);
|
atrb[i] = GetAttribute(x + offx[i], y + offy[i]);
|
||||||
|
|
||||||
switch (atrb[i])
|
switch (atrb[i])
|
||||||
{
|
{
|
||||||
// Water
|
|
||||||
case 0x02:
|
|
||||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Block
|
// Block
|
||||||
case 0x05:
|
case 0x05:
|
||||||
case 0x41:
|
case 0x41:
|
||||||
|
@ -437,11 +444,6 @@ void HitMyCharMap()
|
||||||
gMC.flag |= JudgeHitMyCharBlock(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharBlock(x + offx[i], y + offy[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Spikes
|
|
||||||
case 0x42:
|
|
||||||
gMC.flag |= JudgeHitMyCharDamage(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Slopes
|
// Slopes
|
||||||
case 0x50:
|
case 0x50:
|
||||||
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
||||||
|
@ -475,6 +477,38 @@ void HitMyCharMap()
|
||||||
gMC.flag |= JudgeHitMyCharTriangleH(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharTriangleH(x + offx[i], y + offy[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Spikes
|
||||||
|
case 0x42:
|
||||||
|
gMC.flag |= JudgeHitMyCharDamage(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Water spikes
|
||||||
|
case 0x62:
|
||||||
|
gMC.flag |= JudgeHitMyCharDamageW(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Wind
|
||||||
|
case 0x80:
|
||||||
|
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x81:
|
||||||
|
gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x82:
|
||||||
|
gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x83:
|
||||||
|
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Water
|
||||||
|
case 0x02:
|
||||||
|
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||||
|
break;
|
||||||
|
|
||||||
// Water and water blocks
|
// Water and water blocks
|
||||||
case 0x60:
|
case 0x60:
|
||||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||||
|
@ -485,11 +519,6 @@ void HitMyCharMap()
|
||||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Water spikes
|
|
||||||
case 0x62:
|
|
||||||
gMC.flag |= JudgeHitMyCharDamageW(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Water slopes
|
// Water slopes
|
||||||
case 0x70:
|
case 0x70:
|
||||||
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
|
||||||
|
@ -531,23 +560,6 @@ void HitMyCharMap()
|
||||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Wind
|
|
||||||
case 0x80:
|
|
||||||
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x81:
|
|
||||||
gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x82:
|
|
||||||
gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x83:
|
|
||||||
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Water current
|
// Water current
|
||||||
case 0xA0:
|
case 0xA0:
|
||||||
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
|
||||||
|
@ -568,9 +580,6 @@ void HitMyCharMap()
|
||||||
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
|
||||||
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,20 +642,20 @@ int JudgeHitMyCharNPC(NPCHAR *npc)
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JudgeHitMyCharNPC3(NPCHAR *npc)
|
unsigned char JudgeHitMyCharNPC3(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
if (npc->direct)
|
if (npc->direct == 0)
|
||||||
{
|
{
|
||||||
if (gMC.x + 0x400 > npc->x - npc->hit.back
|
if (gMC.x + 0x400 > npc->x - npc->hit.front
|
||||||
&& gMC.x - 0x400 < npc->x + npc->hit.front
|
&& gMC.x - 0x400 < npc->x + npc->hit.back
|
||||||
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
||||||
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gMC.x + 0x400 > npc->x - npc->hit.front
|
if (gMC.x + 0x400 > npc->x - npc->hit.back
|
||||||
&& gMC.x - 0x400 < npc->x + npc->hit.back
|
&& gMC.x - 0x400 < npc->x + npc->hit.front
|
||||||
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
&& gMC.y + 0x400 > npc->y - npc->hit.top
|
||||||
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -658,65 +667,47 @@ int JudgeHitMyCharNPC3(NPCHAR *npc)
|
||||||
int JudgeHitMyCharNPC4(NPCHAR *npc)
|
int JudgeHitMyCharNPC4(NPCHAR *npc)
|
||||||
{
|
{
|
||||||
// TODO: comment this
|
// TODO: comment this
|
||||||
|
float fx1;
|
||||||
|
float fx2;
|
||||||
|
float fy1;
|
||||||
|
float fy2;
|
||||||
|
|
||||||
int hit = 0;
|
int hit = 0;
|
||||||
long double v1, v2;
|
|
||||||
|
|
||||||
if (npc->x <= gMC.x)
|
if (npc->x > gMC.x)
|
||||||
v1 = (long double)(gMC.x - npc->x);
|
fx1 = (float)(npc->x - gMC.x);
|
||||||
else
|
else
|
||||||
v1 = (long double)(npc->x - gMC.x);
|
fx1 = (float)(gMC.x - npc->x);
|
||||||
|
|
||||||
float fx1 = (float)v1;
|
if (npc->y > gMC.y)
|
||||||
|
fy1 = (float)(npc->y - gMC.y);
|
||||||
if (npc->y <= gMC.y)
|
|
||||||
v2 = (long double)(gMC.y - npc->y);
|
|
||||||
else
|
else
|
||||||
v2 = (long double)(npc->y - gMC.y);
|
fy1 = (float)(gMC.y - npc->y);
|
||||||
|
|
||||||
float fx2 = (float)npc->hit.back;
|
fx2 = (float)npc->hit.back;
|
||||||
if (0.0 == fx1)
|
fy2 = (float)npc->hit.top;
|
||||||
fx1 = 1.0;
|
|
||||||
if (0.0 == fx2)
|
|
||||||
fx2 = 1.0;
|
|
||||||
|
|
||||||
float fy1 = (float)v2;
|
if (fx1 == 0.0f)
|
||||||
float fy2 = (float)npc->hit.top;
|
fx1 = 1.0f;
|
||||||
|
if (fx2 == 0.0f)
|
||||||
|
fx2 = 1.0f;
|
||||||
|
|
||||||
if (fy1 / fx1 <= fy2 / fx2)
|
if (fy1 / fx1 > fy2 / fx2)
|
||||||
{
|
{
|
||||||
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 - npc->hit.back)
|
||||||
{
|
|
||||||
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x - gMC.hit.right > npc->x)
|
|
||||||
{
|
|
||||||
if (gMC.xm < npc->xm)
|
|
||||||
gMC.xm = npc->xm;
|
|
||||||
gMC.x = npc->hit.back + npc->x + gMC.hit.right;
|
|
||||||
hit |= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gMC.x + gMC.hit.right > npc->x - npc->hit.back && gMC.hit.right + gMC.x < npc->x)
|
|
||||||
{
|
|
||||||
if (gMC.xm > npc->xm)
|
|
||||||
gMC.xm = npc->xm;
|
|
||||||
gMC.x = npc->x - npc->hit.back - gMC.hit.right;
|
|
||||||
hit |= 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x + gMC.hit.right > 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)
|
||||||
{
|
{
|
||||||
if (gMC.ym >= npc->ym)
|
if (gMC.ym < npc->ym)
|
||||||
{
|
|
||||||
if (gMC.ym < 0)
|
|
||||||
gMC.ym = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
gMC.y = npc->hit.bottom + npc->y + gMC.hit.top + 0x200;
|
gMC.y = npc->hit.bottom + npc->y + gMC.hit.top + 0x200;
|
||||||
gMC.ym = npc->ym;
|
gMC.ym = npc->ym;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gMC.ym < 0)
|
||||||
|
gMC.ym = 0;
|
||||||
|
}
|
||||||
|
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
@ -745,20 +736,52 @@ int JudgeHitMyCharNPC4(NPCHAR *npc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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.xm < npc->xm)
|
||||||
|
gMC.xm = npc->xm;
|
||||||
|
|
||||||
|
gMC.x = npc->hit.back + npc->x + gMC.hit.right;
|
||||||
|
|
||||||
|
hit |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gMC.x + gMC.hit.right > npc->x - npc->hit.back && gMC.hit.right + gMC.x < npc->x)
|
||||||
|
{
|
||||||
|
if (gMC.xm > npc->xm)
|
||||||
|
gMC.xm = npc->xm;
|
||||||
|
|
||||||
|
gMC.x = npc->x - npc->hit.back - gMC.hit.right;
|
||||||
|
|
||||||
|
hit |= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HitMyCharNpChar()
|
void HitMyCharNpChar()
|
||||||
{
|
{
|
||||||
if ((gMC.cond & 0x80) && !(gMC.cond & 2))
|
int i;
|
||||||
{
|
|
||||||
int hit;
|
|
||||||
|
|
||||||
for (int i = 0; i < NPC_MAX; i++)
|
int hit = 0;
|
||||||
{
|
|
||||||
if (gNPC[i].cond & 0x80)
|
if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < NPC_MAX; i++)
|
||||||
{
|
{
|
||||||
|
if ((gNPC[i].cond & 0x80) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hit = 0;
|
||||||
|
|
||||||
if (gNPC[i].bits & npc_solidSoft)
|
if (gNPC[i].bits & npc_solidSoft)
|
||||||
{
|
{
|
||||||
hit = JudgeHitMyCharNPC(&gNPC[i]);
|
hit = JudgeHitMyCharNPC(&gNPC[i]);
|
||||||
|
@ -797,11 +820,11 @@ void HitMyCharNpChar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run event on contact
|
// Run event on contact
|
||||||
if (!(g_GameFlags & 4) && hit && gNPC[i].bits & npc_eventTouch)
|
if ((g_GameFlags & 4) == 0 && hit && gNPC[i].bits & npc_eventTouch)
|
||||||
StartTextScript(gNPC[i].code_event);
|
StartTextScript(gNPC[i].code_event);
|
||||||
|
|
||||||
// NPC damage
|
// NPC damage
|
||||||
if (g_GameFlags & 2 && !(gNPC[i].bits & npc_interact))
|
if (g_GameFlags & 2 && (gNPC[i].bits & npc_interact) == 0)
|
||||||
{
|
{
|
||||||
if (gNPC[i].bits & npc_rearTop)
|
if (gNPC[i].bits & npc_rearTop)
|
||||||
{
|
{
|
||||||
|
@ -821,30 +844,33 @@ void HitMyCharNpChar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interaction
|
// Interaction
|
||||||
if (!(g_GameFlags & 4) && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
|
if ((g_GameFlags & 4) == 0 && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
|
||||||
{
|
{
|
||||||
StartTextScript(gNPC[i].code_event);
|
StartTextScript(gNPC[i].code_event);
|
||||||
gMC.xm = 0;
|
gMC.xm = 0;
|
||||||
gMC.ques = 0;
|
gMC.ques = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Create question mark when NPC hasn't been interacted with
|
// Create question mark when NPC hasn't been interacted with
|
||||||
if (gMC.ques)
|
if (gMC.ques)
|
||||||
SetCaret(gMC.x, gMC.y, 9, 0);
|
SetCaret(gMC.x, gMC.y, 9, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HitMyCharBoss()
|
void HitMyCharBoss()
|
||||||
{
|
{
|
||||||
if ((gMC.cond & 0x80) && !(gMC.cond & 2))
|
int hit = 0;
|
||||||
{
|
|
||||||
|
if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
|
||||||
|
return;
|
||||||
|
|
||||||
for (int b = 0; b < BOSS_MAX; b++)
|
for (int b = 0; b < BOSS_MAX; b++)
|
||||||
{
|
{
|
||||||
if (gBoss[b].cond & 0x80)
|
if ((gBoss[b].cond & 0x80) == 0)
|
||||||
{
|
continue;
|
||||||
int hit;
|
|
||||||
|
hit = 0;
|
||||||
|
|
||||||
if (gBoss[b].bits & npc_solidSoft)
|
if (gBoss[b].bits & npc_solidSoft)
|
||||||
{
|
{
|
||||||
hit = JudgeHitMyCharNPC(&gBoss[b]);
|
hit = JudgeHitMyCharNPC(&gBoss[b]);
|
||||||
|
@ -885,9 +911,7 @@ void HitMyCharBoss()
|
||||||
gMC.ques = 0;
|
gMC.ques = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (gMC.ques)
|
if (gMC.ques)
|
||||||
SetCaret(gMC.x, gMC.y, 9, 0);
|
SetCaret(gMC.x, gMC.y, 9, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue