mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
more of the same
This commit is contained in:
parent
a483f14418
commit
4e7948ed65
63
src/Chat.c
63
src/Chat.c
@ -172,21 +172,21 @@ void Chat_AddRaw(const char* raw) {
|
|||||||
}
|
}
|
||||||
void Chat_Add(const String* text) { Chat_AddOf(text, MSG_TYPE_NORMAL); }
|
void Chat_Add(const String* text) { Chat_AddOf(text, MSG_TYPE_NORMAL); }
|
||||||
|
|
||||||
void Chat_AddOf(const String* text, int msgType) {
|
void Chat_AddOf(const String* text, MsgType type) {
|
||||||
Event_RaiseChat(&ChatEvents_ChatReceived, text, msgType);
|
Event_RaiseChat(&ChatEvents_ChatReceived, text, type);
|
||||||
|
|
||||||
if (msgType == MSG_TYPE_NORMAL) {
|
if (type == MSG_TYPE_NORMAL) {
|
||||||
StringsBuffer_Add(&Chat_Log, text);
|
StringsBuffer_Add(&Chat_Log, text);
|
||||||
Chat_AppendLog(text);
|
Chat_AppendLog(text);
|
||||||
Chat_AppendLogTime();
|
Chat_AppendLogTime();
|
||||||
} else if (msgType >= MSG_TYPE_STATUS_1 && msgType <= MSG_TYPE_STATUS_3) {
|
} else if (type >= MSG_TYPE_STATUS_1 && type <= MSG_TYPE_STATUS_3) {
|
||||||
ChatLine_Make(&Chat_Status[msgType - MSG_TYPE_STATUS_1], text);
|
ChatLine_Make(&Chat_Status[type - MSG_TYPE_STATUS_1], text);
|
||||||
} else if (msgType >= MSG_TYPE_BOTTOMRIGHT_1 && msgType <= MSG_TYPE_BOTTOMRIGHT_3) {
|
} else if (type >= MSG_TYPE_BOTTOMRIGHT_1 && type <= MSG_TYPE_BOTTOMRIGHT_3) {
|
||||||
ChatLine_Make(&Chat_BottomRight[msgType - MSG_TYPE_BOTTOMRIGHT_1], text);
|
ChatLine_Make(&Chat_BottomRight[type - MSG_TYPE_BOTTOMRIGHT_1], text);
|
||||||
} else if (msgType == MSG_TYPE_ANNOUNCEMENT) {
|
} else if (type == MSG_TYPE_ANNOUNCEMENT) {
|
||||||
ChatLine_Make(&Chat_Announcement, text);
|
ChatLine_Make(&Chat_Announcement, text);
|
||||||
} else if (msgType >= MSG_TYPE_CLIENTSTATUS_1 && msgType <= MSG_TYPE_CLIENTSTATUS_3) {
|
} else if (type >= MSG_TYPE_CLIENTSTATUS_1 && type <= MSG_TYPE_CLIENTSTATUS_3) {
|
||||||
ChatLine_Make(&Chat_ClientStatus[msgType - MSG_TYPE_CLIENTSTATUS_1], text);
|
ChatLine_Make(&Chat_ClientStatus[type - MSG_TYPE_CLIENTSTATUS_1], text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,14 +306,13 @@ static void Commands_Execute(const String* input) {
|
|||||||
*------------------------------------------------------Simple commands----------------------------------------------------*
|
*------------------------------------------------------Simple commands----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static void HelpCommand_Execute(const String* args, int argsCount) {
|
static void HelpCommand_Execute(const String* args, int argsCount) {
|
||||||
if (argsCount == 1) {
|
struct ChatCommand* cmd;
|
||||||
Commands_PrintDefault(); return;
|
int i;
|
||||||
}
|
|
||||||
|
|
||||||
struct ChatCommand* cmd = Commands_GetMatch(&args[1]);
|
if (argsCount == 1) { Commands_PrintDefault(); return; }
|
||||||
|
cmd = Commands_GetMatch(&args[1]);
|
||||||
if (!cmd) return;
|
if (!cmd) return;
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < Array_Elems(cmd->Help); i++) {
|
for (i = 0; i < Array_Elems(cmd->Help); i++) {
|
||||||
if (!cmd->Help[i]) continue;
|
if (!cmd->Help[i]) continue;
|
||||||
Chat_AddRaw(cmd->Help[i]);
|
Chat_AddRaw(cmd->Help[i]);
|
||||||
@ -346,11 +345,12 @@ struct ChatCommand GpuInfoCommand_Instance = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void RenderTypeCommand_Execute(const String* args, int argsCount) {
|
static void RenderTypeCommand_Execute(const String* args, int argsCount) {
|
||||||
|
int flags;
|
||||||
if (argsCount == 1) {
|
if (argsCount == 1) {
|
||||||
Chat_AddRaw("&e/client: &cYou didn't specify a new render type."); return;
|
Chat_AddRaw("&e/client: &cYou didn't specify a new render type."); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int flags = Game_CalcRenderType(&args[1]);
|
flags = Game_CalcRenderType(&args[1]);
|
||||||
if (flags >= 0) {
|
if (flags >= 0) {
|
||||||
EnvRenderer_UseLegacyMode( flags & 1);
|
EnvRenderer_UseLegacyMode( flags & 1);
|
||||||
EnvRenderer_UseMinimalMode(flags & 2);
|
EnvRenderer_UseMinimalMode(flags & 2);
|
||||||
@ -383,7 +383,7 @@ static void ResolutionCommand_Execute(const String* args, int argsCount) {
|
|||||||
Chat_AddRaw("&e/client: &cWidth and height must be above 0.");
|
Chat_AddRaw("&e/client: &cWidth and height must be above 0.");
|
||||||
} else {
|
} else {
|
||||||
Window_SetClientSize(width, height);
|
Window_SetClientSize(width, height);
|
||||||
Options_SetInt(OPT_WINDOW_WIDTH, width);
|
Options_SetInt(OPT_WINDOW_WIDTH, width);
|
||||||
Options_SetInt(OPT_WINDOW_HEIGHT, height);
|
Options_SetInt(OPT_WINDOW_HEIGHT, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,16 +422,16 @@ Vector3I cuboid_mark1, cuboid_mark2;
|
|||||||
bool cuboid_persist, cuboid_hooked;
|
bool cuboid_persist, cuboid_hooked;
|
||||||
|
|
||||||
static bool CuboidCommand_ParseBlock(const String* args, int argsCount) {
|
static bool CuboidCommand_ParseBlock(const String* args, int argsCount) {
|
||||||
|
int block;
|
||||||
if (argsCount == 1) return true;
|
if (argsCount == 1) return true;
|
||||||
if (String_CaselessEqualsConst(&args[1], "yes")) { cuboid_persist = true; return true; }
|
if (String_CaselessEqualsConst(&args[1], "yes")) { cuboid_persist = true; return true; }
|
||||||
|
|
||||||
int raw = Block_Parse(&args[1]);
|
block = Block_Parse(&args[1]);
|
||||||
if (raw == -1) {
|
if (block == -1) {
|
||||||
Chat_Add1("&eCuboid: &c\"%s\" is not a valid block name or id.", &args[1]); return false;
|
Chat_Add1("&eCuboid: &c\"%s\" is not a valid block name or id.", &args[1]); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockID block = (BlockID)raw;
|
if (block >= BLOCK_CPE_COUNT && !Block_IsCustomDefined((BlockID)block)) {
|
||||||
if (block >= BLOCK_CPE_COUNT && !Block_IsCustomDefined(block)) {
|
|
||||||
Chat_Add1("&eCuboid: &cThere is no block with id \"%s\".", &args[1]); return false;
|
Chat_Add1("&eCuboid: &cThere is no block with id \"%s\".", &args[1]); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,20 +521,19 @@ struct ChatCommand CuboidCommand_Instance = {
|
|||||||
*------------------------------------------------------TeleportCommand----------------------------------------------------*
|
*------------------------------------------------------TeleportCommand----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static void TeleportCommand_Execute(const String* args, int argsCount) {
|
static void TeleportCommand_Execute(const String* args, int argsCount) {
|
||||||
|
Vector3 v;
|
||||||
if (argsCount != 4) {
|
if (argsCount != 4) {
|
||||||
Chat_AddRaw("&e/client teleport: &cYou didn't specify X, Y and Z coordinates.");
|
Chat_AddRaw("&e/client teleport: &cYou didn't specify X, Y and Z coordinates.");
|
||||||
} else {
|
return;
|
||||||
float x, y, z;
|
|
||||||
if (!Convert_TryParseFloat(&args[1], &x) || !Convert_TryParseFloat(&args[2], &y) || !Convert_TryParseFloat(&args[3], &z)) {
|
|
||||||
Chat_AddRaw("&e/client teleport: &cCoordinates must be decimals");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 v = { x, y, z };
|
|
||||||
struct LocationUpdate update; LocationUpdate_MakePos(&update, v, false);
|
|
||||||
struct Entity* entity = &LocalPlayer_Instance.Base;
|
|
||||||
entity->VTABLE->SetLocation(entity, &update, false);
|
|
||||||
}
|
}
|
||||||
|
if (!Convert_TryParseFloat(&args[1], &v.X) || !Convert_TryParseFloat(&args[2], &v.Y) || !Convert_TryParseFloat(&args[3], &v.Z)) {
|
||||||
|
Chat_AddRaw("&e/client teleport: &cCoordinates must be decimals");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LocationUpdate update; LocationUpdate_MakePos(&update, v, false);
|
||||||
|
struct Entity* entity = &LocalPlayer_Instance.Base;
|
||||||
|
entity->VTABLE->SetLocation(entity, &update, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChatCommand TeleportCommand_Instance = {
|
struct ChatCommand TeleportCommand_Instance = {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
struct IGameComponent;
|
struct IGameComponent;
|
||||||
|
|
||||||
enum MSG_TYPE {
|
typedef enum MsgType {
|
||||||
MSG_TYPE_NORMAL = 0,
|
MSG_TYPE_NORMAL = 0,
|
||||||
MSG_TYPE_STATUS_1 = 1,
|
MSG_TYPE_STATUS_1 = 1,
|
||||||
MSG_TYPE_STATUS_2 = 2,
|
MSG_TYPE_STATUS_2 = 2,
|
||||||
@ -19,8 +19,8 @@ enum MSG_TYPE {
|
|||||||
MSG_TYPE_ANNOUNCEMENT = 100,
|
MSG_TYPE_ANNOUNCEMENT = 100,
|
||||||
MSG_TYPE_CLIENTSTATUS_1 = 256, /* Cuboid messages */
|
MSG_TYPE_CLIENTSTATUS_1 = 256, /* Cuboid messages */
|
||||||
MSG_TYPE_CLIENTSTATUS_2 = 257, /* Clipboard invalid character */
|
MSG_TYPE_CLIENTSTATUS_2 = 257, /* Clipboard invalid character */
|
||||||
MSG_TYPE_CLIENTSTATUS_3 = 258, /* Tab list matching names*/
|
MSG_TYPE_CLIENTSTATUS_3 = 258 /* Tab list matching names*/
|
||||||
};
|
} MsgType;
|
||||||
|
|
||||||
struct ChatLine { char Buffer[STRING_SIZE]; TimeMS Received; };
|
struct ChatLine { char Buffer[STRING_SIZE]; TimeMS Received; };
|
||||||
struct ChatLine Chat_Status[3], Chat_BottomRight[3], Chat_ClientStatus[3], Chat_Announcement;
|
struct ChatLine Chat_Status[3], Chat_BottomRight[3], Chat_ClientStatus[3], Chat_Announcement;
|
||||||
@ -31,7 +31,7 @@ void Chat_MakeComponent(struct IGameComponent* comp);
|
|||||||
void Chat_SetLogName(const String* name);
|
void Chat_SetLogName(const String* name);
|
||||||
void Chat_Send(const String* text, bool logUsage);
|
void Chat_Send(const String* text, bool logUsage);
|
||||||
void Chat_Add(const String* text);
|
void Chat_Add(const String* text);
|
||||||
void Chat_AddOf(const String* text, int messageType);
|
void Chat_AddOf(const String* text, MsgType type);
|
||||||
void Chat_AddRaw(const char* raw);
|
void Chat_AddRaw(const char* raw);
|
||||||
|
|
||||||
NOINLINE_ void Chat_LogError(ReturnCode result, const char* place);
|
NOINLINE_ void Chat_LogError(ReturnCode result, const char* place);
|
||||||
|
48
src/Model.c
48
src/Model.c
@ -10,9 +10,9 @@
|
|||||||
#define UV_POS_MASK ((uint16_t)0x7FFF)
|
#define UV_POS_MASK ((uint16_t)0x7FFF)
|
||||||
#define UV_MAX ((uint16_t)0x8000)
|
#define UV_MAX ((uint16_t)0x8000)
|
||||||
#define UV_MAX_SHIFT 15
|
#define UV_MAX_SHIFT 15
|
||||||
#define AABB_Width(bb) (bb->Max.X - bb->Min.X)
|
#define AABB_Width(bb) ((bb)->Max.X - (bb)->Min.X)
|
||||||
#define AABB_Height(bb) (bb->Max.Y - bb->Min.Y)
|
#define AABB_Height(bb) ((bb)->Max.Y - (bb)->Min.Y)
|
||||||
#define AABB_Length(bb) (bb->Max.Z - bb->Min.Z)
|
#define AABB_Length(bb) ((bb)->Max.Z - (bb)->Min.Z)
|
||||||
|
|
||||||
void ModelVertex_Init(struct ModelVertex* vertex, float x, float y, float z, int u, int v) {
|
void ModelVertex_Init(struct ModelVertex* vertex, float x, float y, float z, int u, int v) {
|
||||||
vertex->X = x; vertex->Y = y; vertex->Z = z;
|
vertex->X = x; vertex->Y = y; vertex->Z = z;
|
||||||
@ -49,9 +49,9 @@ void Model_Init(struct Model* model) {
|
|||||||
model->NameScale = 1.0f;
|
model->NameScale = 1.0f;
|
||||||
model->armX = 6; model->armY = 12;
|
model->armX = 6; model->armY = 12;
|
||||||
|
|
||||||
model->GetTransform = Model_GetTransform;
|
model->GetTransform = Model_GetTransform;
|
||||||
model->RecalcProperties = Model_NullFunc;
|
model->RecalcProperties = Model_NullFunc;
|
||||||
model->DrawArm = Model_NullFunc;
|
model->DrawArm = Model_NullFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model_ShouldRender(struct Entity* entity) {
|
bool Model_ShouldRender(struct Entity* entity) {
|
||||||
@ -156,9 +156,9 @@ void Model_ApplyTexture(struct Entity* entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Model_DrawPart(struct ModelPart* part) {
|
void Model_DrawPart(struct ModelPart* part) {
|
||||||
struct Model* model = Model_ActiveModel;
|
struct Model* model = Model_ActiveModel;
|
||||||
struct ModelVertex* src = &model->vertices[part->Offset];
|
struct ModelVertex* src = &model->vertices[part->Offset];
|
||||||
VertexP3fT2fC4b* dst = &ModelCache_Vertices[model->index];
|
VertexP3fT2fC4b* dst = &ModelCache_Vertices[model->index];
|
||||||
int i, count = part->Count;
|
int i, count = part->Count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
@ -178,14 +178,15 @@ void Model_DrawPart(struct ModelPart* part) {
|
|||||||
#define Model_RotateZ t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;
|
#define Model_RotateZ t = cosZ * v.X + sinZ * v.Y; v.Y = -sinZ * v.X + cosZ * v.Y; v.X = t;
|
||||||
|
|
||||||
void Model_DrawRotate(float angleX, float angleY, float angleZ, struct ModelPart* part, bool head) {
|
void Model_DrawRotate(float angleX, float angleY, float angleZ, struct ModelPart* part, bool head) {
|
||||||
struct Model* model = Model_ActiveModel;
|
struct Model* model = Model_ActiveModel;
|
||||||
|
struct ModelVertex* src = &model->vertices[part->Offset];
|
||||||
|
VertexP3fT2fC4b* dst = &ModelCache_Vertices[model->index];
|
||||||
|
|
||||||
float cosX = Math_CosF(-angleX), sinX = Math_SinF(-angleX);
|
float cosX = Math_CosF(-angleX), sinX = Math_SinF(-angleX);
|
||||||
float cosY = Math_CosF(-angleY), sinY = Math_SinF(-angleY);
|
float cosY = Math_CosF(-angleY), sinY = Math_SinF(-angleY);
|
||||||
float cosZ = Math_CosF(-angleZ), sinZ = Math_SinF(-angleZ);
|
float cosZ = Math_CosF(-angleZ), sinZ = Math_SinF(-angleZ);
|
||||||
float x = part->RotX, y = part->RotY, z = part->RotZ;
|
float x = part->RotX, y = part->RotY, z = part->RotZ;
|
||||||
|
|
||||||
struct ModelVertex* src = &model->vertices[part->Offset];
|
|
||||||
VertexP3fT2fC4b* dst = &ModelCache_Vertices[model->index];
|
|
||||||
int i, count = part->Count;
|
int i, count = part->Count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
@ -232,9 +233,9 @@ void Model_RenderArm(struct Model* model, struct Entity* entity) {
|
|||||||
struct Matrix translate;
|
struct Matrix translate;
|
||||||
|
|
||||||
if (Game_ClassicArmModel) {
|
if (Game_ClassicArmModel) {
|
||||||
// TODO: Position's not quite right.
|
/* TODO: Position's not quite right. */
|
||||||
// Matrix4.Translate(out m, -armX / 16f + 0.2f, -armY / 16f - 0.20f, 0);
|
/* Matrix_Translate(out m, -armX / 16f + 0.2f, -armY / 16f - 0.20f, 0); */
|
||||||
// is better, but that breaks the dig animation
|
/* is better, but that breaks the dig animation */
|
||||||
Matrix_Translate(&translate, -model->armX / 16.0f, -model->armY / 16.0f - 0.10f, 0);
|
Matrix_Translate(&translate, -model->armX / 16.0f, -model->armY / 16.0f - 0.10f, 0);
|
||||||
} else {
|
} else {
|
||||||
Matrix_Translate(&translate, -model->armX / 16.0f + 0.10f, -model->armY / 16.0f - 0.26f, 0);
|
Matrix_Translate(&translate, -model->armX / 16.0f + 0.10f, -model->armY / 16.0f - 0.26f, 0);
|
||||||
@ -253,7 +254,7 @@ void Model_RenderArm(struct Model* model, struct Entity* entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Model_DrawArmPart(struct ModelPart* part) {
|
void Model_DrawArmPart(struct ModelPart* part) {
|
||||||
struct Model* model = Model_ActiveModel;
|
struct Model* model = Model_ActiveModel;
|
||||||
struct ModelPart arm = *part;
|
struct ModelPart arm = *part;
|
||||||
arm.RotX = model->armX / 16.0f;
|
arm.RotX = model->armX / 16.0f;
|
||||||
arm.RotY = (model->armY + model->armY / 2) / 16.0f;
|
arm.RotY = (model->armY + model->armY / 2) / 16.0f;
|
||||||
@ -285,7 +286,7 @@ void BoxDesc_MirrorX(struct BoxDesc* desc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BoxDesc_BuildBox(struct ModelPart* part, struct BoxDesc* desc) {
|
void BoxDesc_BuildBox(struct ModelPart* part, const struct BoxDesc* desc) {
|
||||||
int sidesW = desc->SizeZ, bodyW = desc->SizeX, bodyH = desc->SizeY;
|
int sidesW = desc->SizeZ, bodyW = desc->SizeX, bodyH = desc->SizeY;
|
||||||
float x1 = desc->X1, y1 = desc->Y1, z1 = desc->Z1;
|
float x1 = desc->X1, y1 = desc->Y1, z1 = desc->Z1;
|
||||||
float x2 = desc->X2, y2 = desc->Y2, z2 = desc->Z2;
|
float x2 = desc->X2, y2 = desc->Y2, z2 = desc->Z2;
|
||||||
@ -303,11 +304,11 @@ void BoxDesc_BuildBox(struct ModelPart* part, struct BoxDesc* desc) {
|
|||||||
desc->RotX, desc->RotY, desc->RotZ);
|
desc->RotX, desc->RotY, desc->RotZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoxDesc_BuildRotatedBox(struct ModelPart* part, struct BoxDesc* desc) {
|
void BoxDesc_BuildRotatedBox(struct ModelPart* part, const struct BoxDesc* desc) {
|
||||||
int sidesW = desc->SizeY, bodyW = desc->SizeX, bodyH = desc->SizeZ;
|
int sidesW = desc->SizeY, bodyW = desc->SizeX, bodyH = desc->SizeZ;
|
||||||
float x1 = desc->X1, y1 = desc->Y1, z1 = desc->Z1;
|
float x1 = desc->X1, y1 = desc->Y1, z1 = desc->Z1;
|
||||||
float x2 = desc->X2, y2 = desc->Y2, z2 = desc->Z2;
|
float x2 = desc->X2, y2 = desc->Y2, z2 = desc->Z2;
|
||||||
int x = desc->TexX, y = desc->TexY;
|
int x = desc->TexX, y = desc->TexY, i;
|
||||||
struct Model* m = Model_ActiveModel;
|
struct Model* m = Model_ActiveModel;
|
||||||
|
|
||||||
BoxDesc_YQuad(m, x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2, false); /* top */
|
BoxDesc_YQuad(m, x + sidesW + bodyW + sidesW, y + sidesW, bodyW, bodyH, x1, x2, z1, z2, y2, false); /* top */
|
||||||
@ -318,7 +319,6 @@ void BoxDesc_BuildRotatedBox(struct ModelPart* part, struct BoxDesc* desc) {
|
|||||||
BoxDesc_XQuad(m, x + sidesW + bodyW, y + sidesW, sidesW, bodyH, y1, y2, z2, z1, x1, false); /* right */
|
BoxDesc_XQuad(m, x + sidesW + bodyW, y + sidesW, sidesW, bodyH, y1, y2, z2, z1, x1, false); /* right */
|
||||||
|
|
||||||
/* rotate left and right 90 degrees */
|
/* rotate left and right 90 degrees */
|
||||||
int i;
|
|
||||||
for (i = m->index - 8; i < m->index; i++) {
|
for (i = m->index - 8; i < m->index; i++) {
|
||||||
struct ModelVertex vertex = m->vertices[i];
|
struct ModelVertex vertex = m->vertices[i];
|
||||||
float z = vertex.Z; vertex.Z = vertex.Y; vertex.Y = z;
|
float z = vertex.Z; vertex.Z = vertex.Y; vertex.Y = z;
|
||||||
@ -331,8 +331,8 @@ void BoxDesc_BuildRotatedBox(struct ModelPart* part, struct BoxDesc* desc) {
|
|||||||
|
|
||||||
|
|
||||||
void BoxDesc_XQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float z1, float z2, float y1, float y2, float x, bool swapU) {
|
void BoxDesc_XQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float z1, float z2, float y1, float y2, float x, bool swapU) {
|
||||||
int u1 = texX, u2 = (texX + texWidth) | UV_MAX;
|
int u1 = texX, u2 = (texX + texWidth) | UV_MAX, tmp;
|
||||||
if (swapU) { int tmp = u1; u1 = u2; u2 = tmp; }
|
if (swapU) { tmp = u1; u1 = u2; u2 = tmp; }
|
||||||
|
|
||||||
ModelVertex_Init(&m->vertices[m->index], x, y1, z1, u1, (texY + texHeight) | UV_MAX); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x, y1, z1, u1, (texY + texHeight) | UV_MAX); m->index++;
|
||||||
ModelVertex_Init(&m->vertices[m->index], x, y2, z1, u1, texY); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x, y2, z1, u1, texY); m->index++;
|
||||||
@ -341,8 +341,8 @@ void BoxDesc_XQuad(struct Model* m, int texX, int texY, int texWidth, int texHei
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BoxDesc_YQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float z1, float z2, float y, bool swapU) {
|
void BoxDesc_YQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float z1, float z2, float y, bool swapU) {
|
||||||
int u1 = texX, u2 = (texX + texWidth) | UV_MAX;
|
int u1 = texX, u2 = (texX + texWidth) | UV_MAX, tmp;
|
||||||
if (swapU) { int tmp = u1; u1 = u2; u2 = tmp; }
|
if (swapU) { tmp = u1; u1 = u2; u2 = tmp; }
|
||||||
|
|
||||||
ModelVertex_Init(&m->vertices[m->index], x1, y, z2, u1, (texY + texHeight) | UV_MAX); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x1, y, z2, u1, (texY + texHeight) | UV_MAX); m->index++;
|
||||||
ModelVertex_Init(&m->vertices[m->index], x1, y, z1, u1, texY); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x1, y, z1, u1, texY); m->index++;
|
||||||
@ -351,8 +351,8 @@ void BoxDesc_YQuad(struct Model* m, int texX, int texY, int texWidth, int texHei
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BoxDesc_ZQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float y1, float y2, float z, bool swapU) {
|
void BoxDesc_ZQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float y1, float y2, float z, bool swapU) {
|
||||||
int u1 = texX, u2 = (texX + texWidth) | UV_MAX;
|
int u1 = texX, u2 = (texX + texWidth) | UV_MAX, tmp;
|
||||||
if (swapU) { int tmp = u1; u1 = u2; u2 = tmp; }
|
if (swapU) { tmp = u1; u1 = u2; u2 = tmp; }
|
||||||
|
|
||||||
ModelVertex_Init(&m->vertices[m->index], x1, y1, z, u1, (texY + texHeight) | UV_MAX); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x1, y1, z, u1, (texY + texHeight) | UV_MAX); m->index++;
|
||||||
ModelVertex_Init(&m->vertices[m->index], x1, y2, z, u1, texY); m->index++;
|
ModelVertex_Init(&m->vertices[m->index], x1, y2, z, u1, texY); m->index++;
|
||||||
|
@ -109,7 +109,7 @@ let SW = sides width, BW = body width, BH = body height
|
|||||||
|H--------tex---------H|H--------tex---------H|H--------tex---------H|H--------tex---------H|
|
|H--------tex---------H|H--------tex---------H|H--------tex---------H|H--------tex---------H|
|
||||||
|----------SW----------|----------BW----------|----------SW----------|----------BW----------|
|
|----------SW----------|----------BW----------|----------SW----------|----------BW----------|
|
||||||
********************************************************************************************* */
|
********************************************************************************************* */
|
||||||
void BoxDesc_BuildBox(struct ModelPart* part, struct BoxDesc* desc);
|
void BoxDesc_BuildBox(struct ModelPart* part, const struct BoxDesc* desc);
|
||||||
|
|
||||||
/* Builds a box model assuming the follow texture layout:
|
/* Builds a box model assuming the follow texture layout:
|
||||||
let SW = sides width, BW = body width, BH = body height
|
let SW = sides width, BW = body width, BH = body height
|
||||||
@ -124,7 +124,7 @@ let SW = sides width, BW = body width, BH = body height
|
|||||||
|H--------tex---------H|H--------tex---------H|H--------tex---------H|H--------tex---------H|
|
|H--------tex---------H|H--------tex---------H|H--------tex---------H|H--------tex---------H|
|
||||||
|----------SW----------|----------BW----------|----------BW----------|----------------------|
|
|----------SW----------|----------BW----------|----------BW----------|----------------------|
|
||||||
********************************************************************************************* */
|
********************************************************************************************* */
|
||||||
void BoxDesc_BuildRotatedBox(struct ModelPart* part, struct BoxDesc* desc);
|
void BoxDesc_BuildRotatedBox(struct ModelPart* part, const struct BoxDesc* desc);
|
||||||
|
|
||||||
void BoxDesc_XQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float z1, float z2, float y1, float y2, float x, bool swapU);
|
void BoxDesc_XQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float z1, float z2, float y1, float y2, float x, bool swapU);
|
||||||
void BoxDesc_YQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float z1, float z2, float y, bool swapU);
|
void BoxDesc_YQuad(struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float z1, float z2, float y, bool swapU);
|
||||||
|
@ -20,9 +20,6 @@ Vector3 Vector3_BigPos(void);
|
|||||||
float Vector3_LengthSquared(const Vector3* v);
|
float Vector3_LengthSquared(const Vector3* v);
|
||||||
|
|
||||||
#define VECTOR3_CONST(x, y, z) { x, y, z };
|
#define VECTOR3_CONST(x, y, z) { x, y, z };
|
||||||
#define Vector3_UnitX VECTOR3_CONST(1.0f, 0.0f, 0.0f)
|
|
||||||
#define Vector3_UnitY VECTOR3_CONST(0.0f, 1.0f, 0.0f)
|
|
||||||
#define Vector3_UnitZ VECTOR3_CONST(0.0f, 0.0f, 1.0f)
|
|
||||||
#define Vector3_Zero VECTOR3_CONST(0.0f, 0.0f, 0.0f)
|
#define Vector3_Zero VECTOR3_CONST(0.0f, 0.0f, 0.0f)
|
||||||
#define Vector3_One VECTOR3_CONST(1.0f, 1.0f, 1.0f)
|
#define Vector3_One VECTOR3_CONST(1.0f, 1.0f, 1.0f)
|
||||||
|
|
||||||
|
@ -42,12 +42,11 @@ BlockID World_SafeGetBlock_3I(Vector3I p);
|
|||||||
bool World_IsValidPos(int x, int y, int z);
|
bool World_IsValidPos(int x, int y, int z);
|
||||||
bool World_IsValidPos_3I(Vector3I p);
|
bool World_IsValidPos_3I(Vector3I p);
|
||||||
|
|
||||||
enum ENV_VAR {
|
enum EnvVar_ {
|
||||||
ENV_VAR_EDGE_BLOCK, ENV_VAR_SIDES_BLOCK, ENV_VAR_EDGE_HEIGHT, ENV_VAR_SIDES_OFFSET,
|
ENV_VAR_EDGE_BLOCK, ENV_VAR_SIDES_BLOCK, ENV_VAR_EDGE_HEIGHT, ENV_VAR_SIDES_OFFSET,
|
||||||
ENV_VAR_CLOUDS_HEIGHT, ENV_VAR_CLOUDS_SPEED, ENV_VAR_WEATHER_SPEED, ENV_VAR_WEATHER_FADE,
|
ENV_VAR_CLOUDS_HEIGHT, ENV_VAR_CLOUDS_SPEED, ENV_VAR_WEATHER_SPEED, ENV_VAR_WEATHER_FADE,
|
||||||
ENV_VAR_WEATHER, ENV_VAR_EXP_FOG, ENV_VAR_SKYBOX_HOR_SPEED, ENV_VAR_SKYBOX_VER_SPEED,
|
ENV_VAR_WEATHER, ENV_VAR_EXP_FOG, ENV_VAR_SKYBOX_HOR_SPEED, ENV_VAR_SKYBOX_VER_SPEED,
|
||||||
ENV_VAR_SKY_COL, ENV_VAR_CLOUDS_COL, ENV_VAR_FOG_COL, ENV_VAR_SUN_COL,
|
ENV_VAR_SKY_COL, ENV_VAR_CLOUDS_COL, ENV_VAR_FOG_COL, ENV_VAR_SUN_COL, ENV_VAR_SHADOW_COL
|
||||||
ENV_VAR_SHADOW_COL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BlockID Env_EdgeBlock, Env_SidesBlock;
|
BlockID Env_EdgeBlock, Env_SidesBlock;
|
||||||
@ -57,7 +56,7 @@ int Env_SidesOffset;
|
|||||||
int Env_CloudsHeight;
|
int Env_CloudsHeight;
|
||||||
float Env_CloudsSpeed;
|
float Env_CloudsSpeed;
|
||||||
|
|
||||||
enum WEATHER { WEATHER_SUNNY, WEATHER_RAINY, WEATHER_SNOWY };
|
enum Weather_ { WEATHER_SUNNY, WEATHER_RAINY, WEATHER_SNOWY };
|
||||||
extern const char* Weather_Names[3];
|
extern const char* Weather_Names[3];
|
||||||
float Env_WeatherSpeed;
|
float Env_WeatherSpeed;
|
||||||
float Env_WeatherFade;
|
float Env_WeatherFade;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user