mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-18 19:41:29 +00:00
servant-hand.c
This commit is contained in:
parent
1fee9f65fb
commit
fa10ff629f
5 changed files with 108 additions and 98 deletions
98
src/k_kart.c
98
src/k_kart.c
|
|
@ -8282,7 +8282,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
K_KartEbrakeVisuals(player);
|
||||
|
||||
K_KartServantHandVisuals(player);
|
||||
Obj_ServantHandHandling(player);
|
||||
}
|
||||
|
||||
if (K_GetKartButtons(player) & BT_BRAKE &&
|
||||
|
|
@ -10170,102 +10170,6 @@ void K_KartEbrakeVisuals(player_t *p)
|
|||
}
|
||||
}
|
||||
|
||||
void K_KartServantHandVisuals(player_t *player)
|
||||
{
|
||||
if (player->pflags & PF_WRONGWAY)
|
||||
{
|
||||
if (player->handtimer < TICRATE)
|
||||
{
|
||||
player->handtimer++;
|
||||
if (player->hand == NULL && player->handtimer == TICRATE)
|
||||
{
|
||||
mobj_t *hand = P_SpawnMobj(
|
||||
player->mo->x,
|
||||
player->mo->y,
|
||||
player->mo->z + player->mo->height + 30*mapobjectscale,
|
||||
MT_SERVANTHAND
|
||||
);
|
||||
|
||||
if (hand)
|
||||
{
|
||||
K_FlipFromObject(hand, player->mo);
|
||||
hand->old_z = hand->z;
|
||||
|
||||
P_SetTarget(&hand->target, player->mo);
|
||||
P_SetTarget(&player->hand, hand);
|
||||
|
||||
hand->fuse = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player->hand)
|
||||
{
|
||||
player->hand->destscale = mapobjectscale;
|
||||
}
|
||||
}
|
||||
else if (player->handtimer != 0)
|
||||
{
|
||||
player->handtimer--;
|
||||
}
|
||||
|
||||
if (player->hand)
|
||||
{
|
||||
const fixed_t handpokespeed = 4;
|
||||
const fixed_t looping = handpokespeed - abs((player->hand->threshold % (handpokespeed*2)) - handpokespeed);
|
||||
fixed_t xoffs = 0, yoffs = 0;
|
||||
|
||||
player->hand->color = player->skincolor;
|
||||
player->hand->angle = player->besthanddirection;
|
||||
|
||||
if (player->hand->fuse != 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (looping != 0)
|
||||
{
|
||||
xoffs = FixedMul(2 * looping * mapobjectscale, FINECOSINE(player->hand->angle >> ANGLETOFINESHIFT)),
|
||||
yoffs = FixedMul(2 * looping * mapobjectscale, FINESINE(player->hand->angle >> ANGLETOFINESHIFT)),
|
||||
|
||||
player->hand->threshold++;
|
||||
}
|
||||
else if (player->handtimer == 0)
|
||||
{
|
||||
player->hand->fuse = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->hand->threshold++;
|
||||
}
|
||||
|
||||
if (player->hand->fuse != 0)
|
||||
{
|
||||
if ((player->hand->fuse > 4) ^ (player->handtimer < TICRATE/2))
|
||||
{
|
||||
player->hand->spritexscale = FRACUNIT/3;
|
||||
player->hand->spriteyscale = 3*FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->hand->spritexscale = 2*FRACUNIT;
|
||||
player->hand->spriteyscale = FRACUNIT/2;
|
||||
}
|
||||
}
|
||||
|
||||
P_MoveOrigin(player->hand,
|
||||
player->mo->x + xoffs,
|
||||
player->mo->y + yoffs,
|
||||
player->mo->z + player->mo->height + 30*mapobjectscale
|
||||
);
|
||||
K_FlipFromObject(player->hand, player->mo);
|
||||
|
||||
player->hand->sprzoff = player->mo->sprzoff;
|
||||
|
||||
player->hand->renderflags &= ~RF_DONTDRAW;
|
||||
player->hand->renderflags |= (RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(player));
|
||||
}
|
||||
}
|
||||
|
||||
static void K_KartSpindashDust(mobj_t *parent)
|
||||
{
|
||||
fixed_t rad = FixedDiv(FixedHypot(parent->radius, parent->radius), parent->scale);
|
||||
|
|
|
|||
|
|
@ -196,7 +196,6 @@ UINT8 K_GetInvincibilityItemFrame(void);
|
|||
UINT8 K_GetOrbinautItemFrame(UINT8 count);
|
||||
boolean K_IsSPBInGame(void);
|
||||
void K_KartEbrakeVisuals(player_t *p);
|
||||
void K_KartServantHandVisuals(player_t *player);
|
||||
void K_HandleDirectionalInfluence(player_t *player);
|
||||
fixed_t K_DefaultPlayerRadius(player_t *player);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,6 +137,9 @@ void Obj_RandomItemSpawn(mobj_t *mobj);
|
|||
void Obj_GachaBomReboundThink(mobj_t *mobj);
|
||||
void Obj_SpawnGachaBomRebound(mobj_t *source, mobj_t *target);
|
||||
|
||||
/* Servant Hand */
|
||||
void Obj_ServantHandHandling(player_t *player);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,4 +20,5 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
instawhip.c
|
||||
block.c
|
||||
gachabom-rebound.cpp
|
||||
servant-hand.c
|
||||
)
|
||||
|
|
|
|||
103
src/objects/servant-hand.c
Normal file
103
src/objects/servant-hand.c
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#include "../doomdef.h"
|
||||
#include "../p_local.h"
|
||||
#include "../p_mobj.h"
|
||||
#include "../d_player.h"
|
||||
#include "../k_kart.h"
|
||||
#include "../k_objects.h"
|
||||
#include "../v_video.h"
|
||||
|
||||
void Obj_ServantHandHandling(player_t *player)
|
||||
{
|
||||
if (player->pflags & PF_WRONGWAY)
|
||||
{
|
||||
if (player->handtimer < TICRATE)
|
||||
{
|
||||
player->handtimer++;
|
||||
if (player->hand == NULL && player->handtimer == TICRATE)
|
||||
{
|
||||
mobj_t *hand = P_SpawnMobj(
|
||||
player->mo->x,
|
||||
player->mo->y,
|
||||
player->mo->z + player->mo->height + 30*mapobjectscale,
|
||||
MT_SERVANTHAND
|
||||
);
|
||||
|
||||
if (hand)
|
||||
{
|
||||
K_FlipFromObject(hand, player->mo);
|
||||
hand->old_z = hand->z;
|
||||
|
||||
P_SetTarget(&hand->target, player->mo);
|
||||
P_SetTarget(&player->hand, hand);
|
||||
|
||||
hand->fuse = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player->hand)
|
||||
{
|
||||
player->hand->destscale = mapobjectscale;
|
||||
}
|
||||
}
|
||||
else if (player->handtimer != 0)
|
||||
{
|
||||
player->handtimer--;
|
||||
}
|
||||
|
||||
if (player->hand)
|
||||
{
|
||||
const fixed_t handpokespeed = 4;
|
||||
const fixed_t looping = handpokespeed - abs((player->hand->threshold % (handpokespeed*2)) - handpokespeed);
|
||||
fixed_t xoffs = 0, yoffs = 0;
|
||||
|
||||
player->hand->color = player->skincolor;
|
||||
player->hand->angle = player->besthanddirection;
|
||||
|
||||
if (player->hand->fuse != 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (looping != 0)
|
||||
{
|
||||
xoffs = FixedMul(2 * looping * mapobjectscale, FINECOSINE(player->hand->angle >> ANGLETOFINESHIFT)),
|
||||
yoffs = FixedMul(2 * looping * mapobjectscale, FINESINE(player->hand->angle >> ANGLETOFINESHIFT)),
|
||||
|
||||
player->hand->threshold++;
|
||||
}
|
||||
else if (player->handtimer == 0)
|
||||
{
|
||||
player->hand->fuse = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->hand->threshold++;
|
||||
}
|
||||
|
||||
if (player->hand->fuse != 0)
|
||||
{
|
||||
if ((player->hand->fuse > 4) ^ (player->handtimer < TICRATE/2))
|
||||
{
|
||||
player->hand->spritexscale = FRACUNIT/3;
|
||||
player->hand->spriteyscale = 3*FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->hand->spritexscale = 2*FRACUNIT;
|
||||
player->hand->spriteyscale = FRACUNIT/2;
|
||||
}
|
||||
}
|
||||
|
||||
P_MoveOrigin(player->hand,
|
||||
player->mo->x + xoffs,
|
||||
player->mo->y + yoffs,
|
||||
player->mo->z + player->mo->height + 30*mapobjectscale
|
||||
);
|
||||
K_FlipFromObject(player->hand, player->mo);
|
||||
|
||||
player->hand->sprzoff = player->mo->sprzoff;
|
||||
|
||||
player->hand->renderflags &= ~RF_DONTDRAW;
|
||||
player->hand->renderflags |= (RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(player));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue