Get rid of unneeded includes from header files

This commit is contained in:
UnknownShadow200 2018-03-30 22:46:09 +11:00
parent 27d5add8ec
commit 31b0cde8aa
64 changed files with 112 additions and 215 deletions

View File

@ -1,6 +1,5 @@
#ifndef CC_ANIMS_H
#define CC_ANIMS_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Texture animations, and water and lava liquid animations.
Copyright 2014 - 2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_ASYNCDOWNLOADER_H
#define CC_ASYNCDOWNLOADER_H
#include "Typedefs.h"
#include "Constants.h"
#include "Utils.h"
#include "GameStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_AXISLINESRENDERER_H
#define CC_AXISLINESRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Renders 3 lines showing direction of each axis.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_BORDERSRENDERER_H
#define CC_BORDERSRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Renders map sides and map edges (horizon) as large quads.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -9,6 +9,43 @@
#include "ErrorHandler.h"
#include "Drawer.h"
#include "Random.h"
#include "ChunkUpdater.h"
#include "BlockID.h"
#include "Block.h"
#include "PackedCol.h"
#include "TerrainAtlas.h"
#include "VertexStructs.h"
BlockID* Builder_Chunk;
UInt8* Builder_Counts;
Int32* Builder_BitFlags;
bool Builder_UseBitFlags;
Int32 Builder_X, Builder_Y, Builder_Z;
BlockID Builder_Block;
Int32 Builder_ChunkIndex;
bool Builder_FullBright;
bool Builder_Tinted;
Int32 Builder_ChunkEndX, Builder_ChunkEndZ;
Int32 Builder_Offsets[6];
Int32 (*Builder_StretchXLiquid)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block);
Int32 (*Builder_StretchX)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block, Face face);
Int32 (*Builder_StretchZ)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block, Face face);
void (*Builder_RenderBlock)(Int32 countsIndex);
void (*Builder_PreStretchTiles)(Int32 x1, Int32 y1, Int32 z1);
void (*Builder_PostStretchTiles)(Int32 x1, Int32 y1, Int32 z1);
/* Contains state for vertices for a portion of a chunk mesh (vertices that are in a 1D atlas) */
typedef struct Builder1DPart_ {
VertexP3fT2fC4b* fVertices[FACE_COUNT];
Int32 fCount[FACE_COUNT];
Int32 sCount, sOffset, sAdvance;
VertexP3fT2fC4b* vertices;
Int32 verticesBufferCount;
} Builder1DPart;
/* Part builder data, for both normal and translucent parts.
The first ATLAS1D_MAX_ATLASES_COUNT parts are for normal parts, remainder are for translucent parts. */
Builder1DPart Builder_Parts[ATLAS1D_MAX_ATLASES_COUNT * 2];
void Builder1DPart_Prepare(Builder1DPart* part) {
part->sOffset = 0;
@ -51,30 +88,6 @@ Int32 Builder1DPart_VerticesCount(Builder1DPart* part) {
return count;
}
void Builder_Init(void) {
Builder_Offsets[FACE_XMIN] = -1;
Builder_Offsets[FACE_XMAX] = 1;
Builder_Offsets[FACE_ZMIN] = -EXTCHUNK_SIZE;
Builder_Offsets[FACE_ZMAX] = EXTCHUNK_SIZE;
Builder_Offsets[FACE_YMIN] = -EXTCHUNK_SIZE_2;
Builder_Offsets[FACE_YMAX] = EXTCHUNK_SIZE_2;
}
void Builder_SetDefault(void) {
Builder_StretchXLiquid = NULL;
Builder_StretchX = NULL;
Builder_StretchZ = NULL;
Builder_RenderBlock = NULL;
Builder_UseBitFlags = false;
Builder_PreStretchTiles = Builder_DefaultPreStretchTiles;
Builder_PostStretchTiles = Builder_DefaultPostStretchTiles;
}
void Builder_OnNewMapLoaded(void) {
Builder_SidesLevel = max(0, WorldEnv_SidesHeight);
Builder_EdgeLevel = max(0, WorldEnv_EdgeHeight);
}
void Builder_AddSpriteVertices(BlockID block) {
Int32 i = Atlas1D_Index(Block_GetTexLoc(block, FACE_XMIN));
@ -428,6 +441,31 @@ void Builder_DrawSprite(Int32 count) {
part->sOffset += 4;
}
void Builder_Init(void) {
Builder_Offsets[FACE_XMIN] = -1;
Builder_Offsets[FACE_XMAX] = 1;
Builder_Offsets[FACE_ZMIN] = -EXTCHUNK_SIZE;
Builder_Offsets[FACE_ZMAX] = EXTCHUNK_SIZE;
Builder_Offsets[FACE_YMIN] = -EXTCHUNK_SIZE_2;
Builder_Offsets[FACE_YMAX] = EXTCHUNK_SIZE_2;
}
void Builder_SetDefault(void) {
Builder_StretchXLiquid = NULL;
Builder_StretchX = NULL;
Builder_StretchZ = NULL;
Builder_RenderBlock = NULL;
Builder_UseBitFlags = false;
Builder_PreStretchTiles = Builder_DefaultPreStretchTiles;
Builder_PostStretchTiles = Builder_DefaultPostStretchTiles;
}
void Builder_OnNewMapLoaded(void) {
Builder_SidesLevel = max(0, WorldEnv_SidesHeight);
Builder_EdgeLevel = max(0, WorldEnv_EdgeHeight);
}
PackedCol NormalBuilder_LightCol(Int32 x, Int32 y, Int32 z, Int32 face, BlockID block) {
Int32 offset = (Block_LightOffset[block] >> face) & 1;

View File

@ -1,12 +1,6 @@
#ifndef CC_BUILDER_H
#define CC_BUILDER_H
#include "Typedefs.h"
#include "Block.h"
#include "PackedCol.h"
#include "ChunkUpdater.h"
#include "BlockID.h"
#include "TerrainAtlas.h"
#include "VertexStructs.h"
/* Converts a 16x16x16 chunk into a mesh of vertices.
NormalMeshBuilder:
Implements a simple chunk mesh builder, where each block face is a single colour.
@ -14,88 +8,14 @@ NormalMeshBuilder:
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
typedef struct ChunkInfo_ ChunkInfo;
/* Contains state for vertices for a portion of a chunk mesh (vertices that are in a 1D atlas) */
typedef struct Builder1DPart_ {
/* Pointers to offset within vertices, indexed by face. */
VertexP3fT2fC4b* fVertices[FACE_COUNT];
/* Number of indices, indexed by face. */
Int32 fCount[FACE_COUNT];
/* Number of indices, for sprites. */
Int32 sCount;
/* Current offset within vertices for sprites, delta between each sprite face. */
Int32 sOffset, sAdvance;
/* Pointer to vertex data. */
VertexP3fT2fC4b* vertices;
/* Number of elements in the vertices pointer. */
Int32 verticesBufferCount;
} Builder1DPart;
/* Prepares the given part for building vertices. */
void Builder1DPart_Prepare(Builder1DPart* part);
/* Resets counts to zero for the given part.*/
void Builder1DPart_Reset(Builder1DPart* part);
/* Counts the total number of vertices in the given part. */
Int32 Builder1DPart_VerticesCount(Builder1DPart* part);
/* Current world coordinates being processed. */
Int32 Builder_X, Builder_Y, Builder_Z;
/* Current block being processed. */
BlockID Builder_Block;
/* Current chunk index being processed. */
Int32 Builder_ChunkIndex;
/* Whether current block being processed is full bright. */
bool Builder_FullBright;
/* Whether current block being processed is tinted. */
bool Builder_Tinted;
/* Pointer to current chunk on stack.*/
BlockID* Builder_Chunk;
/* Pointer to current counts on stack. */
UInt8* Builder_Counts;
/* Pointer to current bitflags on stack. */
Int32* Builder_BitFlags;
/* Whether BitFlags should actually be assigned and cleared. Default false. */
bool Builder_UseBitFlags;
/* Caches map edge and sides height. */
Int32 Builder_SidesLevel, Builder_EdgeLevel;
/* End coordinates of the chunk, as map may not be divisible by CHUNK_SIZE. */
Int32 Builder_ChunkEndX, Builder_ChunkEndZ;
/* Offset chunk indices for each face. */
Int32 Builder_Offsets[6];
/* Part builder data, for both normal and translucent parts.
The first ATLAS1D_MAX_ATLASES_COUNT parts are for normal parts, remainder are for translucent parts. */
Builder1DPart Builder_Parts[ATLAS1D_MAX_ATLASES_COUNT * 2];
/* Initalises state of this mesh builder. */
void Builder_Init(void);
/* Sets function pointers and variables to default. */
void Builder_SetDefault(void);
/* Called when a new map is loaded. */
void Builder_OnNewMapLoaded(void);
/* Builds a mesh for the given chunk. */
void Builder_MakeChunk(ChunkInfo* info);
/* Returns whether a liquid block is occluded at the given index in the chunk. */
bool Builder_OccludedLiquid(Int32 chunkIndex);
/* Calculates how many blocks the current block face mesh can be stretched on X axis. */
Int32 (*Builder_StretchXLiquid)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block);
/* Calculates how many blocks the current block face mesh can be stretched on X axis. */
Int32 (*Builder_StretchX)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block, Face face);
/* Calculates how many blocks the current block face mesh can be stretched on Z axis. */
Int32 (*Builder_StretchZ)(Int32 countIndex, Int32 x, Int32 y, Int32 z, Int32 chunkIndex, BlockID block, Face face);
/* Renders the current block. */
void (*Builder_RenderBlock)(Int32 countsIndex);
/* Called just before Stretch(). */
void (*Builder_PreStretchTiles)(Int32 x1, Int32 y1, Int32 z1);
/* Called just after Stretch(). */
void (*Builder_PostStretchTiles)(Int32 x1, Int32 y1, Int32 z1);
void Builder_DefaultPreStretchTiles(Int32 x1, Int32 y1, Int32 z1);
void Builder_DefaultPostStretchTiles(Int32 x1, Int32 y1, Int32 z1);
/* Renders a sprite block. */
void Builder_DrawSprite(Int32 count);
/* Replaces function pointers in Builder with function pointers for normal mesh builder. */
void NormalBuilder_SetActive(void);
#endif

View File

@ -1,7 +1,5 @@
#ifndef CC_CAMERA_H
#define CC_CAMERA_H
#include "Typedefs.h"
#include "Vectors.h"
#include "Picking.h"
/* Represents a camera, may be first or third person.

View File

@ -1,6 +1,5 @@
#ifndef CC_CHAT_H
#define CC_CHAT_H
#include "Typedefs.h"
#include "Constants.h"
#include "Utils.h"
#include "GameStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_CHUNKUPDATER_H
#define CC_CHUNKUPDATER_H
#include "Typedefs.h"
#include "Vectors.h"
/* Manages the process of building/deleting chunk meshes.
Also sorts chunks so nearest chunks are ordered first, and calculates chunk visibility.

View File

@ -1,6 +1,5 @@
#ifndef CC_DEFLATE_H
#define CC_DEFLATE_H
#include "Typedefs.h"
#include "Stream.h"
/* Decodes data compressed using DEFLATE in a streaming manner.
Partially based off information from

View File

@ -1,8 +1,6 @@
#ifndef CC_DRAWER_H
#define CC_DRAWER_H
#include "VertexStructs.h"
#include "PackedCol.h"
#include "Typedefs.h"
#include "Vectors.h"
/* Draws the vertices for a cuboid region.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,10 +1,7 @@
#ifndef CC_DRAWER2D_H
#define CC_DRAWER2D_H
#include "Typedefs.h"
#include "Platform.h"
#include "Bitmap.h"
#include "PackedCol.h"
#include "2DStructs.h"
#include "Texture.h"
#include "Constants.h"
/* Responsible for performing drawing operations on bitmaps, and for converting bitmaps into textures.

View File

@ -15,6 +15,7 @@
#include "GraphicsCommon.h"
#include "AsyncDownloader.h"
#include "ErrorHandler.h"
#include "IModel.h"
const UInt8* NameMode_Names[5] = { "None", "Hovered", "All", "AllHovered", "AllUnscaled" };
const UInt8* ShadowMode_Names[4] = { "None", "SnapToBlock", "Circle", "CircleAll" };

View File

@ -13,6 +13,7 @@
#include "GraphicsCommon.h"
#include "ModelCache.h"
#include "Physics.h"
#include "IModel.h"
#define ANIM_MAX_ANGLE (110 * MATH_DEG2RAD)
#define ANIM_ARM_MAX (60.0f * MATH_DEG2RAD)
@ -635,6 +636,6 @@ void ShadowComponent_Draw(Entity* entity) {
ShadowComponent_BoundShadowTex = true;
}
UInt32 vCount = (UInt32)(ptr - vertices) / VertexP3fT2fC4b_Size;
UInt32 vCount = (UInt32)(ptr - vertices) / (UInt32)sizeof(VertexP3fT2fC4b);
GfxCommon_UpdateDynamicVb_IndexedTris(vb, vertices, vCount);
}

View File

@ -1,6 +1,5 @@
#ifndef CC_ENTITY_COMPONENTS_H
#define CC_ENTITY_COMPONENTS_H
#include "Typedefs.h"
#include "Vectors.h"
#include "String.h"
/* Various components for entities.

View File

@ -1,6 +1,5 @@
#ifndef CC_ENVRENDERER_H
#define CC_ENVRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Renders environment of the map. (clouds, sky, fog)
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_EVENT_H
#define CC_EVENT_H
#include "Typedefs.h"
#include "String.h"
#include "Stream.h"
#include "Vectors.h"

View File

@ -11,6 +11,7 @@
#include "ExtMath.h"
#include "Gui.h"
#include "Window.h"
#include "Event.h"
Int32 Game_GetWindowScale(void) {
Real32 windowScale = min(Game_Width / 640.0f, Game_Height / 480.0f);

View File

@ -1,6 +1,5 @@
#ifndef CC_GAME_H
#define CC_GAME_H
#include "Typedefs.h"
#include "Stream.h"
#include "Picking.h"
#include "Options.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_GAMEMODE_H
#define CC_GAMEMODE_H
#include "Typedefs.h"
#include "GameStructs.h"
#include "Input.h"
#include "Widgets.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_GFXAPI_H
#define CC_GFXAPI_H
#include "Typedefs.h"
#include "Bitmap.h"
#include "PackedCol.h"
#include "Vectors.h"

View File

@ -1,7 +1,5 @@
#ifndef CC_GFXCOMMON_H
#define CC_GFXCOMMON_H
#include "Typedefs.h"
#include "PackedCol.h"
#include "String.h"
#include "Texture.h"
#include "VertexStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_GUI_H
#define CC_GUI_H
#include "Typedefs.h"
#include "Input.h"
#include "VertexStructs.h"
#include "Texture.h"

View File

@ -8,6 +8,7 @@
#include "ModelCache.h"
#include "ExtMath.h"
#include "Event.h"
#include "Entity.h"
BlockID held_block;
Entity held_entity;

View File

@ -1,6 +1,5 @@
#ifndef CC_HELDBLOCKRENDERER_H
#define CC_HELDBLOCKRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Implements rendering of held block/arm at bottom right of game.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -5,6 +5,7 @@
#include "ModelCache.h"
#include "GraphicsCommon.h"
#include "GraphicsAPI.h"
#include "Entity.h"
#define UV_POS_MASK ((UInt16)0x7FFF)
#define UV_MAX ((UInt16)0x8000)

View File

@ -1,15 +1,13 @@
#ifndef CC_MODEL_H
#define CC_MODEL_H
#include "Typedefs.h"
#include "Vectors.h"
#include "PackedCol.h"
#include "Physics.h"
#include "Entity.h"
#include "Constants.h"
/* Contains various structs and methods for an entity model.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
typedef struct Entity_ Entity;
typedef struct AABB_ AABB;
#define IMODEL_QUAD_VERTICES 4
#define IMODEL_BOX_VERTICES (FACE_COUNT * IMODEL_QUAD_VERTICES)

View File

@ -1,6 +1,5 @@
#ifndef CC_INPUT_H
#define CC_INPUT_H
#include "Typedefs.h"
#include "String.h"
/* Manages the keyboard, and raises events when keys are pressed etc.
Copyright 2017 ClassicalSharp | Licensed under BSD-3 | Based on OpenTK code

View File

@ -1,6 +1,5 @@
#ifndef CC_INPUTHANDLER_H
#define CC_INPUTHANDLER_H
#include "Typedefs.h"
#include "Gui.h"
/* Implements base handlers for mouse and keyboard input.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_INVENTORY_H
#define CC_INVENTORY_H
#include "Typedefs.h"
#include "GameStructs.h"
#include "BlockID.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_ISOMETRICDRAWER_H
#define CC_ISOMETRICDRAWER_H
#include "Typedefs.h"
#include "VertexStructs.h"
#include "Block.h"
/* Draws 2D isometric blocks for the hotbar and inventory UIs.

View File

@ -5,7 +5,7 @@
#include "Platform.h"
#include "World.h"
#include "ErrorHandler.h"
/* Manages lighting through a simple heightmap, where each block is either in sun or shadow. */
#include "Event.h"
Int16* Lighting_heightmap;
PackedCol shadow, shadowZSide, shadowXSide, shadowYBottom;

View File

@ -1,10 +1,9 @@
#ifndef CC_WORLDLIGHTING_H
#define CC_WORLDLIGHTING_H
#include "Typedefs.h"
#include "PackedCol.h"
#include "Event.h"
#include "GameStructs.h"
/* Manages lighting of blocks in the world.
BasicLighting: Uses a simple heightmap, where each block is either in sun or shadow.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/

View File

@ -1,6 +1,5 @@
#ifndef CC_MAP_GEN_H
#define CC_MAP_GEN_H
#include "Typedefs.h"
#include "String.h"
/* Implements flatgrass map generator, and original classic vanilla map generation.
Based on: https://github.com/UnknownShadow200/ClassicalSharp/wiki/Minecraft-Classic-map-generation-algorithm

View File

@ -1,6 +1,5 @@
#ifndef CC_MAPRENDERER_H
#define CC_MAPRENDERER_H
#include "Typedefs.h"
#include "TerrainAtlas.h"
#include "ChunkUpdater.h"
/* Renders the blocks of the world by subdividing it into chunks.

View File

@ -10,6 +10,8 @@
#include "Block.h"
#include "Stream.h"
#include "ErrorHandler.h"
#include "Entity.h"
#include "IModel.h"
UInt32 ModelCache_texCount, ModelCache_modelCount;
@ -157,13 +159,13 @@ void ChickenModel_GetPickingBounds(AABB* bb) {
void ChickenModel_DrawModel(Entity* entity) {
Gfx_BindTexture(IModel_GetTexture(entity));
IModel_DrawRotate(-entity->HeadX * MATH_DEG2RAD, 0, 0, Chicken_Head, true);
IModel_DrawRotate(-entity->HeadX * MATH_DEG2RAD, 0, 0, Chicken_Head, true);
IModel_DrawRotate(-entity->HeadX * MATH_DEG2RAD, 0, 0, Chicken_Head2, true);
IModel_DrawRotate(-entity->HeadX * MATH_DEG2RAD, 0, 0, Chicken_Head3, true);
IModel_DrawPart(Chicken_Torso);
IModel_DrawRotate(0, 0, -Math_AbsF(entity->Anim.LeftArmX), Chicken_LeftWing, false);
IModel_DrawRotate(0, 0, Math_AbsF(entity->Anim.LeftArmX), Chicken_RightWing, false);
IModel_DrawRotate(0, 0, -Math_AbsF(entity->Anim.LeftArmX), Chicken_LeftWing, false);
IModel_DrawRotate(0, 0, Math_AbsF(entity->Anim.LeftArmX), Chicken_RightWing, false);
PackedCol col = IModel_Cols[0];
UInt32 i;
@ -744,10 +746,10 @@ void HumanModel_CreateParts(IModel* m, ModelSet* set, ModelSet* set64, ModelSet*
BoxDesc_Expand(&rArm, offset);
set64->RightArmLayer = BoxDesc_BuildBox(m, &rArm);
setSlim->Head = set64->Head;
setSlim->Torso = set64->Torso;
setSlim->Hat = set64->Hat;
setSlim->LeftLeg = set64->LeftLeg;
setSlim->Head = set64->Head;
setSlim->Torso = set64->Torso;
setSlim->Hat = set64->Hat;
setSlim->LeftLeg = set64->LeftLeg;
setSlim->RightLeg = set64->RightLeg;
lArm.BodyW -= 1; lArm.X1 += (offset * 2.0f) / 16.0f;
@ -758,8 +760,8 @@ void HumanModel_CreateParts(IModel* m, ModelSet* set, ModelSet* set64, ModelSet*
BoxDesc_TexOrigin(&rArm, 40, 16);
setSlim->RightArm = BoxDesc_BuildBox(m, &rArm);
setSlim->TorsoLayer = set64->TorsoLayer;
setSlim->LeftLegLayer = set64->LeftLegLayer;
setSlim->TorsoLayer = set64->TorsoLayer;
setSlim->LeftLegLayer = set64->LeftLegLayer;
setSlim->RightLegLayer = set64->RightLegLayer;
BoxDesc_TexOrigin(&lArm, 48, 48);
@ -784,11 +786,11 @@ void HumanModel_DrawModel(Entity* entity, ModelSet* model) {
UInt8 skinType = entity->SkinType;
IModel_DrawRotate(-entity->HeadX * MATH_DEG2RAD, 0, 0, model->Head, true);
IModel_DrawPart(model->Torso);
IModel_DrawRotate(entity->Anim.LeftLegX, 0, entity->Anim.LeftLegZ, model->LeftLeg, false);
IModel_DrawRotate(entity->Anim.LeftLegX, 0, entity->Anim.LeftLegZ, model->LeftLeg, false);
IModel_DrawRotate(entity->Anim.RightLegX, 0, entity->Anim.RightLegZ, model->RightLeg, false);
IModel_Rotation = ROTATE_ORDER_XZY;
IModel_DrawRotate(entity->Anim.LeftArmX, 0, entity->Anim.LeftArmZ, model->LeftArm, false);
IModel_DrawRotate(entity->Anim.LeftArmX, 0, entity->Anim.LeftArmZ, model->LeftArm, false);
IModel_DrawRotate(entity->Anim.RightArmX, 0, entity->Anim.RightArmZ, model->RightArm, false);
IModel_Rotation = ROTATE_ORDER_ZYX;
IModel_UpdateVB();
@ -797,11 +799,11 @@ void HumanModel_DrawModel(Entity* entity, ModelSet* model) {
IModel_ActiveModel->index = 0;
if (skinType != SKIN_TYPE_64x32) {
IModel_DrawPart(model->TorsoLayer);
IModel_DrawRotate(entity->Anim.LeftLegX, 0, entity->Anim.LeftLegZ, model->LeftLegLayer, false);
IModel_DrawRotate(entity->Anim.LeftLegX, 0, entity->Anim.LeftLegZ, model->LeftLegLayer, false);
IModel_DrawRotate(entity->Anim.RightLegX, 0, entity->Anim.RightLegZ, model->RightLegLayer, false);
IModel_Rotation = ROTATE_ORDER_XZY;
IModel_DrawRotate(entity->Anim.LeftArmX, 0, entity->Anim.LeftArmZ, model->LeftArmLayer, false);
IModel_DrawRotate(entity->Anim.LeftArmX, 0, entity->Anim.LeftArmZ, model->LeftArmLayer, false);
IModel_DrawRotate(entity->Anim.RightArmX, 0, entity->Anim.RightArmZ, model->RightArmLayer, false);
IModel_Rotation = ROTATE_ORDER_ZYX;
}

View File

@ -1,12 +1,11 @@
#ifndef CC_MODELCACHE_H
#define CC_MODELCACHE_H
#include "Typedefs.h"
#include "String.h"
#include "IModel.h"
#include "VertexStructs.h"
/* Contains a cache of model instances and default textures for models.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
typedef struct IModel_ IModel;
typedef struct CachedModel_ {
String Name; /* Name associated with the model, all lowercase. */

View File

@ -473,10 +473,10 @@ void Gfx_DrawIndexedVb_TrisT2fC4b(Int32 verticesCount, Int32 startVertex) {
return;
}
UInt32 offset = startVertex * VertexP3fT2fC4b_Size;
glVertexPointer(3, GL_FLOAT, sizeof(VertexP3fT2fC4b), (void*)(offset));
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(VertexP3fT2fC4b), (void*)(offset + 12));
glTexCoordPointer(2, GL_FLOAT, sizeof(VertexP3fT2fC4b), (void*)(offset + 16));
UInt32 offset = startVertex * (UInt32)sizeof(VertexP3fT2fC4b);
glVertexPointer(3, GL_FLOAT, sizeof(VertexP3fT2fC4b), (void*)(offset));
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(VertexP3fT2fC4b), (void*)(offset + 12));
glTexCoordPointer(2, GL_FLOAT, sizeof(VertexP3fT2fC4b), (void*)(offset + 16));
glDrawElements(GL_TRIANGLES, ICOUNT(verticesCount), GL_UNSIGNED_SHORT, NULL);
}

View File

@ -1,6 +1,5 @@
#ifndef CC_OPTIONS_H
#define CC_OPTIONS_H
#include "Typedefs.h"
#include "String.h"
/* Manages loading and saving options.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_PACKEDCOL_H
#define CC_PACKEDCOL_H
#include "Typedefs.h"
#include "String.h"
/* Manipulates an ARGB colour, in a format suitable for the native 3d graphics api.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -10,6 +10,7 @@
#include "GraphicsCommon.h"
#include "Funcs.h"
#include "Game.h"
#include "Event.h"
void Particle_DoRender(Vector2* size, Vector3* pos, TextureRec* rec, PackedCol col, VertexP3fT2fC4b** vertices) {
Real32 sX = size->X * 0.5f, sY = size->Y * 0.5f;

View File

@ -1,8 +1,6 @@
#ifndef CC_PARTICLE_H
#define CC_PARTICLE_H
#include "Typedefs.h"
#include "Vectors.h"
#include "PackedCol.h"
#include "VertexStructs.h"
#include "2DStructs.h"
#include "GameStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_PHYSICS_H
#define CC_PHYSICS_H
#include "Typedefs.h"
#include "Vectors.h"
/* Contains:
- An axis aligned bounding box, and various methods related to them.

View File

@ -1,6 +1,5 @@
#ifndef CC_PICKEDPOSRENDERER_H
#define CC_PICKEDPOSRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
#include "Picking.h"
#include "Vectors.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_PICKING_H
#define CC_PICKING_H
#include "Typedefs.h"
#include "Constants.h"
#include "Vectors.h"
/* Data for picking/selecting block by the user, and clipping the camera.

View File

@ -1,6 +1,5 @@
#ifndef CC_PLATFORM_H
#define CC_PLATFORM_H
#include "Typedefs.h"
#include "Utils.h"
#include "2DStructs.h"
/* Abstracts platform specific memory management, I/O, etc.

View File

@ -1,6 +1,5 @@
#ifndef CC_SCREEN_H
#define CC_SCREEN_H
#include "Typedefs.h"
#include "Gui.h"
#include "String.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_SELECTIONBOX_H
#define CC_SELECTIONBOX_H
#include "Typedefs.h"
#include "VertexStructs.h"
#include "GameStructs.h"
#include "Vectors.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_SERVERCONNECTION_H
#define CC_SERVERCONNECTION_H
#include "Typedefs.h"
#include "String.h"
#include "Input.h"
#include "GameStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_SKYBOXRENDERER_H
#define CC_SKYBOXRENDERER_H
#include "Typedefs.h"
#include "GameStructs.h"
/* Renders a skybox.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -1,6 +1,5 @@
#ifndef CC_STREAM_H
#define CC_STREAM_H
#include "Typedefs.h"
#include "String.h"
#include "Constants.h"
/* Defines an abstract way of reading and writing data in a streaming manner.

View File

@ -1,6 +1,5 @@
#ifndef CC_TERRAINATLAS_H
#define CC_TERRAINATLAS_H
#include "Typedefs.h"
#include "Bitmap.h"
#include "2DStructs.h"
/* Represents the 2D texture atlas of terrain.png, and converted into an array of 1D textures.

View File

@ -1,6 +1,5 @@
#ifndef CC_TEXTURE_H
#define CC_TEXTURE_H
#include "Typedefs.h"
#include "PackedCol.h"
#include "2DStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_TREE_GEN_H
#define CC_TREE_GEN_H
#include "Typedefs.h"
#include "Random.h"
#include "Vectors.h"
/* Implements original classic vanilla map generation

View File

@ -1,6 +1,5 @@
#ifndef CC_UTILS_H
#define CC_UTILS_H
#include "Typedefs.h"
#include "String.h"
#include "Bitmap.h"
/* Implements various utility functions.

View File

@ -1,27 +1,15 @@
#ifndef CC_VERTEXSTRUCTS_H
#define CC_VERTEXSTRUCTS_H
#include "Typedefs.h"
#include "PackedCol.h"
/* Represents simple vertex formats.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
/* 3 floats for position (XYZ), 4 bytes for colour. */
typedef struct VertexP3fC4b_ {
Real32 X, Y, Z;
PackedCol Col;
} VertexP3fC4b;
typedef struct VertexP3fC4b_ { Real32 X, Y, Z; PackedCol Col; } VertexP3fC4b;
void VertexP3fC4b_Set(VertexP3fC4b* target, Real32 x, Real32 y, Real32 z, PackedCol col);
/* 3 * 4 + 4 * 1 */
#define VertexP3fC4b_Size 16
/* 3 floats for position (XYZ), 2 floats for texture coordinates (UV), 4 bytes for colour. */
typedef struct VertexP3fT2fC4b_ {
Real32 X, Y, Z;
PackedCol Col;
Real32 U, V;
} VertexP3fT2fC4b;
typedef struct VertexP3fT2fC4b_ { Real32 X, Y, Z; PackedCol Col; Real32 U, V; } VertexP3fT2fC4b;
void VertexP3fT2fC4b_Set(VertexP3fT2fC4b* target, Real32 x, Real32 y, Real32 z, Real32 u, Real32 v, PackedCol col);
/* 3 * 4 + 2 * 4 + 4 * 1 */
#define VertexP3fT2fC4b_Size 24
#endif

View File

@ -13,6 +13,7 @@
#include "World.h"
#include "Particle.h"
#include "ErrorHandler.h"
#include "Stream.h"
GfxResourceID weather_rainTex;
GfxResourceID weather_snowTex;
@ -173,7 +174,7 @@ void WeatherRenderer_Render(Real64 deltaTime) {
Gfx_SetAlphaArgBlend(true);
Gfx_SetBatchFormat(VERTEX_FORMAT_P3FT2FC4B);
UInt32 vCount = (UInt32)(ptr - vertices) / VertexP3fT2fC4b_Size;
UInt32 vCount = (UInt32)(ptr - vertices) / (UInt32)sizeof(VertexP3fT2fC4b);
GfxCommon_UpdateDynamicVb_IndexedTris(weather_vb, vertices, vCount);
Gfx_SetAlphaArgBlend(false);

View File

@ -1,17 +1,12 @@
#ifndef CC_WEATHERRENDERER_H
#define CC_WEATHERRENDERER_H
#include "Typedefs.h"
#include "Stream.h"
#include "GameStructs.h"
/* Renders rain and snow.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
Int16* Weather_Heightmap;
/* Creates game component implementation. */
IGameComponent WeatherRenderer_MakeGameComponent(void);
/* Invokes to update state of rain/snow heightmap when a block is changed in the world. */
void WeatherRenderer_OnBlockChanged(Int32 x, Int32 y, Int32 z, BlockID oldBlock, BlockID newBlock);
/* Renders weather in the world. */
void WeatherRenderer_Render(Real64 deltaTime);
#endif

View File

@ -1,6 +1,5 @@
#ifndef CC_WINDOW_H
#define CC_WINDOW_H
#include "Typedefs.h"
#include "String.h"
#include "Bitmap.h"
#include "2DStructs.h"

View File

@ -1,6 +1,5 @@
#ifndef CC_WORDWRAP_H
#define CC_WORDWRAP_H
#include "Typedefs.h"
#include "String.h"
/* Allows wrapping a single line of text into multiple lines.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3

View File

@ -85,24 +85,26 @@ extern PackedCol WorldEnv_DefaultFogCol = PACKEDCOL_CONST(0xFF, 0xFF, 0xFF, 0
extern PackedCol WorldEnv_DefaultCloudsCol = PACKEDCOL_CONST(0xFF, 0xFF, 0xFF, 0xFF);
extern PackedCol WorldEnv_DefaultSunCol = PACKEDCOL_CONST(0xFF, 0xFF, 0xFF, 0xFF);
extern PackedCol WorldEnv_DefaultShadowCol = PACKEDCOL_CONST(0x9B, 0x9B, 0x9B, 0xFF);
UInt8 World_TextureUrlBuffer[String_BufferSize(STRING_SIZE)];
extern String World_TextureUrl = String_FromEmptyArray(World_TextureUrlBuffer);
void WorldEnv_Reset(void) {
WorldEnv_EdgeHeight = -1;
WorldEnv_SidesOffset = -2;
WorldEnv_EdgeHeight = -1;
WorldEnv_SidesOffset = -2;
WorldEnv_CloudsHeight = -1;
WorldEnv_EdgeBlock = BLOCK_STILL_WATER;
WorldEnv_EdgeBlock = BLOCK_STILL_WATER;
WorldEnv_SidesBlock = BLOCK_BEDROCK;
WorldEnv_CloudsSpeed = 1.0f;
WorldEnv_WeatherSpeed = 1.0f;
WorldEnv_WeatherFade = 1.0f;
WorldEnv_CloudsSpeed = 1.0f;
WorldEnv_WeatherSpeed = 1.0f;
WorldEnv_WeatherFade = 1.0f;
WorldEnv_SkyboxHorSpeed = 0.0f;
WorldEnv_SkyboxVerSpeed = 0.0f;
WorldEnv_ResetLight();
WorldEnv_SkyCol = WorldEnv_DefaultSkyCol;
WorldEnv_FogCol = WorldEnv_DefaultFogCol;
WorldEnv_SkyCol = WorldEnv_DefaultSkyCol;
WorldEnv_FogCol = WorldEnv_DefaultFogCol;
WorldEnv_CloudsCol = WorldEnv_DefaultCloudsCol;
WorldEnv_Weather = WEATHER_SUNNY;
WorldEnv_ExpFog = false;

View File

@ -1,6 +1,5 @@
#ifndef CC_WORLD_H
#define CC_WORLD_H
#include "Typedefs.h"
#include "String.h"
#include "Vectors.h"
#include "PackedCol.h"
@ -8,6 +7,7 @@
Also contains associated environment metadata.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
typedef struct AABB_ AABB;
#define World_Unpack(index, x, y, z)\
x = index % World_Width;\
@ -22,8 +22,7 @@ Int32 World_Width, World_Height, World_Length;
Int32 World_MaxX, World_MaxY, World_MaxZ;
Int32 World_OneY;
UInt8 World_Uuid[16];
String World_TextureUrl;
/* TODO: how to initalise World_TextureUrl string */
extern String World_TextureUrl;
void World_Reset(void);
void World_SetNewMap(BlockID* blocks, Int32 blocksSize, Int32 width, Int32 height, Int32 length);
@ -88,7 +87,6 @@ void WorldEnv_SetCloudsCol(PackedCol col);
void WorldEnv_SetSunCol(PackedCol col);
void WorldEnv_SetShadowCol(PackedCol col);
typedef struct AABB_ AABB; /* Forward declaration */
/* Finds the highest free Y coordinate in the given bounding box.*/
Real32 Respawn_HighestFreeY(AABB* bb);
/* Finds a suitable spawn position for the entity, by iterating

View File

@ -2,6 +2,7 @@
#include "ErrorHandler.h"
#include "Platform.h"
#include "Deflate.h"
#include "Stream.h"
String Zip_ReadFixedString(Stream* stream, UInt8* buffer, UInt16 length) {
String fileName;

View File

@ -1,11 +1,10 @@
#ifndef CC_ZIPARCHIVE_H
#define CC_ZIPARCHIVE_H
#include "Typedefs.h"
#include "String.h"
#include "Stream.h"
/* Extracts entries from a .zip archive stream.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
typedef struct Stream_ Stream;
typedef struct ZipEntry_ {
Int32 CompressedDataSize, UncompressedDataSize, LocalHeaderOffset;