mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
Drawangle.
Mystic wanted it, just play it - too busy to give proper commit description. Will outline everything it is in the merge request when that happens.
This commit is contained in:
parent
cfb5a9d904
commit
260b461c39
7 changed files with 32 additions and 6 deletions
|
@ -315,6 +315,9 @@ typedef struct player_s
|
|||
// It is updated with cmd->aiming.
|
||||
angle_t aiming;
|
||||
|
||||
// fun thing for player sprite
|
||||
angle_t drawangle;
|
||||
|
||||
// player's ring count
|
||||
INT32 rings;
|
||||
|
||||
|
|
|
@ -122,6 +122,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushfixed(L, plr->bob);
|
||||
else if (fastcmp(field,"aiming"))
|
||||
lua_pushangle(L, plr->aiming);
|
||||
else if (fastcmp(field,"drawangle"))
|
||||
lua_pushangle(L, plr->drawangle);
|
||||
else if (fastcmp(field,"rings"))
|
||||
lua_pushinteger(L, plr->rings);
|
||||
else if (fastcmp(field,"pity"))
|
||||
|
@ -382,6 +384,8 @@ static int player_set(lua_State *L)
|
|||
else if (plr == &players[secondarydisplayplayer])
|
||||
localaiming2 = plr->aiming;
|
||||
}
|
||||
else if (fastcmp(field,"drawangle"))
|
||||
plr->drawangle = luaL_checkangle(L, 3);
|
||||
else if (fastcmp(field,"rings"))
|
||||
plr->rings = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"pity"))
|
||||
|
|
|
@ -4854,6 +4854,7 @@ void A_CapeChase(mobj_t *actor)
|
|||
fixed_t foffsetx, foffsety, boffsetx, boffsety;
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
angle_t angle;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_CapeChase", actor))
|
||||
return;
|
||||
|
@ -4875,11 +4876,13 @@ void A_CapeChase(mobj_t *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
foffsetx = P_ReturnThrustX(chaser, chaser->angle, FixedMul((locvar2 >> 16)*FRACUNIT, actor->scale));
|
||||
foffsety = P_ReturnThrustY(chaser, chaser->angle, FixedMul((locvar2 >> 16)*FRACUNIT, actor->scale));
|
||||
angle = (chaser->player ? chaser->player->drawangle : chaser->angle);
|
||||
|
||||
boffsetx = P_ReturnThrustX(chaser, chaser->angle-ANGLE_90, FixedMul((locvar2 & 65535)*FRACUNIT, actor->scale));
|
||||
boffsety = P_ReturnThrustY(chaser, chaser->angle-ANGLE_90, FixedMul((locvar2 & 65535)*FRACUNIT, actor->scale));
|
||||
foffsetx = P_ReturnThrustX(chaser, angle, FixedMul((locvar2 >> 16)*FRACUNIT, actor->scale));
|
||||
foffsety = P_ReturnThrustY(chaser, angle, FixedMul((locvar2 >> 16)*FRACUNIT, actor->scale));
|
||||
|
||||
boffsetx = P_ReturnThrustX(chaser, angle-ANGLE_90, FixedMul((locvar2 & 65535)*FRACUNIT, actor->scale));
|
||||
boffsety = P_ReturnThrustY(chaser, angle-ANGLE_90, FixedMul((locvar2 & 65535)*FRACUNIT, actor->scale));
|
||||
|
||||
P_UnsetThingPosition(actor);
|
||||
actor->x = chaser->x + foffsetx + boffsetx;
|
||||
|
@ -4896,7 +4899,7 @@ void A_CapeChase(mobj_t *actor)
|
|||
actor->flags2 &= ~MF2_OBJECTFLIP;
|
||||
actor->z = chaser->z + FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale);
|
||||
}
|
||||
actor->angle = chaser->angle;
|
||||
actor->angle = angle;
|
||||
P_SetThingPosition(actor);
|
||||
}
|
||||
|
||||
|
|
|
@ -9140,6 +9140,7 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
|||
}
|
||||
|
||||
SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle);
|
||||
p->drawangle = mobj->angle;
|
||||
|
||||
if (camera.chase)
|
||||
{
|
||||
|
|
|
@ -126,6 +126,7 @@ static void P_NetArchivePlayers(void)
|
|||
// no longer send ticcmds, player name, skin, or color
|
||||
|
||||
WRITEANGLE(save_p, players[i].aiming);
|
||||
WRITEANGLE(save_p, players[i].drawangle);
|
||||
WRITEANGLE(save_p, players[i].awayviewaiming);
|
||||
WRITEINT32(save_p, players[i].awayviewtics);
|
||||
WRITEINT32(save_p, players[i].rings);
|
||||
|
@ -306,6 +307,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
// (that data is handled in the server config now)
|
||||
|
||||
players[i].aiming = READANGLE(save_p);
|
||||
players[i].drawangle = READANGLE(save_p);
|
||||
players[i].awayviewaiming = READANGLE(save_p);
|
||||
players[i].awayviewtics = READINT32(save_p);
|
||||
players[i].rings = READINT32(save_p);
|
||||
|
|
13
src/p_user.c
13
src/p_user.c
|
@ -9194,6 +9194,19 @@ void P_PlayerThink(player_t *player)
|
|||
if (!player->mo)
|
||||
return; // P_MovePlayer removed player->mo.
|
||||
|
||||
if (player->climbing // stuff where the direction is forced at all times
|
||||
|| G_RingSlingerGametype()) // no firing rings in directions your player isn't aiming
|
||||
player->drawangle = player->mo->angle;
|
||||
else if (P_PlayerInPain(player) && (player->mo->momx || player->mo->momy))
|
||||
player->drawangle = R_PointToAngle2(player->mo->momx, player->mo->momy, 0, 0);
|
||||
else if (cmd->forwardmove || cmd->sidemove || cmd->buttons) // only when you're pressing buttons
|
||||
{
|
||||
if (player->mo->momx || player->mo->momy) // only when you're moing
|
||||
player->drawangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
else
|
||||
player->drawangle = player->mo->angle; // spindash, etc
|
||||
}
|
||||
|
||||
// Unset statis flags after moving.
|
||||
// In other words, if you manually set stasis via code,
|
||||
// it lasts for one tic.
|
||||
|
|
|
@ -1210,7 +1210,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
{
|
||||
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
|
||||
ang = R_PointToAngle (thing->x, thing->y) - (thing->player ? thing->player->drawangle : thing->angle);
|
||||
if (papersprite)
|
||||
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue