make function for quakes, scale with mobjscale
This commit is contained in:
1 parent
4213e6a965
commit
30b7fc2f2b
6 files changed
+34
-17
No files matched your search
+1
-1
@@ -192,7 +192,7 @@ extern struct quake
|
||||
// camera offsets and duration
|
||||
fixed_t x,y,z;
|
||||
angle_t roll;
|
||||
UINT16 time;
|
||||
tic_t time;
|
||||
|
||||
// location, radius, and intensity...
|
||||
mappoint_t *epicenter;
|
||||
|
||||
+1
-2
@@ -2712,8 +2712,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
quake.intensity = 64*FRACUNIT;
|
||||
quake.time = 5;
|
||||
P_StartQuake(5, 64<<FRACBITS, 0);
|
||||
}
|
||||
|
||||
player->kartstuff[k_instashield] = 15;
|
||||
|
||||
+3
-5
@@ -1559,8 +1559,9 @@ static int lib_pSetSkyboxMobj(lua_State *L)
|
||||
// Shhh, neither does P_StartQuake.
|
||||
static int lib_pStartQuake(lua_State *L)
|
||||
{
|
||||
tic_t q_time = (tic_t)luaL_checkinteger(L, 2);
|
||||
fixed_t q_intensity = luaL_checkinteger(L, 1);
|
||||
UINT16 q_time = (UINT16)luaL_checkinteger(L, 2);
|
||||
fixed_t q_radius = luaL_optinteger(L, 4, 512<<FRACBITS);
|
||||
static mappoint_t q_epicenter = {0,0,0};
|
||||
|
||||
NOHUD
|
||||
@@ -1612,11 +1613,8 @@ static int lib_pStartQuake(lua_State *L)
|
||||
}
|
||||
else
|
||||
quake.epicenter = NULL;
|
||||
quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT);
|
||||
|
||||
// These things are actually used in 2.1.
|
||||
quake.intensity = q_intensity;
|
||||
quake.time = q_time;
|
||||
P_StartQuake(q_time, q_intensity, q_radius);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -2435,8 +2435,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_PlayerRingBurst(player, 5);
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
quake.intensity = 32*FRACUNIT;
|
||||
quake.time = 5;
|
||||
P_StartQuake(5, 32<<FRACBITS, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+26
-7
@@ -2843,17 +2843,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
|
||||
case 444: // Earthquake camera
|
||||
{
|
||||
quake.intensity = sides[line->sidenum[0]].textureoffset;
|
||||
quake.radius = sides[line->sidenum[0]].rowoffset;
|
||||
quake.time = P_AproxDistance(line->dx, line->dy)>>FRACBITS;
|
||||
fixed_t intensity = sides[line->sidenum[0]].textureoffset;
|
||||
fixed_t radius = sides[line->sidenum[0]].rowoffset;
|
||||
tic_t time = P_AproxDistance(line->dx, line->dy)>>FRACBITS;
|
||||
|
||||
quake.epicenter = NULL; /// \todo
|
||||
|
||||
// reasonable defaults.
|
||||
if (!quake.intensity)
|
||||
quake.intensity = 8<<FRACBITS;
|
||||
if (!quake.radius)
|
||||
quake.radius = 512<<FRACBITS;
|
||||
if (intensity <= 0)
|
||||
intensity = 8<<FRACBITS;
|
||||
if (radius <= 0)
|
||||
radius = 512<<FRACBITS;
|
||||
|
||||
P_StartQuake(time, intensity, radius);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7472,6 +7474,23 @@ static void P_SpawnPushers(void)
|
||||
}
|
||||
}
|
||||
|
||||
void P_StartQuake(tic_t time, fixed_t intensity, fixed_t radius)
|
||||
{
|
||||
if (time <= 0 || intensity <= 0)
|
||||
{
|
||||
// Invalid parameters
|
||||
return;
|
||||
}
|
||||
|
||||
quake.time = time;
|
||||
quake.intensity = FixedMul(intensity, mapobjectscale);
|
||||
|
||||
if (radius > 0)
|
||||
{
|
||||
quake.radius = FixedMul(radius, mapobjectscale);
|
||||
}
|
||||
}
|
||||
|
||||
static void P_SearchForDisableLinedefs(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -454,4 +454,6 @@ void P_CalcHeight(player_t *player);
|
||||
|
||||
sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo);
|
||||
|
||||
void P_StartQuake(tic_t time, fixed_t intensity, fixed_t radius);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user