Add clipdist member to player struct to control how close the player can get to walls

git-svn-id: https://svn.eduke32.com/eduke32@6230 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-06-23 03:58:43 +00:00
parent 4ae5f2e298
commit a3fbe4c542
6 changed files with 21 additions and 12 deletions

View file

@ -975,6 +975,7 @@ const memberlabel_t PlayerLabels[]=
{ "weapon_pos", PLAYER_WEAPON_POS, 0, 0 },
{ "frag_ps", PLAYER_FRAG_PS, 0, 0 },
{ "transporter_hold", PLAYER_TRANSPORTER_HOLD, 0, 0 },
{ "clipdist", PLAYER_CLIPDIST, 0, 0 },
{ "last_full_weapon", PLAYER_LAST_FULL_WEAPON, 0, 0 },
{ "footprintshade", PLAYER_FOOTPRINTSHADE, 0, 0 },
{ "boot_amount", PLAYER_BOOT_AMOUNT, 0, 0 },

View file

@ -351,6 +351,7 @@ enum PlayerLabel_t
PLAYER_WEAPON_POS,
PLAYER_FRAG_PS,
PLAYER_TRANSPORTER_HOLD,
PLAYER_CLIPDIST,
PLAYER_LAST_FULL_WEAPON,
PLAYER_FOOTPRINTSHADE,
PLAYER_BOOT_AMOUNT,

View file

