raze/source/games/blood/src/view.h

192 lines
4.9 KiB
C
Raw Normal View History

2019-09-19 22:42:45 +00:00
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
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.
*/
//-------------------------------------------------------------------------
#pragma once
#include "compat.h"
#include "build.h"
2019-09-19 22:42:45 +00:00
#include "palette.h"
#include "common_game.h"
#include "messages.h"
#include "player.h"
#include "interpolate.h"
#include "bloodactor.h"
2019-09-19 22:42:45 +00:00
BEGIN_BLD_NS
struct VIEW {
2020-11-21 22:40:08 +00:00
int bobPhase;
int Kills;
int bobHeight; // bob height
int bobWidth; // bob width
int at10;
int at14;
int shakeBobY; // bob sway y
int shakeBobX; // bob sway x
fixedhoriz horiz; // horiz
fixedhoriz horizoff; // horizoff
int at2c;
binangle angle; // angle
int weaponZ; // weapon z
int viewz; // view z
int at3c;
int at40;
int at44;
int at48; // posture
double spin; // spin
union {
struct
{
int32_t x, y, z;
};
vec3_t pos;
};
int xvel; //xvel
int yvel; //yvel
int zvel; //zvel
int sectnum; // sectnum
unsigned int floordist; // floordist
char at6e; // look center
char at6f;
char at70; // run
char at71; // jump
char at72; // underwater
short at73; // sprite flags
SPRITEHIT at75;
binangle look_ang;
binangle rotscrnang;
};
extern VIEW gPrevView[kMaxPlayers];
extern VIEW predict, predictOld;
extern bool gPrediction;
2019-09-19 22:42:45 +00:00
enum VIEW_EFFECT {
kViewEffectShadow = 0,
kViewEffectFlareHalo,
kViewEffectCeilGlow,
kViewEffectFloorGlow,
kViewEffectTorchHigh,
kViewEffectTorchLow,
kViewEffectSmokeHigh,
kViewEffectSmokeLow,
kViewEffectFlame,
kViewEffectSpear,
kViewEffectTrail,
kViewEffectPhase,
kViewEffectShowWeapon,
kViewEffectReflectiveBall,
kViewEffectShoot,
kViewEffectTesla,
kViewEffectFlag,
kViewEffectBigFlag,
kViewEffectAtom,
2020-12-06 20:56:09 +00:00
kViewEffectSpotProgress,
2019-09-19 22:42:45 +00:00
};
enum VIEWPOS {
VIEWPOS_0 = 0,
VIEWPOS_1
};
enum
{
kBackTile = 253,
kCrosshairTile = 2319,
kLoadScreen = 2049,
kLoadScreenWideBack = 9216,
kLoadScreenWideLeft = 9217,
kLoadScreenWideRight = 9218,
kLoadScreenWideMiddle = 9219,
kSBarNumberHealth = 9220,
kSBarNumberAmmo = 9230,
kSBarNumberInv = 9240,
kSBarNumberArmor1 = 9250,
kSBarNumberArmor2 = 9260,
kSBarNumberArmor3 = 9270,
};
2019-09-19 22:42:45 +00:00
2020-10-11 09:52:30 +00:00
enum { kFontNum = 5 };
2020-01-02 09:45:31 +00:00
2020-07-31 19:05:09 +00:00
extern FFont *gFont[kFontNum];
2019-09-19 22:42:45 +00:00
extern VIEWPOS gViewPos;
extern int gViewIndex;
extern int gScreenTilt;
extern int deliriumTilt, deliriumTurn, deliriumPitch;
extern int gScreenTiltO, deliriumTurnO, deliriumPitchO;
extern int gShowFrameRate;
extern FixedBitArray<kMaxSprites> gInterpolateSprite;
2019-09-19 22:42:45 +00:00
extern int gLastPal;
extern double gInterpolate;
2019-09-19 22:42:45 +00:00
void hudDraw(PLAYER* gView, int nSectnum, double bobx, double boby, double zDelta, int basepal, double smoothratio);
2019-09-19 22:42:45 +00:00
void viewInitializePrediction(void);
void viewUpdatePrediction(InputPacket *pInput);
2019-09-19 22:42:45 +00:00
void viewCorrectPrediction(void);
void viewBackupView(int nPlayer);
2019-09-07 16:39:26 +00:00
void viewCorrectViewOffsets(int nPlayer, vec3_t const *oldpos);
2019-09-19 22:42:45 +00:00
void InitStatusBar(void);
void UpdateStatusBar();
2019-09-19 22:42:45 +00:00
void viewInit(void);
void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
void viewSetMessage(const char *pMessage, const int pal = 0, const MESSAGE_PRIORITY priority = MESSAGE_PRIORITY_NORMAL);
2019-09-19 22:42:45 +00:00
void viewSetErrorMessage(const char *pMessage);
void DoLensEffect(void);
void UpdateDacs(int nPalette, bool bNoTint = false);
2020-01-14 20:20:46 +00:00
void viewDrawScreen(bool sceneonly = false);
2019-09-19 22:42:45 +00:00
void viewUpdateDelirium(void);
void viewSetSystemMessage(const char* pMessage, ...);
2019-09-19 22:42:45 +00:00
inline void viewInterpolateSector(int nSector, sectortype *pSector)
{
StartInterpolation(nSector, Interp_Sect_Floorz);
StartInterpolation(nSector, Interp_Sect_Ceilingz);
StartInterpolation(nSector, Interp_Sect_Floorheinum);
2019-09-19 22:42:45 +00:00
}
inline void viewInterpolateWall(int nWall, walltype *pWall)
{
StartInterpolation(nWall, Interp_Wall_X);
StartInterpolation(nWall, Interp_Wall_Y);
2019-09-19 22:42:45 +00:00
}
inline void viewBackupSpriteLoc(int nSprite, spritetype *pSprite)
{
if (!gInterpolateSprite[nSprite])
2019-09-19 22:42:45 +00:00
{
pSprite->backuploc();
gInterpolateSprite.Set(nSprite);
2019-09-19 22:42:45 +00:00
}
}
inline void viewBackupSpriteLoc(DBloodActor* actor)
{
viewBackupSpriteLoc(actor->s().index, &actor->s());
}
END_BLD_NS