mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Merge branch 'master' into tumble-slope-fuck
This commit is contained in:
		
						commit
						6d45e58425
					
				
					 12 changed files with 540 additions and 172 deletions
				
			
		| 
						 | 
				
			
			@ -36,6 +36,7 @@
 | 
			
		|||
#include "d_netfil.h" // findfile
 | 
			
		||||
#include "r_data.h" // Color_cons_t
 | 
			
		||||
#include "r_skins.h"
 | 
			
		||||
#include "m_random.h"
 | 
			
		||||
 | 
			
		||||
//========
 | 
			
		||||
// protos.
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +54,8 @@ static void COM_Wait_f(void);
 | 
			
		|||
static void COM_Help_f(void);
 | 
			
		||||
static void COM_Toggle_f(void);
 | 
			
		||||
static void COM_Add_f(void);
 | 
			
		||||
static void COM_Choose_f(void);
 | 
			
		||||
static void COM_ChooseWeighted_f(void);
 | 
			
		||||
 | 
			
		||||
static void CV_EnforceExecVersion(void);
 | 
			
		||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
 | 
			
		||||
| 
						 | 
				
			
			@ -361,6 +364,8 @@ void COM_Init(void)
 | 
			
		|||
	COM_AddCommand("help", COM_Help_f);
 | 
			
		||||
	COM_AddCommand("toggle", COM_Toggle_f);
 | 
			
		||||
	COM_AddCommand("add", COM_Add_f);
 | 
			
		||||
	COM_AddCommand("choose", COM_Choose_f);
 | 
			
		||||
	COM_AddCommand("chooseweighted", COM_ChooseWeighted_f);
 | 
			
		||||
	RegisterNetXCmd(XD_NETVAR, Got_NetVar);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1075,6 +1080,81 @@ static void COM_Add_f(void)
 | 
			
		|||
		CV_AddValue(cvar, atoi(COM_Argv(2)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void COM_Choose_f(void)
 | 
			
		||||
{
 | 
			
		||||
	size_t na = COM_Argc();
 | 
			
		||||
 | 
			
		||||
	if (na < 2)
 | 
			
		||||
	{
 | 
			
		||||
		CONS_Printf(M_GetText("choose <option1> [<option2>] [<option3>] [...]: Picks a command at random\n"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	COM_BufAddText(COM_Argv(M_RandomKey(na - 1) + 1));
 | 
			
		||||
	COM_BufAddText("\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void COM_ChooseWeighted_f(void)
 | 
			
		||||
{
 | 
			
		||||
	size_t na = COM_Argc();
 | 
			
		||||
	size_t i, cmd;
 | 
			
		||||
	const char *commands[40];
 | 
			
		||||
	INT32 weights[40];
 | 
			
		||||
	INT32 totalWeight = 0;
 | 
			
		||||
	INT32 roll;
 | 
			
		||||
 | 
			
		||||
	if (na < 3)
 | 
			
		||||
	{
 | 
			
		||||
		CONS_Printf(M_GetText("chooseweighted <option1> <weight1> [<option2> <weight2>] [<option3> <weight3>] [...]: Picks a command with weighted randomization\n"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memset(weights, 0, sizeof(weights));
 | 
			
		||||
 | 
			
		||||
	i = 1;
 | 
			
		||||
	cmd = 0;
 | 
			
		||||
	while (i < na)
 | 
			
		||||
	{
 | 
			
		||||
		commands[cmd] = COM_Argv(i);
 | 
			
		||||
 | 
			
		||||
		i++;
 | 
			
		||||
		if (i >= na)
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		weights[cmd] = atoi(COM_Argv(i));
 | 
			
		||||
		totalWeight += weights[cmd];
 | 
			
		||||
 | 
			
		||||
		i++;
 | 
			
		||||
		cmd++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmd == 0 || totalWeight <= 0)
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	roll = M_RandomRange(1, totalWeight);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < cmd; i++)
 | 
			
		||||
	{
 | 
			
		||||
		if (roll <= weights[i])
 | 
			
		||||
		{
 | 
			
		||||
			if (commands[i] == NULL)
 | 
			
		||||
			{
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			COM_BufAddText(commands[i]);
 | 
			
		||||
			COM_BufAddText("\n");
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		roll -= weights[i];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// =========================================================================
 | 
			
		||||
//                      VARIABLE SIZE BUFFERS
 | 
			
		||||
// =========================================================================
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,6 @@
 | 
			
		|||
#include "k_menu.h"
 | 
			
		||||
#include "filesrch.h"
 | 
			
		||||
#include "m_misc.h"
 | 
			
		||||
#include "m_random.h"
 | 
			
		||||
 | 
			
		||||
#ifdef _WINDOWS
 | 
			
		||||
#include "win32/win_main.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -244,81 +243,6 @@ static void CONS_Bind_f(void)
 | 
			
		|||
		bindtable[key] = Z_StrDup(COM_Argv(2));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void CONS_Choose_f(void)
 | 
			
		||||
{
 | 
			
		||||
	size_t na = COM_Argc();
 | 
			
		||||
 | 
			
		||||
	if (na < 2)
 | 
			
		||||
	{
 | 
			
		||||
		CONS_Printf(M_GetText("choose <option1> [<option2>] [<option3>] [...]: Picks a command at random\n"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	COM_BufAddText(COM_Argv(M_RandomKey(na - 1) + 1));
 | 
			
		||||
	COM_BufAddText("\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void CONS_ChooseWeighted_f(void)
 | 
			
		||||
{
 | 
			
		||||
	size_t na = COM_Argc();
 | 
			
		||||
	size_t i, cmd;
 | 
			
		||||
	const char *commands[40];
 | 
			
		||||
	INT32 weights[40];
 | 
			
		||||
	INT32 totalWeight = 0;
 | 
			
		||||
	INT32 roll;
 | 
			
		||||
 | 
			
		||||
	if (na < 3)
 | 
			
		||||
	{
 | 
			
		||||
		CONS_Printf(M_GetText("chooseweighted <option1> <weight1> [<option2> <weight2>] [<option3> <weight3>] [...]: Picks a command with weighted randomization\n"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memset(weights, 0, sizeof(weights));
 | 
			
		||||
 | 
			
		||||
	i = 1;
 | 
			
		||||
	cmd = 0;
 | 
			
		||||
	while (i < na)
 | 
			
		||||
	{
 | 
			
		||||
		commands[cmd] = COM_Argv(i);
 | 
			
		||||
 | 
			
		||||
		i++;
 | 
			
		||||
		if (i >= na)
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		weights[cmd] = atoi(COM_Argv(i));
 | 
			
		||||
		totalWeight += weights[cmd];
 | 
			
		||||
 | 
			
		||||
		i++;
 | 
			
		||||
		cmd++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmd == 0 || totalWeight <= 0)
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	roll = M_RandomRange(1, totalWeight);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < cmd; i++)
 | 
			
		||||
	{
 | 
			
		||||
		if (roll <= weights[i])
 | 
			
		||||
		{
 | 
			
		||||
			if (commands[i] == NULL)
 | 
			
		||||
			{
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			COM_BufAddText(commands[i]);
 | 
			
		||||
			COM_BufAddText("\n");
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		roll -= weights[i];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//======================================================================
 | 
			
		||||
//                          CONSOLE SETUP
 | 
			
		||||
//======================================================================
 | 
			
		||||
| 
						 | 
				
			
			@ -521,8 +445,6 @@ void CON_Init(void)
 | 
			
		|||
		CV_RegisterVar(&cons_backpic);
 | 
			
		||||
		CV_RegisterVar(&cons_backcolor);
 | 
			
		||||
		COM_AddCommand("bind", CONS_Bind_f);
 | 
			
		||||
		COM_AddCommand("choose", CONS_Choose_f);
 | 
			
		||||
		COM_AddCommand("chooseweighted", CONS_ChooseWeighted_f);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -337,6 +337,7 @@ actionpointer_t actionpointers[] =
 | 
			
		|||
	{{A_ReaperThinker},          "A_REAPERTHINKER"},
 | 
			
		||||
	{{A_FlameShieldPaper},       "A_FLAMESHIELDPAPER"},
 | 
			
		||||
	{{A_InvincSparkleRotate},    "A_INVINCSPARKLEROTATE"},
 | 
			
		||||
	{{A_SpawnItemDebrisCloud},   "A_SPAWNITEMDEBRISCLOUD"},
 | 
			
		||||
 | 
			
		||||
	{{NULL},                     "NONE"},
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -3277,6 +3278,10 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
 | 
			
		|||
	"S_RANDOMITEMPOP4",
 | 
			
		||||
	//}
 | 
			
		||||
 | 
			
		||||
	"S_ITEM_DEBRIS",
 | 
			
		||||
	"S_ITEM_DEBRIS_CLOUD_SPAWNER1",
 | 
			
		||||
	"S_ITEM_DEBRIS_CLOUD_SPAWNER2",
 | 
			
		||||
 | 
			
		||||
	"S_ITEMICON",
 | 
			
		||||
 | 
			
		||||
	// Item capsules
 | 
			
		||||
| 
						 | 
				
			
			@ -5311,6 +5316,8 @@ const char *const MOBJTYPE_LIST[] = {  // array length left dynamic for sanity t
 | 
			
		|||
	"MT_BRAKEDRIFT",
 | 
			
		||||
	"MT_BRAKEDUST",
 | 
			
		||||
	"MT_DRIFTDUST",
 | 
			
		||||
	"MT_ITEM_DEBRIS",
 | 
			
		||||
	"MT_ITEM_DEBRIS_CLOUD_SPAWNER",
 | 
			
		||||
	"MT_DRIFTELECTRICITY",
 | 
			
		||||
	"MT_DRIFTELECTRICSPARK",
 | 
			
		||||
	"MT_JANKSPARK",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										63
									
								
								src/info.c
									
										
									
									
									
								
							
							
						
						
									
										63
									
								
								src/info.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -530,6 +530,7 @@ char sprnames[NUMSPRITES + 1][5] =
 | 
			
		|||
	"RNDM", // Random Item Box
 | 
			
		||||
	"SBOX", // Sphere Box (for Battle)
 | 
			
		||||
	"RPOP", // Random Item Box Pop
 | 
			
		||||
	"ITRI", // Item Box Debris
 | 
			
		||||
	"SGNS", // Signpost sparkle
 | 
			
		||||
	"FAST", // Speed boost trail
 | 
			
		||||
	"DSHR", // Speed boost dust release
 | 
			
		||||
| 
						 | 
				
			
			@ -3849,7 +3850,7 @@ state_t states[NUMSTATES] =
 | 
			
		|||
	{SPR_RNDM, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM11},	// S_RANDOMITEM10
 | 
			
		||||
	{SPR_RNDM, 20|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM12},	// S_RANDOMITEM11
 | 
			
		||||
	{SPR_RNDM, 22|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM1},	// S_RANDOMITEM12
 | 
			
		||||
	{SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_NULL},											// S_DEADRANDOMITEM
 | 
			
		||||
	{SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_RANDOMITEM1},											// S_DEADRANDOMITEM
 | 
			
		||||
 | 
			
		||||
	{SPR_SBOX,    FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX2},	// S_SPHEREBOX1
 | 
			
		||||
	{SPR_SBOX,  2|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX3},	// S_SPHEREBOX2
 | 
			
		||||
| 
						 | 
				
			
			@ -3870,6 +3871,10 @@ state_t states[NUMSTATES] =
 | 
			
		|||
	{SPR_RPOP, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_RANDOMITEMPOP4}, // S_RANDOMITEMPOP3
 | 
			
		||||
	{SPR_RPOP, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL},           // S_RANDOMITEMPOP4
 | 
			
		||||
 | 
			
		||||
	{SPR_ITRI, FF_FULLBRIGHT|FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 19, 1, S_NULL}, // S_ITEM_DEBRIS
 | 
			
		||||
	{SPR_NULL, 0, 0, {A_Repeat}, 16, S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_NULL}, // S_ITEM_DEBRIS_CLOUD_SPAWNER1
 | 
			
		||||
	{SPR_NULL, 0, 7, {A_SpawnItemDebrisCloud}, 20, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2
 | 
			
		||||
 | 
			
		||||
	{SPR_NULL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMICON
 | 
			
		||||
 | 
			
		||||
	{SPR_ICAP,                         FF_ADD|0, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE
 | 
			
		||||
| 
						 | 
				
			
			@ -22548,7 +22553,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 | 
			
		|||
		MT_RANDOMITEMPOP, // damage
 | 
			
		||||
		sfx_None,         // activesound
 | 
			
		||||
		MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags
 | 
			
		||||
		S_NULL            // raisestate
 | 
			
		||||
		S_RANDOMITEM1     // raisestate
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{           // MT_SPHEREBOX
 | 
			
		||||
| 
						 | 
				
			
			@ -23145,6 +23150,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 | 
			
		|||
		S_NULL          // raisestate
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{           // MT_ITEM_DEBRIS
 | 
			
		||||
		-1,             // doomednum
 | 
			
		||||
		S_ITEM_DEBRIS,  // spawnstate
 | 
			
		||||
		1,              // spawnhealth
 | 
			
		||||
		S_NULL,         // seestate
 | 
			
		||||
		sfx_None,       // seesound
 | 
			
		||||
		0,              // reactiontime
 | 
			
		||||
		sfx_None,       // attacksound
 | 
			
		||||
		S_NULL,         // painstate
 | 
			
		||||
		0,              // painchance
 | 
			
		||||
		sfx_None,       // painsound
 | 
			
		||||
		S_NULL,         // meleestate
 | 
			
		||||
		S_NULL,         // missilestate
 | 
			
		||||
		S_NULL,         // deathstate
 | 
			
		||||
		S_NULL,         // xdeathstate
 | 
			
		||||
		sfx_None,       // deathsound
 | 
			
		||||
		0,              // speed
 | 
			
		||||
		32*FRACUNIT,    // radius
 | 
			
		||||
		32*FRACUNIT,    // height
 | 
			
		||||
		0,              // display offset
 | 
			
		||||
		0,              // mass
 | 
			
		||||
		0,              // damage
 | 
			
		||||
		sfx_None,       // activesound
 | 
			
		||||
		MF_DONTENCOREMAP, // flags
 | 
			
		||||
		S_NULL          // raisestate
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{           // MT_ITEM_DEBRIS_CLOUD_SPAWNER
 | 
			
		||||
		-1,             // doomednum
 | 
			
		||||
		S_ITEM_DEBRIS_CLOUD_SPAWNER1, // spawnstate
 | 
			
		||||
		1,              // spawnhealth
 | 
			
		||||
		S_NULL,         // seestate
 | 
			
		||||
		sfx_None,       // seesound
 | 
			
		||||
		0,              // reactiontime
 | 
			
		||||
		sfx_None,       // attacksound
 | 
			
		||||
		S_NULL,         // painstate
 | 
			
		||||
		0,              // painchance
 | 
			
		||||
		sfx_None,       // painsound
 | 
			
		||||
		S_NULL,         // meleestate
 | 
			
		||||
		S_NULL,         // missilestate
 | 
			
		||||
		S_NULL,         // deathstate
 | 
			
		||||
		S_NULL,         // xdeathstate
 | 
			
		||||
		sfx_None,       // deathsound
 | 
			
		||||
		0,              // speed
 | 
			
		||||
		32*FRACUNIT,    // radius
 | 
			
		||||
		32*FRACUNIT,    // height
 | 
			
		||||
		0,              // display offset
 | 
			
		||||
		0,              // mass
 | 
			
		||||
		0,              // damage
 | 
			
		||||
		sfx_None,       // activesound
 | 
			
		||||
		MF_NOSECTOR|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags
 | 
			
		||||
		S_NULL          // raisestate
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{           // MT_DRIFTELECTRICITY
 | 
			
		||||
		-1,             // doomednum
 | 
			
		||||
		S_DRIFTELECTRICITY, // spawnstate
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -290,6 +290,7 @@ enum actionnum
 | 
			
		|||
	A_REAPERTHINKER,
 | 
			
		||||
	A_FLAMESHIELDPAPER,
 | 
			
		||||
	A_INVINCSPARKLEROTATE,
 | 
			
		||||
	A_SPAWNITEMDEBRISCLOUD,
 | 
			
		||||
	NUMACTIONS
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -563,6 +564,7 @@ void A_ReaperThinker();
 | 
			
		|||
void A_MementosTPParticles();
 | 
			
		||||
void A_FlameShieldPaper();
 | 
			
		||||
void A_InvincSparkleRotate();
 | 
			
		||||
void A_SpawnItemDebrisCloud();
 | 
			
		||||
 | 
			
		||||
extern boolean actionsoverridden[NUMACTIONS];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1076,6 +1078,7 @@ typedef enum sprite
 | 
			
		|||
	SPR_RNDM, // Random Item Box
 | 
			
		||||
	SPR_SBOX, // Sphere Box (for Battle)
 | 
			
		||||
	SPR_RPOP, // Random Item Box Pop
 | 
			
		||||
	SPR_ITRI, // Item Box Debris
 | 
			
		||||
	SPR_SGNS, // Signpost sparkle
 | 
			
		||||
	SPR_FAST, // Speed boost trail
 | 
			
		||||
	SPR_DSHR, // Speed boost dust release
 | 
			
		||||
| 
						 | 
				
			
			@ -4273,6 +4276,10 @@ typedef enum state
 | 
			
		|||
	S_RANDOMITEMPOP4,
 | 
			
		||||
	//}
 | 
			
		||||
 | 
			
		||||
	S_ITEM_DEBRIS,
 | 
			
		||||
	S_ITEM_DEBRIS_CLOUD_SPAWNER1,
 | 
			
		||||
	S_ITEM_DEBRIS_CLOUD_SPAWNER2,
 | 
			
		||||
 | 
			
		||||
	S_ITEMICON,
 | 
			
		||||
 | 
			
		||||
	// Item capsules
 | 
			
		||||
| 
						 | 
				
			
			@ -6343,6 +6350,8 @@ typedef enum mobj_type
 | 
			
		|||
	MT_BRAKEDRIFT,
 | 
			
		||||
	MT_BRAKEDUST,
 | 
			
		||||
	MT_DRIFTDUST,
 | 
			
		||||
	MT_ITEM_DEBRIS,
 | 
			
		||||
	MT_ITEM_DEBRIS_CLOUD_SPAWNER,
 | 
			
		||||
	MT_DRIFTELECTRICITY,
 | 
			
		||||
	MT_DRIFTELECTRICSPARK,
 | 
			
		||||
	MT_JANKSPARK,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
#include "hu_stuff.h" // Sink snipe print
 | 
			
		||||
#include "doomdef.h" // Sink snipe print
 | 
			
		||||
#include "g_game.h" // Sink snipe print
 | 
			
		||||
#include "k_objects.h"
 | 
			
		||||
 | 
			
		||||
angle_t K_GetCollideAngle(mobj_t *t1, mobj_t *t2)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -265,8 +266,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2)
 | 
			
		|||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			mobj_t *poof = P_SpawnMobj(t1->x, t1->y, t1->z, MT_EXPLODE);
 | 
			
		||||
			S_StartSound(poof, t1->info->deathsound);
 | 
			
		||||
			Obj_SpawnItemDebrisEffects(t1, t2);
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
			// Eggbox snipe!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,4 +15,9 @@ void Obj_ShrinkGunRemoved(mobj_t *gun);
 | 
			
		|||
boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim);
 | 
			
		||||
void Obj_CreateShrinkPohbees(player_t *owner);
 | 
			
		||||
 | 
			
		||||
/* Item Debris */
 | 
			
		||||
void Obj_SpawnItemDebrisEffects(mobj_t *collectible, mobj_t *collector);
 | 
			
		||||
void Obj_ItemDebrisThink(mobj_t *debris);
 | 
			
		||||
fixed_t Obj_ItemDebrisBounce(mobj_t *debris, fixed_t momz);
 | 
			
		||||
 | 
			
		||||
#endif/*k_objects_H*/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
hyudoro.c
 | 
			
		||||
shrink.c
 | 
			
		||||
item-debris.c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										237
									
								
								src/objects/item-debris.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										237
									
								
								src/objects/item-debris.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,237 @@
 | 
			
		|||
#include "../doomdef.h"
 | 
			
		||||
#include "../d_player.h"
 | 
			
		||||
#include "../m_random.h"
 | 
			
		||||
#include "../k_kart.h"
 | 
			
		||||
#include "../k_objects.h"
 | 
			
		||||
#include "../p_local.h"
 | 
			
		||||
#include "../r_main.h"
 | 
			
		||||
#include "../s_sound.h"
 | 
			
		||||
 | 
			
		||||
// TODO: general function
 | 
			
		||||
static fixed_t K_GetPlayerSpeedRatio(player_t *player)
 | 
			
		||||
{
 | 
			
		||||
	return FixedDiv(player->speed,
 | 
			
		||||
			K_GetKartSpeed(player, false, false));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define debris_type(o) ((o)->extravalue1)
 | 
			
		||||
#define debris_bouncesleft(o) ((o)->threshold)
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
	DEBRIS_ALPHA,
 | 
			
		||||
	DEBRIS_BETA,
 | 
			
		||||
 | 
			
		||||
	NUM_DEBRIS_TYPES
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct debris_config {
 | 
			
		||||
	mobj_t * origin;
 | 
			
		||||
	angle_t angle;
 | 
			
		||||
	fixed_t speed;
 | 
			
		||||
	fixed_t scale;
 | 
			
		||||
	UINT8 type;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static fixed_t
 | 
			
		||||
get_speed_ratio (mobj_t *thing)
 | 
			
		||||
{
 | 
			
		||||
	return thing->player ?
 | 
			
		||||
		K_GetPlayerSpeedRatio(thing->player) : FRACUNIT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
spawn_debris
 | 
			
		||||
(		const struct debris_config * config,
 | 
			
		||||
		INT32 angle)
 | 
			
		||||
{
 | 
			
		||||
	const fixed_t height_table[NUM_DEBRIS_TYPES] = {
 | 
			
		||||
		50*FRACUNIT,
 | 
			
		||||
		35*FRACUNIT,
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	mobj_t *debris = P_SpawnMobjFromMobj(
 | 
			
		||||
			config->origin, 0, 0, 0, MT_ITEM_DEBRIS);
 | 
			
		||||
 | 
			
		||||
	debris_type(debris) = config->type;
 | 
			
		||||
	debris_bouncesleft(debris) = 1;
 | 
			
		||||
 | 
			
		||||
	P_InstaThrust(debris,
 | 
			
		||||
			config->angle + angle,
 | 
			
		||||
			config->speed);
 | 
			
		||||
 | 
			
		||||
	P_SetObjectMomZ(debris,
 | 
			
		||||
			FixedMul(config->scale,
 | 
			
		||||
				height_table[config->type]),
 | 
			
		||||
			false);
 | 
			
		||||
 | 
			
		||||
	debris->destscale =
 | 
			
		||||
		FixedMul(config->scale, 3 * debris->scale);
 | 
			
		||||
	P_SetScale(debris, debris->destscale);
 | 
			
		||||
 | 
			
		||||
	// Pass down color to dust particles
 | 
			
		||||
	debris->color = config->origin->color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
spawn_cloud
 | 
			
		||||
(		mobj_t * collectible,
 | 
			
		||||
		mobj_t * collector,
 | 
			
		||||
		fixed_t base_speed)
 | 
			
		||||
{
 | 
			
		||||
	const fixed_t min_speed = 90 * collectible->scale;
 | 
			
		||||
 | 
			
		||||
	const fixed_t scale = FixedDiv(
 | 
			
		||||
			max(base_speed, min_speed), min_speed);
 | 
			
		||||
 | 
			
		||||
	const INT16 spacing =
 | 
			
		||||
		(collectible->radius / 2) / collectible->scale;
 | 
			
		||||
 | 
			
		||||
	INT32 i;
 | 
			
		||||
 | 
			
		||||
	// Most of this code is from p_inter.c, MT_ITEMCAPSULE
 | 
			
		||||
 | 
			
		||||
	// dust effects
 | 
			
		||||
	for (i = 0; i < 10; i++)
 | 
			
		||||
	{
 | 
			
		||||
		mobj_t *puff = P_SpawnMobjFromMobj(
 | 
			
		||||
				collectible,
 | 
			
		||||
				P_RandomRange(-spacing, spacing) * FRACUNIT,
 | 
			
		||||
				P_RandomRange(-spacing, spacing) * FRACUNIT,
 | 
			
		||||
				P_RandomRange(0, 4 * spacing) * FRACUNIT,
 | 
			
		||||
				MT_SPINDASHDUST
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		puff->color = collector->color;
 | 
			
		||||
		puff->colorized = true;
 | 
			
		||||
 | 
			
		||||
		puff->destscale = FixedMul(puff->destscale, scale);
 | 
			
		||||
		P_SetScale(puff, puff->destscale);
 | 
			
		||||
 | 
			
		||||
		puff->momz = puff->scale * P_MobjFlip(puff);
 | 
			
		||||
 | 
			
		||||
		P_InitAngle(puff, R_PointToAngle2(
 | 
			
		||||
					collectible->x,
 | 
			
		||||
					collectible->y,
 | 
			
		||||
					puff->x,
 | 
			
		||||
					puff->y));
 | 
			
		||||
 | 
			
		||||
		P_Thrust(puff, puff->angle, 3 * puff->scale);
 | 
			
		||||
 | 
			
		||||
		puff->momx += collector->momx;
 | 
			
		||||
		puff->momy += collector->momy;
 | 
			
		||||
		puff->momz += collector->momz;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
rotate3d (mobj_t *debris)
 | 
			
		||||
{
 | 
			
		||||
	const UINT8 steps = 30;
 | 
			
		||||
 | 
			
		||||
	debris->rollangle =
 | 
			
		||||
		M_RandomKey(steps) * (ANGLE_MAX / steps);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Obj_SpawnItemDebrisEffects
 | 
			
		||||
(		mobj_t * collectible,
 | 
			
		||||
		mobj_t * collector)
 | 
			
		||||
{
 | 
			
		||||
	const fixed_t min_speed = 80 * collectible->scale;
 | 
			
		||||
 | 
			
		||||
	fixed_t base_speed = FixedMul(75 * mapobjectscale,
 | 
			
		||||
			get_speed_ratio(collector));
 | 
			
		||||
 | 
			
		||||
	struct debris_config config;
 | 
			
		||||
 | 
			
		||||
	// Delayed effect for puffs of smoke that stick to and
 | 
			
		||||
	// glide off of the player
 | 
			
		||||
	mobj_t *spawner = P_SpawnMobjFromMobj(collectible,
 | 
			
		||||
			0, 0, 0, MT_ITEM_DEBRIS_CLOUD_SPAWNER);
 | 
			
		||||
 | 
			
		||||
	P_SetTarget(&spawner->target, collector);
 | 
			
		||||
 | 
			
		||||
	config.origin = collectible;
 | 
			
		||||
	config.angle = K_MomentumAngle(collector);
 | 
			
		||||
	config.speed = max(base_speed, min_speed);
 | 
			
		||||
	config.scale = FixedDiv(config.speed, min_speed);
 | 
			
		||||
 | 
			
		||||
	config.type = DEBRIS_ALPHA;
 | 
			
		||||
 | 
			
		||||
	spawn_debris(&config,   ANGLE_11hh);
 | 
			
		||||
	spawn_debris(&config, -(ANGLE_11hh));
 | 
			
		||||
 | 
			
		||||
	config.type = DEBRIS_BETA;
 | 
			
		||||
 | 
			
		||||
	spawn_debris(&config,   3*ANGLE_22h/2);
 | 
			
		||||
	spawn_debris(&config,   3*ANGLE_22h/4);
 | 
			
		||||
	spawn_debris(&config,   0);
 | 
			
		||||
	spawn_debris(&config, -(3*ANGLE_22h/4));
 | 
			
		||||
	spawn_debris(&config, -(3*ANGLE_22h/2));
 | 
			
		||||
 | 
			
		||||
	spawn_cloud(collectible, collector, base_speed);
 | 
			
		||||
 | 
			
		||||
	S_StartSound(spawner, sfx_kc2e);
 | 
			
		||||
	S_StartSound(spawner, sfx_s1c9);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Obj_ItemDebrisThink (mobj_t *debris)
 | 
			
		||||
{
 | 
			
		||||
	const UINT8 frame = (debris->frame & FF_FRAMEMASK);
 | 
			
		||||
 | 
			
		||||
	if (debris->momz == 0)
 | 
			
		||||
	{
 | 
			
		||||
		P_KillMobj(debris, NULL, NULL, DMG_NORMAL);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	rotate3d(debris);
 | 
			
		||||
 | 
			
		||||
	if (frame % 3 == 1)
 | 
			
		||||
	{
 | 
			
		||||
		mobj_t *ghost = P_SpawnGhostMobj(debris);
 | 
			
		||||
 | 
			
		||||
		ghost->fuse = 3;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (debris_type(debris) == DEBRIS_ALPHA)
 | 
			
		||||
	{
 | 
			
		||||
		mobj_t *dust = P_SpawnMobjFromMobj(
 | 
			
		||||
				debris, 0, 0, 0,  MT_SPINDASHDUST);
 | 
			
		||||
 | 
			
		||||
		P_SetScale(dust, (dust->destscale /= 3));
 | 
			
		||||
 | 
			
		||||
		dust->color = debris->color;
 | 
			
		||||
		dust->colorized = true;
 | 
			
		||||
 | 
			
		||||
		dust->momx = debris->momx / 4;
 | 
			
		||||
		dust->momy = debris->momy / 4;
 | 
			
		||||
		dust->momz = debris->momz / 4;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fixed_t
 | 
			
		||||
Obj_ItemDebrisBounce
 | 
			
		||||
(		mobj_t * debris,
 | 
			
		||||
		fixed_t momz)
 | 
			
		||||
{
 | 
			
		||||
	if (debris_bouncesleft(debris) <= 0)
 | 
			
		||||
	{
 | 
			
		||||
		P_KillMobj(debris, NULL, NULL, DMG_NORMAL);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	momz = -(momz);
 | 
			
		||||
 | 
			
		||||
	if (debris_type(debris) == DEBRIS_BETA)
 | 
			
		||||
	{
 | 
			
		||||
		momz /= 2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	debris_bouncesleft(debris)--;
 | 
			
		||||
 | 
			
		||||
	S_StartSound(debris, sfx_cdfm47);
 | 
			
		||||
 | 
			
		||||
	return momz;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										140
									
								
								src/p_enemy.c
									
										
									
									
									
								
							
							
						
						
									
										140
									
								
								src/p_enemy.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -32,6 +32,7 @@
 | 
			
		|||
#include "k_battle.h"
 | 
			
		||||
#include "k_respawn.h"
 | 
			
		||||
#include "k_collide.h"
 | 
			
		||||
#include "k_objects.h"
 | 
			
		||||
 | 
			
		||||
#ifdef HW3SOUND
 | 
			
		||||
#include "hardware/hw3sound.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -326,6 +327,7 @@ void A_ReaperThinker(mobj_t *actor);
 | 
			
		|||
void A_MementosTPParticles(mobj_t *actor);
 | 
			
		||||
void A_FlameShieldPaper(mobj_t *actor);
 | 
			
		||||
void A_InvincSparkleRotate(mobj_t *actor);
 | 
			
		||||
void A_SpawnItemDebrisCloud(mobj_t *actor);
 | 
			
		||||
 | 
			
		||||
//for p_enemy.c
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -13166,9 +13168,6 @@ void A_ItemPop(mobj_t *actor)
 | 
			
		|||
{
 | 
			
		||||
	INT32 locvar1 = var1;
 | 
			
		||||
 | 
			
		||||
	mobj_t *remains;
 | 
			
		||||
	mobjtype_t explode;
 | 
			
		||||
 | 
			
		||||
	if (LUA_CallAction(A_ITEMPOP, actor))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -13185,63 +13184,28 @@ void A_ItemPop(mobj_t *actor)
 | 
			
		|||
	actor->flags |= MF_NOCLIP;
 | 
			
		||||
	P_SetThingPosition(actor);
 | 
			
		||||
 | 
			
		||||
	// item explosion
 | 
			
		||||
	explode = mobjinfo[actor->info->damage].mass;
 | 
			
		||||
	remains = P_SpawnMobj(actor->x, actor->y,
 | 
			
		||||
		((actor->eflags & MFE_VERTICALFLIP) ? (actor->z + 3*(actor->height/4) - FixedMul(mobjinfo[explode].height, actor->scale)) : (actor->z + actor->height/4)), explode);
 | 
			
		||||
	if (actor->eflags & MFE_VERTICALFLIP)
 | 
			
		||||
	{
 | 
			
		||||
		remains->eflags |= MFE_VERTICALFLIP;
 | 
			
		||||
		remains->flags2 |= MF2_OBJECTFLIP;
 | 
			
		||||
	}
 | 
			
		||||
	remains->destscale = actor->destscale;
 | 
			
		||||
	P_SetScale(remains, actor->scale);
 | 
			
		||||
	// RF_DONTDRAW will flicker as the object's fuse gets
 | 
			
		||||
	// closer to running out (see P_FuseThink)
 | 
			
		||||
	actor->renderflags |= RF_DONTDRAW|RF_TRANS50;
 | 
			
		||||
	actor->color = SKINCOLOR_GREY;
 | 
			
		||||
	actor->colorized = true;
 | 
			
		||||
 | 
			
		||||
	remains = P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->damage);
 | 
			
		||||
	remains->type = actor->type; // Transfer type information
 | 
			
		||||
	P_UnsetThingPosition(remains);
 | 
			
		||||
	if (sector_list)
 | 
			
		||||
	{
 | 
			
		||||
		P_DelSeclist(sector_list);
 | 
			
		||||
		sector_list = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	P_SetThingPosition(remains);
 | 
			
		||||
	remains->destscale = actor->destscale;
 | 
			
		||||
	P_SetScale(remains, actor->scale);
 | 
			
		||||
	remains->flags = actor->flags; // Transfer flags
 | 
			
		||||
	remains->flags2 = actor->flags2; // Transfer flags2
 | 
			
		||||
	remains->fuse = actor->fuse; // Transfer respawn timer
 | 
			
		||||
	remains->cvmem = leveltime;
 | 
			
		||||
	remains->threshold = actor->threshold;
 | 
			
		||||
	if (remains->threshold != 69 && remains->threshold != 70)
 | 
			
		||||
	{
 | 
			
		||||
		remains->threshold = 68;
 | 
			
		||||
	}
 | 
			
		||||
	// To insure this information doesn't have to be rediscovered every time you look at this function...
 | 
			
		||||
	// A threshold of 0 is for a "living", ordinary random item.
 | 
			
		||||
	// 68 means regular popped random item debris.
 | 
			
		||||
	// 69 used to mean old Karma Item behaviour (now you can replicate this with MF2_DONTRESPAWN).
 | 
			
		||||
	// 70 is a powered up Overtime item.
 | 
			
		||||
	remains->skin = NULL;
 | 
			
		||||
	remains->spawnpoint = actor->spawnpoint;
 | 
			
		||||
 | 
			
		||||
	P_SetTarget(&tmthing, remains);
 | 
			
		||||
 | 
			
		||||
	if (actor->info->deathsound)
 | 
			
		||||
		S_StartSound(remains, actor->info->deathsound);
 | 
			
		||||
	Obj_SpawnItemDebrisEffects(actor, actor->target);
 | 
			
		||||
 | 
			
		||||
	if (locvar1 == 1)
 | 
			
		||||
		P_GivePlayerSpheres(actor->target->player, actor->extravalue1);
 | 
			
		||||
	else if (locvar1 == 0)
 | 
			
		||||
		actor->target->player->itemroulette = 1;
 | 
			
		||||
 | 
			
		||||
	remains->flags2 &= ~MF2_AMBUSH;
 | 
			
		||||
 | 
			
		||||
	// Here at mapload in battle?
 | 
			
		||||
	if ((gametyperules & GTR_BUMPERS) && (actor->flags2 & MF2_BOSSNOTRAP))
 | 
			
		||||
	{
 | 
			
		||||
		numgotboxes++;
 | 
			
		||||
 | 
			
		||||
	P_RemoveMobj(actor);
 | 
			
		||||
		// do not flicker back in just yet, handled by
 | 
			
		||||
		// P_RespawnBattleBoxes eventually
 | 
			
		||||
		P_SetMobjState(actor, S_INVISIBLE);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void A_JawzChase(mobj_t *actor)
 | 
			
		||||
| 
						 | 
				
			
			@ -14525,3 +14489,81 @@ void A_InvincSparkleRotate(mobj_t *actor)
 | 
			
		|||
		ghost->fuse = 4;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Function: A_SpawnItemDebrisCloud
 | 
			
		||||
//
 | 
			
		||||
// Description: Spawns the poofs of an exploded item box. Target is a player to spawn the particles around.
 | 
			
		||||
//
 | 
			
		||||
// var1 = Copy extravalue2 / var1 fraction of target's momentum.
 | 
			
		||||
// var2 = unused
 | 
			
		||||
//
 | 
			
		||||
void
 | 
			
		||||
A_SpawnItemDebrisCloud (mobj_t *actor)
 | 
			
		||||
{
 | 
			
		||||
	INT32 locvar1 = var1;
 | 
			
		||||
 | 
			
		||||
	mobj_t *target = actor->target;
 | 
			
		||||
	player_t *player;
 | 
			
		||||
 | 
			
		||||
	fixed_t kartspeed;
 | 
			
		||||
	fixed_t fade;
 | 
			
		||||
 | 
			
		||||
	if (target == NULL || target->player == NULL)
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	player = target->player;
 | 
			
		||||
	kartspeed = K_GetKartSpeed(player, false, false);
 | 
			
		||||
 | 
			
		||||
	// Scale around >50% top speed
 | 
			
		||||
	fade = FixedMul(locvar1, (FixedDiv(player->speed,
 | 
			
		||||
					kartspeed) - FRACUNIT/2) * 2);
 | 
			
		||||
 | 
			
		||||
	if (fade < 1)
 | 
			
		||||
	{
 | 
			
		||||
		fade = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (actor->extravalue2 > fade)
 | 
			
		||||
	{
 | 
			
		||||
		actor->extravalue2 = fade;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// MT_ITEM_DEBRIS_CLOUD_SPAWNER
 | 
			
		||||
	// extravalue2 from A_Repeat
 | 
			
		||||
	fade = actor->extravalue2 * FRACUNIT / locvar1;
 | 
			
		||||
 | 
			
		||||
	// Most of this code is from p_inter.c, MT_ITEMCAPSULE
 | 
			
		||||
 | 
			
		||||
	// dust effects
 | 
			
		||||
	{
 | 
			
		||||
		const INT16 spacing =
 | 
			
		||||
			(target->radius / 2) / target->scale;
 | 
			
		||||
 | 
			
		||||
		mobj_t *puff = P_SpawnMobjFromMobj(
 | 
			
		||||
				target,
 | 
			
		||||
				P_RandomRange(-spacing, spacing) * FRACUNIT,
 | 
			
		||||
				P_RandomRange(-spacing, spacing) * FRACUNIT,
 | 
			
		||||
				P_RandomRange(0, 4 * spacing) * FRACUNIT,
 | 
			
		||||
				MT_SPINDASHDUST
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		puff->color = target->color;
 | 
			
		||||
		puff->colorized = true;
 | 
			
		||||
 | 
			
		||||
		puff->momz = puff->scale * P_MobjFlip(puff);
 | 
			
		||||
 | 
			
		||||
		P_InitAngle(puff, R_PointToAngle2(
 | 
			
		||||
					target->x,
 | 
			
		||||
					target->y,
 | 
			
		||||
					puff->x,
 | 
			
		||||
					puff->y));
 | 
			
		||||
 | 
			
		||||
		P_Thrust(puff, puff->angle, 3 * puff->scale);
 | 
			
		||||
 | 
			
		||||
		puff->momx += FixedMul(target->momx, fade);
 | 
			
		||||
		puff->momy += FixedMul(target->momy, fade);
 | 
			
		||||
		puff->momz += FixedMul(target->momz, fade);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -275,7 +275,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
 | 
			
		|||
			special->momx = special->momy = special->momz = 0;
 | 
			
		||||
			P_SetTarget(&special->target, toucher);
 | 
			
		||||
			P_KillMobj(special, toucher, toucher, DMG_NORMAL);
 | 
			
		||||
			break;
 | 
			
		||||
			return;
 | 
			
		||||
		case MT_SPHEREBOX:
 | 
			
		||||
			if (!P_CanPickupItem(player, 0))
 | 
			
		||||
				return;
 | 
			
		||||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
 | 
			
		|||
			special->momx = special->momy = special->momz = 0;
 | 
			
		||||
			P_SetTarget(&special->target, toucher);
 | 
			
		||||
			P_KillMobj(special, toucher, toucher, DMG_NORMAL);
 | 
			
		||||
			break;
 | 
			
		||||
			return;
 | 
			
		||||
		case MT_ITEMCAPSULE:
 | 
			
		||||
			if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0)
 | 
			
		||||
				return;
 | 
			
		||||
| 
						 | 
				
			
			@ -1037,10 +1037,16 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
 | 
			
		|||
	{
 | 
			
		||||
		if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM)
 | 
			
		||||
		{
 | 
			
		||||
			UINT8 i;
 | 
			
		||||
 | 
			
		||||
			P_SetTarget(&target->target, source);
 | 
			
		||||
 | 
			
		||||
			if (gametyperules & GTR_BUMPERS)
 | 
			
		||||
			{
 | 
			
		||||
				target->fuse = 2;
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				UINT8 i;
 | 
			
		||||
 | 
			
		||||
				for (i = 0; i < MAXPLAYERS; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (&players[i] == source->player)
 | 
			
		||||
| 
						 | 
				
			
			@ -1061,6 +1067,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
 | 
			
		|||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// if a player avatar dies...
 | 
			
		||||
	if (target->player)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										45
									
								
								src/p_mobj.c
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								src/p_mobj.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1209,6 +1209,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
 | 
			
		|||
				case MT_KARMAFIREWORK:
 | 
			
		||||
					gravityadd /= 3;
 | 
			
		||||
					break;
 | 
			
		||||
				case MT_ITEM_DEBRIS:
 | 
			
		||||
					gravityadd *= 6;
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -2350,6 +2353,15 @@ boolean P_ZMovement(mobj_t *mo)
 | 
			
		|||
			mom.z = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale);
 | 
			
		||||
		else if (mo->type == MT_SPINFIRE) // elemental shield fire is another exception here
 | 
			
		||||
			;
 | 
			
		||||
		else if (mo->type == MT_ITEM_DEBRIS)
 | 
			
		||||
		{
 | 
			
		||||
			mom.z = Obj_ItemDebrisBounce(mo, mom.z);
 | 
			
		||||
 | 
			
		||||
			if (mom.z == 0)
 | 
			
		||||
			{
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (mo->type == MT_DRIFTCLIP)
 | 
			
		||||
		{
 | 
			
		||||
			mom.z = -mom.z/2;
 | 
			
		||||
| 
						 | 
				
			
			@ -7901,6 +7913,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
 | 
			
		|||
		Obj_PohbeeThinker(mobj);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	case MT_ITEM_DEBRIS:
 | 
			
		||||
	{
 | 
			
		||||
		Obj_ItemDebrisThink(mobj);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	case MT_ROCKETSNEAKER:
 | 
			
		||||
		if (!mobj->target || !mobj->target->health)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -9268,7 +9285,7 @@ static boolean P_FuseThink(mobj_t *mobj)
 | 
			
		|||
		{
 | 
			
		||||
			;
 | 
			
		||||
		}
 | 
			
		||||
		else if ((gametyperules & GTR_BUMPERS) && (mobj->threshold != 70))
 | 
			
		||||
		else if ((gametyperules & GTR_BUMPERS) && (mobj->state == &states[S_INVISIBLE]))
 | 
			
		||||
		{
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -11111,7 +11128,6 @@ void P_RespawnBattleBoxes(void)
 | 
			
		|||
	for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
 | 
			
		||||
	{
 | 
			
		||||
		mobj_t *box;
 | 
			
		||||
		mobj_t *newmobj;
 | 
			
		||||
 | 
			
		||||
		if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
 | 
			
		||||
			continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -11120,25 +11136,12 @@ void P_RespawnBattleBoxes(void)
 | 
			
		|||
 | 
			
		||||
		if (box->type != MT_RANDOMITEM
 | 
			
		||||
			|| (box->flags2 & MF2_DONTRESPAWN)
 | 
			
		||||
			|| box->threshold != 68
 | 
			
		||||
			|| box->fuse
 | 
			
		||||
			|| ((tic_t)box->cvmem+1 >= leveltime))
 | 
			
		||||
			|| box->health > 0
 | 
			
		||||
			|| box->fuse)
 | 
			
		||||
			continue; // only popped items
 | 
			
		||||
 | 
			
		||||
		// Respawn from mapthing if you have one!
 | 
			
		||||
		if (box->spawnpoint)
 | 
			
		||||
		{
 | 
			
		||||
			P_SpawnMapThing(box->spawnpoint);
 | 
			
		||||
			newmobj = box->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			newmobj = P_SpawnMobj(box->x, box->y, box->z, box->type);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Transfer flags2 (strongbox, objectflip, bossnotrap)
 | 
			
		||||
		newmobj->flags2 = box->flags2;
 | 
			
		||||
		P_RemoveMobj(box); // make sure they disappear
 | 
			
		||||
		box->fuse = TICRATE; // flicker back in (A_ItemPop preps this effect)
 | 
			
		||||
		P_SetMobjState(box, box->info->raisestate);
 | 
			
		||||
 | 
			
		||||
		if (numgotboxes > 0)
 | 
			
		||||
			numgotboxes--; // you've restored a box, remove it from the count
 | 
			
		||||
| 
						 | 
				
			
			@ -12724,10 +12727,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
 | 
			
		|||
				P_SetThingPosition(mobj);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_EXPLODE);
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	case MT_ITEMCAPSULE:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue