- lightened player.h a bit more.

This commit is contained in:
Christoph Oelckers 2020-07-06 23:50:14 +02:00
parent dca7e158bb
commit 43ff87f47f
12 changed files with 23 additions and 49 deletions

View file

@ -499,12 +499,20 @@ enum
EVENT_MAXEVENT = EVENT_NUMEVENTS - 1 EVENT_MAXEVENT = EVENT_NUMEVENTS - 1
}; };
enum enum miscConstants
{ {
MAXSLEEPDIST = 16384, MAXSLEEPDIST = 16384,
SLEEPTIME = 1536, SLEEPTIME = 1536,
ZOFFSET6 = (4 << 8), ZOFFSET6 = (4 << 8),
FOURSLEIGHT = (1 << 8) FOURSLEIGHT = (1 << 8),
MOVEFIFOSIZ =256,
HORIZ_MIN =-99,
HORIZ_MAX =299,
AUTO_AIM_ANGLE =48,
PHEIGHT_DUKE =(38<<8),
PHEIGHT_RR =(40<<8)
}; };
enum enum

View file

@ -252,6 +252,7 @@ void initactorflags_r()
TILE_HURTRAIL = HURTRAIL; TILE_HURTRAIL = HURTRAIL;
TILE_FLOORPLASMA = FLOORPLASMA; TILE_FLOORPLASMA = FLOORPLASMA;
PHEIGHT = PHEIGHT_RR;
} }
END_DUKE_NS END_DUKE_NS

View file

@ -28,25 +28,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "net.h" #include "net.h"
#include "tarray.h" #include "tarray.h"
#include "constants.h" #include "constants.h"
#include "types.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS
extern int32_t playerswhenstarted; extern int32_t playerswhenstarted;
#define MOVEFIFOSIZ 256
#define HORIZ_MIN -99
#define HORIZ_MAX 299
#define AUTO_AIM_ANGLE 48
#define PHEIGHT_DUKE (38<<8)
#define PHEIGHT_RR (40<<8);
extern int32_t PHEIGHT; extern int32_t PHEIGHT;
#define WEAPON_POS_LOWER -9
#define WEAPON_POS_RAISE 10
#define WEAPON_POS_START 6
#define MAX_WEAPON_RECS 256
enum gamemode_t { enum gamemode_t {
MODE_MENU = 0x00000001, MODE_MENU = 0x00000001,
@ -55,19 +44,9 @@ enum gamemode_t {
MODE_EOL = 0x00000008, MODE_EOL = 0x00000008,
MODE_TYPE = 0x00000010, MODE_TYPE = 0x00000010,
MODE_RESTART = 0x00000020, MODE_RESTART = 0x00000020,
MODE_SENDTOWHOM = 0x00000040,
}; };
typedef struct {
ESyncBits bits;
int16_t fvel, svel;
fix16_t q16avel, q16horz;
} input_t;
#pragma pack(push,1)
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct typedef struct
{ {
struct player_struct *ps; struct player_struct *ps;
@ -81,13 +60,11 @@ typedef struct
// NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused // NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused
uint8_t frags[MAXPLAYERS]; uint8_t frags[MAXPLAYERS];
char playerreadyflag, playerquitflag, connected;
char user_name[32]; char user_name[32];
char syncval[SYNCFIFOSIZ][MAXSYNCBYTES]; char syncval[SYNCFIFOSIZ][MAXSYNCBYTES];
double lastInputTicks; double lastInputTicks;
} playerdata_t; } playerdata_t;
#pragma pack(pop)
# define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player]) # define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])

View file

@ -3109,8 +3109,7 @@ HORIZONLY:
if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0; if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0;
} }
if (p->horiz > 299) p->horiz = 299; horiz = clamp(horiz, HORIZ_MIN, HORIZ_MAX);
else if (p->horiz < -99) p->horiz = -99;
#endif #endif
//Shooting code/changes //Shooting code/changes

