added core npc stuff

This commit is contained in:
cuckydev 2019-02-06 22:26:42 -05:00
parent fb372d15a4
commit 9e62a6d814
7 changed files with 317 additions and 12 deletions

View file

@ -138,7 +138,7 @@ void PutFront(int fx, int fy)
if (gBack.type == 3)
{
int x_1 = fx / 0x4000;
int x_2 = fx / 0x4000 + 11;
int x_2 = fx / 0x4000 + (((WINDOW_WIDTH + 31) >> 5) + 1);
int y_1 = 0;
int y_2 = 32;
@ -149,7 +149,7 @@ void PutFront(int fx, int fy)
if (ypos >= -32)
{
if (ypos > WINDOW_HEIGHT)
return;
break;
for (int x = x_1; x < x_2; x++)
{

View file

@ -295,7 +295,11 @@ bool ReloadBitmap_Resource(const char *res, int surf_no)
SDL_Rect RectToSDLRect(RECT *rect)
{
SDL_Rect SDLRect = { rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top};
SDL_Rect SDLRect = {rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top};
if (SDLRect.w < 0)
SDLRect.w = 0;
if (SDLRect.h < 0)
SDLRect.h = 0;
return SDLRect;
}

View file

@ -154,7 +154,7 @@ void ActNpc148(NPCHAR *npc);
void ActNpc149(NPCHAR *npc);
void ActNpc150(NPCHAR *npc);
void ActNpc151(NPCHAR *npc);
void ActNpc152(NPCHAR *npc);
void ActNpc153(NPCHAR *npc);
void ActNpc154(NPCHAR *npc);
void ActNpc155(NPCHAR *npc);
@ -185,13 +185,18 @@ void ActNpc180(NPCHAR *npc);
void ActNpc181(NPCHAR *npc);
void ActNpc182(NPCHAR *npc);
void ActNpc183(NPCHAR *npc);
void ActNpc184(NPCHAR *npc);
void ActNpc185(NPCHAR *npc);
void ActNpc186(NPCHAR *npc);
void ActNpc187(NPCHAR *npc);
void ActNpc188(NPCHAR *npc);
void ActNpc190(NPCHAR *npc);
void ActNpc191(NPCHAR *npc);
void ActNpc192(NPCHAR *npc);
void ActNpc193(NPCHAR *npc);
void ActNpc194(NPCHAR *npc);
void ActNpc195(NPCHAR *npc);
void ActNpc199(NPCHAR *npc);

View file

@ -1287,6 +1287,18 @@ void ActNpc151(NPCHAR *npc)
npc->rect = rcRight[npc->ani_no];
}
//Shutter stuck
void ActNpc152(NPCHAR *npc)
{
if (!npc->act_no)
{
if (npc->direct == 2)
npc->y += 0x2000;
npc->act_no = 1;
}
npc->rect = {0, 0, 0, 0};
}
static const RECT grcKitL[21] = {
{0, 0, 24, 24},
{24, 0, 48, 24},

View file

@ -9,6 +9,7 @@
#include "Back.h"
#include "Triangle.h"
#include "Caret.h"
#include "Frame.h"
#include "Bullet.h"
#include "Flags.h"
@ -541,6 +542,168 @@ void ActNpc183(NPCHAR *npc)
}
}
//Shutter Big
void ActNpc184(NPCHAR *npc)
{
RECT rc[4];
rc[0] = {0, 64, 32, 96};
rc[1] = {32, 64, 64, 96};
rc[2] = {64, 64, 96, 96};
rc[3] = {32, 64, 64, 96};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->x += 0x1000;
npc->y += 0x1000;
break;
case 10:
npc->act_no = 11;
npc->ani_no = 1;
npc->act_wait = 0;
npc->bits |= npc_ignoreSolid;
case 11:
switch (npc->direct)
{
case 0:
npc->x -= 0x80;
break;
case 1:
npc->y -= 0x80;
break;
case 2:
npc->x += 0x80;
break;
case 3:
npc->y += 0x80;
break;
}
if (!(++npc->act_wait & 7))
PlaySoundObject(26, 1);
SetQuake(20);
break;
case 20:
for (int i = 0; i < 4; i++)
SetNpChar(4, npc->x + (Random(-12, 12) << 9), npc->y + 0x2000, Random(-0x155, 0x155), Random(-0x600, 0), 0, 0, 0x100);
npc->act_no = 1;
break;
default:
break;
}
if (++npc->ani_wait > 10)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 3)
npc->ani_no = 0;
npc->rect = rc[npc->ani_no];
}
//Shutter Small
void ActNpc185(NPCHAR *npc)
{
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
npc->y += 0x1000;
break;
case 10:
npc->act_no = 11;
npc->ani_no = 1;
npc->act_wait = 0;
npc->bits |= npc_ignoreSolid;
//Fallthrough
case 11:
switch (npc->direct)
{
case 0:
npc->x -= 0x80;
break;
case 1:
npc->y -= 0x80;
break;
case 2:
npc->x += 0x80;
break;
case 3:
npc->y += 0x80;
break;
}
++npc->act_wait;
break;
case 0x14:
npc->y -= 0x3000;
npc->act_no = 1;
break;
default:
break;
}
npc->rect.left = 96;
npc->rect.top = 64;
npc->rect.right = 112;
npc->rect.bottom = 96;
}
//Lift block
void ActNpc186(NPCHAR *npc)
{
RECT rc[4];
rc[0] = {48, 48, 64, 64};
rc[1] = {64, 48, 80, 64};
rc[2] = {80, 48, 96, 64};
rc[3] = {64, 48, 80, 64};
switch (npc->act_no)
{
case 0:
npc->act_no = 1;
//Fallthrough
case 1:
break;
case 10:
npc->act_no = 11;
npc->ani_no = 1;
npc->act_wait = 0;
npc->bits |= 8;
//Fallthrough
case 11:
switch (npc->direct)
{
case 0:
npc->x -= 0x80;
break;
case 1:
npc->y -= 0x80;
break;
case 2:
npc->x += 0x80;
break;
case 3:
npc->y += 0x80;
break;
}
++npc->act_wait;
break;
}
if (++npc->ani_wait > 10)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 3)
npc->ani_no = 0;
npc->rect = rc[npc->ani_no];
}
//Fuzz Core
void ActNpc187(NPCHAR *npc)
{
@ -695,6 +858,117 @@ void ActNpc188(NPCHAR *npc)
npc->rect = rect_right[npc->ani_no];
}
//Broken robot
void ActNpc190(NPCHAR *npc)
{
RECT rect[2];
rect[0] = {192, 32, 208, 48};
rect[1] = {208, 32, 224, 48};
switch (npc->act_no)
{
case 0:
npc->ani_no = 0;
break;
case 10:
PlaySoundObject(72, 1);
for (int i = 0; i < 8; i++)
SetNpChar(4, npc->x, npc->y + (Random(-8, 8) << 9), Random(-8, -2) << 9, Random(-3, 3) << 9, 0, 0, 0x100);
npc->cond = 0;
break;
case 20:
if (++npc->ani_wait > 10)
{
npc->ani_wait = 0;
++npc->ani_no;
}
if (npc->ani_no > 1)
npc->ani_no = 0;
break;
}
npc->rect = rect[npc->ani_no];
}
//Water level
void ActNpc191(NPCHAR *npc)
{
int v1; // edx
int v2; // edx
int v3; // edx
int v4; // edx
switch ( npc->act_no )
{
case 0:
npc->act_no = 10;
npc->tgt_y = npc->y;
npc->ym = 512;
//Fallthrough
case 10:
if (npc->y >= npc->tgt_y)
npc->ym -= 4;
else
npc->ym += 4;
if (npc->ym < -0x100)
npc->ym = -0x100;
if (npc->ym > 0x100)
npc->ym = 0x100;
npc->y += npc->ym;
break;
case 20:
npc->act_no = 21;
npc->act_wait = 0;
//Fallthrough
case 21:
if (npc->y >= npc->tgt_y)
npc->ym -= 4;
else
npc->ym += 4;
if (npc->ym < -0x200)
npc->ym = -0x200;
if (npc->ym > 0x200)
npc->ym = 0x200;
npc->y += npc->ym;
if (++npc->act_wait > 1000)
npc->act_no = 22;
break;
case 22:
if (npc->y >= 0)
npc->ym -= 4;
else
npc->ym += 4;
if (npc->ym < -0x200)
npc->ym = -0x200;
if (npc->ym > 0x200)
npc->ym = 0x200;
npc->y += npc->ym;
if (npc->y < 0x8000 || gSuperYpos)
{
npc->act_no = 21;
npc->act_wait = 0;
}
break;
case 30:
if (npc->y >= 0)
npc->ym -= 4;
else
npc->ym += 4;
if (npc->ym < -0x200)
npc->ym = -0x200;
if (npc->ym > 0x100)
npc->ym = 0x100;
npc->y += npc->ym;
break;
default:
break;
}
gWaterY = npc->y;
npc->rect.right = 0;
npc->rect.bottom = 0;
}
//Scooter
void ActNpc192(NPCHAR *npc)
{
@ -830,6 +1104,12 @@ void ActNpc194(NPCHAR *npc)
npc->rect = rc[0];
}
//Grate
void ActNpc195(NPCHAR *npc)
{
npc->rect = {112, 64, 128, 80};
}
//Water/wind particles
void ActNpc199(NPCHAR *npc)
{

View file

@ -4,6 +4,7 @@
#include "Flags.h"
#include "Caret.h"
#include "Game.h"
#include "Back.h"
#include "Bullet.h"
#include "MyChar.h"
#include "TextScr.h"
@ -404,6 +405,9 @@ void HitNpCharMap()
break;
}
}
if (gNPC[i].y > gWaterY + 0x800)
gNPC[i].flag |= 0x100;
}
}
}

View file

@ -208,7 +208,7 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc149,
ActNpc150,
ActNpc151,
nullptr,
ActNpc152,
ActNpc153,
ActNpc154,
ActNpc155,
@ -240,18 +240,18 @@ NPCFUNCTION gpNpcFuncTbl[361] =
ActNpc181,
ActNpc182,
ActNpc183,
nullptr,
nullptr,
nullptr,
ActNpc184,
ActNpc185,
ActNpc186,
ActNpc187,
ActNpc188,
nullptr,
nullptr,
nullptr,
ActNpc190,
ActNpc191,
ActNpc192,
ActNpc193,
ActNpc194,
nullptr,
ActNpc195,
nullptr,
nullptr,
nullptr,