ohhhh I'm stupid

This commit is contained in:
minenice55 2025-12-04 17:45:13 -05:00
parent 9e21326ab9
commit f72f28976c
3 changed files with 25 additions and 16 deletions

View file

@ -5024,6 +5024,7 @@ void K_DropHnextList(player_t *player)
while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
{
nextwork = work->hnext;
type = MT_NULL;
if (!work->health)
continue; // taking care of itself
@ -5073,11 +5074,11 @@ void K_DropHnextList(player_t *player)
break;
}
LUA_HookDropHnextList(work, &type, &orbit, &dropall);
if (type == MT_NULL) // who's the fucking bitch
type = LUA_HookDropHnextList(work, type, &orbit, &dropall);
if (type == MT_NULL) // who's the fucking bitch 🗣️🗣️🗣️🔥🔥🔥
{
P_RemoveMobj(work);
continue; // that took my shit
continue; // that took my shit 🗣️🗣️🗣️🔥🔥🔥
}
if ((!itemlittering) && (type == MT_SSMINE))

View file

@ -55,6 +55,7 @@ automatically.
X (MobjMoveBlocked),/* P_XYMovement (when movement is blocked) */\
X (MapThingSpawn),/* P_SpawnMapThing */\
X (FollowMobj),/* P_PlayerAfterThink Smiles mobj-following */\
X (DropHnextList),/*SRB2KART*/\
#define HOOK_LIST(X) \
X (NetVars),/* add to archive table (netsave) */\
@ -93,7 +94,6 @@ automatically.
X (KartStripOther),/*SRB2KART*/\
X (CanPickupItem),/*SRB2KART*/\
X (GetItemEquipStyle),/*SRB2KART*/\
X (DropHnextList),/*SRB2KART*/\
#define STRING_HOOK_LIST(X) \
X (SpecialExecute),\
@ -188,7 +188,7 @@ boolean LUA_HookKartStripItems(player_t *player, UINT8 item); // SRB2Kart: Hook
boolean LUA_HookKartStripOther(player_t *player); // SRB2Kart: Hook for K_StripOther.
boolean LUA_HookCanPickupItem(player_t *player, UINT8 weapon, boolean *force); // SRB2Kart: Hook for P_CanPickupItem.
int LUA_HookGetItemEquipStyle(mobjtype_t mobjtype); // SRB2Kart: Hook for K_GetItemEquipStyle.
boolean LUA_HookDropHnextList(mobj_t *mobj, mobjtype_t *droptype, boolean *orbit, boolean *dropall); // SRB2Kart: Hook for K_DropHnextList.
int LUA_HookDropHnextList(mobj_t *mobj, mobjtype_t droptype, boolean *orbit, boolean *dropall); // SRB2Kart: Hook for K_DropHnextList.
#ifdef __cplusplus
} // extern "C"

View file

@ -1447,7 +1447,7 @@ int LUA_HookGetItemEquipStyle(mobjtype_t type)
}
typedef struct {
mobjtype_t *droptype;
mobjtype_t droptype;
boolean *orbit;
boolean *dropall;
} KartDropHnextList_State;
@ -1455,15 +1455,22 @@ typedef struct {
static void res_kartdrophnext(Hook_State *hook)
{
KartDropHnextList_State *state = (KartDropHnextList_State*)hook->userdata;
if (lua_isnumber(gL, -3))
*state->droptype = lua_tonumber(gL, -3);
if (lua_isboolean(gL, -2))
*state->orbit = lua_toboolean(gL, -2);
if (lua_isboolean(gL, -1))
*state->dropall = lua_toboolean(gL, -1);
if (!lua_isnil(gL, -3))
{
state->droptype = luaL_checkinteger(gL, -3);
if (lua_isboolean(gL, -2))
{
*state->orbit = lua_toboolean(gL, -2);
}
if (lua_isboolean(gL, -1))
{
*state->dropall = lua_toboolean(gL, -1);
}
}
}
boolean LUA_HookDropHnextList(mobj_t *mobj, mobjtype_t *droptype, boolean *orbit, boolean *dropall)
int LUA_HookDropHnextList(mobj_t *mobj, mobjtype_t droptype, boolean *orbit, boolean *dropall)
{
Hook_State hook;
KartDropHnextList_State state = {0};
@ -1471,13 +1478,14 @@ boolean LUA_HookDropHnextList(mobj_t *mobj, mobjtype_t *droptype, boolean *orbit
state.orbit = orbit;
state.dropall = dropall;
if (prepare_mobj_hook(&hook, false, HOOK(DropHnextList), mobj->type))
if (prepare_mobj_hook(&hook, 0, HOOK(DropHnextList), mobj->type))
{
LUA_PushUserdata(gL, mobj, META_MOBJ);
hook.userdata = &state;
call_hooks(&hook, 3, res_kartdrophnext);
}
return hook.status;
CONS_Printf("mobj type is %d\n", mobj->type);
CONS_Printf("droptype is %d\n", state.droptype);
return state.droptype;
}