Remove alloc_*() Functions

This commit is contained in:
TheBrokenRail 2024-05-17 00:36:28 -04:00
parent bbaa69edeb
commit b23f7f1618
13 changed files with 18 additions and 18 deletions

@ -1 +1 @@
Subproject commit eca52455c3d8a520aba30b81d17031340b76ff88
Subproject commit 603010e3cce7a7cce90b87da43e4c918047d14a2

View File

@ -40,7 +40,7 @@ static void start_world(Minecraft *minecraft) {
minecraft->selectLevel(&name, &name, &settings);
// Open ProgressScreen
ProgressScreen *screen = alloc_ProgressScreen();
ProgressScreen *screen = new ProgressScreen;
ALLOC_CHECK(screen);
screen = screen->constructor();
minecraft->setScreen((Screen *) screen);

View File

@ -163,7 +163,7 @@ static ItemInstance *BucketItem_getCraftingRemainingItem(FoodItem *item, ItemIns
if (item_instance->auxiliary == 0) {
return nullptr;
}
ItemInstance *ret = alloc_ItemInstance();
ItemInstance *ret = new ItemInstance;
ret->id = item->id;
ret->count = item_instance->count;
ret->auxiliary = 0;
@ -186,7 +186,7 @@ CUSTOM_VTABLE(bucket, FoodItem) {
// Create Items
static FoodItem *create_bucket(int32_t id, int32_t texture_x, int32_t texture_y, std::string name) {
// Construct
FoodItem *item = alloc_FoodItem();
FoodItem *item = new FoodItem;
ALLOC_CHECK(item);
Item_constructor((Item *) item, id); // FoodItem's Constructor Was Inlined

View File

@ -116,7 +116,7 @@ static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int
// Makes the cakes
static void make_cake() {
// Construct
cake = alloc_Tile();
cake = new Tile;
ALLOC_CHECK(cake);
int texture = 122;
cake->constructor(92, texture, Material_dirt);

View File

@ -19,7 +19,7 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
original(dispatcher);
// Register TripodCameraRenderer
TripodCameraRenderer *renderer = alloc_TripodCameraRenderer();
TripodCameraRenderer *renderer = new TripodCameraRenderer;
ALLOC_CHECK(renderer);
renderer->constructor();
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);

View File

@ -227,7 +227,7 @@ static void create_world(Minecraft *minecraft, std::string name, bool is_creativ
minecraft->hostMultiplayer(19132);
// Open ProgressScreen
ProgressScreen *screen = alloc_ProgressScreen();
ProgressScreen *screen = new ProgressScreen;
ALLOC_CHECK(screen);
screen = screen->constructor();
minecraft->setScreen((Screen *) screen);

View File

@ -16,7 +16,7 @@ static void _handle_open_crafting(Minecraft *minecraft) {
// Set Screen
if (!creative_is_restricted() || !Minecraft_isCreativeMode(minecraft)) {
WorkbenchScreen *screen = alloc_WorkbenchScreen();
WorkbenchScreen *screen = new WorkbenchScreen;
ALLOC_CHECK(screen);
screen = screen->constructor(0);
minecraft->setScreen((Screen *) screen);

View File

@ -703,7 +703,7 @@ void PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_inje
ItemInstance *Item_getCraftingRemainingItem_injection(__attribute__((unused)) Item_getCraftingRemainingItem_t original, Item *self, ItemInstance *item_instance) {
if (self->craftingRemainingItem != nullptr) {
ItemInstance *ret = alloc_ItemInstance();
ItemInstance *ret = new ItemInstance;
ret->id = self->craftingRemainingItem->id;
ret->count = item_instance->count;
ret->auxiliary = 0;

View File

@ -187,7 +187,7 @@ CUSTOM_VTABLE(info_screen, Screen) {
// Handle Back
vtable->handleBackEvent = [](Screen *self, bool do_nothing) {
if (!do_nothing) {
OptionsScreen *screen = alloc_OptionsScreen();
OptionsScreen *screen = new OptionsScreen;
ALLOC_CHECK(screen);
screen->constructor();
self->minecraft->setScreen((Screen *) screen);
@ -256,7 +256,7 @@ CUSTOM_VTABLE(info_screen, Screen) {
// Create Screen
Screen *_create_options_info_screen() {
// Allocate
Screen *screen = alloc_Screen();
Screen *screen = new Screen;
ALLOC_CHECK(screen);
screen->constructor();

View File

@ -97,7 +97,7 @@ static void OptionsScreen_init_injection(OptionsScreen_init_t original, OptionsS
original(self);
// Add Button
Touch_TButton *button = alloc_Touch_TButton();
Touch_TButton *button = new Touch_TButton;
ALLOC_CHECK(button);
std::string name = "Reborn";
button->constructor(INFO_BUTTON_ID, &name);

View File

@ -95,7 +95,7 @@ static void start_world(Minecraft *minecraft) {
}
// Open ProgressScreen
ProgressScreen *screen = alloc_ProgressScreen();
ProgressScreen *screen = new ProgressScreen;
ALLOC_CHECK(screen);
screen = screen->constructor();
minecraft->setScreen((Screen *) screen);

View File

@ -33,7 +33,7 @@ static int32_t sdl_key_to_minecraft_key_injection(Common_sdl_key_to_minecraft_ke
static void LocalPlayer_openTextEdit_injection(LocalPlayer *local_player, TileEntity *sign) {
if (sign->type == 4) {
Minecraft *minecraft = local_player->minecraft;
TextEditScreen *screen = alloc_TextEditScreen();
TextEditScreen *screen = new TextEditScreen;
ALLOC_CHECK(screen);
screen = screen->constructor((SignTileEntity *) sign);
minecraft->setScreen((Screen *) screen);

View File

@ -44,17 +44,17 @@ static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(Gu
// Create Button
int touch_gui = 0;
template <typename T>
static Button *create_button(T *(*allocator)(), int id, std::string text) {
T *button = allocator();
static Button *create_button(int id, std::string text) {
T *button = new T;
ALLOC_CHECK(button);
button->constructor(id, &text);
return (Button *) button;
}
Button *touch_create_button(int id, std::string text) {
if (touch_gui) {
return create_button(alloc_Touch_TButton, id, text);
return create_button<Touch_TButton>(id, text);
} else {
return create_button(alloc_Button, id, text);
return create_button<Button>(id, text);
}
}