mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Shield fixups
This commit is contained in:
		
							parent
							
								
									7c249318c4
								
							
						
					
					
						commit
						1b8faf9233
					
				
					 6 changed files with 49 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -746,6 +746,7 @@ struct player_t
 | 
			
		|||
	UINT8 tripwireState; // see tripwirestate_t
 | 
			
		||||
	UINT8 tripwirePass; // see tripwirepass_t
 | 
			
		||||
	UINT16 tripwireLeniency;	// When reaching a state that lets you go thru tripwire, you get an extra second leniency after it ends to still go through it.
 | 
			
		||||
	UINT8 fakeBoost;	// Some items need to grant tripwire pass briefly, even when their effect is thrust/instathrust. This is a fake boost type to control that.
 | 
			
		||||
 | 
			
		||||
	itemroulette_t itemRoulette;	// Item roulette data
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage)
 | 
			
		|||
	Return:-
 | 
			
		||||
		N/A
 | 
			
		||||
--------------------------------------------------*/
 | 
			
		||||
static void K_SpawnSingleHitLagSpark(
 | 
			
		||||
void K_SpawnSingleHitLagSpark(
 | 
			
		||||
	mobj_t *parent,
 | 
			
		||||
	vector3_t *offset, fixed_t scale,
 | 
			
		||||
	UINT8 tics, UINT8 pause,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,7 @@ void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage);
 | 
			
		|||
--------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
void K_SetHitLagForObjects(mobj_t *victim, mobj_t *inflictor, mobj_t *source, INT32 tics, boolean fromDamage);
 | 
			
		||||
void K_SpawnSingleHitLagSpark(mobj_t *parent, vector3_t *offset, fixed_t scale, UINT8 tics, UINT8 pause, skincolornum_t color);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										43
									
								
								src/k_kart.c
									
										
									
									
									
								
							
							
						
						
									
										43
									
								
								src/k_kart.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3001,7 +3001,8 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player)
 | 
			
		|||
 | 
			
		||||
	if (
 | 
			
		||||
			player->flamedash ||
 | 
			
		||||
			((player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0)
 | 
			
		||||
			((player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0) ||
 | 
			
		||||
			player->fakeBoost
 | 
			
		||||
	)
 | 
			
		||||
		return TRIPWIRE_BOOST;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4862,6 +4863,8 @@ void K_ApplyTripWire(player_t *player, tripwirestate_t state)
 | 
			
		|||
	{
 | 
			
		||||
		S_StartSound(player->mo, sfx_kc40);
 | 
			
		||||
		player->tripwireReboundDelay = 60;
 | 
			
		||||
		if (player->curshield == KSHIELD_BUBBLE)
 | 
			
		||||
			player->tripwireReboundDelay *= 2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	player->tripwireState = state;
 | 
			
		||||
| 
						 | 
				
			
			@ -9086,6 +9089,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
 | 
			
		|||
	if (player->hyudorotimer)
 | 
			
		||||
		player->hyudorotimer--;
 | 
			
		||||
 | 
			
		||||
	if (player->fakeBoost)
 | 
			
		||||
		player->fakeBoost--;
 | 
			
		||||
 | 
			
		||||
	if (player->bumperinflate && player->mo->hitlag == 0)
 | 
			
		||||
	{
 | 
			
		||||
		fixed_t thrustdelta = MAXCOMBOTHRUST - MINCOMBOTHRUST;
 | 
			
		||||
| 
						 | 
				
			
			@ -11929,6 +11935,33 @@ boolean K_FastFallBounce(player_t *player)
 | 
			
		|||
			player->ignoreAirtimeLeniency = max(player->ignoreAirtimeLeniency, TICRATE);
 | 
			
		||||
 | 
			
		||||
			bounce += 3 * mapobjectscale;
 | 
			
		||||
 | 
			
		||||
			UINT8 i;
 | 
			
		||||
			UINT8 numplayers = 0;
 | 
			
		||||
			if (gametyperules & GTR_CIRCUIT)
 | 
			
		||||
			{
 | 
			
		||||
				for (i = 0; i < MAXPLAYERS; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (playeringame[i] && !players[i].spectator)
 | 
			
		||||
						numplayers++;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				numplayers = 1; // solo behavior
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (player->position == 1 && player->positiondelay <= 0 && numplayers != 1)
 | 
			
		||||
			{
 | 
			
		||||
				S_StartSound(player->mo, sfx_kc31);
 | 
			
		||||
				K_StripItems(player);
 | 
			
		||||
				K_AddHitLag(player->mo, 4, false);
 | 
			
		||||
				vector3_t offset = { 0, 0, 0 };
 | 
			
		||||
				K_SpawnSingleHitLagSpark(player->mo, &offset, player->mo->scale*2, 4, 0, player->skincolor);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (player->tripwireReboundDelay)
 | 
			
		||||
				bounce /= 2;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -13041,9 +13074,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
 | 
			
		|||
										if (player->throwdir == -1)
 | 
			
		||||
										{
 | 
			
		||||
											P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale));
 | 
			
		||||
											player->wavedashboost += TICRATE; // Just for keeping speed briefly vs. tripwire etc.
 | 
			
		||||
											player->wavedashboost += TICRATE;
 | 
			
		||||
											player->wavedashpower = FRACUNIT;
 | 
			
		||||
											// If this doesn't turn out to be reliable, I'll change it to directly set leniency or something.
 | 
			
		||||
											player->fakeBoost = TICRATE/2;
 | 
			
		||||
										}
 | 
			
		||||
										K_PlayAttackTaunt(player->mo);
 | 
			
		||||
										player->bubbleblowup = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -13123,6 +13156,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
 | 
			
		|||
											player->mo, player->mo->angle,
 | 
			
		||||
											FixedMul((50*player->mo->scale), K_GetKartGameSpeedScalar(gamespeed))
 | 
			
		||||
										);
 | 
			
		||||
										
 | 
			
		||||
										player->wavedashboost += TICRATE;
 | 
			
		||||
										player->wavedashpower = FRACUNIT;
 | 
			
		||||
										player->fakeBoost = TICRATE/3;
 | 
			
		||||
 | 
			
		||||
										S_StopSoundByID(player->mo, sfx_fshld1);
 | 
			
		||||
										S_StopSoundByID(player->mo, sfx_fshld0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -342,6 +342,8 @@ static int player_get(lua_State *L)
 | 
			
		|||
		lua_pushinteger(L, plr->tripwireState);
 | 
			
		||||
	else if (fastcmp(field,"tripwirepass"))
 | 
			
		||||
		lua_pushinteger(L, plr->tripwirePass);
 | 
			
		||||
	else if (fastcmp(field,"fakeboost"))
 | 
			
		||||
		lua_pushinteger(L, plr->fakeBoost);
 | 
			
		||||
	else if (fastcmp(field,"tripwireleniency"))
 | 
			
		||||
		lua_pushinteger(L, plr->tripwireLeniency);
 | 
			
		||||
	else if (fastcmp(field,"tripwirerebounddelay"))
 | 
			
		||||
| 
						 | 
				
			
			@ -892,6 +894,8 @@ static int player_set(lua_State *L)
 | 
			
		|||
		plr->tripwireState = luaL_checkinteger(L, 3);
 | 
			
		||||
	else if (fastcmp(field,"tripwirepass"))
 | 
			
		||||
		plr->tripwirePass = luaL_checkinteger(L, 3);
 | 
			
		||||
	else if (fastcmp(field,"fakeboost"))
 | 
			
		||||
		plr->fakeBoost = luaL_checkinteger(L, 3);
 | 
			
		||||
	else if (fastcmp(field,"tripwireleniency"))
 | 
			
		||||
		plr->tripwireLeniency = luaL_checkinteger(L, 3);
 | 
			
		||||
	else if (fastcmp(field,"tripwirerebounddelay"))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -483,6 +483,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
 | 
			
		|||
		WRITEUINT8(save->p, players[i].tripwireState);
 | 
			
		||||
		WRITEUINT8(save->p, players[i].tripwirePass);
 | 
			
		||||
		WRITEUINT16(save->p, players[i].tripwireLeniency);
 | 
			
		||||
		WRITEUINT8(save->p, players[i].fakeBoost);
 | 
			
		||||
 | 
			
		||||
		WRITESINT8(save->p, players[i].itemtype);
 | 
			
		||||
		WRITEUINT8(save->p, players[i].itemamount);
 | 
			
		||||
| 
						 | 
				
			
			@ -1081,6 +1082,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
 | 
			
		|||
		players[i].tripwireState = READUINT8(save->p);
 | 
			
		||||
		players[i].tripwirePass = READUINT8(save->p);
 | 
			
		||||
		players[i].tripwireLeniency = READUINT16(save->p);
 | 
			
		||||
		players[i].fakeBoost = READUINT8(save->p);
 | 
			
		||||
 | 
			
		||||
		players[i].itemtype = READSINT8(save->p);
 | 
			
		||||
		players[i].itemamount = READUINT8(save->p);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue