More-accurate NpChar.cpp variable arrangement

This commit is contained in:
Clownacy 2020-01-07 20:48:21 +00:00
parent affaf25e5c
commit 63e855c7fa

View file

@ -52,14 +52,13 @@ void SetUniqueParameter(NPCHAR *npc)
BOOL LoadEvent(const char *path_event) BOOL LoadEvent(const char *path_event)
{ {
int i, n;
FILE *fp; FILE *fp;
int count; int count;
int i;
int n;
EVENT eve;
char path[MAX_PATH];
char code[4]; char code[4];
EVENT eve;
char path[MAX_PATH];
sprintf(path, "%s\\%s", gDataPath, path_event); sprintf(path, "%s\\%s", gDataPath, path_event);
fp = fopen(path, "rb"); fp = fopen(path, "rb");
@ -189,8 +188,10 @@ void SetDestroyNpCharUp(int x, int y, int w, int num)
void SetExpObjects(int x, int y, int exp) void SetExpObjects(int x, int y, int exp)
{ {
int n;
int sub_exp; int sub_exp;
int n = 0x100;
n = 0x100;
while (exp) while (exp)
{ {
while (n < NPC_MAX && gNPC[n].cond) while (n < NPC_MAX && gNPC[n].cond)
@ -310,8 +311,10 @@ BOOL SetLifeObject(int x, int y, int val)
void VanishNpChar(NPCHAR *npc) void VanishNpChar(NPCHAR *npc)
{ {
int x = npc->x; int x, y;
int y = npc->y;
x = npc->x;
y = npc->y;
memset(npc, 0, sizeof(NPCHAR)); memset(npc, 0, sizeof(NPCHAR));
npc->count1 = 0; npc->count1 = 0;
npc->x = x; npc->x = x;
@ -329,12 +332,12 @@ void PutNpChar(int fx, int fy)
int n; int n;
signed char a = 0; signed char a = 0;
int side;
for (n = 0; n < NPC_MAX; ++n) for (n = 0; n < NPC_MAX; ++n)
{ {
if (gNPC[n].cond & 0x80) if (gNPC[n].cond & 0x80)
{ {
int side;
if (gNPC[n].shock) if (gNPC[n].shock)
{ {
a = 2 * ((gNPC[n].shock / 2) % 2) - 1; a = 2 * ((gNPC[n].shock / 2) % 2) - 1;
@ -367,12 +370,13 @@ void PutNpChar(int fx, int fy)
void ActNpChar(void) void ActNpChar(void)
{ {
int i; int i;
int code_char;
for (i = 0; i < NPC_MAX; ++i) for (i = 0; i < NPC_MAX; ++i)
{ {
if (gNPC[i].cond & 0x80) if (gNPC[i].cond & 0x80)
{ {
int code_char = gNPC[i].code_char; code_char = gNPC[i].code_char;
gpNpcFuncTbl[code_char](&gNPC[i]); gpNpcFuncTbl[code_char](&gNPC[i]);