Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Release v1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheesse committed Feb 9, 2019
1 parent 33a408c commit dfe8edd
Show file tree
Hide file tree
Showing 19 changed files with 906 additions and 897 deletions.
4 changes: 3 additions & 1 deletion src/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
struct Model* ZombieVillagerModel_GetInstance(void);

void nullfunc(void);
174 changes: 87 additions & 87 deletions src/CapeModel.c → src/Humans/CapeModel.c
Original file line number Diff line number Diff line change
@@ -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;
}
80 changes: 39 additions & 41 deletions src/ChibiSitModel.c → src/Humans/ChibiSitModel.c
Original file line number Diff line number Diff line change
@@ -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;
}
43 changes: 22 additions & 21 deletions src/TModel.c → src/Humans/TModel.c
Original file line number Diff line number Diff line change
@@ -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;
}
Loading

0 comments on commit dfe8edd

Please sign in to comment.