diff --git a/src/Client/Animations.h b/src/Client/Animations.h index fdc6859b0..3632e9528 100644 --- a/src/Client/Animations.h +++ b/src/Client/Animations.h @@ -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 diff --git a/src/Client/AsyncDownloader.h b/src/Client/AsyncDownloader.h index 2129a95d7..25e04f8a1 100644 --- a/src/Client/AsyncDownloader.h +++ b/src/Client/AsyncDownloader.h @@ -1,6 +1,5 @@ #ifndef CC_ASYNCDOWNLOADER_H #define CC_ASYNCDOWNLOADER_H -#include "Typedefs.h" #include "Constants.h" #include "Utils.h" #include "GameStructs.h" diff --git a/src/Client/AxisLinesRenderer.h b/src/Client/AxisLinesRenderer.h index ee25d75ef..369de4642 100644 --- a/src/Client/AxisLinesRenderer.h +++ b/src/Client/AxisLinesRenderer.h @@ -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 diff --git a/src/Client/BordersRenderer.h b/src/Client/BordersRenderer.h index 1b123a6e5..2bcd2bf5b 100644 --- a/src/Client/BordersRenderer.h +++ b/src/Client/BordersRenderer.h @@ -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 diff --git a/src/Client/Builder.c b/src/Client/Builder.c index 2f242df06..b32f04320 100644 --- a/src/Client/Builder.c +++ b/src/Client/Builder.c @@ -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; @@ -610,4 +648,4 @@ void NormalBuilder_SetActive(void) { Builder_StretchX = NormalBuilder_StretchX; Builder_StretchZ = NormalBuilder_StretchZ; Builder_RenderBlock = NormalBuilder_RenderBlock; -} \ No newline at end of file +} diff --git a/src/Client/Builder.h b/src/Client/Builder.h index b96cc4d63..d6688c946 100644 --- a/src/Client/Builder.h +++ b/src/Client/Builder.h @@ -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 \ No newline at end of file diff --git a/src/Client/Camera.h b/src/Client/Camera.h index 454fce791..21bef2c6b 100644 --- a/src/Client/Camera.h +++ b/src/Client/Camera.h @@ -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. diff --git a/src/Client/Chat.h b/src/Client/Chat.h index 27d72b8d9..0d029caa8 100644 --- a/src/Client/Chat.h +++ b/src/Client/Chat.h @@ -1,6 +1,5 @@ #ifndef CC_CHAT_H #define CC_CHAT_H -#include "Typedefs.h" #include "Constants.h" #include "Utils.h" #include "GameStructs.h" diff --git a/src/Client/ChunkUpdater.h b/src/Client/ChunkUpdater.h index 139c1b07d..e7ee0f0ad 100644 --- a/src/Client/ChunkUpdater.h +++ b/src/Client/ChunkUpdater.h @@ -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. diff --git a/src/Client/Deflate.h b/src/Client/Deflate.h index 630206c90..2af8e66d3 100644 --- a/src/Client/Deflate.h +++ b/src/Client/Deflate.h @@ -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 diff --git a/src/Client/Drawer.h b/src/Client/Drawer.h index 6d99efe2c..3127aac8d 100644 --- a/src/Client/Drawer.h +++ b/src/Client/Drawer.h @@ -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 diff --git a/src/Client/Drawer2D.h b/src/Client/Drawer2D.h index f41c7050f..9e5f45865 100644 --- a/src/Client/Drawer2D.h +++ b/src/Client/Drawer2D.h @@ -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. diff --git a/src/Client/Entity.c b/src/Client/Entity.c index 2560487a4..90ed95001 100644 --- a/src/Client/Entity.c +++ b/src/Client/Entity.c @@ -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" }; diff --git a/src/Client/EntityComponents.c b/src/Client/EntityComponents.c index 63c120102..0e9550b84 100644 --- a/src/Client/EntityComponents.c +++ b/src/Client/EntityComponents.c @@ -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); } \ No newline at end of file diff --git a/src/Client/EntityComponents.h b/src/Client/EntityComponents.h index 34ff1e5b0..f2635ccc5 100644 --- a/src/Client/EntityComponents.h +++ b/src/Client/EntityComponents.h @@ -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. diff --git a/src/Client/EnvRenderer.h b/src/Client/EnvRenderer.h index c06c1607d..8ca9ee041 100644 --- a/src/Client/EnvRenderer.h +++ b/src/Client/EnvRenderer.h @@ -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 diff --git a/src/Client/Event.h b/src/Client/Event.h index df4d6dc5b..1b3c5a5a0 100644 --- a/src/Client/Event.h +++ b/src/Client/Event.h @@ -1,6 +1,5 @@ #ifndef CC_EVENT_H #define CC_EVENT_H -#include "Typedefs.h" #include "String.h" #include "Stream.h" #include "Vectors.h" diff --git a/src/Client/Game.c b/src/Client/Game.c index 39e1b3918..48a389035 100644 --- a/src/Client/Game.c +++ b/src/Client/Game.c @@ -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); diff --git a/src/Client/Game.h b/src/Client/Game.h index 1b800a5b3..5f0767337 100644 --- a/src/Client/Game.h +++ b/src/Client/Game.h @@ -1,6 +1,5 @@ #ifndef CC_GAME_H #define CC_GAME_H -#include "Typedefs.h" #include "Stream.h" #include "Picking.h" #include "Options.h" diff --git a/src/Client/GameMode.h b/src/Client/GameMode.h index d98c176ee..546cda776 100644 --- a/src/Client/GameMode.h +++ b/src/Client/GameMode.h @@ -1,6 +1,5 @@ #ifndef CC_GAMEMODE_H #define CC_GAMEMODE_H -#include "Typedefs.h" #include "GameStructs.h" #include "Input.h" #include "Widgets.h" diff --git a/src/Client/GraphicsAPI.h b/src/Client/GraphicsAPI.h index adcd5e2a5..7679ab776 100644 --- a/src/Client/GraphicsAPI.h +++ b/src/Client/GraphicsAPI.h @@ -1,6 +1,5 @@ #ifndef CC_GFXAPI_H #define CC_GFXAPI_H -#include "Typedefs.h" #include "Bitmap.h" #include "PackedCol.h" #include "Vectors.h" diff --git a/src/Client/GraphicsCommon.h b/src/Client/GraphicsCommon.h index ea16d8dd8..64797b270 100644 --- a/src/Client/GraphicsCommon.h +++ b/src/Client/GraphicsCommon.h @@ -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" diff --git a/src/Client/Gui.h b/src/Client/Gui.h index d9bd6703b..889838e25 100644 --- a/src/Client/Gui.h +++ b/src/Client/Gui.h @@ -1,6 +1,5 @@ #ifndef CC_GUI_H #define CC_GUI_H -#include "Typedefs.h" #include "Input.h" #include "VertexStructs.h" #include "Texture.h" diff --git a/src/Client/HeldBlockRenderer.c b/src/Client/HeldBlockRenderer.c index 464ad9e8b..f9b883b01 100644 --- a/src/Client/HeldBlockRenderer.c +++ b/src/Client/HeldBlockRenderer.c @@ -8,6 +8,7 @@ #include "ModelCache.h" #include "ExtMath.h" #include "Event.h" +#include "Entity.h" BlockID held_block; Entity held_entity; diff --git a/src/Client/HeldBlockRenderer.h b/src/Client/HeldBlockRenderer.h index a808f5759..da6c4b667 100644 --- a/src/Client/HeldBlockRenderer.h +++ b/src/Client/HeldBlockRenderer.h @@ -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 diff --git a/src/Client/IModel.c b/src/Client/IModel.c index 6a850772a..038c4f815 100644 --- a/src/Client/IModel.c +++ b/src/Client/IModel.c @@ -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) diff --git a/src/Client/IModel.h b/src/Client/IModel.h index 78ee906fc..9bd5d6185 100644 --- a/src/Client/IModel.h +++ b/src/Client/IModel.h @@ -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) diff --git a/src/Client/Input.h b/src/Client/Input.h index b20e97fc3..a4938d0eb 100644 --- a/src/Client/Input.h +++ b/src/Client/Input.h @@ -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 diff --git a/src/Client/InputHandler.h b/src/Client/InputHandler.h index af6cddf1d..fd7f09dd8 100644 --- a/src/Client/InputHandler.h +++ b/src/Client/InputHandler.h @@ -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 diff --git a/src/Client/Inventory.h b/src/Client/Inventory.h index 1d75cd5f7..44382cb24 100644 --- a/src/Client/Inventory.h +++ b/src/Client/Inventory.h @@ -1,6 +1,5 @@ #ifndef CC_INVENTORY_H #define CC_INVENTORY_H -#include "Typedefs.h" #include "GameStructs.h" #include "BlockID.h" diff --git a/src/Client/IsometricDrawer.h b/src/Client/IsometricDrawer.h index b0ea09252..15fdcfd68 100644 --- a/src/Client/IsometricDrawer.h +++ b/src/Client/IsometricDrawer.h @@ -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. diff --git a/src/Client/Lighting.c b/src/Client/Lighting.c index 99c794c29..58cc86dd9 100644 --- a/src/Client/Lighting.c +++ b/src/Client/Lighting.c @@ -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; diff --git a/src/Client/Lighting.h b/src/Client/Lighting.h index e65c9510e..916180bf0 100644 --- a/src/Client/Lighting.h +++ b/src/Client/Lighting.h @@ -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 */ diff --git a/src/Client/MapGenerator.h b/src/Client/MapGenerator.h index ed36ae1fc..c462c055d 100644 --- a/src/Client/MapGenerator.h +++ b/src/Client/MapGenerator.h @@ -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 diff --git a/src/Client/MapRenderer.h b/src/Client/MapRenderer.h index 80d830753..330d4272c 100644 --- a/src/Client/MapRenderer.h +++ b/src/Client/MapRenderer.h @@ -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. diff --git a/src/Client/ModelCache.c b/src/Client/ModelCache.c index 897fc5ce6..b9a855cc1 100644 --- a/src/Client/ModelCache.c +++ b/src/Client/ModelCache.c @@ -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; } diff --git a/src/Client/ModelCache.h b/src/Client/ModelCache.h index a5b35f5d9..518b97eed 100644 --- a/src/Client/ModelCache.h +++ b/src/Client/ModelCache.h @@ -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. */ diff --git a/src/Client/OpenGLApi.c b/src/Client/OpenGLApi.c index 699c81f83..770dda3a3 100644 --- a/src/Client/OpenGLApi.c +++ b/src/Client/OpenGLApi.c @@ -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); } diff --git a/src/Client/Options.h b/src/Client/Options.h index 14b5f8ed1..2caa9ba20 100644 --- a/src/Client/Options.h +++ b/src/Client/Options.h @@ -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 diff --git a/src/Client/PackedCol.h b/src/Client/PackedCol.h index f6e0c395b..664e10adf 100644 --- a/src/Client/PackedCol.h +++ b/src/Client/PackedCol.h @@ -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 diff --git a/src/Client/Particle.c b/src/Client/Particle.c index 0eb789380..140865703 100644 --- a/src/Client/Particle.c +++ b/src/Client/Particle.c @@ -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; diff --git a/src/Client/Particle.h b/src/Client/Particle.h index 2ad633f6d..9fe7ad188 100644 --- a/src/Client/Particle.h +++ b/src/Client/Particle.h @@ -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" diff --git a/src/Client/Physics.h b/src/Client/Physics.h index be760bf8d..57fcb08a6 100644 --- a/src/Client/Physics.h +++ b/src/Client/Physics.h @@ -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. diff --git a/src/Client/PickedPosRenderer.h b/src/Client/PickedPosRenderer.h index 13b538b07..87190cfb5 100644 --- a/src/Client/PickedPosRenderer.h +++ b/src/Client/PickedPosRenderer.h @@ -1,6 +1,5 @@ #ifndef CC_PICKEDPOSRENDERER_H #define CC_PICKEDPOSRENDERER_H -#include "Typedefs.h" #include "GameStructs.h" #include "Picking.h" #include "Vectors.h" diff --git a/src/Client/Picking.h b/src/Client/Picking.h index f79576d3e..a5a92d667 100644 --- a/src/Client/Picking.h +++ b/src/Client/Picking.h @@ -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. diff --git a/src/Client/Platform.h b/src/Client/Platform.h index 3ab12fbab..9ed71fce4 100644 --- a/src/Client/Platform.h +++ b/src/Client/Platform.h @@ -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. diff --git a/src/Client/Screens.h b/src/Client/Screens.h index 0e7d9cfb2..b3d54d262 100644 --- a/src/Client/Screens.h +++ b/src/Client/Screens.h @@ -1,6 +1,5 @@ #ifndef CC_SCREEN_H #define CC_SCREEN_H -#include "Typedefs.h" #include "Gui.h" #include "String.h" diff --git a/src/Client/SelectionBox.h b/src/Client/SelectionBox.h index 40f06a46a..bfa78e97e 100644 --- a/src/Client/SelectionBox.h +++ b/src/Client/SelectionBox.h @@ -1,6 +1,5 @@ #ifndef CC_SELECTIONBOX_H #define CC_SELECTIONBOX_H -#include "Typedefs.h" #include "VertexStructs.h" #include "GameStructs.h" #include "Vectors.h" diff --git a/src/Client/ServerConnection.h b/src/Client/ServerConnection.h index c451a12ce..0c28028ec 100644 --- a/src/Client/ServerConnection.h +++ b/src/Client/ServerConnection.h @@ -1,6 +1,5 @@ #ifndef CC_SERVERCONNECTION_H #define CC_SERVERCONNECTION_H -#include "Typedefs.h" #include "String.h" #include "Input.h" #include "GameStructs.h" diff --git a/src/Client/SkyboxRenderer.h b/src/Client/SkyboxRenderer.h index e1dd6a416..c655d224f 100644 --- a/src/Client/SkyboxRenderer.h +++ b/src/Client/SkyboxRenderer.h @@ -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 diff --git a/src/Client/Stream.h b/src/Client/Stream.h index 6ed0737ff..6bc39b850 100644 --- a/src/Client/Stream.h +++ b/src/Client/Stream.h @@ -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. diff --git a/src/Client/TerrainAtlas.h b/src/Client/TerrainAtlas.h index 94eca76f5..6c1f3e487 100644 --- a/src/Client/TerrainAtlas.h +++ b/src/Client/TerrainAtlas.h @@ -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. diff --git a/src/Client/Texture.h b/src/Client/Texture.h index 1b27c8bfb..b9b3a8127 100644 --- a/src/Client/Texture.h +++ b/src/Client/Texture.h @@ -1,6 +1,5 @@ #ifndef CC_TEXTURE_H #define CC_TEXTURE_H -#include "Typedefs.h" #include "PackedCol.h" #include "2DStructs.h" diff --git a/src/Client/TreeGen.h b/src/Client/TreeGen.h index cf8a5710e..2702a3b65 100644 --- a/src/Client/TreeGen.h +++ b/src/Client/TreeGen.h @@ -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 diff --git a/src/Client/Utils.h b/src/Client/Utils.h index 39a99e3c3..371fb0e80 100644 --- a/src/Client/Utils.h +++ b/src/Client/Utils.h @@ -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. diff --git a/src/Client/VertexStructs.h b/src/Client/VertexStructs.h index ed7069de7..bda3d9b8e 100644 --- a/src/Client/VertexStructs.h +++ b/src/Client/VertexStructs.h @@ -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 \ No newline at end of file diff --git a/src/Client/WeatherRenderer.c b/src/Client/WeatherRenderer.c index 30fbed228..a00cd8570 100644 --- a/src/Client/WeatherRenderer.c +++ b/src/Client/WeatherRenderer.c @@ -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); diff --git a/src/Client/WeatherRenderer.h b/src/Client/WeatherRenderer.h index 60714de57..ef49def00 100644 --- a/src/Client/WeatherRenderer.h +++ b/src/Client/WeatherRenderer.h @@ -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 \ No newline at end of file diff --git a/src/Client/Window.h b/src/Client/Window.h index f9ce91e84..c474e811a 100644 --- a/src/Client/Window.h +++ b/src/Client/Window.h @@ -1,6 +1,5 @@ #ifndef CC_WINDOW_H #define CC_WINDOW_H -#include "Typedefs.h" #include "String.h" #include "Bitmap.h" #include "2DStructs.h" diff --git a/src/Client/WordWrap.h b/src/Client/WordWrap.h index 1fcd0cd2e..63b0058c8 100644 --- a/src/Client/WordWrap.h +++ b/src/Client/WordWrap.h @@ -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 diff --git a/src/Client/World.c b/src/Client/World.c index bdc112838..a501016f5 100644 --- a/src/Client/World.c +++ b/src/Client/World.c @@ -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; diff --git a/src/Client/World.h b/src/Client/World.h index dd2d458fa..e804e686d 100644 --- a/src/Client/World.h +++ b/src/Client/World.h @@ -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 diff --git a/src/Client/ZipArchive.c b/src/Client/ZipArchive.c index 16b45f4cf..26ade214a 100644 --- a/src/Client/ZipArchive.c +++ b/src/Client/ZipArchive.c @@ -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; diff --git a/src/Client/ZipArchive.h b/src/Client/ZipArchive.h index a5c090e05..c8d3d59f0 100644 --- a/src/Client/ZipArchive.h +++ b/src/Client/ZipArchive.h @@ -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;