diff --git a/src/Boss.cpp b/src/Boss.cpp index 498656e6..bd64d250 100644 --- a/src/Boss.cpp +++ b/src/Boss.cpp @@ -50,7 +50,7 @@ void PutBossChar(int fx, int fy) { a = 0; - if (gBoss[b].bits & npc_showDamage && gBoss[b].damage_view) + if (gBoss[b].bits & NPC_SHOW_DAMAGE && gBoss[b].damage_view) { SetValueView(&gBoss[b].x, &gBoss[b].y, gBoss[b].damage_view); gBoss[b].damage_view = 0; @@ -100,13 +100,13 @@ void HitBossBullet() // Check if bullet touches boss bHit = FALSE; - if (gBoss[bos].bits & npc_shootable + if (gBoss[bos].bits & NPC_SHOOTABLE && gBoss[bos].x - gBoss[bos].hit.back < gBul[bul].x + gBul[bul].enemyXL && gBoss[bos].x + gBoss[bos].hit.back > gBul[bul].x - gBul[bul].enemyXL && gBoss[bos].y - gBoss[bos].hit.top < gBul[bul].y + gBul[bul].enemyYL && gBoss[bos].y + gBoss[bos].hit.bottom > gBul[bul].y - gBul[bul].enemyYL) bHit = TRUE; - else if (gBoss[bos].bits & npc_invulnerable + else if (gBoss[bos].bits & NPC_INVULNERABLE && gBoss[bos].x - gBoss[bos].hit.back < gBul[bul].x + gBul[bul].blockXL && gBoss[bos].x + gBoss[bos].hit.back > gBul[bul].x - gBul[bul].blockXL && gBoss[bos].y - gBoss[bos].hit.top < gBul[bul].y + gBul[bul].blockYL @@ -116,7 +116,7 @@ void HitBossBullet() if (bHit) { // Damage boss - if (gBoss[bos].bits & npc_shootable) + if (gBoss[bos].bits & NPC_SHOOTABLE) { if (gBoss[bos].cond & 0x10) bos_ = 0; @@ -129,7 +129,7 @@ void HitBossBullet() { gBoss[bos_].life = bos_; - if ((gMC.cond & 0x80) && gBoss[bos_].bits & npc_eventDie) + if ((gMC.cond & 0x80) && gBoss[bos_].bits & NPC_EVENT_WHEN_KILLED) { StartTextScript(gBoss[bos_].code_event); } @@ -282,7 +282,7 @@ void HitBossMap() if ((gBoss[b].cond & 0x80) == 0) continue; - if (gBoss[b].bits & npc_ignoreSolid) + if (gBoss[b].bits & NPC_IGNORE_SOLIDITY) continue; if (gBoss[b].size >= 3) @@ -306,7 +306,7 @@ void HitBossMap() switch (atrb[j]) { case 0x44: - if (gBoss[b].bits & npc_ignore44) + if (gBoss[b].bits & NPC_IGNORE_TILE_44) break; // Fallthrough case 0x05: diff --git a/src/BossAlmo1.cpp b/src/BossAlmo1.cpp index d33e8347..e8feb8f5 100644 --- a/src/BossAlmo1.cpp +++ b/src/BossAlmo1.cpp @@ -25,7 +25,7 @@ static void ActBossChar_Core_Face(NPCHAR *npc) case 10: npc->act_no = 11; npc->ani_no = 2; - npc->bits = 8; + npc->bits = NPC_IGNORE_SOLIDITY; npc->view.front = 0x4800; npc->view.top = 0x7000; // Fallthrough @@ -73,7 +73,7 @@ static void ActBossChar_Core_Tail(NPCHAR *npc) case 10: npc->act_no = 11; npc->ani_no = 0; - npc->bits = 8; + npc->bits = NPC_IGNORE_SOLIDITY; npc->view.front = 0x5800; npc->view.top = 0x7000; // Fallthrough @@ -125,7 +125,7 @@ static void ActBossChar_Core_Mini(NPCHAR *npc) { case 10: npc->ani_no = 2; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; break; case 100: @@ -134,7 +134,7 @@ static void ActBossChar_Core_Mini(NPCHAR *npc) npc->act_wait = 0; npc->tgt_x = gBoss[0].x + (Random(-0x80, 0x20) * 0x200); npc->tgt_y = gBoss[0].y + (Random(-0x40, 0x40) * 0x200); - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 101: npc->x += (npc->tgt_x - npc->x) / 16; @@ -255,7 +255,7 @@ void ActBossChar_Core(void) npc->act_no = 10; npc->exp = 1; npc->cond = 0x80; - npc->bits = 0x800C; + npc->bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_SHOW_DAMAGE); npc->life = 650; npc->hit_voice = 114; npc->x = 0x9A000; @@ -263,7 +263,7 @@ void ActBossChar_Core(void) npc->xm = 0; npc->ym = 0; npc->code_event = 1000; - npc->bits |= 0x200; + npc->bits |= NPC_EVENT_WHEN_KILLED; gBoss[4].cond = 0x80; gBoss[4].act_no = 10; @@ -272,7 +272,7 @@ void ActBossChar_Core(void) gBoss[5].act_no = 10; gBoss[8].cond = 0x80; - gBoss[8].bits = 12; + gBoss[8].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY); gBoss[8].view.front = 0; gBoss[8].view.top = 0; gBoss[8].hit.back = 0x5000; @@ -301,7 +301,7 @@ void ActBossChar_Core(void) gBoss[1].cond = 0x80; gBoss[1].act_no = 10; - gBoss[1].bits = 44; + gBoss[1].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_SHOOTABLE); gBoss[1].life = 1000; gBoss[1].hit_voice = 54; gBoss[1].hit.back = 0x3000; @@ -332,7 +332,7 @@ void ActBossChar_Core(void) case 200: npc->act_no = 201; npc->act_wait = 0; - gBoss[11].bits &= ~0x20; + gBoss[11].bits &= ~NPC_SHOOTABLE; gSuperYpos = 0; CutNoise(); // Fallthrough @@ -368,7 +368,7 @@ void ActBossChar_Core(void) npc->act_no = 211; npc->act_wait = 0; npc->count2 = npc->life; - gBoss[11].bits |= 0x20; + gBoss[11].bits |= NPC_SHOOTABLE; // Fallthrough case 211: npc->tgt_x = gMC.x; @@ -417,7 +417,7 @@ void ActBossChar_Core(void) npc->act_no = 221; npc->act_wait = 0; gSuperYpos = 1; - gBoss[11].bits |= 0x20u; + gBoss[11].bits |= NPC_SHOOTABLE; SetQuake(100); SetNoise(1, 1000); // Fallthrough @@ -486,7 +486,7 @@ void ActBossChar_Core(void) SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0x100); for (i = 0; i < 12; ++i) - gBoss[i].bits &= ~0x24; + gBoss[i].bits &= ~(NPC_INVULNERABLE | NPC_SHOOTABLE); // Fallthrough case 501: @@ -514,10 +514,10 @@ void ActBossChar_Core(void) npc->act_no = 601; gBoss[4].act_no = 50; gBoss[5].act_no = 50; - gBoss[8].bits &= ~4; - gBoss[9].bits &= ~4; - gBoss[10].bits &= ~4; - gBoss[11].bits &= ~4; + gBoss[8].bits &= ~NPC_INVULNERABLE; + gBoss[9].bits &= ~NPC_INVULNERABLE; + gBoss[10].bits &= ~NPC_INVULNERABLE; + gBoss[11].bits &= ~NPC_INVULNERABLE; // Fallthrough case 601: if (++npc->act_wait / 2 % 2) diff --git a/src/BossAlmo2.cpp b/src/BossAlmo2.cpp index 67c1b020..c02f99f6 100644 --- a/src/BossAlmo2.cpp +++ b/src/BossAlmo2.cpp @@ -26,7 +26,7 @@ static void ActBossCharA_Head(NPCHAR *npc) case 10: npc->act_no = 11; npc->ani_no = 2; - npc->bits = 8; + npc->bits = NPC_IGNORE_SOLIDITY; npc->view.front = 0x4800; npc->view.top = 0x7000; // Fallthrough @@ -72,7 +72,7 @@ static void ActBossCharA_Tail(NPCHAR *npc) case 10: npc->act_no = 11; npc->ani_no = 0; - npc->bits = 8; + npc->bits = NPC_IGNORE_SOLIDITY; npc->view.front = 0x5800; npc->view.top = 0x7000; // Fallthrough @@ -165,7 +165,7 @@ static void ActBossCharA_Face(NPCHAR *npc) npc->x = gBoss[0].x - 0x4800; npc->y = gBoss[0].y + 0x800; - npc->bits = 8; + npc->bits = NPC_IGNORE_SOLIDITY; npc->rect = rect[npc->ani_no]; } @@ -188,33 +188,33 @@ static void ActBossCharA_Mini(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; break; case 5: npc->ani_no = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; ++npc->count2; npc->count2 %= 0x100; break; case 10: npc->ani_no = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->count2 += 2; npc->count2 %= 0x100; break; case 20: npc->ani_no = 1; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->count2 += 2; npc->count2 %= 0x100; break; case 30: npc->ani_no = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->count2 += 4; npc->count2 %= 0x100; break; @@ -295,7 +295,7 @@ void ActBossChar_Undead(void) npc->act_no = 10; npc->exp = 1; npc->cond = 0x80; - npc->bits = 0x800C; + npc->bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_SHOW_DAMAGE); npc->life = 700; npc->hit_voice = 114; npc->x = 0x4A000; @@ -303,7 +303,7 @@ void ActBossChar_Undead(void) npc->xm = 0; npc->ym = 0; npc->code_event = 1000; - npc->bits |= 0x200; + npc->bits |= NPC_EVENT_WHEN_KILLED; gBoss[3].cond = 0x80; gBoss[3].act_no = 0; @@ -315,7 +315,7 @@ void ActBossChar_Undead(void) gBoss[5].act_no = 10; gBoss[8].cond = 0x80; - gBoss[8].bits = 8; + gBoss[8].bits = NPC_IGNORE_SOLIDITY; gBoss[8].view.front = 0; gBoss[8].view.top = 0; gBoss[8].hit.back = 0x5000; @@ -344,7 +344,7 @@ void ActBossChar_Undead(void) gBoss[1].cond = 0x80; gBoss[1].act_no = 0; - gBoss[1].bits = 40; + gBoss[1].bits = (NPC_IGNORE_SOLIDITY | NPC_SHOOTABLE); gBoss[1].life = 1000; gBoss[1].hit_voice = 54; gBoss[1].hit.back = 0x3000; @@ -392,10 +392,10 @@ void ActBossChar_Undead(void) gBoss[3].act_no = 0; gBoss[4].ani_no = 2; gBoss[5].ani_no = 0; - gBoss[8].bits &= ~4; - gBoss[9].bits &= ~4; - gBoss[10].bits &= ~4; - gBoss[11].bits &= ~0x20; + gBoss[8].bits &= ~NPC_INVULNERABLE; + gBoss[9].bits &= ~NPC_INVULNERABLE; + gBoss[10].bits &= ~NPC_INVULNERABLE; + gBoss[11].bits &= ~NPC_SHOOTABLE; gSuperYpos = 0; CutNoise(); bShock = TRUE; @@ -427,10 +427,10 @@ void ActBossChar_Undead(void) npc->act_no = 211; npc->act_wait = 0; gBoss[3].act_no = 10; - gBoss[8].bits |= 4; - gBoss[9].bits |= 4; - gBoss[10].bits |= 4; - gBoss[11].bits |= 0x20; + gBoss[8].bits |= NPC_INVULNERABLE; + gBoss[9].bits |= NPC_INVULNERABLE; + gBoss[10].bits |= NPC_INVULNERABLE; + gBoss[11].bits |= NPC_SHOOTABLE; life = npc->life; bShock = TRUE; // Fallthrough @@ -475,10 +475,10 @@ void ActBossChar_Undead(void) npc->count1 = 0; gSuperYpos = 1; gBoss[3].act_no = 20; - gBoss[8].bits |= 4; - gBoss[9].bits |= 4; - gBoss[10].bits |= 4; - gBoss[11].bits |= 0x20; + gBoss[8].bits |= NPC_INVULNERABLE; + gBoss[9].bits |= NPC_INVULNERABLE; + gBoss[10].bits |= NPC_INVULNERABLE; + gBoss[11].bits |= NPC_SHOOTABLE; SetQuake(100); life = npc->life; bShock = TRUE; @@ -533,10 +533,10 @@ void ActBossChar_Undead(void) npc->act_no = 231; npc->act_wait = 0; gBoss[3].act_no = 30; - gBoss[8].bits |= 4; - gBoss[9].bits |= 4; - gBoss[10].bits |= 4; - gBoss[11].bits |= 0x20; + gBoss[8].bits |= NPC_INVULNERABLE; + gBoss[9].bits |= NPC_INVULNERABLE; + gBoss[10].bits |= NPC_INVULNERABLE; + gBoss[11].bits |= NPC_SHOOTABLE; PlaySoundObject(25, 1); SetNpChar(285, gBoss[3].x - 0x2000, gBoss[3].y, 0, 0, 0, 0, 0x100); SetNpChar(285, gBoss[3].x - 0x2000, gBoss[3].y, 0, 0, 0x400, 0, 0x100); @@ -595,10 +595,10 @@ void ActBossChar_Undead(void) SetNpChar(4, npc->x + (Random(-0x80, 0x80) * 0x200), npc->y + (Random(-0x40, 0x40) * 0x200), Random(-0x80, 0x80) * 0x200, Random(-0x80, 0x80) * 0x200, 0, 0, 0); DeleteNpCharCode(282, 1); - gBoss[11].bits &= ~0x20; + gBoss[11].bits &= ~NPC_SHOOTABLE; for (i = 0; i < 12; ++i) - gBoss[i].bits &= ~4; + gBoss[i].bits &= ~NPC_INVULNERABLE; // Fallthrough case 501: ++npc->act_wait; diff --git a/src/BossBallos.cpp b/src/BossBallos.cpp index 8bde4bb3..8e441dc6 100644 --- a/src/BossBallos.cpp +++ b/src/BossBallos.cpp @@ -91,9 +91,9 @@ static void ActBossChar_Eye(NPCHAR *npc) if (npc->act_no >= 0 && npc->act_no < 300) { if (npc->ani_no != 3) - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; else - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } if (npc->direct == 0) @@ -154,7 +154,7 @@ void ActBossChar_Ballos(void) npc->hit.top = 0x6000; npc->hit.back = 0x4000; npc->hit.bottom = 0x6000; - npc->bits = 0x8248; + npc->bits = (NPC_IGNORE_SOLIDITY | NPC_SOLID_HARD | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); npc->size = 3; npc->damage = 0; npc->code_event = 1000; @@ -163,7 +163,7 @@ void ActBossChar_Ballos(void) // Initialize eyes gBoss[1].cond = 0x90; gBoss[1].direct = 0; - gBoss[1].bits = 8; + gBoss[1].bits = NPC_IGNORE_SOLIDITY; gBoss[1].life = 10000; gBoss[1].view.front = 0x1800; gBoss[1].view.top = 0; @@ -179,7 +179,7 @@ void ActBossChar_Ballos(void) // Initialize the body gBoss[3].cond = 0x90; - gBoss[3].bits = 0xD; + gBoss[3].bits = (NPC_SOLID_SOFT | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY); gBoss[3].view.front = 0x7800; gBoss[3].view.top = 0x7800; gBoss[3].view.back = 0x7800; @@ -190,14 +190,14 @@ void ActBossChar_Ballos(void) gBoss[3].hit.bottom = 0x4000; gBoss[4].cond = 0x90; - gBoss[4].bits = 0xD; + gBoss[4].bits = (NPC_SOLID_SOFT | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY); gBoss[4].hit.front = 0x4000; gBoss[4].hit.top = 0x1000; gBoss[4].hit.back = 0x4000; gBoss[4].hit.bottom = 0x1000; gBoss[5].cond = 0x90; - gBoss[5].bits = 0x4C; + gBoss[5].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_SOLID_HARD); gBoss[5].hit.front = 0x4000; gBoss[5].hit.top = 0; gBoss[5].hit.back = 0x4000; @@ -598,13 +598,17 @@ void ActBossChar_Ballos(void) gBoss[1].act_no = 300; gBoss[2].act_no = 300; - gBoss[1].act_no &= ~0x41; - gBoss[2].act_no &= ~0x41; +#ifndef FIX_BUGS + // This code makes absolutely no sense. + // Luckily, it doesn't cause any bugs. + gBoss[1].act_no &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); + gBoss[2].act_no &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); +#endif - gBoss[0].bits &= ~0x41; - gBoss[3].bits &= ~0x41; - gBoss[4].bits &= ~0x41; - gBoss[5].bits &= ~0x41; + gBoss[0].bits &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); + gBoss[3].bits &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); + gBoss[4].bits &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); + gBoss[5].bits &= ~(NPC_SOLID_SOFT | NPC_SOLID_HARD); // Fallthrough case 1001: ++gBoss[0].act_wait; @@ -646,9 +650,9 @@ void ActBossChar_Ballos(void) if (npc->act_no > 420 && npc->act_no < 500) { - gBoss[3].bits |= 0x20; - gBoss[4].bits |= 0x20; - gBoss[5].bits |= 0x20; + gBoss[3].bits |= NPC_SHOOTABLE; + gBoss[4].bits |= NPC_SHOOTABLE; + gBoss[5].bits |= NPC_SHOOTABLE; if (++npc->act_wait > 300) { diff --git a/src/BossFrog.cpp b/src/BossFrog.cpp index 18cc2cd0..142b00ab 100644 --- a/src/BossFrog.cpp +++ b/src/BossFrog.cpp @@ -32,7 +32,7 @@ static void ActBossChar02_01(void) boss->hit.back = 0x2000; boss->hit.bottom = 0x2000; boss->size = 3; - boss->bits = 4; + boss->bits = NPC_INVULNERABLE; break; case 1: @@ -71,7 +71,7 @@ static void ActBossChar02_02(void) boss->hit.back = 0x3000; boss->hit.bottom = 0x2000; boss->size = 3; - boss->bits = 4; + boss->bits = NPC_INVULNERABLE; break; case 1: @@ -138,7 +138,7 @@ void ActBossChar_Frog(void) boss->size = 3; boss->exp = 1; boss->code_event = 1000; - boss->bits |= 0x8200; + boss->bits |= (NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); boss->life = 300; break; @@ -282,7 +282,7 @@ void ActBossChar_Frog(void) boss->act_wait = 0; boss->ani_no = 3; boss->count1 = 16; - gBoss[1].bits |= 0x20; + gBoss[1].bits |= NPC_SHOOTABLE; boss->tgt_x = boss->life; } @@ -332,7 +332,7 @@ void ActBossChar_Frog(void) boss->act_wait = 0; boss->ani_no = 2; boss->ani_wait = 0; - gBoss[1].bits &= ~0x20; + gBoss[1].bits &= ~NPC_SHOOTABLE; } } @@ -507,7 +507,7 @@ void ActBossChar_Frog(void) { boss->ani_no = 8; boss->ym = -0xA00; - boss->bits |= 8; + boss->bits |= NPC_IGNORE_SOLIDITY; boss->act_no = 143; } diff --git a/src/BossIronH.cpp b/src/BossIronH.cpp index 6ad2f238..e3fa74bc 100644 --- a/src/BossIronH.cpp +++ b/src/BossIronH.cpp @@ -34,7 +34,7 @@ void ActBossChar_Ironhead(void) npc->hit.top = 0x1400; npc->hit.back = 0x2000; npc->hit.bottom = 0x1400; - npc->bits = 0x8228; + npc->bits = (NPC_IGNORE_SOLIDITY | NPC_SHOOTABLE | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); npc->size = 3; npc->damage = 10; npc->code_event = 1000; @@ -43,7 +43,7 @@ void ActBossChar_Ironhead(void) case 100: npc->act_no = 101; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->act_wait = 0; // Fallthrough case 101: @@ -78,7 +78,7 @@ void ActBossChar_Ironhead(void) npc->ym = Random(-0x200, 0x200); npc->xm = Random(-0x200, 0x200); - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 251: if (npc->direct == 2) @@ -148,7 +148,7 @@ void ActBossChar_Ironhead(void) break; case 1000: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 8; npc->damage = 0; npc->act_no = 1001; diff --git a/src/BossOhm.cpp b/src/BossOhm.cpp index 2df6aedd..cc7d7289 100644 --- a/src/BossOhm.cpp +++ b/src/BossOhm.cpp @@ -97,7 +97,7 @@ static void ActBoss01_5() switch (gBoss[5].act_no) { case 0: - gBoss[5].bits |= npc_solidSoft | npc_ignoreSolid; + gBoss[5].bits |= (NPC_SOLID_SOFT | NPC_IGNORE_SOLIDITY); gBoss[5].hit.front = 0x2800; gBoss[5].hit.top = 0x4800; @@ -136,7 +136,7 @@ void ActBossChar_Omega() gBoss[0].hit.back = 0x1000; gBoss[0].hit.bottom = 0x2000; - gBoss[0].bits = (npc_ignoreSolid | npc_eventDie | npc_showDamage); + gBoss[0].bits = (NPC_IGNORE_SOLIDITY | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); gBoss[0].size = 3; gBoss[0].exp = 1; gBoss[0].code_event = 210; @@ -149,7 +149,7 @@ void ActBossChar_Omega() gBoss[1].view.back = 0x1800; gBoss[1].view.bottom = 0x1000; - gBoss[1].bits = npc_ignoreSolid; + gBoss[1].bits = NPC_IGNORE_SOLIDITY; gBoss[2] = gBoss[1]; @@ -170,7 +170,7 @@ void ActBossChar_Omega() gBoss[3].hit.back = 0x1000; gBoss[3].hit.bottom = 0x1000; - gBoss[3].bits = npc_ignoreSolid; + gBoss[3].bits = NPC_IGNORE_SOLIDITY; gBoss[3].x = gBoss[0].x - 0x2000; gBoss[3].y = gBoss[0].y; @@ -205,10 +205,10 @@ void ActBossChar_Omega() gBoss[0].act_no = 110; - gBoss[0].bits |= npc_shootable; - gBoss[0].bits &= ~npc_ignoreSolid; - gBoss[3].bits &= ~npc_ignoreSolid; - gBoss[4].bits &= ~npc_ignoreSolid; + gBoss[0].bits |= NPC_SHOOTABLE; + gBoss[0].bits &= ~NPC_IGNORE_SOLIDITY; + gBoss[3].bits &= ~NPC_IGNORE_SOLIDITY; + gBoss[4].bits &= ~NPC_IGNORE_SOLIDITY; gBoss[3].act_no = 3; gBoss[4].act_no = 3; @@ -238,7 +238,7 @@ void ActBossChar_Omega() { gBoss[0].act_no = 60; gBoss[0].act_wait = 0; - gBoss[0].bits |= npc_shootable; + gBoss[0].bits |= NPC_SHOOTABLE; gBoss[0].hit.front = 0x2000; gBoss[0].hit.back = 0x2000; } @@ -281,7 +281,7 @@ void ActBossChar_Omega() gBoss[0].act_no = 80; gBoss[0].act_wait = 0; - gBoss[0].bits &= ~npc_shootable; + gBoss[0].bits &= ~NPC_SHOOTABLE; gBoss[0].hit.front = 0x3000; gBoss[0].hit.back = 0x3000; @@ -369,7 +369,7 @@ void ActBossChar_Omega() if (!gBoss[0].count2) { gBoss[0].act_no = 140; - gBoss[0].bits |= npc_shootable; + gBoss[0].bits |= NPC_SHOOTABLE; gBoss[0].hit.front = 0x2000; gBoss[0].hit.back = 0x2000; diff --git a/src/BossPress.cpp b/src/BossPress.cpp index f9b62b6c..92fde880 100644 --- a/src/BossPress.cpp +++ b/src/BossPress.cpp @@ -35,7 +35,7 @@ void ActBossChar_Press(void) npc->hit.top = 0x7800; npc->hit.back = 0x5000; npc->hit.bottom = 0x6000; - npc->bits = 0x8248; + npc->bits = (NPC_IGNORE_SOLIDITY | NPC_SOLID_HARD | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); npc->size = 3; npc->damage = 10; npc->code_event = 1000; @@ -61,7 +61,7 @@ void ActBossChar_Press(void) npc->act_no = 21; npc->x = 0x14000; npc->y = 0x33A00; - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; gBoss[1].cond = 0; gBoss[2].cond = 0; // Fallthrough @@ -107,12 +107,12 @@ void ActBossChar_Press(void) gBoss[1].hit.back = 0x1C00; gBoss[1].hit.top = 0x1000; gBoss[1].hit.bottom = 0x1000; - gBoss[1].bits = 12; + gBoss[1].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY); gBoss[2] = gBoss[1]; gBoss[3].cond = 0x90; - gBoss[3].bits |= 0x20; + gBoss[3].bits |= NPC_SHOOTABLE; gBoss[3].hit.front = 0xC00; gBoss[3].hit.back = 0xC00; gBoss[3].hit.top = 0x1000; @@ -148,7 +148,7 @@ void ActBossChar_Press(void) break; case 500: - gBoss[3].bits &= ~0x20; + gBoss[3].bits &= ~NPC_SHOOTABLE; npc->act_no = 501; npc->act_wait = 0; diff --git a/src/BossTwinD.cpp b/src/BossTwinD.cpp index 47b59ab5..1e042d4c 100644 --- a/src/BossTwinD.cpp +++ b/src/BossTwinD.cpp @@ -58,7 +58,7 @@ static void ActBossCharT_DragonBody(NPCHAR *npc) case 1000: npc->act_no = 1001; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; // Fallthrough case 1001: deg = ((npc->pNpc->count1 / 4) + npc->count1) % 0x100; @@ -120,7 +120,7 @@ static void ActBossCharT_DragonHead(NPCHAR *npc) npc->act_no = 200; // Fallthrough case 200: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 0; npc->hit.front = 0x2000; npc->act_no = 201; @@ -148,7 +148,7 @@ static void ActBossCharT_DragonHead(NPCHAR *npc) { npc->ani_no = 2; npc->hit.front = 0x1000; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->count2 = 0; } @@ -205,7 +205,7 @@ static void ActBossCharT_DragonHead(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 0; npc->hit.front = 0x2000; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; // Fallthrough case 401: if (++npc->act_wait == 3) @@ -215,7 +215,7 @@ static void ActBossCharT_DragonHead(NPCHAR *npc) { npc->ani_no = 2; npc->hit.front = 0x1000; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->count2 = 0; } @@ -237,7 +237,7 @@ static void ActBossCharT_DragonHead(NPCHAR *npc) break; case 1000: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 3; break; } @@ -279,8 +279,8 @@ void ActBossChar_Twin(void) npc->hit.top = 0x1000; npc->hit.back = 0x1000; npc->hit.bottom = 0x1000; - npc->bits = 8; - npc->bits |= 0x200; + npc->bits = NPC_IGNORE_SOLIDITY; + npc->bits |= NPC_EVENT_WHEN_KILLED; npc->size = 3; npc->damage = 0; npc->code_event = 1000; @@ -298,7 +298,7 @@ void ActBossChar_Twin(void) gBoss[2].hit.front = 0x1800; gBoss[2].hit.top = 0x1400; gBoss[2].hit.bottom = 0x1400; - gBoss[2].bits = 12; + gBoss[2].bits = (NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY); gBoss[2].pNpc = &gBoss[3]; gBoss[2].cond |= 0x10; gBoss[2].damage = 10; @@ -312,7 +312,7 @@ void ActBossChar_Twin(void) gBoss[3].hit.front = 0x1800; gBoss[3].hit.top = 0x400; gBoss[3].hit.bottom = 0x2000; - gBoss[3].bits = 8; + gBoss[3].bits = NPC_IGNORE_SOLIDITY; gBoss[3].pNpc = npc; gBoss[3].damage = 10; diff --git a/src/BossX.cpp b/src/BossX.cpp index 94b9cb0e..5d84b4fc 100644 --- a/src/BossX.cpp +++ b/src/BossX.cpp @@ -35,11 +35,11 @@ static void ActBossChar03_01(NPCHAR *npc) { case 10: npc->ani_no = 0; - npc->bits &= ~0x10; + npc->bits &= ~NPC_BOUNCY; break; case 100: - npc->bits |= 0x10; + npc->bits |= NPC_BOUNCY; npc->act_no = 101; npc->act_wait = 0; npc->ani_no = 2; @@ -62,7 +62,7 @@ static void ActBossChar03_01(NPCHAR *npc) break; case 102: - npc->bits &= ~0x10; + npc->bits &= ~NPC_BOUNCY; npc->act_no = 103; npc->ani_no = 0; npc->ani_wait = 0; @@ -83,8 +83,8 @@ static void ActBossChar03_01(NPCHAR *npc) break; case 200: - npc->bits |= 0x10; - npc->bits |= 0x80; + npc->bits |= NPC_BOUNCY; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->act_no = 201; npc->act_wait = 0; npc->ani_no = 4; @@ -107,7 +107,7 @@ static void ActBossChar03_01(NPCHAR *npc) break; case 202: - npc->bits &= ~0x10; + npc->bits &= ~NPC_BOUNCY; npc->act_no = 203; npc->ani_no = 0; npc->ani_wait = 0; @@ -131,7 +131,7 @@ static void ActBossChar03_01(NPCHAR *npc) npc->act_no = 301; npc->ani_no = 4; npc->ani_wait = 0; - npc->bits |= 0x10; + npc->bits |= NPC_BOUNCY; // Fallthrough case 301: if (++npc->ani_wait > 0) @@ -157,7 +157,7 @@ static void ActBossChar03_01(NPCHAR *npc) npc->act_no = 401; npc->ani_no = 2; npc->ani_wait = 0; - npc->bits |= 0x10; + npc->bits |= NPC_BOUNCY; // Fallthrough case 401: if (++npc->ani_wait > 0) @@ -189,12 +189,12 @@ static void ActBossChar03_01(NPCHAR *npc) if (npc->act_no >= 100 && gMC.y < npc->y + 0x800 && gMC.y > npc->y - 0x800) { npc->damage = 10; - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; } else { npc->damage = 0; - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; } if (npc->xm > 0x400) @@ -380,14 +380,14 @@ static void ActBossChar03_04(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 0; break; case 10: npc->act_no = 11; npc->act_wait = 10 * npc->tgt_x + 40; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 11: if (npc->act_wait < 16 && npc->act_wait / 2 % 2) @@ -449,14 +449,14 @@ static void ActBossChar03_face(NPCHAR *npc) switch (npc->act_no) { case 0: - gBoss[0].bits &= ~0x20; + gBoss[0].bits &= ~NPC_SHOOTABLE; npc->ani_no = 0; break; case 10: npc->act_no = 11; npc->act_wait = 10 * npc->tgt_x + 40; - gBoss[0].bits |= 0x20; + gBoss[0].bits |= NPC_SHOOTABLE; // Fallthrough case 11: if (gBoss[0].shock) @@ -507,7 +507,7 @@ void ActBossChar_MonstX(void) npc->hit.top = 0x3000; npc->hit.back = 0x3000; npc->hit.bottom = 0x3000; - npc->bits = 0x8208; + npc->bits = (NPC_IGNORE_SOLIDITY | NPC_EVENT_WHEN_KILLED | NPC_SHOW_DAMAGE); npc->size = 3; npc->code_event = 1000; npc->ani_no = 0; @@ -518,7 +518,7 @@ void ActBossChar_MonstX(void) gBoss[1].view.top = 0x3000; gBoss[1].view.back = 0x3000; gBoss[1].view.bottom = 0x3000; - gBoss[1].bits = 8; + gBoss[1].bits = NPC_IGNORE_SOLIDITY; gBoss[2] = gBoss[1]; gBoss[2].direct = 2; gBoss[3].cond = 0x80; @@ -535,7 +535,7 @@ void ActBossChar_MonstX(void) gBoss[3].hit.back = 0xA00; gBoss[3].hit.top = 0xA00; gBoss[3].hit.bottom = 0xA00; - gBoss[3].bits = 8; + gBoss[3].bits = NPC_IGNORE_SOLIDITY; gBoss[3].tgt_x = 0; gBoss[4] = gBoss[3]; gBoss[4].tgt_x = 1; @@ -557,7 +557,7 @@ void ActBossChar_MonstX(void) gBoss[7].hit.top = 0x3000; gBoss[7].hit.back = 0x1000; gBoss[7].hit.bottom = 0x2000; - gBoss[7].bits = 8; + gBoss[7].bits = NPC_IGNORE_SOLIDITY; gBoss[7].size = 3; gBoss[7].ani_no = 0; gBoss[9].cond = 0x80; @@ -574,7 +574,7 @@ void ActBossChar_MonstX(void) gBoss[9].hit.top = 0x1000; gBoss[9].hit.back = 0x3800; gBoss[9].hit.bottom = 0x2000; - gBoss[9].bits = 141; + gBoss[9].bits = (NPC_SOLID_SOFT | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_REAR_AND_TOP_DONT_HURT); gBoss[9].size = 3; gBoss[10] = gBoss[9]; gBoss[10].x = 0x108000; @@ -596,25 +596,25 @@ void ActBossChar_MonstX(void) gBoss[13].view.back = 0x5400; gBoss[13].count1 = 9; gBoss[13].ani_no = 0; - gBoss[13].bits = 8; + gBoss[13].bits = NPC_IGNORE_SOLIDITY; gBoss[14] = gBoss[13]; gBoss[14].view.front = 0x5400; gBoss[14].view.back = 0x3C00; gBoss[14].count1 = 10; gBoss[14].ani_no = 1; - gBoss[14].bits = 8; + gBoss[14].bits = NPC_IGNORE_SOLIDITY; gBoss[15] = gBoss[13]; gBoss[15].view.top = 0x2000; gBoss[15].view.bottom = 0x2000; gBoss[15].count1 = 11; gBoss[15].ani_no = 2; - gBoss[15].bits = 8; + gBoss[15].bits = NPC_IGNORE_SOLIDITY; gBoss[16] = gBoss[15]; gBoss[16].view.front = 0x5400; gBoss[16].view.back = 0x3C00; gBoss[16].count1 = 12; gBoss[16].ani_no = 3; - gBoss[16].bits = 8; + gBoss[16].bits = NPC_IGNORE_SOLIDITY; npc->act_no = 2; break; diff --git a/src/MycHit.cpp b/src/MycHit.cpp index e0aa7209..c2ddf56a 100644 --- a/src/MycHit.cpp +++ b/src/MycHit.cpp @@ -624,7 +624,7 @@ int JudgeHitMyCharNPC(NPCHAR *npc) && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.hit.bottom + gMC.y < npc->y + 0x600) { - if (npc->bits & npc_bouncy) + if (npc->bits & NPC_BOUNCY) { gMC.ym = npc->ym - 0x200; hit |= 8; @@ -720,7 +720,7 @@ int JudgeHitMyCharNPC4(NPCHAR *npc) gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200; hit |= 8; } - else if (npc->bits & npc_bouncy) + else if (npc->bits & NPC_BOUNCY) { gMC.ym = npc->ym - 0x200; hit |= 8; @@ -780,12 +780,12 @@ void HitMyCharNpChar() hit = 0; - if (gNPC[i].bits & npc_solidSoft) + if (gNPC[i].bits & NPC_SOLID_SOFT) { hit = JudgeHitMyCharNPC(&gNPC[i]); gMC.flag |= hit; } - else if (gNPC[i].bits & npc_solidHard) + else if (gNPC[i].bits & NPC_SOLID_HARD) { hit = JudgeHitMyCharNPC4(&gNPC[i]); gMC.flag |= hit; @@ -818,13 +818,13 @@ void HitMyCharNpChar() } // Run event on contact - if ((g_GameFlags & 4) == 0 && hit && gNPC[i].bits & npc_eventTouch) + if ((g_GameFlags & 4) == 0 && hit && gNPC[i].bits & NPC_EVENT_WHEN_TOUCHED) StartTextScript(gNPC[i].code_event); // NPC damage - if (g_GameFlags & 2 && (gNPC[i].bits & npc_interact) == 0) + if (g_GameFlags & 2 && (gNPC[i].bits & NPC_INTERACTABLE) == 0) { - if (gNPC[i].bits & npc_rearTop) + if (gNPC[i].bits & NPC_REAR_AND_TOP_DONT_HURT) { if (hit & 4 && gNPC[i].xm < 0) DamageMyChar(gNPC[i].damage); @@ -842,7 +842,7 @@ void HitMyCharNpChar() } // Interaction - if ((g_GameFlags & 4) == 0 && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact) + if ((g_GameFlags & 4) == 0 && hit && gMC.cond & 1 && gNPC[i].bits & NPC_INTERACTABLE) { StartTextScript(gNPC[i].code_event); gMC.xm = 0; @@ -869,12 +869,12 @@ void HitMyCharBoss() hit = 0; - if (gBoss[b].bits & npc_solidSoft) + if (gBoss[b].bits & NPC_SOLID_SOFT) { hit = JudgeHitMyCharNPC(&gBoss[b]); gMC.flag |= hit; } - else if (gBoss[b].bits & npc_solidHard) + else if (gBoss[b].bits & NPC_SOLID_HARD) { hit = JudgeHitMyCharNPC4(&gBoss[b]); gMC.flag |= hit; @@ -884,13 +884,13 @@ void HitMyCharBoss() hit = JudgeHitMyCharNPC3(&gBoss[b]); } - if (!(g_GameFlags & 4) && hit && gBoss[b].bits & npc_eventTouch) + if (!(g_GameFlags & 4) && hit && gBoss[b].bits & NPC_EVENT_WHEN_TOUCHED) { StartTextScript(gBoss[b].code_event); gMC.ques = 0; } - if (gBoss[b].bits & npc_rearTop) + if (gBoss[b].bits & NPC_REAR_AND_TOP_DONT_HURT) { if (hit & 4 && gBoss[b].xm < 0) DamageMyChar(gBoss[b].damage); @@ -902,7 +902,7 @@ void HitMyCharBoss() DamageMyChar(gBoss[b].damage); } - if (!(g_GameFlags & 4) && hit && (gMC.cond & 1) && gBoss[b].bits & npc_interact) + if (!(g_GameFlags & 4) && hit && (gMC.cond & 1) && gBoss[b].bits & NPC_INTERACTABLE) { StartTextScript(gBoss[b].code_event); gMC.xm = 0; diff --git a/src/NpChar.cpp b/src/NpChar.cpp index b1323573..ca83c369 100644 --- a/src/NpChar.cpp +++ b/src/NpChar.cpp @@ -105,7 +105,7 @@ BOOL LoadEvent(const char *path_event) #endif // Set NPC parameters - gNPC[n].direct = (eve.bits & npc_altDir) ? 2 : 0; + gNPC[n].direct = (eve.bits & NPC_SPAWN_IN_OTHER_DIRECTION) ? 2 : 0; gNPC[n].code_char = eve.code_char; gNPC[n].code_event = eve.code_event; gNPC[n].code_flag = eve.code_flag; @@ -117,12 +117,12 @@ BOOL LoadEvent(const char *path_event) SetUniqueParameter(&gNPC[n]); // Check flags - if (gNPC[n].bits & npc_appearSet) + if (gNPC[n].bits & NPC_APPEAR_WHEN_FLAG_SET) { if (GetNPCFlag(gNPC[n].code_flag) == TRUE) gNPC[n].cond |= 0x80; } - else if (gNPC[n].bits & npc_hideSet) + else if (gNPC[n].bits & NPC_HIDE_WHEN_FLAG_SET) { if (GetNPCFlag(gNPC[n].code_flag) == FALSE) gNPC[n].cond |= 0x80; @@ -346,7 +346,7 @@ void PutNpChar(int fx, int fy) else { a = 0; - if (gNPC[n].bits & npc_showDamage && gNPC[n].damage_view) + if (gNPC[n].bits & NPC_SHOW_DAMAGE && gNPC[n].damage_view) { SetValueView(&gNPC[n].x, &gNPC[n].y, gNPC[n].damage_view); gNPC[n].damage_view = 0; @@ -391,7 +391,7 @@ void ChangeNpCharByEvent(int code_event, int code_char, int dir) { if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event) { - gNPC[n].bits &= (npc_eventTouch | npc_eventDie | 0x400 | npc_appearSet | npc_altDir | npc_interact | npc_hideSet); + gNPC[n].bits &= ~(NPC_SOLID_SOFT | NPC_IGNORE_TILE_44 | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_BOUNCY | NPC_SHOOTABLE | NPC_SOLID_HARD | NPC_REAR_AND_TOP_DONT_HURT | NPC_SHOW_DAMAGE); // Clear these flags gNPC[n].code_char = code_char; gNPC[n].bits |= gNpcTable[gNPC[n].code_char].bits; gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp; @@ -433,8 +433,8 @@ void ChangeCheckableNpCharByEvent(int code_event, int code_char, int dir) { if ((gNPC[n].cond & 0x80) != 0 && gNPC[n].code_event == code_event) { - gNPC[n].bits &= ~(npc_showDamage | npc_rearTop | npc_solidHard | npc_shootable | npc_bouncy | npc_ignoreSolid | npc_invulnerable | npc_ignore44 | npc_solidSoft); - gNPC[n].bits |= npc_interact; + gNPC[n].bits &= ~(NPC_SOLID_SOFT | NPC_IGNORE_TILE_44 | NPC_INVULNERABLE | NPC_IGNORE_SOLIDITY | NPC_BOUNCY | NPC_SHOOTABLE | NPC_SOLID_HARD | NPC_REAR_AND_TOP_DONT_HURT | NPC_SHOW_DAMAGE); // Clear these flags + gNPC[n].bits |= NPC_INTERACTABLE; gNPC[n].code_char = code_char; gNPC[n].bits |= gNpcTable[gNPC[n].code_char].bits; gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp; diff --git a/src/NpChar.h b/src/NpChar.h index fa17c9f0..3062b890 100644 --- a/src/NpChar.h +++ b/src/NpChar.h @@ -6,23 +6,24 @@ #define NPC_MAX 0x200 -enum NPC_flags +// Be careful when changing these: they're baked into the 'npc.tbl' file +enum NPCFlags { - npc_solidSoft = 0x1, //Pushes quote out - npc_ignore44 = 0x2, //Ignores tile 44 (No NPC) - npc_invulnerable = 0x4, //Can't get hit - npc_ignoreSolid = 0x8, //Doesn't collide with anything - npc_bouncy = 0x10, //Quote bounces on the top - npc_shootable = 0x20, //Can be shot - npc_solidHard = 0x40, //Essentially acts as level tiles - npc_rearTop = 0x80, //Rear and top don't hurt - npc_eventTouch = 0x100, //Run event when touched - npc_eventDie = 0x200, //Run event when killed - npc_appearSet = 0x800, //Only appear when flag is set - npc_altDir = 0x1000, //Spawn facing to the right (or however the npc interprets the direction as) - npc_interact = 0x2000, //Run event when interacted with - npc_hideSet = 0x4000, //Hide when flag is set - npc_showDamage = 0x8000 //Show #Damage taken + NPC_SOLID_SOFT = 1<<0, // Pushes Quote out + NPC_IGNORE_TILE_44 = 1<<1, // Ignores tile 44, which normally blocks NPCs + NPC_INVULNERABLE = 1<<2, // Can't be hurt + NPC_IGNORE_SOLIDITY = 1<<3, // Doesn't collide with anything + NPC_BOUNCY = 1<<4, // Quote bounces on top of NPC + NPC_SHOOTABLE = 1<<5, // Can be shot + NPC_SOLID_HARD = 1<<6, // Essentially acts as level tiles + NPC_REAR_AND_TOP_DONT_HURT = 1<<7, // Rear and top don't hurt when touched + NPC_EVENT_WHEN_TOUCHED = 1<<8, // Run event when touched + NPC_EVENT_WHEN_KILLED = 1<<9, // Run event when killed + NPC_APPEAR_WHEN_FLAG_SET = 1<<11, // Only appear when flag is set + NPC_SPAWN_IN_OTHER_DIRECTION = 1<<12, // Spawn facing to the right (or however the NPC interprets the direction) + NPC_INTERACTABLE = 1<<13, // Run event when interacted with + NPC_HIDE_WHEN_FLAG_SET = 1<<14, // Hide when flag is set + NPC_SHOW_DAMAGE = 1<<15 // Show the number of damage taken when harmed }; struct NPCHAR diff --git a/src/NpcAct000.cpp b/src/NpcAct000.cpp index 887f31bc..a225e142 100644 --- a/src/NpcAct000.cpp +++ b/src/NpcAct000.cpp @@ -746,7 +746,7 @@ void ActNpc008(NPCHAR *npc) case 0: if (gMC.x < npc->x + 0x2000 && gMC.x > npc->x - 0x2000) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->ym = -0x100; npc->tgt_y = npc->y; npc->act_no = 1; @@ -765,7 +765,7 @@ void ActNpc008(NPCHAR *npc) } else { - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->rect.right = 0; npc->damage = 0; npc->xm = 0; @@ -851,8 +851,8 @@ void ActNpc009(NPCHAR *npc) } else { - npc->bits &= ~8; - npc->bits |= 1; + npc->bits &= ~NPC_IGNORE_SOLIDITY; + npc->bits |= NPC_SOLID_SOFT; } if (npc->flag & 8) @@ -1125,7 +1125,7 @@ void ActNpc012(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 3; npc->ym = -0x800; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } break; @@ -1308,7 +1308,7 @@ void ActNpc012(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 3; npc->ym = -0x800; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; DeleteNpCharCode(150, 0); DeleteNpCharCode(117, 0); SetNpChar(355, 0, 0, 0, 0, 0, npc, 0x100); @@ -1475,7 +1475,7 @@ void ActNpc015(NPCHAR *npc) { case 0: npc->act_no = 1; - npc->bits |= 0x2000u; + npc->bits |= NPC_INTERACTABLE; if (npc->direct == 2) { @@ -1536,12 +1536,12 @@ void ActNpc016(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; npc->act_no = 1; if (npc->direct == 2) { - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->ym = -0x200; for (int i = 0; i < 4; ++i) @@ -1551,7 +1551,7 @@ void ActNpc016(NPCHAR *npc) // Fallthrough case 1: if (npc->flag & 8) - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; break; } diff --git a/src/NpcAct020.cpp b/src/NpcAct020.cpp index f7bc6f6d..41a950f1 100644 --- a/src/NpcAct020.cpp +++ b/src/NpcAct020.cpp @@ -465,7 +465,7 @@ void ActNpc026(NPCHAR *npc) npc->xm /= 2; npc->ym = 0; npc->act_no = 3; - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; } } @@ -482,7 +482,7 @@ void ActNpc026(NPCHAR *npc) npc->xm *= 2; npc->count1 = 0; npc->act_no = 1; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } break; @@ -1027,7 +1027,7 @@ void ActNpc035(NPCHAR *npc) npc->act_no = 3; npc->act_wait = 0; npc->ani_no = 2; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; } diff --git a/src/NpcAct040.cpp b/src/NpcAct040.cpp index dad7b9ef..f53ce803 100644 --- a/src/NpcAct040.cpp +++ b/src/NpcAct040.cpp @@ -678,7 +678,7 @@ void ActNpc046(NPCHAR *npc) { RECT rect = {0, 0, 16, 16}; - npc->bits |= 0x100; + npc->bits |= NPC_EVENT_WHEN_TOUCHED; if (npc->direct == 0) { @@ -708,10 +708,10 @@ void ActNpc047(NPCHAR *npc) npc->act_no = 1; npc->act_wait = 0; npc->tgt_y = npc->y; - npc->bits &= ~0x20; - npc->bits &= ~4; - npc->bits &= ~1; - npc->bits &= ~8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; + npc->bits &= ~NPC_SOLID_SOFT; + npc->bits &= ~NPC_IGNORE_SOLIDITY; // Fallthrough case 1: if (gMC.x > npc->x - 0x1000 && gMC.x < npc->x + 0x1000 && gMC.y > npc->y && gMC.y < npc->y + 0x1000) @@ -741,7 +741,7 @@ void ActNpc047(NPCHAR *npc) if (npc->ani_no == 4) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->act_no = 3; npc->act_wait = 0; } @@ -749,7 +749,7 @@ void ActNpc047(NPCHAR *npc) break; case 3: - npc->bits |= 1; + npc->bits |= NPC_SOLID_SOFT; npc->damage = 0; ++npc->act_wait; @@ -762,13 +762,13 @@ void ActNpc047(NPCHAR *npc) break; case 4: - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->y += 0x200; if (++npc->act_wait == 32) { - npc->bits &= ~1; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SOLID_SOFT; + npc->bits &= ~NPC_SHOOTABLE; npc->act_no = 5; npc->act_wait = 0; } @@ -827,8 +827,8 @@ void ActNpc048(NPCHAR *npc) if (npc->direct == 2) { - npc->bits &= ~npc_shootable; - npc->bits |= npc_invulnerable; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; } npc->ym += 5; @@ -1808,7 +1808,7 @@ void ActNpc058(NPCHAR *npc) case 0: if (gMC.x < npc->x + 0x2000 && gMC.x > npc->x - 0x2000) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->ym = -0x100; npc->tgt_x = npc->x; npc->tgt_y = npc->y; @@ -1835,7 +1835,7 @@ void ActNpc058(NPCHAR *npc) npc->damage = 0; npc->xm = 0; npc->ym = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; } break; diff --git a/src/NpcAct060.cpp b/src/NpcAct060.cpp index 8c4589a4..4bea3832 100644 --- a/src/NpcAct060.cpp +++ b/src/NpcAct060.cpp @@ -165,7 +165,7 @@ void ActNpc060(NPCHAR *npc) { npc->act_no = 12; npc->ani_no = 7; - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; } break; @@ -520,7 +520,7 @@ void ActNpc063(NPCHAR *npc) // Fallthrough case 1: if (npc->ym > 0) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (++npc->ani_wait > 2) { @@ -569,7 +569,7 @@ void ActNpc063(NPCHAR *npc) } if (npc->act_wait > 35) - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; if (npc->direct == 0) npc->xm -= 0x40; @@ -581,7 +581,7 @@ void ActNpc063(NPCHAR *npc) npc->act_no = 4; npc->ani_no = 4; npc->ym = -0x400; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; } @@ -596,7 +596,7 @@ void ActNpc063(NPCHAR *npc) if (npc->act_wait++ && npc->flag & 8) { npc->act_no = 5; - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; } break; @@ -942,7 +942,7 @@ void ActNpc067(NPCHAR *npc) PlaySoundObject(23, 1); npc->ym = 0; npc->act_no = 14; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ani_no = 2; } @@ -969,7 +969,7 @@ void ActNpc067(NPCHAR *npc) npc->act_no = 21; npc->ani_no = 0; npc->ym = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 21: npc->ym -= 0x20; diff --git a/src/NpcAct080.cpp b/src/NpcAct080.cpp index 9be69e54..378a0e18 100644 --- a/src/NpcAct080.cpp +++ b/src/NpcAct080.cpp @@ -39,7 +39,7 @@ void ActNpc080(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->act_no = 1; npc->damage = 0; npc->hit.front = 0x800; @@ -58,7 +58,7 @@ void ActNpc080(NPCHAR *npc) npc->ani_no = 1; npc->ani_wait = 0; npc->act_no = 2; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; } if (gMC.x < npc->x) @@ -83,7 +83,7 @@ void ActNpc080(NPCHAR *npc) npc->hit.front = 0x2400; npc->act_wait = 0; npc->act_no = 3; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; PlaySoundObject(34, 1); if (npc->direct == 0) @@ -365,7 +365,7 @@ void ActNpc082(NPCHAR *npc) npc->act_no = 21; npc->ani_no = 0; npc->ym = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 21: npc->ym -= 0x20; @@ -1446,8 +1446,8 @@ void ActNpc094(NPCHAR *npc) break; case 10: - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; if (++npc->act_wait > 40) { @@ -1505,8 +1505,8 @@ void ActNpc094(NPCHAR *npc) { npc->act_no = 20; npc->ani_no = 4; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; } } else diff --git a/src/NpcAct100.cpp b/src/NpcAct100.cpp index 12203beb..fe7b309d 100644 --- a/src/NpcAct100.cpp +++ b/src/NpcAct100.cpp @@ -163,14 +163,14 @@ void ActNpc104(NPCHAR *npc) else npc->direct = 2; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ani_no = 2; npc->act_no = 3; break; } else { - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; } // Fallthrough case 1: @@ -209,7 +209,7 @@ void ActNpc104(NPCHAR *npc) case 3: if (++npc->act_wait > 40) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->flag & 8) { @@ -631,7 +631,7 @@ void ActNpc110(NPCHAR *npc) else npc->direct = 2; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ani_no = 2; npc->act_no = 3; @@ -639,7 +639,7 @@ void ActNpc110(NPCHAR *npc) } else { - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; } // Fallthrough case 1: @@ -678,7 +678,7 @@ void ActNpc110(NPCHAR *npc) case 3: if (++npc->act_wait > 40) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->flag & 8) { @@ -1096,12 +1096,12 @@ void ActNpc114(NPCHAR *npc) if (gMC.y > npc->y) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->damage = 0x7F; } else { - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; npc->damage = 0; } @@ -1119,7 +1119,7 @@ void ActNpc114(NPCHAR *npc) npc->act_no = 1; npc->ani_no = 0; npc->damage = 0; - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; } break; @@ -1261,7 +1261,7 @@ void ActNpc115(NPCHAR *npc) npc->ani_no = 4; npc->damage = 0; npc->ym = -0x200; - npc->bits &= ~0x21; + npc->bits &= ~(NPC_SOLID_SOFT | NPC_SHOOTABLE); PlaySoundObject(51, 1); // Fallthrough case 51: @@ -1558,8 +1558,8 @@ void ActNpc118(NPCHAR *npc) else npc->direct = 2; - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; // Fallthrough case 11: if (npc->act_wait) @@ -1600,7 +1600,7 @@ void ActNpc118(NPCHAR *npc) } else { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->act_no = 20; npc->act_wait = 0; PlaySoundObject(103, 1); @@ -1683,8 +1683,8 @@ void ActNpc118(NPCHAR *npc) npc->act_wait = 0; npc->act_no = 30; npc->ani_no = 7; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; npc->xm = 0; } diff --git a/src/NpcAct120.cpp b/src/NpcAct120.cpp index 8a419708..4492224e 100644 --- a/src/NpcAct120.cpp +++ b/src/NpcAct120.cpp @@ -185,7 +185,7 @@ void ActNpc122(NPCHAR *npc) } else { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->act_no = 15; npc->ani_no = 2; npc->ym = -0x200; @@ -197,7 +197,7 @@ void ActNpc122(NPCHAR *npc) case 15: if (npc->flag & 8) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->xm = 0; npc->act_no = 10; npc->damage = 0; @@ -229,7 +229,7 @@ void ActNpc122(NPCHAR *npc) } else { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->life = 1000; npc->act_no = 11; npc->act_wait = Random(0, 50); @@ -244,7 +244,7 @@ void ActNpc122(NPCHAR *npc) npc->act_no = 20; npc->ym = -0x200; npc->ani_no = Random(6, 7); - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; } npc->ym += 0x20; @@ -366,7 +366,7 @@ void ActNpc124(NPCHAR *npc) npc->y += 0x1000; // Fallthrough case 1: - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->ani_no = 0; break; @@ -374,7 +374,7 @@ void ActNpc124(NPCHAR *npc) npc->act_no = 11; npc->ani_no = 1; npc->act_wait = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: switch (npc->direct) @@ -547,9 +547,9 @@ void ActNpc126(NPCHAR *npc) } if (gKeyTrg & gKeyDown) - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; else - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->ym += 0x40; if (npc->ym > 0x5FF) @@ -725,7 +725,7 @@ void ActNpc130(NPCHAR *npc) npc->act_no = 1; npc->ani_no = 0; npc->ani_wait = 0; - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; // Fallthrough case 1: if (Random(0, 120) == 10) @@ -1009,15 +1009,15 @@ void ActNpc134(NPCHAR *npc) case 0: npc->act_no = 1; npc->ani_no = 2; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; // Fallthrough case 1: if (gMC.x > npc->x - 0x28000 && gMC.x < npc->x + 0x28000 && gMC.y > npc->y - 0x14000 && gMC.y < npc->y + 0x8000) // TODO: Maybe do something about this for widescreen/tallscreen? { npc->act_no = 10; - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; } break; @@ -1047,8 +1047,8 @@ void ActNpc134(NPCHAR *npc) npc->act_no = 20; npc->act_wait = 0; npc->ani_no = 2; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; } break; @@ -1059,8 +1059,8 @@ void ActNpc134(NPCHAR *npc) npc->act_no = 10; npc->ani_no = 0; npc->ani_wait = 0; - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; } break; @@ -1207,7 +1207,7 @@ void ActNpc136(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->act_no = 1; npc->ani_no = 0; npc->ani_wait = 0; @@ -1291,7 +1291,7 @@ void ActNpc138(NPCHAR *npc) npc->act_no = 11; npc->ani_no = 1; npc->act_wait = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: if (++npc->act_wait % 8 == 0) diff --git a/src/NpcAct140.cpp b/src/NpcAct140.cpp index afb1cf92..032a4c35 100644 --- a/src/NpcAct140.cpp +++ b/src/NpcAct140.cpp @@ -58,7 +58,7 @@ void ActNpc140(NPCHAR *npc) npc->act_no = 1; npc->ani_no = 9; npc->act_wait = 0; - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; // Fallthrough case 1: if (++npc->act_wait > 50) @@ -87,7 +87,7 @@ void ActNpc140(NPCHAR *npc) if (++npc->act_wait > 50) { npc->act_no = 10; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } break; @@ -244,7 +244,7 @@ void ActNpc140(NPCHAR *npc) case 100: npc->ani_no = 3; npc->act_no = 101; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; for (i = 0; i < 8; ++i) @@ -438,8 +438,8 @@ void ActNpc141(NPCHAR *npc) npc->ani_no = 0; npc->act_no = 20; npc->xm = 0; - npc->bits &= ~4; - npc->bits |= 0x20; + npc->bits &= ~NPC_INVULNERABLE; + npc->bits |= NPC_SHOOTABLE; npc->damage = 1; } @@ -981,11 +981,11 @@ void ActNpc149(NPCHAR *npc) npc->xm = 0; npc->ym = 0; - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; break; case 10: - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; if (gMC.x < npc->x + 0x3200 && gMC.x > npc->x - 0x32000 && gMC.y < npc->y + 0x3200 && gMC.y > npc->y - 0x3200) @@ -1015,12 +1015,12 @@ void ActNpc149(NPCHAR *npc) { if (gMC.flag & 1) { - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 100; } else { - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; } @@ -1030,7 +1030,7 @@ void ActNpc149(NPCHAR *npc) break; case 20: - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; if (gMC.x > npc->x - 0x3200 && gMC.x < npc->x + 0x32000 && gMC.y < npc->y + 0x3200 && gMC.y > npc->y - 0x3200) @@ -1060,12 +1060,12 @@ void ActNpc149(NPCHAR *npc) { if (gMC.flag & 4) { - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 100; } else { - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; } @@ -1549,8 +1549,8 @@ void ActNpc154(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; - npc->bits &= ~8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->damage = 0; npc->act_no = 1; npc->ani_no = 9; @@ -1759,11 +1759,11 @@ void ActNpc157(NPCHAR *npc) npc->xm = 0; npc->ym = 0; - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; break; case 10: - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; if (gMC.y < npc->y + 0x3200 && gMC.y > npc->y - 0x32000 && gMC.x < npc->x + 0x3200 && gMC.x > npc->x - 0x3200) @@ -1793,12 +1793,12 @@ void ActNpc157(NPCHAR *npc) { if (gMC.flag & 2) { - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 100; } else { - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; } @@ -1808,7 +1808,7 @@ void ActNpc157(NPCHAR *npc) break; case 20: - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; if (gMC.y > npc->y - 0x3200 && gMC.y < npc->y + 0x32000 && gMC.x < npc->x + 0x3200 && gMC.x > npc->x - 0x3200) @@ -1838,12 +1838,12 @@ void ActNpc157(NPCHAR *npc) { if (gMC.flag & 8) { - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 100; } else { - npc->bits &= ~0x80; + npc->bits &= ~NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 0; } diff --git a/src/NpcAct160.cpp b/src/NpcAct160.cpp index 83cb51a3..636f50f2 100644 --- a/src/NpcAct160.cpp +++ b/src/NpcAct160.cpp @@ -21,7 +21,7 @@ void ActNpc160(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~1; + npc->bits &= ~NPC_SOLID_SOFT; npc->act_no = 1; // Fallthrough case 1: @@ -38,7 +38,7 @@ void ActNpc160(NPCHAR *npc) } else { - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->act_no = 2; } @@ -94,7 +94,7 @@ void ActNpc160(NPCHAR *npc) npc->count1 = 0; npc->act_no = 5; npc->ym = -0xC00; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } } @@ -205,8 +205,8 @@ void ActNpc161(NPCHAR *npc) if (npc->life < 100) { - npc->bits &= ~0x20; - npc->bits &= ~4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; npc->damage = 0; npc->ani_no = 2; } @@ -1321,7 +1321,7 @@ void ActNpc175(NPCHAR *npc) LoseNpChar(npc, 0); npc->act_no = 10; npc->ani_no = 1; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; } @@ -1371,7 +1371,7 @@ void ActNpc176(NPCHAR *npc) LoseNpChar(npc, 0); npc->act_no = 10; npc->ani_no = 2; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; } diff --git a/src/NpcAct180.cpp b/src/NpcAct180.cpp index 93bf0afc..ba41f9a2 100644 --- a/src/NpcAct180.cpp +++ b/src/NpcAct180.cpp @@ -103,7 +103,7 @@ void ActNpc180(NPCHAR *npc) case 41: if (++npc->act_wait == 750) { - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->ani_no = 0; } @@ -586,7 +586,7 @@ void ActNpc184(NPCHAR *npc) npc->act_no = 11; npc->ani_no = 1; npc->act_wait = 0; - npc->bits |= npc_ignoreSolid; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: switch (npc->direct) @@ -650,7 +650,7 @@ void ActNpc185(NPCHAR *npc) npc->act_no = 11; npc->ani_no = 1; npc->act_wait = 0; - npc->bits |= npc_ignoreSolid; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: switch (npc->direct) @@ -705,7 +705,7 @@ void ActNpc186(NPCHAR *npc) npc->act_no = 11; npc->ani_no = 1; npc->act_wait = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: switch (npc->direct) diff --git a/src/NpcAct200.cpp b/src/NpcAct200.cpp index a458b70e..8a66f9cd 100644 --- a/src/NpcAct200.cpp +++ b/src/NpcAct200.cpp @@ -42,7 +42,7 @@ void ActNpc200(NPCHAR *npc) SetDestroyNpChar(npc->x, npc->y, npc->view.back, 8); SetExpObjects(npc->x, npc->y, npc->exp); npc->act_no = 100; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; } @@ -385,18 +385,18 @@ void ActNpc205(NPCHAR *npc) if (gMC.y > npc->y) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->damage = 0x7F; } else { - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; npc->damage = 0; } if (++npc->act_wait > 8 && npc->flag & 0xFF) { - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; npc->act_no = 4; npc->act_wait = 0; npc->ym = 0; @@ -413,7 +413,7 @@ void ActNpc205(NPCHAR *npc) if (++npc->act_wait > 4) { npc->act_no = 5; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } break; @@ -599,7 +599,7 @@ void ActNpc208(NPCHAR *npc) case 0: if (gMC.x < npc->x + 0x2000 && gMC.x > npc->x - 0x2000) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->ym = -0x200; npc->tgt_x = npc->x; npc->tgt_y = npc->y; @@ -626,7 +626,7 @@ void ActNpc208(NPCHAR *npc) npc->damage = 0; npc->xm = 0; npc->ym = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; } return; @@ -786,7 +786,7 @@ void ActNpc210(NPCHAR *npc) case 0: if (gMC.x < npc->x + 0x2000 && gMC.x > npc->x - 0x2000) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->ym = -0x200; npc->tgt_y = npc->y; npc->act_no = 1; @@ -805,7 +805,7 @@ void ActNpc210(NPCHAR *npc) } else { - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->rect.right = 0; npc->damage = 0; npc->xm = 0; @@ -919,7 +919,7 @@ void ActNpc212(NPCHAR *npc) npc->tgt_y = npc->y - 0x2000; npc->tgt_x = npc->x - 0xC00; npc->ym = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 11: if (npc->x < npc->tgt_x) @@ -948,7 +948,7 @@ void ActNpc212(NPCHAR *npc) case 20: npc->act_no = 21; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 21: if (npc->y < npc->tgt_y) @@ -1030,7 +1030,7 @@ void ActNpc213(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 1; npc->ym = 0; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } break; @@ -1174,7 +1174,7 @@ void ActNpc214(NPCHAR *npc) { case 0: npc->act_no = 1; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 1: if (++npc->ani_wait > 2) @@ -1192,7 +1192,7 @@ void ActNpc214(NPCHAR *npc) npc->y += npc->ym; if (npc->xm < 0) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->flag & 0xFF) { @@ -1217,10 +1217,10 @@ void ActNpc215(NPCHAR *npc) npc->act_no = 1; npc->act_wait = 0; npc->tgt_y = npc->y; - npc->bits &= ~0x20; - npc->bits &= ~4; - npc->bits &= ~1; - npc->bits &= ~8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; + npc->bits &= ~NPC_SOLID_SOFT; + npc->bits &= ~NPC_IGNORE_SOLIDITY; // Fallthrough case 1: if (gMC.x > npc->x - 0x1800 && gMC.x < npc->x + 0x1800 && gMC.y > npc->y && gMC.y < npc->y + 0x1000) @@ -1252,7 +1252,7 @@ void ActNpc215(NPCHAR *npc) if (npc->ani_no == 4) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->act_no = 30; npc->act_wait = 0; } @@ -1260,7 +1260,7 @@ void ActNpc215(NPCHAR *npc) break; case 30: - npc->bits |= 1; + npc->bits |= NPC_SOLID_SOFT; npc->damage = 0; ++npc->act_wait; @@ -1273,13 +1273,13 @@ void ActNpc215(NPCHAR *npc) break; case 40: - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->y += 0x200; if (++npc->act_wait == 32) { - npc->bits &= ~1; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SOLID_SOFT; + npc->bits &= ~NPC_SHOOTABLE; npc->act_no = 50; npc->act_wait = 0; } diff --git a/src/NpcAct220.cpp b/src/NpcAct220.cpp index f099dc43..15e90e97 100644 --- a/src/NpcAct220.cpp +++ b/src/NpcAct220.cpp @@ -597,7 +597,7 @@ void ActNpc231(NPCHAR *npc) break; case 12: - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->act_no = 13; npc->act_wait = 0; npc->ani_no = 1; @@ -653,7 +653,7 @@ void ActNpc231(NPCHAR *npc) if (npc->flag & 8) { - npc->bits |= 0x2000; + npc->bits |= NPC_INTERACTABLE; npc->act_no = 1; npc->ani_no = 0; } @@ -796,7 +796,7 @@ void ActNpc233(NPCHAR *npc) npc->xm /= 4; npc->ym = 0; npc->act_no = 3; - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; } } @@ -813,7 +813,7 @@ void ActNpc233(NPCHAR *npc) npc->xm *= 2; npc->count1 = 0; npc->act_no = 1; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } break; diff --git a/src/NpcAct240.cpp b/src/NpcAct240.cpp index 98567704..bdcea76e 100644 --- a/src/NpcAct240.cpp +++ b/src/NpcAct240.cpp @@ -455,12 +455,12 @@ void ActNpc246(NPCHAR *npc) if (gMC.y > npc->y) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->damage = 0x7F; } else { - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; npc->damage = 0; } @@ -478,7 +478,7 @@ void ActNpc246(NPCHAR *npc) npc->act_no = 20; npc->ani_no = 0; npc->ani_wait = 0; - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; npc->damage = 0; } @@ -590,7 +590,7 @@ void ActNpc247(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 0; npc->xm = 0; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->count2 = npc->life; // Fallthrough case 101: @@ -622,7 +622,7 @@ void ActNpc247(NPCHAR *npc) npc->act_wait = 0; npc->xm = 0; npc->ym = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; // Fallthrough case 111: if (++npc->act_wait % 2) @@ -699,7 +699,7 @@ void ActNpc247(NPCHAR *npc) { npc->act_wait = 0; npc->ym = -0x200; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->x = npc->tgt_x; npc->y = npc->tgt_y; @@ -759,7 +759,7 @@ void ActNpc247(NPCHAR *npc) break; case 1000: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->act_no = 1001; npc->act_wait = 0; npc->ani_no = 4; @@ -1025,9 +1025,9 @@ void ActNpc252(NPCHAR *npc) case 10: npc->act_no = 11; - npc->bits |= 0x20; - npc->bits &= ~4; - npc->bits &= ~8; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; deg = GetArktan(npc->x - gMC.x, npc->y - gMC.y); deg += (unsigned char)Random(-3, 3); @@ -1386,7 +1386,7 @@ void ActNpc259(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x2000; + npc->bits &= ~NPC_INTERACTABLE; npc->act_no = 1; // Fallthrough case 1: diff --git a/src/NpcAct260.cpp b/src/NpcAct260.cpp index eeaa4000..ee855238 100644 --- a/src/NpcAct260.cpp +++ b/src/NpcAct260.cpp @@ -232,7 +232,7 @@ void ActNpc263(NPCHAR *npc) case 10: npc->ym += 0x80; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->damage = 3; if (npc->flag & 8) @@ -300,7 +300,7 @@ void ActNpc263(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 6; npc->tgt_x = npc->x; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 31: if (++npc->act_wait / 2 % 2) @@ -333,7 +333,7 @@ void ActNpc263(NPCHAR *npc) case 100: npc->act_no = 101; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; npc->act_wait = 0; PlaySoundObject(29, 1); @@ -375,7 +375,7 @@ void ActNpc263(NPCHAR *npc) if (npc->act_wait <= 0) { - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->damage = 3; if (npc->count1 < 3) @@ -393,7 +393,7 @@ void ActNpc263(NPCHAR *npc) break; case 500: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 6; npc->ym += 0x10; @@ -660,7 +660,7 @@ void ActNpc267(NPCHAR *npc) break; case 10: - npc->bits |= 4; + npc->bits |= NPC_INVULNERABLE; npc->xm = 0; npc->act_no = 11; npc->act_wait = 0; @@ -841,8 +841,8 @@ void ActNpc267(NPCHAR *npc) case 30: npc->act_no = 31; npc->act_wait = 0; - npc->bits |= 1; - npc->bits &= ~0x20; + npc->bits |= NPC_SOLID_SOFT; + npc->bits &= ~NPC_SHOOTABLE; // Fallthrough case 31: npc->ani_no = 3; @@ -852,7 +852,7 @@ void ActNpc267(NPCHAR *npc) npc->act_no = 32; npc->act_wait = 0; npc->ani_no = 7; - npc->bits |= 0x80; + npc->bits |= NPC_REAR_AND_TOP_DONT_HURT; npc->damage = 10; PlaySoundObject(25, 1); @@ -878,8 +878,8 @@ void ActNpc267(NPCHAR *npc) npc->act_wait = 0; npc->act_no = 18; npc->damage = 5; - npc->bits &= ~0x81; - npc->bits |= 0x20; + npc->bits &= ~(NPC_SOLID_SOFT | NPC_REAR_AND_TOP_DONT_HURT); + npc->bits |= NPC_SHOOTABLE; } if (npc->flag & 1 || npc->flag & 4) @@ -887,8 +887,8 @@ void ActNpc267(NPCHAR *npc) npc->act_no = 15; npc->act_wait = 0; npc->damage = 5; - npc->bits &= ~0x81; - npc->bits |= 0x20; + npc->bits &= ~(NPC_SOLID_SOFT | NPC_REAR_AND_TOP_DONT_HURT); + npc->bits |= NPC_SHOOTABLE; } break; @@ -944,7 +944,7 @@ void ActNpc267(NPCHAR *npc) case 100: npc->act_no = 101; npc->act_wait = 0; - npc->bits &= ~0x24; + npc->bits &= ~(NPC_INVULNERABLE | NPC_SHOOTABLE); npc->damage = 0; PlaySoundObject(29, 1); // Fallthrough @@ -994,7 +994,7 @@ void ActNpc267(NPCHAR *npc) if (npc->act_wait <= 0) { - npc->bits |= 0x24; + npc->bits |= (NPC_INVULNERABLE | NPC_SHOOTABLE); npc->damage = 5; npc->act_no = 16; npc->ym = -0x200; @@ -1005,7 +1005,7 @@ void ActNpc267(NPCHAR *npc) case 500: DeleteNpCharCode(269, 1); - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->ani_no = 4; npc->ym += 0x20; npc->xm = 0; @@ -1040,7 +1040,7 @@ void ActNpc267(NPCHAR *npc) npc->ani_no = 9; npc->tgt_x = npc->x; npc->y += 0x2000; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; // Fallthrough case 511: SetQuake(2); @@ -1432,7 +1432,7 @@ void ActNpc270(NPCHAR *npc) { case 0: npc->act_no = 1; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->xm = 3 * Random(-0x200, 0x200); npc->ym = 3 * Random(-0x200, 0x200); @@ -1859,7 +1859,7 @@ void ActNpc276(NPCHAR *npc) npc->act_no = 11; npc->act_wait = 0; npc->ani_no = 3; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 11: switch (++npc->act_wait) @@ -1955,7 +1955,7 @@ void ActNpc276(NPCHAR *npc) break; case 50: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->damage = 0; if (npc->flag & 8) @@ -2165,13 +2165,13 @@ void ActNpc279(NPCHAR *npc) { case 0: npc->act_no = 100; - npc->bits |= 4; + npc->bits |= NPC_INVULNERABLE; npc->ani_no = 0; break; case 2: npc->act_no = 100; - npc->bits |= 4; + npc->bits |= NPC_INVULNERABLE; npc->ani_no = 1; npc->view.back = 0x1000; npc->view.front = 0x1000; @@ -2202,7 +2202,7 @@ void ActNpc279(NPCHAR *npc) if (npc->act_wait <= 0) { npc->act_no = 100; - npc->bits |= 4; + npc->bits |= NPC_INVULNERABLE; } break; @@ -2213,13 +2213,13 @@ void ActNpc279(NPCHAR *npc) npc->ym = 0x700; if (npc->y > 0x10000) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->flag & 8) { npc->ym = -0x200; npc->act_no = 110; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; PlaySoundObject(26, 1); SetQuake(10); diff --git a/src/NpcAct280.cpp b/src/NpcAct280.cpp index 296dd084..8c4b18e2 100644 --- a/src/NpcAct280.cpp +++ b/src/NpcAct280.cpp @@ -172,22 +172,22 @@ void ActNpc282(NPCHAR *npc) if (gMC.flag & 1 && gMC.x < npc->x - npc->hit.back && gMC.x > npc->x - npc->hit.back - 0x1000 && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.y - gMC.hit.top < npc->y + npc->hit.bottom) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->ani_no = 1; } else if (gMC.flag & 4 && gMC.x > npc->x + npc->hit.back && gMC.x < npc->x + npc->hit.back + 0x1000 && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.y - gMC.hit.top < npc->y + npc->hit.bottom) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->ani_no = 1; } else if (gMC.flag & 2 && gMC.y < npc->y - npc->hit.top && gMC.y > npc->y - npc->hit.top - 0x1000 && gMC.x + gMC.hit.front > npc->x - npc->hit.back && gMC.x - gMC.hit.back < npc->x + npc->hit.front) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->ani_no = 1; } else if (gMC.flag & 8 && gMC.y > npc->y + npc->hit.bottom - 0x800 && gMC.y < npc->y + npc->hit.bottom + 0x1800 && gMC.x + gMC.hit.front > npc->x - npc->hit.back - 0x800 && gMC.x - gMC.hit.back < npc->x + npc->hit.front + 0x800) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->ani_no = 1; } } @@ -569,15 +569,15 @@ void ActNpc283(NPCHAR *npc) npc->xm = 0; npc->ym = 0; npc->ani_no = 9; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; break; case 100: npc->act_no = 101; npc->ani_no = 9; npc->damage = 0; - npc->bits &= ~0x20; - npc->bits |= 8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ym = -0x200; npc->shock += 50; npc->hit.bottom = 0x1800; @@ -695,8 +695,8 @@ void ActNpc284(NPCHAR *npc) npc->ani_no = 0; npc->ani_wait = 0; npc->damage = 0; - npc->bits |= 0x20; - npc->bits &= ~8; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; // Fallthrough case 21: npc->xm = 7 * npc->xm / 8; @@ -762,7 +762,7 @@ void ActNpc284(NPCHAR *npc) case 32: npc->act_no = 33; npc->act_wait = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; if (gMC.x < npc->x) npc->tgt_x = gMC.x - 0x14000; @@ -774,21 +774,21 @@ void ActNpc284(NPCHAR *npc) deg = GetArktan(npc->x - npc->tgt_x, npc->y - npc->tgt_y); npc->xm = 3 * GetCos(deg); npc->ym = 3 * GetSin(deg); - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->x < (gMap.width * 0x200 * 0x10) / 2 && npc->xm > 0) { if (npc->y < (gMap.length * 0x200 * 0x10) / 2 && npc->ym > 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; if (npc->y > (gMap.length * 0x200 * 0x10) / 2 && npc->ym < 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } if (npc->x > (gMap.width * 0x200 * 0x10) / 2 && npc->xm < 0) { if (npc->y < (gMap.length * 0x200 * 0x10) / 2 && npc->ym > 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; if (npc->y > (gMap.length * 0x200 * 0x10) / 2 && npc->ym < 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } if (npc->xm > 0) @@ -818,22 +818,22 @@ void ActNpc284(NPCHAR *npc) deg = GetArktan(npc->x - npc->tgt_x, npc->y - npc->tgt_y); npc->ym = 3 * GetSin(deg); npc->xm = 3 * GetCos(deg); - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->x < (gMap.width * 0x200 * 0x10) / 2 && npc->xm > 0) { if (npc->y < (gMap.length * 0x200 * 0x10) / 2 && npc->ym > 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; if (npc->y > (gMap.length * 0x200 * 0x10) / 2 && npc->ym < 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } if (npc->x > (gMap.width * 0x200 * 0x10) / 2 && npc->xm < 0) { if (npc->y < (gMap.length * 0x200 * 0x10) / 2 && npc->ym > 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; if (npc->y > (gMap.length * 0x200 * 0x10) / 2 && npc->ym < 0) - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } if (npc->xm > 0) @@ -870,7 +870,7 @@ void ActNpc284(NPCHAR *npc) npc->act_wait = 0; npc->ani_no = 2; npc->damage = 0; - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; // Fallthrough case 41: npc->xm = 7 * npc->xm / 8; @@ -921,15 +921,15 @@ void ActNpc284(NPCHAR *npc) npc->xm = 0; npc->ym = 0; npc->ani_no = 9; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; break; case 100: npc->act_no = 101; npc->ani_no = 9; npc->damage = 0; - npc->bits &= ~0x20; - npc->bits |= 8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ym = -0x200; npc->shock += 50; ++gBoss[0].ani_no; @@ -1121,7 +1121,7 @@ void ActNpc288(NPCHAR *npc) PlaySoundObject(44, 1); npc->act_no = 3; npc->act_wait = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; npc->ym = 0; if (npc->x > gMC.x) @@ -1191,7 +1191,7 @@ void ActNpc289(NPCHAR *npc) npc->view.top = 0x1000; npc->view.bottom = 0x1000; npc->damage = 2; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } break; @@ -1234,7 +1234,7 @@ void ActNpc289(NPCHAR *npc) break; case 12: - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; if (npc->y > gMap.length * 0x200 * 0x10) { @@ -1301,7 +1301,7 @@ void ActNpc290(NPCHAR *npc) npc->view.top = 0x1000; npc->view.bottom = 0x1000; npc->damage = 2; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->tgt_y = npc->y; npc->ym = 0x400; } @@ -1369,7 +1369,7 @@ void ActNpc291(NPCHAR *npc) if (npc->direct == 2) { - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; npc->ani_no = 1; } diff --git a/src/NpcAct300.cpp b/src/NpcAct300.cpp index 095e2a86..047d21c0 100644 --- a/src/NpcAct300.cpp +++ b/src/NpcAct300.cpp @@ -543,7 +543,7 @@ void ActNpc309(NPCHAR *npc) case 10: npc->act_no = 11; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->damage = 5; // Fallthrough case 11: @@ -632,8 +632,8 @@ void ActNpc310(NPCHAR *npc) { case 0: npc->act_no = 1; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; npc->damage = 0; // Fallthrough case 1: @@ -653,8 +653,8 @@ void ActNpc310(NPCHAR *npc) npc->xm = 0; npc->act_no = 11; npc->act_wait = 0; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; npc->damage = 0; npc->ani_no = 0; // Fallthrough @@ -667,8 +667,8 @@ void ActNpc310(NPCHAR *npc) case 20: npc->act_no = 21; npc->act_wait = 0; - npc->bits &= ~4; - npc->bits |= 0x20; + npc->bits &= ~NPC_INVULNERABLE; + npc->bits |= NPC_SHOOTABLE; npc->damage = 0; if (npc->x > gMC.x) @@ -949,7 +949,7 @@ void ActNpc312(NPCHAR *npc) ++npc->act_wait; if (npc->act_wait == 4) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->act_wait > 10) npc->act_no = 10; @@ -1102,7 +1102,7 @@ void ActNpc313(NPCHAR *npc) npc->act_no = 110; npc->act_wait = 0; npc->count1 = 0; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 110: npc->damage = 1; @@ -1147,7 +1147,7 @@ void ActNpc313(NPCHAR *npc) npc->ym += 0x80; if (npc->y > 0x10000) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->xm < 0 && npc->flag & 1) npc->xm *= -1; @@ -1206,8 +1206,8 @@ void ActNpc313(NPCHAR *npc) npc->xm = 0x5FF; PlaySoundObject(25, 1); - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; npc->damage = 10; } @@ -1242,8 +1242,8 @@ void ActNpc313(NPCHAR *npc) { npc->count1 = 0; npc->act_no = 130; - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; npc->damage = 3; } @@ -1286,9 +1286,9 @@ void ActNpc313(NPCHAR *npc) npc->ani_no = 12; npc->ym = -0x800; PlaySoundObject(25, 1); - npc->bits |= 8; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits |= NPC_IGNORE_SOLIDITY; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; npc->damage = 10; } @@ -1321,15 +1321,15 @@ void ActNpc313(NPCHAR *npc) { npc->count1 = 0; npc->act_no = 130; - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; npc->damage = 3; } break; case 500: - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; npc->act_no = 501; npc->act_wait = 0; npc->ani_no = 8; @@ -1352,13 +1352,13 @@ void ActNpc313(NPCHAR *npc) { if (IsActiveSomeBullet()) { - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; } else { - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; } } @@ -1388,7 +1388,7 @@ void ActNpc314(NPCHAR *npc) case 0: npc->count2 = 0; npc->act_no = 100; - npc->bits |= 4; + npc->bits |= NPC_INVULNERABLE; npc->ani_no = Random(0, 2); // Fallthrough case 100: @@ -1398,13 +1398,13 @@ void ActNpc314(NPCHAR *npc) npc->ym = 0x700; if (npc->y > 0x10000) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->flag & 8) { npc->ym = -0x200; npc->act_no = 110; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; PlaySoundObject(12, 1); SetQuake(10); @@ -1471,7 +1471,7 @@ void ActNpc315(NPCHAR *npc) if (npc->y > 0x10000) { npc->act_no = 130; - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; } break; @@ -1480,7 +1480,7 @@ void ActNpc315(NPCHAR *npc) npc->act_no = 110; npc->act_wait = 0; npc->count1 = 0; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 110: if (npc->x > gMC.x) @@ -1548,7 +1548,7 @@ void ActNpc315(NPCHAR *npc) if (++npc->act_wait > 4) { npc->act_no = 110; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } break; @@ -1558,13 +1558,13 @@ void ActNpc315(NPCHAR *npc) { if (IsActiveSomeBullet()) { - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; } else { - npc->bits |= 0x20; - npc->bits &= ~4; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_INVULNERABLE; } } @@ -1605,8 +1605,8 @@ void ActNpc316(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; - npc->bits &= ~8; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->damage = 0; npc->act_no = 1; npc->ani_no = 0; @@ -1779,9 +1779,9 @@ void ActNpc318(NPCHAR *npc) switch (npc->act_no) { case 0: - npc->bits &= ~0x20; - npc->bits &= ~8; - npc->bits &= ~1; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; + npc->bits &= ~NPC_SOLID_SOFT; npc->damage = 0; npc->act_no = 1; npc->ani_no = 0; @@ -1880,7 +1880,7 @@ void ActNpc319(NPCHAR *npc) case 2: if (++npc->act_wait == 4) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->ym += 0x2A; if (npc->ym > 0x5FF) diff --git a/src/NpcAct320.cpp b/src/NpcAct320.cpp index f2b3877d..265c065b 100644 --- a/src/NpcAct320.cpp +++ b/src/NpcAct320.cpp @@ -190,8 +190,8 @@ void ActNpc322(NPCHAR *npc) { npc->act_no = 2; npc->act_wait = 0; - npc->bits &= ~0x20; - npc->bits |= 4; + npc->bits &= ~NPC_SHOOTABLE; + npc->bits |= NPC_INVULNERABLE; PlaySoundObject(22, 1); } @@ -314,7 +314,7 @@ void ActNpc323(NPCHAR *npc) // Fallthrough case 1: if (++npc->act_wait == 16) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->x += npc->xm; npc->y += npc->ym; @@ -356,8 +356,8 @@ void ActNpc323(NPCHAR *npc) npc->code_char = 309; npc->ani_no = 0; npc->act_no = 11; - npc->bits |= 0x20; - npc->bits &= ~8; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->damage = 5; npc->view.top = 0x1000; } @@ -1079,7 +1079,7 @@ void ActNpc338(NPCHAR *npc) npc->view.top = 0x1000; npc->view.bottom = 0x1000; npc->damage = 3; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->tgt_y = npc->y; npc->ym = (Random(-10, 10) * 0x200) / 2; // Fallthrough diff --git a/src/NpcAct340.cpp b/src/NpcAct340.cpp index d40b3e4c..125738e0 100644 --- a/src/NpcAct340.cpp +++ b/src/NpcAct340.cpp @@ -49,7 +49,7 @@ void ActNpc340(NPCHAR *npc) npc->ani_no = 1; npc->ani_wait = 0; npc->damage = 4; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; // Fallthrough case 110: npc->act_no = 111; @@ -453,7 +453,7 @@ void ActNpc340(NPCHAR *npc) npc->ani_no = 10; npc->tgt_x = npc->x; npc->xm = 0; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; SetDestroyNpChar(npc->x, npc->y, 0x10, 0x10); PlaySoundObject(72, 1); // Fallthrough @@ -498,7 +498,7 @@ void ActNpc340(NPCHAR *npc) npc->ani_no = 3; npc->ym -= 0xA00; npc->direct = 0; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; } break; @@ -633,7 +633,7 @@ void ActNpc342(NPCHAR *npc) case 20: npc->act_no = 21; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->life = 1000; // Fallthrough case 21: @@ -657,7 +657,7 @@ void ActNpc342(NPCHAR *npc) if (npc->life < 900) { npc->act_no = 22; - npc->bits &= ~0x20; + npc->bits &= ~NPC_SHOOTABLE; SetDestroyNpChar(npc->x, npc->y, 0x2000, 0x20); PlaySoundObject(71, 1); } @@ -699,7 +699,7 @@ void ActNpc342(NPCHAR *npc) npc->damage = 10; if (npc->direct == 0) - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; npc->ym = 0; // Fallthrough @@ -710,7 +710,7 @@ void ActNpc342(NPCHAR *npc) if (npc->count2 > 0x100) --npc->count2; - if (npc->bits & 0x20) + if (npc->bits & NPC_SHOOTABLE) { if (npc->shock) { @@ -740,7 +740,7 @@ void ActNpc342(NPCHAR *npc) npc->ym = 0; npc->ani_no = 2; npc->damage = 5; - npc->bits &= ~0x28; + npc->bits &= ~(NPC_IGNORE_SOLIDITY | NPC_SHOOTABLE); SetDestroyNpChar(npc->x, npc->y, 0x2000, 0x20); PlaySoundObject(71, 1); // Fallthrough @@ -775,7 +775,7 @@ void ActNpc342(NPCHAR *npc) npc->xm = 0; npc->ym = 0; npc->ani_no = 2; - npc->bits &= ~0x28; + npc->bits &= ~(NPC_IGNORE_SOLIDITY | NPC_SHOOTABLE); npc->damage = 0; npc->count1 /= 4; npc->exp = 0; @@ -922,7 +922,7 @@ void ActNpc345(NPCHAR *npc) npc->ym = 0x700; if (npc->y > 0x10000) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; if (npc->act_wait++ / 2 % 2) SetNpChar(4, npc->x, npc->y, 0, 0, 0, 0, 0x100); @@ -931,7 +931,7 @@ void ActNpc345(NPCHAR *npc) { npc->ym = -0x200; npc->act_no = 110; - npc->bits |= 8; + npc->bits |= NPC_IGNORE_SOLIDITY; PlaySoundObject(12, 1); SetQuake(10); @@ -1055,7 +1055,7 @@ void ActNpc346(NPCHAR *npc) npc->act_no = 1001; npc->xm = 0; npc->ym = 0; - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; // Fallthrough case 1001: npc->ym += 0x40; @@ -1069,9 +1069,9 @@ void ActNpc346(NPCHAR *npc) if (npc->act_no < 1000) { if (gMC.y > npc->y - 0x1000 && gMC.ym < 0) - npc->bits &= ~0x40; + npc->bits &= ~NPC_SOLID_HARD; else - npc->bits |= 0x40; + npc->bits |= NPC_SOLID_HARD; deg = npc->count1 / 4; npc->tgt_x = npc->pNpc->x + npc->count2 * GetCos(deg) / 4; @@ -1461,7 +1461,7 @@ void ActNpc351(NPCHAR *npc) else { npc->act_no = 11; - npc->bits |= 0x20; + npc->bits |= NPC_SHOOTABLE; } // Fallthrough case 11: @@ -1632,7 +1632,7 @@ void ActNpc353(NPCHAR *npc) ++npc->act_wait; if (npc->act_wait == 8) - npc->bits &= ~8; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->x += npc->xm; npc->y += npc->ym; @@ -1654,8 +1654,8 @@ void ActNpc353(NPCHAR *npc) case 10: npc->act_no = 11; npc->ani_no = 0; - npc->bits |= 0x20; - npc->bits &= ~8; + npc->bits |= NPC_SHOOTABLE; + npc->bits &= ~NPC_IGNORE_SOLIDITY; npc->damage = 5; npc->view.top = 0x1000; // Fallthrough diff --git a/src/NpcHit.cpp b/src/NpcHit.cpp index 052815d5..70b64399 100644 --- a/src/NpcHit.cpp +++ b/src/NpcHit.cpp @@ -299,7 +299,7 @@ void HitNpCharMap() if ((gNPC[i].cond & 0x80) == 0) continue; - if (gNPC[i].bits & 8) + if (gNPC[i].bits & NPC_IGNORE_SOLIDITY) continue; if (gNPC[i].size >= 3) @@ -323,7 +323,7 @@ void HitNpCharMap() { // No NPC block case 0x44: - if (gNPC[i].bits & npc_ignore44) + if (gNPC[i].bits & NPC_IGNORE_TILE_44) break; // Fallthrough // Block @@ -518,9 +518,9 @@ void LoseNpChar(NPCHAR *npc, BOOL bVanish) SetNPCFlag(npc->code_flag); // Create value view - if (npc->bits & npc_showDamage) + if (npc->bits & NPC_SHOW_DAMAGE) { - if ((npc->bits & npc_showDamage) && npc->damage_view) + if ((npc->bits & NPC_SHOW_DAMAGE) && npc->damage_view) SetValueView(&npc->x, &npc->y, npc->damage_view); if (bVanish) VanishNpChar(npc); @@ -542,7 +542,7 @@ void HitNpCharBullet() if ((gNPC[n].cond & 0x80) == 0) continue; - if (gNPC[n].bits & npc_shootable && gNPC[n].bits & npc_interact) + if (gNPC[n].bits & NPC_SHOOTABLE && gNPC[n].bits & NPC_INTERACTABLE) continue; for (b = 0; b < BULLET_MAX; b++) @@ -555,13 +555,13 @@ void HitNpCharBullet() // Check if bullet touches npc 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 && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].enemyYL && gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].enemyYL) bHit = TRUE; - else if (gNPC[n].bits & npc_invulnerable + else if (gNPC[n].bits & NPC_INVULNERABLE && gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].blockXL && gNPC[n].x + gNPC[n].hit.back > gBul[b].x - gBul[b].blockXL && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].blockYL @@ -571,7 +571,7 @@ void HitNpCharBullet() if (bHit) { // Damage NPC - if (gNPC[n].bits & npc_shootable) + if (gNPC[n].bits & NPC_SHOOTABLE) { gNPC[n].life -= gBul[b].damage; @@ -579,10 +579,10 @@ void HitNpCharBullet() { gNPC[n].life = 0; - if (gNPC[n].bits & npc_showDamage) + if (gNPC[n].bits & NPC_SHOW_DAMAGE) gNPC[n].damage_view -= gBul[b].damage; - if ((gMC.cond & 0x80) && gNPC[n].bits & npc_eventDie) + if ((gMC.cond & 0x80) && gNPC[n].bits & NPC_EVENT_WHEN_KILLED) StartTextScript(gNPC[n].code_event); else gNPC[n].cond |= 8; @@ -598,7 +598,7 @@ void HitNpCharBullet() gNPC[n].shock = 16; } - if (gNPC[n].bits & npc_showDamage) + if (gNPC[n].bits & NPC_SHOW_DAMAGE) gNPC[n].damage_view -= gBul[b].damage; } }