@ -513,6 +513,7 @@ int32_t __fastcall VM_GetPlayer(int32_t const playerNum, int32_t labelNum, int32
case PLAYER_WEAPON_POS: labelNum = ps->weapon_pos; break;
case PLAYER_FRAG_PS: labelNum = ps->frag_ps; break;
case PLAYER_TRANSPORTER_HOLD: labelNum = ps->transporter_hold; break;
case PLAYER_CLIPDIST: labelNum = ps->clipdist; break;
case PLAYER_LAST_FULL_WEAPON: labelNum = ps->last_full_weapon; break;
case PLAYER_FOOTPRINTSHADE: labelNum = ps->footprintshade; break;
case PLAYER_BOOT_AMOUNT: labelNum = ps->inv_amount[GET_BOOTS]; break;
@ -698,6 +699,7 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_WEAPON_POS: ps->weapon_pos = iSet; break;
case PLAYER_FRAG_PS: ps->frag_ps = iSet; break;
case PLAYER_TRANSPORTER_HOLD: ps->transporter_hold = iSet; break;
case PLAYER_CLIPDIST: ps->clipdist = iSet; break;
case PLAYER_LAST_FULL_WEAPON: ps->last_full_weapon = iSet; break;
case PLAYER_FOOTPRINTSHADE: ps->footprintshade = iSet; break;
case PLAYER_BOOT_AMOUNT: ps->inv_amount[GET_BOOTS] = iSet; break;

View file

@ -4491,7 +4491,7 @@ static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ,
}
clipmove((vec3_t *) pPlayer, &pPlayer->cursectnum,
0, 0, 164L, (4L<<8), (4L<<8), CLIPMASK0);
0, 0, pPlayer->clipdist, (4L<<8), (4L<<8), CLIPMASK0);
// p->bobcounter += 32;
}
@ -4574,7 +4574,7 @@ void P_ProcessInput(int playerNum)
pPlayer->sbs = 0;
int32_t floorZ, ceilZ, highZhit, lowZhit;
getzrange((vec3_t *)pPlayer, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, 163L, CLIPMASK0);
getzrange((vec3_t *)pPlayer, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, pPlayer->clipdist - 1, CLIPMASK0);
#ifdef YAX_ENABLE
getzsofslope_player(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y, &pPlayer->truecz, &pPlayer->truefz);
@ -4628,17 +4628,17 @@ void P_ProcessInput(int playerNum)
}
}
int spriteNum = -1;
if (lowZhit >= 0 && (lowZhit&49152) == 49152)
{
spriteNum = lowZhit&(MAXSPRITES-1);
int spriteNum = lowZhit&(MAXSPRITES-1);
if ((sprite[spriteNum].cstat&33) == 33 || (sprite[spriteNum].cstat&17) == 17 ||
clipshape_idx_for_sprite((uspritetype *)&sprite[spriteNum], -1) >= 0)
{
// EDuke32 extension: xvel of 1 makes a sprite be never regarded as a bridge.
if ((sprite[spriteNum].xvel&1) == 0)
if ((sprite[spriteNum].xvel & 1) == 0 &&
(sprite[spriteNum].z - ((tilesiz[sprite[spriteNum].picnum].y * sprite[spriteNum].yrepeat) << 2))
< (pSprite->z - (PHEIGHT - pPlayer->autostep)))
{
sectorLotag = 0;
pPlayer->footprintcount = 0;
@ -4847,6 +4847,8 @@ void P_ProcessInput(int playerNum)
{
if (pPlayer->cursectnum >= 0 && (sector[pPlayer->cursectnum].floorstat & 2) != 2)
{
int spriteNum = -1;
for (spriteNum = headspritesect[pPlayer->cursectnum]; spriteNum >= 0; spriteNum = nextspritesect[spriteNum])
{
if (sprite[spriteNum].picnum == FOOTPRINTS || sprite[spriteNum].picnum == FOOTPRINTS2 ||
@ -5216,8 +5218,10 @@ HORIZONLY:;
updatesectorz(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z, &pPlayer->cursectnum);
}
#endif
if ((spriteNum = clipmove((vec3_t *)pPlayer, &pPlayer->cursectnum, pPlayer->vel.x + (pPlayer->fric.x << 9),
pPlayer->vel.y + (pPlayer->fric.y << 9), 164L, (4L << 8), stepHeight, CLIPMASK0)))
int const spriteNum = clipmove((vec3_t *) pPlayer, &pPlayer->cursectnum, pPlayer->vel.x + (pPlayer->fric.x << 9),
pPlayer->vel.y + (pPlayer->fric.y << 9), pPlayer->clipdist, (4L << 8), stepHeight, CLIPMASK0);
if (spriteNum)
P_CheckTouchDamage(pPlayer, spriteNum);
pPlayer->fric.x = pPlayer->fric.y = 0;
@ -5244,7 +5248,7 @@ HORIZONLY:;
}
pPlayer->pos.z += PHEIGHT;
setsprite(pPlayer->i, (vec3_t *)&pPlayer->pos.x);
setsprite(pPlayer->i, &pPlayer->pos);
pPlayer->pos.z -= PHEIGHT;
// ST_2_UNDERWATER
@ -5270,7 +5274,7 @@ HORIZONLY:;
if (pPlayer->cursectnum >= 0 && ud.noclip == 0)
{
int const squishPlayer = (pushmove((vec3_t *)pPlayer, &pPlayer->cursectnum, 164L, (4L << 8), (4L << 8), CLIPMASK0) < 0 &&
int const squishPlayer = (pushmove((vec3_t *)pPlayer, &pPlayer->cursectnum, pPlayer->clipdist, (4L << 8), (4L << 8), CLIPMASK0) < 0 &&
A_GetFurthestAngle(pPlayer->i, 8) < 512);
if (squishPlayer || klabs(actor[pPlayer->i].floorz-actor[pPlayer->i].ceilingz) < (48<<8))

View file

@ -168,7 +168,7 @@ typedef struct {
int16_t orotscrnang, rotscrnang, dead_flag; // JBF 20031220: added orotscrnang
int16_t holoduke_on, pycount;
int16_t transporter_hold;
int16_t transporter_hold, clipdist;
uint8_t max_secret_rooms, secret_rooms;
// XXX: 255 values for frag(gedself) seems too small.
@ -203,7 +203,7 @@ typedef struct {
// anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i.
struct { int32_t idx; } wa;
#endif
int8_t padding_;
int8_t padding_[3];
} DukePlayer_t;
// KEEPINSYNC lunatic/_defs_game.lua

View file

@ -767,6 +767,7 @@ void P_ResetStatus(int playerNum)
pPlayer->crack_time = 0;
pPlayer->hbomb_hold_delay = 0;
pPlayer->transporter_hold = 0;
pPlayer->clipdist = 164;
pPlayer->wantweaponfire = -1;
pPlayer->hurt_delay = 0;
pPlayer->footprintcount = 0;