diff --git a/src/Chat.c b/src/Chat.c index 7e460c9d2..1d16bc819 100644 --- a/src/Chat.c +++ b/src/Chat.c @@ -321,7 +321,7 @@ static void HelpCommand_Execute(const String* args, int argsCount) { } } -static struct ChatCommand HelpCommand_Instance = { +static struct ChatCommand HelpCommand = { "Help", HelpCommand_Execute, false, { "&a/client help [command name]", @@ -339,7 +339,7 @@ static void GpuInfoCommand_Execute(const String* args, int argsCount) { } } -static struct ChatCommand GpuInfoCommand_Instance = { +static struct ChatCommand GpuInfoCommand = { "GpuInfo", GpuInfoCommand_Execute, false, { "&a/client gpuinfo", @@ -363,7 +363,7 @@ static void RenderTypeCommand_Execute(const String* args, int argsCount) { } } -static struct ChatCommand RenderTypeCommand_Instance = { +static struct ChatCommand RenderTypeCommand = { "RenderType", RenderTypeCommand_Execute, false, { "&a/client rendertype [normal/legacy/legacyfast]", @@ -389,7 +389,7 @@ static void ResolutionCommand_Execute(const String* args, int argsCount) { } } -static struct ChatCommand ResolutionCommand_Instance = { +static struct ChatCommand ResolutionCommand = { "Resolution", ResolutionCommand_Execute, false, { "&a/client resolution [width] [height]", @@ -405,7 +405,7 @@ static void ModelCommand_Execute(const String* args, int argsCount) { } } -static struct ChatCommand ModelCommand_Instance = { +static struct ChatCommand ModelCommand = { "Model", ModelCommand_Execute, true, { "&a/client model [name]", @@ -508,7 +508,7 @@ static void CuboidCommand_Execute(const String* args, int argsCount) { cuboid_hooked = true; } -static struct ChatCommand CuboidCommand_Instance = { +static struct ChatCommand CuboidCommand = { "Cuboid", CuboidCommand_Execute, true, { "&a/client cuboid [block] [persist]", @@ -541,7 +541,7 @@ static void TeleportCommand_Execute(const String* args, int argsCount) { e->VTABLE->SetLocation(e, &update, false); } -static struct ChatCommand TeleportCommand_Instance = { +static struct ChatCommand TeleportCommand = { "TP", TeleportCommand_Execute, true, { "&a/client tp [x y z]", @@ -566,13 +566,13 @@ void Chat_Send(const String* text, bool logUsage) { } static void Chat_Init(void) { - Commands_Register(&GpuInfoCommand_Instance); - Commands_Register(&HelpCommand_Instance); - Commands_Register(&RenderTypeCommand_Instance); - Commands_Register(&ResolutionCommand_Instance); - Commands_Register(&ModelCommand_Instance); - Commands_Register(&CuboidCommand_Instance); - Commands_Register(&TeleportCommand_Instance); + Commands_Register(&GpuInfoCommand); + Commands_Register(&HelpCommand); + Commands_Register(&RenderTypeCommand); + Commands_Register(&ResolutionCommand); + Commands_Register(&ModelCommand); + Commands_Register(&CuboidCommand); + Commands_Register(&TeleportCommand); Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, true); } diff --git a/src/Entity.c b/src/Entity.c index 0b3c576df..859566166 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -121,7 +121,7 @@ static void Entity_SetBlockModel(struct Entity* e, const String* model) { if (raw == -1) { /* use default humanoid model */ - e->Model = Human_ModelPtr; + e->Model = Models.Human; } else { e->ModelBlock = (BlockID)raw; e->Model = Model_Get(&block); diff --git a/src/Menus.c b/src/Menus.c index 32e807758..6499198d9 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -2690,6 +2690,7 @@ static void HacksSettingsScreen_ContextRecreated(void* screen) { Menu_Back(s, 10, &s->Buttons[10], "Done", &s->TitleFont, Menu_SwitchOptions); widgets[11] = NULL; widgets[12] = NULL; widgets[13] = NULL; + HacksSettingsScreen_CheckHacksAllowed(screen); } struct Screen* HacksSettingsScreen_MakeInstance(void) { diff --git a/src/Model.c b/src/Model.c index 5e1d19055..3f327d9ba 100644 --- a/src/Model.c +++ b/src/Model.c @@ -14,7 +14,6 @@ #include "Funcs.h" struct _ModelsData Models; -struct Model* Human_ModelPtr; #define UV_POS_MASK ((uint16_t)0x7FFF) #define UV_MAX ((uint16_t)0x8000) @@ -105,7 +104,7 @@ void Model_Render(struct Model* model, struct Entity* entity) { Matrix_Mul(&m, &entity->Transform, &Gfx_View); Gfx_LoadMatrix(MATRIX_VIEW, &m); - model->DrawModel(entity); + model->Draw(entity); Gfx_LoadMatrix(MATRIX_VIEW, &Gfx_View); } @@ -792,7 +791,7 @@ static struct Model* CorpseModel_GetInstance(void) { corpse_model = human_model; corpse_model.Name = "corpse"; corpse_model.MakeParts = Model_NoParts; - corpse_model.DrawModel = CorpseModel_Draw; + corpse_model.Draw = CorpseModel_Draw; return &corpse_model; } @@ -1672,7 +1671,7 @@ static void Model_RegisterDefaultModels(void) { Model_Register(HumanoidModel_GetInstance()); Model_Make(&human_model); - Human_ModelPtr = &human_model; + Models.Human = &human_model; Model_Register(ChickenModel_GetInstance()); Model_Register(CreeperModel_GetInstance()); diff --git a/src/Model.h b/src/Model.h index 563637558..ba7b22377 100644 --- a/src/Model.h +++ b/src/Model.h @@ -50,7 +50,7 @@ struct Model { /* Creates the ModelParts of this model and fills out vertices. */ void (*MakeParts)(void); /* Draws/Renders this model for the given entity. */ - void (*DrawModel)(struct Entity* entity); + void (*Draw)(struct Entity* entity); /* Returns height the 'nametag' gets drawn at above the entity's feet. */ float (*GetNameY)(struct Entity* entity); /* Returns height the 'eye' is located at above the entity's feet. */ @@ -110,6 +110,8 @@ CC_VAR extern struct _ModelsData { /* Maximum number of vertices that can be stored in Vertices. */ /* NOTE: If you change this, you MUST also destroy and recreate the dynamic VB. */ int MaxVertices; + /* Pointer to humanoid/human model.*/ + struct Model* Human; } Models; /* Initialises fields of a model to default. */ @@ -138,8 +140,6 @@ void Model_RenderArm(struct Model* model, struct Entity* entity); /* Draws the given part with appropriate rotation to produce an arm look. */ CC_API void Model_DrawArmPart(struct ModelPart* part); -extern struct Model* Human_ModelPtr; - /* Returns a pointer to the model whose name caselessly matches given name. */ CC_API struct Model* Model_Get(const String* name); /* Returns index of the model texture whose name caselessly matches given name. */