moveactors plus backing code.

This commit is contained in:
Christoph Oelckers 2020-05-09 00:34:48 +02:00
parent ca0af4bd7c
commit 7b75a0683a
20 changed files with 3875 additions and 3065 deletions

View File

@ -174,6 +174,8 @@ static FORCE_INLINE void swapchar2(void *a, void *b, int32_t s)
static FORCE_INLINE CONSTEXPR int ksgn(int32_t a) { return (a > 0) - (a < 0); }
#endif
inline int sgn(int32_t a) { return (a > 0) - (a < 0); }
#ifndef pragmas_have_mulscale
static FORCE_INLINE CONSTEXPR int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * edx) >> by(ecx)); }
static FORCE_INLINE CONSTEXPR int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx)

View File

@ -155,6 +155,11 @@ inline bool isNam()
return g_gameType & (GAMEFLAG_NAM | GAMEFLAG_NAPALM);
}
inline bool isNamWW2GI()
{
return g_gameType & (GAMEFLAG_NAM | GAMEFLAG_NAPALM |GAMEFLAG_WW2GI);
}
inline bool isWW2GI()
{
return g_gameType & (GAMEFLAG_WW2GI);

View File

@ -3,6 +3,8 @@ set( PCH_SOURCES
src/actors.cpp
src/actors_r.cpp
src/actors_d.cpp
src/actors_lava.cpp
src/bowling.cpp
src/e_actors.cpp
src/anim.cpp
src/cheats.cpp

View File

@ -446,7 +446,7 @@ void movedummyplayers(void)
{
sprite[i].cstat = 257;
sprite[i].z = sector[sprite[i].sectnum].ceilingz + (27 << 8);
sprite[i].ang = ps[p].q16ang >> FRACBITS;
sprite[i].ang = ps[p].getang();
if (hittype[i].temp_data[0] == 8)
hittype[i].temp_data[0] = 0;
else hittype[i].temp_data[0]++;
@ -493,7 +493,7 @@ void moveplayers(void) //Players
s->x = p->oposx;
s->y = p->oposy;
hittype[i].bposz = s->z = p->oposz + PHEIGHT;
s->ang = p->oq16ang >> FRACBITS;
s->ang = p->getoang();
setsprite(i, s->x, s->y, s->z);
}
else
@ -553,14 +553,13 @@ void moveplayers(void) //Players
if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS)
{
int ang = p->q16ang >> FRACBITS;
int ang = p->getang();
ang += getincangle(ang, getangle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1;
ang &= 2047;
p->q16ang = ang << FRACBITS;
p->setang(ang & 2047);
}
}
s->ang = p->q16ang >> FRACBITS;
s->ang = p->getang();
}
}
else
@ -598,7 +597,7 @@ void moveplayers(void) //Players
if (s->extra < 8)
{
s->xvel = 128;
s->ang = p->q16ang >> FRACBITS;
s->ang = p->getang();
s->extra++;
//IFMOVING; // JBF 20040825: is really "if (ssp(i,CLIPMASK0)) ;" which is probably
ssp(i, CLIPMASK0); // not the safest of ideas because a zealous optimiser probably sees
@ -606,7 +605,7 @@ void moveplayers(void) //Players
}
else
{
s->ang = 2047 - (p->q16ang >> FRACBITS);
s->ang = 2047 - (p->getang());
setsprite(i, s->x, s->y, s->z);
}
}
@ -815,7 +814,7 @@ void movecrane(int i, int crane)
s->owner = -2;
ps[p].on_crane = i;
spritesound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
ps[p].q16ang = (s->ang + 1024) << FRACBITS;
ps[p].setang(s->ang + 1024);
}
else
{
@ -901,7 +900,7 @@ void movecrane(int i, int crane)
}
else if (s->owner == -2)
{
auto ang = ps[p].q16ang >> FRACBITS;
auto ang = ps[p].getang();
ps[p].oposx = ps[p].posx = s->x - (sintable[(ang + 512) & 2047] >> 6);
ps[p].oposy = ps[p].posy = s->y - (sintable[ang & 2047] >> 6);
ps[p].oposz = ps[p].posz = s->z + (2 << 8);
@ -1468,6 +1467,611 @@ void movetongue(int i, int tongue, int jaw)
sprite[q].picnum = jaw + 1;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool respawnmarker(int i, int yellow, int green)
{
hittype[i].temp_data[0]++;
if (hittype[i].temp_data[0] > respawnitemtime)
{
deletesprite(i);
return false;
}
if (hittype[i].temp_data[0] >= (respawnitemtime >> 1) && hittype[i].temp_data[0] < ((respawnitemtime >> 1) + (respawnitemtime >> 2)))
sprite[i].picnum = yellow;
else if (hittype[i].temp_data[0] > ((respawnitemtime >> 1) + (respawnitemtime >> 2)))
sprite[i].picnum = green;
makeitfall(i);
return true;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool rat(int i, bool makesound)
{
spritetype* s = &sprite[i];
makeitfall(i);
if (ssp(i, CLIPMASK0))
{
if (makesound && (krand() & 255) == 0) spritesound(RATTY, i);
s->ang += (krand() & 31) - 15 + (sintable[(hittype[i].temp_data[0] << 8) & 2047] >> 11);
}
else
{
hittype[i].temp_data[0]++;
if (hittype[i].temp_data[0] > 1)
{
deletesprite(i);
return false;
}
else s->ang = (krand() & 2047);
}
if (s->xvel < 128)
s->xvel += 2;
s->ang += (krand() & 3) - 6;
return true;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool queball(int i, int pocket, int queball, int stripeball)
{
spritetype* s = &sprite[i];
int j, nextj;
if (s->xvel)
{
j = headspritestat[0];
while (j >= 0)
{
nextj = nextspritestat[j];
if (sprite[j].picnum == pocket && ldist(&sprite[j], s) < 52)
{
deletesprite(i);
return false;
}
j = nextj;
}
j = clipmove(&s->x, &s->y, &s->z, &s->sectnum,
(((s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14) * TICSPERFRAME) << 11,
(((s->xvel * (sintable[s->ang & 2047])) >> 14) * TICSPERFRAME) << 11,
24L, (4 << 8), (4 << 8), CLIPMASK1);
if (j & 49152)
{
if ((j & 49152) == 32768)
{
j &= (MAXWALLS - 1);
int k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
}
else if ((j & 49152) == 49152)
{
j &= (MAXSPRITES - 1);
checkhitsprite(i, j);
}
}
s->xvel--;
if (s->xvel < 0) s->xvel = 0;
if (s->picnum == stripeball)
{
s->cstat = 257;
s->cstat |= 4 & s->xvel;
s->cstat |= 8 & s->xvel;
}
}
else
{
int x;
int p = findplayer(s, &x);
if (x < 1596)
{
// if(s->pal == 12)
{
j = getincangle(ps[p].getang(), getangle(s->x - ps[p].posx, s->y - ps[p].posy));
if (j > -64 && j < 64 && PlayerInput(p, SK_OPEN))
if (ps[p].toggle_key_flag == 1)
{
int a = headspritestat[1];
while (a >= 0)
{
if (sprite[a].picnum == queball || sprite[a].picnum == stripeball)
{
j = getincangle(ps[p].getang(), getangle(sprite[a].x - ps[p].posx, sprite[a].y - ps[p].posy));
if (j > -64 && j < 64)
{
int l;
findplayer(&sprite[a], &l);
if (x > l) break;
}
}
a = nextspritestat[a];
}
if (a == -1)
{
if (s->pal == 12)
s->xvel = 164;
else s->xvel = 140;
s->ang = ps[p].getang();
ps[p].toggle_key_flag = 2;
}
}
}
}
if (x < 512 && s->sectnum == ps[p].cursectnum)
{
s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy);
s->xvel = 48;
}
}
return true;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void forcesphere(int i, int forcesphere)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
if (s->yvel == 0)
{
s->yvel = 1;
for (int l = 512; l < (2048 - 512); l += 128)
for (int j = 0; j < 2048; j += 128)
{
int k = spawn(i, forcesphere);
sprite[k].cstat = 257 + 128;
sprite[k].clipdist = 64;
sprite[k].ang = j;
sprite[k].zvel = sintable[l & 2047] >> 5;
sprite[k].xvel = sintable[(l + 512) & 2047] >> 9;
sprite[k].owner = i;
}
}
if (t[3] > 0)
{
if (s->zvel < 6144)
s->zvel += 192;
s->z += s->zvel;
if (s->z > sector[sect].floorz)
s->z = sector[sect].floorz;
t[3]--;
if (t[3] == 0)
{
deletesprite(i);
return;
}
else if (t[2] > 10)
{
int j = headspritestat[5];
while (j >= 0)
{
if (sprite[j].owner == i && sprite[j].picnum == forcesphere)
hittype[j].temp_data[1] = 1 + (krand() & 63);
j = nextspritestat[j];
}
t[3] = 64;
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(int i))
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
int j, a;
getglobalz(i);
if (sector[s->sectnum].ceilingstat & 1)
s->shade += (sector[s->sectnum].ceilingshade - s->shade) >> 1;
else s->shade += (sector[s->sectnum].floorshade - s->shade) >> 1;
if (s->z < sector[sect].ceilingz + (32 << 8))
s->z = sector[sect].ceilingz + (32 << 8);
if (ud.multimode < 2)
{
if (actor_tog == 1)
{
s->cstat = (short)32768;
return;
}
else if (actor_tog == 2) s->cstat = 257;
}
j = ifhitbyweapon(i); if (j >= 0)
{
if (s->extra < 0 && t[0] != -1)
{
t[0] = -1;
s->extra = 0;
}
if (painsnd >= 0) spritesound(painsnd, i);
RANDOMSCRAP(s, i);
}
if (t[0] == -1)
{
s->z += 1024;
t[2]++;
if ((t[2] & 3) == 0) spawn(i, explosion);
getglobalz(i);
s->ang += 96;
s->xvel = 128;
j = ssp(i, CLIPMASK0);
if (j != 1 || s->z > hittype[i].floorz)
{
for (int l = 0; l < 16; l++)
RANDOMSCRAP(s, i);
spritesound(LASERTRIP_EXPLODE, i);
spawn(i, getspawn(i));
ps[myconnectindex].actors_killed++;
deletesprite(i);
}
return;
}
else
{
if (s->z > hittype[i].floorz - (48 << 8))
s->z = hittype[i].floorz - (48 << 8);
}
int x;
int p = findplayer(s, &x);
j = s->owner;
// 3 = findplayerz, 4 = shoot
if (t[0] >= 4)
{
t[2]++;
if ((t[2] & 15) == 0)
{
a = s->ang;
s->ang = hittype[i].tempang;
if (attacksnd >= 0) spritesound(attacksnd, i);
shoot(i, firelaser);
s->ang = a;
}
if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
{
t[0] = 0;
t[2] = 0;
}
else hittype[i].tempang +=
getincangle(hittype[i].tempang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) / 3;
}
else if (t[0] == 2 || t[0] == 3)
{
t[3] = 0;
if (s->xvel > 0) s->xvel -= 16;
else s->xvel = 0;
if (t[0] == 2)
{
int l = ps[p].posz - s->z;
if (abs(l) < (48 << 8)) t[0] = 3;
else s->z += sgn(ps[p].posz - s->z) << shift; // The shift here differs between Duke and RR.
}
else
{
t[2]++;
if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
{
t[0] = 1;
t[2] = 0;
}
else if ((t[2] & 15) == 0 && attacksnd >= 0)
{
spritesound(attacksnd, i);
shoot(i, firelaser);
}
}
s->ang += getincangle(s->ang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2;
}
if (t[0] != 2 && t[0] != 3)
{
int l = ldist(&sprite[j], s);
if (l <= 1524)
{
a = s->ang;
s->xvel >>= 1;
}
else a = getangle(sprite[j].x - s->x, sprite[j].y - s->y);
if (t[0] == 1 || t[0] == 4) // Found a locator and going with it
{
l = dist(&sprite[j], s);
if (l <= 1524) { if (t[0] == 1) t[0] = 0; else t[0] = 5; }
else
{
// Control speed here
if (l > 1524) { if (s->xvel < 256) s->xvel += 32; }
else
{
if (s->xvel > 0) s->xvel -= 16;
else s->xvel = 0;
}
}
if (t[0] < 2) t[2]++;
if (x < 6144 && t[0] < 2 && t[2] > (26 * 4))
{
t[0] = 2 + (krand() & 2);
t[2] = 0;
hittype[i].tempang = s->ang;
}
}
if (t[0] == 0 || t[0] == 5)
{
if (t[0] == 0)
t[0] = 1;
else t[0] = 4;
j = s->owner = LocateTheLocator(s->hitag, -1);
if (j == -1)
{
s->hitag = j = hittype[i].temp_data[5];
s->owner = LocateTheLocator(j, -1);
j = s->owner;
if (j == -1)
{
deletesprite(i);
return;
}
}
else s->hitag++;
}
t[3] = getincangle(s->ang, a);
s->ang += t[3] >> 3;
if (s->z < sprite[j].z)
s->z += 1024;
else s->z -= 1024;
}
if (roamsnd >= 0 && S_CheckSoundPlaying(roamsnd) < 2)
A_PlaySound(roamsnd, i);
ssp(i, CLIPMASK0);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void ooz(int i)
{
getglobalz(i);
int j = (hittype[i].floorz - hittype[i].ceilingz) >> 9;
if (j > 255) j = 255;
int x = 25 - (j >> 1);
if (x < 8) x = 8;
else if (x > 48) x = 48;
spritetype* s = &sprite[i];
s->yrepeat = j;
s->xrepeat = x;
s->z = hittype[i].floorz;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
if (t[4] == 1)
{
int j = headspritesect[sect];
while (j >= 0)
{
if (sprite[j].picnum == SECTOREFFECTOR)
{
if (sprite[j].lotag == 1)
{
sprite[j].lotag = (short)65535;
sprite[j].hitag = (short)65535;
}
}
else if (sprite[j].picnum == REACTOR)
{
sprite[j].picnum = REACTORBURNT;
}
else if (sprite[j].picnum == REACTOR2)
{
sprite[j].picnum = REACTOR2BURNT;
}
else if (sprite[j].picnum == REACTORBURNT || sprite[j].picnum == REACTOR2BURNT)
{
sprite[j].cstat = (short)32768;
}
j = nextspritesect[j];
}
return;
}
if (t[1] >= 20)
{
t[4] = 1;
return;
}
int x;
int p = findplayer(s, &x);
t[2]++;
if (t[2] == 4) t[2] = 0;
if (x < 4096)
{
if ((krand() & 255) < 16)
{
if (!S_CheckSoundPlaying(DUKE_LONGTERM_PAIN))
spritesound(DUKE_LONGTERM_PAIN, ps[p].i);
spritesound(SHORT_CIRCUIT, i);
sprite[ps[p].i].extra--;
SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0));
}
t[0] += 128;
if (t[3] == 0)
t[3] = 1;
}
else t[3] = 0;
if (t[1])
{
int j;
t[1]++;
t[4] = s->z;
s->z = sector[sect].floorz - (krand() % (sector[sect].floorz - sector[sect].ceilingz));
switch (t[1])
{
case 3:
//Turn on all of those flashing sectoreffector.
hitradius(i, 4096,
impact_damage << 2,
impact_damage << 2,
impact_damage << 2,
impact_damage << 2);
j = headspritestat[6];
while (j >= 0)
{
if (sprite[j].picnum == MASTERSWITCH)
if (sprite[j].hitag == s->hitag)
if (sprite[j].yvel == 0)
sprite[j].yvel = 1;
j = nextspritestat[j];
}
break;
case 4:
case 7:
case 10:
case 15:
j = headspritesect[sect];
while (j >= 0)
{
int l = nextspritesect[j];
if (j != i)
{
deletesprite(j);
return;
}
j = l;
}
break;
}
for (x = 0; x < 16; x++)
RANDOMSCRAP(s, i);
s->z = t[4];
t[4] = 0;
}
else
{
int j = ifhitbyweapon(i);
if (j >= 0)
{
for (x = 0; x < 32; x++)
RANDOMSCRAP(s, i);
if (s->extra < 0)
t[1] = 1;
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void camera(int i)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
if (t[0] == 0)
{
t[1] += 8;
if (camerashitable)
{
int j = ifhitbyweapon(i);
if (j >= 0)
{
t[0] = 1; // static
s->cstat = (short)32768;
for (int x = 0; x < 5; x++)
RANDOMSCRAP(s, i);
return;
}
}
if (s->hitag > 0)
{
if (t[1] < s->hitag)
s->ang += 8;
else if (t[1] < (s->hitag * 3))
s->ang -= 8;
else if (t[1] < (s->hitag << 2))
s->ang += 8;
else
{
t[1] = 8;
s->ang += 16;
}
}
}
}
END_DUKE_NS

View File

@ -262,10 +262,16 @@ extern actor_t actor[MAXSPRITES];
extern actor_t* hittype;
extern int32_t block_deletesprite;
extern int32_t g_noEnemies;
#define actor_tog g_noEnemies
extern int32_t otherp;
extern int32_t ticrandomseed;
extern int g_canSeePlayer;
int A_FindLocator(int const tag, int const sectNum);
inline int LocateTheLocator(int const tag, int const sectNum)
{
return A_FindLocator(tag, sectNum);
}
int A_CheckNoSE7Water(uspritetype const *pSprite, int sectNum, int sectLotag, int32_t *pOther);
int A_CheckSwitchTile(int spriteNum);
@ -284,7 +290,7 @@ inline void check_fta_sounds(int 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);
void resetlanepics(void);
int G_SetInterpolation(int32_t *posptr);
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
@ -382,6 +388,15 @@ void bounce(int i);
void movetongue(int i, int tongue, int jaw);
void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion);
void lotsofstuff(spritetype* s, short n, int spawntype);
bool respawnmarker(int i, int yellow, int green);
bool rat(int i, bool makesound);
bool queball(int i, int pocket, int queball, int stripeball);
void forcesphere(int i, int forcesphere);
void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(int i));
void ooz(int i);
void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT);
void camera(int i);
void respawn_rrra(int i, int j);
void hitradius(short i, int r, int hp1, int hp2, int hp3, int hp4);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,663 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
aint with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "global.h"
#include "actors.h"
#include "names_rr.h"
#include "serializer.h"
BEGIN_DUKE_NS
static int torchcnt;
static int jaildoorcnt;
static int minecartcnt;
static int lightnincnt;
static short torchsector[64];
static short torchsectorshade[64];
static short torchtype[64];
static short jaildoorsound[32];
static int jaildoordrag[32];
static int jaildoorspeed[32];
static short jaildoorsecthtag[32];
static int jaildoordist[32];
static short jaildoordir[32];
static short jaildooropen[32];
static short jaildoorsect[32];
static short minecartdir[16];
static int minecartspeed[16];
static short minecartchildsect[16];
static short minecartsound[16];
static int minecartdist[16];
static int minecartdrag[16];
static short minecartopen[16];
static short minecartsect[16];
static short lightninsector[64];
static short lightninsectorshade[64];
static uint8_t brightness;
static int thunderflash;
static int thundertime;
static int winderflash;
static int windertime;
void lava_cleararrays()
{
jaildoorcnt = 0;
minecartcnt = 0;
torchcnt = 0;
lightnincnt = 0;
}
void lava_serialize(FSerializer& arc)
{
arc("torchcnt", torchcnt)
("jaildoorcnt", jaildoorcnt)
("minecartcnt", minecartcnt)
("lightnincnt", lightnincnt);
if (torchcnt)
arc.Array("torchsector", torchsector, torchcnt)
.Array("torchsectorshade", torchsectorshade, torchcnt)
.Array("torchtype", torchtype, torchcnt);
if (jaildoorcnt)
arc.Array("jaildoorsound", jaildoorsound, jaildoorcnt)
.Array("jaildoordrag", jaildoordrag, jaildoorcnt)
.Array("jaildoorspeed", jaildoorspeed, jaildoorcnt)
.Array("jaildoorsecthtag", jaildoorsecthtag, jaildoorcnt)
.Array("jaildoordist", jaildoordist, jaildoorcnt)
.Array("jaildoordir", jaildoordir, jaildoorcnt)
.Array("jaildooropen", jaildooropen, jaildoorcnt)
.Array("jaildoorsect", jaildoorsect, jaildoorcnt);
if (minecartcnt)
arc.Array("minecartdir", minecartdir, minecartcnt)
.Array("minecartspeed", minecartspeed, minecartcnt)
.Array("minecartchildsect", minecartchildsect, minecartcnt)
.Array("minecartsound", minecartsound, minecartcnt)
.Array("minecartdist", minecartdist, minecartcnt)
.Array("minecartdrag", minecartdrag, minecartcnt)
.Array("minecartopen", minecartopen, minecartcnt)
.Array("minecartsect", minecartsect, minecartcnt);
if (lightnincnt)
arc.Array("lightninsector", lightninsector, lightnincnt)
.Array("lightninsectorshade", lightninsectorshade, lightnincnt);
arc("brightness", brightness)
("thunderflash", thunderflash)
("thundertime", thundertime)
("winderflash", winderflash)
("windertime", windertime);
}
void addtorch(int i)
{
if (torchcnt >= 64)
I_Error("Too many torch effects");
torchsector[torchcnt] = sprite[i].sectnum;
torchsectorshade[torchcnt] = sector[sprite[i].sectnum].floorshade;
torchtype[torchcnt] = sprite[i].lotag;
torchcnt++;
}
void addlightning(int i)
{
if (lightnincnt >= 64)
I_Error("Too many lightnin effects");
lightninsector[lightnincnt] = sprite[i].sectnum;
lightninsectorshade[lightnincnt] = sector[sprite[i].sectnum].floorshade;
lightnincnt++;
}
void addjaildoor(int p1, int p2, int iht, int jlt, int p3, int j)
{
if (jaildoorcnt >= 32)
I_Error("Too many jaildoor sectors");
jaildoordist[jaildoorcnt] = p1;
jaildoorspeed[jaildoorcnt] = p2;
jaildoorsecthtag[jaildoorcnt] = iht;
jaildoorsect[jaildoorcnt] = j;
jaildoordrag[jaildoorcnt] = 0;
jaildooropen[jaildoorcnt] = 0;
jaildoordir[jaildoorcnt] = jlt;
jaildoorsound[jaildoorcnt] = p3;
jaildoorcnt++;
}
void addminecart(int p1, int p2, int i, int iht, int p3, int childsectnum)
{
if (minecartcnt >= 16)
G_GameExit("\nToo many minecart sectors");
minecartdist[minecartcnt] = p1;
minecartspeed[minecartcnt] = p2;
minecartsect[minecartcnt] = i;
minecartdir[minecartcnt] = sector[i].hitag;
minecartdrag[minecartcnt] = p1;
minecartopen[minecartcnt] = 1;
minecartsound[minecartcnt] = p3;
minecartchildsect[minecartcnt] = childsectnum;
minecartcnt++;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void dotorch(void)
{
int ds;
short j;
short startwall, endwall;
char shade;
ds = krand()&8;
for (int i = 0; i < torchcnt; i++)
{
shade = torchsectorshade[i] - ds;
switch (torchtype[i])
{
case 0:
sector[torchsector[i]].floorshade = shade;
sector[torchsector[i]].ceilingshade = shade;
break;
case 1:
sector[torchsector[i]].ceilingshade = shade;
break;
case 2:
sector[torchsector[i]].floorshade = shade;
break;
case 4:
sector[torchsector[i]].ceilingshade = shade;
break;
case 5:
sector[torchsector[i]].floorshade = shade;
break;
}
startwall = sector[torchsector[i]].wallptr;
endwall = startwall + sector[torchsector[i]].wallnum;
for (j = startwall; j < endwall; j++)
{
if (wall[j].lotag != 1)
{
switch (torchtype[i])
{
case 0:
wall[j].shade = shade;
break;
case 1:
wall[j].shade = shade;
break;
case 2:
wall[j].shade = shade;
break;
case 3:
wall[j].shade = shade;
break;
}
}
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void dojaildoor(void)
{
int j;
int startwall, endwall;
int x, y;
int speed;
for (int i = 0; i < jaildoorcnt; i++)
{
if (numplayers > 2)
speed = jaildoorspeed[i];
else
speed = jaildoorspeed[i];
if (speed < 2)
speed = 2;
if (jaildooropen[i] == 1)
{
jaildoordrag[i] -= speed;
if (jaildoordrag[i] <= 0)
{
jaildoordrag[i] = 0;
jaildooropen[i] = 2;
switch (jaildoordir[i])
{
case 10:
jaildoordir[i] = 30;
break;
case 20:
jaildoordir[i] = 40;
break;
case 30:
jaildoordir[i] = 10;
break;
case 40:
jaildoordir[i] = 20;
break;
}
}
else
{
startwall = sector[jaildoorsect[i]].wallptr;
endwall = startwall + sector[jaildoorsect[i]].wallnum;
for (j = startwall; j < endwall; j++)
{
switch (jaildoordir[i])
{
case 10:
x = wall[j].x;
y = wall[j].y + speed;
break;
case 20:
x = wall[j].x - speed;
y = wall[j].y;
break;
case 30:
x = wall[j].x;
y = wall[j].y - speed;
break;
case 40:
x = wall[j].x + speed;
y = wall[j].y;
break;
}
dragpoint(j,x,y);
}
}
}
if (jaildooropen[i] == 3)
{
jaildoordrag[i] -= speed;
if (jaildoordrag[i] <= 0)
{
jaildoordrag[i] = 0;
jaildooropen[i] = 0;
switch (jaildoordir[i])
{
case 10:
jaildoordir[i] = 30;
break;
case 20:
jaildoordir[i] = 40;
break;
case 30:
jaildoordir[i] = 10;
break;
case 40:
jaildoordir[i] = 20;
break;
}
}
else
{
startwall = sector[jaildoorsect[i]].wallptr;
endwall = startwall + sector[jaildoorsect[i]].wallnum;
for (j = startwall; j < endwall; j++)
{
switch (jaildoordir[i])
{
case 10:
x = wall[j].x;
y = wall[j].y + speed;
break;
case 20:
x = wall[j].x - speed;
y = wall[j].y;
break;
case 30:
x = wall[j].x;
y = wall[j].y - speed;
break;
case 40:
x = wall[j].x + speed;
y = wall[j].y;
break;
}
dragpoint(j,x,y);
}
}
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void moveminecart(void)
{
short i;
short j;
short csect;
short startwall;
short endwall;
int speed;
int y;
int x;
short nextj;
int cx;
int cy;
int max_x;
int min_y;
int max_y;
int min_x;
for (i = 0; i < minecartcnt; i++)
{
speed = minecartspeed[i];
if (speed < 2)
speed = 2;
if (minecartopen[i] == 1)
{
minecartdrag[i] -= speed;
if (minecartdrag[i] <= 0)
{
minecartdrag[i] = minecartdist[i];
minecartopen[i] = 2;
switch (minecartdir[i])
{
case 10:
minecartdir[i] = 30;
break;
case 20:
minecartdir[i] = 40;
break;
case 30:
minecartdir[i] = 10;
break;
case 40:
minecartdir[i] = 20;
break;
}
}
else
{
startwall = sector[minecartsect[i]].wallptr;
endwall = startwall + sector[minecartsect[i]].wallnum;
for (j = startwall; j < endwall; j++)
{
switch (minecartdir[i])
{
case 10:
x = wall[j].x;
y = wall[j].y + speed;
break;
case 20:
x = wall[j].x - speed;
y = wall[j].y;
break;
case 30:
x = wall[j].x;
y = wall[j].y - speed;
break;
case 40:
x = wall[j].x + speed;
y = wall[j].y;
break;
}
dragpoint(j,x,y);
}
}
}
if (minecartopen[i] == 2)
{
minecartdrag[i] -= speed;
if (minecartdrag[i] <= 0)
{
minecartdrag[i] = minecartdist[i];
minecartopen[i] = 1;
switch (minecartdir[i])
{
case 10:
minecartdir[i] = 30;
break;
case 20:
minecartdir[i] = 40;
break;
case 30:
minecartdir[i] = 10;
break;
case 40:
minecartdir[i] = 20;
break;
}
}
else
{
startwall = sector[minecartsect[i]].wallptr;
endwall = startwall + sector[minecartsect[i]].wallnum;
for (j = startwall; j < endwall; j++)
{
switch (minecartdir[i])
{
case 10:
x = wall[j].x;
y = wall[j].y + speed;
break;
case 20:
x = wall[j].x - speed;
y = wall[j].y;
break;
case 30:
x = wall[j].x;
y = wall[j].y - speed;
break;
case 40:
x = wall[j].x + speed;
y = wall[j].y;
break;
}
dragpoint(j,x,y);
}
}
}
csect = minecartchildsect[i];
startwall = sector[csect].wallptr;
endwall = startwall + sector[csect].wallnum;
max_x = max_y = -0x20000;
min_x = min_y = 0x20000;
for (j = startwall; j < endwall; j++)
{
x = wall[j].x;
y = wall[j].y;
if (x > max_x)
max_x = x;
if (y > max_y)
max_y = y;
if (x < min_x)
min_x = x;
if (y < min_y)
min_y = y;
}
cx = (max_x + min_x) >> 1;
cy = (max_y + min_y) >> 1;
j = headspritesect[csect];
while (j != -1)
{
nextj = nextspritesect[j];
if (badguy(&sprite[j]))
setsprite(j,cx,cy,sprite[j].z);
j = nextj;
}
}
}
void operatejaildoors(int hitag)
{
for (int i = 0; i < jaildoorcnt; i++)
{
if (jaildoorsecthtag[i] == hitag)
{
if (jaildooropen[i] == 0)
{
jaildooropen[i] = 1;
jaildoordrag[i] = jaildoordist[i];
if (!isRRRA() || jaildoorsound[i] != 0)
spritesound(jaildoorsound[i], ps[screenpeek].i);
}
if (jaildooropen[i] == 2)
{
jaildooropen[i] = 3;
jaildoordrag[i] = jaildoordist[i];
if (!isRRRA() || jaildoorsound[i] != 0)
spritesound(jaildoorsound[i], ps[screenpeek].i);
}
}
}
}
void thunder(void)
{
struct player_struct* p;
int r1, r2;
short startwall, endwall, i, j;
unsigned char shade;
p = &ps[screenpeek];
if (!thunderflash)
{
if ((gotpic[RRTILE2577 >> 3] & (1 << (RRTILE2577 & 7))) > 0)
{
gotpic[RRTILE2577 >> 3] &= ~(1 << (RRTILE2577 & 7));
g_visibility = 256; // this is an engine variable
if (krand() > 65000)
{
thunderflash = 1;
thundertime = 256;
sound(351 + (rand() % 3));
}
}
else
{
g_visibility = p->visibility;
brightness = ud.brightness >> 2;
}
}
else
{
thundertime -= 4;
if (thundertime < 0)
{
thunderflash = 0;
brightness = ud.brightness >> 2;
videoSetBrightness(brightness);
g_visibility = p->visibility;
}
}
if (!winderflash)
{
if ((gotpic[RRTILE2562 >> 3] & (1 << (RRTILE2562 & 7))) > 0)
{
gotpic[RRTILE2562 >> 3] &= ~(1 << (RRTILE2562 & 7));
if (krand() > 65000)
{
winderflash = 1;
windertime = 128;
sound(351 + (rand() % 3));
}
}
}
else
{
windertime -= 4;
if (windertime < 0)
{
winderflash = 0;
for (i = 0; i < lightnincnt; i++)
{
startwall = sector[lightninsector[i]].wallptr;
endwall = startwall + sector[lightninsector[i]].wallnum;
sector[lightninsector[i]].floorshade = lightninsectorshade[i];
sector[lightninsector[i]].ceilingshade = lightninsectorshade[i];
for (j = startwall; j < endwall; j++)
wall[j].shade = lightninsectorshade[i];
}
}
}
if (thunderflash == 1)
{
r1 = krand() & 4;
brightness += r1;
switch (r1)
{
case 0:
g_visibility = 2048;
break;
case 1:
g_visibility = 1024;
break;
case 2:
g_visibility = 512;
break;
case 3:
g_visibility = 256;
break;
default:
g_visibility = 4096;
break;
}
if (brightness > 8)
brightness = 0;
videoSetBrightness(brightness);
}
if (winderflash == 1)
{
r2 = krand() & 8;
shade = torchsectorshade[i] + r2;
for (i = 0; i < lightnincnt; i++)
{
startwall = sector[lightninsector[i]].wallptr;
endwall = startwall + sector[lightninsector[i]].wallnum;
sector[lightninsector[i]].floorshade = lightninsectorshade[i] - shade;
sector[lightninsector[i]].ceilingshade = lightninsectorshade[i] - shade;
for (j = startwall; j < endwall; j++)
wall[j].shade = lightninsectorshade[i] - shade;
}
}
}
END_DUKE_NS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,341 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "global.h"
#include "actors.h"
#include "names_rr.h"
BEGIN_DUKE_NS
short pinsectorresetdown(short sect);
void ballreturn(short spr)
{
short j, i, nexti, nextj;
i = headspritestat[105];
while (i >= 0)
{
nexti = nextspritestat[i];
if (sprite[i].picnum == RRTILE281)
if (sprite[spr].sectnum == sprite[i].sectnum)
{
j = headspritestat[105];
while (j >= 0)
{
nextj = nextspritestat[j];
if (sprite[j].picnum == RRTILE282)
if (sprite[i].hitag == sprite[j].hitag)
spawn(j, BOWLINGBALLSPRITE);
if (sprite[j].picnum == RRTILE280)
if (sprite[i].hitag == sprite[j].hitag)
if (sprite[j].lotag == 0)
{
sprite[j].lotag = 100;
sprite[j].extra++;
pinsectorresetdown(sprite[j].sectnum);
}
j = nextj;
}
}
i = nexti;
}
}
short pinsectorresetdown(short sect)
{
int vel, j;
j = getanimationgoal(&sector[sect].ceilingz);
if (j == -1)
{
j = sector[sect].floorz;
vel = 64;
setanimation(sect,&sector[sect].ceilingz,j,vel);
return 1;
}
return 0;
}
short pinsectorresetup(short sect)
{
int vel, j;
j = getanimationgoal(&sector[sect].ceilingz);
if (j == -1)
{
j = sector[nextsectorneighborz(sect,sector[sect].ceilingz,-1,-1)].ceilingz;
vel = 64;
setanimation(sect,&sector[sect].ceilingz,j,vel);
return 1;
}
return 0;
}
short checkpins(short sect)
{
short i, pin;
int x, y;
short pins[10];
short nexti, tag;
pin = 0;
for(i=0;i<10;i++) pins[i] = 0;
i = headspritesect[sect];
while (i >= 0)
{
nexti = nextspritesect[i];
if (sprite[i].picnum == RRTILE3440)
{
pin++;
pins[sprite[i].lotag] = 1;
}
if (sprite[i].picnum == RRTILE280)
{
tag = sprite[i].hitag;
}
i = nexti;
}
if (tag)
{
tag += 2024;
tileCopySection(2024,0,0,128,64,tag,0,0);
for(i=0;i<10;i++)
{
if (pins[i] == 1)
{
switch (i)
{
case 0:
x = 64;
y = 48;
break;
case 1:
x = 56;
y = 40;
break;
case 2:
x = 72;
y = 40;
break;
case 3:
x = 48;
y = 32;
break;
case 4:
x = 64;
y = 32;
break;
case 5:
x = 80;
y = 32;
break;
case 6:
x = 40;
y = 24;
break;
case 7:
x = 56;
y = 24;
break;
case 8:
x = 72;
y = 24;
break;
case 9:
x = 88;
y = 24;
break;
}
tileCopySection(2023,0,0,8,8,tag,x-4,y-10);
}
}
}
return pin;
}
void resetpins(short sect)
{
short i, j, nexti, tag;
int x, y;
i = headspritesect[sect];
while (i >= 0)
{
nexti = headspritesect[i];
if (sprite[i].picnum == 3440)
deletesprite(i);
i = nexti;
}
i = headspritesect[sect];
while (i >= 0)
{
nexti = nextspritesect[i];
if (sprite[i].picnum == 283)
{
j = spawn(i,3440);
sprite[j].lotag = sprite[i].lotag;
if (sprite[j].lotag == 3 || sprite[j].lotag == 5)
{
sprite[j].clipdist = (1+(krand()%1))*16+32;
}
else
{
sprite[j].clipdist = (1+(krand()%1))*16+32;
}
sprite[j].ang -= ((krand()&32)-(krand()&64))&2047;
}
if (sprite[i].picnum == 280)
tag = sprite[i].hitag;
i = nexti;
}
if (tag)
{
tag += LANEPICS+1;
tileCopySection(LANEPICS+1,0,0,128,64,tag,0,0);
for(i=0;i<10;i++)
{
switch (i)
{
case 0:
x = 64;
y = 48;
break;
case 1:
x = 56;
y = 40;
break;
case 2:
x = 72;
y = 40;
break;
case 3:
x = 48;
y = 32;
break;
case 4:
x = 64;
y = 32;
break;
case 5:
x = 80;
y = 32;
break;
case 6:
x = 40;
y = 24;
break;
case 7:
x = 56;
y = 24;
break;
case 8:
x = 72;
y = 24;
break;
case 9:
x = 88;
y = 24;
break;
}
tileCopySection(LANEPICS,0,0,8,8,tag,x-4,y-10);
}
}
}
void resetlanepics(void)
{
int x, y;
short i;
short tag, pic;
for(tag=0;tag<4;tag++)
{
pic = tag + 1;
if (pic == 0) continue;
pic += LANEPICS+1;
tileCopySection(LANEPICS+1,0,0,128,64, pic,0,0);
for(i=0;i<10;i++)
{
switch (i)
{
case 0:
x = 64;
y = 48;
break;
case 1:
x = 56;
y = 40;
break;
case 2:
x = 72;
y = 40;
break;
case 3:
x = 48;
y = 32;
break;
case 4:
x = 64;
y = 32;
break;
case 5:
x = 80;
y = 32;
break;
case 6:
x = 40;
y = 24;
break;
case 7:
x = 56;
y = 24;
break;
case 8:
x = 72;
y = 24;
break;
case 9:
x = 88;
y = 24;
break;
}
tileCopySection(LANEPICS,0,0,8,8,pic,x-4,y-10);
}
}
}
END_DUKE_NS

View File

@ -810,13 +810,13 @@ void G_DoCheats(void)
return;
case CHEAT_RATONY:
g_changeEnemySize = 2;
enemysizecheat = 2;
end_cheat(pPlayer);
inputState.keyFlushChars();
return;
case CHEAT_RAVAN:
g_changeEnemySize = 3;
enemysizecheat = 3;
end_cheat(pPlayer);
inputState.keyFlushChars();
return;

File diff suppressed because it is too large Load Diff

View File

@ -1682,7 +1682,7 @@ default_case:
if (!RRRA) goto default_case;
pSprite->xrepeat = 0;
pSprite->yrepeat = 0;
g_ufoSpawnMinion = 1;
ufospawnsminion = 1;
break;
case RRTILE8193__STATICRR:
if (!RRRA) goto default_case;
@ -2988,7 +2988,7 @@ rr_badguy:
pSprite->xrepeat = 16;
pSprite->yrepeat = 16;
pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x);
if (RRRA && g_ufoSpawnMinion)
if (RRRA && ufospawnsminion)
pSprite->pal = 8;
break;
case DOGRUN__STATICRR:
@ -7572,8 +7572,8 @@ int G_DoMoveThings(void)
//if (g_netClient) //Slave
// Net_SendClientUpdate();
if (RR && ud.recstat == 0 && ud.multimode < 2 && g_torchCnt)
G_DoTorch();
if (RR && ud.recstat == 0 && ud.multimode < 2)
dotorch();
return 0;
}

View File

@ -113,6 +113,7 @@ G_EXTERN int32_t g_frameRate;
G_EXTERN int32_t g_cyclerCnt;
#define numcyclers g_cyclerCnt
G_EXTERN int32_t g_damageCameras;
#define camerashitable g_damageCameras
G_EXTERN int32_t g_defaultLabelCnt;
G_EXTERN int32_t g_doQuickSave;
G_EXTERN int32_t g_earthquakeTime;
@ -122,6 +123,7 @@ G_EXTERN int32_t g_gameQuit;
G_EXTERN int32_t g_globalRandom;
#define global_random g_globalRandom
G_EXTERN int32_t g_impactDamage;
#define impact_damage g_impactDamage
G_EXTERN int32_t g_labelCnt;
G_EXTERN int32_t g_maxPlayerHealth;
G_EXTERN int32_t g_mirrorCount;
@ -157,6 +159,7 @@ G_EXTERN ClockTicks ototalclock;
G_EXTERN int32_t g_wupass;
G_EXTERN int32_t g_chickenPlant;
#define chickenplant g_chickenPlant
G_EXTERN int32_t g_thunderOn;
G_EXTERN int32_t g_ufoSpawn;
G_EXTERN int32_t g_ufoCnt;
@ -165,34 +168,6 @@ G_EXTERN int32_t g_vixenLevel;
G_EXTERN int32_t g_lastLevel;
G_EXTERN int32_t g_turdLevel;
G_EXTERN int32_t g_mineCartDir[MAXMINECARTS];
G_EXTERN int32_t g_mineCartSpeed[MAXMINECARTS];
G_EXTERN int32_t g_mineCartChildSect[MAXMINECARTS];
G_EXTERN int32_t g_mineCartSound[MAXMINECARTS];
G_EXTERN int32_t g_mineCartDist[MAXMINECARTS];
G_EXTERN int32_t g_mineCartDrag[MAXMINECARTS];
G_EXTERN int32_t g_mineCartOpen[MAXMINECARTS];
G_EXTERN int32_t g_mineCartSect[MAXMINECARTS];
G_EXTERN uint32_t g_mineCartCnt;
G_EXTERN int32_t g_jailDoorSound[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorDrag[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorSpeed[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorSecHitag[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorDist[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorDir[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorOpen[MAXJAILDOORS];
G_EXTERN int32_t g_jailDoorSect[MAXJAILDOORS];
G_EXTERN uint32_t g_jailDoorCnt;
G_EXTERN int32_t g_lightninSector[MAXLIGHTNINSECTORS];
G_EXTERN int32_t g_lightninSectorShade[MAXLIGHTNINSECTORS];
G_EXTERN uint32_t g_lightninCnt;
G_EXTERN int32_t g_torchSector[MAXTORCHSECTORS];
G_EXTERN int32_t g_torchSectorShade[MAXTORCHSECTORS];
G_EXTERN int32_t g_torchType[MAXTORCHSECTORS];
G_EXTERN uint32_t g_torchCnt;
G_EXTERN int32_t g_geoSectorWarp[MAXGEOSECTORS];
G_EXTERN int32_t g_geoSectorWarp2[MAXGEOSECTORS];
@ -232,8 +207,9 @@ 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;
G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS];
G_EXTERN uint8_t g_changeEnemySize, g_slotWin, g_ufoSpawnMinion, g_pistonSound, g_chickenWeaponTimer, g_RAendLevel, g_RAendEpisode, g_fogType;
G_EXTERN uint8_t enemysizecheat, ufospawnsminion, g_pistonSound, g_chickenWeaponTimer, g_RAendLevel, g_RAendEpisode, g_fogType;
G_EXTERN int32_t g_cdTrack;
#define raat607 enemysizecheat // only as a reminder
// XXX: I think this pragma pack is meaningless here.
// MSDN (https://msdn.microsoft.com/en-us/library/2e70t5y1%28VS.80%29.aspx) says:
@ -265,10 +241,13 @@ extern char g_gametypeNames[MAXGAMETYPES][33];
extern int32_t g_actorRespawnTime;
extern int32_t g_bouncemineRadius;
#define bouncemineblastradius g_bouncemineRadius
extern int32_t g_deleteQueueSize;
extern int32_t g_gametypeCnt;
extern int32_t g_itemRespawnTime;
#define respawnitemtime g_itemRespawnTime
extern int32_t g_morterRadius;
#define morterblastradius g_morterRadius
extern int32_t g_numFreezeBounces;
extern int32_t g_pipebombRadius;
#define pipebombblastradius g_pipebombRadius
@ -284,6 +263,7 @@ extern int32_t g_spriteGravity;
extern int32_t g_timerTicsPerSecond;
extern int32_t g_tripbombRadius;
#define tripbombblastradius g_tripbombRadius
#define powderkegblastradius g_tripbombRadius
extern int32_t g_volumeCnt;
#define gc g_spriteGravity
@ -369,6 +349,14 @@ inline bool PlayerInput(int pl, int bit)
return TEST_SYNC_KEY(g_player[pl].input->bits, bit);
}
enum
{
kHitTypeMask = 0xC000,
//kHitIndexMask = 0x3FFF,
kHitSector = 0x4000,
kHitWall = 0x8000,
kHitSprite = 0xC000,
};
END_DUKE_NS

View File

@ -163,6 +163,13 @@ typedef struct player_struct {
fix16_t q16horiz, q16horizoff;
fix16_t q16ang, oq16ang;
int getang() { return q16ang >> FRACBITS; }
int getoang() { return oq16ang >> FRACBITS; }
void setang(int v) { q16ang = v << FRACBITS; }
void setoang(int v) { oq16ang = v << FRACBITS; }
void addhoriz(int v) { q16horiz += (v << FRACBITS); }
int gethoriz() { return q16horiz >> FRACBITS; }
int32_t truefz, truecz, player_par;
int32_t randomflamex, exitx, exity;
int32_t runspeed, max_player_health, max_shield_amount;
@ -247,6 +254,7 @@ typedef struct player_struct {
int32_t dhat60f, dhat613, dhat617, dhat61b, dhat61f;
int8_t crouch_toggle;
int SlotWin;
int8_t padding_[3];
} DukePlayer_t;
@ -258,6 +266,7 @@ typedef struct player_struct {
#define heat_amount inv_amount[GET_HEATS]
#define scuba_amount inv_amount[GET_SCUBA]
#define boot_amount inv_amount[GET_BOOTS]
#define raat609 level_end_timer // name in RRGDX is 'MamaEnd'
// KEEPINSYNC lunatic/_defs_game.lua
@ -350,6 +359,10 @@ extern int32_t ticrandomseed;
#define SHOOT_HARDCODED_ZVEL INT32_MIN
int A_Shoot(int spriteNum, int projecTile);
inline int shoot(int s, int p)
{
return A_Shoot(s, p);
}
static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
{
@ -359,6 +372,14 @@ static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_
pPlayer->pals.b = b;
}
inline void SetPlayerPal(DukePlayer_t* pPlayer, PalEntry pe)
{
pPlayer->pals.f = pe.a;
pPlayer->pals.r = pe.r;
pPlayer->pals.g = pe.g;
pPlayer->pals.b = pe.b;
}
void P_AddKills(DukePlayer_t * pPlayer, uint16_t kills);
int32_t A_GetHitscanRange(int spriteNum);
void P_GetInput(int playerNum);
@ -367,7 +388,12 @@ void P_GetInputBoat(int playerNum);
void sub_299C0(void);
void P_DHGetInput(int const playerNum);
void P_AddAmmo(DukePlayer_t * pPlayer, int weaponNum, int addAmount);
inline void addammo(int weaponNum, DukePlayer_t* pPlayer, int addAmount)
{
P_AddAmmo(pPlayer, weaponNum, addAmount);
}
void P_AddWeapon(DukePlayer_t *pPlayer, int weaponNum);
void addweapon(DukePlayer_t* pPlayer, int weaponNum);
void P_CheckWeapon(DukePlayer_t *pPlayer);
void P_DisplayScuba(void);
void P_DisplayWeapon(void);

View File

@ -37,6 +37,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS
void lava_cleararrays();
void addjaildoor(int p1, int p2, int iht, int jlt, int p3, int h);
void addminecart(int p1, int p2, int i, int iht, int p3, int childsectnum);
void addtorch(int i);
void addlightning(int i);
static int32_t g_whichPalForPlayer = 9;
static uint8_t precachehightile[2][MAXTILES>>3];
@ -1001,7 +1008,7 @@ void P_ResetStatus(int playerNum)
pPlayer->drug_stat[2] = 0;
pPlayer->drug_aspect = 0;
}
A_ResetLanePics();
resetlanepics();
if (!g_netServer && numplayers < 2)
{
g_ufoSpawn = min(RRRA ? 3 : (ud.m_player_skill*4+1), 32);
@ -1092,7 +1099,7 @@ void P_ResetInventory(int playerNum)
pPlayer->hbomb_offset = 0;
pPlayer->recoil = 0;
pPlayer->yehaa_timer = 0;
A_ResetLanePics();
resetlanepics();
if (!g_netServer && numplayers < 2)
{
g_ufoSpawn = min(ud.m_player_skill*4+1, 32);
@ -1211,7 +1218,7 @@ static void resetprestat(int playerNum, int gameMode)
pPlayer->hbomb_offset = 0;
pPlayer->recoil = 0;
pPlayer->yehaa_timer = 0;
A_ResetLanePics();
resetlanepics();
if (!g_netServer && numplayers < 2)
{
g_ufoSpawn = min(ud.m_player_skill*4+1, 32);
@ -1268,10 +1275,9 @@ static void prelevel(char g)
{
G_SetFog(0);
g_fogType = 0;
g_ufoSpawnMinion = 0;
ufospawnsminion = 0;
g_pistonSound = 0;
g_slotWin = 0;
g_changeEnemySize = 0;
enemysizecheat = 0;
g_player[myconnectindex].ps->level_end_timer = 0;
g_mamaSpawnCnt = 15;
g_banjoSong = 0;
@ -1282,6 +1288,7 @@ static void prelevel(char g)
{
DukePlayer_t *ps = g_player[playerNum].ps;
ps->sea_sick_stat = 0;
ps->SlotWin = 0;
if (ud.level_number == 4 && ud.volume_number == 1)
ps->inv_amount[GET_STEROIDS] = 0;
}
@ -1308,11 +1315,8 @@ static void prelevel(char g)
resetprestat(0,g);
if (RR)
{
g_lightninCnt = 0;
g_torchCnt = 0;
lava_cleararrays();
g_geoSectorCnt = 0;
g_jailDoorCnt = 0;
g_mineCartCnt = 0;
g_ambientCnt = 0;
g_thunderOn = 0;
g_chickenPlant = 0;
@ -1382,24 +1386,15 @@ static void prelevel(char g)
{
if (sector[i].hitag == sector[j].hitag && i != j)
{
if (g_jailDoorCnt >= 32)
G_GameExit("\nToo many jaildoor sectors");
g_jailDoorDist[g_jailDoorCnt] = p1;
g_jailDoorSpeed[g_jailDoorCnt] = p2;
g_jailDoorSecHitag[g_jailDoorCnt] = sector[i].hitag;
g_jailDoorSect[g_jailDoorCnt] = j;
g_jailDoorDrag[g_jailDoorCnt] = 0;
g_jailDoorOpen[g_jailDoorCnt] = 0;
g_jailDoorDir[g_jailDoorCnt] = sector[j].lotag;
g_jailDoorSound[g_jailDoorCnt] = p3;
g_jailDoorCnt++;
}
addjaildoor(p1, p2, sector[i].hitag, sector[j].lotag, p3, j);
}
}
break;
}
case 42:
{
if (!RR) break;
int childsectnum = -1;
int k = headspritesect[i];
while (k != -1)
{
@ -1413,7 +1408,7 @@ static void prelevel(char g)
if (sprite[kk].picnum == TILE_RRTILE66)
if (sprite[kk].lotag == sprite[k].sectnum)
{
g_mineCartChildSect[g_mineCartCnt] = sprite[kk].sectnum;
childsectnum = sprite[kk].sectnum;
A_DeleteSprite(kk);
}
}
@ -1426,16 +1421,7 @@ static void prelevel(char g)
}
k = nexti;
}
if (g_mineCartCnt >= 16)
G_GameExit("\nToo many minecart sectors");
g_mineCartDist[g_mineCartCnt] = p1;
g_mineCartSpeed[g_mineCartCnt] = p2;
g_mineCartSect[g_mineCartCnt] = i;
g_mineCartDir[g_mineCartCnt] = sector[i].hitag;
g_mineCartDrag[g_mineCartCnt] = p1;
g_mineCartOpen[g_mineCartCnt] = 1;
g_mineCartSound[g_mineCartCnt] = p3;
g_mineCartCnt++;
addminecart(p1, p2, i, sector[i].hitag, p3, childsectnum);
break;
}
case ST_20_CEILING_DOOR:
@ -1523,21 +1509,12 @@ static void prelevel(char g)
case RRTILE18__STATICRR:
if (!RR) break;
if (g_torchCnt >= 64)
G_GameExit("\nToo many torch effects");
g_torchSector[g_torchCnt] = SECT(i);
g_torchSectorShade[g_torchCnt] = sector[SECT(i)].floorshade;
g_torchType[g_torchCnt] = SLT(i);
g_torchCnt++;
addtorch(i);
A_DeleteSprite(i);
break;
case RRTILE35__STATICRR:
if (g_lightninCnt >= 64)
G_GameExit("\nToo many lightnin effects");
g_lightninSector[g_lightninCnt] = SECT(i);
g_lightninSectorShade[g_lightninCnt] = sector[SECT(i)].floorshade;
g_lightninCnt++;
addlightning(i);
A_DeleteSprite(i);
break;

View File

@ -901,28 +901,8 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &g_spriteExtra[0], sizeof(g_spriteExtra[0]), MAXSPRITES },
{ 0, &g_sectorExtra[0], sizeof(g_sectorExtra[0]), MAXSECTORS },
{ 0, &g_jailDoorSecHitag[0], sizeof(g_jailDoorSecHitag[0]), ARRAY_SIZE(g_jailDoorSecHitag) },
{ 0, &g_jailDoorSect[0], sizeof(g_jailDoorSect[0]), ARRAY_SIZE(g_jailDoorSect) },
{ 0, &g_jailDoorOpen[0], sizeof(g_jailDoorOpen[0]), ARRAY_SIZE(g_jailDoorOpen) },
{ 0, &g_jailDoorDir[0], sizeof(g_jailDoorDir[0]), ARRAY_SIZE(g_jailDoorDir) },
{ 0, &g_jailDoorDrag[0], sizeof(g_jailDoorDrag[0]), ARRAY_SIZE(g_jailDoorDrag) },
{ 0, &g_jailDoorDist[0], sizeof(g_jailDoorDist[0]), ARRAY_SIZE(g_jailDoorDist) },
{ 0, &g_jailDoorSpeed[0], sizeof(g_jailDoorSpeed[0]), ARRAY_SIZE(g_jailDoorSpeed) },
{ 0, &g_jailDoorSound[0], sizeof(g_jailDoorSound[0]), ARRAY_SIZE(g_jailDoorSound) },
{ 0, &g_jailDoorCnt, sizeof(g_jailDoorCnt), 1 },
{ 0, &g_shadedSector[0], sizeof(g_shadedSector[0]), MAXSECTORS },
{ 0, &g_mineCartSect[0], sizeof(g_mineCartSect[0]), ARRAY_SIZE(g_mineCartSect) },
{ 0, &g_mineCartChildSect[0], sizeof(g_mineCartChildSect[0]), ARRAY_SIZE(g_mineCartChildSect) },
{ 0, &g_mineCartOpen[0], sizeof(g_mineCartOpen[0]), ARRAY_SIZE(g_mineCartOpen) },
{ 0, &g_mineCartDir[0], sizeof(g_mineCartDir[0]), ARRAY_SIZE(g_mineCartDir) },
{ 0, &g_mineCartDrag[0], sizeof(g_mineCartDrag[0]), ARRAY_SIZE(g_mineCartDrag) },
{ 0, &g_mineCartDist[0], sizeof(g_mineCartDist[0]), ARRAY_SIZE(g_mineCartDist) },
{ 0, &g_mineCartSpeed[0], sizeof(g_mineCartSpeed[0]), ARRAY_SIZE(g_mineCartSpeed) },
{ 0, &g_mineCartSound[0], sizeof(g_mineCartSound[0]), ARRAY_SIZE(g_mineCartSound) },
{ 0, &g_mineCartCnt, sizeof(g_mineCartCnt), 1 },
{ 0, &g_ambientCnt, sizeof(g_ambientCnt), 1 },
{ 0, &g_ambientHitag[0], sizeof(g_ambientHitag[0]), ARRAY_SIZE(g_ambientHitag) },
{ 0, &g_ambientLotag[0], sizeof(g_ambientLotag[0]), ARRAY_SIZE(g_ambientLotag) },
@ -932,15 +912,6 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &g_hulkSpawn, sizeof(g_hulkSpawn), 1 },
{ 0, &g_lastLevel, sizeof(g_lastLevel), 1 },
{ 0, &g_torchSector[0], sizeof(g_torchSector[0]), ARRAY_SIZE(g_torchSector) },
{ 0, &g_torchSectorShade[0], sizeof(g_torchSectorShade[0]), ARRAY_SIZE(g_torchSectorShade) },
{ 0, &g_torchType[0], sizeof(g_torchType[0]), ARRAY_SIZE(g_torchType) },
{ 0, &g_torchCnt, sizeof(g_torchCnt), 1 },
{ 0, &g_lightninSector[0], sizeof(g_lightninSector[0]), ARRAY_SIZE(g_lightninSector) },
{ 0, &g_lightninSectorShade[0], sizeof(g_lightninSectorShade[0]), ARRAY_SIZE(g_lightninSectorShade) },
{ 0, &g_lightninCnt, sizeof(g_lightninCnt), 1 },
{ 0, &g_geoSector[0], sizeof(g_geoSector[0]), ARRAY_SIZE(g_geoSector) },
{ 0, &g_geoSectorWarp[0], sizeof(g_geoSectorWarp[0]), ARRAY_SIZE(g_geoSectorWarp) },
{ 0, &g_geoSectorX[0], sizeof(g_geoSectorX[0]), ARRAY_SIZE(g_geoSectorX) },
@ -958,9 +929,8 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &g_bellTime, sizeof(g_bellTime), 1 },
{ 0, &g_bellSprite, sizeof(g_bellSprite), 1 },
{ 0, &g_changeEnemySize, sizeof(g_changeEnemySize), 1 },
{ 0, &g_slotWin, sizeof(g_slotWin), 1 },
{ 0, &g_ufoSpawnMinion, sizeof(g_ufoSpawnMinion), 1 },
{ 0, &enemysizecheat, sizeof(enemysizecheat), 1 },
{ 0, &ufospawnsminion, sizeof(ufospawnsminion), 1 },
{ 0, &g_pistonSound, sizeof(g_pistonSound), 1 },
{ 0, &g_chickenWeaponTimer, sizeof(g_chickenWeaponTimer), 1 },
{ 0, &g_RAendLevel, sizeof(g_RAendLevel), 1 },

View File

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS
// PRIMITIVE
void operatejaildoors(int hitag);
static int g_haltSoundHack = 0;
@ -682,26 +683,7 @@ void G_OperateSectors(int sectNum, int spriteNum)
{
case 41:
if (!RR) break;
for (bsize_t i = 0; i < g_jailDoorCnt; i++)
{
if (g_jailDoorSecHitag[i] == pSector->hitag)
{
if (g_jailDoorOpen[i] == 0)
{
g_jailDoorOpen[i] = 1;
g_jailDoorDrag[i] = g_jailDoorDist[i];
if (!RRRA || g_jailDoorSound[i] != 0)
A_CallSound2(g_jailDoorSound[i], screenpeek);
}
if (g_jailDoorOpen[i] == 2)
{
g_jailDoorOpen[i] = 3;
g_jailDoorDrag[i] = g_jailDoorDist[i];
if (!RRRA || g_jailDoorSound[i] != 0)
A_CallSound2(g_jailDoorSound[i], screenpeek);
}
}
}
operatejaildoors(pSector->hitag);
break;
case 7:
{
@ -4919,418 +4901,5 @@ void G_DoFurniture(int wallNum, int sectNum, int playerNum)
}
}
void G_DoTorch(void)
{
int j;
int startWall, endWall;
int randNum = rand()&8;
for (bsize_t i = 0; i < g_torchCnt; i++)
{
int shade = g_torchSectorShade[i] - randNum;
switch (g_torchType[i])
{
case 0:
sector[g_torchSector[i]].floorshade = shade;
sector[g_torchSector[i]].ceilingshade = shade;
break;
case 1:
sector[g_torchSector[i]].ceilingshade = shade;
break;
case 2:
sector[g_torchSector[i]].floorshade = shade;
break;
case 4:
sector[g_torchSector[i]].ceilingshade = shade;
break;
case 5:
sector[g_torchSector[i]].floorshade = shade;
break;
}
startWall = sector[g_torchSector[i]].wallptr;
endWall = startWall + sector[g_torchSector[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
{
if (wall[j].lotag != 1)
{
switch (g_torchType[i])
{
case 0:
wall[j].shade = shade;
break;
case 1:
wall[j].shade = shade;
break;
case 2:
wall[j].shade = shade;
break;
case 3:
wall[j].shade = shade;
break;
}
}
}
}
}
void G_DoJailDoor(void)
{
int j;
int32_t speed;
int startWall, endWall;
for (bsize_t i = 0; i < g_jailDoorCnt; i++)
{
speed = g_jailDoorSpeed[i];
if (speed < 2)
speed = 2;
if (g_jailDoorOpen[i] == 1)
{
g_jailDoorDrag[i] -= speed;
if (g_jailDoorDrag[i] <= 0)
{
g_jailDoorDrag[i] = 0;
g_jailDoorOpen[i] = 2;
switch (g_jailDoorDir[i])
{
case 10:
g_jailDoorDir[i] = 30;
break;
case 20:
g_jailDoorDir[i] = 40;
break;
case 30:
g_jailDoorDir[i] = 10;
break;
case 40:
g_jailDoorDir[i] = 20;
break;
}
}
else
{
startWall = sector[g_jailDoorSect[i]].wallptr;
endWall = startWall + sector[g_jailDoorSect[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
{
int32_t x, y;
x = wall[j].x;
y = wall[j].y;
switch (g_jailDoorDir[i])
{
case 10:
y += speed;
break;
case 20:
x -= speed;
break;
case 30:
y -= speed;
break;
case 40:
x += speed;
break;
}
dragpoint(j, x, y, 0);
}
}
}
if (g_jailDoorOpen[i] == 3)
{
g_jailDoorDrag[i] -= speed;
if (g_jailDoorDrag[i] <= 0)
{
g_jailDoorDrag[i] = 0;
g_jailDoorOpen[i] = 0;
switch (g_jailDoorDir[i])
{
case 10:
g_jailDoorDir[i] = 30;
break;
case 20:
g_jailDoorDir[i] = 40;
break;
case 30:
g_jailDoorDir[i] = 10;
break;
case 40:
g_jailDoorDir[i] = 20;
break;
}
}
else
{
startWall = sector[g_jailDoorSect[i]].wallptr;
endWall = startWall + sector[g_jailDoorSect[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
{
int32_t x, y;
x = wall[j].x;
y = wall[j].y;
switch (g_jailDoorDir[i])
{
case 10:
y += speed;
break;
case 20:
x -= speed;
break;
case 30:
y -= speed;
break;
case 40:
x += speed;
break;
}
dragpoint(j, x, y, 0);
}
}
}
}
}
void G_MoveMineCart(void)
{
int j, nextj;
int startWall, endWall;
int32_t speed;
int32_t max_x, min_x, max_y, min_y, cx, cy;
for (bsize_t i = 0; i < g_mineCartCnt; i++)
{
speed = g_mineCartSpeed[i];
if (speed < 2)
speed = 2;
if (g_mineCartOpen[i] == 1)
{
g_mineCartDrag[i] -= speed;
if (g_mineCartDrag[i] <= 0)
{
g_mineCartDrag[i] = g_mineCartDist[i];
g_mineCartOpen[i] = 2;
switch (g_mineCartDir[i])
{
case 10:
g_mineCartDir[i] = 30;
break;
case 20:
g_mineCartDir[i] = 40;
break;
case 30:
g_mineCartDir[i] = 10;
break;
case 40:
g_mineCartDir[i] = 20;
break;
}
}
else
{
startWall = sector[g_mineCartSect[i]].wallptr;
endWall = startWall + sector[g_mineCartSect[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
{
int32_t x, y;
x = wall[j].x;
y = wall[j].y;
switch (g_mineCartDir[i])
{
case 10:
y += speed;
break;
case 20:
x -= speed;
break;
case 30:
y -= speed;
break;
case 40:
x += speed;
break;
}
dragpoint(j, x, y, 0);
}
}
}
if (g_mineCartOpen[i] == 2)
{
g_mineCartDrag[i] -= speed;
if (g_mineCartDrag[i] <= 0)
{
g_mineCartDrag[i] = g_mineCartDist[i];
g_mineCartOpen[i] = 1;
switch (g_mineCartDir[i])
{
case 10:
g_mineCartDir[i] = 30;
break;
case 20:
g_mineCartDir[i] = 40;
break;
case 30:
g_mineCartDir[i] = 10;
break;
case 40:
g_mineCartDir[i] = 20;
break;
}
}
else
{
startWall = sector[g_mineCartSect[i]].wallptr;
endWall = startWall + sector[g_mineCartSect[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
{
int32_t x, y;
x = wall[j].x;
y = wall[j].y;
switch (g_mineCartDir[i])
{
case 10:
y += speed;
break;
case 20:
x -= speed;
break;
case 30:
y -= speed;
break;
case 40:
x += speed;
break;
}
dragpoint(j, x, y, 0);
}
}
}
startWall = sector[g_mineCartChildSect[i]].wallptr;
endWall = startWall + sector[g_mineCartChildSect[i]].wallnum - 1;
max_x = max_y = -(2<<16);
min_x = min_y = 2<<16;
for (j = startWall; j <= endWall; j++)
{
if (max_x < wall[j].x)
max_x = wall[j].x;
if (max_y < wall[j].y)
max_y = wall[j].y;
if (min_x > wall[j].x)
min_x = wall[j].x;
if (min_y > wall[j].y)
min_y = wall[j].y;
}
cx = (max_x + min_x) >> 1;
cy = (max_y + min_y) >> 1;
j = headspritesect[g_mineCartChildSect[i]];
vec3_t pos;
pos.x = cx;
pos.y = cy;
while (j != -1)
{
nextj = nextspritesect[j];
pos.z = sprite[j].z;
if (A_CheckEnemySprite(&sprite[j]))
setsprite(j,&pos);
j = nextj;
}
}
}
void G_Thunder(void)
{
static int32_t brightness;
int j;
int startWall, endWall;
uint8_t shade;
bsize_t i = 0;
if (!g_thunderFlash)
{
if ((gotpic[TILE_RRTILE2577>>3]&(1<<(TILE_RRTILE2577&7))))
{
gotpic[TILE_RRTILE2577>>3] &= ~(1<<(TILE_RRTILE2577&7));
if (tilePtr(TILE_RRTILE2577) != nullptr) // why does this on texture load state???
{
g_visibility = 256;
if (krand2() > 65000)
{
g_thunderTime = 256;
g_thunderFlash = 1;
S_PlaySound(351+(rand()%3));
}
}
}
else
{
brightness = 0;
g_visibility = g_player[screenpeek].ps->visibility;
}
}
else
{
g_thunderTime -= 4;
if (g_thunderTime < 0)
{
brightness = 0;
g_thunderFlash = 0;
videoSetBrightness(0);
g_visibility = g_player[screenpeek].ps->visibility;
}
}
if (!g_winderFlash)
{
if ((gotpic[TILE_RRTILE2562>>3]&(1<<(TILE_RRTILE2562&7))))
{
gotpic[TILE_RRTILE2562>>3] &= ~(1<<(TILE_RRTILE2562&7));
if (tilePtr(TILE_RRTILE2562) != nullptr) // why does this on texture load state???
{
if (krand2() > 65000)
{
g_winderTime = 128;
g_winderFlash = 1;
S_PlaySound(351+(rand()%3));
}
}
}
}
else
{
g_winderFlash -= 4;
if (g_winderTime < 0)
{
g_winderFlash = 0;
for (i = 0; i < g_lightninCnt; i++)
{
sector[g_lightninSector[i]].floorshade = g_lightninSectorShade[i];
sector[g_lightninSector[i]].ceilingshade = g_lightninSectorShade[i];
startWall = sector[g_lightninSector[i]].wallptr;
endWall = startWall + sector[g_lightninSector[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
wall[j].shade = g_lightninSectorShade[i];
}
}
}
if (g_thunderFlash == 1)
{
brightness += krand2()&4;
g_visibility = 2048;
if (brightness > 8)
brightness = 0;
videoSetBrightness(brightness);
}
if (g_winderFlash == 1)
{
if (i >= MAXTORCHSECTORS)
i = MAXTORCHSECTORS - 1;
shade = g_torchSectorShade[i]+(krand2()&8);
for (i = 0; i < g_lightninCnt; i++)
{
sector[g_lightninSector[i]].floorshade = g_lightninSectorShade[i] - shade;
sector[g_lightninSector[i]].ceilingshade = g_lightninSectorShade[i] - shade;
startWall = sector[g_lightninSector[i]].wallptr;
endWall = startWall + sector[g_lightninSector[i]].wallnum - 1;
for (j = startWall; j <= endWall; j++)
wall[j].shade = g_lightninSectorShade[i] - shade;
}
}
}
END_DUKE_NS

View File

@ -146,6 +146,10 @@ inline void operateactivators(int l, int w)
G_OperateActivators(l, w);
}
void G_OperateForceFields(int spriteNum,int wallTag);
inline void operateforcefields(int s, int w)
{
G_OperateForceFields(s, w);
}
void G_OperateMasterSwitches(int lotag);
inline void operatemasterswitches(int l)
{
@ -159,6 +163,10 @@ inline void operatesectors(int s, int i)
}
void P_HandleSharedKeys(int playerNum);
int GetAnimationGoal(const int32_t *animPtr);
inline int getanimationgoal(const int32_t* animPtr)
{
return GetAnimationGoal(animPtr);
}
int isanearoperator(int lotag);
int isanunderoperator(int lotag);
int P_ActivateSwitch(int playerNum, int wallOrSprite, int nSwitchType);
@ -166,11 +174,12 @@ void P_CheckSectors(int playerNum);
void Sect_DamageCeiling(int sectNum);
inline void checkhitceiling(int sec) { Sect_DamageCeiling(sec); }
int SetAnimation(int sectNum,int32_t *animPtr,int goalVal,int animVel);
inline int setanimation(int sectNum, int32_t* animPtr, int goalVal, int animVel)
{
return SetAnimation(sectNum, animPtr, goalVal, animVel);
}
void G_DoFurniture(int wallNum, int sectNum, int playerNum);
void G_DoTorch(void);
void G_DoJailDoor(void);
void G_MoveMineCart(void);
void G_Thunder(void);
void dotorch();
#define FORCEFIELD_CSTAT (64+16+4+1)

View File

@ -416,3 +416,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define BELLSND 395
#define GOAWAY 396
#define JOKE 397
#define FLAMETHROWER_INTRO 398
#define FLAMETHROWER_LOOP 399
#define FLAMETHROWER_END= 400
#define E5L7_DUKE_QUIT_YOU 401

View File

@ -68,6 +68,10 @@ int S_TryPlaySpecialMusic(unsigned int);
void S_PlaySpecialMusicOrNothing(unsigned int);
void S_ContinueLevelMusic(void);
int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0);
inline int sound(int num)
{
return S_PlaySound(num);
}
int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos, int channel = CHAN_AUTO, EChanFlags flags = 0);
void S_StopEnvSound(int sndNum,int sprNum, int flags = -1);
void S_Update(void);