diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b58f7f96d..177fd616b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2336,7 +2336,7 @@ static void HWR_AddLine(seg_t * line) // // modified to use local variables -static boolean HWR_CheckBBox(fixed_t *bspcoord) +static boolean HWR_CheckBBox(const fixed_t *bspcoord) { INT32 boxpos; fixed_t px1, py1, px2, py2; diff --git a/src/objects/orbinaut.c b/src/objects/orbinaut.c deleted file mode 100644 index b4daefb9b..000000000 --- a/src/objects/orbinaut.c +++ /dev/null @@ -1,393 +0,0 @@ -// DR. ROBOTNIK'S RING RACERS -//----------------------------------------------------------------------------- -// Copyright (C) 2022 by Sally "TehRealSalt" Cochenour -// Copyright (C) 2022 by Kart Krew -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file orbinaut.c -/// \brief Orbinaut item code. - -#include "../doomdef.h" -#include "../doomstat.h" -#include "../info.h" -#include "../k_kart.h" -#include "../k_objects.h" -#include "../m_random.h" -#include "../p_local.h" -#include "../r_main.h" -#include "../s_sound.h" -#include "../g_game.h" -#include "../z_zone.h" -#include "../k_waypoint.h" -#include "../k_respawn.h" -#include "../k_collide.h" - -#define ORBINAUT_MAXTURN (ANGLE_67h) -#define ORBINAUT_TURNLERP (16) - -#define orbinaut_speed(o) ((o)->movefactor) -#define orbinaut_selfdelay(o) ((o)->threshold) -#define orbinaut_dropped(o) ((o)->flags2 & MF2_AMBUSH) -#define orbinaut_droptime(o) ((o)->movecount) - -#define orbinaut_turn(o) ((o)->extravalue1) - -#define orbinaut_owner(o) ((o)->target) - -#define orbinaut_shield_dist(o) ((o)->extravalue1) - -void Obj_OrbinautThink(mobj_t *th) -{ - boolean grounded = P_IsObjectOnGround(th); - mobj_t *ghost = NULL; - - if (th->fuse > 0 && th->fuse <= TICRATE) - { - th->renderflags ^= RF_DONTDRAW; - } - - if (orbinaut_dropped(th)) - { - if (grounded && (th->flags & MF_NOCLIPTHING)) - { - th->momx = 1; - th->momy = 0; - th->frame = 3; - S_StartSound(th, th->info->activesound); - th->flags &= ~MF_NOCLIPTHING; - } - else if (orbinaut_droptime(th)) - { - orbinaut_droptime(th)--; - } - else if (th->frame < 3) - { - orbinaut_droptime(th) = 2; - th->frame++; - } - - return; - } - - ghost = P_SpawnGhostMobj(th); - ghost->colorized = true; // already has color! - - th->angle = K_MomentumAngle(th); - if (orbinaut_turn(th) != 0) - { - th->angle += orbinaut_turn(th); - - if (abs(orbinaut_turn(th)) < ORBINAUT_MAXTURN) - { - if (orbinaut_turn(th) < 0) - { - orbinaut_turn(th) -= ORBINAUT_MAXTURN / ORBINAUT_TURNLERP; - } - else - { - orbinaut_turn(th) += ORBINAUT_MAXTURN / ORBINAUT_TURNLERP; - } - } - } - - if (grounded == true) - { - fixed_t finalspeed = orbinaut_speed(th); - const fixed_t currentspeed = R_PointToDist2(0, 0, th->momx, th->momy); - fixed_t thrustamount = 0; - fixed_t frictionsafety = (th->friction == 0) ? 1 : th->friction; - - if (th->health <= 5) - { - INT32 i; - for (i = 5; i >= th->health; i--) - { - finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); - } - } - - if (currentspeed >= finalspeed) - { - // Thrust as if you were at top speed, slow down naturally - thrustamount = FixedDiv(finalspeed, frictionsafety) - finalspeed; - } - else - { - const fixed_t beatfriction = FixedDiv(currentspeed, frictionsafety) - currentspeed; - // Thrust to immediately get to top speed - thrustamount = beatfriction + FixedDiv(finalspeed - currentspeed, frictionsafety); - } - - P_Thrust(th, th->angle, thrustamount); - } - - /* todo: UDMFify - if (P_MobjTouchingSectorSpecialFlag(th, ?)) - { - K_DoPogoSpring(th, 0, 1); - } - */ - - if (orbinaut_selfdelay(th) > 0) - { - orbinaut_selfdelay(th)--; - } - - if (leveltime % 6 == 0) - { - S_StartSound(th, th->info->activesound); - } -} - -boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2) -{ - boolean damageitem = false; - boolean tumbleitem = false; - boolean sprung = false; - - if ((orbinaut_selfdelay(t1) > 0 && t2->hitlag > 0) - || (orbinaut_selfdelay(t2) > 0 && t1->hitlag > 0)) - { - return true; - } - - if (t1->health <= 0 || t2->health <= 0) - { - return true; - } - - if ((orbinaut_owner(t1) == t2) - || (!(t2->flags & (MF_ENEMY|MF_BOSS)) && (orbinaut_owner(t1) == t2->target))) - { - if ((orbinaut_selfdelay(t1) > 0 && t2->type == MT_PLAYER) - || (orbinaut_selfdelay(t2) > 0 && t2->type != MT_PLAYER)) - { - return true; - } - } - - if ((t1->type == MT_ORBINAUT_SHIELD || t1->type == MT_JAWZ_SHIELD) && t1->lastlook - && (t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD) && t2->lastlook - && (orbinaut_owner(t1) == t2->target)) // Don't hit each other if you have the same target - { - return true; - } - - if (t1->type == MT_GARDENTOP) - { - tumbleitem = true; - } - - if (t2->player) - { - if ((t2->player->flashing > 0 && t2->hitlag == 0) - && !(t1->type == MT_ORBINAUT || t1->type == MT_JAWZ)) - return true; - - if (t2->player->hyudorotimer) - return true; // no interaction - - if (t2->player->flamedash && t2->player->itemtype == KITEM_FLAMESHIELD) - { - // Melt item - S_StartSound(t2, sfx_s3k43); - } - else - { - // Player Damage - P_DamageMobj(t2, t1, t1->target, 1, DMG_WOMBO | - (tumbleitem ? DMG_TUMBLE : DMG_WIPEOUT)); - K_KartBouncing(t2, t1); - S_StartSound(t2, sfx_s3k7b); - } - - damageitem = true; - } - else if (t2->type == MT_ORBINAUT || t2->type == MT_JAWZ - || t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD - || t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD - || t2->type == MT_BALLHOG) - { - // Other Item Damage - angle_t bounceangle = K_GetCollideAngle(t1, t2); - - S_StartSound(t2, t2->info->deathsound); - P_KillMobj(t2, t1, t1, DMG_NORMAL); - - P_SetObjectMomZ(t2, 24*FRACUNIT, false); - P_InstaThrust(t2, bounceangle, 16*FRACUNIT); - - P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH); - - damageitem = true; - } - else if (t2->type == MT_SSMINE_SHIELD || t2->type == MT_SSMINE || t2->type == MT_LANDMINE) - { - damageitem = true; - // Bomb death - P_KillMobj(t2, t1, t1, DMG_NORMAL); - } - else if (t2->flags & MF_SPRING && (t1->type != MT_ORBINAUT_SHIELD && t1->type != MT_JAWZ_SHIELD)) - { - // Let thrown items hit springs! - sprung = P_DoSpring(t2, t1); - } - else if (t2->flags & MF_SHOOTABLE) - { - // Shootable damage - P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL); - damageitem = true; - } - - if (t1->type == MT_GARDENTOP) - { - damageitem = false; - } - - if (damageitem) - { - // This Item Damage - angle_t bounceangle = K_GetCollideAngle(t2, t1); - S_StartSound(t1, t1->info->deathsound); - P_KillMobj(t1, t2, t2, DMG_NORMAL); - - P_SetObjectMomZ(t1, 24*FRACUNIT, false); - P_InstaThrust(t1, bounceangle, 16*FRACUNIT); - } - - if (sprung) - { - return false; - } - - return true; -} - -void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir) -{ - if (orbinaut_owner(th) != NULL && P_MobjWasRemoved(orbinaut_owner(th)) == false - && orbinaut_owner(th)->player != NULL) - { - th->color = orbinaut_owner(th)->player->skincolor; - } - else - { - th->color = SKINCOLOR_GREY; - } - - th->fuse = RR_PROJECTILE_FUSE; - orbinaut_speed(th) = finalSpeed; - - if (dir == -1) - { - // Thrown backwards, init orbiting in place - orbinaut_turn(th) = ORBINAUT_MAXTURN / ORBINAUT_TURNLERP; - - th->angle -= ANGLE_45; - th->momx = FixedMul(finalSpeed, FINECOSINE(th->angle >> ANGLETOFINESHIFT)); - th->momy = FixedMul(finalSpeed, FINESINE(th->angle >> ANGLETOFINESHIFT)); - } -} - -void Obj_OrbinautJawzMoveHeld(player_t *player) -{ - fixed_t finalscale = K_ItemScaleForPlayer(player); - fixed_t speed = 0; - mobj_t *cur = NULL; - - player->bananadrag = 0; // Just to make sure - - cur = player->mo->hnext; - speed = ((8 - min(4, player->itemamount)) * cur->info->speed) / 7; - - while (cur != NULL && P_MobjWasRemoved(cur) == false) - { - const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius. - fixed_t z; - - if (!cur->health) - { - cur = cur->hnext; - continue; - } - - cur->color = player->skincolor; - - cur->angle -= ANGLE_90; - cur->angle += FixedAngle(speed) / 3; - - if (orbinaut_shield_dist(cur) < radius) - { - orbinaut_shield_dist(cur) += P_AproxDistance(orbinaut_shield_dist(cur), radius) / 12; - } - - if (orbinaut_shield_dist(cur) > radius) - { - orbinaut_shield_dist(cur) = radius; - } - - // If the player is on the ceiling, then flip your items as well. - if (player && player->mo->eflags & MFE_VERTICALFLIP) - { - cur->eflags |= MFE_VERTICALFLIP; - } - else - { - cur->eflags &= ~MFE_VERTICALFLIP; - } - - // Shrink your items if the player shrunk too. - cur->destscale = FixedMul(FixedDiv(orbinaut_shield_dist(cur), radius), finalscale); - P_SetScale(cur, cur->destscale); - - if (P_MobjFlip(cur) > 0) - { - z = player->mo->z; - } - else - { - z = player->mo->z + player->mo->height - cur->height; - } - - cur->flags |= MF_NOCLIPTHING; // temporarily make them noclip other objects so they can't hit anyone while in the player - P_MoveOrigin(cur, player->mo->x, player->mo->y, z); - cur->momx = FixedMul(FINECOSINE(cur->angle >> ANGLETOFINESHIFT), orbinaut_shield_dist(cur)); - cur->momy = FixedMul(FINESINE(cur->angle >> ANGLETOFINESHIFT), orbinaut_shield_dist(cur)); - cur->flags &= ~MF_NOCLIPTHING; - - if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true, NULL)) - { - P_SlideMove(cur, NULL); - } - - if (P_IsObjectOnGround(player->mo)) - { - if (P_MobjFlip(cur) > 0) - { - if (cur->floorz > player->mo->z - cur->height) - { - z = cur->floorz; - } - } - else - { - if (cur->ceilingz < player->mo->z + player->mo->height + cur->height) - { - z = cur->ceilingz - cur->height; - } - } - } - - // Center it during the scale up animation - z += (FixedMul(cur->info->height, finalscale - cur->scale) >> 1) * P_MobjFlip(cur); - - cur->z = z; - cur->momx = cur->momy = 0; - cur->angle += ANGLE_90; - - cur = cur->hnext; - } -} diff --git a/src/p_map.c b/src/p_map.c index 63d28f86c..d3472c1cc 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2476,23 +2476,7 @@ increment_move if (P_UsingStepUp(thing)) { //All things are affected by their scale. - fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); - - if (thing->player) - { - if (P_MobjTouchingSectorSpecialFlag(thing, SSF_DOUBLESTEPUP) - || (R_PointInSubsector(x, y)->sector->specialflags & SSF_DOUBLESTEPUP)) - { - // If using type Section1:13, double the maxstep. - maxstep <<= 1; - } - else if (P_MobjTouchingSectorSpecialFlag(thing, SSF_NOSTEPUP) - || (R_PointInSubsector(x, y)->sector->specialflags & SSF_NOSTEPUP)) - { - // If using type Section1:12, no maxstep. For short walls, like Egg Zeppelin - maxstep = 0; - } - } + fixed_t maxstep = P_GetThingStepUp(thing, tryx, tryy); if (thing->type == MT_SKIM) maxstep = 0; diff --git a/src/win32/Srb2win.ico b/src/win32/Srb2win.ico index f9caf642c..4e3f81336 100644 Binary files a/src/win32/Srb2win.ico and b/src/win32/Srb2win.ico differ