* Skin-controlled radius is no longer set each tic, only on skin change and player spawn.
* Camerascale, shieldscale, height and spinheight are now player attributes which are set to the skin attribute on skin change, not read directly from the skin. * P_GetPlayerHeight and P_GetPlayerSpinHeight are now macros instead of functions. * Extra protection against switching to a locked skin.
This commit is contained in:
parent
64a9a94604
commit
be0e898bae
|
@ -506,6 +506,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
rsp->skin = LONG(players[i].skin);
|
rsp->skin = LONG(players[i].skin);
|
||||||
// Just in case Lua does something like
|
// Just in case Lua does something like
|
||||||
// modify these at runtime
|
// modify these at runtime
|
||||||
|
rsp->camerascale = (fixed_t)LONG(players[i].camerascale);
|
||||||
|
rsp->shieldscale = (fixed_t)LONG(players[i].shieldscale);
|
||||||
rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed);
|
rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed);
|
||||||
rsp->runspeed = (fixed_t)LONG(players[i].runspeed);
|
rsp->runspeed = (fixed_t)LONG(players[i].runspeed);
|
||||||
rsp->thrustfactor = players[i].thrustfactor;
|
rsp->thrustfactor = players[i].thrustfactor;
|
||||||
|
@ -521,6 +523,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
rsp->mindash = (fixed_t)LONG(players[i].mindash);
|
rsp->mindash = (fixed_t)LONG(players[i].mindash);
|
||||||
rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
|
rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
|
||||||
rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor);
|
rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor);
|
||||||
|
rsp->playerheight = (fixed_t)LONG(players[i].height);
|
||||||
|
rsp->playerspinheight = (fixed_t)LONG(players[i].spinheight);
|
||||||
|
|
||||||
rsp->speed = (fixed_t)LONG(players[i].speed);
|
rsp->speed = (fixed_t)LONG(players[i].speed);
|
||||||
rsp->jumping = players[i].jumping;
|
rsp->jumping = players[i].jumping;
|
||||||
|
@ -632,6 +636,8 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
players[i].skin = LONG(rsp->skin);
|
players[i].skin = LONG(rsp->skin);
|
||||||
// Just in case Lua does something like
|
// Just in case Lua does something like
|
||||||
// modify these at runtime
|
// modify these at runtime
|
||||||
|
players[i].camerascale = (fixed_t)LONG(rsp->camerascale);
|
||||||
|
players[i].shieldscale = (fixed_t)LONG(rsp->shieldscale);
|
||||||
players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed);
|
players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed);
|
||||||
players[i].runspeed = (fixed_t)LONG(rsp->runspeed);
|
players[i].runspeed = (fixed_t)LONG(rsp->runspeed);
|
||||||
players[i].thrustfactor = rsp->thrustfactor;
|
players[i].thrustfactor = rsp->thrustfactor;
|
||||||
|
@ -647,6 +653,8 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
players[i].mindash = (fixed_t)LONG(rsp->mindash);
|
players[i].mindash = (fixed_t)LONG(rsp->mindash);
|
||||||
players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
|
players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
|
||||||
players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor);
|
players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor);
|
||||||
|
players[i].height = (fixed_t)LONG(rsp->playerheight);
|
||||||
|
players[i].spinheight = (fixed_t)LONG(rsp->playerspinheight);
|
||||||
|
|
||||||
players[i].speed = (fixed_t)LONG(rsp->speed);
|
players[i].speed = (fixed_t)LONG(rsp->speed);
|
||||||
players[i].jumping = rsp->jumping;
|
players[i].jumping = rsp->jumping;
|
||||||
|
|
|
@ -166,6 +166,8 @@ typedef struct
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
// Just in case Lua does something like
|
// Just in case Lua does something like
|
||||||
// modify these at runtime
|
// modify these at runtime
|
||||||
|
fixed_t camerascale;
|
||||||
|
fixed_t shieldscale;
|
||||||
fixed_t normalspeed;
|
fixed_t normalspeed;
|
||||||
fixed_t runspeed;
|
fixed_t runspeed;
|
||||||
UINT8 thrustfactor;
|
UINT8 thrustfactor;
|
||||||
|
@ -181,6 +183,8 @@ typedef struct
|
||||||
fixed_t mindash;
|
fixed_t mindash;
|
||||||
fixed_t maxdash;
|
fixed_t maxdash;
|
||||||
fixed_t jumpfactor;
|
fixed_t jumpfactor;
|
||||||
|
fixed_t playerheight;
|
||||||
|
fixed_t playerspinheight;
|
||||||
|
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
UINT8 jumping;
|
UINT8 jumping;
|
||||||
|
|
|
@ -282,6 +282,8 @@ typedef struct player_s
|
||||||
playerstate_t playerstate;
|
playerstate_t playerstate;
|
||||||
|
|
||||||
// Determine POV, including viewpoint bobbing during movement.
|
// Determine POV, including viewpoint bobbing during movement.
|
||||||
|
fixed_t camerascale;
|
||||||
|
fixed_t shieldscale;
|
||||||
// Focal origin above r.z
|
// Focal origin above r.z
|
||||||
fixed_t viewz;
|
fixed_t viewz;
|
||||||
// Base height above floor for viewz.
|
// Base height above floor for viewz.
|
||||||
|
@ -349,6 +351,9 @@ typedef struct player_s
|
||||||
|
|
||||||
fixed_t jumpfactor; // How high can the player jump?
|
fixed_t jumpfactor; // How high can the player jump?
|
||||||
|
|
||||||
|
fixed_t height; // Bounding box changes.
|
||||||
|
fixed_t spinheight;
|
||||||
|
|
||||||
SINT8 lives;
|
SINT8 lives;
|
||||||
SINT8 continues; // continues that player has acquired
|
SINT8 continues; // continues that player has acquired
|
||||||
|
|
||||||
|
|
26
src/g_game.c
26
src/g_game.c
|
@ -2047,6 +2047,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
INT32 score;
|
INT32 score;
|
||||||
INT32 lives;
|
INT32 lives;
|
||||||
INT32 continues;
|
INT32 continues;
|
||||||
|
fixed_t camerascale;
|
||||||
|
fixed_t shieldscale;
|
||||||
UINT8 charability;
|
UINT8 charability;
|
||||||
UINT8 charability2;
|
UINT8 charability2;
|
||||||
fixed_t normalspeed;
|
fixed_t normalspeed;
|
||||||
|
@ -2070,6 +2072,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
INT32 starpostnum;
|
INT32 starpostnum;
|
||||||
INT32 starpostangle;
|
INT32 starpostangle;
|
||||||
fixed_t jumpfactor;
|
fixed_t jumpfactor;
|
||||||
|
fixed_t height;
|
||||||
|
fixed_t spinheight;
|
||||||
INT32 exiting;
|
INT32 exiting;
|
||||||
INT16 numboxes;
|
INT16 numboxes;
|
||||||
INT16 totalring;
|
INT16 totalring;
|
||||||
|
@ -2101,6 +2105,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
|
|
||||||
skincolor = players[player].skincolor;
|
skincolor = players[player].skincolor;
|
||||||
skin = players[player].skin;
|
skin = players[player].skin;
|
||||||
|
camerascale = players[player].camerascale;
|
||||||
|
shieldscale = players[player].shieldscale;
|
||||||
charability = players[player].charability;
|
charability = players[player].charability;
|
||||||
charability2 = players[player].charability2;
|
charability2 = players[player].charability2;
|
||||||
normalspeed = players[player].normalspeed;
|
normalspeed = players[player].normalspeed;
|
||||||
|
@ -2117,6 +2123,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
starpostnum = players[player].starpostnum;
|
starpostnum = players[player].starpostnum;
|
||||||
starpostangle = players[player].starpostangle;
|
starpostangle = players[player].starpostangle;
|
||||||
jumpfactor = players[player].jumpfactor;
|
jumpfactor = players[player].jumpfactor;
|
||||||
|
height = players[player].height;
|
||||||
|
spinheight = players[player].spinheight;
|
||||||
thokitem = players[player].thokitem;
|
thokitem = players[player].thokitem;
|
||||||
spinitem = players[player].spinitem;
|
spinitem = players[player].spinitem;
|
||||||
revitem = players[player].revitem;
|
revitem = players[player].revitem;
|
||||||
|
@ -2142,6 +2150,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
// save player config truth reborn
|
// save player config truth reborn
|
||||||
p->skincolor = skincolor;
|
p->skincolor = skincolor;
|
||||||
p->skin = skin;
|
p->skin = skin;
|
||||||
|
p->camerascale = camerascale;
|
||||||
|
p->shieldscale = shieldscale;
|
||||||
p->charability = charability;
|
p->charability = charability;
|
||||||
p->charability2 = charability2;
|
p->charability2 = charability2;
|
||||||
p->normalspeed = normalspeed;
|
p->normalspeed = normalspeed;
|
||||||
|
@ -2164,6 +2174,8 @@ void G_PlayerReborn(INT32 player)
|
||||||
p->starpostnum = starpostnum;
|
p->starpostnum = starpostnum;
|
||||||
p->starpostangle = starpostangle;
|
p->starpostangle = starpostangle;
|
||||||
p->jumpfactor = jumpfactor;
|
p->jumpfactor = jumpfactor;
|
||||||
|
p->height = height;
|
||||||
|
p->spinheight = spinheight;
|
||||||
p->exiting = exiting;
|
p->exiting = exiting;
|
||||||
|
|
||||||
p->numboxes = numboxes;
|
p->numboxes = numboxes;
|
||||||
|
@ -4696,6 +4708,8 @@ void G_BeginRecording(void)
|
||||||
demo_p += 16;
|
demo_p += 16;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
|
WRITEUINT8(demo_p,player->camerascale>>FRACBITS);
|
||||||
|
WRITEUINT8(demo_p,player->shieldscale>>FRACBITS);
|
||||||
WRITEUINT8(demo_p,player->charability);
|
WRITEUINT8(demo_p,player->charability);
|
||||||
WRITEUINT8(demo_p,player->charability2);
|
WRITEUINT8(demo_p,player->charability2);
|
||||||
WRITEUINT8(demo_p,player->actionspd>>FRACBITS);
|
WRITEUINT8(demo_p,player->actionspd>>FRACBITS);
|
||||||
|
@ -4706,6 +4720,8 @@ void G_BeginRecording(void)
|
||||||
WRITEUINT8(demo_p,player->thrustfactor);
|
WRITEUINT8(demo_p,player->thrustfactor);
|
||||||
WRITEUINT8(demo_p,player->accelstart);
|
WRITEUINT8(demo_p,player->accelstart);
|
||||||
WRITEUINT8(demo_p,player->acceleration);
|
WRITEUINT8(demo_p,player->acceleration);
|
||||||
|
WRITEUINT8(demo_p,player->height>>FRACBITS);
|
||||||
|
WRITEUINT8(demo_p,player->spinheight>>FRACBITS);
|
||||||
|
|
||||||
// Trying to convert it back to % causes demo desync due to precision loss.
|
// Trying to convert it back to % causes demo desync due to precision loss.
|
||||||
// Don't do it.
|
// Don't do it.
|
||||||
|
@ -4936,7 +4952,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
char skin[17],color[17],*n,*pdemoname;
|
char skin[17],color[17],*n,*pdemoname;
|
||||||
UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration;
|
UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration;
|
||||||
UINT32 randseed;
|
UINT32 randseed;
|
||||||
fixed_t actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor;
|
fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight;
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
|
||||||
skin[16] = '\0';
|
skin[16] = '\0';
|
||||||
|
@ -5072,6 +5088,8 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
M_Memcpy(color,demo_p,16);
|
M_Memcpy(color,demo_p,16);
|
||||||
demo_p += 16;
|
demo_p += 16;
|
||||||
|
|
||||||
|
camerascale = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||||
|
shieldscale = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||||
charability = READUINT8(demo_p);
|
charability = READUINT8(demo_p);
|
||||||
charability2 = READUINT8(demo_p);
|
charability2 = READUINT8(demo_p);
|
||||||
actionspd = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
actionspd = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||||
|
@ -5082,6 +5100,8 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
thrustfactor = READUINT8(demo_p);
|
thrustfactor = READUINT8(demo_p);
|
||||||
accelstart = READUINT8(demo_p);
|
accelstart = READUINT8(demo_p);
|
||||||
acceleration = READUINT8(demo_p);
|
acceleration = READUINT8(demo_p);
|
||||||
|
height = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||||
|
spinheight = (fixed_t)READUINT8(demo_p)<<FRACBITS;
|
||||||
jumpfactor = READFIXED(demo_p);
|
jumpfactor = READFIXED(demo_p);
|
||||||
|
|
||||||
// net var data
|
// net var data
|
||||||
|
@ -5145,6 +5165,8 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
// Set saved attribute values
|
// Set saved attribute values
|
||||||
// No cheat checking here, because even if they ARE wrong...
|
// No cheat checking here, because even if they ARE wrong...
|
||||||
// it would only break the replay if we clipped them.
|
// it would only break the replay if we clipped them.
|
||||||
|
players[0].camerascale = camerascale;
|
||||||
|
players[0].shieldscale = shieldscale;
|
||||||
players[0].charability = charability;
|
players[0].charability = charability;
|
||||||
players[0].charability2 = charability2;
|
players[0].charability2 = charability2;
|
||||||
players[0].actionspd = actionspd;
|
players[0].actionspd = actionspd;
|
||||||
|
@ -5156,6 +5178,8 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
players[0].accelstart = accelstart;
|
players[0].accelstart = accelstart;
|
||||||
players[0].acceleration = acceleration;
|
players[0].acceleration = acceleration;
|
||||||
players[0].jumpfactor = jumpfactor;
|
players[0].jumpfactor = jumpfactor;
|
||||||
|
players[0].height = height;
|
||||||
|
players[0].spinheight = spinheight;
|
||||||
|
|
||||||
demo_start = true;
|
demo_start = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,10 @@ static int player_get(lua_State *L)
|
||||||
LUA_PushUserdata(L, &plr->cmd, META_TICCMD);
|
LUA_PushUserdata(L, &plr->cmd, META_TICCMD);
|
||||||
else if (fastcmp(field,"playerstate"))
|
else if (fastcmp(field,"playerstate"))
|
||||||
lua_pushinteger(L, plr->playerstate);
|
lua_pushinteger(L, plr->playerstate);
|
||||||
|
else if (fastcmp(field,"camerascale"))
|
||||||
|
lua_pushfixed(L, plr->camerascale);
|
||||||
|
else if (fastcmp(field,"shieldscale"))
|
||||||
|
lua_pushfixed(L, plr->shieldscale);
|
||||||
else if (fastcmp(field,"viewz"))
|
else if (fastcmp(field,"viewz"))
|
||||||
lua_pushfixed(L, plr->viewz);
|
lua_pushfixed(L, plr->viewz);
|
||||||
else if (fastcmp(field,"viewheight"))
|
else if (fastcmp(field,"viewheight"))
|
||||||
|
@ -172,6 +176,10 @@ static int player_get(lua_State *L)
|
||||||
lua_pushfixed(L, plr->maxdash);
|
lua_pushfixed(L, plr->maxdash);
|
||||||
else if (fastcmp(field,"jumpfactor"))
|
else if (fastcmp(field,"jumpfactor"))
|
||||||
lua_pushfixed(L, plr->jumpfactor);
|
lua_pushfixed(L, plr->jumpfactor);
|
||||||
|
else if (fastcmp(field,"height"))
|
||||||
|
lua_pushfixed(L, plr->height);
|
||||||
|
else if (fastcmp(field,"spinheight"))
|
||||||
|
lua_pushfixed(L, plr->spinheight);
|
||||||
else if (fastcmp(field,"lives"))
|
else if (fastcmp(field,"lives"))
|
||||||
lua_pushinteger(L, plr->lives);
|
lua_pushinteger(L, plr->lives);
|
||||||
else if (fastcmp(field,"continues"))
|
else if (fastcmp(field,"continues"))
|
||||||
|
@ -355,6 +363,10 @@ static int player_set(lua_State *L)
|
||||||
return NOSET;
|
return NOSET;
|
||||||
else if (fastcmp(field,"playerstate"))
|
else if (fastcmp(field,"playerstate"))
|
||||||
plr->playerstate = luaL_checkinteger(L, 3);
|
plr->playerstate = luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"camerascale"))
|
||||||
|
plr->camerascale = luaL_checkfixed(L, 3);
|
||||||
|
else if (fastcmp(field,"shieldscale"))
|
||||||
|
plr->shieldscale = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"viewz"))
|
else if (fastcmp(field,"viewz"))
|
||||||
plr->viewz = luaL_checkfixed(L, 3);
|
plr->viewz = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"viewheight"))
|
else if (fastcmp(field,"viewheight"))
|
||||||
|
@ -429,6 +441,10 @@ static int player_set(lua_State *L)
|
||||||
plr->maxdash = (INT32)luaL_checkinteger(L, 3);
|
plr->maxdash = (INT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"jumpfactor"))
|
else if (fastcmp(field,"jumpfactor"))
|
||||||
plr->jumpfactor = (INT32)luaL_checkinteger(L, 3);
|
plr->jumpfactor = (INT32)luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"height"))
|
||||||
|
plr->height = luaL_checkfixed(L, 3);
|
||||||
|
else if (fastcmp(field,"spinheight"))
|
||||||
|
plr->spinheight = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"lives"))
|
else if (fastcmp(field,"lives"))
|
||||||
plr->lives = (SINT8)luaL_checkinteger(L, 3);
|
plr->lives = (SINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"continues"))
|
else if (fastcmp(field,"continues"))
|
||||||
|
|
|
@ -62,6 +62,9 @@
|
||||||
#define mariomode (maptol & TOL_MARIO)
|
#define mariomode (maptol & TOL_MARIO)
|
||||||
#define twodlevel (maptol & TOL_2D)
|
#define twodlevel (maptol & TOL_2D)
|
||||||
|
|
||||||
|
#define P_GetPlayerHeight(player) FixedMul(player->height, player->mo->scale)
|
||||||
|
#define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale)
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_TICK
|
// P_TICK
|
||||||
//
|
//
|
||||||
|
@ -119,9 +122,6 @@ extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed;
|
||||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||||
|
|
||||||
fixed_t P_GetPlayerRadius(player_t *player);
|
|
||||||
fixed_t P_GetPlayerHeight(player_t *player);
|
|
||||||
fixed_t P_GetPlayerSpinHeight(player_t *player);
|
|
||||||
INT32 P_GetPlayerControlDirection(player_t *player);
|
INT32 P_GetPlayerControlDirection(player_t *player);
|
||||||
void P_AddPlayerScore(player_t *player, UINT32 amount);
|
void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||||
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
||||||
|
|
|
@ -6301,7 +6301,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield)
|
||||||
thing->flags |= MF_NOCLIPHEIGHT;
|
thing->flags |= MF_NOCLIPHEIGHT;
|
||||||
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
|
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
|
||||||
|
|
||||||
P_SetScale(thing, FixedMul(thing->target->scale, skins[thing->target->player->skin].shieldscale));
|
P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale));
|
||||||
P_UnsetThingPosition(thing);
|
P_UnsetThingPosition(thing);
|
||||||
thing->x = thing->target->x;
|
thing->x = thing->target->x;
|
||||||
thing->y = thing->target->y;
|
thing->y = thing->target->y;
|
||||||
|
|
|
@ -259,6 +259,9 @@ static void P_NetArchivePlayers(void)
|
||||||
if (flags & AWAYVIEW)
|
if (flags & AWAYVIEW)
|
||||||
WRITEUINT32(save_p, players[i].awayviewmobj->mobjnum);
|
WRITEUINT32(save_p, players[i].awayviewmobj->mobjnum);
|
||||||
|
|
||||||
|
WRITEFIXED(save_p, players[i].camerascale);
|
||||||
|
WRITEFIXED(save_p, players[i].shieldscale);
|
||||||
|
|
||||||
WRITEUINT8(save_p, players[i].charability);
|
WRITEUINT8(save_p, players[i].charability);
|
||||||
WRITEUINT8(save_p, players[i].charability2);
|
WRITEUINT8(save_p, players[i].charability2);
|
||||||
WRITEUINT32(save_p, players[i].charflags);
|
WRITEUINT32(save_p, players[i].charflags);
|
||||||
|
@ -274,6 +277,8 @@ static void P_NetArchivePlayers(void)
|
||||||
WRITEUINT8(save_p, players[i].accelstart);
|
WRITEUINT8(save_p, players[i].accelstart);
|
||||||
WRITEUINT8(save_p, players[i].acceleration);
|
WRITEUINT8(save_p, players[i].acceleration);
|
||||||
WRITEFIXED(save_p, players[i].jumpfactor);
|
WRITEFIXED(save_p, players[i].jumpfactor);
|
||||||
|
WRITEFIXED(save_p, players[i].height);
|
||||||
|
WRITEFIXED(save_p, players[i].spinheight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +429,9 @@ static void P_NetUnArchivePlayers(void)
|
||||||
|
|
||||||
players[i].viewheight = cv_viewheight.value<<FRACBITS;
|
players[i].viewheight = cv_viewheight.value<<FRACBITS;
|
||||||
|
|
||||||
|
players[i].camerascale = READFIXED(save_p);
|
||||||
|
players[i].shieldscale = READFIXED(save_p);
|
||||||
|
|
||||||
//SetPlayerSkinByNum(i, players[i].skin);
|
//SetPlayerSkinByNum(i, players[i].skin);
|
||||||
players[i].charability = READUINT8(save_p);
|
players[i].charability = READUINT8(save_p);
|
||||||
players[i].charability2 = READUINT8(save_p);
|
players[i].charability2 = READUINT8(save_p);
|
||||||
|
@ -440,6 +448,8 @@ static void P_NetUnArchivePlayers(void)
|
||||||
players[i].accelstart = READUINT8(save_p);
|
players[i].accelstart = READUINT8(save_p);
|
||||||
players[i].acceleration = READUINT8(save_p);
|
players[i].acceleration = READUINT8(save_p);
|
||||||
players[i].jumpfactor = READFIXED(save_p);
|
players[i].jumpfactor = READFIXED(save_p);
|
||||||
|
players[i].height = READFIXED(save_p);
|
||||||
|
players[i].spinheight = READFIXED(save_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
42
src/p_user.c
42
src/p_user.c
|
@ -56,39 +56,6 @@
|
||||||
static void P_NukeAllPlayers(player_t *player);
|
static void P_NukeAllPlayers(player_t *player);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// P_GetPlayerRadius
|
|
||||||
//
|
|
||||||
// Returns the radius
|
|
||||||
// of the player.
|
|
||||||
//
|
|
||||||
fixed_t P_GetPlayerRadius(player_t *player)
|
|
||||||
{
|
|
||||||
return FixedMul(skins[player->skin].radius, player->mo->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// P_GetPlayerHeight
|
|
||||||
//
|
|
||||||
// Returns the height
|
|
||||||
// of the player.
|
|
||||||
//
|
|
||||||
fixed_t P_GetPlayerHeight(player_t *player)
|
|
||||||
{
|
|
||||||
return FixedMul(skins[player->skin].height, player->mo->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// P_GetPlayerSpinHeight
|
|
||||||
//
|
|
||||||
// Returns the 'spin height'
|
|
||||||
// of the player.
|
|
||||||
//
|
|
||||||
fixed_t P_GetPlayerSpinHeight(player_t *player)
|
|
||||||
{
|
|
||||||
return FixedMul(skins[player->skin].spinheight, player->mo->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Movement.
|
// Movement.
|
||||||
//
|
//
|
||||||
|
@ -7002,7 +6969,6 @@ static void P_MovePlayer(player_t *player)
|
||||||
player->mo->height = P_GetPlayerSpinHeight(player);
|
player->mo->height = P_GetPlayerSpinHeight(player);
|
||||||
else
|
else
|
||||||
player->mo->height = P_GetPlayerHeight(player);
|
player->mo->height = P_GetPlayerHeight(player);
|
||||||
player->mo->radius = P_GetPlayerRadius(player);
|
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP && player->mo->height != oldheight) // adjust z height for reverse gravity, similar to how it's done for scaling
|
if (player->mo->eflags & MFE_VERTICALFLIP && player->mo->height != oldheight) // adjust z height for reverse gravity, similar to how it's done for scaling
|
||||||
player->mo->z -= player->mo->height - oldheight;
|
player->mo->z -= player->mo->height - oldheight;
|
||||||
|
@ -7968,16 +7934,16 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
camspeed = cv_cam_speed.value;
|
camspeed = cv_cam_speed.value;
|
||||||
camstill = cv_cam_still.value;
|
camstill = cv_cam_still.value;
|
||||||
camrotate = cv_cam_rotate.value;
|
camrotate = cv_cam_rotate.value;
|
||||||
camdist = FixedMul(cv_cam_dist.value, FixedMul(skins[player->skin].camerascale, mo->scale));
|
camdist = FixedMul(cv_cam_dist.value, FixedMul(player->camerascale, mo->scale));
|
||||||
camheight = FixedMul(cv_cam_height.value, FixedMul(skins[player->skin].camerascale, mo->scale));
|
camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale, mo->scale));
|
||||||
}
|
}
|
||||||
else // Camera 2
|
else // Camera 2
|
||||||
{
|
{
|
||||||
camspeed = cv_cam2_speed.value;
|
camspeed = cv_cam2_speed.value;
|
||||||
camstill = cv_cam2_still.value;
|
camstill = cv_cam2_still.value;
|
||||||
camrotate = cv_cam2_rotate.value;
|
camrotate = cv_cam2_rotate.value;
|
||||||
camdist = FixedMul(cv_cam2_dist.value, FixedMul(skins[player->skin].camerascale, mo->scale));
|
camdist = FixedMul(cv_cam2_dist.value, FixedMul(player->camerascale, mo->scale));
|
||||||
camheight = FixedMul(cv_cam2_height.value, FixedMul(skins[player->skin].camerascale, mo->scale));
|
camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REDSANALOG
|
#ifdef REDSANALOG
|
||||||
|
|
|
@ -2432,7 +2432,7 @@ void SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||||
INT32 i = R_SkinAvailable(skinname);
|
INT32 i = R_SkinAvailable(skinname);
|
||||||
player_t *player = &players[playernum];
|
player_t *player = &players[playernum];
|
||||||
|
|
||||||
if (i != -1)
|
if ((i != -1) && (!P_IsLocalPlayer(player) || R_SkinUnlock(i)))
|
||||||
{
|
{
|
||||||
SetPlayerSkinByNum(playernum, i);
|
SetPlayerSkinByNum(playernum, i);
|
||||||
return;
|
return;
|
||||||
|
@ -2459,6 +2459,9 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||||
{
|
{
|
||||||
player->skin = skinnum;
|
player->skin = skinnum;
|
||||||
|
|
||||||
|
player->camerascale = skin->camerascale;
|
||||||
|
player->shieldscale = skin->shieldscale;
|
||||||
|
|
||||||
player->charability = (UINT8)skin->ability;
|
player->charability = (UINT8)skin->ability;
|
||||||
player->charability2 = (UINT8)skin->ability2;
|
player->charability2 = (UINT8)skin->ability2;
|
||||||
|
|
||||||
|
@ -2480,6 +2483,9 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||||
|
|
||||||
player->jumpfactor = skin->jumpfactor;
|
player->jumpfactor = skin->jumpfactor;
|
||||||
|
|
||||||
|
player->height = skin->height;
|
||||||
|
player->spinheight = skin->spinheight;
|
||||||
|
|
||||||
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
|
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
|
||||||
{
|
{
|
||||||
if (playernum == consoleplayer)
|
if (playernum == consoleplayer)
|
||||||
|
@ -2500,6 +2506,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||||
if (newcolor)
|
if (newcolor)
|
||||||
player->mo->color = newcolor;
|
player->mo->color = newcolor;
|
||||||
P_SetScale(player->mo, player->mo->scale);
|
P_SetScale(player->mo, player->mo->scale);
|
||||||
|
player->mo->radius = FixedMul(skin->radius, player->mo->scale);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue