diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 253f353db..500fa9b16 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -147,6 +147,11 @@ static void Command_Addfilelocal(void); static void Command_Addfile(void); static void Command_Addskins(void); static void Command_GLocalSkin(void); +static void SetPrefcolor(int splitplayer); +static void Command_UsePrefcolor(void); +static void Command_UsePrefcolor2(void); +static void Command_UsePrefcolor3(void); +static void Command_UsePrefcolor4(void); static void Command_ListWADS_f(void); static void Command_LocateLump_f(void); static void Command_ListDoomednums_f(void); @@ -866,6 +871,11 @@ void D_RegisterClientCommands(void) COM_AddCommand("localskin", Command_GLocalSkin); + COM_AddCommand("useprefcolor", Command_UsePrefcolor); + COM_AddCommand("useprefcolor2", Command_UsePrefcolor2); + COM_AddCommand("useprefcolor3", Command_UsePrefcolor3); + COM_AddCommand("useprefcolor4", Command_UsePrefcolor4); + K_RegisterClientKartStuff(); // SRB2kart CV_RegisterVar(&cv_screenshot_option); @@ -4334,6 +4344,49 @@ static void Command_GLocalSkin(void) } } +static void SetPrefcolor(int splitplayer) +{ + // splitscreen + if (splitscreen < splitplayer) + return; + + const INT32 pnum = P_GetLocalPlayerNumForNum(splitplayer); + + player_t *player = &players[pnum]; + consvar_t *colorvars[] = {&cv_playercolor, &cv_playercolor2, &cv_playercolor3, &cv_playercolor4}; + consvar_t *playercolor = colorvars[splitplayer]; + + if (skins[player->skin].prefcolor) + { + CV_SetValue(playercolor, skins[player->skin].prefcolor); + CONS_Printf("Set color to %s%s\n", HU_SkinColorToConsoleColor(skins[player->skin].prefcolor), KartColor_Names[skins[player->skin].prefcolor]); + } + else + { + CONS_Printf("\x86Your skin has no prefcolor set\n"); + } +} + +static void Command_UsePrefcolor(void) +{ + SetPrefcolor(0); +} + +static void Command_UsePrefcolor2(void) +{ + SetPrefcolor(1); +} + +static void Command_UsePrefcolor3(void) +{ + SetPrefcolor(2); +} + +static void Command_UsePrefcolor4(void) +{ + SetPrefcolor(3); +} + static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum) { char filename[241]; diff --git a/src/p_local.h b/src/p_local.h index ab5a2de27..78c2e141d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -420,6 +420,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch); void P_DelSeclist(msecnode_t *node); void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y); +void P_Initsecnode(void); void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist); diff --git a/src/p_map.c b/src/p_map.c index 2fff9d0c6..442879475 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3984,19 +3984,51 @@ boolean P_CheckSector(sector_t *sector, boolean crunch) Lots of new Boom functions that work faster and add functionality. */ +#ifndef PHOBOS_BUILD +static msecnode_t *headsecnode = NULL; +#endif + +void P_Initsecnode(void) +{ +#ifndef PHOBOS_BUILD + headsecnode = NULL; +#endif +} + // P_GetSecnode() retrieves a node from the freelist. The calling routine // should make sure it sets all fields properly. static msecnode_t *P_GetSecnode(void) { +#ifdef PHOBOS_BUILD return Z_LevelPoolCalloc(sizeof(msecnode_t)); +#else + msecnode_t *node; + + if (headsecnode) + { + // vanilla does not clear this + // so for compat reasons we also dont + // means we just reuse stale data which causes weird interactions with orbiting items in some cases + node = headsecnode; + headsecnode = headsecnode->m_thinglist_next; + } + else + node = Z_LevelPoolCalloc(sizeof(msecnode_t)); + + return node; +#endif } // P_PutSecnode() returns a node to the freelist. - static inline void P_PutSecnode(msecnode_t *node) { +#ifdef PHOBOS_BUILD Z_LevelPoolFree(node, sizeof(msecnode_t)); +#else + node->m_thinglist_next = headsecnode; + headsecnode = node; +#endif } // P_AddSecnode() searches the current list to see if this sector is diff --git a/src/p_setup.c b/src/p_setup.c index 9298dc446..8e540c645 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3003,6 +3003,9 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) CON_Drawer(); // let the user know what we are going to do I_FinishUpdate(); // page flip or blit buffer + // Initialize sector node list. + P_Initsecnode(); + if (netgame || multiplayer) cv_debug = botskin = 0;