diff --git a/src/Sourcefile b/src/Sourcefile index 8a94d2189..87fa585b3 100644 --- a/src/Sourcefile +++ b/src/Sourcefile @@ -133,7 +133,6 @@ k_bot.cpp k_botitem.cpp k_botsearch.cpp k_cluster.cpp -k_kartitem.cpp k_odds.c k_altshrink.c k_grandprix.c diff --git a/src/console.c b/src/console.c index f39804822..9c30ee78c 100644 --- a/src/console.c +++ b/src/console.c @@ -1624,7 +1624,6 @@ static const char *CON_LoadingStrings[LOADED_ALLDONE+1] = "Init audio subsystem...", //LOADED_SINITSFXCHANNELS "Cache HUD...", //LOADED_STINIT "Test fixed-point arithmetic...", //LOADED_MATHINIT - "Init kart items...", //LOADED_KITEMSINIT "Init ACSVM...", //LOADED_ACSINIT "Check game status...", //LOADED_DCHECKNETGAME "Now starting..." diff --git a/src/console.h b/src/console.h index c68be9f74..bcc503a21 100644 --- a/src/console.h +++ b/src/console.h @@ -53,7 +53,6 @@ typedef enum LOADED_SINITSFXCHANNELS, LOADED_STINIT, LOADED_MATHINIT, - LOADED_KITEMSINIT, LOADED_ACSINIT, LOADED_DCHECKNETGAME, LOADED_ALLDONE = LOADED_DCHECKNETGAME, diff --git a/src/d_main.cpp b/src/d_main.cpp index 6d9965459..3218325af 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -82,7 +82,6 @@ #include "m_random.h" // P_ClearRandom #include "acs/interface.h" #include "k_specialstage.h" -#include "k_kartitem.hpp" #define __STDC_FORMAT_MACROS #include @@ -1841,10 +1840,6 @@ void D_SRB2Main(void) CON_SetLoadingProgress(LOADED_MATHINIT); - CONS_Printf("K_InitializeKartItems(): Init necessary kart items.\n"); - K_InitializeKartItems(); - CON_SetLoadingProgress(LOADED_KITEMSINIT); - CONS_Printf("ACS_Init(): Init Action Code Script VM.\n"); ACS_Init(); CON_SetLoadingProgress(LOADED_ACSINIT); diff --git a/src/k_kartitem.cpp b/src/k_kartitem.cpp deleted file mode 100644 index ffc6fdec7..000000000 --- a/src/k_kartitem.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// BLANKART -//----------------------------------------------------------------------------- -// Copyright (C) 2018-2025 by Kart Krew. -// Copyright (C) 2025 by "Anonimus". -// Copyright (C) 2025 Blankart Team. -// -// 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 k_kartitem.cpp -/// \brief Kart item structure and systems. - -#include -#include // kartitemtable - -#include "command.h" // Need for player_t -#include "doomdef.h" -#include "d_player.h" // Need for player_t -#include "k_kartitem.hpp" - -std::unordered_map kartitemtable; - -extern "C" -{ -kartitem_t *K_AddItemOdds(UINT32 id, kartitemflags_t flags) -{ - kartitem_t *newitem = new kartitem_t(); - - newitem->_id = id; - newitem->_flags = flags; - - newitem->alternate = false; - newitem->forceme = 0; - - // Initialize race and battle odds. - newitem->odds[GT_RACE][KARTITEM_NORMAL] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - newitem->odds[GT_RACE][KARTITEM_ALTERN] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - newitem->odds[GT_BATTLE][KARTITEM_NORMAL] = { 0, 0 }; - newitem->odds[GT_BATTLE][KARTITEM_ALTERN] = { 0, 0 }; - - kartitemtable.insert({ id, newitem }); - - return newitem; -} - -#define AssertItemExists(kitem, id) { \ - if (auto search = kartitemtable.find(id); search != kartitemtable.end()) \ - { \ - const kartitem_t *tempitem = search->second; \ - I_Assert(tempitem != nullptr); \ - I_Assert(tempitem->_id == kitem->_id); \ - I_Assert(tempitem->_id == id); \ - CONS_Printf("Item no. %d most certainly exists.\n", id); \ - } \ -} - -void K_InitializeKartItems(void) -{ - kartitem_t *kitem; - - // FIXME: Handle all this by SOC at some point! - - kitem = K_AddItemOdds(KITEM_SNEAKER, static_cast(IF_NONE)); - - if (kitem) - { - CONS_Printf("Allocation OK; setting up KITEM_SNEAKER...\n"); - AssertItemExists(kitem, KITEM_SNEAKER); - - // Sneaker - kitem->odds[GT_RACE][KARTITEM_NORMAL] = - { 0, 0, 0, 0, 8, 24, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - //B C D E F G H I J K L M N O P Q - - kitem->odds[GT_BATTLE][KARTITEM_NORMAL] = { 2, 1 }; - //R S - - //CONS_Printf("%d\n", kitem->odds[GT_RACE][KARTITEM_NORMAL][5]); // Should print 24 - } - else - { - // Oh no. - I_Error("Failed to allocate required item KITEM_SNEAKER!"); - } - - kitem = K_AddItemOdds(KITEM_ROCKETSNEAKER, static_cast(IF_NONE)); - - if (kitem) - { - CONS_Printf("Allocation OK; setting up KITEM_ROCKETSNEAKER...\n"); - AssertItemExists(kitem, KITEM_ROCKETSNEAKER); - - // Rocket Sneaker - kitem->odds[GT_RACE][KARTITEM_NORMAL] = - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 35, 42, 48, 37, 37}; - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - //B C D E F G H I J K L M N O P Q - - //CONS_Printf("%d\n", kitem->odds[GT_RACE][KARTITEM_NORMAL][14]); // Should print 37 - } - else - { - // Oh no. - I_Error("Failed to allocate required item KITEM_ROCKETSNEAKER!"); - } - - // Paranoia ID test for items allocated with this function. - CONS_Printf("ID test\n"); - - UINT32 i = 0; - for (auto& iterator : kartitemtable) - { - const kartitem_t * _item = iterator.second; - - if (_item) - { - CONS_Printf("Item no. %d exists.\n", _item->_id); - } - else - { - I_Error("An allocated item is NULL or invalid!"); - } - - i++; - } -} -} \ No newline at end of file diff --git a/src/k_kartitem.hpp b/src/k_kartitem.hpp deleted file mode 100644 index 628174331..000000000 --- a/src/k_kartitem.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// BLANKART -//----------------------------------------------------------------------------- -// Copyright (C) 2018-2025 by Kart Krew. -// Copyright (C) 2025 by "Anonimus". -// Copyright (C) 2025 Blankart Team. -// -// 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 k_kartitem.hpp -/// \brief Kart item structure and systems. - - -#ifndef __K_KARTITEM__ -#define __K_KARTITEM__ - -#include -#include // kartitemtable - -#include "command.h" // Need for player_t -#include "doomstat.h" -#include "doomdef.h" -#include "d_player.h" // Need for player_t - - -typedef enum kartitemflags_e -{ - IF_NONE = 0, - IF_POWERITEM = (1 << 0), // This item is a "power item". This activates "frantic item" toggle related functionality. - IF_STARTCOOLDOWN = (1 << 1), // This item should not appear at the beginning of a race. (Usually really powerful crowd-breaking items) - IF_INDIRECTITEM = (1 << 2), // This item affects others indirectly. A 20 second cooldown is applied to all other items with this flag when an indirect item is rolled. - IF_NOTNEAREND = (1 << 3), // This item should not appear at the end of a race. (Usually trap items that lose their effectiveness) - IF_NOTFORBOTTOM = (1 << 4), // After the first 30 seconds, this item stops appearing for losing players. (Usually items that feel less effective at these positions) - IF_RUNNERAUGMENT = (1 << 5) // This item's odds are affected by the severity of 1st place's frontrun. (Very likely only for SPBs, but who knows?) -} kartitemflags_t; - -typedef enum kartitemfuncs_e -{ - IFUNC_UNIQUEODDS, // This item isn't bound to the odds table, and has unique odds based on certain conditions. - IFUNC_ALTERNODDS, // Same as IFUNC_UNIQUEODDS, but strictly for the alternative version of an item. - IFUNC_SETFORCEME, // This function, should it exist, controls the "forceme" variable for the given item. - IFUNC_CALLONROLL, // When this item is rolled in a roulette, this function is called. - IFUNC_USEITEM, // Function to call on an item's use. - NUMKARTITEMFUNCS -} kartitemfuncs_t; - -struct kartitem_t -{ - UINT32 _id; // The item's ID in game memory. - - kartitemflags_t _flags; // Various flags that control odds behavior. - - boolean alternate; // Is this an alternative version of the same item? - - UINT8 forceme; // This item is being forced into a player's item slot for one reason or another. Higher value = higher priority. - - void *functions[NUMKARTITEMFUNCS]; // Item functions. - - // Per-gametype item odds, for both standard and alternative modes. - std::vector odds[NUMGAMETYPES][2]; -}; - -// Dynamic table containing all items. -extern std::unordered_map kartitemtable; - -extern "C" -{ - kartitem_t *K_AddItemOdds(UINT32 id, kartitemflags_t flags); - void K_InitializeKartItems(void); -} - -#endif // __K_KARTITEM__ \ No newline at end of file diff --git a/src/typedef.h b/src/typedef.h index dc9989b6e..9db777746 100644 --- a/src/typedef.h +++ b/src/typedef.h @@ -208,9 +208,6 @@ TYPEDEF (waypoint_t); TYPEDEF (mapUserProperty_t); TYPEDEF (mapUserProperties_t); -// k_kartitem.hpp -TYPEDEF (kartitem_t); - // lua_hudlib_drawlist.h typedef struct huddrawlist_s *huddrawlist_h;