Merge pull request #36 from GabrielRavier/feature/improveNonNpcCharNpcFiles
Improved N files
This commit is contained in:
commit
a60e9b4ff2
3 changed files with 78 additions and 71 deletions
|
@ -67,7 +67,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
//Read "PXE" check
|
// Read "PXE" check
|
||||||
char code[4];
|
char code[4];
|
||||||
fread(code, 1, 4, fp);
|
fread(code, 1, 4, fp);
|
||||||
if (memcmp(code, gPassPixEve, 3))
|
if (memcmp(code, gPassPixEve, 3))
|
||||||
|
@ -79,20 +79,20 @@ BOOL LoadEvent(const char *path_event)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get amount of NPCs
|
// Get amount of NPCs
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
fread(&count, 4, 1, fp);
|
fread(&count, 4, 1, fp);
|
||||||
#else
|
#else
|
||||||
count = File_ReadLE32(fp);
|
count = File_ReadLE32(fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Load NPCs
|
// Load NPCs
|
||||||
memset(gNPC, 0, sizeof(gNPC));
|
memset(gNPC, 0, sizeof(gNPC));
|
||||||
|
|
||||||
n = 170;
|
n = 170;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//Get data from file
|
// Get data from file
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
fread(&eve, sizeof(EVENT), 1, fp);
|
fread(&eve, sizeof(EVENT), 1, fp);
|
||||||
#else
|
#else
|
||||||
|
@ -104,7 +104,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
eve.bits = File_ReadLE16(fp);
|
eve.bits = File_ReadLE16(fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Set NPC parameters
|
// Set NPC parameters
|
||||||
gNPC[n].direct = (eve.bits & npc_altDir) ? 2 : 0;
|
gNPC[n].direct = (eve.bits & npc_altDir) ? 2 : 0;
|
||||||
gNPC[n].code_char = eve.code_char;
|
gNPC[n].code_char = eve.code_char;
|
||||||
gNPC[n].code_event = eve.code_event;
|
gNPC[n].code_event = eve.code_event;
|
||||||
|
@ -116,7 +116,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
|
gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
|
||||||
SetUniqueParameter(&gNPC[n]);
|
SetUniqueParameter(&gNPC[n]);
|
||||||
|
|
||||||
//Check flags
|
// Check flags
|
||||||
if (gNPC[n].bits & npc_appearSet)
|
if (gNPC[n].bits & npc_appearSet)
|
||||||
{
|
{
|
||||||
if (GetNPCFlag(gNPC[n].code_flag) == TRUE)
|
if (GetNPCFlag(gNPC[n].code_flag) == TRUE)
|
||||||
|
@ -132,7 +132,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
gNPC[n].cond = 0x80;
|
gNPC[n].cond = 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Increase index
|
// Increase index
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc
|
||||||
if (n == NPC_MAX)
|
if (n == NPC_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Set NPC parameters
|
// Set NPC parameters
|
||||||
memset(&gNPC[n], 0, sizeof(NPCHAR));
|
memset(&gNPC[n], 0, sizeof(NPCHAR));
|
||||||
gNPC[n].cond |= 0x80u;
|
gNPC[n].cond |= 0x80u;
|
||||||
gNPC[n].direct = dir;
|
gNPC[n].direct = dir;
|
||||||
|
@ -166,7 +166,7 @@ void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc
|
||||||
|
|
||||||
void SetDestroyNpChar(int x, int y, int w, int num)
|
void SetDestroyNpChar(int x, int y, int w, int num)
|
||||||
{
|
{
|
||||||
//Create smoke
|
// Create smoke
|
||||||
w /= 0x200;
|
w /= 0x200;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
|
@ -175,13 +175,13 @@ void SetDestroyNpChar(int x, int y, int w, int num)
|
||||||
SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 0, NULL, 0x100);
|
SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 0, NULL, 0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flash effect
|
// Flash effect
|
||||||
SetCaret(x, y, 12, 0);
|
SetCaret(x, y, 12, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDestroyNpCharUp(int x, int y, int w, int num)
|
void SetDestroyNpCharUp(int x, int y, int w, int num)
|
||||||
{
|
{
|
||||||
//Create smoke
|
// Create smoke
|
||||||
w /= 0x200;
|
w /= 0x200;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
|
@ -190,7 +190,7 @@ void SetDestroyNpCharUp(int x, int y, int w, int num)
|
||||||
SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 1, NULL, 0x100);
|
SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 1, NULL, 0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flash effect
|
// Flash effect
|
||||||
SetCaret(x, y, 12, 0);
|
SetCaret(x, y, 12, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,9 +251,11 @@ BOOL SetBulletObject(int x, int y, int val)
|
||||||
case 5:
|
case 5:
|
||||||
tamakazu_ari[t++] = 0;
|
tamakazu_ari[t++] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
tamakazu_ari[t++] = 1;
|
tamakazu_ari[t++] = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
tamakazu_ari[t] = 0;
|
tamakazu_ari[t] = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -601,9 +603,11 @@ void DeleteNpCharCode(int code, BOOL bSmoke)
|
||||||
case 1:
|
case 1:
|
||||||
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 4);
|
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 8);
|
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 16);
|
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 16);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -68,14 +68,14 @@ void JudgeHitNpCharTriangleA(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
|
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym < 0)
|
if (npc->ym < 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit a ceiling
|
// Set that hit a ceiling
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,14 +91,14 @@ void JudgeHitNpCharTriangleB(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
|
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym < 0)
|
if (npc->ym < 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit a ceiling
|
// Set that hit a ceiling
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,14 +114,14 @@ void JudgeHitNpCharTriangleC(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
|
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym < 0)
|
if (npc->ym < 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit a ceiling
|
// Set that hit a ceiling
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,14 +137,14 @@ void JudgeHitNpCharTriangleD(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
&& npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
&& npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
|
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym < 0)
|
if (npc->ym < 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit a ceiling
|
// Set that hit a ceiling
|
||||||
hit |= 2;
|
hit |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,14 +162,14 @@ void JudgeHitNpCharTriangleE(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
|
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym > 0)
|
if (npc->ym > 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit this slope
|
// Set that hit this slope
|
||||||
hit |= 0x28;
|
hit |= 0x28;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,14 +187,14 @@ void JudgeHitNpCharTriangleF(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
|
npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym > 0)
|
if (npc->ym > 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit this slope
|
// Set that hit this slope
|
||||||
hit |= 0x28;
|
hit |= 0x28;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,14 +212,14 @@ void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
|
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym > 0)
|
if (npc->ym > 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit this slope
|
// Set that hit this slope
|
||||||
hit |= 0x18;
|
hit |= 0x18;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,14 +237,14 @@ void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y)
|
||||||
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
&& npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
|
||||||
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
&& npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
|
||||||
{
|
{
|
||||||
//Clip
|
// Clip
|
||||||
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
|
npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
|
||||||
|
|
||||||
//Halt momentum
|
// Halt momentum
|
||||||
if (npc->ym > 0)
|
if (npc->ym > 0)
|
||||||
npc->ym = 0;
|
npc->ym = 0;
|
||||||
|
|
||||||
//Set that hit this slope
|
// Set that hit this slope
|
||||||
hit |= 0x18;
|
hit |= 0x18;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,12 +321,12 @@ void HitNpCharMap()
|
||||||
{
|
{
|
||||||
switch (GetAttribute(x + offx[j], y + offy[j]))
|
switch (GetAttribute(x + offx[j], y + offy[j]))
|
||||||
{
|
{
|
||||||
//No NPC block
|
// No NPC block
|
||||||
case 0x44:
|
case 0x44:
|
||||||
if (gNPC[i].bits & npc_ignore44)
|
if (gNPC[i].bits & npc_ignore44)
|
||||||
break;
|
break;
|
||||||
// Fallthrough
|
// Fallthrough
|
||||||
//Block
|
// Block
|
||||||
case 0x03:
|
case 0x03:
|
||||||
case 0x05:
|
case 0x05:
|
||||||
case 0x41:
|
case 0x41:
|
||||||
|
@ -334,7 +334,7 @@ void HitNpCharMap()
|
||||||
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
|
JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Slopes
|
// Slopes
|
||||||
case 0x50:
|
case 0x50:
|
||||||
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
break;
|
break;
|
||||||
|
@ -367,14 +367,14 @@ void HitNpCharMap()
|
||||||
JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Water
|
// Water
|
||||||
case 0x02:
|
case 0x02:
|
||||||
case 0x60:
|
case 0x60:
|
||||||
case 0x62:
|
case 0x62:
|
||||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Water block
|
// Water block
|
||||||
case 0x04:
|
case 0x04:
|
||||||
case 0x61:
|
case 0x61:
|
||||||
case 0x64:
|
case 0x64:
|
||||||
|
@ -382,7 +382,7 @@ void HitNpCharMap()
|
||||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Water slopes
|
// Water slopes
|
||||||
case 0x70:
|
case 0x70:
|
||||||
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
|
||||||
|
@ -460,24 +460,26 @@ void HitNpCharMap()
|
||||||
|
|
||||||
void LoseNpChar(NPCHAR *npc, BOOL bVanish)
|
void LoseNpChar(NPCHAR *npc, BOOL bVanish)
|
||||||
{
|
{
|
||||||
//Play death sound
|
// Play death sound
|
||||||
PlaySoundObject(npc->destroy_voice, 1);
|
PlaySoundObject(npc->destroy_voice, 1);
|
||||||
|
|
||||||
//Create smoke
|
// Create smoke
|
||||||
switch (npc->size)
|
switch (npc->size)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 3);
|
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 7);
|
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 12);
|
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 12);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create drop
|
// Create drop
|
||||||
if (npc->exp)
|
if (npc->exp)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
@ -512,10 +514,10 @@ void LoseNpChar(NPCHAR *npc, BOOL bVanish)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set flag
|
// Set flag
|
||||||
SetNPCFlag(npc->code_flag);
|
SetNPCFlag(npc->code_flag);
|
||||||
|
|
||||||
//Create value view
|
// Create value view
|
||||||
if (npc->bits & npc_showDamage)
|
if (npc->bits & npc_showDamage)
|
||||||
{
|
{
|
||||||
if ((npc->bits & npc_showDamage) && npc->damage_view)
|
if ((npc->bits & npc_showDamage) && npc->damage_view)
|
||||||
|
@ -551,7 +553,7 @@ void HitNpCharBullet()
|
||||||
if (gBul[b].damage == -1)
|
if (gBul[b].damage == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Check if bullet touches npc
|
// Check if bullet touches npc
|
||||||
bHit = FALSE;
|
bHit = FALSE;
|
||||||
if (gNPC[n].bits & npc_shootable
|
if (gNPC[n].bits & npc_shootable
|
||||||
&& gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].enemyXL
|
&& gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].enemyXL
|
||||||
|
@ -568,7 +570,7 @@ void HitNpCharBullet()
|
||||||
|
|
||||||
if (bHit)
|
if (bHit)
|
||||||
{
|
{
|
||||||
//Damage NPC
|
// Damage NPC
|
||||||
if (gNPC[n].bits & npc_shootable)
|
if (gNPC[n].bits & npc_shootable)
|
||||||
{
|
{
|
||||||
gNPC[n].life -= gBul[b].damage;
|
gNPC[n].life -= gBul[b].damage;
|
||||||
|
@ -611,7 +613,7 @@ void HitNpCharBullet()
|
||||||
}
|
}
|
||||||
else if ((gBul[b].bbits & 0x10) == 0)
|
else if ((gBul[b].bbits & 0x10) == 0)
|
||||||
{
|
{
|
||||||
//Hit invulnerable NPC
|
// Hit invulnerable NPC
|
||||||
SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 2, 2);
|
SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 2, 2);
|
||||||
PlaySoundObject(31, 1);
|
PlaySoundObject(31, 1);
|
||||||
gBul[b].life = 0;
|
gBul[b].life = 0;
|
||||||
|
@ -626,3 +628,4 @@ void HitNpCharBullet()
|
||||||
LoseNpChar(&gNPC[n], TRUE);
|
LoseNpChar(&gNPC[n], TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,46 +38,46 @@ BOOL LoadNpcTable(const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
for (n = 0; n < num; n++) //bits
|
for (n = 0; n < num; n++) // bits
|
||||||
fread(&gNpcTable[n].bits, 2, 1, fp);
|
fread(&gNpcTable[n].bits, 2, 1, fp);
|
||||||
for (n = 0; n < num; n++) //life
|
for (n = 0; n < num; n++) // life
|
||||||
fread(&gNpcTable[n].life, 2, 1, fp);
|
fread(&gNpcTable[n].life, 2, 1, fp);
|
||||||
for (n = 0; n < num; n++) //surf
|
for (n = 0; n < num; n++) // surf
|
||||||
fread(&gNpcTable[n].surf, 1, 1, fp);
|
fread(&gNpcTable[n].surf, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //destroy_voice
|
for (n = 0; n < num; n++) // destroy_voice
|
||||||
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
|
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //hit_voice
|
for (n = 0; n < num; n++) // hit_voice
|
||||||
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
|
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //size
|
for (n = 0; n < num; n++) // size
|
||||||
fread(&gNpcTable[n].size, 1, 1, fp);
|
fread(&gNpcTable[n].size, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //exp
|
for (n = 0; n < num; n++) // exp
|
||||||
fread(&gNpcTable[n].exp, 4, 1, fp);
|
fread(&gNpcTable[n].exp, 4, 1, fp);
|
||||||
for (n = 0; n < num; n++) //damage
|
for (n = 0; n < num; n++) // damage
|
||||||
fread(&gNpcTable[n].damage, 4, 1, fp);
|
fread(&gNpcTable[n].damage, 4, 1, fp);
|
||||||
for (n = 0; n < num; n++) //hit
|
for (n = 0; n < num; n++) // hit
|
||||||
fread(&gNpcTable[n].hit, 4, 1, fp);
|
fread(&gNpcTable[n].hit, 4, 1, fp);
|
||||||
for (n = 0; n < num; n++) //view
|
for (n = 0; n < num; n++) // view
|
||||||
fread(&gNpcTable[n].view, 4, 1, fp);
|
fread(&gNpcTable[n].view, 4, 1, fp);
|
||||||
#else
|
#else
|
||||||
for (n = 0; n < num; n++) //bits
|
for (n = 0; n < num; n++) // bits
|
||||||
gNpcTable[n].bits = File_ReadLE16(fp);
|
gNpcTable[n].bits = File_ReadLE16(fp);
|
||||||
for (n = 0; n < num; n++) //life
|
for (n = 0; n < num; n++) // life
|
||||||
gNpcTable[n].life = File_ReadLE16(fp);
|
gNpcTable[n].life = File_ReadLE16(fp);
|
||||||
for (n = 0; n < num; n++) //surf
|
for (n = 0; n < num; n++) // surf
|
||||||
fread(&gNpcTable[n].surf, 1, 1, fp);
|
fread(&gNpcTable[n].surf, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //destroy_voice
|
for (n = 0; n < num; n++) // destroy_voice
|
||||||
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
|
fread(&gNpcTable[n].destroy_voice, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //hit_voice
|
for (n = 0; n < num; n++) // hit_voice
|
||||||
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
|
fread(&gNpcTable[n].hit_voice, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //size
|
for (n = 0; n < num; n++) // size
|
||||||
fread(&gNpcTable[n].size, 1, 1, fp);
|
fread(&gNpcTable[n].size, 1, 1, fp);
|
||||||
for (n = 0; n < num; n++) //exp
|
for (n = 0; n < num; n++) // exp
|
||||||
gNpcTable[n].exp = File_ReadLE32(fp);
|
gNpcTable[n].exp = File_ReadLE32(fp);
|
||||||
for (n = 0; n < num; n++) //damage
|
for (n = 0; n < num; n++) // damage
|
||||||
gNpcTable[n].damage = File_ReadLE32(fp);
|
gNpcTable[n].damage = File_ReadLE32(fp);
|
||||||
for (n = 0; n < num; n++) //hit
|
for (n = 0; n < num; n++) // hit
|
||||||
fread(&gNpcTable[n].hit, 4, 1, fp);
|
fread(&gNpcTable[n].hit, 4, 1, fp);
|
||||||
for (n = 0; n < num; n++) //view
|
for (n = 0; n < num; n++) // view
|
||||||
fread(&gNpcTable[n].view, 4, 1, fp);
|
fread(&gNpcTable[n].view, 4, 1, fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void ReleaseNpcTable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Npc function table
|
// Npc function table
|
||||||
NPCFUNCTION gpNpcFuncTbl[361] =
|
NPCFUNCTION gpNpcFuncTbl[361] =
|
||||||
{
|
{
|
||||||
ActNpc000,
|
ActNpc000,
|
||||||
|
|
Loading…
Add table
Reference in a new issue