mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-03 09:32:45 +00:00
Merge branch 'master' into whaven
This commit is contained in:
commit
e5d4661d79
62 changed files with 379 additions and 467 deletions
|
@ -1098,6 +1098,7 @@ set (PCH_SOURCES
|
|||
core/gameconfigfile.cpp
|
||||
core/gamecvars.cpp
|
||||
core/gamecontrol.cpp
|
||||
core/gamefuncs.cpp
|
||||
core/gameinput.cpp
|
||||
core/interpolate.cpp
|
||||
core/inputstate.cpp
|
||||
|
|
|
@ -535,7 +535,8 @@ void G_ReadConfig(const char* game)
|
|||
// Process automatically executed files
|
||||
FExecList *exec;
|
||||
FArgs *execFiles = new FArgs;
|
||||
GameConfig->AddAutoexec(execFiles, game);
|
||||
if (!(Args->CheckParm("-noautoexec")))
|
||||
GameConfig->AddAutoexec(execFiles, game);
|
||||
exec = D_MultiExec(execFiles, NULL);
|
||||
delete execFiles;
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ bool pausedWithKey;
|
|||
|
||||
bool gamesetinput = false;
|
||||
|
||||
int PlayClock;
|
||||
|
||||
CUSTOM_CVAR(Int, cl_gender, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0 || self > 3) self = 0;
|
||||
|
|
|
@ -240,4 +240,5 @@ extern int chatmodeon;
|
|||
extern bool sendPause;
|
||||
extern int lastTic;
|
||||
|
||||
extern int PlayClock;
|
||||
|
||||
|
|
148
source/core/gamefuncs.cpp
Normal file
148
source/core/gamefuncs.cpp
Normal file
|
@ -0,0 +1,148 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2021 Christoph Oelckers & Mitchell Richters
|
||||
|
||||
This 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "gamefuncs.h"
|
||||
#include "gamestruct.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Unified chasecam function for all games.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int cameradist, cameraclock;
|
||||
|
||||
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio)
|
||||
{
|
||||
hitdata_t hitinfo;
|
||||
binangle daang;
|
||||
short bakcstat;
|
||||
int newdist;
|
||||
|
||||
assert(*psectnum >= 0 && *psectnum < MAXSECTORS);
|
||||
|
||||
// Calculate new pos to shoot backwards, using averaged values from the big three.
|
||||
int nx = gi->chaseCamX(ang);
|
||||
int ny = gi->chaseCamY(ang);
|
||||
int nz = gi->chaseCamZ(horiz);
|
||||
|
||||
vec3_t pvect = { *px, *py, *pz };
|
||||
bakcstat = pspr->cstat;
|
||||
pspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
updatesectorz(*px, *py, *pz, psectnum);
|
||||
hitscan(&pvect, *psectnum, nx, ny, nz, &hitinfo, CLIPMASK1);
|
||||
pspr->cstat = bakcstat;
|
||||
|
||||
int hx = hitinfo.pos.x - *px;
|
||||
int hy = hitinfo.pos.y - *py;
|
||||
|
||||
if (*psectnum < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(*psectnum >= 0 && *psectnum < MAXSECTORS);
|
||||
|
||||
// If something is in the way, make pp->camera_dist lower if necessary
|
||||
if (abs(nx) + abs(ny) > abs(hx) + abs(hy))
|
||||
{
|
||||
if (hitinfo.wall >= 0)
|
||||
{
|
||||
// Push you a little bit off the wall
|
||||
*psectnum = hitinfo.sect;
|
||||
daang = bvectangbam(wall[wall[hitinfo.wall].point2].x - wall[hitinfo.wall].x,
|
||||
wall[wall[hitinfo.wall].point2].y - wall[hitinfo.wall].y);
|
||||
newdist = nx * daang.bsin() + ny * -daang.bcos();
|
||||
|
||||
if (abs(nx) > abs(ny))
|
||||
hx -= MulScale(nx, newdist, 28);
|
||||
else
|
||||
hy -= MulScale(ny, newdist, 28);
|
||||
}
|
||||
else if (hitinfo.sprite < 0)
|
||||
{
|
||||
// Push you off the ceiling/floor
|
||||
*psectnum = hitinfo.sect;
|
||||
|
||||
if (abs(nx) > abs(ny))
|
||||
hx -= (nx >> 5);
|
||||
else
|
||||
hy -= (ny >> 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If you hit a sprite that's not a wall sprite - try again.
|
||||
spritetype* hspr = &sprite[hitinfo.sprite];
|
||||
|
||||
if (!(hspr->cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
bakcstat = hspr->cstat;
|
||||
hspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
calcChaseCamPos(px, py, pz, pspr, psectnum, ang, horiz, smoothratio);
|
||||
hspr->cstat = bakcstat;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// same as wall calculation.
|
||||
daang = buildang(pspr->ang - 512);
|
||||
newdist = nx * daang.bsin() + ny * -daang.bcos();
|
||||
|
||||
if (abs(nx) > abs(ny))
|
||||
hx -= MulScale(nx, newdist, 28);
|
||||
else
|
||||
hy -= MulScale(ny, newdist, 28);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(nx) > abs(ny))
|
||||
newdist = DivScale(hx, nx, 16);
|
||||
else
|
||||
newdist = DivScale(hy, ny, 16);
|
||||
|
||||
if (newdist < cameradist)
|
||||
cameradist = newdist;
|
||||
}
|
||||
|
||||
// Actually move you! (Camerdist is 65536 if nothing is in the way)
|
||||
*px += MulScale(nx, cameradist, 16);
|
||||
*py += MulScale(ny, cameradist, 16);
|
||||
*pz += MulScale(nz, cameradist, 16);
|
||||
|
||||
// Caculate clock using GameTicRate so it increases the same rate on all speed computers.
|
||||
int myclock = PlayClock + MulScale(120 / GameTicRate, smoothratio, 16);
|
||||
if (cameraclock == INT_MIN)
|
||||
{
|
||||
// Third person view was just started.
|
||||
cameraclock = myclock;
|
||||
}
|
||||
|
||||
// Slowly increase cameradist until it reaches 65536.
|
||||
cameradist = min(cameradist + ((myclock - cameraclock) << 10), 65536);
|
||||
cameraclock = myclock;
|
||||
|
||||
// Make sure psectnum is correct.
|
||||
updatesectorz(*px, *py, *pz, psectnum);
|
||||
|
||||
return true;
|
||||
}
|
9
source/core/gamefuncs.h
Normal file
9
source/core/gamefuncs.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "gamecontrol.h"
|
||||
#include "buildtypes.h"
|
||||
#include "binaryangle.h"
|
||||
|
||||
extern int cameradist, cameraclock;
|
||||
|
||||
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio);
|
|
@ -7,6 +7,7 @@ bool System_WantGuiCapture(); // During playing this tells us whether the game m
|
|||
#include "engineerrors.h"
|
||||
#include "stats.h"
|
||||
#include "packet.h"
|
||||
#include "binaryangle.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
class FSerializer;
|
||||
|
@ -97,6 +98,9 @@ struct GameInterface
|
|||
virtual void ToggleThirdPerson() { }
|
||||
virtual void SwitchCoopView() { Printf("Unsupported command\n"); }
|
||||
virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); }
|
||||
virtual int chaseCamX(binangle ang) { return 0; }
|
||||
virtual int chaseCamY(binangle ang) { return 0; }
|
||||
virtual int chaseCamZ(fixedhoriz horiz) { return 0; }
|
||||
|
||||
virtual FString statFPS()
|
||||
{
|
||||
|
|
|
@ -2912,7 +2912,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
|
|||
aiGenDudeNewState(pSprite, &genDudeBurnGoto);
|
||||
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
|
||||
if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200;
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock + 360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock + 360;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3547,9 +3547,9 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
|
|||
case kThingBloodBits:
|
||||
case kThingBloodChunks:
|
||||
case kThingZombieHead:
|
||||
if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->laughCount && Chance(0x4000)) {
|
||||
if (damageType == 3 && pSourcePlayer && PlayClock > pSourcePlayer->laughCount && Chance(0x4000)) {
|
||||
sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2);
|
||||
pSourcePlayer->laughCount = gFrameClock+3600;
|
||||
pSourcePlayer->laughCount = PlayClock+3600;
|
||||
}
|
||||
break;
|
||||
case kTrapMachinegun:
|
||||
|
@ -4187,8 +4187,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
|
|||
switch (pSprite2->type) {
|
||||
case kThingKickablePail:
|
||||
if (pPlayer) {
|
||||
if (pPlayer->kickPower > gFrameClock) return;
|
||||
pPlayer->kickPower = gFrameClock+60;
|
||||
if (pPlayer->kickPower > PlayClock) return;
|
||||
pPlayer->kickPower = PlayClock+60;
|
||||
}
|
||||
actKickObject(pSprite, pSprite2);
|
||||
sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum);
|
||||
|
@ -4196,8 +4196,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
|
|||
break;
|
||||
case kThingZombieHead:
|
||||
if (pPlayer) {
|
||||
if (pPlayer->kickPower > gFrameClock) return;
|
||||
pPlayer->kickPower = gFrameClock+60;
|
||||
if (pPlayer->kickPower > PlayClock) return;
|
||||
pPlayer->kickPower = PlayClock+60;
|
||||
}
|
||||
actKickObject(pSprite, pSprite2);
|
||||
sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum);
|
||||
|
@ -4377,9 +4377,9 @@ int MoveThing(spritetype *pSprite)
|
|||
spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
|
||||
if (pFX)
|
||||
{
|
||||
int v34 = (gFrameClock*3)&2047;
|
||||
int v30 = (gFrameClock*5)&2047;
|
||||
int vbx = (gFrameClock*11)&2047;
|
||||
int v34 = (PlayClock*3)&2047;
|
||||
int v30 = (PlayClock*5)&2047;
|
||||
int vbx = (PlayClock*11)&2047;
|
||||
int v2c = 0x44444;
|
||||
int v28 = 0;
|
||||
int v24 = 0;
|
||||
|
@ -5407,7 +5407,7 @@ void actProcessSprites(void)
|
|||
case kThingBloodBits:
|
||||
case kThingBloodChunks:
|
||||
case kThingZombieHead:
|
||||
if (pXSprite->locked && gFrameClock >= pXSprite->targetX) pXSprite->locked = 0;
|
||||
if (pXSprite->locked && PlayClock >= pXSprite->targetX) pXSprite->locked = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6210,7 +6210,7 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
|
|||
pXThing->data2 = 0;
|
||||
pXThing->data3 = 0;
|
||||
pXThing->data4 = 318;
|
||||
pXThing->targetX = gFrameClock+180;
|
||||
pXThing->targetX = PlayClock+180;
|
||||
pXThing->locked = 1;
|
||||
pXThing->state = 1;
|
||||
pXThing->triggerOnce = 0;
|
||||
|
@ -6222,7 +6222,7 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
|
|||
pXThing->data2 = 0;
|
||||
pXThing->data3 = 0;
|
||||
pXThing->data4 = 318;
|
||||
pXThing->targetX = gFrameClock+180;
|
||||
pXThing->targetX = PlayClock+180;
|
||||
pXThing->locked = 1;
|
||||
pXThing->state = 1;
|
||||
pXThing->triggerOnce = 0;
|
||||
|
@ -6813,7 +6813,7 @@ void DudeToGibCallback1(int, DBloodActor* actor)
|
|||
pXSprite->triggerOnce = 0;
|
||||
pXSprite->isTriggered = 0;
|
||||
pXSprite->locked = 0;
|
||||
pXSprite->targetX = gFrameClock;
|
||||
pXSprite->targetX = PlayClock;
|
||||
pXSprite->state = 1;
|
||||
}
|
||||
|
||||
|
@ -6830,7 +6830,7 @@ void DudeToGibCallback2(int, DBloodActor* actor)
|
|||
pXSprite->triggerOnce = 0;
|
||||
pXSprite->isTriggered = 0;
|
||||
pXSprite->locked = 0;
|
||||
pXSprite->targetX = gFrameClock;
|
||||
pXSprite->targetX = PlayClock;
|
||||
pXSprite->state = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,12 +55,12 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4)
|
|||
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
|
||||
if (a3 == AI_SFX_PRIORITY_0)
|
||||
sfxPlay3DSound(pSprite, a2, a4, 2);
|
||||
else if (a3 > pDudeExtra->prio || pDudeExtra->time <= gFrameClock)
|
||||
else if (a3 > pDudeExtra->prio || pDudeExtra->time <= PlayClock)
|
||||
{
|
||||
sfxKill3DSound(pSprite, -1, -1);
|
||||
sfxPlay3DSound(pSprite, a2, a4, 0);
|
||||
pDudeExtra->prio = a3;
|
||||
pDudeExtra->time = gFrameClock+120;
|
||||
pDudeExtra->time = PlayClock+120;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -925,7 +925,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
|||
aiNewState(actor, &cultistBurnGoto);
|
||||
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
|
||||
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock+360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock+360;
|
||||
actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth);
|
||||
evKill(nSprite, 3, kCallbackFXFlameLick);
|
||||
}
|
||||
|
@ -936,16 +936,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
|||
pSprite->type = kDudeBurningInnocent;
|
||||
aiNewState(actor, &cultistBurnGoto);
|
||||
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock+360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock+360;
|
||||
actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
|
||||
evKill(nSprite, 3, kCallbackFXFlameLick);
|
||||
}
|
||||
break;
|
||||
case kDudeBurningCultist:
|
||||
if (Chance(0x4000) && gDudeExtra[pSprite->extra].time < gFrameClock)
|
||||
if (Chance(0x4000) && gDudeExtra[pSprite->extra].time < PlayClock)
|
||||
{
|
||||
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock+360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock+360;
|
||||
}
|
||||
if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo))
|
||||
{
|
||||
|
@ -979,16 +979,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
|||
pSprite->type = kDudeBurningInnocent;
|
||||
aiNewState(actor, &cultistBurnGoto);
|
||||
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock+360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock+360;
|
||||
actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
|
||||
evKill(nSprite, 3, kCallbackFXFlameLick);
|
||||
}
|
||||
break;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
case kDudeModernCustomBurning:
|
||||
if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < gFrameClock) {
|
||||
if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < PlayClock) {
|
||||
playGenDudeSound(pSprite, kGenDudeSndBurning);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock + 360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock + 360;
|
||||
}
|
||||
if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400;
|
||||
if (spriteIsUnderwater(pSprite, false)) {
|
||||
|
@ -1028,7 +1028,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
|||
|
||||
aiGenDudeNewState(pSprite, &genDudeBurnGoto);
|
||||
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
|
||||
gDudeExtra[pSprite->extra].time = gFrameClock + 360;
|
||||
gDudeExtra[pSprite->extra].time = PlayClock + 360;
|
||||
evKill(nSprite, 3, kCallbackFXFlameLick);
|
||||
|
||||
}
|
||||
|
|
|
@ -490,7 +490,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
// is the target visible?
|
||||
if (dist < pDudeInfo->seeDist && abs(losAngle) <= pDudeInfo->periphery) {
|
||||
|
||||
if ((gFrameClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false))
|
||||
if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false))
|
||||
playGenDudeSound(pSprite, kGenDudeSndChasing);
|
||||
|
||||
actor->dudeSlope = DivScale(pTarget->z - pSprite->z, dist, 10);
|
||||
|
|
|
@ -133,7 +133,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
|
|||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
auto pNSprite = viewInsertTSprite(pTSprite->sectnum, 32767, pTSprite);
|
||||
int ang = (gFrameClock*2048)/120;
|
||||
int ang = (PlayClock*2048)/120;
|
||||
int nRand1 = dword_172CE0[i][0];
|
||||
int nRand2 = dword_172CE0[i][1];
|
||||
int nRand3 = dword_172CE0[i][2];
|
||||
|
@ -432,7 +432,7 @@ static void viewApplyDefaultPal(tspritetype *pTSprite, sectortype const *pSector
|
|||
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smoothratio)
|
||||
{
|
||||
// shift before interpolating to increase precision.
|
||||
int myclock = (gFrameClock<<3) + MulScale(4<<3, smoothratio, 16);
|
||||
int myclock = (PlayClock<<3) + MulScale(4<<3, smoothratio, 16);
|
||||
assert(spritesortcnt <= maxspritesonscreen);
|
||||
gCameraAng = cA;
|
||||
int nViewSprites = spritesortcnt;
|
||||
|
|
|
@ -83,7 +83,7 @@ void StartLevel(MapRecord* level)
|
|||
{
|
||||
if (!level) return;
|
||||
gFrameCount = 0;
|
||||
gFrameClock = 0;
|
||||
PlayClock = 0;
|
||||
STAT_Update(0);
|
||||
EndLevel();
|
||||
inputState.ClearAllInput();
|
||||
|
@ -291,7 +291,7 @@ void GameInterface::Ticker()
|
|||
}
|
||||
|
||||
trProcessBusy();
|
||||
evProcess(gFrameClock);
|
||||
evProcess(PlayClock);
|
||||
seqProcess(4);
|
||||
DoSectorPanning();
|
||||
|
||||
|
@ -320,8 +320,8 @@ void GameInterface::Ticker()
|
|||
thinktime.Unclock();
|
||||
|
||||
gFrameCount++;
|
||||
gFrameClock += kTicsPerFrame;
|
||||
if (gFrameClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
PlayClock += kTicsPerFrame;
|
||||
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
|
|
@ -131,6 +131,9 @@ struct GameInterface : ::GameInterface
|
|||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
void ToggleShowWeapon() override;
|
||||
int chaseCamX(binangle ang) { return MulScale(-Cos(ang.asbuild()), 1280, 30); }
|
||||
int chaseCamY(binangle ang) { return MulScale(-Sin(ang.asbuild()), 1280, 30); }
|
||||
int chaseCamZ(fixedhoriz horiz) { return FixedToInt(MulScale(horiz.asq16(), 1280, 3)) - (16 << 8); }
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ void CChoke::animateChoke(int x, int y, int smoothratio)
|
|||
{
|
||||
if (!qav)
|
||||
return;
|
||||
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
|
||||
int myclock = PlayClock + MulScale(4, smoothratio, 16);
|
||||
qav->x = x;
|
||||
qav->y = y;
|
||||
int vd = myclock - time;
|
||||
|
|
|
@ -84,9 +84,9 @@ void CGameMenuItemQAV::Draw(void)
|
|||
if (raw.Size() > 0)
|
||||
{
|
||||
auto data = (QAV*)raw.Data();
|
||||
int backFC = gFrameClock;
|
||||
int backFC = PlayClock;
|
||||
int currentclock = I_GetBuildTime();
|
||||
gFrameClock = currentclock;
|
||||
PlayClock = currentclock;
|
||||
int nTicks = currentclock - lastTick;
|
||||
lastTick = currentclock;
|
||||
duration -= nTicks;
|
||||
|
@ -111,7 +111,7 @@ void CGameMenuItemQAV::Draw(void)
|
|||
else
|
||||
data->Draw(data->duration - duration, 10, 0, 0, false);
|
||||
|
||||
gFrameClock = backFC;
|
||||
PlayClock = backFC;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -514,13 +514,13 @@ void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
|
|||
assert(command != kCmdCallback);
|
||||
if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
|
||||
else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
|
||||
EVENT evn = { (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, gFrameClock + (int)nDelta };
|
||||
EVENT evn = { (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, PlayClock + (int)nDelta };
|
||||
queue.insert(evn);
|
||||
}
|
||||
|
||||
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
|
||||
{
|
||||
EVENT evn = { (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, gFrameClock + (int)nDelta };
|
||||
EVENT evn = { (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, PlayClock + (int)nDelta };
|
||||
queue.insert(evn);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
int gFrameClock;
|
||||
int gFrameCount;
|
||||
|
||||
int32_t gDetail = 4;
|
||||
|
|
|
@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
extern int gFrameClock;
|
||||
extern int gFrameCount;
|
||||
|
||||
enum { MAXPLAYERNAME = 16 };
|
||||
|
|
|
@ -624,7 +624,7 @@ void SerializeState(FSerializer& arc)
|
|||
|
||||
arc.Array("sector_filler", qsector_filler, numsectors)
|
||||
("visibility", gVisibility)
|
||||
("frameclock", gFrameClock)
|
||||
("frameclock", PlayClock)
|
||||
("framecount", gFrameCount)
|
||||
.Array("basewall", baseWall, numwalls)
|
||||
.SparseArray("basesprite", baseSprite, kMaxSprites, activeSprites)
|
||||
|
|
|
@ -4630,7 +4630,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
return;
|
||||
}
|
||||
// lets try to look for target that fits better by distance
|
||||
else if ((gFrameClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) {
|
||||
else if ((PlayClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) {
|
||||
pTarget = aiFightGetTargetInRange(pSprite, 0, mDist, pXSource->data1, pXSource->data2);
|
||||
if (pTarget != NULL) {
|
||||
pXTarget = &xsprite[pTarget->extra];
|
||||
|
@ -4660,7 +4660,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((pXSprite->target < 0 || pPlayer != NULL) && (gFrameClock & 32) != 0) {
|
||||
if ((pXSprite->target < 0 || pPlayer != NULL) && (PlayClock & 32) != 0) {
|
||||
// try find first target that dude can see
|
||||
int nSprite;
|
||||
StatIterator it(kStatDude);
|
||||
|
@ -4708,7 +4708,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
}
|
||||
|
||||
// got no target - let's ask mates if they have targets
|
||||
if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (gFrameClock & 64) != 0) {
|
||||
if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (PlayClock & 64) != 0) {
|
||||
spritetype* pMateTarget = NULL;
|
||||
if ((pMateTarget = aiFightGetMateTargets(pXSprite)) != NULL && pMateTarget->extra > 0) {
|
||||
XSPRITE* pXMateTarget = &xsprite[pMateTarget->extra];
|
||||
|
@ -4846,10 +4846,10 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
|
|||
if (pQavScene->qavResrc != NULL) {
|
||||
|
||||
QAV* pQAV = pQavScene->qavResrc;
|
||||
int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
|
||||
int v4 = (pPlayer->weaponTimer == 0) ? ((PlayClock + MulScale(4, smoothratio, 16)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
|
||||
|
||||
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) {
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (PlayClock & 32))) {
|
||||
a2 = -128; flags |= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ int qanimateoffs(int a1, int a2)
|
|||
int frames = picanm[a1].num;
|
||||
if (frames > 0)
|
||||
{
|
||||
int const frameClock = gFrameClock;
|
||||
int const frameClock = PlayClock;
|
||||
int vd;
|
||||
if ((a2&0xc000) == 0x8000)
|
||||
vd = (Bcrc32(&a2, 2, 0)+frameClock)>>(picanm[a1].sf&PICANM_ANIMSPEED_MASK);
|
||||
|
|
|
@ -313,7 +313,7 @@ private:
|
|||
if (powerups[i].remainingDuration)
|
||||
{
|
||||
int remainingSeconds = powerups[i].remainingDuration / 100;
|
||||
if (remainingSeconds > warningTime || (gFrameClock & 32))
|
||||
if (remainingSeconds > warningTime || (PlayClock & 32))
|
||||
{
|
||||
DrawStatMaskedSprite(powerups[i].nTile, x, y + powerups[i].yOffset, 0, 0, 256, (int)(65536 * powerups[i].nScaleRatio), DI_SCREEN_LEFT_CENTER);
|
||||
}
|
||||
|
@ -476,14 +476,14 @@ private:
|
|||
{
|
||||
FString gTempStr;
|
||||
int x = 1, y = 1;
|
||||
if (team_ticker[0] == 0 || (gFrameClock & 8))
|
||||
if (team_ticker[0] == 0 || (PlayClock & 8))
|
||||
{
|
||||
SBar_DrawString(this, smallf, GStrings("TXT_COLOR_BLUE"), x, y, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
|
||||
gTempStr.Format("%-3d", team_score[0]);
|
||||
SBar_DrawString(this, smallf, gTempStr, x, y + 10, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
|
||||
}
|
||||
x = -2;
|
||||
if (team_ticker[1] == 0 || (gFrameClock & 8))
|
||||
if (team_ticker[1] == 0 || (PlayClock & 8))
|
||||
{
|
||||
SBar_DrawString(this, smallf, GStrings("TXT_COLOR_RED"), x, y, DI_TEXT_ALIGN_RIGHT, CR_BRICK, 1., -1, -1, 1, 1);
|
||||
gTempStr.Format("%3d", team_score[1]);
|
||||
|
@ -501,7 +501,7 @@ private:
|
|||
{
|
||||
assert(0 == team || 1 == team); // 0: blue, 1: red
|
||||
|
||||
if (team_ticker[team] == 0 || (gFrameClock & 8))
|
||||
if (team_ticker[team] == 0 || (PlayClock & 8))
|
||||
{
|
||||
if (show)
|
||||
DrawStatNumber("%d", team_score[team], kSBarNumberInv, -30, team ? 25 : -10, 0, team ? 2 : 10, 512, 65536 * 0.75, DI_SCREEN_RIGHT_CENTER);
|
||||
|
@ -574,7 +574,7 @@ private:
|
|||
DrawStatMaskedSprite(2200, 160, 200, 0, nPalette, RS_CENTERBOTTOM);
|
||||
DrawPackItemInStatusBar(pPlayer, 265, 186, 260, 172);
|
||||
|
||||
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (PlayClock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 86, 183, 0, 0);
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ private:
|
|||
|
||||
BeginHUD(320, 200, 1);
|
||||
DrawStatSprite(2201, 34, 187 - 200, 16, nPalette);
|
||||
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (PlayClock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 8, 183 - 200, 0, 0);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ void DoSectorLighting(void)
|
|||
{
|
||||
t2 = MulScale(t2, pXSector->busy, 16);
|
||||
}
|
||||
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*gFrameClock, t2);
|
||||
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*PlayClock, t2);
|
||||
if (pXSector->shadeFloor)
|
||||
{
|
||||
sector[nSector].floorshade = ClipRange(sector[nSector].floorshade+v4, -128, 127);
|
||||
|
|
|
@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "v_font.h"
|
||||
#include "statusbar.h"
|
||||
#include "automap.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "v_draw.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
|
||||
|
@ -196,8 +197,7 @@ void viewInit(void)
|
|||
}
|
||||
|
||||
int othercameradist = 1280;
|
||||
int cameradist = -1;
|
||||
int othercameraclock, cameraclock;
|
||||
int othercameraclock;
|
||||
|
||||
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, fixed_t zm, int smoothratio)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
|
|||
*pX += MulScale(vX, othercameradist, 16);
|
||||
*pY += MulScale(vY, othercameradist, 16);
|
||||
*pZ += MulScale(vZ, othercameradist, 16);
|
||||
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
|
||||
int myclock = PlayClock + MulScale(4, smoothratio, 16);
|
||||
othercameradist = ClipHigh(othercameradist+((myclock-othercameraclock)<<10), 65536);
|
||||
othercameraclock = myclock;
|
||||
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
|
||||
|
@ -245,53 +245,6 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
|
|||
pSprite->cstat = bakCstat;
|
||||
}
|
||||
|
||||
void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, fixed_t zm, int smoothratio)
|
||||
{
|
||||
int vX = MulScale(-Cos(nAng), 1280, 30);
|
||||
int vY = MulScale(-Sin(nAng), 1280, 30);
|
||||
int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8);
|
||||
int bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~256;
|
||||
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
|
||||
FindSector(*pX, *pY, *pZ, vsectnum);
|
||||
short nHSector;
|
||||
int hX, hY;
|
||||
hitscangoal.x = hitscangoal.y = 0x1fffffff;
|
||||
vec3_t pos = { *pX, *pY, *pZ };
|
||||
hitdata_t hitdata;
|
||||
hitscan(&pos, *vsectnum, vX, vY, vZ, &hitdata, CLIPMASK1);
|
||||
nHSector = hitdata.sect;
|
||||
hX = hitdata.pos.x;
|
||||
hY = hitdata.pos.y;
|
||||
int dX = hX-*pX;
|
||||
int dY = hY-*pY;
|
||||
if (abs(vX)+abs(vY) > abs(dX)+abs(dY))
|
||||
{
|
||||
*vsectnum = nHSector;
|
||||
dX -= Sgn(vX)<<6;
|
||||
dY -= Sgn(vY)<<6;
|
||||
int nDist;
|
||||
if (abs(vX) > abs(vY))
|
||||
{
|
||||
nDist = ClipHigh(DivScale(dX,vX, 16), cameradist);
|
||||
}
|
||||
else
|
||||
{
|
||||
nDist = ClipHigh(DivScale(dY,vY, 16), cameradist);
|
||||
}
|
||||
cameradist = nDist;
|
||||
}
|
||||
*pX += MulScale(vX, cameradist, 16);
|
||||
*pY += MulScale(vY, cameradist, 16);
|
||||
*pZ += MulScale(vZ, cameradist, 16);
|
||||
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
|
||||
cameradist = ClipHigh(cameradist+((myclock-cameraclock)<<10), 65536);
|
||||
cameraclock = myclock;
|
||||
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
|
||||
FindSector(*pX, *pY, *pZ, vsectnum);
|
||||
pSprite->cstat = bakCstat;
|
||||
}
|
||||
|
||||
// by NoOne: show warning msgs in game instead of throwing errors (in some cases)
|
||||
void viewSetSystemMessage(const char* pMessage, ...) {
|
||||
char buffer[1024]; va_list args; va_start(args, pMessage);
|
||||
|
@ -408,7 +361,7 @@ void viewUpdateDelirium(void)
|
|||
if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0)
|
||||
{
|
||||
int tilt1 = 170, tilt2 = 170, pitch = 20;
|
||||
int timer = gFrameClock*4;
|
||||
int timer = PlayClock*4;
|
||||
if (powerCount < 512)
|
||||
{
|
||||
int powerScale = IntToFixed(powerCount) / 512;
|
||||
|
@ -633,11 +586,11 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
|
||||
cameradist = -1;
|
||||
cameraclock = gFrameClock +MulScale(4, (int)gInterpolate, 16);
|
||||
cameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalcPosition(gView->pSprite, (int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum, cA.asbuild(), cH.asq16(), (int)gInterpolate);
|
||||
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->pSprite, (short*)&nSectnum, cA, cH, gInterpolate);
|
||||
}
|
||||
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum);
|
||||
int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate);
|
||||
|
@ -657,7 +610,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
else if (v4 && gNetPlayers > 1)
|
||||
{
|
||||
#if 0 // needs to be redone for pure hardware rendering.
|
||||
int tmp = (gFrameClock / 240) % (gNetPlayers - 1);
|
||||
int tmp = (PlayClock / 240) % (gNetPlayers - 1);
|
||||
int i = connecthead;
|
||||
while (1)
|
||||
{
|
||||
|
@ -669,7 +622,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
tmp--;
|
||||
}
|
||||
PLAYER* pOther = &gPlayer[i];
|
||||
//othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16);;
|
||||
//othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);;
|
||||
if (!tileData(4079))
|
||||
{
|
||||
TileFiles.tileCreate(4079, 128, 128);
|
||||
|
@ -746,7 +699,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16);
|
||||
othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);
|
||||
}
|
||||
|
||||
if (!bDelirium)
|
||||
|
|
|
@ -268,7 +268,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
|
|||
// Double shotgun fix from BloodGDX.
|
||||
if (/*!IsOriginalDemo() &&*/ (pPlayer->weaponState == -1 || (pPlayer->curWeapon == 3 && pPlayer->weaponState == 7)) && isOriginalQAV())
|
||||
duration = pQAV->duration - 1;
|
||||
else duration = (gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration;
|
||||
else duration = (PlayClock + MulScale(4, smoothratio, 16)) % pQAV->duration;
|
||||
}
|
||||
else duration = pQAV->duration - pPlayer->weaponTimer;
|
||||
|
||||
|
@ -276,7 +276,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
|
|||
pQAV->y = int(ypos);
|
||||
int flags = 2;
|
||||
int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32)))
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (PlayClock & 32)))
|
||||
{
|
||||
shade = -128;
|
||||
flags |= 1;
|
||||
|
@ -1813,12 +1813,12 @@ int processSprayCan(PLAYER *pPlayer)
|
|||
{
|
||||
pPlayer->weaponState = 7;
|
||||
pPlayer->fuseTime = 0;
|
||||
pPlayer->throwTime = gFrameClock;
|
||||
pPlayer->throwTime = PlayClock;
|
||||
}
|
||||
return 1;
|
||||
case 7:
|
||||
{
|
||||
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536);
|
||||
pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
|
||||
if (!(pPlayer->input.actions & SB_FIRE))
|
||||
{
|
||||
if (!pPlayer->fuseTime)
|
||||
|
@ -1851,12 +1851,12 @@ char processTNT(PLAYER *pPlayer)
|
|||
{
|
||||
pPlayer->weaponState = 6;
|
||||
pPlayer->fuseTime = 0;
|
||||
pPlayer->throwTime = gFrameClock;
|
||||
pPlayer->throwTime = PlayClock;
|
||||
}
|
||||
return 1;
|
||||
case 6:
|
||||
{
|
||||
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536);
|
||||
pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
|
||||
if (!(pPlayer->input.actions & SB_FIRE))
|
||||
{
|
||||
if (!pPlayer->fuseTime)
|
||||
|
@ -1875,7 +1875,7 @@ char processProxy(PLAYER *pPlayer)
|
|||
switch (pPlayer->weaponState)
|
||||
{
|
||||
case 9:
|
||||
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536);
|
||||
pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
|
||||
pPlayer->weaponTimer = 0;
|
||||
if (!(pPlayer->input.actions & SB_FIRE))
|
||||
{
|
||||
|
@ -1892,7 +1892,7 @@ char processRemote(PLAYER *pPlayer)
|
|||
switch (pPlayer->weaponState)
|
||||
{
|
||||
case 13:
|
||||
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536);
|
||||
pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
|
||||
if (!(pPlayer->input.actions & SB_FIRE))
|
||||
{
|
||||
pPlayer->weaponState = 11;
|
||||
|
@ -2261,7 +2261,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
case 3:
|
||||
pPlayer->weaponState = 6;
|
||||
pPlayer->fuseTime = -1;
|
||||
pPlayer->throwTime = gFrameClock;
|
||||
pPlayer->throwTime = PlayClock;
|
||||
StartQAV(pPlayer, 21, nClientExplodeBundle, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -2272,7 +2272,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
case 7:
|
||||
pPlayer->weaponQav = 27;
|
||||
pPlayer->weaponState = 9;
|
||||
pPlayer->throwTime = gFrameClock;
|
||||
pPlayer->throwTime = PlayClock;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -2282,7 +2282,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
case 10:
|
||||
pPlayer->weaponQav = 36;
|
||||
pPlayer->weaponState = 13;
|
||||
pPlayer->throwTime = gFrameClock;
|
||||
pPlayer->throwTime = PlayClock;
|
||||
return;
|
||||
case 11:
|
||||
pPlayer->weaponState = 12;
|
||||
|
|
|
@ -158,7 +158,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
case SECTOREFFECTOR:
|
||||
if (t->lotag == 27 && ud.recstat == 1)
|
||||
{
|
||||
t->picnum = 11 + ((ud.levelclock >> 3) & 1);
|
||||
t->picnum = 11 + ((PlayClock >> 3) & 1);
|
||||
t->cstat |= 128;
|
||||
}
|
||||
else
|
||||
|
@ -252,7 +252,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
t->z -= (4 << 8);
|
||||
break;
|
||||
case CRYSTALAMMO:
|
||||
t->shade = bsin(ud.levelclock << 4, -10);
|
||||
t->shade = bsin(PlayClock << 4, -10);
|
||||
continue;
|
||||
case VIEWSCREEN:
|
||||
case VIEWSCREEN2:
|
||||
|
@ -270,10 +270,10 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
break;
|
||||
|
||||
case SHRINKSPARK:
|
||||
t->picnum = SHRINKSPARK + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = SHRINKSPARK + ((PlayClock >> 4) & 3);
|
||||
break;
|
||||
case GROWSPARK:
|
||||
t->picnum = GROWSPARK + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = GROWSPARK + ((PlayClock >> 4) & 3);
|
||||
break;
|
||||
case RPG:
|
||||
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
|
||||
|
@ -653,7 +653,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
if (t->picnum == EXPLOSION2)
|
||||
{
|
||||
ps[screenpeek].visibility = -127;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
}
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
case SECTOREFFECTOR:
|
||||
if (t->lotag == 27 && ud.recstat == 1)
|
||||
{
|
||||
t->picnum = 11 + ((ud.levelclock >> 3) & 1);
|
||||
t->picnum = 11 + ((PlayClock >> 3) & 1);
|
||||
t->cstat |= 128;
|
||||
}
|
||||
else
|
||||
|
@ -183,7 +183,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
case RESPAWNMARKERRED:
|
||||
case RESPAWNMARKERYELLOW:
|
||||
case RESPAWNMARKERGREEN:
|
||||
t->picnum = 861 + ((ud.levelclock >> 4) & 13);
|
||||
t->picnum = 861 + ((PlayClock >> 4) & 13);
|
||||
if (s->picnum == RESPAWNMARKERRED)
|
||||
t->pal = 0;
|
||||
else if (s->picnum == RESPAWNMARKERYELLOW)
|
||||
|
@ -250,21 +250,21 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
t->z -= (4 << 8);
|
||||
break;
|
||||
case CRYSTALAMMO:
|
||||
t->shade = bsin(ud.levelclock << 4, -10);
|
||||
t->shade = bsin(PlayClock << 4, -10);
|
||||
break;
|
||||
case SHRINKSPARK:
|
||||
if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA())
|
||||
{
|
||||
t->picnum = CHEERBLADE + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = CHEERBLADE + ((PlayClock >> 4) & 3);
|
||||
t->shade = -127;
|
||||
}
|
||||
else
|
||||
t->picnum = SHRINKSPARK + ((ud.levelclock >> 4) & 7);
|
||||
t->picnum = SHRINKSPARK + ((PlayClock >> 4) & 7);
|
||||
break;
|
||||
case CHEERBOMB:
|
||||
if (isRRRA())
|
||||
{
|
||||
t->picnum = CHEERBOMB + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = CHEERBOMB + ((PlayClock >> 4) & 3);
|
||||
break;
|
||||
}
|
||||
else goto default_case;
|
||||
|
@ -272,10 +272,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
if (isRRRA() && Owner)
|
||||
{
|
||||
if (Owner->picnum == MINION && Owner->pal == 8)
|
||||
t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6);
|
||||
t->picnum = RRTILE3500 + ((PlayClock >> 4) % 6);
|
||||
else if (Owner->picnum == MINION && Owner->pal == 19)
|
||||
{
|
||||
t->picnum = RRTILE5090 + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = RRTILE5090 + ((PlayClock >> 4) & 3);
|
||||
t->shade = -127;
|
||||
}
|
||||
else if (Owner->picnum == MAMA)
|
||||
|
@ -291,10 +291,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
t->picnum = RRTILE7274 + k;
|
||||
}
|
||||
else
|
||||
t->picnum = SPIT + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = SPIT + ((PlayClock >> 4) & 3);
|
||||
}
|
||||
else
|
||||
t->picnum = SPIT + ((ud.levelclock >> 4) & 3);
|
||||
t->picnum = SPIT + ((PlayClock >> 4) & 3);
|
||||
break;
|
||||
case EMPTYBIKE:
|
||||
if (!isRRRA()) goto default_case;
|
||||
|
@ -803,12 +803,12 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
if (t->picnum == EXPLOSION2)
|
||||
{
|
||||
ps[screenpeek].visibility = -127;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
t->pal = 0;
|
||||
}
|
||||
else if (t->picnum == FIRELASER)
|
||||
{
|
||||
t->picnum = FIRELASER + ((ud.levelclock >> 2) & 5);
|
||||
t->picnum = FIRELASER + ((PlayClock >> 2) & 5);
|
||||
}
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
@ -904,11 +904,11 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
t->shade = -127;
|
||||
break;
|
||||
case RRTILE2034:
|
||||
t->picnum = RRTILE2034 + ((ud.levelclock >> 2) & 1);
|
||||
t->picnum = RRTILE2034 + ((PlayClock >> 2) & 1);
|
||||
break;
|
||||
case RRTILE2944:
|
||||
t->shade = -127;
|
||||
t->picnum = RRTILE2944 + ((ud.levelclock >> 2) & 4);
|
||||
t->picnum = RRTILE2944 + ((PlayClock >> 2) & 4);
|
||||
break;
|
||||
case PLAYERONWATER:
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
#include "cheathandler.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "gamestate.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
|
|
@ -62,6 +62,9 @@ struct GameInterface : public ::GameInterface
|
|||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
void ToggleShowWeapon() override;
|
||||
int chaseCamX(binangle ang) { return -ang.bcos(-4); }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin(-4); }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 9; }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ void playerLookUp(int snum, ESyncBits actions);
|
|||
void playerLookDown(int snum, ESyncBits actions);
|
||||
void playerAimUp(int snum, ESyncBits actions);
|
||||
void playerAimDown(int snum, ESyncBits actions);
|
||||
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio);
|
||||
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
|
||||
DDukeActor* aim(DDukeActor* s, int aang);
|
||||
void checkweapons(struct player_struct* const p);
|
||||
|
|
|
@ -126,7 +126,7 @@ void FTA(int q, struct player_struct* p)
|
|||
if (q < 0 || gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
if (p->ftq != q || (ud.levelclock - p->ftt > TICRATE && q != QUOTE_DEAD))
|
||||
if (p->ftq != q || (PlayClock - p->ftt > TICRATE && q != QUOTE_DEAD))
|
||||
{
|
||||
p->ftq = q;
|
||||
auto qu = quoteMgr.GetQuote(q);
|
||||
|
@ -144,7 +144,7 @@ void FTA(int q, struct player_struct* p)
|
|||
}
|
||||
}
|
||||
}
|
||||
p->ftt = ud.levelclock;
|
||||
p->ftt = PlayClock;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -324,16 +324,16 @@ void cameratext(DDukeActor *cam)
|
|||
drawitem(TILE_CAMCORNER + 1, 24, 163, true, true);
|
||||
drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true);
|
||||
|
||||
if (ud.levelclock & 16)
|
||||
if (PlayClock & 16)
|
||||
drawitem(TILE_CAMLIGHT, 46, 32, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
int flipbits = (ud.levelclock << 1) & 48;
|
||||
int flipbits = (PlayClock << 1) & 48;
|
||||
|
||||
for (int x = -64; x < 394; x += 64)
|
||||
for (int y = 0; y < 200; y += 64)
|
||||
drawitem(TILE_STATIC, x, y, !!(ud.levelclock & 8), !!(ud.levelclock & 16));
|
||||
drawitem(TILE_STATIC, x, y, !!(PlayClock & 8), !!(PlayClock & 16));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
{
|
||||
auto& pp = ps[p];
|
||||
if (pspr->xvel > 16 && pp.on_ground)
|
||||
i = TILE_APLAYERTOP + ((ud.levelclock >> 4) & 3);
|
||||
i = TILE_APLAYERTOP + ((PlayClock >> 4) & 3);
|
||||
else
|
||||
i = TILE_APLAYERTOP;
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ void GameInterface::Ticker()
|
|||
dotorch();
|
||||
|
||||
r_NoInterpolate = false;
|
||||
ud.levelclock+= 4; // This must be at the end of this block so that the first tic receives a value of 0!
|
||||
if (ud.levelclock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
PlayClock+= 4; // This must be at the end of this block so that the first tic receives a value of 0!
|
||||
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
|
||||
}
|
||||
else r_NoInterpolate = true;
|
||||
|
|
|
@ -80,7 +80,6 @@ uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
// not serialized
|
||||
int cameradist = 0, cameraclock = 0; // only for 3rd person view
|
||||
int otherp; // internal helper
|
||||
int actor_tog; // cheat helper
|
||||
int playerswhenstarted; // why is this needed?
|
||||
|
|
|
@ -46,8 +46,6 @@ struct DukeGameInfo
|
|||
|
||||
extern DukeGameInfo gs;
|
||||
|
||||
extern int cameraclock;
|
||||
extern int cameradist;
|
||||
extern int otherp; // transient helper, MP only
|
||||
extern int actor_tog; // cheat state
|
||||
extern intptr_t apScriptGameEvent[];
|
||||
|
|
|
@ -78,7 +78,7 @@ void displaymasks_r(int snum, double smoothratio)
|
|||
{
|
||||
//int pin = 0;
|
||||
// to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value.
|
||||
double interpclock = ud.levelclock + (TICSPERFRAME/65536.) * smoothratio;
|
||||
double interpclock = PlayClock + (TICSPERFRAME/65536.) * smoothratio;
|
||||
int pin = RS_STRETCH;
|
||||
hud_drawsprite((320 - (tileWidth(SCUBAMASK) >> 1) - 15), (200 - (tileHeight(SCUBAMASK) >> 1) + bsinf(interpclock, -10)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite((320 - tileWidth(SCUBAMASK + 4)), (200 - tileHeight(SCUBAMASK + 4)), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);
|
||||
|
|
|
@ -1064,75 +1064,4 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// view - as in third person view (stupid name for this function)
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio)
|
||||
{
|
||||
spritetype* sp;
|
||||
int i, nx, ny, nz, hx, hy, hitx, hity, hitz;
|
||||
short bakcstat, hitsect, hitwall, daang;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
nx = -bcos(ang, -4);
|
||||
ny = -bsin(ang, -4);
|
||||
nz = q16horiz >> 9;
|
||||
|
||||
sp = &pp->GetActor()->s;
|
||||
|
||||
bakcstat = sp->cstat;
|
||||
sp->cstat &= (short)~0x101;
|
||||
|
||||
updatesectorz(*vx, *vy, *vz, vsectnum);
|
||||
hitscan(*vx, *vy, *vz, *vsectnum, nx, ny, nz, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
if (*vsectnum < 0)
|
||||
{
|
||||
sp->cstat = bakcstat;
|
||||
return false;
|
||||
}
|
||||
|
||||
hx = hitx - (*vx); hy = hity - (*vy);
|
||||
if (abs(nx) + abs(ny) > abs(hx) + abs(hy))
|
||||
{
|
||||
*vsectnum = hitsect;
|
||||
if (hitwall >= 0)
|
||||
{
|
||||
daang = getangle(wall[wall[hitwall].point2].x - wall[hitwall].x,
|
||||
wall[wall[hitwall].point2].y - wall[hitwall].y);
|
||||
|
||||
i = nx * bsin(daang) + ny * -bcos(daang);
|
||||
if (abs(nx) > abs(ny)) hx -= MulScale(nx, i, 28);
|
||||
else hy -= MulScale(ny, i, 28);
|
||||
}
|
||||
else if (!hitsprt)
|
||||
{
|
||||
if (abs(nx) > abs(ny)) hx -= (nx >> 5);
|
||||
else hy -= (ny >> 5);
|
||||
}
|
||||
if (abs(nx) > abs(ny)) i = DivScale(hx, nx, 16);
|
||||
else i = DivScale(hy, ny, 16);
|
||||
if (i < cameradist) cameradist = i;
|
||||
}
|
||||
*vx = (*vx) + MulScale(nx, cameradist, 16);
|
||||
*vy = (*vy) + MulScale(ny, cameradist, 16);
|
||||
*vz = (*vz) + MulScale(nz, cameradist, 16);
|
||||
|
||||
int myclock = ud.levelclock + int(TICSPERFRAME/65536. * smoothratio);
|
||||
if (cameraclock == INT_MIN) cameraclock = myclock; // third person view was just started.
|
||||
|
||||
cameradist = min(cameradist + ((myclock - cameraclock) << 10), 65536);
|
||||
cameraclock = myclock;
|
||||
|
||||
updatesectorz(*vx, *vy, *vz, vsectnum);
|
||||
|
||||
sp->cstat = bakcstat;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -1600,7 +1600,7 @@ int doincrements_d(struct player_struct* p)
|
|||
p->knuckle_incs++;
|
||||
if (p->knuckle_incs == 10 && !isWW2GI())
|
||||
{
|
||||
if (ud.levelclock > 1024)
|
||||
if (PlayClock > 1024)
|
||||
if (snum == screenpeek || ud.coop == 1)
|
||||
{
|
||||
if (rand() & 1)
|
||||
|
@ -2274,7 +2274,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
fi.shoot(pact, SHOTSPARK1);
|
||||
S_PlayActorSound(PISTOL_FIRE, pact);
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
|
||||
|
@ -2328,7 +2328,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
|
||||
S_PlayActorSound(SHOTGUN_FIRE, pact);
|
||||
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
|
||||
}
|
||||
|
@ -2383,7 +2383,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
|
||||
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
||||
fi.shoot(pact, CHAINGUN);
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
checkavailweapon(p);
|
||||
|
||||
|
@ -2434,7 +2434,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
// make them visible if not set...
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
}
|
||||
checkavailweapon(p);
|
||||
//#endif
|
||||
|
@ -2448,7 +2448,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
// make them visible if not set...
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
}
|
||||
checkavailweapon(p);
|
||||
}
|
||||
|
@ -2467,7 +2467,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
p->visibility = 0;
|
||||
//flashColor = 176 + (252 << 8) + (120 << 16);
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
checkavailweapon(p);
|
||||
}
|
||||
}
|
||||
|
@ -2475,7 +2475,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
p->okickback_pic = p->kickback_pic = 0;
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
checkavailweapon(p);
|
||||
}
|
||||
else p->kickback_pic++;
|
||||
|
@ -2493,7 +2493,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
(p->kickback_pic & 1))
|
||||
{
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
fi.shoot(pact, RPG);
|
||||
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
||||
checkavailweapon(p);
|
||||
|
@ -2503,7 +2503,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
else if (p->kickback_pic & 1)
|
||||
{
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
fi.shoot(pact, RPG);
|
||||
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
||||
checkavailweapon(p);
|
||||
|
@ -2523,7 +2523,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
p->ammo_amount[p->curr_weapon]--;
|
||||
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
fi.shoot(pact, FREEZEBLAST);
|
||||
checkavailweapon(p);
|
||||
}
|
||||
|
@ -2606,7 +2606,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
if (p->kickback_pic == 4)
|
||||
{
|
||||
p->ammo_amount[RPG_WEAPON]--;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
fi.shoot(pact, RPG);
|
||||
checkavailweapon(p);
|
||||
|
|
|
@ -1486,7 +1486,7 @@ int doincrements_r(struct player_struct* p)
|
|||
}
|
||||
S_PlayActorSound(snd, pact);
|
||||
}
|
||||
else if (ud.levelclock > 1024)
|
||||
else if (PlayClock > 1024)
|
||||
if (snum == screenpeek || ud.coop == 1)
|
||||
{
|
||||
if (rand() & 1)
|
||||
|
@ -2806,7 +2806,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
p->noise_radius = 8192;
|
||||
madenoise(snum);
|
||||
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
if (psectlotag != 857)
|
||||
{
|
||||
|
@ -2885,7 +2885,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
p->noise_radius = 8192;
|
||||
madenoise(snum);
|
||||
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
|
||||
|
@ -2996,7 +2996,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
fi.shoot(pact, CHAINGUN);
|
||||
p->noise_radius = 8192;
|
||||
madenoise(snum);
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
|
||||
if (psectlotag != 857)
|
||||
|
@ -3052,7 +3052,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
||||
{
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
||||
fi.shoot(pact, SHOTSPARK1);
|
||||
p->noise_radius = 16384;
|
||||
|
@ -3079,7 +3079,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
||||
{
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
S_PlayActorSound(CHAINGUN_FIRE, pact);
|
||||
fi.shoot(pact, CHAINGUN);
|
||||
p->noise_radius = 16384;
|
||||
|
@ -3137,7 +3137,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
p->ammo_amount[ALIENBLASTER_WEAPON]--;
|
||||
p->visibility = 0;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
checkavailweapon(p);
|
||||
}
|
||||
else if (p->kickback_pic == 12)
|
||||
|
@ -3246,7 +3246,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
p->ammo_amount[CROSSBOW_WEAPON]--;
|
||||
if (p->ammo_amount[DYNAMITE_WEAPON])
|
||||
p->ammo_amount[DYNAMITE_WEAPON]--;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
fi.shoot(pact, RPG);
|
||||
p->noise_radius = 32768;
|
||||
|
@ -3264,7 +3264,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
if (p->kickback_pic == 4)
|
||||
{
|
||||
p->ammo_amount[CHICKEN_WEAPON]--;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
fi.shoot(pact, RPG2);
|
||||
p->noise_radius = 32768;
|
||||
|
|
|
@ -78,7 +78,7 @@ void DoFire(struct player_struct* p, short snum)
|
|||
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
|
||||
{
|
||||
// make them visible if not set...
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
|
||||
{
|
||||
// make them visible if not set...
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
lastvisinc = PlayClock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);
|
||||
|
|
|
@ -736,7 +736,7 @@ void prelevel_common(int g)
|
|||
void resettimevars(void)
|
||||
{
|
||||
cloudclock = 0;
|
||||
ud.levelclock = 0;
|
||||
PlayClock = 0;
|
||||
if (camsprite != nullptr)
|
||||
camsprite->temp_data[0] = 0;
|
||||
}
|
||||
|
|
|
@ -587,10 +587,10 @@ void displayrooms(int snum, double smoothratio)
|
|||
{
|
||||
cposz -= isRR() ? 3840 : 3072;
|
||||
|
||||
if (!view(p, &cposx, &cposy, &cposz, §, cang.asbuild(), choriz.asq16(), smoothratio))
|
||||
if (!calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, §, cang, choriz, smoothratio))
|
||||
{
|
||||
cposz += isRR() ? 3840 : 3072;
|
||||
view(p, &cposx, &cposy, &cposz, §, cang.asbuild(), choriz.asq16(), smoothratio);
|
||||
calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, §, cang, choriz, smoothratio);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
|
||||
if (!isRRRA() || !fogactive)
|
||||
{
|
||||
if (ud.levelclock < lastvisinc)
|
||||
if (PlayClock < lastvisinc)
|
||||
{
|
||||
if (abs(p->visibility - ud.const_visibility) > 8)
|
||||
p->visibility += (ud.const_visibility - p->visibility) >> 2;
|
||||
|
|
|
@ -329,7 +329,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
("coop", ud.coop)
|
||||
("marker", ud.marker)
|
||||
("ffire", ud.ffire)
|
||||
("levelclock", ud.levelclock)
|
||||
("levelclock", PlayClock)
|
||||
("bomb_tag", ud.bomb_tag)
|
||||
|
||||
.Array("sectorextra", sectorextra, numsectors)
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
imgScale = baseScale / img->GetDisplayHeight();
|
||||
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
|
||||
|
||||
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && p->last_extra > gs.max_player_health)
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
imgX += (imgX * 0.6) * (strlen - 1);
|
||||
}
|
||||
|
||||
if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
|
||||
if (weapon != KNEE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
|
||||
{
|
||||
SBar_DrawString(this, numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
imgScale = baseScale / img->GetDisplayHeight();
|
||||
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
|
||||
|
||||
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && p->last_extra > gs.max_player_health)
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
imgX += (imgX * 0.755) * (strlen - 1);
|
||||
}
|
||||
|
||||
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
|
||||
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
|
||||
{
|
||||
SBar_DrawString(this, numberFont, format, -1, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
||||
}
|
||||
|
|
|
@ -1261,7 +1261,7 @@ void allignwarpelevators(void)
|
|||
void moveclouds(double smoothratio)
|
||||
{
|
||||
// The math here is very messy.. :(
|
||||
int myclock = smoothratio < 32768? ud.levelclock-2 : ud.levelclock;
|
||||
int myclock = smoothratio < 32768? PlayClock-2 : PlayClock;
|
||||
if (myclock > cloudclock || myclock < (cloudclock - 7))
|
||||
{
|
||||
cloudclock = myclock + 6;
|
||||
|
|
|
@ -123,7 +123,6 @@ struct TileInfo
|
|||
|
||||
struct user_defs
|
||||
{
|
||||
int levelclock;
|
||||
unsigned char god, cashman, eog;
|
||||
unsigned char clipping;
|
||||
unsigned char user_pals[MAXPLAYERS];
|
||||
|
|
|
@ -107,7 +107,6 @@ short nBackgroundPic;
|
|||
short nShadowPic;
|
||||
|
||||
short nCreaturesKilled = 0, nCreaturesTotal = 0;
|
||||
int leveltime;
|
||||
|
||||
short nFreeze;
|
||||
|
||||
|
@ -449,8 +448,8 @@ void GameInterface::Ticker()
|
|||
|
||||
lLocalCodes = 0;
|
||||
|
||||
leveltime++;
|
||||
if (leveltime == 2) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
PlayClock += 4;
|
||||
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
GameMove();
|
||||
r_NoInterpolate = false;
|
||||
}
|
||||
|
@ -625,7 +624,7 @@ bool GameInterface::CanSave()
|
|||
|
||||
::GameStats GameInterface::getStats()
|
||||
{
|
||||
return { nCreaturesKilled, nCreaturesTotal, 0, 0, leveltime / 30, 0 };
|
||||
return { nCreaturesKilled, nCreaturesTotal, 0, 0, PlayClock / 120, 0 };
|
||||
}
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
|
@ -666,7 +665,7 @@ void SerializeState(FSerializer& arc)
|
|||
("bodytotal", nBodyTotal)
|
||||
("bsnakecam", bSnakeCam)
|
||||
("slipmode", bSlipMode)
|
||||
("leveltime", leveltime)
|
||||
("PlayClock", PlayClock)
|
||||
("cinemaseen", nCinemaSeen)
|
||||
("spiritsprite", nSpiritSprite)
|
||||
.EndObject();
|
||||
|
|
|
@ -112,7 +112,6 @@ extern short nBackgroundPic;
|
|||
extern short nShadowPic;
|
||||
|
||||
extern short nCreaturesTotal, nCreaturesKilled;
|
||||
extern int leveltime;
|
||||
|
||||
extern int lLocalButtons;
|
||||
|
||||
|
@ -255,6 +254,9 @@ struct GameInterface : ::GameInterface
|
|||
int playerKeyMove() override { return 6; }
|
||||
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||
void ToggleThirdPerson() override;
|
||||
int chaseCamX(binangle ang) { return -ang.bcos() / 12; }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin() / 12; }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() / 384; }
|
||||
|
||||
::GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -87,7 +87,7 @@ uint8_t LoadLevel(int nMap)
|
|||
nCreaturesTotal = 0;
|
||||
nFreeze = 0;
|
||||
nSpiritSprite = -1;
|
||||
leveltime = 0;
|
||||
PlayClock = 0;
|
||||
|
||||
InitLion();
|
||||
InitRexs();
|
||||
|
|
|
@ -100,7 +100,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
|
|||
double x = xdim / 2. + x1 / double(1 << 12);
|
||||
double y = ydim / 2. + y1 / double(1 << 12);
|
||||
// This very likely needs fixing later
|
||||
DrawTexture(twod, tileGetTexture(nTile /*+ ((leveltime >> 2) & 3)*/, true), x, y, DTA_ClipLeft, windowxy1.x, DTA_ClipTop, windowxy1.y, DTA_ScaleX, z / 1536., DTA_ScaleY, z / 1536., DTA_CenterOffset, true,
|
||||
DrawTexture(twod, tileGetTexture(nTile /*+ ((PlayClock >> 4) & 3)*/, true), x, y, DTA_ClipLeft, windowxy1.x, DTA_ClipTop, windowxy1.y, DTA_ScaleX, z / 1536., DTA_ScaleY, z / 1536., DTA_CenterOffset, true,
|
||||
DTA_ClipRight, windowxy2.x + 1, DTA_ClipBottom, windowxy2.y + 1, DTA_Alpha, (pSprite->cstat & 2 ? 0.5 : 1.), TAG_DONE);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1676,20 +1676,20 @@ void DoFinale()
|
|||
{
|
||||
StopLocalSound();
|
||||
PlayLocalSound(StaticSound[kSound76], 0);
|
||||
nextstage = leveltime*4 + 120;
|
||||
nextstage = PlayClock + 120;
|
||||
nFinaleStage++;
|
||||
}
|
||||
}
|
||||
else if (nFinaleStage <= 2)
|
||||
{
|
||||
if (leveltime*4 >= nextstage)
|
||||
if (PlayClock >= nextstage)
|
||||
{
|
||||
PlayLocalSound(StaticSound[kSound77], 0);
|
||||
nFinaleStage++;
|
||||
nextstage = leveltime*4 + 360;
|
||||
nextstage = PlayClock + 360;
|
||||
}
|
||||
}
|
||||
else if (nFinaleStage == 3 && leveltime*4 >= nextstage)
|
||||
else if (nFinaleStage == 3 && PlayClock >= nextstage)
|
||||
{
|
||||
LevelFinished();
|
||||
}
|
||||
|
@ -1856,7 +1856,7 @@ void ExplodeEnergyBlock(int nSprite)
|
|||
else
|
||||
{
|
||||
nFinaleSpr = nSprite;
|
||||
lFinaleStart = leveltime*4;
|
||||
lFinaleStart = PlayClock;
|
||||
|
||||
if (!lFinaleStart) {
|
||||
lFinaleStart = lFinaleStart + 1;
|
||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "input.h"
|
||||
#include "cheathandler.h"
|
||||
#include "gamestate.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "mmulti.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
@ -108,6 +109,8 @@ void GameInterface::ToggleThirdPerson()
|
|||
if (bCamera)
|
||||
{
|
||||
GrabPalette();
|
||||
cameradist = 0;
|
||||
cameraclock = INT_MIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ void InitSpiritHead()
|
|||
|
||||
sprite[nSpiritSprite].cstat &= 0x7FFF;
|
||||
|
||||
nHeadTimeStart = leveltime*4;
|
||||
nHeadTimeStart = PlayClock;
|
||||
|
||||
memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
|
||||
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
||||
|
@ -153,8 +153,8 @@ void InitSpiritHead()
|
|||
StartSwirlies();
|
||||
|
||||
sprintf(filename, "LEV%d.PUP", currentLevel->levelNumber);
|
||||
lNextStateChange = leveltime*4;
|
||||
lHeadStartClock = leveltime*4;
|
||||
lNextStateChange = PlayClock;
|
||||
lHeadStartClock = PlayClock;
|
||||
|
||||
auto headfd = fileSystem.OpenFileReader(filename);
|
||||
if (!headfd.isOpen())
|
||||
|
@ -212,7 +212,6 @@ void DoSpiritHead()
|
|||
|
||||
sPlayerInput[0].actions |= SB_CENTERVIEW;
|
||||
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
||||
int totalclock = leveltime * 4;
|
||||
|
||||
switch (nHeadStage)
|
||||
{
|
||||
|
@ -221,7 +220,7 @@ void DoSpiritHead()
|
|||
memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
|
||||
break;
|
||||
case 5:
|
||||
if (lNextStateChange <= totalclock)
|
||||
if (lNextStateChange <= PlayClock)
|
||||
{
|
||||
if (nPupData != 0)
|
||||
{
|
||||
|
@ -291,7 +290,7 @@ void DoSpiritHead()
|
|||
return;
|
||||
}
|
||||
|
||||
nPixelsToShow = 15 * (totalclock - nHeadTimeStart);
|
||||
nPixelsToShow = 15 * (PlayClock - nHeadTimeStart);
|
||||
if (nPixelsToShow > nPixels)
|
||||
nPixelsToShow = nPixels;
|
||||
|
||||
|
@ -319,10 +318,10 @@ void DoSpiritHead()
|
|||
|
||||
if (nHeadStage == 0)
|
||||
{
|
||||
if (totalclock - nHeadTimeStart > 480)
|
||||
if (PlayClock - nHeadTimeStart > 480)
|
||||
{
|
||||
nHeadStage = 1;
|
||||
nHeadTimeStart = totalclock + 480;
|
||||
nHeadTimeStart = PlayClock + 480;
|
||||
}
|
||||
|
||||
for (int i = 0; i < nPixelsToShow; i++)
|
||||
|
@ -434,7 +433,7 @@ void DoSpiritHead()
|
|||
Worktile[((cury[i] >> 8) + (212 * ((curx[i] >> 8) + 97))) + 106] = pixelval[i];
|
||||
}
|
||||
|
||||
if (totalclock - lHeadStartClock > 600)
|
||||
if (PlayClock - lHeadStartClock > 600)
|
||||
CopyHeadToWorkTile(590);
|
||||
|
||||
if (nCount < (15 * nPixels) / 16) {
|
||||
|
|
|
@ -456,7 +456,7 @@ void EXSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
|
|||
else if (type == SOURCE_Swirly)
|
||||
{
|
||||
int which = *(int*)source;
|
||||
float phase = (leveltime << (6 + which)) * BAngRadian;
|
||||
float phase = (PlayClock << (4 + which)) * BAngRadian;
|
||||
pos->X = fcampos.X + 256 * cos(phase);
|
||||
pos->Z = fcampos.Z + 256 * sin(phase);
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ private:
|
|||
|
||||
int shade;
|
||||
|
||||
if ((leveltime / 30) & 1) {
|
||||
if ((PlayClock / 120) & 1) {
|
||||
shade = -100;
|
||||
}
|
||||
else {
|
||||
|
@ -733,11 +733,11 @@ private:
|
|||
imgScale = baseScale / img->GetDisplayHeight();
|
||||
DrawGraphic(img, 1.5, -1, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
|
||||
|
||||
if (!althud_flashing || pp->nHealth > 150 || (leveltime & 8))
|
||||
if (!althud_flashing || pp->nHealth > 150 || (PlayClock & 32))
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && pp->nHealth > 800)
|
||||
s += bsin(leveltime << 7, -10);
|
||||
s += bsin(PlayClock << 5, -10);
|
||||
int intens = clamp(255 - 4 * s, 0, 255);
|
||||
auto pe = PalEntry(255, intens, intens, intens);
|
||||
format.Format("%d", pp->nHealth >> 3);
|
||||
|
@ -799,7 +799,7 @@ private:
|
|||
imgX += (imgX * 0.855) * (strlen - 1);
|
||||
}
|
||||
|
||||
if ((!althud_flashing || leveltime & 8 || ammo > 10))// (DamageData[weapon].max_ammo / 10)))
|
||||
if ((!althud_flashing || PlayClock & 32 || ammo > 10))// (DamageData[weapon].max_ammo / 10)))
|
||||
{
|
||||
SBar_DrawString(this, numberFont, format, -3, -numberFont->mFont->GetHeight()+3, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ private:
|
|||
stats.font = SmallFont;
|
||||
stats.letterColor = CR_RED;
|
||||
stats.standardColor = CR_UNTRANSLATED;
|
||||
stats.time = Scale(leveltime, 1000, 30);
|
||||
stats.time = Scale(PlayClock, 1000, 120);
|
||||
|
||||
if (automapMode == am_full)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "ns.h"
|
||||
#include "compat.h"
|
||||
#include "engine.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "names.h"
|
||||
#include "view.h"
|
||||
#include "status.h"
|
||||
|
@ -247,11 +248,13 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
|
||||
if (!SyncInput())
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].horizon.sum();
|
||||
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
||||
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
||||
}
|
||||
else
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
|
||||
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio);
|
||||
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio);
|
||||
}
|
||||
|
@ -261,51 +264,44 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
||||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
|
||||
renderSetRollAngle(rotscrnang.asbuildf());
|
||||
|
||||
pan = q16horiz(clamp(pan.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
}
|
||||
|
||||
nCameraa = nAngle;
|
||||
|
||||
if (!bCamera || nFreeze || sceneonly)
|
||||
if (nSnakeCam >= 0 && !sceneonly)
|
||||
{
|
||||
if (nSnakeCam >= 0 && !sceneonly)
|
||||
{
|
||||
pan = q16horiz(0);
|
||||
viewz = playerZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewz = playerZ + nQuake[nLocalPlayer];
|
||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].horizon.sum();
|
||||
}
|
||||
else
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
|
||||
}
|
||||
|
||||
if (viewz > floorZ)
|
||||
viewz = floorZ;
|
||||
|
||||
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clipmove_old((int32_t*)&playerX, (int32_t*)&playerY, (int32_t*)&playerZ, &nSector,
|
||||
-2000 * nAngle.bcos(),
|
||||
-2000 * nAngle.bsin(),
|
||||
4, 0, 0, CLIPMASK1);
|
||||
|
||||
pan = q16horiz(0);
|
||||
viewz = playerZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewz = playerZ + nQuake[nLocalPlayer];
|
||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||
|
||||
pan = q16horiz(clamp(pan.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
if (viewz > floorZ)
|
||||
viewz = floorZ;
|
||||
|
||||
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
||||
|
||||
if (bCamera)
|
||||
{
|
||||
viewz -= 2560;
|
||||
if (!calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio))
|
||||
{
|
||||
viewz += 2560;
|
||||
calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nCamerax = playerX;
|
||||
nCameray = playerY;
|
||||
|
|
|
@ -38,6 +38,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
#include "mytypes.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "network.h"
|
||||
#include "pal.h"
|
||||
#include "player.h"
|
||||
|
@ -925,133 +926,6 @@ post_analyzesprites(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool
|
||||
BackView(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16horiz)
|
||||
{
|
||||
vec3_t n = { *nx, *ny, *nz };
|
||||
SPRITEp sp;
|
||||
hitdata_t hitinfo;
|
||||
int i, vx, vy, vz, hx, hy;
|
||||
short bakcstat, daang;
|
||||
PLAYERp pp = &Player[screenpeek];
|
||||
short ang;
|
||||
|
||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||
|
||||
ang = nang->asbuild() + pp->view_outside_dang;
|
||||
|
||||
// Calculate the vector (nx,ny,nz) to shoot backwards
|
||||
vx = -bcos(ang, -3);
|
||||
vy = -bsin(ang, -3);
|
||||
vz = q16horiz >> 8;
|
||||
|
||||
// Player sprite of current view
|
||||
sp = &sprite[pp->PlayerSprite];
|
||||
|
||||
bakcstat = sp->cstat;
|
||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
// Make sure sector passed to FAFhitscan is correct
|
||||
//COVERupdatesector(*nx, *ny, vsect);
|
||||
|
||||
hitscan(&n, *vsect, vx, vy, vz,
|
||||
&hitinfo, CLIPMASK_PLAYER);
|
||||
|
||||
if (*vsect < 0)
|
||||
{
|
||||
sp->cstat = bakcstat;
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||
|
||||
sp->cstat = bakcstat; // Restore cstat
|
||||
|
||||
hx = hitinfo.pos.x - (*nx);
|
||||
hy = hitinfo.pos.y - (*ny);
|
||||
|
||||
// If something is in the way, make pp->camera_dist lower if necessary
|
||||
if (abs(vx) + abs(vy) > abs(hx) + abs(hy))
|
||||
{
|
||||
if (hitinfo.wall >= 0) // Push you a little bit off the wall
|
||||
{
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
daang = getangle(wall[wall[hitinfo.wall].point2].x - wall[hitinfo.wall].x,
|
||||
wall[wall[hitinfo.wall].point2].y - wall[hitinfo.wall].y);
|
||||
|
||||
i = vx * bsin(daang) + vy * -bcos(daang);
|
||||
if (abs(vx) > abs(vy))
|
||||
hx -= MulScale(vx, i, 28);
|
||||
else
|
||||
hy -= MulScale(vy, i, 28);
|
||||
}
|
||||
else if (hitinfo.sprite < 0) // Push you off the ceiling/floor
|
||||
{
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
if (abs(vx) > abs(vy))
|
||||
hx -= (vx >> 5);
|
||||
else
|
||||
hy -= (vy >> 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
SPRITEp hsp = &sprite[hitinfo.sprite];
|
||||
int flag_backup;
|
||||
|
||||
// if you hit a sprite that's not a wall sprite - try again
|
||||
if (!TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
flag_backup = hsp->cstat;
|
||||
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||
BackView(nx, ny, nz, vsect, nang, q16horiz);
|
||||
hsp->cstat = flag_backup;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// same as wall calculation
|
||||
daang = NORM_ANGLE(sp->ang-512);
|
||||
|
||||
i = vx * bsin(daang) + vy * -bcos(daang);
|
||||
if (abs(vx) > abs(vy))
|
||||
hx -= MulScale(vx, i, 28);
|
||||
else
|
||||
hy -= MulScale(vy, i, 28);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (abs(vx) > abs(vy))
|
||||
i = IntToFixed(hx) / vx;
|
||||
else
|
||||
i = IntToFixed(hy) / vy;
|
||||
|
||||
if (i < pp->camera_dist)
|
||||
pp->camera_dist = i;
|
||||
}
|
||||
|
||||
// Actually move you! (Camerdist is 65536 if nothing is in the way)
|
||||
*nx = (*nx) + MulScale(vx, pp->camera_dist, 16);
|
||||
*ny = (*ny) + MulScale(vy, pp->camera_dist, 16);
|
||||
*nz = (*nz) + MulScale(vz, pp->camera_dist, 16);
|
||||
|
||||
// Slowly increase pp->camera_dist until it reaches 65536
|
||||
// Synctics is a timer variable so it increases the same rate
|
||||
// on all speed computers
|
||||
pp->camera_dist = min(pp->camera_dist + (3 << 10), 65536);
|
||||
//pp->camera_dist = min(pp->camera_dist + (synctics << 10), 65536);
|
||||
|
||||
// Make sure vsect is correct
|
||||
updatesectorz(*nx, *ny, *nz, vsect);
|
||||
|
||||
*nang += buildang(pp->view_outside_dang);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CircleCamera(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16horiz)
|
||||
{
|
||||
|
@ -1705,10 +1579,10 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
{
|
||||
tz -= 8448;
|
||||
|
||||
if (!BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz.asq16()))
|
||||
if (!calcChaseCamPos(&tx, &ty, &tz, &sprite[pp->PlayerSprite], &tsectnum, tang, thoriz, smoothratio))
|
||||
{
|
||||
tz += 8448;
|
||||
BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz.asq16());
|
||||
calcChaseCamPos(&tx, &ty, &tz, &sprite[pp->PlayerSprite], &tsectnum, tang, thoriz, smoothratio);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -839,7 +839,6 @@ struct PLAYERstruct
|
|||
SPRITEp hi_sp, lo_sp;
|
||||
|
||||
SPRITEp last_camera_sp;
|
||||
int camera_dist; // view mode dist
|
||||
int circle_camera_dist;
|
||||
int six,siy,siz; // save player interp position for PlayerSprite
|
||||
short siang;
|
||||
|
@ -2196,7 +2195,6 @@ void InitFonts();
|
|||
int32_t registerosdcommands(void);
|
||||
void SW_InitMultiPsky(void);
|
||||
|
||||
extern int PlayClock;
|
||||
extern short LevelSecrets;
|
||||
extern short TotalKillable;
|
||||
extern int OrigCommPlayers;
|
||||
|
@ -2253,6 +2251,9 @@ struct GameInterface : ::GameInterface
|
|||
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
int chaseCamX(binangle ang) { return -ang.bcos(-3); }
|
||||
int chaseCamY(binangle ang) { return -ang.bsin(-3); }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 8; }
|
||||
|
||||
|
||||
GameStats getStats() override;
|
||||
|
|
|
@ -43,7 +43,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
BEGIN_SW_NS
|
||||
|
||||
static uint8_t tempbuf[576], packbuf[576];
|
||||
int PlayClock;
|
||||
|
||||
gNET gNet;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "jsector.h"
|
||||
#include "network.h"
|
||||
#include "gamestate.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "player.h"
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
@ -99,22 +100,14 @@ void GameInterface::ToggleThirdPerson()
|
|||
{
|
||||
if (gamestate != GS_LEVEL) return;
|
||||
auto pp = &Player[myconnectindex];
|
||||
if (inputState.ShiftPressed())
|
||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
{
|
||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
pp->view_outside_dang = NORM_ANGLE(pp->view_outside_dang + 256);
|
||||
RESET(pp->Flags, PF_VIEW_FROM_OUTSIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
{
|
||||
RESET(pp->Flags, PF_VIEW_FROM_OUTSIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET(pp->Flags, PF_VIEW_FROM_OUTSIDE);
|
||||
pp->camera_dist = 0;
|
||||
}
|
||||
SET(pp->Flags, PF_VIEW_FROM_OUTSIDE);
|
||||
cameradist = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7084,7 +7084,6 @@ void PauseMultiPlay(void)
|
|||
void
|
||||
domovethings(void)
|
||||
{
|
||||
extern int PlayClock;
|
||||
short i, pnum;
|
||||
|
||||
PLAYERp pp;
|
||||
|
|
|
@ -70,7 +70,6 @@ void InitLevelGlobals(void);
|
|||
|
||||
extern int lastUpdate;
|
||||
extern char SaveGameDescr[10][80];
|
||||
extern int PlayClock;
|
||||
extern short Bunny_Count;
|
||||
extern bool NewGame;
|
||||
extern int GodMode;
|
||||
|
|
Loading…
Reference in a new issue