mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
use player->carry and player->mobj->tracer
This commit is contained in:
parent
54b14fea3f
commit
ed5adc5b78
6 changed files with 8 additions and 20 deletions
|
|
@ -150,6 +150,7 @@ typedef enum
|
||||||
CR_SLIDING,
|
CR_SLIDING,
|
||||||
CR_ZOOMTUBE,
|
CR_ZOOMTUBE,
|
||||||
CR_DASHRING,
|
CR_DASHRING,
|
||||||
|
CR_TRAPBUBBLE,
|
||||||
} carrytype_t; // carry
|
} carrytype_t; // carry
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -775,8 +776,6 @@ struct player_t
|
||||||
UINT8 curshield; // see kartshields_t
|
UINT8 curshield; // see kartshields_t
|
||||||
UINT8 bubblecool; // Bubble Shield use cooldown
|
UINT8 bubblecool; // Bubble Shield use cooldown
|
||||||
UINT8 bubbleblowup; // Bubble Shield usage blowup
|
UINT8 bubbleblowup; // Bubble Shield usage blowup
|
||||||
mobj_t *bubbletrap; // Bubble player is trapped inside
|
|
||||||
boolean gotbubbletrapped; //to know if player was got trapped
|
|
||||||
UINT16 flamedash; // Flame Shield dash power
|
UINT16 flamedash; // Flame Shield dash power
|
||||||
UINT16 flamemeter; // Flame Shield dash meter left
|
UINT16 flamemeter; // Flame Shield dash meter left
|
||||||
UINT8 flamelength; // Flame Shield dash meter, number of segments
|
UINT8 flamelength; // Flame Shield dash meter, number of segments
|
||||||
|
|
|
||||||
|
|
@ -4671,6 +4671,7 @@ struct int_const_s const INT_CONST[] = {
|
||||||
// Carrying
|
// Carrying
|
||||||
{"CR_NONE",CR_NONE},
|
{"CR_NONE",CR_NONE},
|
||||||
{"CR_ZOOMTUBE",CR_ZOOMTUBE},
|
{"CR_ZOOMTUBE",CR_ZOOMTUBE},
|
||||||
|
{"CR_TRAPBUBBLE",CR_TRAPBUBBLE},
|
||||||
|
|
||||||
// Character flags (skinflags_t)
|
// Character flags (skinflags_t)
|
||||||
{"SF_MACHINE",SF_MACHINE},
|
{"SF_MACHINE",SF_MACHINE},
|
||||||
|
|
|
||||||
|
|
@ -726,10 +726,11 @@ static void K_DropDashWait(player_t *player)
|
||||||
if (player->pflags & PF_FAULT)
|
if (player->pflags & PF_FAULT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if player got trapped inside a ubble but lost its bubble object in a unintended way, remove no gravity flag
|
// if player got trapped inside a bubble but lost its bubble object in a unintended way, remove no gravity flag
|
||||||
if ((P_MobjWasRemoved(player->bubbletrap) && player->gotbubbletrapped == true) && (player->mo->flags & MF_NOGRAVITY))
|
if (((P_MobjWasRemoved(player->mo->tracer) || player->mo->tracer == NULL) && player->carry == CR_TRAPBUBBLE) && (player->mo->flags & MF_NOGRAVITY))
|
||||||
{
|
{
|
||||||
player->mo->flags &= ~MF_NOGRAVITY;
|
player->mo->flags &= ~MF_NOGRAVITY;
|
||||||
|
player->carry = CR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leveltime % 8 == 0)
|
if (leveltime % 8 == 0)
|
||||||
|
|
|
||||||
|
|
@ -430,10 +430,6 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->bubblecool);
|
lua_pushinteger(L, plr->bubblecool);
|
||||||
else if (fastcmp(field,"bubbleblowup"))
|
else if (fastcmp(field,"bubbleblowup"))
|
||||||
lua_pushinteger(L, plr->bubbleblowup);
|
lua_pushinteger(L, plr->bubbleblowup);
|
||||||
else if (fastcmp(field,"bubbletrap"))
|
|
||||||
LUA_PushUserdata(L, plr->bubbletrap, META_MOBJ);
|
|
||||||
else if (fastcmp(field,"gotbubbletrapped"))
|
|
||||||
lua_pushboolean(L, plr->gotbubbletrapped);
|
|
||||||
else if (fastcmp(field,"flamedash"))
|
else if (fastcmp(field,"flamedash"))
|
||||||
lua_pushinteger(L, plr->flamedash);
|
lua_pushinteger(L, plr->flamedash);
|
||||||
else if (fastcmp(field,"counterdash"))
|
else if (fastcmp(field,"counterdash"))
|
||||||
|
|
@ -998,15 +994,6 @@ static int player_set(lua_State *L)
|
||||||
plr->bubblecool = luaL_checkinteger(L, 3);
|
plr->bubblecool = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"bubbleblowup"))
|
else if (fastcmp(field,"bubbleblowup"))
|
||||||
plr->bubbleblowup = luaL_checkinteger(L, 3);
|
plr->bubbleblowup = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"bubbletrap"))
|
|
||||||
{
|
|
||||||
mobj_t *mo = NULL;
|
|
||||||
if (!lua_isnil(L, 3))
|
|
||||||
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
|
||||||
P_SetTarget(&plr->bubbletrap, mo);
|
|
||||||
}
|
|
||||||
else if (fastcmp(field,"gotbubbletrapped"))
|
|
||||||
plr->gotbubbletrapped = luaL_checkboolean(L, 3);
|
|
||||||
else if (fastcmp(field,"flamedash"))
|
else if (fastcmp(field,"flamedash"))
|
||||||
plr->flamedash = luaL_checkinteger(L, 3);
|
plr->flamedash = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"counterdash"))
|
else if (fastcmp(field,"counterdash"))
|
||||||
|
|
|
||||||
|
|
@ -642,8 +642,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
P_SetTarget(&special->tracer, toucher);
|
P_SetTarget(&special->tracer, toucher);
|
||||||
toucher->flags |= MF_NOGRAVITY;
|
toucher->flags |= MF_NOGRAVITY;
|
||||||
toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher);
|
toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher);
|
||||||
toucher->player->gotbubbletrapped = true;
|
toucher->player->carry = CR_TRAPBUBBLE;
|
||||||
P_SetTarget(&toucher->player->bubbletrap, special); //allow it to access later on and to know if player is trapped
|
P_SetTarget(&toucher->tracer, special); //use tracer to acces the object
|
||||||
|
|
||||||
// Snap to the unfortunate player and quit moving laterally, or we can end up quite far away
|
// Snap to the unfortunate player and quit moving laterally, or we can end up quite far away
|
||||||
special->momx = 0;
|
special->momx = 0;
|
||||||
|
|
|
||||||
|
|
@ -9387,7 +9387,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||||
{
|
{
|
||||||
S_StartSound(mobj->tracer, sfx_s3k77);
|
S_StartSound(mobj->tracer, sfx_s3k77);
|
||||||
mobj->tracer->flags &= ~MF_NOGRAVITY;
|
mobj->tracer->flags &= ~MF_NOGRAVITY;
|
||||||
mobj->tracer->player->gotbubbletrapped = false;
|
mobj->tracer->player->carry = CR_NONE;
|
||||||
P_KillMobj(mobj, mobj->tracer, mobj->tracer, DMG_NORMAL);
|
P_KillMobj(mobj, mobj->tracer, mobj->tracer, DMG_NORMAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue