mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- movestandables - old code not removed yet. Plus some World Tour handling.
This commit is contained in:
parent
8d42055dd7
commit
9104fda1a0
10 changed files with 1570 additions and 272 deletions
|
@ -110,8 +110,9 @@ enum
|
|||
GAMEFLAG_POWERSLAVE = 0x00002000,
|
||||
GAMEFLAG_EXHUMED = 0x00004000,
|
||||
GAMEFLAG_PSEXHUMED = GAMEFLAG_POWERSLAVE | GAMEFLAG_EXHUMED, // the two games really are the same, except for the name and the publisher.
|
||||
GAMEFLAG_STANDALONE = 0x00008000,
|
||||
GAMEFLAGMASK = 0x00007FFF, // flags allowed from grpinfo
|
||||
GAMEFLAG_WORLDTOUR = 0x00008000,
|
||||
GAMEFLAG_STANDALONE = 0x00010000,
|
||||
GAMEFLAGMASK = 0x0000FFFF, // flags allowed from grpinfo
|
||||
|
||||
};
|
||||
|
||||
|
@ -169,6 +170,11 @@ inline bool isRRRA()
|
|||
return g_gameType & (GAMEFLAG_RRRA);
|
||||
}
|
||||
|
||||
inline bool isWorldTour()
|
||||
{
|
||||
return g_gameType & GAMEFLAG_WORLDTOUR;
|
||||
}
|
||||
|
||||
TArray<GrpEntry> GrpScan();
|
||||
void S_PauseSound(bool notmusic, bool notsfx);
|
||||
void S_ResumeSound(bool notsfx);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,6 +36,7 @@ BEGIN_DUKE_NS
|
|||
#define ZOFFSET4 (12<<8)
|
||||
#define ZOFFSET5 (32<<8)
|
||||
#define ZOFFSET6 (4<<8)
|
||||
#define FOURSLEIGHT ZOFFSET
|
||||
|
||||
#define ACTOR_MAXFALLINGZVEL 6144
|
||||
#define ACTOR_ONWATER_ADDZ (24<<8)
|
||||
|
@ -138,7 +139,11 @@ typedef struct
|
|||
struct { int bposx, bposy, bposz; };
|
||||
};
|
||||
int32_t floorz, ceilingz; // 8b
|
||||
vec2_t lastv; // 8b
|
||||
union
|
||||
{
|
||||
vec2_t lastv; // 8b
|
||||
struct { int lastvx, lastvy; };
|
||||
};
|
||||
int16_t picnum, ang, extra, owner; // 8b
|
||||
int16_t movflag, tempang, timetosleep; // 6b
|
||||
int16_t actorstayput; // 2b
|
||||
|
|
|
@ -393,270 +393,9 @@ static fix16_t P_GetQ16AngleDeltaForTic(DukePlayer_t const *pPlayer)
|
|||
}
|
||||
|
||||
void moveplayers();
|
||||
|
||||
ACTOR_STATIC void G_MoveFX(void)
|
||||
{
|
||||
int spriteNum = headspritestat[STAT_FX];
|
||||
|
||||
while (spriteNum >= 0)
|
||||
{
|
||||
spritetype *const pSprite = &sprite[spriteNum];
|
||||
int const nextSprite = nextspritestat[spriteNum];
|
||||
|
||||
switch (DYNAMICTILEMAP(pSprite->picnum))
|
||||
{
|
||||
case RESPAWN__STATIC:
|
||||
if (pSprite->extra == 66)
|
||||
{
|
||||
int32_t j = A_Spawn(spriteNum,SHT(spriteNum));
|
||||
if (RRRA)
|
||||
{
|
||||
sprite[j].pal = pSprite->pal;
|
||||
if (sprite[j].picnum == TILE_MAMA)
|
||||
{
|
||||
switch (sprite[j].pal)
|
||||
{
|
||||
case 30:
|
||||
sprite[j].xrepeat = sprite[j].yrepeat = 26;
|
||||
sprite[j].clipdist = 75;
|
||||
break;
|
||||
case 31:
|
||||
sprite[j].xrepeat = sprite[j].yrepeat = 36;
|
||||
sprite[j].clipdist = 100;
|
||||
break;
|
||||
default:
|
||||
sprite[j].xrepeat = sprite[j].yrepeat = 50;
|
||||
sprite[j].clipdist = 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sprite[j].pal == 8)
|
||||
sprite[j].cstat |= 2;
|
||||
else if (sprite[j].pal == 6)
|
||||
{
|
||||
pSprite->extra = 66-13;
|
||||
sprite[j].pal = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// sprite[j].pal = sprite[i].pal;
|
||||
DELETE_SPRITE_AND_CONTINUE(spriteNum);
|
||||
}
|
||||
else if (pSprite->extra > (66-13))
|
||||
sprite[spriteNum].extra++;
|
||||
break;
|
||||
|
||||
case MUSICANDSFX__STATIC:
|
||||
{
|
||||
int32_t const spriteHitag = (uint16_t)pSprite->hitag;
|
||||
DukePlayer_t *const pPlayer = g_player[screenpeek].ps;
|
||||
|
||||
if (T2(spriteNum) != (int)SoundEnabled())
|
||||
{
|
||||
// If sound playback was toggled, restart.
|
||||
T2(spriteNum) = SoundEnabled();
|
||||
T1(spriteNum) = 0;
|
||||
}
|
||||
|
||||
if (pSprite->lotag >= 1000 && pSprite->lotag < 2000)
|
||||
{
|
||||
int32_t playerDist = ldist(&sprite[pPlayer->i], pSprite);
|
||||
|
||||
#ifdef SPLITSCREEN_MOD_HACKS
|
||||
if (g_fakeMultiMode==2)
|
||||
{
|
||||
// HACK for splitscreen mod
|
||||
int32_t otherdist = ldist(&sprite[g_player[1].ps->i],pSprite);
|
||||
playerDist = min(playerDist, otherdist);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (playerDist < spriteHitag && T1(spriteNum) == 0)
|
||||
{
|
||||
FX_SetReverb(pSprite->lotag - 1000);
|
||||
T1(spriteNum) = 1;
|
||||
}
|
||||
else if (playerDist >= spriteHitag && T1(spriteNum) == 1)
|
||||
{
|
||||
FX_SetReverb(0);
|
||||
T1(spriteNum) = 0;
|
||||
}
|
||||
}
|
||||
else if (pSprite->lotag < 999 && (unsigned)sector[pSprite->sectnum].lotag < 9 && // ST_9_SLIDING_ST_DOOR
|
||||
snd_ambience && sector[SECT(spriteNum)].floorz != sector[SECT(spriteNum)].ceilingz)
|
||||
{
|
||||
auto flags = S_GetUserFlags(pSprite->lotag);
|
||||
if (flags & SF_MSFX)
|
||||
{
|
||||
int playerDist = dist(&sprite[pPlayer->i], pSprite);
|
||||
|
||||
#ifdef SPLITSCREEN_MOD_HACKS
|
||||
if (g_fakeMultiMode==2)
|
||||
{
|
||||
// HACK for splitscreen mod
|
||||
int32_t otherdist = dist(&sprite[g_player[1].ps->i],pSprite);
|
||||
playerDist = min(playerDist, otherdist);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (playerDist < spriteHitag && T1(spriteNum) == 0)// && FX_VoiceAvailable(g_sounds[pSprite->lotag].pr-1))
|
||||
{
|
||||
// Start playing an ambience sound.
|
||||
#if 0 // let the sound system handle this internally.
|
||||
if (g_numEnvSoundsPlaying == snd_numvoices)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
for (SPRITES_OF(STAT_FX, j))
|
||||
if (j != spriteNum && S_IsAmbientSFX(j) && actor[j].t_data[0] == 1 &&
|
||||
dist(&sprite[j], &sprite[pPlayer->i]) > playerDist)
|
||||
{
|
||||
S_StopEnvSound(sprite[j].lotag,j);
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == -1)
|
||||
goto next_sprite;
|
||||
}
|
||||
#endif
|
||||
A_PlaySound(pSprite->lotag, spriteNum, CHAN_AUTO, CHANF_LOOP);
|
||||
T1(spriteNum) = 1; // AMBIENT_SFX_PLAYING
|
||||
}
|
||||
else if (playerDist >= spriteHitag && T1(spriteNum) == 1)
|
||||
{
|
||||
// Stop playing ambience sound because we're out of its range.
|
||||
|
||||
// T1 will be reset in sounds.c: CLEAR_SOUND_T0
|
||||
// T1 = 0;
|
||||
S_StopEnvSound(pSprite->lotag,spriteNum);
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & (SF_GLOBAL | SF_DTAG)) == SF_GLOBAL)
|
||||
{
|
||||
// Randomly playing global sounds (flyby of planes, screams, ...)
|
||||
|
||||
if (T5(spriteNum) > 0)
|
||||
T5(spriteNum)--;
|
||||
else
|
||||
{
|
||||
for (int TRAVERSE_CONNECT(playerNum))
|
||||
if (playerNum == myconnectindex && g_player[playerNum].ps->cursectnum == pSprite->sectnum)
|
||||
{
|
||||
S_PlaySound(pSprite->lotag + (unsigned)g_globalRandom % (pSprite->hitag+1));
|
||||
T5(spriteNum) = GAMETICSPERSEC*40 + g_globalRandom%(GAMETICSPERSEC*40);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
next_sprite:
|
||||
spriteNum = nextSprite;
|
||||
}
|
||||
}
|
||||
|
||||
ACTOR_STATIC void G_MoveFallers(void)
|
||||
{
|
||||
int spriteNum = headspritestat[STAT_FALLER];
|
||||
|
||||
while (spriteNum >= 0)
|
||||
{
|
||||
int const nextSprite = nextspritestat[spriteNum];
|
||||
spritetype *const pSprite = &sprite[spriteNum];
|
||||
int const sectNum = pSprite->sectnum;
|
||||
|
||||
if (T1(spriteNum) == 0)
|
||||
{
|
||||
const int16_t oextra = pSprite->extra;
|
||||
int j;
|
||||
|
||||
pSprite->z -= ZOFFSET2;
|
||||
T2(spriteNum) = pSprite->ang;
|
||||
|
||||
if ((j = A_IncurDamage(spriteNum)) >= 0)
|
||||
{
|
||||
if ((!RR && j == TILE_FIREEXT) || j == TILE_RPG || (RRRA && j == TILE_RPG2) || j == TILE_RADIUSEXPLOSION || j == TILE_SEENINE || j == TILE_OOZFILTER)
|
||||
{
|
||||
if (pSprite->extra <= 0)
|
||||
{
|
||||
T1(spriteNum) = 1;
|
||||
|
||||
for (bssize_t SPRITES_OF(STAT_FALLER, j))
|
||||
{
|
||||
if (sprite[j].hitag == SHT(spriteNum))
|
||||
{
|
||||
actor[j].t_data[0] = 1;
|
||||
sprite[j].cstat &= (65535-64);
|
||||
if (sprite[j].picnum == TILE_CEILINGSTEAM || sprite[j].picnum == TILE_STEAM)
|
||||
sprite[j].cstat |= 32768;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actor[spriteNum].extra = 0;
|
||||
pSprite->extra = oextra;
|
||||
}
|
||||
}
|
||||
pSprite->ang = T2(spriteNum);
|
||||
pSprite->z += ZOFFSET2;
|
||||
}
|
||||
else if (T1(spriteNum) == 1)
|
||||
{
|
||||
if ((int16_t)pSprite->lotag > 0)
|
||||
{
|
||||
pSprite->lotag-=3;
|
||||
if (RR)
|
||||
{
|
||||
pSprite->xvel = (64+krand2())&127;
|
||||
pSprite->zvel = -(1024+(krand2()&1023));
|
||||
}
|
||||
else if ((int16_t)pSprite->lotag <= 0)
|
||||
{
|
||||
pSprite->xvel = (32+krand2())&63;
|
||||
pSprite->zvel = -(1024+(krand2()&1023));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t spriteGravity = g_spriteGravity;
|
||||
|
||||
if (pSprite->xvel > 0)
|
||||
{
|
||||
pSprite->xvel -= RR ? 2 : 8;
|
||||
A_SetSprite(spriteNum,CLIPMASK0);
|
||||
}
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceFloor(pSprite->sectnum)))
|
||||
spriteGravity = 0;
|
||||
else if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceCeiling(pSprite->sectnum)))
|
||||
spriteGravity = g_spriteGravity / 6;
|
||||
|
||||
if (pSprite->z < (sector[sectNum].floorz-ZOFFSET))
|
||||
{
|
||||
pSprite->zvel += spriteGravity;
|
||||
if (pSprite->zvel > 6144)
|
||||
pSprite->zvel = 6144;
|
||||
pSprite->z += pSprite->zvel;
|
||||
}
|
||||
|
||||
if ((sector[sectNum].floorz-pSprite->z) < ZOFFSET2)
|
||||
{
|
||||
for (size_t x = 0, x_end = 1+(krand2()&7); x < x_end; ++x)
|
||||
RANDOMSCRAP(pSprite, spriteNum);
|
||||
DELETE_SPRITE_AND_CONTINUE(spriteNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next_sprite:
|
||||
spriteNum = nextSprite;
|
||||
}
|
||||
}
|
||||
void movefx();
|
||||
void movefallers();
|
||||
void movestandables();
|
||||
|
||||
ACTOR_STATIC void G_MoveStandables(void)
|
||||
{
|
||||
|
@ -8828,7 +8567,7 @@ void G_MoveWorld(void)
|
|||
}
|
||||
|
||||
moveplayers(); //ST 10
|
||||
G_MoveFallers(); //ST 12
|
||||
movefallers(); //ST 12
|
||||
if (!DEER)
|
||||
G_MoveMisc(); //ST 5
|
||||
|
||||
|
@ -8854,13 +8593,13 @@ void G_MoveWorld(void)
|
|||
if (!DEER)
|
||||
{
|
||||
G_MoveEffectors(); //ST 3
|
||||
G_MoveStandables(); //ST 6
|
||||
movestandables(); //ST 6
|
||||
}
|
||||
|
||||
G_RefreshLights();
|
||||
G_DoSectorAnimations();
|
||||
if (!DEER)
|
||||
G_MoveFX(); //ST 11
|
||||
movefx(); //ST 11
|
||||
|
||||
if (RR && numplayers < 2 && g_thunderOn)
|
||||
G_Thunder();
|
||||
|
|
|
@ -228,6 +228,10 @@ int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z,
|
|||
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
|
||||
#define EGS A_InsertSprite
|
||||
int A_Spawn(int spriteNum,int tileNum);
|
||||
inline int spawn(int s, int t)
|
||||
{
|
||||
return A_Spawn(s, t);
|
||||
}
|
||||
int G_DoMoveThings(void);
|
||||
//int32_t G_EndOfLevel(void);
|
||||
|
||||
|
|
|
@ -86,6 +86,10 @@ inline void makeitfall(int s)
|
|||
}
|
||||
int32_t A_GetFurthestAngle(int spriteNum, int angDiv);
|
||||
void A_GetZLimits(int spriteNum);
|
||||
inline void getglobalz(int s)
|
||||
{
|
||||
A_GetZLimits(s);
|
||||
}
|
||||
int32_t __fastcall G_GetAngleDelta(int32_t currAngle, int32_t newAngle);
|
||||
inline int getincangle(int c, int n)
|
||||
{
|
||||
|
|
|
@ -99,6 +99,10 @@ static FORCE_INLINE void Gv_FillWithVars(T & rv)
|
|||
}
|
||||
|
||||
int Gv_GetVarByLabel(const char *szGameLabel,int defaultValue,int spriteNum,int playerNum);
|
||||
inline int GetGameVar(const char* szGameLabel, int defaultValue, int spriteNum, int playerNum)
|
||||
{
|
||||
return Gv_GetVarByLabel(szGameLabel, defaultValue, spriteNum, playerNum);
|
||||
}
|
||||
void Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags);
|
||||
|
||||
static FORCE_INLINE void A_ResetVars(int const spriteNum)
|
||||
|
|
|
@ -108,6 +108,7 @@ G_EXTERN int32_t g_animWallCnt;
|
|||
G_EXTERN int32_t g_animateCnt;
|
||||
G_EXTERN int32_t g_cloudCnt;
|
||||
G_EXTERN int32_t g_curViewscreen;
|
||||
#define camsprite g_curViewscreen
|
||||
G_EXTERN int32_t g_frameRate;
|
||||
G_EXTERN int32_t g_cyclerCnt;
|
||||
#define numcyclers g_cyclerCnt
|
||||
|
@ -115,9 +116,11 @@ G_EXTERN int32_t g_damageCameras;
|
|||
G_EXTERN int32_t g_defaultLabelCnt;
|
||||
G_EXTERN int32_t g_doQuickSave;
|
||||
G_EXTERN int32_t g_earthquakeTime;
|
||||
#define earthquaketime g_earthquakeTime
|
||||
G_EXTERN int32_t g_freezerSelfDamage;
|
||||
G_EXTERN int32_t g_gameQuit;
|
||||
G_EXTERN int32_t g_globalRandom;
|
||||
#define global_random g_globalRandom
|
||||
G_EXTERN int32_t g_impactDamage;
|
||||
G_EXTERN int32_t g_labelCnt;
|
||||
G_EXTERN int32_t g_maxPlayerHealth;
|
||||
|
@ -268,15 +271,19 @@ extern int32_t g_itemRespawnTime;
|
|||
extern int32_t g_morterRadius;
|
||||
extern int32_t g_numFreezeBounces;
|
||||
extern int32_t g_pipebombRadius;
|
||||
#define pipebombblastradius g_pipebombRadius
|
||||
extern int32_t g_playerFriction;
|
||||
extern int32_t g_rpgRadius;
|
||||
extern int32_t g_scriptSize;
|
||||
extern int32_t g_seenineRadius;
|
||||
#define seenineblastradius g_seenineRadius
|
||||
extern int32_t g_shrinkerRadius;
|
||||
extern int32_t g_spriteGravity;
|
||||
extern int32_t g_timerTicsPerSecond;
|
||||
extern int32_t g_tripbombRadius;
|
||||
#define tripbombblastradius g_tripbombRadius
|
||||
extern int32_t g_volumeCnt;
|
||||
#define gc g_spriteGravity
|
||||
|
||||
extern int16_t g_blimpSpawnItems[15];
|
||||
extern int32_t g_gametypeFlags[MAXGAMETYPES];
|
||||
|
@ -349,6 +356,8 @@ bool isIn(int value, int first, Args... args)
|
|||
{
|
||||
return value == first || isIn(value, args...);
|
||||
}
|
||||
// This is for picking between two identical names with different indices, e.g. CRACK and RR_CRACK.
|
||||
#define pPick(d) (isRR()? (RR_##d) : (d))
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -1181,6 +1181,7 @@ enum
|
|||
|
||||
|
||||
// Stuff that gets referenced but has no name. RR Reconstruction only has Duke names for these items which should be avoided.
|
||||
RR_1196 = 1196,
|
||||
RR_1251 = 1251,
|
||||
RR_1268 = 1268,
|
||||
RR_1187 = 1187,
|
||||
|
|
|
@ -108,6 +108,10 @@ int S_FindMusicSFX(int sectNum, int *sndptr);
|
|||
void A_CallSound2(int soundNum, int playerNum);
|
||||
int A_CallSound(int sectNum,int spriteNum);
|
||||
int A_CheckHitSprite(int spriteNum,int16_t *hitSprite);
|
||||
inline int hitasprite(int s, int16_t* h)
|
||||
{
|
||||
return A_CheckHitSprite(s, h);
|
||||
}
|
||||
void A_DamageObject(int spriteNum,int dmgSrc);
|
||||
inline void checkhitsprite(int s, int d)
|
||||
{
|
||||
|
@ -131,12 +135,28 @@ void G_AnimateCamSprite(int smoothRatio);
|
|||
void G_AnimateWalls(void);
|
||||
int G_ActivateWarpElevators(int s,int warpDir);
|
||||
int G_CheckActivatorMotion(int lotag);
|
||||
inline int check_activator_motion(int lotag)
|
||||
{
|
||||
return G_CheckActivatorMotion(lotag);
|
||||
}
|
||||
void G_DoSectorAnimations(void);
|
||||
void G_OperateActivators(int lotag, int playerNum);
|
||||
inline void operateactivators(int l, int w)
|
||||
{
|
||||
G_OperateActivators(l, w);
|
||||
}
|
||||
void G_OperateForceFields(int spriteNum,int wallTag);
|
||||
void G_OperateMasterSwitches(int lotag);
|
||||
inline void operatemasterswitches(int l)
|
||||
{
|
||||
return G_OperateMasterSwitches(l);
|
||||
}
|
||||
void G_OperateRespawns(int lotag);
|
||||
void G_OperateSectors(int sectNum,int spriteNum);
|
||||
inline void operatesectors(int s, int i)
|
||||
{
|
||||
G_OperateSectors(s, i);
|
||||
}
|
||||
void P_HandleSharedKeys(int playerNum);
|
||||
int GetAnimationGoal(const int32_t *animPtr);
|
||||
int isanearoperator(int lotag);
|
||||
|
@ -190,6 +210,12 @@ EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t sect)
|
|||
return -1;
|
||||
}
|
||||
|
||||
inline int checkcursectnums(int se)
|
||||
{
|
||||
return G_CheckPlayerInSector(se);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
Loading…
Reference in a new issue