mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- guts and moves
This commit is contained in:
parent
754c8bd9c1
commit
89e555761d
7 changed files with 394 additions and 248 deletions
|
@ -899,7 +899,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange
|
|||
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
|
||||
int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
|
||||
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
|
||||
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags);
|
||||
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags = 0);
|
||||
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
|
||||
int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
|
||||
int32_t vx, int32_t vy, int32_t vz,
|
||||
|
@ -951,6 +951,16 @@ static FORCE_INLINE int32_t logapproach(int32_t const val, int32_t const targetv
|
|||
}
|
||||
|
||||
void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * const p2) ATTRIBUTE((nonnull(4)));
|
||||
inline void rotatepoint(int px, int py, int ptx, int pty, int daang, int* resx, int* resy)
|
||||
{
|
||||
vec2_t pivot = { px, py };
|
||||
vec2_t point = { ptx, pty };
|
||||
vec2_t result;
|
||||
rotatepoint(pivot, point, daang, &result);
|
||||
*resx = result.x;
|
||||
*resy = result.y;
|
||||
}
|
||||
|
||||
int32_t lastwall(int16_t point);
|
||||
int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction);
|
||||
|
||||
|
|
|
@ -335,6 +335,50 @@ void checkavailweapon(struct player_struct* p)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool ifsquished(int i, int p)
|
||||
{
|
||||
if (g_gameType & GAMEFLAG_RRALL) return false; // this function is a no-op in RR's source.
|
||||
|
||||
bool squishme = false;
|
||||
if (sprite[i].picnum == TILE_APLAYER && ud.clipping)
|
||||
return false;
|
||||
|
||||
auto& sc = sector[sprite[i].sectnum];
|
||||
int floorceildist = sc.floorz - sc.ceilingz;
|
||||
|
||||
if (sc.lotag != ST_23_SWINGING_DOOR)
|
||||
{
|
||||
if (sprite[i].pal == 1)
|
||||
squishme = floorceildist < (32 << 8) && (sc.lotag & 32768) == 0;
|
||||
else
|
||||
squishme = floorceildist < (12 << 8);
|
||||
}
|
||||
|
||||
if (squishme)
|
||||
{
|
||||
FTA(QUOTE_SQUISHED, &ps[p]);
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
sprite[i].xvel = 0;
|
||||
|
||||
if (sprite[i].pal == 1)
|
||||
{
|
||||
hittype[i].picnum = SHOTSPARK1;
|
||||
hittype[i].extra = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void clearcamera(player_struct* ps)
|
||||
{
|
||||
ps->newowner = -1;
|
||||
|
@ -630,7 +674,7 @@ SKIPWALLCHECK:
|
|||
int movesprite(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype)
|
||||
{
|
||||
int daz, h, oldx, oldy;
|
||||
short retval, dasectnum, a, cd;
|
||||
short retval, dasectnum, cd;
|
||||
char bg;
|
||||
|
||||
bg = badguy(&sprite[spritenum]);
|
||||
|
@ -766,7 +810,7 @@ void insertspriteq(int i)
|
|||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// consolidation of several nearly identical functions
|
||||
// lotsofmoney -> MONEY
|
||||
// lotsofmoney -> MONEY / RR_FEATHERS
|
||||
// lotsofmail -> MAIL
|
||||
// lotsofpaper -> PAPER
|
||||
//
|
||||
|
@ -777,7 +821,9 @@ void lotsofstuff(spritetype* s, short n, int spawntype)
|
|||
short i, j;
|
||||
for (i = n; i > 0; i--)
|
||||
{
|
||||
j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (47 << 8)), spawntype, -32, 8, 8, krand() & 2047, 0, 0, 0, 5);
|
||||
short r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR.
|
||||
// TRANSITIONAL RedNukem sets the spawner as owner.
|
||||
j = EGS(s->sectnum, s->x, s->y, s->z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, 0, 5);
|
||||
sprite[j].cstat = krand() & 12;
|
||||
}
|
||||
}
|
||||
|
@ -788,42 +834,276 @@ void lotsofstuff(spritetype* s, short n, int spawntype)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool ifsquished(int i, int p)
|
||||
void guts(spritetype* s, short gtype, short n, short p)
|
||||
{
|
||||
if (g_gameType & GAMEFLAG_RRALL) return false; // this function is a no-op in RR's source.
|
||||
int gutz, floorz;
|
||||
int i=0, j;
|
||||
int sx, sy;
|
||||
uint8_t pal;
|
||||
|
||||
bool squishme = false;
|
||||
if (sprite[i].picnum == TILE_APLAYER && ud.clipping)
|
||||
return false;
|
||||
if (badguy(s) && s->xrepeat < 16)
|
||||
sx = sy = 8;
|
||||
else sx = sy = 32;
|
||||
|
||||
auto &sc = sector[sprite[i].sectnum];
|
||||
int floorceildist = sc.floorz - sc.ceilingz;
|
||||
gutz = s->z - (8 << 8);
|
||||
floorz = getflorzofslope(s->sectnum, s->x, s->y);
|
||||
|
||||
if (sc.lotag != ST_23_SWINGING_DOOR)
|
||||
if (gutz > (floorz - (8 << 8)))
|
||||
gutz = floorz - (8 << 8);
|
||||
|
||||
if (!(g_gameType & GAMEFLAG_RRALL) && s->picnum == COMMANDER)
|
||||
gutz -= (24 << 8);
|
||||
|
||||
if (badguy(s) && s->pal == 6)
|
||||
pal = 6;
|
||||
else
|
||||
{
|
||||
if (sprite[i].pal == 1)
|
||||
squishme = floorceildist < (32 << 8) && (sc.lotag & 32768) == 0;
|
||||
else
|
||||
squishme = floorceildist < (12 << 8);
|
||||
}
|
||||
|
||||
if (squishme)
|
||||
{
|
||||
FTA(QUOTE_SQUISHED, &ps[p]);
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
sprite[i].xvel = 0;
|
||||
|
||||
if (sprite[i].pal == 1)
|
||||
pal = 0;
|
||||
if (g_gameType & GAMEFLAG_RRRA)
|
||||
{
|
||||
hittype[i].picnum = SHOTSPARK1;
|
||||
hittype[i].extra = 1;
|
||||
return false;
|
||||
if (s->picnum == RR_MINION && (s->pal == 8 || s->pal == 19)) pal = s->pal;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (g_gameType & GAMEFLAG_RRALL)
|
||||
{
|
||||
sx >>= 1;
|
||||
sy >>= 1;
|
||||
}
|
||||
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
// RANDCORRECT version from RR.
|
||||
int a = krand() & 2047;
|
||||
int r1 = krand();
|
||||
int r2 = krand();
|
||||
int r3 = krand();
|
||||
int r4 = krand();
|
||||
int r5 = krand();
|
||||
// TRANSITIONAL: owned by a player???
|
||||
i = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].i, 5);
|
||||
if (!(g_gameType & GAMEFLAG_RRALL) && sprite[i].picnum == JIBS2)
|
||||
{
|
||||
sprite[i].xrepeat >>= 2;
|
||||
sprite[i].yrepeat >>= 2;
|
||||
}
|
||||
if (pal != 0)
|
||||
sprite[i].pal = pal;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void gutsdir(spritetype* s, short gtype, short n, short p)
|
||||
{
|
||||
int gutz, floorz;
|
||||
short i, j;
|
||||
char sx, sy;
|
||||
|
||||
if (badguy(s) && s->xrepeat < 16)
|
||||
sx = sy = 8;
|
||||
else sx = sy = 32;
|
||||
|
||||
gutz = s->z - (8 << 8);
|
||||
floorz = getflorzofslope(s->sectnum, s->x, s->y);
|
||||
|
||||
if (gutz > (floorz - (8 << 8)))
|
||||
gutz = floorz - (8 << 8);
|
||||
|
||||
if (!(g_gameType & GAMEFLAG_RRALL) && s->picnum == COMMANDER)
|
||||
gutz -= (24 << 8);
|
||||
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
int a = krand() & 2047;
|
||||
int r1 = krand();
|
||||
int r2 = krand();
|
||||
// TRANSITIONAL: owned by a player???
|
||||
i = EGS(s->sectnum, s->x, s->y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].i, 5);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// movesector - why is this in actors.cpp?
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ms(short i)
|
||||
{
|
||||
//T1,T2 and T3 are used for all the sector moving stuff!!!
|
||||
|
||||
short startwall, endwall, x;
|
||||
int tx, ty;
|
||||
spritetype* s;
|
||||
|
||||
s = &sprite[i];
|
||||
|
||||
s->x += (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14;
|
||||
s->y += (s->xvel * (sintable[s->ang & 2047])) >> 14;
|
||||
|
||||
int j = hittype[i].temp_data[1];
|
||||
int k = hittype[i].temp_data[2];
|
||||
|
||||
startwall = sector[s->sectnum].wallptr;
|
||||
endwall = startwall + sector[s->sectnum].wallnum;
|
||||
for (x = startwall; x < endwall; x++)
|
||||
{
|
||||
rotatepoint(
|
||||
0, 0,
|
||||
msx[j], msy[j],
|
||||
k & 2047, &tx, &ty);
|
||||
|
||||
dragpoint(x, s->x + tx, s->y + ty);
|
||||
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void movefta(void)
|
||||
{
|
||||
int x, px, py, sx, sy;
|
||||
short i, j, p, psect, ssect, nexti;
|
||||
spritetype* s;
|
||||
|
||||
i = headspritestat[STAT_ZOMBIEACTOR];
|
||||
while (i >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
|
||||
s = &sprite[i];
|
||||
p = findplayer(s, &x);
|
||||
|
||||
ssect = psect = s->sectnum;
|
||||
|
||||
if (sprite[ps[p].i].extra > 0)
|
||||
{
|
||||
if (x < 30000)
|
||||
{
|
||||
hittype[i].timetosleep++;
|
||||
if (hittype[i].timetosleep >= (x >> 8))
|
||||
{
|
||||
if (badguy(s))
|
||||
{
|
||||
px = ps[p].oposx + 64 - (krand() & 127);
|
||||
py = ps[p].oposy + 64 - (krand() & 127);
|
||||
updatesector(px, py, &psect);
|
||||
if (psect == -1)
|
||||
{
|
||||
i = nexti;
|
||||
continue;
|
||||
}
|
||||
sx = s->x + 64 - (krand() & 127);
|
||||
sy = s->y + 64 - (krand() & 127);
|
||||
updatesector(px, py, &ssect);
|
||||
if (ssect == -1)
|
||||
{
|
||||
i = nexti;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(g_gameType & GAMEFLAG_RRALL) || s->pal == 33 || s->type == RR_VIXEN ||
|
||||
((g_gameType & GAMEFLAG_RRRA) && isIn(s->type, RR_COOT, RR_COOTSTAYPUT, RR_BIKERSTAND, RR_BIKERRIDE,
|
||||
RR_BIKERRIDEDAISY, RR_MINIONAIRBOAT, RR_HULKAIRBOAT,
|
||||
RR_DAISYAIRBOAT, RR_JACKOLOPE, RR_BANJOCOOTER,
|
||||
RR_GUITARBILLY, RR_MAMAJACKOLOPE, RR_BIKERBV,
|
||||
RR_MAKEOUT, RR_CHEER, RR_CHEERSTAYPUT)) ||
|
||||
(sintable[(s->ang + 512) & 2047] * (px - sx) + sintable[s->ang & 2047] * (py - sy) >= 0))
|
||||
{
|
||||
int r1 = krand();
|
||||
int r2 = krand();
|
||||
j = cansee(sx, sy, s->z - (r2 % (52 << 8)), s->sectnum, px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursectnum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int r1 = krand();
|
||||
int r2 = krand();
|
||||
j = cansee(s->x, s->y, s->z - ((r2 & 31) << 8), s->sectnum, ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursectnum);
|
||||
}
|
||||
|
||||
if (j)
|
||||
{
|
||||
bool res = (!(g_gameType & GAMEFLAG_RRALL)) ?
|
||||
isIn(s->picnum,
|
||||
RUBBERCAN,
|
||||
EXPLODINGBARREL,
|
||||
WOODENHORSE,
|
||||
HORSEONSIDE,
|
||||
CANWITHSOMETHING,
|
||||
CANWITHSOMETHING2,
|
||||
CANWITHSOMETHING3,
|
||||
CANWITHSOMETHING4,
|
||||
FIREBARREL,
|
||||
FIREVASE,
|
||||
NUKEBARREL,
|
||||
NUKEBARRELDENTED,
|
||||
NUKEBARRELLEAKED,
|
||||
TRIPBOMB) :
|
||||
isIn(s->picnum,
|
||||
RR_1251,
|
||||
RR_1268,
|
||||
RR_1187,
|
||||
RR_1304,
|
||||
RR_1305,
|
||||
RR_1306,
|
||||
RR_1309,
|
||||
RR_1315,
|
||||
RR_1317,
|
||||
RR_1388);
|
||||
|
||||
|
||||
if (res)
|
||||
{
|
||||
if (sector[s->sectnum].ceilingstat & 1)
|
||||
s->shade = sector[s->sectnum].ceilingshade;
|
||||
else s->shade = sector[s->sectnum].floorshade;
|
||||
|
||||
hittype[i].timetosleep = 0;
|
||||
changespritestat(i, STAT_STANDABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
// TRANSITIONAL: RedNukem has this here. Needed?
|
||||
if (A_CheckSpriteFlags(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384) break;
|
||||
#endif
|
||||
hittype[i].timetosleep = 0;
|
||||
check_fta_sounds(i);
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
}
|
||||
}
|
||||
else hittype[i].timetosleep = 0;
|
||||
}
|
||||
}
|
||||
if ((!(g_gameType & GAMEFLAG_RRALL) || !j) && badguy(s))
|
||||
{
|
||||
if (sector[s->sectnum].ceilingstat & 1)
|
||||
s->shade = sector[s->sectnum].ceilingshade;
|
||||
else s->shade = sector[s->sectnum].floorshade;
|
||||
|
||||
if (s->picnum != RR_HEN || s->picnum != RR_COW || s->picnum != RR_PIG || s->picnum != RR_DOGRUN || ((g_gameType & GAMEFLAG_RRRA) && s->picnum != RR_JACKOLOPE))
|
||||
if (wakeup(i, p))
|
||||
{
|
||||
hittype[i].timetosleep = 0;
|
||||
check_fta_sounds(i);
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
i = nexti;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -269,6 +269,10 @@ void A_MoveCyclers(void);
|
|||
void A_MoveDummyPlayers(void);
|
||||
void A_MoveSector(int spriteNum);
|
||||
void A_PlayAlertSound(int spriteNum);
|
||||
inline void check_fta_sounds(int s)
|
||||
{
|
||||
A_PlayAlertSound(s);
|
||||
}
|
||||
void A_RadiusDamage(int spriteNum, int blastRadius, int dmg1, int dmg2, int dmg3, int dmg4);
|
||||
void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt);
|
||||
void A_ResetLanePics(void);
|
||||
|
@ -283,9 +287,12 @@ void G_RefreshLights(void);
|
|||
void G_StopInterpolation(const int32_t *posptr);
|
||||
|
||||
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
|
||||
// Note: The entire interpolation system needs to be a lot smarter than what's backing these functions.
|
||||
void Sect_ToggleInterpolation(int sectnum, int setInterpolation);
|
||||
static FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
||||
static FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
||||
static FORCE_INLINE void clearsectinterpolate(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
||||
static FORCE_INLINE void setsectinterpolate(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
||||
|
||||
#if KRANDDEBUG
|
||||
# define ACTOR_INLINE __fastcall
|
||||
|
@ -345,6 +352,12 @@ inline int badguy(void const* const pSprite)
|
|||
return A_CheckEnemySprite(pSprite);
|
||||
}
|
||||
|
||||
int G_WakeUp(spritetype* const pSprite, int const playerNum);
|
||||
inline int wakeup(int sn, int pn)
|
||||
{
|
||||
return G_WakeUp(&sprite[sn], pn);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -208,74 +208,17 @@ void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt)
|
|||
}
|
||||
}
|
||||
|
||||
void guts(spritetype* s, short gtype, short n, short p);
|
||||
void gutsdir(spritetype* s, short gtype, short n, short p);
|
||||
|
||||
void A_DoGuts(int spriteNum, int tileNum, int spawnCnt)
|
||||
{
|
||||
uspritetype const *const pSprite = (uspritetype *)&sprite[spriteNum];
|
||||
vec2_t repeat = { 32, 32 };
|
||||
|
||||
if (A_CheckEnemySprite(pSprite) && pSprite->xrepeat < 16)
|
||||
repeat.x = repeat.y = 8;
|
||||
|
||||
int gutZ = pSprite->z - ZOFFSET3;
|
||||
int floorz = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
|
||||
|
||||
if (gutZ > (floorz-ZOFFSET3))
|
||||
gutZ = floorz-ZOFFSET3;
|
||||
|
||||
if (!RR && pSprite->picnum == TILE_COMMANDER)
|
||||
gutZ -= (24<<8);
|
||||
|
||||
uint8_t pal = 0;
|
||||
|
||||
if (A_CheckEnemySprite(pSprite) && pSprite->pal == 6)
|
||||
pal = 6;
|
||||
else if (RRRA && pSprite->picnum == TILE_MINION && (pSprite->pal == 8 || pSprite->pal == 19))
|
||||
pal = pSprite->pal;
|
||||
|
||||
if (RR) repeat.x >>= 1, repeat.y >>= 1;
|
||||
|
||||
for (bssize_t j=spawnCnt; j>0; j--)
|
||||
{
|
||||
int32_t const ang = krand2() & 2047;
|
||||
int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2();
|
||||
int const i = A_InsertSprite(pSprite->sectnum, pSprite->x + (r5 & 255) - 128,
|
||||
pSprite->y + (r4 & 255) - 128, gutZ - (r3 & 8191), tileNum, -32, repeat.x,
|
||||
repeat.y, ang, 48 + (r2 & 31), -512 - (r1 & 2047), spriteNum, 5);
|
||||
|
||||
if (!RR && PN(i) == TILE_JIBS2)
|
||||
{
|
||||
sprite[i].xrepeat >>= 2;
|
||||
sprite[i].yrepeat >>= 2;
|
||||
}
|
||||
|
||||
sprite[i].pal = pal;
|
||||
}
|
||||
guts(&sprite[spriteNum], tileNum, spawnCnt, 0);
|
||||
}
|
||||
|
||||
void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt)
|
||||
{
|
||||
uspritetype const * const s = (uspritetype *)&sprite[spriteNum];
|
||||
vec2_t repeat = { 32, 32 };
|
||||
|
||||
if (A_CheckEnemySprite(s) && s->xrepeat < 16)
|
||||
repeat.x = repeat.y = 8;
|
||||
|
||||
int gutZ = s->z-ZOFFSET3;
|
||||
int floorZ = getflorzofslope(s->sectnum,s->x,s->y);
|
||||
|
||||
if (gutZ > (floorZ-ZOFFSET3))
|
||||
gutZ = floorZ-ZOFFSET3;
|
||||
|
||||
if (!RR && s->picnum == TILE_COMMANDER)
|
||||
gutZ -= (24<<8);
|
||||
|
||||
for (bssize_t j=spawnCnt; j>0; j--)
|
||||
{
|
||||
int32_t const ang = krand2() & 2047;
|
||||
int32_t const r1 = krand2(), r2 = krand2();
|
||||
A_InsertSprite(s->sectnum, s->x, s->y, gutZ, tileNum, -32, repeat.x, repeat.y, ang,
|
||||
256 + (r2 & 127), -512 - (r1 & 2047), spriteNum, 5);
|
||||
}
|
||||
gutsdir(&sprite[spriteNum], tileNum, spawnCnt, 0);
|
||||
}
|
||||
|
||||
static int32_t G_ToggleWallInterpolation(int32_t wallNum, int32_t setInterpolation)
|
||||
|
@ -308,28 +251,11 @@ void Sect_ToggleInterpolation(int sectNum, int setInterpolation)
|
|||
}
|
||||
}
|
||||
|
||||
void ms(short i);
|
||||
|
||||
void A_MoveSector(int spriteNum)
|
||||
{
|
||||
// T1,T2 and T3 are used for all the sector moving stuff!!!
|
||||
|
||||
spritetype *const pSprite = &sprite[spriteNum];
|
||||
int const rotateAngle = T3(spriteNum);
|
||||
int originIdx = T2(spriteNum);
|
||||
|
||||
pSprite->x += (pSprite->xvel * (sintable[(pSprite->ang + 512) & 2047])) >> 14;
|
||||
pSprite->y += (pSprite->xvel * (sintable[pSprite->ang & 2047])) >> 14;
|
||||
|
||||
int const endWall = sector[pSprite->sectnum].wallptr + sector[pSprite->sectnum].wallnum;
|
||||
|
||||
for (bssize_t wallNum = sector[pSprite->sectnum].wallptr; wallNum < endWall; wallNum++)
|
||||
{
|
||||
vec2_t const origin = g_origins[originIdx];
|
||||
vec2_t result;
|
||||
rotatepoint(zerovec, origin, rotateAngle & 2047, &result);
|
||||
dragpoint(wallNum, pSprite->x + result.x, pSprite->y + result.y, 0);
|
||||
|
||||
originIdx++;
|
||||
}
|
||||
ms(spriteNum);
|
||||
}
|
||||
|
||||
// NOTE: T5 is AC_ACTION_ID
|
||||
|
@ -413,7 +339,7 @@ void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange,
|
|||
|
||||
int g_canSeePlayer = 0;
|
||||
|
||||
ACTOR_STATIC int G_WakeUp(spritetype *const pSprite, int const playerNum)
|
||||
int G_WakeUp(spritetype *const pSprite, int const playerNum)
|
||||
{
|
||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||
if (!pPlayer->make_noise)
|
||||
|
@ -427,137 +353,9 @@ ACTOR_STATIC int G_WakeUp(spritetype *const pSprite, int const playerNum)
|
|||
&& pPlayer->noise_y - radius < pSprite->y && pPlayer->noise_y + radius > pSprite->y);
|
||||
}
|
||||
|
||||
|
||||
// sleeping monsters, etc
|
||||
ACTOR_STATIC void G_MoveZombieActors(void)
|
||||
{
|
||||
int spriteNum = headspritestat[STAT_ZOMBIEACTOR], canSeePlayer;
|
||||
|
||||
if (RR)
|
||||
canSeePlayer = g_canSeePlayer;
|
||||
|
||||
while (spriteNum >= 0)
|
||||
{
|
||||
int const nextSprite = nextspritestat[spriteNum];
|
||||
int32_t playerDist;
|
||||
spritetype *const pSprite = &sprite[spriteNum];
|
||||
int const playerNum = A_FindPlayer(pSprite, &playerDist);
|
||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||
|
||||
if (sprite[pPlayer->i].extra > 0)
|
||||
{
|
||||
if (playerDist < 30000)
|
||||
{
|
||||
actor[spriteNum].timetosleep++;
|
||||
if (actor[spriteNum].timetosleep >= (playerDist>>8))
|
||||
{
|
||||
if (A_CheckEnemySprite(pSprite))
|
||||
{
|
||||
vec3_t p = { pPlayer->opos.x + 64 - (krand2() & 127),
|
||||
pPlayer->opos.y + 64 - (krand2() & 127),
|
||||
0 };
|
||||
|
||||
int16_t pSectnum = pPlayer->cursectnum;
|
||||
|
||||
updatesector(p.x, p.y, &pSectnum);
|
||||
|
||||
if (pSectnum == -1)
|
||||
{
|
||||
spriteNum = nextSprite;
|
||||
continue;
|
||||
}
|
||||
|
||||
vec3_t s = { pSprite->x + 64 - (krand2() & 127),
|
||||
pSprite->y + 64 - (krand2() & 127),
|
||||
0 };
|
||||
|
||||
int16_t sectNum = pSprite->sectnum;
|
||||
|
||||
updatesector(s.x, s.y, §Num);
|
||||
|
||||
//if (sectNum == -1)
|
||||
//{
|
||||
// spriteNum = nextSprite;
|
||||
// continue;
|
||||
//}
|
||||
canSeePlayer = 0;
|
||||
if (!RR || pSprite->pal == 33 || A_CheckSpriteFlags(spriteNum, SFLAG_NOCANSEECHECK)
|
||||
|| (RRRA && pSprite->picnum == TILE_MINION && pSprite->pal == 8)
|
||||
|| (sintable[(pSprite->ang+512)&2047]*(p.x-s.x)+sintable[pSprite->ang&2047]*(p.y-s.y) >= 0))
|
||||
{
|
||||
p.z = pPlayer->opos.z - (krand2() % ZOFFSET5);
|
||||
s.z = pSprite->z - (krand2() % (52 << 8));
|
||||
canSeePlayer = cansee(s.x, s.y, s.z, pSprite->sectnum, p.x, p.y, p.z, pPlayer->cursectnum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t const r1 = krand2(), r2 = krand2();
|
||||
canSeePlayer = cansee(pSprite->x, pSprite->y, pSprite->z - ((r2 & 31) << 8), pSprite->sectnum, pPlayer->opos.x,
|
||||
pPlayer->opos.y, pPlayer->opos.z - ((r1 & 31) << 8), pPlayer->cursectnum);
|
||||
}
|
||||
|
||||
if (canSeePlayer)
|
||||
{
|
||||
switch (DYNAMICTILEMAP(pSprite->picnum))
|
||||
{
|
||||
case CANWITHSOMETHING2__STATIC:
|
||||
case CANWITHSOMETHING3__STATIC:
|
||||
case CANWITHSOMETHING4__STATIC:
|
||||
case TRIPBOMB__STATIC:
|
||||
if (RR) goto default_case;
|
||||
fallthrough__;
|
||||
case RUBBERCAN__STATIC:
|
||||
case EXPLODINGBARREL__STATIC:
|
||||
case WOODENHORSE__STATIC:
|
||||
case HORSEONSIDE__STATIC:
|
||||
case CANWITHSOMETHING__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
case NUKEBARREL__STATIC:
|
||||
case NUKEBARRELDENTED__STATIC:
|
||||
case NUKEBARRELLEAKED__STATIC:
|
||||
pSprite->shade = (sector[pSprite->sectnum].ceilingstat & 1)
|
||||
? sector[pSprite->sectnum].ceilingshade
|
||||
: sector[pSprite->sectnum].floorshade;
|
||||
actor[spriteNum].timetosleep = 0;
|
||||
changespritestat(spriteNum, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
default:
|
||||
default_case:
|
||||
if (A_CheckSpriteFlags(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384)
|
||||
break;
|
||||
|
||||
actor[spriteNum].timetosleep = 0;
|
||||
A_PlayAlertSound(spriteNum);
|
||||
changespritestat(spriteNum, STAT_ACTOR);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
actor[spriteNum].timetosleep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!RR || !canSeePlayer) && A_CheckEnemySprite(pSprite))
|
||||
{
|
||||
pSprite->shade = (sector[pSprite->sectnum].ceilingstat & 1)
|
||||
? sector[pSprite->sectnum].ceilingshade
|
||||
: sector[pSprite->sectnum].floorshade;
|
||||
|
||||
if (RR && G_WakeUp(pSprite, playerNum))
|
||||
{
|
||||
actor[spriteNum].timetosleep = 0;
|
||||
A_PlayAlertSound(spriteNum);
|
||||
changespritestat(spriteNum, STAT_ACTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spriteNum = nextSprite;
|
||||
}
|
||||
}
|
||||
void movefta(void);
|
||||
|
||||
// stupid name, but it's what the function does.
|
||||
static FORCE_INLINE int G_FindExplosionInSector(int const sectNum)
|
||||
|
@ -9356,7 +9154,7 @@ void G_MoveWorld(void)
|
|||
|
||||
if (!DEER)
|
||||
{
|
||||
G_MoveZombieActors(); //ST 2
|
||||
movefta(); //ST 2
|
||||
G_MoveWeapons(); //ST 4
|
||||
G_MoveTransports(); //ST 9
|
||||
}
|
||||
|
|
|
@ -213,6 +213,16 @@ G_EXTERN intptr_t *g_scriptPtr;
|
|||
|
||||
G_EXTERN map_t g_mapInfo[(MAXVOLUMES + 1) * MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music
|
||||
G_EXTERN vec2_t g_origins[MAXANIMPOINTS];
|
||||
struct msx_
|
||||
{
|
||||
int operator[](int v) { return g_origins[v].x; }
|
||||
};
|
||||
struct msy_
|
||||
{
|
||||
int operator[](int v) { return g_origins[v].y; }
|
||||
};
|
||||
G_EXTERN msx_ msx;
|
||||
G_EXTERN msy_ msy;
|
||||
|
||||
G_EXTERN int32_t g_windTime, g_windDir;
|
||||
G_EXTERN int16_t g_fakeBubbaCnt, g_mamaSpawnCnt, g_banjoSong, g_bellTime, g_bellSprite;
|
||||
|
@ -324,6 +334,20 @@ extern psaccess ps;
|
|||
#define spriteq SpriteDeletionQueue
|
||||
#define spriteqloc g_spriteDeleteQueuePos
|
||||
|
||||
// This is for dealing with those horrible switch/case messes the code is full of.
|
||||
// With two different sets of tile constants the switches won't do anymore.
|
||||
|
||||
inline bool isIn(int value, int first)
|
||||
{
|
||||
return value == first;
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
bool isIn(int value, int first, Args... args)
|
||||
{
|
||||
return value == first || isIn(value, args...);
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1062,7 +1062,6 @@ enum
|
|||
RR_FIRELASER = 3420,
|
||||
RR_BOWLINGBALL = 3430,
|
||||
RR_BOWLINGBALLSPRITE = 3437,
|
||||
RR_3440,
|
||||
RR_CHEERBOMB = -3464,
|
||||
RR_OWHIP = 3471,
|
||||
RR_UWHIP = 3475,
|
||||
|
@ -1157,7 +1156,10 @@ enum
|
|||
RR_VIXENKICK = 5805,
|
||||
RR_VIXENTELE = 5845,
|
||||
RR_VIXENTEAT = 5851,
|
||||
|
||||
RR_BIKERBV = 5891,
|
||||
RR_MAKEOUT = 6225,
|
||||
RR_CHEER = 6658,
|
||||
RR_CHEERSTAYPUT = 6659,
|
||||
//RA
|
||||
RR_AIRPLANE = 8450,
|
||||
RR_SWAMPBUGGY = 7233,
|
||||
|
@ -1177,6 +1179,21 @@ enum
|
|||
RR_MAMACLOUD = 8663,
|
||||
RR_MAMAJACKOLOPE = 8705,
|
||||
|
||||
|
||||
// Stuff that gets referenced but has no name. RR Reconstruction only has Duke names for these items which should be avoided.
|
||||
RR_1251 = 1251,
|
||||
RR_1268 = 1268,
|
||||
RR_1187 = 1187,
|
||||
RR_1304 = 1304,
|
||||
RR_1305 = 1305,
|
||||
RR_1306 = 1306,
|
||||
RR_1309 = 1309,
|
||||
RR_1315 = 1315,
|
||||
RR_1317 = 1317,
|
||||
RR_1388 = 1388,
|
||||
RR_3440 = 3440,
|
||||
|
||||
|
||||
};
|
||||
|
||||
extern int APLAYER;
|
||||
|
|
|
@ -120,6 +120,10 @@ inline void checkhitwall(int spr, int wal, int x, int y, int z, int w)
|
|||
A_DamageWall(spr, wal, &vec, w);
|
||||
}
|
||||
int __fastcall A_FindPlayer(const spritetype *pSprite,int32_t *dist);
|
||||
inline int findplayer(const spritetype* pSprite, int32_t* dist)
|
||||
{
|
||||
return A_FindPlayer(pSprite, dist);
|
||||
}
|
||||
void G_AlignWarpElevators(void);
|
||||
int CheckDoorTile(int tileNum);
|
||||
int CheckBlockDoorTile(int tileNum);
|
||||
|
|
Loading…
Reference in a new issue