View file

@ -4208,8 +4208,7 @@ HORIZONLY:
if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0; if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0;
} }
if (p->horiz > 299) p->horiz = 299; horiz = clamp(horiz, HORIZ_MIN, HORIZ_MAX);
else if (p->horiz < -99) p->horiz = -99;
#endif #endif
//Shooting code/changes //Shooting code/changes

View file

@ -514,8 +514,7 @@ FAKEHORIZONLY:
myhoriz -= (myhardlanding<<4); myhoriz -= (myhardlanding<<4);
} }
if (myhoriz > 299) myhoriz = 299; myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX);
else if (myhoriz < -99) myhoriz = -99;
if(p->knee_incs > 0) if(p->knee_incs > 0)
{ {

View file

@ -681,7 +681,6 @@ void enterlevel(char g)
displayrooms(myconnectindex,65536); displayrooms(myconnectindex,65536);
displayrest(screenpeek); displayrest(screenpeek);
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
ps[myconnectindex].over_shoulder_on = 0; ps[myconnectindex].over_shoulder_on = 0;
clearfrags(); clearfrags();

View file

@ -989,7 +989,6 @@ void loadlevel(const char *filename)
displayrest(screenpeek); displayrest(screenpeek);
nextpage(); nextpage();
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
if (waitabort == 1) if (waitabort == 1)
gameexit(" "); gameexit(" ");
ps[myconnectindex].over_shoulder_on = 0; ps[myconnectindex].over_shoulder_on = 0;

View file

@ -608,8 +608,7 @@ void displayrooms(int snum, int smoothratio)
if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8); if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8);
} }
if (choriz > 299) choriz = 299; choriz = clamp(choriz, HORIZ_MIN, HORIZ_MAX);
else if (choriz < -99) choriz = -99;
if (isRR() && sector[sect].lotag == 848) if (isRR() && sector[sect].lotag == 848)
{ {

View file

@ -34,6 +34,13 @@ struct ActorInfo
int aimoffset; int aimoffset;
}; };
struct input_t // original name was input which is too generic for a type name.
{
fixed_t q16avel, q16horz; // These were expanded to 16.16 fixed point.
short fvel, svel;
ESyncBits bits;
};
struct player_orig struct player_orig
{ {
int ox, oy, oz; int ox, oy, oz;

View file

@ -354,8 +354,6 @@ inline int G_CheckPlayerColor(int color)
static void G_Startup(void) static void G_Startup(void)
{ {
int32_t i;
timerInit(TICRATE); timerInit(TICRATE);
timerSetCallback(gameTimerHandler); timerSetCallback(gameTimerHandler);
@ -398,11 +396,6 @@ static void G_Startup(void)
strncpy(boardfilename, startupMap, BMAX_PATH); strncpy(boardfilename, startupMap, BMAX_PATH);
} }
for (i=0; i<MAXPLAYERS; i++)
g_player[i].playerreadyflag = 0;
Net_GetPackets();
if (numplayers > 1) if (numplayers > 1)
Printf("Multiplayer initialized.\n"); Printf("Multiplayer initialized.\n");
@ -677,8 +670,6 @@ int GameInterface::app_main()
G_Startup(); // a bunch of stuff including compiling cons G_Startup(); // a bunch of stuff including compiling cons
g_player[0].playerquitflag = 1;
g_player[myconnectindex].ps->palette = BASEPAL; g_player[myconnectindex].ps->palette = BASEPAL;
for (int i=1, j=numplayers; j<ud.multimode; j++) for (int i=1, j=numplayers; j<ud.multimode; j++)

View file

@ -1431,10 +1431,6 @@ static void postloadplayer(int32_t savegamep)
if (savegamep) if (savegamep)
everyothertime = 0; everyothertime = 0;
//7
for (i=0; i<MAXPLAYERS; i++)
g_player[i].playerquitflag = 1;
// ---------- // ----------
//7.5 //7.5