diff --git a/.gitignore b/.gitignore index 3b38dc7c..b70eefb6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /obj Config.dat Profile.dat +build.7z +build.zip # Compiled Object files *.slo diff --git a/src/NpcAct.h b/src/NpcAct.h index 3065ae60..1bb7e4ac 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -5,3 +5,4 @@ void ActNpc002(NPCHAR *npc); void ActNpc003(NPCHAR *npc); void ActNpc004(NPCHAR *npc); void ActNpc005(NPCHAR *npc); +void ActNpc006(NPCHAR *npc); diff --git a/src/NpcAct000.cpp b/src/NpcAct000.cpp index 0aabd340..7687b4fe 100644 --- a/src/NpcAct000.cpp +++ b/src/NpcAct000.cpp @@ -483,4 +483,130 @@ void ActNpc005(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; else npc->rect = rcLeft[npc->ani_no]; -} \ No newline at end of file +} + +//Beetle (Goes left and right, Egg Corridor) +void ActNpc006(NPCHAR *npc) +{ + RECT rcLeft[5]; + RECT rcRight[5]; + + rcLeft[0] = {0, 80, 16, 96}; + rcLeft[1] = {16, 80, 32, 96}; + rcLeft[2] = {32, 80, 48, 96}; + rcLeft[3] = {48, 80, 64, 96}; + rcLeft[4] = {64, 80, 80, 96}; + + rcRight[0] = {0, 96, 16, 112}; + rcRight[1] = {16, 96, 32, 112}; + rcRight[2] = {32, 96, 48, 112}; + rcRight[3] = {48, 96, 64, 112}; + rcRight[4] = {64, 96, 80, 112}; + + switch (npc->act_no) + { + case 0: //Init + npc->act_no = 1; + + if (npc->direct) + npc->act_no = 3; + else + npc->act_no = 1; + break; + + case 1: + //Accelerate to the left + npc->xm -= 0x10; + if (npc->xm < -0x400) + npc->xm = -0x400; + + //Move + if (npc->shock) + npc->x += npc->xm / 2; + else + npc->x += npc->xm; + + //Animate + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if ( npc->ani_no > 2 ) + npc->ani_no = 1; + + //Stop when hitting a wall + if (npc->flag & 1) + { + npc->act_no = 2; + npc->act_wait = 0; + npc->ani_no = 0; + npc->xm = 0; + npc->direct = 2; + } + break; + + case 2: + //Wait 60 frames then move to the right + if (++npc->act_wait > 60) + { + npc->act_no = 3; + npc->ani_wait = 0; + npc->ani_no = 1; + } + break; + + case 3: + //Accelerate to the right + npc->xm += 0x10; + if (npc->xm > 0x400) + npc->xm = 0x400; + + //Move + if (npc->shock) + npc->x += npc->xm / 2; + else + npc->x += npc->xm; + + //Animate + if (++npc->ani_wait > 1) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + + if ( npc->ani_no > 2 ) + npc->ani_no = 1; + + //Stop when hitting a wall + if (npc->flag & 4) + { + npc->act_no = 4; + npc->act_wait = 0; + npc->ani_no = 0; + npc->xm = 0; + npc->direct = 0; + } + break; + + case 4: + //Wait 60 frames then move to the left + if (++npc->act_wait > 60) + { + npc->act_no = 1; + npc->ani_wait = 0; + npc->ani_no = 1; + } + break; + + default: + break; + } + + //Set framerect + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; +} diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 6071cd21..ce5ab964 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -62,7 +62,7 @@ NPCFUNCTION gpNpcFuncTbl[] = &ActNpc003, &ActNpc004, &ActNpc005, - nullptr, + &ActNpc006, nullptr, nullptr, nullptr,