From 505e2db2c42a406021e52472cbd983ce92ef3b60 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 17 Mar 2022 20:31:46 -0700 Subject: [PATCH 01/20] Add Hyudoro states --- src/deh_tables.c | 6 +++++ src/info.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ src/info.h | 7 ++++++ 3 files changed, 70 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 8bdae717d..7266303da 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3973,6 +3973,9 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_FLAMESHIELDLINE3", "S_FLAMESHIELDFLASH", + // Caked-Up Booty-Sheet Ghost + "S_HYUDORO", + // The legend "S_SINK", "S_SINK_SHIELD", @@ -5544,6 +5547,9 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_FLAMESHIELDPAPER", "MT_BUBBLESHIELDTRAP", + "MT_HYUDORO", + "MT_HYUDORO_CENTER", + "MT_SINK", // Kitchen Sink Stuff "MT_SINK_SHIELD", "MT_SINKTRAIL", diff --git a/src/info.c b/src/info.c index 9ebc1bf4c..00463602f 100644 --- a/src/info.c +++ b/src/info.c @@ -569,6 +569,7 @@ char sprnames[NUMSPRITES + 1][5] = "FLMP", // Flame Shield paper sprites "FLML", // Flame Shield speed lines "FLMF", // Flame Shield flash + "HYUU", // Hyudoro "SINK", // Kitchen Sink "SITR", // Kitchen Sink Trail "KBLN", // Battle Mode Bumper @@ -4529,6 +4530,8 @@ state_t states[NUMSTATES] = {SPR_FLML, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE|14, 7, {NULL}, 6, 1, S_NULL}, // S_FLAMESHIELDLINE3 {SPR_FLMF, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_FLAMESHIELDFLASH + {SPR_HYUU, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_HYUDORO + {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD {SPR_SITR, 0, 1, {NULL}, 0, 0, S_SINKTRAIL2}, // S_SINKTRAIL1 @@ -24521,6 +24524,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_HYUDORO + -1, // doomednum + S_HYUDORO, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 64*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + + { // MT_HYUDORO_CENTER + -1, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 64*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_SINK -1, // doomednum S_SINK, // spawnstate diff --git a/src/info.h b/src/info.h index 71da066b8..a7e869bd9 100644 --- a/src/info.h +++ b/src/info.h @@ -1117,6 +1117,7 @@ typedef enum sprite SPR_FLMP, // Flame Shield paper sprites SPR_FLML, // Flame Shield speed lines SPR_FLMF, // Flame Shield flash + SPR_HYUU, // Hyudoro SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail SPR_KBLN, // Battle Mode Bumper @@ -4953,6 +4954,9 @@ typedef enum state S_FLAMESHIELDLINE3, S_FLAMESHIELDFLASH, + // Caked-Up Booty-Sheet Ghost + S_HYUDORO, + // The legend S_SINK, S_SINK_SHIELD, @@ -6561,6 +6565,9 @@ typedef enum mobj_type MT_FLAMESHIELDPAPER, MT_BUBBLESHIELDTRAP, + MT_HYUDORO, + MT_HYUDORO_CENTER, + MT_SINK, // Kitchen Sink Stuff MT_SINK_SHIELD, MT_SINKTRAIL, From cd9777f0cbf6142694edb99960c8611c3b1fd12a Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 22 Mar 2022 17:46:36 -0700 Subject: [PATCH 02/20] MT_GHOST: dont flicker tracer's DONTDRAW flags --- src/p_mobj.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 3a4cd1751..0dc5ec131 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9207,14 +9207,19 @@ void P_MobjThinker(mobj_t *mobj) { if (mobj->extravalue2 >= 2) { + UINT32 dontdraw = RF_DONTDRAW; + + if (mobj->tracer) + dontdraw &= ~(mobj->tracer->renderflags); + if (mobj->extravalue2 == 2) // I don't know why the normal logic doesn't work for this. - mobj->renderflags ^= RF_DONTDRAW; + mobj->renderflags ^= dontdraw; else { if (mobj->fuse == mobj->extravalue2) - mobj->renderflags &= ~RF_DONTDRAW; + mobj->renderflags &= ~(dontdraw); else - mobj->renderflags |= RF_DONTDRAW; + mobj->renderflags |= dontdraw; } } } From 61399981a2d7c87eab71f1ee8a3ebd4f5185399b Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 22 Mar 2022 17:47:29 -0700 Subject: [PATCH 03/20] MT_SHADOW + SPR_NONE, teleports to tracer and renders only a shadow --- src/deh_tables.c | 3 ++- src/info.c | 29 +++++++++++++++++++++++++++++ src/info.h | 4 +++- src/p_mobj.c | 9 +++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 7266303da..b7aaf262d 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -369,8 +369,8 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_XDEATHSTATE", "S_RAISESTATE", - // Thok "S_THOK", + "S_SHADOW", // SRB2kart Frames "S_KART_STILL", @@ -4705,6 +4705,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_UNKNOWN", "MT_THOK", // Thok! mobj + "MT_SHADOW", // Linkdraw Shadow (for invisible objects) "MT_PLAYER", "MT_KART_LEFTOVER", "MT_KART_TIRE", diff --git a/src/info.c b/src/info.c index 00463602f..8680bc9c7 100644 --- a/src/info.c +++ b/src/info.c @@ -28,6 +28,7 @@ char sprnames[NUMSPRITES + 1][5] = { "NULL", // invisible object + "NONE", // invisible but still rendered "UNKN", "THOK", // Thok! mobj @@ -850,6 +851,7 @@ state_t states[NUMSTATES] = {SPR_UNKN, FF_FULLBRIGHT, -1, {A_InfoState}, 6, 0, S_NULL}, // S_RAISESTATE {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK + {SPR_NONE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHADOW // Player {SPR_PLAY, SPR2_STIN, 1, {NULL}, 0, 0, S_KART_STILL}, // S_KART_STILL @@ -5364,6 +5366,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_SHADOW + -1, // doomednum + S_SHADOW, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 8, // speed + 32*FRACUNIT, // radius + 64*FRACUNIT, // height + -1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_PLAYER -1, // doomednum S_KART_STILL, // spawnstate diff --git a/src/info.h b/src/info.h index a7e869bd9..e3257fdeb 100644 --- a/src/info.h +++ b/src/info.h @@ -576,6 +576,7 @@ extern boolean actionsoverridden[NUMACTIONS]; typedef enum sprite { SPR_NULL, // invisible object + SPR_NONE, // invisible but still rendered SPR_UNKN, SPR_THOK, // Thok! mobj @@ -1351,8 +1352,8 @@ typedef enum state S_XDEATHSTATE, S_RAISESTATE, - // Thok S_THOK, + S_SHADOW, S_KART_STILL, S_KART_STILL_L, @@ -5723,6 +5724,7 @@ typedef enum mobj_type MT_UNKNOWN, MT_THOK, // Thok! mobj + MT_SHADOW, // Linkdraw Shadow (for invisible objects) MT_PLAYER, MT_KART_LEFTOVER, MT_KART_TIRE, diff --git a/src/p_mobj.c b/src/p_mobj.c index 0dc5ec131..05d802b02 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5307,6 +5307,15 @@ static void P_MobjSceneryThink(mobj_t *mobj) switch (mobj->type) { + case MT_SHADOW: + if (mobj->tracer) + { + P_MoveOrigin(mobj, + mobj->tracer->x, + mobj->tracer->y, + mobj->tracer->z); + } + break; case MT_BOSSJUNK: mobj->renderflags ^= RF_DONTDRAW; break; From 910ebe9d0fafb041c71b19b3b8abe6c63dd583e7 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 29 Apr 2022 22:01:51 -0700 Subject: [PATCH 04/20] Add objects subdirectory For game object-specific code --- src/CMakeLists.txt | 1 + src/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1355c85ee..53eeb5248 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -302,6 +302,7 @@ target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG) #) add_subdirectory(sdl) +add_subdirectory(objects) if(${CMAKE_SYSTEM} MATCHES Windows) add_subdirectory(win32) diff --git a/src/Makefile b/src/Makefile index 9659a4994..ffec6a4cf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -208,6 +208,7 @@ objdir:=$(makedir)/objs sources+=\ $(call List,Sourcefile)\ $(call List,blua/Sourcefile)\ + $(call List,objects/Sourcefile)\ depends:=$(basename $(filter %.c %.s,$(sources))) objects:=$(basename $(filter %.c %.s %.nas,$(sources))) From c6e7fe2d298bc4841c25d519838f14fc60db9a1e Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 29 Apr 2022 22:02:22 -0700 Subject: [PATCH 05/20] Hyudoro object code --- src/d_player.h | 1 + src/info.c | 6 +- src/k_kart.c | 7 +- src/objects/Sourcefile | 1 + src/objects/hyudoro.c | 402 +++++++++++++++++++++++++++++++++++++++++ src/p_inter.c | 5 + src/p_mobj.c | 16 +- 7 files changed, 432 insertions(+), 6 deletions(-) create mode 100644 src/objects/Sourcefile create mode 100644 src/objects/hyudoro.c diff --git a/src/d_player.h b/src/d_player.h index 55c2857d5..c72944268 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -465,6 +465,7 @@ typedef struct player_s UINT16 hyudorotimer; // Duration of the Hyudoro offroad effect itself SINT8 stealingtimer; // if >0 you are stealing, if <0 you are being stolen from + mobj_t *hoverhyudoro; // First hyudoro hovering next to player UINT16 sneakertimer; // Duration of a Sneaker Boost (from Sneakers or level boosters) UINT8 numsneakers; // Number of stacked sneaker effects diff --git a/src/info.c b/src/info.c index 8680bc9c7..136ef3cb8 100644 --- a/src/info.c +++ b/src/info.c @@ -24570,13 +24570,13 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 64*FRACUNIT, // radius - 32*FRACUNIT, // height + 32*FRACUNIT, // radius + 24*FRACUNIT, // height 0, // display offset 0, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, diff --git a/src/k_kart.c b/src/k_kart.c index 412f3bdc3..8ac2ccc22 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -36,6 +36,7 @@ #include "k_hud.h" #include "k_terrain.h" #include "k_director.h" +#include "k_objects.h" // SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H: // gamespeed is cc (0 for easy, 1 for normal, 2 for hard) @@ -5178,6 +5179,7 @@ static void K_FlameDashLeftoverSmoke(mobj_t *src) } } +#if 0 static void K_DoHyudoroSteal(player_t *player) { INT32 i, numplayers = 0; @@ -5255,6 +5257,7 @@ static void K_DoHyudoroSteal(player_t *player) S_StartSound(NULL, sfx_s3k92); } } +#endif void K_DoSneaker(player_t *player, INT32 type) { @@ -9563,7 +9566,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { player->itemamount--; - K_DoHyudoroSteal(player); // yes. yes they do. + //K_DoHyudoroSteal(player); // yes. yes they do. + Obj_HyudoroDeploy(player->mo); + K_PlayAttackTaunt(player->mo); } break; case KITEM_POGOSPRING: diff --git a/src/objects/Sourcefile b/src/objects/Sourcefile new file mode 100644 index 000000000..f7e4f2491 --- /dev/null +++ b/src/objects/Sourcefile @@ -0,0 +1 @@ +hyudoro.c diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c new file mode 100644 index 000000000..35c3680df --- /dev/null +++ b/src/objects/hyudoro.c @@ -0,0 +1,402 @@ +#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" + +enum { + HYU_PATROL, + HYU_RETURN, + HYU_HOVER, +}; + +// TODO: make these general functions + +static fixed_t +K_GetSpeed (mobj_t *mobj) +{ + return FixedHypot(mobj->momx, mobj->momy); +} + +static void +K_ChangePlayerItem +( player_t * player, + INT32 itemtype, + INT32 itemamount) +{ + player->itemtype = itemtype; + player->itemamount = itemamount; + K_UnsetItemOut(player); +} + +#define hyudoro_mode(o) ((o)->extravalue1) +#define hyudoro_itemtype(o) ((o)->movefactor) +#define hyudoro_itemcount(o) ((o)->movecount) +#define hyudoro_hover_stack(o) ((o)->threshold) +#define hyudoro_next(o) ((o)->tracer) +#define hyudoro_stackpos(o) ((o)->reactiontime) + +// cannot be combined +#define hyudoro_center(o) ((o)->target) +#define hyudoro_target(o) ((o)->target) + +#define hyudoro_center_max_radius(o) ((o)->threshold) +#define hyudoro_center_master(o) ((o)->target) + +static angle_t +trace_angle (mobj_t *hyu) +{ + mobj_t *center = hyu->target; + + if (hyu->x != center->x || hyu->y != center->y) + { + return R_PointToAngle2( + center->x, center->y, hyu->x, hyu->y); + } + else + return hyu->angle; +} + +static angle_t +get_look_angle (mobj_t *thing) +{ + player_t *player = thing->player; + + return player ? player->angleturn : thing->angle; +} + +static boolean +is_hyudoro (mobj_t *thing) +{ + return thing && thing->type == MT_HYUDORO; +} + +static mobj_t * +get_hyudoro_master (mobj_t *hyu) +{ + mobj_t *center = hyudoro_center(hyu); + + return center ? hyudoro_center_master(center) : NULL; +} + +static void +sine_bob +( mobj_t * hyu, + angle_t a, + fixed_t sineofs) +{ + hyu->sprzoff = FixedMul(hyu->height, + sineofs + FINESINE(a >> ANGLETOFINESHIFT)); +} + +static void +project_hyudoro (mobj_t *hyu) +{ + mobj_t *center = hyudoro_center(hyu); + + angle_t angleStep = FixedMul(5 * ANG1, + FixedDiv(hyudoro_center_max_radius(center), + center->radius)); + + angle_t angle = trace_angle(hyu) + angleStep; + + fixed_t d = center->radius; + + fixed_t x = P_ReturnThrustX(center, angle, d); + fixed_t y = P_ReturnThrustY(center, angle, d); + + hyu->momx = (center->x + x) - hyu->x; + hyu->momy = (center->y + y) - hyu->y; + hyu->angle = angle + ANGLE_90; + + sine_bob(hyu, angle, FRACUNIT); +} + +static void +project_hyudoro_hover (mobj_t *hyu) +{ + const INT32 bob_speed = 64; + + mobj_t *target = hyudoro_target(hyu); + + // Turns a bit toward its target + angle_t ang = get_look_angle(target) + ANGLE_67h; + fixed_t rad = (target->radius * 2) + hyu->radius; + + fixed_t zofs = hyudoro_stackpos(hyu) * + ((target->height / 2) + (hyu->height * 2)); + + P_MoveOrigin(hyu, + target->x - P_ReturnThrustX(hyu, ang, rad), + target->y - P_ReturnThrustY(hyu, ang, rad), + target->z + (zofs * P_MobjFlip(target))); + + // Cancel momentum from HYU_RETURN. + // (And anything else! I don't trust this game!!) + hyu->momx = 0; + hyu->momy = 0; + + hyu->angle = ang; + + // copies sprite tilting + hyu->pitch = target->pitch; + hyu->roll = target->roll; + + sine_bob(hyu, + (leveltime & (bob_speed - 1)) * + (ANGLE_MAX / bob_speed), -(3*FRACUNIT/4)); +} + +static void +spawn_hyudoro_shadow (mobj_t *hyu) +{ + mobj_t *shadow = P_SpawnMobjFromMobj( + hyu, 0, 0, 0, MT_SHADOW); + + shadow->whiteshadow = true; + + shadow->shadowscale = hyu->shadowscale; + hyu->shadowscale = 0; + + P_SetTarget(&shadow->tracer, hyu); +} + +static void +move_to_player (mobj_t *hyu) +{ + mobj_t *target = hyudoro_target(hyu); + + angle_t angle; + + if (!target) + return; + + angle = R_PointToAngle2( + hyu->x, hyu->y, target->x, target->y); + + P_InstaThrust(hyu, angle, (hyu->radius / 2) + + max(hyu->radius, K_GetSpeed(target))); + + hyu->z = target->z; // stay level with target + hyu->angle = angle; +} + +static void +deliver_item (mobj_t *hyu) +{ + mobj_t *target = hyudoro_target(hyu); + player_t *player = target->player; + + P_SetTarget(&hyudoro_target(hyu), NULL); + + K_ChangePlayerItem(player, + hyudoro_itemtype(hyu), + hyudoro_itemcount(hyu)); + + S_StartSound(target, sfx_itpick); + + // Stop moving here + hyu->momx = 0; + hyu->momy = 0; + + hyu->tics = 4; + + hyu->destscale = target->scale / 4; + hyu->scalespeed = + abs(hyu->scale - hyu->destscale) / hyu->tics; +} + +static void +append_hyudoro +( mobj_t ** head, + mobj_t * hyu) +{ + INT32 lastpos = 0; + + while (is_hyudoro(*head)) + { + lastpos = hyudoro_stackpos(*head); + head = &hyudoro_next(*head); + } + + hyudoro_stackpos(hyu) = lastpos + 1; + *head = hyu; +} + +static boolean +hyudoro_patrol_hit_player +( mobj_t * hyu, + mobj_t * toucher) +{ + player_t *player = toucher->player; + + mobj_t *center = hyudoro_center(hyu); + + if (!player) + return false; + + // Cannot hit its master + if (toucher == get_hyudoro_master(hyu)) + return false; + + // Don't punish a punished player + if (player->hyudorotimer) + return false; + + // NO ITEM? + if (!player->itemamount) + return false; + + K_AddHitLag(toucher, TICRATE/2, true); + + player->hyudorotimer = hyudorotime; + player->stealingtimer = hyudorotime; + + hyudoro_mode(hyu) = HYU_RETURN; + hyudoro_itemtype(hyu) = player->itemtype; + hyudoro_itemcount(hyu) = player->itemamount; + + K_ChangePlayerItem(player, KITEM_NONE, 0); + + P_SetTarget(&hyudoro_target(hyu), + hyudoro_center_master(center)); + + if (center) + P_RemoveMobj(center); + + hyu->renderflags &= ~(RF_DONTDRAW); + + return true; +} + +static boolean +hyudoro_return_hit_player +( mobj_t * hyu, + mobj_t * toucher) +{ + player_t *player = toucher->player; + + if (toucher != hyudoro_target(hyu)) + return false; + + // If the player already has an item, just hover beside + // them until they use/lose it. + if (player->itemamount || player->itemroulette) + { + hyudoro_mode(hyu) = HYU_HOVER; + append_hyudoro(&player->hoverhyudoro, hyu); + } + else + { + deliver_item(hyu); + } + + return true; +} + +void +Obj_HyudoroDeploy (mobj_t *master) +{ + mobj_t *center = P_SpawnMobjFromMobj( + master, 0, 0, 0, MT_HYUDORO_CENTER); + + mobj_t *hyu = P_SpawnMobjFromMobj( + center, 0, 0, 0, MT_HYUDORO); + + // This allows a Lua override + if (!hyudoro_center_max_radius(center)) + { + hyudoro_center_max_radius(center) = + 128 * center->scale; + } + + center->radius = hyu->radius; + + P_InitAngle(hyu, master->angle); + P_SetTarget(&hyudoro_center(hyu), center); + P_SetTarget(&hyudoro_center_master(center), master); + + hyudoro_mode(hyu) = HYU_PATROL; + + // Set splitscreen player visibility + if (master->player) + { + hyu->renderflags |= RF_DONTDRAW & + ~(K_GetPlayerDontDrawFlag(master->player)); + } + + spawn_hyudoro_shadow(hyu); // this sucks btw + + S_StartSound(master, sfx_s3k92); // scary ghost noise +} + +void +Obj_HyudoroThink (mobj_t *hyu) +{ + // Might get set from clipping slopes + hyu->momz = 0; + + switch (hyudoro_mode(hyu)) + { + case HYU_PATROL: + if (hyudoro_center(hyu)) + project_hyudoro(hyu); + + if (leveltime & 1) + { + mobj_t *ghost = P_SpawnGhostMobj(hyu); + + // Flickers every frame + ghost->extravalue1 = 1; + ghost->extravalue2 = 2; + + // copy per-splitscreen-player visibility + ghost->renderflags = + (hyu->renderflags & RF_DONTDRAW); + + ghost->tics = 8; + + P_SetTarget(&ghost->tracer, hyu); + } + break; + + case HYU_RETURN: + move_to_player(hyu); + break; + + case HYU_HOVER: + if (hyudoro_target(hyu)) + project_hyudoro_hover(hyu); + break; + } +} + +void +Obj_HyudoroCenterThink (mobj_t *center) +{ + fixed_t max_radius = hyudoro_center_max_radius(center); + + if (center->radius < max_radius) + center->radius += max_radius / 64; +} + +void +Obj_HyudoroCollide +( mobj_t * hyu, + mobj_t * toucher) +{ + switch (hyudoro_mode(hyu)) + { + case HYU_PATROL: + hyudoro_patrol_hit_player(hyu, toucher); + break; + + case HYU_RETURN: + hyudoro_return_hit_player(hyu, toucher); + break; + } +} diff --git a/src/p_inter.c b/src/p_inter.c index aceb8336c..d73828916 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -37,6 +37,7 @@ #include "k_boss.h" #include "k_respawn.h" #include "p_spec.h" +#include "k_objects.h" // CTF player names #define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : "" @@ -483,6 +484,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, sfx_s1b2); return; + case MT_HYUDORO: + Obj_HyudoroCollide(special, toucher); + return; + case MT_RING: case MT_FLINGRING: if (special->extravalue1) diff --git a/src/p_mobj.c b/src/p_mobj.c index 05d802b02..f23047371 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -42,6 +42,7 @@ #include "k_respawn.h" #include "k_bot.h" #include "k_terrain.h" +#include "k_objects.h" static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}}; consvar_t cv_movebob = CVAR_INIT ("movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL); @@ -6559,8 +6560,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } else if (P_IsObjectOnGround(mobj)) { - mobj->momx = 1; - mobj->momy = 0; + //mobj->momx = 1; + //mobj->momy = 0; mobj->flags &= ~MF_NOCLIPTHING; mobj->flags |= MF_NOGRAVITY; } @@ -7717,6 +7718,16 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } break; } + case MT_HYUDORO: + { + Obj_HyudoroThink(mobj); + break; + } + case MT_HYUDORO_CENTER: + { + Obj_HyudoroCenterThink(mobj); + break; + } case MT_ROCKETSNEAKER: if (!mobj->target || !mobj->target->health) { @@ -9671,6 +9682,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing) case MT_SSMINE_SHIELD: case MT_LANDMINE: case MT_BALLHOG: + case MT_HYUDORO: case MT_SINK: case MT_ROCKETSNEAKER: case MT_SPB: From 39ff9ce383e010492f736a287d96d949a40b1286 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 29 Apr 2022 23:43:25 -0700 Subject: [PATCH 06/20] Remove orphaned MT_SHADOW --- src/p_mobj.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index f23047371..8d727c308 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5316,6 +5316,11 @@ static void P_MobjSceneryThink(mobj_t *mobj) mobj->tracer->y, mobj->tracer->z); } + else + { + P_RemoveMobj(mobj); + return; + } break; case MT_BOSSJUNK: mobj->renderflags ^= RF_DONTDRAW; From 3e8d50a44ae5d3d5d6d1c00ffb5cad1968619bf4 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 30 Apr 2022 00:25:42 -0700 Subject: [PATCH 07/20] Fix/finish hyudoro return delivery - Fix item detection, matches paper sprite pickups - Stacked hyudoros deliver item once player is not holding --- src/objects/hyudoro.c | 101 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index 35c3680df..b4778c8c5 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -83,6 +83,14 @@ get_hyudoro_master (mobj_t *hyu) return center ? hyudoro_center_master(center) : NULL; } +static player_t * +get_hyudoro_target_player (mobj_t *hyu) +{ + mobj_t *target = hyudoro_target(hyu); + + return target ? target->player : NULL; +} + static void sine_bob ( mobj_t * hyu, @@ -193,9 +201,12 @@ deliver_item (mobj_t *hyu) P_SetTarget(&hyudoro_target(hyu), NULL); - K_ChangePlayerItem(player, - hyudoro_itemtype(hyu), - hyudoro_itemcount(hyu)); + if (player) + { + K_ChangePlayerItem(player, + hyudoro_itemtype(hyu), + player->itemamount + hyudoro_itemcount(hyu)); + } S_StartSound(target, sfx_itpick); @@ -227,6 +238,33 @@ append_hyudoro *head = hyu; } +static void +pop_hyudoro (mobj_t **head) +{ + mobj_t *hyu = *head; + + INT32 lastpos; + INT32 thispos; + + if (is_hyudoro(hyu)) + { + lastpos = hyudoro_stackpos(hyu); + hyu = hyudoro_next(hyu); + + while (is_hyudoro(hyu)) + { + thispos = hyudoro_stackpos(hyu); + + hyudoro_stackpos(hyu) = lastpos; + lastpos = thispos; + + hyu = hyudoro_next(hyu); + } + } + + *head = hyu; +} + static boolean hyudoro_patrol_hit_player ( mobj_t * hyu, @@ -273,31 +311,69 @@ hyudoro_patrol_hit_player return true; } +static boolean +award_immediately (mobj_t *hyu) +{ + player_t *player = get_hyudoro_target_player(hyu); + + if (player) + { + if (player->itemamount && + player->itemtype != hyudoro_itemtype(hyu)) + { + return false; + } + + // Same as picking up paper items; get stacks + // immediately + if (!P_CanPickupItem(player, 3)) + return false; + } + + deliver_item(hyu); + + return true; +} + static boolean hyudoro_return_hit_player ( mobj_t * hyu, mobj_t * toucher) { - player_t *player = toucher->player; - if (toucher != hyudoro_target(hyu)) return false; // If the player already has an item, just hover beside // them until they use/lose it. - if (player->itemamount || player->itemroulette) + if (!award_immediately(hyu)) { hyudoro_mode(hyu) = HYU_HOVER; - append_hyudoro(&player->hoverhyudoro, hyu); - } - else - { - deliver_item(hyu); + append_hyudoro(&toucher->player->hoverhyudoro, hyu); } return true; } +static boolean +hyudoro_hover_await_stack (mobj_t *hyu) +{ + player_t *player = get_hyudoro_target_player(hyu); + + if (!player) + return false; + + // First in stack goes first + if (hyu == player->hoverhyudoro) + return false; + + if (!award_immediately(hyu)) + return false; + + pop_hyudoro(&player->hoverhyudoro); + + return true; +} + void Obj_HyudoroDeploy (mobj_t *master) { @@ -370,7 +446,10 @@ Obj_HyudoroThink (mobj_t *hyu) case HYU_HOVER: if (hyudoro_target(hyu)) + { project_hyudoro_hover(hyu); + hyudoro_hover_await_stack(hyu); + } break; } } From 8fd251b54c7feee6cff375d899ec221b05bf7fdf Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 1 May 2022 13:36:01 -0700 Subject: [PATCH 08/20] Revert wrongly committed code --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 8d727c308..54ea94703 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6565,8 +6565,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } else if (P_IsObjectOnGround(mobj)) { - //mobj->momx = 1; - //mobj->momy = 0; + mobj->momx = 1; + mobj->momy = 0; mobj->flags &= ~MF_NOCLIPTHING; mobj->flags |= MF_NOGRAVITY; } From 2196ccef62136e517a3f2c8bb04c02d4f0b33ef1 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 1 May 2022 13:36:17 -0700 Subject: [PATCH 09/20] Add k_objects.h --- src/k_objects.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/k_objects.h diff --git a/src/k_objects.h b/src/k_objects.h new file mode 100644 index 000000000..45f9df78c --- /dev/null +++ b/src/k_objects.h @@ -0,0 +1,11 @@ +/* object-specific code */ +#ifndef k_objects_H +#define k_objects_H + +/* Hyudoro */ +void Obj_HyudoroDeploy(mobj_t *master); +void Obj_HyudoroThink(mobj_t *actor); +void Obj_HyudoroCenterThink(mobj_t *actor); +void Obj_HyudoroCollide(mobj_t *special, mobj_t *toucher); + +#endif/*k_objects_H*/ From 38ab22f02272ccb498920302edfeed96ac218ec5 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 1 May 2022 14:04:25 -0700 Subject: [PATCH 10/20] Netsave player.hoverhyudoro --- src/p_saveg.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 18cef0e94..f6acde09e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -62,6 +62,7 @@ typedef enum FOLLOWER = 0x04, SKYBOXVIEW = 0x08, SKYBOXCENTER = 0x10, + HOVERHYUDORO = 0x20, } player_saveflags; static inline void P_ArchivePlayer(void) @@ -195,6 +196,9 @@ static void P_NetArchivePlayers(void) if (players[i].skybox.centerpoint) flags |= SKYBOXCENTER; + if (players[i].hoverhyudoro) + flags |= HOVERHYUDORO; + WRITEUINT16(save_p, flags); if (flags & SKYBOXVIEW) @@ -209,6 +213,9 @@ static void P_NetArchivePlayers(void) if (flags & FOLLOWITEM) WRITEUINT32(save_p, players[i].followmobj->mobjnum); + if (flags & HOVERHYUDORO) + WRITEUINT32(save_p, players[i].hoverhyudoro->mobjnum); + WRITEUINT32(save_p, (UINT32)players[i].followitem); WRITEUINT32(save_p, players[i].charflags); @@ -474,6 +481,9 @@ static void P_NetUnArchivePlayers(void) if (flags & FOLLOWITEM) players[i].followmobj = (mobj_t *)(size_t)READUINT32(save_p); + if (flags & HOVERHYUDORO) + players[i].hoverhyudoro = (mobj_t *)(size_t)READUINT32(save_p); + players[i].followitem = (mobjtype_t)READUINT32(save_p); //SetPlayerSkinByNum(i, players[i].skin); @@ -4213,6 +4223,13 @@ static void P_RelinkPointers(void) CONS_Debug(DBG_GAMELOGIC, "respawn.wp not found on %d\n", mobj->type); } } + if (mobj->player->hoverhyudoro) + { + temp = (UINT32)(size_t)mobj->player->hoverhyudoro; + mobj->player->hoverhyudoro = NULL; + if (!P_SetTarget(&mobj->player->hoverhyudoro, P_FindNewPosition(temp))) + CONS_Debug(DBG_GAMELOGIC, "hoverhyudoro not found on %d\n", mobj->type); + } } } } From 64b8da086f1fe4a52761f9ed45355230b34bed81 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 1 May 2022 14:39:19 -0700 Subject: [PATCH 11/20] Readjust race item odds for Hyudoro --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 8ac2ccc22..1f0c0047b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -352,21 +352,21 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = //P-Odds 0 1 2 3 4 5 6 7 /*Sneaker*/ { 0, 0, 2, 4, 6, 0, 0, 0 }, // Sneaker /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 2, 4, 6 }, // Rocket Sneaker - /*Invincibility*/ { 0, 0, 0, 0, 2, 4, 6, 9 }, // Invincibility - /*Banana*/ { 4, 3, 1, 0, 0, 0, 0, 0 }, // Banana + /*Invincibility*/ { 0, 0, 0, 0, 3, 4, 6, 9 }, // Invincibility + /*Banana*/ { 2, 3, 1, 0, 0, 0, 0, 0 }, // Banana /*Eggman Monitor*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Eggman Monitor /*Orbinaut*/ { 5, 4, 2, 2, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 3, 2, 1, 1, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 2, 3, 1, 0, 0, 0, 0 }, // Mine /*Land Mine*/ { 3, 0, 0, 0, 0, 0, 0, 0 }, // Land Mine - /*Ballhog*/ { 0, 0, 2, 1, 0, 0, 0, 0 }, // Ballhog + /*Ballhog*/ { 0, 0, 2, 2, 0, 0, 0, 0 }, // Ballhog /*Self-Propelled Bomb*/ { 0, 0, 0, 0, 0, 2, 4, 0 }, // Self-Propelled Bomb /*Grow*/ { 0, 0, 0, 1, 2, 3, 0, 0 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 2, 0 }, // Shrink /*Thunder Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Thunder Shield /*Bubble Shield*/ { 0, 1, 2, 1, 0, 0, 0, 0 }, // Bubble Shield /*Flame Shield*/ { 0, 0, 0, 0, 0, 1, 3, 5 }, // Flame Shield - /*Hyudoro*/ { 0, 0, 0, 1, 1, 0, 0, 0 }, // Hyudoro + /*Hyudoro*/ { 2, 0, 0, 0, 0, 0, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 2, 1, 1, 0, 0, 0, 0, 0 }, // Super Ring /*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Kitchen Sink From 2de756d0772f076b00765e3cf21d90b314102953 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 1 May 2022 18:31:17 -0700 Subject: [PATCH 12/20] Fix typo --- src/objects/hyudoro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index b4778c8c5..e8fc14de3 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -363,7 +363,7 @@ hyudoro_hover_await_stack (mobj_t *hyu) return false; // First in stack goes first - if (hyu == player->hoverhyudoro) + if (hyu != player->hoverhyudoro) return false; if (!award_immediately(hyu)) From 543928b5bbc14b027cc0c920db946cbbf22b6293 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 21:04:52 -0400 Subject: [PATCH 13/20] Adjust Hyuu frequency --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b2fa1b627..08bd77101 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -367,11 +367,11 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] = /*Lightning Shield*/ { 1, 2, 0, 0, 0, 0, 0, 0 }, // Lightning Shield /*Bubble Shield*/ { 0, 1, 2, 1, 0, 0, 0, 0 }, // Bubble Shield /*Flame Shield*/ { 0, 0, 0, 0, 0, 1, 3, 5 }, // Flame Shield - /*Hyudoro*/ { 2, 0, 0, 0, 0, 0, 0, 0 }, // Hyudoro + /*Hyudoro*/ { 3, 0, 0, 0, 0, 0, 0, 0 }, // Hyudoro /*Pogo Spring*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Pogo Spring /*Super Ring*/ { 2, 1, 1, 0, 0, 0, 0, 0 }, // Super Ring /*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0, 0, 0 }, // Kitchen Sink - /*Drop Target*/ { 4, 0, 0, 0, 0, 0, 0, 0 }, // Drop Target + /*Drop Target*/ { 3, 0, 0, 0, 0, 0, 0, 0 }, // Drop Target /*Sneaker x2*/ { 0, 0, 2, 2, 1, 0, 0, 0 }, // Sneaker x2 /*Sneaker x3*/ { 0, 0, 0, 2, 6,10, 5, 0 }, // Sneaker x3 /*Banana x3*/ { 0, 1, 1, 0, 0, 0, 0, 0 }, // Banana x3 From c8718b25ffd38b947b1bb404021c3b3fb3d2d121 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 21:14:02 -0400 Subject: [PATCH 14/20] REMOVE hyubgone + all of the other bullshit we did to try and make it show up less --- src/doomstat.h | 1 - src/g_game.c | 1 - src/k_kart.c | 11 +---------- src/lua_script.c | 5 ----- src/p_saveg.c | 2 -- src/p_setup.c | 1 - src/p_tick.c | 2 -- 7 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 163bfee96..8c2671c96 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -685,7 +685,6 @@ extern boolean comeback; extern SINT8 battlewanted[4]; extern tic_t wantedcalcdelay; extern tic_t indirectitemcooldown; -extern tic_t hyubgone; extern tic_t mapreset; extern boolean thwompsactive; extern UINT8 lastLowestLap; diff --git a/src/g_game.c b/src/g_game.c index 21467e592..6eae4df17 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -314,7 +314,6 @@ SINT8 pickedvote; // What vote the host rolls SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points tic_t wantedcalcdelay; // Time before it recalculates WANTED tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded -tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled tic_t mapreset; // Map reset delay when enough players have joined an empty game boolean thwompsactive; // Thwomps activate on lap 2 UINT8 lastLowestLap; // Last lowest lap, for activating race lap executors diff --git a/src/k_kart.c b/src/k_kart.c index 08bd77101..a1f9ac788 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -458,9 +458,6 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem) if (getitem == KITEM_SPB || getitem == KITEM_SHRINK) // Indirect items indirectitemcooldown = 20*TICRATE; - if (getitem == KITEM_HYUDORO) // Hyudoro cooldown - hyubgone = 5*TICRATE; - player->botvars.itemdelay = TICRATE; player->botvars.itemconfirm = 0; @@ -682,6 +679,7 @@ INT32 K_KartGetItemOdds( case KITEM_LANDMINE: case KITEM_DROPTARGET: case KITEM_BALLHOG: + case KITEM_HYUDORO: case KRITEM_TRIPLESNEAKER: case KRITEM_TRIPLEORBINAUT: case KRITEM_QUADORBINAUT: @@ -742,13 +740,6 @@ INT32 K_KartGetItemOdds( if (spbplace != -1) newodds = 0; break; - case KITEM_HYUDORO: - cooldownOnStart = true; - notNearEnd = true; - - if (hyubgone > 0) - newodds = 0; - break; default: break; } diff --git a/src/lua_script.c b/src/lua_script.c index 3f919439f..8aea589db 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -378,9 +378,6 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"indirectitemcooldown")) { lua_pushinteger(L, indirectitemcooldown); return 1; - } else if (fastcmp(word,"hyubgone")) { - lua_pushinteger(L, hyubgone); - return 1; } else if (fastcmp(word,"thwompsactive")) { lua_pushboolean(L, thwompsactive); return 1; @@ -468,8 +465,6 @@ int LUA_WriteGlobals(lua_State *L, const char *word) exitcountdown = (tic_t)luaL_checkinteger(L, 2); else if (fastcmp(word,"indirectitemcooldown")) indirectitemcooldown = (tic_t)luaL_checkinteger(L, 2); - else if (fastcmp(word,"hyubgone")) - hyubgone = (tic_t)luaL_checkinteger(L, 2); else return 0; diff --git a/src/p_saveg.c b/src/p_saveg.c index 8b4604c8a..3cb65e7a7 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4505,7 +4505,6 @@ static void P_NetArchiveMisc(boolean resending) WRITEUINT32(save_p, wantedcalcdelay); WRITEUINT32(save_p, indirectitemcooldown); - WRITEUINT32(save_p, hyubgone); WRITEUINT32(save_p, mapreset); for (i = 0; i < MAXPLAYERS; i++) @@ -4655,7 +4654,6 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading) wantedcalcdelay = READUINT32(save_p); indirectitemcooldown = READUINT32(save_p); - hyubgone = READUINT32(save_p); mapreset = READUINT32(save_p); for (i = 0; i < MAXPLAYERS; i++) diff --git a/src/p_setup.c b/src/p_setup.c index c1da43eef..2f23d6c1f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4405,7 +4405,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) wantedcalcdelay = wantedfrequency*2; indirectitemcooldown = 0; - hyubgone = 0; mapreset = 0; for (i = 0; i < MAXPLAYERS; i++) diff --git a/src/p_tick.c b/src/p_tick.c index c7dae9030..843461db6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -685,8 +685,6 @@ void P_Ticker(boolean run) if (indirectitemcooldown > 0) indirectitemcooldown--; - if (hyubgone > 0) - hyubgone--; K_BossInfoTicker(); From 0ce466e7efacd1e97971ae1fb2bee9f6e6390a9d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 21:34:24 -0400 Subject: [PATCH 15/20] Some asserts in hyu code Instead of letting it crash due to a NULL subsector later, let it crash earlier so I can see what is happening... --- src/objects/hyudoro.c | 54 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index e8fc14de3..b5ece9157 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -37,21 +37,55 @@ K_ChangePlayerItem #define hyudoro_itemtype(o) ((o)->movefactor) #define hyudoro_itemcount(o) ((o)->movecount) #define hyudoro_hover_stack(o) ((o)->threshold) -#define hyudoro_next(o) ((o)->tracer) + +static mobj_t * +hyudoro_next (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->tracer != NULL && P_MobjWasRemoved(o->tracer) == false); + + return o->tracer; +} + #define hyudoro_stackpos(o) ((o)->reactiontime) -// cannot be combined -#define hyudoro_center(o) ((o)->target) -#define hyudoro_target(o) ((o)->target) +// these next two functions cannot be combined +static mobj_t * +hyudoro_center (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} + +static mobj_t * +hyudoro_target (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} #define hyudoro_center_max_radius(o) ((o)->threshold) -#define hyudoro_center_master(o) ((o)->target) + +static mobj_t * +hyudoro_center_master (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} static angle_t trace_angle (mobj_t *hyu) { mobj_t *center = hyu->target; + I_Assert(center != NULL && P_MobjWasRemoved(center) == false); + if (hyu->x != center->x || hyu->y != center->y) { return R_PointToAngle2( @@ -66,13 +100,15 @@ get_look_angle (mobj_t *thing) { player_t *player = thing->player; + I_Assert(player != NULL); + return player ? player->angleturn : thing->angle; } static boolean is_hyudoro (mobj_t *thing) { - return thing && thing->type == MT_HYUDORO; + return thing != NULL && P_MobjWasRemoved(thing) == false && thing->type == MT_HYUDORO; } static mobj_t * @@ -80,6 +116,8 @@ get_hyudoro_master (mobj_t *hyu) { mobj_t *center = hyudoro_center(hyu); + I_Assert(center != NULL && P_MobjWasRemoved(center) == false); + return center ? hyudoro_center_master(center) : NULL; } @@ -97,6 +135,8 @@ sine_bob angle_t a, fixed_t sineofs) { + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + hyu->sprzoff = FixedMul(hyu->height, sineofs + FINESINE(a >> ANGLETOFINESHIFT)); } @@ -180,7 +220,7 @@ move_to_player (mobj_t *hyu) angle_t angle; - if (!target) + if (target == NULL || P_MobjWasRemoved(target) == true) return; angle = R_PointToAngle2( From 5ef78cbc16b795a90ce04fe032e2650af8d817f7 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 21:41:40 -0400 Subject: [PATCH 16/20] EVEN MORE (also removed the define replacements since didn't work) --- src/objects/hyudoro.c | 69 +++++++++++++++++++------------------------ src/p_mobj.c | 2 ++ 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index b5ece9157..d72a597c4 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -37,47 +37,15 @@ K_ChangePlayerItem #define hyudoro_itemtype(o) ((o)->movefactor) #define hyudoro_itemcount(o) ((o)->movecount) #define hyudoro_hover_stack(o) ((o)->threshold) - -static mobj_t * -hyudoro_next (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->tracer != NULL && P_MobjWasRemoved(o->tracer) == false); - - return o->tracer; -} - +#define hyudoro_next(o) ((o)->tracer) #define hyudoro_stackpos(o) ((o)->reactiontime) -// these next two functions cannot be combined -static mobj_t * -hyudoro_center (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} - -static mobj_t * -hyudoro_target (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} +// cannot be combined +#define hyudoro_center(o) ((o)->target) +#define hyudoro_target(o) ((o)->target) #define hyudoro_center_max_radius(o) ((o)->threshold) - -static mobj_t * -hyudoro_center_master (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} +#define hyudoro_center_master(o) ((o)->target) static angle_t trace_angle (mobj_t *hyu) @@ -126,6 +94,8 @@ get_hyudoro_target_player (mobj_t *hyu) { mobj_t *target = hyudoro_target(hyu); + I_Assert(target != NULL && P_MobjWasRemoved(target) == false); + return target ? target->player : NULL; } @@ -220,6 +190,8 @@ move_to_player (mobj_t *hyu) angle_t angle; + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + if (target == NULL || P_MobjWasRemoved(target) == true) return; @@ -239,6 +211,10 @@ deliver_item (mobj_t *hyu) mobj_t *target = hyudoro_target(hyu); player_t *player = target->player; + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + I_Assert(target != NULL && P_MobjWasRemoved(target) == false); + I_Assert(player != NULL); + P_SetTarget(&hyudoro_target(hyu), NULL); if (player) @@ -268,6 +244,8 @@ append_hyudoro { INT32 lastpos = 0; + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + while (is_hyudoro(*head)) { lastpos = hyudoro_stackpos(*head); @@ -314,7 +292,11 @@ hyudoro_patrol_hit_player mobj_t *center = hyudoro_center(hyu); - if (!player) + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); + I_Assert(center != NULL && P_MobjWasRemoved(center) == false); + + if (player == NULL) return false; // Cannot hit its master @@ -356,6 +338,8 @@ award_immediately (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + if (player) { if (player->itemamount && @@ -380,6 +364,9 @@ hyudoro_return_hit_player ( mobj_t * hyu, mobj_t * toucher) { + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); + if (toucher != hyudoro_target(hyu)) return false; @@ -399,7 +386,9 @@ hyudoro_hover_await_stack (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); - if (!player) + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + + if (player == NULL) return false; // First in stack goes first @@ -453,6 +442,8 @@ Obj_HyudoroDeploy (mobj_t *master) void Obj_HyudoroThink (mobj_t *hyu) { + I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); + // Might get set from clipping slopes hyu->momz = 0; diff --git a/src/p_mobj.c b/src/p_mobj.c index 009241c62..64d0f616c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13464,6 +13464,8 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo { mobj_t *newmobj; + I_Assert(mobj != NULL && P_MobjWasRemoved(mobj) == false); + xofs = FixedMul(xofs, mobj->scale); yofs = FixedMul(yofs, mobj->scale); zofs = FixedMul(zofs, mobj->scale); From 098304bd996fdae56cd9862b60c5eb54ceb41008 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 22:00:54 -0400 Subject: [PATCH 17/20] Allow hyu thru tripwire --- src/k_kart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.c b/src/k_kart.c index a1f9ac788..7a1d23bf6 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2908,6 +2908,7 @@ boolean K_TripwirePassConditions(player_t *player) player->sneakertimer || player->growshrinktimer > 0 || player->flamedash || + player->hyudorotimer || player->speed > 2 * K_GetKartSpeed(player, false) ) return true; From 61d61dcf25ecfb8860e868482cad298555a2b63e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 22:02:21 -0400 Subject: [PATCH 18/20] Revert "EVEN MORE" This reverts commit 5ef78cbc16b795a90ce04fe032e2650af8d817f7. --- src/objects/hyudoro.c | 69 ++++++++++++++++++++++++------------------- src/p_mobj.c | 2 -- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index d72a597c4..b5ece9157 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -37,15 +37,47 @@ K_ChangePlayerItem #define hyudoro_itemtype(o) ((o)->movefactor) #define hyudoro_itemcount(o) ((o)->movecount) #define hyudoro_hover_stack(o) ((o)->threshold) -#define hyudoro_next(o) ((o)->tracer) + +static mobj_t * +hyudoro_next (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->tracer != NULL && P_MobjWasRemoved(o->tracer) == false); + + return o->tracer; +} + #define hyudoro_stackpos(o) ((o)->reactiontime) -// cannot be combined -#define hyudoro_center(o) ((o)->target) -#define hyudoro_target(o) ((o)->target) +// these next two functions cannot be combined +static mobj_t * +hyudoro_center (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} + +static mobj_t * +hyudoro_target (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} #define hyudoro_center_max_radius(o) ((o)->threshold) -#define hyudoro_center_master(o) ((o)->target) + +static mobj_t * +hyudoro_center_master (mobj_t *o) +{ + I_Assert(o != NULL && P_MobjWasRemoved(o) == false); + I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); + + return o->target; +} static angle_t trace_angle (mobj_t *hyu) @@ -94,8 +126,6 @@ get_hyudoro_target_player (mobj_t *hyu) { mobj_t *target = hyudoro_target(hyu); - I_Assert(target != NULL && P_MobjWasRemoved(target) == false); - return target ? target->player : NULL; } @@ -190,8 +220,6 @@ move_to_player (mobj_t *hyu) angle_t angle; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - if (target == NULL || P_MobjWasRemoved(target) == true) return; @@ -211,10 +239,6 @@ deliver_item (mobj_t *hyu) mobj_t *target = hyudoro_target(hyu); player_t *player = target->player; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(target != NULL && P_MobjWasRemoved(target) == false); - I_Assert(player != NULL); - P_SetTarget(&hyudoro_target(hyu), NULL); if (player) @@ -244,8 +268,6 @@ append_hyudoro { INT32 lastpos = 0; - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - while (is_hyudoro(*head)) { lastpos = hyudoro_stackpos(*head); @@ -292,11 +314,7 @@ hyudoro_patrol_hit_player mobj_t *center = hyudoro_center(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); - I_Assert(center != NULL && P_MobjWasRemoved(center) == false); - - if (player == NULL) + if (!player) return false; // Cannot hit its master @@ -338,8 +356,6 @@ award_immediately (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - if (player) { if (player->itemamount && @@ -364,9 +380,6 @@ hyudoro_return_hit_player ( mobj_t * hyu, mobj_t * toucher) { - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - I_Assert(toucher != NULL && P_MobjWasRemoved(toucher) == false); - if (toucher != hyudoro_target(hyu)) return false; @@ -386,9 +399,7 @@ hyudoro_hover_await_stack (mobj_t *hyu) { player_t *player = get_hyudoro_target_player(hyu); - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - - if (player == NULL) + if (!player) return false; // First in stack goes first @@ -442,8 +453,6 @@ Obj_HyudoroDeploy (mobj_t *master) void Obj_HyudoroThink (mobj_t *hyu) { - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - // Might get set from clipping slopes hyu->momz = 0; diff --git a/src/p_mobj.c b/src/p_mobj.c index 64d0f616c..009241c62 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13464,8 +13464,6 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo { mobj_t *newmobj; - I_Assert(mobj != NULL && P_MobjWasRemoved(mobj) == false); - xofs = FixedMul(xofs, mobj->scale); yofs = FixedMul(yofs, mobj->scale); zofs = FixedMul(zofs, mobj->scale); From 800dcc6302f303e33a318f9e74c21515ffad1243 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 22 May 2022 22:02:31 -0400 Subject: [PATCH 19/20] Revert "Some asserts in hyu code" This reverts commit 0ce466e7efacd1e97971ae1fb2bee9f6e6390a9d. --- src/objects/hyudoro.c | 54 ++++++------------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index b5ece9157..e8fc14de3 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -37,55 +37,21 @@ K_ChangePlayerItem #define hyudoro_itemtype(o) ((o)->movefactor) #define hyudoro_itemcount(o) ((o)->movecount) #define hyudoro_hover_stack(o) ((o)->threshold) - -static mobj_t * -hyudoro_next (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->tracer != NULL && P_MobjWasRemoved(o->tracer) == false); - - return o->tracer; -} - +#define hyudoro_next(o) ((o)->tracer) #define hyudoro_stackpos(o) ((o)->reactiontime) -// these next two functions cannot be combined -static mobj_t * -hyudoro_center (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} - -static mobj_t * -hyudoro_target (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} +// cannot be combined +#define hyudoro_center(o) ((o)->target) +#define hyudoro_target(o) ((o)->target) #define hyudoro_center_max_radius(o) ((o)->threshold) - -static mobj_t * -hyudoro_center_master (mobj_t *o) -{ - I_Assert(o != NULL && P_MobjWasRemoved(o) == false); - I_Assert(o->target != NULL && P_MobjWasRemoved(o->target) == false); - - return o->target; -} +#define hyudoro_center_master(o) ((o)->target) static angle_t trace_angle (mobj_t *hyu) { mobj_t *center = hyu->target; - I_Assert(center != NULL && P_MobjWasRemoved(center) == false); - if (hyu->x != center->x || hyu->y != center->y) { return R_PointToAngle2( @@ -100,15 +66,13 @@ get_look_angle (mobj_t *thing) { player_t *player = thing->player; - I_Assert(player != NULL); - return player ? player->angleturn : thing->angle; } static boolean is_hyudoro (mobj_t *thing) { - return thing != NULL && P_MobjWasRemoved(thing) == false && thing->type == MT_HYUDORO; + return thing && thing->type == MT_HYUDORO; } static mobj_t * @@ -116,8 +80,6 @@ get_hyudoro_master (mobj_t *hyu) { mobj_t *center = hyudoro_center(hyu); - I_Assert(center != NULL && P_MobjWasRemoved(center) == false); - return center ? hyudoro_center_master(center) : NULL; } @@ -135,8 +97,6 @@ sine_bob angle_t a, fixed_t sineofs) { - I_Assert(hyu != NULL && P_MobjWasRemoved(hyu) == false); - hyu->sprzoff = FixedMul(hyu->height, sineofs + FINESINE(a >> ANGLETOFINESHIFT)); } @@ -220,7 +180,7 @@ move_to_player (mobj_t *hyu) angle_t angle; - if (target == NULL || P_MobjWasRemoved(target) == true) + if (!target) return; angle = R_PointToAngle2( From a12c88c5e213519422dcef33be3f81dabfe0dec6 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 22 May 2022 19:19:41 -0700 Subject: [PATCH 20/20] Strip items after stealing with Hyudoro --- src/objects/hyudoro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/objects/hyudoro.c b/src/objects/hyudoro.c index e8fc14de3..af0241fe3 100644 --- a/src/objects/hyudoro.c +++ b/src/objects/hyudoro.c @@ -291,14 +291,14 @@ hyudoro_patrol_hit_player K_AddHitLag(toucher, TICRATE/2, true); - player->hyudorotimer = hyudorotime; - player->stealingtimer = hyudorotime; - hyudoro_mode(hyu) = HYU_RETURN; hyudoro_itemtype(hyu) = player->itemtype; hyudoro_itemcount(hyu) = player->itemamount; - K_ChangePlayerItem(player, KITEM_NONE, 0); + K_StripItems(player); + + player->hyudorotimer = hyudorotime; + player->stealingtimer = hyudorotime; P_SetTarget(&hyudoro_target(hyu), hyudoro_center_master(center));