From dfe8edd73d9b075b50015f2a80779374550d7f32 Mon Sep 17 00:00:00 2001 From: Cheesse Date: Sat, 9 Feb 2019 01:39:45 -0500 Subject: [PATCH] Release v1.2.3 --- src/Common.h | 4 +- src/{ => Humans}/CapeModel.c | 174 ++++++++--------- src/{ => Humans}/ChibiSitModel.c | 80 ++++---- src/{ => Humans}/TModel.c | 43 ++--- src/{ => Mobs}/CaveSpiderModel.c | 196 ++++++++++---------- src/{ => Mobs}/CowModel.c | 182 +++++++++--------- src/{ => Mobs}/EndermanModel.c | 0 src/{ => Mobs}/MagmaCubeModel.c | 66 +++---- src/{ => Mobs}/Skeletons.c | 2 + src/{ => Mobs}/SlimeModel.c | 88 ++++----- src/{ => Mobs}/VillagerModel.c | 160 ++++++++-------- src/{ => Mobs}/ZombieVillagerModel.c | 168 ++++++++--------- src/{ => Mobs}/Zombies.c | 2 + src/MoreModels.c | 19 +- src/MoreModels.vcxproj | 64 ++++--- src/{ => Props}/CarModel.c | 267 +++++++++++++-------------- src/{ => Props}/ChairModel.c | 100 +++++----- src/{ => Props}/TVModel.c | 94 +++++----- src/{ => Props}/TableModel.c | 94 +++++----- 19 files changed, 906 insertions(+), 897 deletions(-) rename src/{ => Humans}/CapeModel.c (96%) rename src/{ => Humans}/ChibiSitModel.c (90%) rename src/{ => Humans}/TModel.c (95%) rename src/{ => Mobs}/CaveSpiderModel.c (97%) rename src/{ => Mobs}/CowModel.c (96%) rename src/{ => Mobs}/EndermanModel.c (100%) rename src/{ => Mobs}/MagmaCubeModel.c (96%) rename src/{ => Mobs}/Skeletons.c (96%) rename src/{ => Mobs}/SlimeModel.c (96%) rename src/{ => Mobs}/VillagerModel.c (96%) rename src/{ => Mobs}/ZombieVillagerModel.c (96%) rename src/{ => Mobs}/Zombies.c (90%) rename src/{ => Props}/CarModel.c (94%) rename src/{ => Props}/ChairModel.c (97%) rename src/{ => Props}/TVModel.c (96%) rename src/{ => Props}/TableModel.c (97%) diff --git a/src/Common.h b/src/Common.h index 6e5d01b..a07b776 100644 --- a/src/Common.h +++ b/src/Common.h @@ -66,4 +66,6 @@ struct Model* TVModel_GetInstance(void); struct Model* VillagerModel_GetInstance(void); struct Model* WitherSkeletonModel_GetInstance(void); struct Model* ZombiePigmanModel_GetInstance(void); -struct Model* ZombieVillagerModel_GetInstance(void); \ No newline at end of file +struct Model* ZombieVillagerModel_GetInstance(void); + +void nullfunc(void); \ No newline at end of file diff --git a/src/CapeModel.c b/src/Humans/CapeModel.c similarity index 96% rename from src/CapeModel.c rename to src/Humans/CapeModel.c index d533b16..ccba0d1 100644 --- a/src/CapeModel.c +++ b/src/Humans/CapeModel.c @@ -1,87 +1,87 @@ -#include "Common.h" -// Cape textures are flipped so you will need to flip both of your cape textures. -static struct ModelPart cape; - -static void CapeModel_MakeParts(void) { - BoxDesc_BuildBox(&cape, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-5,8,3, 5,24,2), - BoxDesc_Rot(0, 23, 0) - }); -} - -static void CapeModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - Models.uScale = 1/64.0f; - Models.vScale = 1/32.0f; - - Model_DrawRotate(-e->Anim.Swing * (MATH_PI / 3) + e->Anim.LeftArmZ * (1 - e->Anim.Swing), 0, 0, &cape, false); - Model_UpdateVB(); - - Model_SetupState(Models.Human, e); - Models.Human->Draw(e); -} - -static void CapeModel_DrawArm(struct Entity* e) { - Model_SetupState(Models.Human, e); - Models.Human->DrawArm(e); -} - -static struct ModelVertex vertices[MODEL_BOX_VERTICES]; -static void Cape_MakeModel(struct Model* model) { - // copy everything from human model - *model = *Models.Human; - - model->Name = "cape"; - model->defaultTex = &cape_tex; - model->vertices = vertices; - model->MakeParts = CapeModel_MakeParts; - model->Draw = CapeModel_Draw; - model->DrawArm = CapeModel_DrawArm; -} - -static struct Model model; -struct Model* CapeModel_GetInstance(void) { - Cape_MakeModel(&model); - return &model; -} - -static struct Model model_2011; -struct Model* Cape2011Model_GetInstance(void) { - Cape_MakeModel(&model_2011); - model_2011.Name = "cape_2011"; - model_2011.defaultTex = &cape2011_tex; - return &model_2011; -} - -static struct Model model_2012; -struct Model* Cape2012Model_GetInstance(void) { - Cape_MakeModel(&model_2012); - model_2012.Name = "cape_2012"; - model_2012.defaultTex = &cape2012_tex; - return &model_2012; -} - -static struct Model model_2013; -struct Model* Cape2013Model_GetInstance(void) { - Cape_MakeModel(&model_2013); - model_2013.Name = "cape_2013"; - model_2013.defaultTex = &cape2013_tex; - return &model_2013; -} - -static struct Model model_2015; -struct Model* Cape2015Model_GetInstance(void) { - Cape_MakeModel(&model_2015); - model_2015.Name = "cape_2015"; - model_2015.defaultTex = &cape2015_tex; - return &model_2015; -} - -static struct Model model_2016; -struct Model* Cape2016Model_GetInstance(void) { - Cape_MakeModel(&model_2016); - model_2016.Name = "cape_2016"; - model_2016.defaultTex = &cape2016_tex; - return &model_2016; -} +#include "Common.h" +// Cape textures are flipped so you will need to flip both of your cape textures. +static struct ModelPart cape; + +static void CapeModel_MakeParts(void) { + BoxDesc_BuildBox(&cape, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-5,8,3, 5,24,2), + BoxDesc_Rot(0, 23, 0) + }); +} + +static void CapeModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + Models.uScale = 1/64.0f; + Models.vScale = 1/32.0f; + + Model_DrawRotate(-e->Anim.Swing * (MATH_PI / 3) + e->Anim.LeftArmZ * (1 - e->Anim.Swing), 0, 0, &cape, false); + Model_UpdateVB(); + + Model_SetupState(Models.Human, e); + Models.Human->Draw(e); +} + +static void CapeModel_DrawArm(struct Entity* e) { + Model_SetupState(Models.Human, e); + Models.Human->DrawArm(e); +} + +static struct ModelVertex vertices[MODEL_BOX_VERTICES]; +static void Cape_MakeModel(struct Model* model) { + // copy everything from human model + *model = *Models.Human; + + model->Name = "cape"; + model->defaultTex = &cape_tex; + model->vertices = vertices; + model->MakeParts = CapeModel_MakeParts; + model->Draw = CapeModel_Draw; + model->DrawArm = CapeModel_DrawArm; +} + +static struct Model model; +struct Model* CapeModel_GetInstance(void) { + Cape_MakeModel(&model); + return &model; +} + +static struct Model model_2011; +struct Model* Cape2011Model_GetInstance(void) { + Cape_MakeModel(&model_2011); + model_2011.Name = "cape_2011"; + model_2011.defaultTex = &cape2011_tex; + return &model_2011; +} + +static struct Model model_2012; +struct Model* Cape2012Model_GetInstance(void) { + Cape_MakeModel(&model_2012); + model_2012.Name = "cape_2012"; + model_2012.defaultTex = &cape2012_tex; + return &model_2012; +} + +static struct Model model_2013; +struct Model* Cape2013Model_GetInstance(void) { + Cape_MakeModel(&model_2013); + model_2013.Name = "cape_2013"; + model_2013.defaultTex = &cape2013_tex; + return &model_2013; +} + +static struct Model model_2015; +struct Model* Cape2015Model_GetInstance(void) { + Cape_MakeModel(&model_2015); + model_2015.Name = "cape_2015"; + model_2015.defaultTex = &cape2015_tex; + return &model_2015; +} + +static struct Model model_2016; +struct Model* Cape2016Model_GetInstance(void) { + Cape_MakeModel(&model_2016); + model_2016.Name = "cape_2016"; + model_2016.defaultTex = &cape2016_tex; + return &model_2016; +} diff --git a/src/ChibiSitModel.c b/src/Humans/ChibiSitModel.c similarity index 90% rename from src/ChibiSitModel.c rename to src/Humans/ChibiSitModel.c index 972c13e..fabd04f 100644 --- a/src/ChibiSitModel.c +++ b/src/Humans/ChibiSitModel.c @@ -1,42 +1,40 @@ -#include "Common.h" -static struct Model* chibi; -#define SIT_OFFSET (5/16.0f) - -//static void ChibiSitModel_MakeParts(void) { } - -static void ChibiSitModel_Draw(struct Entity* e) { - e->Anim.LeftLegX = 1.5f; e->Anim.RightLegX = 1.5f; - e->Anim.LeftLegZ = -0.1f; e->Anim.RightLegZ = 0.1f; - Model_SetupState(chibi, e); - chibi->Draw(e); -} -static void ChibiSitModel_GetTransform(struct Entity* e, Vector3 pos, struct Matrix* m) { - pos.Y -= SIT_OFFSET * e->ModelScale.Y; - Entity_GetTransform(e, pos, e->ModelScale, m); -} -static float ChibiSitModel_GetEyeY(struct Entity* e) { return chibi->GetEyeY(e) - SIT_OFFSET; } - -static void ChibiSitModel_GetSize(struct Entity* e) { - chibi->GetCollisionSize(e); e->Size.Y -= SIT_OFFSET; -} -static void ChibiSitModel_GetBounds(struct Entity* e) { - chibi->GetPickingBounds(e); e->ModelAABB.Max.Y -= SIT_OFFSET; -} - -static struct Model model; -struct Model* ChibiSitModel_GetInstance(void) { - // copy everything from chibi model - chibi = Model_Get(&(String)String_FromConst("chibi")); - model = *chibi; - - model.Name = "chibisit"; - //model.MakeParts = ChibiSitModel_MakeParts; - model.Draw = ChibiSitModel_Draw; - model.GetTransform = ChibiSitModel_GetTransform; - // TODO: check chibi sit draw arms - - model.GetEyeY = ChibiSitModel_GetEyeY; - model.GetCollisionSize = ChibiSitModel_GetSize; - model.GetPickingBounds = ChibiSitModel_GetBounds; - return &model; +#include "Common.h" +static struct Model* chibi; +#define SIT_OFFSET (5/16.0f) + +static void ChibiSitModel_Draw(struct Entity* e) { + e->Anim.LeftLegX = 1.5f; e->Anim.RightLegX = 1.5f; + e->Anim.LeftLegZ = -0.1f; e->Anim.RightLegZ = 0.1f; + Model_SetupState(chibi, e); + chibi->Draw(e); +} +static void ChibiSitModel_GetTransform(struct Entity* e, Vector3 pos, struct Matrix* m) { + pos.Y -= SIT_OFFSET * e->ModelScale.Y; + Entity_GetTransform(e, pos, e->ModelScale, m); +} +static float ChibiSitModel_GetEyeY(struct Entity* e) { return chibi->GetEyeY(e) - SIT_OFFSET; } + +static void ChibiSitModel_GetSize(struct Entity* e) { + chibi->GetCollisionSize(e); e->Size.Y -= SIT_OFFSET; +} +static void ChibiSitModel_GetBounds(struct Entity* e) { + chibi->GetPickingBounds(e); e->ModelAABB.Max.Y -= SIT_OFFSET; +} + +static struct Model model; +struct Model* ChibiSitModel_GetInstance(void) { + // copy everything from chibi model + chibi = Model_Get(&(String)String_FromConst("chibi")); + model = *chibi; + + model.Name = "chibisit"; + model.MakeParts = nullfunc; + model.Draw = ChibiSitModel_Draw; + model.GetTransform = ChibiSitModel_GetTransform; + // TODO: check chibi sit draw arms + + model.GetEyeY = ChibiSitModel_GetEyeY; + model.GetCollisionSize = ChibiSitModel_GetSize; + model.GetPickingBounds = ChibiSitModel_GetBounds; + return &model; } \ No newline at end of file diff --git a/src/TModel.c b/src/Humans/TModel.c similarity index 95% rename from src/TModel.c rename to src/Humans/TModel.c index 14e893b..682ef13 100644 --- a/src/TModel.c +++ b/src/Humans/TModel.c @@ -1,22 +1,23 @@ -#include "Common.h" -static void TModel_Draw(struct Entity* e) { - // No animation for arms/legs - e->Anim.LeftArmX = 0; e->Anim.RightArmX = 0; - e->Anim.LeftArmZ = -MATH_PI / 2; e->Anim.RightArmZ = MATH_PI / 2; - - e->Anim.LeftLegX = 0; e->Anim.RightLegX = 0; - e->Anim.LeftLegZ = 0; e->Anim.RightLegZ = 0; - - Models.Human->Draw(e); -} - -static struct Model model; -struct Model* TModel_GetInstance(void) { - // copy everything from human model - model = *Models.Human; - - model.Name = "t"; - model.Draw = TModel_Draw; - model.Bobbing = false; - return &model; +#include "Common.h" +static void TModel_Draw(struct Entity* e) { + // No animation for arms/legs + e->Anim.LeftArmX = 0; e->Anim.RightArmX = 0; + e->Anim.LeftArmZ = -MATH_PI / 2; e->Anim.RightArmZ = MATH_PI / 2; + + e->Anim.LeftLegX = 0; e->Anim.RightLegX = 0; + e->Anim.LeftLegZ = 0; e->Anim.RightLegZ = 0; + + Models.Human->Draw(e); +} + +static struct Model model; +struct Model* TModel_GetInstance(void) { + // copy everything from human model + model = *Models.Human; + + model.Name = "t"; + model.MakeParts = nullfunc; + model.Draw = TModel_Draw; + model.Bobbing = false; + return &model; } \ No newline at end of file diff --git a/src/CaveSpiderModel.c b/src/Mobs/CaveSpiderModel.c similarity index 97% rename from src/CaveSpiderModel.c rename to src/Mobs/CaveSpiderModel.c index 2ea8966..38a014e 100644 --- a/src/CaveSpiderModel.c +++ b/src/Mobs/CaveSpiderModel.c @@ -1,99 +1,99 @@ -#include "Common.h" -static struct Model* spider; -/* -static struct ModelPart head, link, end, leftLeg, rightLeg; - -static void CaveSpiderModel_MakeParts(void) { - BoxDesc_BuildBox(&head, &(struct BoxDesc) { - BoxDesc_Tex(32, 4), - BoxDesc_Box(-4,4,-11, 4,12,-3), - BoxDesc_Rot(0, 8, -3), - }); - - BoxDesc_BuildBox(&link, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-3,5,3, 3,11,-3) - }); - - BoxDesc_BuildBox(&end, &(struct BoxDesc) { - BoxDesc_Tex(0, 12), - BoxDesc_Box(-5,4,3, 5,12,15) - }); - - BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { - BoxDesc_Tex(18, 0), - BoxDesc_Box(-19,7,-1, -3,9,1), - BoxDesc_Rot(-3, 8, 0) - }); - - BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { - BoxDesc_Tex(18, 0), - BoxDesc_Box(3,7,-1, 19,9,1), - BoxDesc_Rot(3, 8, 0) - }); -} - -#define quarterPi (MATH_PI / 4.0f) -#define eighthPi (MATH_PI / 8.0f) - -static void CaveSpiderModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); - Model_DrawPart(&link); - Model_DrawPart(&end); - - float rotX = (float)Math_Sin(e->Anim.WalkTime) * e->Anim.Swing * MATH_PI; - float rotZ = (float)Math_Cos(e->Anim.WalkTime * 2) * e->Anim.Swing * MATH_PI / 16.0f; - float rotY = (float)Math_Sin(e->Anim.WalkTime * 2) * e->Anim.Swing * MATH_PI / 32.0f; - - Models.Rotation = ROTATE_ORDER_XZY; - - Model_DrawRotate(rotX, quarterPi + rotY, eighthPi + rotZ, &leftLeg, false); - Model_DrawRotate(-rotX, eighthPi + rotY, eighthPi + rotZ, &leftLeg, false); - Model_DrawRotate(rotX, -eighthPi - rotY, eighthPi - rotZ, &leftLeg, false); - Model_DrawRotate(-rotX, -quarterPi - rotY, eighthPi - rotZ, &leftLeg, false); - Model_DrawRotate(rotX, -quarterPi + rotY, -eighthPi + rotZ, &rightLeg, false); - Model_DrawRotate(-rotX, -eighthPi + rotY, -eighthPi + rotZ, &rightLeg, false); - Model_DrawRotate(rotX, eighthPi - rotY, -eighthPi - rotZ, &rightLeg, false); - Model_DrawRotate(-rotX, quarterPi - rotY, -eighthPi - rotZ, &rightLeg, false); - - Models.Rotation = ROTATE_ORDER_ZYX; - Model_UpdateVB(); -} - -static float CaveSpiderModel_GetNameY(struct Entity* e) { e; return 1.0125f; } -static float CaveSpiderModel_GetEyeY(struct Entity* e) { e; return 0.5000f; } -static void CaveSpiderModel_GetSize(struct Entity* e) { _SetSize(15,12,15); } -static void CaveSpiderModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,-11, 5,12,15); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 7];*/ -static void CaveSpiderModel_GetTransform(struct Entity* e, Vector3 pos, struct Matrix* m) { - static Vector3 vec; vec = e->ModelScale; - Vector3_Mul1(&vec, &vec, 0.75f); - Entity_GetTransform(e, pos, vec, m); -} -static float CaveSpiderModel_GetEyeY(struct Entity* e) { return spider->GetEyeY(e) * 0.75f; } - -static void CaveSpiderModel_GetSize(struct Entity* e) { - spider->GetCollisionSize(e); Vector3_Mul1(&e->Size, &e->Size, 0.75f); -} -static void CaveSpiderModel_GetBounds(struct Entity* e) { - spider->GetPickingBounds(e); - e->ModelAABB.Min.X *= 0.875f; e->ModelAABB.Min.Z *= 0.875f; - e->ModelAABB.Max.X *= 0.875f; e->ModelAABB.Max.Z *= 0.775f; - e->ModelAABB.Max.Y *= 0.75f; -} -static struct Model model; /*= { - */ -struct Model* CaveSpiderModel_GetInstance(void) { - /* Copy from spider model. */ - model = *(spider = Model_Get(&(String)String_FromConst("spider"))); - model.Name = "cavespider"; - model.defaultTex = &caveSpider_tex; - model.GetTransform = CaveSpiderModel_GetTransform; - model.GetEyeY = CaveSpiderModel_GetEyeY; - model.GetCollisionSize = CaveSpiderModel_GetSize; - model.GetPickingBounds = CaveSpiderModel_GetBounds; - return &model; +#include "Common.h" +static struct Model* spider; +/* +static struct ModelPart head, link, end, leftLeg, rightLeg; + +static void CaveSpiderModel_MakeParts(void) { + BoxDesc_BuildBox(&head, &(struct BoxDesc) { + BoxDesc_Tex(32, 4), + BoxDesc_Box(-4,4,-11, 4,12,-3), + BoxDesc_Rot(0, 8, -3), + }); + + BoxDesc_BuildBox(&link, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-3,5,3, 3,11,-3) + }); + + BoxDesc_BuildBox(&end, &(struct BoxDesc) { + BoxDesc_Tex(0, 12), + BoxDesc_Box(-5,4,3, 5,12,15) + }); + + BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { + BoxDesc_Tex(18, 0), + BoxDesc_Box(-19,7,-1, -3,9,1), + BoxDesc_Rot(-3, 8, 0) + }); + + BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { + BoxDesc_Tex(18, 0), + BoxDesc_Box(3,7,-1, 19,9,1), + BoxDesc_Rot(3, 8, 0) + }); +} + +#define quarterPi (MATH_PI / 4.0f) +#define eighthPi (MATH_PI / 8.0f) + +static void CaveSpiderModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); + Model_DrawPart(&link); + Model_DrawPart(&end); + + float rotX = (float)Math_Sin(e->Anim.WalkTime) * e->Anim.Swing * MATH_PI; + float rotZ = (float)Math_Cos(e->Anim.WalkTime * 2) * e->Anim.Swing * MATH_PI / 16.0f; + float rotY = (float)Math_Sin(e->Anim.WalkTime * 2) * e->Anim.Swing * MATH_PI / 32.0f; + + Models.Rotation = ROTATE_ORDER_XZY; + + Model_DrawRotate(rotX, quarterPi + rotY, eighthPi + rotZ, &leftLeg, false); + Model_DrawRotate(-rotX, eighthPi + rotY, eighthPi + rotZ, &leftLeg, false); + Model_DrawRotate(rotX, -eighthPi - rotY, eighthPi - rotZ, &leftLeg, false); + Model_DrawRotate(-rotX, -quarterPi - rotY, eighthPi - rotZ, &leftLeg, false); + Model_DrawRotate(rotX, -quarterPi + rotY, -eighthPi + rotZ, &rightLeg, false); + Model_DrawRotate(-rotX, -eighthPi + rotY, -eighthPi + rotZ, &rightLeg, false); + Model_DrawRotate(rotX, eighthPi - rotY, -eighthPi - rotZ, &rightLeg, false); + Model_DrawRotate(-rotX, quarterPi - rotY, -eighthPi - rotZ, &rightLeg, false); + + Models.Rotation = ROTATE_ORDER_ZYX; + Model_UpdateVB(); +} + +static float CaveSpiderModel_GetNameY(struct Entity* e) { e; return 1.0125f; } +static float CaveSpiderModel_GetEyeY(struct Entity* e) { e; return 0.5000f; } +static void CaveSpiderModel_GetSize(struct Entity* e) { _SetSize(15,12,15); } +static void CaveSpiderModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,-11, 5,12,15); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 7];*/ +static void CaveSpiderModel_GetTransform(struct Entity* e, Vector3 pos, struct Matrix* m) { + static Vector3 vec; vec = e->ModelScale; + Vector3_Mul1(&vec, &vec, 0.75f); + Entity_GetTransform(e, pos, vec, m); +} +static float CaveSpiderModel_GetEyeY(struct Entity* e) { return spider->GetEyeY(e) * 0.75f; } + +static void CaveSpiderModel_GetSize(struct Entity* e) { + spider->GetCollisionSize(e); Vector3_Mul1(&e->Size, &e->Size, 0.75f); +} +static void CaveSpiderModel_GetBounds(struct Entity* e) { + spider->GetPickingBounds(e); + e->ModelAABB.Min.X *= 0.875f; e->ModelAABB.Min.Z *= 0.875f; + e->ModelAABB.Max.X *= 0.875f; e->ModelAABB.Max.Z *= 0.775f; + e->ModelAABB.Max.Y *= 0.75f; +} +static struct Model model; /*= { + */ +struct Model* CaveSpiderModel_GetInstance(void) { + /* Copy from spider model. */ + model = *(spider = Model_Get(&(String)String_FromConst("spider"))); + model.Name = "cavespider"; + model.defaultTex = &caveSpider_tex; + model.GetTransform = CaveSpiderModel_GetTransform; + model.GetEyeY = CaveSpiderModel_GetEyeY; + model.GetCollisionSize = CaveSpiderModel_GetSize; + model.GetPickingBounds = CaveSpiderModel_GetBounds; + return &model; } \ No newline at end of file diff --git a/src/CowModel.c b/src/Mobs/CowModel.c similarity index 96% rename from src/CowModel.c rename to src/Mobs/CowModel.c index 4f54c0c..dc95adb 100644 --- a/src/CowModel.c +++ b/src/Mobs/CowModel.c @@ -1,92 +1,92 @@ -#include "Common.h" -static struct ModelPart head, rightHorn, leftHorn, torso, udder, leftLegFront, rightLegFront, leftLegBack, rightLegBack; - -static void CowModel_MakeParts(void) { - BoxDesc_BuildBox(&head, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-4,16,-14,4,24,-8), - BoxDesc_Rot(0, 20, -6), - }); - - BoxDesc_BuildBox(&rightHorn, &(struct BoxDesc) { - BoxDesc_Tex(22, 0), - BoxDesc_Box(-5,22,-13, -4,25,-12), - BoxDesc_Rot(0, 20, -6), - }); - - BoxDesc_BuildBox(&leftHorn, &(struct BoxDesc) { - BoxDesc_Tex(22, 0), - BoxDesc_Box(4,22,-13, 5,25,-12), - BoxDesc_Rot(0, 20, -6), - }); - - BoxDesc_BuildBox(&leftLegFront, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(-2,0,-8, -6,12,-4), - BoxDesc_Rot(0, 12, -6), - }); - - BoxDesc_BuildBox(&rightLegFront, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(2,0,-8, 6,12,-4), - BoxDesc_Rot(0, 12, -6), - }); - - BoxDesc_BuildBox(&leftLegBack, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(-2,0,5, -6,12,9), - BoxDesc_Rot(0, 12, 7), - }); - - BoxDesc_BuildBox(&rightLegBack, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(2,0,5, 6,12,9), - BoxDesc_Rot(0, 12, 7), - }); - - BoxDesc_BuildRotatedBox(&torso, &(struct BoxDesc) { - BoxDesc_Tex(18, 4), - BoxDesc_Box(-6,12,-8, 6,22,10) - }); - - BoxDesc_BuildRotatedBox(&udder, &(struct BoxDesc) { - BoxDesc_Tex(52, 0), - BoxDesc_Box(-2,11,4, 2,12,10) - }); -} - -static void CowModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - - Model_DrawPart(&torso); - Model_DrawPart(&udder); - - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &leftHorn, true); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &rightHorn, true); - - Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &leftLegFront, false); - Model_DrawRotate(e->Anim.RightLegX, 0, 0, &rightLegFront, false); - Model_DrawRotate(e->Anim.RightLegX, 0, 0, &leftLegBack, false); - Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &rightLegBack, false); - - Model_UpdateVB(); -} - -static float CowModel_GetNameY(struct Entity* e) { return 24 / 16.0f; } -static float CowModel_GetEyeY(struct Entity* e) { return 20 / 16.0f; } -static void CowModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } -static void CowModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,-14, 5,16,9); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 9]; -static struct Model model = { - "cow", vertices, &cow_tex, - CowModel_MakeParts, CowModel_Draw, - CowModel_GetNameY, CowModel_GetEyeY, - CowModel_GetSize, CowModel_GetBounds -}; - -struct Model* CowModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart head, rightHorn, leftHorn, torso, udder, leftLegFront, rightLegFront, leftLegBack, rightLegBack; + +static void CowModel_MakeParts(void) { + BoxDesc_BuildBox(&head, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-4,16,-14,4,24,-8), + BoxDesc_Rot(0, 20, -6), + }); + + BoxDesc_BuildBox(&rightHorn, &(struct BoxDesc) { + BoxDesc_Tex(22, 0), + BoxDesc_Box(-5,22,-13, -4,25,-12), + BoxDesc_Rot(0, 20, -6), + }); + + BoxDesc_BuildBox(&leftHorn, &(struct BoxDesc) { + BoxDesc_Tex(22, 0), + BoxDesc_Box(4,22,-13, 5,25,-12), + BoxDesc_Rot(0, 20, -6), + }); + + BoxDesc_BuildBox(&leftLegFront, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(-2,0,-8, -6,12,-4), + BoxDesc_Rot(0, 12, -6), + }); + + BoxDesc_BuildBox(&rightLegFront, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(2,0,-8, 6,12,-4), + BoxDesc_Rot(0, 12, -6), + }); + + BoxDesc_BuildBox(&leftLegBack, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(-2,0,5, -6,12,9), + BoxDesc_Rot(0, 12, 7), + }); + + BoxDesc_BuildBox(&rightLegBack, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(2,0,5, 6,12,9), + BoxDesc_Rot(0, 12, 7), + }); + + BoxDesc_BuildRotatedBox(&torso, &(struct BoxDesc) { + BoxDesc_Tex(18, 4), + BoxDesc_Box(-6,12,-8, 6,22,10) + }); + + BoxDesc_BuildRotatedBox(&udder, &(struct BoxDesc) { + BoxDesc_Tex(52, 0), + BoxDesc_Box(-2,11,4, 2,12,10) + }); +} + +static void CowModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + + Model_DrawPart(&torso); + Model_DrawPart(&udder); + + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &leftHorn, true); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &rightHorn, true); + + Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &leftLegFront, false); + Model_DrawRotate(e->Anim.RightLegX, 0, 0, &rightLegFront, false); + Model_DrawRotate(e->Anim.RightLegX, 0, 0, &leftLegBack, false); + Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &rightLegBack, false); + + Model_UpdateVB(); +} + +static float CowModel_GetNameY(struct Entity* e) { return 24 / 16.0f; } +static float CowModel_GetEyeY(struct Entity* e) { return 20 / 16.0f; } +static void CowModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } +static void CowModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,-14, 5,16,9); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 9]; +static struct Model model = { + "cow", vertices, &cow_tex, + CowModel_MakeParts, CowModel_Draw, + CowModel_GetNameY, CowModel_GetEyeY, + CowModel_GetSize, CowModel_GetBounds +}; + +struct Model* CowModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/EndermanModel.c b/src/Mobs/EndermanModel.c similarity index 100% rename from src/EndermanModel.c rename to src/Mobs/EndermanModel.c diff --git a/src/MagmaCubeModel.c b/src/Mobs/MagmaCubeModel.c similarity index 96% rename from src/MagmaCubeModel.c rename to src/Mobs/MagmaCubeModel.c index ce94bb8..f347dff 100644 --- a/src/MagmaCubeModel.c +++ b/src/Mobs/MagmaCubeModel.c @@ -1,34 +1,34 @@ -#include "Common.h" -/* TEXTURE NEEDS FIX, OTHERWISE BAD LIGHTING. */ -static struct ModelPart cube; - -static void MagmaCubeModel_MakeParts(void) { - BoxDesc_BuildBox(&cube, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(4,0,-4, -4,8,4) - }); -} - -static void MagmaCubeModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - Model_DrawPart(&cube); - Model_UpdateVB(); -} - -static float MagmaCubeModel_GetNameY(struct Entity* e) { return 8 / 16.0f; } -static float MagmaCubeModel_GetEyeY(struct Entity* e) { return 6 / 16.0f; } -static void MagmaCubeModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } -static void MagmaCubeModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES]; -static struct Model model = { - "magmacube", vertices, &magmaCube_tex, - MagmaCubeModel_MakeParts, MagmaCubeModel_Draw, - MagmaCubeModel_GetNameY, MagmaCubeModel_GetEyeY, - MagmaCubeModel_GetSize, MagmaCubeModel_GetBounds -}; - -struct Model* MagmaCubeModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +/* TEXTURE NEEDS FIX, OTHERWISE BAD LIGHTING. */ +static struct ModelPart cube; + +static void MagmaCubeModel_MakeParts(void) { + BoxDesc_BuildBox(&cube, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(4,0,-4, -4,8,4) + }); +} + +static void MagmaCubeModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + Model_DrawPart(&cube); + Model_UpdateVB(); +} + +static float MagmaCubeModel_GetNameY(struct Entity* e) { return 8 / 16.0f; } +static float MagmaCubeModel_GetEyeY(struct Entity* e) { return 6 / 16.0f; } +static void MagmaCubeModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } +static void MagmaCubeModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES]; +static struct Model model = { + "magmacube", vertices, &magmaCube_tex, + MagmaCubeModel_MakeParts, MagmaCubeModel_Draw, + MagmaCubeModel_GetNameY, MagmaCubeModel_GetEyeY, + MagmaCubeModel_GetSize, MagmaCubeModel_GetBounds +}; + +struct Model* MagmaCubeModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/Skeletons.c b/src/Mobs/Skeletons.c similarity index 96% rename from src/Skeletons.c rename to src/Mobs/Skeletons.c index 42fa306..67890ef 100644 --- a/src/Skeletons.c +++ b/src/Mobs/Skeletons.c @@ -9,6 +9,7 @@ struct Model* StrayModel_GetInstance(void) { // First skeleton-based model initialized gets to set skeleton ptr. stray = *(skeleton = Model_Get(&(String)String_FromConst("skeleton"))); stray.Name = "stray"; + stray.MakeParts = nullfunc; stray.defaultTex = &stray_tex; return &stray; } @@ -36,6 +37,7 @@ struct Model* WitherSkeletonModel_GetInstance(void) { witherskel = *Model_Get(&(String)String_FromConst("skeleton")); witherskel.Name = "witherskeleton"; witherskel.defaultTex = &witherSkeleton_tex; + witherskel.MakeParts = nullfunc; witherskel.GetTransform = WitherSkeletonModel_GetTransform; witherskel.GetCollisionSize = WitherSkeletonModel_GetSize; witherskel.GetEyeY = WitherSkeletonModel_GetEyeY; diff --git a/src/SlimeModel.c b/src/Mobs/SlimeModel.c similarity index 96% rename from src/SlimeModel.c rename to src/Mobs/SlimeModel.c index cc85e6c..5354fe0 100644 --- a/src/SlimeModel.c +++ b/src/Mobs/SlimeModel.c @@ -1,45 +1,45 @@ -#include "Common.h" -/* TEXTURE NEEDS FIX, OTHERWISE BAD LIGHTING. */ -static struct ModelPart headInner, headOuter; - -static void SlimeModel_MakeParts(void) { - BoxDesc_BuildBox(&headInner, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(-3,1,-3, 3,7,3) - }); - - BoxDesc_BuildBox(&headOuter, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(4,0,-4, -4,8,4) - }); -} - -static void SlimeModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - /* This currently causes anything behind slime to be culled (except entities). */ - Gfx_SetAlphaBlending(true); - - Model_DrawPart(&headInner); - Model_DrawRotate(0, MATH_PI, 0, &headOuter, false); - - Model_UpdateVB(); - Gfx_SetAlphaBlending(false); -} - -static float SlimeModel_GetNameY(struct Entity* e) { return 8 / 16.0f; } -static float SlimeModel_GetEyeY(struct Entity* e) { return 6 / 16.0f; } -static void SlimeModel_GetSize(struct Entity* e) { _SetSize(14, 14, 14); } -static void SlimeModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 2]; -static struct Model model = { - "slime", vertices, &slime_tex, - SlimeModel_MakeParts, SlimeModel_Draw, - SlimeModel_GetNameY, SlimeModel_GetEyeY, - SlimeModel_GetSize, SlimeModel_GetBounds -}; - -struct Model* SlimeModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +/* TEXTURE NEEDS FIX, OTHERWISE BAD LIGHTING. */ +static struct ModelPart headInner, headOuter; + +static void SlimeModel_MakeParts(void) { + BoxDesc_BuildBox(&headInner, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(-3,1,-3, 3,7,3) + }); + + BoxDesc_BuildBox(&headOuter, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(4,0,-4, -4,8,4) + }); +} + +static void SlimeModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + /* This currently causes anything behind slime to be culled (except entities). */ + Gfx_SetAlphaBlending(true); + + Model_DrawPart(&headInner); + Model_DrawRotate(0, MATH_PI, 0, &headOuter, false); + + Model_UpdateVB(); + Gfx_SetAlphaBlending(false); +} + +static float SlimeModel_GetNameY(struct Entity* e) { return 8 / 16.0f; } +static float SlimeModel_GetEyeY(struct Entity* e) { return 6 / 16.0f; } +static void SlimeModel_GetSize(struct Entity* e) { _SetSize(14, 14, 14); } +static void SlimeModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 2]; +static struct Model model = { + "slime", vertices, &slime_tex, + SlimeModel_MakeParts, SlimeModel_Draw, + SlimeModel_GetNameY, SlimeModel_GetEyeY, + SlimeModel_GetSize, SlimeModel_GetBounds +}; + +struct Model* SlimeModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/VillagerModel.c b/src/Mobs/VillagerModel.c similarity index 96% rename from src/VillagerModel.c rename to src/Mobs/VillagerModel.c index 58f7a3c..995dc1b 100644 --- a/src/VillagerModel.c +++ b/src/Mobs/VillagerModel.c @@ -1,81 +1,81 @@ -#include "Common.h" -static struct ModelPart head, nose, torso, robe, leftLeg, rightLeg, arms; - -static void VillagerModel_MakeParts(void) { - BoxDesc_BuildBox(&head, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-4,24,-4, 4,34,4), - BoxDesc_Rot(0, 24, 0), - }); - - BoxDesc_BuildBox(&nose, &(struct BoxDesc) { - BoxDesc_Tex(24, 0), - BoxDesc_Box(1,27,-3.5, -1,23,-5.5), - BoxDesc_Rot(0, 24, 0), - }); - - BoxDesc_BuildBox(&torso, &(struct BoxDesc) { - BoxDesc_Tex(16, 20), - BoxDesc_Box(-4,12,-2, 4,24,2) - }); - - BoxDesc_BuildBox(&robe, &(struct BoxDesc) { - BoxDesc_Tex(0, 38), - BoxDesc_Dims(-4,4,3, 4,24,-3), - BoxDesc_Bounds(-4.5f,3.5f,2.5f, 4.5f,24.5f,-2.5f) - }); - - BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { - BoxDesc_Tex(0, 22), - BoxDesc_Box(0,0,-2, -4,12,2), - BoxDesc_Rot(0, 12, 0) - }); - - BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { - BoxDesc_Tex(0, 22), - BoxDesc_Box(0,0,-2, 4,12,2), - BoxDesc_Rot(0, 12, 0) - }); - - BoxDesc_BuildBox(&arms, &(struct BoxDesc) { - BoxDesc_Tex(28, 51), - BoxDesc_Box(-8,15,-3, 8,23,2), - BoxDesc_Rot(0, 21, -1) - }); -} - -static void VillagerModel_Draw(struct Entity* e) { - // Remove arm animation - e->Anim.LeftArmX = 0; e->Anim.RightArmX = 0; - e->Anim.LeftArmZ = 0; e->Anim.RightArmZ = 0; - Model_ApplyTexture(e); - - Model_DrawPart(&torso); - Model_DrawPart(&robe); - - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &nose, true); - Model_DrawRotate(e->Anim.LeftLegX / 2, 0, 0, &leftLeg, false); - Model_DrawRotate(e->Anim.RightLegX / 2, 0, 0, &rightLeg, false); - Model_DrawRotate(45 * MATH_DEG2RAD, 0, e->Anim.LeftArmZ, &arms, false); - - Model_UpdateVB(); -} - -static float VillagerModel_GetNameY(struct Entity* e) { return 34 / 16.0f; } -static float VillagerModel_GetEyeY(struct Entity* e) { return 26 / 16.0f; } -static void VillagerModel_GetSize(struct Entity* e) { _SetSize(8.6f,28.1f,8.6f); } -static void VillagerModel_GetBounds(struct Entity* e) { _SetBounds(-4,0,-4, 4,32,4); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 7]; -static struct Model model = { - "villager", vertices, &villager_tex, - VillagerModel_MakeParts, VillagerModel_Draw, - VillagerModel_GetNameY, VillagerModel_GetEyeY, - VillagerModel_GetSize, VillagerModel_GetBounds -}; - -struct Model* VillagerModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart head, nose, torso, robe, leftLeg, rightLeg, arms; + +static void VillagerModel_MakeParts(void) { + BoxDesc_BuildBox(&head, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-4,24,-4, 4,34,4), + BoxDesc_Rot(0, 24, 0), + }); + + BoxDesc_BuildBox(&nose, &(struct BoxDesc) { + BoxDesc_Tex(24, 0), + BoxDesc_Box(1,27,-3.5, -1,23,-5.5), + BoxDesc_Rot(0, 24, 0), + }); + + BoxDesc_BuildBox(&torso, &(struct BoxDesc) { + BoxDesc_Tex(16, 20), + BoxDesc_Box(-4,12,-2, 4,24,2) + }); + + BoxDesc_BuildBox(&robe, &(struct BoxDesc) { + BoxDesc_Tex(0, 38), + BoxDesc_Dims(-4,4,3, 4,24,-3), + BoxDesc_Bounds(-4.5f,3.5f,2.5f, 4.5f,24.5f,-2.5f) + }); + + BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { + BoxDesc_Tex(0, 22), + BoxDesc_Box(0,0,-2, -4,12,2), + BoxDesc_Rot(0, 12, 0) + }); + + BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { + BoxDesc_Tex(0, 22), + BoxDesc_Box(0,0,-2, 4,12,2), + BoxDesc_Rot(0, 12, 0) + }); + + BoxDesc_BuildBox(&arms, &(struct BoxDesc) { + BoxDesc_Tex(28, 51), + BoxDesc_Box(-8,15,-3, 8,23,2), + BoxDesc_Rot(0, 21, -1) + }); +} + +static void VillagerModel_Draw(struct Entity* e) { + // Remove arm animation + e->Anim.LeftArmX = 0; e->Anim.RightArmX = 0; + e->Anim.LeftArmZ = 0; e->Anim.RightArmZ = 0; + Model_ApplyTexture(e); + + Model_DrawPart(&torso); + Model_DrawPart(&robe); + + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &nose, true); + Model_DrawRotate(e->Anim.LeftLegX / 2, 0, 0, &leftLeg, false); + Model_DrawRotate(e->Anim.RightLegX / 2, 0, 0, &rightLeg, false); + Model_DrawRotate(45 * MATH_DEG2RAD, 0, e->Anim.LeftArmZ, &arms, false); + + Model_UpdateVB(); +} + +static float VillagerModel_GetNameY(struct Entity* e) { return 34 / 16.0f; } +static float VillagerModel_GetEyeY(struct Entity* e) { return 26 / 16.0f; } +static void VillagerModel_GetSize(struct Entity* e) { _SetSize(8.6f,28.1f,8.6f); } +static void VillagerModel_GetBounds(struct Entity* e) { _SetBounds(-4,0,-4, 4,32,4); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 7]; +static struct Model model = { + "villager", vertices, &villager_tex, + VillagerModel_MakeParts, VillagerModel_Draw, + VillagerModel_GetNameY, VillagerModel_GetEyeY, + VillagerModel_GetSize, VillagerModel_GetBounds +}; + +struct Model* VillagerModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/ZombieVillagerModel.c b/src/Mobs/ZombieVillagerModel.c similarity index 96% rename from src/ZombieVillagerModel.c rename to src/Mobs/ZombieVillagerModel.c index cf79ea5..89352b4 100644 --- a/src/ZombieVillagerModel.c +++ b/src/Mobs/ZombieVillagerModel.c @@ -1,85 +1,85 @@ -#include "Common.h" -static struct ModelPart head, nose, hat, torso, leftLeg, rightLeg, leftArm, rightArm; - -static void ZombieVillagerModel_MakeParts(void) { - BoxDesc_BuildBox(&head, &(struct BoxDesc) { - BoxDesc_Tex(0, 32), - BoxDesc_Box(-4,24,-4, 4,34,4), - BoxDesc_Rot(0, 24, 0), - }); - - BoxDesc_BuildBox(&nose, &(struct BoxDesc) { - BoxDesc_Tex(24, 32), - BoxDesc_Box(1,27,-3.5f, -1,23,-5.5f), - BoxDesc_Rot(0, 24, 0), - }); - - BoxDesc_BuildBox(&torso, &(struct BoxDesc) { - BoxDesc_Tex(16, 16), - BoxDesc_Box(-4,12,-2, 4,24,2) - }); - - BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(0,0,-2, -4,12,2), - BoxDesc_Rot(0, 12, 0) - }); - - BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { - BoxDesc_Tex(0, 16), - BoxDesc_Box(0,0,-2, 4,12,2), - BoxDesc_Rot(0, 12, 0) - }); - - BoxDesc_BuildBox(&leftArm, &(struct BoxDesc) { - BoxDesc_Tex(40, 16), - BoxDesc_Box(-4,12,-2, -8,24,2), - BoxDesc_Rot(-6, 22, 0) - }); - - BoxDesc_BuildBox(&rightArm, &(struct BoxDesc) { - BoxDesc_Tex(40, 16), - BoxDesc_Box(4,12,-2, 8,24,2), - BoxDesc_Rot(6, 22, 0) - }); - - BoxDesc_BuildBox(&hat, &(struct BoxDesc) { - BoxDesc_Tex(32, 0), - BoxDesc_Dims(-4,24,-4, 4,32,4), - BoxDesc_Bounds(-4.5f,23.5f,-4.5f, 4.5f,32.5f,4.5f), - BoxDesc_Rot(0, 24, 0) - }); -} - -static void ZombieVillagerModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - - Model_DrawPart(&torso); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &nose, true); - Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &leftLeg, false); - Model_DrawRotate(e->Anim.RightLegX, 0, 0, &rightLeg, false); - Model_DrawRotate(90 * MATH_DEG2RAD, 0, e->Anim.LeftArmZ, &leftArm, false); - Model_DrawRotate(90 * MATH_DEG2RAD, 0, e->Anim.RightArmZ, &rightArm, false); - Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &hat, true); - - Model_UpdateVB(); -} - -static float ZombieVillagerModel_GetNameY(struct Entity* e) { return 34 / 16.0f; } -static float ZombieVillagerModel_GetEyeY(struct Entity* e) { return 26 / 16.0f; } -static void ZombieVillagerModel_GetSize(struct Entity* e) { _SetSize(8.6f,28.1f,8.6f); } -static void ZombieVillagerModel_GetBounds(struct Entity* e) { _SetBounds(-4,0,-4, 4,32,4); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 8]; -static struct Model model = { - "zombievillager", vertices, &zombieVillager_tex, - ZombieVillagerModel_MakeParts, ZombieVillagerModel_Draw, - ZombieVillagerModel_GetNameY, ZombieVillagerModel_GetEyeY, - ZombieVillagerModel_GetSize, ZombieVillagerModel_GetBounds -}; - -struct Model* ZombieVillagerModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart head, nose, hat, torso, leftLeg, rightLeg, leftArm, rightArm; + +static void ZombieVillagerModel_MakeParts(void) { + BoxDesc_BuildBox(&head, &(struct BoxDesc) { + BoxDesc_Tex(0, 32), + BoxDesc_Box(-4,24,-4, 4,34,4), + BoxDesc_Rot(0, 24, 0), + }); + + BoxDesc_BuildBox(&nose, &(struct BoxDesc) { + BoxDesc_Tex(24, 32), + BoxDesc_Box(1,27,-3.5f, -1,23,-5.5f), + BoxDesc_Rot(0, 24, 0), + }); + + BoxDesc_BuildBox(&torso, &(struct BoxDesc) { + BoxDesc_Tex(16, 16), + BoxDesc_Box(-4,12,-2, 4,24,2) + }); + + BoxDesc_BuildBox(&leftLeg, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(0,0,-2, -4,12,2), + BoxDesc_Rot(0, 12, 0) + }); + + BoxDesc_BuildBox(&rightLeg, &(struct BoxDesc) { + BoxDesc_Tex(0, 16), + BoxDesc_Box(0,0,-2, 4,12,2), + BoxDesc_Rot(0, 12, 0) + }); + + BoxDesc_BuildBox(&leftArm, &(struct BoxDesc) { + BoxDesc_Tex(40, 16), + BoxDesc_Box(-4,12,-2, -8,24,2), + BoxDesc_Rot(-6, 22, 0) + }); + + BoxDesc_BuildBox(&rightArm, &(struct BoxDesc) { + BoxDesc_Tex(40, 16), + BoxDesc_Box(4,12,-2, 8,24,2), + BoxDesc_Rot(6, 22, 0) + }); + + BoxDesc_BuildBox(&hat, &(struct BoxDesc) { + BoxDesc_Tex(32, 0), + BoxDesc_Dims(-4,24,-4, 4,32,4), + BoxDesc_Bounds(-4.5f,23.5f,-4.5f, 4.5f,32.5f,4.5f), + BoxDesc_Rot(0, 24, 0) + }); +} + +static void ZombieVillagerModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + + Model_DrawPart(&torso); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &head, true); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &nose, true); + Model_DrawRotate(e->Anim.LeftLegX, 0, 0, &leftLeg, false); + Model_DrawRotate(e->Anim.RightLegX, 0, 0, &rightLeg, false); + Model_DrawRotate(90 * MATH_DEG2RAD, 0, e->Anim.LeftArmZ, &leftArm, false); + Model_DrawRotate(90 * MATH_DEG2RAD, 0, e->Anim.RightArmZ, &rightArm, false); + Model_DrawRotate(-e->HeadX * MATH_DEG2RAD, 0, 0, &hat, true); + + Model_UpdateVB(); +} + +static float ZombieVillagerModel_GetNameY(struct Entity* e) { return 34 / 16.0f; } +static float ZombieVillagerModel_GetEyeY(struct Entity* e) { return 26 / 16.0f; } +static void ZombieVillagerModel_GetSize(struct Entity* e) { _SetSize(8.6f,28.1f,8.6f); } +static void ZombieVillagerModel_GetBounds(struct Entity* e) { _SetBounds(-4,0,-4, 4,32,4); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 8]; +static struct Model model = { + "zombievillager", vertices, &zombieVillager_tex, + ZombieVillagerModel_MakeParts, ZombieVillagerModel_Draw, + ZombieVillagerModel_GetNameY, ZombieVillagerModel_GetEyeY, + ZombieVillagerModel_GetSize, ZombieVillagerModel_GetBounds +}; + +struct Model* ZombieVillagerModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/Zombies.c b/src/Mobs/Zombies.c similarity index 90% rename from src/Zombies.c rename to src/Mobs/Zombies.c index 53a4764..20c1e34 100644 --- a/src/Zombies.c +++ b/src/Mobs/Zombies.c @@ -8,6 +8,7 @@ struct Model* HuskModel_GetInstance(void) { husk = *Model_Get(&(String)String_FromConst("zombie")); husk.Name = "husk"; husk.defaultTex = &husk_tex; + husk.MakeParts = nullfunc; return &husk; } @@ -18,5 +19,6 @@ struct Model* ZombiePigmanModel_GetInstance(void) { zpigman = *Model_Get(&(String)String_FromConst("zombie")); zpigman.Name = "zombiepigman"; zpigman.defaultTex = &zombiePigman_tex; + zpigman.MakeParts = nullfunc; return &zpigman; } \ No newline at end of file diff --git a/src/MoreModels.c b/src/MoreModels.c index ea78ae2..64c6d91 100644 --- a/src/MoreModels.c +++ b/src/MoreModels.c @@ -1,7 +1,8 @@ #include "Common.h" /* - Add the rest of the models - Fix slime/magmacube textures + Add the rest of the models. + Double-check if slime and magmacube textures are oriented properly. + Slime and magmacube require more boxes. */ /* === MODELS LIST COMMAND === */ @@ -103,7 +104,7 @@ static void MoreModels_Init(void) { Models.MaxVertices = 32 * 32; Models.Vb = Gfx_CreateDynamicVb(VERTEX_FORMAT_P3FT2FC4B, Models.MaxVertices); - String_AppendConst(&Server.AppName, " + More Models v1.2.1"); + String_AppendConst(&Server.AppName, " + More Models v1.2.3"); Commands_Register(&ListModelsCommand); } @@ -126,7 +127,7 @@ PLUGIN_EXPORT struct IGameComponent Plugin_Component = { MoreModels_Init, /* Init */ NULL, /* Free */ NULL, /* Reset */ - MoreModels_OnNewMap, /* OnNewMap */ + //MoreModels_OnNewMap, /* OnNewMap */ }; /* === TEXTURES === */ @@ -156,10 +157,6 @@ struct ModelTex wood_tex = { "wood.png" }, zombiePigman_tex = { "zombie_pigman.png" }, zombieVillager_tex = { "zombie_villager.png" }; -/* Turned on no entry point -#ifdef _WIN32 -// by default, the 'DllMain' Visual Studio produces includes a bunch of CRT code -// therefore, in the project options I tell Visual Studio to use this DllMainRedirect instead -// with this change, the dll size in release mode is reduced from 89 to 24 kb -__declspec(noinline) int __stdcall DllMainRedirect(void* a, unsigned b, void* c) { a; b; c; return 1; } -#endif*/ + +/* Just your average general-purpose empty function. */ +void nullfunc(void) { } \ No newline at end of file diff --git a/src/MoreModels.vcxproj b/src/MoreModels.vcxproj index 21bf85b..f219215 100644 --- a/src/MoreModels.vcxproj +++ b/src/MoreModels.vcxproj @@ -88,12 +88,12 @@ Level4 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;MOREMODELS_EXPORTS;%(PreprocessorDefinitions) - C:\Users\Andrew\Documents\GitHub\ClassicalSharp\src;%(AdditionalIncludeDirectories) + $(SolutionDir) Windows true - C:\Users\Andrew\Documents\GitHub\ClassicalSharp\src\x64\Release\ClassiCube.lib;%(AdditionalDependencies) + kernel32.lib @@ -103,72 +103,80 @@ Level3 Disabled _DEBUG;_WINDOWS;_USRDLL;MOREMODELS_EXPORTS;%(PreprocessorDefinitions) + $(SolutionDir) Windows true + kernel32.lib - Level3 - - + Level4 + NotUsing MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;MOREMODELS_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded + NDEBUG;_WINDOWS;MOREMODELS_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + $(SolutionDir) + Speed + false Windows true true true - DllMainRedirect + + + kernel32.lib + true Level4 NotUsing - MinSpace + MaxSpeed true NDEBUG;_WINDOWS;MOREMODELS_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL - %(AdditionalIncludeDirectories) + $(SolutionDir) true false - Size + Speed false false + true Windows true true - C:\Users\Andrew\Documents\GitHub\ClassicalSharp\src\x64\Release\ClassiCube.lib + kernel32.lib true - - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + diff --git a/src/CarModel.c b/src/Props/CarModel.c similarity index 94% rename from src/CarModel.c rename to src/Props/CarModel.c index fb761d0..7b2725b 100644 --- a/src/CarModel.c +++ b/src/Props/CarModel.c @@ -1,135 +1,134 @@ -#include "Common.h" -static struct ModelPart top, body, tireFrontLeft, tireFrontRight, tireBackLeft, tireBackRight, frontLeft, frontRight; -static struct ModelPart backLeft, backRight, mirrorLeft, mirrorRight, spoilerLeft, spoilerRight, spoiler; - -static void CarModel_MakeParts(void) { - BoxDesc_BuildRotatedBox(&top, &(struct BoxDesc) { - BoxDesc_Tex(120, 0), - BoxDesc_Box(-20,20,-16, 20,36,20) - }); - - BoxDesc_BuildRotatedBox(&body, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-22,4,-40, 22,20,40) - }); - - BoxDesc_BuildRotatedBox(&spoiler, &(struct BoxDesc) { - BoxDesc_Tex(120, 52), - BoxDesc_Box(-19,27,33, 19,30,42) - }); - - BoxDesc_BuildBox(&tireFrontLeft, &(struct BoxDesc) { - BoxDesc_Tex(156, 64), - BoxDesc_Box(-20,0,-28, -24,10,-18), - BoxDesc_Rot(-22, 5, -23) - }); - - BoxDesc_BuildBox(&tireBackLeft, &(struct BoxDesc) { - BoxDesc_Tex(156, 64), - BoxDesc_Box(-20,0,18, -24,10,28), - BoxDesc_Rot(-22, 5, 23) - }); - - BoxDesc_BuildBox(&mirrorLeft, &(struct BoxDesc) { - BoxDesc_Tex(202, 52), - BoxDesc_Box(-20,20,-15, -27,25,-18), - BoxDesc_Rot(-20, 22, -15) - }); - - BoxDesc_BuildBox(&spoilerLeft, &(struct BoxDesc) { - BoxDesc_Tex(184, 64), - BoxDesc_Box(-12,20,31, -15,30,34), - BoxDesc_Rot(-12, 20, 31) - }); - - BoxDesc_BuildBox(&tireFrontRight, &(struct BoxDesc) { - BoxDesc_Tex(156, 64), - BoxDesc_Box(20,0,-28, 24,10,-18), - BoxDesc_Rot(22, 5, -23) - }); - - BoxDesc_BuildBox(&tireBackRight, &(struct BoxDesc) { - BoxDesc_Tex(156, 64), - BoxDesc_Box(20,0,18, 24,10,28), - BoxDesc_Rot(22, 5, 23) - }); - - BoxDesc_BuildBox(&mirrorRight, &(struct BoxDesc) { - BoxDesc_Tex(202, 52), - BoxDesc_Box(20,20,-15, 27,25,-18), - BoxDesc_Rot(20, 22, -15) - }); - - BoxDesc_BuildBox(&spoilerRight, &(struct BoxDesc) { - BoxDesc_Tex(184, 64), - BoxDesc_Box(12,20,31, 15,30,34), - BoxDesc_Rot(12, 20, 31) - }); - - BoxDesc_BuildBox(&frontLeft, &(struct BoxDesc) { - BoxDesc_Tex(120, 64), - BoxDesc_Box(-20,4,-31, -22,14,-15) - }); - - BoxDesc_BuildBox(&backLeft, &(struct BoxDesc) { - BoxDesc_Tex(120, 64), - BoxDesc_Box(-20,4,15, -22,14,31) - }); - - BoxDesc_BuildBox(&frontRight, &(struct BoxDesc) { - BoxDesc_Tex(120, 64), - BoxDesc_Box(20,4,-31, 22,14,-15) - }); - - BoxDesc_BuildBox(&backRight, &(struct BoxDesc) { - BoxDesc_Tex(120, 64), - BoxDesc_Box(20,4,15, 22,14,31) - }); -} - -static void CarModel_Draw(struct Entity* e) { - Model_ApplyTexture(e); - Models.uScale = 1/256.0f; - Models.vScale = 1/128.0f; - - Model_DrawPart(&top); - Model_DrawPart(&body); - Model_DrawPart(&frontLeft); - Model_DrawPart(&frontRight); - Model_DrawPart(&backLeft); - Model_DrawPart(&backRight); - Model_DrawPart(&spoiler); - - Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireFrontLeft, false); - Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireFrontRight, false); - Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireBackLeft, false); - Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireBackRight, false); - Model_DrawRotate(0, MATH_PI / 12, 0, &mirrorLeft, false); - Model_DrawRotate(0, -MATH_PI / 12, 0, &mirrorRight, false); - Model_DrawRotate(MATH_PI / 6, 0, 0, &spoilerLeft, false); - Model_DrawRotate(MATH_PI / 6, 0, 0, &spoilerRight, false); - - Model_UpdateVB(); -} - -static float CarModel_GetNameY(struct Entity* e) { e; return 2.375f; } -static float CarModel_GetEyeY(struct Entity* e) { e; return 1.750f; } -static void CarModel_GetSize(struct Entity* e) { _SetSize(76, 34, 76); } -static void CarModel_GetBounds(struct Entity* e) { _SetBounds(-22, 0, -40, 22, 36, 40); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 15]; -static struct Model model = { - "car", vertices, &car_tex, - CarModel_MakeParts, CarModel_Draw, - CarModel_GetNameY, CarModel_GetEyeY, - CarModel_GetSize, CarModel_GetBounds -}; - -struct Model* CarModel_GetInstance(void) { - Model_Init(&model); - model.Bobbing = false; - model.GroundFriction = (Vector3) { 0.9f, 0.9f, 0.9f }; - model.Drag = (Vector3) { 0.9f, 0.9f, 0.9f }; - model.ShadowScale = 2.0f; - return &model; +#include "Common.h" +static struct ModelPart top, body, tireFrontLeft, tireFrontRight, tireBackLeft, tireBackRight, frontLeft, frontRight; +static struct ModelPart backLeft, backRight, mirrorLeft, mirrorRight, spoilerLeft, spoilerRight, spoiler; + +static void CarModel_MakeParts(void) { + BoxDesc_BuildRotatedBox(&top, &(struct BoxDesc) { + BoxDesc_Tex(120, 0), + BoxDesc_Box(-20,20,-16, 20,36,20) + }); + + BoxDesc_BuildRotatedBox(&body, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-22,4,-40, 22,20,40) + }); + + BoxDesc_BuildRotatedBox(&spoiler, &(struct BoxDesc) { + BoxDesc_Tex(120, 52), + BoxDesc_Box(-19,27,33, 19,30,42) + }); + + BoxDesc_BuildBox(&tireFrontLeft, &(struct BoxDesc) { + BoxDesc_Tex(156, 64), + BoxDesc_Box(-20,0,-28, -24,10,-18), + BoxDesc_Rot(-22, 5, -23) + }); + + BoxDesc_BuildBox(&tireBackLeft, &(struct BoxDesc) { + BoxDesc_Tex(156, 64), + BoxDesc_Box(-20,0,18, -24,10,28), + BoxDesc_Rot(-22, 5, 23) + }); + + BoxDesc_BuildBox(&mirrorLeft, &(struct BoxDesc) { + BoxDesc_Tex(202, 52), + BoxDesc_Box(-20,20,-15, -27,25,-18), + BoxDesc_Rot(-20, 22, -15) + }); + + BoxDesc_BuildBox(&spoilerLeft, &(struct BoxDesc) { + BoxDesc_Tex(184, 64), + BoxDesc_Box(-12,20,31, -15,30,34), + BoxDesc_Rot(-12, 20, 31) + }); + + BoxDesc_BuildBox(&tireFrontRight, &(struct BoxDesc) { + BoxDesc_Tex(156, 64), + BoxDesc_Box(20,0,-28, 24,10,-18), + BoxDesc_Rot(22, 5, -23) + }); + + BoxDesc_BuildBox(&tireBackRight, &(struct BoxDesc) { + BoxDesc_Tex(156, 64), + BoxDesc_Box(20,0,18, 24,10,28), + BoxDesc_Rot(22, 5, 23) + }); + + BoxDesc_BuildBox(&mirrorRight, &(struct BoxDesc) { + BoxDesc_Tex(202, 52), + BoxDesc_Box(20,20,-15, 27,25,-18), + BoxDesc_Rot(20, 22, -15) + }); + + BoxDesc_BuildBox(&spoilerRight, &(struct BoxDesc) { + BoxDesc_Tex(184, 64), + BoxDesc_Box(12,20,31, 15,30,34), + BoxDesc_Rot(12, 20, 31) + }); + + BoxDesc_BuildBox(&frontLeft, &(struct BoxDesc) { + BoxDesc_Tex(120, 64), + BoxDesc_Box(-20,4,-31, -22,14,-15) + }); + + BoxDesc_BuildBox(&backLeft, &(struct BoxDesc) { + BoxDesc_Tex(120, 64), + BoxDesc_Box(-20,4,15, -22,14,31) + }); + + BoxDesc_BuildBox(&frontRight, &(struct BoxDesc) { + BoxDesc_Tex(120, 64), + BoxDesc_Box(20,4,-31, 22,14,-15) + }); + + BoxDesc_BuildBox(&backRight, &(struct BoxDesc) { + BoxDesc_Tex(120, 64), + BoxDesc_Box(20,4,15, 22,14,31) + }); +} + +static void CarModel_Draw(struct Entity* e) { + Model_ApplyTexture(e); + Models.uScale = 1/256.0f; + Models.vScale = 1/128.0f; + + Model_DrawPart(&top); + Model_DrawPart(&body); + Model_DrawPart(&frontLeft); + Model_DrawPart(&frontRight); + Model_DrawPart(&backLeft); + Model_DrawPart(&backRight); + Model_DrawPart(&spoiler); + + Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireFrontLeft, false); + Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireFrontRight, false); + Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireBackLeft, false); + Model_DrawRotate(-e->Anim.WalkTime, 0, 0, &tireBackRight, false); + Model_DrawRotate(0, MATH_PI / 12, 0, &mirrorLeft, false); + Model_DrawRotate(0, -MATH_PI / 12, 0, &mirrorRight, false); + Model_DrawRotate(MATH_PI / 6, 0, 0, &spoilerLeft, false); + Model_DrawRotate(MATH_PI / 6, 0, 0, &spoilerRight, false); + + Model_UpdateVB(); +} + +static float CarModel_GetNameY(struct Entity* e) { e; return 2.375f; } +static float CarModel_GetEyeY(struct Entity* e) { e; return 1.750f; } +static void CarModel_GetSize(struct Entity* e) { _SetSize(76, 34, 76); } +static void CarModel_GetBounds(struct Entity* e) { _SetBounds(-22, 0, -40, 22, 36, 40); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 15]; +static struct Model model = { + "car", vertices, &car_tex, + CarModel_MakeParts, CarModel_Draw, + CarModel_GetNameY, CarModel_GetEyeY, + CarModel_GetSize, CarModel_GetBounds +}; + +struct Model* CarModel_GetInstance(void) { + Model_Init(&model); + model.Bobbing = false; + model.GroundFriction = (Vector3) { 1.05f, 1.05f, 1.05f }; + model.ShadowScale = 2.0f; + return &model; } \ No newline at end of file diff --git a/src/ChairModel.c b/src/Props/ChairModel.c similarity index 97% rename from src/ChairModel.c rename to src/Props/ChairModel.c index 314f474..2cbd7a8 100644 --- a/src/ChairModel.c +++ b/src/Props/ChairModel.c @@ -1,51 +1,51 @@ -#include "Common.h" -static struct ModelPart base, back, leftLegFront, rightLegFront, leftLegBack, rightLegBack; - -static void ChairModel_MakeParts(void) { - // all the parts have a TexOrigin of 0,0 - struct BoxDesc box_base = { 0,0, BoxDesc_Box(-5.5f, 7,-5.5f, 5.5f, 9, 5.5f) }; - struct BoxDesc box_back = { 0,0, BoxDesc_Box( 5.5f, 9, 3.5f, -5.5f,22, 5.5f) }; - struct BoxDesc box_lFront = { 0,0, BoxDesc_Box(-3.5f, 0,-3.5f, -5.5f, 7,-5.5f) }; - struct BoxDesc box_rFront = { 0,0, BoxDesc_Box( 3.5f, 0,-3.5f, 5.5f, 7,-5.5f) }; - struct BoxDesc box_lBack = { 0,0, BoxDesc_Box(-3.5f, 0, 3.5f, -5.5f, 7, 5.5f) }; - struct BoxDesc box_rBack = { 0,0, BoxDesc_Box( 3.5f, 0, 3.5f, 5.5f, 7, 5.5f) }; - - BoxDesc_BuildBox(&base, &box_base); - BoxDesc_BuildBox(&back, &box_back); - BoxDesc_BuildBox(&leftLegFront, &box_lFront); - BoxDesc_BuildBox(&rightLegFront, &box_rFront); - BoxDesc_BuildBox(&leftLegBack, &box_lBack); - BoxDesc_BuildBox(&rightLegBack, &box_rBack); -} - -static void ChairModel_Draw(struct Entity* entity) { - Model_ApplyTexture(entity); - Models.uScale = 1/16.0f; Models.vScale = 1/16.0f; - - Model_DrawPart(&base); - Model_DrawPart(&back); - Model_DrawPart(&leftLegFront); - Model_DrawPart(&rightLegFront); - Model_DrawPart(&leftLegBack); - Model_DrawPart(&rightLegBack); - - Model_UpdateVB(); -} - -static float ChairModel_GetNameY(struct Entity* e) { return 1.5f; } -static float ChairModel_GetEyeY(struct Entity* e) { return 0.875f; } -static void ChairModel_GetSize(struct Entity* e) { _SetSize(9,20,9); } -static void ChairModel_GetBounds(struct Entity* e) { _SetBounds(-5.5f,0,-5.5f, 5.5f,22,5.5f); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 6]; -static struct Model model = { - "chair", vertices, &wood_tex, - ChairModel_MakeParts, ChairModel_Draw, - ChairModel_GetNameY, ChairModel_GetEyeY, - ChairModel_GetSize, ChairModel_GetBounds -}; - -struct Model* ChairModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart base, back, leftLegFront, rightLegFront, leftLegBack, rightLegBack; + +static void ChairModel_MakeParts(void) { + // all the parts have a TexOrigin of 0,0 + struct BoxDesc box_base = { 0,0, BoxDesc_Box(-5.5f, 7,-5.5f, 5.5f, 9, 5.5f) }; + struct BoxDesc box_back = { 0,0, BoxDesc_Box( 5.5f, 9, 3.5f, -5.5f,22, 5.5f) }; + struct BoxDesc box_lFront = { 0,0, BoxDesc_Box(-3.5f, 0,-3.5f, -5.5f, 7,-5.5f) }; + struct BoxDesc box_rFront = { 0,0, BoxDesc_Box( 3.5f, 0,-3.5f, 5.5f, 7,-5.5f) }; + struct BoxDesc box_lBack = { 0,0, BoxDesc_Box(-3.5f, 0, 3.5f, -5.5f, 7, 5.5f) }; + struct BoxDesc box_rBack = { 0,0, BoxDesc_Box( 3.5f, 0, 3.5f, 5.5f, 7, 5.5f) }; + + BoxDesc_BuildBox(&base, &box_base); + BoxDesc_BuildBox(&back, &box_back); + BoxDesc_BuildBox(&leftLegFront, &box_lFront); + BoxDesc_BuildBox(&rightLegFront, &box_rFront); + BoxDesc_BuildBox(&leftLegBack, &box_lBack); + BoxDesc_BuildBox(&rightLegBack, &box_rBack); +} + +static void ChairModel_Draw(struct Entity* entity) { + Model_ApplyTexture(entity); + Models.uScale = 1/16.0f; Models.vScale = 1/16.0f; + + Model_DrawPart(&base); + Model_DrawPart(&back); + Model_DrawPart(&leftLegFront); + Model_DrawPart(&rightLegFront); + Model_DrawPart(&leftLegBack); + Model_DrawPart(&rightLegBack); + + Model_UpdateVB(); +} + +static float ChairModel_GetNameY(struct Entity* e) { return 1.5f; } +static float ChairModel_GetEyeY(struct Entity* e) { return 0.875f; } +static void ChairModel_GetSize(struct Entity* e) { _SetSize(9,20,9); } +static void ChairModel_GetBounds(struct Entity* e) { _SetBounds(-5.5f,0,-5.5f, 5.5f,22,5.5f); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 6]; +static struct Model model = { + "chair", vertices, &wood_tex, + ChairModel_MakeParts, ChairModel_Draw, + ChairModel_GetNameY, ChairModel_GetEyeY, + ChairModel_GetSize, ChairModel_GetBounds +}; + +struct Model* ChairModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/TVModel.c b/src/Props/TVModel.c similarity index 96% rename from src/TVModel.c rename to src/Props/TVModel.c index 2a7c030..2b62fbb 100644 --- a/src/TVModel.c +++ b/src/Props/TVModel.c @@ -1,48 +1,48 @@ -#include "Common.h" -static struct ModelPart screen, stem, base; - -static void TVModel_MakeParts(void) { - BoxDesc_BuildBox(&screen, &(struct BoxDesc) { - BoxDesc_Tex(0, 0), - BoxDesc_Box(-24,10,-1, 24,35,1) - }); - - BoxDesc_BuildBox(&stem, &(struct BoxDesc) { - BoxDesc_Tex(7, 34), - BoxDesc_Box(-4,4,-1, 4,10,1) - }); - - BoxDesc_BuildBox(&base, &(struct BoxDesc) { - BoxDesc_Tex(30, 31), - BoxDesc_Box(-10,0,-3, 10,4,3) - }); -} - -static void TVModel_Draw(struct Entity* entity) { - Model_ApplyTexture(entity); - Models.uScale = 1/128.0f; Models.vScale = 1/128.0f; - - Model_DrawPart(&screen); - Model_DrawPart(&stem); - Model_DrawPart(&base); - - Model_UpdateVB(); -} - -static float TVModel_GetNameY(struct Entity* e) { return 2.25f; } -static float TVModel_GetEyeY(struct Entity* e) { return 1.50f; } -static void TVModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } -static void TVModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 5]; -static struct Model model = { - "tv", vertices, &tv_tex, - TVModel_MakeParts, TVModel_Draw, - TVModel_GetNameY, TVModel_GetEyeY, - TVModel_GetSize, TVModel_GetBounds -}; - -struct Model* TVModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart screen, stem, base; + +static void TVModel_MakeParts(void) { + BoxDesc_BuildBox(&screen, &(struct BoxDesc) { + BoxDesc_Tex(0, 0), + BoxDesc_Box(-24,10,-1, 24,35,1) + }); + + BoxDesc_BuildBox(&stem, &(struct BoxDesc) { + BoxDesc_Tex(7, 34), + BoxDesc_Box(-4,4,-1, 4,10,1) + }); + + BoxDesc_BuildBox(&base, &(struct BoxDesc) { + BoxDesc_Tex(30, 31), + BoxDesc_Box(-10,0,-3, 10,4,3) + }); +} + +static void TVModel_Draw(struct Entity* entity) { + Model_ApplyTexture(entity); + Models.uScale = 1/128.0f; Models.vScale = 1/128.0f; + + Model_DrawPart(&screen); + Model_DrawPart(&stem); + Model_DrawPart(&base); + + Model_UpdateVB(); +} + +static float TVModel_GetNameY(struct Entity* e) { return 2.25f; } +static float TVModel_GetEyeY(struct Entity* e) { return 1.50f; } +static void TVModel_GetSize(struct Entity* e) { _SetSize(14,14,14); } +static void TVModel_GetBounds(struct Entity* e) { _SetBounds(-5,0,14, 5,16,9); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 5]; +static struct Model model = { + "tv", vertices, &tv_tex, + TVModel_MakeParts, TVModel_Draw, + TVModel_GetNameY, TVModel_GetEyeY, + TVModel_GetSize, TVModel_GetBounds +}; + +struct Model* TVModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file diff --git a/src/TableModel.c b/src/Props/TableModel.c similarity index 97% rename from src/TableModel.c rename to src/Props/TableModel.c index 63330d5..fcb33f0 100644 --- a/src/TableModel.c +++ b/src/Props/TableModel.c @@ -1,48 +1,48 @@ -#include "Common.h" -static struct ModelPart base, leftLegFront, rightLegFront, leftLegBack, rightLegBack; - -static void TableModel_MakeParts(void) { - // all the parts have a TexOrigin of 0,0 - struct BoxDesc box_base = { 0,0, BoxDesc_Box(-9,14,-9, 9,16, 9) }; - struct BoxDesc box_lFront = { 0,0, BoxDesc_Box(-6, 0,-6, -8,14,-8) }; - struct BoxDesc box_rFront = { 0,0, BoxDesc_Box( 6, 0,-6, 8,14,-8) }; - struct BoxDesc box_lBack = { 0,0, BoxDesc_Box(-6, 0, 6, -8,14, 8) }; - struct BoxDesc box_rBack = { 0,0, BoxDesc_Box( 6, 0, 6, 8,14, 8) }; - - BoxDesc_BuildBox(&base, &box_base); - BoxDesc_BuildBox(&leftLegFront, &box_lFront); - BoxDesc_BuildBox(&rightLegFront, &box_rFront); - BoxDesc_BuildBox(&leftLegBack, &box_lBack); - BoxDesc_BuildBox(&rightLegBack, &box_rBack); -} - -static void TableModel_Draw(struct Entity* entity) { - Model_ApplyTexture(entity); - Models.uScale = 1/16.0f; Models.vScale = 1/16.0f; - - Model_DrawPart(&base); - Model_DrawPart(&leftLegFront); - Model_DrawPart(&rightLegFront); - Model_DrawPart(&leftLegBack); - Model_DrawPart(&rightLegBack); - - Model_UpdateVB(); -} - -static float TableModel_GetNameY(struct Entity* e) { return 1.50f; } -static float TableModel_GetEyeY(struct Entity* e) { return 0.875f; } -static void TableModel_GetSize(struct Entity* e) { _SetSize(14,15,14); } -static void TableModel_GetBounds(struct Entity* e) { _SetBounds(-8,0,8, -8,16,8); } - -static struct ModelVertex vertices[MODEL_BOX_VERTICES * 5]; -static struct Model model = { - "table", vertices, &wood_tex, - TableModel_MakeParts, TableModel_Draw, - TableModel_GetNameY, TableModel_GetEyeY, - TableModel_GetSize, TableModel_GetBounds -}; - -struct Model* TableModel_GetInstance(void) { - Model_Init(&model); - return &model; +#include "Common.h" +static struct ModelPart base, leftLegFront, rightLegFront, leftLegBack, rightLegBack; + +static void TableModel_MakeParts(void) { + // all the parts have a TexOrigin of 0,0 + struct BoxDesc box_base = { 0,0, BoxDesc_Box(-9,14,-9, 9,16, 9) }; + struct BoxDesc box_lFront = { 0,0, BoxDesc_Box(-6, 0,-6, -8,14,-8) }; + struct BoxDesc box_rFront = { 0,0, BoxDesc_Box( 6, 0,-6, 8,14,-8) }; + struct BoxDesc box_lBack = { 0,0, BoxDesc_Box(-6, 0, 6, -8,14, 8) }; + struct BoxDesc box_rBack = { 0,0, BoxDesc_Box( 6, 0, 6, 8,14, 8) }; + + BoxDesc_BuildBox(&base, &box_base); + BoxDesc_BuildBox(&leftLegFront, &box_lFront); + BoxDesc_BuildBox(&rightLegFront, &box_rFront); + BoxDesc_BuildBox(&leftLegBack, &box_lBack); + BoxDesc_BuildBox(&rightLegBack, &box_rBack); +} + +static void TableModel_Draw(struct Entity* entity) { + Model_ApplyTexture(entity); + Models.uScale = 1/16.0f; Models.vScale = 1/16.0f; + + Model_DrawPart(&base); + Model_DrawPart(&leftLegFront); + Model_DrawPart(&rightLegFront); + Model_DrawPart(&leftLegBack); + Model_DrawPart(&rightLegBack); + + Model_UpdateVB(); +} + +static float TableModel_GetNameY(struct Entity* e) { return 1.50f; } +static float TableModel_GetEyeY(struct Entity* e) { return 0.875f; } +static void TableModel_GetSize(struct Entity* e) { _SetSize(14,15,14); } +static void TableModel_GetBounds(struct Entity* e) { _SetBounds(-8,0,8, -8,16,8); } + +static struct ModelVertex vertices[MODEL_BOX_VERTICES * 5]; +static struct Model model = { + "table", vertices, &wood_tex, + TableModel_MakeParts, TableModel_Draw, + TableModel_GetNameY, TableModel_GetEyeY, + TableModel_GetSize, TableModel_GetBounds +}; + +struct Model* TableModel_GetInstance(void) { + Model_Init(&model); + return &model; } \ No newline at end of file