Basic implementation for player position correction to Drone center

* player->drone mobj variable
* P_MoveNiGHTSToDrone, will change later
This commit is contained in:
mazmazz 2018-08-10 19:25:49 -04:00
parent e0e77d873b
commit 32c17b1454
6 changed files with 50 additions and 1 deletions

View File

@ -455,6 +455,7 @@ typedef struct player_s
UINT8 drilldelay;
boolean bonustime; // Capsule destroyed, now it's bonus time!
mobj_t *capsule; // Go inside the capsule
mobj_t *drone; // Move center to the drone
UINT8 mare; // Current mare
// Statistical purposes.

View File

@ -288,6 +288,8 @@ static int player_get(lua_State *L)
lua_pushboolean(L, plr->bonustime);
else if (fastcmp(field,"capsule"))
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
else if (fastcmp(field,"drone"))
LUA_PushUserdata(L, plr->drone, META_MOBJ);
else if (fastcmp(field,"mare"))
lua_pushinteger(L, plr->mare);
else if (fastcmp(field,"marebegunat"))
@ -568,6 +570,13 @@ static int player_set(lua_State *L)
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
P_SetTarget(&plr->capsule, mo);
}
else if (fastcmp(field,"drone"))
{
mobj_t *mo = NULL;
if (!lua_isnil(L, 3))
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
P_SetTarget(&plr->drone, mo);
}
else if (fastcmp(field,"mare"))
plr->mare = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"marebegunat"))

View File

@ -794,6 +794,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (!(netgame || multiplayer) && !(player->powers[pw_carry] == CR_NIGHTSMODE))
P_SetTarget(&special->tracer, toucher);
P_NightserizePlayer(player, special->health); // Transform!
P_SetTarget(&player->drone, special); // Mark the player as 'center into the drone'
if (!spec)
{
if (toucher->tracer) // Move the ideya over to the drone!

View File

@ -57,6 +57,7 @@ typedef enum
FIRSTAXIS = 0x10,
SECONDAXIS = 0x20,
FOLLOW = 0x40,
DRONE = 0x80,
} player_saveflags;
//
@ -226,6 +227,9 @@ static void P_NetArchivePlayers(void)
if (players[i].followmobj)
flags |= FOLLOW;
if (players[i].drone)
flags |= DRONE;
WRITEINT16(save_p, players[i].lastsidehit);
WRITEINT16(save_p, players[i].lastlinehit);
@ -254,6 +258,9 @@ static void P_NetArchivePlayers(void)
if (flags & FOLLOW)
WRITEUINT32(save_p, players[i].followmobj->mobjnum);
if (flags & DRONE)
WRITEUINT32(save_p, players[i].drone->mobjnum);
WRITEFIXED(save_p, players[i].camerascale);
WRITEFIXED(save_p, players[i].shieldscale);
@ -428,6 +435,9 @@ static void P_NetUnArchivePlayers(void)
if (flags & FOLLOW)
players[i].followmobj = (mobj_t *)(size_t)READUINT32(save_p);
if (flags & DRONE)
players[i].drone = (mobj_t *)(size_t)READUINT32(save_p);
players[i].camerascale = READFIXED(save_p);
players[i].shieldscale = READFIXED(save_p);
@ -3099,6 +3109,13 @@ static void P_RelinkPointers(void)
if (!P_SetTarget(&mobj->player->followmobj, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "followmobj not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->drone)
{
temp = (UINT32)(size_t)mobj->player->drone;
mobj->player->drone = NULL;
if (!P_SetTarget(&mobj->player->drone, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "drone not found on %d\n", mobj->type);
}
}
}
}

View File

@ -2401,7 +2401,7 @@ static void P_LevelInitStuff(void)
// unset ALL the pointers. P_SetTarget isn't needed here because if this
// function is being called we're just going to clobber the data anyways
players[i].mo = players[i].followmobj = players[i].awayviewmobj =\
players[i].capsule = players[i].axis1 = players[i].axis2 = NULL;
players[i].capsule = players[i].axis1 = players[i].axis2 = players[i].drone = NULL;
}
}

View File

@ -6095,6 +6095,20 @@ static void P_DoNiGHTSCapsule(player_t *player)
player->capsule->extravalue1 = -1;
}
//
// P_MoveNiGHTSToDrone
//
// Pull NiGHTS to the drone during Nightserizing
//
static void P_MoveNiGHTSToDrone(player_t *player)
{
if (!player->drone)
return;
player->mo->momx = player->mo->momy = player->mo->momz = 0;
P_TeleportMove(player->mo, player->drone->x, player->drone->y, player->drone->z);
P_SetTarget(&player->drone, NULL);
}
//
// P_NiGHTSMovement
//
@ -7007,6 +7021,13 @@ static void P_MovePlayer(player_t *player)
return;
}
// Suck player into their drone
if (player->drone)
{
P_MoveNiGHTSToDrone(player);
return;
}
// Test revamped NiGHTS movement.
if (player->powers[pw_carry] == CR_NIGHTSMODE)
{